@solexllc/usx-react 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/README.md +6 -5
  2. package/dist/index.cjs +245 -162
  3. package/dist/index.js +246 -163
  4. package/package.json +4 -4
  5. package/src/components/accordion/Accordion.tsx +4 -1
  6. package/src/components/accordion/accordion.django.html +1 -1
  7. package/src/components/accordion/config.json +1 -0
  8. package/src/components/banner/Banner.tsx +3 -1
  9. package/src/components/banner/banner.django.html +1 -1
  10. package/src/components/banner/config.json +1 -0
  11. package/src/components/carousel/carousel.django-snapshot.html +0 -40
  12. package/src/components/carousel/carousel.react-snapshot.html +0 -38
  13. package/src/components/character-count/CharacterCount.tsx +3 -0
  14. package/src/components/character-count/character-count.django-snapshot.html +43 -0
  15. package/src/components/character-count/character-count.django.html +2 -2
  16. package/src/components/character-count/character-count.react-snapshot.html +37 -0
  17. package/src/components/character-count/config.json +9 -0
  18. package/src/components/checkbox/Checkbox.tsx +16 -17
  19. package/src/components/checkbox/checkbox.django-snapshot.html +18 -0
  20. package/src/components/checkbox/checkbox.django.html +6 -4
  21. package/src/components/checkbox/checkbox.react-snapshot.html +14 -0
  22. package/src/components/checkbox/config.json +4 -4
  23. package/src/components/checkbox-group/checkbox-group.django-snapshot.html +54 -0
  24. package/src/components/checkbox-group/checkbox-group.react-snapshot.html +45 -0
  25. package/src/components/code/code.django-snapshot.html +4 -6
  26. package/src/components/code/code.html +2 -2
  27. package/src/components/code/code.react-snapshot.html +2 -4
  28. package/src/components/combobox/Combobox.tsx +6 -1
  29. package/src/components/combobox/combobox.django-snapshot.html +141 -0
  30. package/src/components/combobox/combobox.django.html +2 -2
  31. package/src/components/combobox/combobox.react-snapshot.html +76 -0
  32. package/src/components/combobox/config.json +9 -0
  33. package/src/components/data-table/DataTable.tsx +4 -1
  34. package/src/components/data-table/config.json +4 -0
  35. package/src/components/data-table/data-table.django.html +1 -1
  36. package/src/components/date-picker/DatePicker.tsx +6 -1
  37. package/src/components/date-picker/config.json +9 -0
  38. package/src/components/date-picker/date-picker.django-snapshot.html +23 -0
  39. package/src/components/date-picker/date-picker.django.html +4 -4
  40. package/src/components/date-picker/date-picker.react-snapshot.html +19 -0
  41. package/src/components/date-range-picker/DateRangePicker.tsx +11 -2
  42. package/src/components/date-range-picker/config.json +14 -0
  43. package/src/components/date-range-picker/date-range-picker.django-snapshot.html +47 -0
  44. package/src/components/date-range-picker/date-range-picker.django.html +5 -5
  45. package/src/components/date-range-picker/date-range-picker.react-snapshot.html +38 -0
  46. package/src/components/drawer/Drawer.tsx +3 -1
  47. package/src/components/drawer/config.json +4 -0
  48. package/src/components/drawer/drawer.django.html +1 -1
  49. package/src/components/file-input/FileInput.tsx +7 -2
  50. package/src/components/file-input/_contents.django.html +2 -1
  51. package/src/components/file-input/config.json +4 -0
  52. package/src/components/header/Header.tsx +15 -9
  53. package/src/components/header/config.json +1 -0
  54. package/src/components/header/header.django-snapshot.html +29 -7
  55. package/src/components/header/header.django.html +8 -4
  56. package/src/components/header/header.html +21 -11
  57. package/src/components/header/header.react-snapshot.html +23 -6
  58. package/src/components/icon-list/IconList.tsx +10 -2
  59. package/src/components/icon-list/config.json +5 -1
  60. package/src/components/icon-list/icon-list.django-snapshot.html +39 -0
  61. package/src/components/icon-list/icon-list.django.html +2 -0
  62. package/src/components/icon-list/icon-list.react-snapshot.html +31 -0
  63. package/src/components/in-page-nav/InPageNav.tsx +3 -0
  64. package/src/components/in-page-nav/config.json +1 -0
  65. package/src/components/in-page-nav/in-page-nav.django.html +1 -1
  66. package/src/components/input/Input.tsx +3 -0
  67. package/src/components/input/config.json +10 -0
  68. package/src/components/input/input.django-snapshot.html +24 -0
  69. package/src/components/input/input.django.html +4 -4
  70. package/src/components/input/input.react-snapshot.html +22 -0
  71. package/src/components/language-selector/LanguageSelector.tsx +10 -5
  72. package/src/components/language-selector/config.json +1 -0
  73. package/src/components/language-selector/language-selector.django.html +2 -2
  74. package/src/components/layout/Layout.tsx +3 -1
  75. package/src/components/layout/config.json +4 -0
  76. package/src/components/layout/layout.django.html +1 -1
  77. package/src/components/list/List.tsx +10 -2
  78. package/src/components/list/config.json +5 -1
  79. package/src/components/list/list.django-snapshot.html +26 -0
  80. package/src/components/list/list.django.html +2 -0
  81. package/src/components/list/list.html +20 -0
  82. package/src/components/list/list.react-snapshot.html +20 -0
  83. package/src/components/memorable-date/MemorableDate.tsx +18 -3
  84. package/src/components/memorable-date/config.json +15 -0
  85. package/src/components/memorable-date/memorable-date.django-snapshot.html +82 -0
  86. package/src/components/memorable-date/memorable-date.django.html +14 -14
  87. package/src/components/memorable-date/memorable-date.react-snapshot.html +70 -0
  88. package/src/components/modal/Modal.tsx +3 -0
  89. package/src/components/modal/config.json +1 -0
  90. package/src/components/modal/modal.django.html +1 -1
  91. package/src/components/page/Page.tsx +16 -0
  92. package/src/components/page/config.json +18 -1
  93. package/src/components/page/page.django-snapshot.html +74 -0
  94. package/src/components/page/page.django.html +8 -0
  95. package/src/components/page/page.html +60 -0
  96. package/src/components/page/page.react-snapshot.html +60 -0
  97. package/src/components/popover/Popover.tsx +3 -0
  98. package/src/components/popover/config.json +4 -0
  99. package/src/components/popover/popover.django-snapshot.html +30 -0
  100. package/src/components/popover/popover.django.html +1 -0
  101. package/src/components/radio-buttons/RadioButtons.tsx +5 -1
  102. package/src/components/radio-buttons/radio-buttons.django-snapshot.html +65 -0
  103. package/src/components/radio-buttons/radio-buttons.django.html +1 -1
  104. package/src/components/radio-buttons/radio-buttons.react-snapshot.html +53 -0
  105. package/src/components/range-slider/RangeSlider.tsx +4 -2
  106. package/src/components/range-slider/config.json +1 -0
  107. package/src/components/range-slider/range-slider.django-snapshot.html +17 -0
  108. package/src/components/range-slider/range-slider.django.html +4 -4
  109. package/src/components/range-slider/range-slider.react-snapshot.html +16 -0
  110. package/src/components/search/Search.tsx +6 -1
  111. package/src/components/search/config.json +5 -0
  112. package/src/components/search/search.django-snapshot.html +683 -563
  113. package/src/components/search/search.django.html +1 -1
  114. package/src/components/search/search.react-snapshot.html +25 -0
  115. package/src/components/select/Select.tsx +3 -1
  116. package/src/components/select/config.json +5 -0
  117. package/src/components/select/select.django-snapshot.html +15 -0
  118. package/src/components/select/select.django.html +2 -2
  119. package/src/components/select/select.react-snapshot.html +11 -0
  120. package/src/components/switch/Switch.tsx +13 -70
  121. package/src/components/switch/config.json +60 -23
  122. package/src/components/switch/switch.django-snapshot.html +507 -56
  123. package/src/components/switch/switch.django.html +23 -26
  124. package/src/components/switch/switch.html +425 -33
  125. package/src/components/switch/switch.react-snapshot.html +447 -58
  126. package/src/components/table/Table.tsx +3 -1
  127. package/src/components/table/config.json +1 -0
  128. package/src/components/table/table.django.html +1 -1
  129. package/src/components/text-area/TextArea.tsx +3 -1
  130. package/src/components/text-area/config.json +5 -0
  131. package/src/components/text-area/text-area.django-snapshot.html +18 -0
  132. package/src/components/text-area/text-area.django.html +4 -4
  133. package/src/components/text-area/text-area.react-snapshot.html +16 -0
  134. package/src/components/theme-picker/ThemePicker.tsx +97 -52
  135. package/src/components/theme-picker/config.json +21 -5
  136. package/src/components/theme-picker/theme-picker-select.django.html +7 -0
  137. package/src/components/theme-picker/theme-picker.django-snapshot.html +158 -14
  138. package/src/components/theme-picker/theme-picker.django.html +22 -24
  139. package/src/components/theme-picker/theme-picker.html +86 -56
  140. package/src/components/theme-picker/theme-picker.react-snapshot.html +120 -12
  141. package/src/components/time-picker/TimePicker.tsx +6 -1
  142. package/src/components/time-picker/config.json +9 -0
  143. package/src/components/time-picker/time-picker.django-snapshot.html +26 -0
  144. package/src/components/time-picker/time-picker.django.html +4 -4
  145. package/src/components/time-picker/time-picker.react-snapshot.html +22 -0
