@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,121 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Icon, { IconProps } from '../icon/Icon';
|
|
3
|
+
import Spinner from '../spinner/Spinner';
|
|
4
|
+
import ClassNames from 'classnames';
|
|
5
|
+
|
|
6
|
+
export interface ButtonIcon extends IconProps {
|
|
7
|
+
/** Which side of the label to render this icon on. Defaults to 'left'. */
|
|
8
|
+
position?: 'left' | 'right';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type ButtonBaseProps = {
|
|
12
|
+
label?: string;
|
|
13
|
+
variant?: 'primary' | 'secondary' | 'accent-cool' | 'accent-warm' | 'base' | 'outline' | 'unstyled';
|
|
14
|
+
type?: 'button' | 'submit' | 'reset';
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
17
|
+
href?: string;
|
|
18
|
+
isExternal?: boolean;
|
|
19
|
+
big?: boolean;
|
|
20
|
+
inverse?: boolean;
|
|
21
|
+
ghost?: boolean;
|
|
22
|
+
loading?: boolean;
|
|
23
|
+
iconProps?: ButtonIcon[];
|
|
24
|
+
className?: string;
|
|
25
|
+
style?: React.CSSProperties;
|
|
26
|
+
children?: React.ReactNode;
|
|
27
|
+
extraAttributes?: Record<string, unknown>;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
type AnchorButtonProps = ButtonBaseProps & React.AnchorHTMLAttributes<HTMLAnchorElement> & { href: string };
|
|
31
|
+
type NativeButtonProps = ButtonBaseProps & React.ButtonHTMLAttributes<HTMLButtonElement> & { href?: undefined };
|
|
32
|
+
export type ButtonProps = AnchorButtonProps | NativeButtonProps;
|
|
33
|
+
|
|
34
|
+
export default function Button({
|
|
35
|
+
label,
|
|
36
|
+
variant,
|
|
37
|
+
type = 'button',
|
|
38
|
+
disabled = false,
|
|
39
|
+
onClick,
|
|
40
|
+
href,
|
|
41
|
+
isExternal = false,
|
|
42
|
+
big = false,
|
|
43
|
+
inverse = false,
|
|
44
|
+
ghost = false,
|
|
45
|
+
loading = false,
|
|
46
|
+
iconProps = [],
|
|
47
|
+
className = '',
|
|
48
|
+
children = '',
|
|
49
|
+
extraAttributes = {},
|
|
50
|
+
...props
|
|
51
|
+
}: ButtonProps) {
|
|
52
|
+
const leftIcons = iconProps.filter((icon) => (icon.position ?? 'left') === 'left');
|
|
53
|
+
const rightIcons = iconProps.filter((icon) => icon.position === 'right');
|
|
54
|
+
const renderIcon = (icon: ButtonIcon, index: number) => {
|
|
55
|
+
const { position, ...iconRest } = icon;
|
|
56
|
+
return <Icon key={index} {...iconRest} />;
|
|
57
|
+
};
|
|
58
|
+
const spinner = loading && <Spinner size={2} />;
|
|
59
|
+
|
|
60
|
+
const variantClasses: Record<string, string> = {
|
|
61
|
+
primary: 'usa-button--primary',
|
|
62
|
+
secondary: 'usa-button--secondary',
|
|
63
|
+
'accent-cool': 'usa-button--accent-cool',
|
|
64
|
+
'accent-warm': 'usa-button--accent-warm',
|
|
65
|
+
base: 'usa-button--base',
|
|
66
|
+
outline: 'usa-button--outline',
|
|
67
|
+
unstyled: 'usa-button--unstyled',
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const classes = ClassNames(
|
|
71
|
+
'usa-button',
|
|
72
|
+
'usx-button',
|
|
73
|
+
variant && variantClasses[variant],
|
|
74
|
+
big && 'usa-button--big',
|
|
75
|
+
inverse && 'usa-button--inverse',
|
|
76
|
+
ghost && 'usx-button--ghost',
|
|
77
|
+
className
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
if (href) {
|
|
81
|
+
// Only pass anchor-allowed props
|
|
82
|
+
const {
|
|
83
|
+
// Remove unused variables
|
|
84
|
+
...anchorProps
|
|
85
|
+
} = props as React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
86
|
+
return (
|
|
87
|
+
<a
|
|
88
|
+
className={classes}
|
|
89
|
+
href={href}
|
|
90
|
+
{...(isExternal ? { target: '_blank', rel: 'noopener noreferrer' } : {})}
|
|
91
|
+
{...anchorProps}
|
|
92
|
+
{...extraAttributes}
|
|
93
|
+
>
|
|
94
|
+
{spinner}
|
|
95
|
+
{leftIcons.map(renderIcon)}
|
|
96
|
+
{children || label}
|
|
97
|
+
{rightIcons.map(renderIcon)}
|
|
98
|
+
</a>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
// Only pass button-allowed props
|
|
102
|
+
const {
|
|
103
|
+
// Remove unused variables
|
|
104
|
+
...buttonProps
|
|
105
|
+
} = props as React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
106
|
+
return (
|
|
107
|
+
<button
|
|
108
|
+
type={type}
|
|
109
|
+
className={classes}
|
|
110
|
+
disabled={disabled}
|
|
111
|
+
{...(onClick ? { onClick } : {})}
|
|
112
|
+
{...buttonProps}
|
|
113
|
+
{...extraAttributes}
|
|
114
|
+
>
|
|
115
|
+
{spinner}
|
|
116
|
+
{leftIcons.map(renderIcon)}
|
|
117
|
+
{children || label}
|
|
118
|
+
{rightIcons.map(renderIcon)}
|
|
119
|
+
</button>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{% load components %}
|
|
2
|
+
|
|
3
|
+
{% if href %}
|
|
4
|
+
<a
|
|
5
|
+
href="{{ href }}"
|
|
6
|
+
class="
|
|
7
|
+
usa-button usx-button
|
|
8
|
+
{% if variant and variant != '' %} usa-button--{{ variant }}{% endif %}
|
|
9
|
+
{% if big == True %} usa-button--big{% endif %}
|
|
10
|
+
{% if disabled == True %} usa-button--disabled{% endif %}
|
|
11
|
+
{% if inverse == True %} usa-button--inverse{% endif %}
|
|
12
|
+
{% if ghost == True %} usx-button--ghost{% endif %}
|
|
13
|
+
{% if className %} {{ className }}{% endif %}
|
|
14
|
+
"
|
|
15
|
+
{% if disabled == True %} aria-disabled="true" {% endif %}
|
|
16
|
+
{% if isExternal %} target="_blank" rel="noopener noreferrer" {% endif %}
|
|
17
|
+
>
|
|
18
|
+
{% else %}
|
|
19
|
+
|
|
20
|
+
<button
|
|
21
|
+
type="{{ type }}"
|
|
22
|
+
class="
|
|
23
|
+
usa-button usx-button
|
|
24
|
+
{% if variant and variant != '' %} usa-button--{{ variant }}{% endif %}
|
|
25
|
+
{% if big == True %} usa-button--big{% endif %}
|
|
26
|
+
{% if disabled == True %} usa-button--disabled{% endif %}
|
|
27
|
+
{% if inverse == True %} usa-button--inverse{% endif %}
|
|
28
|
+
{% if ghost == True %} usx-button--ghost{% endif %}
|
|
29
|
+
{% if className %} {{ className }}{% endif %}
|
|
30
|
+
"
|
|
31
|
+
{% if disabled == True %} disabled="disabled" aria-disabled="true" {% endif %}
|
|
32
|
+
{% if extraAttributes %}{% for attr, value in extraAttributes.items %} {{ attr }}="{{ value }}"{% endfor %}{% endif %}
|
|
33
|
+
>
|
|
34
|
+
{% endif %}
|
|
35
|
+
{% if loading %}
|
|
36
|
+
{% spinner size=2 %}{% endspinner %}
|
|
37
|
+
{% endif %}
|
|
38
|
+
{% for i in iconProps %}
|
|
39
|
+
{% if i.name %}
|
|
40
|
+
{% if not i.position or i.position == 'left' %}
|
|
41
|
+
{% icon name=i.name color=i.color size=i.size className=i.className alt=i.alt staticUrlPrefix=i.staticUrlPrefix %}{% endicon %}
|
|
42
|
+
{% endif %}
|
|
43
|
+
{% endif %}
|
|
44
|
+
{% endfor %}
|
|
45
|
+
|
|
46
|
+
{% if children %}{{ children }}{% elif label %}{{ label }}{% endif %}
|
|
47
|
+
|
|
48
|
+
{% for i in iconProps %}
|
|
49
|
+
{% if i.name and i.position == 'right' %}
|
|
50
|
+
{% icon name=i.name color=i.color size=i.size className=i.className alt=i.alt staticUrlPrefix=i.staticUrlPrefix %}{% endicon %}
|
|
51
|
+
{% endif %}
|
|
52
|
+
{% endfor %}
|
|
53
|
+
|
|
54
|
+
{% if href %}
|
|
55
|
+
</a>
|
|
56
|
+
{% else %}
|
|
57
|
+
</button>
|
|
58
|
+
{% endif %}
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
<h3 class="site-preview-heading">Default</h3>
|
|
2
|
+
<button class="usa-button usx-button usa-button--primary" type="button">Default</button>
|
|
3
|
+
<button class="usa-button usx-button usa-button--primary usa-button--hover" type="button">Hover</button>
|
|
4
|
+
<button class="usa-button usx-button usa-button--primary usa-button--active" type="button">Active</button>
|
|
5
|
+
<button class="usa-button usx-button usa-button--primary usa-focus" type="button">Focus</button>
|
|
6
|
+
<button class="usa-button usx-button usa-button--primary" type="button" disabled="disabled">Disabled</button>
|
|
7
|
+
<button class="usa-button usx-button usa-button--primary" type="button" aria-disabled="true">
|
|
8
|
+
aria-disabled
|
|
9
|
+
</button>
|
|
10
|
+
<button class="usa-button usx-button usa-button--unstyled" type="button">
|
|
11
|
+
Unstyled button
|
|
12
|
+
</button>
|
|
13
|
+
|
|
14
|
+
<h3 class="site-preview-heading">Secondary color</h3>
|
|
15
|
+
<button class="usa-button usx-button usa-button--secondary" type="button">Default</button>
|
|
16
|
+
<button
|
|
17
|
+
class="usa-button usx-button usa-button--secondary usa-button--hover"
|
|
18
|
+
type="button"
|
|
19
|
+
>
|
|
20
|
+
Hover
|
|
21
|
+
</button>
|
|
22
|
+
<button
|
|
23
|
+
class="usa-button usx-button usa-button--secondary usa-button--active"
|
|
24
|
+
type="button"
|
|
25
|
+
>
|
|
26
|
+
Active
|
|
27
|
+
</button>
|
|
28
|
+
<button class="usa-button usx-button usa-button--secondary usa-focus" type="button">
|
|
29
|
+
Focus
|
|
30
|
+
</button>
|
|
31
|
+
<button
|
|
32
|
+
class="usa-button usx-button usa-button--secondary"
|
|
33
|
+
type="button"
|
|
34
|
+
disabled="disabled"
|
|
35
|
+
>
|
|
36
|
+
Disabled
|
|
37
|
+
</button>
|
|
38
|
+
<button
|
|
39
|
+
class="usa-button usx-button usa-button--secondary"
|
|
40
|
+
type="button"
|
|
41
|
+
aria-disabled="true"
|
|
42
|
+
>
|
|
43
|
+
aria-disabled
|
|
44
|
+
</button>
|
|
45
|
+
<button
|
|
46
|
+
class="usa-button usx-button usa-button--unstyled"
|
|
47
|
+
type="button"
|
|
48
|
+
>
|
|
49
|
+
Unstyled button
|
|
50
|
+
</button>
|
|
51
|
+
|
|
52
|
+
<h3 class="site-preview-heading">Accent cool color</h3>
|
|
53
|
+
<button class="usa-button usx-button usa-button--accent-cool" type="button">
|
|
54
|
+
Default
|
|
55
|
+
</button>
|
|
56
|
+
<button
|
|
57
|
+
class="usa-button usx-button usa-button--accent-cool usa-button--hover"
|
|
58
|
+
type="button"
|
|
59
|
+
>
|
|
60
|
+
Hover
|
|
61
|
+
</button>
|
|
62
|
+
<button
|
|
63
|
+
class="usa-button usx-button usa-button--accent-cool usa-button--active"
|
|
64
|
+
type="button"
|
|
65
|
+
>
|
|
66
|
+
Active
|
|
67
|
+
</button>
|
|
68
|
+
<button class="usa-button usx-button usa-button--accent-cool usa-focus" type="button">
|
|
69
|
+
Focus
|
|
70
|
+
</button>
|
|
71
|
+
<button
|
|
72
|
+
class="usa-button usx-button usa-button--accent-cool"
|
|
73
|
+
type="button"
|
|
74
|
+
disabled="disabled"
|
|
75
|
+
>
|
|
76
|
+
Disabled
|
|
77
|
+
</button>
|
|
78
|
+
<button
|
|
79
|
+
class="usa-button usx-button usa-button--accent-cool"
|
|
80
|
+
type="button"
|
|
81
|
+
aria-disabled="true"
|
|
82
|
+
>
|
|
83
|
+
aria-disabled
|
|
84
|
+
</button>
|
|
85
|
+
<button
|
|
86
|
+
class="usa-button usx-button usa-button--unstyled"
|
|
87
|
+
type="button"
|
|
88
|
+
>
|
|
89
|
+
Unstyled button
|
|
90
|
+
</button>
|
|
91
|
+
|
|
92
|
+
<h3 class="site-preview-heading">Accent warm color</h3>
|
|
93
|
+
<button class="usa-button usx-button usa-button--accent-warm" type="button">
|
|
94
|
+
Default
|
|
95
|
+
</button>
|
|
96
|
+
<button
|
|
97
|
+
class="usa-button usx-button usa-button--accent-warm usa-button--hover"
|
|
98
|
+
type="button"
|
|
99
|
+
>
|
|
100
|
+
Hover
|
|
101
|
+
</button>
|
|
102
|
+
<button
|
|
103
|
+
class="usa-button usx-button usa-button--accent-warm usa-button--active"
|
|
104
|
+
type="button"
|
|
105
|
+
>
|
|
106
|
+
Active
|
|
107
|
+
</button>
|
|
108
|
+
<button class="usa-button usx-button usa-button--accent-warm usa-focus" type="button">
|
|
109
|
+
Focus
|
|
110
|
+
</button>
|
|
111
|
+
<button
|
|
112
|
+
class="usa-button usx-button usa-button--accent-warm"
|
|
113
|
+
type="button"
|
|
114
|
+
disabled="disabled"
|
|
115
|
+
>
|
|
116
|
+
Disabled
|
|
117
|
+
</button>
|
|
118
|
+
<button
|
|
119
|
+
class="usa-button usx-button usa-button--accent-warm"
|
|
120
|
+
type="button"
|
|
121
|
+
aria-disabled="true"
|
|
122
|
+
>
|
|
123
|
+
aria-disabled
|
|
124
|
+
</button>
|
|
125
|
+
<button
|
|
126
|
+
class="usa-button usx-button usa-button--unstyled"
|
|
127
|
+
type="button"
|
|
128
|
+
>
|
|
129
|
+
Unstyled button
|
|
130
|
+
</button>
|
|
131
|
+
|
|
132
|
+
<h3 class="site-preview-heading">Base color</h3>
|
|
133
|
+
<button class="usa-button usx-button usa-button--base" type="button">Default</button>
|
|
134
|
+
<button class="usa-button usx-button usa-button--base usa-button--hover" type="button">
|
|
135
|
+
Hover
|
|
136
|
+
</button>
|
|
137
|
+
<button class="usa-button usx-button usa-button--base usa-button--active" type="button">
|
|
138
|
+
Active
|
|
139
|
+
</button>
|
|
140
|
+
<button class="usa-button usx-button usa-button--base usa-focus" type="button">
|
|
141
|
+
Focus
|
|
142
|
+
</button>
|
|
143
|
+
<button class="usa-button usx-button usa-button--base" type="button" disabled="disabled">
|
|
144
|
+
Disabled
|
|
145
|
+
</button>
|
|
146
|
+
<button class="usa-button usx-button usa-button--base" type="button" aria-disabled="true">
|
|
147
|
+
aria-disabled
|
|
148
|
+
</button>
|
|
149
|
+
<button class="usa-button usx-button usa-button--unstyled" type="button">
|
|
150
|
+
Unstyled button
|
|
151
|
+
</button>
|
|
152
|
+
|
|
153
|
+
<h3 class="site-preview-heading">Outline</h3>
|
|
154
|
+
<button class="usa-button usx-button usa-button--outline" type="button">Default</button>
|
|
155
|
+
<button class="usa-button usx-button usa-button--outline usa-button--hover" type="button">
|
|
156
|
+
Hover
|
|
157
|
+
</button>
|
|
158
|
+
<button class="usa-button usx-button usa-button--outline usa-button--active" type="button">
|
|
159
|
+
Active
|
|
160
|
+
</button>
|
|
161
|
+
<button class="usa-button usx-button usa-button--outline usa-focus" type="button">
|
|
162
|
+
Focus
|
|
163
|
+
</button>
|
|
164
|
+
<button
|
|
165
|
+
class="usa-button usx-button usa-button--outline"
|
|
166
|
+
type="button"
|
|
167
|
+
disabled="disabled"
|
|
168
|
+
>
|
|
169
|
+
Disabled
|
|
170
|
+
</button>
|
|
171
|
+
<button
|
|
172
|
+
class="usa-button usx-button usa-button--outline"
|
|
173
|
+
type="button"
|
|
174
|
+
aria-disabled="true"
|
|
175
|
+
>
|
|
176
|
+
aria-disabled
|
|
177
|
+
</button>
|
|
178
|
+
<button
|
|
179
|
+
class="usa-button usx-button usa-button--unstyled"
|
|
180
|
+
type="button"
|
|
181
|
+
>
|
|
182
|
+
Unstyled button
|
|
183
|
+
</button>
|
|
184
|
+
|
|
185
|
+
<h3 class="site-preview-heading">Outline inverse</h3>
|
|
186
|
+
<div class="bg-base-darkest padding-1" style="max-width: fit-content">
|
|
187
|
+
<button
|
|
188
|
+
class="usa-button usx-button usa-button--outline usa-button--inverse"
|
|
189
|
+
type="button"
|
|
190
|
+
>
|
|
191
|
+
Default
|
|
192
|
+
</button>
|
|
193
|
+
<button
|
|
194
|
+
class="usa-button usx-button usa-button--outline usa-button--inverse usa-button--hover"
|
|
195
|
+
type="button"
|
|
196
|
+
>
|
|
197
|
+
Hover
|
|
198
|
+
</button>
|
|
199
|
+
<button
|
|
200
|
+
class="usa-button usx-button usa-button--outline usa-button--inverse usa-button--active"
|
|
201
|
+
type="button"
|
|
202
|
+
>
|
|
203
|
+
Active
|
|
204
|
+
</button>
|
|
205
|
+
<button
|
|
206
|
+
class="usa-button usx-button usa-button--outline usa-button--inverse usa-focus"
|
|
207
|
+
type="button"
|
|
208
|
+
>
|
|
209
|
+
Focus
|
|
210
|
+
</button>
|
|
211
|
+
<button
|
|
212
|
+
class="usa-button usx-button usa-button--outline usa-button--inverse"
|
|
213
|
+
type="button"
|
|
214
|
+
disabled="disabled"
|
|
215
|
+
>
|
|
216
|
+
Disabled
|
|
217
|
+
</button>
|
|
218
|
+
<button
|
|
219
|
+
class="usa-button usx-button usa-button--outline usa-button--inverse"
|
|
220
|
+
type="button"
|
|
221
|
+
aria-disabled="true"
|
|
222
|
+
>
|
|
223
|
+
aria-disabled
|
|
224
|
+
</button>
|
|
225
|
+
<button
|
|
226
|
+
class="usa-button usx-button usa-button--inverse usa-button--unstyled"
|
|
227
|
+
type="button"
|
|
228
|
+
>
|
|
229
|
+
Unstyled button
|
|
230
|
+
</button>
|
|
231
|
+
</div>
|
|
232
|
+
|
|
233
|
+
<h3 class="site-preview-heading">Big button</h3>
|
|
234
|
+
<button class="usa-button usx-button usa-button--primary usa-button--big" type="button">Default</button>
|
|
235
|
+
<button class="usa-button usx-button usa-button--primary usa-button--big" type="button" disabled="disabled">
|
|
236
|
+
Disabled
|
|
237
|
+
</button>
|
|
238
|
+
<button class="usa-button usx-button usa-button--primary usa-button--big" type="button" aria-disabled="true">
|
|
239
|
+
aria-disabled
|
|
240
|
+
</button>
|
|
241
|
+
<button class="usa-button usx-button usa-button--big usa-button--unstyled" type="button">
|
|
242
|
+
Unstyled button
|
|
243
|
+
</button>
|
|
244
|
+
|
|
245
|
+
<h2 class="site-preview-heading">Custom Buttons</h2>
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
<h3 class="site-preview-heading">Ghost button</h3>
|
|
249
|
+
<div class="margin-bottom-3">
|
|
250
|
+
<button class="usa-button usx-button usx-button--ghost" type="button">Default</button>
|
|
251
|
+
<button class="usa-button usx-button usx-button--ghost usa-button--hover" type="button">Hover</button>
|
|
252
|
+
<button class="usa-button usx-button usx-button--ghost usa-button--active" type="button">Active</button>
|
|
253
|
+
<button class="usa-button usx-button usx-button--ghost usa-focus" type="button">Focus</button>
|
|
254
|
+
<button class="usa-button usx-button usx-button--ghost" type="button" disabled="disabled">Disabled</button>
|
|
255
|
+
<button class="usa-button usx-button usx-button--ghost" type="button" aria-disabled="true">
|
|
256
|
+
aria-disabled
|
|
257
|
+
</button>
|
|
258
|
+
<button class="usa-button usx-button usa-button--ghost usa-button--unstyled" type="button">
|
|
259
|
+
Unstyled button
|
|
260
|
+
</button>
|
|
261
|
+
</div>
|
|
262
|
+
<div class="margin-bottom-3">
|
|
263
|
+
<button class="usa-button usx-button usa-button--primary usx-button--ghost" type="button">Default</button>
|
|
264
|
+
<button class="usa-button usx-button usa-button--primary usx-button--ghost usa-button--hover" type="button">Hover</button>
|
|
265
|
+
<button class="usa-button usx-button usa-button--primary usx-button--ghost usa-button--active" type="button">Active</button>
|
|
266
|
+
<button class="usa-button usx-button usa-button--primary usx-button--ghost usa-focus" type="button">Focus</button>
|
|
267
|
+
<button class="usa-button usx-button usa-button--primary usx-button--ghost" type="button" disabled="disabled">Disabled</button>
|
|
268
|
+
<button class="usa-button usx-button usa-button--primary usx-button--ghost" type="button" aria-disabled="true">
|
|
269
|
+
aria-disabled
|
|
270
|
+
</button>
|
|
271
|
+
<button class="usa-button usx-button usa-button--ghost usa-button--unstyled" type="button">
|
|
272
|
+
Unstyled button
|
|
273
|
+
</button>
|
|
274
|
+
</div>
|
|
275
|
+
<div class="margin-bottom-3">
|
|
276
|
+
<button class="usa-button usx-button usa-button--secondary usx-button--ghost" type="button">Default</button>
|
|
277
|
+
<button class="usa-button usx-button usa-button--secondary usx-button--ghost usa-button--hover" type="button">Hover</button>
|
|
278
|
+
<button class="usa-button usx-button usa-button--secondary usx-button--ghost usa-button--active" type="button">Active</button>
|
|
279
|
+
<button class="usa-button usx-button usa-button--secondary usx-button--ghost usa-focus" type="button">Focus</button>
|
|
280
|
+
<button class="usa-button usx-button usa-button--secondary usx-button--ghost" type="button" disabled="disabled">Disabled</button>
|
|
281
|
+
<button class="usa-button usx-button usa-button--secondary usx-button--ghost" type="button" aria-disabled="true">
|
|
282
|
+
aria-disabled
|
|
283
|
+
</button>
|
|
284
|
+
<button class="usa-button usx-button usa-button--ghost usa-button--unstyled" type="button">
|
|
285
|
+
Unstyled button
|
|
286
|
+
</button>
|
|
287
|
+
</div>
|
|
288
|
+
<div class="margin-bottom-3">
|
|
289
|
+
<button class="usa-button usx-button usa-button--accent-cool usx-button--ghost" type="button">Default</button>
|
|
290
|
+
<button class="usa-button usx-button usa-button--accent-cool usx-button--ghost usa-button--hover" type="button">Hover</button>
|
|
291
|
+
<button class="usa-button usx-button usa-button--accent-cool usx-button--ghost usa-button--active" type="button">Active</button>
|
|
292
|
+
<button class="usa-button usx-button usa-button--accent-cool usx-button--ghost usa-focus" type="button">Focus</button>
|
|
293
|
+
<button class="usa-button usx-button usa-button--accent-cool usx-button--ghost" type="button" disabled="disabled">Disabled</button>
|
|
294
|
+
<button class="usa-button usx-button usa-button--accent-cool usx-button--ghost" type="button" aria-disabled="true">
|
|
295
|
+
aria-disabled
|
|
296
|
+
</button>
|
|
297
|
+
<button class="usa-button usx-button usa-button--ghost usa-button--unstyled" type="button">
|
|
298
|
+
Unstyled button
|
|
299
|
+
</button>
|
|
300
|
+
</div>
|
|
301
|
+
<div class="margin-bottom-3">
|
|
302
|
+
<button class="usa-button usx-button usa-button--accent-warm usx-button--ghost" type="button">Default</button>
|
|
303
|
+
<button class="usa-button usx-button usa-button--accent-warm usx-button--ghost usa-button--hover" type="button">Hover</button>
|
|
304
|
+
<button class="usa-button usx-button usa-button--accent-warm usx-button--ghost usa-button--active" type="button">Active</button>
|
|
305
|
+
<button class="usa-button usx-button usa-button--accent-warm usx-button--ghost usa-focus" type="button">Focus</button>
|
|
306
|
+
<button class="usa-button usx-button usa-button--accent-warm usx-button--ghost" type="button" disabled="disabled">Disabled</button>
|
|
307
|
+
<button class="usa-button usx-button usa-button--accent-warm usx-button--ghost" type="button" aria-disabled="true">
|
|
308
|
+
aria-disabled
|
|
309
|
+
</button>
|
|
310
|
+
<button class="usa-button usx-button usa-button--ghost usa-button--unstyled" type="button">
|
|
311
|
+
Unstyled button
|
|
312
|
+
</button>
|
|
313
|
+
</div>
|
|
314
|
+
<div class="margin-bottom-3">
|
|
315
|
+
<button class="usa-button usx-button usa-button--base usx-button--ghost" type="button">Default</button>
|
|
316
|
+
<button class="usa-button usx-button usa-button--base usx-button--ghost usa-button--hover" type="button">Hover</button>
|
|
317
|
+
<button class="usa-button usx-button usa-button--base usx-button--ghost usa-button--active" type="button">Active</button>
|
|
318
|
+
<button class="usa-button usx-button usa-button--base usx-button--ghost usa-focus" type="button">Focus</button>
|
|
319
|
+
<button class="usa-button usx-button usa-button--base usx-button--ghost" type="button" disabled="disabled">Disabled</button>
|
|
320
|
+
<button class="usa-button usx-button usa-button--base usx-button--ghost" type="button" aria-disabled="true">
|
|
321
|
+
aria-disabled
|
|
322
|
+
</button>
|
|
323
|
+
<button class="usa-button usx-button usa-button--ghost usa-button--unstyled" type="button">
|
|
324
|
+
Unstyled button
|
|
325
|
+
</button>
|
|
326
|
+
</div>
|
|
327
|
+
<div class="margin-bottom-3">
|
|
328
|
+
<button class="usa-button usx-button usa-button--primary usx-button--ghost" type="button">
|
|
329
|
+
<svg class="usa-icon usx-icon--size-2" aria-hidden="true" focusable="false" role="img">
|
|
330
|
+
<use href="./img/sprite.svg#campaign"></use>
|
|
331
|
+
</svg>
|
|
332
|
+
Announce
|
|
333
|
+
</button>
|
|
334
|
+
<button class="usa-button usx-button usa-button--secondary usx-button--ghost" type="button">
|
|
335
|
+
<svg class="usa-icon usx-icon--size-2" aria-hidden="true" focusable="false" role="img">
|
|
336
|
+
<use href="./img/sprite.svg#delete"></use>
|
|
337
|
+
</svg>
|
|
338
|
+
Remove
|
|
339
|
+
</button>
|
|
340
|
+
<button class="usa-button usx-button usa-button--accent-cool usx-button--ghost" type="button">
|
|
341
|
+
<svg class="usa-icon usx-icon--size-2" aria-hidden="true" focusable="false" role="img">
|
|
342
|
+
<use href="./img/sprite.svg#comment"></use>
|
|
343
|
+
</svg>
|
|
344
|
+
Discuss
|
|
345
|
+
</button>
|
|
346
|
+
<button class="usa-button usx-button usa-button--accent-warm usx-button--ghost" type="button">
|
|
347
|
+
<svg class="usa-icon usx-icon--size-2" aria-hidden="true" focusable="false" role="img">
|
|
348
|
+
<use href="./img/sprite.svg#edit"></use>
|
|
349
|
+
</svg>
|
|
350
|
+
Edit
|
|
351
|
+
</button>
|
|
352
|
+
<button class="usa-button usx-button usa-button--base usx-button--ghost" type="button">
|
|
353
|
+
<svg class="usa-icon usx-icon--size-2" aria-hidden="true" focusable="false" role="img">
|
|
354
|
+
<use href="./img/sprite.svg#content_copy"></use>
|
|
355
|
+
</svg>
|
|
356
|
+
Copy
|
|
357
|
+
</button>
|
|
358
|
+
</div>
|
|
359
|
+
<div class="margin-bottom-3 bg-primary-darkest padding-1">
|
|
360
|
+
<button class="usa-button usx-button usx-button--ghost usa-button--inverse" type="button">
|
|
361
|
+
Inverse
|
|
362
|
+
</button>
|
|
363
|
+
</div>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "button",
|
|
3
|
+
"template": "button/button.django.html",
|
|
4
|
+
"version": 1,
|
|
5
|
+
"props": {
|
|
6
|
+
"label": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"description": "The text to be displayed on the button, providing a clear and concise indication of the button's purpose or action."
|
|
9
|
+
},
|
|
10
|
+
"variant": {
|
|
11
|
+
"type": "select",
|
|
12
|
+
"options": [
|
|
13
|
+
"primary",
|
|
14
|
+
"secondary",
|
|
15
|
+
"accent-cool",
|
|
16
|
+
"accent-warm",
|
|
17
|
+
"base",
|
|
18
|
+
"outline"
|
|
19
|
+
],
|
|
20
|
+
"description": "The visual style of the button, which can be used to indicate the importance or type of action the button represents."
|
|
21
|
+
},
|
|
22
|
+
"type": {
|
|
23
|
+
"type": "select",
|
|
24
|
+
"options": [
|
|
25
|
+
"button",
|
|
26
|
+
"submit",
|
|
27
|
+
"reset"
|
|
28
|
+
],
|
|
29
|
+
"description": "The HTML button type attribute, which specifies the behavior of the button when it is clicked."
|
|
30
|
+
},
|
|
31
|
+
"disabled": {
|
|
32
|
+
"type": "boolean",
|
|
33
|
+
"description": "A boolean that determines whether the button is disabled, preventing user interaction and indicating that the button is not currently available for action.",
|
|
34
|
+
"default": false
|
|
35
|
+
},
|
|
36
|
+
"onClick": {
|
|
37
|
+
"type": "function",
|
|
38
|
+
"description": "A function that is called when the button is clicked, allowing for custom behavior to be executed in response to the user's interaction with the button."
|
|
39
|
+
},
|
|
40
|
+
"href": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"description": "The URL that the button should navigate to when clicked, if the button is used as a link."
|
|
43
|
+
},
|
|
44
|
+
"isExternal": {
|
|
45
|
+
"type": "boolean",
|
|
46
|
+
"description": "A boolean that determines whether the link should open in a new tab or window, indicating that the destination is external to the current site.",
|
|
47
|
+
"default": false
|
|
48
|
+
},
|
|
49
|
+
"big": {
|
|
50
|
+
"type": "boolean",
|
|
51
|
+
"description": "A boolean that determines whether the button should be displayed in a larger size, making it more prominent and easier to interact with.",
|
|
52
|
+
"default": false
|
|
53
|
+
},
|
|
54
|
+
"inverse": {
|
|
55
|
+
"type": "boolean",
|
|
56
|
+
"description": "A boolean that determines whether the button should be displayed with an inverse color scheme, which can be used to create contrast against a darker background.",
|
|
57
|
+
"default": false
|
|
58
|
+
},
|
|
59
|
+
"ghost": {
|
|
60
|
+
"type": "boolean",
|
|
61
|
+
"description": "A boolean that determines whether the button should be displayed in a ghost style, which typically features a transparent background and a border, giving it a more subtle appearance.",
|
|
62
|
+
"default": false
|
|
63
|
+
},
|
|
64
|
+
"loading": {
|
|
65
|
+
"type": "boolean",
|
|
66
|
+
"description": "When true, displays a loading spinner before any left-positioned icons, indicating the button's action is in progress.",
|
|
67
|
+
"default": false
|
|
68
|
+
},
|
|
69
|
+
"iconProps": {
|
|
70
|
+
"type": "array",
|
|
71
|
+
"description": "Icons to render alongside the button label.",
|
|
72
|
+
"items": {
|
|
73
|
+
"type": "object",
|
|
74
|
+
"description": "An icon instance for the button. Mirrors the icon component's props.",
|
|
75
|
+
"component": "icon",
|
|
76
|
+
"properties": {
|
|
77
|
+
"position": {
|
|
78
|
+
"type": "select",
|
|
79
|
+
"options": ["left", "right"],
|
|
80
|
+
"default": "left",
|
|
81
|
+
"description": "Which side of the button label to render this icon on."
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"className": {
|
|
87
|
+
"type": "string",
|
|
88
|
+
"description": "Additional CSS classes to apply to the button component."
|
|
89
|
+
},
|
|
90
|
+
"style": {
|
|
91
|
+
"type": "string",
|
|
92
|
+
"description": "Inline styles to apply to the button component."
|
|
93
|
+
},
|
|
94
|
+
"children": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"description": "Inner HTML or text to be displayed within the button, allowing for more complex content such as additional elements or formatting."
|
|
97
|
+
},
|
|
98
|
+
"extraAttributes": {
|
|
99
|
+
"type": "object",
|
|
100
|
+
"description": "An object containing any additional HTML attributes to be spread onto the button element, providing flexibility for custom use cases or integrations."
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ClassNames from 'classnames';
|
|
3
|
+
import Button from '../button/Button';
|
|
4
|
+
import type { ButtonProps } from '../button/Button';
|
|
5
|
+
export interface ButtonGroupProps extends React.HTMLAttributes<HTMLUListElement> {
|
|
6
|
+
buttonProps?: ButtonProps[];
|
|
7
|
+
segmented?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default function ButtonGroup({
|
|
12
|
+
buttonProps = [],
|
|
13
|
+
segmented = false,
|
|
14
|
+
className = '',
|
|
15
|
+
...props
|
|
16
|
+
}: ButtonGroupProps) {
|
|
17
|
+
const classes = ClassNames(
|
|
18
|
+
'usa-button-group usx-button-group',
|
|
19
|
+
segmented && 'usa-button-group--segmented',
|
|
20
|
+
className
|
|
21
|
+
);
|
|
22
|
+
return (
|
|
23
|
+
<ul className={classes} {...props}>
|
|
24
|
+
{buttonProps.map((item, index) => (
|
|
25
|
+
<li key={index} className="usa-button-group__item">
|
|
26
|
+
<Button {...item}>
|
|
27
|
+
{item.children}
|
|
28
|
+
</Button>
|
|
29
|
+
</li>
|
|
30
|
+
))}
|
|
31
|
+
</ul>
|
|
32
|
+
);
|
|
33
|
+
}
|