@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.
- package/README.md +6 -5
- package/dist/index.cjs +245 -162
- package/dist/index.js +246 -163
- package/package.json +4 -4
- package/src/components/accordion/Accordion.tsx +4 -1
- package/src/components/accordion/accordion.django.html +1 -1
- package/src/components/accordion/config.json +1 -0
- package/src/components/banner/Banner.tsx +3 -1
- package/src/components/banner/banner.django.html +1 -1
- package/src/components/banner/config.json +1 -0
- package/src/components/carousel/carousel.django-snapshot.html +0 -40
- package/src/components/carousel/carousel.react-snapshot.html +0 -38
- package/src/components/character-count/CharacterCount.tsx +3 -0
- package/src/components/character-count/character-count.django-snapshot.html +43 -0
- package/src/components/character-count/character-count.django.html +2 -2
- package/src/components/character-count/character-count.react-snapshot.html +37 -0
- package/src/components/character-count/config.json +9 -0
- package/src/components/checkbox/Checkbox.tsx +16 -17
- package/src/components/checkbox/checkbox.django-snapshot.html +18 -0
- package/src/components/checkbox/checkbox.django.html +6 -4
- package/src/components/checkbox/checkbox.react-snapshot.html +14 -0
- package/src/components/checkbox/config.json +4 -4
- package/src/components/checkbox-group/checkbox-group.django-snapshot.html +54 -0
- package/src/components/checkbox-group/checkbox-group.react-snapshot.html +45 -0
- package/src/components/code/code.django-snapshot.html +4 -6
- package/src/components/code/code.html +2 -2
- package/src/components/code/code.react-snapshot.html +2 -4
- package/src/components/combobox/Combobox.tsx +6 -1
- package/src/components/combobox/combobox.django-snapshot.html +141 -0
- package/src/components/combobox/combobox.django.html +2 -2
- package/src/components/combobox/combobox.react-snapshot.html +76 -0
- package/src/components/combobox/config.json +9 -0
- package/src/components/data-table/DataTable.tsx +4 -1
- package/src/components/data-table/config.json +4 -0
- package/src/components/data-table/data-table.django.html +1 -1
- package/src/components/date-picker/DatePicker.tsx +6 -1
- package/src/components/date-picker/config.json +9 -0
- package/src/components/date-picker/date-picker.django-snapshot.html +23 -0
- package/src/components/date-picker/date-picker.django.html +4 -4
- package/src/components/date-picker/date-picker.react-snapshot.html +19 -0
- package/src/components/date-range-picker/DateRangePicker.tsx +11 -2
- package/src/components/date-range-picker/config.json +14 -0
- package/src/components/date-range-picker/date-range-picker.django-snapshot.html +47 -0
- package/src/components/date-range-picker/date-range-picker.django.html +5 -5
- package/src/components/date-range-picker/date-range-picker.react-snapshot.html +38 -0
- package/src/components/drawer/Drawer.tsx +3 -1
- package/src/components/drawer/config.json +4 -0
- package/src/components/drawer/drawer.django.html +1 -1
- package/src/components/file-input/FileInput.tsx +7 -2
- package/src/components/file-input/_contents.django.html +2 -1
- package/src/components/file-input/config.json +4 -0
- package/src/components/header/Header.tsx +15 -9
- package/src/components/header/config.json +1 -0
- package/src/components/header/header.django-snapshot.html +29 -7
- package/src/components/header/header.django.html +8 -4
- package/src/components/header/header.html +21 -11
- package/src/components/header/header.react-snapshot.html +23 -6
- package/src/components/icon-list/IconList.tsx +10 -2
- package/src/components/icon-list/config.json +5 -1
- package/src/components/icon-list/icon-list.django-snapshot.html +39 -0
- package/src/components/icon-list/icon-list.django.html +2 -0
- package/src/components/icon-list/icon-list.react-snapshot.html +31 -0
- package/src/components/in-page-nav/InPageNav.tsx +3 -0
- package/src/components/in-page-nav/config.json +1 -0
- package/src/components/in-page-nav/in-page-nav.django.html +1 -1
- package/src/components/input/Input.tsx +3 -0
- package/src/components/input/config.json +10 -0
- package/src/components/input/input.django-snapshot.html +24 -0
- package/src/components/input/input.django.html +4 -4
- package/src/components/input/input.react-snapshot.html +22 -0
- package/src/components/language-selector/LanguageSelector.tsx +10 -5
- package/src/components/language-selector/config.json +1 -0
- package/src/components/language-selector/language-selector.django.html +2 -2
- package/src/components/layout/Layout.tsx +3 -1
- package/src/components/layout/config.json +4 -0
- package/src/components/layout/layout.django.html +1 -1
- package/src/components/list/List.tsx +10 -2
- package/src/components/list/config.json +5 -1
- package/src/components/list/list.django-snapshot.html +26 -0
- package/src/components/list/list.django.html +2 -0
- package/src/components/list/list.html +20 -0
- package/src/components/list/list.react-snapshot.html +20 -0
- package/src/components/memorable-date/MemorableDate.tsx +18 -3
- package/src/components/memorable-date/config.json +15 -0
- package/src/components/memorable-date/memorable-date.django-snapshot.html +82 -0
- package/src/components/memorable-date/memorable-date.django.html +14 -14
- package/src/components/memorable-date/memorable-date.react-snapshot.html +70 -0
- package/src/components/modal/Modal.tsx +3 -0
- package/src/components/modal/config.json +1 -0
- package/src/components/modal/modal.django.html +1 -1
- package/src/components/page/Page.tsx +16 -0
- package/src/components/page/config.json +18 -1
- package/src/components/page/page.django-snapshot.html +74 -0
- package/src/components/page/page.django.html +8 -0
- package/src/components/page/page.html +60 -0
- package/src/components/page/page.react-snapshot.html +60 -0
- package/src/components/popover/Popover.tsx +3 -0
- package/src/components/popover/config.json +4 -0
- package/src/components/popover/popover.django-snapshot.html +30 -0
- package/src/components/popover/popover.django.html +1 -0
- package/src/components/radio-buttons/RadioButtons.tsx +5 -1
- package/src/components/radio-buttons/radio-buttons.django-snapshot.html +65 -0
- package/src/components/radio-buttons/radio-buttons.django.html +1 -1
- package/src/components/radio-buttons/radio-buttons.react-snapshot.html +53 -0
- package/src/components/range-slider/RangeSlider.tsx +4 -2
- package/src/components/range-slider/config.json +1 -0
- package/src/components/range-slider/range-slider.django-snapshot.html +17 -0
- package/src/components/range-slider/range-slider.django.html +4 -4
- package/src/components/range-slider/range-slider.react-snapshot.html +16 -0
- package/src/components/search/Search.tsx +6 -1
- package/src/components/search/config.json +5 -0
- package/src/components/search/search.django-snapshot.html +683 -563
- package/src/components/search/search.django.html +1 -1
- package/src/components/search/search.react-snapshot.html +25 -0
- package/src/components/select/Select.tsx +3 -1
- package/src/components/select/config.json +5 -0
- package/src/components/select/select.django-snapshot.html +15 -0
- package/src/components/select/select.django.html +2 -2
- package/src/components/select/select.react-snapshot.html +11 -0
- package/src/components/switch/Switch.tsx +13 -70
- package/src/components/switch/config.json +60 -23
- package/src/components/switch/switch.django-snapshot.html +507 -56
- package/src/components/switch/switch.django.html +23 -26
- package/src/components/switch/switch.html +425 -33
- package/src/components/switch/switch.react-snapshot.html +447 -58
- package/src/components/table/Table.tsx +3 -1
- package/src/components/table/config.json +1 -0
- package/src/components/table/table.django.html +1 -1
- package/src/components/text-area/TextArea.tsx +3 -1
- package/src/components/text-area/config.json +5 -0
- package/src/components/text-area/text-area.django-snapshot.html +18 -0
- package/src/components/text-area/text-area.django.html +4 -4
- package/src/components/text-area/text-area.react-snapshot.html +16 -0
- package/src/components/theme-picker/ThemePicker.tsx +97 -52
- package/src/components/theme-picker/config.json +21 -5
- package/src/components/theme-picker/theme-picker-select.django.html +7 -0
- package/src/components/theme-picker/theme-picker.django-snapshot.html +158 -14
- package/src/components/theme-picker/theme-picker.django.html +22 -24
- package/src/components/theme-picker/theme-picker.html +86 -56
- package/src/components/theme-picker/theme-picker.react-snapshot.html +120 -12
- package/src/components/time-picker/TimePicker.tsx +6 -1
- package/src/components/time-picker/config.json +9 -0
- package/src/components/time-picker/time-picker.django-snapshot.html +26 -0
- package/src/components/time-picker/time-picker.django.html +4 -4
- package/src/components/time-picker/time-picker.react-snapshot.html +22 -0
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
"endHint": "mm/dd/yyyy"
|
|
12
12
|
},
|
|
13
13
|
"props": {
|
|
14
|
+
"extraAttributes": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"description": "Additional attributes on the USWDS enhancement target."
|
|
17
|
+
},
|
|
14
18
|
"startId": {
|
|
15
19
|
"type": "string",
|
|
16
20
|
"default": "event-date-start",
|
|
@@ -71,10 +75,20 @@
|
|
|
71
75
|
"type": "string",
|
|
72
76
|
"description": "Initial start date (yyyy-mm-dd). Sets data-default-value on the start usa-date-picker wrapper."
|
|
73
77
|
},
|
|
78
|
+
"startDate": {
|
|
79
|
+
"type": "string",
|
|
80
|
+
"default": null,
|
|
81
|
+
"description": "Start date used to initialize the USWDS date picker, taking precedence over defaultStartDate."
|
|
82
|
+
},
|
|
74
83
|
"defaultEndDate": {
|
|
75
84
|
"type": "string",
|
|
76
85
|
"description": "Initial end date (yyyy-mm-dd). Sets data-default-value on the end usa-date-picker wrapper."
|
|
77
86
|
},
|
|
87
|
+
"endDate": {
|
|
88
|
+
"type": "string",
|
|
89
|
+
"default": null,
|
|
90
|
+
"description": "End date used to initialize the USWDS date picker, taking precedence over defaultEndDate."
|
|
91
|
+
},
|
|
78
92
|
"minDate": {
|
|
79
93
|
"type": "string",
|
|
80
94
|
"description": "Earliest selectable date (yyyy-mm-dd). Sets data-min-date on the usa-date-range-picker wrapper."
|
|
@@ -299,3 +299,50 @@
|
|
|
299
299
|
</div>
|
|
300
300
|
</div>
|
|
301
301
|
</div>
|
|
302
|
+
|
|
303
|
+
<h3 class="site-preview-heading">With Values</h3>
|
|
304
|
+
<div class="usa-date-range-picker usx-date-range-picker">
|
|
305
|
+
<div class="usa-form-group usx-form-group">
|
|
306
|
+
<label
|
|
307
|
+
id="django-event-date-value-start-label"
|
|
308
|
+
class="usa-label usx-label"
|
|
309
|
+
for="django-event-date-value-start"
|
|
310
|
+
>
|
|
311
|
+
Event start date
|
|
312
|
+
</label>
|
|
313
|
+
|
|
314
|
+
<span class="usa-hint usx-hint" id="django-event-date-value-start-hint">mm/dd/yyyy</span>
|
|
315
|
+
|
|
316
|
+
<div class="usa-date-picker usx-date-picker" data-default-value="2021-06-20">
|
|
317
|
+
<input
|
|
318
|
+
class="usa-input usx-input"
|
|
319
|
+
id="django-event-date-value-start"
|
|
320
|
+
name="event-date-value-start"
|
|
321
|
+
aria-labelledby="django-event-date-value-start-label"
|
|
322
|
+
aria-describedby="django-event-date-value-start-hint"
|
|
323
|
+
/>
|
|
324
|
+
</div>
|
|
325
|
+
</div>
|
|
326
|
+
|
|
327
|
+
<div class="usa-form-group usx-form-group">
|
|
328
|
+
<label
|
|
329
|
+
id="django-event-date-value-end-label"
|
|
330
|
+
class="usa-label usx-label"
|
|
331
|
+
for="django-event-date-value-end"
|
|
332
|
+
>
|
|
333
|
+
Event end date
|
|
334
|
+
</label>
|
|
335
|
+
|
|
336
|
+
<span class="usa-hint usx-hint" id="django-event-date-value-end-hint">mm/dd/yyyy</span>
|
|
337
|
+
|
|
338
|
+
<div class="usa-date-picker usx-date-picker" data-default-value="2021-06-27">
|
|
339
|
+
<input
|
|
340
|
+
class="usa-input usx-input"
|
|
341
|
+
id="django-event-date-value-end"
|
|
342
|
+
name="event-date-value-end"
|
|
343
|
+
aria-labelledby="django-event-date-value-end-label"
|
|
344
|
+
aria-describedby="django-event-date-value-end-hint"
|
|
345
|
+
/>
|
|
346
|
+
</div>
|
|
347
|
+
</div>
|
|
348
|
+
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{# Django template for DateRangePicker #}
|
|
2
2
|
{% load usx_components %}
|
|
3
3
|
<div
|
|
4
|
-
class="usa-date-range-picker usx-date-range-picker{% if className %} {{ className }}{% endif %}"
|
|
4
|
+
class="usa-date-range-picker usx-date-range-picker{% 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 %}
|
|
5
5
|
{% if minDate %} data-min-date="{{ minDate }}"{% endif %}
|
|
6
6
|
{% if maxDate %} data-max-date="{{ maxDate }}"{% endif %}
|
|
7
7
|
>
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
{% endif %}
|
|
20
20
|
|
|
21
21
|
<div
|
|
22
|
-
class="usa-date-picker usx-date-picker"
|
|
23
|
-
{% if defaultStartDate %} data-default-value="{{ defaultStartDate }}"{% endif %}
|
|
22
|
+
class="usa-date-picker usx-date-picker"{% if extraAttributes %}{% for attr, value in extraAttributes.items %}{% if attr == "data-enhanced" %} data-enhanced="{{ value }}"{% endif %}{% endfor %}{% endif %}
|
|
23
|
+
{% if startDate is not None and startDate or startDate is None and defaultStartDate %} data-default-value="{% if startDate is not None %}{{ startDate }}{% else %}{{ defaultStartDate }}{% endif %}"{% endif %}
|
|
24
24
|
>
|
|
25
25
|
<input
|
|
26
26
|
class="usa-input usx-input"
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
{% endif %}
|
|
49
49
|
|
|
50
50
|
<div
|
|
51
|
-
class="usa-date-picker usx-date-picker"
|
|
52
|
-
{% if defaultEndDate %} data-default-value="{{ defaultEndDate }}"{% endif %}
|
|
51
|
+
class="usa-date-picker usx-date-picker"{% if extraAttributes %}{% for attr, value in extraAttributes.items %}{% if attr == "data-enhanced" %} data-enhanced="{{ value }}"{% endif %}{% endfor %}{% endif %}
|
|
52
|
+
{% if endDate is not None and endDate or endDate is None and defaultEndDate %} data-default-value="{% if endDate is not None %}{{ endDate }}{% else %}{{ defaultEndDate }}{% endif %}"{% endif %}
|
|
53
53
|
>
|
|
54
54
|
<input
|
|
55
55
|
class="usa-input usx-input"
|
|
@@ -244,3 +244,41 @@
|
|
|
244
244
|
</div>
|
|
245
245
|
</div>
|
|
246
246
|
</div>
|
|
247
|
+
|
|
248
|
+
<h3 class="site-preview-heading">With Values</h3>
|
|
249
|
+
<div class="usa-date-range-picker usx-date-range-picker">
|
|
250
|
+
<div class="usa-form-group usx-form-group">
|
|
251
|
+
<label
|
|
252
|
+
id="react-event-date-value-start-label"
|
|
253
|
+
class="usa-label usx-label"
|
|
254
|
+
for="react-event-date-value-start"
|
|
255
|
+
>Event start date</label
|
|
256
|
+
><span class="usa-hint usx-hint" id="react-event-date-value-start-hint">mm/dd/yyyy</span>
|
|
257
|
+
<div class="usa-date-picker usx-date-picker" data-default-value="2021-06-20">
|
|
258
|
+
<input
|
|
259
|
+
class="usa-input usx-input"
|
|
260
|
+
id="react-event-date-value-start"
|
|
261
|
+
name="event-date-value-start"
|
|
262
|
+
aria-labelledby="react-event-date-value-start-label"
|
|
263
|
+
aria-describedby="react-event-date-value-start-hint"
|
|
264
|
+
/>
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
<div class="usa-form-group usx-form-group">
|
|
268
|
+
<label
|
|
269
|
+
id="react-event-date-value-end-label"
|
|
270
|
+
class="usa-label usx-label"
|
|
271
|
+
for="react-event-date-value-end"
|
|
272
|
+
>Event end date</label
|
|
273
|
+
><span class="usa-hint usx-hint" id="react-event-date-value-end-hint">mm/dd/yyyy</span>
|
|
274
|
+
<div class="usa-date-picker usx-date-picker" data-default-value="2021-06-27">
|
|
275
|
+
<input
|
|
276
|
+
class="usa-input usx-input"
|
|
277
|
+
id="react-event-date-value-end"
|
|
278
|
+
name="event-date-value-end"
|
|
279
|
+
aria-labelledby="react-event-date-value-end-label"
|
|
280
|
+
aria-describedby="react-event-date-value-end-hint"
|
|
281
|
+
/>
|
|
282
|
+
</div>
|
|
283
|
+
</div>
|
|
284
|
+
</div>
|
|
@@ -40,6 +40,7 @@ export interface DrawerProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
40
40
|
disabled?: boolean;
|
|
41
41
|
triggerClassName?: string;
|
|
42
42
|
panelClassName?: string;
|
|
43
|
+
extraAttributes?: Record<string, unknown>;
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
/** A native dialog drawer with declarative open and close controls. */
|
|
@@ -62,6 +63,7 @@ export default function Drawer({
|
|
|
62
63
|
className,
|
|
63
64
|
triggerClassName,
|
|
64
65
|
panelClassName,
|
|
66
|
+
extraAttributes,
|
|
65
67
|
...props
|
|
66
68
|
}: DrawerProps) {
|
|
67
69
|
// Lowercase native attributes work with React 18 and its current DOM typings.
|
|
@@ -72,7 +74,7 @@ export default function Drawer({
|
|
|
72
74
|
};
|
|
73
75
|
|
|
74
76
|
return (
|
|
75
|
-
<div {...props} className={ClassNames('usx-drawer', className)}>
|
|
77
|
+
<div {...props} className={ClassNames('usx-drawer', className)} {...extraAttributes}>
|
|
76
78
|
<button
|
|
77
79
|
type="button"
|
|
78
80
|
className={triggerClassName || undefined}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{% load usx_components %}
|
|
2
2
|
<!-- prettier-ignore -->
|
|
3
|
-
<div class="usx-drawer{% if className %} {{ className }}{% endif %}">
|
|
3
|
+
<div class="usx-drawer{% 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
|
<button
|
|
5
5
|
type="button"
|
|
6
6
|
{% if triggerClassName %}class="{{ triggerClassName|force_escape }}"
|
|
@@ -27,6 +27,7 @@ export interface FileInputProps extends Omit<React.InputHTMLAttributes<HTMLInput
|
|
|
27
27
|
onFilesChange?: ((files: File[]) => void) | null;
|
|
28
28
|
defaultFiles?: FileInputDefaultFile[];
|
|
29
29
|
formGroup?: boolean;
|
|
30
|
+
extraAttributes?: Record<string, unknown>;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
// Mirrors USWDS's own default aria-label text (see updateVisibleInstructions
|
|
@@ -59,6 +60,7 @@ export default function FileInput({
|
|
|
59
60
|
onFilesChange = null,
|
|
60
61
|
defaultFiles = [],
|
|
61
62
|
formGroup = true,
|
|
63
|
+
extraAttributes,
|
|
62
64
|
...props
|
|
63
65
|
}: FileInputProps) {
|
|
64
66
|
const hintId = hint ? `${id}-hint` : undefined;
|
|
@@ -71,6 +73,7 @@ export default function FileInput({
|
|
|
71
73
|
// and always looks ready for the next file. The actual selection lives in
|
|
72
74
|
// the FileList below, which owns its own Delete action.
|
|
73
75
|
const isManagedMultiple = multiple && manageIndividualFiles;
|
|
76
|
+
const usxManagedDisabled = extraAttributes?.['usx-data-enhanced'] === 'true';
|
|
74
77
|
const nextFileId = useRef(0);
|
|
75
78
|
// defaultFiles seeds rows for files that already exist on the server (no
|
|
76
79
|
// File object) — e.g. previously-submitted uploads. Uncontrolled: only read
|
|
@@ -137,6 +140,7 @@ export default function FileInput({
|
|
|
137
140
|
required={required}
|
|
138
141
|
{...(invalidFileTypeMessage ? { 'data-errormessage': invalidFileTypeMessage } : {})}
|
|
139
142
|
{...props}
|
|
143
|
+
{...extraAttributes}
|
|
140
144
|
/>
|
|
141
145
|
</>
|
|
142
146
|
);
|
|
@@ -148,7 +152,7 @@ export default function FileInput({
|
|
|
148
152
|
{commonLabel}
|
|
149
153
|
{commonHint}
|
|
150
154
|
{commonError}
|
|
151
|
-
<div className="usx-file-input__add-only" data-usx-file-list-hint={typeof fileListHint === 'string' && fileListHint ? fileListHint : 'Selected files'}>
|
|
155
|
+
<div className="usx-file-input__add-only" {...(usxManagedDisabled ? { 'usx-data-enhanced': 'true' } : {})} data-usx-file-list-hint={typeof fileListHint === 'string' && fileListHint ? fileListHint : 'Selected files'}>
|
|
152
156
|
<input
|
|
153
157
|
ref={(node) => { if (node) (node as HTMLInputElement & { usxReactManaged?: boolean }).usxReactManaged = true; }}
|
|
154
158
|
className={ClassNames('usa-file-input', 'usx-file-input', className)}
|
|
@@ -162,7 +166,8 @@ export default function FileInput({
|
|
|
162
166
|
required={required && managedFiles.length === 0}
|
|
163
167
|
{...(invalidFileTypeMessage ? { 'data-errormessage': invalidFileTypeMessage } : {})}
|
|
164
168
|
{...props}
|
|
165
|
-
|
|
169
|
+
{...extraAttributes}
|
|
170
|
+
onChange={usxManagedDisabled ? undefined : addFiles}
|
|
166
171
|
/>
|
|
167
172
|
</div>
|
|
168
173
|
<FileList files={managedFiles} hint={fileListHint} onRemove={removeFile} disabled={disabled} />
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
{% if error %}
|
|
9
9
|
{% error_message id=id|add:"-error" %}{{ error }}{% enderror_message %}
|
|
10
10
|
{% endif %}
|
|
11
|
-
{% if multiple and manageIndividualFiles %}<div class="usx-file-input__add-only" data-usx-file-list-hint="{{ fileListHint|default:'Selected files' }}">{% endif %}
|
|
11
|
+
{% if multiple and manageIndividualFiles %}<div class="usx-file-input__add-only"{% if extraAttributes %}{% for attr, value in extraAttributes.items %}{% if attr == 'usx-data-enhanced' %} usx-data-enhanced="{{ value }}"{% endif %}{% endfor %}{% endif %} data-usx-file-list-hint="{{ fileListHint|default:'Selected files' }}">{% endif %}
|
|
12
12
|
<input
|
|
13
13
|
class="usa-file-input usx-file-input{% if className %} {{ className }}{% endif %}"
|
|
14
14
|
id="{{ id }}"
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
{% if invalidFileTypeMessage %} data-errormessage="{{ invalidFileTypeMessage }}"{% endif %}
|
|
21
21
|
{% if disabled %} disabled{% endif %}
|
|
22
22
|
{% if required %}{% if multiple and manageIndividualFiles %}{% if not defaultFiles %} required{% endif %}{% else %} required{% endif %}{% endif %}
|
|
23
|
+
{% if extraAttributes %}{% for attr, value in extraAttributes.items %} {{ attr }}="{% if value is True %}true{% elif value is False %}false{% else %}{{ value }}{% endif %}"{% endfor %}{% endif %}
|
|
23
24
|
/>
|
|
24
25
|
{% if multiple and manageIndividualFiles %}
|
|
25
26
|
</div>
|
|
@@ -79,6 +79,10 @@
|
|
|
79
79
|
"onFilesChange": {
|
|
80
80
|
"type": "function",
|
|
81
81
|
"description": "Receives the current browser File objects after managed add or delete. React calls this function; Django dispatches a bubbling usx:files-change event from the input with detail.files. Preloaded files are excluded."
|
|
82
|
+
},
|
|
83
|
+
"extraAttributes": {
|
|
84
|
+
"type": "object",
|
|
85
|
+
"description": "Additional HTML attributes on the file input."
|
|
82
86
|
}
|
|
83
87
|
}
|
|
84
88
|
}
|
|
@@ -158,6 +158,7 @@ function PrimaryNav({
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
export interface HeaderProps extends React.HTMLAttributes<HTMLElement> {
|
|
161
|
+
extraAttributes?: Record<string, unknown>;
|
|
161
162
|
id?: string;
|
|
162
163
|
branding: BrandingProps;
|
|
163
164
|
staticBaseUrl?: string;
|
|
@@ -191,6 +192,7 @@ export default function Header({
|
|
|
191
192
|
className = '',
|
|
192
193
|
utilityContent = null,
|
|
193
194
|
navEndContent = null,
|
|
195
|
+
extraAttributes,
|
|
194
196
|
...props
|
|
195
197
|
}: HeaderProps) {
|
|
196
198
|
const headerClasses = ClassNames(
|
|
@@ -207,23 +209,27 @@ export default function Header({
|
|
|
207
209
|
'usx-nav',
|
|
208
210
|
{ 'usx-nav--sticky': stickyNav },
|
|
209
211
|
);
|
|
212
|
+
const hasNavigation = navSections.length > 0 || Boolean(searchProps || utilityContent ||
|
|
213
|
+
(extended && (secondaryLinks.length > 0 || navEndContent)));
|
|
210
214
|
|
|
211
215
|
const navbar = (
|
|
212
216
|
<div className="usa-navbar">
|
|
213
217
|
<Branding branding={branding} projectUrl={projectUrl} staticBaseUrl={staticBaseUrl} />
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
218
|
+
{hasNavigation && (
|
|
219
|
+
<button type="button" className="usa-menu-btn align-center">
|
|
220
|
+
{useMenuIcon ? <Icon name="menu" size={3} /> : 'Menu'}
|
|
221
|
+
</button>
|
|
222
|
+
)}
|
|
217
223
|
</div>
|
|
218
224
|
);
|
|
219
225
|
|
|
220
226
|
if (extended) {
|
|
221
227
|
return (
|
|
222
228
|
<>
|
|
223
|
-
<header id={id} className={headerClasses} {...props}>
|
|
229
|
+
<header id={id} className={headerClasses} {...props} {...extraAttributes}>
|
|
224
230
|
{navbar}
|
|
225
231
|
</header>
|
|
226
|
-
<nav aria-label="Primary navigation" className={navClasses}>
|
|
232
|
+
{hasNavigation && <nav aria-label="Primary navigation" className={navClasses} {...(extraAttributes?.['data-enhanced'] === 'true' ? { 'data-enhanced': 'true' } : {})}>
|
|
227
233
|
<div className="usa-nav__inner">
|
|
228
234
|
<PrimaryNav
|
|
229
235
|
navSections={navSections}
|
|
@@ -254,16 +260,16 @@ export default function Header({
|
|
|
254
260
|
</div>
|
|
255
261
|
{navEndContent && <div className="usx-nav__end-slot">{navEndContent}</div>}
|
|
256
262
|
</div>
|
|
257
|
-
</nav>
|
|
263
|
+
</nav>}
|
|
258
264
|
</>
|
|
259
265
|
);
|
|
260
266
|
}
|
|
261
267
|
|
|
262
268
|
return (
|
|
263
|
-
<header id={id} className={headerClasses} {...props}>
|
|
269
|
+
<header id={id} className={headerClasses} {...props} {...extraAttributes}>
|
|
264
270
|
<div className="usa-nav-container">
|
|
265
271
|
{navbar}
|
|
266
|
-
<nav aria-label="Primary navigation" className={navClasses}>
|
|
272
|
+
{hasNavigation && <nav aria-label="Primary navigation" className={navClasses}>
|
|
267
273
|
<PrimaryNav
|
|
268
274
|
navSections={navSections}
|
|
269
275
|
megamenu={megamenu}
|
|
@@ -274,7 +280,7 @@ export default function Header({
|
|
|
274
280
|
headerId={id}
|
|
275
281
|
renderSearchDirectly={true}
|
|
276
282
|
/>
|
|
277
|
-
</nav>
|
|
283
|
+
</nav>}
|
|
278
284
|
</div>
|
|
279
285
|
</header>
|
|
280
286
|
);
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"megamenu": true
|
|
77
77
|
},
|
|
78
78
|
"props": {
|
|
79
|
+
"extraAttributes": { "type": "object", "description": "Additional attributes on the USWDS enhancement target." },
|
|
79
80
|
"staticBaseUrl": {
|
|
80
81
|
"type": "string",
|
|
81
82
|
"description": "Optional branding image asset base, overriding window.usxBaseUrl in React or STATIC_URL in Django. Defaults to the global base or /."
|
|
@@ -1060,6 +1060,30 @@
|
|
|
1060
1060
|
</div>
|
|
1061
1061
|
</header>
|
|
1062
1062
|
|
|
1063
|
+
<h3 class="site-preview-heading">Brand Only</h3>
|
|
1064
|
+
<header class="usa-header usx-header usa-header--basic" id="django-header-brand-only">
|
|
1065
|
+
<div class="usa-nav-container">
|
|
1066
|
+
<div class="usa-navbar">
|
|
1067
|
+
<div class="usa-logo usx-logo">
|
|
1068
|
+
<em class="usa-logo__text">
|
|
1069
|
+
<a href="/" class="usx-logo__title">Simple Site</a>
|
|
1070
|
+
</em>
|
|
1071
|
+
</div>
|
|
1072
|
+
</div>
|
|
1073
|
+
</div>
|
|
1074
|
+
</header>
|
|
1075
|
+
|
|
1076
|
+
<h3 class="site-preview-heading">Brand Only Extended</h3>
|
|
1077
|
+
<header class="usa-header usx-header usa-header--extended" id="django-header-brand-only-extended">
|
|
1078
|
+
<div class="usa-navbar">
|
|
1079
|
+
<div class="usa-logo usx-logo">
|
|
1080
|
+
<em class="usa-logo__text">
|
|
1081
|
+
<a href="/" class="usx-logo__title">Simple Site</a>
|
|
1082
|
+
</em>
|
|
1083
|
+
</div>
|
|
1084
|
+
</div>
|
|
1085
|
+
</header>
|
|
1086
|
+
|
|
1063
1087
|
<h3 class="site-preview-heading">Minimal</h3>
|
|
1064
1088
|
<header class="usa-header usx-header usa-header--basic" id="django-header-minimal">
|
|
1065
1089
|
<div class="usa-nav-container">
|
|
@@ -3354,25 +3378,23 @@
|
|
|
3354
3378
|
aria-controls="django-theme-picker-panel"
|
|
3355
3379
|
>
|
|
3356
3380
|
<svg
|
|
3357
|
-
class="usa-icon usx-theme-picker__icon"
|
|
3381
|
+
class="usa-icon usx-icon usx-theme-picker__icon"
|
|
3358
3382
|
aria-hidden="true"
|
|
3359
3383
|
focusable="false"
|
|
3360
|
-
|
|
3384
|
+
role="img"
|
|
3361
3385
|
>
|
|
3362
|
-
<
|
|
3363
|
-
fill="currentColor"
|
|
3364
|
-
d="M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9c.83 0 1.5-.67 1.5-1.5 0-.39-.15-.74-.39-1.01-.23-.26-.38-.61-.38-.99 0-.83.67-1.5 1.5-1.5H16c2.76 0 5-2.24 5-5 0-4.42-4.03-8-9-8zm-5.5 9c-.83 0-1.5-.67-1.5-1.5S5.67 9 6.5 9 8 9.67 8 10.5 7.33 12 6.5 12zm3-4C8.67 8 8 7.33 8 6.5S8.67 5 9.5 5s1.5.67 1.5 1.5S10.33 8 9.5 8zm5 0c-.83 0-1.5-.67-1.5-1.5S13.67 5 14.5 5s1.5.67 1.5 1.5S15.33 8 14.5 8zm3 4c-.83 0-1.5-.67-1.5-1.5S16.67 9 17.5 9s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"
|
|
3365
|
-
/>
|
|
3386
|
+
<use href="img/usx-sprite.svg#color_palette"></use>
|
|
3366
3387
|
</svg>
|
|
3367
3388
|
</button>
|
|
3368
3389
|
<div id="django-theme-picker-panel" class="usx-theme-picker__panel">
|
|
3369
3390
|
<label class="usa-label usx-label usa-sr-only" for="django-theme-picker"> Theme </label>
|
|
3370
3391
|
|
|
3371
|
-
<select class="usa-select usx-select"
|
|
3392
|
+
<select id="django-theme-picker" class="usa-select usx-select">
|
|
3372
3393
|
<option value="Aurora" selected>Light</option>
|
|
3373
3394
|
|
|
3374
3395
|
<option value="Borealis">Dark</option>
|
|
3375
3396
|
</select>
|
|
3397
|
+
|
|
3376
3398
|
<button
|
|
3377
3399
|
type="button"
|
|
3378
3400
|
class="usa-button usx-button usa-button--primary usx-theme-picker__toggle"
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
{% if megamenu and not extended %}usa-header--megamenu{% endif %}
|
|
8
8
|
{% if extended %}usa-header--extended{% endif %}
|
|
9
9
|
{{ className }}
|
|
10
|
-
" {% if id %}id="{{ id }}"{% endif %} {% if styles %}style="{{ styles|safe }}"{% endif %}>
|
|
10
|
+
" {% if id %}id="{{ id }}"{% endif %} {% if styles %}style="{{ styles|safe }}"{% 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 %}>
|
|
11
11
|
{% if not extended %}
|
|
12
12
|
<div class="usa-nav-container">
|
|
13
13
|
{% endif %}
|
|
@@ -35,16 +35,17 @@
|
|
|
35
35
|
</em>
|
|
36
36
|
{% endif %}
|
|
37
37
|
</div>
|
|
38
|
-
<button type="button" class="usa-menu-btn align-center">
|
|
38
|
+
{% if navSections or searchProps or utilityContent or extended and secondaryLinks or extended and navEndContent %}<button type="button" class="usa-menu-btn align-center">
|
|
39
39
|
{% if useMenuIcon %}
|
|
40
40
|
{% icon name='menu' size=3 %}{% endicon %}
|
|
41
41
|
{% else %}
|
|
42
42
|
Menu
|
|
43
43
|
{% endif %}
|
|
44
|
-
</button>
|
|
44
|
+
</button>{% endif %}
|
|
45
45
|
</div>
|
|
46
46
|
|
|
47
47
|
{% if not extended %}
|
|
48
|
+
{% if navSections or searchProps or utilityContent %}
|
|
48
49
|
<nav aria-label="Primary navigation" class="usa-nav usx-nav{% if stickyNav %} usx-nav--sticky{% endif %}">
|
|
49
50
|
<button type="button" class="usa-nav__close">
|
|
50
51
|
{% icon name='close' size=3 %}{% endicon %}
|
|
@@ -107,11 +108,13 @@
|
|
|
107
108
|
</div>
|
|
108
109
|
{% endif %}
|
|
109
110
|
</nav>
|
|
111
|
+
{% endif %}
|
|
110
112
|
{% endif %}
|
|
111
113
|
{% if not extended %}</div>{% endif %}
|
|
112
114
|
</header>
|
|
113
115
|
{% if extended %}
|
|
114
|
-
|
|
116
|
+
{% if navSections or secondaryLinks or searchProps or utilityContent or navEndContent %}
|
|
117
|
+
<nav aria-label="Primary navigation" class="usa-nav usx-nav{% if stickyNav %} usx-nav--sticky{% endif %}"{% if extraAttributes %}{% for attr, value in extraAttributes.items %}{% if attr == 'data-enhanced' %} data-enhanced="{{ value }}"{% endif %}{% endfor %}{% endif %}>
|
|
115
118
|
<div class="usa-nav__inner">
|
|
116
119
|
<button type="button" class="usa-nav__close">
|
|
117
120
|
{% icon name='close' size=3 %}{% endicon %}
|
|
@@ -188,4 +191,5 @@
|
|
|
188
191
|
{% if navEndContent %}<div class="usx-nav__end-slot">{{ navEndContent|safe }}</div>{% endif %}
|
|
189
192
|
</div>
|
|
190
193
|
</nav>
|
|
194
|
+
{% endif %}
|
|
191
195
|
{% endif %}
|
|
@@ -1599,6 +1599,26 @@
|
|
|
1599
1599
|
</div>
|
|
1600
1600
|
</header>
|
|
1601
1601
|
|
|
1602
|
+
<h3 class="site-preview-heading">Brand Only</h3>
|
|
1603
|
+
<header id="html-header-brand-only" class="usa-header usx-header usa-header--basic">
|
|
1604
|
+
<div class="usa-nav-container">
|
|
1605
|
+
<div class="usa-navbar">
|
|
1606
|
+
<div class="usa-logo usx-logo">
|
|
1607
|
+
<em class="usa-logo__text"><a href="/" class="usx-logo__title">Simple Site</a></em>
|
|
1608
|
+
</div>
|
|
1609
|
+
</div>
|
|
1610
|
+
</div>
|
|
1611
|
+
</header>
|
|
1612
|
+
|
|
1613
|
+
<h3 class="site-preview-heading">Brand Only Extended</h3>
|
|
1614
|
+
<header id="html-header-brand-only-extended" class="usa-header usx-header usa-header--extended">
|
|
1615
|
+
<div class="usa-navbar">
|
|
1616
|
+
<div class="usa-logo usx-logo">
|
|
1617
|
+
<em class="usa-logo__text"><a href="/" class="usx-logo__title">Simple Site</a></em>
|
|
1618
|
+
</div>
|
|
1619
|
+
</div>
|
|
1620
|
+
</header>
|
|
1621
|
+
|
|
1602
1622
|
<h3 class="site-preview-heading">Minimal</h3>
|
|
1603
1623
|
<header class="usa-header usx-header usa-header--basic">
|
|
1604
1624
|
<div class="usa-nav-container">
|
|
@@ -2747,17 +2767,7 @@
|
|
|
2747
2767
|
class="usa-button usx-button usx-button--ghost text-muted usx-theme-picker__trigger"
|
|
2748
2768
|
aria-label="Theme"
|
|
2749
2769
|
>
|
|
2750
|
-
<svg
|
|
2751
|
-
class="usa-icon usx-theme-picker__icon"
|
|
2752
|
-
aria-hidden="true"
|
|
2753
|
-
focusable="false"
|
|
2754
|
-
viewBox="0 0 24 24"
|
|
2755
|
-
>
|
|
2756
|
-
<path
|
|
2757
|
-
fill="currentColor"
|
|
2758
|
-
d="M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9c.83 0 1.5-.67 1.5-1.5 0-.39-.15-.74-.39-1.01-.23-.26-.38-.61-.38-.99 0-.83.67-1.5 1.5-1.5H16c2.76 0 5-2.24 5-5 0-4.42-4.03-8-9-8zm-5.5 9c-.83 0-1.5-.67-1.5-1.5S5.67 9 6.5 9 8 9.67 8 10.5 7.33 12 6.5 12zm3-4C8.67 8 8 7.33 8 6.5S8.67 5 9.5 5s1.5.67 1.5 1.5S10.33 8 9.5 8zm5 0c-.83 0-1.5-.67-1.5-1.5S13.67 5 14.5 5s1.5.67 1.5 1.5S15.33 8 14.5 8zm3 4c-.83 0-1.5-.67-1.5-1.5S16.67 9 17.5 9s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"
|
|
2759
|
-
></path>
|
|
2760
|
-
</svg>
|
|
2770
|
+
<svg class="usa-icon usx-icon usx-theme-picker__icon" aria-hidden="true" focusable="false" role="img"><use href="./img/usx-sprite.svg#color_palette"></use></svg>
|
|
2761
2771
|
</button>
|
|
2762
2772
|
</div>
|
|
2763
2773
|
</div>
|
|
@@ -813,6 +813,26 @@
|
|
|
813
813
|
</div>
|
|
814
814
|
</header>
|
|
815
815
|
|
|
816
|
+
<h3 class="site-preview-heading">Brand Only</h3>
|
|
817
|
+
<header id="react-header-brand-only" class="usa-header usx-header usa-header--basic">
|
|
818
|
+
<div class="usa-nav-container">
|
|
819
|
+
<div class="usa-navbar">
|
|
820
|
+
<div class="usa-logo usx-logo">
|
|
821
|
+
<em class="usa-logo__text"><a href="/" class="usx-logo__title">Simple Site</a></em>
|
|
822
|
+
</div>
|
|
823
|
+
</div>
|
|
824
|
+
</div>
|
|
825
|
+
</header>
|
|
826
|
+
|
|
827
|
+
<h3 class="site-preview-heading">Brand Only Extended</h3>
|
|
828
|
+
<header id="react-header-brand-only-extended" class="usa-header usx-header usa-header--extended">
|
|
829
|
+
<div class="usa-navbar">
|
|
830
|
+
<div class="usa-logo usx-logo">
|
|
831
|
+
<em class="usa-logo__text"><a href="/" class="usx-logo__title">Simple Site</a></em>
|
|
832
|
+
</div>
|
|
833
|
+
</div>
|
|
834
|
+
</header>
|
|
835
|
+
|
|
816
836
|
<h3 class="site-preview-heading">Minimal</h3>
|
|
817
837
|
<header id="react-header-minimal" class="usa-header usx-header usa-header--basic">
|
|
818
838
|
<div class="usa-nav-container">
|
|
@@ -2637,15 +2657,12 @@
|
|
|
2637
2657
|
aria-controls="react-theme-picker-panel"
|
|
2638
2658
|
>
|
|
2639
2659
|
<svg
|
|
2640
|
-
class="usa-icon usx-theme-picker__icon"
|
|
2660
|
+
class="usa-icon usx-icon usx-theme-picker__icon"
|
|
2641
2661
|
aria-hidden="true"
|
|
2642
2662
|
focusable="false"
|
|
2643
|
-
|
|
2663
|
+
role="img"
|
|
2644
2664
|
>
|
|
2645
|
-
<
|
|
2646
|
-
fill="currentColor"
|
|
2647
|
-
d="M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9c.83 0 1.5-.67 1.5-1.5 0-.39-.15-.74-.39-1.01-.23-.26-.38-.61-.38-.99 0-.83.67-1.5 1.5-1.5H16c2.76 0 5-2.24 5-5 0-4.42-4.03-8-9-8zm-5.5 9c-.83 0-1.5-.67-1.5-1.5S5.67 9 6.5 9 8 9.67 8 10.5 7.33 12 6.5 12zm3-4C8.67 8 8 7.33 8 6.5S8.67 5 9.5 5s1.5.67 1.5 1.5S10.33 8 9.5 8zm5 0c-.83 0-1.5-.67-1.5-1.5S13.67 5 14.5 5s1.5.67 1.5 1.5S15.33 8 14.5 8zm3 4c-.83 0-1.5-.67-1.5-1.5S16.67 9 17.5 9s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"
|
|
2648
|
-
></path>
|
|
2665
|
+
<use href="/img/usx-sprite.svg#color_palette"></use>
|
|
2649
2666
|
</svg>
|
|
2650
2667
|
</button>
|
|
2651
2668
|
<div id="react-theme-picker-panel" class="usx-theme-picker__panel">
|
|
@@ -15,6 +15,7 @@ export interface IconListItem {
|
|
|
15
15
|
|
|
16
16
|
export interface IconListProps extends React.HTMLAttributes<HTMLUListElement> {
|
|
17
17
|
items?: IconListItem[];
|
|
18
|
+
caption?: string;
|
|
18
19
|
primary?: boolean;
|
|
19
20
|
size?: null | 'lg';
|
|
20
21
|
className?: string;
|
|
@@ -27,7 +28,7 @@ function renderContent(content: string | React.ReactNode) {
|
|
|
27
28
|
return content;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
export default function IconList({ items = [], primary = false, size = null, className = '', ...props }: IconListProps) {
|
|
31
|
+
export default function IconList({ items = [], caption, primary = false, size = null, className = '', ...props }: IconListProps) {
|
|
31
32
|
const classes = ClassNames(
|
|
32
33
|
'usa-icon-list',
|
|
33
34
|
'usx-icon-list',
|
|
@@ -36,7 +37,7 @@ export default function IconList({ items = [], primary = false, size = null, cla
|
|
|
36
37
|
className,
|
|
37
38
|
);
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
const list = (
|
|
40
41
|
<ul className={classes} {...props}>
|
|
41
42
|
{items.map((item, index) => (
|
|
42
43
|
<li key={index} className={ClassNames('usa-icon-list__item', item.itemClassName)}>
|
|
@@ -56,4 +57,11 @@ export default function IconList({ items = [], primary = false, size = null, cla
|
|
|
56
57
|
))}
|
|
57
58
|
</ul>
|
|
58
59
|
);
|
|
60
|
+
|
|
61
|
+
return caption ? (
|
|
62
|
+
<figure className="usx-list-figure">
|
|
63
|
+
<figcaption className="usx-list-figure__caption">{caption}</figcaption>
|
|
64
|
+
{list}
|
|
65
|
+
</figure>
|
|
66
|
+
) : list;
|
|
59
67
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "icon-list",
|
|
3
3
|
"template": "icon-list/icon-list.django.html",
|
|
4
|
-
"version":
|
|
4
|
+
"version": 2,
|
|
5
5
|
"default": {
|
|
6
6
|
"items": [
|
|
7
7
|
{
|
|
@@ -64,6 +64,10 @@
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
|
+
"caption": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"description": "Optional label rendered in a figcaption before the icon list. Wraps the list in a figure when provided."
|
|
70
|
+
},
|
|
67
71
|
"primary": {
|
|
68
72
|
"type": "boolean",
|
|
69
73
|
"default": false,
|