@@ -1,73 +1,462 @@
1
1
  <h3 class="site-preview-heading">Default</h3>
2
- <input id="react-switch-1" type="checkbox" class="usx-switch usx-toggle-md" />
2
+ <div class="usa-form-group usx-form-group">
3
+ <div class="usa-checkbox usx-checkbox usx-switch">
4
+ <input
5
+ class="usa-checkbox__input"
6
+ id="react-example-switch-1"
7
+ type="checkbox"
8
+ name="example-1"
9
+ value="example-value-1"
10
+ /><label class="usa-checkbox__label" for="react-example-switch-1">Example Switch 1</label>
11
+ </div>
12
+ </div>
3
13
 
4
- <h3 class="site-preview-heading">XS</h3>
5
- <input id="react-switch-xs" type="checkbox" class="usx-switch usx-toggle-xs" />
14
+ <h3 class="site-preview-heading">Checked</h3>
15
+ <div class="usa-form-group usx-form-group">
16
+ <div class="usa-checkbox usx-checkbox usx-switch">
17
+ <input
18
+ class="usa-checkbox__input"
19
+ id="react-example-switch-2"
20
+ type="checkbox"
21
+ name="example-2"
22
+ checked=""
23
+ value="example-value-2"
24
+ /><label class="usa-checkbox__label" for="react-example-switch-2">Example Switch 2</label>
25
+ </div>
26
+ </div>
6
27
 
