@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
|
@@ -4,7 +4,7 @@ NOTE: This file is only for size tooling.
|
|
|
4
4
|
Do not import anything from this module!
|
|
5
5
|
**/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.DateInput = exports.PhoneInput = exports.PaymentCard = exports.Video = exports.Typography = exports.Tooltip = exports.TimeZonePicker = exports.TimeRangePicker = exports.TimePicker = exports.Themes = exports.TextArea = exports.Tag = exports.Tabs = exports.Switch = exports.StyleEngine = exports.Style = exports.Stack = exports.SpacewebProvider = exports.SpaceConsumer = exports.Snackbar = exports.Slider = exports.Select = exports.Search = exports.Radio = exports.Popover = exports.Overrides = exports.Modal = exports.Menu = exports.Loader = exports.List = exports.Link = exports.Input = exports.Image = exports.Icons = exports.useCombinedRef = exports.useCombinedHandler = exports.Helpers = exports.Grid = exports.FormControl = exports.DatePicker = exports.Col = exports.ClassNames = exports.Checkbox = exports.ButtonGroup = exports.Button = exports.Box = exports.BaseButton = exports.Badge = exports.Avatar = void 0;
|
|
7
|
+
exports.Breadcrumb = exports.DateInput = exports.PhoneInput = exports.PaymentCard = exports.Video = exports.Typography = exports.Tooltip = exports.TimeZonePicker = exports.TimeRangePicker = exports.TimePicker = exports.Themes = exports.TextArea = exports.Tag = exports.Tabs = exports.Switch = exports.StyleEngine = exports.Style = exports.Stack = exports.SpacewebProvider = exports.SpaceConsumer = exports.Snackbar = exports.Slider = exports.Select = exports.Search = exports.Radio = exports.Popover = exports.Overrides = exports.Modal = exports.Menu = exports.Loader = exports.List = exports.Link = exports.Input = exports.Image = exports.Icons = exports.useCombinedRef = exports.useCombinedHandler = exports.Helpers = exports.Grid = exports.FormControl = exports.DatePicker = exports.Col = exports.ClassNames = exports.Checkbox = exports.ButtonGroup = exports.Button = exports.Box = exports.BaseButton = exports.Badge = exports.Avatar = void 0;
|
|
8
8
|
var tslib_1 = require("tslib");
|
|
9
9
|
(0, tslib_1.__exportStar)(require("./index"), exports);
|
|
10
10
|
exports.Avatar = (0, tslib_1.__importStar)(require("./avatar"));
|
|
@@ -57,3 +57,4 @@ exports.Video = (0, tslib_1.__importStar)(require("./video"));
|
|
|
57
57
|
exports.PaymentCard = (0, tslib_1.__importStar)(require("./payment-card"));
|
|
58
58
|
exports.PhoneInput = (0, tslib_1.__importStar)(require("./phone-input"));
|
|
59
59
|
exports.DateInput = (0, tslib_1.__importStar)(require("./date-input"));
|
|
60
|
+
exports.Breadcrumb = (0, tslib_1.__importStar)(require("./breadcrumb"));
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Created by Aneree on 03/11/20.
|
|
3
3
|
*/
|
|
4
|
-
import { ReactElement } from 'react';
|
|
4
|
+
import { ReactElement, ReactNode } from 'react';
|
|
5
5
|
import { AsyncSelectProps } from './types';
|
|
6
|
-
declare const AsyncSelect: (
|
|
6
|
+
declare const AsyncSelect: ({ loadOptions, initialOptions, resolveSelectedOptions, value, ...restProps }: AsyncSelectProps & {
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
}) => ReactElement;
|
|
7
9
|
export { AsyncSelect };
|
|
@@ -7,117 +7,52 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
7
7
|
* Created by Aneree on 03/11/20.
|
|
8
8
|
*/
|
|
9
9
|
var react_1 = require("react");
|
|
10
|
-
var keyBy_1 = (0, tslib_1.__importDefault)(require("lodash/keyBy"));
|
|
11
|
-
//components
|
|
12
10
|
var select_1 = require("../select");
|
|
13
|
-
|
|
14
|
-
var locale_1 = require("../locale");
|
|
15
|
-
var useLatest_1 = require("../hooks/useLatest");
|
|
16
|
-
var useCombinedRef_1 = (0, tslib_1.__importDefault)(require("../hooks/useCombinedRef"));
|
|
17
|
-
var useInputChangeHandler_1 = require("./hooks/useInputChangeHandler");
|
|
18
|
-
var useAsyncOptionHandlers_1 = require("./hooks/useAsyncOptionHandlers");
|
|
19
|
-
var useResolveSelectedOptions_1 = require("./hooks/useResolveSelectedOptions");
|
|
20
|
-
//helpers
|
|
11
|
+
var useAsyncSelect_1 = require("./hooks/useAsyncSelect");
|
|
21
12
|
var helpers_1 = require("./helpers");
|
|
22
|
-
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
(0, useResolveSelectedOptions_1.useResolveSelectedOptions)({
|
|
43
|
-
value: value,
|
|
44
|
-
valueKey: valueKey,
|
|
45
|
-
inputRef: inputRef,
|
|
46
|
-
allOptionsMap: allOptionsMap,
|
|
47
|
-
setOptions: setOptions,
|
|
48
|
-
setIsLoading: setIsLoading,
|
|
49
|
-
setAllOptionsMap: setAllOptionsMap,
|
|
50
|
-
resolveSelectedOptions: resolveSelectedOptions,
|
|
51
|
-
});
|
|
52
|
-
var _p = (0, useAsyncOptionHandlers_1.useAsyncOptionHandlers)({
|
|
53
|
-
valueKey: valueKey,
|
|
54
|
-
isLoading: isLoading,
|
|
55
|
-
minimumInput: minimumInput,
|
|
56
|
-
paginationBuffer: paginationBuffer,
|
|
57
|
-
inputRef: inputRef,
|
|
58
|
-
setAllOptionsMap: setAllOptionsMap,
|
|
59
|
-
setIsLoading: setIsLoading,
|
|
60
|
-
setOptions: setOptions,
|
|
61
|
-
loadOptions: loadOptions,
|
|
62
|
-
createOption: propsCreateOption,
|
|
63
|
-
}), fetchOptions = _p.fetchOptions, onPaginate = _p.onPaginate, inputChangeHandlerToDebounce = _p.onInputChange, createOption = _p.createOption;
|
|
64
|
-
var _onInputChange = (0, useInputChangeHandler_1.useInputChangeHandler)({
|
|
65
|
-
inputElement: inputElement,
|
|
66
|
-
listenAllInputChanges: listenAllInputChanges,
|
|
67
|
-
onInputChange: onInputChange,
|
|
68
|
-
inputChangeHandlerToDebounce: inputChangeHandlerToDebounce,
|
|
69
|
-
debounceInterval: debounceInterval,
|
|
70
|
-
});
|
|
71
|
-
/************************************************ HANDLING FOCUS ****************************************************/
|
|
72
|
-
var handleFocus = (0, react_1.useCallback)(function (event) {
|
|
73
|
-
/**
|
|
74
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/relatedTarget
|
|
75
|
-
* event.relatedTarget points to last focused element
|
|
76
|
-
*/
|
|
77
|
-
var lastFocusedNode = event.relatedTarget;
|
|
78
|
-
if (loadOnFocus && !(rootRef === null || rootRef === void 0 ? void 0 : rootRef.contains(lastFocusedNode)) && !(popoverRef === null || popoverRef === void 0 ? void 0 : popoverRef.contains(lastFocusedNode))) {
|
|
79
|
-
inputChangeHandlerToDebounce();
|
|
80
|
-
}
|
|
81
|
-
}, [loadOnFocus, inputChangeHandlerToDebounce, rootRef, popoverRef]);
|
|
82
|
-
/******************************************* HANDLING FETCH ON MOUNT ************************************************/
|
|
83
|
-
(0, react_1.useEffect)(function () {
|
|
84
|
-
if (loadOnMountRef.current) {
|
|
85
|
-
fetchOptions(0);
|
|
86
|
-
}
|
|
87
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- only want to load the options on first mount
|
|
88
|
-
}, []);
|
|
89
|
-
/********************************************************************************************************************/
|
|
90
|
-
var selectedOptions = (0, react_1.useMemo)(function () {
|
|
91
|
-
return value === null || value === void 0 ? void 0 : value.map(function (valueOption) {
|
|
92
|
-
var _a;
|
|
93
|
-
var optionKey = valueOption[valueKeyRef.current];
|
|
94
|
-
//In case of unresolved values, till the value is being resolved, show the unresolved value to the user
|
|
95
|
-
return (_a = allOptionsMap[optionKey]) !== null && _a !== void 0 ? _a : valueOption;
|
|
13
|
+
var constants_1 = require("../select/constants");
|
|
14
|
+
var UNGROUP_GROUP_CONFIG = [{ id: constants_1.UNGROUPED_ID, label: 'Ungrouped' }];
|
|
15
|
+
var AsyncSelect = function (_a) {
|
|
16
|
+
var loadOptions = _a.loadOptions, initialOptions = _a.initialOptions, resolveSelectedOptions = _a.resolveSelectedOptions, value = _a.value, restProps = (0, tslib_1.__rest)(_a, ["loadOptions", "initialOptions", "resolveSelectedOptions", "value"]);
|
|
17
|
+
var adaptedLoadOptions = (0, react_1.useCallback)(function (input, groupFilters) { return (0, tslib_1.__awaiter)(void 0, void 0, void 0, function () {
|
|
18
|
+
var _a, filter, _b, options, complete;
|
|
19
|
+
return (0, tslib_1.__generator)(this, function (_c) {
|
|
20
|
+
switch (_c.label) {
|
|
21
|
+
case 0:
|
|
22
|
+
_a = (0, tslib_1.__read)(groupFilters, 1), filter = _a[0];
|
|
23
|
+
if (!filter) {
|
|
24
|
+
return [2 /*return*/, { groups: [] }];
|
|
25
|
+
}
|
|
26
|
+
return [4 /*yield*/, loadOptions(input, filter.pageNumber)];
|
|
27
|
+
case 1:
|
|
28
|
+
_b = _c.sent(), options = _b.options, complete = _b.complete;
|
|
29
|
+
return [2 /*return*/, {
|
|
30
|
+
groups: [{ group: filter.group, options: options, complete: complete }],
|
|
31
|
+
}];
|
|
32
|
+
}
|
|
96
33
|
});
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
34
|
+
}); }, [loadOptions]);
|
|
35
|
+
var adaptedResolveSelectedOptions = (0, react_1.useCallback)(function (groupVsUnresolvedValueKeys) { return (0, tslib_1.__awaiter)(void 0, void 0, void 0, function () {
|
|
36
|
+
var resolvedOptions;
|
|
37
|
+
var _a;
|
|
38
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
39
|
+
switch (_b.label) {
|
|
40
|
+
case 0:
|
|
41
|
+
if (!resolveSelectedOptions) {
|
|
42
|
+
return [2 /*return*/, {}];
|
|
43
|
+
}
|
|
44
|
+
return [4 /*yield*/, resolveSelectedOptions(groupVsUnresolvedValueKeys[constants_1.UNGROUPED_ID] || [])];
|
|
45
|
+
case 1:
|
|
46
|
+
resolvedOptions = _b.sent();
|
|
47
|
+
return [2 /*return*/, (_a = {}, _a[constants_1.UNGROUPED_ID] = resolvedOptions, _a)];
|
|
107
48
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}, [
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
noResultsMsg: noResultsMsg,
|
|
117
|
-
inputText: (0, helpers_1.getInputValue)(inputRef),
|
|
118
|
-
minimumInput: minimumInput,
|
|
119
|
-
searchingText: searchingText !== null && searchingText !== void 0 ? searchingText : locale.asyncSelect.searchingText,
|
|
120
|
-
emptyInputMsg: locale.asyncSelect.emptyInputMsg,
|
|
121
|
-
}), createOption: createOption }), void 0));
|
|
49
|
+
});
|
|
50
|
+
}); }, [resolveSelectedOptions]);
|
|
51
|
+
var adaptedValue = (0, react_1.useMemo)(function () {
|
|
52
|
+
var _a;
|
|
53
|
+
return (value ? (_a = {}, _a[constants_1.UNGROUPED_ID] = value, _a) : value);
|
|
54
|
+
}, [value]);
|
|
55
|
+
var _b = (0, useAsyncSelect_1.useAsyncSelect)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, restProps), { initialOptions: (0, react_1.useMemo)(function () { return (0, helpers_1.arrayToGroupedOptions)(initialOptions || []); }, [initialOptions]), loadOptions: adaptedLoadOptions, groupConfig: UNGROUP_GROUP_CONFIG, resolveSelectedOptions: resolveSelectedOptions ? adaptedResolveSelectedOptions : undefined, value: adaptedValue })), resultCountMap = _b.resultCountMap, selectProps = (0, tslib_1.__rest)(_b, ["resultCountMap"]);
|
|
56
|
+
return (0, jsx_runtime_1.jsx)(select_1.Select, (0, tslib_1.__assign)({}, selectProps, { hideSelectAll: true }), void 0);
|
|
122
57
|
};
|
|
123
58
|
exports.AsyncSelect = AsyncSelect;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { GroupedAsyncSelectProps } from './types';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export declare const GroupedAsyncSelect: ({ onChange, showSelectAll, selectAllSelected, selectOnTab, ...restProps }: GroupedAsyncSelectProps & {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
}) => JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GroupedAsyncSelect = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var useAsyncSelect_1 = require("./hooks/useAsyncSelect");
|
|
7
|
+
var select_1 = require("../select");
|
|
8
|
+
var CollapsibleSelectMenu_1 = require("../select/selectMenuAdapter/CollapsibleSelectMenu");
|
|
9
|
+
var react_1 = require("react");
|
|
10
|
+
var overrides_1 = require("../overrides");
|
|
11
|
+
var helpers_1 = require("./helpers");
|
|
12
|
+
var reduce_1 = (0, tslib_1.__importDefault)(require("lodash/reduce"));
|
|
13
|
+
var isObject_1 = (0, tslib_1.__importDefault)(require("lodash/isObject"));
|
|
14
|
+
var default_props_1 = (0, tslib_1.__importDefault)(require("../select/default-props"));
|
|
15
|
+
var GroupedAsyncSelect = function (_a) {
|
|
16
|
+
var onChange = _a.onChange, showSelectAll = _a.showSelectAll, selectAllSelected = _a.selectAllSelected, selectOnTab = _a.selectOnTab, restProps = (0, tslib_1.__rest)(_a, ["onChange", "showSelectAll", "selectAllSelected", "selectOnTab"]);
|
|
17
|
+
var adaptedOnChange = (0, react_1.useCallback)(function (params) {
|
|
18
|
+
var groupedValue = (0, helpers_1.arrayToGroupedOptions)(params.value);
|
|
19
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange((0, tslib_1.__assign)((0, tslib_1.__assign)({}, params), { value: groupedValue, valueKeys: (0, reduce_1.default)(groupedValue, function (acc, values, groupId) {
|
|
20
|
+
acc[groupId] = values === null || values === void 0 ? void 0 : values.map(function (valueObjOrId) {
|
|
21
|
+
return (0, isObject_1.default)(valueObjOrId) ? valueObjOrId[restProps.valueKey || default_props_1.default.valueKey] : valueObjOrId;
|
|
22
|
+
});
|
|
23
|
+
return acc;
|
|
24
|
+
}, {}) }));
|
|
25
|
+
}, [onChange, restProps.valueKey]);
|
|
26
|
+
var _b = (0, useAsyncSelect_1.useAsyncSelect)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, restProps), { onChange: adaptedOnChange })), resultCountMap = _b.resultCountMap, selectProps = (0, tslib_1.__rest)(_b, ["resultCountMap"]);
|
|
27
|
+
var overrides = (0, react_1.useMemo)(function () {
|
|
28
|
+
return (0, overrides_1.mergeOverrides)({
|
|
29
|
+
StatefulMenu: {
|
|
30
|
+
component: CollapsibleSelectMenu_1.CollapsibleSelectMenu,
|
|
31
|
+
props: {
|
|
32
|
+
groupConfig: restProps.groupConfig.map(function (group) { return ((0, tslib_1.__assign)((0, tslib_1.__assign)({}, group), { count: resultCountMap[group.id] })); }),
|
|
33
|
+
clearAsOption: restProps.clearAsOption,
|
|
34
|
+
selectOnTab: selectOnTab,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
}, selectProps.overrides);
|
|
38
|
+
}, [selectProps.overrides, restProps.groupConfig, resultCountMap, restProps.clearAsOption, selectOnTab]);
|
|
39
|
+
return ((0, jsx_runtime_1.jsx)(select_1.Select, (0, tslib_1.__assign)({}, selectProps, { overrides: overrides, hideSelectAll: !showSelectAll, __selectAllShouldReturnAllOptions: showSelectAll, __selectAllSelected: selectAllSelected }, ((selectProps === null || selectProps === void 0 ? void 0 : selectProps.type) === 'overlay' ? { scrollContainer: 'menuContainer' } : {})), void 0));
|
|
40
|
+
};
|
|
41
|
+
exports.GroupedAsyncSelect = GroupedAsyncSelect;
|
package/asyncSelect/helpers.d.ts
CHANGED
|
@@ -3,15 +3,21 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { RefObject } from 'react';
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import { AllOptionsMap, Option } from './types';
|
|
6
|
+
import { AllOptionsMap, GroupConfig, GroupedOptions, Option } from './types';
|
|
7
|
+
import { normalizeOptions } from 'baseui/select/utils';
|
|
8
|
+
import { Value } from '../select/types';
|
|
7
9
|
export declare const getNoResultsMsg: ({ isLoading, minimumInput, inputText, noResultsMsg, searchingText, emptyInputMsg, }: {
|
|
8
10
|
isLoading: boolean;
|
|
9
11
|
minimumInput: number;
|
|
10
12
|
inputText: string;
|
|
11
13
|
noResultsMsg?: React.ReactNode;
|
|
12
|
-
searchingText:
|
|
14
|
+
searchingText: React.ReactNode;
|
|
13
15
|
emptyInputMsg: string;
|
|
14
16
|
}) => string | React.ReactNode | undefined;
|
|
15
17
|
export declare const shouldPaginate: (element: HTMLElement, paginationBuffer?: number) => boolean;
|
|
16
|
-
export declare const addOptionsInMap: (optionsMap: AllOptionsMap, options: Array<Option>, valueKey: string) => AllOptionsMap;
|
|
17
18
|
export declare const getInputValue: (inputRef: RefObject<HTMLInputElement>) => string;
|
|
19
|
+
export declare const arrayToGroupedOptions: (options: Array<Option> | GroupedOptions | Value) => GroupedOptions;
|
|
20
|
+
export declare const mergeOptions: (a: Array<Option> | GroupedOptions, b: Array<Option> | GroupedOptions) => GroupedOptions;
|
|
21
|
+
export declare const initGroupOptions: (groupConfig: GroupConfig) => GroupedOptions;
|
|
22
|
+
export declare const addOptionsInMap: (optionsMap: AllOptionsMap, options: Array<Option> | GroupedOptions, valueKey: string) => AllOptionsMap;
|
|
23
|
+
export { normalizeOptions };
|
package/asyncSelect/helpers.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.normalizeOptions = exports.addOptionsInMap = exports.initGroupOptions = exports.mergeOptions = exports.arrayToGroupedOptions = exports.getInputValue = exports.shouldPaginate = exports.getNoResultsMsg = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
+
var utils_1 = require("baseui/select/utils");
|
|
6
|
+
Object.defineProperty(exports, "normalizeOptions", { enumerable: true, get: function () { return utils_1.normalizeOptions; } });
|
|
7
|
+
var constants_1 = require("../select/constants");
|
|
5
8
|
var getNoResultsMsg = function (_a) {
|
|
6
9
|
var isLoading = _a.isLoading, minimumInput = _a.minimumInput, inputText = _a.inputText, noResultsMsg = _a.noResultsMsg, searchingText = _a.searchingText, emptyInputMsg = _a.emptyInputMsg;
|
|
7
10
|
if (isLoading) {
|
|
@@ -20,8 +23,38 @@ var shouldPaginate = function (element, paginationBuffer) {
|
|
|
20
23
|
element.scrollTop >= element.scrollHeight - element.clientHeight - paginationBuffer;
|
|
21
24
|
};
|
|
22
25
|
exports.shouldPaginate = shouldPaginate;
|
|
26
|
+
var getInputValue = function (inputRef) { var _a; return ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value) || ''; };
|
|
27
|
+
exports.getInputValue = getInputValue;
|
|
28
|
+
var arrayToGroupedOptions = function (options) {
|
|
29
|
+
if (!Array.isArray(options)) {
|
|
30
|
+
return options;
|
|
31
|
+
}
|
|
32
|
+
return options.reduce(function (acc, option) {
|
|
33
|
+
acc[option.__optgroup || constants_1.UNGROUPED_ID] = acc[option.__optgroup || constants_1.UNGROUPED_ID] || [];
|
|
34
|
+
acc[option.__optgroup || constants_1.UNGROUPED_ID].push(option);
|
|
35
|
+
return acc;
|
|
36
|
+
}, {});
|
|
37
|
+
};
|
|
38
|
+
exports.arrayToGroupedOptions = arrayToGroupedOptions;
|
|
39
|
+
var mergeOptions = function (a, b) {
|
|
40
|
+
var groupedA = (0, exports.arrayToGroupedOptions)(a), groupedB = (0, exports.arrayToGroupedOptions)(b);
|
|
41
|
+
var allKeys = Object.keys((0, tslib_1.__assign)((0, tslib_1.__assign)({}, groupedA), groupedB));
|
|
42
|
+
return allKeys.reduce(function (acc, key) {
|
|
43
|
+
acc[key] = (0, tslib_1.__spreadArray)((0, tslib_1.__spreadArray)([], (0, tslib_1.__read)((groupedA[key] || [])), false), (0, tslib_1.__read)((groupedB[key] || [])), false);
|
|
44
|
+
return acc;
|
|
45
|
+
}, {});
|
|
46
|
+
};
|
|
47
|
+
exports.mergeOptions = mergeOptions;
|
|
48
|
+
var initGroupOptions = function (groupConfig) {
|
|
49
|
+
return groupConfig.reduce(function (acc, _a) {
|
|
50
|
+
var id = _a.id;
|
|
51
|
+
acc[id] = [];
|
|
52
|
+
return acc;
|
|
53
|
+
}, {});
|
|
54
|
+
};
|
|
55
|
+
exports.initGroupOptions = initGroupOptions;
|
|
23
56
|
var addOptionsInMap = function (optionsMap, options, valueKey) {
|
|
24
|
-
var newOptions = options.filter(function (option) { return !optionsMap[option[valueKey]]; });
|
|
57
|
+
var newOptions = (0, utils_1.normalizeOptions)(options).filter(function (option) { return !optionsMap[option[valueKey]]; });
|
|
25
58
|
//Not creating a new map (reference) if there are no new options to be added
|
|
26
59
|
if (newOptions.length) {
|
|
27
60
|
var newOptionsMap_1 = (0, tslib_1.__assign)({}, optionsMap);
|
|
@@ -34,5 +67,3 @@ var addOptionsInMap = function (optionsMap, options, valueKey) {
|
|
|
34
67
|
return optionsMap;
|
|
35
68
|
};
|
|
36
69
|
exports.addOptionsInMap = addOptionsInMap;
|
|
37
|
-
var getInputValue = function (inputRef) { var _a; return ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value) || ''; };
|
|
38
|
-
exports.getInputValue = getInputValue;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Created by Aneree on 15/01/21.
|
|
3
3
|
*/
|
|
4
|
-
import { MutableRefObject } from 'react';
|
|
5
|
-
import {
|
|
6
|
-
import { SetStateFunc, AllOptionsMap, AsyncSelectProps } from '../types';
|
|
4
|
+
import { MutableRefObject, UIEvent } from 'react';
|
|
5
|
+
import { Options } from '../../select';
|
|
6
|
+
import { SetStateFunc, AllOptionsMap, AsyncSelectProps, LoadOptions, GroupedOptions, GroupConfig } from '../types';
|
|
7
|
+
import { Value } from 'baseui/select/types';
|
|
7
8
|
interface UseAsyncOptionHandlersArgs {
|
|
8
9
|
valueKey: string;
|
|
9
10
|
isLoading: boolean;
|
|
@@ -11,18 +12,22 @@ interface UseAsyncOptionHandlersArgs {
|
|
|
11
12
|
paginationBuffer?: number;
|
|
12
13
|
inputRef: MutableRefObject<HTMLInputElement | null>;
|
|
13
14
|
setIsLoading: SetStateFunc<boolean>;
|
|
14
|
-
setOptions: SetStateFunc<
|
|
15
|
+
setOptions: SetStateFunc<GroupedOptions>;
|
|
15
16
|
setAllOptionsMap: SetStateFunc<AllOptionsMap>;
|
|
16
|
-
loadOptions:
|
|
17
|
-
options: Array<Option>;
|
|
18
|
-
complete: boolean;
|
|
19
|
-
}>;
|
|
17
|
+
loadOptions: LoadOptions;
|
|
20
18
|
createOption: AsyncSelectProps['createOption'];
|
|
19
|
+
groupConfig: GroupConfig;
|
|
20
|
+
selectedOptions?: Value;
|
|
21
|
+
moveSelectedOptionsToTop: boolean;
|
|
21
22
|
}
|
|
22
|
-
declare const useAsyncOptionHandlers: ({ inputRef, valueKey, isLoading, setOptions, loadOptions, minimumInput, setIsLoading, paginationBuffer, setAllOptionsMap, createOption: propsCreateOption, }: UseAsyncOptionHandlersArgs) => {
|
|
23
|
-
onPaginate: (event:
|
|
23
|
+
declare const useAsyncOptionHandlers: ({ inputRef, valueKey, isLoading, setOptions, loadOptions, minimumInput, setIsLoading, paginationBuffer, setAllOptionsMap, createOption: propsCreateOption, groupConfig, selectedOptions, moveSelectedOptionsToTop, }: UseAsyncOptionHandlersArgs) => {
|
|
24
|
+
onPaginate: (event: UIEvent<HTMLElement>, itemGroup?: string) => void;
|
|
24
25
|
onInputChange: () => void;
|
|
25
|
-
fetchOptions: (
|
|
26
|
-
|
|
26
|
+
fetchOptions: (itemGroups: {
|
|
27
|
+
group: string;
|
|
28
|
+
pageNumber: number;
|
|
29
|
+
}[]) => Promise<void>;
|
|
30
|
+
createOption: ((label: string) => Promise<Options>) | undefined;
|
|
31
|
+
resultCountMap: Record<string, number | undefined>;
|
|
27
32
|
};
|
|
28
33
|
export { useAsyncOptionHandlers };
|
|
@@ -8,19 +8,26 @@ var tslib_1 = require("tslib");
|
|
|
8
8
|
var react_1 = require("react");
|
|
9
9
|
//hooks
|
|
10
10
|
var useLatest_1 = require("../../hooks/useLatest");
|
|
11
|
-
//helpers
|
|
12
11
|
var helpers_1 = require("../helpers");
|
|
12
|
+
var constants_1 = require("../../select/constants");
|
|
13
13
|
var useAsyncOptionHandlers = function (_a) {
|
|
14
|
-
var inputRef = _a.inputRef, valueKey = _a.valueKey, isLoading = _a.isLoading, setOptions = _a.setOptions, loadOptions = _a.loadOptions, minimumInput = _a.minimumInput, setIsLoading = _a.setIsLoading, paginationBuffer = _a.paginationBuffer, setAllOptionsMap = _a.setAllOptionsMap, propsCreateOption = _a.createOption;
|
|
15
|
-
var pageRef = (0, react_1.useRef)(
|
|
16
|
-
var completeRef = (0, react_1.useRef)(
|
|
17
|
-
var isPaginatingRef = (0, react_1.useRef)(
|
|
14
|
+
var inputRef = _a.inputRef, valueKey = _a.valueKey, isLoading = _a.isLoading, setOptions = _a.setOptions, loadOptions = _a.loadOptions, minimumInput = _a.minimumInput, setIsLoading = _a.setIsLoading, paginationBuffer = _a.paginationBuffer, setAllOptionsMap = _a.setAllOptionsMap, propsCreateOption = _a.createOption, groupConfig = _a.groupConfig, selectedOptions = _a.selectedOptions, moveSelectedOptionsToTop = _a.moveSelectedOptionsToTop;
|
|
15
|
+
var pageRef = (0, react_1.useRef)({});
|
|
16
|
+
var completeRef = (0, react_1.useRef)({});
|
|
17
|
+
var isPaginatingRef = (0, react_1.useRef)({});
|
|
18
|
+
var _b = (0, tslib_1.__read)((0, react_1.useState)({}), 2), resultCountMap = _b[0], setResultCountMap = _b[1];
|
|
19
|
+
var updateResultCount = (0, react_1.useCallback)(function (groupId, count) { return setResultCountMap(function (prev) {
|
|
20
|
+
var _a;
|
|
21
|
+
return ((0, tslib_1.__assign)((0, tslib_1.__assign)({}, prev), (_a = {}, _a[groupId] = count, _a)));
|
|
22
|
+
}); }, []);
|
|
18
23
|
var valueKeyRef = (0, useLatest_1.useLatest)(valueKey);
|
|
19
24
|
var loadOptionsRef = (0, useLatest_1.useLatest)(loadOptions);
|
|
20
25
|
var minimumInputRef = (0, useLatest_1.useLatest)(minimumInput);
|
|
21
26
|
var paginationBufferRef = (0, useLatest_1.useLatest)(paginationBuffer);
|
|
22
|
-
var
|
|
23
|
-
|
|
27
|
+
var selectedOptionsRef = (0, useLatest_1.useLatest)(selectedOptions);
|
|
28
|
+
var fetchOptions = (0, react_1.useCallback)(function (itemGroups) { return (0, tslib_1.__awaiter)(void 0, void 0, void 0, function () {
|
|
29
|
+
var timeoutId, loadedOptions, groupedOptions_1, selectedOptionsByGroup_1;
|
|
30
|
+
var _a;
|
|
24
31
|
return (0, tslib_1.__generator)(this, function (_b) {
|
|
25
32
|
switch (_b.label) {
|
|
26
33
|
case 0:
|
|
@@ -28,15 +35,39 @@ var useAsyncOptionHandlers = function (_a) {
|
|
|
28
35
|
_b.label = 1;
|
|
29
36
|
case 1:
|
|
30
37
|
_b.trys.push([1, , 3, 4]);
|
|
31
|
-
return [4 /*yield*/, loadOptionsRef.current((0, helpers_1.getInputValue)(inputRef),
|
|
38
|
+
return [4 /*yield*/, loadOptionsRef.current((0, helpers_1.getInputValue)(inputRef), itemGroups)];
|
|
32
39
|
case 2:
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
loadedOptions = _b.sent();
|
|
41
|
+
groupedOptions_1 = {};
|
|
42
|
+
selectedOptionsByGroup_1 = (0, helpers_1.arrayToGroupedOptions)((_a = selectedOptionsRef.current) !== null && _a !== void 0 ? _a : []);
|
|
43
|
+
loadedOptions.groups.forEach(function (_a) {
|
|
44
|
+
var options = _a.options, complete = _a.complete, group = _a.group, count = _a.count;
|
|
45
|
+
groupedOptions_1[group] = options;
|
|
46
|
+
completeRef.current[group] = complete;
|
|
47
|
+
updateResultCount(group, count);
|
|
48
|
+
});
|
|
49
|
+
setAllOptionsMap(function (prevOptions) { return (0, helpers_1.addOptionsInMap)(prevOptions, groupedOptions_1, valueKeyRef.current); });
|
|
35
50
|
//Merge options when it's not the first page
|
|
36
|
-
setOptions(function (prevOptions) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
51
|
+
setOptions(function (prevOptions) {
|
|
52
|
+
var updatedOptions = (0, tslib_1.__assign)({}, prevOptions);
|
|
53
|
+
itemGroups.forEach(function (_a) {
|
|
54
|
+
var group = _a.group, pageNumber = _a.pageNumber;
|
|
55
|
+
if (pageNumber) {
|
|
56
|
+
updatedOptions[group] = (0, tslib_1.__spreadArray)((0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(prevOptions[group]), false), (0, tslib_1.__read)(groupedOptions_1[group]), false);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
updatedOptions[group] =
|
|
60
|
+
moveSelectedOptionsToTop && selectedOptionsByGroup_1[group]
|
|
61
|
+
? (0, tslib_1.__spreadArray)((0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(selectedOptionsByGroup_1[group]), false), (0, tslib_1.__read)(groupedOptions_1[group]), false) : groupedOptions_1[group];
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
return updatedOptions;
|
|
65
|
+
});
|
|
66
|
+
itemGroups.forEach(function (_a) {
|
|
67
|
+
var group = _a.group, pageNumber = _a.pageNumber;
|
|
68
|
+
pageRef.current[group] = pageNumber;
|
|
69
|
+
isPaginatingRef.current[group] = false;
|
|
70
|
+
});
|
|
40
71
|
return [3 /*break*/, 4];
|
|
41
72
|
case 3:
|
|
42
73
|
clearTimeout(timeoutId);
|
|
@@ -45,34 +76,49 @@ var useAsyncOptionHandlers = function (_a) {
|
|
|
45
76
|
case 4: return [2 /*return*/];
|
|
46
77
|
}
|
|
47
78
|
});
|
|
48
|
-
}); }, [
|
|
49
|
-
|
|
79
|
+
}); }, [
|
|
80
|
+
inputRef,
|
|
81
|
+
loadOptionsRef,
|
|
82
|
+
setAllOptionsMap,
|
|
83
|
+
setIsLoading,
|
|
84
|
+
setOptions,
|
|
85
|
+
updateResultCount,
|
|
86
|
+
valueKeyRef,
|
|
87
|
+
selectedOptionsRef,
|
|
88
|
+
]);
|
|
89
|
+
var onPaginate = (0, react_1.useCallback)(function (event, itemGroup) {
|
|
90
|
+
var _a;
|
|
91
|
+
if (itemGroup === void 0) { itemGroup = constants_1.UNGROUPED_ID; }
|
|
50
92
|
if (!isLoading &&
|
|
51
|
-
!isPaginatingRef.current &&
|
|
52
|
-
!completeRef.current &&
|
|
93
|
+
!isPaginatingRef.current[itemGroup] &&
|
|
94
|
+
!completeRef.current[itemGroup] &&
|
|
53
95
|
(0, helpers_1.shouldPaginate)(event.target, paginationBufferRef.current)) {
|
|
54
|
-
isPaginatingRef.current = true;
|
|
55
|
-
fetchOptions(pageRef.current + 1);
|
|
96
|
+
isPaginatingRef.current[itemGroup] = true;
|
|
97
|
+
fetchOptions([{ group: itemGroup, pageNumber: ((_a = pageRef.current[itemGroup]) !== null && _a !== void 0 ? _a : 0) + 1 }]);
|
|
56
98
|
}
|
|
57
99
|
}, [fetchOptions, isLoading]);
|
|
58
100
|
var onInputChange = (0, react_1.useCallback)(function () {
|
|
59
101
|
if ((0, helpers_1.getInputValue)(inputRef).length < minimumInputRef.current) {
|
|
60
102
|
//reset state
|
|
61
103
|
setIsLoading(false);
|
|
62
|
-
setOptions(
|
|
63
|
-
pageRef.current =
|
|
64
|
-
completeRef.current =
|
|
104
|
+
setOptions((0, helpers_1.initGroupOptions)(groupConfig));
|
|
105
|
+
pageRef.current = {};
|
|
106
|
+
completeRef.current = {};
|
|
107
|
+
setResultCountMap({});
|
|
65
108
|
return;
|
|
66
109
|
}
|
|
67
|
-
fetchOptions(
|
|
68
|
-
|
|
110
|
+
fetchOptions(groupConfig.map(function (_a) {
|
|
111
|
+
var id = _a.id;
|
|
112
|
+
return ({ group: id, pageNumber: 0 });
|
|
113
|
+
}));
|
|
114
|
+
}, [fetchOptions, groupConfig]);
|
|
69
115
|
var createOption = (0, react_1.useCallback)(function (label) { return (0, tslib_1.__awaiter)(void 0, void 0, void 0, function () {
|
|
70
116
|
var createdOptions, err_1;
|
|
71
117
|
return (0, tslib_1.__generator)(this, function (_a) {
|
|
72
118
|
switch (_a.label) {
|
|
73
119
|
case 0:
|
|
74
120
|
if (!propsCreateOption) {
|
|
75
|
-
throw 'Spaceweb: [AsyncSelect] `createOption` is not defined';
|
|
121
|
+
throw new Error('Spaceweb: [AsyncSelect] `createOption` is not defined');
|
|
76
122
|
}
|
|
77
123
|
_a.label = 1;
|
|
78
124
|
case 1:
|
|
@@ -97,6 +143,7 @@ var useAsyncOptionHandlers = function (_a) {
|
|
|
97
143
|
onInputChange: onInputChange,
|
|
98
144
|
fetchOptions: fetchOptions,
|
|
99
145
|
createOption: propsCreateOption ? createOption : undefined,
|
|
146
|
+
resultCountMap: resultCountMap,
|
|
100
147
|
};
|
|
101
148
|
};
|
|
102
149
|
exports.useAsyncOptionHandlers = useAsyncOptionHandlers;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { OnChangeParams, SelectProps } from '../../select';
|
|
2
|
+
import { GroupedAsyncSelectProps, Id } from '../types';
|
|
3
|
+
export declare type UseAsyncSelectParams = Omit<GroupedAsyncSelectProps, 'onChange'> & {
|
|
4
|
+
onChange?: (params: OnChangeParams & {
|
|
5
|
+
valueKeys: Id[];
|
|
6
|
+
}) => unknown;
|
|
7
|
+
};
|
|
8
|
+
export declare const useAsyncSelect: (params: UseAsyncSelectParams) => SelectProps & {
|
|
9
|
+
resultCountMap: Record<string, number | undefined>;
|
|
10
|
+
};
|