@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
|
@@ -4,13 +4,15 @@ import { useMemo, useCallback } from 'react';
|
|
|
4
4
|
import dateFnsAdapter from 'baseui/datepicker/utils/date-fns-adapter';
|
|
5
5
|
import DateHelpers from 'baseui/datepicker/utils/date-helpers';
|
|
6
6
|
import RangeSelectorContainer from './RangeSelectorContainer';
|
|
7
|
-
import { getSelectedTimeRange, getSystemTzName, getDefaultTimeRangePresets,
|
|
7
|
+
import { getSelectedTimeRange, getSystemTzName, getDefaultTimeRangePresets, convertDateFromTargetTzToSystemTz, convertDateFromSystemTzToTargetTz, formatSummaryValue, } from './utils';
|
|
8
8
|
import { useDatePickerState, StatelessDatePicker } from '../date-picker';
|
|
9
9
|
import { useLocale } from '../locale';
|
|
10
10
|
import { DEFAULT_FORMAT_STRING } from '../date-picker/constants';
|
|
11
11
|
import { mergeOverrides } from '../overrides';
|
|
12
12
|
import { normalizeDashes, prepareLocale } from '../date-picker/utils';
|
|
13
13
|
import { CUSTOM_OPTION } from './constants';
|
|
14
|
+
import { IconButton } from '../button';
|
|
15
|
+
import BaseCalendarIcon from '../icon/components/calendar-solid';
|
|
14
16
|
var __DEV__ = process.env.NODE_ENV !== 'production';
|
|
15
17
|
export var TimeRangePicker = function (_a) {
|
|
16
18
|
var _b = _a.adapter, adapter = _b === void 0 ? dateFnsAdapter : _b, onSubmit = _a.onSubmit, _timezone = _a.timezone, value = _a.value, formatDisplayValue = _a.formatDisplayValue, timeRangePresets = _a.timeRangePresets, overrides = _a.overrides, timeSelect = _a.timeSelect, peekNextMonth = _a.peekNextMonth, excludeDates = _a.excludeDates, filterDate = _a.filterDate, minDate = _a.minDate, maxDate = _a.maxDate, _c = _a.placeholder, placeholder = _c === void 0 ? "".concat(DEFAULT_FORMAT_STRING, "-").concat(DEFAULT_FORMAT_STRING) : _c, _d = _a.formatString, formatString = _d === void 0 ? DEFAULT_FORMAT_STRING : _d, onClose = _a.onClose, onChange = _a.onChange, showTimezoneInSummary = _a.showTimezoneInSummary, clearable = _a.clearable, onClear = _a.onClear, showFullDateInSummary = _a.showFullDateInSummary, autoSizeInput = _a.autoSizeInput, preset = _a.preset, _e = _a.startOpen, startOpen = _e === void 0 ? false : _e, fixedHeight = _a.fixedHeight, _f = _a.monthsShown, monthsShown = _f === void 0 ? 2 : _f, weekStartsOn = _a.weekStartsOn, _g = _a.disableTimezone, disableTimezone = _g === void 0 ? false : _g, _h = _a.displayVariant, displayVariant = _h === void 0 ? 'default' : _h, props = __rest(_a, ["adapter", "onSubmit", "timezone", "value", "formatDisplayValue", "timeRangePresets", "overrides", "timeSelect", "peekNextMonth", "excludeDates", "filterDate", "minDate", "maxDate", "placeholder", "formatString", "onClose", "onChange", "showTimezoneInSummary", "clearable", "onClear", "showFullDateInSummary", "autoSizeInput", "preset", "startOpen", "fixedHeight", "monthsShown", "weekStartsOn", "disableTimezone", "displayVariant"]);
|
|
@@ -41,9 +43,8 @@ export var TimeRangePicker = function (_a) {
|
|
|
41
43
|
], false); }, [timeRangePresets, locale]);
|
|
42
44
|
var formatDate = useCallback(function (date, normalizedFormatString) {
|
|
43
45
|
if (normalizedFormatString === void 0) { normalizedFormatString = normalizeDashes(formatString); }
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}, [formatString, dateHelpers, timezone, dateFnsLocale]);
|
|
46
|
+
return dateHelpers.formatDate(date, normalizedFormatString, dateFnsLocale);
|
|
47
|
+
}, [formatString, dateHelpers, dateFnsLocale]);
|
|
47
48
|
var defaultFormatDisplayValue = useCallback(function (date, normalizedFormatString) {
|
|
48
49
|
var _a, _b;
|
|
49
50
|
if (normalizedFormatString === void 0) { normalizedFormatString = normalizeDashes(formatString); }
|
|
@@ -97,8 +98,8 @@ export var TimeRangePicker = function (_a) {
|
|
|
97
98
|
var timeRange = _a.timeRange, preset = _a.preset, timezone = _a.timezone;
|
|
98
99
|
// value is returned only for backward compatibility will be removed in future version.
|
|
99
100
|
if (preset === 'CUSTOM') {
|
|
100
|
-
var startMillis =
|
|
101
|
-
var endMillis =
|
|
101
|
+
var startMillis = convertDateFromTargetTzToSystemTz(timeRange[0], timezone);
|
|
102
|
+
var endMillis = convertDateFromTargetTzToSystemTz(timeRange[1], timezone);
|
|
102
103
|
var dates = [new Date(startMillis), new Date(endMillis)];
|
|
103
104
|
onSubmit(__assign({ value: dates, preset: preset, date: dates }, (disableTimezone ? {} : { timezone: timezone })));
|
|
104
105
|
}
|
|
@@ -117,12 +118,18 @@ export var TimeRangePicker = function (_a) {
|
|
|
117
118
|
else {
|
|
118
119
|
dates = (_c = (_b = (_a = getSelectedTimeRange(preset !== null && preset !== void 0 ? preset : value, timeRangeList)) === null || _a === void 0 ? void 0 : _a.getTimeRangeLimits) === null || _b === void 0 ? void 0 : _b.call(_a, timezone)) !== null && _c !== void 0 ? _c : [];
|
|
119
120
|
}
|
|
120
|
-
return __spreadArray(__spreadArray([], __read((dates[0] ? [
|
|
121
|
+
return __spreadArray(__spreadArray([], __read((dates[0] ? [new Date(convertDateFromSystemTzToTargetTz(dates[0], timezone))] : [])), false), __read((dates[1] ? [new Date(convertDateFromSystemTzToTargetTz(dates[1], timezone))] : [])), false);
|
|
121
122
|
}, [value, timeRangeList, timezone, preset]);
|
|
122
123
|
var mergedOverrides = useMemo(function () {
|
|
123
124
|
return mergeOverrides({
|
|
124
|
-
Input: {
|
|
125
|
-
|
|
125
|
+
Input: __assign(__assign({}, (displayVariant === 'iconButton'
|
|
126
|
+
? {
|
|
127
|
+
component: function () { return (_jsx(IconButton, __assign({ tooltipContent: locale.calendar.calendarButtonAriaLabel, size: props.size, bordered: true, shape: "square" }, { children: _jsx(BaseCalendarIcon, {}, void 0) }), void 0)); },
|
|
128
|
+
Before: {
|
|
129
|
+
component: function () { return null; },
|
|
130
|
+
},
|
|
131
|
+
}
|
|
132
|
+
: {})), { props: {
|
|
126
133
|
overrides: __assign({}, (displayVariant === 'compact'
|
|
127
134
|
? {
|
|
128
135
|
Before: {
|
|
@@ -130,8 +137,7 @@ export var TimeRangePicker = function (_a) {
|
|
|
130
137
|
},
|
|
131
138
|
}
|
|
132
139
|
: {})),
|
|
133
|
-
},
|
|
134
|
-
},
|
|
140
|
+
} }),
|
|
135
141
|
InputWrapper: {
|
|
136
142
|
props: {
|
|
137
143
|
'data-testid': 'time-range',
|
|
@@ -175,6 +181,8 @@ export var TimeRangePicker = function (_a) {
|
|
|
175
181
|
disableTimezone,
|
|
176
182
|
locale.timeRangePicker.popoverAriaLabel,
|
|
177
183
|
displayVariant,
|
|
184
|
+
locale.calendar.calendarButtonAriaLabel,
|
|
185
|
+
props.size,
|
|
178
186
|
]);
|
|
179
187
|
var handleInputChange = useCallback(function (_a) {
|
|
180
188
|
var _b = _a.value, _value = _b === void 0 ? [] : _b;
|
|
@@ -183,5 +191,5 @@ export var TimeRangePicker = function (_a) {
|
|
|
183
191
|
onSubmit(__assign({ value: _value, preset: 'CUSTOM', date: _value }, (disableTimezone ? {} : { timezone: timezone })));
|
|
184
192
|
onClear === null || onClear === void 0 ? void 0 : onClear();
|
|
185
193
|
}, [onSubmit, timezone, onClear, disableTimezone]);
|
|
186
|
-
return (_jsx(StatelessDatePicker, { value: timeRange, isOpen: isOpen, onFocus: handleOpen, onBlur: handleClose, formatDisplayValue: defaultFormatDisplayValue, trapTabbing: false, intent: props.intent, variant: props.variant, size: props.size, disabled: props.disabled, formatString: formatString, placeholder: placeholder, "aria-label": locale.timeRangePicker.ariaLabelRange, overrides: mergedOverrides, clearable: clearable, onChange: handleInputChange, autoSizeInput: autoSizeInput, locale: dateFnsLocale, mountNode: props.mountNode, minDate: minDate, maxDate: maxDate }, void 0));
|
|
194
|
+
return (_jsx(StatelessDatePicker, { value: timeRange, isOpen: isOpen, onFocus: handleOpen, onBlur: handleClose, formatDisplayValue: defaultFormatDisplayValue, trapTabbing: false, intent: props.intent, variant: props.variant, size: props.size, disabled: props.disabled, formatString: formatString, placeholder: placeholder, "aria-label": locale.timeRangePicker.ariaLabelRange, overrides: mergedOverrides, clearable: clearable, onChange: handleInputChange, autoSizeInput: autoSizeInput, locale: dateFnsLocale, mountNode: props.mountNode, minDate: minDate, maxDate: maxDate, "aria-describedby": props['aria-describedby'], "aria-labelledby": props['aria-labelledby'], required: props.required, id: props.id }, void 0));
|
|
187
195
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { TimeRangePicker } from './TimeRangePicker';
|
|
2
|
-
export { getDefaultTimeRangePresets, formatSummaryValue } from './utils';
|
|
2
|
+
export { getDefaultTimeRangePresets, formatSummaryValue, convertDateFromSrcTzToTargetTz, convertDateFromSystemTzToTargetTz, convertDateFromTargetTzToSystemTz, } from './utils';
|
|
3
3
|
export type { TimeRangePickerLocale } from './locale';
|
|
4
4
|
export type { TimeRangePickerValue, TimeRangePickerProps, TimeRangePreset, TimeRangePickerOverrides, FormatString, } from './types';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { TimeRangePicker } from './TimeRangePicker';
|
|
2
|
-
export { getDefaultTimeRangePresets, formatSummaryValue } from './utils';
|
|
2
|
+
export { getDefaultTimeRangePresets, formatSummaryValue, convertDateFromSrcTzToTargetTz, convertDateFromSystemTzToTargetTz, convertDateFromTargetTzToSystemTz, } from './utils';
|
|
@@ -39,7 +39,7 @@ export declare type TimeRangePickerValue = {
|
|
|
39
39
|
timezone?: string;
|
|
40
40
|
};
|
|
41
41
|
declare type Preset = string;
|
|
42
|
-
export declare type SizeVariant = 'default' | 'compact';
|
|
42
|
+
export declare type SizeVariant = 'default' | 'compact' | 'iconButton';
|
|
43
43
|
export declare type FormatSummaryValueOptions = {
|
|
44
44
|
date: Date[];
|
|
45
45
|
presetId: string;
|
|
@@ -60,7 +60,6 @@ export declare type TimeRangePickerProps = Omit<StatelessDatePickerProps, 'value
|
|
|
60
60
|
*/
|
|
61
61
|
value?: Preset | Date[];
|
|
62
62
|
preset?: Preset;
|
|
63
|
-
timezone?: string;
|
|
64
63
|
timeRangePresets?: TimeRangePreset[];
|
|
65
64
|
onSubmit: (timeRangePickerValue: TimeRangePickerValue) => void;
|
|
66
65
|
overrides?: TimeRangePickerOverrides;
|
|
@@ -3,18 +3,47 @@ import { Locale } from '../locale';
|
|
|
3
3
|
import { FormatSummaryValueOptions, TimeRangePreset } from './types';
|
|
4
4
|
export declare const getSelectedTimeRange: (selectedTimeRange: string | undefined, timeRangeOptions: Array<TimeRangePreset>) => TimeRangePreset | undefined;
|
|
5
5
|
export declare const getSystemTzName: () => string;
|
|
6
|
+
/**
|
|
7
|
+
@param date: Date object or epoch in source timezone
|
|
8
|
+
@param srcTz: source timezone
|
|
9
|
+
@param targetTz: target timezone
|
|
10
|
+
This function is used to convert the time from one timezone to another timezone.
|
|
11
|
+
Example use-case of this function
|
|
12
|
+
Lets say you want to find out what time it will be in New York when it is 6th Nov, 2022 00:00 in Los Angeles.
|
|
13
|
+
then you can call like:
|
|
14
|
+
convertDateFromSrcTzToTargetTz(new Date('6 Nov 2022, 00:00'), "America/Los_Angeles", "America/New_York")
|
|
15
|
+
this function will return 6 Nov 2022, 2:00 because generally NY is 3 hours ahead of LA but at 2:00AM NY will switch to DST
|
|
16
|
+
and hence it will be not 3:00AM but 2:00AM.
|
|
17
|
+
*/
|
|
18
|
+
export declare const convertDateFromSrcTzToTargetTz: (date: Date | number, srcTz?: string, targetTz?: string) => number;
|
|
19
|
+
/**
|
|
20
|
+
* @param date Date object or epoch representing the date in particular timezone
|
|
21
|
+
* @param timezone timezone of the date
|
|
22
|
+
* @returns epoch of the same time in system timezone
|
|
23
|
+
* Use case:
|
|
24
|
+
* Lets say user selects 6 Nov 2022, 00:00 from Time range picker and selects New York timezone.
|
|
25
|
+
* Now we want to find out what that time represents in our system timezone(Los Angeles) which in given case is 5 Nov 2022, 21:00
|
|
26
|
+
*/
|
|
27
|
+
export declare const convertDateFromTargetTzToSystemTz: (date: Date | number, timezone?: string) => number;
|
|
28
|
+
/**
|
|
29
|
+
* @param date date in system timezone
|
|
30
|
+
* @param timezone timezone in which you want to convert this date to
|
|
31
|
+
* @returns date in that timezone
|
|
32
|
+
* Use case:
|
|
33
|
+
* User will come back with 5 Nov 2022, 21:00 but has selected new york timezone so we want to find out
|
|
34
|
+
* what time it will be in new york when it is 5 Nov 2022, 21:00 in system timezone(Los Angeles), which is
|
|
35
|
+
* 6 Nov 2022, 00:00
|
|
36
|
+
*/
|
|
37
|
+
export declare const convertDateFromSystemTzToTargetTz: (date: Date | number, timezone?: string) => number;
|
|
6
38
|
/**
|
|
7
39
|
* returns milliseconds offset from timezone name
|
|
8
40
|
*/
|
|
9
41
|
export declare const getTzOffset: (timezone: string, date?: number | Date | undefined) => number;
|
|
10
42
|
/**
|
|
43
|
+
* @deprecated use convertDateFromTargetTzToSystemTz function to make sure you account for DST cases too
|
|
11
44
|
* convert epoch from one timezone to another
|
|
12
45
|
*/
|
|
13
46
|
export declare const switchEpochTimezone: (date: Date | number, tzFrom?: string, tzTo?: string) => number;
|
|
14
|
-
/**
|
|
15
|
-
* adapts date with the system timezone
|
|
16
|
-
*/
|
|
17
|
-
export declare const adaptDateWithSystemTz: (date: Date, selectedTimezone: string) => Date;
|
|
18
47
|
/**
|
|
19
48
|
* Adds or subtract the offset according to timezone passed so that we can get correct start date and end date in that timezone.
|
|
20
49
|
* ex. Lets say we are in Asia/Kolakata timezone on 19th Feb and time is 12:30 AM, and selected Asia/Kabul timezone and preset as Today.
|
|
@@ -3,6 +3,8 @@ import { findTimeZone, getZonedTime } from 'timezone-support/dist/index-1900-205
|
|
|
3
3
|
import dateFnsAdapter from 'baseui/datepicker/utils/date-fns-adapter';
|
|
4
4
|
import DateHelpers from 'baseui/datepicker/utils/date-helpers';
|
|
5
5
|
import getInterpolatedString from 'baseui/helpers/i18n-interpolation';
|
|
6
|
+
import { subDays, addDays } from 'date-fns';
|
|
7
|
+
import { zonedTimeToUtc, utcToZonedTime } from 'date-fns-tz';
|
|
6
8
|
import { isTimeInRange, normalizeDashes } from '../date-picker/utils';
|
|
7
9
|
import { CALENDAR_HEIGHT, CUSTOM_OPTION, TIME_SELECT_ROW_HEIGHT } from './constants';
|
|
8
10
|
export var getSelectedTimeRange = function (selectedTimeRange, timeRangeOptions) { return timeRangeOptions.find(function (_a) {
|
|
@@ -22,6 +24,48 @@ export var getSystemTzName = function () {
|
|
|
22
24
|
}
|
|
23
25
|
return SYSTEM_TIMEZONE;
|
|
24
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
@param date: Date object or epoch in source timezone
|
|
29
|
+
@param srcTz: source timezone
|
|
30
|
+
@param targetTz: target timezone
|
|
31
|
+
This function is used to convert the time from one timezone to another timezone.
|
|
32
|
+
Example use-case of this function
|
|
33
|
+
Lets say you want to find out what time it will be in New York when it is 6th Nov, 2022 00:00 in Los Angeles.
|
|
34
|
+
then you can call like:
|
|
35
|
+
convertDateFromSrcTzToTargetTz(new Date('6 Nov 2022, 00:00'), "America/Los_Angeles", "America/New_York")
|
|
36
|
+
this function will return 6 Nov 2022, 2:00 because generally NY is 3 hours ahead of LA but at 2:00AM NY will switch to DST
|
|
37
|
+
and hence it will be not 3:00AM but 2:00AM.
|
|
38
|
+
*/
|
|
39
|
+
export var convertDateFromSrcTzToTargetTz = function (date, srcTz, targetTz) {
|
|
40
|
+
if (srcTz === void 0) { srcTz = getSystemTzName(); }
|
|
41
|
+
if (targetTz === void 0) { targetTz = getSystemTzName(); }
|
|
42
|
+
return +utcToZonedTime(zonedTimeToUtc(date, srcTz), targetTz);
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* @param date Date object or epoch representing the date in particular timezone
|
|
46
|
+
* @param timezone timezone of the date
|
|
47
|
+
* @returns epoch of the same time in system timezone
|
|
48
|
+
* Use case:
|
|
49
|
+
* Lets say user selects 6 Nov 2022, 00:00 from Time range picker and selects New York timezone.
|
|
50
|
+
* Now we want to find out what that time represents in our system timezone(Los Angeles) which in given case is 5 Nov 2022, 21:00
|
|
51
|
+
*/
|
|
52
|
+
export var convertDateFromTargetTzToSystemTz = function (date, timezone) {
|
|
53
|
+
if (timezone === void 0) { timezone = getSystemTzName(); }
|
|
54
|
+
return convertDateFromSrcTzToTargetTz(date, timezone, getSystemTzName());
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* @param date date in system timezone
|
|
58
|
+
* @param timezone timezone in which you want to convert this date to
|
|
59
|
+
* @returns date in that timezone
|
|
60
|
+
* Use case:
|
|
61
|
+
* User will come back with 5 Nov 2022, 21:00 but has selected new york timezone so we want to find out
|
|
62
|
+
* what time it will be in new york when it is 5 Nov 2022, 21:00 in system timezone(Los Angeles), which is
|
|
63
|
+
* 6 Nov 2022, 00:00
|
|
64
|
+
*/
|
|
65
|
+
export var convertDateFromSystemTzToTargetTz = function (date, timezone) {
|
|
66
|
+
if (timezone === void 0) { timezone = getSystemTzName(); }
|
|
67
|
+
return convertDateFromSrcTzToTargetTz(date, getSystemTzName(), timezone);
|
|
68
|
+
};
|
|
25
69
|
/**
|
|
26
70
|
* returns milliseconds offset from timezone name
|
|
27
71
|
*/
|
|
@@ -32,6 +76,7 @@ export var getTzOffset = function (timezone, date) {
|
|
|
32
76
|
return ((_b = (_a = zonedTime.zone) === null || _a === void 0 ? void 0 : _a.offset) !== null && _b !== void 0 ? _b : 0) * 60 * 1000;
|
|
33
77
|
};
|
|
34
78
|
/**
|
|
79
|
+
* @deprecated use convertDateFromTargetTzToSystemTz function to make sure you account for DST cases too
|
|
35
80
|
* convert epoch from one timezone to another
|
|
36
81
|
*/
|
|
37
82
|
export var switchEpochTimezone = function (date, tzFrom, tzTo) {
|
|
@@ -42,13 +87,6 @@ export var switchEpochTimezone = function (date, tzFrom, tzTo) {
|
|
|
42
87
|
var offset = tzToOffset - tzFromOffset;
|
|
43
88
|
return +date + offset;
|
|
44
89
|
};
|
|
45
|
-
/**
|
|
46
|
-
* adapts date with the system timezone
|
|
47
|
-
*/
|
|
48
|
-
export var adaptDateWithSystemTz = function (date, selectedTimezone) {
|
|
49
|
-
var timestampInMillis = switchEpochTimezone(date, selectedTimezone, getSystemTzName());
|
|
50
|
-
return new Date(timestampInMillis);
|
|
51
|
-
};
|
|
52
90
|
/**
|
|
53
91
|
* Adds or subtract the offset according to timezone passed so that we can get correct start date and end date in that timezone.
|
|
54
92
|
* ex. Lets say we are in Asia/Kolakata timezone on 19th Feb and time is 12:30 AM, and selected Asia/Kabul timezone and preset as Today.
|
|
@@ -67,8 +105,8 @@ export var getDateForGivenTimezone = function (timezone) {
|
|
|
67
105
|
};
|
|
68
106
|
export var getDefaultTimeRangePresets = function (locale) {
|
|
69
107
|
var switchTimezoneOfRange = function (startDate, endDate, timezone) { return [
|
|
70
|
-
new Date(
|
|
71
|
-
new Date(
|
|
108
|
+
new Date(convertDateFromTargetTzToSystemTz(startDate, timezone)),
|
|
109
|
+
new Date(convertDateFromTargetTzToSystemTz(endDate, timezone)),
|
|
72
110
|
]; };
|
|
73
111
|
return [
|
|
74
112
|
{
|
|
@@ -134,9 +172,7 @@ export var getDefaultTimeRangePresets = function (locale) {
|
|
|
134
172
|
var firstday = date.getDate() - (date.getDay() - 1) - 1;
|
|
135
173
|
var startDate = new Date(date.setDate(firstday));
|
|
136
174
|
startDate.setHours(0, 0, 0, 0);
|
|
137
|
-
var endDate =
|
|
138
|
-
endDate.setMonth(startDate.getMonth());
|
|
139
|
-
endDate.setDate(startDate.getDate() + 6);
|
|
175
|
+
var endDate = addDays(startDate, 6);
|
|
140
176
|
endDate.setHours(23, 59, 59, 999);
|
|
141
177
|
return switchTimezoneOfRange(startDate, endDate, timezone);
|
|
142
178
|
},
|
|
@@ -150,9 +186,7 @@ export var getDefaultTimeRangePresets = function (locale) {
|
|
|
150
186
|
var lastday = date.getDate() - (date.getDay() - 1) - 2;
|
|
151
187
|
var endDate = new Date(date.setDate(lastday));
|
|
152
188
|
endDate.setHours(23, 59, 59, 999);
|
|
153
|
-
var startDate =
|
|
154
|
-
startDate.setMonth(endDate.getMonth());
|
|
155
|
-
startDate.setDate(endDate.getDate() - 6);
|
|
189
|
+
var startDate = subDays(endDate, 6);
|
|
156
190
|
startDate.setHours(0, 0, 0, 0);
|
|
157
191
|
return switchTimezoneOfRange(startDate, endDate, timezone);
|
|
158
192
|
},
|
package/esm/tooltip/overrides.js
CHANGED
|
@@ -5,9 +5,9 @@ import { useConvertOverrides } from '../helpers/baseui/useConvertOverrides';
|
|
|
5
5
|
import StatefulContainer from './stateful-tooltip-container';
|
|
6
6
|
import Tooltip from './tooltip';
|
|
7
7
|
var StatefulTooltip = function (props) {
|
|
8
|
-
var children = props.children, size = props.size, label = props.label, _a = props.overrides, overrides = _a === void 0 ? {} : _a, restProps = __rest(props, ["children", "size", "label", "overrides"]);
|
|
8
|
+
var children = props.children, size = props.size, label = props.label, _a = props.overrides, overrides = _a === void 0 ? {} : _a, viewportAsBoundary = props.viewportAsBoundary, restProps = __rest(props, ["children", "size", "label", "overrides", "viewportAsBoundary"]);
|
|
9
9
|
var _overrides = useConvertOverrides(overrides, undefined, [overrides]);
|
|
10
|
-
return (_jsx(StatefulContainer, __assign({ dismissOnClickOutside: true, dismissOnEsc: true, triggerType: "hover" }, restProps, { overrides: _overrides }, { children: function (tooltipProps) { return (_jsx(Tooltip, __assign({}, tooltipProps, { size: size, label: label }, { children: children }), void 0)); } }), void 0));
|
|
10
|
+
return (_jsx(StatefulContainer, __assign({ dismissOnClickOutside: true, dismissOnEsc: true, triggerType: "hover" }, restProps, { overrides: _overrides }, { children: function (tooltipProps) { return (_jsx(Tooltip, __assign({}, tooltipProps, { size: size, label: label, viewportAsBoundary: viewportAsBoundary }, { children: children }), void 0)); } }), void 0));
|
|
11
11
|
};
|
|
12
12
|
StatefulTooltip.displayName = 'StatefulTooltip';
|
|
13
13
|
StatefulTooltip.defaultProps = __assign(__assign({}, defaultProps), { showArrow: true, focusLock: false, returnFocus: false });
|
package/esm/tooltip/tooltip.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { TooltipProps } from './types';
|
|
3
3
|
declare const Tooltip: {
|
|
4
|
-
({ size, label, content, overrides, children, targetElement, isOpen, triggerType, returnFocus, focusLock, placement, ...restProps }: TooltipProps): ReactElement;
|
|
4
|
+
({ size, label, content, overrides, children, targetElement, isOpen, triggerType, returnFocus, focusLock, placement, popperOptions, ignoreBoundary, viewportAsBoundary, ...restProps }: TooltipProps): ReactElement;
|
|
5
5
|
displayName: string;
|
|
6
6
|
};
|
|
7
7
|
export default Tooltip;
|
package/esm/tooltip/tooltip.js
CHANGED
|
@@ -3,6 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
// TODO: baseui/tooltip is using Popover internally which we cannot override
|
|
4
4
|
import { Tooltip as BaseTooltip } from 'baseui/tooltip';
|
|
5
5
|
import * as React from 'react';
|
|
6
|
+
import { useMemo } from 'react';
|
|
6
7
|
import { PopoverChildEnhancer } from '../popover/PopoverEnahncer';
|
|
7
8
|
import { useConvertOverrides } from '../helpers/baseui/useConvertOverrides';
|
|
8
9
|
import { LayersManager, Z_INDEX } from '../layer';
|
|
@@ -11,6 +12,7 @@ import { useFocusLock, useContent } from '../popover/hooks';
|
|
|
11
12
|
import useUniqueId from '../hooks/useUniqueId';
|
|
12
13
|
import { getArrowStyle, getBodyStyle, innerStyles } from './overrides';
|
|
13
14
|
import { StyledLabel } from './styled-component';
|
|
15
|
+
import { getPopperOptions } from '../popover/utils';
|
|
14
16
|
var DISABLED_FOCUS_PROPS = {
|
|
15
17
|
autoFocus: false,
|
|
16
18
|
focusLock: false,
|
|
@@ -19,7 +21,7 @@ var DISABLED_FOCUS_PROPS = {
|
|
|
19
21
|
// @ts-ignore
|
|
20
22
|
BaseTooltip.displayName = 'BaseUITooltip';
|
|
21
23
|
var Tooltip = function (_a) {
|
|
22
|
-
var _b = _a.size, size = _b === void 0 ? 'sm' : _b, label = _a.label, content = _a.content, _c = _a.overrides, overrides = _c === void 0 ? {} : _c, children = _a.children, targetElement = _a.targetElement, isOpen = _a.isOpen, _d = _a.triggerType, triggerType = _d === void 0 ? 'hover' : _d, _e = _a.returnFocus, returnFocus = _e === void 0 ? triggerType === 'click' : _e, _f = _a.focusLock, focusLock = _f === void 0 ? false : _f, _g = _a.placement, placement = _g === void 0 ? 'auto' : _g, restProps = __rest(_a, ["size", "label", "content", "overrides", "children", "targetElement", "isOpen", "triggerType", "returnFocus", "focusLock", "placement"]);
|
|
24
|
+
var _b = _a.size, size = _b === void 0 ? 'sm' : _b, label = _a.label, content = _a.content, _c = _a.overrides, overrides = _c === void 0 ? {} : _c, children = _a.children, targetElement = _a.targetElement, isOpen = _a.isOpen, _d = _a.triggerType, triggerType = _d === void 0 ? 'hover' : _d, _e = _a.returnFocus, returnFocus = _e === void 0 ? triggerType === 'click' : _e, _f = _a.focusLock, focusLock = _f === void 0 ? false : _f, _g = _a.placement, placement = _g === void 0 ? 'auto' : _g, popperOptions = _a.popperOptions, ignoreBoundary = _a.ignoreBoundary, viewportAsBoundary = _a.viewportAsBoundary, restProps = __rest(_a, ["size", "label", "content", "overrides", "children", "targetElement", "isOpen", "triggerType", "returnFocus", "focusLock", "placement", "popperOptions", "ignoreBoundary", "viewportAsBoundary"]);
|
|
23
25
|
var focusLockProps = useFocusLock({ returnFocus: returnFocus, focusLock: focusLock });
|
|
24
26
|
var sharedProps = { $size: size, $label: !!label };
|
|
25
27
|
var _h = __read(useOverrides(overrides.Label, StyledLabel), 2), Label = _h[0], labelProps = _h[1];
|
|
@@ -40,7 +42,8 @@ var Tooltip = function (_a) {
|
|
|
40
42
|
Inner: { style: innerStyles, props: __assign(__assign({}, sharedProps), { ref: setContentHost }) },
|
|
41
43
|
}, overrides, [overrides, size, label, setContentHost]);
|
|
42
44
|
var id = useUniqueId();
|
|
43
|
-
|
|
45
|
+
var mergedPopperOptions = useMemo(function () { return (__assign(__assign({}, getPopperOptions({ ignoreBoundary: ignoreBoundary, viewportAsBoundary: viewportAsBoundary })), popperOptions)); }, [popperOptions, ignoreBoundary, viewportAsBoundary]);
|
|
46
|
+
return (_jsx(LayersManager, __assign({ zIndex: Z_INDEX.POPOVER }, { children: _jsx(BaseTooltip, __assign({ id: id }, restProps, { triggerType: triggerType, isOpen: isOpen, overrides: _overrides, content: wrappedContent, placement: placement }, focusLockProps, (triggerType === 'hover' ? DISABLED_FOCUS_PROPS : {}), { popperOptions: mergedPopperOptions }, { children: _jsx(PopoverChildEnhancer, __assign({ targetElement: targetElement }, { children: childNode }), void 0) }), void 0) }), void 0));
|
|
44
47
|
};
|
|
45
48
|
Tooltip.displayName = 'Tooltip';
|
|
46
49
|
export default Tooltip;
|
package/esm/tooltip/types.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export declare type StatefulTooltipProps = Omit<BaseStatefulTooltipProps, 'overr
|
|
|
39
39
|
dismissOnEsc?: boolean;
|
|
40
40
|
triggerType?: TriggerType;
|
|
41
41
|
placement?: TetherPlacement;
|
|
42
|
+
viewportAsBoundary?: boolean;
|
|
42
43
|
} & DeprecatedProps;
|
|
43
44
|
export declare type TooltipProps = Omit<BaseTooltipProps, 'overrides' | 'children' | 'autoFocus' | 'focusLock' | 'returnFocus' | 'triggerType' | 'placement'> & {
|
|
44
45
|
overrides?: {
|
|
@@ -54,6 +55,7 @@ export declare type TooltipProps = Omit<BaseTooltipProps, 'overrides' | 'childre
|
|
|
54
55
|
targetElement?: HTMLElement | null;
|
|
55
56
|
triggerType?: TriggerType;
|
|
56
57
|
placement?: TetherPlacement;
|
|
58
|
+
viewportAsBoundary?: boolean;
|
|
57
59
|
} & DeprecatedProps;
|
|
58
60
|
export type { Placement, TriggerType, AccessibilityType } from '../popover';
|
|
59
61
|
export type { StatefulTooltipContainerProps } from 'baseui/tooltip';
|
package/esm/types.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ export declare type Variant = 'primary' | 'secondary' | 'tertiary' | 'minimal';
|
|
|
60
60
|
/**
|
|
61
61
|
* Size Options
|
|
62
62
|
*/
|
|
63
|
-
export declare type Size = 'xxxs' | 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
63
|
+
export declare type Size = 'xxxxs' | 'xxxs' | 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
64
64
|
/**
|
|
65
65
|
* Intent Options
|
|
66
66
|
*/
|
|
@@ -77,6 +77,7 @@ export declare type Px2Rem = (px: number | string) => string;
|
|
|
77
77
|
* `useStyle` return type
|
|
78
78
|
*/
|
|
79
79
|
export declare type StyleUtils = ThemeContext & {
|
|
80
|
+
isRTL?: boolean;
|
|
80
81
|
css: CSSFunc;
|
|
81
82
|
getStyle: GetStyle;
|
|
82
83
|
px2rem: Px2Rem;
|
|
@@ -17,9 +17,22 @@ var defaultVariantToHTMLTagMapping = {
|
|
|
17
17
|
bl1: 'p',
|
|
18
18
|
bl2: 'p',
|
|
19
19
|
bl3: 'p',
|
|
20
|
+
'body-8': 'span',
|
|
21
|
+
'body-10': 'span',
|
|
22
|
+
'body-12': 'span',
|
|
23
|
+
'body-13': 'span',
|
|
24
|
+
'body-14': 'span',
|
|
25
|
+
'body-16': 'span',
|
|
26
|
+
'display-18': 'h6',
|
|
27
|
+
'display-20': 'h5',
|
|
28
|
+
'display-24': 'h4',
|
|
29
|
+
'display-28': 'h3',
|
|
30
|
+
'display-32': 'h2',
|
|
31
|
+
'display-40': 'h1',
|
|
32
|
+
'display-42': 'h1',
|
|
20
33
|
};
|
|
21
34
|
var Typography = forwardRef(function (_a, ref) {
|
|
22
|
-
var $as = _a.$as, _b = _a.variant, variant = _b === void 0 ? '
|
|
35
|
+
var $as = _a.$as, _b = _a.variant, variant = _b === void 0 ? 'body-14' : _b, weight = _a.weight, restProps = __rest(_a, ["$as", "variant", "weight"]);
|
|
23
36
|
var sharedProps = add$props({ variant: variant, weight: weight });
|
|
24
37
|
return (_jsx(StyledTypography, __assign({ ref: ref, "data-spaceweb": "typography-".concat(variant), "$as": $as || defaultVariantToHTMLTagMapping[variant] }, restProps, sharedProps), void 0));
|
|
25
38
|
});
|
|
@@ -4,3 +4,59 @@ export declare const WEIGHT: Readonly<{
|
|
|
4
4
|
semibold: number;
|
|
5
5
|
bold: number;
|
|
6
6
|
}>;
|
|
7
|
+
export declare const DEFAULT_BODY_WEIGHT = 400;
|
|
8
|
+
export declare const DEFAULT_DISPLAY_WEIGHT = 600;
|
|
9
|
+
export declare const TYPOGRAPHY_VARIANT_MAP: {
|
|
10
|
+
'body-8': {
|
|
11
|
+
fontSize: string;
|
|
12
|
+
lineHeight: string;
|
|
13
|
+
};
|
|
14
|
+
'body-10': {
|
|
15
|
+
fontSize: string;
|
|
16
|
+
lineHeight: string;
|
|
17
|
+
};
|
|
18
|
+
'body-12': {
|
|
19
|
+
fontSize: string;
|
|
20
|
+
lineHeight: string;
|
|
21
|
+
};
|
|
22
|
+
'body-13': {
|
|
23
|
+
fontSize: string;
|
|
24
|
+
lineHeight: string;
|
|
25
|
+
};
|
|
26
|
+
'body-14': {
|
|
27
|
+
fontSize: string;
|
|
28
|
+
lineHeight: string;
|
|
29
|
+
};
|
|
30
|
+
'body-16': {
|
|
31
|
+
fontSize: string;
|
|
32
|
+
lineHeight: string;
|
|
33
|
+
};
|
|
34
|
+
'display-18': {
|
|
35
|
+
fontSize: string;
|
|
36
|
+
lineHeight: string;
|
|
37
|
+
};
|
|
38
|
+
'display-20': {
|
|
39
|
+
fontSize: string;
|
|
40
|
+
lineHeight: string;
|
|
41
|
+
};
|
|
42
|
+
'display-24': {
|
|
43
|
+
fontSize: string;
|
|
44
|
+
lineHeight: string;
|
|
45
|
+
};
|
|
46
|
+
'display-28': {
|
|
47
|
+
fontSize: string;
|
|
48
|
+
lineHeight: string;
|
|
49
|
+
};
|
|
50
|
+
'display-32': {
|
|
51
|
+
fontSize: string;
|
|
52
|
+
lineHeight: string;
|
|
53
|
+
};
|
|
54
|
+
'display-40': {
|
|
55
|
+
fontSize: string;
|
|
56
|
+
lineHeight: string;
|
|
57
|
+
};
|
|
58
|
+
'display-42': {
|
|
59
|
+
fontSize: string;
|
|
60
|
+
lineHeight: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
@@ -4,3 +4,59 @@ export var WEIGHT = Object.freeze({
|
|
|
4
4
|
semibold: 600,
|
|
5
5
|
bold: 700,
|
|
6
6
|
});
|
|
7
|
+
export var DEFAULT_BODY_WEIGHT = 400;
|
|
8
|
+
export var DEFAULT_DISPLAY_WEIGHT = 600;
|
|
9
|
+
export var TYPOGRAPHY_VARIANT_MAP = {
|
|
10
|
+
'body-8': {
|
|
11
|
+
fontSize: '8px',
|
|
12
|
+
lineHeight: '10px',
|
|
13
|
+
},
|
|
14
|
+
'body-10': {
|
|
15
|
+
fontSize: '10px',
|
|
16
|
+
lineHeight: '12px',
|
|
17
|
+
},
|
|
18
|
+
'body-12': {
|
|
19
|
+
fontSize: '12px',
|
|
20
|
+
lineHeight: '15px',
|
|
21
|
+
},
|
|
22
|
+
'body-13': {
|
|
23
|
+
fontSize: '13px',
|
|
24
|
+
lineHeight: '16px',
|
|
25
|
+
},
|
|
26
|
+
'body-14': {
|
|
27
|
+
fontSize: '14px',
|
|
28
|
+
lineHeight: '18px',
|
|
29
|
+
},
|
|
30
|
+
'body-16': {
|
|
31
|
+
fontSize: '16px',
|
|
32
|
+
lineHeight: '20px',
|
|
33
|
+
},
|
|
34
|
+
'display-18': {
|
|
35
|
+
fontSize: '18px',
|
|
36
|
+
lineHeight: '24px',
|
|
37
|
+
},
|
|
38
|
+
'display-20': {
|
|
39
|
+
fontSize: '20px',
|
|
40
|
+
lineHeight: '26px',
|
|
41
|
+
},
|
|
42
|
+
'display-24': {
|
|
43
|
+
fontSize: '24px',
|
|
44
|
+
lineHeight: '34px',
|
|
45
|
+
},
|
|
46
|
+
'display-28': {
|
|
47
|
+
fontSize: '28px',
|
|
48
|
+
lineHeight: '34px',
|
|
49
|
+
},
|
|
50
|
+
'display-32': {
|
|
51
|
+
fontSize: '32px',
|
|
52
|
+
lineHeight: '38px',
|
|
53
|
+
},
|
|
54
|
+
'display-40': {
|
|
55
|
+
fontSize: '40px',
|
|
56
|
+
lineHeight: '46px',
|
|
57
|
+
},
|
|
58
|
+
'display-42': {
|
|
59
|
+
fontSize: '42px',
|
|
60
|
+
lineHeight: '48px',
|
|
61
|
+
},
|
|
62
|
+
};
|
package/esm/typography/index.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { styled } from '../style';
|
|
2
|
-
import { WEIGHT as WeightAlias } from './constants';
|
|
2
|
+
import { WEIGHT as WeightAlias, TYPOGRAPHY_VARIANT_MAP, DEFAULT_BODY_WEIGHT, DEFAULT_DISPLAY_WEIGHT, } from './constants';
|
|
3
|
+
var getTypographyWeight = function ($variant) {
|
|
4
|
+
return $variant.includes('body')
|
|
5
|
+
? DEFAULT_BODY_WEIGHT
|
|
6
|
+
: $variant.includes('display')
|
|
7
|
+
? DEFAULT_DISPLAY_WEIGHT
|
|
8
|
+
: WeightAlias.regular;
|
|
9
|
+
};
|
|
3
10
|
export var StyledTypography = styled('span', function (_a, _b) {
|
|
4
|
-
var
|
|
11
|
+
var _c, _d;
|
|
12
|
+
var theme = _a.theme, classes = _a.classes;
|
|
5
13
|
var $variant = _b.$variant, $weight = _b.$weight;
|
|
6
|
-
var variantStyles = theme.typography[$variant]
|
|
14
|
+
var variantStyles = (_d = (_c = TYPOGRAPHY_VARIANT_MAP[$variant]) !== null && _c !== void 0 ? _c : theme.typography[$variant]) !== null && _d !== void 0 ? _d : theme.typography['l1'];
|
|
7
15
|
var fontSize = variantStyles.fontSize, lineHeight = variantStyles.lineHeight, variantFontWeight = variantStyles.fontWeight;
|
|
8
|
-
var fontWeight = $weight ? "".concat(WeightAlias[$weight]) : variantFontWeight;
|
|
16
|
+
var fontWeight = $weight ? "".concat(WeightAlias[$weight]) : variantFontWeight !== null && variantFontWeight !== void 0 ? variantFontWeight : getTypographyWeight($variant);
|
|
9
17
|
return { fontSize: fontSize, lineHeight: lineHeight, fontWeight: fontWeight };
|
|
10
18
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
import { SpacewebComponentProps } from '../types';
|
|
3
|
-
export declare type TypographyVariant = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'h7' | 'bl1' | 'bl2' | 'bl3' | 'bs1' | 'bs2' | 'bs3' | 'l1' | 'l2' | 'l3' | 'l4';
|
|
3
|
+
export declare type TypographyVariant = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'h7' | 'bl1' | 'bl2' | 'bl3' | 'bs1' | 'bs2' | 'bs3' | 'l1' | 'l2' | 'l3' | 'l4' | 'body-8' | 'body-10' | 'body-12' | 'body-13' | 'body-14' | 'body-16' | 'display-18' | 'display-20' | 'display-24' | 'display-28' | 'display-32' | 'display-40' | 'display-42';
|
|
4
4
|
export declare type FontWeight = 'regular' | 'medium' | 'semibold' | 'bold';
|
|
5
5
|
export declare type TypographyProps = PropsWithChildren<SpacewebComponentProps> & {
|
|
6
6
|
/** variant of typography element */
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import { NUMBER_VARIANTS } from './types';
|
|
3
|
+
export var getFormattedNumber = function (_a) {
|
|
4
|
+
var value = _a.value, locale = _a.locale, variant = _a.variant, numberOptions = _a.numberOptions;
|
|
5
|
+
var absValue = Math.abs(value);
|
|
6
|
+
var betweenZeroAndOne = absValue > 0 && absValue < 1;
|
|
7
|
+
var maximumFractionDigits, notation;
|
|
8
|
+
switch (variant.type) {
|
|
9
|
+
case NUMBER_VARIANTS.EXPANDED_AUTO_FORMAT: {
|
|
10
|
+
var decimalDigits = betweenZeroAndOne ? 4 : 2;
|
|
11
|
+
maximumFractionDigits = decimalDigits;
|
|
12
|
+
notation = 'standard';
|
|
13
|
+
break;
|
|
14
|
+
}
|
|
15
|
+
case NUMBER_VARIANTS.EXPANDED_DECIMAL_FORMAT: {
|
|
16
|
+
maximumFractionDigits = variant.decimalDigits;
|
|
17
|
+
notation = 'standard';
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
case NUMBER_VARIANTS.COMPACT_AUTO_FORMAT: {
|
|
21
|
+
var decimalDigits = betweenZeroAndOne ? 4 : 2;
|
|
22
|
+
maximumFractionDigits = decimalDigits;
|
|
23
|
+
notation = 'compact';
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
case NUMBER_VARIANTS.COMPACT_DECIMAL_FORMAT: {
|
|
27
|
+
maximumFractionDigits = variant.decimalDigits;
|
|
28
|
+
notation = 'compact';
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
default: {
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return Intl.NumberFormat(locale, __assign({ minimumFractionDigits: 0, maximumFractionDigits: maximumFractionDigits, notation: notation }, numberOptions)).format(value);
|
|
36
|
+
};
|