7
- <h3 class="site-preview-heading">SM</h3>
8
- <input id="react-switch-sm" type="checkbox" class="usx-switch usx-toggle-sm" />
28
+ <h3 class="site-preview-heading">Tile</h3>
29
+ <div class="usa-form-group usx-form-group">
30
+ <div class="usa-checkbox usx-checkbox usx-switch">
31
+ <input
32
+ class="usa-checkbox__input usa-checkbox__input--tile"
33
+ id="react-example-switch-3"
34
+ type="checkbox"
35
+ name="example-3"
36
+ value="example-value-3"
37
+ /><label class="usa-checkbox__label" for="react-example-switch-3">Example Switch 3</label>
38
+ </div>
39
+ </div>
9
40
 
10
- <h3 class="site-preview-heading">MD</h3>
11
- <input id="react-switch-md" type="checkbox" class="usx-switch usx-toggle-md" />
41
+ <h3 class="site-preview-heading">Description</h3>
42
+ <div class="usa-form-group usx-form-group">
43
+ <div class="usa-checkbox usx-checkbox usx-switch">
44
+ <input
45
+ class="usa-checkbox__input"
46
+ id="react-example-switch-4"
47
+ type="checkbox"
48
+ name="example-4"
49
+ value="example-value-4"
50
+ /><label class="usa-checkbox__label" for="react-example-switch-4"
51
+ >Example Switch 4<span class="usa-checkbox__label-description"
52
+ >Additional details about this setting.</span
53
+ ></label
54
+ >
55
+ </div>
56
+ </div>
12
57
 
13
- <h3 class="site-preview-heading">LG</h3>
14
- <input id="react-switch-lg" type="checkbox" class="usx-switch usx-toggle-lg" />
58
+ <h3 class="site-preview-heading">Tile With Description</h3>
59
+ <div class="usa-form-group usx-form-group">
60
+ <div class="usa-checkbox usx-checkbox usx-switch">
61
+ <input
62
+ class="usa-checkbox__input usa-checkbox__input--tile"
63
+ id="react-example-switch-5"
64
+ type="checkbox"
65
+ name="example-5"
66
+ value="example-value-5"
67
+ /><label class="usa-checkbox__label" for="react-example-switch-5"
68
+ >Example Switch 5<span class="usa-checkbox__label-description"
69
+ >Additional details about this setting.</span
70
+ ></label
71
+ >
72
+ </div>
73
+ </div>
15
74
 
16
- <h3 class="site-preview-heading">XL</h3>
17
- <input id="react-switch-xl" type="checkbox" class="usx-switch usx-toggle-xl" />
75
+ <h3 class="site-preview-heading">Disabled</h3>
76
+ <div class="usa-form-group usx-form-group">
77
+ <div class="usa-checkbox usx-checkbox usx-switch">
78
+ <input
79
+ class="usa-checkbox__input"
80
+ id="react-example-switch-6"
81
+ type="checkbox"
82
+ name="example-6"
83
+ disabled=""
84
+ value="example-value-6"
85
+ /><label class="usa-checkbox__label" for="react-example-switch-6">Example Switch 6</label>
86
+ </div>
87
+ </div>
18
88
 
19
- <h3 class="site-preview-heading">Primary</h3>
20
- <input
21
- id="react-switch-primary"
22
- type="checkbox"
23
- class="usx-switch usx-toggle-md text-primary"
24
- checked=""
25
- />
89
+ <h3 class="site-preview-heading">Disabled Checked</h3>
90
+ <div class="usa-form-group usx-form-group">
91
+ <div class="usa-checkbox usx-checkbox usx-switch">
92
+ <input
93
+ class="usa-checkbox__input"
94
+ id="react-example-switch-7"
95
+ type="checkbox"
96
+ name="example-7"
97
+ disabled=""
98
+ checked=""
99
+ value="example-value-7"
100
+ /><label class="usa-checkbox__label" for="react-example-switch-7">Example Switch 7</label>
101
+ </div>
102
+ </div>
26
103
 
