@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
|
@@ -1,85 +1,115 @@
|
|
|
1
|
-
<h3 class="site-preview-heading
|
|
2
|
-
<div class="usx-theme-picker"
|
|
1
|
+
<h3 class="site-preview-heading">Default</h3>
|
|
2
|
+
<div class="usx-theme-picker">
|
|
3
3
|
<button
|
|
4
4
|
type="button"
|
|
5
5
|
class="usa-button usx-button usx-button--ghost usx-theme-picker__trigger"
|
|
6
6
|
aria-label="Theme"
|
|
7
|
-
|
|
7
|
+
aria-expanded="false"
|
|
8
|
+
aria-controls="theme-picker-example-1-panel"
|
|
8
9
|
>
|
|
9
10
|
<svg
|
|
10
|
-
class="usa-icon usx-theme-picker__icon"
|
|
11
|
+
class="usa-icon usx-icon usx-theme-picker__icon"
|
|
11
12
|
aria-hidden="true"
|
|
12
13
|
focusable="false"
|
|
13
|
-
|
|
14
|
+
role="img"
|
|
14
15
|
>
|
|
15
|
-
<
|
|
16
|
-
fill="currentColor"
|
|
17
|
-
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"
|
|
18
|
-
/>
|
|
16
|
+
<use href="./img/usx-sprite.svg#color_palette"></use>
|
|
19
17
|
</svg>
|
|
20
18
|
</button>
|
|
21
|
-
<div class="usx-theme-picker__panel">
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<option value="
|
|
19
|
+
<div id="theme-picker-example-1-panel" class="usx-theme-picker__panel">
|
|
20
|
+
<label class="usa-label usx-label usa-sr-only" for="theme-picker-example-1">Theme</label
|
|
21
|
+
><select id="theme-picker-example-1" class="usa-select usx-select">
|
|
22
|
+
<option value="Default" selected="">Default</option>
|
|
23
|
+
<option value="Forest">Forest</option>
|
|
24
|
+
<option value="Sunset">Sunset</option>
|
|
25
|
+
<option value="Ocean">Ocean</option>
|
|
26
|
+
<option value="Aurora">Aurora</option>
|
|
27
|
+
<option value="Borealis">Borealis</option>
|
|
28
28
|
<option value="Midnight">Midnight</option>
|
|
29
29
|
<option value="Carbon">Carbon</option>
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
<option value="VADS">VADS</option>
|
|
31
|
+
<option value="GOV.UK">GOV.UK</option>
|
|
32
|
+
<option value="NASA">NASA</option></select
|
|
33
|
+
><button
|
|
32
34
|
type="button"
|
|
33
35
|
class="usa-button usx-button usa-button--primary usx-theme-picker__toggle"
|
|
34
36
|
aria-label="Confirm theme"
|
|
35
|
-
onclick="this.closest('.usx-theme-picker').classList.remove('usx-theme-picker--open')"
|
|
36
37
|
>
|
|
37
|
-
<svg
|
|
38
|
-
|
|
38
|
+
<svg
|
|
39
|
+
class="usa-icon usx-icon usx-theme-picker__icon"
|
|
40
|
+
aria-hidden="true"
|
|
41
|
+
focusable="false"
|
|
42
|
+
role="img"
|
|
43
|
+
>
|
|
44
|
+
<use href="/img/sprite.svg#close"></use>
|
|
39
45
|
</svg>
|
|
40
46
|
</button>
|
|
41
47
|
</div>
|
|
42
48
|
</div>
|
|
43
49
|
|
|
44
|
-
<h3 class="site-preview-heading text-ink">Light/Dark Theme Picker</h3>
|
|
45
50
|
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
onclick="this.closest('.usx-theme-picker').classList.add('usx-theme-picker--open')"
|
|
52
|
-
>
|
|
53
|
-
<svg
|
|
54
|
-
class="usa-icon usx-theme-picker__icon"
|
|
51
|
+
<h3 class="site-preview-heading">Ghost Select</h3>
|
|
52
|
+
<div class="usx-theme-picker usx-theme-picker--ghost-select">
|
|
53
|
+
<div class="usx-theme-picker__ghost">
|
|
54
|
+
<span
|
|
55
|
+
class="usa-button usx-button usx-button--ghost usx-theme-picker__ghost-face"
|
|
55
56
|
aria-hidden="true"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
class="usa-select usx-select"
|
|
68
|
-
id="theme-picker-light-dark-select"
|
|
69
|
-
onchange="window.usxThemePickerDemo.onChange(this.value)"
|
|
57
|
+
><svg
|
|
58
|
+
class="usa-icon usx-icon usx-theme-picker__icon"
|
|
59
|
+
aria-hidden="true"
|
|
60
|
+
focusable="false"
|
|
61
|
+
role="img"
|
|
62
|
+
>
|
|
63
|
+
<use href="./img/usx-sprite.svg#color_palette"></use></svg></span
|
|
64
|
+
><label class="usa-label usx-label usa-sr-only" for="theme-picker-example-ghost-select"
|
|
65
|
+
>Theme</label
|
|
66
|
+
><select
|
|
67
|
+
id="theme-picker-example-ghost-select"
|
|
68
|
+
class="usa-select usx-select usx-theme-picker__select--hidden"
|
|
70
69
|
>
|
|
71
|
-
<option value="
|
|
70
|
+
<option value="Default" selected="">Default</option>
|
|
71
|
+
<option value="Forest">Forest</option>
|
|
72
|
+
<option value="Sunset">Sunset</option>
|
|
73
|
+
<option value="Ocean">Ocean</option>
|
|
74
|
+
<option value="Aurora">Aurora</option>
|
|
75
|
+
<option value="Borealis">Borealis</option>
|
|
76
|
+
<option value="Midnight">Midnight</option>
|
|
77
|
+
<option value="Carbon">Carbon</option>
|
|
78
|
+
<option value="VADS">VADS</option>
|
|
79
|
+
<option value="GOV.UK">GOV.UK</option>
|
|
80
|
+
<option value="NASA">NASA</option>
|
|
81
|
+
</select>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
<h3 class="site-preview-heading">Swap</h3>
|
|
87
|
+
<div class="usx-theme-picker usx-theme-picker--swap">
|
|
88
|
+
<label
|
|
89
|
+
class="usx-swap usx-swap--rotate usx-theme-picker__swap usa-button usx-button usx-button--ghost"
|
|
90
|
+
><input type="checkbox" autocomplete="off" aria-label="Theme: Light. Switch to Dark" /><span
|
|
91
|
+
class="usx-swap-on"
|
|
92
|
+
><svg
|
|
93
|
+
class="usa-icon usx-icon usx-theme-picker__icon"
|
|
94
|
+
aria-hidden="true"
|
|
95
|
+
focusable="false"
|
|
96
|
+
role="img"
|
|
97
|
+
>
|
|
98
|
+
<use href="./img/usx-sprite.svg#moon"></use></svg></span
|
|
99
|
+
><span class="usx-swap-off"
|
|
100
|
+
><svg
|
|
101
|
+
class="usa-icon usx-icon usx-theme-picker__icon"
|
|
102
|
+
aria-hidden="true"
|
|
103
|
+
focusable="false"
|
|
104
|
+
role="img"
|
|
105
|
+
>
|
|
106
|
+
<use href="./img/usx-sprite.svg#sun"></use></svg></span
|
|
107
|
+
></label>
|
|
108
|
+
<div class="usx-theme-picker__fallback">
|
|
109
|
+
<label class="usa-label usx-label usa-sr-only" for="theme-picker-example-swap">Theme</label
|
|
110
|
+
><select id="theme-picker-example-swap" class="usa-select usx-select">
|
|
111
|
+
<option value="Aurora" selected="">Light</option>
|
|
72
112
|
<option value="Borealis">Dark</option>
|
|
73
113
|
</select>
|
|
74
|
-
<button
|
|
75
|
-
type="button"
|
|
76
|
-
class="usa-button usx-button usa-button--primary usx-theme-picker__toggle"
|
|
77
|
-
aria-label="Confirm theme"
|
|
78
|
-
onclick="this.closest('.usx-theme-picker').classList.remove('usx-theme-picker--open')"
|
|
79
|
-
>
|
|
80
|
-
<svg class="usa-icon usx-theme-picker__icon" aria-hidden="true" focusable="false" role="img">
|
|
81
|
-
<use href="img/sprite.svg#close"></use>
|
|
82
|
-
</svg>
|
|
83
|
-
</button>
|
|
84
114
|
</div>
|
|
85
115
|
</div>
|
|
@@ -8,15 +8,12 @@
|
|
|
8
8
|
aria-controls="react-theme-picker-1-panel"
|
|
9
9
|
>
|
|
10
10
|
<svg
|
|
11
|
-
class="usa-icon usx-theme-picker__icon"
|
|
11
|
+
class="usa-icon usx-icon usx-theme-picker__icon"
|
|
12
12
|
aria-hidden="true"
|
|
13
13
|
focusable="false"
|
|
14
|
-
|
|
14
|
+
role="img"
|
|
15
15
|
>
|
|
16
|
-
<
|
|
17
|
-
fill="currentColor"
|
|
18
|
-
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"
|
|
19
|
-
></path>
|
|
16
|
+
<use href="/img/usx-sprite.svg#color_palette"></use>
|
|
20
17
|
</svg>
|
|
21
18
|
</button>
|
|
22
19
|
<div id="react-theme-picker-1-panel" class="usx-theme-picker__panel">
|
|
@@ -60,15 +57,12 @@
|
|
|
60
57
|
aria-controls="react-theme-picker-2-panel"
|
|
61
58
|
>
|
|
62
59
|
<svg
|
|
63
|
-
class="usa-icon usx-theme-picker__icon"
|
|
60
|
+
class="usa-icon usx-icon usx-theme-picker__icon"
|
|
64
61
|
aria-hidden="true"
|
|
65
62
|
focusable="false"
|
|
66
|
-
|
|
63
|
+
role="img"
|
|
67
64
|
>
|
|
68
|
-
<
|
|
69
|
-
fill="currentColor"
|
|
70
|
-
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"
|
|
71
|
-
></path>
|
|
65
|
+
<use href="/img/usx-sprite.svg#color_palette"></use>
|
|
72
66
|
</svg>
|
|
73
67
|
</button>
|
|
74
68
|
<div id="react-theme-picker-2-panel" class="usx-theme-picker__panel">
|
|
@@ -92,3 +86,117 @@
|
|
|
92
86
|
</button>
|
|
93
87
|
</div>
|
|
94
88
|
</div>
|
|
89
|
+
|
|
90
|
+
<h3 class="site-preview-heading">Ghost Select</h3>
|
|
91
|
+
<div class="usx-theme-picker usx-theme-picker--ghost-select">
|
|
92
|
+
<div class="usx-theme-picker__ghost">
|
|
93
|
+
<span
|
|
94
|
+
class="usa-button usx-button usx-button--ghost usx-theme-picker__ghost-face"
|
|
95
|
+
aria-hidden="true"
|
|
96
|
+
><svg
|
|
97
|
+
class="usa-icon usx-icon usx-theme-picker__icon"
|
|
98
|
+
aria-hidden="true"
|
|
99
|
+
focusable="false"
|
|
100
|
+
role="img"
|
|
101
|
+
>
|
|
102
|
+
<use href="/img/usx-sprite.svg#color_palette"></use></svg></span
|
|
103
|
+
><label class="usa-label usx-label usa-sr-only" for="react-theme-picker-ghost-select"
|
|
104
|
+
>Theme</label
|
|
105
|
+
><select
|
|
106
|
+
id="react-theme-picker-ghost-select"
|
|
107
|
+
class="usa-select usx-select usx-theme-picker__select--hidden"
|
|
108
|
+
>
|
|
109
|
+
<option value="Default" selected="">Default</option>
|
|
110
|
+
<option value="Forest">Forest</option>
|
|
111
|
+
<option value="Sunset">Sunset</option>
|
|
112
|
+
<option value="Ocean">Ocean</option>
|
|
113
|
+
<option value="Aurora">Aurora</option>
|
|
114
|
+
<option value="Borealis">Borealis</option>
|
|
115
|
+
<option value="Midnight">Midnight</option>
|
|
116
|
+
<option value="Carbon">Carbon</option>
|
|
117
|
+
<option value="VADS">VADS</option>
|
|
118
|
+
<option value="GOV.UK">GOV.UK</option>
|
|
119
|
+
<option value="NASA">NASA</option>
|
|
120
|
+
</select>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
<h3 class="site-preview-heading">Swap</h3>
|
|
125
|
+
<div class="usx-theme-picker usx-theme-picker--swap">
|
|
126
|
+
<label
|
|
127
|
+
class="usx-swap usx-swap--rotate usx-theme-picker__swap usa-button usx-button usx-button--ghost"
|
|
128
|
+
><input type="checkbox" autocomplete="off" aria-label="Theme: Light. Switch to Dark" /><span
|
|
129
|
+
class="usx-swap-on"
|
|
130
|
+
><svg
|
|
131
|
+
class="usa-icon usx-icon usx-theme-picker__icon"
|
|
132
|
+
aria-hidden="true"
|
|
133
|
+
focusable="false"
|
|
134
|
+
role="img"
|
|
135
|
+
>
|
|
136
|
+
<use href="/img/usx-sprite.svg#moon"></use></svg></span
|
|
137
|
+
><span class="usx-swap-off"
|
|
138
|
+
><svg
|
|
139
|
+
class="usa-icon usx-icon usx-theme-picker__icon"
|
|
140
|
+
aria-hidden="true"
|
|
141
|
+
focusable="false"
|
|
142
|
+
role="img"
|
|
143
|
+
>
|
|
144
|
+
<use href="/img/usx-sprite.svg#sun"></use></svg></span
|
|
145
|
+
></label>
|
|
146
|
+
<div class="usx-theme-picker__fallback">
|
|
147
|
+
<label class="usa-label usx-label usa-sr-only" for="react-theme-picker-swap">Theme</label
|
|
148
|
+
><select id="react-theme-picker-swap" class="usa-select usx-select">
|
|
149
|
+
<option value="Aurora" selected="">Light</option>
|
|
150
|
+
<option value="Borealis">Dark</option>
|
|
151
|
+
</select>
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
<h3 class="site-preview-heading">With Value</h3>
|
|
156
|
+
<div class="usx-theme-picker">
|
|
157
|
+
<button
|
|
158
|
+
type="button"
|
|
159
|
+
class="usa-button usx-button usx-button--ghost usx-theme-picker__trigger"
|
|
160
|
+
aria-label="Theme"
|
|
161
|
+
aria-expanded="false"
|
|
162
|
+
aria-controls="react-theme-picker-value-panel"
|
|
163
|
+
>
|
|
164
|
+
<svg
|
|
165
|
+
class="usa-icon usx-icon usx-theme-picker__icon"
|
|
166
|
+
aria-hidden="true"
|
|
167
|
+
focusable="false"
|
|
168
|
+
role="img"
|
|
169
|
+
>
|
|
170
|
+
<use href="/img/usx-sprite.svg#color_palette"></use>
|
|
171
|
+
</svg>
|
|
172
|
+
</button>
|
|
173
|
+
<div id="react-theme-picker-value-panel" class="usx-theme-picker__panel">
|
|
174
|
+
<label class="usa-label usx-label usa-sr-only" for="react-theme-picker-value">Theme</label
|
|
175
|
+
><select id="react-theme-picker-value" class="usa-select usx-select">
|
|
176
|
+
<option value="Default">Default</option>
|
|
177
|
+
<option value="Forest" selected="">Forest</option>
|
|
178
|
+
<option value="Sunset">Sunset</option>
|
|
179
|
+
<option value="Ocean">Ocean</option>
|
|
180
|
+
<option value="Aurora">Aurora</option>
|
|
181
|
+
<option value="Borealis">Borealis</option>
|
|
182
|
+
<option value="Midnight">Midnight</option>
|
|
183
|
+
<option value="Carbon">Carbon</option>
|
|
184
|
+
<option value="VADS">VADS</option>
|
|
185
|
+
<option value="GOV.UK">GOV.UK</option>
|
|
186
|
+
<option value="NASA">NASA</option></select
|
|
187
|
+
><button
|
|
188
|
+
type="button"
|
|
189
|
+
class="usa-button usx-button usa-button--primary usx-theme-picker__toggle"
|
|
190
|
+
aria-label="Confirm theme"
|
|
191
|
+
>
|
|
192
|
+
<svg
|
|
193
|
+
class="usa-icon usx-icon usx-theme-picker__icon"
|
|
194
|
+
aria-hidden="true"
|
|
195
|
+
focusable="false"
|
|
196
|
+
role="img"
|
|
197
|
+
>
|
|
198
|
+
<use href="/img/sprite.svg#close"></use>
|
|
199
|
+
</svg>
|
|
200
|
+
</button>
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
@@ -7,11 +7,13 @@ import ErrorMessage from '../error-message/ErrorMessage';
|
|
|
7
7
|
import FormGroup from '../form-group/FormGroup';
|
|
8
8
|
|
|
9
9
|
export interface TimePickerProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'defaultValue' | 'step'> {
|
|
10
|
+
extraAttributes?: Record<string, unknown>;
|
|
10
11
|
label?: React.ReactNode;
|
|
11
12
|
hint?: React.ReactNode;
|
|
12
13
|
error?: React.ReactNode;
|
|
13
14
|
ariaDisabled?: boolean;
|
|
14
15
|
defaultValue?: string | null;
|
|
16
|
+
value?: string;
|
|
15
17
|
minTime?: string | null;
|
|
16
18
|
maxTime?: string | null;
|
|
17
19
|
step?: string | number | null;
|
|
@@ -28,11 +30,13 @@ export default function TimePicker({
|
|
|
28
30
|
ariaDisabled = false,
|
|
29
31
|
required = false,
|
|
30
32
|
defaultValue = null,
|
|
33
|
+
value,
|
|
31
34
|
minTime = null,
|
|
32
35
|
maxTime = null,
|
|
33
36
|
step = null,
|
|
34
37
|
formGroup = true,
|
|
35
38
|
className = '',
|
|
39
|
+
extraAttributes,
|
|
36
40
|
...props
|
|
37
41
|
}: TimePickerProps) {
|
|
38
42
|
const labelId = `${id}-label`;
|
|
@@ -63,6 +67,7 @@ export default function TimePicker({
|
|
|
63
67
|
{hint && <Hint id={hintId}>{hint}</Hint>}
|
|
64
68
|
{error && <ErrorMessage id={errorId}>{error}</ErrorMessage>}
|
|
65
69
|
<div
|
|
70
|
+
{...extraAttributes}
|
|
66
71
|
className={containerClasses}
|
|
67
72
|
{...(minTime ? { 'data-min-time': minTime } : {})}
|
|
68
73
|
{...(maxTime ? { 'data-max-time': maxTime } : {})}
|
|
@@ -74,7 +79,7 @@ export default function TimePicker({
|
|
|
74
79
|
name={name || id}
|
|
75
80
|
type="text"
|
|
76
81
|
aria-describedby={describedBy}
|
|
77
|
-
|
|
82
|
+
{...(value !== undefined ? { value } : { defaultValue: defaultValue || undefined })}
|
|
78
83
|
disabled={disabled}
|
|
79
84
|
aria-disabled={!disabled && ariaDisabled ? 'true' : undefined}
|
|
80
85
|
required={required}
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
"hint": "Select a time from the dropdown or type to jump to the first matching time."
|
|
10
10
|
},
|
|
11
11
|
"props": {
|
|
12
|
+
"extraAttributes": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"description": "Additional attributes on the USWDS enhancement target."
|
|
15
|
+
},
|
|
12
16
|
"id": {
|
|
13
17
|
"type": "string",
|
|
14
18
|
"default": "appointment-time",
|
|
@@ -50,6 +54,11 @@
|
|
|
50
54
|
"type": "string",
|
|
51
55
|
"description": "Initial value shown in the time picker (e.g. \"1:00pm\"). Sets the value attribute on the input."
|
|
52
56
|
},
|
|
57
|
+
"value": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"default": null,
|
|
60
|
+
"description": "Current time field value. Takes precedence over defaultValue."
|
|
61
|
+
},
|
|
53
62
|
"minTime": {
|
|
54
63
|
"type": "string",
|
|
55
64
|
"description": "Earliest time option in hh:mm 24-hour format. Sets data-min-time on the wrapper. USWDS default: 00:00."
|
|
@@ -188,3 +188,29 @@
|
|
|
188
188
|
/>
|
|
189
189
|
</div>
|
|
190
190
|
</div>
|
|
191
|
+
|
|
192
|
+
<h3 class="site-preview-heading">With Value</h3>
|
|
193
|
+
<div class="usa-form-group usx-form-group">
|
|
194
|
+
<label
|
|
195
|
+
id="django-appointment-time-value-label"
|
|
196
|
+
class="usa-label usx-label"
|
|
197
|
+
for="django-appointment-time-value"
|
|
198
|
+
>
|
|
199
|
+
Current time
|
|
200
|
+
</label>
|
|
201
|
+
|
|
202
|
+
<span class="usa-hint usx-hint" id="django-appointment-time-value-hint"
|
|
203
|
+
>Select a time from the dropdown or type to jump to the first matching time.</span
|
|
204
|
+
>
|
|
205
|
+
|
|
206
|
+
<div class="usa-time-picker usx-time-picker">
|
|
207
|
+
<input
|
|
208
|
+
class="usa-input usx-input"
|
|
209
|
+
id="django-appointment-time-value"
|
|
210
|
+
name="appointment-time-value"
|
|
211
|
+
type="text"
|
|
212
|
+
aria-describedby="django-appointment-time-value-label django-appointment-time-value-hint"
|
|
213
|
+
value="2:30pm"
|
|
214
|
+
/>
|
|
215
|
+
</div>
|
|
216
|
+
</div>
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
{% endif %}
|
|
17
17
|
|
|
18
18
|
<div
|
|
19
|
-
class="usa-time-picker usx-time-picker{% if error %} usx-combo-box--error{% endif %}{% if className %} {{ className }}{% endif %}"
|
|
19
|
+
class="usa-time-picker usx-time-picker{% if error %} usx-combo-box--error{% 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 %}
|
|
20
20
|
{% if minTime %} data-min-time="{{ minTime }}"{% endif %}
|
|
21
21
|
{% if maxTime %} data-max-time="{{ maxTime }}"{% endif %}
|
|
22
22
|
{% if step %} data-step="{{ step }}"{% endif %}
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
name="{{ name|default:id }}"
|
|
28
28
|
type="text"
|
|
29
29
|
{% if label or hint or error %} aria-describedby="{% if label %}{{ id }}-label{% endif %}{% if label and hint %} {% endif %}{% if hint %}{{ id }}-hint{% endif %}{% if hint and error %} {% endif %}{% if not hint and label and error %} {% endif %}{% if error %}{{ id }}-error{% endif %}"{% endif %}
|
|
30
|
-
{% if defaultValue %} value="{{ defaultValue }}"{% endif %}
|
|
30
|
+
{% if value is not None %} value="{{ value }}"{% elif defaultValue %} value="{{ defaultValue }}"{% endif %}
|
|
31
31
|
{% if disabled %} disabled{% elif ariaDisabled %} aria-disabled="true"{% endif %}
|
|
32
32
|
{% if required %} required{% endif %}
|
|
33
33
|
/>
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
{% endif %}
|
|
48
48
|
|
|
49
49
|
<div
|
|
50
|
-
class="usa-time-picker usx-time-picker{% if className %} {{ className }}{% endif %}"
|
|
50
|
+
class="usa-time-picker usx-time-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 %}
|
|
51
51
|
{% if minTime %} data-min-time="{{ minTime }}"{% endif %}
|
|
52
52
|
{% if maxTime %} data-max-time="{{ maxTime }}"{% endif %}
|
|
53
53
|
{% if step %} data-step="{{ step }}"{% endif %}
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
name="{{ name|default:id }}"
|
|
59
59
|
type="text"
|
|
60
60
|
{% if label or hint or error %} aria-describedby="{% if label %}{{ id }}-label{% endif %}{% if label and hint %} {% endif %}{% if hint %}{{ id }}-hint{% endif %}{% if hint and error %} {% endif %}{% if not hint and label and error %} {% endif %}{% if error %}{{ id }}-error{% endif %}"{% endif %}
|
|
61
|
-
{% if defaultValue %} value="{{ defaultValue }}"{% endif %}
|
|
61
|
+
{% if value is not None %} value="{{ value }}"{% elif defaultValue %} value="{{ defaultValue }}"{% endif %}
|
|
62
62
|
{% if disabled %} disabled{% elif ariaDisabled %} aria-disabled="true"{% endif %}
|
|
63
63
|
{% if required %} required{% endif %}
|
|
64
64
|
/>
|
|
@@ -155,3 +155,25 @@
|
|
|
155
155
|
/>
|
|
156
156
|
</div>
|
|
157
157
|
</div>
|
|
158
|
+
|
|
159
|
+
<h3 class="site-preview-heading">With Value</h3>
|
|
160
|
+
<div class="usa-form-group usx-form-group">
|
|
161
|
+
<label
|
|
162
|
+
id="react-appointment-time-value-label"
|
|
163
|
+
class="usa-label usx-label"
|
|
164
|
+
for="react-appointment-time-value"
|
|
165
|
+
>Current time</label
|
|
166
|
+
><span class="usa-hint usx-hint" id="react-appointment-time-value-hint"
|
|
167
|
+
>Select a time from the dropdown or type to jump to the first matching time.</span
|
|
168
|
+
>
|
|
169
|
+
<div class="usa-time-picker usx-time-picker">
|
|
170
|
+
<input
|
|
171
|
+
class="usa-input usx-input"
|
|
172
|
+
id="react-appointment-time-value"
|
|
173
|
+
name="appointment-time-value"
|
|
174
|
+
type="text"
|
|
175
|
+
aria-describedby="react-appointment-time-value-label react-appointment-time-value-hint"
|
|
176
|
+
value="2:30pm"
|
|
177
|
+
/>
|
|
178
|
+
</div>
|
|
179
|
+
</div>
|