@solexllc/usx-react 0.9.0 → 0.10.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 +123 -97
- package/dist/index.js +124 -98
- 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/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 +24 -0
- package/src/components/header/header.django.html +8 -4
- package/src/components/header/header.html +20 -0
- package/src/components/header/header.react-snapshot.html +20 -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/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/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 +3 -1
- package/src/components/theme-picker/config.json +14 -1
- package/src/components/theme-picker/theme-picker.django-snapshot.html +64 -0
- package/src/components/theme-picker/theme-picker.django.html +2 -2
- package/src/components/theme-picker/theme-picker.react-snapshot.html +52 -0
- 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
|
@@ -12,6 +12,7 @@ export interface LanguageOption {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export interface LanguageSelectorProps {
|
|
15
|
+
extraAttributes?: Record<string, unknown>;
|
|
15
16
|
languages?: LanguageOption[];
|
|
16
17
|
variant?: 'two' | 'menu' | null;
|
|
17
18
|
unstyled?: boolean;
|
|
@@ -23,7 +24,7 @@ export interface LanguageSelectorProps {
|
|
|
23
24
|
onSelect?: ((language: LanguageOption, event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void) | null;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
interface TwoLanguageSelectorProps extends Pick<LanguageSelectorProps, 'onSelect' | 'className' | 'navAriaLabel'> {
|
|
27
|
+
interface TwoLanguageSelectorProps extends Pick<LanguageSelectorProps, 'onSelect' | 'className' | 'navAriaLabel' | 'extraAttributes'> {
|
|
27
28
|
target: LanguageOption;
|
|
28
29
|
}
|
|
29
30
|
|
|
@@ -51,7 +52,7 @@ function LanguageLabel({ code, label, description }: Pick<LanguageOption, 'code'
|
|
|
51
52
|
);
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
function TwoLanguageSelector({ target, onSelect, className, navAriaLabel }: TwoLanguageSelectorProps) {
|
|
55
|
+
function TwoLanguageSelector({ target, onSelect, className, navAriaLabel, extraAttributes }: TwoLanguageSelectorProps) {
|
|
55
56
|
const handleClick = (event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => {
|
|
56
57
|
if (onSelect) onSelect(target, event);
|
|
57
58
|
if (!target.href) event.preventDefault();
|
|
@@ -63,7 +64,7 @@ function TwoLanguageSelector({ target, onSelect, className, navAriaLabel }: TwoL
|
|
|
63
64
|
: { type: 'button' as const };
|
|
64
65
|
|
|
65
66
|
return (
|
|
66
|
-
<nav aria-label={navAriaLabel} className={className}>
|
|
67
|
+
<nav aria-label={navAriaLabel} className={className} {...extraAttributes}>
|
|
67
68
|
<div className="usa-language-container">
|
|
68
69
|
<Tag className="usa-button usx-button usa-button--primary" onClick={handleClick} {...tagProps}>
|
|
69
70
|
<LanguageLabel code={target.code} label={target.label} />
|
|
@@ -82,6 +83,7 @@ function MenuLanguageSelector({
|
|
|
82
83
|
onSelect,
|
|
83
84
|
className,
|
|
84
85
|
navAriaLabel,
|
|
86
|
+
extraAttributes,
|
|
85
87
|
}: MenuLanguageSelectorProps) {
|
|
86
88
|
// Open/close (aria-expanded, hidden, outside-click, Escape, focusout) is
|
|
87
89
|
// driven by USWDS's own JS, initialized via a decorator in the story/host
|
|
@@ -100,7 +102,7 @@ function MenuLanguageSelector({
|
|
|
100
102
|
|
|
101
103
|
return (
|
|
102
104
|
<nav aria-label={navAriaLabel} className={className}>
|
|
103
|
-
<div className={containerClasses}>
|
|
105
|
+
<div className={containerClasses} {...extraAttributes}>
|
|
104
106
|
<ul className="usa-language__primary usa-accordion">
|
|
105
107
|
<li className="usa-language__primary-item">
|
|
106
108
|
<button
|
|
@@ -157,13 +159,14 @@ export default function LanguageSelector({
|
|
|
157
159
|
navAriaLabel = 'Language selection',
|
|
158
160
|
className = '',
|
|
159
161
|
onSelect = null,
|
|
162
|
+
extraAttributes,
|
|
160
163
|
...props
|
|
161
164
|
}: LanguageSelectorProps) {
|
|
162
165
|
const resolvedVariant = variant || (languages.length > 2 ? 'menu' : 'two');
|
|
163
166
|
const classes = classnames('usx-language-selector', className);
|
|
164
167
|
|
|
165
168
|
if (!languages || languages.length === 0) {
|
|
166
|
-
return <div className={classes}>{'LanguageSelector'}</div>;
|
|
169
|
+
return <div className={classes} {...extraAttributes}>{'LanguageSelector'}</div>;
|
|
167
170
|
}
|
|
168
171
|
|
|
169
172
|
if (resolvedVariant === 'two') {
|
|
@@ -174,6 +177,7 @@ export default function LanguageSelector({
|
|
|
174
177
|
onSelect={onSelect}
|
|
175
178
|
className={classes}
|
|
176
179
|
navAriaLabel={navAriaLabel}
|
|
180
|
+
extraAttributes={extraAttributes}
|
|
177
181
|
{...props}
|
|
178
182
|
/>
|
|
179
183
|
);
|
|
@@ -189,6 +193,7 @@ export default function LanguageSelector({
|
|
|
189
193
|
onSelect={onSelect}
|
|
190
194
|
className={classes}
|
|
191
195
|
navAriaLabel={navAriaLabel}
|
|
196
|
+
extraAttributes={extraAttributes}
|
|
192
197
|
{...props}
|
|
193
198
|
/>
|
|
194
199
|
);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{# Django template for LanguageSelector #}
|
|
2
2
|
{# Props: languages (array of {code,label,description,href,current,plain}), variant ('two'|'menu'), unstyled (bool), small (bool), label (string), id (string), navAriaLabel (string), className (string) #}
|
|
3
3
|
{# For variant="two", mark exactly one language `current: true` — the other renders as the switch target. #}
|
|
4
|
-
<nav aria-label="{{ navAriaLabel|default:'Language selection' }}" class="usx-language-selector{% if className %} {{ className }}{% endif %}">
|
|
4
|
+
<nav aria-label="{{ navAriaLabel|default:'Language selection' }}" class="usx-language-selector{% if className %} {{ className }}{% endif %}"{% if variant != 'menu' and 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 variant == 'menu' %}
|
|
6
|
-
<div class="usa-language-container{% if small %} usa-language--small{% endif %}">
|
|
6
|
+
<div class="usa-language-container{% if small %} usa-language--small{% 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 %}>
|
|
7
7
|
<ul class="usa-language__primary usa-accordion">
|
|
8
8
|
<li class="usa-language__primary-item">
|
|
9
9
|
<button
|
|
@@ -103,6 +103,7 @@ export type LayoutProps = {
|
|
|
103
103
|
/** Optional callback fired when the layout is expanded or contracted. */
|
|
104
104
|
onToggleExpanded?: (expanded: boolean) => void;
|
|
105
105
|
className?: string;
|
|
106
|
+
extraAttributes?: Record<string, unknown>;
|
|
106
107
|
} & HTMLAttributes<HTMLDivElement>;
|
|
107
108
|
|
|
108
109
|
export default function Layout({
|
|
@@ -116,6 +117,7 @@ export default function Layout({
|
|
|
116
117
|
expandable = false,
|
|
117
118
|
onToggleExpanded,
|
|
118
119
|
className = '',
|
|
120
|
+
extraAttributes,
|
|
119
121
|
...props
|
|
120
122
|
}: LayoutProps) {
|
|
121
123
|
const [expanded, setExpanded] = useState(false);
|
|
@@ -150,7 +152,7 @@ export default function Layout({
|
|
|
150
152
|
) : null;
|
|
151
153
|
|
|
152
154
|
return (
|
|
153
|
-
<div className={classes} {...props}>
|
|
155
|
+
<div className={classes} {...props} {...extraAttributes}>
|
|
154
156
|
{variant === 'single-column' ? (
|
|
155
157
|
<SingleColumnLayout expandButton={expandButton}>
|
|
156
158
|
{children || content}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
{% endbutton %}
|
|
12
12
|
{% endif %}
|
|
13
13
|
{% endfragment %}
|
|
14
|
-
<div class="usx-layout{% if className %} {{ className }}{% endif %}">
|
|
14
|
+
<div class="usx-layout{% 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 %}>
|
|
15
15
|
{% if variant == 'single-column' %}
|
|
16
16
|
<div class="usx-layout__single-column">
|
|
17
17
|
{{ expandButton }}
|
|
@@ -22,6 +22,12 @@ export interface MemorableDateProps {
|
|
|
22
22
|
defaultMonth?: string;
|
|
23
23
|
defaultDay?: string;
|
|
24
24
|
defaultYear?: string;
|
|
25
|
+
month?: string;
|
|
26
|
+
day?: string;
|
|
27
|
+
year?: string;
|
|
28
|
+
onMonthChange?: React.ChangeEventHandler<HTMLSelectElement>;
|
|
29
|
+
onDayChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
30
|
+
onYearChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
25
31
|
disabled?: boolean;
|
|
26
32
|
ariaDisabled?: boolean;
|
|
27
33
|
required?: boolean;
|
|
@@ -60,6 +66,12 @@ export default function MemorableDate({
|
|
|
60
66
|
defaultMonth,
|
|
61
67
|
defaultDay,
|
|
62
68
|
defaultYear,
|
|
69
|
+
month,
|
|
70
|
+
day,
|
|
71
|
+
year,
|
|
72
|
+
onMonthChange,
|
|
73
|
+
onDayChange,
|
|
74
|
+
onYearChange,
|
|
63
75
|
disabled = false,
|
|
64
76
|
ariaDisabled = false,
|
|
65
77
|
required = false,
|
|
@@ -101,7 +113,8 @@ export default function MemorableDate({
|
|
|
101
113
|
label={monthLabel}
|
|
102
114
|
options={MONTH_OPTIONS}
|
|
103
115
|
placeholder="- Select -"
|
|
104
|
-
defaultValue
|
|
116
|
+
{...(month !== undefined ? { value: month } : { defaultValue: defaultMonth })}
|
|
117
|
+
onChange={onMonthChange}
|
|
105
118
|
required={required}
|
|
106
119
|
aria-describedby={describedBy(monthHintId)}
|
|
107
120
|
aria-invalid={hasError || undefined}
|
|
@@ -121,7 +134,8 @@ export default function MemorableDate({
|
|
|
121
134
|
name={dayName || dayId}
|
|
122
135
|
label={dayLabel}
|
|
123
136
|
placeholder=""
|
|
124
|
-
defaultValue
|
|
137
|
+
{...(day !== undefined ? { value: day } : { defaultValue: defaultDay })}
|
|
138
|
+
onChange={onDayChange}
|
|
125
139
|
maxLength={2}
|
|
126
140
|
pattern="[0-9]*"
|
|
127
141
|
inputMode="numeric"
|
|
@@ -143,7 +157,8 @@ export default function MemorableDate({
|
|
|
143
157
|
name={yearName || yearId}
|
|
144
158
|
label={yearLabel}
|
|
145
159
|
placeholder=""
|
|
146
|
-
defaultValue
|
|
160
|
+
{...(year !== undefined ? { value: year } : { defaultValue: defaultYear })}
|
|
161
|
+
onChange={onYearChange}
|
|
147
162
|
minLength={4}
|
|
148
163
|
maxLength={4}
|
|
149
164
|
pattern="[0-9]*"
|
|
@@ -67,14 +67,29 @@
|
|
|
67
67
|
"type": "string",
|
|
68
68
|
"description": "Initial selected month value (\"1\"-\"12\")."
|
|
69
69
|
},
|
|
70
|
+
"month": {
|
|
71
|
+
"type": "string",
|
|
72
|
+
"default": null,
|
|
73
|
+
"description": "Current month selection. Takes precedence over defaultMonth."
|
|
74
|
+
},
|
|
70
75
|
"defaultDay": {
|
|
71
76
|
"type": "string",
|
|
72
77
|
"description": "Initial day value."
|
|
73
78
|
},
|
|
79
|
+
"day": {
|
|
80
|
+
"type": "string",
|
|
81
|
+
"default": null,
|
|
82
|
+
"description": "Current day value. Takes precedence over defaultDay."
|
|
83
|
+
},
|
|
74
84
|
"defaultYear": {
|
|
75
85
|
"type": "string",
|
|
76
86
|
"description": "Initial year value."
|
|
77
87
|
},
|
|
88
|
+
"year": {
|
|
89
|
+
"type": "string",
|
|
90
|
+
"default": null,
|
|
91
|
+
"description": "Current year value. Takes precedence over defaultYear."
|
|
92
|
+
},
|
|
78
93
|
"disabled": {
|
|
79
94
|
"type": "boolean",
|
|
80
95
|
"default": false,
|
|
@@ -534,3 +534,85 @@
|
|
|
534
534
|
</div>
|
|
535
535
|
</fieldset>
|
|
536
536
|
</div>
|
|
537
|
+
|
|
538
|
+
<h3 class="site-preview-heading">With Values</h3>
|
|
539
|
+
<div class="usa-form-group usx-form-group">
|
|
540
|
+
<fieldset class="usa-fieldset usx-fieldset">
|
|
541
|
+
<legend class="usa-legend usx-legend">Date of Birth</legend>
|
|
542
|
+
|
|
543
|
+
<span class="usa-hint usx-hint" aria-hidden="true" id="django-memorable-date-values-hint"
|
|
544
|
+
>Select a month. Enter 1 or 2 digits for the day and 4 digits for the year.</span
|
|
545
|
+
>
|
|
546
|
+
<div class="usa-memorable-date usx-memorable-date">
|
|
547
|
+
<div class="usa-form-group usx-form-group usa-form-group--month usa-form-group--select">
|
|
548
|
+
<label class="usa-label usx-label" for="django-memorable-date-values-month"> Month </label>
|
|
549
|
+
|
|
550
|
+
<select
|
|
551
|
+
class="usa-select usx-select"
|
|
552
|
+
id="django-memorable-date-values-month"
|
|
553
|
+
name="memorable-date-values-month"
|
|
554
|
+
aria-describedby="django-memorable-date-values-month-hint"
|
|
555
|
+
>
|
|
556
|
+
<option value="">- Select -</option>
|
|
557
|
+
<option value="1">January</option>
|
|
558
|
+
<option value="2">February</option>
|
|
559
|
+
<option value="3">March</option>
|
|
560
|
+
<option value="4">April</option>
|
|
561
|
+
<option value="5">May</option>
|
|
562
|
+
<option value="6" selected>June</option>
|
|
563
|
+
<option value="7">July</option>
|
|
564
|
+
<option value="8">August</option>
|
|
565
|
+
<option value="9">September</option>
|
|
566
|
+
<option value="10">October</option>
|
|
567
|
+
<option value="11">November</option>
|
|
568
|
+
<option value="12">December</option>
|
|
569
|
+
</select>
|
|
570
|
+
|
|
571
|
+
<span class="usa-hint usa-sr-only" id="django-memorable-date-values-month-hint"
|
|
572
|
+
>Select a month from the dropdown.</span
|
|
573
|
+
>
|
|
574
|
+
</div>
|
|
575
|
+
|
|
576
|
+
<div class="usa-form-group usx-form-group usa-form-group--day">
|
|
577
|
+
<label class="usa-label usx-label" for="django-memorable-date-values-day"> Day </label>
|
|
578
|
+
|
|
579
|
+
<input
|
|
580
|
+
class="usa-input usx-input"
|
|
581
|
+
id="django-memorable-date-values-day"
|
|
582
|
+
name="memorable-date-values-day"
|
|
583
|
+
value="20"
|
|
584
|
+
maxlength="2"
|
|
585
|
+
pattern="[0-9]*"
|
|
586
|
+
placeholder=""
|
|
587
|
+
inputmode="numeric"
|
|
588
|
+
aria-describedby="django-memorable-date-values-day-hint"
|
|
589
|
+
/>
|
|
590
|
+
|
|
591
|
+
<span class="usa-hint usa-sr-only" id="django-memorable-date-values-day-hint"
|
|
592
|
+
>Enter 1 or 2 digits for the day.</span
|
|
593
|
+
>
|
|
594
|
+
</div>
|
|
595
|
+
|
|
596
|
+
<div class="usa-form-group usx-form-group usa-form-group--year">
|
|
597
|
+
<label class="usa-label usx-label" for="django-memorable-date-values-year"> Year </label>
|
|
598
|
+
|
|
599
|
+
<input
|
|
600
|
+
class="usa-input usx-input"
|
|
601
|
+
id="django-memorable-date-values-year"
|
|
602
|
+
name="memorable-date-values-year"
|
|
603
|
+
value="1990"
|
|
604
|
+
minlength="4"
|
|
605
|
+
maxlength="4"
|
|
606
|
+
pattern="[0-9]*"
|
|
607
|
+
placeholder=""
|
|
608
|
+
inputmode="numeric"
|
|
609
|
+
aria-describedby="django-memorable-date-values-year-hint"
|
|
610
|
+
/>
|
|
611
|
+
|
|
612
|
+
<span class="usa-hint usa-sr-only" id="django-memorable-date-values-year-hint"
|
|
613
|
+
>Enter 4 digits for the year.</span
|
|
614
|
+
>
|
|
615
|
+
</div>
|
|
616
|
+
</div>
|
|
617
|
+
</fieldset>
|
|
618
|
+
</div>
|
|
@@ -20,18 +20,18 @@
|
|
|
20
20
|
{% if required %}required{% endif %}
|
|
21
21
|
>
|
|
22
22
|
<option value="">- Select -</option>
|
|
23
|
-
<option value="1" {% if defaultMonth == "1" %}selected{% endif %}>January</option>
|
|
24
|
-
<option value="2" {% if defaultMonth == "2" %}selected{% endif %}>February</option>
|
|
25
|
-
<option value="3" {% if defaultMonth == "3" %}selected{% endif %}>March</option>
|
|
26
|
-
<option value="4" {% if defaultMonth == "4" %}selected{% endif %}>April</option>
|
|
27
|
-
<option value="5" {% if defaultMonth == "5" %}selected{% endif %}>May</option>
|
|
28
|
-
<option value="6" {% if defaultMonth == "6" %}selected{% endif %}>June</option>
|
|
29
|
-
<option value="7" {% if defaultMonth == "7" %}selected{% endif %}>July</option>
|
|
30
|
-
<option value="8" {% if defaultMonth == "8" %}selected{% endif %}>August</option>
|
|
31
|
-
<option value="9" {% if defaultMonth == "9" %}selected{% endif %}>September</option>
|
|
32
|
-
<option value="10" {% if defaultMonth == "10" %}selected{% endif %}>October</option>
|
|
33
|
-
<option value="11" {% if defaultMonth == "11" %}selected{% endif %}>November</option>
|
|
34
|
-
<option value="12" {% if defaultMonth == "12" %}selected{% endif %}>December</option>
|
|
23
|
+
<option value="1" {% if month is not None and month == "1" or month is None and defaultMonth == "1" %}selected{% endif %}>January</option>
|
|
24
|
+
<option value="2" {% if month is not None and month == "2" or month is None and defaultMonth == "2" %}selected{% endif %}>February</option>
|
|
25
|
+
<option value="3" {% if month is not None and month == "3" or month is None and defaultMonth == "3" %}selected{% endif %}>March</option>
|
|
26
|
+
<option value="4" {% if month is not None and month == "4" or month is None and defaultMonth == "4" %}selected{% endif %}>April</option>
|
|
27
|
+
<option value="5" {% if month is not None and month == "5" or month is None and defaultMonth == "5" %}selected{% endif %}>May</option>
|
|
28
|
+
<option value="6" {% if month is not None and month == "6" or month is None and defaultMonth == "6" %}selected{% endif %}>June</option>
|
|
29
|
+
<option value="7" {% if month is not None and month == "7" or month is None and defaultMonth == "7" %}selected{% endif %}>July</option>
|
|
30
|
+
<option value="8" {% if month is not None and month == "8" or month is None and defaultMonth == "8" %}selected{% endif %}>August</option>
|
|
31
|
+
<option value="9" {% if month is not None and month == "9" or month is None and defaultMonth == "9" %}selected{% endif %}>September</option>
|
|
32
|
+
<option value="10" {% if month is not None and month == "10" or month is None and defaultMonth == "10" %}selected{% endif %}>October</option>
|
|
33
|
+
<option value="11" {% if month is not None and month == "11" or month is None and defaultMonth == "11" %}selected{% endif %}>November</option>
|
|
34
|
+
<option value="12" {% if month is not None and month == "12" or month is None and defaultMonth == "12" %}selected{% endif %}>December</option>
|
|
35
35
|
</select>
|
|
36
36
|
{% if monthHint %}
|
|
37
37
|
<span class="usa-hint usa-sr-only" id="{{ month_hint_id }}">{{ monthHint|default:"Select a month from the dropdown." }}</span>
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
class="usa-input usx-input{% if error %} usa-input--error{% endif %}"
|
|
45
45
|
id="{{ day_id }}"
|
|
46
46
|
name="{{ dayName|default:day_id }}"
|
|
47
|
-
value="{{ defaultDay|default:'' }}"
|
|
47
|
+
value="{% if day is not None %}{{ day }}{% else %}{{ defaultDay|default:'' }}{% endif %}"
|
|
48
48
|
maxlength="2"
|
|
49
49
|
pattern="[0-9]*"
|
|
50
50
|
placeholder=""
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
class="usa-input usx-input{% if error %} usa-input--error{% endif %}"
|
|
66
66
|
id="{{ year_id }}"
|
|
67
67
|
name="{{ yearName|default:year_id }}"
|
|
68
|
-
value="{{ defaultYear|default:'' }}"
|
|
68
|
+
value="{% if year is not None %}{{ year }}{% else %}{{ defaultYear|default:'' }}{% endif %}"
|
|
69
69
|
minlength="4"
|
|
70
70
|
maxlength="4"
|
|
71
71
|
pattern="[0-9]*"
|
|
@@ -435,3 +435,73 @@
|
|
|
435
435
|
</div>
|
|
436
436
|
</fieldset>
|
|
437
437
|
</div>
|
|
438
|
+
|
|
439
|
+
<h3 class="site-preview-heading">With Values</h3>
|
|
440
|
+
<div class="usa-form-group usx-form-group">
|
|
441
|
+
<fieldset class="usa-fieldset usx-fieldset">
|
|
442
|
+
<legend class="usa-legend usx-legend">Date of Birth</legend>
|
|
443
|
+
<span class="usa-hint usx-hint" id="react-memorable-date-values-hint" aria-hidden="true"
|
|
444
|
+
>Select a month. Enter 1 or 2 digits for the day and 4 digits for the year.</span
|
|
445
|
+
>
|
|
446
|
+
<div class="usa-memorable-date usx-memorable-date">
|
|
447
|
+
<div class="usa-form-group usx-form-group usa-form-group--month usa-form-group--select">
|
|
448
|
+
<label class="usa-label usx-label" for="react-memorable-date-values-month">Month</label
|
|
449
|
+
><select
|
|
450
|
+
id="react-memorable-date-values-month"
|
|
451
|
+
name="memorable-date-values-month"
|
|
452
|
+
class="usa-select usx-select"
|
|
453
|
+
aria-describedby="react-memorable-date-values-month-hint"
|
|
454
|
+
>
|
|
455
|
+
<option value="">- Select -</option>
|
|
456
|
+
<option value="1">January</option>
|
|
457
|
+
<option value="2">February</option>
|
|
458
|
+
<option value="3">March</option>
|
|
459
|
+
<option value="4">April</option>
|
|
460
|
+
<option value="5">May</option>
|
|
461
|
+
<option value="6" selected="">June</option>
|
|
462
|
+
<option value="7">July</option>
|
|
463
|
+
<option value="8">August</option>
|
|
464
|
+
<option value="9">September</option>
|
|
465
|
+
<option value="10">October</option>
|
|
466
|
+
<option value="11">November</option>
|
|
467
|
+
<option value="12">December</option></select
|
|
468
|
+
><span class="usa-hint usa-sr-only" id="react-memorable-date-values-month-hint"
|
|
469
|
+
>Select a month from the dropdown.</span
|
|
470
|
+
>
|
|
471
|
+
</div>
|
|
472
|
+
<div class="usa-form-group usx-form-group usa-form-group--day">
|
|
473
|
+
<label class="usa-label usx-label" for="react-memorable-date-values-day">Day</label
|
|
474
|
+
><input
|
|
475
|
+
id="react-memorable-date-values-day"
|
|
476
|
+
class="usa-input usx-input"
|
|
477
|
+
placeholder=""
|
|
478
|
+
aria-describedby="react-memorable-date-values-day-hint"
|
|
479
|
+
name="memorable-date-values-day"
|
|
480
|
+
maxlength="2"
|
|
481
|
+
pattern="[0-9]*"
|
|
482
|
+
inputmode="numeric"
|
|
483
|
+
value="20"
|
|
484
|
+
/><span class="usa-hint usa-sr-only" id="react-memorable-date-values-day-hint"
|
|
485
|
+
>Enter 1 or 2 digits for the day.</span
|
|
486
|
+
>
|
|
487
|
+
</div>
|
|
488
|
+
<div class="usa-form-group usx-form-group usa-form-group--year">
|
|
489
|
+
<label class="usa-label usx-label" for="react-memorable-date-values-year">Year</label
|
|
490
|
+
><input
|
|
491
|
+
id="react-memorable-date-values-year"
|
|
492
|
+
class="usa-input usx-input"
|
|
493
|
+
placeholder=""
|
|
494
|
+
aria-describedby="react-memorable-date-values-year-hint"
|
|
495
|
+
name="memorable-date-values-year"
|
|
496
|
+
minlength="4"
|
|
497
|
+
maxlength="4"
|
|
498
|
+
pattern="[0-9]*"
|
|
499
|
+
inputmode="numeric"
|
|
500
|
+
value="1990"
|
|
501
|
+
/><span class="usa-hint usa-sr-only" id="react-memorable-date-values-year-hint"
|
|
502
|
+
>Enter 4 digits for the year.</span
|
|
503
|
+
>
|
|
504
|
+
</div>
|
|
505
|
+
</div>
|
|
506
|
+
</fieldset>
|
|
507
|
+
</div>
|
|
@@ -5,6 +5,7 @@ import Prose from '../prose/Prose';
|
|
|
5
5
|
import ButtonGroup, { ButtonGroupProps } from '../button-group/ButtonGroup';
|
|
6
6
|
|
|
7
7
|
export interface ModalProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
extraAttributes?: Record<string, unknown>;
|
|
8
9
|
id?: string;
|
|
9
10
|
heading?: string;
|
|
10
11
|
description?: string;
|
|
@@ -27,6 +28,7 @@ export default function Modal({
|
|
|
27
28
|
forceAction = false,
|
|
28
29
|
className = '',
|
|
29
30
|
children,
|
|
31
|
+
extraAttributes,
|
|
30
32
|
...props
|
|
31
33
|
}: ModalProps) {
|
|
32
34
|
const classes = classNames('usa-modal', 'usx-modal', {
|
|
@@ -42,6 +44,7 @@ export default function Modal({
|
|
|
42
44
|
aria-describedby={`${id}-description`}
|
|
43
45
|
{...(forceAction ? { 'data-force-action': true } : {})}
|
|
44
46
|
{...props}
|
|
47
|
+
{...extraAttributes}
|
|
45
48
|
>
|
|
46
49
|
<div className="usa-modal__content">
|
|
47
50
|
<div className="usa-modal__main">
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{# Django template for Modal #}
|
|
2
2
|
{% load usx_components %}
|
|
3
3
|
<div
|
|
4
|
-
class="usa-modal usx-modal{% if size == 'lg' %} usa-modal--lg{% elif size == 'lg-collapsed' %} usx-modal--lg-collapsed{% endif %}{% if className %} {{ className }}{% endif %}"
|
|
4
|
+
class="usa-modal usx-modal{% if size == 'lg' %} usa-modal--lg{% elif size == 'lg-collapsed' %} usx-modal--lg-collapsed{% 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 %}
|
|
5
5
|
id="{{ id }}"
|
|
6
6
|
aria-labelledby="{{ id }}-heading"
|
|
7
7
|
aria-describedby="{{ id }}-description"
|
|
@@ -42,6 +42,7 @@ export interface PopoverProps extends Omit<
|
|
|
42
42
|
panelClassName?: string;
|
|
43
43
|
/** Optional class name for the inner content container. */
|
|
44
44
|
contentClassName?: string;
|
|
45
|
+
extraAttributes?: Record<string, unknown>;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
/**
|
|
@@ -64,6 +65,7 @@ export default function Popover({
|
|
|
64
65
|
summaryProps,
|
|
65
66
|
panelClassName,
|
|
66
67
|
contentClassName,
|
|
68
|
+
extraAttributes,
|
|
67
69
|
children,
|
|
68
70
|
...props
|
|
69
71
|
}: PopoverProps) {
|
|
@@ -78,6 +80,7 @@ export default function Popover({
|
|
|
78
80
|
open={initiallyOpen || undefined}
|
|
79
81
|
data-side={side}
|
|
80
82
|
data-align={align}
|
|
83
|
+
{...extraAttributes}
|
|
81
84
|
>
|
|
82
85
|
<Summary unstyled {...composedSummaryProps} />
|
|
83
86
|
<div
|
|
@@ -125,6 +125,10 @@
|
|
|
125
125
|
"contentClassName": {
|
|
126
126
|
"type": "string",
|
|
127
127
|
"description": "Optional class name for the inner content container."
|
|
128
|
+
},
|
|
129
|
+
"extraAttributes": {
|
|
130
|
+
"type": "object",
|
|
131
|
+
"description": "Additional HTML attributes on the popover root."
|
|
128
132
|
}
|
|
129
133
|
}
|
|
130
134
|
}
|