@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
package/date-input/DateInput.js
CHANGED
|
@@ -13,24 +13,18 @@ var overrides_1 = require("../overrides");
|
|
|
13
13
|
var constants_1 = require("../date-picker/constants");
|
|
14
14
|
var utils_1 = require("../date-picker/utils");
|
|
15
15
|
var styled_components_1 = require("./styled-components");
|
|
16
|
+
var utils_2 = require("../time-range-picker/utils");
|
|
17
|
+
var context_1 = require("../form-control/context");
|
|
16
18
|
var DateInput = function (_a) {
|
|
17
|
-
var _b = _a.adapter, adapter = _b === void 0 ? date_fns_adapter_1.default : _b, _c = _a.formatString, formatString = _c === void 0 ? constants_1.DEFAULT_FORMAT_STRING : _c, mask = _a.mask, onChange = _a.onChange, value = _a.value, locale = _a.locale, weekStartsOn = _a.weekStartsOn, _d = _a.maskChar, maskChar = _d === void 0 ? '_' : _d, overrides = _a.overrides, minDate = _a.minDate, maxDate = _a.maxDate, timeSelect = _a.timeSelect, restProps = (0, tslib_1.__rest)(_a, ["adapter", "formatString", "mask", "onChange", "value", "locale", "weekStartsOn", "maskChar", "overrides", "minDate", "maxDate", "timeSelect"]);
|
|
19
|
+
var _b = _a.adapter, adapter = _b === void 0 ? date_fns_adapter_1.default : _b, _c = _a.formatString, formatString = _c === void 0 ? constants_1.DEFAULT_FORMAT_STRING : _c, mask = _a.mask, onChange = _a.onChange, value = _a.value, locale = _a.locale, weekStartsOn = _a.weekStartsOn, _d = _a.maskChar, maskChar = _d === void 0 ? '_' : _d, overrides = _a.overrides, minDate = _a.minDate, maxDate = _a.maxDate, timeSelect = _a.timeSelect, _e = _a.showTimezone, showTimezone = _e === void 0 ? false : _e, _f = _a.timezone, timezone = _f === void 0 ? (0, utils_2.getSystemTzName)() : _f, restProps = (0, tslib_1.__rest)(_a, ["adapter", "formatString", "mask", "onChange", "value", "locale", "weekStartsOn", "maskChar", "overrides", "minDate", "maxDate", "timeSelect", "showTimezone", "timezone"]);
|
|
20
|
+
var intent = (0, context_1.useContextualFormProps)(restProps).intent;
|
|
18
21
|
var dateFnsLocale = (0, react_1.useMemo)(function () { return (0, utils_1.prepareLocale)(locale, { weekStartsOn: weekStartsOn }); }, [weekStartsOn, locale]);
|
|
19
22
|
var dateHelpers = (0, react_1.useMemo)(function () { return new date_helpers_1.default(adapter); }, [adapter]);
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
maxDate: maxDate,
|
|
26
|
-
dateHelpers: dateHelpers,
|
|
27
|
-
})) {
|
|
28
|
-
setError(false);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
setError(true);
|
|
32
|
-
}
|
|
33
|
-
}, [dateHelpers, maxDate, minDate, value]);
|
|
23
|
+
var timezoneAdaptedValue = (0, react_1.useMemo)(function () { return (value ? new Date((0, utils_2.convertDateFromSystemTzToTargetTz)(value, timezone)) : undefined); }, [value, timezone]);
|
|
24
|
+
var _g = (0, tslib_1.__read)((0, react_1.useState)(function () {
|
|
25
|
+
return (0, utils_1.formatDate)({ date: timezoneAdaptedValue, locale: dateFnsLocale, dateHelpers: dateHelpers, formatString: formatString });
|
|
26
|
+
}), 2), date = _g[0], setDate = _g[1];
|
|
27
|
+
var _h = (0, tslib_1.__read)((0, react_1.useState)(function () { return !(0, utils_1.isDayInRange)(timezoneAdaptedValue, { minDate: minDate, maxDate: maxDate, dateHelpers: dateHelpers }); }), 2), error = _h[0], setError = _h[1];
|
|
34
28
|
var getMask = (0, react_1.useCallback)(function () {
|
|
35
29
|
if (!mask && formatString !== constants_1.DEFAULT_FORMAT_STRING) {
|
|
36
30
|
return null;
|
|
@@ -47,7 +41,10 @@ var DateInput = function (_a) {
|
|
|
47
41
|
var _mask = getMask();
|
|
48
42
|
var _date = dateHelpers.date(dateString);
|
|
49
43
|
// to check the clearable cases
|
|
50
|
-
if ((typeof _mask === 'string' &&
|
|
44
|
+
if ((typeof _mask === 'string' &&
|
|
45
|
+
inputValue.replace(new RegExp(maskChar, 'g'), ' ') === _mask.replace(/[9|a|*]/g, ' ')) ||
|
|
46
|
+
inputValue.length === 0) {
|
|
47
|
+
setError(false);
|
|
51
48
|
onChange(null);
|
|
52
49
|
return;
|
|
53
50
|
}
|
|
@@ -59,18 +56,27 @@ var DateInput = function (_a) {
|
|
|
59
56
|
}
|
|
60
57
|
var isValidDate = _date && dateHelpers.isValid(_date);
|
|
61
58
|
if (isValidDate && _date) {
|
|
62
|
-
setError(
|
|
59
|
+
setError(!(0, utils_1.isDayInRange)(_date, { minDate: minDate, maxDate: maxDate, dateHelpers: dateHelpers }));
|
|
63
60
|
setDate((0, utils_1.formatDate)({ date: _date, locale: dateFnsLocale, dateHelpers: dateHelpers, formatString: formatString }));
|
|
64
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(_date);
|
|
61
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(new Date((0, utils_2.convertDateFromTargetTzToSystemTz)(_date, timezone)), timezone);
|
|
65
62
|
}
|
|
66
63
|
else {
|
|
64
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(null);
|
|
67
65
|
setError(true);
|
|
68
66
|
}
|
|
69
|
-
}, [onChange, dateFnsLocale, dateHelpers, formatString, getMask]);
|
|
70
|
-
var onCalendarDateChange = (0, react_1.useCallback)(function (_date) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
}, [onChange, dateFnsLocale, dateHelpers, formatString, getMask, timezone, maskChar, maxDate, minDate]);
|
|
68
|
+
var onCalendarDateChange = (0, react_1.useCallback)(function (_date, _timezone) {
|
|
69
|
+
// _date is timezone adapted date, original date is what user actually selected from calendar
|
|
70
|
+
var originalDate = new Date((0, utils_2.convertDateFromSystemTzToTargetTz)(_date, _timezone));
|
|
71
|
+
setDate((0, utils_1.formatDate)({
|
|
72
|
+
date: originalDate,
|
|
73
|
+
locale: dateFnsLocale,
|
|
74
|
+
dateHelpers: dateHelpers,
|
|
75
|
+
formatString: formatString,
|
|
76
|
+
}));
|
|
77
|
+
setError(!(0, utils_1.isDayInRange)(originalDate, { minDate: minDate, maxDate: maxDate, dateHelpers: dateHelpers }));
|
|
78
|
+
onChange(_date, _timezone);
|
|
79
|
+
}, [onChange, dateFnsLocale, dateHelpers, formatString, minDate, maxDate]);
|
|
74
80
|
var mergedOverrides = (0, react_1.useMemo)(function () {
|
|
75
81
|
return (0, overrides_1.mergeOverrides)({
|
|
76
82
|
Before: {
|
|
@@ -80,17 +86,32 @@ var DateInput = function (_a) {
|
|
|
80
86
|
locale: locale,
|
|
81
87
|
onChange: onCalendarDateChange,
|
|
82
88
|
weekStartsOn: weekStartsOn,
|
|
89
|
+
// passing value as it is as date picker will adapt this with timezone
|
|
83
90
|
value: value,
|
|
84
91
|
minDate: minDate,
|
|
85
92
|
maxDate: maxDate,
|
|
86
93
|
timeSelect: timeSelect,
|
|
94
|
+
showTimezone: showTimezone,
|
|
95
|
+
timezone: timezone,
|
|
87
96
|
},
|
|
88
97
|
},
|
|
89
98
|
Input: {
|
|
90
99
|
style: styled_components_1.inputStyles,
|
|
91
100
|
},
|
|
92
101
|
}, overrides);
|
|
93
|
-
}, [
|
|
94
|
-
|
|
102
|
+
}, [
|
|
103
|
+
adapter,
|
|
104
|
+
onCalendarDateChange,
|
|
105
|
+
locale,
|
|
106
|
+
overrides,
|
|
107
|
+
value,
|
|
108
|
+
weekStartsOn,
|
|
109
|
+
minDate,
|
|
110
|
+
maxDate,
|
|
111
|
+
timeSelect,
|
|
112
|
+
showTimezone,
|
|
113
|
+
timezone,
|
|
114
|
+
]);
|
|
115
|
+
return ((0, jsx_runtime_1.jsx)(react_input_mask_1.default, (0, tslib_1.__assign)({ mask: getMask(), value: date, maskChar: maskChar, onChange: handleInputChange, disabled: restProps.disabled, onBlur: restProps.onBlur }, { children: function (props) { return (0, jsx_runtime_1.jsx)(input_1.Input, (0, tslib_1.__assign)({}, restProps, props, { intent: error ? 'error' : intent, overrides: mergedOverrides }), void 0); } }), void 0));
|
|
95
116
|
};
|
|
96
117
|
exports.DateInput = DateInput;
|
|
@@ -6,11 +6,13 @@ var dateInputSizeConfig = {
|
|
|
6
6
|
md: { paddingLeft: '4px' },
|
|
7
7
|
lg: { paddingLeft: '8px' },
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
exports.inputStyles = [
|
|
10
|
+
'tabular-nums',
|
|
11
|
+
function (utils, _a) {
|
|
12
|
+
var _b;
|
|
13
|
+
var $size = _a.$size;
|
|
14
|
+
return ({
|
|
15
|
+
paddingLeft: ((_b = dateInputSizeConfig[$size]) !== null && _b !== void 0 ? _b : dateInputSizeConfig.lg).paddingLeft,
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
];
|
package/date-input/types.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { WeekStartsOn } from '../date-picker';
|
|
2
2
|
import { InputProps } from '../input';
|
|
3
|
-
export declare type DateInputProps = Omit<InputProps, 'value' | 'onChange' | '
|
|
3
|
+
export declare type DateInputProps = Omit<InputProps, 'value' | 'onChange' | 'min' | 'max' | 'debouncedOnChange' | 'debounceInterval' | 'type' | 'inputMode'> & {
|
|
4
4
|
formatString?: string;
|
|
5
5
|
adapter?: any;
|
|
6
6
|
mask?: string;
|
|
7
7
|
locale?: any;
|
|
8
8
|
value?: Date;
|
|
9
|
-
onChange: (value?: Date | null) => void;
|
|
9
|
+
onChange: (value?: Date | null, timezone?: string) => void;
|
|
10
10
|
weekStartsOn?: WeekStartsOn;
|
|
11
11
|
maskChar?: string;
|
|
12
12
|
minDate?: Date;
|
|
13
13
|
maxDate?: Date;
|
|
14
14
|
timeSelect?: boolean;
|
|
15
|
+
showTimezone?: boolean;
|
|
16
|
+
timezone?: string;
|
|
15
17
|
};
|
package/date-picker/Calendar.js
CHANGED
|
@@ -8,7 +8,8 @@ var date_fns_adapter_1 = (0, tslib_1.__importDefault)(require("baseui/datepicker
|
|
|
8
8
|
var date_helpers_1 = (0, tslib_1.__importDefault)(require("baseui/datepicker/utils/date-helpers"));
|
|
9
9
|
var constants_1 = require("baseui/datepicker/constants");
|
|
10
10
|
var merge_1 = (0, tslib_1.__importDefault)(require("lodash/merge"));
|
|
11
|
-
var
|
|
11
|
+
var chevron_left_1 = (0, tslib_1.__importDefault)(require("../icon/components/chevron-left"));
|
|
12
|
+
var chevron_right_1 = (0, tslib_1.__importDefault)(require("../icon/components/chevron-right"));
|
|
12
13
|
var useConvertOverrides_1 = require("../helpers/baseui/useConvertOverrides");
|
|
13
14
|
var popover_1 = require("../popover");
|
|
14
15
|
var menu_1 = require("../menu");
|
|
@@ -20,7 +21,7 @@ var styled_components_1 = require("./styled-components");
|
|
|
20
21
|
var constants_2 = require("./constants");
|
|
21
22
|
var utils_1 = require("./utils");
|
|
22
23
|
var useIsMobileDevice_1 = require("../hooks/useIsMobileDevice");
|
|
23
|
-
var CALENDAR_CUSTOM_THEME = { theme: { input: { borderRadius: '4px' } } };
|
|
24
|
+
var CALENDAR_CUSTOM_THEME = { theme: { input: { borderRadius: '4px', sizeSm: { borderRadius: '4px' } } } };
|
|
24
25
|
var MonthYearSelectMenu = function (props) {
|
|
25
26
|
var _a = (0, tslib_1.__read)((0, react_1.useState)(props.initialState.highlightedIndex), 2), highlightedIndex = _a[0], setHighlightedIndex = _a[1];
|
|
26
27
|
var onItemSelect = props.onItemSelect;
|
|
@@ -45,6 +46,7 @@ var isHiddenPaginationButton = function (direction, order, monthsShown) {
|
|
|
45
46
|
var ArrowButton = function (_a) {
|
|
46
47
|
var $order = _a.$order, monthsShown = _a.monthsShown, direction = _a.direction, nextButtonProps = (0, tslib_1.__rest)(_a, ["$order", "monthsShown", "direction"]);
|
|
47
48
|
var isHidden = isHiddenPaginationButton(direction, $order, monthsShown);
|
|
49
|
+
var ChevronIcon = direction === 'next' ? chevron_right_1.default : chevron_left_1.default;
|
|
48
50
|
return ((0, jsx_runtime_1.jsx)(button_1.IconButton, (0, tslib_1.__assign)({ className: [
|
|
49
51
|
'h-6 w-6',
|
|
50
52
|
isHidden ? 'invisible' : 'visible',
|
|
@@ -54,7 +56,7 @@ var ArrowButton = function (_a) {
|
|
|
54
56
|
minWidth: px2rem(24),
|
|
55
57
|
});
|
|
56
58
|
},
|
|
57
|
-
] }, nextButtonProps, { children: (0, jsx_runtime_1.jsx)(
|
|
59
|
+
] }, nextButtonProps, { children: (0, jsx_runtime_1.jsx)(ChevronIcon, { size: 8 }, void 0) }), void 0));
|
|
58
60
|
};
|
|
59
61
|
var Calendar = function (_a) {
|
|
60
62
|
var _b;
|
package/date-picker/DateInput.js
CHANGED
|
@@ -10,8 +10,10 @@ var longHandHelpers_1 = require("../helpers/longHandHelpers");
|
|
|
10
10
|
var input_1 = require("../input");
|
|
11
11
|
var utils_1 = require("./utils");
|
|
12
12
|
var box_1 = require("../box");
|
|
13
|
+
var themeHelpers_1 = require("../helpers/themeHelpers");
|
|
14
|
+
var theme_1 = require("../theme");
|
|
13
15
|
var COMMON_STYLE = [
|
|
14
|
-
'px-0 py-0 rounded-2
|
|
16
|
+
'px-0 py-0 rounded-2 focus:spr-ui-04 focus:spr-text-05 text-center',
|
|
15
17
|
function (_a) {
|
|
16
18
|
var theme = _a.theme, px2rem = _a.px2rem;
|
|
17
19
|
return ({
|
|
@@ -22,14 +24,13 @@ var COMMON_STYLE = [
|
|
|
22
24
|
caretColor: theme.spr.ui01,
|
|
23
25
|
},
|
|
24
26
|
fontVariantNumeric: 'tabular-nums',
|
|
25
|
-
lineHeight: px2rem(16),
|
|
26
27
|
});
|
|
27
28
|
},
|
|
28
29
|
];
|
|
29
30
|
var DATE_CLASSNAME = [
|
|
30
31
|
'text-center flex-none',
|
|
31
32
|
{
|
|
32
|
-
maxWidth: '1.
|
|
33
|
+
maxWidth: '1.9rem',
|
|
33
34
|
},
|
|
34
35
|
];
|
|
35
36
|
var DATE_OVERRIDES = {
|
|
@@ -46,7 +47,7 @@ var DATE_OVERRIDES = {
|
|
|
46
47
|
var MONTH_CLASSNAME = [
|
|
47
48
|
'text-center flex-none',
|
|
48
49
|
{
|
|
49
|
-
maxWidth: '2.
|
|
50
|
+
maxWidth: '2.7rem',
|
|
50
51
|
},
|
|
51
52
|
];
|
|
52
53
|
var MONTH_OVERRIDES = {
|
|
@@ -63,7 +64,7 @@ var MONTH_OVERRIDES = {
|
|
|
63
64
|
var YEAR_CLASSNAME = [
|
|
64
65
|
'text-center flex-none',
|
|
65
66
|
{
|
|
66
|
-
maxWidth: '3.
|
|
67
|
+
maxWidth: '3.7rem',
|
|
67
68
|
},
|
|
68
69
|
];
|
|
69
70
|
var YEAR_OVERRIDES = {
|
|
@@ -96,12 +97,15 @@ var MIN_YEAR = 1900;
|
|
|
96
97
|
var MAX_YEAR = 2100;
|
|
97
98
|
var isDateValid = function (value) { return value > 0 && value <= 31; };
|
|
98
99
|
exports.isDateValid = isDateValid;
|
|
100
|
+
exports.DateInput = React.memo(
|
|
99
101
|
// eslint-disable-next-line max-statements
|
|
100
|
-
|
|
102
|
+
function (_a) {
|
|
103
|
+
var _b;
|
|
101
104
|
var dateHelpers = _a.dateHelpers, date = _a.date, onChange = _a.onChange, maxDate = _a.maxDate, minDate = _a.minDate, disabled = _a.disabled;
|
|
102
|
-
var
|
|
103
|
-
var _c = (0, tslib_1.__read)(React.useState(function () { return (date ? dateHelpers.
|
|
104
|
-
var _d = (0, tslib_1.__read)(React.useState(
|
|
105
|
+
var theme = (0, theme_1.useTheme)().theme;
|
|
106
|
+
var _c = (0, tslib_1.__read)(React.useState(function () { return (date ? dateHelpers.formatDate(date, 'dd') : ''); }), 2), day = _c[0], setDay = _c[1];
|
|
107
|
+
var _d = (0, tslib_1.__read)(React.useState(function () { return (date ? dateHelpers.getYear(date) : ''); }), 2), year = _d[0], setYear = _d[1];
|
|
108
|
+
var _e = (0, tslib_1.__read)(React.useState(false), 2), error = _e[0], setError = _e[1];
|
|
105
109
|
var minAllowedDate = 1;
|
|
106
110
|
var maxAllowedDate = (0, getDaysInMonth_1.default)(date || new Date());
|
|
107
111
|
var minYear = minDate ? dateHelpers.getYear(minDate) : MIN_YEAR;
|
|
@@ -210,11 +214,9 @@ exports.DateInput = React.memo(function (_a) {
|
|
|
210
214
|
}
|
|
211
215
|
};
|
|
212
216
|
var month = date ? dateHelpers.formatDate(date, 'MMM') : '';
|
|
217
|
+
var inputSizeTheme = (0, themeHelpers_1.getComponentSizeTheme)(theme, 'input', 'sm', (0, themeHelpers_1.getDefaultSize)(theme));
|
|
213
218
|
return ((0, jsx_runtime_1.jsxs)(box_1.Box, (0, tslib_1.__assign)({ "data-testid": "date-input", className: [
|
|
214
|
-
'px-3 flex items-center border-1 border-solid
|
|
215
|
-
|
|
216
|
-
var theme = _a.theme, px2rem = _a.px2rem;
|
|
217
|
-
return ((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, (0, longHandHelpers_1.borderColor)(error ? theme.spr.supportError : theme.spr.ui03)), { height: px2rem(35) }), (disabled ? { backgroundColor: theme.spr.ui02 } : { backgroundColor: theme.spr.ui01 })));
|
|
218
|
-
},
|
|
219
|
+
'px-3 flex items-center border-1 border-solid border-box',
|
|
220
|
+
(0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, (0, longHandHelpers_1.borderColor)(error ? theme.spr.supportError : theme.spr.ui03)), (0, longHandHelpers_1.borderRadius)((_b = inputSizeTheme.borderRadius) !== null && _b !== void 0 ? _b : theme.input.borderRadius)), { paddingLeft: inputSizeTheme.paddingX, paddingRight: inputSizeTheme.paddingX, paddingTop: inputSizeTheme.paddingY, paddingBottom: inputSizeTheme.paddingY }), (disabled ? { backgroundColor: theme.spr.ui02 } : { backgroundColor: theme.spr.ui01 })),
|
|
219
221
|
] }, { children: [(0, jsx_runtime_1.jsx)(react_input_mask_1.default, (0, tslib_1.__assign)({ onBlur: dateBlur, onKeyDown: dateKeyDown, mask: "99", value: day, onChange: dayChange, maskChar: "_", disabled: disabled }, { children: function (props) { return ((0, jsx_runtime_1.jsx)(input_1.Input, (0, tslib_1.__assign)({}, props, { className: DATE_CLASSNAME, overrides: DATE_OVERRIDES, placeholder: "dd", size: "sm", disabled: disabled }), void 0)); } }), void 0), (0, jsx_runtime_1.jsx)(react_input_mask_1.default, (0, tslib_1.__assign)({ value: month, onKeyDown: monthKeyDown, mask: "aaa", maskChar: "_", disabled: disabled }, { children: function (props) { return ((0, jsx_runtime_1.jsx)(input_1.Input, (0, tslib_1.__assign)({}, props, { className: MONTH_CLASSNAME, overrides: MONTH_OVERRIDES, placeholder: "MM", size: "sm", disabled: disabled }), void 0)); } }), void 0), (0, jsx_runtime_1.jsx)(react_input_mask_1.default, (0, tslib_1.__assign)({ onBlur: yearBlur, onKeyDown: yearKeyDown, mask: "9999", value: year, onChange: yearChange, maskChar: "_", disabled: disabled }, { children: function (props) { return ((0, jsx_runtime_1.jsx)(input_1.Input, (0, tslib_1.__assign)({}, props, { className: YEAR_CLASSNAME, overrides: YEAR_OVERRIDES, placeholder: "yyyy", size: "sm", disabled: disabled }), void 0)); } }), void 0)] }), void 0));
|
|
220
222
|
});
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { DatepickerOverrides, CalendarProps } from './types';
|
|
3
|
-
declare type DatePickerContentProps = Omit<CalendarProps, 'timeSelectEnd' | 'timeSelectStart'> & {
|
|
2
|
+
import { DatepickerOverrides, CalendarProps, Nullable } from './types';
|
|
3
|
+
declare type DatePickerContentProps = Omit<CalendarProps, 'timeSelectEnd' | 'timeSelectStart' | 'onChange'> & {
|
|
4
4
|
overrides?: DatepickerOverrides;
|
|
5
5
|
timeSelect?: boolean;
|
|
6
6
|
onClose: () => void;
|
|
7
|
+
showTimezone?: boolean;
|
|
8
|
+
timezone: string;
|
|
9
|
+
onChange: (params: {
|
|
10
|
+
date?: Nullable<Date>[] | Nullable<Date>;
|
|
11
|
+
timezone?: string;
|
|
12
|
+
}) => void;
|
|
7
13
|
};
|
|
8
|
-
export declare const DatePickerContent: ({ value: _value, onChange, overrides, autoFocusCalendar, onClose, adapter, ...props }: DatePickerContentProps) => React.ReactElement;
|
|
14
|
+
export declare const DatePickerContent: ({ value: _value, onChange, overrides, autoFocusCalendar, onClose, adapter, showTimezone, timezone: _timezone, ...props }: DatePickerContentProps) => React.ReactElement;
|
|
9
15
|
export {};
|
|
@@ -6,19 +6,38 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
6
6
|
var React = (0, tslib_1.__importStar)(require("react"));
|
|
7
7
|
var date_helpers_1 = (0, tslib_1.__importDefault)(require("baseui/datepicker/utils/date-helpers"));
|
|
8
8
|
var date_fns_adapter_1 = (0, tslib_1.__importDefault)(require("baseui/datepicker/utils/date-fns-adapter"));
|
|
9
|
+
var compact_1 = (0, tslib_1.__importDefault)(require("lodash/compact"));
|
|
9
10
|
var Calendar_1 = (0, tslib_1.__importDefault)(require("./Calendar"));
|
|
10
11
|
var box_1 = require("../box");
|
|
11
12
|
var stack_1 = require("../stack");
|
|
12
13
|
var button_1 = require("../button");
|
|
13
14
|
var styled_components_1 = require("./styled-components");
|
|
15
|
+
var time_zone_picker_1 = require("../time-zone-picker");
|
|
16
|
+
var form_control_1 = require("../form-control");
|
|
14
17
|
var overrides_1 = require("../overrides");
|
|
15
18
|
var locale_1 = require("../locale");
|
|
16
19
|
var utils_1 = require("./utils");
|
|
20
|
+
var utils_2 = require("../time-range-picker/utils");
|
|
21
|
+
var MONTH_WIDTH = 284;
|
|
22
|
+
var TIMEZONE_PICKER_OVERRIDES = {
|
|
23
|
+
Select: {
|
|
24
|
+
props: {
|
|
25
|
+
overrides: {
|
|
26
|
+
Input: {
|
|
27
|
+
props: {
|
|
28
|
+
'data-testid': 'timezone-selector',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
17
35
|
var DatePickerContent = function (_a) {
|
|
18
|
-
var _value = _a.value, onChange = _a.onChange, overrides = _a.overrides, autoFocusCalendar = _a.autoFocusCalendar, onClose = _a.onClose, _b = _a.adapter, adapter = _b === void 0 ? date_fns_adapter_1.default : _b, props = (0, tslib_1.__rest)(_a, ["value", "onChange", "overrides", "autoFocusCalendar", "onClose", "adapter"]);
|
|
36
|
+
var _value = _a.value, onChange = _a.onChange, overrides = _a.overrides, autoFocusCalendar = _a.autoFocusCalendar, onClose = _a.onClose, _b = _a.adapter, adapter = _b === void 0 ? date_fns_adapter_1.default : _b, showTimezone = _a.showTimezone, _timezone = _a.timezone, props = (0, tslib_1.__rest)(_a, ["value", "onChange", "overrides", "autoFocusCalendar", "onClose", "adapter", "showTimezone", "timezone"]);
|
|
19
37
|
var dateHelpers = React.useMemo(function () { return new date_helpers_1.default(adapter); }, [adapter]);
|
|
20
38
|
var _c = (0, tslib_1.__read)(React.useState(_value), 2), value = _c[0], setValue = _c[1];
|
|
21
39
|
var _d = (0, tslib_1.__read)(React.useState(false), 2), hasError = _d[0], setHasError = _d[1];
|
|
40
|
+
var _e = (0, tslib_1.__read)(React.useState(_timezone), 2), timezone = _e[0], setTimezone = _e[1];
|
|
22
41
|
React.useEffect(function () {
|
|
23
42
|
if ((0, utils_1.isTimeInRange)(value, { minDate: props.minDate, maxDate: props.maxDate, dateHelpers: dateHelpers })) {
|
|
24
43
|
setHasError(false);
|
|
@@ -27,19 +46,51 @@ var DatePickerContent = function (_a) {
|
|
|
27
46
|
setHasError(true);
|
|
28
47
|
}
|
|
29
48
|
}, [dateHelpers, props.maxDate, props.minDate, value]);
|
|
30
|
-
var
|
|
49
|
+
var _f = (0, tslib_1.__read)((0, overrides_1.useOverrides)(overrides === null || overrides === void 0 ? void 0 : overrides.Footer, styled_components_1.StyledFooter), 2), Footer = _f[0], footerProps = _f[1];
|
|
50
|
+
var _g = (0, tslib_1.__read)((0, overrides_1.useOverrides)(overrides === null || overrides === void 0 ? void 0 : overrides.Calendar, Calendar_1.default), 2), Calendar = _g[0], calendarProps = _g[1];
|
|
31
51
|
var locale = (0, locale_1.useLocale)();
|
|
32
52
|
var handleChange = React.useCallback(function (data) {
|
|
33
53
|
setValue(data.date);
|
|
34
54
|
if (!props.timeSelect) {
|
|
35
|
-
|
|
55
|
+
if (Array.isArray(data.date)) {
|
|
56
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
57
|
+
date: (0, compact_1.default)(data.date).map(function (date) { return new Date((0, utils_2.convertDateFromTargetTzToSystemTz)(date, timezone)); }),
|
|
58
|
+
timezone: timezone,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
var startMillis = (0, utils_2.convertDateFromTargetTzToSystemTz)(data.date, timezone);
|
|
63
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
64
|
+
date: new Date(startMillis),
|
|
65
|
+
timezone: timezone,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
36
68
|
}
|
|
37
|
-
}, [onChange, props.timeSelect]);
|
|
69
|
+
}, [onChange, props.timeSelect, timezone]);
|
|
38
70
|
var handleSubmit = React.useCallback(function () {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
71
|
+
if (value && !Array.isArray(value)) {
|
|
72
|
+
var startMillis = (0, utils_2.convertDateFromTargetTzToSystemTz)(value, timezone);
|
|
73
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({ date: new Date(startMillis), timezone: timezone });
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
77
|
+
date: value
|
|
78
|
+
? (0, compact_1.default)(value).map(function (date) { return new Date((0, utils_2.convertDateFromTargetTzToSystemTz)(date, timezone)); })
|
|
79
|
+
: undefined,
|
|
80
|
+
timezone: timezone,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}, [onChange, timezone, value]);
|
|
84
|
+
return ((0, jsx_runtime_1.jsxs)(box_1.Box, (0, tslib_1.__assign)({ className: function (_a) {
|
|
85
|
+
var px2rem = _a.px2rem;
|
|
86
|
+
return ({
|
|
87
|
+
maxWidth: px2rem((props.monthsShown || 1) * MONTH_WIDTH),
|
|
88
|
+
});
|
|
89
|
+
} }, { children: [(0, jsx_runtime_1.jsx)(Calendar, (0, tslib_1.__assign)({ trapTabbing: !props.timeSelect }, props, { value: value, onChange: handleChange,
|
|
42
90
|
// @ts-ignore
|
|
43
|
-
overrides: overrides, autoFocusCalendar: autoFocusCalendar, timeSelectEnd: props.timeSelect, timeSelectStart: props.timeSelect, adapter: adapter }), void 0),
|
|
91
|
+
overrides: overrides, autoFocusCalendar: autoFocusCalendar, timeSelectEnd: props.timeSelect, timeSelectStart: props.timeSelect, adapter: adapter }, calendarProps), void 0), showTimezone ? ((0, jsx_runtime_1.jsx)(box_1.Box, (0, tslib_1.__assign)({ className: "px-4 mb-4" }, { children: (0, jsx_runtime_1.jsx)(form_control_1.FormControl, (0, tslib_1.__assign)({ label: locale.datePicker.timezonePickerLabel }, { children: (0, jsx_runtime_1.jsx)(time_zone_picker_1.TimezonePicker, { clearable: false, placeholder: locale.datePicker.timezonePickerPlaceholder, value: timezone, size: "sm", onChange: function (_a) {
|
|
92
|
+
var id = _a.id;
|
|
93
|
+
return setTimezone(id);
|
|
94
|
+
}, overrides: TIMEZONE_PICKER_OVERRIDES }, void 0) }), void 0) }), void 0)) : null, props.timeSelect ? ((0, jsx_runtime_1.jsx)(Footer, (0, tslib_1.__assign)({ "$onSubmit": handleSubmit, "$onClose": onClose, className: "justify-end" }, footerProps, { children: (0, jsx_runtime_1.jsxs)(stack_1.Stack, (0, tslib_1.__assign)({ direction: "horizontal", gap: 3, className: "items-center" }, { children: [(0, jsx_runtime_1.jsx)(button_1.Button, (0, tslib_1.__assign)({ size: "xs", onClick: onClose, variant: "secondary", "data-testid": "cancel" }, { children: locale.timeRangePicker.cancelBtnLabel }), void 0), (0, jsx_runtime_1.jsx)(button_1.Button, (0, tslib_1.__assign)({ size: "xs", onClick: handleSubmit, "data-testid": "save", disabled: hasError || !value }, { children: locale.timeRangePicker.saveBtnLabel }), void 0)] }), void 0) }), void 0)) : null] }), void 0));
|
|
44
95
|
};
|
|
45
96
|
exports.DatePickerContent = DatePickerContent;
|
|
@@ -16,11 +16,15 @@ var styled_components_1 = require("../input/styled-components");
|
|
|
16
16
|
var classNames_1 = (0, tslib_1.__importDefault)(require("../classNames"));
|
|
17
17
|
var InputBeforeEnhancer = function (_a) {
|
|
18
18
|
var disabled = _a.disabled, onClick = _a.onClick;
|
|
19
|
-
return ((0, jsx_runtime_1.jsx)(box_1.Box, (0, tslib_1.__assign)({ className: (0, classNames_1.default)('flex items-center pl-3', {
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(box_1.Box, (0, tslib_1.__assign)({ className: (0, classNames_1.default)('flex items-center pl-3', {
|
|
20
|
+
'cursor-pointer': !disabled,
|
|
21
|
+
}), onClick: disabled ? noop_1.default : onClick }, { children: (0, jsx_runtime_1.jsx)(calendar_solid_1.default, { className: "".concat(disabled ? 'spr-icon-03' : 'spr-icon-01'), size: 14 }, void 0) }), void 0));
|
|
20
22
|
};
|
|
21
23
|
var InputAfterEnhancer = function (_a) {
|
|
22
24
|
var onClick = _a.onClick, isOpen = _a.isOpen, disabled = _a.disabled;
|
|
23
|
-
return ((0, jsx_runtime_1.jsx)(box_1.Box, (0, tslib_1.__assign)({ className: (0, classNames_1.default)('flex items-center pr-3', {
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)(box_1.Box, (0, tslib_1.__assign)({ className: (0, classNames_1.default)('flex items-center pr-3', {
|
|
26
|
+
'cursor-pointer': !disabled,
|
|
27
|
+
}), onClick: disabled ? noop_1.default : onClick }, { children: (0, jsx_runtime_1.jsx)(chevron_down_1.default, { className: commonStyles_1.chevronStyles, "$isOpen": isOpen }, void 0) }), void 0));
|
|
24
28
|
};
|
|
25
29
|
var DEFAULT_INPUT_WIDTH = 62;
|
|
26
30
|
var DatePickerInput = function (_a) {
|
|
@@ -71,10 +75,9 @@ var DatePickerInput = function (_a) {
|
|
|
71
75
|
style: function (_a, _b) {
|
|
72
76
|
var theme = _a.theme;
|
|
73
77
|
var $intent = _b.$intent;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
return {};
|
|
78
|
+
return ((0, tslib_1.__assign)((0, tslib_1.__assign)({}, (isOpen && $intent === 'default' && (0, longHandHelpers_1.borderColor)(theme.spr.focus01))), (autoSizeInput && {
|
|
79
|
+
width: 'auto',
|
|
80
|
+
})));
|
|
78
81
|
},
|
|
79
82
|
},
|
|
80
83
|
ClearIcon: {
|
|
@@ -5,6 +5,7 @@ var tslib_1 = require("tslib");
|
|
|
5
5
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
var React = (0, tslib_1.__importStar)(require("react"));
|
|
7
7
|
var noop_1 = (0, tslib_1.__importDefault)(require("lodash/noop"));
|
|
8
|
+
var compact_1 = (0, tslib_1.__importDefault)(require("lodash/compact"));
|
|
8
9
|
var date_helpers_1 = (0, tslib_1.__importDefault)(require("baseui/datepicker/utils/date-helpers"));
|
|
9
10
|
var date_fns_adapter_1 = (0, tslib_1.__importDefault)(require("baseui/datepicker/utils/date-fns-adapter"));
|
|
10
11
|
var popover_1 = require("baseui/popover");
|
|
@@ -19,6 +20,9 @@ var overrides_1 = require("../overrides");
|
|
|
19
20
|
var constants_1 = require("./constants");
|
|
20
21
|
var utils_1 = require("./utils");
|
|
21
22
|
var DatePickerContent_1 = require("./DatePickerContent");
|
|
23
|
+
var utils_2 = require("../time-range-picker/utils");
|
|
24
|
+
var themeHelpers_1 = require("../helpers/themeHelpers");
|
|
25
|
+
var style_1 = require("../style");
|
|
22
26
|
var accessibilityStyles = {
|
|
23
27
|
position: 'fixed',
|
|
24
28
|
width: '0px',
|
|
@@ -35,14 +39,24 @@ var accessibilityStyles = {
|
|
|
35
39
|
// eslint-disable-next-line max-statements
|
|
36
40
|
var StatelessDatePicker = function (_props) {
|
|
37
41
|
var _a, _b;
|
|
38
|
-
var
|
|
42
|
+
var theme = (0, style_1.useStyle)().theme;
|
|
43
|
+
var _c = (0, context_1.useContextualFormProps)(_props), onChange = _c.onChange, onBlur = _c.onBlur, _d = _c.adapter, adapter = _d === void 0 ? date_fns_adapter_1.default : _d, _e = _c.size, size = _e === void 0 ? (0, themeHelpers_1.getDefaultSize)(theme) : _e, _f = _c.formatString, formatString = _f === void 0 ? constants_1.DEFAULT_FORMAT_STRING : _f, _g = _c.isOpen, isOpen = _g === void 0 ? false : _g, onFocus = _c.onFocus, clearable = _c.clearable, displayValueAtRangeIndex = _c.displayValueAtRangeIndex, _h = _c.variant, variant = _h === void 0 ? 'default' : _h, overrides = _c.overrides, intent = _c.intent, _value = _c.value, formatDisplayValue = _c.formatDisplayValue, _j = _c.autoSizeInput, autoSizeInput = _j === void 0 ? false : _j, weekStartsOn = _c.weekStartsOn, _k = _c.timezone, timezone = _k === void 0 ? (0, utils_2.getSystemTzName)() : _k, _l = _c.showTimezone, showTimezone = _l === void 0 ? false : _l, props = (0, tslib_1.__rest)(_c, ["onChange", "onBlur", "adapter", "size", "formatString", "isOpen", "onFocus", "clearable", "displayValueAtRangeIndex", "variant", "overrides", "intent", "value", "formatDisplayValue", "autoSizeInput", "weekStartsOn", "timezone", "showTimezone"]);
|
|
39
44
|
var locale = (0, locale_1.useLocale)();
|
|
40
45
|
var dateHelpers = React.useMemo(function () { return new date_helpers_1.default(adapter); }, [adapter]);
|
|
41
46
|
var dateFnsLocale = React.useMemo(function () { return (0, utils_1.prepareLocale)(props.locale, { weekStartsOn: weekStartsOn }); }, [weekStartsOn, props.locale]);
|
|
47
|
+
var value = React.useMemo(function () {
|
|
48
|
+
if (Array.isArray(_value)) {
|
|
49
|
+
return (0, compact_1.default)(_value).map(function (date) { return new Date((0, utils_2.convertDateFromSystemTzToTargetTz)(date, timezone)); });
|
|
50
|
+
}
|
|
51
|
+
if (_value) {
|
|
52
|
+
return new Date((0, utils_2.convertDateFromSystemTzToTargetTz)(_value, timezone));
|
|
53
|
+
}
|
|
54
|
+
return undefined;
|
|
55
|
+
}, [_value, timezone]);
|
|
42
56
|
// this state is required for a11y of calendar, this will be set to true when user first press down arrow key on opened calendar
|
|
43
57
|
// and we will set this to false when calendar will be closed.
|
|
44
|
-
var
|
|
45
|
-
var
|
|
58
|
+
var _m = (0, tslib_1.__read)(React.useState(false), 2), autoFocusCalendar = _m[0], setAutoFocusCalendar = _m[1];
|
|
59
|
+
var _o = (0, tslib_1.__read)(React.useState(false), 2), error = _o[0], setError = _o[1];
|
|
46
60
|
React.useEffect(function () {
|
|
47
61
|
if ((0, utils_1.isTimeInRange)(value, { minDate: props.minDate, maxDate: props.maxDate, dateHelpers: dateHelpers })) {
|
|
48
62
|
setError(false);
|
|
@@ -52,7 +66,7 @@ var StatelessDatePicker = function (_props) {
|
|
|
52
66
|
}
|
|
53
67
|
}, [value, props.minDate, props.maxDate, dateHelpers]);
|
|
54
68
|
var screenReaderMsgId = (0, useUniqueId_1.default)();
|
|
55
|
-
var
|
|
69
|
+
var _p = props["aria-describedby"], ariaDescribedBy = _p === void 0 ? "datepicker--screenreader--message--input-".concat(screenReaderMsgId) : _p;
|
|
56
70
|
var defaultFormatDisplayValue = React.useCallback(function (date) {
|
|
57
71
|
var normalizedFormatString = (0, utils_1.normalizeDashes)(formatString);
|
|
58
72
|
if (formatDisplayValue) {
|
|
@@ -61,8 +75,15 @@ var StatelessDatePicker = function (_props) {
|
|
|
61
75
|
}
|
|
62
76
|
return formatDisplayValue(date, normalizedFormatString);
|
|
63
77
|
}
|
|
64
|
-
return (0, utils_1.formatDate)({
|
|
65
|
-
|
|
78
|
+
return (0, utils_1.formatDate)({
|
|
79
|
+
date: date,
|
|
80
|
+
dateHelpers: dateHelpers,
|
|
81
|
+
formatString: normalizedFormatString,
|
|
82
|
+
locale: dateFnsLocale,
|
|
83
|
+
timezone: timezone,
|
|
84
|
+
showTimezone: showTimezone,
|
|
85
|
+
});
|
|
86
|
+
}, [formatString, formatDisplayValue, dateHelpers, dateFnsLocale, timezone, showTimezone]);
|
|
66
87
|
var mergedOverrides = React.useMemo(function () {
|
|
67
88
|
return (0, overrides_1.mergeOverrides)({
|
|
68
89
|
Popover: {
|
|
@@ -97,8 +118,8 @@ var StatelessDatePicker = function (_props) {
|
|
|
97
118
|
}, [locale.datePicker.popoverAriaLabel, overrides]);
|
|
98
119
|
var displayValue = React.useMemo(function () { return defaultFormatDisplayValue(value) || ''; }, [value, defaultFormatDisplayValue]);
|
|
99
120
|
var handleDateChange = React.useCallback(function (data) {
|
|
100
|
-
onChange === null || onChange === void 0 ? void 0 : onChange({ value: data.date });
|
|
101
|
-
}, [onChange]);
|
|
121
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(showTimezone ? { value: data.date, timezone: data.timezone } : { value: data.date });
|
|
122
|
+
}, [onChange, showTimezone]);
|
|
102
123
|
var onClose = React.useCallback(function () {
|
|
103
124
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
104
125
|
setAutoFocusCalendar(false);
|
|
@@ -125,17 +146,15 @@ var StatelessDatePicker = function (_props) {
|
|
|
125
146
|
var handleInputChange = React.useCallback(function (e) {
|
|
126
147
|
var inputValue = e.currentTarget.value;
|
|
127
148
|
if (clearable && inputValue.length === 0) {
|
|
128
|
-
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
129
|
-
value: undefined,
|
|
130
|
-
});
|
|
149
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(showTimezone ? { value: undefined, timezone: timezone } : { value: undefined });
|
|
131
150
|
}
|
|
132
|
-
}, [clearable, onChange]);
|
|
151
|
+
}, [clearable, onChange, timezone, showTimezone]);
|
|
133
152
|
var dateAriaLabel = React.useMemo(function () { return (0, utils_1.getAriaLabel)(value, defaultFormatDisplayValue, locale); }, [value, defaultFormatDisplayValue, locale]);
|
|
134
|
-
var
|
|
135
|
-
var
|
|
136
|
-
var
|
|
153
|
+
var _q = (0, tslib_1.__read)((0, overrides_1.useOverrides)(mergedOverrides === null || mergedOverrides === void 0 ? void 0 : mergedOverrides.Input, DatePickerInput_1.default), 2), InputComponent = _q[0], inputProps = _q[1];
|
|
154
|
+
var _r = (0, tslib_1.__read)((0, overrides_1.useOverrides)(mergedOverrides === null || mergedOverrides === void 0 ? void 0 : mergedOverrides.Popover, popover_2.Popover), 2), PopoverComponent = _r[0], popoverProps = _r[1];
|
|
155
|
+
var _s = (0, tslib_1.__read)((0, overrides_1.useOverrides)(mergedOverrides === null || mergedOverrides === void 0 ? void 0 : mergedOverrides.InputWrapper, styled_components_1.StyledInputWrapper), 2), InputWrapper = _s[0], inputWrapperProps = _s[1];
|
|
137
156
|
var placeholder = (_a = props.placeholder) !== null && _a !== void 0 ? _a : 'MM/DD/YYYY';
|
|
138
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(PopoverComponent, (0, tslib_1.__assign)({ focusLock: true, returnFocus: true, mountNode: props.mountNode, placement: popover_1.PLACEMENT.auto, isOpen: isOpen, onClickOutside: onClose, onEsc: onClose, showArrow: false, triggerType: "click", onClick: props.disabled ? noop_1.default : onFocus, content: (0, jsx_runtime_1.jsx)(DatePickerContent_1.DatePickerContent, (0, tslib_1.__assign)({}, props, { value: value, onChange: handleDateChange, overrides: mergedOverrides, autoFocusCalendar: autoFocusCalendar, onClose: onClose, formatString: formatString, adapter: adapter, locale: dateFnsLocale }), void 0) }, popoverProps, { children: (0, jsx_runtime_1.jsx)(InputWrapper, (0, tslib_1.__assign)({}, inputWrapperProps, { children: (0, jsx_runtime_1.jsx)(InputComponent, (0, tslib_1.__assign)({ "aria-disabled": props.disabled, "aria-label": (_b = props['aria-label']) !== null && _b !== void 0 ? _b : locale.timeRangePicker.ariaLabel, "aria-describedby": ariaDescribedBy, "aria-labelledby": props['aria-labelledby'], "aria-required": props.required || null, disabled: props.disabled, size: size, variant: variant, intent: error ? 'error' : intent, value: displayValue,
|
|
157
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(PopoverComponent, (0, tslib_1.__assign)({ accessibilityType: "none", focusLock: true, returnFocus: true, mountNode: props.mountNode, placement: popover_1.PLACEMENT.auto, isOpen: isOpen, onClickOutside: onClose, onEsc: onClose, showArrow: false, triggerType: "click", onClick: props.disabled ? noop_1.default : onFocus, content: (0, jsx_runtime_1.jsx)(DatePickerContent_1.DatePickerContent, (0, tslib_1.__assign)({}, props, { value: value, onChange: handleDateChange, overrides: mergedOverrides, autoFocusCalendar: autoFocusCalendar, onClose: onClose, formatString: formatString, adapter: adapter, locale: dateFnsLocale, showTimezone: showTimezone, timezone: timezone }), void 0) }, popoverProps, { children: (0, jsx_runtime_1.jsx)(InputWrapper, (0, tslib_1.__assign)({}, inputWrapperProps, { children: (0, jsx_runtime_1.jsx)(InputComponent, (0, tslib_1.__assign)({ id: props.id, "aria-disabled": props.disabled, "aria-label": (_b = props['aria-label']) !== null && _b !== void 0 ? _b : locale.timeRangePicker.ariaLabel, "aria-describedby": ariaDescribedBy, "aria-labelledby": props['aria-labelledby'], "aria-required": props.required || null, disabled: props.disabled, size: size, variant: variant, intent: error ? 'error' : intent, value: displayValue,
|
|
139
158
|
// onFocus={onFocus}
|
|
140
159
|
onKeyDown: handleKeyDown, onChange: handleInputChange, placeholder: placeholder, required: props.required, clearable: clearable, isOpen: isOpen, autoSizeInput: autoSizeInput }, inputProps), void 0) }), void 0) }), void 0), (0, jsx_runtime_1.jsx)(typography_1.Typography, (0, tslib_1.__assign)({ id: ariaDescribedBy, style: accessibilityStyles }, { children: locale.timeRangePicker.screenReaderMessageInput }), void 0), (0, jsx_runtime_1.jsx)(typography_1.Typography, (0, tslib_1.__assign)({ "aria-live": "assertive", style: accessibilityStyles }, { children: dateAriaLabel }), void 0)] }, void 0));
|
|
141
160
|
};
|
package/date-picker/locale.d.ts
CHANGED
|
@@ -4,23 +4,26 @@ var tslib_1 = require("tslib");
|
|
|
4
4
|
var React = (0, tslib_1.__importStar)(require("react"));
|
|
5
5
|
var date_fns_adapter_1 = (0, tslib_1.__importDefault)(require("baseui/datepicker/utils/date-fns-adapter"));
|
|
6
6
|
var useDatePickerState_1 = require("./useDatePickerState");
|
|
7
|
+
var utils_1 = require("../time-range-picker/utils");
|
|
7
8
|
var StatefulContainer = function (_a) {
|
|
8
|
-
var _b;
|
|
9
|
-
var adapter = _a.adapter, onChange = _a.onChange, value = _a.value,
|
|
10
|
-
var
|
|
11
|
-
var
|
|
9
|
+
var _b, _c;
|
|
10
|
+
var adapter = _a.adapter, onChange = _a.onChange, value = _a.value, _d = _a.startOpen, startOpen = _d === void 0 ? false : _d, props = (0, tslib_1.__rest)(_a, ["adapter", "onChange", "value", "startOpen"]);
|
|
11
|
+
var _e = (0, tslib_1.__read)(React.useState(value), 2), date = _e[0], setDate = _e[1];
|
|
12
|
+
var _f = (0, tslib_1.__read)(React.useState((_b = props.timezone) !== null && _b !== void 0 ? _b : (0, utils_1.getSystemTzName)()), 2), timezone = _f[0], setTimezone = _f[1];
|
|
13
|
+
var _g = (0, useDatePickerState_1.useDatePickerState)({ startOpen: startOpen }), isOpen = _g.isOpen, handleOpen = _g.handleOpen, handleClose = _g.handleClose, setIsOpen = _g.setIsOpen;
|
|
12
14
|
React.useEffect(function () {
|
|
13
15
|
setDate(value);
|
|
14
16
|
}, [value]);
|
|
15
17
|
var handleDateChange = React.useCallback(function (_a) {
|
|
16
|
-
var _value = _a.value;
|
|
18
|
+
var _value = _a.value, _timezone = _a.timezone;
|
|
17
19
|
var prevValue = date;
|
|
18
20
|
setDate(_value);
|
|
19
|
-
|
|
21
|
+
setTimezone(_timezone);
|
|
22
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(props.showTimezone ? { value: _value, timezone: _timezone } : { value: _value });
|
|
20
23
|
setIsOpen(false);
|
|
21
|
-
}, [setDate, setIsOpen, onChange, date]);
|
|
24
|
+
}, [setDate, setIsOpen, onChange, date, props.showTimezone]);
|
|
22
25
|
var children = props.children, restProps = (0, tslib_1.__rest)(props, ["children"]);
|
|
23
|
-
return (
|
|
26
|
+
return (_c = props.children) === null || _c === void 0 ? void 0 : _c.call(props, (0, tslib_1.__assign)((0, tslib_1.__assign)({}, restProps), { value: date, adapter: adapter, onChange: handleDateChange, onFocus: handleOpen, onBlur: handleClose, isOpen: isOpen, range: false, timezone: timezone }));
|
|
24
27
|
};
|
|
25
28
|
StatefulContainer.defaultProps = {
|
|
26
29
|
adapter: date_fns_adapter_1.default,
|