@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
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAsyncSelect = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var react_1 = require("react");
|
|
6
|
+
var keyBy_1 = (0, tslib_1.__importDefault)(require("lodash/keyBy"));
|
|
7
|
+
var reduce_1 = (0, tslib_1.__importDefault)(require("lodash/reduce"));
|
|
8
|
+
var isObject_1 = (0, tslib_1.__importDefault)(require("lodash/isObject"));
|
|
9
|
+
//hooks
|
|
10
|
+
var locale_1 = require("../../locale");
|
|
11
|
+
var useLatest_1 = require("../../hooks/useLatest");
|
|
12
|
+
var useCombinedRef_1 = (0, tslib_1.__importDefault)(require("../../hooks/useCombinedRef"));
|
|
13
|
+
var useInputChangeHandler_1 = require("./useInputChangeHandler");
|
|
14
|
+
var useAsyncOptionHandlers_1 = require("./useAsyncOptionHandlers");
|
|
15
|
+
var useResolveSelectedOptions_1 = require("./useResolveSelectedOptions");
|
|
16
|
+
//helpers
|
|
17
|
+
var helpers_1 = require("../helpers");
|
|
18
|
+
var utils_1 = require("baseui/select/utils");
|
|
19
|
+
var helpers_2 = require("../../helpers");
|
|
20
|
+
//utils
|
|
21
|
+
var overrides_1 = require("../../overrides");
|
|
22
|
+
var default_props_1 = (0, tslib_1.__importDefault)(require("../../select/default-props"));
|
|
23
|
+
var constants_1 = require("../../select/constants");
|
|
24
|
+
var EMPTY_OBJ = {};
|
|
25
|
+
var useAsyncSelect = function (params) {
|
|
26
|
+
var loadOptions = params.loadOptions, searchingText = params.searchingText, paginationBuffer = params.paginationBuffer, debounceInterval = params.debounceInterval, resolveSelectedOptions = params.resolveSelectedOptions, _a = params.minimumInput, minimumInput = _a === void 0 ? 0 : _a, _b = params.loadOnMount, loadOnMount = _b === void 0 ? false : _b, _c = params.loadOnFocus, loadOnFocus = _c === void 0 ? false : _c, _d = params.initialOptions, initialOptions = _d === void 0 ? EMPTY_OBJ : _d, _e = params.listenAllInputChanges, listenAllInputChanges = _e === void 0 ? true : _e, groupConfig = params.groupConfig, resolveValuesOnUpdate = params.resolveValuesOnUpdate, hideUnresolvedValues = params.hideUnresolvedValues, _f = params.moveSelectedOptionsToTop, moveSelectedOptionsToTop = _f === void 0 ? false : _f,
|
|
27
|
+
//selectProps
|
|
28
|
+
onInputChange = params.onInputChange, noResultsMsg = params.noResultsMsg, overrides = params.overrides, groupedValue = params.value, controlRef = params.controlRef, propsInputRef = params.inputRef, propsCreateOption = params.createOption, _g = params.valueKey, valueKey = _g === void 0 ? default_props_1.default.valueKey : _g, _h = params.labelKey, labelKey = _h === void 0 ? default_props_1.default.labelKey : _h, propsOnChange = params.onChange, restSelectProps = (0, tslib_1.__rest)(params, ["loadOptions", "searchingText", "paginationBuffer", "debounceInterval", "resolveSelectedOptions", "minimumInput", "loadOnMount", "loadOnFocus", "initialOptions", "listenAllInputChanges", "groupConfig", "resolveValuesOnUpdate", "hideUnresolvedValues", "moveSelectedOptionsToTop", "onInputChange", "noResultsMsg", "overrides", "value", "controlRef", "inputRef", "createOption", "valueKey", "labelKey", "onChange"]);
|
|
29
|
+
var locale = (0, locale_1.useLocale)();
|
|
30
|
+
var loadOnMountRef = (0, useLatest_1.useLatest)(loadOnMount);
|
|
31
|
+
var _j = (0, tslib_1.__read)((0, react_1.useState)(function () {
|
|
32
|
+
return (0, helpers_1.mergeOptions)(initialOptions, (0, helpers_1.initGroupOptions)(groupConfig));
|
|
33
|
+
}), 2), options = _j[0], setOptions = _j[1];
|
|
34
|
+
var _k = (0, tslib_1.__read)((0, react_1.useState)(function () {
|
|
35
|
+
return (0, keyBy_1.default)((0, utils_1.normalizeOptions)(initialOptions), valueKey);
|
|
36
|
+
}), 2), allOptionsMap = _k[0], setAllOptionsMap = _k[1];
|
|
37
|
+
var _l = (0, tslib_1.__read)((0, react_1.useState)(null), 2), inputElement = _l[0], setInputElement = _l[1];
|
|
38
|
+
var inputRef = (0, useLatest_1.useLatest)(inputElement);
|
|
39
|
+
var combinedRef = (0, useCombinedRef_1.default)(setInputElement, propsInputRef);
|
|
40
|
+
var _m = (0, tslib_1.__read)((0, react_1.useState)(null), 2), rootRef = _m[0], setRootRef = _m[1];
|
|
41
|
+
var _o = (0, tslib_1.__read)((0, react_1.useState)(null), 2), popoverRef = _o[0], setPopoverRef = _o[1];
|
|
42
|
+
var _p = (0, useResolveSelectedOptions_1.useResolveSelectedOptions)({
|
|
43
|
+
groupedValue: groupedValue,
|
|
44
|
+
valueKey: valueKey,
|
|
45
|
+
inputRef: inputRef,
|
|
46
|
+
allOptionsMap: allOptionsMap,
|
|
47
|
+
setOptions: setOptions,
|
|
48
|
+
setAllOptionsMap: setAllOptionsMap,
|
|
49
|
+
resolveValuesOnUpdate: resolveValuesOnUpdate,
|
|
50
|
+
resolveSelectedOptions: resolveSelectedOptions,
|
|
51
|
+
}), unresolvedGroupedValueKeys = _p.unresolvedGroupedValueKeys, isResolvingValues = _p.isResolvingValues;
|
|
52
|
+
var _q = (0, tslib_1.__read)((0, react_1.useState)(loadOnMount), 2), _isLoading = _q[0], setIsLoading = _q[1];
|
|
53
|
+
var isLoading = isResolvingValues || _isLoading;
|
|
54
|
+
var unresolvedValueKeysRef = (0, react_1.useRef)([]);
|
|
55
|
+
var selectedOptions = (0, react_1.useMemo)(function () {
|
|
56
|
+
if (!groupedValue) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
unresolvedValueKeysRef.current = [];
|
|
60
|
+
var groupedValueObject = (0, reduce_1.default)(groupedValue, function (acc, values, groupId) {
|
|
61
|
+
acc[groupId] = (values || []).flatMap(function (valueObjOrId) {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
var valueId = (0, isObject_1.default)(valueObjOrId) ? valueObjOrId[valueKey] : valueObjOrId;
|
|
64
|
+
var isResolving = isResolvingValues && unresolvedGroupedValueKeys[groupId].includes(valueId);
|
|
65
|
+
var valueObject = (0, isObject_1.default)(valueObjOrId)
|
|
66
|
+
? valueObjOrId
|
|
67
|
+
: (_a = {},
|
|
68
|
+
_a[valueKey] = valueId,
|
|
69
|
+
_a[labelKey] = valueId,
|
|
70
|
+
_a);
|
|
71
|
+
var isUnresolved = !allOptionsMap[valueId];
|
|
72
|
+
var resolvedObject = isUnresolved ? valueObject : (0, tslib_1.__assign)((0, tslib_1.__assign)({}, valueObject), allOptionsMap[valueId]);
|
|
73
|
+
if (isResolving) {
|
|
74
|
+
return [(0, tslib_1.__assign)((0, tslib_1.__assign)({}, resolvedObject), (_b = {}, _b[constants_1.LOADING_KEY] = true, _b))];
|
|
75
|
+
}
|
|
76
|
+
if (isUnresolved && hideUnresolvedValues) {
|
|
77
|
+
unresolvedValueKeysRef.current.push({ id: valueId, groupId: groupId });
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
return [resolvedObject];
|
|
81
|
+
});
|
|
82
|
+
return acc;
|
|
83
|
+
}, {});
|
|
84
|
+
return (0, utils_1.normalizeOptions)(groupedValueObject);
|
|
85
|
+
},
|
|
86
|
+
// All options map needs to be present in the dependency list so that the values get recomputed when
|
|
87
|
+
// the resolved options have been fetched
|
|
88
|
+
[
|
|
89
|
+
groupedValue,
|
|
90
|
+
valueKey,
|
|
91
|
+
isResolvingValues,
|
|
92
|
+
unresolvedGroupedValueKeys,
|
|
93
|
+
labelKey,
|
|
94
|
+
allOptionsMap,
|
|
95
|
+
hideUnresolvedValues,
|
|
96
|
+
]);
|
|
97
|
+
var _r = (0, useAsyncOptionHandlers_1.useAsyncOptionHandlers)({
|
|
98
|
+
valueKey: valueKey,
|
|
99
|
+
isLoading: isLoading,
|
|
100
|
+
minimumInput: minimumInput,
|
|
101
|
+
paginationBuffer: paginationBuffer,
|
|
102
|
+
inputRef: inputRef,
|
|
103
|
+
setAllOptionsMap: setAllOptionsMap,
|
|
104
|
+
setIsLoading: setIsLoading,
|
|
105
|
+
setOptions: setOptions,
|
|
106
|
+
loadOptions: loadOptions,
|
|
107
|
+
createOption: propsCreateOption,
|
|
108
|
+
groupConfig: groupConfig,
|
|
109
|
+
selectedOptions: selectedOptions,
|
|
110
|
+
moveSelectedOptionsToTop: moveSelectedOptionsToTop,
|
|
111
|
+
}), fetchOptions = _r.fetchOptions, onPaginate = _r.onPaginate, inputChangeHandlerToDebounce = _r.onInputChange, createOption = _r.createOption, resultCountMap = _r.resultCountMap;
|
|
112
|
+
var _onInputChange = (0, useInputChangeHandler_1.useInputChangeHandler)({
|
|
113
|
+
inputElement: inputElement,
|
|
114
|
+
listenAllInputChanges: listenAllInputChanges,
|
|
115
|
+
onInputChange: onInputChange,
|
|
116
|
+
inputChangeHandlerToDebounce: inputChangeHandlerToDebounce,
|
|
117
|
+
debounceInterval: debounceInterval,
|
|
118
|
+
});
|
|
119
|
+
/************************************************ HANDLING FOCUS ****************************************************/
|
|
120
|
+
var handleFocus = (0, react_1.useCallback)(function (event) {
|
|
121
|
+
/**
|
|
122
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/relatedTarget
|
|
123
|
+
* event.relatedTarget points to last focused element
|
|
124
|
+
*/
|
|
125
|
+
var lastFocusedNode = event.relatedTarget;
|
|
126
|
+
if (loadOnFocus && !(rootRef === null || rootRef === void 0 ? void 0 : rootRef.contains(lastFocusedNode)) && !(popoverRef === null || popoverRef === void 0 ? void 0 : popoverRef.contains(lastFocusedNode))) {
|
|
127
|
+
inputChangeHandlerToDebounce();
|
|
128
|
+
}
|
|
129
|
+
}, [loadOnFocus, inputChangeHandlerToDebounce, rootRef, popoverRef]);
|
|
130
|
+
/******************************************* HANDLING FETCH ON MOUNT ************************************************/
|
|
131
|
+
(0, react_1.useEffect)(function () {
|
|
132
|
+
if (loadOnMountRef.current) {
|
|
133
|
+
fetchOptions(groupConfig.map(function (_a) {
|
|
134
|
+
var id = _a.id;
|
|
135
|
+
return ({ group: id, pageNumber: 0 });
|
|
136
|
+
}));
|
|
137
|
+
}
|
|
138
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- only want to load the options on first mount
|
|
139
|
+
}, []);
|
|
140
|
+
/********************************************************************************************************************/
|
|
141
|
+
var inputText = (0, helpers_1.getInputValue)(inputRef), adaptedNoResultsMsg = (0, helpers_1.getNoResultsMsg)({
|
|
142
|
+
isLoading: isLoading,
|
|
143
|
+
noResultsMsg: noResultsMsg,
|
|
144
|
+
inputText: inputText,
|
|
145
|
+
minimumInput: minimumInput,
|
|
146
|
+
searchingText: searchingText !== null && searchingText !== void 0 ? searchingText : locale.asyncSelect.searchingText,
|
|
147
|
+
emptyInputMsg: locale.asyncSelect.emptyInputMsg,
|
|
148
|
+
});
|
|
149
|
+
var mergedOverrides = (0, react_1.useMemo)(function () {
|
|
150
|
+
return (0, overrides_1.mergeOverrides)((0, tslib_1.__assign)({ Root: { props: { ref: setRootRef, onFocus: handleFocus } }, Popover: { props: { overrides: { Inner: { props: { ref: setPopoverRef } } } } }, StatefulMenu: { props: { $onPaginate: onPaginate } }, NoResults: { props: (0, helpers_2.add$props)({ isLoading: isLoading, inputText: inputText, adaptedNoResultsMsg: adaptedNoResultsMsg }) } }, (params.type === 'overlay'
|
|
151
|
+
? {
|
|
152
|
+
// In overlaySelect, overflow property is on OverlayContentContainer
|
|
153
|
+
OverlayContentContainer: { props: { onScroll: onPaginate } },
|
|
154
|
+
Menu: { props: { $onPaginate: onPaginate } },
|
|
155
|
+
}
|
|
156
|
+
: {
|
|
157
|
+
//Overriding DropdownContainer and not StatefulMenu so that async select remains functional even when
|
|
158
|
+
//user overrides StatefulMenu in favour of rendering virtualized menu
|
|
159
|
+
Menu: { props: { onScroll: onPaginate } },
|
|
160
|
+
})), overrides);
|
|
161
|
+
}, [handleFocus, onPaginate, isLoading, inputText, adaptedNoResultsMsg, params.type, overrides]);
|
|
162
|
+
var onChange = (0, react_1.useCallback)(function (onChangeParams) {
|
|
163
|
+
propsOnChange === null || propsOnChange === void 0 ? void 0 : propsOnChange((0, tslib_1.__assign)((0, tslib_1.__assign)({}, onChangeParams), { valueKeys: (0, tslib_1.__spreadArray)((0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(unresolvedValueKeysRef.current.map(function (_a) {
|
|
164
|
+
var id = _a.id;
|
|
165
|
+
return id;
|
|
166
|
+
})), false), (0, tslib_1.__read)(onChangeParams.value.map(function (opt) { return opt[valueKey]; })), false), value: unresolvedValueKeysRef.current.length
|
|
167
|
+
? (0, tslib_1.__spreadArray)((0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(unresolvedValueKeysRef.current.map(function (_a) {
|
|
168
|
+
var _b;
|
|
169
|
+
var id = _a.id, groupId = _a.groupId;
|
|
170
|
+
return (_b = {},
|
|
171
|
+
_b[valueKey] = id,
|
|
172
|
+
_b[labelKey] = id,
|
|
173
|
+
_b.__optgroup = groupId,
|
|
174
|
+
_b);
|
|
175
|
+
})), false), (0, tslib_1.__read)(onChangeParams.value), false) : onChangeParams.value }));
|
|
176
|
+
}, [propsOnChange, valueKey, labelKey]);
|
|
177
|
+
return (0, tslib_1.__assign)((0, tslib_1.__assign)({ children: undefined }, restSelectProps), { options: options, isLoading: isLoading, value: selectedOptions, controlRef: controlRef, inputRef: combinedRef, overrides: mergedOverrides, noResultsMsg: adaptedNoResultsMsg, createOption: createOption, onInputChange: _onInputChange, valueKey: valueKey, labelKey: labelKey, type: restSelectProps.type, resultCountMap: resultCountMap, onChange: onChange, onOpen: function () {
|
|
178
|
+
moveSelectedOptionsToTop && setOptions(function (prev) { return (0, helpers_1.mergeOptions)((selectedOptions || []), prev); });
|
|
179
|
+
restSelectProps.onOpen && restSelectProps.onOpen();
|
|
180
|
+
} });
|
|
181
|
+
};
|
|
182
|
+
exports.useAsyncSelect = useAsyncSelect;
|
|
@@ -2,17 +2,20 @@
|
|
|
2
2
|
* Created by Aneree on 15/01/21.
|
|
3
3
|
*/
|
|
4
4
|
import { MutableRefObject } from 'react';
|
|
5
|
-
import { Option
|
|
6
|
-
import {
|
|
5
|
+
import { Option } from '../../select';
|
|
6
|
+
import { AllOptionsMap, GroupedOptions, GroupedValue, Id, SetStateFunc } from '../types';
|
|
7
7
|
interface UseResolveSelectedOptionsArgs {
|
|
8
|
-
|
|
8
|
+
groupedValue?: GroupedValue;
|
|
9
9
|
valueKey: string;
|
|
10
10
|
allOptionsMap: AllOptionsMap;
|
|
11
|
-
|
|
11
|
+
resolveValuesOnUpdate?: boolean;
|
|
12
|
+
resolveSelectedOptions?: (groupVsUnresolvedValueKeys: Record<string, Array<Id>>) => Promise<Record<string, Array<Option>>>;
|
|
12
13
|
inputRef: MutableRefObject<HTMLInputElement | null>;
|
|
13
|
-
|
|
14
|
-
setOptions: SetStateFunc<Array<Option>>;
|
|
14
|
+
setOptions: SetStateFunc<GroupedOptions>;
|
|
15
15
|
setAllOptionsMap: SetStateFunc<AllOptionsMap>;
|
|
16
16
|
}
|
|
17
|
-
declare const useResolveSelectedOptions: ({
|
|
17
|
+
declare const useResolveSelectedOptions: ({ groupedValue, valueKey, allOptionsMap, resolveValuesOnUpdate, resolveSelectedOptions, inputRef, setOptions, setAllOptionsMap, }: UseResolveSelectedOptionsArgs) => {
|
|
18
|
+
isResolvingValues: boolean;
|
|
19
|
+
unresolvedGroupedValueKeys: Record<string, Id[]>;
|
|
20
|
+
};
|
|
18
21
|
export { useResolveSelectedOptions };
|
|
@@ -6,59 +6,71 @@ var tslib_1 = require("tslib");
|
|
|
6
6
|
* Created by Aneree on 15/01/21.
|
|
7
7
|
*/
|
|
8
8
|
var react_1 = require("react");
|
|
9
|
-
var
|
|
9
|
+
var forEach_1 = (0, tslib_1.__importDefault)(require("lodash/forEach"));
|
|
10
|
+
var isEmpty_1 = (0, tslib_1.__importDefault)(require("lodash/isEmpty"));
|
|
11
|
+
var isObject_1 = (0, tslib_1.__importDefault)(require("lodash/isObject"));
|
|
10
12
|
//hooks
|
|
11
|
-
var
|
|
13
|
+
var useFirstMountState_1 = require("../../hooks/useFirstMountState");
|
|
12
14
|
//helpers
|
|
13
15
|
var helpers_1 = require("../helpers");
|
|
14
16
|
var useResolveSelectedOptions = function (_a) {
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
setAllOptionsMap(function (prevOptions) { return (0, helpers_1.addOptionsInMap)(prevOptions, options_1, valueKeyRef.current); });
|
|
33
|
-
//Inject the resolved selected options into the options state
|
|
34
|
-
// 1. Only if currently shown options are not filtered i.e. user input text is empty (All options need to be shown)
|
|
35
|
-
if (!(0, helpers_1.getInputValue)(inputRef)) {
|
|
36
|
-
setOptions(function (prevOptions) {
|
|
37
|
-
// 2. Only if they are not already present in the state
|
|
38
|
-
var combinedOptions = (0, tslib_1.__spreadArray)((0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(prevOptions), false), (0, tslib_1.__read)(options_1), false), uniqueOptions = (0, uniqBy_1.default)(combinedOptions, valueKeyRef.current);
|
|
39
|
-
return prevOptions.length === uniqueOptions.length ? prevOptions : uniqueOptions;
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
setIsLoading(false);
|
|
43
|
-
return [3 /*break*/, 4];
|
|
44
|
-
case 3:
|
|
45
|
-
e_1 = _a.sent();
|
|
46
|
-
setIsLoading(false);
|
|
47
|
-
throw e_1;
|
|
48
|
-
case 4: return [2 /*return*/];
|
|
49
|
-
}
|
|
17
|
+
var groupedValue = _a.groupedValue, valueKey = _a.valueKey, allOptionsMap = _a.allOptionsMap, resolveValuesOnUpdate = _a.resolveValuesOnUpdate, resolveSelectedOptions = _a.resolveSelectedOptions, inputRef = _a.inputRef, setOptions = _a.setOptions, setAllOptionsMap = _a.setAllOptionsMap;
|
|
18
|
+
var isFirstMount = (0, useFirstMountState_1.useFirstMountState)();
|
|
19
|
+
var unresolvedValuesResults = (0, react_1.useRef)({
|
|
20
|
+
unresolvedGroupedValueKeys: {},
|
|
21
|
+
hasUnresolvedValues: false,
|
|
22
|
+
});
|
|
23
|
+
(0, react_1.useMemo)(function () {
|
|
24
|
+
var shouldCalculateUnresolvedValues = (resolveValuesOnUpdate || isFirstMount) && resolveSelectedOptions && !(0, isEmpty_1.default)(groupedValue);
|
|
25
|
+
if (!shouldCalculateUnresolvedValues) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
var unresolvedGroupedValueKeys = {}, hasUnresolvedValues = false;
|
|
29
|
+
(0, forEach_1.default)(groupedValue, function (values, groupId) {
|
|
30
|
+
unresolvedGroupedValueKeys[groupId] = (values !== null && values !== void 0 ? values : [])
|
|
31
|
+
.map(function (valueObjOrId) { return ((0, isObject_1.default)(valueObjOrId) ? valueObjOrId[valueKey] : valueObjOrId); })
|
|
32
|
+
.filter(function (valueId) { return !allOptionsMap[valueId]; });
|
|
33
|
+
hasUnresolvedValues = hasUnresolvedValues || unresolvedGroupedValueKeys[groupId].length > 0;
|
|
50
34
|
});
|
|
51
|
-
|
|
35
|
+
unresolvedValuesResults.current = { unresolvedGroupedValueKeys: unresolvedGroupedValueKeys, hasUnresolvedValues: hasUnresolvedValues };
|
|
36
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- calculate this on mount or when value changes
|
|
37
|
+
}, [groupedValue]);
|
|
38
|
+
var _b = unresolvedValuesResults.current, hasUnresolvedValues = _b.hasUnresolvedValues, unresolvedGroupedValueKeys = _b.unresolvedGroupedValueKeys;
|
|
39
|
+
var _c = (0, tslib_1.__read)((0, react_1.useState)(hasUnresolvedValues), 2), isResolvingValues = _c[0], setIsResolving = _c[1];
|
|
52
40
|
(0, react_1.useEffect)(function () {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var _valueKey_1 = valueKeyRef.current;
|
|
57
|
-
var unresolvedValueKeys = (_b = valueRef.current) === null || _b === void 0 ? void 0 : _b.filter(function (valueOption) { return !allOptionsMapRef.current[valueOption[_valueKey_1]]; }).map(function (valueOption) { return valueOption[_valueKey_1]; });
|
|
58
|
-
if (unresolvedValueKeys.length) {
|
|
59
|
-
fetchUnresolvedValueKeys(unresolvedValueKeys);
|
|
60
|
-
}
|
|
41
|
+
if (!hasUnresolvedValues || !resolveSelectedOptions) {
|
|
42
|
+
setIsResolving(false);
|
|
43
|
+
return;
|
|
61
44
|
}
|
|
62
|
-
|
|
45
|
+
var fetchUnresolvedValueKeys = function (_unresolvedGroupedValueKeys) { return (0, tslib_1.__awaiter)(void 0, void 0, void 0, function () {
|
|
46
|
+
var options_1;
|
|
47
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
48
|
+
switch (_a.label) {
|
|
49
|
+
case 0:
|
|
50
|
+
setIsResolving(true);
|
|
51
|
+
_a.label = 1;
|
|
52
|
+
case 1:
|
|
53
|
+
_a.trys.push([1, , 3, 4]);
|
|
54
|
+
return [4 /*yield*/, resolveSelectedOptions(_unresolvedGroupedValueKeys)];
|
|
55
|
+
case 2:
|
|
56
|
+
options_1 = _a.sent();
|
|
57
|
+
setAllOptionsMap(function (prevOptions) { return (0, helpers_1.addOptionsInMap)(prevOptions, options_1, valueKey); });
|
|
58
|
+
//Inject the resolved selected options into the options state
|
|
59
|
+
// 1. Only if currently shown options are not filtered i.e. user input text is empty (All options need to be shown)
|
|
60
|
+
if (!(0, helpers_1.getInputValue)(inputRef)) {
|
|
61
|
+
setOptions(function (prevOptions) { return (0, helpers_1.mergeOptions)(prevOptions, options_1); });
|
|
62
|
+
}
|
|
63
|
+
return [3 /*break*/, 4];
|
|
64
|
+
case 3:
|
|
65
|
+
setIsResolving(false);
|
|
66
|
+
return [7 /*endfinally*/];
|
|
67
|
+
case 4: return [2 /*return*/];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}); };
|
|
71
|
+
fetchUnresolvedValueKeys(unresolvedGroupedValueKeys);
|
|
72
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- this effect should run only when unresolvedValues is changed
|
|
73
|
+
}, [unresolvedGroupedValueKeys]);
|
|
74
|
+
return { isResolvingValues: isResolvingValues, unresolvedGroupedValueKeys: unresolvedGroupedValueKeys };
|
|
63
75
|
};
|
|
64
76
|
exports.useResolveSelectedOptions = useResolveSelectedOptions;
|
package/asyncSelect/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
export type { Value, Option, AsyncSelectProps } from './types';
|
|
1
|
+
export type { Value, AsyncSelectValue, GroupedValue, Option, GroupedOptions, AsyncSelectProps, GroupedAsyncSelectProps, } from './types';
|
|
2
2
|
export * from './locale';
|
|
3
3
|
export * from './asyncSelect';
|
|
4
|
+
export { GroupedAsyncSelect } from './groupedAsyncSelect';
|
|
5
|
+
export { arrayToGroupedOptions, normalizeOptions } from './helpers';
|
|
6
|
+
export { STATE_CHANGE_TYPE } from '../select';
|
package/asyncSelect/index.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.STATE_CHANGE_TYPE = exports.normalizeOptions = exports.arrayToGroupedOptions = exports.GroupedAsyncSelect = void 0;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
5
|
(0, tslib_1.__exportStar)(require("./locale"), exports);
|
|
5
6
|
(0, tslib_1.__exportStar)(require("./asyncSelect"), exports);
|
|
7
|
+
var groupedAsyncSelect_1 = require("./groupedAsyncSelect");
|
|
8
|
+
Object.defineProperty(exports, "GroupedAsyncSelect", { enumerable: true, get: function () { return groupedAsyncSelect_1.GroupedAsyncSelect; } });
|
|
9
|
+
var helpers_1 = require("./helpers");
|
|
10
|
+
Object.defineProperty(exports, "arrayToGroupedOptions", { enumerable: true, get: function () { return helpers_1.arrayToGroupedOptions; } });
|
|
11
|
+
Object.defineProperty(exports, "normalizeOptions", { enumerable: true, get: function () { return helpers_1.normalizeOptions; } });
|
|
12
|
+
var select_1 = require("../select");
|
|
13
|
+
Object.defineProperty(exports, "STATE_CHANGE_TYPE", { enumerable: true, get: function () { return select_1.STATE_CHANGE_TYPE; } });
|
package/asyncSelect/types.d.ts
CHANGED
|
@@ -1,29 +1,80 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Created by Aneree on 03/11/20.
|
|
3
3
|
*/
|
|
4
|
-
import { Dispatch,
|
|
5
|
-
import { SelectProps, Option, Value } from '../select/types';
|
|
4
|
+
import { Dispatch, ReactNode, SetStateAction } from 'react';
|
|
5
|
+
import { SelectProps, Option, Value, OnChangeParams } from '../select/types';
|
|
6
6
|
export declare type SetStateFunc<S> = Dispatch<SetStateAction<S>>;
|
|
7
|
-
export declare type
|
|
7
|
+
export declare type Id = string | number;
|
|
8
|
+
export declare type AllOptionsMap = Record<Id, Option>;
|
|
9
|
+
export declare type GroupedOptions = Record<string, Array<Option>>;
|
|
10
|
+
export declare type LoadOptions = (input: string, groupFilters: {
|
|
11
|
+
group: string;
|
|
12
|
+
pageNumber: number;
|
|
13
|
+
}[]) => Promise<{
|
|
14
|
+
groups: Array<{
|
|
15
|
+
group: string;
|
|
16
|
+
options: Array<Option>;
|
|
17
|
+
complete: boolean;
|
|
18
|
+
count?: number;
|
|
19
|
+
}>;
|
|
20
|
+
}>;
|
|
21
|
+
export declare type AsyncSelectValue = Array<Id | Option> | Value;
|
|
8
22
|
/**
|
|
9
23
|
* NOTE:
|
|
10
24
|
* AsyncSelect does not support select all option
|
|
11
25
|
* removed the support of these props in AsyncSelect
|
|
12
26
|
*/
|
|
13
|
-
|
|
14
|
-
loadOptions: (input: string, page: number) => Promise<{
|
|
15
|
-
options: Array<Option>;
|
|
16
|
-
complete: boolean;
|
|
17
|
-
}>;
|
|
27
|
+
declare type BaseAsyncSelectProps = Omit<SelectProps, 'isLoading' | 'options' | 'hideSelectAll' | 'value' | 'onChange' | 'scrollContainer'> & {
|
|
18
28
|
paginationBuffer?: number;
|
|
19
|
-
searchingText?:
|
|
29
|
+
searchingText?: ReactNode;
|
|
20
30
|
minimumInput?: number;
|
|
21
31
|
debounceInterval?: number;
|
|
22
|
-
initialOptions?: Array<Option>;
|
|
23
|
-
resolveSelectedOptions?: (unresolvedValueKeys: Array<string | number>) => Promise<Array<Option>>;
|
|
24
32
|
loadOnFocus?: boolean;
|
|
25
33
|
loadOnMount?: boolean;
|
|
26
|
-
controlRef?: MutableRefObject<HTMLInputElement> | RefCallback<HTMLInputElement> | null;
|
|
27
34
|
listenAllInputChanges?: boolean;
|
|
35
|
+
value?: AsyncSelectValue;
|
|
36
|
+
onChange?: (params: OnChangeParams & {
|
|
37
|
+
valueKeys: Id[];
|
|
38
|
+
}) => unknown;
|
|
39
|
+
resolveValuesOnUpdate?: boolean;
|
|
40
|
+
hideUnresolvedValues?: boolean;
|
|
41
|
+
moveSelectedOptionsToTop?: boolean;
|
|
42
|
+
};
|
|
43
|
+
export declare type AsyncSelectProps = BaseAsyncSelectProps & {
|
|
44
|
+
loadOptions: (input: string, page: number) => Promise<{
|
|
45
|
+
options: Array<Option>;
|
|
46
|
+
complete: boolean;
|
|
47
|
+
}>;
|
|
48
|
+
initialOptions?: Array<Option>;
|
|
49
|
+
resolveSelectedOptions?: (unresolvedValueKeys: Array<Id>) => Promise<Array<Option>>;
|
|
50
|
+
};
|
|
51
|
+
export declare type GroupConfig = Array<{
|
|
52
|
+
id: string;
|
|
53
|
+
label: string;
|
|
54
|
+
}>;
|
|
55
|
+
export declare type GroupedValue = Record<string, AsyncSelectValue>;
|
|
56
|
+
export declare type GroupedAsyncSelectProps = Omit<BaseAsyncSelectProps, 'creatable' | 'onChange' | 'value'> & {
|
|
57
|
+
loadOptions: (input: string, groupFilters: Array<{
|
|
58
|
+
group: string;
|
|
59
|
+
pageNumber: number;
|
|
60
|
+
}>) => Promise<{
|
|
61
|
+
groups: {
|
|
62
|
+
group: string;
|
|
63
|
+
options: Array<Option>;
|
|
64
|
+
complete: boolean;
|
|
65
|
+
count?: number;
|
|
66
|
+
}[];
|
|
67
|
+
}>;
|
|
68
|
+
initialOptions?: Record<string, Array<Option>>;
|
|
69
|
+
groupConfig: GroupConfig;
|
|
70
|
+
initialExpandedCount?: number;
|
|
71
|
+
resolveSelectedOptions?: (groupVsUnresolvedValueKeys: Record<string, Array<Id>>) => Promise<GroupedOptions>;
|
|
72
|
+
value?: GroupedValue;
|
|
73
|
+
onChange?: (params: Omit<OnChangeParams, 'value'> & {
|
|
74
|
+
value: GroupedOptions;
|
|
75
|
+
valueKeys: Record<string, Id[]>;
|
|
76
|
+
}) => unknown;
|
|
77
|
+
showSelectAll?: boolean;
|
|
78
|
+
selectAllSelected?: boolean;
|
|
28
79
|
};
|
|
29
80
|
export type { Value, Option };
|
package/avatar/avatar.js
CHANGED
|
@@ -23,6 +23,16 @@ function getInitials(name) {
|
|
|
23
23
|
var initials = words.map(function (word) { return word[0]; });
|
|
24
24
|
return initials.slice(0, 2).join('').toUpperCase();
|
|
25
25
|
}
|
|
26
|
+
//If Image is already available in disk cache, then we should directly set isImageLoaded state to true, to avoid flicker between initials and avatar.
|
|
27
|
+
var getIsImageLoaded = function (src) {
|
|
28
|
+
var isServer = typeof window === 'undefined';
|
|
29
|
+
if (!src || isServer) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
var imageEl = new Image();
|
|
33
|
+
imageEl.src = src;
|
|
34
|
+
return imageEl.complete;
|
|
35
|
+
};
|
|
26
36
|
var Icon = function (_a) {
|
|
27
37
|
var overrides = _a.overrides, className = _a.className, props = (0, tslib_1.__rest)(_a, ["overrides", "className"]);
|
|
28
38
|
var _b = (0, tslib_1.__read)((0, overrides_1.useOverrides)(overrides === null || overrides === void 0 ? void 0 : overrides.UserIcon, user_1.default), 2), UserIcon = _b[0], iconProps = _b[1];
|
|
@@ -30,8 +40,8 @@ var Icon = function (_a) {
|
|
|
30
40
|
};
|
|
31
41
|
var Avatar = function (props) {
|
|
32
42
|
var _a = (0, tslib_1.__read)((0, react_1.useState)(null), 2), imageRef = _a[0], setImageRef = _a[1];
|
|
33
|
-
var _b =
|
|
34
|
-
var
|
|
43
|
+
var _b = props.shape, shape = _b === void 0 ? 'circle' : _b, _c = props.size, size = _c === void 0 ? 'md' : _c, className = props.className, color = props.color, allowPhoneInitials = props.allowPhoneInitials, name = props.name, overrides = props.overrides, initials = props.initials, src = props.src;
|
|
44
|
+
var _d = (0, tslib_1.__read)((0, react_1.useState)(function () { return getIsImageLoaded(src); }), 2), imageLoaded = _d[0], setImageLoaded = _d[1];
|
|
35
45
|
var displayName = (0, cleanupDisplayName_1.cleanupDisplayName)(name);
|
|
36
46
|
var randomBgColor = (0, useAvatarColor_1.useAvatarColor)(displayName);
|
|
37
47
|
var isPhoneNumber = PHONENUMBER_REGEX.test(displayName);
|
package/avatar/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export { Avatar } from './avatar';
|
|
|
2
2
|
export { AvatarGroup } from './avatar-group';
|
|
3
3
|
export { StyledAvatarGroup, StyledAvatar, StyledInitials, StyledRoot } from './styled-component';
|
|
4
4
|
export { useAvatarColor } from './useAvatarColor';
|
|
5
|
-
export type { Spacing, Shape, Size, AvatarGroupProps, AvatarSharedProps, AvatarProps,
|
|
5
|
+
export type { Spacing, Shape, Size, AvatarGroupProps, AvatarSharedProps, AvatarProps, } from './types';
|
|
@@ -5,30 +5,15 @@ var tslib_1 = require("tslib");
|
|
|
5
5
|
var styled_1 = (0, tslib_1.__importDefault)(require("../style/styled"));
|
|
6
6
|
var longHandHelpers_1 = require("../helpers/longHandHelpers");
|
|
7
7
|
exports.avatarSizeConfig = {
|
|
8
|
-
sm: { size: '24px', rectangleBorderRadius: '6px', fontSize: '
|
|
9
|
-
md: { size: '34px', rectangleBorderRadius: '8px', fontSize: '
|
|
10
|
-
lg: { size: '40px', rectangleBorderRadius: '8px', fontSize: '
|
|
11
|
-
xl: { size: '48px', rectangleBorderRadius: '8px', fontSize: '
|
|
12
|
-
xxl: { size: '84px', rectangleBorderRadius: '12px', fontSize: '
|
|
13
|
-
xxxl: { size: '96px', rectangleBorderRadius: '12px', fontSize: '
|
|
8
|
+
sm: { size: '24px', rectangleBorderRadius: '6px', fontSize: '12px' },
|
|
9
|
+
md: { size: '34px', rectangleBorderRadius: '8px', fontSize: '17px' },
|
|
10
|
+
lg: { size: '40px', rectangleBorderRadius: '8px', fontSize: '20px' },
|
|
11
|
+
xl: { size: '48px', rectangleBorderRadius: '8px', fontSize: '24px' },
|
|
12
|
+
xxl: { size: '84px', rectangleBorderRadius: '12px', fontSize: '42px' },
|
|
13
|
+
xxxl: { size: '96px', rectangleBorderRadius: '12px', fontSize: '48px' },
|
|
14
14
|
};
|
|
15
15
|
var getSizeConfig = function (size) { var _a; return (_a = exports.avatarSizeConfig[size]) !== null && _a !== void 0 ? _a : exports.avatarSizeConfig.md; };
|
|
16
|
-
var getFontSize = function (size) {
|
|
17
|
-
if (size < 24)
|
|
18
|
-
return '8px';
|
|
19
|
-
else if (size < 36)
|
|
20
|
-
return '12px';
|
|
21
|
-
else if (size < 48)
|
|
22
|
-
return '16px';
|
|
23
|
-
else if (size < 60)
|
|
24
|
-
return '20px';
|
|
25
|
-
else if (size < 72)
|
|
26
|
-
return '24px';
|
|
27
|
-
else if (size < 84)
|
|
28
|
-
return '28px';
|
|
29
|
-
else
|
|
30
|
-
return '36px';
|
|
31
|
-
};
|
|
16
|
+
var getFontSize = function (size) { return "".concat(size / 2, "px"); };
|
|
32
17
|
exports.StyledAvatarGroup = (0, styled_1.default)('div', 'flex');
|
|
33
18
|
exports.StyledRoot = (0, styled_1.default)('div', 'box-border inline-block', function (_, _a) {
|
|
34
19
|
var $shape = _a.$shape, $color = _a.$color, $didImageFailToLoad = _a.$didImageFailToLoad, $avatarSize = _a.$avatarSize, $size = _a.$size;
|
package/avatar/types.d.ts
CHANGED
|
@@ -13,21 +13,23 @@ var sizeMap = {
|
|
|
13
13
|
lg: '50%',
|
|
14
14
|
};
|
|
15
15
|
var isCustomContent = function (content) { return typeof content === 'function'; };
|
|
16
|
-
var anchorOffset = function (
|
|
17
|
-
var
|
|
16
|
+
var anchorOffset = function (_a, _b) {
|
|
17
|
+
var isRTL = _a.isRTL;
|
|
18
|
+
var $horizontalPosition = _b.$horizontalPosition, $verticalPosition = _b.$verticalPosition, $overlap = _b.$overlap;
|
|
18
19
|
var offset = $overlap === 'rectangle' ? 0 : '14%';
|
|
19
20
|
var horizontalOffset = $horizontalPosition === 'left' ? { left: offset } : { right: offset };
|
|
20
21
|
var verticalOffset = $verticalPosition === 'top' ? { top: offset } : { bottom: offset };
|
|
22
|
+
var rtlHorizontalPosition = isRTL ? ($horizontalPosition === 'right' ? 'left' : 'right') : $horizontalPosition;
|
|
21
23
|
var transform = $verticalPosition === 'top'
|
|
22
24
|
? {
|
|
23
|
-
transform:
|
|
24
|
-
? 'translate(calc(-100% + min(1rem, 50%)), -50%)' // min of 1rem( for large elements ) and 50%( for small elements )
|
|
25
|
-
: 'translate(calc(100% - min(1rem, 50%)), -50%)',
|
|
25
|
+
transform: rtlHorizontalPosition === 'left'
|
|
26
|
+
? 'translate(calc(-100% + min(1rem, 50%)), -50%) /* @noflip */' // min of 1rem( for large elements ) and 50%( for small elements )
|
|
27
|
+
: 'translate(calc(100% - min(1rem, 50%)), -50%) /* @noflip */',
|
|
26
28
|
}
|
|
27
29
|
: {
|
|
28
|
-
transform:
|
|
29
|
-
? 'translate(calc(-100% + min(1rem, 50%)), 50%)'
|
|
30
|
-
: 'translate(calc(100% - min(1rem, 50%)), 50%)',
|
|
30
|
+
transform: rtlHorizontalPosition === 'left'
|
|
31
|
+
? 'translate(calc(-100% + min(1rem, 50%)), 50%) /* @noflip */'
|
|
32
|
+
: 'translate(calc(100% - min(1rem, 50%)), 50%) /* @noflip */',
|
|
31
33
|
};
|
|
32
34
|
return (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, horizontalOffset), verticalOffset), transform);
|
|
33
35
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const _default: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<import("react").AllHTMLAttributes<HTMLElement>, "style" | "className"> & {
|
|
3
|
+
$as?: import("react").ElementType<any> | undefined;
|
|
4
|
+
className?: import("..").Styles;
|
|
5
|
+
style?: import("..").Styles;
|
|
6
|
+
} & {
|
|
7
|
+
children?: import("react").ReactNode;
|
|
8
|
+
overrides?: {
|
|
9
|
+
Root?: import("../overrides").Override<Record<string, any>> | undefined;
|
|
10
|
+
} | undefined;
|
|
11
|
+
} & import("react").RefAttributes<HTMLElement>>>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
var react_1 = require("react");
|
|
6
|
+
var overrides_1 = require("../overrides");
|
|
7
|
+
var styled_component_1 = require("./styled-component");
|
|
8
|
+
var BannerItem = (0, react_1.forwardRef)(function (_a, ref) {
|
|
9
|
+
var _b = _a.overrides, overrides = _b === void 0 ? {} : _b, children = _a.children, restProps = (0, tslib_1.__rest)(_a, ["overrides", "children"]);
|
|
10
|
+
var _c = (0, tslib_1.__read)((0, overrides_1.useOverrides)(overrides.Root, styled_component_1.StyledBannerItem), 2), Root = _c[0], rootProps = _c[1];
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(Root, (0, tslib_1.__assign)({ "data-spaceweb": "banner-item", role: "listitem" }, rootProps, restProps, { ref: ref }, { children: children }), void 0));
|
|
12
|
+
});
|
|
13
|
+
BannerItem.displayName = 'BannerItem';
|
|
14
|
+
exports.default = (0, react_1.memo)(BannerItem);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Omit<import("../types").SpacewebComponentProps<React.AllHTMLAttributes<HTMLElement>>, "title"> & {
|
|
3
|
+
intent?: "success" | "warning" | "error" | undefined;
|
|
4
|
+
$as?: string | undefined;
|
|
5
|
+
collapsible?: boolean | undefined;
|
|
6
|
+
title: React.ReactNode;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
maxItemContainerHeight?: string | undefined;
|
|
9
|
+
overrides?: {
|
|
10
|
+
Root?: import("../overrides").Override<Record<string, any>> | undefined;
|
|
11
|
+
BannerItemContainer?: import("../overrides").Override<Record<string, any>> | undefined;
|
|
12
|
+
HeaderTitle?: import("../overrides").Override<Record<string, any>> | undefined;
|
|
13
|
+
HeaderIcon?: import("../overrides").Override<Record<string, any>> | undefined;
|
|
14
|
+
HeaderContainer?: import("../overrides").Override<Record<string, any>> | undefined;
|
|
15
|
+
TitleContainer?: import("../overrides").Override<Record<string, any>> | undefined;
|
|
16
|
+
ToggleButton?: import("../overrides").Override<Record<string, any>> | undefined;
|
|
17
|
+
} | undefined;
|
|
18
|
+
} & React.RefAttributes<HTMLElement>>>;
|
|
19
|
+
export default _default;
|