27
- <h3 class="site-preview-heading">Success</h3>
28
- <input
29
- id="react-switch-success"
30
- type="checkbox"
31
- class="usx-switch usx-toggle-md text-success"
32
- checked=""
33
- />
34
-
35
- <h3 class="site-preview-heading">Warning</h3>
36
- <input
37
- id="react-switch-warning"
38
- type="checkbox"
39
- class="usx-switch usx-toggle-md text-warning"
40
- checked=""
41
- />
104
+ <h3 class="site-preview-heading">Disabled Tile</h3>
105
+ <div class="usa-form-group usx-form-group">
106
+ <div class="usa-checkbox usx-checkbox usx-switch">
107
+ <input
108
+ class="usa-checkbox__input usa-checkbox__input--tile"
109
+ id="react-example-switch-8"
110
+ type="checkbox"
111
+ name="example-8"
112
+ disabled=""
113
+ value="example-value-8"
114
+ /><label class="usa-checkbox__label" for="react-example-switch-8">Example Switch 8</label>
115
+ </div>
116
+ </div>
42
117
 
43
- <h3 class="site-preview-heading">Error</h3>
44
- <input
45
- id="react-switch-error"
46
- type="checkbox"
47
- class="usx-switch usx-toggle-md text-error"
48
- checked=""
49
- />
118
+ <h3 class="site-preview-heading">Disabled Checked Tile</h3>
119
+ <div class="usa-form-group usx-form-group">
120
+ <div class="usa-checkbox usx-checkbox usx-switch">
121
+ <input
122
+ class="usa-checkbox__input usa-checkbox__input--tile"
123
+ id="react-example-switch-9"
124
+ type="checkbox"
125
+ name="example-9"
126
+ disabled=""
127
+ checked=""
128
+ value="example-value-9"
129
+ /><label class="usa-checkbox__label" for="react-example-switch-9">Example Switch 9</label>
130
+ </div>
131
+ </div>
50
132
 
51
- <h3 class="site-preview-heading">Pre Checked</h3>
52
- <input id="react-switch-prechecked" type="checkbox" class="usx-switch usx-toggle-md" checked="" />
133
+ <h3 class="site-preview-heading">Small</h3>
134
+ <div class="usa-form-group usx-form-group">
135
+ <div class="usa-checkbox usx-checkbox usx-checkbox--small usx-switch">
136
+ <input
137
+ class="usa-checkbox__input"
138
+ id="react-example-switch-10"
139
+ type="checkbox"
140
+ name="example-10"
141
+ value="example-value-10"
142
+ /><label class="usa-checkbox__label" for="react-example-switch-10">Example Switch 10</label>
143
+ </div>
144
+ </div>
53
145
 
54
- <h3 class="site-preview-heading">Disabled</h3>
55
- <input id="react-switch-disabled" type="checkbox" class="usx-switch usx-toggle-md" disabled="" />
146
+ <h3 class="site-preview-heading">Small Tile</h3>
147
+ <div class="usa-form-group usx-form-group">
148
+ <div class="usa-checkbox usx-checkbox usx-checkbox--small usx-switch">
149
+ <input
150
+ class="usa-checkbox__input usa-checkbox__input--tile"
151
+ id="react-example-switch-11"
152
+ type="checkbox"
153
+ name="example-11"
154
+ value="example-value-11"
155
+ /><label class="usa-checkbox__label" for="react-example-switch-11">Example Switch 11</label>
156
+ </div>
157
+ </div>
56
158
 
