@automattic/vip-design-system 1.2.0 → 1.2.2
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/.storybook/decorators/withBoundingBox.tsx +11 -0
- package/.storybook/decorators/{withThemeProvider.jsx → withThemeProvider.tsx} +1 -5
- package/.storybook/{preview.js → preview.tsx} +12 -3
- package/build/declaration.d.js +1 -0
- package/build/system/Accordion/Accordion.d.ts +41 -0
- package/build/system/Accordion/Accordion.js +10 -35
- package/build/system/Accordion/Accordion.stories.d.ts +13 -0
- package/build/system/Accordion/Accordion.stories.js +4 -7
- package/build/system/Accordion/Accordion.test.d.ts +2 -0
- package/build/system/Accordion/Accordion.test.js +5 -7
- package/build/system/Accordion/index.d.ts +5 -0
- package/build/system/Avatar/Avatar.d.ts +13 -0
- package/build/system/Avatar/Avatar.js +7 -20
- package/build/system/Avatar/Avatar.stories.d.ts +16 -0
- package/build/system/Avatar/Avatar.stories.js +5 -7
- package/build/system/Avatar/Avatar.test.d.ts +1 -0
- package/build/system/Avatar/Avatar.test.js +5 -7
- package/build/system/Avatar/index.d.ts +4 -0
- package/build/system/Avatar/index.js +1 -0
- package/build/system/Badge/Badge.d.ts +6 -0
- package/build/system/Badge/Badge.js +6 -15
- package/build/system/Badge/Badge.stories.d.ts +18 -0
- package/build/system/Badge/Badge.stories.js +70 -71
- package/build/system/Badge/Badge.test.d.ts +1 -0
- package/build/system/Badge/Badge.test.js +6 -8
- package/build/system/Badge/index.d.ts +4 -0
- package/build/system/Badge/index.js +1 -0
- package/build/system/Box/Box.d.ts +3 -0
- package/build/system/{Form/Label.stories.js → Box/Box.js} +15 -31
- package/build/system/Box/Box.stories.d.ts +16 -0
- package/build/system/Box/Box.stories.js +21 -0
- package/build/system/Box/index.d.ts +2 -0
- package/build/system/Box/index.js +5 -4
- package/build/system/Button/Button.d.ts +12 -0
- package/build/system/Button/Button.js +10 -18
- package/build/system/Button/Button.stories.d.ts +30 -0
- package/build/system/Button/Button.stories.js +10 -20
- package/build/system/Button/Button.test.d.ts +1 -0
- package/build/system/Button/Button.test.js +45 -74
- package/build/system/Button/ButtonSubmit.d.ts +2 -0
- package/build/system/Button/ButtonSubmit.js +60 -70
- package/build/system/Button/ButtonSubmit.stories.d.ts +38 -0
- package/build/system/Button/ButtonSubmit.stories.jsx +40 -0
- package/build/system/Button/ButtonSubmit.test.d.ts +1 -0
- package/build/system/Button/ButtonSubmit.test.js +32 -60
- package/build/system/Button/index.d.ts +3 -0
- package/build/system/Button/index.js +7 -6
- package/build/system/Button/variants.d.ts +2 -0
- package/build/system/Button/variants.js +1 -6
- package/build/system/Card/Card.d.ts +9 -0
- package/build/system/Card/Card.js +2 -10
- package/build/system/Card/Card.stories.d.ts +7 -0
- package/build/system/Card/Card.stories.js +4 -6
- package/build/system/Card/Card.test.d.ts +1 -0
- package/build/system/Card/Card.test.js +5 -7
- package/build/system/Card/index.d.ts +4 -0
- package/build/system/Card/index.js +1 -0
- package/build/system/Code/Code.d.ts +15 -0
- package/build/system/Code/Code.js +14 -21
- package/build/system/Code/Code.stories.d.ts +18 -0
- package/build/system/Code/Code.stories.js +31 -23
- package/build/system/Code/Code.test.d.ts +1 -0
- package/build/system/Code/Code.test.js +10 -11
- package/build/system/Code/index.d.ts +4 -0
- package/build/system/Code/index.js +1 -0
- package/build/system/ConfirmationDialog/ConfirmationDialog.d.ts +35 -0
- package/build/system/ConfirmationDialog/ConfirmationDialog.js +68 -94
- package/build/system/ConfirmationDialog/ConfirmationDialog.stories.d.ts +7 -0
- package/build/system/ConfirmationDialog/ConfirmationDialog.stories.jsx +29 -0
- package/build/system/ConfirmationDialog/index.d.ts +3 -0
- package/build/system/ConfirmationDialog/index.js +5 -5
- package/build/system/Dialog/Dialog.d.ts +18 -0
- package/build/system/Dialog/Dialog.js +81 -94
- package/build/system/Dialog/Dialog.stories.d.ts +7 -0
- package/build/system/Dialog/Dialog.stories.jsx +60 -0
- package/build/system/Dialog/DialogButton.d.ts +16 -0
- package/build/system/Dialog/DialogButton.js +51 -66
- package/build/system/Dialog/DialogContent.d.ts +18 -0
- package/build/system/Dialog/DialogContent.js +142 -137
- package/build/system/Dialog/DialogDivider.d.ts +5 -0
- package/build/system/Dialog/DialogDivider.js +5 -16
- package/build/system/Dialog/DialogMenu.d.ts +5 -0
- package/build/system/Dialog/DialogMenu.js +5 -18
- package/build/system/Dialog/DialogMenuItem.d.ts +13 -0
- package/build/system/Dialog/DialogMenuItem.js +64 -71
- package/build/system/Dialog/DialogTrigger.d.ts +1 -0
- package/build/system/Dialog/DialogTrigger.js +10 -16
- package/build/system/Dialog/index.d.ts +8 -0
- package/build/system/Dialog/index.js +19 -16
- package/build/system/Dropdown/Dropdown.d.ts +37 -0
- package/build/system/Dropdown/Dropdown.js +96 -93
- package/build/system/Dropdown/Dropdown.stories.d.ts +34 -0
- package/build/system/Dropdown/Dropdown.stories.jsx +170 -0
- package/build/system/Dropdown/Dropdown.test.d.ts +1 -0
- package/build/system/Dropdown/Dropdown.test.js +30 -52
- package/build/system/Dropdown/DropdownContent.d.ts +11 -0
- package/build/system/Dropdown/DropdownContent.js +40 -49
- package/build/system/Dropdown/DropdownItem.d.ts +32 -0
- package/build/system/Dropdown/DropdownItem.js +91 -95
- package/build/system/Dropdown/DropdownLabel.d.ts +8 -0
- package/build/system/Dropdown/DropdownLabel.js +24 -33
- package/build/system/Dropdown/DropdownSeparator.d.ts +7 -0
- package/build/system/Dropdown/DropdownSeparator.js +23 -32
- package/build/system/Dropdown/index.d.ts +40 -0
- package/build/system/Dropdown/index.js +49 -37
- package/build/system/Flex/Flex.d.ts +2 -0
- package/build/system/Flex/Flex.js +6 -8
- package/build/system/Flex/Flex.stories.d.ts +7 -0
- package/build/system/Flex/Flex.stories.js +3 -5
- package/build/system/Flex/index.d.ts +4 -0
- package/build/system/Flex/index.js +1 -0
- package/build/system/Form/Checkbox.d.ts +10 -0
- package/build/system/Form/Checkbox.js +61 -62
- package/build/system/Form/Checkbox.stories.d.ts +7 -0
- package/build/system/Form/Checkbox.stories.jsx +54 -0
- package/build/system/Form/Input.d.ts +2 -0
- package/build/system/Form/Input.js +70 -69
- package/build/system/Form/Input.stories.d.ts +5 -0
- package/build/system/Form/Input.stories.jsx +38 -0
- package/build/system/Form/Input.styles.d.ts +32 -0
- package/build/system/Form/Input.styles.js +29 -40
- package/build/system/Form/InputWithCopyButton.d.ts +2 -0
- package/build/system/Form/InputWithCopyButton.js +109 -105
- package/build/system/Form/InputWithCopyButton.stories.d.ts +5 -0
- package/build/system/Form/InputWithCopyButton.stories.jsx +30 -0
- package/build/system/Form/Label.d.ts +9 -0
- package/build/system/Form/Label.js +41 -47
- package/build/system/Form/Label.stories.d.ts +6 -0
- package/build/system/Form/Label.stories.jsx +36 -0
- package/build/system/Form/Radio.d.ts +2 -0
- package/build/system/Form/Radio.js +185 -169
- package/build/system/Form/Radio.stories.d.ts +7 -0
- package/build/system/Form/Radio.stories.jsx +100 -0
- package/build/system/Form/RadioBoxGroup.d.ts +2 -0
- package/build/system/Form/RadioBoxGroup.js +193 -187
- package/build/system/Form/RadioBoxGroup.stories.d.ts +8 -0
- package/build/system/Form/RadioBoxGroup.stories.jsx +60 -0
- package/build/system/Form/RequiredLabel.d.ts +5 -0
- package/build/system/Form/RequiredLabel.js +7 -17
- package/build/system/Form/Textarea.d.ts +2 -0
- package/build/system/Form/Textarea.js +18 -20
- package/build/system/Form/Textarea.stories.d.ts +34 -0
- package/build/system/Form/Textarea.stories.jsx +40 -0
- package/build/system/Form/Toggle.d.ts +2 -0
- package/build/system/Form/Toggle.js +67 -81
- package/build/system/Form/Toggle.stories.d.ts +19 -0
- package/build/system/Form/Toggle.stories.jsx +96 -0
- package/build/system/Form/Toggle.test.d.ts +1 -0
- package/build/system/Form/Toggle.test.js +21 -39
- package/build/system/Form/ToggleRow.d.ts +22 -0
- package/build/system/Form/ToggleRow.js +66 -95
- package/build/system/Form/Validation.d.ts +14 -0
- package/build/system/Form/Validation.js +33 -42
- package/build/system/Form/index.d.ts +11 -0
- package/build/system/Form/index.js +25 -22
- package/build/system/Grid/Grid.d.ts +6 -0
- package/build/system/Grid/Grid.js +4 -5
- package/build/system/Grid/Grid.stories.d.ts +7 -0
- package/build/system/Grid/Grid.stories.js +3 -5
- package/build/system/Grid/index.d.ts +4 -0
- package/build/system/Grid/index.js +1 -0
- package/build/system/Heading/Heading.d.ts +6 -0
- package/build/system/Heading/Heading.js +33 -0
- package/build/system/Heading/Heading.stories.d.ts +7 -0
- package/build/system/Heading/Heading.stories.js +33 -0
- package/build/system/Heading/index.d.ts +2 -0
- package/build/system/Heading/index.js +5 -4
- package/build/system/Link/Link.d.ts +6 -0
- package/build/system/Link/Link.js +5 -12
- package/build/system/Link/Link.stories.d.ts +16 -0
- package/build/system/Link/Link.stories.js +12 -13
- package/build/system/Link/index.d.ts +4 -0
- package/build/system/Link/index.js +1 -0
- package/build/system/NewConfirmationDialog/NewConfirmationDialog.d.ts +23 -0
- package/build/system/NewConfirmationDialog/NewConfirmationDialog.js +86 -99
- package/build/system/NewConfirmationDialog/NewConfirmationDialog.stories.d.ts +8 -0
- package/build/system/NewConfirmationDialog/NewConfirmationDialog.stories.jsx +34 -0
- package/build/system/NewConfirmationDialog/NewConfirmationDialog.test.d.ts +1 -0
- package/build/system/NewConfirmationDialog/NewConfirmationDialog.test.js +43 -66
- package/build/system/NewConfirmationDialog/index.d.ts +2 -0
- package/build/system/NewConfirmationDialog/index.js +5 -4
- package/build/system/NewDialog/DialogClose.d.ts +6 -0
- package/build/system/NewDialog/DialogClose.js +50 -69
- package/build/system/NewDialog/DialogClose.test.d.ts +1 -0
- package/build/system/NewDialog/DialogClose.test.js +29 -46
- package/build/system/NewDialog/DialogContent.d.ts +18 -0
- package/build/system/NewDialog/DialogContent.js +14 -21
- package/build/system/NewDialog/DialogDescription.d.ts +5 -0
- package/build/system/NewDialog/DialogDescription.js +31 -38
- package/build/system/NewDialog/DialogDescription.test.d.ts +1 -0
- package/build/system/NewDialog/DialogDescription.test.js +44 -67
- package/build/system/NewDialog/DialogOverlay.d.ts +2 -0
- package/build/system/NewDialog/DialogOverlay.js +28 -32
- package/build/system/NewDialog/DialogOverlay.test.d.ts +1 -0
- package/build/system/NewDialog/DialogOverlay.test.js +26 -42
- package/build/system/NewDialog/DialogTitle.d.ts +11 -0
- package/build/system/NewDialog/DialogTitle.js +19 -34
- package/build/system/NewDialog/DialogTitle.test.d.ts +1 -0
- package/build/system/NewDialog/DialogTitle.test.js +44 -67
- package/build/system/NewDialog/NewDialog.d.ts +29 -0
- package/build/system/NewDialog/NewDialog.js +74 -89
- package/build/system/NewDialog/NewDialog.stories.d.ts +38 -0
- package/build/system/NewDialog/NewDialog.stories.jsx +192 -0
- package/build/system/NewDialog/index.d.ts +31 -0
- package/build/system/NewDialog/index.js +9 -13
- package/build/system/NewForm/Fieldset.d.ts +2 -0
- package/build/system/NewForm/Fieldset.js +38 -43
- package/build/system/NewForm/Form.d.ts +2 -0
- package/build/system/NewForm/Form.js +21 -28
- package/build/system/NewForm/FormAutocomplete.d.ts +2 -0
- package/build/system/NewForm/FormAutocomplete.js +386 -381
- package/build/system/NewForm/FormAutocomplete.stories.d.ts +156 -0
- package/build/system/NewForm/FormAutocomplete.stories.jsx +159 -0
- package/build/system/NewForm/FormAutocomplete.test.d.ts +1 -0
- package/build/system/NewForm/FormAutocomplete.test.js +40 -73
- package/build/system/NewForm/FormAutocompleteMultiselect.d.ts +2 -0
- package/build/system/NewForm/FormAutocompleteMultiselect.js +456 -468
- package/build/system/NewForm/FormAutocompleteMultiselect.stories.d.ts +45 -0
- package/build/system/NewForm/FormAutocompleteMultiselect.stories.jsx +162 -0
- package/build/system/NewForm/FormAutocompleteMultiselect.test.d.ts +1 -0
- package/build/system/NewForm/FormAutocompleteMultiselect.test.js +37 -73
- package/build/system/NewForm/FormSelect.d.ts +2 -0
- package/build/system/NewForm/FormSelect.js +159 -140
- package/build/system/NewForm/FormSelect.stories.d.ts +137 -0
- package/build/system/NewForm/FormSelect.stories.jsx +138 -0
- package/build/system/NewForm/FormSelect.test.d.ts +1 -0
- package/build/system/NewForm/FormSelect.test.js +131 -227
- package/build/system/NewForm/FormSelectArrow.d.ts +2 -0
- package/build/system/NewForm/FormSelectArrow.js +35 -35
- package/build/system/NewForm/FormSelectContent.d.ts +2 -0
- package/build/system/NewForm/FormSelectContent.js +27 -34
- package/build/system/NewForm/FormSelectInline.d.ts +30 -0
- package/build/system/NewForm/FormSelectInline.js +41 -38
- package/build/system/NewForm/FormSelectLoading.d.ts +2 -0
- package/build/system/NewForm/FormSelectLoading.js +36 -45
- package/build/system/NewForm/FormSelectSearch.d.ts +2 -0
- package/build/system/NewForm/FormSelectSearch.js +23 -25
- package/build/system/NewForm/Legend.d.ts +2 -0
- package/build/system/NewForm/Legend.js +32 -37
- package/build/system/NewForm/index.d.ts +12 -0
- package/build/system/NewForm/index.js +30 -30
- package/build/system/Notice/Notice.d.ts +18 -0
- package/build/system/Notice/Notice.js +41 -55
- package/build/system/Notice/Notice.stories.d.ts +13 -0
- package/build/system/Notice/Notice.stories.js +3 -5
- package/build/system/Notice/index.d.ts +5 -0
- package/build/system/OptionRow/OptionRow.d.ts +2 -0
- package/build/system/OptionRow/OptionRow.js +146 -159
- package/build/system/OptionRow/OptionRow.stories.d.ts +8 -0
- package/build/system/OptionRow/OptionRow.stories.jsx +53 -0
- package/build/system/OptionRow/OptionRow.test.d.ts +1 -0
- package/build/system/OptionRow/OptionRow.test.js +38 -67
- package/build/system/OptionRow/index.d.ts +2 -0
- package/build/system/OptionRow/index.js +5 -4
- package/build/system/Progress/Progress.d.ts +2 -0
- package/build/system/Progress/Progress.js +69 -84
- package/build/system/Progress/Progress.stories.d.ts +8 -0
- package/build/system/Progress/Progress.stories.jsx +25 -0
- package/build/system/Progress/index.d.ts +2 -0
- package/build/system/Progress/index.js +5 -4
- package/build/system/ScreenReaderText/ScreenReader.test.d.ts +1 -0
- package/build/system/ScreenReaderText/ScreenReader.test.js +21 -25
- package/build/system/ScreenReaderText/ScreenReaderText.d.ts +14 -0
- package/build/system/ScreenReaderText/ScreenReaderText.js +13 -21
- package/build/system/ScreenReaderText/index.d.ts +3 -0
- package/build/system/ScreenReaderText/index.js +6 -8
- package/build/system/Spinner/Spinner.d.ts +9 -0
- package/build/system/Spinner/Spinner.js +12 -19
- package/build/system/Spinner/Spinner.stories.d.ts +7 -0
- package/build/system/Spinner/Spinner.stories.js +3 -5
- package/build/system/Spinner/Spinner.test.d.ts +1 -0
- package/build/system/Spinner/Spinner.test.js +59 -0
- package/build/system/Spinner/index.d.ts +1 -0
- package/build/system/Spinner/index.js +1 -0
- package/build/system/Table/Table.d.ts +14 -0
- package/build/system/Table/Table.js +7 -21
- package/build/system/Table/Table.stories.d.ts +9 -0
- package/build/system/Table/Table.stories.js +5 -12
- package/build/system/Table/TableCell.d.ts +15 -0
- package/build/system/Table/TableCell.js +13 -18
- package/build/system/Table/TableRow.d.ts +14 -0
- package/build/system/Table/TableRow.js +19 -24
- package/build/system/Table/index.d.ts +6 -0
- package/build/system/Table/index.js +1 -0
- package/build/system/Tabs/Tabs.d.ts +5 -0
- package/build/system/Tabs/Tabs.js +40 -38
- package/build/system/Tabs/Tabs.stories.d.ts +9 -0
- package/build/system/Tabs/Tabs.stories.jsx +69 -0
- package/build/system/Tabs/TabsContent.d.ts +16 -0
- package/build/system/Tabs/TabsContent.js +23 -30
- package/build/system/Tabs/TabsList.d.ts +15 -0
- package/build/system/Tabs/TabsList.js +24 -32
- package/build/system/Tabs/TabsTrigger.d.ts +2 -0
- package/build/system/Tabs/TabsTrigger.js +58 -66
- package/build/system/Tabs/index.d.ts +5 -0
- package/build/system/Tabs/index.js +8 -10
- package/build/system/Text/Text.d.ts +2 -0
- package/build/system/Text/Text.js +5 -13
- package/build/system/Text/Text.stories.d.ts +8 -0
- package/build/system/Text/Text.stories.js +4 -5
- package/build/system/Text/index.d.ts +4 -0
- package/build/system/Text/index.js +1 -0
- package/build/system/Tooltip/Tooltip.css +96 -0
- package/build/system/Tooltip/Tooltip.d.ts +15 -0
- package/build/system/Tooltip/Tooltip.js +23 -93
- package/build/system/Tooltip/Tooltip.stories.d.ts +15 -0
- package/build/system/Tooltip/Tooltip.stories.js +83 -21
- package/build/system/Tooltip/index.d.ts +5 -0
- package/build/system/Wizard/Wizard.d.ts +2 -0
- package/build/system/Wizard/Wizard.js +94 -103
- package/build/system/Wizard/Wizard.stories.d.ts +9 -0
- package/build/system/Wizard/Wizard.stories.jsx +145 -0
- package/build/system/Wizard/WizardStep.d.ts +2 -0
- package/build/system/Wizard/WizardStep.js +188 -198
- package/build/system/Wizard/WizardStepHorizontal.d.ts +2 -0
- package/build/system/Wizard/WizardStepHorizontal.js +43 -55
- package/build/system/Wizard/index.d.ts +4 -0
- package/build/system/Wizard/index.js +7 -8
- package/build/system/index.d.ts +51 -0
- package/build/system/index.js +104 -86
- package/build/system/theme/colors.d.ts +2 -0
- package/build/system/theme/colors.js +7 -12
- package/build/system/theme/getColor.d.ts +8 -0
- package/build/system/theme/getColor.js +47 -46
- package/build/system/theme/index.d.ts +322 -0
- package/build/system/theme/index.js +494 -396
- package/build/system/theme/textStyles.d.ts +71 -0
- package/build/system/theme/textStyles.js +45 -50
- package/build/system/utils/random.d.ts +1 -0
- package/build/system/utils/random.js +3 -7
- package/package.json +31 -37
- package/src/declaration.d.ts +1 -0
- package/src/system/Accordion/{Accordion.test.js → Accordion.test.tsx} +2 -2
- package/src/system/Accordion/{Accordion.js → Accordion.tsx} +87 -80
- package/src/system/Avatar/Avatar.stories.tsx +18 -0
- package/src/system/Avatar/{Avatar.test.js → Avatar.test.tsx} +2 -2
- package/src/system/Avatar/{Avatar.js → Avatar.tsx} +17 -19
- package/src/system/Avatar/index.ts +4 -0
- package/src/system/Badge/Badge.stories.tsx +57 -0
- package/src/system/Badge/{Badge.test.js → Badge.test.tsx} +3 -3
- package/src/system/Badge/{Badge.js → Badge.tsx} +10 -15
- package/src/system/Badge/index.ts +4 -0
- package/src/system/Box/Box.stories.tsx +13 -1
- package/src/system/Box/Box.tsx +4 -8
- package/src/system/Button/Button.stories.tsx +110 -0
- package/src/system/Button/Button.tsx +67 -0
- package/src/system/Card/{Card.stories.jsx → Card.stories.tsx} +1 -1
- package/src/system/Card/{Card.test.js → Card.test.tsx} +2 -2
- package/src/system/Card/Card.tsx +40 -0
- package/src/system/Card/index.ts +4 -0
- package/src/system/Code/Code.stories.tsx +44 -0
- package/src/system/Code/{Code.test.js → Code.test.tsx} +6 -4
- package/src/system/Code/{Code.js → Code.tsx} +27 -22
- package/src/system/Code/index.ts +4 -0
- package/src/system/Flex/Flex.tsx +11 -0
- package/src/system/Flex/index.ts +4 -0
- package/src/system/Grid/Grid.tsx +11 -0
- package/src/system/Grid/index.ts +4 -0
- package/src/system/Heading/Heading.tsx +8 -17
- package/src/system/Link/Link.stories.tsx +23 -0
- package/src/system/Link/Link.tsx +43 -0
- package/src/system/Link/index.ts +4 -0
- package/src/system/NewForm/FormAutocomplete.js +2 -2
- package/src/system/Notice/Notice.tsx +129 -0
- package/src/system/OptionRow/OptionRow.test.js +1 -1
- package/src/system/ScreenReaderText/ScreenReaderText.tsx +40 -0
- package/src/system/Spinner/Spinner.test.tsx +30 -0
- package/src/system/Spinner/Spinner.tsx +34 -0
- package/src/system/Spinner/index.ts +1 -0
- package/src/system/Table/{Table.stories.jsx → Table.stories.tsx} +6 -6
- package/src/system/Table/{Table.js → Table.tsx} +14 -18
- package/src/system/Table/{TableCell.js → TableCell.tsx} +14 -12
- package/src/system/Table/TableRow.tsx +63 -0
- package/src/system/Table/index.ts +6 -0
- package/src/system/Text/{Text.stories.jsx → Text.stories.tsx} +1 -0
- package/src/system/Text/Text.tsx +25 -0
- package/src/system/Text/index.ts +4 -0
- package/src/system/Tooltip/Tooltip.css +96 -0
- package/src/system/Tooltip/Tooltip.stories.tsx +133 -0
- package/src/system/Tooltip/Tooltip.tsx +39 -0
- package/src/system/index.js +1 -2
- package/src/system/theme/index.js +21 -1
- package/test/fileMock.ts +1 -0
- package/test/setupAfterEnv.ts +5 -0
- package/tsconfig.definition.json +12 -0
- package/.storybook/decorators/withBoundingBox.jsx +0 -22
- package/build/system/Box/Box.stories.tsx +0 -11
- package/build/system/Box/Box.tsx +0 -22
- package/build/system/Button/ButtonSubmit.stories.js +0 -58
- package/build/system/ConfirmationDialog/ConfirmationDialog.stories.js +0 -42
- package/build/system/Dialog/Dialog.stories.js +0 -70
- package/build/system/Dropdown/Dropdown.stories.js +0 -197
- package/build/system/Form/Checkbox.stories.js +0 -73
- package/build/system/Form/Input.stories.js +0 -51
- package/build/system/Form/InputWithCopyButton.stories.js +0 -39
- package/build/system/Form/Radio.stories.js +0 -115
- package/build/system/Form/RadioBoxGroup.stories.js +0 -62
- package/build/system/Form/Textarea.stories.js +0 -59
- package/build/system/Form/Toggle.stories.js +0 -104
- package/build/system/Heading/Heading.stories.tsx +0 -19
- package/build/system/Heading/Heading.tsx +0 -38
- package/build/system/NewConfirmationDialog/NewConfirmationDialog.stories.js +0 -46
- package/build/system/NewDialog/NewDialog.stories.js +0 -247
- package/build/system/NewForm/FormAutocomplete.stories.js +0 -220
- package/build/system/NewForm/FormAutocompleteMultiselect.stories.js +0 -231
- package/build/system/NewForm/FormSelect.stories.js +0 -171
- package/build/system/Notification/Notification.js +0 -97
- package/build/system/Notification/Notification.stories.js +0 -29
- package/build/system/Notification/index.js +0 -5
- package/build/system/OptionRow/OptionRow.stories.js +0 -64
- package/build/system/Progress/Progress.stories.js +0 -36
- package/build/system/Tabs/Tabs.stories.js +0 -113
- package/build/system/Wizard/Wizard.stories.js +0 -182
- package/src/system/Avatar/Avatar.stories.jsx +0 -11
- package/src/system/Avatar/index.js +0 -6
- package/src/system/Badge/Badge.stories.jsx +0 -43
- package/src/system/Badge/index.js +0 -6
- package/src/system/Button/Button.js +0 -63
- package/src/system/Button/Button.stories.jsx +0 -87
- package/src/system/Card/Card.js +0 -39
- package/src/system/Card/index.js +0 -6
- package/src/system/Code/Code.stories.jsx +0 -37
- package/src/system/Code/index.js +0 -6
- package/src/system/Flex/Flex.js +0 -15
- package/src/system/Flex/index.js +0 -6
- package/src/system/Grid/Grid.js +0 -16
- package/src/system/Grid/index.js +0 -6
- package/src/system/Link/Link.js +0 -42
- package/src/system/Link/Link.stories.jsx +0 -15
- package/src/system/Link/index.js +0 -6
- package/src/system/Notice/Notice.js +0 -136
- package/src/system/Notification/Notification.js +0 -66
- package/src/system/Notification/Notification.stories.jsx +0 -16
- package/src/system/Notification/index.js +0 -6
- package/src/system/ScreenReaderText/ScreenReaderText.js +0 -39
- package/src/system/Spinner/Spinner.js +0 -34
- package/src/system/Spinner/index.js +0 -6
- package/src/system/Table/TableRow.js +0 -50
- package/src/system/Table/index.js +0 -8
- package/src/system/Text/Text.js +0 -33
- package/src/system/Text/index.js +0 -6
- package/src/system/Tooltip/Tooltip.js +0 -79
- package/src/system/Tooltip/Tooltip.stories.jsx +0 -22
- package/test/fileMock.js +0 -1
- package/test/setupAfterEnv.js +0 -13
- package/test/setupTests.js +0 -4
- /package/.storybook/decorators/{withColorMode.jsx → withColorMode.tsx} +0 -0
- /package/src/system/Accordion/{Accordion.stories.jsx → Accordion.stories.tsx} +0 -0
- /package/src/system/Accordion/{index.js → index.ts} +0 -0
- /package/src/system/Flex/{Flex.stories.jsx → Flex.stories.tsx} +0 -0
- /package/src/system/Grid/{Grid.stories.jsx → Grid.stories.tsx} +0 -0
- /package/src/system/Notice/{Notice.stories.jsx → Notice.stories.tsx} +0 -0
- /package/src/system/Notice/{index.js → index.ts} +0 -0
- /package/src/system/Spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +0 -0
- /package/src/system/Tooltip/{index.js → index.ts} +0 -0
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = exports.WithSlowSearchAndDebounce = exports.WithSearchIcon = exports.WithLoading = exports.WithErrors = exports.WithDefaultValue = exports.WithDebounce = exports.WithCustomMessages = exports.WithCustomArrow = exports.WithArrow = exports.Inline = exports.Default = void 0;
|
|
5
|
-
var _react = require("react");
|
|
6
|
-
var Form = _interopRequireWildcard(require("."));
|
|
7
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
8
|
-
var _excluded = ["label", "width"];
|
|
9
|
-
/** @jsxImportSource theme-ui */
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
16
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
17
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
18
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
19
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
20
|
-
var _default = {
|
|
21
|
-
title: 'Form/Autocomplete',
|
|
22
|
-
argTypes: {
|
|
23
|
-
placeholder: {
|
|
24
|
-
type: {
|
|
25
|
-
name: 'string',
|
|
26
|
-
required: false
|
|
27
|
-
},
|
|
28
|
-
control: {
|
|
29
|
-
type: 'text'
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
debounce: {
|
|
33
|
-
type: {
|
|
34
|
-
name: 'number',
|
|
35
|
-
required: false
|
|
36
|
-
},
|
|
37
|
-
control: {
|
|
38
|
-
type: 'number'
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
label: {
|
|
42
|
-
type: {
|
|
43
|
-
name: 'string',
|
|
44
|
-
required: false
|
|
45
|
-
},
|
|
46
|
-
control: {
|
|
47
|
-
type: 'text'
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
resetOnBlur: {
|
|
51
|
-
options: [false, true],
|
|
52
|
-
control: {
|
|
53
|
-
type: 'boolean'
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
exports["default"] = _default;
|
|
59
|
-
var options = [{
|
|
60
|
-
value: 'chocolate',
|
|
61
|
-
label: 'Chocolate'
|
|
62
|
-
}, {
|
|
63
|
-
value: 'strawberry',
|
|
64
|
-
label: 'Strawberry Chocolate Vanilla Chocolate Vanilla'
|
|
65
|
-
}, {
|
|
66
|
-
value: 'vanilla',
|
|
67
|
-
label: 'Vanilla'
|
|
68
|
-
}];
|
|
69
|
-
var args = {
|
|
70
|
-
label: 'Label',
|
|
71
|
-
options: options,
|
|
72
|
-
resetOnBlur: false,
|
|
73
|
-
placeholder: 'Start typing...'
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
// eslint-disable-next-line react/prop-types
|
|
77
|
-
var DefaultComponent = function DefaultComponent(_ref) {
|
|
78
|
-
var _ref$label = _ref.label,
|
|
79
|
-
label = _ref$label === void 0 ? 'Label' : _ref$label,
|
|
80
|
-
_ref$width = _ref.width,
|
|
81
|
-
width = _ref$width === void 0 ? 250 : _ref$width,
|
|
82
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
83
|
-
var _useState = (0, _react.useState)(null),
|
|
84
|
-
selectedValue = _useState[0],
|
|
85
|
-
setSelectedValue = _useState[1];
|
|
86
|
-
return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
87
|
-
children: (0, _jsxRuntime.jsxs)(Form.Root, {
|
|
88
|
-
children: [(0, _jsxRuntime.jsx)("div", {
|
|
89
|
-
sx: {
|
|
90
|
-
width: width
|
|
91
|
-
},
|
|
92
|
-
children: (0, _jsxRuntime.jsx)(Form.Autocomplete, _extends({
|
|
93
|
-
forLabel: "form-autocomplete",
|
|
94
|
-
label: label,
|
|
95
|
-
onChange: function onChange(obj, val) {
|
|
96
|
-
setSelectedValue(val);
|
|
97
|
-
}
|
|
98
|
-
}, rest))
|
|
99
|
-
}), (0, _jsxRuntime.jsxs)("div", {
|
|
100
|
-
sx: {
|
|
101
|
-
mt: 3
|
|
102
|
-
},
|
|
103
|
-
children: ["Selected value: ", selectedValue]
|
|
104
|
-
})]
|
|
105
|
-
})
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
var Default = DefaultComponent.bind({});
|
|
109
|
-
exports.Default = Default;
|
|
110
|
-
Default.args = args;
|
|
111
|
-
var Inline = DefaultComponent.bind({});
|
|
112
|
-
exports.Inline = Inline;
|
|
113
|
-
Inline.args = _extends({}, Default.args, {
|
|
114
|
-
isInline: true
|
|
115
|
-
});
|
|
116
|
-
var WithDefaultValue = DefaultComponent.bind({});
|
|
117
|
-
exports.WithDefaultValue = WithDefaultValue;
|
|
118
|
-
WithDefaultValue.args = _extends({}, Default.args, {
|
|
119
|
-
value: 'Chocolate'
|
|
120
|
-
});
|
|
121
|
-
var WithSearchIcon = DefaultComponent.bind({});
|
|
122
|
-
exports.WithSearchIcon = WithSearchIcon;
|
|
123
|
-
WithSearchIcon.args = _extends({}, Default.args, {
|
|
124
|
-
searchIcon: true,
|
|
125
|
-
placeholder: 'Type to search'
|
|
126
|
-
});
|
|
127
|
-
var WithLoading = DefaultComponent.bind({});
|
|
128
|
-
exports.WithLoading = WithLoading;
|
|
129
|
-
WithLoading.args = _extends({}, Default.args, {
|
|
130
|
-
loading: true
|
|
131
|
-
});
|
|
132
|
-
var WithDebounce = function WithDebounce() {
|
|
133
|
-
var _useState2 = (0, _react.useState)(null),
|
|
134
|
-
value = _useState2[0],
|
|
135
|
-
setValue = _useState2[1];
|
|
136
|
-
var customArgs = _extends({}, args, {
|
|
137
|
-
minLength: 3,
|
|
138
|
-
debounce: 300,
|
|
139
|
-
onInputChange: function onInputChange(query) {
|
|
140
|
-
setValue(query);
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
144
|
-
children: ["Filter: ", value, (0, _jsxRuntime.jsx)(DefaultComponent, _extends({}, customArgs))]
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
exports.WithDebounce = WithDebounce;
|
|
148
|
-
var WithSlowSearchAndDebounce = DefaultComponent.bind({});
|
|
149
|
-
exports.WithSlowSearchAndDebounce = WithSlowSearchAndDebounce;
|
|
150
|
-
WithSlowSearchAndDebounce.args = _extends({}, Default.args, {
|
|
151
|
-
label: 'Label',
|
|
152
|
-
autoFilter: false,
|
|
153
|
-
minLength: 3,
|
|
154
|
-
required: true,
|
|
155
|
-
debounce: 500,
|
|
156
|
-
source: function () {
|
|
157
|
-
var _source = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(query, populateResults) {
|
|
158
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
159
|
-
while (1) switch (_context.prev = _context.next) {
|
|
160
|
-
case 0:
|
|
161
|
-
if (!query || query.length >= 3) {
|
|
162
|
-
setTimeout(function () {
|
|
163
|
-
var filteredResults = args.options.map(function (option) {
|
|
164
|
-
return option.label;
|
|
165
|
-
}).filter(function (result) {
|
|
166
|
-
return result.toLowerCase().indexOf(query == null ? void 0 : query.toLowerCase()) !== -1;
|
|
167
|
-
});
|
|
168
|
-
populateResults(filteredResults);
|
|
169
|
-
}, 1000);
|
|
170
|
-
}
|
|
171
|
-
case 1:
|
|
172
|
-
case "end":
|
|
173
|
-
return _context.stop();
|
|
174
|
-
}
|
|
175
|
-
}, _callee);
|
|
176
|
-
}));
|
|
177
|
-
function source(_x, _x2) {
|
|
178
|
-
return _source.apply(this, arguments);
|
|
179
|
-
}
|
|
180
|
-
return source;
|
|
181
|
-
}()
|
|
182
|
-
});
|
|
183
|
-
var WithCustomMessages = DefaultComponent.bind({});
|
|
184
|
-
exports.WithCustomMessages = WithCustomMessages;
|
|
185
|
-
WithCustomMessages.args = _extends({}, Default.args, {
|
|
186
|
-
noOptionsMessage: function noOptionsMessage() {
|
|
187
|
-
return 'No data';
|
|
188
|
-
},
|
|
189
|
-
placeholder: 'Type to search'
|
|
190
|
-
});
|
|
191
|
-
var WithErrors = DefaultComponent.bind({});
|
|
192
|
-
exports.WithErrors = WithErrors;
|
|
193
|
-
WithErrors.args = _extends({}, Default.args, {
|
|
194
|
-
hasError: true,
|
|
195
|
-
errorMessage: 'Please select a value.',
|
|
196
|
-
required: true
|
|
197
|
-
});
|
|
198
|
-
var WithArrow = DefaultComponent.bind({});
|
|
199
|
-
exports.WithArrow = WithArrow;
|
|
200
|
-
WithArrow.args = _extends({}, Default.args, {
|
|
201
|
-
showAllValues: true
|
|
202
|
-
});
|
|
203
|
-
var WithCustomArrow = DefaultComponent.bind({});
|
|
204
|
-
exports.WithCustomArrow = WithCustomArrow;
|
|
205
|
-
WithCustomArrow.args = _extends({}, Default.args, {
|
|
206
|
-
showAllValues: true,
|
|
207
|
-
// eslint-disable-next-line react/display-name
|
|
208
|
-
dropdownArrow: function dropdownArrow() {
|
|
209
|
-
return (0, _jsxRuntime.jsx)("span", {
|
|
210
|
-
sx: {
|
|
211
|
-
position: 'absolute',
|
|
212
|
-
top: '2px',
|
|
213
|
-
right: '10px',
|
|
214
|
-
pointerEvents: 'none'
|
|
215
|
-
},
|
|
216
|
-
children: "\uD83D\uDC47"
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
WithCustomArrow.displayName = 'WithCustomArrow';
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = exports.WithStaticData = exports.WithDynamicData = exports.Inline = exports.Default = void 0;
|
|
5
|
-
var _react = require("react");
|
|
6
|
-
var Form = _interopRequireWildcard(require("."));
|
|
7
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
8
|
-
var _excluded = ["label", "width"];
|
|
9
|
-
/** @jsxImportSource theme-ui */
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
17
|
-
var _default = {
|
|
18
|
-
title: 'Form/AutocompleteMulti',
|
|
19
|
-
argTypes: {
|
|
20
|
-
placeholder: {
|
|
21
|
-
type: {
|
|
22
|
-
name: 'string',
|
|
23
|
-
required: false
|
|
24
|
-
},
|
|
25
|
-
control: {
|
|
26
|
-
type: 'text'
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
label: {
|
|
30
|
-
type: {
|
|
31
|
-
name: 'string',
|
|
32
|
-
required: false
|
|
33
|
-
},
|
|
34
|
-
control: {
|
|
35
|
-
type: 'text'
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
exports["default"] = _default;
|
|
41
|
-
var shortOptions = [{
|
|
42
|
-
value: 'chocolate',
|
|
43
|
-
label: 'Chocolate'
|
|
44
|
-
}, {
|
|
45
|
-
value: 'strawberry',
|
|
46
|
-
label: 'Strawberry'
|
|
47
|
-
}, {
|
|
48
|
-
value: 'vanilla',
|
|
49
|
-
label: 'Vanilla'
|
|
50
|
-
}, {
|
|
51
|
-
value: 'pistachio',
|
|
52
|
-
label: 'Pistachio'
|
|
53
|
-
}, {
|
|
54
|
-
value: 'bubblegum',
|
|
55
|
-
label: 'Bubblegum'
|
|
56
|
-
}, {
|
|
57
|
-
value: 'ube',
|
|
58
|
-
label: 'Ube'
|
|
59
|
-
}, {
|
|
60
|
-
value: 'mango',
|
|
61
|
-
label: 'Mango'
|
|
62
|
-
}, {
|
|
63
|
-
value: 'buko',
|
|
64
|
-
label: 'Buko'
|
|
65
|
-
}, {
|
|
66
|
-
value: 'durian',
|
|
67
|
-
label: 'Durian'
|
|
68
|
-
}, {
|
|
69
|
-
value: 'lecheflan',
|
|
70
|
-
label: 'Leche Flan'
|
|
71
|
-
}];
|
|
72
|
-
var longOptions = [{
|
|
73
|
-
value: 'chocolate',
|
|
74
|
-
label: 'www.chocolate.com'
|
|
75
|
-
}, {
|
|
76
|
-
value: 'strawberry',
|
|
77
|
-
label: 'www.chocolatevanillastrawberry.com'
|
|
78
|
-
}, {
|
|
79
|
-
value: 'vanilla',
|
|
80
|
-
label: 'www.vanilla.com'
|
|
81
|
-
}, {
|
|
82
|
-
value: 'pistachio',
|
|
83
|
-
label: 'www.pistachio.com'
|
|
84
|
-
}, {
|
|
85
|
-
value: 'bubblegum',
|
|
86
|
-
label: 'www.bubblegum.com'
|
|
87
|
-
}, {
|
|
88
|
-
value: 'ube',
|
|
89
|
-
label: 'www.ube.com'
|
|
90
|
-
}, {
|
|
91
|
-
value: 'mango',
|
|
92
|
-
label: 'www.mango.com'
|
|
93
|
-
}, {
|
|
94
|
-
value: 'buko',
|
|
95
|
-
label: 'www.buko.com'
|
|
96
|
-
}, {
|
|
97
|
-
value: 'durian',
|
|
98
|
-
label: 'www.thesuperfruitdurian.com'
|
|
99
|
-
}, {
|
|
100
|
-
value: 'lecheflan',
|
|
101
|
-
label: 'www.deliciousdessertnamedfromcursewordlecheflan.com'
|
|
102
|
-
}, {
|
|
103
|
-
value: 'optionwithspace',
|
|
104
|
-
label: 'This a very long option that has spaces and it should wrap.'
|
|
105
|
-
}];
|
|
106
|
-
var args = {
|
|
107
|
-
label: 'Ice Cream Flavors',
|
|
108
|
-
options: shortOptions
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
// eslint-disable-next-line react/prop-types
|
|
112
|
-
var DefaultComponent = function DefaultComponent(_ref) {
|
|
113
|
-
var _ref$label = _ref.label,
|
|
114
|
-
label = _ref$label === void 0 ? 'Label' : _ref$label,
|
|
115
|
-
_ref$width = _ref.width,
|
|
116
|
-
width = _ref$width === void 0 ? 250 : _ref$width,
|
|
117
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
118
|
-
var _useState = (0, _react.useState)([]),
|
|
119
|
-
selectedValues = _useState[0],
|
|
120
|
-
setSelectedValues = _useState[1];
|
|
121
|
-
return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
122
|
-
children: (0, _jsxRuntime.jsxs)(Form.Root, {
|
|
123
|
-
children: [(0, _jsxRuntime.jsx)("div", {
|
|
124
|
-
sx: {
|
|
125
|
-
width: width
|
|
126
|
-
},
|
|
127
|
-
children: (0, _jsxRuntime.jsx)(Form.AutocompleteMulti, _extends({
|
|
128
|
-
forLabel: "form-autocompletemultiselect",
|
|
129
|
-
label: label,
|
|
130
|
-
onChange: function onChange(obj) {
|
|
131
|
-
setSelectedValues(obj);
|
|
132
|
-
}
|
|
133
|
-
}, rest))
|
|
134
|
-
}), (0, _jsxRuntime.jsxs)("div", {
|
|
135
|
-
sx: {
|
|
136
|
-
mt: 3
|
|
137
|
-
},
|
|
138
|
-
children: ["Selected value: ", selectedValues.join(', ')]
|
|
139
|
-
})]
|
|
140
|
-
})
|
|
141
|
-
});
|
|
142
|
-
};
|
|
143
|
-
var Default = function Default() {
|
|
144
|
-
return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
145
|
-
children: (0, _jsxRuntime.jsx)(DefaultComponent, _extends({
|
|
146
|
-
required: true
|
|
147
|
-
}, args, {
|
|
148
|
-
placeholder: "Start typing..."
|
|
149
|
-
}))
|
|
150
|
-
});
|
|
151
|
-
};
|
|
152
|
-
exports.Default = Default;
|
|
153
|
-
var Inline = function Inline() {
|
|
154
|
-
var customArgs = _extends({
|
|
155
|
-
isInline: true
|
|
156
|
-
}, args, {
|
|
157
|
-
showAllValues: true
|
|
158
|
-
});
|
|
159
|
-
return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
160
|
-
children: (0, _jsxRuntime.jsx)(DefaultComponent, _extends({}, customArgs))
|
|
161
|
-
});
|
|
162
|
-
};
|
|
163
|
-
exports.Inline = Inline;
|
|
164
|
-
Inline.displayName = 'Inline';
|
|
165
|
-
var WithStaticData = function WithStaticData() {
|
|
166
|
-
var customArgs = {
|
|
167
|
-
label: 'Select domains',
|
|
168
|
-
searchIcon: true,
|
|
169
|
-
required: true,
|
|
170
|
-
options: longOptions,
|
|
171
|
-
showAllValues: true,
|
|
172
|
-
placeholder: 'Select domains',
|
|
173
|
-
hasError: true,
|
|
174
|
-
errorMessage: 'Domain is required.'
|
|
175
|
-
};
|
|
176
|
-
return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
177
|
-
children: (0, _jsxRuntime.jsx)(DefaultComponent, _extends({}, customArgs))
|
|
178
|
-
});
|
|
179
|
-
};
|
|
180
|
-
exports.WithStaticData = WithStaticData;
|
|
181
|
-
WithStaticData.displayName = 'WithStaticData';
|
|
182
|
-
var WithDynamicData = function WithDynamicData() {
|
|
183
|
-
var _useState2 = (0, _react.useState)([]),
|
|
184
|
-
selectedValues = _useState2[0],
|
|
185
|
-
setSelectedValues = _useState2[1];
|
|
186
|
-
var customArgs = {
|
|
187
|
-
label: 'Select domains',
|
|
188
|
-
searchIcon: true,
|
|
189
|
-
required: true,
|
|
190
|
-
placeholder: 'Start typing...',
|
|
191
|
-
source: function source(q, populateResults) {
|
|
192
|
-
var filtered = longOptions.filter(function (option) {
|
|
193
|
-
return option.label.toLowerCase().includes(q);
|
|
194
|
-
});
|
|
195
|
-
var optionForDisplay = filtered == null ? void 0 : filtered.map(function (option) {
|
|
196
|
-
return option.label;
|
|
197
|
-
});
|
|
198
|
-
populateResults(optionForDisplay.filter(function (option) {
|
|
199
|
-
return !selectedValues.includes(option);
|
|
200
|
-
}));
|
|
201
|
-
},
|
|
202
|
-
onChange: function onChange(obj) {
|
|
203
|
-
setSelectedValues(obj);
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
207
|
-
children: (0, _jsxRuntime.jsxs)(Form.Root, {
|
|
208
|
-
children: [(0, _jsxRuntime.jsx)("div", {
|
|
209
|
-
sx: {
|
|
210
|
-
width: '100%'
|
|
211
|
-
},
|
|
212
|
-
children: (0, _jsxRuntime.jsx)(Form.AutocompleteMulti, _extends({
|
|
213
|
-
forLabel: "form-autocompletemultiselect",
|
|
214
|
-
label: customArgs.label,
|
|
215
|
-
onChange: function onChange(obj) {
|
|
216
|
-
setSelectedValues(obj);
|
|
217
|
-
},
|
|
218
|
-
hasError: true,
|
|
219
|
-
errorMessage: "Please select a value."
|
|
220
|
-
}, customArgs))
|
|
221
|
-
}), (0, _jsxRuntime.jsxs)("div", {
|
|
222
|
-
sx: {
|
|
223
|
-
mt: 3
|
|
224
|
-
},
|
|
225
|
-
children: ["Selected value: ", selectedValues.join(', ')]
|
|
226
|
-
})]
|
|
227
|
-
})
|
|
228
|
-
});
|
|
229
|
-
};
|
|
230
|
-
exports.WithDynamicData = WithDynamicData;
|
|
231
|
-
WithDynamicData.displayName = 'WithDynamicDataFullSize';
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = exports.WithOptionLabelAndValue = exports.WithOnChange = exports.WithGroup = exports.WithErrors = exports.IsInline = exports.Default = void 0;
|
|
5
|
-
var _react = require("react");
|
|
6
|
-
var Form = _interopRequireWildcard(require("."));
|
|
7
|
-
var _Link = require("../Link");
|
|
8
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
9
|
-
var _excluded = ["label", "width", "onChange"];
|
|
10
|
-
/** @jsxImportSource theme-ui */
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
17
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
18
|
-
var _default = {
|
|
19
|
-
title: 'Form/Select',
|
|
20
|
-
argTypes: {
|
|
21
|
-
placeholder: {
|
|
22
|
-
type: {
|
|
23
|
-
name: 'string',
|
|
24
|
-
required: false
|
|
25
|
-
},
|
|
26
|
-
control: {
|
|
27
|
-
type: 'text'
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
label: {
|
|
31
|
-
type: {
|
|
32
|
-
name: 'string',
|
|
33
|
-
required: false
|
|
34
|
-
},
|
|
35
|
-
control: {
|
|
36
|
-
type: 'text'
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
exports["default"] = _default;
|
|
42
|
-
var options = [{
|
|
43
|
-
value: 'chocolate',
|
|
44
|
-
label: 'Chocolate'
|
|
45
|
-
}, {
|
|
46
|
-
value: 'strawberry',
|
|
47
|
-
label: 'Strawberry Chocolate Vanilla Chocolate Vanilla'
|
|
48
|
-
}, {
|
|
49
|
-
value: 'vanilla',
|
|
50
|
-
label: 'Vanilla'
|
|
51
|
-
}];
|
|
52
|
-
var groupedOptions = [{
|
|
53
|
-
label: 'Group name',
|
|
54
|
-
options: options
|
|
55
|
-
}, {
|
|
56
|
-
label: 'Another Group name',
|
|
57
|
-
options: options
|
|
58
|
-
}];
|
|
59
|
-
|
|
60
|
-
// eslint-disable-next-line react/prop-types
|
|
61
|
-
var DefaultComponent = function DefaultComponent(_ref) {
|
|
62
|
-
var _ref$label = _ref.label,
|
|
63
|
-
label = _ref$label === void 0 ? 'Label' : _ref$label,
|
|
64
|
-
_ref$width = _ref.width,
|
|
65
|
-
width = _ref$width === void 0 ? 250 : _ref$width,
|
|
66
|
-
onChange = _ref.onChange,
|
|
67
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
68
|
-
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
69
|
-
children: [(0, _jsxRuntime.jsxs)("p", {
|
|
70
|
-
children: ["This is a simple wrapper at the top of a browser default select component. This component should be used for situations where you have up to ", (0, _jsxRuntime.jsx)("strong", {
|
|
71
|
-
children: "15 options"
|
|
72
|
-
}), ". If you need to use a auto-complete, searchable solution, please use another component with a typeahead capability."]
|
|
73
|
-
}), (0, _jsxRuntime.jsxs)("p", {
|
|
74
|
-
children: ["This component was heavily inspired by the", ' ', (0, _jsxRuntime.jsxs)(_Link.Link, {
|
|
75
|
-
href: "https://designsystem.digital.gov/components/select/",
|
|
76
|
-
target: "_blank",
|
|
77
|
-
rel: "noreferrer",
|
|
78
|
-
children: [' ', "U.S. Web Design System (USWDS) Select component"]
|
|
79
|
-
}), "."]
|
|
80
|
-
}), (0, _jsxRuntime.jsx)(Form.Root, {
|
|
81
|
-
children: (0, _jsxRuntime.jsx)("div", {
|
|
82
|
-
sx: {
|
|
83
|
-
width: width
|
|
84
|
-
},
|
|
85
|
-
children: (0, _jsxRuntime.jsx)(Form.Select, _extends({
|
|
86
|
-
forLabel: "form-select",
|
|
87
|
-
label: label,
|
|
88
|
-
onChange: onChange
|
|
89
|
-
}, rest))
|
|
90
|
-
})
|
|
91
|
-
})]
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
var Default = DefaultComponent.bind({});
|
|
95
|
-
exports.Default = Default;
|
|
96
|
-
Default.args = {
|
|
97
|
-
placeholder: '- Select -',
|
|
98
|
-
required: true,
|
|
99
|
-
options: options
|
|
100
|
-
};
|
|
101
|
-
var WithErrors = DefaultComponent.bind({});
|
|
102
|
-
exports.WithErrors = WithErrors;
|
|
103
|
-
WithErrors.args = {
|
|
104
|
-
placeholder: '- Select -',
|
|
105
|
-
required: true,
|
|
106
|
-
hasError: true,
|
|
107
|
-
errorMessage: 'This is an error message',
|
|
108
|
-
options: options
|
|
109
|
-
};
|
|
110
|
-
var WithGroup = DefaultComponent.bind({});
|
|
111
|
-
exports.WithGroup = WithGroup;
|
|
112
|
-
WithGroup.args = {
|
|
113
|
-
label: 'Group Label',
|
|
114
|
-
options: [].concat(options, groupedOptions)
|
|
115
|
-
};
|
|
116
|
-
var IsInline = DefaultComponent.bind({});
|
|
117
|
-
exports.IsInline = IsInline;
|
|
118
|
-
IsInline.args = {
|
|
119
|
-
label: 'Inline Select',
|
|
120
|
-
isInline: true,
|
|
121
|
-
width: '100%',
|
|
122
|
-
options: groupedOptions
|
|
123
|
-
};
|
|
124
|
-
var WithOptionLabelAndValue = DefaultComponent.bind({});
|
|
125
|
-
exports.WithOptionLabelAndValue = WithOptionLabelAndValue;
|
|
126
|
-
WithOptionLabelAndValue.args = {
|
|
127
|
-
label: 'Select with getOptionLabel / getOptionValue',
|
|
128
|
-
width: '100%',
|
|
129
|
-
options: options.map(function (_ref2) {
|
|
130
|
-
var label = _ref2.label,
|
|
131
|
-
value = _ref2.value;
|
|
132
|
-
return {
|
|
133
|
-
name: label,
|
|
134
|
-
id: value
|
|
135
|
-
};
|
|
136
|
-
}),
|
|
137
|
-
getOptionLabel: function getOptionLabel(option) {
|
|
138
|
-
return option.name;
|
|
139
|
-
},
|
|
140
|
-
getOptionValue: function getOptionValue(option) {
|
|
141
|
-
return option.id;
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
var WithOnChange = function WithOnChange() {
|
|
145
|
-
var _useState = (0, _react.useState)(null),
|
|
146
|
-
option = _useState[0],
|
|
147
|
-
setOption = _useState[1];
|
|
148
|
-
var onChange = (0, _react.useCallback)(function (val, event) {
|
|
149
|
-
return setOption({
|
|
150
|
-
obj: val,
|
|
151
|
-
eventValue: event.target.value
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
var args = {
|
|
155
|
-
label: 'Select with onChange',
|
|
156
|
-
placeholder: '- Select -',
|
|
157
|
-
width: '100%',
|
|
158
|
-
onChange: onChange,
|
|
159
|
-
options: [].concat(options, groupedOptions)
|
|
160
|
-
};
|
|
161
|
-
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
162
|
-
children: [(0, _jsxRuntime.jsx)(DefaultComponent, _extends({
|
|
163
|
-
onChange: onChange
|
|
164
|
-
}, args)), option && (0, _jsxRuntime.jsxs)("p", {
|
|
165
|
-
children: ["Object to JSON: ", JSON.stringify(option.obj)]
|
|
166
|
-
}), option && (0, _jsxRuntime.jsxs)("p", {
|
|
167
|
-
children: ["Original Event Value: ", option.eventValue]
|
|
168
|
-
})]
|
|
169
|
-
});
|
|
170
|
-
};
|
|
171
|
-
exports.WithOnChange = WithOnChange;
|