@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
|
@@ -2,27 +2,79 @@
|
|
|
2
2
|
* Created by Aneree on 03/11/20.
|
|
3
3
|
*/
|
|
4
4
|
import { Dispatch, ReactNode, SetStateAction } from 'react';
|
|
5
|
-
import { SelectProps, Option, Value } from '../select/types';
|
|
5
|
+
import { SelectProps, Option, Value, OnChangeParams } from '../select/types';
|
|
6
6
|
export declare type SetStateFunc<S> = Dispatch<SetStateAction<S>>;
|
|
7
|
-
export declare type
|
|
7
|
+
export declare type Id = string | number;
|
|
8
|
+
export declare type AllOptionsMap = Record<Id, Option>;
|
|
9
|
+
export declare type GroupedOptions = Record<string, Array<Option>>;
|
|
10
|
+
export declare type LoadOptions = (input: string, groupFilters: {
|
|
11
|
+
group: string;
|
|
12
|
+
pageNumber: number;
|
|
13
|
+
}[]) => Promise<{
|
|
14
|
+
groups: Array<{
|
|
15
|
+
group: string;
|
|
16
|
+
options: Array<Option>;
|
|
17
|
+
complete: boolean;
|
|
18
|
+
count?: number;
|
|
19
|
+
}>;
|
|
20
|
+
}>;
|
|
21
|
+
export declare type AsyncSelectValue = Array<Id | Option> | Value;
|
|
8
22
|
/**
|
|
9
23
|
* NOTE:
|
|
10
24
|
* AsyncSelect does not support select all option
|
|
11
25
|
* removed the support of these props in AsyncSelect
|
|
12
26
|
*/
|
|
13
|
-
|
|
14
|
-
loadOptions: (input: string, page: number) => Promise<{
|
|
15
|
-
options: Array<Option>;
|
|
16
|
-
complete: boolean;
|
|
17
|
-
}>;
|
|
27
|
+
declare type BaseAsyncSelectProps = Omit<SelectProps, 'isLoading' | 'options' | 'hideSelectAll' | 'value' | 'onChange' | 'scrollContainer'> & {
|
|
18
28
|
paginationBuffer?: number;
|
|
19
29
|
searchingText?: ReactNode;
|
|
20
30
|
minimumInput?: number;
|
|
21
31
|
debounceInterval?: number;
|
|
22
|
-
initialOptions?: Array<Option>;
|
|
23
|
-
resolveSelectedOptions?: (unresolvedValueKeys: Array<string | number>) => Promise<Array<Option>>;
|
|
24
32
|
loadOnFocus?: boolean;
|
|
25
33
|
loadOnMount?: boolean;
|
|
26
34
|
listenAllInputChanges?: boolean;
|
|
35
|
+
value?: AsyncSelectValue;
|
|
36
|
+
onChange?: (params: OnChangeParams & {
|
|
37
|
+
valueKeys: Id[];
|
|
38
|
+
}) => unknown;
|
|
39
|
+
resolveValuesOnUpdate?: boolean;
|
|
40
|
+
hideUnresolvedValues?: boolean;
|
|
41
|
+
moveSelectedOptionsToTop?: boolean;
|
|
42
|
+
};
|
|
43
|
+
export declare type AsyncSelectProps = BaseAsyncSelectProps & {
|
|
44
|
+
loadOptions: (input: string, page: number) => Promise<{
|
|
45
|
+
options: Array<Option>;
|
|
46
|
+
complete: boolean;
|
|
47
|
+
}>;
|
|
48
|
+
initialOptions?: Array<Option>;
|
|
49
|
+
resolveSelectedOptions?: (unresolvedValueKeys: Array<Id>) => Promise<Array<Option>>;
|
|
50
|
+
};
|
|
51
|
+
export declare type GroupConfig = Array<{
|
|
52
|
+
id: string;
|
|
53
|
+
label: string;
|
|
54
|
+
}>;
|
|
55
|
+
export declare type GroupedValue = Record<string, AsyncSelectValue>;
|
|
56
|
+
export declare type GroupedAsyncSelectProps = Omit<BaseAsyncSelectProps, 'creatable' | 'onChange' | 'value'> & {
|
|
57
|
+
loadOptions: (input: string, groupFilters: Array<{
|
|
58
|
+
group: string;
|
|
59
|
+
pageNumber: number;
|
|
60
|
+
}>) => Promise<{
|
|
61
|
+
groups: {
|
|
62
|
+
group: string;
|
|
63
|
+
options: Array<Option>;
|
|
64
|
+
complete: boolean;
|
|
65
|
+
count?: number;
|
|
66
|
+
}[];
|
|
67
|
+
}>;
|
|
68
|
+
initialOptions?: Record<string, Array<Option>>;
|
|
69
|
+
groupConfig: GroupConfig;
|
|
70
|
+
initialExpandedCount?: number;
|
|
71
|
+
resolveSelectedOptions?: (groupVsUnresolvedValueKeys: Record<string, Array<Id>>) => Promise<GroupedOptions>;
|
|
72
|
+
value?: GroupedValue;
|
|
73
|
+
onChange?: (params: Omit<OnChangeParams, 'value'> & {
|
|
74
|
+
value: GroupedOptions;
|
|
75
|
+
valueKeys: Record<string, Id[]>;
|
|
76
|
+
}) => unknown;
|
|
77
|
+
showSelectAll?: boolean;
|
|
78
|
+
selectAllSelected?: boolean;
|
|
27
79
|
};
|
|
28
80
|
export type { Value, Option };
|
package/esm/avatar/avatar.js
CHANGED
|
@@ -20,6 +20,16 @@ function getInitials(name) {
|
|
|
20
20
|
var initials = words.map(function (word) { return word[0]; });
|
|
21
21
|
return initials.slice(0, 2).join('').toUpperCase();
|
|
22
22
|
}
|
|
23
|
+
//If Image is already available in disk cache, then we should directly set isImageLoaded state to true, to avoid flicker between initials and avatar.
|
|
24
|
+
var getIsImageLoaded = function (src) {
|
|
25
|
+
var isServer = typeof window === 'undefined';
|
|
26
|
+
if (!src || isServer) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
var imageEl = new Image();
|
|
30
|
+
imageEl.src = src;
|
|
31
|
+
return imageEl.complete;
|
|
32
|
+
};
|
|
23
33
|
var Icon = function (_a) {
|
|
24
34
|
var overrides = _a.overrides, className = _a.className, props = __rest(_a, ["overrides", "className"]);
|
|
25
35
|
var _b = __read(useOverrides(overrides === null || overrides === void 0 ? void 0 : overrides.UserIcon, DefaultUserIcon), 2), UserIcon = _b[0], iconProps = _b[1];
|
|
@@ -27,8 +37,8 @@ var Icon = function (_a) {
|
|
|
27
37
|
};
|
|
28
38
|
var Avatar = function (props) {
|
|
29
39
|
var _a = __read(useState(null), 2), imageRef = _a[0], setImageRef = _a[1];
|
|
30
|
-
var _b =
|
|
31
|
-
var
|
|
40
|
+
var _b = props.shape, shape = _b === void 0 ? 'circle' : _b, _c = props.size, size = _c === void 0 ? 'md' : _c, className = props.className, color = props.color, allowPhoneInitials = props.allowPhoneInitials, name = props.name, overrides = props.overrides, initials = props.initials, src = props.src;
|
|
41
|
+
var _d = __read(useState(function () { return getIsImageLoaded(src); }), 2), imageLoaded = _d[0], setImageLoaded = _d[1];
|
|
32
42
|
var displayName = cleanupDisplayName(name);
|
|
33
43
|
var randomBgColor = useAvatarColor(displayName);
|
|
34
44
|
var isPhoneNumber = PHONENUMBER_REGEX.test(displayName);
|
|
@@ -2,30 +2,15 @@ import { __assign } from "tslib";
|
|
|
2
2
|
import styled from '../style/styled';
|
|
3
3
|
import { borderRadius as borderRadiusHelper } from '../helpers/longHandHelpers';
|
|
4
4
|
export var avatarSizeConfig = {
|
|
5
|
-
sm: { size: '24px', rectangleBorderRadius: '6px', fontSize: '
|
|
6
|
-
md: { size: '34px', rectangleBorderRadius: '8px', fontSize: '
|
|
7
|
-
lg: { size: '40px', rectangleBorderRadius: '8px', fontSize: '
|
|
8
|
-
xl: { size: '48px', rectangleBorderRadius: '8px', fontSize: '
|
|
9
|
-
xxl: { size: '84px', rectangleBorderRadius: '12px', fontSize: '
|
|
10
|
-
xxxl: { size: '96px', rectangleBorderRadius: '12px', fontSize: '
|
|
5
|
+
sm: { size: '24px', rectangleBorderRadius: '6px', fontSize: '12px' },
|
|
6
|
+
md: { size: '34px', rectangleBorderRadius: '8px', fontSize: '17px' },
|
|
7
|
+
lg: { size: '40px', rectangleBorderRadius: '8px', fontSize: '20px' },
|
|
8
|
+
xl: { size: '48px', rectangleBorderRadius: '8px', fontSize: '24px' },
|
|
9
|
+
xxl: { size: '84px', rectangleBorderRadius: '12px', fontSize: '42px' },
|
|
10
|
+
xxxl: { size: '96px', rectangleBorderRadius: '12px', fontSize: '48px' },
|
|
11
11
|
};
|
|
12
12
|
var getSizeConfig = function (size) { var _a; return (_a = avatarSizeConfig[size]) !== null && _a !== void 0 ? _a : avatarSizeConfig.md; };
|
|
13
|
-
var getFontSize = function (size) {
|
|
14
|
-
if (size < 24)
|
|
15
|
-
return '8px';
|
|
16
|
-
else if (size < 36)
|
|
17
|
-
return '12px';
|
|
18
|
-
else if (size < 48)
|
|
19
|
-
return '16px';
|
|
20
|
-
else if (size < 60)
|
|
21
|
-
return '20px';
|
|
22
|
-
else if (size < 72)
|
|
23
|
-
return '24px';
|
|
24
|
-
else if (size < 84)
|
|
25
|
-
return '28px';
|
|
26
|
-
else
|
|
27
|
-
return '36px';
|
|
28
|
-
};
|
|
13
|
+
var getFontSize = function (size) { return "".concat(size / 2, "px"); };
|
|
29
14
|
export var StyledAvatarGroup = styled('div', 'flex');
|
|
30
15
|
export var StyledRoot = styled('div', 'box-border inline-block', function (_, _a) {
|
|
31
16
|
var $shape = _a.$shape, $color = _a.$color, $didImageFailToLoad = _a.$didImageFailToLoad, $avatarSize = _a.$avatarSize, $size = _a.$size;
|
|
@@ -10,21 +10,23 @@ var sizeMap = {
|
|
|
10
10
|
lg: '50%',
|
|
11
11
|
};
|
|
12
12
|
var isCustomContent = function (content) { return typeof content === 'function'; };
|
|
13
|
-
var anchorOffset = function (
|
|
14
|
-
var
|
|
13
|
+
var anchorOffset = function (_a, _b) {
|
|
14
|
+
var isRTL = _a.isRTL;
|
|
15
|
+
var $horizontalPosition = _b.$horizontalPosition, $verticalPosition = _b.$verticalPosition, $overlap = _b.$overlap;
|
|
15
16
|
var offset = $overlap === 'rectangle' ? 0 : '14%';
|
|
16
17
|
var horizontalOffset = $horizontalPosition === 'left' ? { left: offset } : { right: offset };
|
|
17
18
|
var verticalOffset = $verticalPosition === 'top' ? { top: offset } : { bottom: offset };
|
|
19
|
+
var rtlHorizontalPosition = isRTL ? ($horizontalPosition === 'right' ? 'left' : 'right') : $horizontalPosition;
|
|
18
20
|
var transform = $verticalPosition === 'top'
|
|
19
21
|
? {
|
|
20
|
-
transform:
|
|
21
|
-
? 'translate(calc(-100% + min(1rem, 50%)), -50%)' // min of 1rem( for large elements ) and 50%( for small elements )
|
|
22
|
-
: 'translate(calc(100% - min(1rem, 50%)), -50%)',
|
|
22
|
+
transform: rtlHorizontalPosition === 'left'
|
|
23
|
+
? 'translate(calc(-100% + min(1rem, 50%)), -50%) /* @noflip */' // min of 1rem( for large elements ) and 50%( for small elements )
|
|
24
|
+
: 'translate(calc(100% - min(1rem, 50%)), -50%) /* @noflip */',
|
|
23
25
|
}
|
|
24
26
|
: {
|
|
25
|
-
transform:
|
|
26
|
-
? 'translate(calc(-100% + min(1rem, 50%)), 50%)'
|
|
27
|
-
: 'translate(calc(100% - min(1rem, 50%)), 50%)',
|
|
27
|
+
transform: rtlHorizontalPosition === 'left'
|
|
28
|
+
? 'translate(calc(-100% + min(1rem, 50%)), 50%) /* @noflip */'
|
|
29
|
+
: 'translate(calc(100% - min(1rem, 50%)), 50%) /* @noflip */',
|
|
28
30
|
};
|
|
29
31
|
return __assign(__assign(__assign({}, horizontalOffset), verticalOffset), transform);
|
|
30
32
|
};
|
package/esm/banner/banner.js
CHANGED
|
@@ -28,7 +28,7 @@ function Icon(_a) {
|
|
|
28
28
|
},
|
|
29
29
|
};
|
|
30
30
|
var _c = intentToIconMap[intent], BaseIcon = _c.BaseIcon, prop = _c.prop;
|
|
31
|
-
return _jsx(BaseIcon, __assign({ className: ['mr-1.5', prop, className] }, restProps, { size: 14 }), void 0);
|
|
31
|
+
return _jsx(BaseIcon, __assign({ className: ['mr-1.5 flex-shrink-0', prop, className] }, restProps, { size: 14 }), void 0);
|
|
32
32
|
}
|
|
33
33
|
function BaseToggleButton(_a) {
|
|
34
34
|
var show = _a.show, className = _a.className, onToggle = _a.onToggle, props = __rest(_a, ["show", "className", "onToggle"]);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BreadcrumbItemProps } from './types';
|
|
3
|
+
declare const BreadcrumbItem: {
|
|
4
|
+
({ children, isLastChild, overrides, onClick, index, startEnhancer, endEnhancer, separator, gap, ...restProps }: BreadcrumbItemProps): JSX.Element;
|
|
5
|
+
displayName: string;
|
|
6
|
+
};
|
|
7
|
+
export default BreadcrumbItem;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { __assign, __read, __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import _noop from 'lodash/noop';
|
|
4
|
+
import { Typography } from '../typography';
|
|
5
|
+
import { Link } from '../link';
|
|
6
|
+
import { StyledStartEnhancer, StyledEndEnhancer, StyledListItem, StyledSeparator, DEFAULT_SEPARATOR, } from './styled-components';
|
|
7
|
+
import { useOverrides, mergeOverrides } from '../overrides';
|
|
8
|
+
var breadcrumbItemOverrides = {
|
|
9
|
+
Link: {
|
|
10
|
+
style: [
|
|
11
|
+
'inline-flex text-16 leading-10',
|
|
12
|
+
function (_, _a) {
|
|
13
|
+
var $isLastChild = _a.$isLastChild;
|
|
14
|
+
return !$isLastChild ? { color: 'inherit', ':focus': { textDecoration: 'underline' } } : {};
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
var BreadcrumbItem = function (_a) {
|
|
20
|
+
var children = _a.children, _b = _a.isLastChild, isLastChild = _b === void 0 ? false : _b, overrides = _a.overrides, _c = _a.onClick, onClick = _c === void 0 ? _noop : _c, _d = _a.index, index = _d === void 0 ? 0 : _d, startEnhancer = _a.startEnhancer, endEnhancer = _a.endEnhancer, _e = _a.separator, separator = _e === void 0 ? DEFAULT_SEPARATOR : _e, _f = _a.gap, gap = _f === void 0 ? 4 : _f, restProps = __rest(_a, ["children", "isLastChild", "overrides", "onClick", "index", "startEnhancer", "endEnhancer", "separator", "gap"]);
|
|
21
|
+
var sharedProps = {
|
|
22
|
+
$gap: gap,
|
|
23
|
+
$withStartEnhancer: !!startEnhancer,
|
|
24
|
+
$withEndEnhancer: !!endEnhancer,
|
|
25
|
+
$isLastChild: isLastChild,
|
|
26
|
+
};
|
|
27
|
+
var mergedOverrides = mergeOverrides(breadcrumbItemOverrides, overrides);
|
|
28
|
+
var _g = __read(useOverrides(mergedOverrides === null || mergedOverrides === void 0 ? void 0 : mergedOverrides.ListItem, StyledListItem), 2), ListItem = _g[0], listItemProps = _g[1];
|
|
29
|
+
var _h = __read(useOverrides(mergedOverrides === null || mergedOverrides === void 0 ? void 0 : mergedOverrides.Link, !isLastChild ? Link : Typography), 2), LinkOverride = _h[0], linkOverrideProps = _h[1];
|
|
30
|
+
var _j = __read(useOverrides(mergedOverrides === null || mergedOverrides === void 0 ? void 0 : mergedOverrides.StartEnhancer, StyledStartEnhancer), 2), StartEnhancer = _j[0], startEnhancerProps = _j[1];
|
|
31
|
+
var _k = __read(useOverrides(mergedOverrides === null || mergedOverrides === void 0 ? void 0 : mergedOverrides.EndEnhancer, StyledEndEnhancer), 2), EndEnhancer = _k[0], endEnhancerProps = _k[1];
|
|
32
|
+
var _l = __read(useOverrides(overrides === null || overrides === void 0 ? void 0 : overrides.Separator, StyledSeparator), 2), BreadcrumbSeparator = _l[0], separatorWrapperProps = _l[1];
|
|
33
|
+
var renderEnhancer = function (enhancer) {
|
|
34
|
+
return typeof enhancer === 'function' ? enhancer(sharedProps) : enhancer;
|
|
35
|
+
};
|
|
36
|
+
return (_jsxs(ListItem, __assign({ "data-testid": "breadcrumb-list-item-".concat(index) }, sharedProps, listItemProps, { children: [_jsxs(LinkOverride, __assign({ "data-testid": "breadcrumb-item-link-".concat(index), onClick: function (e) { return onClick(e, index); } }, sharedProps, restProps, linkOverrideProps, { children: [startEnhancer && (_jsx(StartEnhancer, __assign({ "data-testid": "breadcrumb-item-startenhancer-".concat(index) }, sharedProps, startEnhancerProps, { children: renderEnhancer(startEnhancer) }), void 0)), children, endEnhancer && (_jsx(EndEnhancer, __assign({ "data-testid": "breadcrumb-item-endenhancer-".concat(index) }, sharedProps, endEnhancerProps, { children: renderEnhancer(endEnhancer) }), void 0))] }), void 0), !isLastChild && (_jsx(BreadcrumbSeparator, __assign({ "data-testid": "breadcrumb-item-separator-".concat(index), "aria-hidden": true }, sharedProps, separatorWrapperProps, { children: separator }), void 0))] }), void 0));
|
|
37
|
+
};
|
|
38
|
+
BreadcrumbItem.displayName = 'BreadcrumbItem';
|
|
39
|
+
export default BreadcrumbItem;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { __assign, __read } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createElement as _createElement } from "react";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import BreadcrumbItem from './breadcrumb-item';
|
|
6
|
+
import { useOverrides } from '../overrides';
|
|
7
|
+
import { DEFAULT_SEPARATOR, StyledWrapper } from './styled-components';
|
|
8
|
+
var Breadcrumb = function (_a) {
|
|
9
|
+
var children = _a.children, _b = _a.separator, separator = _b === void 0 ? DEFAULT_SEPARATOR : _b, _c = _a.gap, gap = _c === void 0 ? 4 : _c, _d = _a.overrides, overrides = _d === void 0 ? {} : _d;
|
|
10
|
+
var _e = __read(useOverrides(overrides === null || overrides === void 0 ? void 0 : overrides.Root, StyledWrapper), 2), Root = _e[0], rootProps = _e[1];
|
|
11
|
+
var sharedProps = { $gap: gap };
|
|
12
|
+
var validChildren = React.Children.toArray(children).filter(React.isValidElement);
|
|
13
|
+
var breadcrumbItems = validChildren.map(function (child, index) {
|
|
14
|
+
var _a, _b, _c;
|
|
15
|
+
return child.type === BreadcrumbItem ? (React.cloneElement(child, {
|
|
16
|
+
key: (_a = child.key) !== null && _a !== void 0 ? _a : "breadcrumbItem-".concat(index),
|
|
17
|
+
separator: (_b = child.props.separator) !== null && _b !== void 0 ? _b : separator,
|
|
18
|
+
gap: (_c = child.props.gap) !== null && _c !== void 0 ? _c : gap,
|
|
19
|
+
})) : (_createElement(BreadcrumbItem, __assign({}, sharedProps, { key: "breadcrumbItem-".concat(index), separator: separator, gap: gap }), child));
|
|
20
|
+
});
|
|
21
|
+
return (_jsx("nav", { children: _jsx(Root, __assign({ "data-testid": "breadcrumb-root" }, sharedProps, rootProps, { children: React.Children.map(breadcrumbItems, function (breadcrumbItem, index) {
|
|
22
|
+
var isLastChild = index === breadcrumbItems.length - 1;
|
|
23
|
+
return React.cloneElement(breadcrumbItem, { isLastChild: isLastChild, index: index });
|
|
24
|
+
}) }), void 0) }, void 0));
|
|
25
|
+
};
|
|
26
|
+
Breadcrumb.displayName = 'Breadcrumb';
|
|
27
|
+
export default Breadcrumb;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as Breadcrumb } from './breadcrumb';
|
|
2
|
+
export { default as BreadcrumbItem } from './breadcrumb-item';
|
|
3
|
+
export { StyledSeparator, StyledEndEnhancer, StyledListItem, StyledWrapper, StyledStartEnhancer, DEFAULT_SEPARATOR, } from './styled-components';
|
|
4
|
+
export type { BreadcrumbItemProps, BreadcrumbProps, BreadcrumbSharedProps, BreadcrumbItemSharedProps } from './types';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const StyledStartEnhancer: import("../style/styled").StyledComponent;
|
|
3
|
+
export declare const StyledEndEnhancer: import("../style/styled").StyledComponent;
|
|
4
|
+
export declare const StyledWrapper: import("../style/styled").StyledComponent;
|
|
5
|
+
export declare const StyledSeparator: import("../style/styled").StyledComponent;
|
|
6
|
+
export declare const StyledListItem: import("../style/styled").StyledComponent;
|
|
7
|
+
export declare const DEFAULT_SEPARATOR: JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { styled } from '../style';
|
|
3
|
+
import ChevronRightIcon from '../icon/components/chevron-right';
|
|
4
|
+
export var StyledStartEnhancer = styled('div', 'inline-flex items-center mr-1');
|
|
5
|
+
export var StyledEndEnhancer = styled('div', 'inline-flex items-center ml-1');
|
|
6
|
+
export var StyledWrapper = styled('ul', 'm-0 p-0 inline-flex items-center flex-wrap');
|
|
7
|
+
export var StyledSeparator = styled('span', 'inline-flex items-center', function (_, _a) {
|
|
8
|
+
var $gap = _a.$gap;
|
|
9
|
+
return {
|
|
10
|
+
marginLeft: "".concat($gap * 4, "px"),
|
|
11
|
+
marginRight: "".concat($gap * 4, "px"),
|
|
12
|
+
};
|
|
13
|
+
});
|
|
14
|
+
export var StyledListItem = styled('li', 'm-0 inline-flex items-center');
|
|
15
|
+
export var DEFAULT_SEPARATOR = _jsx(ChevronRightIcon, { size: 10 }, void 0);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { Override } from '../overrides';
|
|
3
|
+
import { LinkProps } from '../link';
|
|
4
|
+
export declare type Enhancer<SharedProps> = ReactNode | ((props: SharedProps) => ReactNode);
|
|
5
|
+
export declare type BreadcrumbItemSharedProps = {
|
|
6
|
+
$isLastChild?: boolean;
|
|
7
|
+
$withStartEnhancer: boolean;
|
|
8
|
+
$withEndEnhancer: boolean;
|
|
9
|
+
$gap: number;
|
|
10
|
+
};
|
|
11
|
+
export declare type BreadcrumbSharedProps = {
|
|
12
|
+
$gap: number;
|
|
13
|
+
};
|
|
14
|
+
export declare type BreadcrumbProps = {
|
|
15
|
+
separator?: ReactNode;
|
|
16
|
+
gap?: number;
|
|
17
|
+
overrides?: {
|
|
18
|
+
Root?: Override<Record<string, any>>;
|
|
19
|
+
};
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
};
|
|
22
|
+
export declare type BreadcrumbItemProps = Omit<LinkProps, 'onClick'> & {
|
|
23
|
+
isLastChild?: boolean;
|
|
24
|
+
gap?: number;
|
|
25
|
+
onClick?: (event: React.MouseEvent<HTMLElement>, index: number) => void;
|
|
26
|
+
index?: number;
|
|
27
|
+
separator?: ReactNode;
|
|
28
|
+
startEnhancer?: Enhancer<BreadcrumbItemSharedProps>;
|
|
29
|
+
endEnhancer?: Enhancer<BreadcrumbItemSharedProps>;
|
|
30
|
+
overrides?: {
|
|
31
|
+
Link?: Override<Record<string, any>>;
|
|
32
|
+
StartEnhancer?: Override<Record<string, any>>;
|
|
33
|
+
EndEnhancer?: Override<Record<string, any>>;
|
|
34
|
+
ListItem?: Override<Record<string, any>>;
|
|
35
|
+
Separator?: Override<Record<string, any>>;
|
|
36
|
+
};
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/button/Button.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ declare const Button: React.ForwardRefExoticComponent<Omit<{
|
|
|
12
12
|
disabled?: boolean | undefined;
|
|
13
13
|
fullWidth?: boolean | undefined;
|
|
14
14
|
autoFocus?: boolean | undefined;
|
|
15
|
+
role?: React.AriaRole | undefined;
|
|
15
16
|
href?: string | undefined;
|
|
16
17
|
target?: string | undefined;
|
|
17
18
|
rel?: string | undefined;
|
|
@@ -22,6 +23,7 @@ declare const Button: React.ForwardRefExoticComponent<Omit<{
|
|
|
22
23
|
startEnhancer?: React.ReactNode;
|
|
23
24
|
type?: "button" | "reset" | "submit" | undefined;
|
|
24
25
|
tooltipContent?: React.ReactNode | import("baseui/popover").StatefulContentRenderProp;
|
|
26
|
+
tabIndex?: number | undefined;
|
|
25
27
|
}, "style" | "className"> & {
|
|
26
28
|
$as?: React.ElementType<any> | undefined;
|
|
27
29
|
className?: import("..").Styles;
|
package/esm/button/Button.js
CHANGED
|
@@ -12,10 +12,14 @@ import { add$props } from '../helpers';
|
|
|
12
12
|
import { StyledBaseButton as BaseButton } from '../base-button';
|
|
13
13
|
import { StatefulTooltip as DefaultStatefulTooltip, DisabledTooltipContainer } from '../tooltip';
|
|
14
14
|
import { useContextualFormProps } from '../form-control/context';
|
|
15
|
+
import useStyle from '../style/useStyle';
|
|
16
|
+
import { getDefaultSize } from '../helpers/themeHelpers';
|
|
15
17
|
BaseUIButton.displayName = 'BaseUIButton';
|
|
16
18
|
var Button = React.forwardRef(function (props, ref) {
|
|
17
19
|
var buttonRef = ref;
|
|
18
|
-
var _a = useContextualFormProps(props), _b = _a.variant, variant = _b === void 0 ? 'primary' : _b, _c = _a.intent, intent = _c === void 0 ? 'default' : _c,
|
|
20
|
+
var _a = useContextualFormProps(props), _b = _a.variant, variant = _b === void 0 ? 'primary' : _b, _c = _a.intent, intent = _c === void 0 ? 'default' : _c, _size = _a.size, fullWidth = _a.fullWidth, className = _a.className, style = _a.style, overrides = _a.overrides, tooltipContent = _a.tooltipContent, restProps = __rest(_a, ["variant", "intent", "size", "fullWidth", "className", "style", "overrides", "tooltipContent"]);
|
|
21
|
+
var _d = useStyle(), getStyle = _d.getStyle, isRTL = _d.isRTL, theme = _d.theme;
|
|
22
|
+
var size = _size !== null && _size !== void 0 ? _size : getDefaultSize(theme);
|
|
19
23
|
var buttonOverrides = React.useMemo(function () { return _omit(overrides, 'StatefulTooltip'); }, [overrides]);
|
|
20
24
|
var adaptedProps = adaptBaseButtonProps(__assign(__assign({}, restProps), { variant: variant, overrides: buttonOverrides }));
|
|
21
25
|
var convertedOverrides = useConvertOverrides(adaptedProps.overrides || {});
|
|
@@ -36,6 +40,14 @@ var Button = React.forwardRef(function (props, ref) {
|
|
|
36
40
|
width: '100%',
|
|
37
41
|
},
|
|
38
42
|
},
|
|
43
|
+
StartEnhancer: {
|
|
44
|
+
// This check should not be required. Overrides should first be merged and then converted for baseui.
|
|
45
|
+
// In Button we are converting overrides(that's when rtlCssJs gets applied) and then merging, which is wrong.
|
|
46
|
+
style: getStyle(isRTL ? 'ml-1' : 'mr-1'),
|
|
47
|
+
},
|
|
48
|
+
EndEnhancer: {
|
|
49
|
+
style: getStyle(isRTL ? 'mr-1' : 'ml-1'),
|
|
50
|
+
},
|
|
39
51
|
}, _pick(adaptedProps.overrides, 'BaseButton'));
|
|
40
52
|
var _e = __read(useOverrides(overrides === null || overrides === void 0 ? void 0 : overrides.StatefulTooltip, DefaultStatefulTooltip), 2), StatefulTooltip = _e[0], statefulTooltipProps = _e[1];
|
|
41
53
|
var buttonEl = (_jsx(BaseUIButton, __assign({ "data-spaceweb": "button", "data-testid": "button" }, adaptedProps, { onClick: adaptedProps.onClick, overrides: __assign(__assign({}, convertedOverrides), mergedOverrides), ref: buttonRef }), void 0));
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
bordered?: boolean | undefined;
|
|
5
|
-
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
2
|
+
import { IconButtonProps } from './types';
|
|
3
|
+
declare const IconButton: import("react").ForwardRefExoticComponent<IconButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
6
4
|
export default IconButton;
|
|
@@ -5,16 +5,19 @@ import { mergeOverrides } from '../../overrides';
|
|
|
5
5
|
import { useStyle } from '../../style';
|
|
6
6
|
import Button from '../Button';
|
|
7
7
|
import { iconButtonStyles, renderIconButtonChild } from './styled-components';
|
|
8
|
+
import { getDefaultSize } from '../../helpers/themeHelpers';
|
|
8
9
|
var IconButton = forwardRef(function (props, ref) {
|
|
9
10
|
var theme = useStyle().theme;
|
|
10
|
-
var bordered = props.bordered,
|
|
11
|
+
var bordered = props.bordered, _size = props.size, className = props.className, style = props.style, _a = props.variant, variant = _a === void 0 ? 'minimal' : _a, _b = props.shape, shape = _b === void 0 ? 'round' : _b, buttonProps = __rest(props, ["bordered", "size", "className", "style", "variant", "shape"]);
|
|
12
|
+
var size = _size !== null && _size !== void 0 ? _size : getDefaultSize(theme);
|
|
11
13
|
var overrides = mergeOverrides({
|
|
12
14
|
BaseButton: {
|
|
13
15
|
style: [iconButtonStyles, className, style],
|
|
14
16
|
props: { $bordered: bordered, $size: size, $isIconButton: true },
|
|
15
17
|
},
|
|
16
18
|
}, buttonProps.overrides);
|
|
17
|
-
|
|
19
|
+
var ariaLabel = typeof buttonProps.tooltipContent === 'string' && !buttonProps.isLoading ? buttonProps.tooltipContent : undefined;
|
|
20
|
+
return (_jsx(Button, __assign({ variant: variant, shape: shape }, (ariaLabel ? { 'aria-label': ariaLabel } : {}), buttonProps, { overrides: overrides, ref: ref }, { children: Children.map(props.children, renderIconButtonChild.bind(null, theme, size)) }), void 0));
|
|
18
21
|
});
|
|
19
22
|
IconButton.displayName = 'IconButton';
|
|
20
23
|
export default IconButton;
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { ButtonProps, ButtonSharedProps } from '../types';
|
|
2
2
|
import { Size } from '../../types';
|
|
3
|
-
|
|
3
|
+
import { StatefulTooltipProps } from '../../tooltip';
|
|
4
|
+
declare type BaseIconButtonProps = Omit<ButtonProps, 'size'> & {
|
|
4
5
|
size?: Size;
|
|
5
6
|
bordered?: boolean;
|
|
6
7
|
};
|
|
8
|
+
declare type IconButtonPropsWithAriaLabel = BaseIconButtonProps & {
|
|
9
|
+
'aria-label': string;
|
|
10
|
+
};
|
|
11
|
+
declare type IconButtonPropsWithTooltip = BaseIconButtonProps & {
|
|
12
|
+
tooltipContent: StatefulTooltipProps['content'];
|
|
13
|
+
};
|
|
14
|
+
export declare type IconButtonProps = IconButtonPropsWithAriaLabel | IconButtonPropsWithTooltip;
|
|
7
15
|
export declare type SharedProps = Omit<ButtonSharedProps, '$size'> & {
|
|
8
16
|
$size?: Size;
|
|
9
17
|
$bordered?: boolean;
|
|
10
18
|
};
|
|
19
|
+
export {};
|
|
@@ -17,14 +17,16 @@ declare const _default: (props: Omit<ButtonProps, 'size'>) => {
|
|
|
17
17
|
shape?: import("./types").Shape | undefined;
|
|
18
18
|
target?: string | undefined;
|
|
19
19
|
type?: "button" | "reset" | "submit" | undefined;
|
|
20
|
+
tabIndex?: number | undefined;
|
|
21
|
+
role?: import("react").AriaRole | undefined;
|
|
20
22
|
onClick?: ((event: import("react").MouseEvent<HTMLElement, MouseEvent>) => any) | undefined;
|
|
21
23
|
$as?: import("react").ElementType<any> | undefined;
|
|
22
24
|
startEnhancer?: import("react").ReactNode;
|
|
23
25
|
endEnhancer?: import("react").ReactNode;
|
|
26
|
+
tooltipContent?: import("react").ReactNode | import("baseui/popover").StatefulContentRenderProp;
|
|
24
27
|
intent?: import("..").Intent | undefined;
|
|
25
28
|
isLoading?: boolean | undefined;
|
|
26
29
|
isSelected?: boolean | undefined;
|
|
27
30
|
fullWidth?: boolean | undefined;
|
|
28
|
-
tooltipContent?: import("react").ReactNode | import("baseui/popover").StatefulContentRenderProp;
|
|
29
31
|
};
|
|
30
32
|
export default _default;
|
|
@@ -60,8 +60,9 @@ var getPrimaryHoverColor = function (_a) {
|
|
|
60
60
|
});
|
|
61
61
|
};
|
|
62
62
|
var getBorderRadiiStyles = function (_a, _b) {
|
|
63
|
+
var _c;
|
|
63
64
|
var px2rem = _a.px2rem, theme = _a.theme;
|
|
64
|
-
var $shape = _b.$shape;
|
|
65
|
+
var $shape = _b.$shape, $size = _b.$size;
|
|
65
66
|
switch ($shape) {
|
|
66
67
|
case 'round':
|
|
67
68
|
return borderRadius(theme.borderRadius.full);
|
|
@@ -71,7 +72,7 @@ var getBorderRadiiStyles = function (_a, _b) {
|
|
|
71
72
|
return borderRadius(px2rem(theme.borderRadius['16']));
|
|
72
73
|
default:
|
|
73
74
|
}
|
|
74
|
-
return borderRadius(theme.button.borderRadius);
|
|
75
|
+
return borderRadius(((_c = getButtonSizeTheme(theme, $size)) === null || _c === void 0 ? void 0 : _c.borderRadius) || theme.button.borderRadius);
|
|
75
76
|
};
|
|
76
77
|
var getDimension = function (_a, _b) {
|
|
77
78
|
var theme = _a.theme, px2rem = _a.px2rem;
|
|
@@ -124,13 +125,13 @@ export var createButtonStyles = function (_a, _b) {
|
|
|
124
125
|
: {})), { ':active': activeStyles });
|
|
125
126
|
};
|
|
126
127
|
var getVariantStyles = function (utils, props) {
|
|
127
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
|
|
128
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
|
|
128
129
|
var theme = utils.theme;
|
|
129
130
|
var $variant = props.$variant, $isFocusVisible = props.$isFocusVisible, $intent = props.$intent, $isSelected = props.$isSelected;
|
|
130
131
|
switch ($variant) {
|
|
131
132
|
case 'primary':
|
|
132
133
|
default: {
|
|
133
|
-
var
|
|
134
|
+
var _7 = getPrimaryHighlightColor(utils, props), activeBackgroundColor = _7.backgroundColor, activeBorderColor = _7.borderColor, _8 = getPrimaryHoverColor(utils), hoverBackgroundColor = _8.backgroundColor, hoverBorderColor = _8.borderColor;
|
|
134
135
|
var backgroundColor = getIntentColor(utils, props), color = theme.spr.text05, borderColor = getIntentColor(utils, props);
|
|
135
136
|
var primaryButtonTheme = ((_a = theme.button) === null || _a === void 0 ? void 0 : _a.primary) || {};
|
|
136
137
|
var defaultIntentStyles = createButtonStyles({
|
|
@@ -154,36 +155,39 @@ var getVariantStyles = function (utils, props) {
|
|
|
154
155
|
: __assign(__assign(__assign({}, intentStyles), { ':hover': { opacity: '0.8' }, ':active': { opacity: '0.8' } }), ($isFocusVisible && { ':focus': { opacity: '0.8' } }));
|
|
155
156
|
}
|
|
156
157
|
case 'secondary': {
|
|
157
|
-
var
|
|
158
|
+
var _9 = theme.button.variantSecondary, color = _9.color, hoverBackgroundColor = _9.hoverBackgroundColor, activeBackgroundColor = _9.activeBackgroundColor;
|
|
158
159
|
var secondaryButtonTheme = ((_j = theme.button) === null || _j === void 0 ? void 0 : _j.secondary) || {};
|
|
159
160
|
return createButtonStyles({
|
|
160
161
|
color: (_k = secondaryButtonTheme.color) !== null && _k !== void 0 ? _k : color,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
162
|
+
disabledColor: (_l = secondaryButtonTheme.disabledColor) !== null && _l !== void 0 ? _l : theme.spr.text03,
|
|
163
|
+
backgroundColor: (_m = secondaryButtonTheme.backgroundColor) !== null && _m !== void 0 ? _m : theme.spr.ui01,
|
|
164
|
+
hoverBackgroundColor: (_o = secondaryButtonTheme.hoverBackgroundColor) !== null && _o !== void 0 ? _o : hoverBackgroundColor,
|
|
165
|
+
activeBackgroundColor: (_p = secondaryButtonTheme.activeBackgroundColor) !== null && _p !== void 0 ? _p : activeBackgroundColor,
|
|
166
|
+
disabledBackgroundColor: (_q = secondaryButtonTheme.disabledBackgroundColor) !== null && _q !== void 0 ? _q : theme.spr.ui05,
|
|
167
|
+
borderColor: (_r = secondaryButtonTheme.borderColor) !== null && _r !== void 0 ? _r : theme.spr.interactive02,
|
|
168
|
+
hoverBorderColor: (_s = secondaryButtonTheme.hoverBorderColor) !== null && _s !== void 0 ? _s : theme.spr.border06,
|
|
169
|
+
activeBorderColor: (_t = secondaryButtonTheme.activeBorderColor) !== null && _t !== void 0 ? _t : theme.spr.interactive01,
|
|
170
|
+
disabledBorderColor: (_u = secondaryButtonTheme.disabledBorderColor) !== null && _u !== void 0 ? _u : theme.spr.border02,
|
|
167
171
|
}, props);
|
|
168
172
|
}
|
|
169
173
|
case 'tertiary': {
|
|
170
|
-
var tertiaryButtonTheme = ((
|
|
174
|
+
var tertiaryButtonTheme = ((_v = theme.button) === null || _v === void 0 ? void 0 : _v.tertiary) || {};
|
|
171
175
|
return createButtonStyles({
|
|
172
|
-
color: (
|
|
173
|
-
backgroundColor: (
|
|
174
|
-
hoverBackgroundColor: (
|
|
175
|
-
activeBackgroundColor: (
|
|
176
|
-
borderColor: (
|
|
176
|
+
color: (_w = tertiaryButtonTheme.color) !== null && _w !== void 0 ? _w : getIntentTextColor(utils, props),
|
|
177
|
+
backgroundColor: (_x = tertiaryButtonTheme.backgroundColor) !== null && _x !== void 0 ? _x : theme.spr.ui01,
|
|
178
|
+
hoverBackgroundColor: (_y = tertiaryButtonTheme.hoverBackgroundColor) !== null && _y !== void 0 ? _y : theme.spr.uiHover,
|
|
179
|
+
activeBackgroundColor: (_z = tertiaryButtonTheme.activeBackgroundColor) !== null && _z !== void 0 ? _z : theme.spr.uiFocus,
|
|
180
|
+
borderColor: (_0 = tertiaryButtonTheme.borderColor) !== null && _0 !== void 0 ? _0 : getIntentColor(utils, props),
|
|
177
181
|
}, props);
|
|
178
182
|
}
|
|
179
183
|
case 'minimal': {
|
|
180
|
-
var minimalButtonTheme = ((
|
|
184
|
+
var minimalButtonTheme = ((_1 = theme.button) === null || _1 === void 0 ? void 0 : _1.minimal) || {};
|
|
181
185
|
var styles = createButtonStyles({
|
|
182
|
-
color: (
|
|
183
|
-
backgroundColor: (
|
|
184
|
-
hoverBackgroundColor: (
|
|
185
|
-
activeBackgroundColor: (
|
|
186
|
-
borderColor: (
|
|
186
|
+
color: (_2 = minimalButtonTheme.color) !== null && _2 !== void 0 ? _2 : getIntentTextColor(utils, props),
|
|
187
|
+
backgroundColor: (_3 = minimalButtonTheme.backgroundColor) !== null && _3 !== void 0 ? _3 : 'transparent',
|
|
188
|
+
hoverBackgroundColor: (_4 = minimalButtonTheme.hoverBackgroundColor) !== null && _4 !== void 0 ? _4 : theme.spr.uiHover,
|
|
189
|
+
activeBackgroundColor: (_5 = minimalButtonTheme.activeBackgroundColor) !== null && _5 !== void 0 ? _5 : theme.spr.uiFocus,
|
|
190
|
+
borderColor: (_6 = minimalButtonTheme.borderColor) !== null && _6 !== void 0 ? _6 : 'transparent',
|
|
187
191
|
}, props);
|
|
188
192
|
styles.fontWeight = theme.fontWeight.normal;
|
|
189
193
|
return styles;
|
|
@@ -197,11 +201,12 @@ var getBaseStyles = function (_a, _b) {
|
|
|
197
201
|
};
|
|
198
202
|
export var getButtonStyles = [
|
|
199
203
|
function (utils, props) {
|
|
200
|
-
var $disabled = props.$disabled;
|
|
204
|
+
var $disabled = props.$disabled, $variant = props.$variant;
|
|
201
205
|
var theme = utils.theme;
|
|
202
206
|
return {
|
|
203
207
|
cursor: $disabled ? 'not-allowed' : 'pointer',
|
|
204
|
-
|
|
208
|
+
// for secondary variant disabled state, we are using correct tokens instead of relying on opacity
|
|
209
|
+
opacity: $disabled && $variant !== 'secondary' ? '0.6' : '1',
|
|
205
210
|
boxSizing: 'border-box',
|
|
206
211
|
outlineWidth: theme.borderWidth['0'],
|
|
207
212
|
};
|