57
- <h3 class="site-preview-heading">Disabled Checked</h3>
58
- <input
59
- id="react-switch-disabled-checked"
60
- type="checkbox"
61
- class="usx-switch usx-toggle-md"
62
- disabled=""
63
- checked=""
64
- />
65
-
66
- <h3 class="site-preview-heading">With Label</h3>
67
- <label class="usa-label usx-switch__label"
68
- ><input id="react-switch-with-label" type="checkbox" class="usx-switch usx-toggle-md" />Switch
69
- Label</label
159
+ <h3 class="site-preview-heading">Small Disabled</h3>
160
+ <div class="usa-form-group usx-form-group">
161
+ <div class="usa-checkbox usx-checkbox usx-checkbox--small usx-switch">
162
+ <input
163
+ class="usa-checkbox__input"
164
+ id="react-example-switch-12"
165
+ type="checkbox"
166
+ name="example-12"
167
+ disabled=""
168
+ value="example-value-12"
169
+ /><label class="usa-checkbox__label" for="react-example-switch-12">Example Switch 12</label>
170
+ </div>
171
+ </div>
172
+
173
+ <h3 class="site-preview-heading">Small Checked Disabled</h3>
174
+ <div class="usa-form-group usx-form-group">
175
+ <div class="usa-checkbox usx-checkbox usx-checkbox--small usx-switch">
176
+ <input
177
+ class="usa-checkbox__input"
178
+ id="react-example-switch-13"
179
+ type="checkbox"
180
+ name="example-13"
181
+ disabled=""
182
+ checked=""
183
+ value="example-value-13"
184
+ /><label class="usa-checkbox__label" for="react-example-switch-13">Example Switch 13</label>
185
+ </div>
186
+ </div>
187
+
188
+ <h3 class="site-preview-heading">Small Tile Disabled</h3>
189
+ <div class="usa-form-group usx-form-group">
190
+ <div class="usa-checkbox usx-checkbox usx-checkbox--small usx-switch">
191
+ <input
192
+ class="usa-checkbox__input usa-checkbox__input--tile"
193
+ id="react-example-switch-14"
194
+ type="checkbox"
195
+ name="example-14"
196
+ disabled=""
197
+ value="example-value-14"
198
+ /><label class="usa-checkbox__label" for="react-example-switch-14"
199
+ >Example Switch 14<span class="usa-checkbox__label-description"
200
+ >Additional details about this setting.</span
201
+ ></label
202
+ >
203
+ </div>
204
+ </div>
205
+
206
+ <h3 class="site-preview-heading">Small Checked Tile Disabled</h3>
207
+ <div class="usa-form-group usx-form-group">
208
+ <div class="usa-checkbox usx-checkbox usx-checkbox--small usx-switch">
209
+ <input
210
+ class="usa-checkbox__input usa-checkbox__input--tile"
211
+ id="react-example-switch-15"
212
+ type="checkbox"
213
+ name="example-15"
214
+ disabled=""
215
+ checked=""
216
+ value="example-value-15"
217
+ /><label class="usa-checkbox__label" for="react-example-switch-15"
218
+ >Example Switch 15<span class="usa-checkbox__label-description"
219
+ >Additional details about this setting.</span
220
+ ></label
221
+ >
222
+ </div>
223
+ </div>
224
+
225
+ <h3 class="site-preview-heading">With On Change</h3>
226
+ <div class="usa-form-group usx-form-group">
227
+ <div class="usa-checkbox usx-checkbox usx-switch">
228
+ <input
229
+ class="usa-checkbox__input"
230
+ id="react-example-switch-16"
231
+ type="checkbox"
232
+ name="example-16"
233
+ value="example-value-16"
234
+ /><label class="usa-checkbox__label" for="react-example-switch-16">Example Switch 16</label>
235
+ </div>
236
+ </div>
237
+
238
+ <h3 class="site-preview-heading">Required</h3>
239
+ <div class="usa-form-group usx-form-group">
240
+ <div class="usa-checkbox usx-checkbox usx-switch">
241
+ <input
242
+ class="usa-checkbox__input usa-checkbox__input--tile"
243
+ id="react-example-switch-17"
244
+ type="checkbox"
245
+ name="example-17"
246
+ required=""
247
+ value="example-value-17"
248
+ /><label class="usa-checkbox__label" for="react-example-switch-17"
249
+ ><abbr title="Required" class="usx-required">*</abbr> Example Switch 17<span
250
+ class="usa-checkbox__label-description"
251
+ >This setting is required.</span
252
+ ></label
253
+ >
254
+ </div>
255
+ </div>
256
+
257
+ <h3 class="site-preview-heading">Error</h3>
258
+ <div class="usa-form-group usx-form-group usa-form-group--error">
259
+ <div class="usa-checkbox usx-checkbox usx-switch">
260
+ <input
261
+ class="usa-checkbox__input usa-checkbox__input--tile"
262
+ id="react-example-switch-18"
263
+ type="checkbox"
264
+ name="example-18"
265
+ value="example-value-18"
266
+ /><label class="usa-checkbox__label" for="react-example-switch-18"
267
+ >Example Switch 18<span class="usa-checkbox__label-description"
268
+ >Please review this setting.</span
269
+ ></label
270
+ >
271
+ </div>
272
+ <span class="usa-error-message usx-error-message" role="alert"
273
+ >Choose a setting before continuing.</span
274
+ >
275
+ </div>
276
+
277
+ <h3 class="site-preview-heading">Error Without Form Group</h3>
278
+ <div class="usa-checkbox usx-checkbox usx-switch">
279
+ <input
280
+ class="usa-checkbox__input usa-checkbox__input--tile"
281
+ id="react-example-switch-19"
282
+ type="checkbox"
283
+ name="example-19"
284
+ value="example-value-19"
285
+ /><label class="usa-checkbox__label" for="react-example-switch-19"
286
+ >Example Switch 19<span class="usa-checkbox__label-description"
287
+ >Please review this setting.</span
288
+ ></label
289
+ >
290
+ </div>
291
+ <span class="usa-error-message usx-error-message" role="alert"
292
+ >Choose a setting before continuing.</span
70
293
  >
71
294
 
