@sprinklrjs/spaceweb 10.1.0 → 12.14.4
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/allComponentsAndUtilities.d.ts +1 -0
- package/allComponentsAndUtilities.js +2 -1
- package/asyncSelect/asyncSelect.d.ts +4 -2
- package/asyncSelect/asyncSelect.js +43 -108
- package/asyncSelect/groupedAsyncSelect.d.ts +5 -0
- package/asyncSelect/groupedAsyncSelect.js +41 -0
- package/asyncSelect/helpers.d.ts +9 -3
- package/asyncSelect/helpers.js +35 -4
- package/asyncSelect/hooks/useAsyncOptionHandlers.d.ts +17 -12
- package/asyncSelect/hooks/useAsyncOptionHandlers.js +73 -26
- package/asyncSelect/hooks/useAsyncSelect.d.ts +10 -0
- package/asyncSelect/hooks/useAsyncSelect.js +182 -0
- package/asyncSelect/hooks/useResolveSelectedOptions.d.ts +10 -7
- package/asyncSelect/hooks/useResolveSelectedOptions.js +59 -47
- package/asyncSelect/index.d.ts +4 -1
- package/asyncSelect/index.js +8 -0
- package/asyncSelect/types.d.ts +63 -12
- package/avatar/avatar.js +12 -2
- package/avatar/index.d.ts +1 -1
- package/avatar/styled-component.js +7 -22
- package/avatar/types.d.ts +1 -1
- package/badge/styled-component.js +10 -8
- package/banner/banner-item.d.ts +12 -0
- package/banner/banner-item.js +14 -0
- package/banner/banner.d.ts +19 -0
- package/banner/banner.js +56 -0
- package/banner/index.d.ts +5 -0
- package/banner/index.js +14 -0
- package/banner/locale.d.ts +6 -0
- package/banner/locale.js +2 -0
- package/banner/package.json +4 -0
- package/banner/styled-component.d.ts +6 -0
- package/banner/styled-component.js +39 -0
- package/banner/types.d.ts +26 -0
- package/banner/types.js +2 -0
- package/breadcrumb/breadcrumb-item.d.ts +7 -0
- package/breadcrumb/breadcrumb-item.js +41 -0
- package/breadcrumb/breadcrumb.d.ts +7 -0
- package/breadcrumb/breadcrumb.js +29 -0
- package/breadcrumb/index.d.ts +4 -0
- package/breadcrumb/index.js +17 -0
- package/breadcrumb/package.json +4 -0
- package/breadcrumb/styled-components.d.ts +7 -0
- package/breadcrumb/styled-components.js +19 -0
- package/breadcrumb/types.d.ts +38 -0
- package/breadcrumb/types.js +2 -0
- package/button/Button.d.ts +3 -3
- package/button/Button.js +14 -2
- package/button/IconButton/IconButton.d.ts +2 -4
- package/button/IconButton/IconButton.js +5 -2
- package/button/IconButton/types.d.ts +10 -1
- package/button/basewebAdapter.d.ts +9 -6
- package/button/basewebAdapter.js +1 -1
- package/button/styled-components.js +30 -25
- package/button/types.d.ts +4 -1
- package/button-group/ButtonGroup.d.ts +1 -0
- package/button-group/ButtonGroup.js +9 -5
- package/button-group/StatefulButtonGroup.d.ts +1 -0
- package/button-group/index.d.ts +1 -2
- package/button-group/index.js +1 -5
- package/button-group/styled-components.d.ts +34 -0
- package/button-group/styled-components.js +60 -12
- package/button-group/types.d.ts +3 -0
- package/checkbox/basewebAdapters.d.ts +5 -2
- package/checkbox/basewebAdapters.js +9 -2
- package/checkbox/index.d.ts +1 -1
- package/checkbox/index.js +1 -2
- package/checkbox/styled-components.js +1 -1
- package/checkbox/types.d.ts +15 -8
- package/color-picker/ColorPalette.d.ts +9 -0
- package/color-picker/ColorPalette.js +26 -0
- package/color-picker/ColorPicker.d.ts +3 -0
- package/color-picker/ColorPicker.js +35 -0
- package/color-picker/Swatch.d.ts +12 -0
- package/color-picker/Swatch.js +40 -0
- package/color-picker/colors.d.ts +1 -0
- package/color-picker/colors.js +109 -0
- package/color-picker/getContrastRatio.d.ts +1 -0
- package/color-picker/getContrastRatio.js +23 -0
- package/color-picker/index.d.ts +3 -0
- package/color-picker/index.js +7 -0
- package/color-picker/locale.d.ts +3 -0
- package/color-picker/locale.js +2 -0
- package/color-picker/package.json +4 -0
- package/color-picker/styled-component.d.ts +1 -0
- package/color-picker/styled-component.js +5 -0
- package/color-picker/types.d.ts +15 -0
- package/color-picker/types.js +2 -0
- package/currency/Currency.d.ts +3 -0
- package/currency/Currency.js +14 -0
- package/currency/constants.d.ts +3 -0
- package/currency/constants.js +8 -0
- package/currency/index.d.ts +5 -0
- package/currency/index.js +12 -0
- package/currency/package.json +4 -0
- package/currency/types.d.ts +7 -0
- package/currency/types.js +2 -0
- package/currency/useCurrency.d.ts +2 -0
- package/currency/useCurrency.js +12 -0
- package/currency/utils.d.ts +8 -0
- package/currency/utils.js +11 -0
- package/date-input/Before.d.ts +4 -2
- package/date-input/Before.js +4 -4
- package/date-input/CalendarIconButton.js +7 -1
- package/date-input/DateInput.d.ts +1 -1
- package/date-input/DateInput.js +47 -26
- package/date-input/styled-components.d.ts +2 -2
- package/date-input/styled-components.js +10 -8
- package/date-input/types.d.ts +4 -2
- package/date-picker/Calendar.d.ts +1 -1
- package/date-picker/Calendar.js +16 -6
- package/date-picker/DateInput.d.ts +3 -2
- package/date-picker/DateInput.js +19 -17
- package/date-picker/DatePickerContent.d.ts +9 -3
- package/date-picker/DatePickerContent.js +59 -8
- package/date-picker/DatePickerInput.js +13 -16
- package/date-picker/DateTimeContainer.d.ts +4 -2
- package/date-picker/DateTimeContainer.js +5 -5
- package/date-picker/StatelessDatePicker.d.ts +1 -1
- package/date-picker/StatelessDatePicker.js +40 -20
- package/date-picker/TimeInput.d.ts +5 -2
- package/date-picker/TimeInput.js +4 -2
- package/date-picker/index.d.ts +1 -0
- package/date-picker/index.js +3 -1
- package/date-picker/locale.d.ts +2 -0
- package/date-picker/stateful-container.d.ts +1 -1
- package/date-picker/stateful-container.js +11 -8
- package/date-picker/styled-components.d.ts +0 -1
- package/date-picker/styled-components.js +54 -27
- package/date-picker/types.d.ts +10 -1
- package/date-picker/utils.d.ts +10 -7
- package/date-picker/utils.js +12 -4
- package/date-time/DateTime.d.ts +3 -0
- package/date-time/DateTime.js +12 -0
- package/date-time/index.d.ts +3 -0
- package/date-time/index.js +9 -0
- package/date-time/package.json +4 -0
- package/date-time/types.d.ts +21 -0
- package/date-time/types.js +18 -0
- package/date-time/useDateTime.d.ts +2 -0
- package/date-time/useDateTime.js +13 -0
- package/date-time/variants.d.ts +4 -0
- package/date-time/variants.js +87 -0
- package/esm/allComponentsAndUtilities.d.ts +1 -0
- package/esm/allComponentsAndUtilities.js +2 -0
- package/esm/asyncSelect/asyncSelect.d.ts +4 -2
- package/esm/asyncSelect/asyncSelect.js +46 -111
- package/esm/asyncSelect/groupedAsyncSelect.d.ts +5 -0
- package/esm/asyncSelect/groupedAsyncSelect.js +37 -0
- package/esm/asyncSelect/helpers.d.ts +9 -3
- package/esm/asyncSelect/helpers.js +31 -3
- package/esm/asyncSelect/hooks/useAsyncOptionHandlers.d.ts +17 -12
- package/esm/asyncSelect/hooks/useAsyncOptionHandlers.js +76 -29
- package/esm/asyncSelect/hooks/useAsyncSelect.d.ts +10 -0
- package/esm/asyncSelect/hooks/useAsyncSelect.js +178 -0
- package/esm/asyncSelect/hooks/useResolveSelectedOptions.d.ts +10 -7
- package/esm/asyncSelect/hooks/useResolveSelectedOptions.js +62 -50
- package/esm/asyncSelect/index.d.ts +4 -1
- package/esm/asyncSelect/index.js +3 -0
- package/esm/asyncSelect/types.d.ts +63 -12
- package/esm/avatar/avatar.js +12 -2
- package/esm/avatar/index.d.ts +1 -1
- package/esm/avatar/styled-component.js +7 -22
- package/esm/avatar/types.d.ts +1 -1
- package/esm/badge/styled-component.js +10 -8
- package/esm/banner/banner-item.d.ts +12 -0
- package/esm/banner/banner-item.js +12 -0
- package/esm/banner/banner.d.ts +19 -0
- package/esm/banner/banner.js +54 -0
- package/esm/banner/index.d.ts +5 -0
- package/esm/banner/index.js +3 -0
- package/esm/banner/locale.d.ts +6 -0
- package/esm/banner/locale.js +1 -0
- package/esm/banner/styled-component.d.ts +6 -0
- package/esm/banner/styled-component.js +35 -0
- package/esm/banner/types.d.ts +26 -0
- package/esm/banner/types.js +1 -0
- package/esm/breadcrumb/breadcrumb-item.d.ts +7 -0
- package/esm/breadcrumb/breadcrumb-item.js +39 -0
- package/esm/breadcrumb/breadcrumb.d.ts +7 -0
- package/esm/breadcrumb/breadcrumb.js +27 -0
- package/esm/breadcrumb/index.d.ts +4 -0
- package/esm/breadcrumb/index.js +3 -0
- package/esm/breadcrumb/styled-components.d.ts +7 -0
- package/esm/breadcrumb/styled-components.js +15 -0
- package/esm/breadcrumb/types.d.ts +38 -0
- package/esm/breadcrumb/types.js +1 -0
- package/esm/button/Button.d.ts +3 -3
- package/esm/button/Button.js +14 -2
- package/esm/button/IconButton/IconButton.d.ts +2 -4
- package/esm/button/IconButton/IconButton.js +5 -2
- package/esm/button/IconButton/types.d.ts +10 -1
- package/esm/button/basewebAdapter.d.ts +9 -6
- package/esm/button/basewebAdapter.js +1 -1
- package/esm/button/styled-components.js +30 -25
- package/esm/button/types.d.ts +4 -1
- package/esm/button-group/ButtonGroup.d.ts +1 -0
- package/esm/button-group/ButtonGroup.js +9 -5
- package/esm/button-group/StatefulButtonGroup.d.ts +1 -0
- package/esm/button-group/index.d.ts +1 -2
- package/esm/button-group/index.js +0 -1
- package/esm/button-group/styled-components.d.ts +34 -0
- package/esm/button-group/styled-components.js +58 -11
- package/esm/button-group/types.d.ts +3 -0
- package/esm/checkbox/basewebAdapters.d.ts +5 -2
- package/esm/checkbox/basewebAdapters.js +9 -2
- package/esm/checkbox/index.d.ts +1 -1
- package/esm/checkbox/index.js +1 -1
- package/esm/checkbox/styled-components.js +1 -1
- package/esm/checkbox/types.d.ts +15 -8
- package/esm/color-picker/ColorPalette.d.ts +9 -0
- package/esm/color-picker/ColorPalette.js +22 -0
- package/esm/color-picker/ColorPicker.d.ts +3 -0
- package/esm/color-picker/ColorPicker.js +31 -0
- package/esm/color-picker/Swatch.d.ts +12 -0
- package/esm/color-picker/Swatch.js +37 -0
- package/esm/color-picker/colors.d.ts +1 -0
- package/esm/color-picker/colors.js +106 -0
- package/esm/color-picker/getContrastRatio.d.ts +1 -0
- package/esm/color-picker/getContrastRatio.js +19 -0
- package/esm/color-picker/index.d.ts +3 -0
- package/esm/color-picker/index.js +2 -0
- package/esm/color-picker/locale.d.ts +3 -0
- package/esm/color-picker/locale.js +1 -0
- package/esm/color-picker/styled-component.d.ts +1 -0
- package/esm/color-picker/styled-component.js +2 -0
- package/esm/color-picker/types.d.ts +15 -0
- package/esm/color-picker/types.js +1 -0
- package/esm/currency/Currency.d.ts +3 -0
- package/esm/currency/Currency.js +10 -0
- package/esm/currency/constants.d.ts +3 -0
- package/esm/currency/constants.js +5 -0
- package/esm/currency/index.d.ts +5 -0
- package/esm/currency/index.js +5 -0
- package/esm/currency/types.d.ts +7 -0
- package/esm/currency/types.js +1 -0
- package/esm/currency/useCurrency.d.ts +2 -0
- package/esm/currency/useCurrency.js +8 -0
- package/esm/currency/utils.d.ts +8 -0
- package/esm/currency/utils.js +7 -0
- package/esm/date-input/Before.d.ts +4 -2
- package/esm/date-input/Before.js +4 -4
- package/esm/date-input/CalendarIconButton.js +7 -1
- package/esm/date-input/DateInput.d.ts +1 -1
- package/esm/date-input/DateInput.js +48 -27
- package/esm/date-input/styled-components.d.ts +2 -2
- package/esm/date-input/styled-components.js +10 -7
- package/esm/date-input/types.d.ts +4 -2
- package/esm/date-picker/Calendar.d.ts +1 -1
- package/esm/date-picker/Calendar.js +17 -7
- package/esm/date-picker/DateInput.d.ts +3 -2
- package/esm/date-picker/DateInput.js +20 -18
- package/esm/date-picker/DatePickerContent.d.ts +9 -3
- package/esm/date-picker/DatePickerContent.js +60 -9
- package/esm/date-picker/DatePickerInput.js +13 -16
- package/esm/date-picker/DateTimeContainer.d.ts +4 -2
- package/esm/date-picker/DateTimeContainer.js +5 -5
- package/esm/date-picker/StatelessDatePicker.d.ts +1 -1
- package/esm/date-picker/StatelessDatePicker.js +40 -20
- package/esm/date-picker/TimeInput.d.ts +5 -2
- package/esm/date-picker/TimeInput.js +4 -2
- package/esm/date-picker/index.d.ts +1 -0
- package/esm/date-picker/index.js +1 -0
- package/esm/date-picker/locale.d.ts +2 -0
- package/esm/date-picker/stateful-container.d.ts +1 -1
- package/esm/date-picker/stateful-container.js +11 -8
- package/esm/date-picker/styled-components.d.ts +0 -1
- package/esm/date-picker/styled-components.js +53 -26
- package/esm/date-picker/types.d.ts +10 -1
- package/esm/date-picker/utils.d.ts +10 -7
- package/esm/date-picker/utils.js +13 -5
- package/esm/date-time/DateTime.d.ts +3 -0
- package/esm/date-time/DateTime.js +8 -0
- package/esm/date-time/index.d.ts +3 -0
- package/esm/date-time/index.js +3 -0
- package/esm/date-time/types.d.ts +21 -0
- package/esm/date-time/types.js +15 -0
- package/esm/date-time/useDateTime.d.ts +2 -0
- package/esm/date-time/useDateTime.js +9 -0
- package/esm/date-time/variants.d.ts +4 -0
- package/esm/date-time/variants.js +84 -0
- package/esm/form-control/context.d.ts +6 -13
- package/esm/form-control/context.js +10 -9
- package/esm/form-control/form-control.d.ts +1 -1
- package/esm/form-control/form-control.js +17 -12
- package/esm/form-control/styled-component.js +18 -7
- package/esm/helpers/ClearIconButton.js +3 -1
- package/esm/helpers/StyledTombstone.d.ts +1 -0
- package/esm/helpers/StyledTombstone.js +17 -0
- package/esm/helpers/baseui/useConvertOverrides.js +6 -1
- package/esm/helpers/baseui/withThemeOverride.js +1 -1
- package/esm/helpers/commonStyles.d.ts +2 -2
- package/esm/helpers/commonStyles.js +3 -6
- package/esm/helpers/index.d.ts +1 -0
- package/esm/helpers/index.js +8 -0
- package/esm/helpers/styletron.d.ts +14 -3
- package/esm/helpers/themeHelpers.d.ts +1 -0
- package/esm/helpers/themeHelpers.js +13 -0
- package/esm/hooks/useAutoFocus.d.ts +6 -7
- package/esm/hooks/useAutoFocus.js +19 -13
- package/esm/hooks/useCombinedRef.d.ts +1 -0
- package/esm/hooks/useCombinedRef.js +33 -0
- package/esm/hooks/useIsMobileDevice.d.ts +1 -0
- package/esm/hooks/useIsMobileDevice.js +6 -0
- package/esm/hooks/useMatchMedia.d.ts +3 -0
- package/esm/hooks/useMatchMedia.js +49 -0
- package/esm/icon/components/alert-solid.js +2 -0
- package/esm/icon/components/alert.js +2 -0
- package/esm/icon/components/calendar-solid.js +2 -0
- package/esm/icon/components/chevron-down.js +2 -0
- package/esm/icon/components/chevron-left.d.ts +3 -0
- package/esm/icon/components/chevron-left.js +8 -0
- package/esm/icon/components/chevron-right.d.ts +3 -0
- package/esm/icon/components/chevron-right.js +8 -0
- package/esm/icon/components/close.js +2 -0
- package/esm/icon/components/error-clr.js +2 -0
- package/esm/icon/components/error-solid.js +2 -0
- package/esm/icon/components/error.js +2 -0
- package/esm/icon/components/imagePreview.js +2 -0
- package/esm/icon/components/info.js +2 -0
- package/esm/icon/components/play-video.js +2 -0
- package/esm/icon/components/reset-color.d.ts +3 -0
- package/esm/icon/components/reset-color.js +8 -0
- package/esm/icon/components/search.js +2 -0
- package/esm/icon/components/tick.js +2 -0
- package/esm/icon/components/tickCircle-solid.js +2 -0
- package/esm/icon/components/user.js +2 -0
- package/esm/icon/components/video-non-playable.js +2 -0
- package/esm/index.d.ts +2 -0
- package/esm/index.js +2 -0
- package/esm/input/basewebAdapters.d.ts +1 -1
- package/esm/input/basewebAdapters.js +18 -3
- package/esm/input/index.d.ts +2 -1
- package/esm/input/index.js +1 -0
- package/esm/input/styled-components.d.ts +1 -1
- package/esm/input/styled-components.js +8 -6
- package/esm/input/types.d.ts +10 -4
- package/esm/layer/useLayersContextValue.js +3 -2
- package/esm/list/avatar-list-item.d.ts +12 -22
- package/esm/list/avatar-list-item.js +8 -10
- package/esm/list/divider.js +6 -3
- package/esm/list/index.d.ts +1 -1
- package/esm/list/index.js +1 -1
- package/esm/list/list-item.d.ts +3 -1
- package/esm/list/list-item.js +9 -6
- package/esm/list/list.d.ts +10 -5
- package/esm/list/list.js +47 -6
- package/esm/list/styled-component.d.ts +1 -0
- package/esm/list/styled-component.js +23 -17
- package/esm/list/types.d.ts +8 -0
- package/esm/list/utils.d.ts +2 -0
- package/esm/list/utils.js +10 -0
- package/esm/locale/en_US.js +35 -0
- package/esm/locale/types.d.ts +21 -0
- package/esm/menu/MenuContext.d.ts +2 -1
- package/esm/menu/MenuContext.js +1 -0
- package/esm/menu/menu-item.d.ts +8 -2
- package/esm/menu/menu-item.js +11 -11
- package/esm/menu/menu.d.ts +6 -0
- package/esm/menu/menu.js +11 -11
- package/esm/menu/types.d.ts +1 -0
- package/esm/menu/useKeyboardNavigation.d.ts +6 -3
- package/esm/menu/useKeyboardNavigation.js +21 -14
- package/esm/menu/useStatefulMenu.d.ts +5 -2
- package/esm/menu/useStatefulMenu.js +14 -8
- package/esm/modal/adapter.d.ts +1 -1
- package/esm/modal/index.d.ts +1 -1
- package/esm/modal/index.js +1 -1
- package/esm/modal/modal.js +5 -5
- package/esm/modal/overrides.d.ts +2 -3
- package/esm/modal/overrides.js +6 -8
- package/esm/modal/styled-components.d.ts +1 -1
- package/esm/modal/styled-components.js +8 -8
- package/esm/number/Number.d.ts +3 -0
- package/esm/number/Number.js +10 -0
- package/esm/number/constants.d.ts +2 -0
- package/esm/number/constants.js +4 -0
- package/esm/number/index.d.ts +5 -0
- package/esm/number/index.js +5 -0
- package/esm/number/types.d.ts +6 -0
- package/esm/number/types.js +1 -0
- package/esm/number/useNumber.d.ts +2 -0
- package/esm/number/useNumber.js +8 -0
- package/esm/overrides/index.d.ts +1 -1
- package/esm/overrides/index.js +1 -1
- package/esm/overrides/mergeOverrides.d.ts +3 -2
- package/esm/overrides/mergeOverrides.js +5 -4
- package/esm/payment-card/basewebAdapters.d.ts +2 -0
- package/esm/payment-card/basewebAdapters.js +27 -4
- package/esm/payment-card/styled-components.js +25 -6
- package/esm/payment-card/types.d.ts +4 -2
- package/esm/phone-input/country-select-container.js +1 -1
- package/esm/phone-input/country-select.js +4 -6
- package/esm/phone-input/default-props.d.ts +6 -9
- package/esm/phone-input/default-props.js +7 -9
- package/esm/phone-input/flag-container.js +1 -1
- package/esm/phone-input/phone-input.d.ts +0 -6
- package/esm/phone-input/phone-input.js +21 -12
- package/esm/phone-input/stateful-phone-input-container.js +4 -3
- package/esm/phone-input/stateful-phone-input.d.ts +0 -6
- package/esm/phone-input/styled-components.d.ts +9 -1
- package/esm/phone-input/styled-components.js +21 -7
- package/esm/phone-input/types.d.ts +2 -1
- package/esm/phone-input/utils.d.ts +10 -3
- package/esm/phone-input/utils.js +10 -5
- package/esm/popover/adapter.d.ts +4 -3
- package/esm/popover/adapter.js +15 -0
- package/esm/popover/overrides.js +8 -19
- package/esm/popover/popover.d.ts +6 -3
- package/esm/popover/popover.js +13 -6
- package/esm/popover/stateful-popover.js +2 -2
- package/esm/popover/types.d.ts +10 -2
- package/esm/popover/types.js +2 -1
- package/esm/popover/utils.d.ts +12 -0
- package/esm/popover/utils.js +9 -0
- package/esm/progress/circular/styled-component.d.ts +1 -1
- package/esm/progress/circular/styled-component.js +3 -3
- package/esm/progress/linear/styled-component.d.ts +1 -1
- package/esm/progress/linear/styled-component.js +5 -5
- package/esm/radio/basewebAdapters.d.ts +8 -11
- package/esm/radio/basewebAdapters.js +6 -3
- package/esm/radio/radio.js +6 -5
- package/esm/radio/styled-components.js +9 -11
- package/esm/radio/types.d.ts +13 -6
- package/esm/search/index.d.ts +1 -0
- package/esm/search/index.js +1 -0
- package/esm/search/search.d.ts +1 -1
- package/esm/search/search.js +15 -6
- package/esm/search/stateful-search.d.ts +3 -0
- package/esm/search/stateful-search.js +15 -0
- package/esm/search/styled-components.d.ts +1 -10
- package/esm/search/styled-components.js +54 -24
- package/esm/search/types.d.ts +8 -2
- package/esm/select/adaptor.d.ts +1 -1
- package/esm/select/base-select.d.ts +36 -16
- package/esm/select/base-select.js +185 -88
- package/esm/select/constants.d.ts +3 -0
- package/esm/select/constants.js +3 -1
- package/esm/select/default-props.d.ts +9 -5
- package/esm/select/default-props.js +4 -1
- package/esm/select/index.d.ts +4 -4
- package/esm/select/index.js +3 -3
- package/esm/select/locale.d.ts +4 -0
- package/esm/select/mobileSelect/MobileSelect.js +3 -5
- package/esm/select/mobileSelect/MobileSheet.js +3 -1
- package/esm/select/multi-value.js +22 -12
- package/esm/select/overlaySelect/OverlaySelect.js +10 -18
- package/esm/select/overlaySelect/hooks/useControlRef.d.ts +9 -0
- package/esm/select/overlaySelect/hooks/useControlRef.js +33 -0
- package/esm/select/overlaySelect/hooks/useOverlaySelectOverrides.d.ts +24 -0
- package/esm/select/overlaySelect/{useOverlaySelectOverrides.js → hooks/useOverlaySelectOverrides.js} +31 -28
- package/esm/select/overlaySelect/{usePopover.d.ts → hooks/usePopover.d.ts} +1 -1
- package/esm/select/overlaySelect/{usePopover.js → hooks/usePopover.js} +2 -2
- package/esm/select/overrides.d.ts +3 -1
- package/esm/select/overrides.js +19 -13
- package/esm/select/select-variants.js +2 -2
- package/esm/select/select.d.ts +9 -5
- package/esm/select/select.js +9 -3
- package/esm/select/selectMenuAdapter/CollapsibleSelectMenu.d.ts +118 -0
- package/esm/select/selectMenuAdapter/CollapsibleSelectMenu.js +70 -0
- package/esm/select/selectMenuAdapter/SelectMenuAdapter.d.ts +2 -32
- package/esm/select/selectMenuAdapter/SelectMenuAdapter.js +11 -5
- package/esm/select/selectMenuAdapter/SelectMenuItem.d.ts +8 -2
- package/esm/select/selectMenuAdapter/SelectMenuItem.js +2 -4
- package/esm/select/selectMenuAdapter/hooks/useGetExpandedGroup.d.ts +6 -0
- package/esm/select/selectMenuAdapter/hooks/useGetExpandedGroup.js +16 -0
- package/esm/select/selectMenuAdapter/types.d.ts +42 -0
- package/esm/select/selectMenuAdapter/types.js +1 -0
- package/esm/select/stateful-select.d.ts +9 -5
- package/esm/select/stateful-select.js +3 -3
- package/esm/select/styled-component.d.ts +15 -4
- package/esm/select/styled-component.js +60 -10
- package/esm/select/types.d.ts +36 -9
- package/esm/select/types.js +1 -0
- package/esm/select/utils/default-filter-options.d.ts +2 -1
- package/esm/select/utils/default-filter-options.js +5 -1
- package/esm/select/utils/hidden-element.d.ts +6 -0
- package/esm/select/utils/hidden-element.js +16 -0
- package/esm/select/utils/merge-options.d.ts +2 -0
- package/esm/select/utils/merge-options.js +18 -0
- package/esm/select/utils/test-utils.d.ts +1 -0
- package/esm/select/utils/test-utils.js +7 -0
- package/esm/slider/mark.d.ts +3 -3
- package/esm/slider/slider.js +2 -1
- package/esm/slider/stateful-slider.js +1 -1
- package/esm/slider/styled-components.js +4 -4
- package/esm/slider/types.d.ts +9 -2
- package/esm/snackbar/Snackbar.js +12 -12
- package/esm/snackbar/styled-component.js +9 -6
- package/esm/spacewebProvider/CustomBaseProvider.js +1 -0
- package/esm/spacewebProvider/SpacewebProvider.d.ts +3 -1
- package/esm/spacewebProvider/SpacewebProvider.js +9 -9
- package/esm/stack/stack.js +6 -13
- package/esm/style/_buildUtils.d.ts +1 -1
- package/esm/style/_buildUtils.js +3 -1
- package/esm/style/_parseStyle.js +12 -7
- package/esm/style/useMemoizedStyletron.d.ts +1 -1
- package/esm/style/useMemoizedStyletron.js +6 -1
- package/esm/styleEngine/styleEngine.d.ts +1 -2
- package/esm/switch/__test__/switch.spec.js +13 -0
- package/esm/switch/styled-components.js +14 -21
- package/esm/switch/switch.js +5 -2
- package/esm/switch/types.d.ts +8 -11
- package/esm/tag/avatar-tag.js +23 -16
- package/esm/tag/styled-components.js +32 -27
- package/esm/tag/tag.js +20 -12
- package/esm/tag/types.d.ts +2 -2
- package/esm/tag/utils.d.ts +50 -0
- package/esm/tag/utils.js +64 -0
- package/esm/textarea/basewebAdapters.js +4 -4
- package/esm/textarea/styled-components.d.ts +1 -1
- package/esm/textarea/textarea.js +4 -8
- package/esm/textarea/types.d.ts +7 -5
- package/esm/theme/Provider.d.ts +10 -0
- package/esm/theme/Provider.js +61 -0
- package/esm/theme/context.d.ts +1 -10
- package/esm/theme/context.js +1 -61
- package/esm/theme/index.d.ts +1 -0
- package/esm/theme/index.js +1 -0
- package/esm/themes/index.js +1 -1
- package/esm/themes/responsive-theme.d.ts +2 -2
- package/esm/time-picker/TimePicker.d.ts +1 -6
- package/esm/time-picker/TimePicker.js +4 -4
- package/esm/time-picker/types.d.ts +3 -1
- package/esm/time-range-picker/RangeSelector.js +6 -5
- package/esm/time-range-picker/RangeSelectorContainer.js +27 -27
- package/esm/time-range-picker/TimeRangeList.js +8 -1
- package/esm/time-range-picker/TimeRangePicker.js +26 -17
- package/esm/time-range-picker/index.d.ts +1 -1
- package/esm/time-range-picker/index.js +1 -1
- package/esm/time-range-picker/locale.d.ts +3 -0
- package/esm/time-range-picker/types.d.ts +17 -3
- package/esm/time-range-picker/utils.d.ts +47 -18
- package/esm/time-range-picker/utils.js +94 -16
- package/esm/time-zone-picker/TimezonePicker.d.ts +1 -6
- package/esm/time-zone-picker/TimezonePicker.js +5 -7
- package/esm/time-zone-picker/types.d.ts +2 -0
- package/esm/tooltip/disabled-tooltip-container.d.ts +26 -1
- package/esm/tooltip/overrides.js +1 -2
- package/esm/tooltip/stateful-tooltip-container.d.ts +26 -1
- package/esm/tooltip/stateful-tooltip.d.ts +27 -1
- package/esm/tooltip/stateful-tooltip.js +2 -2
- package/esm/tooltip/tooltip.d.ts +1 -1
- package/esm/tooltip/tooltip.js +7 -4
- package/esm/tooltip/types.d.ts +12 -2
- package/esm/types.d.ts +5 -3
- package/esm/typography/Typography.js +14 -1
- package/esm/typography/constants.d.ts +56 -0
- package/esm/typography/constants.js +56 -0
- package/esm/typography/index.d.ts +1 -0
- package/esm/typography/index.js +1 -0
- package/esm/typography/styled-components.js +12 -4
- package/esm/typography/types.d.ts +1 -1
- package/esm/utils/intlNumberFormatUtils/index.d.ts +7 -0
- package/esm/utils/intlNumberFormatUtils/index.js +36 -0
- package/esm/utils/intlNumberFormatUtils/types.d.ts +21 -0
- package/esm/utils/intlNumberFormatUtils/types.js +6 -0
- package/esm/video/Video.js +4 -2
- package/esm/video/types.d.ts +2 -0
- package/form-control/context.d.ts +6 -13
- package/form-control/context.js +11 -10
- package/form-control/form-control.d.ts +1 -1
- package/form-control/form-control.js +16 -11
- package/form-control/styled-component.js +18 -7
- package/helpers/ClearIconButton.js +3 -1
- package/helpers/StyledTombstone.d.ts +1 -0
- package/helpers/StyledTombstone.js +21 -0
- package/helpers/baseui/useConvertOverrides.js +6 -1
- package/helpers/baseui/withThemeOverride.js +1 -1
- package/helpers/commonStyles.d.ts +2 -2
- package/helpers/commonStyles.js +3 -6
- package/helpers/index.d.ts +1 -0
- package/helpers/index.js +10 -1
- package/helpers/styletron.d.ts +14 -3
- package/helpers/themeHelpers.d.ts +1 -0
- package/helpers/themeHelpers.js +15 -1
- package/hooks/useAutoFocus.d.ts +6 -7
- package/hooks/useAutoFocus.js +19 -14
- package/hooks/useCombinedRef.d.ts +1 -0
- package/hooks/useCombinedRef.js +35 -1
- package/hooks/useIsMobileDevice.d.ts +1 -0
- package/hooks/useIsMobileDevice.js +11 -0
- package/hooks/useMatchMedia.d.ts +3 -0
- package/hooks/useMatchMedia.js +52 -0
- package/icon/components/alert-solid.js +2 -0
- package/icon/components/alert.js +2 -0
- package/icon/components/calendar-solid.js +2 -0
- package/icon/components/chevron-down.js +2 -0
- package/icon/components/chevron-left.d.ts +3 -0
- package/icon/components/chevron-left.js +11 -0
- package/icon/components/chevron-right.d.ts +3 -0
- package/icon/components/chevron-right.js +11 -0
- package/icon/components/close.js +2 -0
- package/icon/components/error-clr.js +2 -0
- package/icon/components/error-solid.js +2 -0
- package/icon/components/error.js +2 -0
- package/icon/components/imagePreview.js +2 -0
- package/icon/components/info.js +2 -0
- package/icon/components/play-video.js +2 -0
- package/icon/components/reset-color.d.ts +3 -0
- package/icon/components/reset-color.js +11 -0
- package/icon/components/search.js +2 -0
- package/icon/components/tick.js +2 -0
- package/icon/components/tickCircle-solid.js +2 -0
- package/icon/components/user.js +2 -0
- package/icon/components/video-non-playable.js +2 -0
- package/index.d.ts +2 -0
- package/index.js +3 -0
- package/input/basewebAdapters.d.ts +1 -1
- package/input/basewebAdapters.js +18 -3
- package/input/index.d.ts +2 -1
- package/input/index.js +3 -1
- package/input/styled-components.d.ts +1 -1
- package/input/styled-components.js +7 -5
- package/input/types.d.ts +10 -4
- package/layer/useLayersContextValue.js +2 -1
- package/list/avatar-list-item.d.ts +12 -22
- package/list/avatar-list-item.js +6 -8
- package/list/divider.js +6 -3
- package/list/index.d.ts +1 -1
- package/list/index.js +2 -1
- package/list/list-item.d.ts +3 -1
- package/list/list-item.js +9 -6
- package/list/list.d.ts +10 -5
- package/list/list.js +47 -6
- package/list/styled-component.d.ts +1 -0
- package/list/styled-component.js +24 -18
- package/list/types.d.ts +8 -0
- package/list/utils.d.ts +2 -0
- package/list/utils.js +14 -0
- package/locale/en_US.js +35 -0
- package/locale/types.d.ts +21 -0
- package/menu/MenuContext.d.ts +2 -1
- package/menu/MenuContext.js +1 -0
- package/menu/menu-item.d.ts +8 -2
- package/menu/menu-item.js +11 -11
- package/menu/menu.d.ts +6 -0
- package/menu/menu.js +11 -11
- package/menu/types.d.ts +1 -0
- package/menu/useKeyboardNavigation.d.ts +6 -3
- package/menu/useKeyboardNavigation.js +21 -14
- package/menu/useStatefulMenu.d.ts +5 -2
- package/menu/useStatefulMenu.js +14 -8
- package/modal/adapter.d.ts +1 -1
- package/modal/index.d.ts +1 -1
- package/modal/index.js +1 -2
- package/modal/modal.js +4 -4
- package/modal/overrides.d.ts +2 -3
- package/modal/overrides.js +7 -9
- package/modal/styled-components.d.ts +1 -1
- package/modal/styled-components.js +8 -9
- package/number/Number.d.ts +3 -0
- package/number/Number.js +14 -0
- package/number/constants.d.ts +2 -0
- package/number/constants.js +7 -0
- package/number/index.d.ts +5 -0
- package/number/index.js +12 -0
- package/number/package.json +4 -0
- package/number/types.d.ts +6 -0
- package/number/types.js +2 -0
- package/number/useNumber.d.ts +2 -0
- package/number/useNumber.js +12 -0
- package/overrides/index.d.ts +1 -1
- package/overrides/index.js +2 -1
- package/overrides/mergeOverrides.d.ts +3 -2
- package/overrides/mergeOverrides.js +6 -4
- package/package.json +18 -12
- package/payment-card/basewebAdapters.d.ts +2 -0
- package/payment-card/basewebAdapters.js +27 -4
- package/payment-card/styled-components.js +24 -5
- package/payment-card/types.d.ts +4 -2
- package/phone-input/country-select-container.js +1 -1
- package/phone-input/country-select.js +4 -6
- package/phone-input/default-props.d.ts +6 -9
- package/phone-input/default-props.js +8 -9
- package/phone-input/flag-container.js +1 -1
- package/phone-input/phone-input.d.ts +0 -6
- package/phone-input/phone-input.js +20 -11
- package/phone-input/stateful-phone-input-container.js +4 -3
- package/phone-input/stateful-phone-input.d.ts +0 -6
- package/phone-input/styled-components.d.ts +9 -1
- package/phone-input/styled-components.js +22 -7
- package/phone-input/types.d.ts +2 -1
- package/phone-input/utils.d.ts +10 -3
- package/phone-input/utils.js +11 -5
- package/popover/adapter.d.ts +4 -3
- package/popover/adapter.js +16 -1
- package/popover/overrides.js +8 -19
- package/popover/popover.d.ts +6 -3
- package/popover/popover.js +12 -5
- package/popover/stateful-popover.js +2 -2
- package/popover/types.d.ts +10 -2
- package/popover/types.js +5 -4
- package/popover/utils.d.ts +12 -0
- package/popover/utils.js +11 -1
- package/progress/circular/styled-component.d.ts +1 -1
- package/progress/circular/styled-component.js +4 -4
- package/progress/linear/styled-component.d.ts +1 -1
- package/progress/linear/styled-component.js +5 -5
- package/radio/basewebAdapters.d.ts +8 -11
- package/radio/basewebAdapters.js +6 -3
- package/radio/radio.js +6 -5
- package/radio/styled-components.js +9 -11
- package/radio/types.d.ts +13 -6
- package/search/index.d.ts +1 -0
- package/search/index.js +3 -1
- package/search/search.d.ts +1 -1
- package/search/search.js +14 -5
- package/search/stateful-search.d.ts +3 -0
- package/search/stateful-search.js +19 -0
- package/search/styled-components.d.ts +1 -10
- package/search/styled-components.js +56 -25
- package/search/types.d.ts +8 -2
- package/select/adaptor.d.ts +1 -1
- package/select/base-select.d.ts +36 -16
- package/select/base-select.js +183 -86
- package/select/constants.d.ts +3 -0
- package/select/constants.js +4 -2
- package/select/default-props.d.ts +9 -5
- package/select/default-props.js +4 -1
- package/select/index.d.ts +4 -4
- package/select/index.js +4 -2
- package/select/locale.d.ts +4 -0
- package/select/mobileSelect/MobileSelect.js +3 -5
- package/select/mobileSelect/MobileSheet.js +3 -1
- package/select/multi-value.js +21 -11
- package/select/overlaySelect/OverlaySelect.js +9 -17
- package/select/overlaySelect/hooks/useControlRef.d.ts +9 -0
- package/select/overlaySelect/hooks/useControlRef.js +37 -0
- package/select/overlaySelect/hooks/useOverlaySelectOverrides.d.ts +24 -0
- package/select/overlaySelect/{useOverlaySelectOverrides.js → hooks/useOverlaySelectOverrides.js} +31 -28
- package/select/overlaySelect/{usePopover.d.ts → hooks/usePopover.d.ts} +1 -1
- package/select/overlaySelect/{usePopover.js → hooks/usePopover.js} +2 -2
- package/select/overrides.d.ts +3 -1
- package/select/overrides.js +20 -14
- package/select/select-variants.js +2 -2
- package/select/select.d.ts +9 -5
- package/select/select.js +9 -3
- package/select/selectMenuAdapter/CollapsibleSelectMenu.d.ts +118 -0
- package/select/selectMenuAdapter/CollapsibleSelectMenu.js +74 -0
- package/select/selectMenuAdapter/SelectMenuAdapter.d.ts +2 -32
- package/select/selectMenuAdapter/SelectMenuAdapter.js +11 -5
- package/select/selectMenuAdapter/SelectMenuItem.d.ts +8 -2
- package/select/selectMenuAdapter/SelectMenuItem.js +2 -4
- package/select/selectMenuAdapter/hooks/useGetExpandedGroup.d.ts +6 -0
- package/select/selectMenuAdapter/hooks/useGetExpandedGroup.js +20 -0
- package/select/selectMenuAdapter/types.d.ts +42 -0
- package/select/selectMenuAdapter/types.js +2 -0
- package/select/stateful-select.d.ts +9 -5
- package/select/stateful-select.js +3 -3
- package/select/styled-component.d.ts +15 -4
- package/select/styled-component.js +58 -11
- package/select/types.d.ts +36 -9
- package/select/types.js +2 -1
- package/select/utils/default-filter-options.d.ts +2 -1
- package/select/utils/default-filter-options.js +6 -5
- package/select/utils/hidden-element.d.ts +6 -0
- package/select/utils/hidden-element.js +19 -0
- package/select/utils/merge-options.d.ts +2 -0
- package/select/utils/merge-options.js +22 -0
- package/select/utils/test-utils.d.ts +1 -0
- package/select/utils/test-utils.js +11 -0
- package/slider/mark.d.ts +3 -3
- package/slider/slider.js +2 -1
- package/slider/stateful-slider.js +1 -1
- package/slider/styled-components.js +4 -4
- package/slider/types.d.ts +9 -2
- package/snackbar/Snackbar.js +12 -12
- package/snackbar/styled-component.js +9 -6
- package/spacewebProvider/CustomBaseProvider.js +1 -0
- package/spacewebProvider/SpacewebProvider.d.ts +3 -1
- package/spacewebProvider/SpacewebProvider.js +8 -8
- package/stack/stack.js +6 -13
- package/style/_buildUtils.d.ts +1 -1
- package/style/_buildUtils.js +3 -1
- package/style/_parseStyle.js +12 -7
- package/style/useMemoizedStyletron.d.ts +1 -1
- package/style/useMemoizedStyletron.js +6 -1
- package/styleEngine/styleEngine.d.ts +1 -2
- package/switch/__test__/switch.spec.js +13 -0
- package/switch/styled-components.js +14 -21
- package/switch/switch.js +5 -2
- package/switch/types.d.ts +8 -11
- package/tag/avatar-tag.js +23 -16
- package/tag/styled-components.js +32 -27
- package/tag/tag.js +19 -11
- package/tag/types.d.ts +2 -2
- package/tag/utils.d.ts +50 -0
- package/tag/utils.js +67 -1
- package/textarea/basewebAdapters.js +3 -3
- package/textarea/styled-components.d.ts +1 -1
- package/textarea/textarea.js +3 -7
- package/textarea/types.d.ts +7 -5
- package/theme/Provider.d.ts +10 -0
- package/theme/Provider.js +65 -0
- package/theme/context.d.ts +1 -10
- package/theme/context.js +1 -61
- package/theme/index.d.ts +1 -0
- package/theme/index.js +1 -0
- package/themes/index.js +1 -1
- package/themes/responsive-theme.d.ts +2 -2
- package/time-picker/TimePicker.d.ts +1 -6
- package/time-picker/TimePicker.js +4 -4
- package/time-picker/types.d.ts +3 -1
- package/time-range-picker/RangeSelector.js +5 -4
- package/time-range-picker/RangeSelectorContainer.js +26 -26
- package/time-range-picker/TimeRangeList.js +8 -1
- package/time-range-picker/TimeRangePicker.js +25 -16
- package/time-range-picker/index.d.ts +1 -1
- package/time-range-picker/index.js +4 -1
- package/time-range-picker/locale.d.ts +3 -0
- package/time-range-picker/types.d.ts +17 -3
- package/time-range-picker/utils.d.ts +47 -18
- package/time-range-picker/utils.js +98 -17
- package/time-zone-picker/TimezonePicker.d.ts +1 -6
- package/time-zone-picker/TimezonePicker.js +5 -7
- package/time-zone-picker/types.d.ts +2 -0
- package/tooltip/disabled-tooltip-container.d.ts +26 -1
- package/tooltip/overrides.js +1 -2
- package/tooltip/stateful-tooltip-container.d.ts +26 -1
- package/tooltip/stateful-tooltip.d.ts +27 -1
- package/tooltip/stateful-tooltip.js +2 -2
- package/tooltip/tooltip.d.ts +1 -1
- package/tooltip/tooltip.js +7 -4
- package/tooltip/types.d.ts +12 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/types.d.ts +5 -3
- package/typography/Typography.js +14 -1
- package/typography/constants.d.ts +56 -0
- package/typography/constants.js +57 -1
- package/typography/index.d.ts +1 -0
- package/typography/index.js +3 -1
- package/typography/styled-components.js +11 -3
- package/typography/types.d.ts +1 -1
- package/utils/intlNumberFormatUtils/index.d.ts +7 -0
- package/utils/intlNumberFormatUtils/index.js +40 -0
- package/utils/intlNumberFormatUtils/types.d.ts +21 -0
- package/utils/intlNumberFormatUtils/types.js +9 -0
- package/utils/package.json +4 -0
- package/video/Video.js +4 -2
- package/video/types.d.ts +2 -0
- package/esm/icon/components/chevron-right-solid.d.ts +0 -3
- package/esm/icon/components/chevron-right-solid.js +0 -6
- package/esm/phone-input/virtualized-country-select-dropdown.d.ts +0 -31
- package/esm/phone-input/virtualized-country-select-dropdown.js +0 -33
- package/esm/select/overlaySelect/useOverlaySelectOverrides.d.ts +0 -14
- package/esm/style/_escapeClassName.d.ts +0 -6
- package/esm/style/_escapeClassName.js +0 -6
- package/icon/components/chevron-right-solid.d.ts +0 -3
- package/icon/components/chevron-right-solid.js +0 -9
- package/phone-input/virtualized-country-select-dropdown.d.ts +0 -31
- package/phone-input/virtualized-country-select-dropdown.js +0 -35
- package/select/overlaySelect/useOverlaySelectOverrides.d.ts +0 -14
- package/style/_escapeClassName.d.ts +0 -6
- package/style/_escapeClassName.js +0 -9
package/select/base-select.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
4
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
var utils_1 = require("baseui/select/utils");
|
|
6
5
|
var noop_1 = (0, tslib_1.__importDefault)(require("lodash/noop"));
|
|
7
6
|
var pick_1 = (0, tslib_1.__importDefault)(require("lodash/pick"));
|
|
8
7
|
var omit_1 = (0, tslib_1.__importDefault)(require("lodash/omit"));
|
|
8
|
+
var keyBy_1 = (0, tslib_1.__importDefault)(require("lodash/keyBy"));
|
|
9
9
|
var memoize_one_1 = (0, tslib_1.__importDefault)(require("memoize-one"));
|
|
10
10
|
var react_1 = require("react");
|
|
11
11
|
var React = (0, tslib_1.__importStar)(require("react"));
|
|
@@ -29,31 +29,43 @@ var types_1 = require("./types");
|
|
|
29
29
|
var helpers_1 = require("../helpers");
|
|
30
30
|
var useCombinedRef_1 = require("../hooks/useCombinedRef");
|
|
31
31
|
var useUniqueId_1 = require("../hooks/useUniqueId");
|
|
32
|
+
var merge_options_1 = require("./utils/merge-options");
|
|
32
33
|
var BaseSelect = /** @class */ (function (_super) {
|
|
33
34
|
(0, tslib_1.__extends)(BaseSelect, _super);
|
|
34
35
|
function BaseSelect() {
|
|
35
36
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
37
|
+
_this.state = {
|
|
38
|
+
isContainerFocused: false,
|
|
39
|
+
};
|
|
40
|
+
_this.lastSelectedValue = _this.props.value;
|
|
36
41
|
_this.id = (0, useUniqueId_1.getUniqueId)();
|
|
37
42
|
_this.menuId = (0, useUniqueId_1.getUniqueId)();
|
|
43
|
+
_this.getMemoizedNormalizedOptions = (0, memoize_one_1.default)(function (valueKey, options1, options2) { return (0, merge_options_1.mergeOptions)(valueKey, options1, options2); });
|
|
44
|
+
_this.getValueByIdMap = (0, memoize_one_1.default)(function (value, valueKey) { return (0, keyBy_1.default)(value, valueKey); });
|
|
38
45
|
_this.shouldDisplaySelectAll = function () {
|
|
39
|
-
var _a = _this.props, multi = _a.multi, hideSelectAll = _a.hideSelectAll, options = _a.options;
|
|
40
|
-
return (multi && !hideSelectAll && _this.
|
|
46
|
+
var _a = _this.props, multi = _a.multi, hideSelectAll = _a.hideSelectAll, options = _a.options, valueKey = _a.valueKey;
|
|
47
|
+
return (multi && !hideSelectAll && _this.getMemoizedNormalizedOptions(valueKey, options, _this.createdOptions).length > 0);
|
|
41
48
|
};
|
|
42
|
-
_this.getNormalizedOptions = (0, memoize_one_1.default)(function (options) { return (0, utils_1.normalizeOptions)(options); });
|
|
43
|
-
_this.isSelectAllChecked = (0, memoize_one_1.default)(
|
|
44
49
|
// in creatable select, value length can be more than length of options
|
|
45
|
-
function (value, options) {
|
|
46
|
-
return
|
|
47
|
-
|
|
50
|
+
_this.isSelectAllChecked = function (value, options) {
|
|
51
|
+
return _this.props.__selectAllShouldReturnAllOptions
|
|
52
|
+
? _this.props.__selectAllSelected
|
|
53
|
+
: (value === null || value === void 0 ? void 0 : value.length) >=
|
|
54
|
+
_this.getMemoizedNormalizedOptions(_this.props.valueKey, options, _this.createdOptions).filter(function (opt) { return !opt.disabled; }).length;
|
|
55
|
+
};
|
|
48
56
|
_this.getSelectOverrides =
|
|
49
57
|
// FIXME: Remove use of any
|
|
50
58
|
function () {
|
|
51
|
-
var _a
|
|
59
|
+
var _a;
|
|
60
|
+
var _b = _this.props, _c = _b.id, id = _c === void 0 ? _this.id : _c, valueKey = _b.valueKey, labelKey = _b.labelKey, value = _b.value, multi = _b.multi, overrides = _b.overrides, noResultsMsg = _b.noResultsMsg, options = _b.options, className = _b.className, style = _b.style, intent = _b.intent, size = _b.size, disabled = _b.disabled, captureScroll = _b.captureScroll, placement = _b.placement, popoverMinWidth = _b.popoverMinWidth, searchable = _b.searchable, virtual = _b.virtual, ignoreBoundary = _b.ignoreBoundary, clearAsOption = _b.clearAsOption, selectOnTab = _b.selectOnTab;
|
|
52
61
|
return {
|
|
53
62
|
Root: {
|
|
54
63
|
style: [className, style],
|
|
55
64
|
// https://github.com/uber/baseweb/issues/3702#issuecomment-792665393
|
|
56
|
-
props: {
|
|
65
|
+
props: {
|
|
66
|
+
tabIndex: -1,
|
|
67
|
+
onFocus: function () { return _this.setState({ isContainerFocused: true }); },
|
|
68
|
+
},
|
|
57
69
|
},
|
|
58
70
|
StatefulMenu: {
|
|
59
71
|
component: selectMenuAdapter_1.default,
|
|
@@ -65,8 +77,12 @@ var BaseSelect = /** @class */ (function (_super) {
|
|
|
65
77
|
labelKey: labelKey,
|
|
66
78
|
multi: multi,
|
|
67
79
|
selectAllSelected: _this.isSelectAllChecked(value, options),
|
|
80
|
+
shouldDisplaySelectAll: _this.shouldDisplaySelectAll(),
|
|
68
81
|
noResultsMsg: noResultsMsg,
|
|
69
82
|
captureScroll: captureScroll,
|
|
83
|
+
virtual: virtual,
|
|
84
|
+
overscanCount: 20,
|
|
85
|
+
selectOnTab: selectOnTab,
|
|
70
86
|
},
|
|
71
87
|
},
|
|
72
88
|
DropdownContainer: {
|
|
@@ -76,32 +92,72 @@ var BaseSelect = /** @class */ (function (_super) {
|
|
|
76
92
|
},
|
|
77
93
|
style: (0, tslib_1.__assign)((0, tslib_1.__assign)({}, (popoverMinWidth ? { minWidth: popoverMinWidth } : {})), (0, longHandHelpers_1.borderRadius)('inherit')),
|
|
78
94
|
},
|
|
79
|
-
|
|
95
|
+
// aria-selected is applied on SelectMenuItem. No need to apply it on OptionContent
|
|
96
|
+
OptionContent: {
|
|
97
|
+
style: { fontWeight: 'inherit', wordBreak: 'break-word' },
|
|
98
|
+
props: { 'aria-selected': undefined },
|
|
99
|
+
},
|
|
80
100
|
ControlContainer: { style: overrides_1.getControlContainerStyles, props: (0, helpers_1.add$props)({ intent: intent, size: size, disabled: disabled }) },
|
|
81
|
-
ValueContainer: {
|
|
82
|
-
|
|
83
|
-
|
|
101
|
+
ValueContainer: {
|
|
102
|
+
style: overrides_1.getValueContainerStyles,
|
|
103
|
+
props: (0, tslib_1.__assign)({}, (0, helpers_1.add$props)({ intent: intent, size: size, disabled: disabled })),
|
|
104
|
+
},
|
|
105
|
+
MultiValue: {
|
|
106
|
+
component: multi_value_1.default,
|
|
107
|
+
props: {
|
|
108
|
+
'data-testid': 'combobox-selected-value',
|
|
109
|
+
selectSize: size,
|
|
110
|
+
$value: value,
|
|
111
|
+
$valueByIdMap: _this.getValueByIdMap(value, valueKey),
|
|
112
|
+
$valueKey: valueKey,
|
|
113
|
+
$isContainerFocused: _this.state.isContainerFocused,
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
SingleValue: {
|
|
117
|
+
component: ((_a = value === null || value === void 0 ? void 0 : value[0]) === null || _a === void 0 ? void 0 : _a.__loading) ? overrides_1.SingleValueTombstone : undefined,
|
|
118
|
+
style: overrides_1.getValueTypography,
|
|
119
|
+
props: { 'data-testid': 'combobox-selected-value', $selectSize: size, $value: value },
|
|
120
|
+
},
|
|
84
121
|
InputContainer: {
|
|
85
122
|
component: styled_component_1.InputContainer,
|
|
86
|
-
props: { menuId: _this.menuId, size: size },
|
|
87
|
-
style: overrides_1.getValueTypography,
|
|
123
|
+
props: { menuId: _this.menuId, size: size, $value: value, $labelKey: labelKey, placeholder: _this.props.placeholder },
|
|
88
124
|
},
|
|
89
125
|
Input: {
|
|
90
126
|
component: styled_component_1.Input,
|
|
91
|
-
props: {
|
|
92
|
-
|
|
127
|
+
props: {
|
|
128
|
+
id: id,
|
|
129
|
+
'aria-required': _this.props['aria-required'],
|
|
130
|
+
menuId: searchable ? _this.menuId : null,
|
|
131
|
+
onPaste: _this.handlePaste,
|
|
132
|
+
placeholder: _this.props.placeholder,
|
|
133
|
+
$value: value,
|
|
134
|
+
$labelKey: labelKey,
|
|
135
|
+
'aria-label': _this.props['aria-label'],
|
|
136
|
+
},
|
|
93
137
|
},
|
|
94
138
|
Placeholder: {
|
|
95
139
|
style: styled_components_1.getPlaceholderTypography,
|
|
96
140
|
},
|
|
97
|
-
IconsContainer: { style: 'cursor-pointer
|
|
141
|
+
IconsContainer: { style: 'cursor-pointer px-0 sticky top-0' },
|
|
98
142
|
SelectArrow: { component: overrides_1.SelectArrow },
|
|
99
|
-
ClearIcon: {
|
|
100
|
-
|
|
143
|
+
ClearIcon: {
|
|
144
|
+
component: clearAsOption ? function () { return null; } : ClearIconButton_1.default,
|
|
145
|
+
props: { tabIndex: _this.state.isContainerFocused ? 0 : -1 },
|
|
146
|
+
},
|
|
147
|
+
SearchIcon: {
|
|
148
|
+
component: search_1.default,
|
|
149
|
+
style: overrides_1.getSearchIconStyles,
|
|
150
|
+
},
|
|
101
151
|
SearchIconContainer: { style: overrides_1.getSearchIconContainerStyles },
|
|
102
152
|
Popover: {
|
|
103
153
|
component: popover_1.Popover,
|
|
104
|
-
props: {
|
|
154
|
+
props: {
|
|
155
|
+
placement: placement,
|
|
156
|
+
showArrow: false,
|
|
157
|
+
returnFocus: false,
|
|
158
|
+
overrides: { Body: { style: 'mt-2' } },
|
|
159
|
+
ignoreBoundary: ignoreBoundary,
|
|
160
|
+
},
|
|
105
161
|
},
|
|
106
162
|
LoadingIndicator: {
|
|
107
163
|
component: function () { return ((0, jsx_runtime_1.jsx)(loader_1.Loader, { size: 16, variant: "clip", className: "mx-1", overrides: {
|
|
@@ -112,65 +168,38 @@ var BaseSelect = /** @class */ (function (_super) {
|
|
|
112
168
|
},
|
|
113
169
|
};
|
|
114
170
|
};
|
|
115
|
-
_this.mergeOptions = function (options1, options2) {
|
|
116
|
-
var mergedOptions = options1;
|
|
117
|
-
if (Array.isArray(options1)) {
|
|
118
|
-
if (Array.isArray(options2)) {
|
|
119
|
-
mergedOptions = options1.concat(options2);
|
|
120
|
-
}
|
|
121
|
-
else if (typeof options2 === 'object') {
|
|
122
|
-
mergedOptions = (0, tslib_1.__assign)({}, options2);
|
|
123
|
-
mergedOptions.__ungrouped = mergedOptions.__ungrouped
|
|
124
|
-
? options1.concat(mergedOptions.__ungrouped)
|
|
125
|
-
: options1;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
else if (typeof options1 === 'object') {
|
|
129
|
-
mergedOptions = (0, tslib_1.__assign)({}, options1);
|
|
130
|
-
if (Array.isArray(options2)) {
|
|
131
|
-
mergedOptions.__ungrouped = mergedOptions.__ungrouped
|
|
132
|
-
? mergedOptions.__ungrouped.concat(options2)
|
|
133
|
-
: options2;
|
|
134
|
-
}
|
|
135
|
-
else if (typeof options2 === 'object') {
|
|
136
|
-
Object.keys(options2).forEach(function (key) {
|
|
137
|
-
if (!mergedOptions) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
if (key in mergedOptions) {
|
|
141
|
-
mergedOptions[key] = mergedOptions[key].concat(options2[key]);
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
mergedOptions[key] = options2[key];
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
mergedOptions = options2;
|
|
151
|
-
}
|
|
152
|
-
return mergedOptions;
|
|
153
|
-
};
|
|
154
171
|
/*
|
|
155
172
|
* 1. Add selected values which are not present in Options (to display newly created option)
|
|
156
173
|
* 2. Add selectAll option in multi-select
|
|
157
174
|
* */
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
var
|
|
161
|
-
var
|
|
162
|
-
|
|
163
|
-
|
|
175
|
+
_this.getOptions = (0, memoize_one_1.default)(function (locale, createdOptions, options, shouldPrependClearOption) {
|
|
176
|
+
var _a, _b;
|
|
177
|
+
var _c = _this.props, valueKey = _c.valueKey, labelKey = _c.labelKey, clearAsOptionLabel = _c.clearAsOptionLabel, multi = _c.multi;
|
|
178
|
+
var optionArr = _this.getMemoizedNormalizedOptions(valueKey, options, createdOptions);
|
|
179
|
+
if (shouldPrependClearOption) {
|
|
180
|
+
optionArr = (0, tslib_1.__spreadArray)([
|
|
181
|
+
(_a = {},
|
|
182
|
+
_a[valueKey] = types_1.CLEAR_OPTION_ID,
|
|
183
|
+
_a[labelKey] = clearAsOptionLabel !== null && clearAsOptionLabel !== void 0 ? clearAsOptionLabel : locale.select.clearOptionLabel,
|
|
184
|
+
_a[types_1.CLEAR_OPTION_ID] = true,
|
|
185
|
+
_a)
|
|
186
|
+
], (0, tslib_1.__read)(optionArr), false);
|
|
187
|
+
}
|
|
164
188
|
if (!_this.shouldDisplaySelectAll()) {
|
|
165
189
|
return optionArr;
|
|
166
190
|
}
|
|
167
191
|
return (0, tslib_1.__spreadArray)([
|
|
168
|
-
(
|
|
192
|
+
(_b = {}, _b[valueKey] = types_1.SELECT_ALL_ID, _b[labelKey] = locale.select.selectAllLabel, _b[types_1.SELECT_ALL_ID] = true, _b)
|
|
169
193
|
], (0, tslib_1.__read)(optionArr), false);
|
|
170
194
|
});
|
|
195
|
+
_this.defaultCreateOption = function (label) {
|
|
196
|
+
var _a;
|
|
197
|
+
var _b = _this.props, labelKey = _b.labelKey, valueKey = _b.valueKey;
|
|
198
|
+
return [(_a = {}, _a[labelKey] = label.trim(), _a[valueKey] = label.trim(), _a)];
|
|
199
|
+
};
|
|
171
200
|
_this.getCreatedOptions = function (option) {
|
|
172
|
-
var _a = _this.props, labelKey = _a.labelKey,
|
|
173
|
-
if (
|
|
201
|
+
var _a = _this.props, labelKey = _a.labelKey, _b = _a.createOption, createOption = _b === void 0 ? _this.defaultCreateOption : _b;
|
|
202
|
+
if (typeof option[labelKey] === 'string') {
|
|
174
203
|
return Promise.resolve(createOption(option[labelKey]));
|
|
175
204
|
}
|
|
176
205
|
return Promise.resolve([
|
|
@@ -187,12 +216,27 @@ var BaseSelect = /** @class */ (function (_super) {
|
|
|
187
216
|
return ((0, tslib_1.__assign)((0, tslib_1.__assign)({}, acc), (_a = {}, _a[key] = (_b = options[key]) === null || _b === void 0 ? void 0 : _b.map(function (option) { return ((0, tslib_1.__assign)((0, tslib_1.__assign)({}, option), { isCreatable: true })); }), _a)));
|
|
188
217
|
}, {});
|
|
189
218
|
};
|
|
219
|
+
_this.handleBlur = function (e) {
|
|
220
|
+
var _a;
|
|
221
|
+
if (!_this.props.clearable && !_this.props.multi && !_this.props.value.length && _this.lastSelectedValue.length) {
|
|
222
|
+
_this.props.onChange({
|
|
223
|
+
option: _this.lastSelectedValue[0],
|
|
224
|
+
type: constants_1.STATE_CHANGE_TYPE.select,
|
|
225
|
+
value: _this.lastSelectedValue,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
_this.setState({ isContainerFocused: false });
|
|
229
|
+
(_a = _this.props) === null || _a === void 0 ? void 0 : _a.onBlur(e);
|
|
230
|
+
};
|
|
190
231
|
_this.handleChange = function (params) { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () {
|
|
191
|
-
var _a, options, _b, onChange, value, creatable, prevSelectAllState, newCreatedOptions, newCreatedValues, mergedValue;
|
|
232
|
+
var _a, options, _b, onChange, value, creatable, valueKey, __selectAllShouldReturnAllOptions, multi, prevSelectAllState, newCreatedOptions, newCreatedValues, mergedValue;
|
|
192
233
|
return (0, tslib_1.__generator)(this, function (_c) {
|
|
193
234
|
switch (_c.label) {
|
|
194
235
|
case 0:
|
|
195
|
-
_a = this.props, options = _a.options, _b = _a.onChange, onChange = _b === void 0 ? noop_1.default : _b, value = _a.value, creatable = _a.creatable;
|
|
236
|
+
_a = this.props, options = _a.options, _b = _a.onChange, onChange = _b === void 0 ? noop_1.default : _b, value = _a.value, creatable = _a.creatable, valueKey = _a.valueKey, __selectAllShouldReturnAllOptions = _a.__selectAllShouldReturnAllOptions, multi = _a.multi;
|
|
237
|
+
if (params.value.length > 0) {
|
|
238
|
+
this.lastSelectedValue = params.value;
|
|
239
|
+
}
|
|
196
240
|
//select the user input on option selection
|
|
197
241
|
if (params.type === constants_1.STATE_CHANGE_TYPE.select && this.inputRef.current && 'select' in this.inputRef.current) {
|
|
198
242
|
this.inputRef.current.select();
|
|
@@ -207,22 +251,32 @@ var BaseSelect = /** @class */ (function (_super) {
|
|
|
207
251
|
? { type: constants_1.STATE_CHANGE_TYPE.clear, value: [] }
|
|
208
252
|
: {
|
|
209
253
|
type: constants_1.STATE_CHANGE_TYPE.selectAll,
|
|
210
|
-
value:
|
|
254
|
+
value: __selectAllShouldReturnAllOptions
|
|
255
|
+
? []
|
|
256
|
+
: (0, merge_options_1.mergeOptions)(valueKey, options, this.createdOptions).filter(function (opt) { return !opt.disabled; }),
|
|
211
257
|
});
|
|
212
258
|
}
|
|
213
259
|
return [2 /*return*/];
|
|
214
260
|
}
|
|
261
|
+
if (params.option && params.option[types_1.CLEAR_OPTION_ID]) {
|
|
262
|
+
onChange({
|
|
263
|
+
type: constants_1.STATE_CHANGE_TYPE.clear,
|
|
264
|
+
value: [],
|
|
265
|
+
option: null,
|
|
266
|
+
});
|
|
267
|
+
return [2 /*return*/];
|
|
268
|
+
}
|
|
215
269
|
if (!(creatable && params.type === constants_1.STATE_CHANGE_TYPE.select && params.option && params.option.isCreatable)) return [3 /*break*/, 2];
|
|
216
270
|
return [4 /*yield*/, this.getCreatedOptions(params.option)];
|
|
217
271
|
case 1:
|
|
218
272
|
newCreatedOptions = _c.sent();
|
|
219
|
-
this.createdOptions =
|
|
273
|
+
this.createdOptions = (0, merge_options_1.mergeOptions)(valueKey, this.createdOptions, newCreatedOptions);
|
|
220
274
|
newCreatedValues = this.getCreatedValues(newCreatedOptions);
|
|
221
|
-
mergedValue =
|
|
275
|
+
mergedValue = (0, merge_options_1.mergeOptions)(valueKey, value, newCreatedValues);
|
|
222
276
|
onChange({
|
|
223
|
-
option: (0, tslib_1.__assign)((0, tslib_1.__assign)({}, newCreatedOptions[0]), { isCreatable: true }),
|
|
277
|
+
option: (0, tslib_1.__assign)((0, tslib_1.__assign)({}, newCreatedOptions === null || newCreatedOptions === void 0 ? void 0 : newCreatedOptions[0]), { isCreatable: true }),
|
|
224
278
|
type: constants_1.STATE_CHANGE_TYPE.select,
|
|
225
|
-
value:
|
|
279
|
+
value: multi ? mergedValue : [mergedValue[mergedValue.length - 1]],
|
|
226
280
|
});
|
|
227
281
|
return [2 /*return*/];
|
|
228
282
|
case 2:
|
|
@@ -232,25 +286,68 @@ var BaseSelect = /** @class */ (function (_super) {
|
|
|
232
286
|
});
|
|
233
287
|
}); };
|
|
234
288
|
_this.handlePaste = function (e) {
|
|
235
|
-
var _a = _this.props, onPaste = _a.onPaste, _b = _a.onChange, onChange = _b === void 0 ? noop_1.default : _b, value = _a.value;
|
|
289
|
+
var _a = _this.props, onPaste = _a.onPaste, _b = _a.onChange, onChange = _b === void 0 ? noop_1.default : _b, value = _a.value, valueKey = _a.valueKey, multi = _a.multi;
|
|
236
290
|
var pastedOptions = onPaste === null || onPaste === void 0 ? void 0 : onPaste(e);
|
|
237
291
|
if (!pastedOptions) {
|
|
238
292
|
return;
|
|
239
293
|
}
|
|
240
|
-
_this.createdOptions =
|
|
241
|
-
var mergedValue =
|
|
242
|
-
onChange({ type: constants_1.STATE_CHANGE_TYPE.select, value:
|
|
294
|
+
_this.createdOptions = (0, merge_options_1.mergeOptions)(valueKey, _this.createdOptions, pastedOptions);
|
|
295
|
+
var mergedValue = (0, merge_options_1.mergeOptions)(valueKey, value, pastedOptions);
|
|
296
|
+
onChange({ type: constants_1.STATE_CHANGE_TYPE.select, value: multi ? mergedValue : [mergedValue[mergedValue.length - 1]] });
|
|
243
297
|
};
|
|
298
|
+
_this.handleInputChange = function (e) { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () {
|
|
299
|
+
var _a, _b, onChange, value, valueKey, onInputChange, multi, delimiter, _c, createOption, val, shouldCreateOption, labels, createdOptions, resolvedOptions, err_1, mergedValue;
|
|
300
|
+
var _d, _e;
|
|
301
|
+
return (0, tslib_1.__generator)(this, function (_f) {
|
|
302
|
+
switch (_f.label) {
|
|
303
|
+
case 0:
|
|
304
|
+
_a = this.props, _b = _a.onChange, onChange = _b === void 0 ? noop_1.default : _b, value = _a.value, valueKey = _a.valueKey, onInputChange = _a.onInputChange, multi = _a.multi, delimiter = _a.delimiter, _c = _a.createOption, createOption = _c === void 0 ? this.defaultCreateOption : _c;
|
|
305
|
+
onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange(e);
|
|
306
|
+
val = e.target.value;
|
|
307
|
+
shouldCreateOption = typeof delimiter === 'string' && val.includes(delimiter);
|
|
308
|
+
if (!shouldCreateOption) {
|
|
309
|
+
return [2 /*return*/];
|
|
310
|
+
}
|
|
311
|
+
labels = val.split(delimiter).filter(function (label) { return label.trim(); });
|
|
312
|
+
createdOptions = [];
|
|
313
|
+
_f.label = 1;
|
|
314
|
+
case 1:
|
|
315
|
+
_f.trys.push([1, 3, , 4]);
|
|
316
|
+
return [4 /*yield*/, Promise.all(labels.map(function (label) { return createOption(label); }))];
|
|
317
|
+
case 2:
|
|
318
|
+
resolvedOptions = _f.sent();
|
|
319
|
+
createdOptions = resolvedOptions.filter(function (opt) { return !!opt; }).flat();
|
|
320
|
+
return [3 /*break*/, 4];
|
|
321
|
+
case 3:
|
|
322
|
+
err_1 = _f.sent();
|
|
323
|
+
console.error(err_1);
|
|
324
|
+
return [3 /*break*/, 4];
|
|
325
|
+
case 4:
|
|
326
|
+
if (createdOptions.length > 0) {
|
|
327
|
+
this.createdOptions = (0, merge_options_1.mergeOptions)(valueKey, this.createdOptions, createdOptions);
|
|
328
|
+
mergedValue = (0, merge_options_1.mergeOptions)(valueKey, value, createdOptions);
|
|
329
|
+
onChange({
|
|
330
|
+
type: constants_1.STATE_CHANGE_TYPE.inputChange,
|
|
331
|
+
value: multi ? mergedValue : [mergedValue[mergedValue.length - 1]],
|
|
332
|
+
});
|
|
333
|
+
(_d = this.inputRef.current) === null || _d === void 0 ? void 0 : _d.focus();
|
|
334
|
+
(_e = this.inputRef.current) === null || _e === void 0 ? void 0 : _e.setSelectionRange(0, val.length);
|
|
335
|
+
}
|
|
336
|
+
return [2 /*return*/];
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
}); };
|
|
244
340
|
_this.inputRef = React.createRef();
|
|
245
|
-
_this.combinedInputRef = (0, memoize_one_1.default)(function (refParam) {
|
|
246
|
-
return (0, useCombinedRef_1.combineRefs)(_this.inputRef, refParam);
|
|
247
|
-
});
|
|
248
341
|
return _this;
|
|
249
342
|
}
|
|
250
343
|
BaseSelect.prototype.render = function () {
|
|
251
344
|
var _this = this;
|
|
252
|
-
var _a = this.props, options = _a.options, selectOverrides = _a.overrides, type = _a.type, controlRef = _a.controlRef;
|
|
253
|
-
|
|
345
|
+
var _a = this.props, options = _a.options, selectOverrides = _a.overrides, type = _a.type, controlRef = _a.controlRef, inputRef = _a.inputRef, value = _a.value, clearAsOption = _a.clearAsOption, multi = _a.multi;
|
|
346
|
+
var shouldPrependClearOption = clearAsOption && !multi && value && value.length > 0;
|
|
347
|
+
return ((0, jsx_runtime_1.jsx)(locale_1.LocaleConsumer, { children: function (locale) { return ((0, jsx_runtime_1.jsx)(spaceConsumer_1.default, { children: function (utils) {
|
|
348
|
+
var _a;
|
|
349
|
+
return ((0, jsx_runtime_1.jsx)(styled_component_1.StyledSelect, (0, tslib_1.__assign)({}, (0, omit_1.default)(_this.props, 'size'), { overrides: (0, useConvertOverrides_1.mergeAndConvertOverrides)(_this.getSelectOverrides(), selectOverrides, utils), controlRef: controlRef, inputRef: (0, useCombinedRef_1.combineRefs)(_this.inputRef, inputRef), options: _this.getOptions(locale, _this.createdOptions, options, shouldPrependClearOption), onChange: _this.handleChange, type: adaptor_1.typeAdaptor[type], onInputChange: _this.handleInputChange, placeholder: (_a = _this.props.placeholder) !== null && _a !== void 0 ? _a : locale.select.selectPlaceholder, onBlur: _this.handleBlur }), void 0));
|
|
350
|
+
} }, void 0)); } }, void 0));
|
|
254
351
|
};
|
|
255
352
|
BaseSelect.defaultProps = default_props_1.default;
|
|
256
353
|
return BaseSelect;
|
package/select/constants.d.ts
CHANGED
|
@@ -3,5 +3,8 @@ export declare const STATE_CHANGE_TYPE: {
|
|
|
3
3
|
readonly remove: "remove";
|
|
4
4
|
readonly clear: "clear";
|
|
5
5
|
readonly selectAll: "selectAll";
|
|
6
|
+
readonly inputChange: "inputChange";
|
|
6
7
|
};
|
|
7
8
|
export declare const UNGROUPED_ID = "__ungrouped";
|
|
9
|
+
export declare const LOADING_KEY = "__loading";
|
|
10
|
+
export declare const CLEARABLE_KEY = "clearable";
|
package/select/constants.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UNGROUPED_ID = exports.STATE_CHANGE_TYPE = void 0;
|
|
3
|
+
exports.CLEARABLE_KEY = exports.LOADING_KEY = exports.UNGROUPED_ID = exports.STATE_CHANGE_TYPE = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var select_1 = require("baseui/select");
|
|
6
|
-
exports.STATE_CHANGE_TYPE = (0, tslib_1.__assign)({ selectAll: 'selectAll' }, select_1.STATE_CHANGE_TYPE);
|
|
6
|
+
exports.STATE_CHANGE_TYPE = (0, tslib_1.__assign)({ selectAll: 'selectAll', inputChange: 'inputChange' }, select_1.STATE_CHANGE_TYPE);
|
|
7
7
|
exports.UNGROUPED_ID = '__ungrouped';
|
|
8
|
+
exports.LOADING_KEY = '__loading';
|
|
9
|
+
exports.CLEARABLE_KEY = 'clearable';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Options, Value, Type } from './types';
|
|
2
2
|
declare const defaultProps: {
|
|
3
3
|
autoFocus: boolean;
|
|
4
4
|
backspaceRemoves: boolean;
|
|
@@ -10,7 +10,10 @@ declare const defaultProps: {
|
|
|
10
10
|
error: boolean;
|
|
11
11
|
positive: boolean;
|
|
12
12
|
escapeClearsValue: boolean;
|
|
13
|
-
filterOptions:
|
|
13
|
+
filterOptions: ((options: Value, filterValue: string, excludeOptions: Value | null | undefined, a: {
|
|
14
|
+
valueKey: string;
|
|
15
|
+
labelKey: string;
|
|
16
|
+
}) => Value) | null | undefined;
|
|
14
17
|
filterOutSelected: boolean;
|
|
15
18
|
isLoading: boolean;
|
|
16
19
|
labelKey: string;
|
|
@@ -25,14 +28,15 @@ declare const defaultProps: {
|
|
|
25
28
|
onSelectResetsInput: boolean;
|
|
26
29
|
openOnClick: boolean;
|
|
27
30
|
startOpen: boolean;
|
|
28
|
-
options:
|
|
31
|
+
options: Options;
|
|
29
32
|
overrides: {};
|
|
30
33
|
required: boolean;
|
|
31
34
|
searchable: boolean;
|
|
32
|
-
size: Size;
|
|
33
35
|
type: "overlay" | Type | "mobile";
|
|
34
36
|
value: Value;
|
|
35
37
|
valueKey: string;
|
|
36
|
-
placement: "auto" | "bottom" | "left" | "right" | "top" | "topLeft" | "topRight" | "rightTop" | "rightBottom" | "
|
|
38
|
+
placement: "auto" | "bottom" | "left" | "right" | "top" | "topLeft" | "topRight" | "rightTop" | "rightBottom" | "bottomRight" | "bottomLeft" | "leftBottom" | "leftTop" | undefined;
|
|
39
|
+
virtual: boolean;
|
|
40
|
+
popoverMinWidth: string;
|
|
37
41
|
};
|
|
38
42
|
export default defaultProps;
|
package/select/default-props.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
4
|
var noop_1 = (0, tslib_1.__importDefault)(require("lodash/noop"));
|
|
5
5
|
var default_filter_options_1 = require("./utils/default-filter-options");
|
|
6
|
+
var list_1 = require("../list");
|
|
6
7
|
var defaultProps = {
|
|
7
8
|
autoFocus: false,
|
|
8
9
|
backspaceRemoves: true,
|
|
@@ -33,10 +34,12 @@ var defaultProps = {
|
|
|
33
34
|
overrides: {},
|
|
34
35
|
required: false,
|
|
35
36
|
searchable: true,
|
|
36
|
-
size: 'lg',
|
|
37
37
|
type: 'select',
|
|
38
38
|
value: [],
|
|
39
39
|
valueKey: 'id',
|
|
40
40
|
placement: 'bottom',
|
|
41
|
+
virtual: true,
|
|
42
|
+
// popoverMinWidth should have min-width same as the list minWidth
|
|
43
|
+
popoverMinWidth: "".concat(list_1.LIST_MIN_WIDTH, "px"),
|
|
41
44
|
};
|
|
42
45
|
exports.default = defaultProps;
|
package/select/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export type { Option, Value,
|
|
2
|
-
export { SELECT_ALL_ID } from './types';
|
|
1
|
+
export type { Option, Value, Options, Optgroups, StateReducer, OnChangeParams, ControlRef, ImperativeMethods, SelectProps, AutosizeInputProps, DropdownProps, StatefulSelectProps, StatefulContainerProps, SelectActions, SelectState, AutosizeInputState, StatefulContainerState, } from './types';
|
|
2
|
+
export { SELECT_ALL_ID, CLEAR_OPTION_ID } from './types';
|
|
3
3
|
export type { SelectLocale } from './locale';
|
|
4
|
-
export { STATE_CHANGE_TYPE } from './constants';
|
|
5
|
-
export { StyledRoot, StyledClearIcon, StyledControlContainer, StyledDropdownContainer, StyledIconsContainer, StyledInput, StyledInputContainer, StyledInputSizer, StyledPlaceholder,
|
|
4
|
+
export { STATE_CHANGE_TYPE, LOADING_KEY, CLEARABLE_KEY } from './constants';
|
|
5
|
+
export { StyledRoot, StyledClearIcon, StyledControlContainer, StyledDropdownContainer, StyledIconsContainer, StyledInput, StyledInputContainer, StyledInputSizer, StyledPlaceholder, StyledSearchIconContainer, StyledSelectArrow, StyledSingleValue, StyledValueContainer, NoResults, StyledOverlayContentContainer, } from './styled-component';
|
|
6
6
|
export type { StyledSelect } from './styled-component';
|
|
7
7
|
export { default as Select } from './select';
|
|
8
8
|
export { default as StatefulSelect } from './stateful-select';
|
package/select/index.js
CHANGED
|
@@ -3,11 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.defaultFilterOptions = exports.SingleValue = exports.MobileSheet = exports.SelectMenuAdapter = exports.MultiValue = exports.SingleSelect = exports.MultiSelect = exports.StatefulSelect = exports.Select = exports.StyledOverlayContentContainer = exports.NoResults = exports.StyledValueContainer = exports.StyledSingleValue = exports.StyledSelectArrow = exports.StyledSearchIconContainer = exports.
|
|
6
|
+
exports.defaultFilterOptions = exports.SingleValue = exports.MobileSheet = exports.SelectMenuAdapter = exports.MultiValue = exports.SingleSelect = exports.MultiSelect = exports.StatefulSelect = exports.Select = exports.StyledOverlayContentContainer = exports.NoResults = exports.StyledValueContainer = exports.StyledSingleValue = exports.StyledSelectArrow = exports.StyledSearchIconContainer = exports.StyledPlaceholder = exports.StyledInputSizer = exports.StyledInputContainer = exports.StyledInput = exports.StyledIconsContainer = exports.StyledDropdownContainer = exports.StyledControlContainer = exports.StyledClearIcon = exports.StyledRoot = exports.CLEARABLE_KEY = exports.LOADING_KEY = exports.STATE_CHANGE_TYPE = exports.CLEAR_OPTION_ID = exports.SELECT_ALL_ID = void 0;
|
|
7
7
|
var types_1 = require("./types");
|
|
8
8
|
Object.defineProperty(exports, "SELECT_ALL_ID", { enumerable: true, get: function () { return types_1.SELECT_ALL_ID; } });
|
|
9
|
+
Object.defineProperty(exports, "CLEAR_OPTION_ID", { enumerable: true, get: function () { return types_1.CLEAR_OPTION_ID; } });
|
|
9
10
|
var constants_1 = require("./constants");
|
|
10
11
|
Object.defineProperty(exports, "STATE_CHANGE_TYPE", { enumerable: true, get: function () { return constants_1.STATE_CHANGE_TYPE; } });
|
|
12
|
+
Object.defineProperty(exports, "LOADING_KEY", { enumerable: true, get: function () { return constants_1.LOADING_KEY; } });
|
|
13
|
+
Object.defineProperty(exports, "CLEARABLE_KEY", { enumerable: true, get: function () { return constants_1.CLEARABLE_KEY; } });
|
|
11
14
|
// styled-components
|
|
12
15
|
var styled_component_1 = require("./styled-component");
|
|
13
16
|
Object.defineProperty(exports, "StyledRoot", { enumerable: true, get: function () { return styled_component_1.StyledRoot; } });
|
|
@@ -19,7 +22,6 @@ Object.defineProperty(exports, "StyledInput", { enumerable: true, get: function
|
|
|
19
22
|
Object.defineProperty(exports, "StyledInputContainer", { enumerable: true, get: function () { return styled_component_1.StyledInputContainer; } });
|
|
20
23
|
Object.defineProperty(exports, "StyledInputSizer", { enumerable: true, get: function () { return styled_component_1.StyledInputSizer; } });
|
|
21
24
|
Object.defineProperty(exports, "StyledPlaceholder", { enumerable: true, get: function () { return styled_component_1.StyledPlaceholder; } });
|
|
22
|
-
Object.defineProperty(exports, "StyledSearchIcon", { enumerable: true, get: function () { return styled_component_1.StyledSearchIcon; } });
|
|
23
25
|
Object.defineProperty(exports, "StyledSearchIconContainer", { enumerable: true, get: function () { return styled_component_1.StyledSearchIconContainer; } });
|
|
24
26
|
Object.defineProperty(exports, "StyledSelectArrow", { enumerable: true, get: function () { return styled_component_1.StyledSelectArrow; } });
|
|
25
27
|
Object.defineProperty(exports, "StyledSingleValue", { enumerable: true, get: function () { return styled_component_1.StyledSingleValue; } });
|
package/select/locale.d.ts
CHANGED
|
@@ -12,12 +12,10 @@ var usePauseBodyScrollEffect_1 = require("./hooks/usePauseBodyScrollEffect");
|
|
|
12
12
|
exports.MobileSelect = React.memo(function (props) {
|
|
13
13
|
var overrides = props.overrides, children = props.children, label = props.label;
|
|
14
14
|
var _a = (0, tslib_1.__read)(React.useState(null), 2), scrollContainer = _a[0], setScrollContainer = _a[1];
|
|
15
|
-
var mergedOverrides = React.useMemo(function () { return (0, overrides_1.mergeOverrides)(overrides !== null && overrides !== void 0 ? overrides : {}, (0, overrides_2.getOverlayOverrides)({ overlayContainerRef: setScrollContainer, label: label })); }, [overrides]);
|
|
16
|
-
var childSelectOverrides = React.useMemo(function () { return (0, overrides_1.mergeOverrides)(overrides !== null && overrides !== void 0 ? overrides : {}, overrides_2.CHILD_SELECT_OVERRIDES); }, [
|
|
17
|
-
overrides,
|
|
18
|
-
]);
|
|
15
|
+
var mergedOverrides = React.useMemo(function () { return (0, overrides_1.mergeOverrides)(overrides !== null && overrides !== void 0 ? overrides : {}, (0, overrides_2.getOverlayOverrides)({ overlayContainerRef: setScrollContainer, label: label })); }, [overrides, label]);
|
|
16
|
+
var childSelectOverrides = React.useMemo(function () { return (0, overrides_1.mergeOverrides)(overrides !== null && overrides !== void 0 ? overrides : {}, overrides_2.CHILD_SELECT_OVERRIDES); }, [overrides]);
|
|
19
17
|
var overlaySelectProps = (0, omit_1.default)(props, overrides_2.OVERLAY_SELECT_PROPS_TO_OMIT);
|
|
20
18
|
var viewSelectProps = (0, omit_1.default)(props, overrides_2.CHILD_SELECT_PROPS_TO_OMIT);
|
|
21
19
|
(0, usePauseBodyScrollEffect_1.usePauseBodyScrollEffect)({ currentEl: scrollContainer || undefined });
|
|
22
|
-
return ((0, jsx_runtime_1.jsx)(index_1.Select, (0, tslib_1.__assign)({ overlayWidth: "100%", maxDropdownHeight: "100%", autoFocus: true }, overlaySelectProps, { overrides: mergedOverrides, type: "overlay" }, { children: React.isValidElement(children) ? (children) : ((0, jsx_runtime_1.jsx)(index_1.Select, (0, tslib_1.__assign)({}, viewSelectProps, { overrides: childSelectOverrides, type: "select" }), void 0)) }), void 0));
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(index_1.Select, (0, tslib_1.__assign)({ overlayWidth: "100%", maxDropdownHeight: "100%", autoFocus: true }, overlaySelectProps, { overrides: mergedOverrides, type: "overlay", filterOptions: overlaySelectProps.filterOptions }, { children: React.isValidElement(children) ? (children) : ((0, jsx_runtime_1.jsx)(index_1.Select, (0, tslib_1.__assign)({}, viewSelectProps, { filterOptions: viewSelectProps.filterOptions, overrides: childSelectOverrides, type: "select" }), void 0)) }), void 0));
|
|
23
21
|
});
|
|
@@ -20,6 +20,7 @@ var useKeyboardViewportShiftOffset_1 = require("./hooks/useKeyboardViewportShift
|
|
|
20
20
|
var overrides_1 = require("../../overrides");
|
|
21
21
|
var style_1 = require("../../style");
|
|
22
22
|
var constants_1 = require("./AdaptedCSSTransition/constants");
|
|
23
|
+
var locale_1 = require("../../locale");
|
|
23
24
|
var StyledSheetContainer = (0, style_1.styled)('div', 'spr-ui-01 fixed bottom-0 w-full z-50 flex flex-col', function (_a) {
|
|
24
25
|
var px2rem = _a.px2rem;
|
|
25
26
|
return ({
|
|
@@ -45,7 +46,8 @@ var MobileSheet = function (_a) {
|
|
|
45
46
|
var _e = (0, tslib_1.__read)((0, overrides_1.useOverrides)(overrides === null || overrides === void 0 ? void 0 : overrides.Label, StyledLabel), 2), Label = _e[0], labelProps = _e[1];
|
|
46
47
|
var _f = (0, tslib_1.__read)((0, overrides_1.useOverrides)(overrides === null || overrides === void 0 ? void 0 : overrides.Layer, layer_1.Layer), 2), Layer = _f[0], layerProps = _f[1];
|
|
47
48
|
var _g = (0, tslib_1.__read)((0, overrides_1.useOverrides)(overrides === null || overrides === void 0 ? void 0 : overrides.Backdrop, Backdrop_1.Backdrop), 2), BackdropComp = _g[0], backdropProps = _g[1];
|
|
48
|
-
|
|
49
|
+
var locale = (0, locale_1.useLocale)();
|
|
50
|
+
return ((0, jsx_runtime_1.jsx)(layer_2.LayersManager, (0, tslib_1.__assign)({ zIndex: layer_2.Z_INDEX.OVERLAY }, { children: (0, jsx_runtime_1.jsx)(Layer, (0, tslib_1.__assign)({}, layerProps, { children: (0, jsx_runtime_1.jsxs)(box_1.Box, (0, tslib_1.__assign)({ id: "".concat(sheetKey, "-container"), "data-testid": "sheetContainer", role: "contentinfo" }, { children: [(0, jsx_runtime_1.jsx)(BackdropComp, (0, tslib_1.__assign)({ show: visible, onHide: onHide, backdropKey: sheetKey }, backdropProps), void 0), (0, jsx_runtime_1.jsx)(AdaptedCSSTransition_1.default, (0, tslib_1.__assign)({ show: visible, transitionType: constants_1.TRANSITION_TYPES.SLIDE_FROM_BOTTOM }, { children: (0, jsx_runtime_1.jsxs)(SheetContainer, (0, tslib_1.__assign)({ "data-testid": "".concat(sheetKey, "-sheetContainer") }, sheetContainerProps, { className: [{ bottom: offsetBottom }, sheetStyles, sheetContainerProps.className], ref: combinedRef }, { children: [label && ((0, jsx_runtime_1.jsxs)(Label, (0, tslib_1.__assign)({}, labelProps, { children: [(0, jsx_runtime_1.jsx)(button_1.IconButton, (0, tslib_1.__assign)({ onClick: onHide, "aria-label": locale.select.hideButtonAriaLabel }, { children: (0, jsx_runtime_1.jsx)(chevron_down_1.default, { size: 12, className: { transform: 'rotate(90deg)' } }, void 0) }), void 0), (0, jsx_runtime_1.jsx)(typography_1.Typography, (0, tslib_1.__assign)({ variant: "h4" }, { children: label }), void 0)] }), void 0)), (0, jsx_runtime_1.jsx)(SwipeableTargetArea_1.SwipeableTargetArea, { onSwipeStart: onSwipeStart, onSwipe: onSwipe, onSwipeEnd: onSwipeEnd }, void 0), children] }), void 0) }), void 0)] }), void 0) }), void 0) }), void 0));
|
|
49
51
|
};
|
|
50
52
|
exports.MobileSheet = MobileSheet;
|
|
51
53
|
exports.MobileSheet.displayName = 'MobileSheet';
|