@sprinklrjs/spaceweb 10.1.0 → 11.0.0
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/asyncSelect/asyncSelect.js +12 -12
- package/asyncSelect/helpers.d.ts +1 -1
- package/asyncSelect/hooks/useAsyncOptionHandlers.d.ts +2 -2
- package/asyncSelect/types.d.ts +3 -4
- package/avatar/index.d.ts +1 -1
- package/avatar/types.d.ts +1 -1
- package/banner/banner-item.d.ts +12 -0
- package/banner/banner-item.js +14 -0
- package/banner/banner.d.ts +19 -0
- package/banner/banner.js +56 -0
- package/banner/index.d.ts +5 -0
- package/banner/index.js +14 -0
- package/banner/locale.d.ts +6 -0
- package/banner/locale.js +2 -0
- package/banner/package.json +4 -0
- package/banner/styled-component.d.ts +6 -0
- package/banner/styled-component.js +39 -0
- package/banner/types.d.ts +26 -0
- package/banner/types.js +2 -0
- package/button/Button.d.ts +1 -3
- package/button/Button.js +1 -1
- package/button/basewebAdapter.d.ts +7 -6
- package/button/basewebAdapter.js +1 -1
- package/button/types.d.ts +1 -1
- package/button-group/ButtonGroup.js +1 -1
- package/button-group/index.d.ts +1 -2
- package/button-group/index.js +1 -5
- package/button-group/styled-components.js +4 -4
- package/button-group/types.d.ts +1 -0
- package/checkbox/basewebAdapters.d.ts +5 -2
- package/checkbox/basewebAdapters.js +3 -1
- package/checkbox/index.d.ts +1 -1
- package/checkbox/index.js +1 -2
- package/checkbox/styled-components.js +1 -1
- package/checkbox/types.d.ts +15 -8
- package/date-input/DateInput.js +2 -2
- package/date-picker/Calendar.d.ts +1 -1
- package/date-picker/Calendar.js +11 -3
- package/date-picker/DateInput.d.ts +3 -2
- package/date-picker/DateInput.js +5 -5
- package/date-picker/DatePickerInput.js +4 -10
- package/date-picker/DateTimeContainer.d.ts +4 -2
- package/date-picker/DateTimeContainer.js +5 -5
- package/date-picker/StatelessDatePicker.d.ts +1 -1
- package/date-picker/StatelessDatePicker.js +7 -6
- package/date-picker/TimeInput.d.ts +5 -2
- package/date-picker/TimeInput.js +4 -2
- package/date-picker/index.d.ts +1 -0
- package/date-picker/index.js +3 -1
- package/date-picker/stateful-container.d.ts +1 -1
- package/date-picker/styled-components.d.ts +0 -1
- package/date-picker/styled-components.js +1 -24
- package/date-picker/types.d.ts +1 -1
- package/date-picker/utils.d.ts +8 -7
- package/date-picker/utils.js +4 -1
- package/esm/asyncSelect/asyncSelect.js +12 -12
- package/esm/asyncSelect/helpers.d.ts +1 -1
- package/esm/asyncSelect/hooks/useAsyncOptionHandlers.d.ts +2 -2
- package/esm/asyncSelect/types.d.ts +3 -4
- package/esm/avatar/index.d.ts +1 -1
- package/esm/avatar/types.d.ts +1 -1
- package/esm/banner/banner-item.d.ts +12 -0
- package/esm/banner/banner-item.js +12 -0
- package/esm/banner/banner.d.ts +19 -0
- package/esm/banner/banner.js +54 -0
- package/esm/banner/index.d.ts +5 -0
- package/esm/banner/index.js +3 -0
- package/esm/banner/locale.d.ts +6 -0
- package/esm/banner/locale.js +1 -0
- package/esm/banner/styled-component.d.ts +6 -0
- package/esm/banner/styled-component.js +35 -0
- package/esm/banner/types.d.ts +26 -0
- package/esm/banner/types.js +1 -0
- package/esm/button/Button.d.ts +1 -3
- package/esm/button/Button.js +1 -1
- package/esm/button/basewebAdapter.d.ts +7 -6
- package/esm/button/basewebAdapter.js +1 -1
- package/esm/button/types.d.ts +1 -1
- package/esm/button-group/ButtonGroup.js +1 -1
- package/esm/button-group/index.d.ts +1 -2
- package/esm/button-group/index.js +0 -1
- package/esm/button-group/styled-components.js +4 -4
- package/esm/button-group/types.d.ts +1 -0
- package/esm/checkbox/basewebAdapters.d.ts +5 -2
- package/esm/checkbox/basewebAdapters.js +3 -1
- package/esm/checkbox/index.d.ts +1 -1
- package/esm/checkbox/index.js +1 -1
- package/esm/checkbox/styled-components.js +1 -1
- package/esm/checkbox/types.d.ts +15 -8
- package/esm/date-input/DateInput.js +2 -2
- package/esm/date-picker/Calendar.d.ts +1 -1
- package/esm/date-picker/Calendar.js +12 -4
- package/esm/date-picker/DateInput.d.ts +3 -2
- package/esm/date-picker/DateInput.js +5 -5
- package/esm/date-picker/DatePickerInput.js +4 -10
- package/esm/date-picker/DateTimeContainer.d.ts +4 -2
- package/esm/date-picker/DateTimeContainer.js +5 -5
- package/esm/date-picker/StatelessDatePicker.d.ts +1 -1
- package/esm/date-picker/StatelessDatePicker.js +7 -6
- package/esm/date-picker/TimeInput.d.ts +5 -2
- package/esm/date-picker/TimeInput.js +4 -2
- package/esm/date-picker/index.d.ts +1 -0
- package/esm/date-picker/index.js +1 -0
- package/esm/date-picker/stateful-container.d.ts +1 -1
- package/esm/date-picker/styled-components.d.ts +0 -1
- package/esm/date-picker/styled-components.js +0 -23
- package/esm/date-picker/types.d.ts +1 -1
- package/esm/date-picker/utils.d.ts +8 -7
- package/esm/date-picker/utils.js +4 -1
- package/esm/form-control/context.d.ts +6 -13
- package/esm/form-control/context.js +10 -9
- package/esm/form-control/styled-component.js +3 -3
- package/esm/helpers/baseui/withThemeOverride.js +1 -1
- package/esm/helpers/commonStyles.d.ts +2 -2
- package/esm/helpers/styletron.d.ts +14 -3
- package/esm/hooks/useAutoFocus.d.ts +6 -7
- package/esm/hooks/useAutoFocus.js +13 -13
- package/esm/hooks/useCombinedRef.d.ts +1 -0
- package/esm/hooks/useCombinedRef.js +33 -0
- package/esm/hooks/useIsMobileDevice.d.ts +1 -0
- package/esm/hooks/useIsMobileDevice.js +6 -0
- package/esm/hooks/useMatchMedia.d.ts +3 -0
- package/esm/hooks/useMatchMedia.js +38 -0
- package/esm/input/basewebAdapters.d.ts +1 -1
- package/esm/input/index.d.ts +2 -1
- package/esm/input/index.js +1 -0
- package/esm/input/styled-components.d.ts +1 -1
- package/esm/input/styled-components.js +1 -1
- package/esm/input/types.d.ts +6 -3
- package/esm/list/avatar-list-item.js +4 -8
- package/esm/list/divider.js +6 -3
- package/esm/list/list.d.ts +10 -5
- package/esm/list/list.js +47 -6
- package/esm/list/styled-component.js +9 -11
- package/esm/list/types.d.ts +5 -0
- package/esm/list/utils.d.ts +2 -0
- package/esm/list/utils.js +10 -0
- package/esm/locale/en_US.js +9 -0
- package/esm/locale/types.d.ts +2 -0
- package/esm/menu/menu-item.d.ts +4 -1
- package/esm/menu/menu.d.ts +5 -0
- package/esm/menu/menu.js +7 -7
- package/esm/modal/adapter.d.ts +1 -1
- package/esm/modal/index.d.ts +1 -1
- package/esm/modal/index.js +1 -1
- package/esm/modal/modal.js +2 -4
- package/esm/modal/overrides.d.ts +0 -1
- package/esm/modal/overrides.js +0 -1
- package/esm/modal/styled-components.d.ts +1 -1
- package/esm/modal/styled-components.js +1 -1
- package/esm/overrides/mergeOverrides.js +4 -3
- package/esm/payment-card/basewebAdapters.js +4 -3
- package/esm/payment-card/styled-components.js +1 -1
- package/esm/payment-card/types.d.ts +4 -2
- package/esm/phone-input/country-select.js +1 -3
- package/esm/phone-input/default-props.d.ts +1 -4
- package/esm/phone-input/default-props.js +0 -2
- package/esm/phone-input/phone-input.d.ts +0 -2
- package/esm/phone-input/phone-input.js +3 -2
- package/esm/phone-input/stateful-phone-input.d.ts +0 -2
- package/esm/phone-input/utils.d.ts +5 -2
- package/esm/phone-input/utils.js +4 -4
- package/esm/popover/adapter.d.ts +3 -3
- package/esm/popover/popover.d.ts +5 -3
- package/esm/popover/popover.js +6 -4
- package/esm/popover/types.d.ts +7 -2
- package/esm/popover/types.js +2 -1
- package/esm/progress/circular/styled-component.d.ts +1 -1
- package/esm/progress/circular/styled-component.js +3 -3
- package/esm/radio/basewebAdapters.d.ts +8 -11
- package/esm/radio/basewebAdapters.js +6 -3
- package/esm/radio/radio.js +6 -5
- package/esm/radio/styled-components.js +4 -6
- package/esm/radio/types.d.ts +13 -6
- package/esm/select/adaptor.d.ts +1 -1
- package/esm/select/base-select.d.ts +18 -15
- package/esm/select/base-select.js +19 -14
- package/esm/select/default-props.d.ts +8 -5
- package/esm/select/default-props.js +1 -1
- package/esm/select/index.d.ts +2 -2
- package/esm/select/index.js +1 -1
- package/esm/select/mobileSelect/MobileSelect.js +3 -5
- package/esm/select/multi-value.js +1 -1
- package/esm/select/overlaySelect/OverlaySelect.js +9 -18
- package/esm/select/overlaySelect/hooks/useControlRef.d.ts +9 -0
- package/esm/select/overlaySelect/hooks/useControlRef.js +33 -0
- package/esm/select/overlaySelect/hooks/useOverlaySelectOverrides.d.ts +23 -0
- package/esm/select/overlaySelect/{useOverlaySelectOverrides.js → hooks/useOverlaySelectOverrides.js} +22 -16
- package/esm/select/overlaySelect/{usePopover.d.ts → hooks/usePopover.d.ts} +1 -1
- package/esm/select/overlaySelect/{usePopover.js → hooks/usePopover.js} +2 -2
- package/esm/select/overrides.d.ts +0 -1
- package/esm/select/overrides.js +2 -9
- package/esm/select/select-variants.js +2 -2
- package/esm/select/select.d.ts +8 -5
- package/esm/select/select.js +3 -3
- package/esm/select/selectMenuAdapter/SelectMenuAdapter.d.ts +2 -0
- package/esm/select/selectMenuAdapter/SelectMenuAdapter.js +11 -5
- package/esm/select/selectMenuAdapter/SelectMenuItem.d.ts +4 -1
- package/esm/select/selectMenuAdapter/SelectMenuItem.js +2 -4
- package/esm/select/stateful-select.d.ts +8 -5
- package/esm/select/stateful-select.js +3 -3
- package/esm/select/styled-component.d.ts +5 -3
- package/esm/select/styled-component.js +32 -6
- package/esm/select/types.d.ts +13 -8
- package/esm/slider/mark.d.ts +3 -3
- package/esm/slider/slider.js +2 -1
- package/esm/slider/stateful-slider.js +1 -1
- package/esm/slider/types.d.ts +9 -2
- package/esm/spacewebProvider/CustomBaseProvider.js +1 -0
- package/esm/spacewebProvider/SpacewebProvider.d.ts +1 -1
- package/esm/style/_parseStyle.js +5 -5
- package/esm/style/useMemoizedStyletron.d.ts +1 -1
- package/esm/styleEngine/styleEngine.d.ts +1 -2
- package/esm/switch/__test__/switch.spec.js +13 -0
- package/esm/switch/styled-components.js +14 -21
- package/esm/switch/switch.js +5 -2
- package/esm/switch/types.d.ts +8 -11
- package/esm/textarea/basewebAdapters.js +2 -2
- package/esm/textarea/styled-components.d.ts +1 -1
- package/esm/textarea/textarea.js +2 -6
- package/esm/textarea/types.d.ts +5 -3
- package/esm/themes/index.js +1 -1
- package/esm/themes/responsive-theme.d.ts +2 -2
- package/esm/time-picker/TimePicker.d.ts +1 -6
- package/esm/time-picker/TimePicker.js +1 -4
- package/esm/time-picker/types.d.ts +3 -1
- package/esm/time-range-picker/RangeSelector.js +6 -5
- package/esm/time-range-picker/RangeSelectorContainer.js +27 -27
- package/esm/time-range-picker/TimeRangeList.js +8 -1
- package/esm/time-range-picker/TimeRangePicker.js +6 -5
- package/esm/time-range-picker/locale.d.ts +3 -0
- package/esm/time-range-picker/types.d.ts +16 -1
- package/esm/time-range-picker/utils.d.ts +14 -14
- package/esm/time-range-picker/utils.js +45 -1
- package/esm/time-zone-picker/TimezonePicker.d.ts +1 -6
- package/esm/time-zone-picker/TimezonePicker.js +5 -7
- package/esm/tooltip/disabled-tooltip-container.d.ts +26 -1
- package/esm/tooltip/overrides.js +1 -1
- package/esm/tooltip/stateful-tooltip-container.d.ts +26 -1
- package/esm/tooltip/stateful-tooltip.d.ts +27 -1
- package/esm/tooltip/stateful-tooltip.js +1 -1
- package/esm/tooltip/tooltip.d.ts +1 -1
- package/esm/tooltip/tooltip.js +4 -4
- package/esm/tooltip/types.d.ts +10 -2
- package/esm/types.d.ts +3 -2
- package/esm/video/Video.js +4 -2
- package/esm/video/types.d.ts +2 -0
- package/form-control/context.d.ts +6 -13
- package/form-control/context.js +11 -10
- package/form-control/styled-component.js +3 -3
- package/helpers/baseui/withThemeOverride.js +1 -1
- package/helpers/commonStyles.d.ts +2 -2
- package/helpers/styletron.d.ts +14 -3
- package/hooks/useAutoFocus.d.ts +6 -7
- package/hooks/useAutoFocus.js +13 -14
- package/hooks/useCombinedRef.d.ts +1 -0
- package/hooks/useCombinedRef.js +35 -1
- package/hooks/useIsMobileDevice.d.ts +1 -0
- package/hooks/useIsMobileDevice.js +11 -0
- package/hooks/useMatchMedia.d.ts +3 -0
- package/hooks/useMatchMedia.js +41 -0
- package/input/basewebAdapters.d.ts +1 -1
- package/input/index.d.ts +2 -1
- package/input/index.js +3 -1
- package/input/styled-components.d.ts +1 -1
- package/input/styled-components.js +1 -1
- package/input/types.d.ts +6 -3
- package/list/avatar-list-item.js +3 -7
- package/list/divider.js +6 -3
- package/list/list.d.ts +10 -5
- package/list/list.js +47 -6
- package/list/styled-component.js +9 -11
- package/list/types.d.ts +5 -0
- package/list/utils.d.ts +2 -0
- package/list/utils.js +14 -0
- package/locale/en_US.js +9 -0
- package/locale/types.d.ts +2 -0
- package/menu/menu-item.d.ts +4 -1
- package/menu/menu.d.ts +5 -0
- package/menu/menu.js +7 -7
- package/modal/adapter.d.ts +1 -1
- package/modal/index.d.ts +1 -1
- package/modal/index.js +1 -2
- package/modal/modal.js +1 -3
- package/modal/overrides.d.ts +0 -1
- package/modal/overrides.js +1 -2
- package/modal/styled-components.d.ts +1 -1
- package/modal/styled-components.js +1 -2
- package/overrides/mergeOverrides.js +4 -3
- package/package.json +13 -10
- package/payment-card/basewebAdapters.js +4 -3
- package/payment-card/styled-components.js +1 -1
- package/payment-card/types.d.ts +4 -2
- package/phone-input/country-select.js +1 -3
- package/phone-input/default-props.d.ts +1 -4
- package/phone-input/default-props.js +0 -2
- package/phone-input/phone-input.d.ts +0 -2
- package/phone-input/phone-input.js +3 -2
- package/phone-input/stateful-phone-input.d.ts +0 -2
- package/phone-input/utils.d.ts +5 -2
- package/phone-input/utils.js +4 -4
- package/popover/adapter.d.ts +3 -3
- package/popover/popover.d.ts +5 -3
- package/popover/popover.js +6 -4
- package/popover/types.d.ts +7 -2
- package/popover/types.js +5 -4
- package/progress/circular/styled-component.d.ts +1 -1
- package/progress/circular/styled-component.js +4 -4
- package/radio/basewebAdapters.d.ts +8 -11
- package/radio/basewebAdapters.js +6 -3
- package/radio/radio.js +6 -5
- package/radio/styled-components.js +4 -6
- package/radio/types.d.ts +13 -6
- package/select/adaptor.d.ts +1 -1
- package/select/base-select.d.ts +18 -15
- package/select/base-select.js +18 -13
- package/select/default-props.d.ts +8 -5
- package/select/default-props.js +1 -1
- package/select/index.d.ts +2 -2
- package/select/index.js +1 -2
- package/select/mobileSelect/MobileSelect.js +3 -5
- package/select/multi-value.js +1 -1
- package/select/overlaySelect/OverlaySelect.js +8 -17
- package/select/overlaySelect/hooks/useControlRef.d.ts +9 -0
- package/select/overlaySelect/hooks/useControlRef.js +37 -0
- package/select/overlaySelect/hooks/useOverlaySelectOverrides.d.ts +23 -0
- package/select/overlaySelect/{useOverlaySelectOverrides.js → hooks/useOverlaySelectOverrides.js} +22 -16
- package/select/overlaySelect/{usePopover.d.ts → hooks/usePopover.d.ts} +1 -1
- package/select/overlaySelect/{usePopover.js → hooks/usePopover.js} +2 -2
- package/select/overrides.d.ts +0 -1
- package/select/overrides.js +3 -11
- package/select/select-variants.js +2 -2
- package/select/select.d.ts +8 -5
- package/select/select.js +3 -3
- package/select/selectMenuAdapter/SelectMenuAdapter.d.ts +2 -0
- package/select/selectMenuAdapter/SelectMenuAdapter.js +11 -5
- package/select/selectMenuAdapter/SelectMenuItem.d.ts +4 -1
- package/select/selectMenuAdapter/SelectMenuItem.js +2 -4
- package/select/stateful-select.d.ts +8 -5
- package/select/stateful-select.js +3 -3
- package/select/styled-component.d.ts +5 -3
- package/select/styled-component.js +32 -9
- package/select/types.d.ts +13 -8
- package/slider/mark.d.ts +3 -3
- package/slider/slider.js +2 -1
- package/slider/stateful-slider.js +1 -1
- package/slider/types.d.ts +9 -2
- package/spacewebProvider/CustomBaseProvider.js +1 -0
- package/spacewebProvider/SpacewebProvider.d.ts +1 -1
- package/style/_parseStyle.js +5 -5
- package/style/useMemoizedStyletron.d.ts +1 -1
- package/styleEngine/styleEngine.d.ts +1 -2
- package/switch/__test__/switch.spec.js +13 -0
- package/switch/styled-components.js +14 -21
- package/switch/switch.js +5 -2
- package/switch/types.d.ts +8 -11
- package/textarea/basewebAdapters.js +2 -2
- package/textarea/styled-components.d.ts +1 -1
- package/textarea/textarea.js +2 -6
- package/textarea/types.d.ts +5 -3
- package/themes/index.js +1 -1
- package/themes/responsive-theme.d.ts +2 -2
- package/time-picker/TimePicker.d.ts +1 -6
- package/time-picker/TimePicker.js +1 -4
- package/time-picker/types.d.ts +3 -1
- package/time-range-picker/RangeSelector.js +5 -4
- package/time-range-picker/RangeSelectorContainer.js +26 -26
- package/time-range-picker/TimeRangeList.js +8 -1
- package/time-range-picker/TimeRangePicker.js +6 -5
- package/time-range-picker/locale.d.ts +3 -0
- package/time-range-picker/types.d.ts +16 -1
- package/time-range-picker/utils.d.ts +14 -14
- package/time-range-picker/utils.js +46 -1
- package/time-zone-picker/TimezonePicker.d.ts +1 -6
- package/time-zone-picker/TimezonePicker.js +5 -7
- package/tooltip/disabled-tooltip-container.d.ts +26 -1
- package/tooltip/overrides.js +1 -1
- package/tooltip/stateful-tooltip-container.d.ts +26 -1
- package/tooltip/stateful-tooltip.d.ts +27 -1
- package/tooltip/stateful-tooltip.js +1 -1
- package/tooltip/tooltip.d.ts +1 -1
- package/tooltip/tooltip.js +4 -4
- package/tooltip/types.d.ts +10 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/types.d.ts +3 -2
- package/video/Video.js +4 -2
- package/video/types.d.ts +2 -0
- package/esm/phone-input/virtualized-country-select-dropdown.d.ts +0 -31
- package/esm/phone-input/virtualized-country-select-dropdown.js +0 -33
- package/esm/select/overlaySelect/useOverlaySelectOverrides.d.ts +0 -14
- package/esm/style/_escapeClassName.d.ts +0 -6
- package/esm/style/_escapeClassName.js +0 -6
- package/phone-input/virtualized-country-select-dropdown.d.ts +0 -31
- package/phone-input/virtualized-country-select-dropdown.js +0 -35
- package/select/overlaySelect/useOverlaySelectOverrides.d.ts +0 -14
- package/style/_escapeClassName.d.ts +0 -6
- package/style/_escapeClassName.js +0 -9
|
@@ -9,8 +9,9 @@ import { sanitize } from './utils';
|
|
|
9
9
|
import { useOverrides, mergeOverrides } from '../overrides';
|
|
10
10
|
import { useLocale } from '../locale';
|
|
11
11
|
import defaultProps from './default-props';
|
|
12
|
+
import { useContextualFormProps } from '../form-control/context';
|
|
12
13
|
var PhoneInput = function (props) {
|
|
13
|
-
var
|
|
14
|
+
var _a = useContextualFormProps(props), _b = _a.size, size = _b === void 0 ? 'md' : _b, variant = _a.variant, intent = _a.intent, disabled = _a.disabled, overrides = _a.overrides, mapIsoToLabel = _a.mapIsoToLabel, maxDropdownHeight = _a.maxDropdownHeight, maxDropdownWidth = _a.maxDropdownWidth, onInputChange = _a.onInputChange, onChange = _a.onChange, value = _a.value, rest = __rest(_a, ["size", "variant", "intent", "disabled", "overrides", "mapIsoToLabel", "maxDropdownHeight", "maxDropdownWidth", "onInputChange", "onChange", "value"]);
|
|
14
15
|
var locale = useLocale();
|
|
15
16
|
var inputRef = useRef(null);
|
|
16
17
|
var mergedOverrides = mergeOverrides({
|
|
@@ -42,7 +43,7 @@ var PhoneInput = function (props) {
|
|
|
42
43
|
},
|
|
43
44
|
},
|
|
44
45
|
}, overrides);
|
|
45
|
-
var
|
|
46
|
+
var _c = __read(useOverrides(mergedOverrides === null || mergedOverrides === void 0 ? void 0 : mergedOverrides.Input, DefaultInput), 2), Input = _c[0], inputProps = _c[1];
|
|
46
47
|
return (_jsx(Input, __assign({ "aria-label": locale.phoneInput.inputAriaLabel, size: size, variant: variant, intent: intent, disabled: disabled, onChange: function (e) {
|
|
47
48
|
var number = sanitize(e.currentTarget.value);
|
|
48
49
|
if (onChange) {
|
|
@@ -6,7 +6,6 @@ declare const StatefulPhoneInput: {
|
|
|
6
6
|
clearable: boolean;
|
|
7
7
|
focusLock: boolean;
|
|
8
8
|
disabled: boolean;
|
|
9
|
-
intent: import("..").Intent;
|
|
10
9
|
maxDropdownHeight: string;
|
|
11
10
|
maxDropdownWidth: string;
|
|
12
11
|
name: undefined;
|
|
@@ -14,7 +13,6 @@ declare const StatefulPhoneInput: {
|
|
|
14
13
|
overrides: import("./types").PhoneInputOverrides;
|
|
15
14
|
positive: boolean;
|
|
16
15
|
required: boolean;
|
|
17
|
-
size: import("../input").InputSize;
|
|
18
16
|
variant: import("../input").InputVariant;
|
|
19
17
|
value: {
|
|
20
18
|
country: import("./types").Country;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Value as ValueT } from '../select/types';
|
|
2
2
|
import { Value } from './types';
|
|
3
3
|
export declare const iso2FlagEmoji: (iso: string) => string | undefined;
|
|
4
4
|
export declare const sanitize: (value?: string) => string;
|
|
5
5
|
export declare const getPhoneNumberWithCountryDialCode: (value: Value) => string | undefined;
|
|
6
|
-
export declare const countrySelectFilterOptions:
|
|
6
|
+
export declare const countrySelectFilterOptions: (options: ValueT, filterValue: string, excludeOptions?: ValueT | undefined | null, params?: {
|
|
7
|
+
valueKey: string;
|
|
8
|
+
labelKey: string;
|
|
9
|
+
}) => ValueT;
|
package/esm/phone-input/utils.js
CHANGED
|
@@ -3,7 +3,7 @@ import { filterOptions } from '../select/utils/default-filter-options';
|
|
|
3
3
|
import { ISO_REGEX, ISO_TO_FLAG_OFFSET } from './constants';
|
|
4
4
|
export var iso2FlagEmoji = function (iso) {
|
|
5
5
|
if (!ISO_REGEX.test(iso)) {
|
|
6
|
-
return;
|
|
6
|
+
return undefined;
|
|
7
7
|
}
|
|
8
8
|
var chars = Array.from(iso.toUpperCase()).map(function (char) { return char.charCodeAt(0) + ISO_TO_FLAG_OFFSET; });
|
|
9
9
|
return String.fromCodePoint.apply(String, __spreadArray([], __read(chars), false));
|
|
@@ -14,14 +14,14 @@ export var sanitize = function (value) {
|
|
|
14
14
|
};
|
|
15
15
|
export var getPhoneNumberWithCountryDialCode = function (value) {
|
|
16
16
|
if (value === undefined || value.country === undefined || value.phoneNumber === undefined) {
|
|
17
|
-
return;
|
|
17
|
+
return undefined;
|
|
18
18
|
}
|
|
19
19
|
return value.country.dialCode.concat(value.phoneNumber);
|
|
20
20
|
};
|
|
21
21
|
export var countrySelectFilterOptions = function (options, filterValue, excludeOptions, params) {
|
|
22
|
-
return filterOptions(options, filterValue, excludeOptions, __assign(__assign({}, params), { filterOption: function (_a,
|
|
22
|
+
return filterOptions(options, filterValue, excludeOptions, __assign(__assign({}, params), { filterOption: function (_a, _filterValue) {
|
|
23
23
|
var label = _a.label, dialCode = _a.dialCode;
|
|
24
|
-
var filterValueLowerCase =
|
|
24
|
+
var filterValueLowerCase = _filterValue.toLowerCase();
|
|
25
25
|
return label.toLowerCase().includes(filterValueLowerCase) || dialCode.includes(filterValueLowerCase);
|
|
26
26
|
} }));
|
|
27
27
|
};
|
package/esm/popover/adapter.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ACCESSIBILITY_TYPE, PLACEMENT, TRIGGER_TYPE } from 'baseui/popover';
|
|
2
2
|
import { AccessibilityType, TriggerType, Placement } from './types';
|
|
3
3
|
import { ValueOf } from '../utility-types';
|
|
4
|
-
export declare const accessibilityMap: Record<AccessibilityType, ValueOf<ACCESSIBILITY_TYPE>>;
|
|
5
|
-
export declare const triggerTypeMap: Record<TriggerType, ValueOf<TRIGGER_TYPE>>;
|
|
6
|
-
export declare const placementMap: Record<Placement, ValueOf<PLACEMENT>>;
|
|
4
|
+
export declare const accessibilityMap: Record<AccessibilityType, ValueOf<typeof ACCESSIBILITY_TYPE>>;
|
|
5
|
+
export declare const triggerTypeMap: Record<TriggerType, ValueOf<typeof TRIGGER_TYPE>>;
|
|
6
|
+
export declare const placementMap: Record<Placement, ValueOf<typeof PLACEMENT>>;
|
package/esm/popover/popover.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Popover as BasePopover } from 'baseui/popover';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
declare const Popover: React.ForwardRefExoticComponent<Omit<import("baseui/popover").PopoverProps, "overrides" | "
|
|
2
|
+
declare const Popover: React.ForwardRefExoticComponent<Omit<import("baseui/popover").PopoverProps, "children" | "overrides" | "triggerType" | "placement"> & {
|
|
4
3
|
overrides?: ({
|
|
5
4
|
Body?: import("../overrides").Override<any> | undefined;
|
|
6
5
|
Arrow?: import("../overrides").Override<any> | undefined;
|
|
@@ -12,5 +11,8 @@ declare const Popover: React.ForwardRefExoticComponent<Omit<import("baseui/popov
|
|
|
12
11
|
isOpen: boolean;
|
|
13
12
|
}) => React.ReactNode);
|
|
14
13
|
targetElement?: HTMLElement | null | undefined;
|
|
15
|
-
|
|
14
|
+
triggerType?: import("./types").TriggerType | undefined;
|
|
15
|
+
placement?: "auto" | "bottom" | "left" | "right" | "top" | "topLeft" | "topRight" | "rightTop" | "rightBottom" | "bottomRight" | "bottomLeft" | "leftBottom" | "leftTop" | undefined;
|
|
16
|
+
innerRef?: React.Ref<HTMLElement> | undefined;
|
|
17
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
16
18
|
export default Popover;
|
package/esm/popover/popover.js
CHANGED
|
@@ -11,13 +11,14 @@ import { LayersManager, Z_INDEX } from '../layer';
|
|
|
11
11
|
import { accessibilityMap, placementMap, triggerTypeMap } from './adapter';
|
|
12
12
|
import { arrowStyles, getBodyStyles, getInnerStyles } from './overrides';
|
|
13
13
|
import { StyledArrowTriangle } from './styled-components';
|
|
14
|
+
import useCombinedRefs from '../hooks/useCombinedRef';
|
|
14
15
|
// @ts-ignore
|
|
15
16
|
BasePopover.displayName = 'BaseUIPopover';
|
|
16
17
|
var Popover = React.forwardRef(function (_a, ref) {
|
|
17
|
-
var overrides = _a.overrides, children = _a.children,
|
|
18
|
-
var
|
|
18
|
+
var overrides = _a.overrides, children = _a.children, _b = _a.placement, placement = _b === void 0 ? 'auto' : _b, accessibilityType = _a.accessibilityType, _c = _a.triggerType, triggerType = _c === void 0 ? 'click' : _c, _d = _a.showArrow, showArrow = _d === void 0 ? false : _d, targetElement = _a.targetElement, isOpen = _a.isOpen, _e = _a.focusLock, focusLock = _e === void 0 ? false : _e, _f = _a.returnFocus, returnFocus = _f === void 0 ? triggerType === 'click' : _f, content = _a.content, restProps = __rest(_a, ["overrides", "children", "placement", "accessibilityType", "triggerType", "showArrow", "targetElement", "isOpen", "focusLock", "returnFocus", "content"]);
|
|
19
|
+
var _g = useContent({ content: content }), setContentHost = _g.setContentHost, wrappedContent = _g.wrappedContent;
|
|
19
20
|
var focusLockProps = useFocusLock({ returnFocus: returnFocus, focusLock: focusLock });
|
|
20
|
-
var
|
|
21
|
+
var _h = __read(useOverrides(overrides === null || overrides === void 0 ? void 0 : overrides.ArrowTriangle, StyledArrowTriangle), 2), ArrowTriangle = _h[0], arrowTriangleProps = _h[1];
|
|
21
22
|
var _overrides = useConvertOverrides({
|
|
22
23
|
Body: { style: getBodyStyles },
|
|
23
24
|
Arrow: { style: arrowStyles, props: { children: _jsx(ArrowTriangle, __assign({}, arrowTriangleProps), void 0) } },
|
|
@@ -28,12 +29,13 @@ var Popover = React.forwardRef(function (_a, ref) {
|
|
|
28
29
|
accessibilityType: accessibilityType && accessibilityMap[accessibilityType],
|
|
29
30
|
triggerType: triggerType && triggerTypeMap[triggerType],
|
|
30
31
|
};
|
|
32
|
+
var combinedRef = useCombinedRefs(ref, restProps.innerRef);
|
|
31
33
|
var childNode = children;
|
|
32
34
|
if (typeof children === 'function') {
|
|
33
35
|
childNode = children({ isOpen: isOpen });
|
|
34
36
|
}
|
|
35
37
|
var id = useUniqueId();
|
|
36
|
-
return (_jsx(LayersManager, __assign({ zIndex: Z_INDEX.POPOVER }, { children: _jsx(BasePopover, __assign({ id: id }, restProps, mappedProps, { showArrow: showArrow, isOpen: isOpen, overrides: _overrides,
|
|
38
|
+
return (_jsx(LayersManager, __assign({ zIndex: Z_INDEX.POPOVER }, { children: _jsx(BasePopover, __assign({ id: id }, restProps, mappedProps, { showArrow: showArrow, isOpen: isOpen, overrides: _overrides, innerRef: combinedRef, content: wrappedContent }, focusLockProps, { children: _jsx(PopoverChildEnhancer, __assign({ targetElement: targetElement }, { children: childNode }), void 0) }), void 0) }), void 0));
|
|
37
39
|
});
|
|
38
40
|
Popover.displayName = 'Popover';
|
|
39
41
|
export default Popover;
|
package/esm/popover/types.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { TetherPlacement } from 'baseui/layer';
|
|
2
3
|
import { PopoverProps as BasePopoverProps, StatefulPopoverProps as BaseStatefulPopoverProps, StatefulPopoverContainerProps as BaseStatefulPopoverContainerProps, PopoverOverrides as BasePopoverOverrides } from 'baseui/popover';
|
|
3
4
|
import { Override } from '../overrides';
|
|
4
|
-
export declare type PopoverProps = Omit<BasePopoverProps, 'overrides' | 'children'> & {
|
|
5
|
+
export declare type PopoverProps = Omit<BasePopoverProps, 'overrides' | 'children' | 'triggerType' | 'placement'> & {
|
|
5
6
|
overrides?: {
|
|
6
7
|
[key in keyof BasePopoverOverrides]?: Override<any>;
|
|
7
8
|
} & {
|
|
@@ -11,6 +12,9 @@ export declare type PopoverProps = Omit<BasePopoverProps, 'overrides' | 'childre
|
|
|
11
12
|
isOpen: boolean;
|
|
12
13
|
}) => React.ReactNode);
|
|
13
14
|
targetElement?: HTMLElement | null;
|
|
15
|
+
triggerType?: TriggerType;
|
|
16
|
+
placement?: TetherPlacement;
|
|
17
|
+
innerRef?: React.Ref<HTMLElement>;
|
|
14
18
|
};
|
|
15
19
|
export declare type StatefulPopoverProps = Omit<BaseStatefulPopoverProps, 'overrides' | 'children'> & {
|
|
16
20
|
overrides?: {
|
|
@@ -29,4 +33,5 @@ export declare type AccessibilityType = 'none' | 'menu' | 'tooltip';
|
|
|
29
33
|
export declare type TriggerType = 'click' | 'hover';
|
|
30
34
|
export declare type Placement = 'auto' | 'top' | 'topLeft' | 'topRight' | 'right' | 'rightTop' | 'rightBottom' | 'bottom' | 'bottomLeft' | 'bottomRight' | 'left' | 'leftTop' | 'leftBottom';
|
|
31
35
|
export type { Offset, SharedStylePropsArg as SharedProps, StateReducer, } from 'baseui/popover';
|
|
32
|
-
export {
|
|
36
|
+
export { STATE_CHANGE_TYPE, ANIMATE_IN_TIME, ANIMATE_OUT_TIME } from 'baseui/popover';
|
|
37
|
+
export { ARROW_SIZE, ARROW_WIDTH, POPOVER_MARGIN } from 'baseui/popover/constants';
|
package/esm/popover/types.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { STATE_CHANGE_TYPE, ANIMATE_IN_TIME, ANIMATE_OUT_TIME } from 'baseui/popover';
|
|
2
|
+
export { ARROW_SIZE, ARROW_WIDTH, POPOVER_MARGIN } from 'baseui/popover/constants';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare const VIEWBOX_SIZE = 44;
|
|
1
2
|
export declare const getProgressInlineStyles: ({ strokeWidth, value, infinite, }: {
|
|
2
3
|
strokeWidth: number;
|
|
3
4
|
value: number;
|
|
@@ -5,7 +6,6 @@ export declare const getProgressInlineStyles: ({ strokeWidth, value, infinite, }
|
|
|
5
6
|
}) => {
|
|
6
7
|
strokeDashoffset: string;
|
|
7
8
|
};
|
|
8
|
-
export declare const VIEWBOX_SIZE = 44;
|
|
9
9
|
export declare const StyledRoot: import("../../style/styled").StyledComponent;
|
|
10
10
|
export declare const StyledBarContainer: import("../../style/styled").StyledComponent;
|
|
11
11
|
export declare const StyledSvg: import("../../style/styled").StyledComponent;
|
|
@@ -11,6 +11,7 @@ var BaseProgress = function (_a) {
|
|
|
11
11
|
var inlineStyles = _a.inlineStyles, props = __rest(_a, ["inlineStyles"]);
|
|
12
12
|
return (_jsx("circle", __assign({ style: inlineStyles }, props), void 0));
|
|
13
13
|
};
|
|
14
|
+
export var VIEWBOX_SIZE = 44;
|
|
14
15
|
export var getProgressInlineStyles = function (_a) {
|
|
15
16
|
var strokeWidth = _a.strokeWidth, value = _a.value, infinite = _a.infinite;
|
|
16
17
|
var circumference = 2 * Math.PI * ((VIEWBOX_SIZE - strokeWidth) / 2);
|
|
@@ -18,7 +19,6 @@ export var getProgressInlineStyles = function (_a) {
|
|
|
18
19
|
strokeDashoffset: "".concat((((100 - value) / 100) * circumference).toFixed(3), "px"),
|
|
19
20
|
};
|
|
20
21
|
};
|
|
21
|
-
export var VIEWBOX_SIZE = 44;
|
|
22
22
|
export var StyledRoot = styled('span', 'relative inline-flex', function (_a, _b) {
|
|
23
23
|
var px2rem = _a.px2rem;
|
|
24
24
|
var $size = _b.$size;
|
|
@@ -58,14 +58,14 @@ export var StyledBar = styled('circle', function (_a, _b) {
|
|
|
58
58
|
cx: px2rem(VIEWBOX_SIZE),
|
|
59
59
|
cy: px2rem(VIEWBOX_SIZE),
|
|
60
60
|
r: px2rem((VIEWBOX_SIZE - $strokeWidth) / 2),
|
|
61
|
-
strokeWidth: $strokeWidth,
|
|
61
|
+
strokeWidth: $strokeWidth.toString(),
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
64
|
export var StyledProgress = styled(BaseProgress, 'stroke-current', { fill: 'none' }, function (_a, _b) {
|
|
65
65
|
var px2rem = _a.px2rem;
|
|
66
66
|
var $infinite = _b.$infinite, $value = _b.$value, $strokeWidth = _b.$strokeWidth;
|
|
67
67
|
var circumference = 2 * Math.PI * ((VIEWBOX_SIZE - $strokeWidth) / 2);
|
|
68
|
-
return __assign({ cx: px2rem(VIEWBOX_SIZE), cy: px2rem(VIEWBOX_SIZE), r: px2rem((VIEWBOX_SIZE - $strokeWidth) / 2), strokeWidth: $strokeWidth }, (!$infinite
|
|
68
|
+
return __assign({ cx: px2rem(VIEWBOX_SIZE), cy: px2rem(VIEWBOX_SIZE), r: px2rem((VIEWBOX_SIZE - $strokeWidth) / 2), strokeWidth: $strokeWidth.toString() }, (!$infinite
|
|
69
69
|
? {
|
|
70
70
|
willChange: 'strokeDashoffset',
|
|
71
71
|
transitionTimingFunction: 'ease',
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { Radio as BaseRadio, RadioGroup as BaseRadioGroup } from 'baseui/radio';
|
|
3
3
|
import { RadioGroupProps, RadioProps, Size } from './types';
|
|
4
4
|
import { Intent } from '../types';
|
|
5
|
-
export declare const SpaceRadioContext:
|
|
5
|
+
export declare const SpaceRadioContext: React.Context<{
|
|
6
6
|
size?: Size | undefined;
|
|
7
7
|
intent?: Intent | undefined;
|
|
8
8
|
}>;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
export declare const useRadioAdapter: <T extends RadioProps>(props: T) => Omit<T, "style" | "className" | "$outlineColor" | "$outlineWidth" | "$outlineOffset" | "$outlineStyle"> & {
|
|
15
|
-
overrides: RadioOverrides;
|
|
16
|
-
};
|
|
9
|
+
declare type BaseuiRadioGroupProps = React.ComponentProps<typeof BaseRadioGroup>;
|
|
10
|
+
export declare function useRadioGroupAdapter(props: RadioGroupProps): BaseuiRadioGroupProps;
|
|
11
|
+
declare type BaseuiRadioProps = React.ComponentProps<typeof BaseRadio>;
|
|
12
|
+
export declare const useRadioAdapter: (props: RadioProps) => BaseuiRadioProps;
|
|
13
|
+
export {};
|
|
@@ -4,6 +4,7 @@ import { add$props } from '../helpers';
|
|
|
4
4
|
import { useConvertOverrides } from '../helpers/baseui/useConvertOverrides';
|
|
5
5
|
import { getRadioLabelStyles, getRadioMarkInnerStyles, getRadioMarkOuterStyles, getRootStyles, } from './styled-components';
|
|
6
6
|
import { useContextualFormProps } from '../form-control/context';
|
|
7
|
+
import { useCombineRefObjects } from '../hooks/useCombinedRef';
|
|
7
8
|
export var SpaceRadioContext = createContext({
|
|
8
9
|
size: 'md',
|
|
9
10
|
intent: 'default',
|
|
@@ -16,7 +17,7 @@ export function useRadioGroupAdapter(props) {
|
|
|
16
17
|
style: [className, style],
|
|
17
18
|
},
|
|
18
19
|
}, overrides);
|
|
19
|
-
return
|
|
20
|
+
return __assign(__assign({}, restProps), { overrides: convertOverrides, onMouseEnter: props.onMouseEnter, onMouseLeave: props.onMouseLeave, onFocus: props.onFocus, onBlur: props.onBlur });
|
|
20
21
|
}
|
|
21
22
|
export var useRadioAdapter = function (props) {
|
|
22
23
|
var _a = useContext(SpaceRadioContext), size = _a.size, intent = _a.intent;
|
|
@@ -40,7 +41,9 @@ export var useRadioAdapter = function (props) {
|
|
|
40
41
|
props: sharedProps,
|
|
41
42
|
},
|
|
42
43
|
// https://prod-gitlab.sprinklr.com/sprinklr/frontend/spaceweb/-/issues/472 - baseui adds position absolute
|
|
43
|
-
|
|
44
|
+
// static position gives unexpected behaviour in Safari. Using position fixed works well for the above issue and Safari as well.
|
|
45
|
+
Input: { style: { position: 'fixed' } },
|
|
44
46
|
}, props.overrides);
|
|
45
|
-
|
|
47
|
+
var inputRefObj = useCombineRefObjects(props.inputRef);
|
|
48
|
+
return __assign(__assign({}, restProps), { overrides: overrides, onMouseEnter: props.onMouseEnter, onMouseLeave: props.onMouseLeave, onFocus: props.onFocus, onBlur: props.onBlur, inputRef: inputRefObj });
|
|
46
49
|
};
|
package/esm/radio/radio.js
CHANGED
|
@@ -3,6 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { Radio as BaseRadio, RadioGroup as BaseRadioGroup } from 'baseui/radio';
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
import { useRadioGroupAdapter, useRadioAdapter, SpaceRadioContext } from './basewebAdapters';
|
|
6
|
+
import { useContextualFormProps } from '../form-control/context';
|
|
6
7
|
// @ts-ignore
|
|
7
8
|
BaseRadio.displayName = 'BaseUIRadio';
|
|
8
9
|
// @ts-ignore
|
|
@@ -13,11 +14,11 @@ export var Radio = function (props) {
|
|
|
13
14
|
};
|
|
14
15
|
Radio.displayName = 'Radio';
|
|
15
16
|
export var RadioGroup = function (props) {
|
|
16
|
-
var adaptedProps = useRadioGroupAdapter(props)
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
]);
|
|
17
|
+
var adaptedProps = useRadioGroupAdapter(props);
|
|
18
|
+
var _a = useContextualFormProps(props, {
|
|
19
|
+
intent: 'default',
|
|
20
|
+
}), formIntent = _a.intent, _b = _a.size, formSize = _b === void 0 ? 'md' : _b;
|
|
21
|
+
var memoizedProviderValue = useMemo(function () { return ({ size: formSize, intent: formIntent }); }, [formSize, formIntent]);
|
|
21
22
|
return (_jsx(SpaceRadioContext.Provider, __assign({ value: memoizedProviderValue }, { children: _jsx(BaseRadioGroup, __assign({}, adaptedProps), void 0) }), void 0));
|
|
22
23
|
};
|
|
23
24
|
RadioGroup.displayName = 'RadioGroup';
|
|
@@ -117,19 +117,17 @@ export var getRootStyles = function (_a, _b) {
|
|
|
117
117
|
var directionMargin = direction === 'rtl' ? 'Left' : 'Right';
|
|
118
118
|
var styles = (_c = {},
|
|
119
119
|
_c["margin".concat(directionMargin)] = isHorizontal ? px2rem(30) : undefined,
|
|
120
|
-
_c.marginTop =
|
|
121
|
-
_c.marginBottom = $hasDescription
|
|
120
|
+
_c.marginTop = '0px',
|
|
121
|
+
_c.marginBottom = isHorizontal || $hasDescription ? undefined : px2rem(6),
|
|
122
122
|
_c);
|
|
123
123
|
switch ($size) {
|
|
124
124
|
case 'md':
|
|
125
125
|
styles["margin".concat(directionMargin)] = isHorizontal ? px2rem(38) : undefined;
|
|
126
|
-
styles.
|
|
127
|
-
styles.marginBottom = $hasDescription && !isHorizontal ? undefined : px2rem(8);
|
|
126
|
+
styles.marginBottom = isHorizontal || $hasDescription ? undefined : px2rem(8);
|
|
128
127
|
break;
|
|
129
128
|
case 'lg':
|
|
130
129
|
styles["margin".concat(directionMargin)] = isHorizontal ? px2rem(46) : undefined;
|
|
131
|
-
styles.
|
|
132
|
-
styles.marginBottom = $hasDescription && !isHorizontal ? undefined : px2rem(10);
|
|
130
|
+
styles.marginBottom = isHorizontal || $hasDescription ? undefined : px2rem(10);
|
|
133
131
|
break;
|
|
134
132
|
default:
|
|
135
133
|
break;
|
package/esm/radio/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import { RadioGroupProps as BaseRadioGroupProps, RadioProps as BaseRadioProps, RadioOverrides, RadioGroupOverrides } from 'baseui/radio';
|
|
2
3
|
import { Intent, SpacewebComponentProps } from '../types';
|
|
3
4
|
import { Override } from '../overrides';
|
|
@@ -21,17 +22,23 @@ export declare type SharedProps = {
|
|
|
21
22
|
$size?: Size;
|
|
22
23
|
$labelPosition?: LabelPosition;
|
|
23
24
|
};
|
|
24
|
-
|
|
25
|
+
declare type CommonProps = {
|
|
26
|
+
onMouseEnter?: (e: React.MouseEvent<HTMLInputElement>) => unknown;
|
|
27
|
+
onMouseLeave?: (e: React.MouseEvent<HTMLInputElement>) => unknown;
|
|
28
|
+
onFocus?: (e: React.FocusEvent<HTMLInputElement>) => unknown;
|
|
29
|
+
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => unknown;
|
|
25
30
|
size?: Size;
|
|
26
31
|
intent?: Intent;
|
|
32
|
+
};
|
|
33
|
+
export declare type RadioProps = SpacewebComponentProps<Omit<BaseRadioProps, 'overrides' | 'isError' | keyof CommonProps>> & {
|
|
27
34
|
overrides?: {
|
|
28
35
|
[key in keyof RadioOverrides]?: Override<SharedProps>;
|
|
29
36
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
size?: Size;
|
|
37
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
38
|
+
} & OutlineProps & CommonProps;
|
|
39
|
+
export declare type RadioGroupProps = SpacewebComponentProps<Omit<BaseRadioGroupProps, 'overrides' | keyof CommonProps>> & {
|
|
34
40
|
overrides?: {
|
|
35
41
|
[key in keyof RadioGroupOverrides]?: Override<SharedProps>;
|
|
36
42
|
};
|
|
37
|
-
};
|
|
43
|
+
} & CommonProps;
|
|
44
|
+
export {};
|
package/esm/select/adaptor.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import type { OnChangeParams as BaseOnChangeParams } from 'baseui/select';
|
|
1
2
|
import { Component } from 'react';
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
import { Locale } from '../locale';
|
|
4
5
|
import { Overrides } from '../overrides';
|
|
5
6
|
import defaultProps from './default-props';
|
|
6
|
-
import { BaseSelectProps,
|
|
7
|
+
import { BaseSelectProps, Option, Options, Value } from './types';
|
|
7
8
|
declare class BaseSelect extends Component<BaseSelectProps & typeof defaultProps, {
|
|
8
9
|
selectAllSelected: boolean;
|
|
9
10
|
}> {
|
|
@@ -18,7 +19,10 @@ declare class BaseSelect extends Component<BaseSelectProps & typeof defaultProps
|
|
|
18
19
|
error: boolean;
|
|
19
20
|
positive: boolean;
|
|
20
21
|
escapeClearsValue: boolean;
|
|
21
|
-
filterOptions:
|
|
22
|
+
filterOptions: ((options: Value, filterValue: string, excludeOptions: Value | null | undefined, a: {
|
|
23
|
+
valueKey: string;
|
|
24
|
+
labelKey: string;
|
|
25
|
+
}) => Value) | null | undefined;
|
|
22
26
|
filterOutSelected: boolean;
|
|
23
27
|
isLoading: boolean;
|
|
24
28
|
labelKey: string;
|
|
@@ -33,31 +37,30 @@ declare class BaseSelect extends Component<BaseSelectProps & typeof defaultProps
|
|
|
33
37
|
onSelectResetsInput: boolean;
|
|
34
38
|
openOnClick: boolean;
|
|
35
39
|
startOpen: boolean;
|
|
36
|
-
options:
|
|
40
|
+
options: Options;
|
|
37
41
|
overrides: {};
|
|
38
42
|
required: boolean;
|
|
39
43
|
searchable: boolean;
|
|
40
|
-
size: import("./types").Size;
|
|
41
44
|
type: "overlay" | import("./types").Type | "mobile";
|
|
42
45
|
value: Value;
|
|
43
46
|
valueKey: string;
|
|
44
|
-
placement: "auto" | "bottom" | "left" | "right" | "top" | "topLeft" | "topRight" | "rightTop" | "rightBottom" | "
|
|
47
|
+
placement: "auto" | "bottom" | "left" | "right" | "top" | "topLeft" | "topRight" | "rightTop" | "rightBottom" | "bottomRight" | "bottomLeft" | "leftBottom" | "leftTop" | undefined;
|
|
48
|
+
virtual: boolean;
|
|
45
49
|
};
|
|
46
50
|
id: string;
|
|
47
51
|
menuId: string;
|
|
48
|
-
createdOptions:
|
|
52
|
+
createdOptions: Options | undefined;
|
|
49
53
|
shouldDisplaySelectAll: () => boolean;
|
|
50
|
-
getNormalizedOptions: (options?:
|
|
51
|
-
isSelectAllChecked: (value: Value, options?:
|
|
54
|
+
getNormalizedOptions: (options?: Options) => Value;
|
|
55
|
+
isSelectAllChecked: (value: Value, options?: Options) => boolean;
|
|
52
56
|
getSelectOverrides: () => Overrides<any>;
|
|
53
|
-
mergeOptions: (options1?:
|
|
54
|
-
getOptions: (locale: Locale, createdOptions:
|
|
55
|
-
getCreatedOptions: (option: Option) => Promise<
|
|
56
|
-
getCreatedValues: (options:
|
|
57
|
-
handleChange: (params:
|
|
57
|
+
mergeOptions: (options1?: Options, options2?: Options) => Options | undefined;
|
|
58
|
+
getOptions: (locale: Locale, createdOptions: Options | undefined, options?: Options) => Value;
|
|
59
|
+
getCreatedOptions: (option: Option) => Promise<Options>;
|
|
60
|
+
getCreatedValues: (options: Options) => Options;
|
|
61
|
+
handleChange: (params: BaseOnChangeParams) => Promise<void>;
|
|
58
62
|
handlePaste: (e: React.ClipboardEvent) => void;
|
|
59
|
-
inputRef: React.RefObject<HTMLInputElement
|
|
60
|
-
combinedInputRef: (refParam: BaseSelectProps['controlRef']) => (element: HTMLInputElement | HTMLDivElement) => void;
|
|
63
|
+
inputRef: React.RefObject<HTMLInputElement>;
|
|
61
64
|
render(): React.ReactElement;
|
|
62
65
|
}
|
|
63
66
|
export default BaseSelect;
|
|
@@ -18,7 +18,7 @@ import { typeAdaptor } from './adaptor';
|
|
|
18
18
|
import { STATE_CHANGE_TYPE } from './constants';
|
|
19
19
|
import defaultProps from './default-props';
|
|
20
20
|
import MultiValue from './multi-value';
|
|
21
|
-
import { getControlContainerStyles,
|
|
21
|
+
import { getControlContainerStyles, getSearchIconContainerStyles, getSearchIconStyles, getValueContainerStyles, getValueTypography, SelectArrow, } from './overrides';
|
|
22
22
|
import { getPlaceholderTypography } from '../input/styled-components';
|
|
23
23
|
import SelectMenuAdapter from './selectMenuAdapter';
|
|
24
24
|
import ClearIconButton from '../helpers/ClearIconButton';
|
|
@@ -46,7 +46,7 @@ var BaseSelect = /** @class */ (function (_super) {
|
|
|
46
46
|
_this.getSelectOverrides =
|
|
47
47
|
// FIXME: Remove use of any
|
|
48
48
|
function () {
|
|
49
|
-
var _a = _this.props, _b = _a.id, id = _b === void 0 ? _this.id : _b, valueKey = _a.valueKey, labelKey = _a.labelKey, value = _a.value, multi = _a.multi, overrides = _a.overrides, noResultsMsg = _a.noResultsMsg, options = _a.options, className = _a.className, style = _a.style, intent = _a.intent, size = _a.size, disabled = _a.disabled, captureScroll = _a.captureScroll, placement = _a.placement, popoverMinWidth = _a.popoverMinWidth, searchable = _a.searchable;
|
|
49
|
+
var _a = _this.props, _b = _a.id, id = _b === void 0 ? _this.id : _b, valueKey = _a.valueKey, labelKey = _a.labelKey, value = _a.value, multi = _a.multi, overrides = _a.overrides, noResultsMsg = _a.noResultsMsg, options = _a.options, className = _a.className, style = _a.style, intent = _a.intent, size = _a.size, disabled = _a.disabled, captureScroll = _a.captureScroll, placement = _a.placement, popoverMinWidth = _a.popoverMinWidth, searchable = _a.searchable, virtual = _a.virtual, ignoreBoundary = _a.ignoreBoundary;
|
|
50
50
|
return {
|
|
51
51
|
Root: {
|
|
52
52
|
style: [className, style],
|
|
@@ -65,6 +65,8 @@ var BaseSelect = /** @class */ (function (_super) {
|
|
|
65
65
|
selectAllSelected: _this.isSelectAllChecked(value, options),
|
|
66
66
|
noResultsMsg: noResultsMsg,
|
|
67
67
|
captureScroll: captureScroll,
|
|
68
|
+
virtual: virtual,
|
|
69
|
+
overscanCount: 20,
|
|
68
70
|
},
|
|
69
71
|
},
|
|
70
72
|
DropdownContainer: {
|
|
@@ -74,7 +76,8 @@ var BaseSelect = /** @class */ (function (_super) {
|
|
|
74
76
|
},
|
|
75
77
|
style: __assign(__assign({}, (popoverMinWidth ? { minWidth: popoverMinWidth } : {})), borderRadius('inherit')),
|
|
76
78
|
},
|
|
77
|
-
|
|
79
|
+
// aria-selected is applied on SelectMenuItem. No need to apply it on OptionContent
|
|
80
|
+
OptionContent: { style: { fontWeight: 'inherit' }, props: { 'aria-selected': undefined } },
|
|
78
81
|
ControlContainer: { style: getControlContainerStyles, props: add$props({ intent: intent, size: size, disabled: disabled }) },
|
|
79
82
|
ValueContainer: { style: getValueContainerStyles, props: add$props({ intent: intent, size: size, disabled: disabled }) },
|
|
80
83
|
MultiValue: { component: MultiValue, props: { selectSize: size } },
|
|
@@ -82,12 +85,10 @@ var BaseSelect = /** @class */ (function (_super) {
|
|
|
82
85
|
InputContainer: {
|
|
83
86
|
component: InputContainer,
|
|
84
87
|
props: { menuId: _this.menuId, size: size },
|
|
85
|
-
style: getValueTypography,
|
|
86
88
|
},
|
|
87
89
|
Input: {
|
|
88
90
|
component: Input,
|
|
89
91
|
props: { id: id, menuId: searchable ? _this.menuId : null, onPaste: _this.handlePaste },
|
|
90
|
-
style: getSelectInputStyles,
|
|
91
92
|
},
|
|
92
93
|
Placeholder: {
|
|
93
94
|
style: getPlaceholderTypography,
|
|
@@ -99,7 +100,13 @@ var BaseSelect = /** @class */ (function (_super) {
|
|
|
99
100
|
SearchIconContainer: { style: getSearchIconContainerStyles },
|
|
100
101
|
Popover: {
|
|
101
102
|
component: Popover,
|
|
102
|
-
props: {
|
|
103
|
+
props: {
|
|
104
|
+
placement: placement,
|
|
105
|
+
showArrow: false,
|
|
106
|
+
returnFocus: false,
|
|
107
|
+
overrides: { Body: { style: 'mt-2' } },
|
|
108
|
+
ignoreBoundary: ignoreBoundary,
|
|
109
|
+
},
|
|
103
110
|
},
|
|
104
111
|
LoadingIndicator: {
|
|
105
112
|
component: function () { return (_jsx(Loader, { size: 16, variant: "clip", className: "mx-1", overrides: {
|
|
@@ -111,6 +118,7 @@ var BaseSelect = /** @class */ (function (_super) {
|
|
|
111
118
|
};
|
|
112
119
|
};
|
|
113
120
|
_this.mergeOptions = function (options1, options2) {
|
|
121
|
+
var _a;
|
|
114
122
|
var mergedOptions = options1;
|
|
115
123
|
if (Array.isArray(options1)) {
|
|
116
124
|
if (Array.isArray(options2)) {
|
|
@@ -127,10 +135,10 @@ var BaseSelect = /** @class */ (function (_super) {
|
|
|
127
135
|
mergedOptions = __assign({}, options1);
|
|
128
136
|
if (Array.isArray(options2)) {
|
|
129
137
|
mergedOptions.__ungrouped = mergedOptions.__ungrouped
|
|
130
|
-
? mergedOptions.__ungrouped.concat(options2)
|
|
138
|
+
? (_a = mergedOptions.__ungrouped) === null || _a === void 0 ? void 0 : _a.concat(options2)
|
|
131
139
|
: options2;
|
|
132
140
|
}
|
|
133
|
-
else if (typeof options2 === 'object') {
|
|
141
|
+
else if (typeof options2 === 'object' && options2) {
|
|
134
142
|
Object.keys(options2).forEach(function (key) {
|
|
135
143
|
if (!mergedOptions) {
|
|
136
144
|
return;
|
|
@@ -218,7 +226,7 @@ var BaseSelect = /** @class */ (function (_super) {
|
|
|
218
226
|
newCreatedValues = this.getCreatedValues(newCreatedOptions);
|
|
219
227
|
mergedValue = this.mergeOptions(value, newCreatedValues);
|
|
220
228
|
onChange({
|
|
221
|
-
option: __assign(__assign({}, newCreatedOptions[0]), { isCreatable: true }),
|
|
229
|
+
option: __assign(__assign({}, newCreatedOptions === null || newCreatedOptions === void 0 ? void 0 : newCreatedOptions[0]), { isCreatable: true }),
|
|
222
230
|
type: STATE_CHANGE_TYPE.select,
|
|
223
231
|
value: this.getNormalizedOptions(mergedValue),
|
|
224
232
|
});
|
|
@@ -240,15 +248,12 @@ var BaseSelect = /** @class */ (function (_super) {
|
|
|
240
248
|
onChange({ type: STATE_CHANGE_TYPE.select, value: _this.getNormalizedOptions(mergedValue) });
|
|
241
249
|
};
|
|
242
250
|
_this.inputRef = React.createRef();
|
|
243
|
-
_this.combinedInputRef = memoizeOne(function (refParam) {
|
|
244
|
-
return combineRefs(_this.inputRef, refParam);
|
|
245
|
-
});
|
|
246
251
|
return _this;
|
|
247
252
|
}
|
|
248
253
|
BaseSelect.prototype.render = function () {
|
|
249
254
|
var _this = this;
|
|
250
|
-
var _a = this.props, options = _a.options, selectOverrides = _a.overrides, type = _a.type, controlRef = _a.controlRef;
|
|
251
|
-
return (_jsx(LocaleConsumer, { children: function (locale) { return (_jsx(SpaceStyleConsumer, { children: function (utils) { return (_jsx(StyledSelect, __assign({}, _omit(_this.props, 'size'), { overrides: mergeAndConvertOverrides(_this.getSelectOverrides(), selectOverrides, utils), controlRef: _this.
|
|
255
|
+
var _a = this.props, options = _a.options, selectOverrides = _a.overrides, type = _a.type, controlRef = _a.controlRef, inputRef = _a.inputRef;
|
|
256
|
+
return (_jsx(LocaleConsumer, { children: function (locale) { return (_jsx(SpaceStyleConsumer, { children: function (utils) { return (_jsx(StyledSelect, __assign({}, _omit(_this.props, 'size'), { overrides: mergeAndConvertOverrides(_this.getSelectOverrides(), selectOverrides, utils), controlRef: controlRef, inputRef: combineRefs(_this.inputRef, inputRef), options: _this.getOptions(locale, _this.createdOptions, options), onChange: _this.handleChange, type: typeAdaptor[type] }), void 0)); } }, void 0)); } }, void 0));
|
|
252
257
|
};
|
|
253
258
|
BaseSelect.defaultProps = defaultProps;
|
|
254
259
|
return BaseSelect;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Options, Value, Type } from './types';
|
|
2
2
|
declare const defaultProps: {
|
|
3
3
|
autoFocus: boolean;
|
|
4
4
|
backspaceRemoves: boolean;
|
|
@@ -10,7 +10,10 @@ declare const defaultProps: {
|
|
|
10
10
|
error: boolean;
|
|
11
11
|
positive: boolean;
|
|
12
12
|
escapeClearsValue: boolean;
|
|
13
|
-
filterOptions:
|
|
13
|
+
filterOptions: ((options: Value, filterValue: string, excludeOptions: Value | null | undefined, a: {
|
|
14
|
+
valueKey: string;
|
|
15
|
+
labelKey: string;
|
|
16
|
+
}) => Value) | null | undefined;
|
|
14
17
|
filterOutSelected: boolean;
|
|
15
18
|
isLoading: boolean;
|
|
16
19
|
labelKey: string;
|
|
@@ -25,14 +28,14 @@ declare const defaultProps: {
|
|
|
25
28
|
onSelectResetsInput: boolean;
|
|
26
29
|
openOnClick: boolean;
|
|
27
30
|
startOpen: boolean;
|
|
28
|
-
options:
|
|
31
|
+
options: Options;
|
|
29
32
|
overrides: {};
|
|
30
33
|
required: boolean;
|
|
31
34
|
searchable: boolean;
|
|
32
|
-
size: Size;
|
|
33
35
|
type: "overlay" | Type | "mobile";
|
|
34
36
|
value: Value;
|
|
35
37
|
valueKey: string;
|
|
36
|
-
placement: "auto" | "bottom" | "left" | "right" | "top" | "topLeft" | "topRight" | "rightTop" | "rightBottom" | "
|
|
38
|
+
placement: "auto" | "bottom" | "left" | "right" | "top" | "topLeft" | "topRight" | "rightTop" | "rightBottom" | "bottomRight" | "bottomLeft" | "leftBottom" | "leftTop" | undefined;
|
|
39
|
+
virtual: boolean;
|
|
37
40
|
};
|
|
38
41
|
export default defaultProps;
|
package/esm/select/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export type { Option, Value,
|
|
1
|
+
export type { Option, Value, Options, Optgroups, StateReducer, OnChangeParams, ControlRef, ImperativeMethods, SelectProps, AutosizeInputProps, DropdownProps, StatefulSelectProps, StatefulContainerProps, SelectActions, SelectState, AutosizeInputState, StatefulContainerState, } from './types';
|
|
2
2
|
export { SELECT_ALL_ID } from './types';
|
|
3
3
|
export type { SelectLocale } from './locale';
|
|
4
4
|
export { STATE_CHANGE_TYPE } from './constants';
|
|
5
|
-
export { StyledRoot, StyledClearIcon, StyledControlContainer, StyledDropdownContainer, StyledIconsContainer, StyledInput, StyledInputContainer, StyledInputSizer, StyledPlaceholder,
|
|
5
|
+
export { StyledRoot, StyledClearIcon, StyledControlContainer, StyledDropdownContainer, StyledIconsContainer, StyledInput, StyledInputContainer, StyledInputSizer, StyledPlaceholder, StyledSearchIconContainer, StyledSelectArrow, StyledSingleValue, StyledValueContainer, NoResults, StyledOverlayContentContainer, } from './styled-component';
|
|
6
6
|
export type { StyledSelect } from './styled-component';
|
|
7
7
|
export { default as Select } from './select';
|
|
8
8
|
export { default as StatefulSelect } from './stateful-select';
|