@czi-sds/components 15.1.1 → 15.3.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/dist/index.cjs.d.ts +7 -5
- package/dist/index.cjs.js +144 -86
- package/dist/index.esm.d.ts +7 -5
- package/dist/index.esm.js +144 -86
- package/dist/src/common/helpers/scrollStop.d.ts +8 -0
- package/dist/src/common/helpers/scrollStop.js +54 -0
- package/dist/src/common/storybookConstants.d.ts +3 -0
- package/dist/src/common/storybookConstants.js +2 -0
- package/dist/src/common/utils.d.ts +2 -0
- package/dist/src/common/utils.js +9 -0
- package/dist/src/common/warnings.d.ts +10 -0
- package/dist/src/common/warnings.js +60 -0
- package/dist/src/common/warnings.test.d.ts +1 -0
- package/dist/src/common/warnings.test.js +19 -0
- package/dist/src/core/Accordion/Accordion.namespace-test.d.ts +1 -0
- package/dist/src/core/Accordion/Accordion.namespace-test.js +18 -0
- package/dist/src/core/Accordion/__snapshots__/index.test.js.snap +64 -0
- package/dist/src/core/Accordion/components/AccordionDetails/index.d.ts +3 -0
- package/dist/src/core/Accordion/components/AccordionDetails/index.js +9 -0
- package/dist/src/core/Accordion/components/AccordionDetails/style.d.ts +2 -0
- package/dist/src/core/Accordion/components/AccordionDetails/style.js +16 -0
- package/dist/src/core/Accordion/components/AccordionHeader/index.d.ts +7 -0
- package/dist/src/core/Accordion/components/AccordionHeader/index.js +13 -0
- package/dist/src/core/Accordion/components/AccordionHeader/style.d.ts +27 -0
- package/dist/src/core/Accordion/components/AccordionHeader/style.js +21 -0
- package/dist/src/core/Accordion/index.d.ts +12 -0
- package/dist/src/core/Accordion/index.js +38 -0
- package/dist/src/core/Accordion/index.stories.d.ts +28 -0
- package/dist/src/core/Accordion/index.stories.js +82 -0
- package/dist/src/core/Accordion/index.test.d.ts +1 -0
- package/dist/src/core/Accordion/index.test.js +58 -0
- package/dist/src/core/Accordion/style.d.ts +30 -0
- package/dist/src/core/Accordion/style.js +28 -0
- package/dist/src/core/Alert/index.d.ts +7 -0
- package/dist/src/core/Alert/index.js +22 -0
- package/dist/src/core/Alert/index.stories.d.ts +19 -0
- package/dist/src/core/Alert/index.stories.js +70 -0
- package/dist/src/core/Alert/style.d.ts +1 -0
- package/dist/src/core/Alert/style.js +23 -0
- package/dist/src/core/Banner/Banner.namespace-test.d.ts +1 -0
- package/dist/src/core/Banner/Banner.namespace-test.js +18 -0
- package/dist/src/core/Banner/banner.test.d.ts +1 -0
- package/dist/src/core/Banner/banner.test.js +126 -0
- package/dist/src/core/Banner/index.d.ts +11 -0
- package/dist/src/core/Banner/index.js +47 -0
- package/dist/src/core/Banner/index.stories.d.ts +46 -0
- package/dist/src/core/Banner/index.stories.js +106 -0
- package/dist/src/core/Banner/style.d.ts +13 -0
- package/dist/src/core/Banner/style.js +55 -0
- package/dist/src/core/Button/Button.namespace-test.d.ts +1 -0
- package/dist/src/core/Button/Button.namespace-test.js +18 -0
- package/dist/src/core/Button/index.d.ts +18 -0
- package/dist/src/core/Button/index.js +54 -0
- package/dist/src/core/Button/index.stories.d.ts +72 -0
- package/dist/src/core/Button/index.stories.js +215 -0
- package/dist/src/core/Button/index.test.d.ts +1 -0
- package/dist/src/core/Button/index.test.js +40 -0
- package/dist/src/core/Button/style.d.ts +180 -0
- package/dist/src/core/Button/style.js +59 -0
- package/dist/src/core/ButtonDropdown/ButtonDropdown.namespace-test.d.ts +1 -0
- package/dist/src/core/ButtonDropdown/ButtonDropdown.namespace-test.js +18 -0
- package/dist/src/core/ButtonDropdown/index.d.ts +18 -0
- package/dist/src/core/ButtonDropdown/index.js +30 -0
- package/dist/src/core/ButtonDropdown/index.stories.d.ts +35 -0
- package/dist/src/core/ButtonDropdown/index.stories.js +79 -0
- package/dist/src/core/ButtonDropdown/index.test.d.ts +1 -0
- package/dist/src/core/ButtonDropdown/index.test.js +41 -0
- package/dist/src/core/ButtonIcon/ButtonIcon.namespace-test.d.ts +1 -0
- package/dist/src/core/ButtonIcon/ButtonIcon.namespace-test.js +18 -0
- package/dist/src/core/ButtonIcon/index.d.ts +15 -0
- package/dist/src/core/ButtonIcon/index.js +34 -0
- package/dist/src/core/ButtonIcon/index.stories.d.ts +39 -0
- package/dist/src/core/ButtonIcon/index.stories.js +239 -0
- package/dist/src/core/ButtonIcon/index.test.d.ts +1 -0
- package/dist/src/core/ButtonIcon/index.test.js +41 -0
- package/dist/src/core/ButtonIcon/style.d.ts +41 -0
- package/dist/src/core/ButtonIcon/style.js +68 -0
- package/dist/src/core/Callout/Callout.namespace-test.d.ts +1 -0
- package/dist/src/core/Callout/Callout.namespace-test.js +18 -0
- package/dist/src/core/Callout/components/CalloutTitle/index.d.ts +3 -0
- package/dist/src/core/Callout/components/CalloutTitle/index.js +9 -0
- package/dist/src/core/Callout/components/CalloutTitle/style.d.ts +1 -0
- package/dist/src/core/Callout/components/CalloutTitle/style.js +16 -0
- package/dist/src/core/Callout/index.d.ts +18 -0
- package/dist/src/core/Callout/index.js +89 -0
- package/dist/src/core/Callout/index.stories.d.ts +14 -0
- package/dist/src/core/Callout/index.stories.js +80 -0
- package/dist/src/core/Callout/style.d.ts +7 -0
- package/dist/src/core/Callout/style.js +31 -0
- package/dist/src/core/CellBasic/CellBasic.namespace-test.d.ts +1 -0
- package/dist/src/core/CellBasic/CellBasic.namespace-test.js +7 -0
- package/dist/src/core/CellBasic/index.d.ts +21 -0
- package/dist/src/core/CellBasic/index.js +32 -0
- package/dist/src/core/CellBasic/index.stories.d.ts +33 -0
- package/dist/src/core/CellBasic/index.stories.js +143 -0
- package/dist/src/core/CellBasic/index.test.d.ts +1 -0
- package/dist/src/core/CellBasic/index.test.js +124 -0
- package/dist/src/core/CellBasic/style.d.ts +18 -0
- package/dist/src/core/CellBasic/style.js +86 -0
- package/dist/src/core/CellComponent/CellComponent.namespace-test.d.ts +1 -0
- package/dist/src/core/CellComponent/CellComponent.namespace-test.js +7 -0
- package/dist/src/core/CellComponent/index.d.ts +8 -0
- package/dist/src/core/CellComponent/index.js +21 -0
- package/dist/src/core/CellComponent/index.stories.d.ts +21 -0
- package/dist/src/core/CellComponent/index.stories.js +92 -0
- package/dist/src/core/CellComponent/index.test.d.ts +1 -0
- package/dist/src/core/CellComponent/index.test.js +110 -0
- package/dist/src/core/CellComponent/style.d.ts +9 -0
- package/dist/src/core/CellComponent/style.js +32 -0
- package/dist/src/core/CellHeader/CellHeader.namespace-test.d.ts +1 -0
- package/dist/src/core/CellHeader/CellHeader.namespace-test.js +8 -0
- package/dist/src/core/CellHeader/index.d.ts +20 -0
- package/dist/src/core/CellHeader/index.js +47 -0
- package/dist/src/core/CellHeader/index.stories.d.ts +26 -0
- package/dist/src/core/CellHeader/index.stories.js +128 -0
- package/dist/src/core/CellHeader/index.test.d.ts +1 -0
- package/dist/src/core/CellHeader/index.test.js +112 -0
- package/dist/src/core/CellHeader/style.d.ts +9 -0
- package/dist/src/core/CellHeader/style.js +50 -0
- package/dist/src/core/Chip/index.d.ts +9 -0
- package/dist/src/core/Chip/index.js +29 -0
- package/dist/src/core/Chip/index.stories.d.ts +58 -0
- package/dist/src/core/Chip/index.stories.js +90 -0
- package/dist/src/core/Chip/style.d.ts +26 -0
- package/dist/src/core/Chip/style.js +95 -0
- package/dist/src/core/ComplexFilter/ComplexFilter.namespace-test.d.ts +1 -0
- package/dist/src/core/ComplexFilter/ComplexFilter.namespace-test.js +20 -0
- package/dist/src/core/ComplexFilter/components/Chips/index.d.ts +8 -0
- package/dist/src/core/ComplexFilter/components/Chips/index.js +21 -0
- package/dist/src/core/ComplexFilter/index.d.ts +23 -0
- package/dist/src/core/ComplexFilter/index.js +119 -0
- package/dist/src/core/ComplexFilter/index.stories.d.ts +33 -0
- package/dist/src/core/ComplexFilter/index.stories.js +126 -0
- package/dist/src/core/ComplexFilter/index.test.d.ts +1 -0
- package/dist/src/core/ComplexFilter/index.test.js +51 -0
- package/dist/src/core/ComplexFilter/style.d.ts +3 -0
- package/dist/src/core/ComplexFilter/style.js +15 -0
- package/dist/src/core/Dialog/Dialog.namespace-test.d.ts +1 -0
- package/dist/src/core/Dialog/Dialog.namespace-test.js +8 -0
- package/dist/src/core/Dialog/__snapshots__/index.test.js.snap +382 -0
- package/dist/src/core/Dialog/components/common.d.ts +6 -0
- package/dist/src/core/Dialog/components/common.js +5 -0
- package/dist/src/core/Dialog/index.d.ts +18 -0
- package/dist/src/core/Dialog/index.js +50 -0
- package/dist/src/core/Dialog/index.stories.d.ts +46 -0
- package/dist/src/core/Dialog/index.stories.js +147 -0
- package/dist/src/core/Dialog/index.test.d.ts +1 -0
- package/dist/src/core/Dialog/index.test.js +62 -0
- package/dist/src/core/DialogActions/index.d.ts +9 -0
- package/dist/src/core/DialogActions/index.js +23 -0
- package/dist/src/core/DialogActions/style.d.ts +5 -0
- package/dist/src/core/DialogActions/style.js +20 -0
- package/dist/src/core/DialogContent/index.d.ts +5 -0
- package/dist/src/core/DialogContent/index.js +23 -0
- package/dist/src/core/DialogContent/style.d.ts +1 -0
- package/dist/src/core/DialogContent/style.js +11 -0
- package/dist/src/core/DialogPaper/index.d.ts +8 -0
- package/dist/src/core/DialogPaper/index.js +27 -0
- package/dist/src/core/DialogPaper/style.d.ts +16 -0
- package/dist/src/core/DialogPaper/style.js +44 -0
- package/dist/src/core/DialogTitle/components/CloseButton/index.d.ts +5 -0
- package/dist/src/core/DialogTitle/components/CloseButton/index.js +31 -0
- package/dist/src/core/DialogTitle/components/CloseButton/style.d.ts +2 -0
- package/dist/src/core/DialogTitle/components/CloseButton/style.js +18 -0
- package/dist/src/core/DialogTitle/index.d.ts +14 -0
- package/dist/src/core/DialogTitle/index.js +42 -0
- package/dist/src/core/DialogTitle/style.d.ts +46 -0
- package/dist/src/core/DialogTitle/style.js +20 -0
- package/dist/src/core/Dropdown/Dropdown.namespace-test.d.ts +1 -0
- package/dist/src/core/Dropdown/Dropdown.namespace-test.js +20 -0
- package/dist/src/core/Dropdown/index.d.ts +31 -0
- package/dist/src/core/Dropdown/index.js +160 -0
- package/dist/src/core/Dropdown/index.stories.d.ts +68 -0
- package/dist/src/core/Dropdown/index.stories.js +215 -0
- package/dist/src/core/Dropdown/index.test.d.ts +1 -0
- package/dist/src/core/Dropdown/index.test.js +229 -0
- package/dist/src/core/Dropdown/style.d.ts +5 -0
- package/dist/src/core/Dropdown/style.js +19 -0
- package/dist/src/core/DropdownMenu/DropdownMenu.namespace-test.d.ts +1 -0
- package/dist/src/core/DropdownMenu/DropdownMenu.namespace-test.js +20 -0
- package/dist/src/core/DropdownMenu/GITHUB_LABELS.d.ts +2 -0
- package/dist/src/core/DropdownMenu/GITHUB_LABELS.js +83 -0
- package/dist/src/core/DropdownMenu/index.d.ts +42 -0
- package/dist/src/core/DropdownMenu/index.js +83 -0
- package/dist/src/core/DropdownMenu/index.stories.d.ts +55 -0
- package/dist/src/core/DropdownMenu/index.stories.js +438 -0
- package/dist/src/core/DropdownMenu/index.test.d.ts +1 -0
- package/dist/src/core/DropdownMenu/index.test.js +51 -0
- package/dist/src/core/DropdownMenu/style.d.ts +40 -0
- package/dist/src/core/DropdownMenu/style.js +85 -0
- package/dist/src/core/Icon/Icon.namespace-test.d.ts +1 -0
- package/dist/src/core/Icon/Icon.namespace-test.js +7 -0
- package/dist/src/core/Icon/index.d.ts +14 -0
- package/dist/src/core/Icon/index.js +25 -0
- package/dist/src/core/Icon/index.stories.d.ts +34 -0
- package/dist/src/core/Icon/index.stories.js +171 -0
- package/dist/src/core/Icon/map.d.ts +98 -0
- package/dist/src/core/Icon/map.js +476 -0
- package/dist/src/core/Icon/style.d.ts +36 -0
- package/dist/src/core/Icon/style.js +42 -0
- package/dist/src/core/InputCheckbox/InputCheckbox.namespace-test.d.ts +1 -0
- package/dist/src/core/InputCheckbox/InputCheckbox.namespace-test.js +9 -0
- package/dist/src/core/InputCheckbox/index.d.ts +13 -0
- package/dist/src/core/InputCheckbox/index.js +55 -0
- package/dist/src/core/InputCheckbox/index.stories.d.ts +35 -0
- package/dist/src/core/InputCheckbox/index.stories.js +119 -0
- package/dist/src/core/InputCheckbox/index.test.d.ts +1 -0
- package/dist/src/core/InputCheckbox/index.test.js +62 -0
- package/dist/src/core/InputCheckbox/styles.d.ts +6 -0
- package/dist/src/core/InputCheckbox/styles.js +24 -0
- package/dist/src/core/InputDropdown/InputDropdown.namespace-test.d.ts +1 -0
- package/dist/src/core/InputDropdown/InputDropdown.namespace-test.js +8 -0
- package/dist/src/core/InputDropdown/index.d.ts +8 -0
- package/dist/src/core/InputDropdown/index.js +83 -0
- package/dist/src/core/InputDropdown/index.stories.d.ts +59 -0
- package/dist/src/core/InputDropdown/index.stories.js +264 -0
- package/dist/src/core/InputDropdown/index.test.d.ts +1 -0
- package/dist/src/core/InputDropdown/index.test.js +58 -0
- package/dist/src/core/InputDropdown/style.d.ts +38 -0
- package/dist/src/core/InputDropdown/style.js +130 -0
- package/dist/src/core/InputRadio/InputRadio.namespace-test.d.ts +1 -0
- package/dist/src/core/InputRadio/InputRadio.namespace-test.js +8 -0
- package/dist/src/core/InputRadio/index.d.ts +14 -0
- package/dist/src/core/InputRadio/index.js +40 -0
- package/dist/src/core/InputRadio/index.stories.d.ts +32 -0
- package/dist/src/core/InputRadio/index.stories.js +64 -0
- package/dist/src/core/InputRadio/index.test.d.ts +1 -0
- package/dist/src/core/InputRadio/index.test.js +92 -0
- package/dist/src/core/InputRadio/style.d.ts +6 -0
- package/dist/src/core/InputRadio/style.js +24 -0
- package/dist/src/core/InputSearch/InputSearch.namespace-test.d.ts +1 -0
- package/dist/src/core/InputSearch/InputSearch.namespace-test.js +8 -0
- package/dist/src/core/InputSearch/index.d.ts +16 -0
- package/dist/src/core/InputSearch/index.js +75 -0
- package/dist/src/core/InputSearch/index.stories.d.ts +35 -0
- package/dist/src/core/InputSearch/index.stories.js +104 -0
- package/dist/src/core/InputSearch/index.test.d.ts +1 -0
- package/dist/src/core/InputSearch/index.test.js +70 -0
- package/dist/src/core/InputSearch/style.d.ts +12 -0
- package/dist/src/core/InputSearch/style.js +47 -0
- package/dist/src/core/InputSlider/InputSlider.namespace-test.d.ts +1 -0
- package/dist/src/core/InputSlider/InputSlider.namespace-test.js +7 -0
- package/dist/src/core/InputSlider/__snapshots__/index.test.js.snap +124 -0
- package/dist/src/core/InputSlider/index.d.ts +8 -0
- package/dist/src/core/InputSlider/index.js +23 -0
- package/dist/src/core/InputSlider/index.stories.d.ts +43 -0
- package/dist/src/core/InputSlider/index.stories.js +160 -0
- package/dist/src/core/InputSlider/index.test.d.ts +1 -0
- package/dist/src/core/InputSlider/index.test.js +52 -0
- package/dist/src/core/InputSlider/style.d.ts +76 -0
- package/dist/src/core/InputSlider/style.js +34 -0
- package/dist/src/core/InputText/InputText.namespace-test.d.ts +1 -0
- package/dist/src/core/InputText/InputText.namespace-test.js +7 -0
- package/dist/src/core/InputText/__snapshots__/index.test.js.snap +10 -0
- package/dist/src/core/InputText/index.d.ts +14 -0
- package/dist/src/core/InputText/index.js +52 -0
- package/dist/src/core/InputText/index.stories.d.ts +29 -0
- package/dist/src/core/InputText/index.stories.js +100 -0
- package/dist/src/core/InputText/index.test.d.ts +1 -0
- package/dist/src/core/InputText/index.test.js +67 -0
- package/dist/src/core/InputText/style.d.ts +13 -0
- package/dist/src/core/InputText/style.js +45 -0
- package/dist/src/core/InputToggle/InputToggle.namespace-test.d.ts +1 -0
- package/dist/src/core/InputToggle/InputToggle.namespace-test.js +7 -0
- package/dist/src/core/InputToggle/__snapshots__/index.test.js.snap +26 -0
- package/dist/src/core/InputToggle/index.d.ts +7 -0
- package/dist/src/core/InputToggle/index.js +42 -0
- package/dist/src/core/InputToggle/index.stories.d.ts +20 -0
- package/dist/src/core/InputToggle/index.stories.js +63 -0
- package/dist/src/core/InputToggle/index.test.d.ts +1 -0
- package/dist/src/core/InputToggle/index.test.js +52 -0
- package/dist/src/core/InputToggle/style.d.ts +9 -0
- package/dist/src/core/InputToggle/style.js +38 -0
- package/dist/src/core/Link/Link.namespace-test.d.ts +1 -0
- package/dist/src/core/Link/Link.namespace-test.js +7 -0
- package/dist/src/core/Link/index.d.ts +8 -0
- package/dist/src/core/Link/index.js +28 -0
- package/dist/src/core/Link/index.stories.d.ts +27 -0
- package/dist/src/core/Link/index.stories.js +99 -0
- package/dist/src/core/Link/style.d.ts +9 -0
- package/dist/src/core/Link/style.js +30 -0
- package/dist/src/core/List/List.namespace-test.d.ts +1 -0
- package/dist/src/core/List/List.namespace-test.js +7 -0
- package/dist/src/core/List/index.d.ts +8 -0
- package/dist/src/core/List/index.js +23 -0
- package/dist/src/core/List/index.stories.d.ts +4 -0
- package/dist/src/core/List/index.stories.js +30 -0
- package/dist/src/core/List/style.d.ts +17 -0
- package/dist/src/core/List/style.js +33 -0
- package/dist/src/core/ListItem/ListItem.namespace-test.d.ts +1 -0
- package/dist/src/core/ListItem/ListItem.namespace-test.js +7 -0
- package/dist/src/core/ListItem/index.d.ts +9 -0
- package/dist/src/core/ListItem/index.js +24 -0
- package/dist/src/core/ListItem/style.d.ts +26 -0
- package/dist/src/core/ListItem/style.js +56 -0
- package/dist/src/core/ListSubheader/ListSubheader.namespace-test.d.ts +1 -0
- package/dist/src/core/ListSubheader/ListSubheader.namespace-test.js +7 -0
- package/dist/src/core/ListSubheader/index.d.ts +7 -0
- package/dist/src/core/ListSubheader/index.js +22 -0
- package/dist/src/core/ListSubheader/style.d.ts +12 -0
- package/dist/src/core/ListSubheader/style.js +16 -0
- package/dist/src/core/LoadingIndicator/LoadingIndicator.namespace-test.d.ts +1 -0
- package/dist/src/core/LoadingIndicator/LoadingIndicator.namespace-test.js +7 -0
- package/dist/src/core/LoadingIndicator/index.d.ts +4 -0
- package/dist/src/core/LoadingIndicator/index.js +13 -0
- package/dist/src/core/LoadingIndicator/index.stories.d.ts +24 -0
- package/dist/src/core/LoadingIndicator/index.stories.js +77 -0
- package/dist/src/core/LoadingIndicator/index.test.d.ts +1 -0
- package/dist/src/core/LoadingIndicator/index.test.js +41 -0
- package/dist/src/core/LoadingIndicator/style.d.ts +7 -0
- package/dist/src/core/LoadingIndicator/style.js +36 -0
- package/dist/src/core/Menu/Menu.namespace-test.d.ts +1 -0
- package/dist/src/core/Menu/Menu.namespace-test.js +8 -0
- package/dist/src/core/Menu/index.d.ts +7 -0
- package/dist/src/core/Menu/index.js +30 -0
- package/dist/src/core/Menu/index.stories.d.ts +17 -0
- package/dist/src/core/Menu/index.stories.js +55 -0
- package/dist/src/core/Menu/style.d.ts +1 -0
- package/dist/src/core/Menu/style.js +15 -0
- package/dist/src/core/MenuItem/MenuItem.namespace-test.d.ts +1 -0
- package/dist/src/core/MenuItem/MenuItem.namespace-test.js +8 -0
- package/dist/src/core/MenuItem/index.d.ts +21 -0
- package/dist/src/core/MenuItem/index.js +42 -0
- package/dist/src/core/MenuItem/index.stories.d.ts +35 -0
- package/dist/src/core/MenuItem/index.stories.js +188 -0
- package/dist/src/core/MenuItem/index.test.d.ts +1 -0
- package/dist/src/core/MenuItem/index.test.js +41 -0
- package/dist/src/core/MenuItem/style.d.ts +65 -0
- package/dist/src/core/MenuItem/style.js +58 -0
- package/dist/src/core/MenuSelect/index.d.ts +19 -0
- package/dist/src/core/MenuSelect/index.js +70 -0
- package/dist/src/core/MenuSelect/index.stories.d.ts +34 -0
- package/dist/src/core/MenuSelect/index.stories.js +154 -0
- package/dist/src/core/MenuSelect/style.d.ts +12 -0
- package/dist/src/core/MenuSelect/style.js +45 -0
- package/dist/src/core/NavigationJumpTo/NavigationJumpTo.namespace-test.d.ts +1 -0
- package/dist/src/core/NavigationJumpTo/NavigationJumpTo.namespace-test.js +13 -0
- package/dist/src/core/NavigationJumpTo/__snapshots__/index.test.js.snap +319 -0
- package/dist/src/core/NavigationJumpTo/index.d.ts +13 -0
- package/dist/src/core/NavigationJumpTo/index.js +122 -0
- package/dist/src/core/NavigationJumpTo/index.stories.d.ts +56 -0
- package/dist/src/core/NavigationJumpTo/index.stories.js +218 -0
- package/dist/src/core/NavigationJumpTo/index.test.d.ts +1 -0
- package/dist/src/core/NavigationJumpTo/index.test.js +87 -0
- package/dist/src/core/NavigationJumpTo/style.d.ts +106 -0
- package/dist/src/core/NavigationJumpTo/style.js +27 -0
- package/dist/src/core/NavigationJumpTo/useIntersection.d.ts +19 -0
- package/dist/src/core/NavigationJumpTo/useIntersection.js +67 -0
- package/dist/src/core/Notification/Notification.namespace-test.d.ts +1 -0
- package/dist/src/core/Notification/Notification.namespace-test.js +8 -0
- package/dist/src/core/Notification/index.d.ts +17 -0
- package/dist/src/core/Notification/index.js +70 -0
- package/dist/src/core/Notification/index.stories.d.ts +43 -0
- package/dist/src/core/Notification/index.stories.js +186 -0
- package/dist/src/core/Notification/index.test.d.ts +1 -0
- package/dist/src/core/Notification/index.test.js +115 -0
- package/dist/src/core/Notification/style.d.ts +1 -0
- package/dist/src/core/Notification/style.js +26 -0
- package/dist/src/core/Pagination/Pagination.namespace-test.d.ts +1 -0
- package/dist/src/core/Pagination/Pagination.namespace-test.js +8 -0
- package/dist/src/core/Pagination/components/PageListDropdown/index.d.ts +7 -0
- package/dist/src/core/Pagination/components/PageListDropdown/index.js +27 -0
- package/dist/src/core/Pagination/components/PageListDropdown/style.d.ts +1 -0
- package/dist/src/core/Pagination/components/PageListDropdown/style.js +14 -0
- package/dist/src/core/Pagination/index.d.ts +15 -0
- package/dist/src/core/Pagination/index.js +47 -0
- package/dist/src/core/Pagination/index.stories.d.ts +21 -0
- package/dist/src/core/Pagination/index.stories.js +99 -0
- package/dist/src/core/Pagination/index.test.d.ts +1 -0
- package/dist/src/core/Pagination/index.test.js +128 -0
- package/dist/src/core/Pagination/style.d.ts +13 -0
- package/dist/src/core/Pagination/style.js +62 -0
- package/dist/src/core/Pagination/usePagination.d.ts +9 -0
- package/dist/src/core/Pagination/usePagination.js +69 -0
- package/dist/src/core/SegmentedControl/SegmentedControl.namespace-test.d.ts +1 -0
- package/dist/src/core/SegmentedControl/SegmentedControl.namespace-test.js +12 -0
- package/dist/src/core/SegmentedControl/index.d.ts +15 -0
- package/dist/src/core/SegmentedControl/index.js +38 -0
- package/dist/src/core/SegmentedControl/index.stories.d.ts +49 -0
- package/dist/src/core/SegmentedControl/index.stories.js +128 -0
- package/dist/src/core/SegmentedControl/index.test.d.ts +1 -0
- package/dist/src/core/SegmentedControl/index.test.js +41 -0
- package/dist/src/core/SegmentedControl/style.d.ts +2 -0
- package/dist/src/core/SegmentedControl/style.js +23 -0
- package/dist/src/core/Table/Table.namespace-test.d.ts +1 -0
- package/dist/src/core/Table/Table.namespace-test.js +7 -0
- package/dist/src/core/Table/components/common.d.ts +6 -0
- package/dist/src/core/Table/components/common.js +5 -0
- package/dist/src/core/Table/index.d.ts +7 -0
- package/dist/src/core/Table/index.js +21 -0
- package/dist/src/core/Table/index.stories.d.ts +18 -0
- package/dist/src/core/Table/index.stories.js +64 -0
- package/dist/src/core/Table/index.test.d.ts +1 -0
- package/dist/src/core/Table/index.test.js +89 -0
- package/dist/src/core/Table/style.d.ts +2 -0
- package/dist/src/core/Table/style.js +10 -0
- package/dist/src/core/TableHeader/TableHeader.namespace-test.d.ts +1 -0
- package/dist/src/core/TableHeader/TableHeader.namespace-test.js +7 -0
- package/dist/src/core/TableHeader/index.d.ts +6 -0
- package/dist/src/core/TableHeader/index.js +25 -0
- package/dist/src/core/TableHeader/index.stories.d.ts +12 -0
- package/dist/src/core/TableHeader/index.stories.js +38 -0
- package/dist/src/core/TableHeader/index.test.d.ts +1 -0
- package/dist/src/core/TableHeader/index.test.js +41 -0
- package/dist/src/core/TableHeader/style.d.ts +2 -0
- package/dist/src/core/TableHeader/style.js +14 -0
- package/dist/src/core/TableRow/TableRow.namespace-test.d.ts +1 -0
- package/dist/src/core/TableRow/TableRow.namespace-test.js +7 -0
- package/dist/src/core/TableRow/__snapshots__/index.test.js.snap +100 -0
- package/dist/src/core/TableRow/index.d.ts +13 -0
- package/dist/src/core/TableRow/index.js +28 -0
- package/dist/src/core/TableRow/index.stories.d.ts +24 -0
- package/dist/src/core/TableRow/index.stories.js +77 -0
- package/dist/src/core/TableRow/index.test.d.ts +1 -0
- package/dist/src/core/TableRow/index.test.js +92 -0
- package/dist/src/core/TableRow/style.d.ts +10 -0
- package/dist/src/core/TableRow/style.js +34 -0
- package/dist/src/core/Tabs/Tabs.namespace-test.d.ts +1 -0
- package/dist/src/core/Tabs/Tabs.namespace-test.js +8 -0
- package/dist/src/core/Tabs/__snapshots__/index.test.js.snap +46 -0
- package/dist/src/core/Tabs/components/LabelWithCount/index.d.ts +7 -0
- package/dist/src/core/Tabs/components/LabelWithCount/index.js +11 -0
- package/dist/src/core/Tabs/components/LabelWithCount/style.d.ts +10 -0
- package/dist/src/core/Tabs/components/LabelWithCount/style.js +43 -0
- package/dist/src/core/Tabs/components/common.d.ts +5 -0
- package/dist/src/core/Tabs/components/common.js +5 -0
- package/dist/src/core/Tabs/index.d.ts +13 -0
- package/dist/src/core/Tabs/index.js +89 -0
- package/dist/src/core/Tabs/index.stories.d.ts +38 -0
- package/dist/src/core/Tabs/index.stories.js +154 -0
- package/dist/src/core/Tabs/index.test.d.ts +1 -0
- package/dist/src/core/Tabs/index.test.js +48 -0
- package/dist/src/core/Tabs/style.d.ts +115 -0
- package/dist/src/core/Tabs/style.js +53 -0
- package/dist/src/core/Tag/Tag.namespace-test.d.ts +1 -0
- package/dist/src/core/Tag/Tag.namespace-test.js +7 -0
- package/dist/src/core/Tag/index.d.ts +17 -0
- package/dist/src/core/Tag/index.js +27 -0
- package/dist/src/core/Tag/index.stories.d.ts +98 -0
- package/dist/src/core/Tag/index.stories.js +238 -0
- package/dist/src/core/Tag/index.test.d.ts +1 -0
- package/dist/src/core/Tag/index.test.js +40 -0
- package/dist/src/core/Tag/index.testUtils.d.ts +8 -0
- package/dist/src/core/Tag/index.testUtils.js +108 -0
- package/dist/src/core/Tag/style.d.ts +29 -0
- package/dist/src/core/Tag/style.js +100 -0
- package/dist/src/core/TagFilter/TagFilter.namespace-test.d.ts +1 -0
- package/dist/src/core/TagFilter/TagFilter.namespace-test.js +8 -0
- package/dist/src/core/TagFilter/__snapshots__/index.test.js.snap +46 -0
- package/dist/src/core/TagFilter/index.d.ts +12 -0
- package/dist/src/core/TagFilter/index.js +23 -0
- package/dist/src/core/TagFilter/index.stories.d.ts +44 -0
- package/dist/src/core/TagFilter/index.stories.js +121 -0
- package/dist/src/core/TagFilter/index.test.d.ts +1 -0
- package/dist/src/core/TagFilter/index.test.js +40 -0
- package/dist/src/core/TagFilter/style.d.ts +7 -0
- package/dist/src/core/TagFilter/style.js +19 -0
- package/dist/src/core/Tooltip/Tooltip.namespace-test.d.ts +1 -0
- package/dist/src/core/Tooltip/Tooltip.namespace-test.js +7 -0
- package/dist/src/core/Tooltip/index.d.ts +14 -0
- package/dist/src/core/Tooltip/index.js +87 -0
- package/dist/src/core/Tooltip/index.stories.d.ts +48 -0
- package/dist/src/core/Tooltip/index.stories.js +257 -0
- package/dist/src/core/Tooltip/index.test.d.ts +1 -0
- package/dist/src/core/Tooltip/index.test.js +102 -0
- package/dist/src/core/Tooltip/style.d.ts +23 -0
- package/dist/src/core/Tooltip/style.js +47 -0
- package/dist/src/core/TooltipCondensed/TooltipCondensed.namespace-test.d.ts +1 -0
- package/dist/src/core/TooltipCondensed/TooltipCondensed.namespace-test.js +7 -0
- package/dist/src/core/TooltipCondensed/index.d.ts +13 -0
- package/dist/src/core/TooltipCondensed/index.js +43 -0
- package/dist/src/core/TooltipCondensed/index.stories.d.ts +27 -0
- package/dist/src/core/TooltipCondensed/index.stories.js +72 -0
- package/dist/src/core/TooltipCondensed/index.test.d.ts +1 -0
- package/dist/src/core/TooltipCondensed/index.test.js +85 -0
- package/dist/src/core/TooltipCondensed/style.d.ts +6 -0
- package/dist/src/core/TooltipCondensed/style.js +22 -0
- package/dist/src/core/TooltipTable/TooltipTable.namespace-test.d.ts +1 -0
- package/dist/src/core/TooltipTable/TooltipTable.namespace-test.js +23 -0
- package/dist/src/core/TooltipTable/__snapshots__/index.test.js.snap +272 -0
- package/dist/src/core/TooltipTable/index.d.ts +8 -0
- package/dist/src/core/TooltipTable/index.js +35 -0
- package/dist/src/core/TooltipTable/index.stories.d.ts +32 -0
- package/dist/src/core/TooltipTable/index.stories.js +128 -0
- package/dist/src/core/TooltipTable/index.test.d.ts +1 -0
- package/dist/src/core/TooltipTable/index.test.js +109 -0
- package/dist/src/core/TooltipTable/style.d.ts +25 -0
- package/dist/src/core/TooltipTable/style.js +46 -0
- package/dist/src/core/styles/common/constants/black.d.ts +3 -0
- package/dist/src/core/styles/common/constants/black.js +7 -0
- package/dist/src/core/styles/common/constants/boxShadows.d.ts +5 -0
- package/dist/src/core/styles/common/constants/boxShadows.js +9 -0
- package/dist/src/core/styles/common/constants/fontWeights.d.ts +7 -0
- package/dist/src/core/styles/common/constants/fontWeights.js +11 -0
- package/dist/src/core/styles/common/constants/gray.d.ts +8 -0
- package/dist/src/core/styles/common/constants/gray.js +12 -0
- package/dist/src/core/styles/common/constants/spaces.d.ts +11 -0
- package/dist/src/core/styles/common/constants/spaces.js +15 -0
- package/dist/src/core/styles/common/constants/white.d.ts +3 -0
- package/dist/src/core/styles/common/constants/white.js +7 -0
- package/dist/src/core/styles/common/defaultTheme.d.ts +129 -0
- package/dist/src/core/styles/common/defaultTheme.js +414 -0
- package/dist/src/core/styles/common/mixins/fonts.d.ts +27 -0
- package/dist/src/core/styles/common/mixins/fonts.js +60 -0
- package/dist/src/core/styles/common/selectors/theme.d.ts +15 -0
- package/dist/src/core/styles/common/selectors/theme.js +63 -0
- package/dist/src/core/styles/index.d.ts +3 -0
- package/dist/src/core/styles/index.js +19 -0
- package/dist/src/index.d.ts +100 -0
- package/dist/src/index.js +170 -0
- package/dist/tsconfig-namespace-check.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AutocompleteValue } from "@mui/material/useAutocomplete";
|
|
2
|
+
import React, { ReactNode } from "react";
|
|
3
|
+
import { DefaultDropdownMenuOption, DropdownMenuProps as SdsDropdownMenuProps } from "../DropdownMenu";
|
|
4
|
+
import { StyledPaper, StyledPopper } from "../DropdownMenu/style";
|
|
5
|
+
import InputDropdown, { InputDropdownProps as InputDropdownPropsType } from "../InputDropdown";
|
|
6
|
+
export { InputDropdown as DropdownInputDropdown, StyledPaper as DropdownPaper, StyledPopper as DropdownPopper, };
|
|
7
|
+
export type Value<T, Multiple> = Multiple extends undefined | false ? T | null : Array<T> | null;
|
|
8
|
+
export type MUIValue<Multiple> = AutocompleteValue<DefaultDropdownMenuOption, Multiple, undefined, undefined>;
|
|
9
|
+
type RenderFunctionType = (props: any) => JSX.Element;
|
|
10
|
+
export interface DropdownProps<Multiple extends boolean | undefined> {
|
|
11
|
+
buttonPosition?: "left" | "right";
|
|
12
|
+
buttons?: boolean;
|
|
13
|
+
closeOnBlur?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
label: ReactNode;
|
|
16
|
+
options: DefaultDropdownMenuOption[];
|
|
17
|
+
onChange: (options: Value<DefaultDropdownMenuOption, Multiple>) => void;
|
|
18
|
+
onClose?: () => void;
|
|
19
|
+
multiple?: Multiple;
|
|
20
|
+
search?: boolean;
|
|
21
|
+
DropdownMenuProps?: Partial<SdsDropdownMenuProps<DefaultDropdownMenuOption, Multiple, undefined, undefined>>;
|
|
22
|
+
InputDropdownProps?: Partial<InputDropdownPropsType>;
|
|
23
|
+
value?: Value<DefaultDropdownMenuOption, Multiple>;
|
|
24
|
+
style?: React.CSSProperties;
|
|
25
|
+
className?: string;
|
|
26
|
+
PopperComponent?: typeof StyledPopper | RenderFunctionType;
|
|
27
|
+
InputDropdownComponent?: typeof InputDropdown;
|
|
28
|
+
isTriggerChangeOnOptionClick?: boolean;
|
|
29
|
+
}
|
|
30
|
+
declare const Dropdown: <Multiple extends boolean | undefined = false>({ options, label, multiple, search, buttonPosition, buttons, closeOnBlur, onChange, onClose, DropdownMenuProps, InputDropdownProps, value: propValue, PopperComponent, InputDropdownComponent, isTriggerChangeOnOptionClick, disabled, ...rest }: DropdownProps<Multiple>) => JSX.Element;
|
|
31
|
+
export default Dropdown;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.DropdownPopper = exports.DropdownPaper = exports.DropdownInputDropdown = void 0;
|
|
29
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
30
|
+
var react_1 = require("react");
|
|
31
|
+
var DropdownMenu_1 = __importDefault(require("../DropdownMenu"));
|
|
32
|
+
var style_1 = require("../DropdownMenu/style");
|
|
33
|
+
Object.defineProperty(exports, "DropdownPaper", { enumerable: true, get: function () { return style_1.StyledPaper; } });
|
|
34
|
+
Object.defineProperty(exports, "DropdownPopper", { enumerable: true, get: function () { return style_1.StyledPopper; } });
|
|
35
|
+
var InputDropdown_1 = __importDefault(require("../InputDropdown"));
|
|
36
|
+
exports.DropdownInputDropdown = InputDropdown_1.default;
|
|
37
|
+
var style_2 = require("./style");
|
|
38
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
39
|
+
var Dropdown = function (_a) {
|
|
40
|
+
var options = _a.options, _b = _a.label, label = _b === void 0 ? "" : _b, _c = _a.multiple, multiple = _c === void 0 ? false : _c, _d = _a.search, search = _d === void 0 ? false : _d, _e = _a.buttonPosition, buttonPosition = _e === void 0 ? "right" : _e, _f = _a.buttons, buttons = _f === void 0 ? false : _f,
|
|
41
|
+
// By default, most dropdowns will close when the user clicks outside the dropdown.
|
|
42
|
+
// The exception is the multiple select variant with Apply/Cancel buttons,
|
|
43
|
+
// which by default will not close on blur. If closeOnBlur is enabled, clicking out
|
|
44
|
+
// is equivalent to clicking the Cancel button, closing the dropdown and losing
|
|
45
|
+
// unapplied changes.
|
|
46
|
+
_g = _a.closeOnBlur,
|
|
47
|
+
// By default, most dropdowns will close when the user clicks outside the dropdown.
|
|
48
|
+
// The exception is the multiple select variant with Apply/Cancel buttons,
|
|
49
|
+
// which by default will not close on blur. If closeOnBlur is enabled, clicking out
|
|
50
|
+
// is equivalent to clicking the Cancel button, closing the dropdown and losing
|
|
51
|
+
// unapplied changes.
|
|
52
|
+
closeOnBlur = _g === void 0 ? !buttons : _g, onChange = _a.onChange, onClose = _a.onClose, _h = _a.DropdownMenuProps, DropdownMenuProps = _h === void 0 ? {} : _h, _j = _a.InputDropdownProps, InputDropdownProps = _j === void 0 ? { sdsStyle: "minimal" } : _j, propValue = _a.value, PopperComponent = _a.PopperComponent, _k = _a.InputDropdownComponent, InputDropdownComponent = _k === void 0 ? InputDropdown_1.default : _k, _l = _a.isTriggerChangeOnOptionClick, isTriggerChangeOnOptionClick = _l === void 0 ? false : _l, _m = _a.disabled, disabled = _m === void 0 ? false : _m, rest = __rest(_a, ["options", "label", "multiple", "search", "buttonPosition", "buttons", "closeOnBlur", "onChange", "onClose", "DropdownMenuProps", "InputDropdownProps", "value", "PopperComponent", "InputDropdownComponent", "isTriggerChangeOnOptionClick", "disabled"]);
|
|
53
|
+
if (buttons && !multiple) {
|
|
54
|
+
// eslint-disable-next-line no-console
|
|
55
|
+
console.warn("Warning: buttons are only supported for multiple select dropdowns.");
|
|
56
|
+
}
|
|
57
|
+
var isControlled = propValue !== undefined;
|
|
58
|
+
var _o = (0, react_1.useState)(null), anchorEl = _o[0], setAnchorEl = _o[1];
|
|
59
|
+
var _p = (0, react_1.useState)(getInitialValue), value = _p[0], setValue = _p[1];
|
|
60
|
+
var _q = (0, react_1.useState)([]), pendingValue = _q[0], setPendingValue = _q[1];
|
|
61
|
+
(0, react_1.useEffect)(function () {
|
|
62
|
+
onChange(value);
|
|
63
|
+
}, [value]);
|
|
64
|
+
(0, react_1.useEffect)(function () {
|
|
65
|
+
if (isControlled) {
|
|
66
|
+
setValue(propValue);
|
|
67
|
+
}
|
|
68
|
+
}, [propValue]);
|
|
69
|
+
var _r = (0, react_1.useState)(false), open = _r[0], setOpen = _r[1];
|
|
70
|
+
var shouldShowButtons = buttons && !isTriggerChangeOnOptionClick && multiple;
|
|
71
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(InputDropdownComponent, __assign({ disabled: disabled, label: label, onClick: handleClick, sdsStage: open ? "userInput" : "default" }, InputDropdownProps, rest)), (0, jsx_runtime_1.jsx)(DropdownMenu_1.default, __assign({ anchorEl: anchorEl, open: open, search: search, onClose: handleClose, multiple: multiple, value: (multiple ? pendingValue : value), onChange: handleChange, disableCloseOnSelect: multiple, PopperComponent: PopperComponent, PopperBaseProps: { sx: { minWidth: 250 } }, options: options, onClickAway: handleClickAway }, DropdownMenuProps, { children: shouldShowButtons ? ((0, jsx_runtime_1.jsx)("div", { children: buttonPosition === "left" ? ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(style_2.StyledButton, { onClick: handleClose, sdsStyle: "square", sdsType: "primary", children: "Apply" }), (0, jsx_runtime_1.jsx)(style_2.StyledButton, { onClick: handleCancel, sdsStyle: "square", sdsType: "secondary", children: "Cancel" })] })) : ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(style_2.StyledButton, { onClick: handleCancel, sdsStyle: "square", sdsType: "secondary", children: "Cancel" }), (0, jsx_runtime_1.jsx)(style_2.StyledButton, { onClick: handleClose, sdsStyle: "square", sdsType: "primary", children: "Apply" })] })) })) : null }))] }));
|
|
72
|
+
function handleClickAway() {
|
|
73
|
+
if (open) {
|
|
74
|
+
// (masoudmanson): We want to keep the dropdown menu open in two scenarios:
|
|
75
|
+
// 1. If the dropdown has buttons,
|
|
76
|
+
// 2. When there are no buttons, and the closeOnBlur property is set to false,
|
|
77
|
+
// In all other cases, we close the menu.
|
|
78
|
+
if (closeOnBlur && !shouldShowButtons) {
|
|
79
|
+
setOpen(false);
|
|
80
|
+
}
|
|
81
|
+
if (multiple) {
|
|
82
|
+
setValue(pendingValue);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function handleClick(event) {
|
|
87
|
+
if (open) {
|
|
88
|
+
if (multiple) {
|
|
89
|
+
setValue(pendingValue);
|
|
90
|
+
}
|
|
91
|
+
setOpen(false);
|
|
92
|
+
if (anchorEl) {
|
|
93
|
+
anchorEl.focus();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
if (multiple) {
|
|
98
|
+
setPendingValue(value);
|
|
99
|
+
}
|
|
100
|
+
setAnchorEl(event.currentTarget);
|
|
101
|
+
setOpen(true);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function handleClose(_, reason) {
|
|
105
|
+
// (thuang): We don't want to close the menu when the input is clicked
|
|
106
|
+
if (reason === "toggleInput") {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
// (masoudmanson): When the dropdown loses focus, we will not close it immediately. Instead, we will update the values and
|
|
110
|
+
// only close the dropdown at the end of this block by calling setOpen(false).
|
|
111
|
+
if (shouldShowButtons && reason === "blur") {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (multiple) {
|
|
115
|
+
setValue(pendingValue);
|
|
116
|
+
}
|
|
117
|
+
if (anchorEl) {
|
|
118
|
+
anchorEl.focus();
|
|
119
|
+
}
|
|
120
|
+
if (closeOnBlur)
|
|
121
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
122
|
+
if (shouldShowButtons) {
|
|
123
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
124
|
+
setOpen(false);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function handleChange(_, newValue) {
|
|
128
|
+
if (multiple) {
|
|
129
|
+
if (isTriggerChangeOnOptionClick) {
|
|
130
|
+
setPendingValue(newValue);
|
|
131
|
+
return setValue(newValue);
|
|
132
|
+
}
|
|
133
|
+
return setPendingValue(newValue);
|
|
134
|
+
}
|
|
135
|
+
setValue(newValue);
|
|
136
|
+
setOpen(false);
|
|
137
|
+
}
|
|
138
|
+
function handleCancel() {
|
|
139
|
+
if (multiple) {
|
|
140
|
+
// (masoudmanson): To undo the latest actions made on the selections,
|
|
141
|
+
// we set the value of the selection to the pendingValue. This allows us to
|
|
142
|
+
// cancel any recent changes and restore the previous selection state.
|
|
143
|
+
setPendingValue(value);
|
|
144
|
+
}
|
|
145
|
+
if (anchorEl) {
|
|
146
|
+
anchorEl.focus();
|
|
147
|
+
}
|
|
148
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
149
|
+
setOpen(false);
|
|
150
|
+
}
|
|
151
|
+
function getInitialValue() {
|
|
152
|
+
if (isControlled) {
|
|
153
|
+
return propValue;
|
|
154
|
+
}
|
|
155
|
+
return multiple
|
|
156
|
+
? []
|
|
157
|
+
: null;
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
exports.default = Dropdown;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Args } from "@storybook/react";
|
|
2
|
+
declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, Args>;
|
|
3
|
+
export default _default;
|
|
4
|
+
export declare const Default: {
|
|
5
|
+
args: {
|
|
6
|
+
buttonPosition: string;
|
|
7
|
+
buttons: boolean;
|
|
8
|
+
closeOnBlur: boolean;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
isTriggerChangeOnOptionClick: boolean;
|
|
11
|
+
label: string;
|
|
12
|
+
multiple: boolean;
|
|
13
|
+
onChange: () => void;
|
|
14
|
+
onClose: () => void;
|
|
15
|
+
search: boolean;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare const LoadingResultsIndicator: {
|
|
19
|
+
args: {
|
|
20
|
+
DropdownMenuProps: {
|
|
21
|
+
loading: boolean;
|
|
22
|
+
loadingText: JSX.Element;
|
|
23
|
+
};
|
|
24
|
+
label: string;
|
|
25
|
+
onChange: () => void;
|
|
26
|
+
options: never[];
|
|
27
|
+
};
|
|
28
|
+
parameters: {
|
|
29
|
+
snapshot: {
|
|
30
|
+
skip: boolean;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export declare const InsideModal: {
|
|
35
|
+
parameters: {
|
|
36
|
+
axe: {
|
|
37
|
+
disabledRules: string[];
|
|
38
|
+
};
|
|
39
|
+
snapshot: {
|
|
40
|
+
skip: boolean;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
render: () => JSX.Element;
|
|
44
|
+
};
|
|
45
|
+
export declare const ControlledDropdown: {
|
|
46
|
+
args: {
|
|
47
|
+
label: string;
|
|
48
|
+
};
|
|
49
|
+
parameters: {
|
|
50
|
+
snapshot: {
|
|
51
|
+
skip: boolean;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
render: (args: Args) => JSX.Element;
|
|
55
|
+
};
|
|
56
|
+
export declare const Test: {
|
|
57
|
+
args: {
|
|
58
|
+
buttonPosition: string;
|
|
59
|
+
label: string;
|
|
60
|
+
onChange: () => void;
|
|
61
|
+
};
|
|
62
|
+
parameters: {
|
|
63
|
+
snapshot: {
|
|
64
|
+
skip: boolean;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
render: (args: Args) => JSX.Element;
|
|
68
|
+
};
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __assign = (this && this.__assign) || function () {
|
|
7
|
+
__assign = Object.assign || function(t) {
|
|
8
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
9
|
+
s = arguments[i];
|
|
10
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
11
|
+
t[p] = s[p];
|
|
12
|
+
}
|
|
13
|
+
return t;
|
|
14
|
+
};
|
|
15
|
+
return __assign.apply(this, arguments);
|
|
16
|
+
};
|
|
17
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
18
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
19
|
+
if (ar || !(i in from)) {
|
|
20
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
21
|
+
ar[i] = from[i];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
25
|
+
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.Test = exports.ControlledDropdown = exports.InsideModal = exports.LoadingResultsIndicator = exports.Default = void 0;
|
|
31
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
32
|
+
var material_1 = require("@mui/material");
|
|
33
|
+
var react_1 = require("react");
|
|
34
|
+
var utils_1 = require("src/common/utils");
|
|
35
|
+
var Button_1 = __importDefault(require("../Button"));
|
|
36
|
+
var GITHUB_LABELS_1 = require("../DropdownMenu/GITHUB_LABELS");
|
|
37
|
+
var LoadingIndicator_1 = __importDefault(require("../LoadingIndicator"));
|
|
38
|
+
var index_1 = __importDefault(require("./index"));
|
|
39
|
+
var Dropdown = function (props) {
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(index_1.default, __assign({ label: "Click Target", onChange: utils_1.noop, options: GITHUB_LABELS_1.GITHUB_LABELS, DropdownMenuProps: {
|
|
41
|
+
groupBy: function (option) {
|
|
42
|
+
return option.section;
|
|
43
|
+
},
|
|
44
|
+
} }, props)));
|
|
45
|
+
};
|
|
46
|
+
var onChangeOptions = [
|
|
47
|
+
utils_1.noop,
|
|
48
|
+
function (value) {
|
|
49
|
+
// eslint-disable-next-line no-console
|
|
50
|
+
console.log(value);
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
var onCloseOptions = [
|
|
54
|
+
utils_1.noop,
|
|
55
|
+
function () {
|
|
56
|
+
// eslint-disable-next-line no-console
|
|
57
|
+
console.log("Closed!");
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
var buttonPositionOptions = ["left", "right"];
|
|
61
|
+
var LABEL = "Click Target";
|
|
62
|
+
exports.default = {
|
|
63
|
+
argTypes: {
|
|
64
|
+
DropdownMenuProps: { control: { type: "object" } },
|
|
65
|
+
buttonPosition: {
|
|
66
|
+
constrol: {
|
|
67
|
+
labels: ["left", "right"],
|
|
68
|
+
type: "select",
|
|
69
|
+
},
|
|
70
|
+
mapping: buttonPositionOptions,
|
|
71
|
+
options: Object.keys(buttonPositionOptions),
|
|
72
|
+
},
|
|
73
|
+
buttons: {
|
|
74
|
+
control: {
|
|
75
|
+
type: "boolean",
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
closeOnBlur: {
|
|
79
|
+
control: {
|
|
80
|
+
type: "boolean",
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
disabled: {
|
|
84
|
+
control: {
|
|
85
|
+
type: "boolean",
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
label: { control: { type: "text" } },
|
|
89
|
+
multiple: {
|
|
90
|
+
control: {
|
|
91
|
+
type: "boolean",
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
onChange: {
|
|
95
|
+
control: {
|
|
96
|
+
labels: ["NOOP", "Log value on change"],
|
|
97
|
+
type: "select",
|
|
98
|
+
},
|
|
99
|
+
mapping: onChangeOptions,
|
|
100
|
+
options: Object.keys(onChangeOptions),
|
|
101
|
+
},
|
|
102
|
+
onClose: {
|
|
103
|
+
control: {
|
|
104
|
+
labels: ["NOOP", "console.log('Closed!')"],
|
|
105
|
+
type: "select",
|
|
106
|
+
},
|
|
107
|
+
mapping: onCloseOptions,
|
|
108
|
+
options: Object.keys(onCloseOptions),
|
|
109
|
+
},
|
|
110
|
+
search: {
|
|
111
|
+
control: {
|
|
112
|
+
type: "boolean",
|
|
113
|
+
},
|
|
114
|
+
defaulValue: true,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
component: Dropdown,
|
|
118
|
+
title: "Dropdowns/Dropdown",
|
|
119
|
+
};
|
|
120
|
+
exports.Default = {
|
|
121
|
+
args: {
|
|
122
|
+
buttonPosition: "left",
|
|
123
|
+
buttons: false,
|
|
124
|
+
closeOnBlur: true,
|
|
125
|
+
disabled: false,
|
|
126
|
+
isTriggerChangeOnOptionClick: false,
|
|
127
|
+
label: LABEL,
|
|
128
|
+
multiple: true,
|
|
129
|
+
onChange: utils_1.noop,
|
|
130
|
+
onClose: utils_1.noop,
|
|
131
|
+
search: true,
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
exports.LoadingResultsIndicator = {
|
|
135
|
+
args: {
|
|
136
|
+
DropdownMenuProps: {
|
|
137
|
+
loading: true,
|
|
138
|
+
loadingText: (0, jsx_runtime_1.jsx)(LoadingIndicator_1.default, { sdsStyle: "minimal" }),
|
|
139
|
+
},
|
|
140
|
+
label: LABEL,
|
|
141
|
+
onChange: utils_1.noop,
|
|
142
|
+
options: [],
|
|
143
|
+
},
|
|
144
|
+
parameters: {
|
|
145
|
+
snapshot: {
|
|
146
|
+
skip: true,
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
// Inside Modal
|
|
151
|
+
var StyledPaper = (0, material_1.styled)(material_1.Paper)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 200px;\n padding: 50px;\n"], ["\n width: 200px;\n padding: 50px;\n"])));
|
|
152
|
+
exports.InsideModal = {
|
|
153
|
+
parameters: {
|
|
154
|
+
axe: {
|
|
155
|
+
disabledRules: ["aria-dialog-name"],
|
|
156
|
+
},
|
|
157
|
+
snapshot: {
|
|
158
|
+
skip: true,
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
render: function () {
|
|
162
|
+
var _a = (0, react_1.useState)([GITHUB_LABELS_1.GITHUB_LABELS[0], GITHUB_LABELS_1.GITHUB_LABELS[1]]), value = _a[0], setValue = _a[1];
|
|
163
|
+
var FullWidthDropdown = (0, material_1.styled)(index_1.default)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 100%;\n "], ["\n width: 100%;\n "])));
|
|
164
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Dialog, { open: true, disableEnforceFocus: true, PaperComponent: StyledPaper, children: (0, jsx_runtime_1.jsx)(FullWidthDropdown, { label: "Dropdown", options: GITHUB_LABELS_1.GITHUB_LABELS, onChange: handleChange, value: value, multiple: true, InputDropdownProps: { sdsStyle: "square" } }) }));
|
|
165
|
+
function handleChange(newValue) {
|
|
166
|
+
setValue(newValue);
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
// Controlled Dropdown
|
|
171
|
+
var ControlledDropdownDemo = function (props) {
|
|
172
|
+
var _a = (0, react_1.useState)([]), value = _a[0], setValue = _a[1];
|
|
173
|
+
var StyledButton = (0, material_1.styled)(Button_1.default)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n &:focus {\n outline: none;\n }\n\n margin: 0 0 24px 8px;\n "], ["\n &:focus {\n outline: none;\n }\n\n margin: 0 0 24px 8px;\n "])));
|
|
174
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(StyledButton, { onClick: handleClick, sdsStyle: "minimal", sdsType: "primary", children: "Click here to select the first three options" }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(index_1.default, __assign({ label: "Click Target", options: GITHUB_LABELS_1.GITHUB_LABELS }, props, { value: value, onChange: handleChange, "data-testid": "dropdown", DropdownMenuProps: {
|
|
175
|
+
groupBy: function (option) {
|
|
176
|
+
return option.section;
|
|
177
|
+
},
|
|
178
|
+
title: "Github Labels",
|
|
179
|
+
}, multiple: true }))] }));
|
|
180
|
+
function handleClick() {
|
|
181
|
+
setValue(__spreadArray([], GITHUB_LABELS_1.GITHUB_LABELS.slice(0, 3), true));
|
|
182
|
+
}
|
|
183
|
+
function handleChange(newValue) {
|
|
184
|
+
setValue(newValue);
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
exports.ControlledDropdown = {
|
|
188
|
+
args: {
|
|
189
|
+
label: LABEL,
|
|
190
|
+
},
|
|
191
|
+
parameters: {
|
|
192
|
+
snapshot: {
|
|
193
|
+
skip: true,
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
render: function (args) { return (0, jsx_runtime_1.jsx)(ControlledDropdownDemo, __assign({}, args)); },
|
|
197
|
+
};
|
|
198
|
+
// Test
|
|
199
|
+
var TestDemo = function (props) {
|
|
200
|
+
return ((0, jsx_runtime_1.jsx)(index_1.default, __assign({ label: "Click Target", onChange: utils_1.noop, options: GITHUB_LABELS_1.GITHUB_LABELS }, props, { "data-testid": "dropdown" })));
|
|
201
|
+
};
|
|
202
|
+
exports.Test = {
|
|
203
|
+
args: {
|
|
204
|
+
buttonPosition: "left",
|
|
205
|
+
label: LABEL,
|
|
206
|
+
onChange: utils_1.noop,
|
|
207
|
+
},
|
|
208
|
+
parameters: {
|
|
209
|
+
snapshot: {
|
|
210
|
+
skip: true,
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
render: function (args) { return (0, jsx_runtime_1.jsx)(TestDemo, __assign({}, args)); },
|
|
214
|
+
};
|
|
215
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|