295
+ <h3 class="site-preview-heading">Success</h3>
296
+ <div class="usa-form-group usx-form-group">
297
+ <div class="usa-checkbox usx-checkbox usx-switch">
298
+ <input
299
+ class="usa-checkbox__input usa-checkbox__input--tile"
300
+ id="react-example-switch-20"
301
+ type="checkbox"
302
+ name="example-20"
303
+ value="example-value-20"
304
+ /><label class="usa-checkbox__label" for="react-example-switch-20"
305
+ >Example Switch 20<span class="usa-checkbox__label-description"
306
+ >Your choice has been recorded.</span
307
+ ></label
308
+ >
309
+ </div>
310
+ <span class="usa-success-message text-success" role="status">Setting saved.</span>
311
+ </div>
312
+
313
+ <h3 class="site-preview-heading">Aria Label</h3>
314
+ <div class="usa-form-group usx-form-group">
315
+ <div class="usa-checkbox usx-checkbox usx-switch">
316
+ <input
317
+ class="usa-checkbox__input"
318
+ id="react-example-switch-21"
319
+ type="checkbox"
320
+ name="example-21"
321
+ aria-label="Email notifications"
322
+ value="example-value-21"
323
+ /><label class="usa-checkbox__label" for="react-example-switch-21"></label>
324
+ </div>
325
+ </div>
326
+
327
+ <h3 class="site-preview-heading">Custom Class</h3>
328
+ <div class="usa-form-group usx-form-group">
329
+ <div class="usa-checkbox usx-checkbox usx-switch custom-switch">
330
+ <input
331
+ class="usa-checkbox__input"
332
+ id="react-example-switch-22"
333
+ type="checkbox"
334
+ name="example-22"
335
+ value="example-value-22"
336
+ /><label class="usa-checkbox__label" for="react-example-switch-22">Example Switch 22</label>
337
+ </div>
338
+ </div>
339
+
72
340
  <h3 class="site-preview-heading">Indeterminate</h3>
73
- <input type="checkbox" class="usx-switch usx-toggle-md" aria-checked="mixed" />
341
+ <div class="usa-form-group usx-form-group">
342
+ <div class="usa-checkbox usx-checkbox usx-switch">
343
+ <input
344
+ class="usa-checkbox__input"
345
+ id="react-example-switch-23"
346
+ type="checkbox"
347
+ name="example-23"
348
+ value="example-value-23"
349
+ /><label class="usa-checkbox__label" for="react-example-switch-23">Example Switch 23</label>
350
+ </div>
351
+ </div>
352
+
353
+ <h3 class="site-preview-heading">Color Success</h3>
354
+ <div class="usa-form-group usx-form-group">
355
+ <div class="usa-checkbox usx-checkbox usx-switch">
356
+ <input
357
+ class="usa-checkbox__input"
358
+ id="react-example-switch-24"
359
+ type="checkbox"
360
+ name="example-24"
361
+ checked=""
362
+ value="example-value-24"
363
+ /><label class="usa-checkbox__label before-success" for="react-example-switch-24"
364
+ >Example Switch 24</label
365
+ >
366
+ </div>
367
+ </div>
368
+
369
+ <h3 class="site-preview-heading">Color Warning</h3>
370
+ <div class="usa-form-group usx-form-group">
371
+ <div class="usa-checkbox usx-checkbox usx-switch">
372
+ <input
373
+ class="usa-checkbox__input"
374
+ id="react-example-switch-25"
375
+ type="checkbox"
376
+ name="example-25"
377
+ checked=""
378
+ value="example-value-25"
379
+ /><label class="usa-checkbox__label before-warning" for="react-example-switch-25"
380
+ >Example Switch 25</label
381
+ >
382
+ </div>
383
+ </div>
384
+
385
+ <h3 class="site-preview-heading">Color Error</h3>
386
+ <div class="usa-form-group usx-form-group">
387
+ <div class="usa-checkbox usx-checkbox usx-switch">
388
+ <input
389
+ class="usa-checkbox__input"
390
+ id="react-example-switch-26"
391
+ type="checkbox"
392
+ name="example-26"
393
+ checked=""
394
+ value="example-value-26"
395
+ /><label class="usa-checkbox__label before-error" for="react-example-switch-26"
396
+ >Example Switch 26</label
397
+ >
398
+ </div>
399
+ </div>
400
+
401
+ <h3 class="site-preview-heading">Color Secondary Tile</h3>
402
+ <div class="usa-form-group usx-form-group">
403
+ <div class="usa-checkbox usx-checkbox usx-switch">
404
+ <input
405
+ class="usa-checkbox__input usa-checkbox__input--tile"
406
+ id="react-example-switch-27"
407
+ type="checkbox"
408
+ name="example-27"
409
+ checked=""
410
+ value="example-value-27"
411
+ /><label class="usa-checkbox__label before-secondary" for="react-example-switch-27"
412
+ >Example Switch 27</label
413
+ >
414
+ </div>
415
+ </div>
416
+
417
+ <h3 class="site-preview-heading">Color Accent Cool</h3>
418
+ <div class="usa-form-group usx-form-group">
419
+ <div class="usa-checkbox usx-checkbox usx-switch">
420
+ <input
421
+ class="usa-checkbox__input"
422
+ id="react-example-switch-28"
423
+ type="checkbox"
424
+ name="example-28"
425
+ checked=""
426
+ value="example-value-28"
427
+ /><label class="usa-checkbox__label before-accent-cool" for="react-example-switch-28"
428
+ >Example Switch 28</label
429
+ >
430
+ </div>
431
+ </div>
432
+
433
+ <h3 class="site-preview-heading">Color Disabled Checked</h3>
434
+ <div class="usa-form-group usx-form-group">
435
+ <div class="usa-checkbox usx-checkbox usx-switch">
436
+ <input
437
+ class="usa-checkbox__input"
438
+ id="react-example-switch-30"
439
+ type="checkbox"
440
+ name="example-30"
441
+ disabled=""
442
+ checked=""
443
+ value="example-value-30"
444
+ /><label class="usa-checkbox__label before-error" for="react-example-switch-30"
445
+ >Example Switch 30</label
446
+ >
447
+ </div>
448
+ </div>
449
+
450
+ <h3 class="site-preview-heading">Default Checked</h3>
451
+ <div class="usa-form-group usx-form-group">
452
+ <div class="usa-checkbox usx-checkbox usx-switch">
453
+ <input
454
+ class="usa-checkbox__input"
455
+ id="react-example-switch-31"
456
+ type="checkbox"
457
+ name="example-31"
458
+ checked=""
459
+ value="example-value-31"
460
+ /><label class="usa-checkbox__label" for="react-example-switch-31">Example Switch 31</label>
461
+ </div>
462
+ </div>
@@ -11,6 +11,7 @@ export interface TableColumn {
11
11
  }
