Commit 785387f
authored
feat: Add BooleanMetaDataField to support checkbox inputs on sign-up form (#115)
* Add BooleanMetaDataField for checkbox inputs in SupaEmailAuth
This commit introduces a new BooleanMetaDataField class to support checkbox inputs
in the SupaEmailAuth component. This enhancement allows for more versatile form
creation, particularly useful for consent checkboxes or boolean preferences.
Key changes:
1. New BooleanMetaDataField class:
- Extends MetaDataField to maintain compatibility
- Supports both simple text labels and rich text labels with interactive elements
(allowing links to be inserted within the text)
- Supports semantic labeling for accessability
- Allows customization of checkbox position (leading or trailing)
- Includes a 'required' option for mandatory fields
2. Updates to SupaEmailAuth:
- Modified to handle both MetaDataField and BooleanMetaDataField
- Implemented rendering logic for checkbox fields
- Added support for rich text labels in checkboxes
- Implemented validation for required checkbox fields
3. Styling improvements:
- Ensured checkbox styling matches other form elements
- Added support for dark mode theming
- Implemented error message display for invalid checkbox fields
- Error message added to localization class
4. Documentation:
- Added comprehensive documentation for BooleanMetaDataField
- Updated existing documentation to reflect new capabilities
5. Example updates:
- Modified example code to demonstrate usage of BooleanMetaDataField
- Included examples of both simple and rich text labels
6. Backward compatibility:
- Maintained support for existing MetaDataField usage
- No breaking changes to public API
This enhancement provides developers with more flexibility in creating
sign-up forms, particularly for scenarios requiring user consent or
boolean preferences, while maintaining the existing functionality
of the SupaEmailAuth component.
* Add documentation to README and minor code cleanup1 parent a5c75b8 commit 785387f
File tree
4 files changed
+332
-44
lines changed- example/lib
- lib/src
- components
- localizations
4 files changed
+332
-44
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
41 | | - | |
42 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
43 | 75 | | |
44 | 76 | | |
45 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
33 | | - | |
34 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
35 | 40 | | |
36 | 41 | | |
37 | 42 | | |
| |||
60 | 65 | | |
61 | 66 | | |
62 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
63 | 91 | | |
64 | 92 | | |
65 | 93 | | |
| |||
76 | 104 | | |
77 | 105 | | |
78 | 106 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
90 | 156 | | |
91 | 157 | | |
92 | 158 | | |
| |||
0 commit comments