@dxc-technology/halstack-react 0.0.0-ff6151e → 0.0.0-ff6c8bf
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/BackgroundColorContext.d.ts +1 -0
- package/BackgroundColorContext.js +30 -0
- package/HalstackContext.d.ts +1246 -0
- package/HalstackContext.js +310 -0
- package/README.md +28 -47
- package/accordion/Accordion.accessibility.test.js +71 -0
- package/accordion/Accordion.d.ts +4 -0
- package/accordion/Accordion.js +171 -0
- package/accordion/Accordion.stories.tsx +241 -0
- package/accordion/Accordion.test.js +56 -0
- package/accordion/types.d.ts +57 -0
- package/accordion/types.js +5 -0
- package/accordion-group/AccordionGroup.accessibility.test.js +88 -0
- package/accordion-group/AccordionGroup.d.ts +7 -0
- package/accordion-group/AccordionGroup.js +101 -0
- package/accordion-group/AccordionGroup.stories.tsx +252 -0
- package/accordion-group/AccordionGroup.test.js +98 -0
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +31 -0
- package/accordion-group/AccordionGroupContext.d.ts +3 -0
- package/accordion-group/AccordionGroupContext.js +8 -0
- package/accordion-group/types.d.ts +67 -0
- package/accordion-group/types.js +5 -0
- package/action-icon/ActionIcon.accessibility.test.js +63 -0
- package/action-icon/ActionIcon.d.ts +4 -0
- package/action-icon/ActionIcon.js +48 -0
- package/action-icon/ActionIcon.stories.tsx +41 -0
- package/action-icon/ActionIcon.test.js +64 -0
- package/action-icon/types.d.ts +26 -0
- package/action-icon/types.js +5 -0
- package/alert/Alert.accessibility.test.js +95 -0
- package/alert/Alert.d.ts +4 -0
- package/alert/Alert.js +203 -0
- package/alert/Alert.stories.tsx +198 -0
- package/alert/Alert.test.js +75 -0
- package/alert/types.d.ts +49 -0
- package/alert/types.js +5 -0
- package/badge/Badge.accessibility.test.js +129 -0
- package/badge/Badge.d.ts +4 -0
- package/badge/Badge.js +161 -0
- package/badge/Badge.stories.tsx +210 -0
- package/badge/Badge.test.js +30 -0
- package/badge/types.d.ts +54 -0
- package/badge/types.js +5 -0
- package/bleed/Bleed.d.ts +3 -0
- package/bleed/Bleed.js +43 -0
- package/bleed/Bleed.stories.tsx +342 -0
- package/bleed/types.d.ts +37 -0
- package/bleed/types.js +5 -0
- package/box/Box.accessibility.test.js +33 -0
- package/box/Box.d.ts +4 -0
- package/box/Box.js +75 -0
- package/box/Box.stories.tsx +119 -0
- package/box/Box.test.js +13 -0
- package/box/types.d.ts +32 -0
- package/box/types.js +5 -0
- package/breadcrumbs/Breadcrumbs.accessibility.test.d.ts +1 -0
- package/breadcrumbs/Breadcrumbs.accessibility.test.js +96 -0
- package/breadcrumbs/Breadcrumbs.d.ts +4 -0
- package/breadcrumbs/Breadcrumbs.js +79 -0
- package/breadcrumbs/Breadcrumbs.stories.tsx +194 -0
- package/breadcrumbs/Breadcrumbs.test.d.ts +1 -0
- package/breadcrumbs/Breadcrumbs.test.js +169 -0
- package/breadcrumbs/Item.d.ts +4 -0
- package/breadcrumbs/Item.js +52 -0
- package/breadcrumbs/dropdownTheme.d.ts +53 -0
- package/breadcrumbs/dropdownTheme.js +62 -0
- package/breadcrumbs/types.d.ts +16 -0
- package/breadcrumbs/types.js +5 -0
- package/bulleted-list/BulletedList.accessibility.test.js +119 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +92 -0
- package/bulleted-list/BulletedList.stories.tsx +115 -0
- package/bulleted-list/types.d.ts +38 -0
- package/bulleted-list/types.js +5 -0
- package/button/Button.accessibility.test.js +127 -0
- package/button/Button.d.ts +4 -0
- package/button/Button.js +121 -0
- package/button/Button.stories.tsx +325 -0
- package/button/Button.test.js +38 -0
- package/button/types.d.ts +57 -0
- package/button/types.js +5 -0
- package/card/Card.accessibility.test.js +36 -0
- package/card/Card.d.ts +4 -0
- package/card/Card.js +121 -0
- package/card/Card.stories.tsx +171 -0
- package/card/Card.test.js +39 -0
- package/card/types.d.ts +62 -0
- package/card/types.js +5 -0
- package/checkbox/Checkbox.accessibility.test.js +87 -0
- package/checkbox/Checkbox.d.ts +4 -0
- package/checkbox/Checkbox.js +215 -0
- package/checkbox/Checkbox.stories.tsx +222 -0
- package/checkbox/Checkbox.test.js +199 -0
- package/checkbox/types.d.ts +72 -0
- package/checkbox/types.js +5 -0
- package/chip/Chip.accessibility.test.js +67 -0
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +126 -0
- package/chip/Chip.stories.tsx +199 -0
- package/chip/Chip.test.js +41 -0
- package/chip/types.d.ts +45 -0
- package/chip/types.js +5 -0
- package/common/coreTokens.d.ts +237 -0
- package/common/coreTokens.js +184 -0
- package/common/utils.d.ts +1 -0
- package/common/utils.js +16 -0
- package/common/variables.d.ts +1392 -0
- package/common/variables.js +1264 -0
- package/container/Container.d.ts +4 -0
- package/container/Container.js +194 -0
- package/container/Container.stories.tsx +214 -0
- package/container/types.d.ts +74 -0
- package/container/types.js +5 -0
- package/contextual-menu/ContextualMenu.accessibility.test.js +97 -0
- package/contextual-menu/ContextualMenu.d.ts +5 -0
- package/contextual-menu/ContextualMenu.js +88 -0
- package/contextual-menu/ContextualMenu.stories.tsx +232 -0
- package/contextual-menu/ContextualMenu.test.js +205 -0
- package/contextual-menu/GroupItem.d.ts +4 -0
- package/contextual-menu/GroupItem.js +67 -0
- package/contextual-menu/ItemAction.d.ts +4 -0
- package/contextual-menu/ItemAction.js +51 -0
- package/contextual-menu/MenuItem.d.ts +4 -0
- package/contextual-menu/MenuItem.js +29 -0
- package/contextual-menu/SingleItem.d.ts +4 -0
- package/contextual-menu/SingleItem.js +38 -0
- package/contextual-menu/types.d.ts +58 -0
- package/contextual-menu/types.js +5 -0
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +214 -0
- package/date-input/DateInput.accessibility.test.js +228 -0
- package/date-input/DateInput.d.ts +4 -0
- package/date-input/DateInput.js +222 -0
- package/date-input/DateInput.stories.tsx +292 -0
- package/date-input/DateInput.test.js +808 -0
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +121 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +100 -0
- package/date-input/types.d.ts +164 -0
- package/date-input/types.js +5 -0
- package/dialog/Dialog.accessibility.test.js +69 -0
- package/dialog/Dialog.d.ts +4 -0
- package/dialog/Dialog.js +93 -0
- package/dialog/Dialog.stories.tsx +371 -0
- package/dialog/Dialog.test.js +307 -0
- package/dialog/types.d.ts +36 -0
- package/dialog/types.js +5 -0
- package/divider/Divider.accessibility.test.js +33 -0
- package/divider/Divider.d.ts +4 -0
- package/divider/Divider.js +36 -0
- package/divider/Divider.stories.tsx +223 -0
- package/divider/Divider.test.js +38 -0
- package/divider/types.d.ts +21 -0
- package/divider/types.js +5 -0
- package/dropdown/Dropdown.accessibility.test.js +180 -0
- package/dropdown/Dropdown.d.ts +4 -0
- package/dropdown/Dropdown.js +321 -0
- package/dropdown/Dropdown.stories.tsx +427 -0
- package/dropdown/Dropdown.test.js +599 -0
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +63 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +71 -0
- package/dropdown/types.d.ts +96 -0
- package/dropdown/types.js +5 -0
- package/file-input/FileInput.accessibility.test.js +160 -0
- package/file-input/FileInput.d.ts +4 -0
- package/file-input/FileInput.js +443 -0
- package/file-input/FileInput.stories.tsx +618 -0
- package/file-input/FileInput.test.js +396 -0
- package/file-input/FileItem.d.ts +4 -0
- package/file-input/FileItem.js +125 -0
- package/file-input/types.d.ts +129 -0
- package/file-input/types.js +5 -0
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +57 -0
- package/flex/Flex.stories.tsx +112 -0
- package/flex/types.d.ts +97 -0
- package/flex/types.js +5 -0
- package/footer/Footer.accessibility.test.js +125 -0
- package/footer/Footer.d.ts +4 -0
- package/footer/Footer.js +140 -0
- package/footer/Footer.stories.tsx +208 -0
- package/footer/Footer.test.js +85 -0
- package/footer/Icons.d.ts +3 -0
- package/footer/Icons.js +108 -0
- package/footer/types.d.ts +64 -0
- package/footer/types.js +5 -0
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +76 -0
- package/grid/Grid.stories.tsx +219 -0
- package/grid/types.d.ts +115 -0
- package/grid/types.js +5 -0
- package/header/Header.accessibility.test.js +93 -0
- package/header/Header.d.ts +8 -0
- package/header/Header.js +210 -0
- package/header/Header.stories.tsx +267 -0
- package/header/Header.test.js +66 -0
- package/header/Icons.d.ts +2 -0
- package/header/Icons.js +24 -0
- package/header/types.d.ts +33 -0
- package/header/types.js +5 -0
- package/heading/Heading.accessibility.test.js +33 -0
- package/heading/Heading.d.ts +4 -0
- package/heading/Heading.js +137 -0
- package/heading/Heading.stories.tsx +54 -0
- package/heading/Heading.test.js +169 -0
- package/heading/types.d.ts +33 -0
- package/heading/types.js +5 -0
- package/icon/Icon.accessibility.test.js +30 -0
- package/icon/Icon.d.ts +4 -0
- package/icon/Icon.js +33 -0
- package/icon/Icon.stories.tsx +28 -0
- package/icon/types.d.ts +4 -0
- package/icon/types.js +5 -0
- package/image/Image.accessibility.test.js +56 -0
- package/image/Image.d.ts +4 -0
- package/image/Image.js +70 -0
- package/image/Image.stories.tsx +129 -0
- package/image/types.d.ts +72 -0
- package/image/types.js +5 -0
- package/inset/Inset.d.ts +3 -0
- package/inset/Inset.js +43 -0
- package/inset/Inset.stories.tsx +230 -0
- package/inset/types.d.ts +37 -0
- package/inset/types.js +5 -0
- package/layout/ApplicationLayout.d.ts +20 -0
- package/layout/ApplicationLayout.js +137 -0
- package/layout/ApplicationLayout.stories.tsx +162 -0
- package/layout/Icons.d.ts +7 -0
- package/layout/Icons.js +48 -0
- package/layout/types.d.ts +41 -0
- package/layout/types.js +5 -0
- package/link/Link.accessibility.test.js +108 -0
- package/link/Link.d.ts +4 -0
- package/link/Link.js +117 -0
- package/link/Link.stories.tsx +253 -0
- package/link/Link.test.js +63 -0
- package/link/types.d.ts +54 -0
- package/link/types.js +5 -0
- package/main.d.ts +50 -0
- package/{dist/main.js → main.js} +172 -111
- package/nav-tabs/NavTabs.accessibility.test.js +44 -0
- package/nav-tabs/NavTabs.d.ts +7 -0
- package/nav-tabs/NavTabs.js +93 -0
- package/nav-tabs/NavTabs.stories.tsx +279 -0
- package/nav-tabs/NavTabs.test.js +77 -0
- package/nav-tabs/NavTabsContext.d.ts +3 -0
- package/nav-tabs/NavTabsContext.js +8 -0
- package/nav-tabs/Tab.d.ts +4 -0
- package/nav-tabs/Tab.js +117 -0
- package/nav-tabs/types.d.ts +52 -0
- package/nav-tabs/types.js +5 -0
- package/number-input/NumberInput.accessibility.test.js +228 -0
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +86 -0
- package/number-input/NumberInput.stories.tsx +131 -0
- package/number-input/NumberInput.test.js +989 -0
- package/number-input/NumberInputContext.d.ts +3 -0
- package/number-input/NumberInputContext.js +8 -0
- package/number-input/types.d.ts +136 -0
- package/number-input/types.js +5 -0
- package/package.json +66 -51
- package/paginator/Paginator.accessibility.test.js +79 -0
- package/paginator/Paginator.d.ts +4 -0
- package/paginator/Paginator.js +138 -0
- package/paginator/Paginator.stories.tsx +87 -0
- package/paginator/Paginator.test.js +335 -0
- package/paginator/types.d.ts +38 -0
- package/paginator/types.js +5 -0
- package/paragraph/Paragraph.accessibility.test.js +28 -0
- package/paragraph/Paragraph.d.ts +5 -0
- package/paragraph/Paragraph.js +22 -0
- package/paragraph/Paragraph.stories.tsx +27 -0
- package/password-input/PasswordInput.accessibility.test.js +153 -0
- package/password-input/PasswordInput.d.ts +4 -0
- package/password-input/PasswordInput.js +97 -0
- package/password-input/PasswordInput.stories.tsx +99 -0
- package/password-input/PasswordInput.test.js +198 -0
- package/password-input/types.d.ts +111 -0
- package/password-input/types.js +5 -0
- package/progress-bar/ProgressBar.accessibility.test.js +35 -0
- package/progress-bar/ProgressBar.d.ts +4 -0
- package/progress-bar/ProgressBar.js +146 -0
- package/progress-bar/ProgressBar.stories.tsx +93 -0
- package/progress-bar/ProgressBar.test.js +93 -0
- package/progress-bar/types.d.ts +37 -0
- package/progress-bar/types.js +5 -0
- package/quick-nav/QuickNav.accessibility.test.js +57 -0
- package/quick-nav/QuickNav.d.ts +4 -0
- package/quick-nav/QuickNav.js +94 -0
- package/quick-nav/QuickNav.stories.tsx +356 -0
- package/quick-nav/types.d.ts +21 -0
- package/quick-nav/types.js +5 -0
- package/radio-group/Radio.d.ts +4 -0
- package/radio-group/Radio.js +124 -0
- package/radio-group/RadioGroup.accessibility.test.js +97 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +236 -0
- package/radio-group/RadioGroup.stories.tsx +214 -0
- package/radio-group/RadioGroup.test.js +756 -0
- package/radio-group/types.d.ts +114 -0
- package/radio-group/types.js +5 -0
- package/resultset-table/Icons.d.ts +7 -0
- package/resultset-table/Icons.js +47 -0
- package/resultset-table/ResultsetTable.accessibility.test.js +285 -0
- package/resultset-table/ResultsetTable.d.ts +7 -0
- package/resultset-table/ResultsetTable.js +171 -0
- package/resultset-table/ResultsetTable.stories.tsx +413 -0
- package/resultset-table/ResultsetTable.test.js +381 -0
- package/resultset-table/types.d.ts +100 -0
- package/resultset-table/types.js +5 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +155 -0
- package/select/Option.d.ts +4 -0
- package/select/Option.js +89 -0
- package/select/Select.accessibility.test.js +228 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +602 -0
- package/select/Select.stories.tsx +919 -0
- package/select/Select.test.js +2265 -0
- package/select/types.d.ts +209 -0
- package/select/types.js +5 -0
- package/sidenav/Sidenav.accessibility.test.js +59 -0
- package/sidenav/Sidenav.d.ts +10 -0
- package/sidenav/Sidenav.js +201 -0
- package/sidenav/Sidenav.stories.tsx +277 -0
- package/sidenav/Sidenav.test.js +37 -0
- package/sidenav/SidenavContext.d.ts +5 -0
- package/sidenav/SidenavContext.js +13 -0
- package/sidenav/types.d.ts +76 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.accessibility.test.js +104 -0
- package/slider/Slider.d.ts +4 -0
- package/slider/Slider.js +286 -0
- package/slider/Slider.stories.tsx +180 -0
- package/slider/Slider.test.js +254 -0
- package/slider/types.d.ts +86 -0
- package/slider/types.js +5 -0
- package/spinner/Spinner.accessibility.test.js +96 -0
- package/spinner/Spinner.d.ts +4 -0
- package/spinner/Spinner.js +210 -0
- package/spinner/Spinner.stories.tsx +129 -0
- package/spinner/Spinner.test.js +55 -0
- package/spinner/types.d.ts +32 -0
- package/spinner/types.js +5 -0
- package/status-light/StatusLight.accessibility.test.js +157 -0
- package/status-light/StatusLight.d.ts +4 -0
- package/status-light/StatusLight.js +51 -0
- package/status-light/StatusLight.stories.tsx +74 -0
- package/status-light/StatusLight.test.js +25 -0
- package/status-light/types.d.ts +17 -0
- package/status-light/types.js +5 -0
- package/switch/Switch.accessibility.test.js +98 -0
- package/switch/Switch.d.ts +4 -0
- package/switch/Switch.js +214 -0
- package/switch/Switch.stories.tsx +149 -0
- package/switch/Switch.test.js +180 -0
- package/switch/types.d.ts +66 -0
- package/switch/types.js +5 -0
- package/table/DropdownTheme.js +62 -0
- package/table/Table.accessibility.test.js +93 -0
- package/table/Table.d.ts +8 -0
- package/table/Table.js +161 -0
- package/table/Table.stories.tsx +663 -0
- package/table/Table.test.js +113 -0
- package/table/types.d.ts +49 -0
- package/table/types.js +5 -0
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +117 -0
- package/tabs/Tabs.accessibility.test.js +56 -0
- package/tabs/Tabs.d.ts +4 -0
- package/tabs/Tabs.js +373 -0
- package/tabs/Tabs.stories.tsx +230 -0
- package/tabs/Tabs.test.js +276 -0
- package/tabs/types.d.ts +92 -0
- package/tabs/types.js +5 -0
- package/tag/Tag.accessibility.test.js +69 -0
- package/tag/Tag.d.ts +4 -0
- package/tag/Tag.js +151 -0
- package/tag/Tag.stories.tsx +152 -0
- package/tag/Tag.test.js +41 -0
- package/tag/types.d.ts +69 -0
- package/tag/types.js +5 -0
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +67 -0
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +94 -0
- package/text-input/TextInput.accessibility.test.js +321 -0
- package/text-input/TextInput.d.ts +4 -0
- package/text-input/TextInput.js +571 -0
- package/text-input/TextInput.stories.tsx +474 -0
- package/text-input/TextInput.test.js +1756 -0
- package/text-input/types.d.ts +205 -0
- package/text-input/types.js +5 -0
- package/textarea/Textarea.accessibility.test.js +155 -0
- package/textarea/Textarea.d.ts +4 -0
- package/textarea/Textarea.js +235 -0
- package/textarea/Textarea.stories.tsx +174 -0
- package/textarea/Textarea.test.js +406 -0
- package/textarea/types.d.ts +141 -0
- package/textarea/types.js +5 -0
- package/toggle-group/ToggleGroup.accessibility.test.js +107 -0
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/toggle-group/ToggleGroup.js +202 -0
- package/toggle-group/ToggleGroup.stories.tsx +218 -0
- package/toggle-group/ToggleGroup.test.js +137 -0
- package/toggle-group/types.d.ts +114 -0
- package/toggle-group/types.js +5 -0
- package/typography/Typography.accessibility.test.js +339 -0
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +23 -0
- package/typography/Typography.stories.tsx +198 -0
- package/typography/types.d.ts +18 -0
- package/typography/types.js +5 -0
- package/useTheme.d.ts +1145 -0
- package/{dist/useTheme.js → useTheme.js} +4 -11
- package/useTranslatedLabels.d.ts +85 -0
- package/useTranslatedLabels.js +14 -0
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +94 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +124 -0
- package/wizard/Wizard.accessibility.test.js +55 -0
- package/wizard/Wizard.d.ts +4 -0
- package/wizard/Wizard.js +239 -0
- package/wizard/Wizard.stories.tsx +272 -0
- package/wizard/Wizard.test.js +114 -0
- package/wizard/types.d.ts +64 -0
- package/wizard/types.js +5 -0
- package/babel.config.js +0 -4
- package/dist/ThemeContext.js +0 -54
- package/dist/accordion/Accordion.js +0 -273
- package/dist/accordion/Accordion.stories.js +0 -207
- package/dist/accordion/readme.md +0 -96
- package/dist/accordion-group/AccordionGroup.js +0 -159
- package/dist/accordion-group/AccordionGroup.stories.js +0 -207
- package/dist/accordion-group/readme.md +0 -70
- package/dist/alert/Alert.js +0 -304
- package/dist/alert/Alert.stories.js +0 -158
- package/dist/alert/close.svg +0 -4
- package/dist/alert/error.svg +0 -4
- package/dist/alert/info.svg +0 -4
- package/dist/alert/readme.md +0 -43
- package/dist/alert/success.svg +0 -4
- package/dist/alert/warning.svg +0 -4
- package/dist/badge/Badge.js +0 -58
- package/dist/box/Box.js +0 -148
- package/dist/button/Button.js +0 -202
- package/dist/button/Button.stories.js +0 -224
- package/dist/button/readme.md +0 -93
- package/dist/card/Card.js +0 -217
- package/dist/checkbox/Checkbox.js +0 -240
- package/dist/checkbox/Checkbox.stories.js +0 -144
- package/dist/checkbox/readme.md +0 -116
- package/dist/chip/Chip.js +0 -208
- package/dist/common/OpenSans.css +0 -81
- package/dist/common/RequiredComponent.js +0 -40
- package/dist/common/fonts/OpenSans-Bold.ttf +0 -0
- package/dist/common/fonts/OpenSans-BoldItalic.ttf +0 -0
- package/dist/common/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/dist/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- package/dist/common/fonts/OpenSans-Italic.ttf +0 -0
- package/dist/common/fonts/OpenSans-Light.ttf +0 -0
- package/dist/common/fonts/OpenSans-LightItalic.ttf +0 -0
- package/dist/common/fonts/OpenSans-Regular.ttf +0 -0
- package/dist/common/fonts/OpenSans-SemiBold.ttf +0 -0
- package/dist/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
- package/dist/common/services/example-service.js +0 -10
- package/dist/common/services/example-service.test.js +0 -12
- package/dist/common/utils.js +0 -42
- package/dist/common/variables.js +0 -436
- package/dist/date/Date.js +0 -357
- package/dist/date/Date.stories.js +0 -205
- package/dist/date/calendar.svg +0 -1
- package/dist/date/calendar_dark.svg +0 -1
- package/dist/date/readme.md +0 -73
- package/dist/dialog/Dialog.js +0 -197
- package/dist/dialog/Dialog.stories.js +0 -217
- package/dist/dialog/readme.md +0 -32
- package/dist/dropdown/Dropdown.js +0 -449
- package/dist/dropdown/Dropdown.stories.js +0 -249
- package/dist/dropdown/baseline-arrow_drop_down.svg +0 -1
- package/dist/dropdown/baseline-arrow_drop_down_wh.svg +0 -4
- package/dist/dropdown/baseline-arrow_drop_up.svg +0 -1
- package/dist/dropdown/baseline-arrow_drop_up_wh.svg +0 -4
- package/dist/dropdown/readme.md +0 -69
- package/dist/footer/Footer.js +0 -371
- package/dist/footer/Footer.stories.js +0 -94
- package/dist/footer/dxc_logo_wht.png +0 -0
- package/dist/footer/readme.md +0 -41
- package/dist/header/Header.js +0 -373
- package/dist/header/Header.stories.js +0 -176
- package/dist/header/close_icon.svg +0 -1
- package/dist/header/dxc_logo_black.png +0 -0
- package/dist/header/dxc_logo_blk_rgb.svg +0 -6
- package/dist/header/dxc_logo_white.png +0 -0
- package/dist/header/hamb_menu_black.svg +0 -1
- package/dist/header/hamb_menu_white.svg +0 -1
- package/dist/header/readme.md +0 -33
- package/dist/heading/Heading.js +0 -153
- package/dist/input-text/InputText.js +0 -570
- package/dist/input-text/InputText.stories.js +0 -209
- package/dist/input-text/error.svg +0 -1
- package/dist/input-text/readme.md +0 -91
- package/dist/layout/ApplicationLayout.js +0 -335
- package/dist/layout/facebook.svg +0 -45
- package/dist/layout/linkedin.svg +0 -50
- package/dist/layout/twitter.svg +0 -53
- package/dist/link/Link.js +0 -192
- package/dist/link/readme.md +0 -51
- package/dist/paginator/Paginator.js +0 -232
- package/dist/paginator/images/next.svg +0 -3
- package/dist/paginator/images/nextPage.svg +0 -3
- package/dist/paginator/images/previous.svg +0 -3
- package/dist/paginator/images/previousPage.svg +0 -3
- package/dist/paginator/readme.md +0 -50
- package/dist/progress-bar/ProgressBar.js +0 -185
- package/dist/progress-bar/ProgressBar.stories.js +0 -280
- package/dist/progress-bar/readme.md +0 -63
- package/dist/radio/Radio.js +0 -195
- package/dist/radio/Radio.stories.js +0 -166
- package/dist/radio/readme.md +0 -70
- package/dist/resultsetTable/ResultsetTable.js +0 -341
- package/dist/resultsetTable/arrow_downward-24px_wht.svg +0 -1
- package/dist/resultsetTable/arrow_upward-24px_wht.svg +0 -1
- package/dist/resultsetTable/unfold_more-24px_wht.svg +0 -1
- package/dist/select/Select.js +0 -473
- package/dist/select/Select.stories.js +0 -235
- package/dist/select/readme.md +0 -72
- package/dist/sidenav/Sidenav.js +0 -128
- package/dist/slider/Slider.js +0 -266
- package/dist/slider/Slider.stories.js +0 -241
- package/dist/slider/readme.md +0 -64
- package/dist/spinner/Spinner.js +0 -193
- package/dist/spinner/Spinner.stories.js +0 -183
- package/dist/spinner/readme.md +0 -65
- package/dist/switch/Switch.js +0 -199
- package/dist/switch/Switch.stories.js +0 -134
- package/dist/switch/readme.md +0 -133
- package/dist/table/Table.js +0 -105
- package/dist/tabs/Tabs.js +0 -292
- package/dist/tabs/Tabs.stories.js +0 -130
- package/dist/tabs/readme.md +0 -78
- package/dist/tabs-for-sections/TabsForSections.js +0 -92
- package/dist/tabs-for-sections/readme.md +0 -78
- package/dist/tag/Tag.js +0 -249
- package/dist/textarea/Textarea.js +0 -227
- package/dist/toggle/Toggle.js +0 -223
- package/dist/toggle/Toggle.stories.js +0 -297
- package/dist/toggle/readme.md +0 -80
- package/dist/toggle-group/ToggleGroup.js +0 -226
- package/dist/toggle-group/readme.md +0 -82
- package/dist/upload/Upload.js +0 -200
- package/dist/upload/Upload.stories.js +0 -72
- package/dist/upload/buttons-upload/ButtonsUpload.js +0 -122
- package/dist/upload/buttons-upload/drag-drop-icon.svg +0 -4
- package/dist/upload/buttons-upload/upload-button.svg +0 -1
- package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -279
- package/dist/upload/dragAndDropArea/upload_drop.svg +0 -4
- package/dist/upload/dragAndDropArea/upload_file.svg +0 -4
- package/dist/upload/file-upload/FileToUpload.js +0 -158
- package/dist/upload/file-upload/audio-icon.svg +0 -4
- package/dist/upload/file-upload/close.svg +0 -4
- package/dist/upload/file-upload/file-icon.svg +0 -4
- package/dist/upload/file-upload/video-icon.svg +0 -4
- package/dist/upload/files-upload/FilesToUpload.js +0 -123
- package/dist/upload/readme.md +0 -37
- package/dist/upload/transaction/Transaction.js +0 -155
- package/dist/upload/transaction/audio-icon-err.svg +0 -4
- package/dist/upload/transaction/audio-icon.svg +0 -4
- package/dist/upload/transaction/error-icon.svg +0 -4
- package/dist/upload/transaction/file-icon-err.svg +0 -4
- package/dist/upload/transaction/file-icon.svg +0 -4
- package/dist/upload/transaction/image-icon-err.svg +0 -4
- package/dist/upload/transaction/image-icon.svg +0 -4
- package/dist/upload/transaction/success-icon.svg +0 -4
- package/dist/upload/transaction/video-icon-err.svg +0 -4
- package/dist/upload/transaction/video-icon.svg +0 -4
- package/dist/upload/transactions/Transactions.js +0 -120
- package/dist/wizard/Wizard.js +0 -331
- package/dist/wizard/invalid_icon.svg +0 -6
- package/dist/wizard/valid_icon.svg +0 -6
- package/dist/wizard/validation-wrong.svg +0 -6
- package/test/Accordion.test.js +0 -33
- package/test/AccordionGroup.test.js +0 -109
- package/test/Alert.test.js +0 -53
- package/test/Box.test.js +0 -10
- package/test/Button.test.js +0 -18
- package/test/Card.test.js +0 -30
- package/test/Checkbox.test.js +0 -45
- package/test/Chip.test.js +0 -25
- package/test/Date.test.js +0 -393
- package/test/Dialog.test.js +0 -23
- package/test/Dropdown.test.js +0 -130
- package/test/Footer.test.js +0 -99
- package/test/Header.test.js +0 -39
- package/test/Heading.test.js +0 -35
- package/test/InputText.test.js +0 -240
- package/test/Link.test.js +0 -42
- package/test/Paginator.test.js +0 -194
- package/test/ProgressBar.test.js +0 -35
- package/test/Radio.test.js +0 -37
- package/test/ResultsetTable.test.js +0 -304
- package/test/Select.test.js +0 -192
- package/test/Sidenav.test.js +0 -45
- package/test/Slider.test.js +0 -82
- package/test/Spinner.test.js +0 -27
- package/test/Switch.test.js +0 -45
- package/test/Table.test.js +0 -36
- package/test/Tabs.test.js +0 -109
- package/test/TabsForSections.test.js +0 -34
- package/test/Tag.test.js +0 -32
- package/test/TextArea.test.js +0 -52
- package/test/ToggleGroup.test.js +0 -81
- package/test/Upload.test.js +0 -60
- package/test/Wizard.test.js +0 -130
- package/test/mocks/pngMock.js +0 -1
- package/test/mocks/svgMock.js +0 -1
package/select/Select.js
ADDED
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
10
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
15
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
16
|
+
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
17
|
+
var _variables = require("../common/variables");
|
|
18
|
+
var _uuid = require("uuid");
|
|
19
|
+
var _utils = require("../common/utils");
|
|
20
|
+
var _Listbox = _interopRequireDefault(require("./Listbox"));
|
|
21
|
+
var Popover = _interopRequireWildcard(require("@radix-ui/react-popover"));
|
|
22
|
+
var _Icon = _interopRequireDefault(require("../icon/Icon"));
|
|
23
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17;
|
|
24
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
25
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
26
|
+
var isOptionGroup = function isOptionGroup(option) {
|
|
27
|
+
return "options" in option && option.options != null;
|
|
28
|
+
};
|
|
29
|
+
var isArrayOfOptionGroups = function isArrayOfOptionGroups(options) {
|
|
30
|
+
return isOptionGroup(options[0]);
|
|
31
|
+
};
|
|
32
|
+
var groupsHaveOptions = function groupsHaveOptions(filteredOptions) {
|
|
33
|
+
return isArrayOfOptionGroups(filteredOptions) ? filteredOptions.some(function (groupOption) {
|
|
34
|
+
var _groupOption$options;
|
|
35
|
+
return ((_groupOption$options = groupOption.options) === null || _groupOption$options === void 0 ? void 0 : _groupOption$options.length) > 0;
|
|
36
|
+
}) : true;
|
|
37
|
+
};
|
|
38
|
+
var canOpenOptions = function canOpenOptions(options, disabled) {
|
|
39
|
+
return !disabled && (options === null || options === void 0 ? void 0 : options.length) > 0 && groupsHaveOptions(options);
|
|
40
|
+
};
|
|
41
|
+
var filterOptionsBySearchValue = function filterOptionsBySearchValue(options, searchValue) {
|
|
42
|
+
if ((options === null || options === void 0 ? void 0 : options.length) > 0) {
|
|
43
|
+
if (isArrayOfOptionGroups(options)) return options.map(function (optionGroup) {
|
|
44
|
+
var group = {
|
|
45
|
+
label: optionGroup.label,
|
|
46
|
+
options: optionGroup.options.filter(function (option) {
|
|
47
|
+
return option.label.toUpperCase().includes(searchValue.toUpperCase());
|
|
48
|
+
})
|
|
49
|
+
};
|
|
50
|
+
return group;
|
|
51
|
+
});else return options.filter(function (option) {
|
|
52
|
+
return option.label.toUpperCase().includes(searchValue.toUpperCase());
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
var getLastOptionIndex = function getLastOptionIndex(options, filteredOptions, searchable, optional, multiple) {
|
|
57
|
+
var last = 0;
|
|
58
|
+
var reducer = function reducer(acc, current) {
|
|
59
|
+
var _current$options;
|
|
60
|
+
return acc + ((_current$options = current.options) === null || _current$options === void 0 ? void 0 : _current$options.length);
|
|
61
|
+
};
|
|
62
|
+
if (searchable && (filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.length) > 0) isArrayOfOptionGroups(filteredOptions) ? last = filteredOptions.reduce(reducer, 0) - 1 : last = filteredOptions.length - 1;else if ((options === null || options === void 0 ? void 0 : options.length) > 0) isArrayOfOptionGroups(options) ? last = options.reduce(reducer, 0) - 1 : last = options.length - 1;
|
|
63
|
+
return optional && !multiple ? last + 1 : last;
|
|
64
|
+
};
|
|
65
|
+
var getSelectedOption = function getSelectedOption(value, options, multiple, optional, optionalItem) {
|
|
66
|
+
var selectedOption = multiple ? [] : {};
|
|
67
|
+
var singleSelectionIndex;
|
|
68
|
+
if (multiple) {
|
|
69
|
+
if ((options === null || options === void 0 ? void 0 : options.length) > 0) {
|
|
70
|
+
options.forEach(function (option) {
|
|
71
|
+
if (isOptionGroup(option)) option.options.forEach(function (singleOption) {
|
|
72
|
+
if (value.includes(singleOption.value) && Array.isArray(selectedOption)) selectedOption.push(singleOption);
|
|
73
|
+
});else if (value.includes(option.value) && Array.isArray(selectedOption)) selectedOption.push(option);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
if (optional && value === "") {
|
|
78
|
+
selectedOption = optionalItem;
|
|
79
|
+
singleSelectionIndex = 0;
|
|
80
|
+
} else if ((options === null || options === void 0 ? void 0 : options.length) > 0) {
|
|
81
|
+
var group_index = 0;
|
|
82
|
+
options.some(function (option, index) {
|
|
83
|
+
if (isOptionGroup(option)) {
|
|
84
|
+
option.options.some(function (singleOption) {
|
|
85
|
+
if (singleOption.value === value) {
|
|
86
|
+
selectedOption = singleOption;
|
|
87
|
+
singleSelectionIndex = optional ? group_index + 1 : group_index;
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
group_index++;
|
|
91
|
+
});
|
|
92
|
+
} else if (option.value === value) {
|
|
93
|
+
selectedOption = option;
|
|
94
|
+
singleSelectionIndex = optional ? index + 1 : index;
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
selectedOption: selectedOption,
|
|
102
|
+
singleSelectionIndex: singleSelectionIndex
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
var getSelectedOptionLabel = function getSelectedOptionLabel(placeholder, selectedOption) {
|
|
106
|
+
var _selectedOption$label;
|
|
107
|
+
if (Array.isArray(selectedOption)) return selectedOption.length === 0 ? placeholder : selectedOption.map(function (option) {
|
|
108
|
+
return option.label;
|
|
109
|
+
}).join(", ");else return (_selectedOption$label = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) !== null && _selectedOption$label !== void 0 ? _selectedOption$label : placeholder;
|
|
110
|
+
};
|
|
111
|
+
var notOptionalCheck = function notOptionalCheck(value, multiple, optional) {
|
|
112
|
+
return !optional && (multiple ? value.length === 0 : value === "");
|
|
113
|
+
};
|
|
114
|
+
var useWidth = function useWidth(target) {
|
|
115
|
+
var _useState = (0, _react.useState)(0),
|
|
116
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
117
|
+
width = _useState2[0],
|
|
118
|
+
setWidth = _useState2[1];
|
|
119
|
+
(0, _react.useEffect)(function () {
|
|
120
|
+
if (target != null) {
|
|
121
|
+
setWidth(target.getBoundingClientRect().width);
|
|
122
|
+
var triggerObserver = new ResizeObserver(function (entries) {
|
|
123
|
+
var rect = entries[0].target.getBoundingClientRect();
|
|
124
|
+
setWidth(rect === null || rect === void 0 ? void 0 : rect.width);
|
|
125
|
+
});
|
|
126
|
+
triggerObserver.observe(target);
|
|
127
|
+
return function () {
|
|
128
|
+
triggerObserver.unobserve(target);
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
}, [target]);
|
|
132
|
+
return width;
|
|
133
|
+
};
|
|
134
|
+
var DxcSelect = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
135
|
+
var _ref4;
|
|
136
|
+
var label = _ref.label,
|
|
137
|
+
_ref$name = _ref.name,
|
|
138
|
+
name = _ref$name === void 0 ? "" : _ref$name,
|
|
139
|
+
defaultValue = _ref.defaultValue,
|
|
140
|
+
value = _ref.value,
|
|
141
|
+
options = _ref.options,
|
|
142
|
+
helperText = _ref.helperText,
|
|
143
|
+
_ref$placeholder = _ref.placeholder,
|
|
144
|
+
placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
|
|
145
|
+
_ref$disabled = _ref.disabled,
|
|
146
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
147
|
+
_ref$optional = _ref.optional,
|
|
148
|
+
optional = _ref$optional === void 0 ? false : _ref$optional,
|
|
149
|
+
_ref$searchable = _ref.searchable,
|
|
150
|
+
searchable = _ref$searchable === void 0 ? false : _ref$searchable,
|
|
151
|
+
_ref$multiple = _ref.multiple,
|
|
152
|
+
multiple = _ref$multiple === void 0 ? false : _ref$multiple,
|
|
153
|
+
onChange = _ref.onChange,
|
|
154
|
+
onBlur = _ref.onBlur,
|
|
155
|
+
error = _ref.error,
|
|
156
|
+
margin = _ref.margin,
|
|
157
|
+
_ref$size = _ref.size,
|
|
158
|
+
size = _ref$size === void 0 ? "medium" : _ref$size,
|
|
159
|
+
_ref$tabIndex = _ref.tabIndex,
|
|
160
|
+
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
161
|
+
var _useState3 = (0, _react.useState)("select-".concat((0, _uuid.v4)())),
|
|
162
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 1),
|
|
163
|
+
selectId = _useState4[0];
|
|
164
|
+
var selectLabelId = "label-".concat(selectId);
|
|
165
|
+
var searchableInputId = "searchable-input-".concat(selectId);
|
|
166
|
+
var errorId = "error-".concat(selectId);
|
|
167
|
+
var optionsListId = "".concat(selectId, "-listbox");
|
|
168
|
+
var _useState5 = (0, _react.useState)(defaultValue !== null && defaultValue !== void 0 ? defaultValue : multiple ? [] : ""),
|
|
169
|
+
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
170
|
+
innerValue = _useState6[0],
|
|
171
|
+
setInnerValue = _useState6[1];
|
|
172
|
+
var _useState7 = (0, _react.useState)(""),
|
|
173
|
+
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
|
174
|
+
searchValue = _useState8[0],
|
|
175
|
+
setSearchValue = _useState8[1];
|
|
176
|
+
var _useState9 = (0, _react.useState)(-1),
|
|
177
|
+
_useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
|
|
178
|
+
visualFocusIndex = _useState10[0],
|
|
179
|
+
changeVisualFocusIndex = _useState10[1];
|
|
180
|
+
var _useState11 = (0, _react.useState)(false),
|
|
181
|
+
_useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
|
|
182
|
+
isOpen = _useState12[0],
|
|
183
|
+
changeIsOpen = _useState12[1];
|
|
184
|
+
var selectRef = (0, _react.useRef)(null);
|
|
185
|
+
var selectSearchInputRef = (0, _react.useRef)(null);
|
|
186
|
+
var selectedOptionLabelRef = (0, _react.useRef)(null);
|
|
187
|
+
var width = useWidth(selectRef.current);
|
|
188
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
189
|
+
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
190
|
+
var optionalItem = {
|
|
191
|
+
label: placeholder,
|
|
192
|
+
value: ""
|
|
193
|
+
};
|
|
194
|
+
var filteredOptions = (0, _react.useMemo)(function () {
|
|
195
|
+
return filterOptionsBySearchValue(options, searchValue);
|
|
196
|
+
}, [options, searchValue]);
|
|
197
|
+
var lastOptionIndex = (0, _react.useMemo)(function () {
|
|
198
|
+
return getLastOptionIndex(options, filteredOptions, searchable, optional, multiple);
|
|
199
|
+
}, [options, filteredOptions, searchable, optional, multiple]);
|
|
200
|
+
var _useMemo = (0, _react.useMemo)(function () {
|
|
201
|
+
return getSelectedOption(value !== null && value !== void 0 ? value : innerValue, options, multiple, optional, optionalItem);
|
|
202
|
+
}, [value, innerValue, options, multiple, optional, optionalItem]),
|
|
203
|
+
selectedOption = _useMemo.selectedOption,
|
|
204
|
+
singleSelectionIndex = _useMemo.singleSelectionIndex;
|
|
205
|
+
var openOptions = function openOptions() {
|
|
206
|
+
if (!isOpen && canOpenOptions(options, disabled)) changeIsOpen(true);
|
|
207
|
+
};
|
|
208
|
+
var closeOptions = function closeOptions() {
|
|
209
|
+
if (isOpen) {
|
|
210
|
+
changeIsOpen(false);
|
|
211
|
+
changeVisualFocusIndex(-1);
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
var handleSelectChangeValue = function handleSelectChangeValue(newOption) {
|
|
215
|
+
var newValue;
|
|
216
|
+
if (multiple) {
|
|
217
|
+
var _ref2, _ref3;
|
|
218
|
+
if ((value !== null && value !== void 0 ? value : innerValue).includes(newOption.value)) newValue = ((_ref2 = value && Array.isArray(value) && value) !== null && _ref2 !== void 0 ? _ref2 : innerValue && Array.isArray(innerValue) && innerValue).filter(function (optionVal) {
|
|
219
|
+
return optionVal !== newOption.value;
|
|
220
|
+
});else newValue = [].concat((0, _toConsumableArray2["default"])((_ref3 = value && Array.isArray(value) && value) !== null && _ref3 !== void 0 ? _ref3 : innerValue && Array.isArray(innerValue) && innerValue), [newOption.value]);
|
|
221
|
+
} else newValue = newOption.value;
|
|
222
|
+
value !== null && value !== void 0 ? value : setInnerValue(newValue);
|
|
223
|
+
notOptionalCheck(newValue, multiple, optional) ? onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
224
|
+
value: newValue,
|
|
225
|
+
error: translatedLabels.formFields.requiredValueErrorMessage
|
|
226
|
+
}) : onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
227
|
+
value: newValue
|
|
228
|
+
});
|
|
229
|
+
};
|
|
230
|
+
var handleSelectOnClick = function handleSelectOnClick() {
|
|
231
|
+
searchable && selectSearchInputRef.current.focus();
|
|
232
|
+
if (isOpen) {
|
|
233
|
+
closeOptions();
|
|
234
|
+
setSearchValue("");
|
|
235
|
+
} else openOptions();
|
|
236
|
+
};
|
|
237
|
+
var handleSelectOnFocus = function handleSelectOnFocus(event) {
|
|
238
|
+
if (!event.currentTarget.contains(event.relatedTarget)) searchable && selectSearchInputRef.current.focus();
|
|
239
|
+
};
|
|
240
|
+
var handleSelectOnBlur = function handleSelectOnBlur(event) {
|
|
241
|
+
// focus leaves container (outside, not to a child)
|
|
242
|
+
if (!event.currentTarget.contains(event.relatedTarget)) {
|
|
243
|
+
closeOptions();
|
|
244
|
+
setSearchValue("");
|
|
245
|
+
var currentValue = value !== null && value !== void 0 ? value : innerValue;
|
|
246
|
+
notOptionalCheck(currentValue, multiple, optional) ? onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
247
|
+
value: currentValue,
|
|
248
|
+
error: translatedLabels.formFields.requiredValueErrorMessage
|
|
249
|
+
}) : onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
250
|
+
value: currentValue
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
var handleSelectOnKeyDown = function handleSelectOnKeyDown(event) {
|
|
255
|
+
switch (event.key) {
|
|
256
|
+
case "Down":
|
|
257
|
+
case "ArrowDown":
|
|
258
|
+
event.preventDefault();
|
|
259
|
+
singleSelectionIndex !== undefined && (!isOpen || visualFocusIndex === -1 && singleSelectionIndex > -1 && singleSelectionIndex <= lastOptionIndex) ? changeVisualFocusIndex(singleSelectionIndex) : changeVisualFocusIndex(function (visualFocusIndex) {
|
|
260
|
+
if (visualFocusIndex < lastOptionIndex) return visualFocusIndex + 1;else if (visualFocusIndex === lastOptionIndex) return 0;
|
|
261
|
+
});
|
|
262
|
+
openOptions();
|
|
263
|
+
break;
|
|
264
|
+
case "Up":
|
|
265
|
+
case "ArrowUp":
|
|
266
|
+
event.preventDefault();
|
|
267
|
+
singleSelectionIndex !== undefined && (!isOpen || visualFocusIndex === -1 && singleSelectionIndex > -1 && singleSelectionIndex <= lastOptionIndex) ? changeVisualFocusIndex(singleSelectionIndex) : changeVisualFocusIndex(function (visualFocusIndex) {
|
|
268
|
+
return visualFocusIndex === 0 || visualFocusIndex === -1 ? lastOptionIndex : visualFocusIndex - 1;
|
|
269
|
+
});
|
|
270
|
+
openOptions();
|
|
271
|
+
break;
|
|
272
|
+
case "Esc":
|
|
273
|
+
case "Escape":
|
|
274
|
+
event.preventDefault();
|
|
275
|
+
closeOptions();
|
|
276
|
+
setSearchValue("");
|
|
277
|
+
break;
|
|
278
|
+
case "Enter":
|
|
279
|
+
if (isOpen && visualFocusIndex >= 0) {
|
|
280
|
+
var accLength = optional && !multiple ? 1 : 0;
|
|
281
|
+
if (searchable) {
|
|
282
|
+
if (filteredOptions.length > 0) {
|
|
283
|
+
if (optional && !multiple && visualFocusIndex === 0 && groupsHaveOptions(filteredOptions)) handleSelectChangeValue(optionalItem);else isArrayOfOptionGroups(filteredOptions) ? groupsHaveOptions(filteredOptions) && filteredOptions.some(function (groupOption) {
|
|
284
|
+
var groupLength = accLength + groupOption.options.length;
|
|
285
|
+
groupLength > visualFocusIndex && handleSelectChangeValue(groupOption.options[visualFocusIndex - accLength]);
|
|
286
|
+
accLength = groupLength;
|
|
287
|
+
return groupLength > visualFocusIndex;
|
|
288
|
+
}) : handleSelectChangeValue(filteredOptions[visualFocusIndex - accLength]);
|
|
289
|
+
}
|
|
290
|
+
} else {
|
|
291
|
+
if (optional && !multiple && visualFocusIndex === 0) handleSelectChangeValue(optionalItem);else isArrayOfOptionGroups(options) ? options.some(function (groupOption) {
|
|
292
|
+
var groupLength = accLength + groupOption.options.length;
|
|
293
|
+
groupLength > visualFocusIndex && handleSelectChangeValue(groupOption.options[visualFocusIndex - accLength]);
|
|
294
|
+
accLength = groupLength;
|
|
295
|
+
return groupLength > visualFocusIndex;
|
|
296
|
+
}) : handleSelectChangeValue(options[visualFocusIndex - accLength]);
|
|
297
|
+
}
|
|
298
|
+
!multiple && closeOptions();
|
|
299
|
+
setSearchValue("");
|
|
300
|
+
}
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
var handleSearchIOnChange = function handleSearchIOnChange(event) {
|
|
305
|
+
setSearchValue(event.target.value);
|
|
306
|
+
changeVisualFocusIndex(-1);
|
|
307
|
+
openOptions();
|
|
308
|
+
};
|
|
309
|
+
var handleClearOptionsActionOnClick = function handleClearOptionsActionOnClick(event) {
|
|
310
|
+
event.stopPropagation();
|
|
311
|
+
value !== null && value !== void 0 ? value : setInnerValue([]);
|
|
312
|
+
!optional ? onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
313
|
+
value: [],
|
|
314
|
+
error: translatedLabels.formFields.requiredValueErrorMessage
|
|
315
|
+
}) : onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
316
|
+
value: []
|
|
317
|
+
});
|
|
318
|
+
};
|
|
319
|
+
var handleClearSearchActionOnClick = function handleClearSearchActionOnClick(event) {
|
|
320
|
+
event.stopPropagation();
|
|
321
|
+
setSearchValue("");
|
|
322
|
+
};
|
|
323
|
+
var handleOptionOnClick = (0, _react.useCallback)(function (option) {
|
|
324
|
+
handleSelectChangeValue(option);
|
|
325
|
+
!multiple && closeOptions();
|
|
326
|
+
setSearchValue("");
|
|
327
|
+
}, [handleSelectChangeValue, closeOptions, multiple]);
|
|
328
|
+
(0, _react.useEffect)(function () {
|
|
329
|
+
if ((selectedOptionLabelRef === null || selectedOptionLabelRef === void 0 ? void 0 : selectedOptionLabelRef.current) != null) {
|
|
330
|
+
if ((selectedOptionLabelRef === null || selectedOptionLabelRef === void 0 ? void 0 : selectedOptionLabelRef.current.scrollWidth) > (selectedOptionLabelRef === null || selectedOptionLabelRef === void 0 ? void 0 : selectedOptionLabelRef.current.clientWidth)) selectedOptionLabelRef.current.title = getSelectedOptionLabel(placeholder, selectedOption);else selectedOptionLabelRef.current.title = "";
|
|
331
|
+
}
|
|
332
|
+
}, [placeholder, selectedOption]);
|
|
333
|
+
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
334
|
+
theme: colorsTheme.select
|
|
335
|
+
}, /*#__PURE__*/_react["default"].createElement(SelectContainer, {
|
|
336
|
+
margin: margin,
|
|
337
|
+
size: size,
|
|
338
|
+
ref: ref
|
|
339
|
+
}, label && /*#__PURE__*/_react["default"].createElement(Label, {
|
|
340
|
+
id: selectLabelId,
|
|
341
|
+
disabled: disabled,
|
|
342
|
+
onClick: function onClick() {
|
|
343
|
+
selectRef.current.focus();
|
|
344
|
+
},
|
|
345
|
+
helperText: helperText,
|
|
346
|
+
htmlFor: searchable ? searchableInputId : undefined
|
|
347
|
+
}, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, translatedLabels.formFields.optionalLabel)), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
|
|
348
|
+
disabled: disabled
|
|
349
|
+
}, helperText), /*#__PURE__*/_react["default"].createElement(Popover.Root, {
|
|
350
|
+
open: isOpen
|
|
351
|
+
}, /*#__PURE__*/_react["default"].createElement(Popover.Trigger, {
|
|
352
|
+
asChild: true,
|
|
353
|
+
type: undefined
|
|
354
|
+
}, /*#__PURE__*/_react["default"].createElement(Select, {
|
|
355
|
+
id: selectId,
|
|
356
|
+
disabled: disabled,
|
|
357
|
+
error: error,
|
|
358
|
+
onBlur: handleSelectOnBlur,
|
|
359
|
+
onClick: handleSelectOnClick,
|
|
360
|
+
onFocus: handleSelectOnFocus,
|
|
361
|
+
onKeyDown: handleSelectOnKeyDown,
|
|
362
|
+
ref: selectRef,
|
|
363
|
+
tabIndex: disabled ? -1 : tabIndex,
|
|
364
|
+
role: "combobox",
|
|
365
|
+
"aria-controls": optionsListId,
|
|
366
|
+
"aria-disabled": disabled,
|
|
367
|
+
"aria-expanded": isOpen,
|
|
368
|
+
"aria-haspopup": "listbox",
|
|
369
|
+
"aria-labelledby": label ? selectLabelId : undefined,
|
|
370
|
+
"aria-activedescendant": visualFocusIndex >= 0 ? "option-".concat(visualFocusIndex) : undefined,
|
|
371
|
+
"aria-invalid": error ? true : false,
|
|
372
|
+
"aria-errormessage": error ? errorId : undefined,
|
|
373
|
+
"aria-required": !disabled && !optional
|
|
374
|
+
}, multiple && Array.isArray(selectedOption) && selectedOption.length > 0 && /*#__PURE__*/_react["default"].createElement(SelectionIndicator, null, /*#__PURE__*/_react["default"].createElement(SelectionNumber, {
|
|
375
|
+
disabled: disabled
|
|
376
|
+
}, selectedOption.length), /*#__PURE__*/_react["default"].createElement(ClearOptionsAction, {
|
|
377
|
+
disabled: disabled,
|
|
378
|
+
onMouseDown: function onMouseDown(event) {
|
|
379
|
+
// Avoid input to lose focus when pressed
|
|
380
|
+
event.preventDefault();
|
|
381
|
+
},
|
|
382
|
+
onClick: handleClearOptionsActionOnClick,
|
|
383
|
+
tabIndex: -1,
|
|
384
|
+
title: translatedLabels.select.actionClearSelectionTitle,
|
|
385
|
+
"aria-label": translatedLabels.select.actionClearSelectionTitle
|
|
386
|
+
}, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
387
|
+
icon: "clear"
|
|
388
|
+
}))), /*#__PURE__*/_react["default"].createElement(SearchableValueContainer, null, /*#__PURE__*/_react["default"].createElement(ValueInput, {
|
|
389
|
+
name: name,
|
|
390
|
+
disabled: disabled,
|
|
391
|
+
value: multiple ? ((_ref4 = value && Array.isArray(value) && value) !== null && _ref4 !== void 0 ? _ref4 : innerValue && Array.isArray(innerValue) && innerValue).join(",") : value !== null && value !== void 0 ? value : innerValue,
|
|
392
|
+
readOnly: true,
|
|
393
|
+
"aria-hidden": "true"
|
|
394
|
+
}), searchable && /*#__PURE__*/_react["default"].createElement(SearchInput, {
|
|
395
|
+
id: searchableInputId,
|
|
396
|
+
value: searchValue,
|
|
397
|
+
disabled: disabled,
|
|
398
|
+
onChange: handleSearchIOnChange,
|
|
399
|
+
ref: selectSearchInputRef,
|
|
400
|
+
autoComplete: "nope",
|
|
401
|
+
autoCorrect: "nope",
|
|
402
|
+
size: 1
|
|
403
|
+
}), (!searchable || searchValue === "") && /*#__PURE__*/_react["default"].createElement(SelectedOption, {
|
|
404
|
+
disabled: disabled,
|
|
405
|
+
atBackground: (multiple ? (value !== null && value !== void 0 ? value : innerValue).length === 0 : !(value !== null && value !== void 0 ? value : innerValue)) || searchable && isOpen
|
|
406
|
+
}, /*#__PURE__*/_react["default"].createElement(SelectedOptionLabel, {
|
|
407
|
+
ref: selectedOptionLabelRef
|
|
408
|
+
}, getSelectedOptionLabel(placeholder, selectedOption)))), !disabled && error && /*#__PURE__*/_react["default"].createElement(ErrorIcon, null, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
409
|
+
icon: "filled_error"
|
|
410
|
+
})), searchable && searchValue.length > 0 && /*#__PURE__*/_react["default"].createElement(ClearSearchAction, {
|
|
411
|
+
onMouseDown: function onMouseDown(event) {
|
|
412
|
+
// Avoid input to lose focus
|
|
413
|
+
event.preventDefault();
|
|
414
|
+
},
|
|
415
|
+
onClick: handleClearSearchActionOnClick,
|
|
416
|
+
tabIndex: -1,
|
|
417
|
+
title: translatedLabels.select.actionClearSearchTitle,
|
|
418
|
+
"aria-label": translatedLabels.select.actionClearSearchTitle
|
|
419
|
+
}, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
420
|
+
icon: "clear"
|
|
421
|
+
})), /*#__PURE__*/_react["default"].createElement(CollapseIndicator, {
|
|
422
|
+
disabled: disabled
|
|
423
|
+
}, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
424
|
+
icon: isOpen ? "keyboard_arrow_up" : "keyboard_arrow_down"
|
|
425
|
+
})))), /*#__PURE__*/_react["default"].createElement(Popover.Portal, null, /*#__PURE__*/_react["default"].createElement(Popover.Content, {
|
|
426
|
+
sideOffset: 4,
|
|
427
|
+
style: {
|
|
428
|
+
zIndex: "2147483647"
|
|
429
|
+
},
|
|
430
|
+
onOpenAutoFocus: function onOpenAutoFocus(event) {
|
|
431
|
+
// Avoid select to lose focus when the list is opened
|
|
432
|
+
event.preventDefault();
|
|
433
|
+
},
|
|
434
|
+
onCloseAutoFocus: function onCloseAutoFocus(event) {
|
|
435
|
+
// Avoid select to lose focus when the list is closed
|
|
436
|
+
event.preventDefault();
|
|
437
|
+
}
|
|
438
|
+
}, /*#__PURE__*/_react["default"].createElement(_Listbox["default"], {
|
|
439
|
+
id: optionsListId,
|
|
440
|
+
currentValue: value !== null && value !== void 0 ? value : innerValue,
|
|
441
|
+
options: searchable ? filteredOptions : options,
|
|
442
|
+
visualFocusIndex: visualFocusIndex,
|
|
443
|
+
lastOptionIndex: lastOptionIndex,
|
|
444
|
+
multiple: multiple,
|
|
445
|
+
optional: optional,
|
|
446
|
+
optionalItem: optionalItem,
|
|
447
|
+
searchable: searchable,
|
|
448
|
+
handleOptionOnClick: handleOptionOnClick,
|
|
449
|
+
styles: {
|
|
450
|
+
width: width
|
|
451
|
+
}
|
|
452
|
+
})))), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
|
|
453
|
+
id: errorId,
|
|
454
|
+
role: "alert",
|
|
455
|
+
"aria-live": error ? "assertive" : "off"
|
|
456
|
+
}, error)));
|
|
457
|
+
});
|
|
458
|
+
var sizes = {
|
|
459
|
+
small: "240px",
|
|
460
|
+
medium: "360px",
|
|
461
|
+
large: "480px",
|
|
462
|
+
fillParent: "100%"
|
|
463
|
+
};
|
|
464
|
+
var calculateWidth = function calculateWidth(margin, size) {
|
|
465
|
+
return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
|
|
466
|
+
};
|
|
467
|
+
var SelectContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
468
|
+
return calculateWidth(props.margin, props.size);
|
|
469
|
+
}, function (props) {
|
|
470
|
+
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
471
|
+
}, function (props) {
|
|
472
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
473
|
+
}, function (props) {
|
|
474
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
|
|
475
|
+
}, function (props) {
|
|
476
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
|
|
477
|
+
}, function (props) {
|
|
478
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
479
|
+
});
|
|
480
|
+
var Label = _styledComponents["default"].label(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n cursor: default;\n ", "\n"])), function (props) {
|
|
481
|
+
return props.disabled ? props.theme.disabledColor : props.theme.labelFontColor;
|
|
482
|
+
}, function (props) {
|
|
483
|
+
return props.theme.fontFamily;
|
|
484
|
+
}, function (props) {
|
|
485
|
+
return props.theme.labelFontSize;
|
|
486
|
+
}, function (props) {
|
|
487
|
+
return props.theme.labelFontStyle;
|
|
488
|
+
}, function (props) {
|
|
489
|
+
return props.theme.labelFontWeight;
|
|
490
|
+
}, function (props) {
|
|
491
|
+
return props.theme.labelLineHeight;
|
|
492
|
+
}, function (props) {
|
|
493
|
+
return !props.helperText && "margin-bottom: 0.25rem";
|
|
494
|
+
});
|
|
495
|
+
var OptionalLabel = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"])), function (props) {
|
|
496
|
+
return props.theme.optionalLabelFontWeight;
|
|
497
|
+
});
|
|
498
|
+
var HelperText = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n margin-bottom: 0.25rem;\n"])), function (props) {
|
|
499
|
+
return props.disabled ? props.theme.disabledColor : props.theme.helperTextFontColor;
|
|
500
|
+
}, function (props) {
|
|
501
|
+
return props.theme.fontFamily;
|
|
502
|
+
}, function (props) {
|
|
503
|
+
return props.theme.helperTextFontSize;
|
|
504
|
+
}, function (props) {
|
|
505
|
+
return props.theme.helperTextFontStyle;
|
|
506
|
+
}, function (props) {
|
|
507
|
+
return props.theme.helperTextFontWeight;
|
|
508
|
+
}, function (props) {
|
|
509
|
+
return props.theme.helperTextLineHeight;
|
|
510
|
+
});
|
|
511
|
+
var Select = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n position: relative;\n align-items: center;\n height: calc(2.5rem - 2px);\n padding: 0 0.5rem;\n outline: none;\n ", ";\n box-shadow: 0 0 0 2px transparent;\n border-radius: 4px;\n border: 1px solid\n ", ";\n ", "\n ", ";\n\n ", ";\n"])), function (props) {
|
|
512
|
+
return props.disabled && "background-color: ".concat(props.theme.disabledInputBackgroundColor);
|
|
513
|
+
}, function (props) {
|
|
514
|
+
return props.disabled ? props.theme.disabledInputBorderColor : props.theme.enabledInputBorderColor;
|
|
515
|
+
}, function (props) {
|
|
516
|
+
return props.error && !props.disabled && "border-color: transparent;\n box-shadow: 0 0 0 2px ".concat(props.theme.errorInputBorderColor, ";\n ");
|
|
517
|
+
}, function (props) {
|
|
518
|
+
return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
|
|
519
|
+
}, function (props) {
|
|
520
|
+
return !props.disabled && "\n &:hover {\n border-color: ".concat(props.error ? "transparent" : props.theme.hoverInputBorderColor, ";\n ").concat(props.error && "box-shadow: 0 0 0 2px ".concat(props.theme.hoverInputErrorBorderColor, ";"), "\n }\n &:focus-within {\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(props.theme.focusInputBorderColor, ";\n }\n ");
|
|
521
|
+
});
|
|
522
|
+
var SelectionIndicator = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n border: 1px solid ", ";\n border-radius: 2px;\n max-height: 22px;\n width: 46px;\n"])), function (props) {
|
|
523
|
+
return props.theme.selectionIndicatorBorderColor;
|
|
524
|
+
});
|
|
525
|
+
var SelectionNumber = _styledComponents["default"].span(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: 22px;\n height: 22px;\n user-select: none;\n ", ";\n border-right: 1px solid ", ";\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n ", "\n"])), function (props) {
|
|
526
|
+
return !props.disabled && "background-color: ".concat(props.theme.selectionIndicatorBackgroundColor);
|
|
527
|
+
}, function (props) {
|
|
528
|
+
return props.theme.selectionIndicatorBorderColor;
|
|
529
|
+
}, function (props) {
|
|
530
|
+
return props.disabled ? props.theme.disabledColor : props.theme.selectionIndicatorFontColor;
|
|
531
|
+
}, function (props) {
|
|
532
|
+
return props.theme.fontFamily;
|
|
533
|
+
}, function (props) {
|
|
534
|
+
return props.theme.selectionIndicatorFontSize;
|
|
535
|
+
}, function (props) {
|
|
536
|
+
return props.theme.selectionIndicatorFontStyle;
|
|
537
|
+
}, function (props) {
|
|
538
|
+
return props.theme.selectionIndicatorFontWeight;
|
|
539
|
+
}, function (props) {
|
|
540
|
+
return props.disabled ? "cursor: not-allowed;" : "cursor: default;";
|
|
541
|
+
});
|
|
542
|
+
var ClearOptionsAction = _styledComponents["default"].button(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n width: 23px;\n height: 22px;\n border: none;\n padding: 0.25rem;\n ", "\n background-color: ", ";\n color: ", ";\n\n :focus-visible {\n outline: none;\n }\n ", "\n\n font-size:16px;\n"])), function (props) {
|
|
543
|
+
return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
|
|
544
|
+
}, function (props) {
|
|
545
|
+
return props.disabled ? "transparent" : props.theme.enabledSelectionIndicatorActionBackgroundColor;
|
|
546
|
+
}, function (props) {
|
|
547
|
+
return props.disabled ? props.theme.disabledColor : props.theme.enabledSelectionIndicatorActionIconColor;
|
|
548
|
+
}, function (props) {
|
|
549
|
+
return !props.disabled && "\n &:hover {\n background-color: ".concat(props.theme.hoverSelectionIndicatorActionBackgroundColor, ";\n color: ").concat(props.theme.hoverSelectionIndicatorActionIconColor, ";\n }\n &:active {\n background-color: ").concat(props.theme.activeSelectionIndicatorActionBackgroundColor, ";\n color: ").concat(props.theme.activeSelectionIndicatorActionIconColor, ";\n }\n ");
|
|
550
|
+
});
|
|
551
|
+
var SearchableValueContainer = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n display: grid;\n width: 100%;\n"])));
|
|
552
|
+
var SelectedOption = _styledComponents["default"].span(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n grid-area: 1 / 1 / 1 / 1;\n display: inline-flex;\n align-items: center;\n height: calc(2.5rem - 2px);\n padding: 0 0.5rem;\n user-select: none;\n overflow: hidden;\n\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n"])), function (props) {
|
|
553
|
+
if (props.disabled) return props.theme.disabledColor;else if (props.atBackground) return props.theme.placeholderFontColor;else return props.theme.valueFontColor;
|
|
554
|
+
}, function (props) {
|
|
555
|
+
return props.theme.fontFamily;
|
|
556
|
+
}, function (props) {
|
|
557
|
+
return props.theme.valueFontSize;
|
|
558
|
+
}, function (props) {
|
|
559
|
+
return props.theme.valueFontStyle;
|
|
560
|
+
}, function (props) {
|
|
561
|
+
return props.theme.valueFontWeight;
|
|
562
|
+
});
|
|
563
|
+
var SelectedOptionLabel = _styledComponents["default"].span(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"])));
|
|
564
|
+
var ValueInput = _styledComponents["default"].input(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["\n display: none;\n"])));
|
|
565
|
+
var SearchInput = _styledComponents["default"].input(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2["default"])(["\n grid-area: 1 / 1 / 1 / 1;\n height: calc(2.5rem - 2px);\n background: none;\n border: none;\n outline: none;\n padding: 0 0.5rem;\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5em;\n"])), function (props) {
|
|
566
|
+
return props.disabled ? props.theme.disabledColor : props.theme.valueFontColor;
|
|
567
|
+
}, function (props) {
|
|
568
|
+
return props.theme.fontFamily;
|
|
569
|
+
}, function (props) {
|
|
570
|
+
return props.theme.valueFontSize;
|
|
571
|
+
}, function (props) {
|
|
572
|
+
return props.theme.valueFontStyle;
|
|
573
|
+
}, function (props) {
|
|
574
|
+
return props.theme.valueFontWeight;
|
|
575
|
+
});
|
|
576
|
+
var ErrorIcon = _styledComponents["default"].span(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n margin-left: 0.25rem;\n pointer-events: none;\n color: ", ";\n\n font-size: 1.25rem;\n"])), function (props) {
|
|
577
|
+
return props.theme.errorIconColor;
|
|
578
|
+
});
|
|
579
|
+
var Error = _styledComponents["default"].span(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 1.5em;\n color: ", ";\n font-family: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n line-height: 1.5em;\n margin-top: 0.25rem;\n"])), function (props) {
|
|
580
|
+
return props.theme.errorMessageColor;
|
|
581
|
+
}, function (props) {
|
|
582
|
+
return props.theme.fontFamily;
|
|
583
|
+
});
|
|
584
|
+
var CollapseIndicator = _styledComponents["default"].span(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 16px;\n width: 16px;\n padding: 4px;\n margin-left: 0.25rem;\n color: ", ";\n"])), function (props) {
|
|
585
|
+
return props.disabled ? props.theme.disabledColor : props.theme.collapseIndicatorColor;
|
|
586
|
+
});
|
|
587
|
+
var ClearSearchAction = _styledComponents["default"].button(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n font-size: 1rem;\n font-family: ", ";\n border: 1px solid transparent;\n border-radius: 2px;\n padding: 3px;\n margin-left: 0.25rem;\n background-color: ", ";\n color: ", ";\n\n cursor: pointer;\n &:hover {\n background-color: ", ";\n color: ", ";\n }\n &:active {\n background-color: ", ";\n color: ", ";\n }\n font-size: 16px;\n"])), function (props) {
|
|
588
|
+
return props.theme.fontFamily;
|
|
589
|
+
}, function (props) {
|
|
590
|
+
return props.theme.actionBackgroundColor;
|
|
591
|
+
}, function (props) {
|
|
592
|
+
return props.theme.actionIconColor;
|
|
593
|
+
}, function (props) {
|
|
594
|
+
return props.theme.hoverActionBackgroundColor;
|
|
595
|
+
}, function (props) {
|
|
596
|
+
return props.theme.hoverActionIconColor;
|
|
597
|
+
}, function (props) {
|
|
598
|
+
return props.theme.activeActionBackgroundColor;
|
|
599
|
+
}, function (props) {
|
|
600
|
+
return props.theme.activeActionIconColor;
|
|
601
|
+
});
|
|
602
|
+
var _default = exports["default"] = DxcSelect;
|