12
12
 
13
13
  export interface TableProps extends Omit<React.TableHTMLAttributes<HTMLTableElement>, 'children'> {
14
+ extraAttributes?: Record<string, unknown>;
14
15
  columns?: TableColumn[];
15
16
  data?: Record<string, React.ReactNode>[];
16
17
  caption?: React.ReactNode;
@@ -30,13 +31,14 @@ export interface TableProps extends Omit<React.TableHTMLAttributes<HTMLTableElem
30
31
  export default function Table({
31
32
  columns = [], data = [], caption, striped = false, borderless = false,
32
33
  compact = false, scrollable = false, scrollHeight, stickyHeader = false, responsive = false,
33
- className, children, ...props
34
+ className, children, extraAttributes, ...props
34
35
  }: TableProps) {
35
36
  const hasSorting = !children && columns.some((column) => column.sortable);
36
37
  const table = (
37
38
  <>
38
39
  <table
39
40
  {...props}
41
+ {...extraAttributes}
40
42
  className={classnames(
41
43
  'usa-table', 'usx-table',
42
44
  striped && 'usa-table--striped',
@@ -17,6 +17,7 @@
17
17
  "caption": "Historic U.S. documents"
18
18
  },
19
19
  "props": {
20
+ "extraAttributes": { "type": "object", "description": "Additional attributes on the USWDS enhancement target." },
20
21
  "id": { "type": "string", "description": "Optional table ID." },
21
22
  "columns": { "type": "array", "description": "Column definitions: key, header, primary (row header), sortable (USWDS sorting)." },
22
23
  "data": { "type": "array", "description": "Array of records displayed in the same order provided." },
@@ -1,6 +1,6 @@
1
1
  {% load components %}
2
2
  {% if scrollable %}<div class="usa-table-container--scrollable" tabindex="0"{% if scrollHeight %} style="height: {{ scrollHeight }}; overflow: auto"{% endif %}>{% endif %}
3
- <table{% if id %} id="{{ id }}"{% endif %} class="usa-table usx-table{% if striped %} usa-table--striped{% endif %}{% if borderless %} usa-table--borderless{% endif %}{% if compact %} usa-table--compact{% endif %}{% if stickyHeader %} usa-table--sticky-header{% endif %}{% if responsive == 'stack' %} usa-table--stacked{% elif responsive == 'stack-header' %} usa-table--stacked-header{% endif %}{% if className %} {{ className }}{% endif %}">
3
+ <table{% if id %} id="{{ id }}"{% endif %} class="usa-table usx-table{% if striped %} usa-table--striped{% endif %}{% if borderless %} usa-table--borderless{% endif %}{% if compact %} usa-table--compact{% endif %}{% if stickyHeader %} usa-table--sticky-header{% endif %}{% if responsive == 'stack' %} usa-table--stacked{% elif responsive == 'stack-header' %} usa-table--stacked-header{% endif %}{% if className %} {{ className }}{% endif %}"{% if extraAttributes %}{% for attr, value in extraAttributes.items %} {{ attr }}="{% if value is True %}true{% elif value is False %}false{% else %}{{ value }}{% endif %}"{% endfor %}{% endif %}>
4
4
  <caption class="usx-table__caption">{{ caption|default:'Data table' }}</caption>
5
5
  <thead><tr>{% for column in columns %}<th scope="col"{% if column.sortable %} data-sortable{% endif %}>{{ column.header }}</th>{% endfor %}</tr></thead>
6
6
  <tbody>
@@ -12,6 +12,7 @@ export interface TextAreaProps extends React.TextareaHTMLAttributes<HTMLTextArea
12
12
  disabled?: boolean;
13
13
  required?: boolean;
14
14
  defaultValue?: string;
15
+ value?: string;
15
16
  hint?: string;
16
17
  screenReaderOnlyLabel?: boolean;
17
18
  error?: React.ReactNode;
@@ -27,6 +28,7 @@ const TextArea: React.FC<TextAreaProps> = ({
27
28
  disabled = false,
28
29
  required = false,
29
30
  defaultValue = '',
31
+ value,
30
32
  hint = null,
31
33
  screenReaderOnlyLabel = false,
32
34
  error = null,
@@ -64,7 +66,7 @@ const TextArea: React.FC<TextAreaProps> = ({
64
66
  className={classes}
65
67
  placeholder={placeholder}
66
68
  disabled={disabled}
67
- defaultValue={props.value === undefined ? defaultValue : undefined}
69
+ {...(value !== undefined ? { value } : { defaultValue })}
68
70
  {...(required ? { required: true } : {})}
69
71
  aria-describedby={describedByParts.length ? describedByParts.join(' ') : undefined}
70
72
  aria-invalid={hasError ? 'true' : undefined}
@@ -33,6 +33,11 @@
33
33
  "default": "",
34
34
  "description": "Initial value of the textarea."
35
35
  },
36
+ "value": {
37
+ "type": "string",
38
+ "default": null,
39
+ "description": "Current textarea value. Takes precedence over defaultValue."
40
+ },
36
41
  "error": {
37
42
  "type": [
38
43
  "string",
@@ -125,3 +125,21 @@
125
125
  disabled
126
126
  ></textarea>
127
127
  </div>
128
+
129
+ <h3 class="site-preview-heading">Value</h3>
130
+ <div class="usa-form-group usx-form-group">
131
+ <label class="usa-label usx-label" for="django-text-area-value"> Current value </label>
132
+
133
+ <textarea class="usa-textarea usx-textarea" id="django-text-area-value" placeholder="">
134
+ Current text</textarea
135
+ >
136
+ </div>
137
+
138
+ <h3 class="site-preview-heading">Default Value</h3>
139
+ <div class="usa-form-group usx-form-group">
140
+ <label class="usa-label usx-label" for="django-text-area-default-value"> Initial value </label>
141
+
142
+ <textarea class="usa-textarea usx-textarea" id="django-text-area-default-value" placeholder="">
143
+ Editable initial text</textarea
144
+ >
145
+ </div>
@@ -16,7 +16,7 @@
16
16
  {% endif %}
17
17
  <textarea
18
18
  class="usa-textarea usx-textarea{% if error %} usa-input--error{% elif success %} usa-input--success{% endif %}{% if className %} {{ className }}{% endif %}"
19
- id="{{ field_id }}"
19
+ id="{{ field_id }}"{% if extraAttributes %}{% for attr, value in extraAttributes.items %} {{ attr }}="{% if value is True %}true{% elif value is False %}false{% else %}{{ value }}{% endif %}"{% endfor %}{% endif %}
20
20
  placeholder="{{ placeholder|default:'' }}"
21
21
  {% if maxlength %}maxlength="{{ maxlength }}" {% endif %}
22
22
  {% if hint or describedBy or error and error != "true" and error != True and error != "false" %}aria-describedby="{% if describedBy %}{{ describedBy }} {% endif %}{% if hint %}{{ field_id }}-hint {% endif %}{% if error and error != "true" and error != True and error != "false" %}{{ field_id }}-error {% endif %}"
@@ -24,7 +24,7 @@
24
24
  {% if error and error != "false" %}aria-invalid="true" {% endif %}
25
25
  {% if disabled %}disabled {% endif %}
26
26
  {% if required %}required{% endif %}
27
- >{{ defaultValue|default:'' }}</textarea>
27
+ >{% if value is not None %}{{ value }}{% else %}{{ defaultValue|default:'' }}{% endif %}</textarea>
28
28
  {% endform_group %}
29
29
  {% else %}
30
30
  {% if label %}
@@ -38,7 +38,7 @@
38
38
  {% endif %}
39
39
  <textarea
40
40
  class="usa-textarea usx-textarea{% if error %} usa-input--error{% elif success %} usa-input--success{% endif %}{% if className %} {{ className }}{% endif %}"
41
- id="{{ field_id }}"
41
+ id="{{ field_id }}"{% if extraAttributes %}{% for attr, value in extraAttributes.items %} {{ attr }}="{% if value is True %}true{% elif value is False %}false{% else %}{{ value }}{% endif %}"{% endfor %}{% endif %}
42
42
  placeholder="{{ placeholder|default:'' }}"
43
43
  {% if maxlength %}maxlength="{{ maxlength }}" {% endif %}
44
44
  {% if hint or describedBy or error and error != "true" and error != True and error != "false" %}aria-describedby="{% if describedBy %}{{ describedBy }} {% endif %}{% if hint %}{{ field_id }}-hint {% endif %}{% if error and error != "true" and error != True and error != "false" %}{{ field_id }}-error {% endif %}"
@@ -46,7 +46,7 @@
46
46
  {% if error and error != "false" %}aria-invalid="true" {% endif %}
47
47
  {% if disabled %}disabled {% endif %}
48
48
  {% if required %}required{% endif %}
49
- >{{ defaultValue|default:'' }}</textarea>
49
+ >{% if value is not None %}{{ value }}{% else %}{{ defaultValue|default:'' }}{% endif %}</textarea>
50
50
  {% endif %}
51
51
 
52
52
  {% endwith %}