@sprinklrjs/spaceweb 11.0.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 +8 -2
- package/asyncSelect/helpers.js +35 -4
- package/asyncSelect/hooks/useAsyncOptionHandlers.d.ts +16 -11
- 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 +61 -9
- package/avatar/avatar.js +12 -2
- package/avatar/styled-component.js +7 -22
- package/badge/styled-component.js +10 -8
- package/banner/banner.js +1 -1
- 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 +2 -0
- package/button/Button.js +13 -1
- 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 +3 -1
- package/button/styled-components.js +30 -25
- package/button/types.d.ts +3 -0
- 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/styled-components.d.ts +34 -0
- package/button-group/styled-components.js +57 -9
- package/button-group/types.d.ts +2 -0
- package/checkbox/basewebAdapters.js +6 -1
- 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 +46 -25
- 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.js +5 -3
- package/date-picker/DateInput.js +16 -14
- package/date-picker/DatePickerContent.d.ts +9 -3
- package/date-picker/DatePickerContent.js +59 -8
- package/date-picker/DatePickerInput.js +9 -6
- package/date-picker/StatelessDatePicker.js +35 -16
- package/date-picker/locale.d.ts +2 -0
- package/date-picker/stateful-container.js +11 -8
- package/date-picker/styled-components.js +53 -3
- package/date-picker/types.d.ts +10 -1
- package/date-picker/utils.d.ts +3 -1
- package/date-picker/utils.js +8 -3
- 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 +8 -2
- package/esm/asyncSelect/helpers.js +31 -3
- package/esm/asyncSelect/hooks/useAsyncOptionHandlers.d.ts +16 -11
- 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 +61 -9
- package/esm/avatar/avatar.js +12 -2
- package/esm/avatar/styled-component.js +7 -22
- package/esm/badge/styled-component.js +10 -8
- package/esm/banner/banner.js +1 -1
- 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 +2 -0
- package/esm/button/Button.js +13 -1
- 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 +3 -1
- package/esm/button/styled-components.js +30 -25
- package/esm/button/types.d.ts +3 -0
- 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/styled-components.d.ts +34 -0
- package/esm/button-group/styled-components.js +55 -8
- package/esm/button-group/types.d.ts +2 -0
- package/esm/checkbox/basewebAdapters.js +6 -1
- 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 +47 -26
- 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.js +5 -3
- package/esm/date-picker/DateInput.js +17 -15
- package/esm/date-picker/DatePickerContent.d.ts +9 -3
- package/esm/date-picker/DatePickerContent.js +60 -9
- package/esm/date-picker/DatePickerInput.js +9 -6
- package/esm/date-picker/StatelessDatePicker.js +35 -16
- package/esm/date-picker/locale.d.ts +2 -0
- package/esm/date-picker/stateful-container.js +11 -8
- package/esm/date-picker/styled-components.js +53 -3
- package/esm/date-picker/types.d.ts +10 -1
- package/esm/date-picker/utils.d.ts +3 -1
- package/esm/date-picker/utils.js +9 -4
- 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/form-control.d.ts +1 -1
- package/esm/form-control/form-control.js +17 -12
- package/esm/form-control/styled-component.js +17 -6
- 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/commonStyles.js +3 -6
- package/esm/helpers/index.d.ts +1 -0
- package/esm/helpers/index.js +8 -0
- package/esm/helpers/themeHelpers.d.ts +1 -0
- package/esm/helpers/themeHelpers.js +13 -0
- package/esm/hooks/useAutoFocus.js +6 -0
- package/esm/hooks/useMatchMedia.js +13 -2
- 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.js +18 -3
- package/esm/input/styled-components.js +8 -6
- package/esm/input/types.d.ts +4 -1
- package/esm/layer/useLayersContextValue.js +3 -2
- package/esm/list/avatar-list-item.d.ts +12 -22
- package/esm/list/avatar-list-item.js +6 -4
- 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/styled-component.d.ts +1 -0
- package/esm/list/styled-component.js +23 -15
- package/esm/list/types.d.ts +3 -0
- package/esm/locale/en_US.js +26 -0
- package/esm/locale/types.d.ts +19 -0
- package/esm/menu/MenuContext.d.ts +2 -1
- package/esm/menu/MenuContext.js +1 -0
- package/esm/menu/menu-item.d.ts +4 -1
- package/esm/menu/menu-item.js +11 -11
- package/esm/menu/menu.d.ts +1 -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/modal.js +3 -1
- package/esm/modal/overrides.d.ts +2 -2
- package/esm/modal/overrides.js +6 -7
- package/esm/modal/styled-components.js +7 -7
- 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 +1 -1
- package/esm/payment-card/basewebAdapters.d.ts +2 -0
- package/esm/payment-card/basewebAdapters.js +23 -1
- package/esm/payment-card/styled-components.js +25 -6
- package/esm/phone-input/country-select-container.js +1 -1
- package/esm/phone-input/country-select.js +3 -3
- package/esm/phone-input/default-props.d.ts +5 -5
- package/esm/phone-input/default-props.js +7 -7
- package/esm/phone-input/flag-container.js +1 -1
- package/esm/phone-input/phone-input.d.ts +0 -4
- package/esm/phone-input/phone-input.js +20 -12
- package/esm/phone-input/stateful-phone-input-container.js +4 -3
- package/esm/phone-input/stateful-phone-input.d.ts +0 -4
- 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 +5 -1
- package/esm/phone-input/utils.js +6 -1
- package/esm/popover/adapter.d.ts +1 -0
- package/esm/popover/adapter.js +15 -0
- package/esm/popover/overrides.js +8 -19
- package/esm/popover/popover.d.ts +1 -0
- package/esm/popover/popover.js +9 -4
- package/esm/popover/stateful-popover.js +2 -2
- package/esm/popover/types.d.ts +3 -0
- package/esm/popover/utils.d.ts +12 -0
- package/esm/popover/utils.js +9 -0
- package/esm/progress/linear/styled-component.d.ts +1 -1
- package/esm/progress/linear/styled-component.js +5 -5
- package/esm/radio/styled-components.js +5 -5
- 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/base-select.d.ts +22 -5
- package/esm/select/base-select.js +174 -82
- package/esm/select/constants.d.ts +3 -0
- package/esm/select/constants.js +3 -1
- package/esm/select/default-props.d.ts +1 -0
- package/esm/select/default-props.js +3 -0
- package/esm/select/index.d.ts +2 -2
- package/esm/select/index.js +2 -2
- package/esm/select/locale.d.ts +4 -0
- package/esm/select/mobileSelect/MobileSheet.js +3 -1
- package/esm/select/multi-value.js +22 -12
- package/esm/select/overlaySelect/OverlaySelect.js +1 -0
- package/esm/select/overlaySelect/hooks/useOverlaySelectOverrides.d.ts +2 -1
- package/esm/select/overlaySelect/hooks/useOverlaySelectOverrides.js +13 -16
- package/esm/select/overrides.d.ts +3 -0
- package/esm/select/overrides.js +19 -6
- package/esm/select/select.d.ts +1 -0
- 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 -34
- package/esm/select/selectMenuAdapter/SelectMenuAdapter.js +3 -3
- package/esm/select/selectMenuAdapter/SelectMenuItem.d.ts +4 -1
- 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 +1 -0
- package/esm/select/styled-component.d.ts +10 -1
- package/esm/select/styled-component.js +39 -15
- package/esm/select/types.d.ts +23 -1
- 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/styled-components.js +4 -4
- package/esm/snackbar/Snackbar.js +12 -12
- package/esm/snackbar/styled-component.js +9 -6
- package/esm/spacewebProvider/SpacewebProvider.d.ts +2 -0
- 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 +7 -2
- package/esm/style/useMemoizedStyletron.js +6 -1
- package/esm/switch/styled-components.js +3 -3
- 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 +3 -3
- package/esm/textarea/textarea.js +3 -3
- package/esm/textarea/types.d.ts +2 -2
- 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/time-picker/TimePicker.js +4 -1
- package/esm/time-range-picker/RangeSelectorContainer.js +1 -1
- package/esm/time-range-picker/TimeRangePicker.js +20 -12
- package/esm/time-range-picker/index.d.ts +1 -1
- package/esm/time-range-picker/index.js +1 -1
- package/esm/time-range-picker/types.d.ts +1 -2
- package/esm/time-range-picker/utils.d.ts +33 -4
- package/esm/time-range-picker/utils.js +49 -15
- package/esm/time-zone-picker/types.d.ts +2 -0
- package/esm/tooltip/overrides.js +0 -1
- package/esm/tooltip/stateful-tooltip.js +2 -2
- package/esm/tooltip/tooltip.d.ts +1 -1
- package/esm/tooltip/tooltip.js +5 -2
- package/esm/tooltip/types.d.ts +2 -0
- package/esm/types.d.ts +2 -1
- 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/form-control/form-control.d.ts +1 -1
- package/form-control/form-control.js +16 -11
- package/form-control/styled-component.js +17 -6
- 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/commonStyles.js +3 -6
- package/helpers/index.d.ts +1 -0
- package/helpers/index.js +10 -1
- package/helpers/themeHelpers.d.ts +1 -0
- package/helpers/themeHelpers.js +15 -1
- package/hooks/useAutoFocus.js +6 -0
- package/hooks/useMatchMedia.js +13 -2
- 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.js +18 -3
- package/input/styled-components.js +7 -5
- package/input/types.d.ts +4 -1
- package/layer/useLayersContextValue.js +2 -1
- package/list/avatar-list-item.d.ts +12 -22
- package/list/avatar-list-item.js +5 -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/styled-component.d.ts +1 -0
- package/list/styled-component.js +24 -16
- package/list/types.d.ts +3 -0
- package/locale/en_US.js +26 -0
- package/locale/types.d.ts +19 -0
- package/menu/MenuContext.d.ts +2 -1
- package/menu/MenuContext.js +1 -0
- package/menu/menu-item.d.ts +4 -1
- package/menu/menu-item.js +11 -11
- package/menu/menu.d.ts +1 -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/modal.js +3 -1
- package/modal/overrides.d.ts +2 -2
- package/modal/overrides.js +6 -7
- package/modal/styled-components.js +7 -7
- 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 +2 -1
- package/package.json +8 -5
- package/payment-card/basewebAdapters.d.ts +2 -0
- package/payment-card/basewebAdapters.js +23 -1
- package/payment-card/styled-components.js +24 -5
- package/phone-input/country-select-container.js +1 -1
- package/phone-input/country-select.js +3 -3
- package/phone-input/default-props.d.ts +5 -5
- package/phone-input/default-props.js +8 -7
- package/phone-input/flag-container.js +1 -1
- package/phone-input/phone-input.d.ts +0 -4
- package/phone-input/phone-input.js +19 -11
- package/phone-input/stateful-phone-input-container.js +4 -3
- package/phone-input/stateful-phone-input.d.ts +0 -4
- 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 +5 -1
- package/phone-input/utils.js +7 -1
- package/popover/adapter.d.ts +1 -0
- package/popover/adapter.js +16 -1
- package/popover/overrides.js +8 -19
- package/popover/popover.d.ts +1 -0
- package/popover/popover.js +8 -3
- package/popover/stateful-popover.js +2 -2
- package/popover/types.d.ts +3 -0
- package/popover/utils.d.ts +12 -0
- package/popover/utils.js +11 -1
- package/progress/linear/styled-component.d.ts +1 -1
- package/progress/linear/styled-component.js +5 -5
- package/radio/styled-components.js +5 -5
- 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/base-select.d.ts +22 -5
- package/select/base-select.js +172 -80
- package/select/constants.d.ts +3 -0
- package/select/constants.js +4 -2
- package/select/default-props.d.ts +1 -0
- package/select/default-props.js +3 -0
- package/select/index.d.ts +2 -2
- package/select/index.js +4 -1
- package/select/locale.d.ts +4 -0
- package/select/mobileSelect/MobileSheet.js +3 -1
- package/select/multi-value.js +21 -11
- package/select/overlaySelect/OverlaySelect.js +1 -0
- package/select/overlaySelect/hooks/useOverlaySelectOverrides.d.ts +2 -1
- package/select/overlaySelect/hooks/useOverlaySelectOverrides.js +13 -16
- package/select/overrides.d.ts +3 -0
- package/select/overrides.js +20 -6
- package/select/select.d.ts +1 -0
- 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 -34
- package/select/selectMenuAdapter/SelectMenuAdapter.js +3 -3
- package/select/selectMenuAdapter/SelectMenuItem.d.ts +4 -1
- 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 +1 -0
- package/select/styled-component.d.ts +10 -1
- package/select/styled-component.js +38 -14
- package/select/types.d.ts +23 -1
- 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/styled-components.js +4 -4
- package/snackbar/Snackbar.js +12 -12
- package/snackbar/styled-component.js +9 -6
- package/spacewebProvider/SpacewebProvider.d.ts +2 -0
- 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 +7 -2
- package/style/useMemoizedStyletron.js +6 -1
- package/switch/styled-components.js +3 -3
- 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 +2 -2
- package/textarea/textarea.js +2 -2
- package/textarea/types.d.ts +2 -2
- 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/time-picker/TimePicker.js +4 -1
- package/time-range-picker/RangeSelectorContainer.js +1 -1
- package/time-range-picker/TimeRangePicker.js +19 -11
- package/time-range-picker/index.d.ts +1 -1
- package/time-range-picker/index.js +4 -1
- package/time-range-picker/types.d.ts +1 -2
- package/time-range-picker/utils.d.ts +33 -4
- package/time-range-picker/utils.js +53 -17
- package/time-zone-picker/types.d.ts +2 -0
- package/tooltip/overrides.js +0 -1
- package/tooltip/stateful-tooltip.js +2 -2
- package/tooltip/tooltip.d.ts +1 -1
- package/tooltip/tooltip.js +5 -2
- package/tooltip/types.d.ts +2 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/types.d.ts +2 -1
- 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/esm/icon/components/chevron-right-solid.d.ts +0 -3
- package/esm/icon/components/chevron-right-solid.js +0 -6
- package/icon/components/chevron-right-solid.d.ts +0 -3
- package/icon/components/chevron-right-solid.js +0 -9
|
@@ -1,46 +1,51 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
2
|
import { borderRadius as borderRadiusLonghand, borderStyle, borderColor, borderWidth, margin, } from '../helpers/longHandHelpers';
|
|
3
|
-
import { getComponentSizeTheme, getComponentTheme } from '../helpers/themeHelpers';
|
|
4
3
|
import { getFocusVisibleStyles } from '../helpers/commonStyles';
|
|
5
4
|
import { styled } from '../style';
|
|
6
5
|
import { getIntentStyles } from './intentStyles';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
import { getTagSizeTheme } from './utils';
|
|
7
|
+
export var StyledStartEnhancer = styled('div', 'inline-flex items-center', function (_a, _b) {
|
|
8
|
+
var px2rem = _a.px2rem, theme = _a.theme;
|
|
9
|
+
var $size = _b.$size;
|
|
10
|
+
var _c = getTagSizeTheme(theme, $size), startEnhancerMarginLeft = _c.startEnhancerMarginLeft, startEnhancerMarginRight = _c.startEnhancerMarginRight;
|
|
11
|
+
return {
|
|
12
|
+
marginRight: startEnhancerMarginRight,
|
|
13
|
+
marginLeft: startEnhancerMarginLeft,
|
|
14
|
+
};
|
|
12
15
|
});
|
|
13
16
|
export var StyledRoot = styled('span', 'inline-flex items-center box-border', function (utils, _a) {
|
|
14
17
|
var _b;
|
|
15
18
|
var $withStartEnhancer = _a.$withStartEnhancer, $size = _a.$size, $closeable = _a.$closeable, $intent = _a.$intent, $variant = _a.$variant, $clickable = _a.$clickable, $isFocusVisible = _a.$isFocusVisible;
|
|
16
|
-
var
|
|
17
|
-
var paddingStartDir =
|
|
18
|
-
var paddingEndDir =
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
if ($withStartEnhancer)
|
|
23
|
-
paddingStart = theme.padding['1'];
|
|
24
|
-
var paddingEnd = $closeable ? '0' : paddingStart;
|
|
19
|
+
var theme = utils.theme;
|
|
20
|
+
var paddingStartDir = 'paddingLeft';
|
|
21
|
+
var paddingEndDir = 'paddingRight';
|
|
22
|
+
var _c = getTagSizeTheme(theme, $size), height = _c.height, borderRadius = _c.borderRadius, paddingX = _c.paddingX, paddingY = _c.paddingY;
|
|
23
|
+
var paddingStart = $withStartEnhancer ? '0' : paddingX;
|
|
24
|
+
var paddingEnd = $closeable ? '0' : paddingX;
|
|
25
25
|
var typographyStyles = $intent === 'default'
|
|
26
26
|
? __assign(__assign({}, theme.typography.l2), { fontWeight: theme.fontWeight.normal }) : __assign(__assign({}, theme.typography.l2), { fontWeight: theme.fontWeight.semibold });
|
|
27
27
|
var hoverStyles = __assign({ boxShadow: 'inset 0px 0px 100px rgba(0, 0, 0, 0.08)' }, borderColor(theme.spr.border06));
|
|
28
28
|
var activeStyles = __assign({}, borderColor(theme.spr.interactive01));
|
|
29
|
-
return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign((_b = { height: height }, _b[paddingStartDir] = paddingStart, _b[paddingEndDir] = paddingEnd, _b.maxWidth = 'none', _b), typographyStyles), margin(0)), borderStyle('solid')), borderColor(theme.borderColor.transparent)), borderWidth('1px')), borderRadiusLonghand(borderRadius)), getIntentStyles(theme, $intent, $variant)), ($clickable && __assign({ cursor: 'pointer',
|
|
29
|
+
return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign((_b = { height: height }, _b[paddingStartDir] = paddingStart, _b[paddingEndDir] = paddingEnd, _b.paddingTop = paddingY, _b.paddingBottom = paddingY, _b.maxWidth = 'none', _b), typographyStyles), margin(0)), borderStyle('solid')), borderColor(theme.borderColor.transparent)), borderWidth('1px')), borderRadiusLonghand(borderRadius)), getIntentStyles(theme, $intent, $variant)), ($clickable && __assign({ cursor: 'pointer',
|
|
30
30
|
// temporary boxShadow onHover
|
|
31
31
|
':hover': hoverStyles, ':active': activeStyles }, getFocusVisibleStyles(utils)))), { ':focus': __assign({}, ($isFocusVisible && hoverStyles)) });
|
|
32
32
|
});
|
|
33
|
-
export var StyledAction = styled('span', 'cursor-pointer inline-flex items-center justify-center
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
return
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
export var StyledAction = styled('span', 'cursor-pointer inline-flex items-center justify-center', function (_a, _b) {
|
|
34
|
+
var theme = _a.theme;
|
|
35
|
+
var $size = _b.$size;
|
|
36
|
+
var clearableIconMarginX = getTagSizeTheme(theme, $size).clearableIconMarginX;
|
|
37
|
+
return {
|
|
38
|
+
marginRight: clearableIconMarginX,
|
|
39
|
+
marginLeft: clearableIconMarginX,
|
|
40
|
+
};
|
|
40
41
|
});
|
|
41
|
-
export var StyledText = styled('span', 'truncate', function (_a) {
|
|
42
|
-
var px2rem = _a.px2rem;
|
|
43
|
-
|
|
42
|
+
export var StyledText = styled('span', 'truncate', function (_a, _b) {
|
|
43
|
+
var px2rem = _a.px2rem, theme = _a.theme;
|
|
44
|
+
var $size = _b.$size;
|
|
45
|
+
var _c = getTagSizeTheme(theme, $size), fontSize = _c.fontSize, lineHeight = _c.lineHeight;
|
|
46
|
+
return {
|
|
44
47
|
maxWidth: px2rem(128),
|
|
45
|
-
|
|
48
|
+
fontSize: fontSize,
|
|
49
|
+
lineHeight: lineHeight,
|
|
50
|
+
};
|
|
46
51
|
});
|
package/esm/tag/tag.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { __assign, __read, __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, useCallback } from 'react';
|
|
4
|
+
import _omit from 'lodash/omit';
|
|
4
5
|
import { IconButton } from '../button';
|
|
5
|
-
import { getComponentTheme } from '../helpers/themeHelpers';
|
|
6
6
|
import { useFocusVisible } from '../hooks/useFocusVisible';
|
|
7
7
|
import CloseIcon from '../icon/components/close';
|
|
8
8
|
import { useOverrides } from '../overrides';
|
|
9
9
|
import { useStyle } from '../style';
|
|
10
10
|
import { StyledAction, StyledRoot, StyledStartEnhancer, StyledText } from './styled-components';
|
|
11
|
-
import { getTextFromChildren } from './utils';
|
|
11
|
+
import { getDefaultTagSize, getTagSizeTheme, getTextFromChildren } from './utils';
|
|
12
|
+
import { useLocale } from '../locale';
|
|
13
|
+
import { borderRadius } from '../helpers/longHandHelpers';
|
|
12
14
|
var Tag = forwardRef(function (props, ref) {
|
|
13
|
-
var children = props.children, _a = props.closeable, closeable = _a === void 0 ? true : _a,
|
|
14
|
-
var
|
|
15
|
+
var children = props.children, _a = props.closeable, closeable = _a === void 0 ? true : _a, _size = props.size, _b = props.isFocused, isFocused = _b === void 0 ? false : _b, _c = props.isHovered, isHovered = _c === void 0 ? false : _c, onActionClick = props.onActionClick, onActionKeyDown = props.onActionKeyDown, _d = props.onClick, onClick = _d === void 0 ? null : _d, _e = props.onKeyDown, onKeyDown = _e === void 0 ? null : _e, overrides = props.overrides, title = props.title, _f = props.variant, variant = _f === void 0 ? 'light' : _f, _g = props.intent, intent = _g === void 0 ? 'default' : _g, className = props.className, startEnhancer = props.startEnhancer, restProps = __rest(props, ["children", "closeable", "size", "isFocused", "isHovered", "onActionClick", "onActionKeyDown", "onClick", "onKeyDown", "overrides", "title", "variant", "intent", "className", "startEnhancer"]);
|
|
16
|
+
var _h = useFocusVisible(), $isFocusVisible = _h.$isFocusVisible, onBlur = _h.onBlur, onFocus = _h.onFocus;
|
|
15
17
|
var theme = useStyle().theme;
|
|
18
|
+
var size = _size !== null && _size !== void 0 ? _size : getDefaultTagSize(theme);
|
|
16
19
|
var handleKeyDown = useCallback(function (event) {
|
|
17
20
|
if (event.currentTarget !== event.target) {
|
|
18
21
|
return;
|
|
@@ -29,11 +32,11 @@ var Tag = forwardRef(function (props, ref) {
|
|
|
29
32
|
onKeyDown(event);
|
|
30
33
|
}
|
|
31
34
|
}, [closeable, onActionClick, onActionKeyDown, onClick, onKeyDown]);
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
var
|
|
35
|
+
var _j = __read(useOverrides(overrides === null || overrides === void 0 ? void 0 : overrides.Root, StyledRoot), 2), Root = _j[0], rootProps = _j[1];
|
|
36
|
+
var _k = __read(useOverrides(overrides === null || overrides === void 0 ? void 0 : overrides.Action, StyledAction), 2), Action = _k[0], actionProps = _k[1];
|
|
37
|
+
var _l = __read(useOverrides(overrides === null || overrides === void 0 ? void 0 : overrides.ActionIcon, CloseIcon), 2), ActionIcon = _l[0], actionIconProps = _l[1];
|
|
38
|
+
var _m = __read(useOverrides(overrides === null || overrides === void 0 ? void 0 : overrides.Text, StyledText), 2), Text = _m[0], textProps = _m[1];
|
|
39
|
+
var _o = __read(useOverrides(overrides === null || overrides === void 0 ? void 0 : overrides.StartEnhancer, StyledStartEnhancer), 2), StartEnhancer = _o[0], startEnhancerProps = _o[1];
|
|
37
40
|
var clickable = typeof onClick === 'function';
|
|
38
41
|
var sharedProps = {
|
|
39
42
|
$clickable: clickable,
|
|
@@ -47,9 +50,14 @@ var Tag = forwardRef(function (props, ref) {
|
|
|
47
50
|
$intent: intent,
|
|
48
51
|
};
|
|
49
52
|
var titleText = title || getTextFromChildren(children);
|
|
50
|
-
var
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
+
var _p = getTagSizeTheme(theme, size), clearableIconSize = _p.clearableIconSize, clearableIconButtonSize = _p.clearableIconButtonSize, clearableIconButtonBorderRadius = _p.clearableIconButtonBorderRadius;
|
|
54
|
+
var actionIconButtonOverrides = {
|
|
55
|
+
BaseButton: {
|
|
56
|
+
style: __assign({ height: clearableIconButtonSize, width: clearableIconButtonSize }, borderRadius(clearableIconButtonBorderRadius)),
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
var locale = useLocale();
|
|
60
|
+
return (_jsxs(Root, __assign({ ref: ref, "data-spaceweb": "tag", role: clickable ? 'button' : null, tabIndex: clickable ? 0 : null, onFocus: onFocus, onBlur: onBlur, className: className, onClick: onClick, onKeyDown: handleKeyDown }, sharedProps, restProps, rootProps, { children: [startEnhancer && (_jsx(StartEnhancer, __assign({}, sharedProps, startEnhancerProps, { children: typeof startEnhancer === 'function' ? startEnhancer(sharedProps) : startEnhancer }), void 0)), _jsx(Text, __assign({ title: titleText }, sharedProps, textProps, { children: children }), void 0), closeable ? (_jsx(Action, __assign({ "aria-hidden": true, role: "presentation", onClick: onActionClick }, sharedProps, _omit(actionProps, 'tabIndex'), { children: _jsx(IconButton, __assign({ shape: "square", type: "button", className: "hover:spr-clr-grey", "aria-label": locale.tag.closeAriaLabel, overrides: actionIconButtonOverrides, tabIndex: actionProps === null || actionProps === void 0 ? void 0 : actionProps.tabIndex }, { children: _jsx(ActionIcon, __assign({ size: clearableIconSize }, actionIconProps), void 0) }), void 0) }), void 0)) : null] }), void 0));
|
|
53
61
|
});
|
|
54
62
|
Tag.displayName = 'Tag';
|
|
55
63
|
export default Tag;
|
package/esm/tag/types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Override } from '../overrides';
|
|
|
4
4
|
import { ClassName } from '../types';
|
|
5
5
|
export declare type Intent = 'success' | 'error' | 'warning' | 'info' | 'default';
|
|
6
6
|
export declare type Variant = 'solid' | 'light';
|
|
7
|
-
export declare type Size = 'sm' | 'lg';
|
|
7
|
+
export declare type Size = 'xxxs' | 'sm' | 'lg';
|
|
8
8
|
export declare type TagOverrides = {
|
|
9
9
|
Root?: Override<SharedProps & Record<string, any>>;
|
|
10
10
|
Action?: Override<SharedProps & Record<string, any>>;
|
|
@@ -34,7 +34,7 @@ export declare type TagProps = {
|
|
|
34
34
|
variant?: Variant;
|
|
35
35
|
size?: Size;
|
|
36
36
|
};
|
|
37
|
-
export declare type AvatarTagProps = Omit<TagProps, '
|
|
37
|
+
export declare type AvatarTagProps = Omit<TagProps, 'overrides'> & {
|
|
38
38
|
avatarProps: AvatarProps;
|
|
39
39
|
overrides?: TagProps['overrides'] & {
|
|
40
40
|
StartEnhancer?: Override<Record<string, any>>;
|
package/esm/tag/utils.d.ts
CHANGED
|
@@ -1,2 +1,52 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { Theme } from '@sprinklrjs/spaceweb-themes/types';
|
|
2
3
|
export declare function getTextFromChildren(children: React.ReactNode): string | null;
|
|
4
|
+
export declare const getDefaultTagSize: (theme: Theme) => 'xxxs' | 'sm' | 'lg';
|
|
5
|
+
export declare const tagSizeMap: {
|
|
6
|
+
xxxs: {
|
|
7
|
+
paddingY: string;
|
|
8
|
+
paddingX: string;
|
|
9
|
+
height: string;
|
|
10
|
+
fontSize: string;
|
|
11
|
+
lineHeight: string;
|
|
12
|
+
borderRadius: string;
|
|
13
|
+
avatarIconSize: number;
|
|
14
|
+
clearableIconSize: string;
|
|
15
|
+
clearableIconButtonSize: string;
|
|
16
|
+
clearableIconButtonBorderRadius: string;
|
|
17
|
+
clearableIconMarginX: string;
|
|
18
|
+
startEnhancerMarginLeft: string;
|
|
19
|
+
startEnhancerMarginRight: string;
|
|
20
|
+
};
|
|
21
|
+
sm: {
|
|
22
|
+
paddingY: string;
|
|
23
|
+
paddingX: string;
|
|
24
|
+
height: string;
|
|
25
|
+
fontSize: string;
|
|
26
|
+
lineHeight: string;
|
|
27
|
+
borderRadius: string;
|
|
28
|
+
avatarIconSize: number;
|
|
29
|
+
clearableIconSize: string;
|
|
30
|
+
clearableIconButtonSize: string;
|
|
31
|
+
clearableIconButtonBorderRadius: string;
|
|
32
|
+
clearableIconMarginX: string;
|
|
33
|
+
startEnhancerMarginLeft: string;
|
|
34
|
+
startEnhancerMarginRight: string;
|
|
35
|
+
};
|
|
36
|
+
lg: {
|
|
37
|
+
paddingY: string;
|
|
38
|
+
paddingX: string;
|
|
39
|
+
height: string;
|
|
40
|
+
fontSize: string;
|
|
41
|
+
lineHeight: string;
|
|
42
|
+
borderRadius: string;
|
|
43
|
+
avatarIconSize: number;
|
|
44
|
+
clearableIconSize: string;
|
|
45
|
+
clearableIconButtonSize: string;
|
|
46
|
+
clearableIconButtonBorderRadius: string;
|
|
47
|
+
clearableIconMarginX: string;
|
|
48
|
+
startEnhancerMarginLeft: string;
|
|
49
|
+
startEnhancerMarginRight: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export declare const getTagSizeTheme: (theme: any, size: any) => any;
|
package/esm/tag/utils.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { getComponentSizeTheme } from '../helpers/themeHelpers';
|
|
2
3
|
var JOINABLE_TYPES = new Set(['string', 'number']);
|
|
3
4
|
// Checks the children of a React component to ensure every value is a number
|
|
4
5
|
// or a string. If they are, they are joined and returned. Useful for collecting
|
|
@@ -17,3 +18,66 @@ export function getTextFromChildren(children) {
|
|
|
17
18
|
// <Tag>foo {'bar'} baz</Tag> => 'foo bar baz'
|
|
18
19
|
return childList.join('');
|
|
19
20
|
}
|
|
21
|
+
export var getDefaultTagSize = function (theme) {
|
|
22
|
+
switch (theme.density) {
|
|
23
|
+
case 'COMFORTABLE':
|
|
24
|
+
return 'sm';
|
|
25
|
+
case 'SPACIOUS':
|
|
26
|
+
return 'sm';
|
|
27
|
+
case 'COMPACT':
|
|
28
|
+
return 'xxxs';
|
|
29
|
+
default:
|
|
30
|
+
return 'lg';
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export var tagSizeMap = {
|
|
34
|
+
xxxs: {
|
|
35
|
+
paddingY: '1px',
|
|
36
|
+
paddingX: '6px',
|
|
37
|
+
height: '18px',
|
|
38
|
+
fontSize: '13px',
|
|
39
|
+
lineHeight: '16px',
|
|
40
|
+
borderRadius: '4px',
|
|
41
|
+
avatarIconSize: 12,
|
|
42
|
+
clearableIconSize: '8px',
|
|
43
|
+
clearableIconButtonSize: '14px',
|
|
44
|
+
clearableIconButtonBorderRadius: '2px',
|
|
45
|
+
clearableIconMarginX: '3px',
|
|
46
|
+
startEnhancerMarginLeft: '6px',
|
|
47
|
+
startEnhancerMarginRight: '2px',
|
|
48
|
+
},
|
|
49
|
+
sm: {
|
|
50
|
+
paddingY: '2px',
|
|
51
|
+
paddingX: '8px',
|
|
52
|
+
height: '22px',
|
|
53
|
+
fontSize: '14px',
|
|
54
|
+
lineHeight: '18px',
|
|
55
|
+
borderRadius: '5px',
|
|
56
|
+
avatarIconSize: 14,
|
|
57
|
+
clearableIconSize: '9px',
|
|
58
|
+
clearableIconButtonSize: '16px',
|
|
59
|
+
clearableIconButtonBorderRadius: '3px',
|
|
60
|
+
clearableIconMarginX: '5px',
|
|
61
|
+
startEnhancerMarginLeft: '8px',
|
|
62
|
+
startEnhancerMarginRight: '3px',
|
|
63
|
+
},
|
|
64
|
+
lg: {
|
|
65
|
+
paddingY: '7px',
|
|
66
|
+
paddingX: '12px',
|
|
67
|
+
height: '34px',
|
|
68
|
+
fontSize: '16px',
|
|
69
|
+
lineHeight: '18px',
|
|
70
|
+
borderRadius: '6px',
|
|
71
|
+
avatarIconSize: 20,
|
|
72
|
+
clearableIconSize: '10px',
|
|
73
|
+
clearableIconButtonSize: '18px',
|
|
74
|
+
clearableIconButtonBorderRadius: '3px',
|
|
75
|
+
clearableIconMarginX: '7px',
|
|
76
|
+
startEnhancerMarginLeft: '12px',
|
|
77
|
+
startEnhancerMarginRight: '4px',
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
export var getTagSizeTheme = function (theme, size) {
|
|
81
|
+
var _a, _b;
|
|
82
|
+
return (_b = (_a = getComponentSizeTheme(theme, 'tag', size, getDefaultTagSize(theme))) !== null && _a !== void 0 ? _a : tagSizeMap[size]) !== null && _b !== void 0 ? _b : tagSizeMap[getDefaultTagSize(theme)];
|
|
83
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import { borderStyle } from '../helpers/longHandHelpers';
|
|
3
|
+
import { borderRadius, borderStyle } from '../helpers/longHandHelpers';
|
|
4
4
|
import { getTextareaInputContainerStyles, getTextareaInputStyles } from './styled-components';
|
|
5
5
|
import { useConvertOverrides } from '../helpers/baseui/useConvertOverrides';
|
|
6
6
|
import { add$props } from '../helpers';
|
|
@@ -15,7 +15,7 @@ function useTextareaAdapter(props) {
|
|
|
15
15
|
var handleChange = useDebouncedEventHandler((_a = props.debouncedOnChange) !== null && _a !== void 0 ? _a : _noop, props.onChange, props.debounceInterval || 200);
|
|
16
16
|
var overrides = useConvertOverrides({
|
|
17
17
|
Root: {
|
|
18
|
-
style: [__assign({ backgroundColor: 'transparent' }, borderStyle('none'))],
|
|
18
|
+
style: [__assign(__assign({ backgroundColor: 'transparent' }, borderStyle('none')), borderRadius('0px'))], // overriding baseweb borderRadius
|
|
19
19
|
},
|
|
20
20
|
InputContainer: {
|
|
21
21
|
style: inputContainerStyles,
|
|
@@ -23,7 +23,7 @@ function useTextareaAdapter(props) {
|
|
|
23
23
|
},
|
|
24
24
|
Input: {
|
|
25
25
|
style: getTextareaInputStyles,
|
|
26
|
-
props: __assign({ $autoSize: autoSize }, sharedProps),
|
|
26
|
+
props: __assign({ $autoSize: autoSize, 'aria-required': restProps['aria-required'] }, sharedProps),
|
|
27
27
|
},
|
|
28
28
|
}, restProps.overrides);
|
|
29
29
|
var rows = autoSize && !restProps.rows ? 1 : restProps.rows;
|
package/esm/textarea/textarea.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { Textarea as BaseTextarea, StatefulTextarea as BaseStatefulTextarea } from 'baseui/textarea';
|
|
3
|
+
import { Textarea as BaseTextarea, StatefulTextarea as BaseStatefulTextarea, } from 'baseui/textarea';
|
|
4
4
|
import useTextareaAdapter from './basewebAdapters';
|
|
5
5
|
import useAutoFocus from '../hooks/useAutoFocus';
|
|
6
6
|
import useAutoSizeTextarea from './useAutoSizeTextarea';
|
|
@@ -17,13 +17,13 @@ export var Textarea = function (props) {
|
|
|
17
17
|
inputRef: autoFocusRef,
|
|
18
18
|
});
|
|
19
19
|
var adaptedProps = useTextareaAdapter(restProps);
|
|
20
|
-
return _jsx(BaseTextarea, __assign({}, adaptedProps, { inputRef: inputRef }), void 0);
|
|
20
|
+
return (_jsx(BaseTextarea, __assign({}, adaptedProps, { overrides: adaptedProps.overrides, inputRef: inputRef }), void 0));
|
|
21
21
|
};
|
|
22
22
|
Textarea.displayName = 'Textarea';
|
|
23
23
|
export var StatefulTextarea = function (props) {
|
|
24
24
|
var autoFocus = props.autoFocus, restProps = __rest(props, ["autoFocus"]);
|
|
25
25
|
var autoFocusRef = useAutoFocus({ autoFocus: autoFocus, inputRef: restProps.inputRef });
|
|
26
26
|
var adaptedProps = useTextareaAdapter(restProps);
|
|
27
|
-
return _jsx(BaseStatefulTextarea, __assign({}, adaptedProps, { inputRef: autoFocusRef }), void 0);
|
|
27
|
+
return (_jsx(BaseStatefulTextarea, __assign({}, adaptedProps, { overrides: adaptedProps.overrides, inputRef: autoFocusRef }), void 0));
|
|
28
28
|
};
|
|
29
29
|
StatefulTextarea.displayName = 'StatefulTextarea';
|
package/esm/textarea/types.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare type TextareaProps = SpacewebComponentProps<Omit<BaseTextareaProp
|
|
|
7
7
|
size?: InputSize;
|
|
8
8
|
variant?: InputVariant;
|
|
9
9
|
overrides?: {
|
|
10
|
-
[key in keyof BaseTextareaProps['overrides']]?: Override<any>;
|
|
10
|
+
[key in keyof Required<BaseTextareaProps>['overrides']]?: Override<any>;
|
|
11
11
|
};
|
|
12
12
|
intent?: Intent;
|
|
13
13
|
debouncedOnChange?: BaseTextareaProps['onChange'];
|
|
@@ -20,7 +20,7 @@ export declare type StatefulTextareaProps = SpacewebComponentProps<Omit<BaseStat
|
|
|
20
20
|
size?: InputSize;
|
|
21
21
|
variant?: InputVariant;
|
|
22
22
|
overrides?: {
|
|
23
|
-
[key in keyof BaseStatefulTextareaProps['overrides']]?: Override<any>;
|
|
23
|
+
[key in keyof Required<BaseStatefulTextareaProps>['overrides']]?: Override<any>;
|
|
24
24
|
};
|
|
25
25
|
debouncedOnChange?: BaseStatefulTextareaProps['onChange'];
|
|
26
26
|
debounceInterval?: number;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PropsWithChildren, ReactElement } from 'react';
|
|
2
|
+
import { ThemeProviderT } from './types';
|
|
3
|
+
import type { Density } from '@sprinklrjs/spaceweb-themes/types';
|
|
4
|
+
declare type Props = PropsWithChildren<{
|
|
5
|
+
theme?: ThemeProviderT;
|
|
6
|
+
containerElement?: HTMLElement | null;
|
|
7
|
+
density?: Density;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const ThemeProvider: (props: Props) => ReactElement;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { __assign, __read } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo, useState } from 'react';
|
|
4
|
+
import _merge from 'lodash/merge';
|
|
5
|
+
import { ThemeProvider as BaseUIThemProvider } from 'baseui';
|
|
6
|
+
import usePrevious from '../hooks/usePrevious';
|
|
7
|
+
import useMemoizedStyletron from '../style/useMemoizedStyletron';
|
|
8
|
+
import SPACEWEB_THEME_VS_BASEUI_THEME from '../themes';
|
|
9
|
+
import { useIsomorphicLayoutEffect } from '../hooks/useIsomorphicLayoutEffect';
|
|
10
|
+
import { themeContext, useTheme } from './context';
|
|
11
|
+
var THEME_NAMES = ['hyperspace-light', 'space-light', 'space-dark', 'hyperspace-dark'];
|
|
12
|
+
var addDensityToTheme = function (theme, density) {
|
|
13
|
+
var _a;
|
|
14
|
+
return (__assign(__assign({}, theme), { theme: __assign(__assign({}, theme.theme), { density: density || ((_a = theme.theme) === null || _a === void 0 ? void 0 : _a.density) }) }));
|
|
15
|
+
};
|
|
16
|
+
export var ThemeProvider = function (props) {
|
|
17
|
+
var theme = props.theme, children = props.children, elementToApplyClass = props.containerElement, density = props.density;
|
|
18
|
+
var _a = __read(useState(null), 2), containerElementRef = _a[0], setContainerElementRef = _a[1];
|
|
19
|
+
var outerTheme = useTheme();
|
|
20
|
+
var _b = __read(useMemoizedStyletron(), 2), baseUITheme = _b[1];
|
|
21
|
+
if (typeof outerTheme === 'undefined' && typeof theme === 'undefined') {
|
|
22
|
+
throw new Error('No Theme present in context & props');
|
|
23
|
+
}
|
|
24
|
+
var Provider = themeContext.Provider;
|
|
25
|
+
var value = useMemo(function () {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
if (theme) {
|
|
28
|
+
var newTheme = void 0;
|
|
29
|
+
if (typeof theme === 'function') {
|
|
30
|
+
newTheme = theme(outerTheme);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
var newThemeName = (_a = theme.theme) === null || _a === void 0 ? void 0 : _a.name, outerThemeName = (_b = outerTheme === null || outerTheme === void 0 ? void 0 : outerTheme.theme) === null || _b === void 0 ? void 0 : _b.name,
|
|
34
|
+
// theme should be merged if both the outerTheme & themeToOverride has same name
|
|
35
|
+
shouldMergeThemes = !newThemeName || !outerThemeName || newThemeName === outerThemeName;
|
|
36
|
+
if (shouldMergeThemes) {
|
|
37
|
+
newTheme = _merge({}, outerTheme, theme);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
newTheme = __assign({ direction: outerTheme === null || outerTheme === void 0 ? void 0 : outerTheme.direction }, theme);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (typeof newTheme !== 'object') {
|
|
44
|
+
throw new Error('theme has to be an object of shape {theme : {}, classes : {}}');
|
|
45
|
+
}
|
|
46
|
+
return addDensityToTheme(newTheme, density);
|
|
47
|
+
}
|
|
48
|
+
return addDensityToTheme(outerTheme, density);
|
|
49
|
+
}, [theme, outerTheme, density]);
|
|
50
|
+
var themeName = value.theme.name, prevThemName = usePrevious(themeName), containerElement = elementToApplyClass !== null && elementToApplyClass !== void 0 ? elementToApplyClass : containerElementRef, prevContainerElement = usePrevious(containerElement);
|
|
51
|
+
useIsomorphicLayoutEffect(function () {
|
|
52
|
+
prevThemName && (prevContainerElement === null || prevContainerElement === void 0 ? void 0 : prevContainerElement.classList.remove(prevThemName));
|
|
53
|
+
THEME_NAMES.forEach(function (name) { return containerElement === null || containerElement === void 0 ? void 0 : containerElement.classList.remove(name); });
|
|
54
|
+
containerElement === null || containerElement === void 0 ? void 0 : containerElement.classList.add(themeName);
|
|
55
|
+
}, [themeName, prevThemName, containerElement, prevContainerElement]);
|
|
56
|
+
var baseuiThemeWithDirection = useMemo(function () { return (__assign(__assign({}, SPACEWEB_THEME_VS_BASEUI_THEME[themeName]), { direction: value.direction || 'ltr' })); }, [value.direction, themeName]);
|
|
57
|
+
/**
|
|
58
|
+
* Box component/styled cannot be used here as styletron might not be initialized when ThemeProvider renders for the first time.
|
|
59
|
+
*/
|
|
60
|
+
return (_jsx("div", __assign({ "data-testid": "theme-provider-container", style: { display: 'contents' }, ref: setContainerElementRef }, { children: _jsx(BaseUIThemProvider, __assign({ theme: baseuiThemeWithDirection !== null && baseuiThemeWithDirection !== void 0 ? baseuiThemeWithDirection : baseUITheme }, { children: _jsx(Provider, __assign({ value: value }, { children: children }), void 0) }), void 0) }), void 0));
|
|
61
|
+
};
|
package/esm/theme/context.d.ts
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { ThemeContext } from '../types';
|
|
3
|
-
import { ThemeProviderT } from './types';
|
|
4
|
-
import type { Density } from '@sprinklrjs/spaceweb-themes/types';
|
|
5
3
|
export declare const themeContext: import("react").Context<ThemeContext>;
|
|
6
4
|
export declare const useTheme: () => ThemeContext;
|
|
7
|
-
declare type Props = PropsWithChildren<{
|
|
8
|
-
theme?: ThemeProviderT;
|
|
9
|
-
containerElement?: HTMLElement | null;
|
|
10
|
-
density?: Density;
|
|
11
|
-
}>;
|
|
12
|
-
export declare const ThemeProvider: (props: Props) => ReactElement;
|
|
13
5
|
export declare const ThemeConsumer: import("react").Consumer<ThemeContext>;
|
|
14
|
-
export {};
|
package/esm/theme/context.js
CHANGED
|
@@ -1,65 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { createContext, useContext, useMemo, useState } from 'react';
|
|
4
|
-
import _merge from 'lodash/merge';
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
5
2
|
import hyperspaceLight from '@sprinklrjs/spaceweb-themes/hyperspace/light';
|
|
6
|
-
import { ThemeProvider as BaseUIThemProvider } from 'baseui';
|
|
7
|
-
import usePrevious from '../hooks/usePrevious';
|
|
8
|
-
import useMemoizedStyletron from '../style/useMemoizedStyletron';
|
|
9
|
-
import SPACEWEB_THEME_VS_BASEUI_THEME from '../themes';
|
|
10
|
-
import { useIsomorphicLayoutEffect } from '../hooks/useIsomorphicLayoutEffect';
|
|
11
|
-
//todo: remove default sprLight, too many tests failing on removal
|
|
12
3
|
export var themeContext = createContext(hyperspaceLight);
|
|
13
4
|
export var useTheme = function () { return useContext(themeContext); };
|
|
14
|
-
var THEME_NAMES = ['hyperspace-light', 'space-light', 'space-dark', 'hyperspace-dark'];
|
|
15
|
-
var addDensityToTheme = function (theme, density) {
|
|
16
|
-
var _a;
|
|
17
|
-
return (__assign(__assign({}, theme), { theme: __assign(__assign({}, theme.theme), { density: density || ((_a = theme.theme) === null || _a === void 0 ? void 0 : _a.density) }) }));
|
|
18
|
-
};
|
|
19
|
-
export var ThemeProvider = function (props) {
|
|
20
|
-
var _a;
|
|
21
|
-
var theme = props.theme, children = props.children, elementToApplyClass = props.containerElement, density = props.density;
|
|
22
|
-
var _b = __read(useState(null), 2), containerElementRef = _b[0], setContainerElementRef = _b[1];
|
|
23
|
-
var outerTheme = useTheme();
|
|
24
|
-
var _c = __read(useMemoizedStyletron(), 2), baseUITheme = _c[1];
|
|
25
|
-
if (typeof outerTheme === 'undefined' && typeof theme === 'undefined') {
|
|
26
|
-
throw new Error('No Theme present in context & props');
|
|
27
|
-
}
|
|
28
|
-
var Provider = themeContext.Provider;
|
|
29
|
-
var value = useMemo(function () {
|
|
30
|
-
var _a, _b;
|
|
31
|
-
if (theme) {
|
|
32
|
-
var newTheme = void 0;
|
|
33
|
-
if (typeof theme === 'function') {
|
|
34
|
-
newTheme = theme(outerTheme);
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
var newThemeName = (_a = theme.theme) === null || _a === void 0 ? void 0 : _a.name, outerThemeName = (_b = outerTheme === null || outerTheme === void 0 ? void 0 : outerTheme.theme) === null || _b === void 0 ? void 0 : _b.name,
|
|
38
|
-
// theme should be merged if both the outerTheme & themeToOverride has same name
|
|
39
|
-
shouldMergeThemes = !newThemeName || !outerThemeName || newThemeName === outerThemeName;
|
|
40
|
-
if (shouldMergeThemes) {
|
|
41
|
-
newTheme = _merge({}, outerTheme, theme);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
newTheme = __assign({ direction: outerTheme === null || outerTheme === void 0 ? void 0 : outerTheme.direction }, theme);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (typeof newTheme !== 'object') {
|
|
48
|
-
throw new Error('theme has to be an object of shape {theme : {}, classes : {}}');
|
|
49
|
-
}
|
|
50
|
-
return addDensityToTheme(newTheme, density);
|
|
51
|
-
}
|
|
52
|
-
return addDensityToTheme(outerTheme, density);
|
|
53
|
-
}, [theme, outerTheme, density]);
|
|
54
|
-
var themeName = value.theme.name, prevThemName = usePrevious(themeName), containerElement = elementToApplyClass !== null && elementToApplyClass !== void 0 ? elementToApplyClass : containerElementRef, prevContainerElement = usePrevious(containerElement);
|
|
55
|
-
useIsomorphicLayoutEffect(function () {
|
|
56
|
-
prevThemName && (prevContainerElement === null || prevContainerElement === void 0 ? void 0 : prevContainerElement.classList.remove(prevThemName));
|
|
57
|
-
THEME_NAMES.forEach(function (name) { return containerElement === null || containerElement === void 0 ? void 0 : containerElement.classList.remove(name); });
|
|
58
|
-
containerElement === null || containerElement === void 0 ? void 0 : containerElement.classList.add(themeName);
|
|
59
|
-
}, [themeName, prevThemName, containerElement, prevContainerElement]);
|
|
60
|
-
/**
|
|
61
|
-
* Box component/styled cannot be used here as styletron might not be initialized when ThemeProvider renders for the first time.
|
|
62
|
-
*/
|
|
63
|
-
return (_jsx("div", __assign({ "data-testid": "theme-provider-container", style: { display: 'contents' }, ref: setContainerElementRef }, { children: _jsx(BaseUIThemProvider, __assign({ theme: (_a = SPACEWEB_THEME_VS_BASEUI_THEME[themeName]) !== null && _a !== void 0 ? _a : baseUITheme }, { children: _jsx(Provider, __assign({ value: value }, { children: children }), void 0) }), void 0) }), void 0));
|
|
64
|
-
};
|
|
65
5
|
export var ThemeConsumer = themeContext.Consumer;
|
package/esm/theme/index.d.ts
CHANGED
package/esm/theme/index.js
CHANGED
|
@@ -4,8 +4,11 @@ import { TimePicker as BaseTimePicker } from 'baseui/timepicker';
|
|
|
4
4
|
import { Select } from '../select';
|
|
5
5
|
import { useContextualFormProps } from '../form-control/context';
|
|
6
6
|
import { useConvertOverrides } from '../helpers/baseui/useConvertOverrides';
|
|
7
|
+
import { getDefaultSize } from '../helpers/themeHelpers';
|
|
8
|
+
import { useStyle } from '../style';
|
|
7
9
|
var useTimePickerBasewebAdapter = function (props) {
|
|
8
|
-
var
|
|
10
|
+
var theme = useStyle().theme;
|
|
11
|
+
var _a = useContextualFormProps(props), _b = _a.size, size = _b === void 0 ? getDefaultSize(theme) : _b, className = _a.className, style = _a.style, intent = _a.intent, overrides = _a.overrides, clearable = _a.clearable, restProps = __rest(_a, ["size", "className", "style", "intent", "overrides", "clearable"]);
|
|
9
12
|
var convertedOverrides = useConvertOverrides({
|
|
10
13
|
Select: {
|
|
11
14
|
component: Select,
|
|
@@ -95,7 +95,7 @@ var RangeSelectorContainer = function (_a) {
|
|
|
95
95
|
});
|
|
96
96
|
},
|
|
97
97
|
] }, void 0), _jsx(Typography, __assign({ className: "my-0", variant: "bs3" }, { children: errMsg }), void 0)] }), void 0)) : null;
|
|
98
|
-
return (_jsxs(Box, __assign({ className: "spr-ui-01 rounded-8" }, { children: [_jsxs(Header, __assign({ "$setTimezone": setTimezone, "$onClose": props.onClose }, headerProps, { children: [_jsx(HeaderBeforeEnhancer, __assign({ variant: "bs1", "$as": "span", weight: "medium", className: "flex items-center" }, headerBeforeEnhancerProps, { children: locale.timeRangePicker.headerLabel }), void 0), disableTimezone ? null : (_jsx(TimezonePicker, __assign({ setTimezone: setTimezone, timezone: timezone }, timezonePickerProps), void 0))] }), void 0), _jsx(RangeSelector, { overrides: props.overrides, timeSelect: props.timeSelect, timeRangePresets: timeRangePresets, timezone: timezone, timeRange: timeRange, preset: preset, onChange: onDateChange, adapter: adapter, peekNextMonth: props.peekNextMonth, excludeDates: props.excludeDates, filterDate: props.filterDate, minDate: minDate, maxDate: maxDate, formatString: props.formatString, locale: props.locale, fixedHeight: props.fixedHeight, monthsShown: monthsShown }, void 0),
|
|
98
|
+
return (_jsxs(Box, __assign({ className: "spr-ui-01 rounded-8" }, { children: [_jsxs(Header, __assign({ "$setTimezone": setTimezone, "$onClose": props.onClose }, headerProps, { children: [_jsx(HeaderBeforeEnhancer, __assign({ variant: "bs1", "$as": "span", weight: "medium", className: "flex items-center" }, headerBeforeEnhancerProps, { children: locale.timeRangePicker.headerLabel }), void 0), disableTimezone ? null : (_jsx(TimezonePicker, __assign({ setTimezone: setTimezone, timezone: timezone }, timezonePickerProps), void 0))] }), void 0), _jsx(RangeSelector, { overrides: props.overrides, timeSelect: props.timeSelect, timeRangePresets: timeRangePresets, timezone: timezone, timeRange: timeRange, preset: preset, onChange: onDateChange, adapter: adapter, peekNextMonth: props.peekNextMonth, excludeDates: props.excludeDates, filterDate: props.filterDate, minDate: minDate, maxDate: maxDate, formatString: props.formatString, locale: props.locale, fixedHeight: props.fixedHeight, monthsShown: monthsShown }, void 0), _jsx(Footer, __assign({ "$hasError": hasError, "$onSubmit": handleSubmit, "$onClose": props.onClose }, footerProps, { children: _jsxs(Box, __assign({ className: "justify-between w-0 flex-grow flex" }, { children: [_jsx(FooterBeforeEnhancer, __assign({}, footerBeforeEnhancerProps), void 0), _jsxs(Stack, __assign({ direction: monthsShown === 1 ? 'vertical' : 'horizontal', gap: 3, className: [cx({ 'items-center': monthsShown !== 1 }), { maxWidth: 'fit-content' }] }, { children: [monthsShown === 1 ? null : errorEl, _jsxs(StackItem, __assign({ className: "flex self-end" }, { children: [_jsx(Button, __assign({ size: "sm", onClick: props.onClose, variant: "secondary", "data-testid": "cancel" }, { children: locale.timeRangePicker.cancelBtnLabel }), void 0), _jsx(Button, __assign({ size: "sm", className: "ml-3", onClick: handleSubmit, disabled: hasError, "data-testid": "save" }, { children: locale.timeRangePicker.saveBtnLabel }), void 0)] }), void 0), monthsShown === 1 ? errorEl : null] }), void 0)] }), void 0) }), void 0)] }), void 0));
|
|
99
99
|
};
|
|
100
100
|
RangeSelectorContainer.displayName = 'RangeSelectorContainer';
|
|
101
101
|
export default RangeSelectorContainer;
|