@solexllc/usx-react 0.1.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 +45 -0
- package/dist/index.cjs +6017 -0
- package/dist/index.js +6015 -0
- package/package.json +48 -0
- package/src/components/accordion/Accordion.jsx +170 -0
- package/src/components/accordion/accordion.django.html +47 -0
- package/src/components/accordion/accordion.html +304 -0
- package/src/components/accordion/config.json +31 -0
- package/src/components/alert/Alert.tsx +88 -0
- package/src/components/alert/alert.django.html +45 -0
- package/src/components/alert/alert.html +192 -0
- package/src/components/alert/config.json +70 -0
- package/src/components/attribution/Attribution.tsx +40 -0
- package/src/components/attribution/attribution.django.html +21 -0
- package/src/components/attribution/attribution.html +26 -0
- package/src/components/attribution/config.json +32 -0
- package/src/components/avatar/Avatar.tsx +85 -0
- package/src/components/avatar/avatar.django.html +27 -0
- package/src/components/avatar/avatar.html +101 -0
- package/src/components/avatar/config.json +59 -0
- package/src/components/avatar-group/AvatarGroup.tsx +43 -0
- package/src/components/avatar-group/avatar-group.django.html +8 -0
- package/src/components/avatar-group/avatar-group.html +208 -0
- package/src/components/avatar-group/config.json +60 -0
- package/src/components/back-to-top/BackToTop.tsx +60 -0
- package/src/components/back-to-top/back-to-top.django.html +38 -0
- package/src/components/back-to-top/back-to-top.html +107 -0
- package/src/components/back-to-top/config.json +44 -0
- package/src/components/banner/Banner.tsx +111 -0
- package/src/components/banner/banner.django.html +80 -0
- package/src/components/banner/banner.html +411 -0
- package/src/components/banner/config.json +47 -0
- package/src/components/block/Block.tsx +78 -0
- package/src/components/block/block.django.html +26 -0
- package/src/components/block/block.html +162 -0
- package/src/components/block/config.json +88 -0
- package/src/components/breadcrumb/Breadcrumb.tsx +83 -0
- package/src/components/breadcrumb/breadcrumb.django.html +24 -0
- package/src/components/breadcrumb/breadcrumb.html +108 -0
- package/src/components/breadcrumb/config.json +74 -0
- package/src/components/button/Button.tsx +121 -0
- package/src/components/button/button.django.html +58 -0
- package/src/components/button/button.html +363 -0
- package/src/components/button/config.json +103 -0
- package/src/components/button-group/ButtonGroup.tsx +33 -0
- package/src/components/button-group/button-group.django.html +9 -0
- package/src/components/button-group/button-group.html +159 -0
- package/src/components/button-group/config.json +25 -0
- package/src/components/calendar-date/CalendarDate.tsx +40 -0
- package/src/components/calendar-date/calendar-date.django.html +8 -0
- package/src/components/calendar-date/calendar-date.html +17 -0
- package/src/components/calendar-date/config.json +17 -0
- package/src/components/card/Card.tsx +137 -0
- package/src/components/card/card.django.html +40 -0
- package/src/components/card/card.html +67 -0
- package/src/components/card/config.json +115 -0
- package/src/components/card-group/CardGroup.tsx +23 -0
- package/src/components/card-group/card-group.django.html +6 -0
- package/src/components/card-group/card-group.html +164 -0
- package/src/components/card-group/config.json +21 -0
- package/src/components/carousel/Carousel.tsx +101 -0
- package/src/components/carousel/carousel.django.html +41 -0
- package/src/components/carousel/carousel.html +64 -0
- package/src/components/carousel/config.json +38 -0
- package/src/components/character-count/CharacterCount.tsx +77 -0
- package/src/components/character-count/character-count.django.html +19 -0
- package/src/components/character-count/character-count.html +110 -0
- package/src/components/character-count/config.json +78 -0
- package/src/components/checkbox/Checkbox.tsx +90 -0
- package/src/components/checkbox/checkbox.django.html +16 -0
- package/src/components/checkbox/checkbox.html +266 -0
- package/src/components/checkbox/config.json +71 -0
- package/src/components/checkbox-group/CheckboxGroup.tsx +67 -0
- package/src/components/checkbox-group/checkbox-group.django.html +12 -0
- package/src/components/checkbox-group/checkbox-group.html +36 -0
- package/src/components/checkbox-group/config.json +50 -0
- package/src/components/clickable/Clickable.tsx +78 -0
- package/src/components/clickable/clickable.django.html +5 -0
- package/src/components/clickable/clickable.html +133 -0
- package/src/components/clickable/config.json +26 -0
- package/src/components/code/Code.tsx +60 -0
- package/src/components/code/code.django.html +21 -0
- package/src/components/code/code.html +71 -0
- package/src/components/code/config.json +40 -0
- package/src/components/collection/Collection.tsx +99 -0
- package/src/components/collection/collection.django.html +48 -0
- package/src/components/collection/collection.html +384 -0
- package/src/components/collection/config.json +60 -0
- package/src/components/combobox/Combobox.tsx +114 -0
- package/src/components/combobox/combobox.django.html +61 -0
- package/src/components/combobox/combobox.html +509 -0
- package/src/components/combobox/config.json +80 -0
- package/src/components/copy-to-clipboard/CopyToClipboard.tsx +48 -0
- package/src/components/copy-to-clipboard/config.json +30 -0
- package/src/components/copy-to-clipboard/copy-to-clipboard.django.html +16 -0
- package/src/components/copy-to-clipboard/copy-to-clipboard.html +68 -0
- package/src/components/date-picker/DatePicker.jsx +83 -0
- package/src/components/date-picker/config.json +71 -0
- package/src/components/date-picker/date-picker.django.html +67 -0
- package/src/components/date-picker/date-picker.html +104 -0
- package/src/components/date-range-picker/DateRangePicker.jsx +113 -0
- package/src/components/date-range-picker/config.json +92 -0
- package/src/components/date-range-picker/date-range-picker.django.html +66 -0
- package/src/components/date-range-picker/date-range-picker.html +190 -0
- package/src/components/error-message/ErrorMessage.tsx +23 -0
- package/src/components/error-message/config.json +19 -0
- package/src/components/error-message/error-message.django.html +2 -0
- package/src/components/error-message/error-message.html +2 -0
- package/src/components/eyebrow/Eyebrow.tsx +15 -0
- package/src/components/eyebrow/config.json +15 -0
- package/src/components/eyebrow/eyebrow.django.html +4 -0
- package/src/components/eyebrow/eyebrow.html +4 -0
- package/src/components/fieldset/Fieldset.tsx +54 -0
- package/src/components/fieldset/config.json +47 -0
- package/src/components/fieldset/fieldset.django.html +22 -0
- package/src/components/fieldset/fieldset.html +17 -0
- package/src/components/file-input/FileInput.jsx +174 -0
- package/src/components/file-input/config.json +80 -0
- package/src/components/file-input/file-input.django.html +57 -0
- package/src/components/file-input/file-input.html +258 -0
- package/src/components/file-list/FileList.jsx +105 -0
- package/src/components/file-list/config.json +43 -0
- package/src/components/file-list/file-list.django.html +30 -0
- package/src/components/file-list/file-list.html +61 -0
- package/src/components/footer/Footer.tsx +365 -0
- package/src/components/footer/config.json +83 -0
- package/src/components/footer/footer.django.html +260 -0
- package/src/components/footer/footer.html +392 -0
- package/src/components/form-group/FormGroup.tsx +26 -0
- package/src/components/form-group/config.json +22 -0
- package/src/components/form-group/form-group.django.html +4 -0
- package/src/components/form-group/form-group.html +17 -0
- package/src/components/header/Branding.tsx +101 -0
- package/src/components/header/Header.tsx +229 -0
- package/src/components/header/HeaderBranding.jsx +4 -0
- package/src/components/header/config.json +58 -0
- package/src/components/header/header.django.html +194 -0
- package/src/components/header/header.html +823 -0
- package/src/components/hero/Hero.tsx +64 -0
- package/src/components/hero/config.json +70 -0
- package/src/components/hero/hero.django.html +22 -0
- package/src/components/hero/hero.html +75 -0
- package/src/components/hint/Hint.tsx +23 -0
- package/src/components/hint/config.json +19 -0
- package/src/components/hint/hint.django.html +2 -0
- package/src/components/hint/hint.html +2 -0
- package/src/components/icon/Icon.tsx +46 -0
- package/src/components/icon/config.json +60 -0
- package/src/components/icon/icon.django.html +26 -0
- package/src/components/icon/icon.html +289 -0
- package/src/components/icon/icons_list.json +247 -0
- package/src/components/icon-list/IconList.tsx +59 -0
- package/src/components/icon-list/config.json +86 -0
- package/src/components/icon-list/icon-list.django.html +17 -0
- package/src/components/icon-list/icon-list.html +227 -0
- package/src/components/identifier/Identifier.tsx +193 -0
- package/src/components/identifier/config.json +133 -0
- package/src/components/identifier/identifier.django.html +99 -0
- package/src/components/identifier/identifier.html +737 -0
- package/src/components/image/Image.tsx +106 -0
- package/src/components/image/config.json +64 -0
- package/src/components/image/image.django.html +62 -0
- package/src/components/image/image.html +53 -0
- package/src/components/in-page-nav/InPageNav.jsx +76 -0
- package/src/components/in-page-nav/config.json +69 -0
- package/src/components/in-page-nav/in-page-nav.django.html +28 -0
- package/src/components/in-page-nav/in-page-nav.html +183 -0
- package/src/components/indicator/Indicator.tsx +32 -0
- package/src/components/indicator/README.md +1 -0
- package/src/components/indicator/config.json +19 -0
- package/src/components/indicator/indicator.django.html +10 -0
- package/src/components/indicator/indicator.html +42 -0
- package/src/components/input/Input.tsx +85 -0
- package/src/components/input/config.json +73 -0
- package/src/components/input/input.django.html +55 -0
- package/src/components/input/input.html +59 -0
- package/src/components/label/Label.tsx +42 -0
- package/src/components/label/config.json +39 -0
- package/src/components/label/label.django.html +23 -0
- package/src/components/label/label.html +23 -0
- package/src/components/language-selector/LanguageSelector.jsx +224 -0
- package/src/components/language-selector/config.json +107 -0
- package/src/components/language-selector/language-selector.django.html +40 -0
- package/src/components/language-selector/language-selector.html +85 -0
- package/src/components/layout/Layout.tsx +131 -0
- package/src/components/layout/config.json +36 -0
- package/src/components/layout/layout.django.html +28 -0
- package/src/components/layout/layout.html +29 -0
- package/src/components/legend/Legend.tsx +34 -0
- package/src/components/legend/config.json +27 -0
- package/src/components/legend/legend.django.html +11 -0
- package/src/components/legend/legend.html +12 -0
- package/src/components/link/Link.tsx +45 -0
- package/src/components/link/config.json +39 -0
- package/src/components/link/link.django.html +8 -0
- package/src/components/link/link.html +47 -0
- package/src/components/list/List.tsx +82 -0
- package/src/components/list/_list-items.django.html +17 -0
- package/src/components/list/config.json +25 -0
- package/src/components/list/list.django.html +11 -0
- package/src/components/list/list.html +26 -0
- package/src/components/memorable-date/MemorableDate.jsx +167 -0
- package/src/components/memorable-date/config.json +104 -0
- package/src/components/memorable-date/memorable-date.django.html +86 -0
- package/src/components/memorable-date/memorable-date.html +275 -0
- package/src/components/misc-banner/MiscBanner.tsx +112 -0
- package/src/components/misc-banner/config.json +57 -0
- package/src/components/misc-banner/misc-banner.django.html +63 -0
- package/src/components/misc-banner/misc-banner.html +191 -0
- package/src/components/modal/Modal.tsx +71 -0
- package/src/components/modal/config.json +57 -0
- package/src/components/modal/modal.django.html +43 -0
- package/src/components/modal/modal.html +222 -0
- package/src/components/page/Page.jsx +34 -0
- package/src/components/page/config.json +34 -0
- package/src/components/page/page.django.html +5 -0
- package/src/components/page/page.html +23 -0
- package/src/components/pagination/Pagination.tsx +112 -0
- package/src/components/pagination/config.json +135 -0
- package/src/components/pagination/container/PaginationContainer.tsx +38 -0
- package/src/components/pagination/navigation/PaginationNavigation.tsx +219 -0
- package/src/components/pagination/navigation/pagination-navigation.django.html +64 -0
- package/src/components/pagination/pagination.django.html +48 -0
- package/src/components/pagination/pagination.html +613 -0
- package/src/components/pagination/step-options/PaginationStepOptions.tsx +43 -0
- package/src/components/pagination/step-options/pagination-step-options.django.html +7 -0
- package/src/components/pagination/summary/PaginationSummary.tsx +33 -0
- package/src/components/pagination/summary/pagination-summary.django.html +12 -0
- package/src/components/process-list/ProcessList.tsx +52 -0
- package/src/components/process-list/config.json +15 -0
- package/src/components/process-list/process-list.django.html +15 -0
- package/src/components/process-list/process-list.html +90 -0
- package/src/components/prose/Prose.tsx +32 -0
- package/src/components/prose/config.json +28 -0
- package/src/components/prose/prose.django.html +35 -0
- package/src/components/prose/prose.html +91 -0
- package/src/components/radio-buttons/RadioButtons.tsx +82 -0
- package/src/components/radio-buttons/config.json +57 -0
- package/src/components/radio-buttons/radio-buttons.django.html +28 -0
- package/src/components/radio-buttons/radio-buttons.html +189 -0
- package/src/components/range-slider/RangeSlider.jsx +84 -0
- package/src/components/range-slider/config.json +89 -0
- package/src/components/range-slider/range-slider.django.html +65 -0
- package/src/components/range-slider/range-slider.html +106 -0
- package/src/components/required/Required.tsx +25 -0
- package/src/components/required/config.json +20 -0
- package/src/components/required/required.django.html +2 -0
- package/src/components/required/required.html +6 -0
- package/src/components/search/Search.tsx +92 -0
- package/src/components/search/config.json +69 -0
- package/src/components/search/search.django.html +59 -0
- package/src/components/search/search.html +76 -0
- package/src/components/section/Section.tsx +28 -0
- package/src/components/section/config.json +27 -0
- package/src/components/section/section.django.html +5 -0
- package/src/components/section/section.html +16 -0
- package/src/components/select/Select.tsx +107 -0
- package/src/components/select/config.json +80 -0
- package/src/components/select/select.django.html +64 -0
- package/src/components/select/select.html +62 -0
- package/src/components/sidenav/SideNav.tsx +74 -0
- package/src/components/sidenav/config.json +45 -0
- package/src/components/sidenav/sidenav.django.html +29 -0
- package/src/components/sidenav/sidenav.html +84 -0
- package/src/components/site-alert/SiteAlert.tsx +101 -0
- package/src/components/site-alert/config.json +62 -0
- package/src/components/site-alert/site-alert.django.html +34 -0
- package/src/components/site-alert/site-alert.html +312 -0
- package/src/components/skipnav/Skipnav.tsx +41 -0
- package/src/components/skipnav/config.json +29 -0
- package/src/components/skipnav/skipnav.django.html +11 -0
- package/src/components/skipnav/skipnav.html +1 -0
- package/src/components/spinner/Spinner.tsx +46 -0
- package/src/components/spinner/config.json +44 -0
- package/src/components/spinner/spinner.django.html +8 -0
- package/src/components/spinner/spinner.html +219 -0
- package/src/components/status/Status.tsx +28 -0
- package/src/components/status/config.json +47 -0
- package/src/components/status/status.django.html +2 -0
- package/src/components/status/status.html +31 -0
- package/src/components/step-indicator/StepIndicator.tsx +80 -0
- package/src/components/step-indicator/config.json +54 -0
- package/src/components/step-indicator/step-indicator.django.html +29 -0
- package/src/components/step-indicator/step-indicator.html +243 -0
- package/src/components/summary-box/SummaryBox.tsx +41 -0
- package/src/components/summary-box/config.json +30 -0
- package/src/components/summary-box/summary-box.django.html +19 -0
- package/src/components/summary-box/summary-box.html +210 -0
- package/src/components/swap/Swap.tsx +47 -0
- package/src/components/swap/config.json +61 -0
- package/src/components/swap/swap.django.html +14 -0
- package/src/components/swap/swap.html +163 -0
- package/src/components/switch/Switch.tsx +73 -0
- package/src/components/switch/config.json +55 -0
- package/src/components/switch/switch.django.html +28 -0
- package/src/components/switch/switch.html +56 -0
- package/src/components/table/Table.tsx +334 -0
- package/src/components/table/TableBody.tsx +253 -0
- package/src/components/table/TableCell.tsx +37 -0
- package/src/components/table/TableContext.tsx +87 -0
- package/src/components/table/TableFoot.tsx +68 -0
- package/src/components/table/TableGroup.tsx +69 -0
- package/src/components/table/TableHead.tsx +139 -0
- package/src/components/table/TableRow.tsx +56 -0
- package/src/components/table/__pycache__/table_helper.cpython-312.pyc +0 -0
- package/src/components/table/config.json +297 -0
- package/src/components/table/hooks/useRowDetails.ts +34 -0
- package/src/components/table/hooks/useTableGroups.ts +61 -0
- package/src/components/table/hooks/useTableSelect.ts +82 -0
- package/src/components/table/hooks/useTableSort.ts +60 -0
- package/src/components/table/table-body.django.html +68 -0
- package/src/components/table/table-detail-row.django.html +14 -0
- package/src/components/table/table-foot.django.html +31 -0
- package/src/components/table/table-group.django.html +40 -0
- package/src/components/table/table-head.django.html +85 -0
- package/src/components/table/table-row.django.html +98 -0
- package/src/components/table/table.django.html +60 -0
- package/src/components/table/table.html +1186 -0
- package/src/components/table/table_helper.py +298 -0
- package/src/components/table/types.ts +68 -0
- package/src/components/tag/Tag.tsx +75 -0
- package/src/components/tag/config.json +54 -0
- package/src/components/tag/tag.django.html +39 -0
- package/src/components/tag/tag.html +45 -0
- package/src/components/tag-group/TagGroup.tsx +35 -0
- package/src/components/tag-group/config.json +24 -0
- package/src/components/tag-group/tag-group.django.html +11 -0
- package/src/components/tag-group/tag-group.html +36 -0
- package/src/components/task-list/TaskList.tsx +40 -0
- package/src/components/task-list/config.json +41 -0
- package/src/components/task-list/task-list.django.html +21 -0
- package/src/components/task-list/task-list.html +24 -0
- package/src/components/text-area/TextArea.tsx +78 -0
- package/src/components/text-area/config.json +78 -0
- package/src/components/text-area/text-area.django.html +53 -0
- package/src/components/text-area/text-area.html +59 -0
- package/src/components/theme-picker/ThemePicker.tsx +106 -0
- package/src/components/theme-picker/config.json +39 -0
- package/src/components/theme-picker/theme-picker.django.html +32 -0
- package/src/components/theme-picker/theme-picker.html +67 -0
- package/src/components/time-picker/TimePicker.jsx +87 -0
- package/src/components/time-picker/config.json +76 -0
- package/src/components/time-picker/time-picker.django.html +67 -0
- package/src/components/time-picker/time-picker.html +123 -0
- package/src/components/toggle/Toggle.tsx +80 -0
- package/src/components/toggle/config.json +69 -0
- package/src/components/toggle/toggle.django.html +19 -0
- package/src/components/toggle/toggle.html +85 -0
- package/src/components/tooltip/Tooltip.tsx +33 -0
- package/src/components/tooltip/config.json +33 -0
- package/src/components/tooltip/tooltip.django.html +5 -0
- package/src/components/tooltip/tooltip.html +57 -0
- package/src/components/villain/Villain.tsx +47 -0
- package/src/components/villain/config.json +44 -0
- package/src/components/villain/villain.django.html +19 -0
- package/src/components/villain/villain.html +39 -0
- package/src/declarations.d.ts +1 -0
- package/src/index.js +82 -0
- package/src/styles/core.scss +12 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
<h3 class="site-preview-heading">Default</h3>
|
|
2
|
+
<fieldset class="usa-fieldset">
|
|
3
|
+
<legend class="usa-legend usa-legend">Select one historical figure</legend>
|
|
4
|
+
<div class="usa-radio usx-radio">
|
|
5
|
+
<input
|
|
6
|
+
class="usa-radio__input"
|
|
7
|
+
id="historical-truth"
|
|
8
|
+
type="radio"
|
|
9
|
+
name="historical-figures"
|
|
10
|
+
value="sojourner-truth"
|
|
11
|
+
checked="checked"
|
|
12
|
+
/>
|
|
13
|
+
<label class="usa-radio__label" for="historical-truth"
|
|
14
|
+
>Sojourner Truth</label
|
|
15
|
+
>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="usa-radio usx-radio">
|
|
18
|
+
<input
|
|
19
|
+
class="usa-radio__input"
|
|
20
|
+
id="historical-douglass"
|
|
21
|
+
type="radio"
|
|
22
|
+
name="historical-figures"
|
|
23
|
+
value="frederick-douglass"
|
|
24
|
+
/>
|
|
25
|
+
<label class="usa-radio__label" for="historical-douglass"
|
|
26
|
+
>Frederick Douglass</label
|
|
27
|
+
>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="usa-radio usx-radio">
|
|
30
|
+
<input
|
|
31
|
+
class="usa-radio__input"
|
|
32
|
+
id="historical-washington"
|
|
33
|
+
type="radio"
|
|
34
|
+
name="historical-figures"
|
|
35
|
+
value="booker-t-washington"
|
|
36
|
+
/>
|
|
37
|
+
<label class="usa-radio__label" for="historical-washington"
|
|
38
|
+
>Booker T. Washington</label
|
|
39
|
+
>
|
|
40
|
+
</div>
|
|
41
|
+
<div class="usa-radio usx-radio">
|
|
42
|
+
<input
|
|
43
|
+
class="usa-radio__input"
|
|
44
|
+
id="historical-carver"
|
|
45
|
+
type="radio"
|
|
46
|
+
name="historical-figures"
|
|
47
|
+
value="george-washington-carver"
|
|
48
|
+
disabled="disabled"
|
|
49
|
+
/>
|
|
50
|
+
<label class="usa-radio__label" for="historical-carver"
|
|
51
|
+
>George Washington Carver</label
|
|
52
|
+
>
|
|
53
|
+
</div>
|
|
54
|
+
</fieldset>
|
|
55
|
+
|
|
56
|
+
<h3 class="site-preview-heading">Tile</h3>
|
|
57
|
+
<form class="usa-form">
|
|
58
|
+
<fieldset class="usa-fieldset">
|
|
59
|
+
<legend class="usa-legend">Select one historical figure</legend>
|
|
60
|
+
<div class="usa-radio usx-radio">
|
|
61
|
+
<input
|
|
62
|
+
class="usa-radio__input usa-radio__input--tile"
|
|
63
|
+
id="historical-truth-2"
|
|
64
|
+
type="radio"
|
|
65
|
+
name="historical-figures-2"
|
|
66
|
+
value="sojourner-truth"
|
|
67
|
+
checked="checked"
|
|
68
|
+
/>
|
|
69
|
+
<label class="usa-radio__label" for="historical-truth-2"
|
|
70
|
+
>Sojourner Truth</label
|
|
71
|
+
>
|
|
72
|
+
</div>
|
|
73
|
+
<div class="usa-radio usx-radio">
|
|
74
|
+
<input
|
|
75
|
+
class="usa-radio__input usa-radio__input--tile"
|
|
76
|
+
id="historical-douglass-2"
|
|
77
|
+
type="radio"
|
|
78
|
+
name="historical-figures-2"
|
|
79
|
+
value="frederick-douglass"
|
|
80
|
+
/>
|
|
81
|
+
<label class="usa-radio__label" for="historical-douglass-2"
|
|
82
|
+
>Frederick Douglass
|
|
83
|
+
<span class="usa-checkbox__label-description"
|
|
84
|
+
>This is optional text that can be used to describe the label in more
|
|
85
|
+
detail.</span
|
|
86
|
+
></label
|
|
87
|
+
>
|
|
88
|
+
</div>
|
|
89
|
+
<div class="usa-radio usx-radio">
|
|
90
|
+
<input
|
|
91
|
+
class="usa-radio__input usa-radio__input--tile"
|
|
92
|
+
id="historical-washington-2"
|
|
93
|
+
type="radio"
|
|
94
|
+
name="historical-figures-2"
|
|
95
|
+
value="booker-t-washington"
|
|
96
|
+
/>
|
|
97
|
+
<label class="usa-radio__label" for="historical-washington-2"
|
|
98
|
+
>Booker T. Washington</label
|
|
99
|
+
>
|
|
100
|
+
</div>
|
|
101
|
+
<div class="usa-radio usx-radio">
|
|
102
|
+
<input
|
|
103
|
+
class="usa-radio__input usa-radio__input--tile"
|
|
104
|
+
id="historical-carver-2"
|
|
105
|
+
type="radio"
|
|
106
|
+
name="historical-figures-2"
|
|
107
|
+
value="george-washington-carver"
|
|
108
|
+
disabled="disabled"
|
|
109
|
+
/>
|
|
110
|
+
<label class="usa-radio__label" for="historical-carver-2"
|
|
111
|
+
>George Washington Carver</label
|
|
112
|
+
>
|
|
113
|
+
</div>
|
|
114
|
+
<div class="usa-radio usx-radio">
|
|
115
|
+
<input
|
|
116
|
+
class="usa-radio__input usa-radio__input--tile"
|
|
117
|
+
id="historical-carver-2"
|
|
118
|
+
type="radio"
|
|
119
|
+
name="historical-figures-2"
|
|
120
|
+
value="james-madison"
|
|
121
|
+
disabled="disabled"
|
|
122
|
+
checked="checked"
|
|
123
|
+
/>
|
|
124
|
+
<label class="usa-radio__label" for="historical-carver-2"
|
|
125
|
+
>James Madison</label
|
|
126
|
+
>
|
|
127
|
+
</div>
|
|
128
|
+
</fieldset>
|
|
129
|
+
</form>
|
|
130
|
+
|
|
131
|
+
<h3 class="site-preview-heading">Small</h3>
|
|
132
|
+
<fieldset class="usa-fieldset">
|
|
133
|
+
<legend class="usa-legend">Select one historical figure</legend>
|
|
134
|
+
<div class="usa-radio usx-radio usx-radio--small">
|
|
135
|
+
<input class="usa-radio__input" id="small-historical-truth" type="radio" name="small-historical-figures" value="sojourner-truth" checked="checked" />
|
|
136
|
+
<label class="usa-radio__label" for="small-historical-truth">Sojourner Truth</label>
|
|
137
|
+
</div>
|
|
138
|
+
<div class="usa-radio usx-radio usx-radio--small">
|
|
139
|
+
<input class="usa-radio__input" id="small-historical-douglass" type="radio" name="small-historical-figures" value="frederick-douglass" />
|
|
140
|
+
<label class="usa-radio__label" for="small-historical-douglass">Frederick Douglass</label>
|
|
141
|
+
</div>
|
|
142
|
+
<div class="usa-radio usx-radio usx-radio--small">
|
|
143
|
+
<input class="usa-radio__input" id="small-historical-washington" type="radio" name="small-historical-figures" value="booker-t-washington" />
|
|
144
|
+
<label class="usa-radio__label" for="small-historical-washington">Booker T. Washington</label>
|
|
145
|
+
</div>
|
|
146
|
+
<div class="usa-radio usx-radio usx-radio--small">
|
|
147
|
+
<input class="usa-radio__input" id="small-historical-carver" type="radio" name="small-historical-figures" value="george-washington-carver" disabled="disabled" />
|
|
148
|
+
<label class="usa-radio__label" for="small-historical-carver">George Washington Carver</label>
|
|
149
|
+
</div>
|
|
150
|
+
</fieldset>
|
|
151
|
+
|
|
152
|
+
<h3 class="site-preview-heading">Small Tile</h3>
|
|
153
|
+
<form class="usa-form">
|
|
154
|
+
<fieldset class="usa-fieldset">
|
|
155
|
+
<legend class="usa-legend">Select one historical figure</legend>
|
|
156
|
+
<div class="usa-radio usx-radio usx-radio--small">
|
|
157
|
+
<input class="usa-radio__input usa-radio__input--tile" id="small-historical-truth-2" type="radio" name="small-historical-figures-2" value="sojourner-truth" checked="checked" />
|
|
158
|
+
<label class="usa-radio__label" for="small-historical-truth-2">Sojourner Truth</label>
|
|
159
|
+
</div>
|
|
160
|
+
<div class="usa-radio usx-radio usx-radio--small">
|
|
161
|
+
<input class="usa-radio__input usa-radio__input--tile" id="small-historical-douglass-2" type="radio" name="small-historical-figures-2" value="frederick-douglass" />
|
|
162
|
+
<label class="usa-radio__label" for="small-historical-douglass-2">Frederick Douglass <span class="usa-checkbox__label-description">This is optional text that can be used to describe the label in more detail.</span></label>
|
|
163
|
+
</div>
|
|
164
|
+
<div class="usa-radio usx-radio usx-radio--small">
|
|
165
|
+
<input class="usa-radio__input usa-radio__input--tile" id="small-historical-washington-2" type="radio" name="small-historical-figures-2" value="booker-t-washington" />
|
|
166
|
+
<label class="usa-radio__label" for="small-historical-washington-2">Booker T. Washington</label>
|
|
167
|
+
</div>
|
|
168
|
+
<div class="usa-radio usx-radio usx-radio--small">
|
|
169
|
+
<input class="usa-radio__input usa-radio__input--tile" id="small-historical-carver-2" type="radio" name="small-historical-figures-2" value="george-washington-carver" disabled="disabled" />
|
|
170
|
+
<label class="usa-radio__label" for="small-historical-carver-2">George Washington Carver</label>
|
|
171
|
+
</div>
|
|
172
|
+
</fieldset>
|
|
173
|
+
</form>
|
|
174
|
+
|
|
175
|
+
<h3 class="site-preview-heading">With Error</h3>
|
|
176
|
+
<div class="usa-form-group usx-form-group usa-form-group--error">
|
|
177
|
+
<fieldset class="usa-fieldset">
|
|
178
|
+
<legend class="usa-legend usa-label--error">Select one historical figure</legend>
|
|
179
|
+
<span class="usa-error-message" id="historical-figures-error-error" role="alert">Select an option to continue.</span>
|
|
180
|
+
<div class="usa-radio usx-radio">
|
|
181
|
+
<input class="usa-radio__input" id="historical-error-truth" type="radio" name="historical-figures-error" value="sojourner-truth" />
|
|
182
|
+
<label class="usa-radio__label" for="historical-error-truth">Sojourner Truth</label>
|
|
183
|
+
</div>
|
|
184
|
+
<div class="usa-radio usx-radio">
|
|
185
|
+
<input class="usa-radio__input" id="historical-error-douglass" type="radio" name="historical-figures-error" value="frederick-douglass" />
|
|
186
|
+
<label class="usa-radio__label" for="historical-error-douglass">Frederick Douglass</label>
|
|
187
|
+
</div>
|
|
188
|
+
</fieldset>
|
|
189
|
+
</div>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import Label from '../label/Label';
|
|
4
|
+
import FormGroup from '../form-group/FormGroup';
|
|
5
|
+
import Hint from '../hint/Hint';
|
|
6
|
+
import ErrorMessage from '../error-message/ErrorMessage';
|
|
7
|
+
|
|
8
|
+
// Enhanced by @uswds/uswds/js/usa-range at runtime (call ONLY range.init() in
|
|
9
|
+
// the consuming app, never .on()/.off() — see Combobox.tsx for why) — that
|
|
10
|
+
// script builds the value display span and keeps the aria-valuetext
|
|
11
|
+
// screen-reader callout in sync, so React doesn't reimplement either here.
|
|
12
|
+
export default function RangeSlider({
|
|
13
|
+
id = 'range-slider',
|
|
14
|
+
name,
|
|
15
|
+
label = null,
|
|
16
|
+
hint = null,
|
|
17
|
+
error = null,
|
|
18
|
+
disabled = false,
|
|
19
|
+
required = false,
|
|
20
|
+
min = 0,
|
|
21
|
+
max = 100,
|
|
22
|
+
step = 1,
|
|
23
|
+
value,
|
|
24
|
+
defaultValue,
|
|
25
|
+
textUnit = null,
|
|
26
|
+
textPreposition = null,
|
|
27
|
+
formGroup = true,
|
|
28
|
+
className = '',
|
|
29
|
+
...props
|
|
30
|
+
}) {
|
|
31
|
+
const hintId = hint ? `${id}-hint` : undefined;
|
|
32
|
+
const errorId = error ? `${id}-error` : undefined;
|
|
33
|
+
const describedBy = [hintId, errorId].filter(Boolean).join(' ') || undefined;
|
|
34
|
+
|
|
35
|
+
const content = (
|
|
36
|
+
<>
|
|
37
|
+
{label && (
|
|
38
|
+
<Label htmlFor={id} required={required} error={!!error}>
|
|
39
|
+
{label}
|
|
40
|
+
</Label>
|
|
41
|
+
)}
|
|
42
|
+
{hint && <Hint id={hintId}>{hint}</Hint>}
|
|
43
|
+
{error && <ErrorMessage id={errorId}>{error}</ErrorMessage>}
|
|
44
|
+
<input
|
|
45
|
+
className={['usa-range', 'usx-range-slider', className].filter(Boolean).join(' ')}
|
|
46
|
+
id={id}
|
|
47
|
+
type="range"
|
|
48
|
+
name={name || id}
|
|
49
|
+
min={min}
|
|
50
|
+
max={max}
|
|
51
|
+
step={step}
|
|
52
|
+
value={typeof value !== 'undefined' ? value : undefined}
|
|
53
|
+
defaultValue={defaultValue}
|
|
54
|
+
disabled={disabled}
|
|
55
|
+
required={required}
|
|
56
|
+
aria-describedby={describedBy}
|
|
57
|
+
{...(textUnit ? { 'data-text-unit': textUnit } : {})}
|
|
58
|
+
{...(textPreposition ? { 'data-text-preposition': textPreposition } : {})}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
</>
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
return formGroup ? <FormGroup error={!!error}>{content}</FormGroup> : content;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
RangeSlider.propTypes = {
|
|
68
|
+
id: PropTypes.string,
|
|
69
|
+
name: PropTypes.string,
|
|
70
|
+
label: PropTypes.node,
|
|
71
|
+
hint: PropTypes.node,
|
|
72
|
+
error: PropTypes.node,
|
|
73
|
+
disabled: PropTypes.bool,
|
|
74
|
+
required: PropTypes.bool,
|
|
75
|
+
min: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
76
|
+
max: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
77
|
+
step: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
78
|
+
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
79
|
+
defaultValue: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
80
|
+
textUnit: PropTypes.string,
|
|
81
|
+
textPreposition: PropTypes.string,
|
|
82
|
+
formGroup: PropTypes.bool,
|
|
83
|
+
className: PropTypes.string,
|
|
84
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "range-slider",
|
|
3
|
+
"template": "range-slider/range-slider.django.html",
|
|
4
|
+
"version": 1,
|
|
5
|
+
"default": {
|
|
6
|
+
"id": "range-slider-default",
|
|
7
|
+
"label": "Range slider",
|
|
8
|
+
"hint": "Move the slider to change the value",
|
|
9
|
+
"min": 0,
|
|
10
|
+
"max": 100,
|
|
11
|
+
"step": 10,
|
|
12
|
+
"defaultValue": 20
|
|
13
|
+
},
|
|
14
|
+
"props": {
|
|
15
|
+
"id": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"default": "range-slider",
|
|
18
|
+
"description": "id for the input. Label/hint/error ids are derived from this."
|
|
19
|
+
},
|
|
20
|
+
"name": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"description": "name attribute for the input. Defaults to id."
|
|
23
|
+
},
|
|
24
|
+
"label": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "Label text for the field."
|
|
27
|
+
},
|
|
28
|
+
"hint": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "Hint text displayed below the label."
|
|
31
|
+
},
|
|
32
|
+
"error": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "Error message. Renders aria-describedby and error styling."
|
|
35
|
+
},
|
|
36
|
+
"disabled": {
|
|
37
|
+
"type": "boolean",
|
|
38
|
+
"default": false,
|
|
39
|
+
"description": "Disables the input."
|
|
40
|
+
},
|
|
41
|
+
"required": {
|
|
42
|
+
"type": "boolean",
|
|
43
|
+
"default": false,
|
|
44
|
+
"description": "Marks the field as required."
|
|
45
|
+
},
|
|
46
|
+
"min": {
|
|
47
|
+
"type": "number",
|
|
48
|
+
"default": 0,
|
|
49
|
+
"description": "Minimum value."
|
|
50
|
+
},
|
|
51
|
+
"max": {
|
|
52
|
+
"type": "number",
|
|
53
|
+
"default": 100,
|
|
54
|
+
"description": "Maximum value."
|
|
55
|
+
},
|
|
56
|
+
"step": {
|
|
57
|
+
"type": "number",
|
|
58
|
+
"default": 1,
|
|
59
|
+
"description": "Step increment."
|
|
60
|
+
},
|
|
61
|
+
"value": {
|
|
62
|
+
"type": "number",
|
|
63
|
+
"description": "Current value (controlled). React only."
|
|
64
|
+
},
|
|
65
|
+
"defaultValue": {
|
|
66
|
+
"type": "number",
|
|
67
|
+
"description": "Initial value for uncontrolled usage. Also used as the static value shown in the Django/HTML templates."
|
|
68
|
+
},
|
|
69
|
+
"textUnit": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"description": "Optional unit appended to the screen-reader value callout, e.g. \"percent\"."
|
|
72
|
+
},
|
|
73
|
+
"textPreposition": {
|
|
74
|
+
"type": "string",
|
|
75
|
+
"default": "of",
|
|
76
|
+
"description": "Preposition used in the screen-reader value callout (\"of\", \"de\", etc.)."
|
|
77
|
+
},
|
|
78
|
+
"formGroup": {
|
|
79
|
+
"type": "boolean",
|
|
80
|
+
"default": true,
|
|
81
|
+
"description": "Whether to wrap the label/hint/error/control in a `.usa-form-group`. Set to `false` when composing inside another form group."
|
|
82
|
+
},
|
|
83
|
+
"className": {
|
|
84
|
+
"type": "string",
|
|
85
|
+
"default": "",
|
|
86
|
+
"description": "Additional classes for the usa-range input."
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{# Django template for RangeSlider #}
|
|
2
|
+
{# Plain (unenhanced) usa-range markup — relies on @uswds/uswds/js/usa-range #}
|
|
3
|
+
{# at runtime to build the value display and screen-reader callout. #}
|
|
4
|
+
{% load components %}
|
|
5
|
+
{% with formGroup|default_if_none:True as wrap_group %}
|
|
6
|
+
{% if wrap_group %}
|
|
7
|
+
{% form_group error=error %}
|
|
8
|
+
{% if label %}
|
|
9
|
+
{% label htmlFor=id required=required error=error %}{{ label }}{% endlabel %}
|
|
10
|
+
{% endif %}
|
|
11
|
+
|
|
12
|
+
{% if hint %}
|
|
13
|
+
{% hint id=id|add:"-hint" %}{{ hint }}{% endhint %}
|
|
14
|
+
{% endif %}
|
|
15
|
+
|
|
16
|
+
{% if error %}
|
|
17
|
+
{% error_message id=id|add:"-error" %}{{ error }}{% enderror_message %}
|
|
18
|
+
{% endif %}
|
|
19
|
+
|
|
20
|
+
<input
|
|
21
|
+
class="usa-range usx-range-slider{% if className %} {{ className }}{% endif %}"
|
|
22
|
+
id="{{ id }}"
|
|
23
|
+
type="range"
|
|
24
|
+
name="{{ name|default:id }}"
|
|
25
|
+
min="{{ min|default:0 }}"
|
|
26
|
+
max="{{ max|default:100 }}"
|
|
27
|
+
step="{{ step|default:1 }}"
|
|
28
|
+
value="{% firstof value defaultValue 0 %}"
|
|
29
|
+
{% if textUnit %} data-text-unit="{{ textUnit }}"{% endif %}
|
|
30
|
+
{% if textPreposition %} data-text-preposition="{{ textPreposition }}"{% endif %}
|
|
31
|
+
{% if hint or error %} aria-describedby="{% if hint %}{{ id }}-hint{% endif %}{% if hint and error %} {% endif %}{% if error %}{{ id }}-error{% endif %}"{% endif %}
|
|
32
|
+
{% if disabled %} disabled{% endif %}
|
|
33
|
+
{% if required %} required{% endif %}
|
|
34
|
+
/>
|
|
35
|
+
{% endform_group %}
|
|
36
|
+
{% else %}
|
|
37
|
+
{% if label %}
|
|
38
|
+
{% label htmlFor=id required=required error=error %}{{ label }}{% endlabel %}
|
|
39
|
+
{% endif %}
|
|
40
|
+
|
|
41
|
+
{% if hint %}
|
|
42
|
+
{% hint id=id|add:"-hint" %}{{ hint }}{% endhint %}
|
|
43
|
+
{% endif %}
|
|
44
|
+
|
|
45
|
+
{% if error %}
|
|
46
|
+
{% error_message id=id|add:"-error" %}{{ error }}{% enderror_message %}
|
|
47
|
+
{% endif %}
|
|
48
|
+
|
|
49
|
+
<input
|
|
50
|
+
class="usa-range usx-range-slider{% if className %} {{ className }}{% endif %}"
|
|
51
|
+
id="{{ id }}"
|
|
52
|
+
type="range"
|
|
53
|
+
name="{{ name|default:id }}"
|
|
54
|
+
min="{{ min|default:0 }}"
|
|
55
|
+
max="{{ max|default:100 }}"
|
|
56
|
+
step="{{ step|default:1 }}"
|
|
57
|
+
value="{% firstof value defaultValue 0 %}"
|
|
58
|
+
{% if textUnit %} data-text-unit="{{ textUnit }}"{% endif %}
|
|
59
|
+
{% if textPreposition %} data-text-preposition="{{ textPreposition }}"{% endif %}
|
|
60
|
+
{% if hint or error %} aria-describedby="{% if hint %}{{ id }}-hint{% endif %}{% if hint and error %} {% endif %}{% if error %}{{ id }}-error{% endif %}"{% endif %}
|
|
61
|
+
{% if disabled %} disabled{% endif %}
|
|
62
|
+
{% if required %} required{% endif %}
|
|
63
|
+
/>
|
|
64
|
+
{% endif %}
|
|
65
|
+
{% endwith %}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<!-- Default -->
|
|
2
|
+
<label class="usa-label usx-label" for="range-slider-default">Range slider</label>
|
|
3
|
+
<span class="usa-hint usx-hint" id="range-slider-default-hint">Move the slider to change the value</span>
|
|
4
|
+
<input
|
|
5
|
+
class="usa-range usx-range-slider"
|
|
6
|
+
id="range-slider-default"
|
|
7
|
+
type="range"
|
|
8
|
+
name="range-slider-default"
|
|
9
|
+
min="0"
|
|
10
|
+
max="100"
|
|
11
|
+
step="10"
|
|
12
|
+
value="20"
|
|
13
|
+
aria-describedby="range-slider-default-hint"
|
|
14
|
+
/>
|
|
15
|
+
|
|
16
|
+
<!-- WithUnit -->
|
|
17
|
+
<label class="usa-label usx-label" for="range-slider-unit">Volume</label>
|
|
18
|
+
<span class="usa-hint usx-hint" id="range-slider-unit-hint">Adjust the volume level</span>
|
|
19
|
+
<input
|
|
20
|
+
class="usa-range usx-range-slider"
|
|
21
|
+
id="range-slider-unit"
|
|
22
|
+
type="range"
|
|
23
|
+
name="range-slider-unit"
|
|
24
|
+
min="0"
|
|
25
|
+
max="100"
|
|
26
|
+
step="10"
|
|
27
|
+
value="50"
|
|
28
|
+
data-text-unit="percent"
|
|
29
|
+
aria-describedby="range-slider-unit-hint"
|
|
30
|
+
/>
|
|
31
|
+
|
|
32
|
+
<!-- WithPreposition -->
|
|
33
|
+
<label class="usa-label usx-label" for="range-slider-preposition">Rango deslizante</label>
|
|
34
|
+
<span class="usa-hint usx-hint" id="range-slider-preposition-hint">Mueva el control deslizante para cambiar el valor</span>
|
|
35
|
+
<input
|
|
36
|
+
class="usa-range usx-range-slider"
|
|
37
|
+
id="range-slider-preposition"
|
|
38
|
+
type="range"
|
|
39
|
+
name="range-slider-preposition"
|
|
40
|
+
min="0"
|
|
41
|
+
max="100"
|
|
42
|
+
step="10"
|
|
43
|
+
value="20"
|
|
44
|
+
data-text-preposition="de"
|
|
45
|
+
aria-describedby="range-slider-preposition-hint"
|
|
46
|
+
/>
|
|
47
|
+
|
|
48
|
+
<!-- FineStep -->
|
|
49
|
+
<label class="usa-label usx-label" for="range-slider-fine-step">Fine-grained slider</label>
|
|
50
|
+
<span class="usa-hint usx-hint" id="range-slider-fine-step-hint">Move the slider to change the value by 1</span>
|
|
51
|
+
<input
|
|
52
|
+
class="usa-range usx-range-slider"
|
|
53
|
+
id="range-slider-fine-step"
|
|
54
|
+
type="range"
|
|
55
|
+
name="range-slider-fine-step"
|
|
56
|
+
min="0"
|
|
57
|
+
max="100"
|
|
58
|
+
step="1"
|
|
59
|
+
value="20"
|
|
60
|
+
aria-describedby="range-slider-fine-step-hint"
|
|
61
|
+
/>
|
|
62
|
+
|
|
63
|
+
<!-- CustomRange -->
|
|
64
|
+
<label class="usa-label usx-label" for="range-slider-custom-range">Target price</label>
|
|
65
|
+
<span class="usa-hint usx-hint" id="range-slider-custom-range-hint">Move the slider to select a price target between 50 and 150</span>
|
|
66
|
+
<input
|
|
67
|
+
class="usa-range usx-range-slider"
|
|
68
|
+
id="range-slider-custom-range"
|
|
69
|
+
type="range"
|
|
70
|
+
name="range-slider-custom-range"
|
|
71
|
+
min="50"
|
|
72
|
+
max="150"
|
|
73
|
+
step="10"
|
|
74
|
+
value="90"
|
|
75
|
+
aria-describedby="range-slider-custom-range-hint"
|
|
76
|
+
/>
|
|
77
|
+
|
|
78
|
+
<!-- WithError -->
|
|
79
|
+
<label class="usa-label usx-label usa-label--error" for="range-slider-error">Range slider</label>
|
|
80
|
+
<span class="usa-error-message usx-error-message" id="range-slider-error-error" role="alert">Select a value within the allowed range</span>
|
|
81
|
+
<input
|
|
82
|
+
class="usa-range usx-range-slider"
|
|
83
|
+
id="range-slider-error"
|
|
84
|
+
type="range"
|
|
85
|
+
name="range-slider-error"
|
|
86
|
+
min="0"
|
|
87
|
+
max="100"
|
|
88
|
+
step="10"
|
|
89
|
+
value="20"
|
|
90
|
+
aria-describedby="range-slider-error-error"
|
|
91
|
+
/>
|
|
92
|
+
|
|
93
|
+
<!-- Disabled -->
|
|
94
|
+
<label class="usa-label usx-label" for="range-slider-disabled">Range slider</label>
|
|
95
|
+
<input
|
|
96
|
+
class="usa-range usx-range-slider"
|
|
97
|
+
id="range-slider-disabled"
|
|
98
|
+
type="range"
|
|
99
|
+
name="range-slider-disabled"
|
|
100
|
+
min="0"
|
|
101
|
+
max="100"
|
|
102
|
+
step="10"
|
|
103
|
+
value="20"
|
|
104
|
+
disabled
|
|
105
|
+
/>
|
|
106
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ClassNames from 'classnames';
|
|
3
|
+
|
|
4
|
+
export interface RequiredProps extends React.HTMLAttributes<HTMLElement> {
|
|
5
|
+
title?: string;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const Required: React.FC<RequiredProps> = ({
|
|
11
|
+
title = 'Required',
|
|
12
|
+
children = null,
|
|
13
|
+
className = '',
|
|
14
|
+
...props
|
|
15
|
+
}) => {
|
|
16
|
+
const classes = ClassNames('usx-required', className);
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
<abbr title={title} className={classes} {...props}>*</abbr>
|
|
20
|
+
{children ? children : ''}
|
|
21
|
+
</>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default Required;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "required",
|
|
3
|
+
"template": "required/required.django.html",
|
|
4
|
+
"version": 1,
|
|
5
|
+
"props": {
|
|
6
|
+
"title": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"default": "required",
|
|
9
|
+
"description": "Title attribute for the required indicator (default: 'required')"
|
|
10
|
+
},
|
|
11
|
+
"children": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "Inner HTML or text"
|
|
14
|
+
},
|
|
15
|
+
"className": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "Additional classes"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
|
|
2
|
+
<h3 class="site-preview-heading">Default</h3>
|
|
3
|
+
<abbr title="required" class="usx-required">*</abbr>This field is required.
|
|
4
|
+
|
|
5
|
+
<h3 class="site-preview-heading">With custom title</h3>
|
|
6
|
+
<abbr title="This field is required" class="usx-required">*</abbr>Hover over the asterisk to see the custom title.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ClassNames from 'classnames';
|
|
3
|
+
import Icon from '../icon/Icon';
|
|
4
|
+
import Button from '../button/Button';
|
|
5
|
+
import Input from '../input/Input';
|
|
6
|
+
|
|
7
|
+
import type { ButtonProps } from '../button/Button';
|
|
8
|
+
|
|
9
|
+
export interface SearchProps {
|
|
10
|
+
id?: string;
|
|
11
|
+
ariaLabel?: string;
|
|
12
|
+
searchKey?: string;
|
|
13
|
+
label?: string;
|
|
14
|
+
icon?: string;
|
|
15
|
+
iconOnly?: boolean;
|
|
16
|
+
buttonVariant?: ButtonProps['variant'];
|
|
17
|
+
big?: boolean;
|
|
18
|
+
action?: string;
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
defaultValue?: string;
|
|
21
|
+
onSubmit?: (query: FormDataEntryValue | null) => void;
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default function Search({
|
|
26
|
+
id,
|
|
27
|
+
ariaLabel,
|
|
28
|
+
searchKey = 'q',
|
|
29
|
+
label = 'Search',
|
|
30
|
+
icon = 'search',
|
|
31
|
+
iconOnly = false,
|
|
32
|
+
buttonVariant = 'primary',
|
|
33
|
+
big = false,
|
|
34
|
+
placeholder,
|
|
35
|
+
action,
|
|
36
|
+
defaultValue,
|
|
37
|
+
onSubmit,
|
|
38
|
+
className = ''
|
|
39
|
+
}: SearchProps) {
|
|
40
|
+
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
|
41
|
+
if (onSubmit) {
|
|
42
|
+
e.preventDefault();
|
|
43
|
+
const formData = new FormData(e.target as HTMLFormElement);
|
|
44
|
+
const query = formData.get(searchKey);
|
|
45
|
+
onSubmit(query);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const iconClasses = ClassNames(
|
|
50
|
+
'usa-search__submit-icon',
|
|
51
|
+
{
|
|
52
|
+
'display-inline-block': iconOnly
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const formClasses = ClassNames(
|
|
57
|
+
'usa-search',
|
|
58
|
+
{
|
|
59
|
+
'usa-search--small': iconOnly && !big,
|
|
60
|
+
'usa-search--big': big,
|
|
61
|
+
},
|
|
62
|
+
className
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<section aria-label={ariaLabel || label}>
|
|
67
|
+
<form
|
|
68
|
+
id={`${id}-form`}
|
|
69
|
+
className={formClasses}
|
|
70
|
+
method="get"
|
|
71
|
+
role="search"
|
|
72
|
+
{...(action ? { action } : {})}
|
|
73
|
+
{...(onSubmit ? { onSubmit: handleSubmit } : {})}
|
|
74
|
+
>
|
|
75
|
+
<Input
|
|
76
|
+
id={id}
|
|
77
|
+
label={label}
|
|
78
|
+
screenReaderOnlyLabel={true}
|
|
79
|
+
placeholder={placeholder}
|
|
80
|
+
defaultValue={defaultValue}
|
|
81
|
+
type="search"
|
|
82
|
+
name={searchKey}
|
|
83
|
+
formGroup={false}
|
|
84
|
+
/>
|
|
85
|
+
<Button variant={buttonVariant} type="submit">
|
|
86
|
+
{!iconOnly && <span className="usa-search__submit-text">{label}</span>}
|
|
87
|
+
<Icon name={icon} className={iconClasses} aria-hidden="true" alt={label} />
|
|
88
|
+
</Button>
|
|
89
|
+
</form>
|
|
90
|
+
</section>
|
|
91
|
+
);
|
|
92
|
+
}
|