asma-ui-core 3.44.0 → 3.45.1
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/dist/asma-ui-core.css +1 -1
- package/dist/components/custom/module/header-layout/ToolbarActionGroup.js +2 -2
- package/dist/components/custom/module/module-title/StyledModuleTitle.module.js +1 -1
- package/dist/components/custom/widget/widget/StyledWidget.module.js +8 -8
- package/dist/components/custom/widget/widget-title/StyledWidgetTitle.module.js +1 -1
- package/dist/components/data-display/ai-disclosure/StyledAIDisclosure.js +7 -5
- package/dist/components/data-display/badge/StyledBadge.js +53 -23
- package/dist/components/data-display/chip/StyledChip.js +62 -59
- package/dist/components/data-display/chip/chipPadding.js +44 -0
- package/dist/components/data-display/form-label/components/StyledFormLabel.js +18 -10
- package/dist/components/data-display/form-label/styles/StyledFormLabel.module.js +4 -4
- package/dist/components/data-display/interactive-chip/StyledInteractiveChip.js +35 -39
- package/dist/components/data-display/interactive-chip/StyledInteractiveChip.module.js +4 -0
- package/dist/components/data-display/tooltip/StyledTooltip.js +51 -33
- package/dist/components/data-display/typography/StyledTypography.js +62 -4
- package/dist/components/feedback/dialog/StyledDialog.js +102 -39
- package/dist/components/feedback/dialog/StyledDialog.module.js +2 -9
- package/dist/components/feedback/dialog/StyledDialogActions.js +16 -16
- package/dist/components/feedback/dialog/StyledDialogContent.js +18 -14
- package/dist/components/feedback/dialog/StyledDialogTitle.js +18 -13
- package/dist/components/feedback/empty-page/StyledEmptyPage.js +4 -4
- package/dist/components/feedback/filtered-empty-state/StyledFilteredEmptyState.js +7 -7
- package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +123 -114
- package/dist/components/feedback/minimizable-dialog/components/CloseBtn.js +6 -5
- package/dist/components/feedback/minimizable-dialog/components/FullscreenBtn.js +13 -12
- package/dist/components/feedback/minimizable-dialog/components/MinimizeBtn.js +15 -13
- package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +67 -61
- package/dist/components/feedback/snack-bar/StyledAlert.js +95 -14
- package/dist/components/feedback/snack-bar/StyledSnackbar.js +34 -8
- package/dist/components/feedback/snack-bar/components/StyledDefaultSnackbar.js +32 -33
- package/dist/components/feedback/snack-bar/components/StyledDefaultSnackbar.module.js +16 -16
- package/dist/components/icons/check-icon/CheckIcon.js +8 -7
- package/dist/components/inputs/button/StyledButton.js +22 -18
- package/dist/components/inputs/button/StyledButton.module.js +5 -5
- package/dist/components/inputs/checkbox/base-ui/StyledCheckbox.js +61 -55
- package/dist/components/inputs/checkbox/base-ui/StyledCheckbox.module.js +12 -11
- package/dist/components/inputs/dynamic-select/components/DynamicInteractiveChipGroup.js +54 -50
- package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +107 -99
- package/dist/components/inputs/field-styles.js +8 -0
- package/dist/components/inputs/input-field/StyledInputField.js +188 -83
- package/dist/components/inputs/input-field/StyledInputField.module.js +10 -0
- package/dist/components/inputs/label/StyledLabel.js +19 -11
- package/dist/components/inputs/label/StyledLabel.module.js +1 -1
- package/dist/components/inputs/radio-button/base-ui/RadioGroupContext.js +6 -0
- package/dist/components/inputs/radio-button/base-ui/StyledRadio.js +43 -28
- package/dist/components/inputs/radio-button/base-ui/StyledRadio.module.js +7 -6
- package/dist/components/inputs/radio-button/base-ui/StyledRadioGroup.js +37 -24
- package/dist/components/inputs/search-field/StyledSearchField.js +49 -43
- package/dist/components/inputs/select/StyledSelect.js +170 -45
- package/dist/components/inputs/select/StyledSelectItem.js +19 -23
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +228 -150
- package/dist/components/inputs/slider/StyledSlider.js +100 -52
- package/dist/components/inputs/slider/StyledSlider.module.js +10 -0
- package/dist/components/inputs/switch/base-ui/StyledSwitch.js +45 -38
- package/dist/components/inputs/switch/base-ui/StyledSwitch.module.js +4 -4
- package/dist/components/inputs/textarea/StyledTextarea.js +44 -43
- package/dist/components/inputs/textarea/StyledTextarea.module.js +1 -1
- package/dist/components/miscellaneous/FormControlContext.js +6 -0
- package/dist/components/miscellaneous/StyledFormControl.js +42 -21
- package/dist/components/miscellaneous/StyledFormControlLabel.js +29 -15
- package/dist/components/miscellaneous/StyledFormGroup.js +16 -4
- package/dist/components/miscellaneous/StyledFormHelperText.js +12 -4
- package/dist/components/miscellaneous/StyledInputLabel.js +20 -4
- package/dist/components/mui-compat/Avatar.js +34 -0
- package/dist/components/mui-compat/ClickAwayListener.js +42 -0
- package/dist/components/mui-compat/Container.js +24 -0
- package/dist/components/mui-compat/Fade.js +29 -0
- package/dist/components/mui-compat/Fade.module.js +9 -0
- package/dist/components/mui-compat/FormLabel.js +22 -0
- package/dist/components/mui-compat/Paper.js +44 -0
- package/dist/components/mui-compat/Popper.js +35 -0
- package/dist/components/mui-compat/Skeleton.js +27 -0
- package/dist/components/mui-compat/Stack.js +24 -0
- package/dist/components/navigation/drawer/StyledDrawer.js +45 -4
- package/dist/components/navigation/link/StyledLink.module.js +5 -5
- package/dist/components/navigation/listbox/Listbox.js +7 -7
- package/dist/components/navigation/menu/StyledMenu.js +28 -11
- package/dist/components/navigation/menu/StyledMenuItem.js +21 -19
- package/dist/components/navigation/menu/StyledMenuList.js +34 -4
- package/dist/components/navigation/tabs/StyledTab.js +28 -13
- package/dist/components/navigation/tabs/StyledTabs.js +115 -66
- package/dist/components/navigation/tabs/TabsContext.js +6 -0
- package/dist/components/utils/accordion/base-ui/AccordionContext.js +10 -0
- package/dist/components/utils/accordion/base-ui/StyledAccordion.js +28 -21
- package/dist/components/utils/accordion/base-ui/StyledAccordion.module.js +7 -7
- package/dist/components/utils/accordion/base-ui/StyledAccordionDetails.js +28 -14
- package/dist/components/utils/accordion/base-ui/StyledAccordionSummary.js +34 -27
- package/dist/components/utils/copy-wrapper/CopyButton.js +8 -7
- package/dist/components/utils/copy-wrapper/CopyWrapper.js +23 -20
- package/dist/components/utils/filter-menu/StyledFilterButton.js +14 -13
- package/dist/components/utils/filter-menu/StyledFilterMenu.js +16 -15
- package/dist/components/utils/popover/StyledPopover.js +51 -15
- package/dist/components/utils/virtual-list/VirtualList.js +46 -0
- package/dist/datetime/components/date-picker/StyledDatePicker.js +17 -17
- package/dist/datetime/components/date-picker/components/BaseDatePickerInput.js +98 -99
- package/dist/datetime/components/date-picker/components/DatePickerButton.js +11 -9
- package/dist/datetime/components/date-picker/components/StyledCalendarPicker.js +11 -11
- package/dist/datetime/components/date-picker/components/StyledCalendarPicker.module.js +20 -20
- package/dist/datetime/components/date-picker/components/StyledCalendarPickerCaption.js +8 -7
- package/dist/datetime/components/date-picker/components/StyledCalendarPickerFooter.js +13 -14
- package/dist/datetime/components/date-picker/components/StyledCalendarPickerSelectMonth.js +17 -24
- package/dist/datetime/components/date-picker/components/StyledCalendarPickerSelectYear.js +7 -8
- package/dist/datetime/components/date-picker/components/StyledDayPicker.js +4 -5
- package/dist/datetime/components/date-picker/helpers.js +7 -7
- package/dist/datetime/components/date-picker/hooks/useDatePickerMask.js +3 -7
- package/dist/datetime/components/time-picker/StyledTimePicker.js +25 -25
- package/dist/datetime/components/time-picker/StyledTimePicker.module.js +6 -6
- package/dist/datetime/components/time-picker/TimePickerInput.js +56 -50
- package/dist/datetime/components/time-picker/TimePickerPopper.js +22 -19
- package/dist/datetime/components/time-picker/components/TimePickerColumn.js +12 -12
- package/dist/datetime/components/time-picker/helpers/getTimeFromValue.js +3 -3
- package/dist/datetime/helpers/cn.js +4 -5
- package/dist/datetime/hooks/useWindowWidthSize.hook.js +1 -1
- package/dist/helpers/arrays.js +4 -0
- package/dist/helpers/classOverride.js +12 -0
- package/dist/helpers/cn.js +4 -5
- package/dist/helpers/inputMask.js +58 -0
- package/dist/helpers/sx.js +46 -0
- package/dist/hooks/useFocusTrap.hook.js +34 -0
- package/dist/hooks/useTopLayer.hook.js +25 -0
- package/dist/index.js +185 -175
- package/dist/src/api-surface.test.d.ts +1 -0
- package/dist/src/components/custom/module/header-layout/DynamicToolbar.d.ts +10 -0
- package/dist/src/components/custom/module/header-layout/DynamicToolbarLayoutContext.d.ts +1 -1
- package/dist/src/components/custom/module/module-title/StyledModuleTitle.d.ts +4 -0
- package/dist/src/components/custom/widget/widget/StyledWidget.d.ts +8 -0
- package/dist/src/components/custom/widget/widget-header/StyledWidgetHeader.d.ts +4 -0
- package/dist/src/components/custom/widget/widget-title/StyledWidgetTitle.d.ts +7 -3
- package/dist/src/components/data-display/ai-disclosure/StyledAIDisclosure.d.ts +7 -0
- package/dist/src/components/data-display/badge/StyledBadge.d.ts +40 -2
- package/dist/src/components/data-display/chip/StyledChip.d.ts +74 -5
- package/dist/src/components/data-display/chip/chipPadding.d.ts +3 -0
- package/dist/src/components/data-display/form-label/types.d.ts +11 -0
- package/dist/src/components/data-display/interactive-chip/StyledInteractiveChip.d.ts +22 -4
- package/dist/src/components/data-display/tooltip/StyledTooltip.d.ts +43 -1
- package/dist/src/components/data-display/typography/StyledTypography.d.ts +32 -1
- package/dist/src/components/feedback/dialog/StyledDialog.d.ts +60 -4
- package/dist/src/components/feedback/dialog/StyledDialogActions.d.ts +12 -2
- package/dist/src/components/feedback/dialog/StyledDialogContent.d.ts +12 -2
- package/dist/src/components/feedback/dialog/StyledDialogTitle.d.ts +10 -2
- package/dist/src/components/feedback/empty-page/StyledEmptyPage.d.ts +6 -0
- package/dist/src/components/feedback/filtered-empty-state/StyledFilteredEmptyState.d.ts +7 -0
- package/dist/src/components/feedback/loading/StyledLoading.d.ts +9 -0
- package/dist/src/components/feedback/minimizable-dialog/v2/types.d.ts +13 -0
- package/dist/src/components/feedback/minimizable-dialog/v2/useControlledProps.d.ts +4 -2
- package/dist/src/components/feedback/minimizable-dialog/v2/useTranslations.d.ts +17 -12
- package/dist/src/components/feedback/snack-bar/SnackbarProvider.d.ts +1 -1
- package/dist/src/components/feedback/snack-bar/StyledAlert.d.ts +41 -2
- package/dist/src/components/feedback/snack-bar/StyledAlertSnackbar.d.ts +2 -2
- package/dist/src/components/feedback/snack-bar/StyledSnackbar.d.ts +25 -2
- package/dist/src/components/feedback/snack-bar/components/StyledDefaultSnackbar.d.ts +11 -2
- package/dist/src/components/feedback/snack-bar/components/StyledInfoSnackbar.d.ts +2 -2
- package/dist/src/components/feedback/snack-bar/components/types.d.ts +1 -1
- package/dist/src/components/inputs/button/StyledButton.d.ts +15 -1
- package/dist/src/components/inputs/checkbox/base-ui/StyledCheckbox.d.ts +33 -4
- package/dist/src/components/inputs/dynamic-select/StyledDynamicSelect.d.ts +16 -0
- package/dist/src/components/inputs/dynamic-select/types.d.ts +25 -14
- package/dist/src/components/inputs/field-styles.d.ts +27 -0
- package/dist/src/components/inputs/input-field/StyledInputField.d.ts +85 -10
- package/dist/src/components/inputs/input-field/index.d.ts +1 -1
- package/dist/src/components/inputs/label/StyledLabel.d.ts +13 -0
- package/dist/src/components/inputs/radio-button/base-ui/RadioGroupContext.d.ts +10 -0
- package/dist/src/components/inputs/radio-button/base-ui/StyledRadio.d.ts +60 -5
- package/dist/src/components/inputs/radio-button/base-ui/StyledRadioGroup.d.ts +30 -7
- package/dist/src/components/inputs/search-field/StyledSearchField.d.ts +9 -1
- package/dist/src/components/inputs/select/StyledSelect.d.ts +70 -16
- package/dist/src/components/inputs/select/StyledSelectItem.d.ts +14 -2
- package/dist/src/components/inputs/select/index.d.ts +0 -1
- package/dist/src/components/inputs/select-autocomplete/StyledSelectAutocomplete.d.ts +120 -17
- package/dist/src/components/inputs/slider/StyledSlider.d.ts +66 -3
- package/dist/src/components/inputs/switch/base-ui/StyledSwitch.d.ts +44 -4
- package/dist/src/components/inputs/textarea/StyledTextarea.d.ts +19 -0
- package/dist/src/components/miscellaneous/FormControlContext.d.ts +14 -0
- package/dist/src/components/miscellaneous/StyledFormControl.d.ts +27 -2
- package/dist/src/components/miscellaneous/StyledFormControlLabel.d.ts +21 -2
- package/dist/src/components/miscellaneous/StyledFormGroup.d.ts +11 -2
- package/dist/src/components/miscellaneous/StyledFormHelperText.d.ts +12 -2
- package/dist/src/components/miscellaneous/StyledInputLabel.d.ts +20 -2
- package/dist/src/components/mui-compat/Avatar.d.ts +6 -0
- package/dist/src/components/mui-compat/ClickAwayListener.d.ts +19 -0
- package/dist/src/components/mui-compat/Container.d.ts +6 -0
- package/dist/src/components/mui-compat/Fade.d.ts +21 -0
- package/dist/src/components/mui-compat/FormLabel.d.ts +6 -0
- package/dist/src/components/mui-compat/Paper.d.ts +6 -0
- package/dist/src/components/mui-compat/Popper.d.ts +29 -0
- package/dist/src/components/mui-compat/Skeleton.d.ts +7 -0
- package/dist/src/components/mui-compat/Stack.d.ts +7 -0
- package/dist/src/components/mui-compat/index.d.ts +9 -0
- package/dist/src/components/mui-compat/types.d.ts +46 -0
- package/dist/src/components/navigation/drawer/StyledDrawer.d.ts +33 -2
- package/dist/src/components/navigation/link/StyledLink.d.ts +13 -0
- package/dist/src/components/navigation/menu/StyledMenu.d.ts +33 -2
- package/dist/src/components/navigation/menu/StyledMenuItem.d.ts +35 -2
- package/dist/src/components/navigation/menu/StyledMenuList.d.ts +16 -2
- package/dist/src/components/navigation/menu/index.d.ts +0 -1
- package/dist/src/components/navigation/tabs/StyledTab.d.ts +27 -3
- package/dist/src/components/navigation/tabs/StyledTabs.d.ts +22 -7
- package/dist/src/components/navigation/tabs/TabsContext.d.ts +11 -0
- package/dist/src/components/utils/accordion/base-ui/AccordionContext.d.ts +10 -0
- package/dist/src/components/utils/accordion/base-ui/StyledAccordion.d.ts +9 -3
- package/dist/src/components/utils/accordion/base-ui/StyledAccordionDetails.d.ts +5 -0
- package/dist/src/components/utils/accordion/base-ui/StyledAccordionSummary.d.ts +16 -4
- package/dist/src/components/utils/copy-wrapper/CopyWrapper.d.ts +6 -1
- package/dist/src/components/utils/filter-menu/StyledFilterButton.d.ts +4 -0
- package/dist/src/components/utils/filter-menu/StyledFilterMenu.d.ts +8 -2
- package/dist/src/components/utils/popover/StyledPopover.d.ts +39 -2
- package/dist/src/components/utils/virtual-list/VirtualList.d.ts +32 -0
- package/dist/src/components/utils/virtual-list/index.d.ts +1 -0
- package/dist/src/datetime/components/date-picker/StyledDatePicker.d.ts +11 -0
- package/dist/src/datetime/components/date-picker/components/DatePickerButton.d.ts +2 -0
- package/dist/src/datetime/components/date-picker/components/StyledCalendarPicker.d.ts +1 -1
- package/dist/src/datetime/components/date-picker/components/StyledDayPicker.d.ts +1 -1
- package/dist/src/datetime/components/date-picker/hooks/useDatePickerMask.d.ts +1 -2
- package/dist/src/datetime/components/date-picker/hooks/useDatePickerValidation.d.ts +7 -5
- package/dist/src/datetime/components/time-picker/StyledTimePicker.d.ts +10 -0
- package/dist/src/datetime/components/time-picker/TimePickerInput.d.ts +1 -1
- package/dist/src/datetime/components/time-picker/TimePickerPopper.d.ts +1 -1
- package/dist/src/datetime/components/time-picker/types.d.ts +1 -2
- package/dist/src/datetime/hooks/useToggleMenuVisibility.hook.d.ts +6 -4
- package/dist/src/datetime/shared-components/StyledFormControl.d.ts +1 -2
- package/dist/src/datetime/shared-components/StyledInputField.d.ts +1 -12
- package/dist/src/datetime/shared-components/StyledSelect.d.ts +1 -16
- package/dist/src/datetime/shared-components/StyledSelectItem.d.ts +1 -2
- package/dist/src/datetime/shared-components/StyledTooltip.d.ts +1 -2
- package/dist/src/helpers/applyImportantPadding.d.ts +8 -0
- package/dist/src/helpers/arrays.d.ts +2 -0
- package/dist/src/helpers/arrays.test.d.ts +1 -0
- package/dist/src/helpers/classOverride.d.ts +21 -0
- package/dist/src/helpers/classOverride.test.d.ts +1 -0
- package/dist/src/helpers/inputMask.d.ts +40 -0
- package/dist/src/helpers/inputMask.test.d.ts +1 -0
- package/dist/src/helpers/sx.d.ts +2 -0
- package/dist/src/helpers/sx.test.d.ts +1 -0
- package/dist/src/hooks/useFocusTrap.hook.d.ts +10 -0
- package/dist/src/hooks/useTopLayer.hook.d.ts +49 -0
- package/dist/src/index.d.ts +2 -1
- package/dist/src/table/components/TableSkeleton.d.ts +1 -1
- package/dist/src/table/components/columns/helpers/useElementHeightPx.d.ts +6 -3
- package/dist/src/table/components/columns/helpers/useProxyHorizontalScrollSync.d.ts +9 -6
- package/dist/src/table/hooks/useToggleMenuVisibility.hook.d.ts +6 -4
- package/dist/src/table/hooks/useTranslations.d.ts +15 -8
- package/dist/src/table/shared-components/StyledCheckbox.d.ts +7 -4
- package/dist/src/table/shared-components/StyledMenuItem.d.ts +18 -2
- package/dist/src/table/shared-components/menu-item/index.d.ts +13 -2
- package/dist/src/table/shared-components/tooltip/index.d.ts +5 -1
- package/dist/src/table/types.d.ts +1 -1
- package/dist/table/components/Fetching.js +4 -4
- package/dist/table/components/StyledTable.module.js +48 -48
- package/dist/table/components/TableRow.js +7 -7
- package/dist/table/components/TableSkeleton.js +6 -6
- package/dist/table/components/columns/action-column/actionColumn.js +14 -11
- package/dist/table/components/columns/action-column/components/HeaderActionMenu.js +52 -49
- package/dist/table/components/columns/action-column/components/RowActionMenu.js +40 -36
- package/dist/table/components/columns/expandColumn.js +12 -9
- package/dist/table/components/table-footer/TablePagination.js +28 -25
- package/dist/table/components/table-footer/TableRowCountSelect.js +31 -28
- package/dist/table/components/table-header/TableHeaderCell.js +54 -45
- package/dist/table/custom-features/focus-rows/FocusRowsFeature.js +29 -25
- package/dist/table/helpers/cn.js +4 -5
- package/dist/table/hooks/useColumnVirtualizer.js +1 -1
- package/dist/table/hooks/usePersistedPageSize.js +6 -6
- package/dist/table/hooks/useTranslations.js +6 -4
- package/dist/table/hooks/useWindowWidthSize.hook.js +1 -1
- package/dist/table/shared-components/StyledCheckbox.js +54 -55
- package/dist/table/shared-components/StyledCheckbox.module.js +9 -9
- package/dist/table/shared-components/StyledMenuItem.js +14 -17
- package/dist/table/shared-components/button/StyledButton.module.js +8 -8
- package/dist/table/shared-components/menu-item/index.js +15 -16
- package/dist/table/shared-components/tooltip/index.js +4 -23
- package/package.json +9 -18
- package/src/styles/components-colors/inputVariables.css +59 -57
- package/src/styles/index.css +38 -0
- package/dist/components/feedback/dialog/StyledDialogActions.module.js +0 -8
- package/dist/components/feedback/dialog/StyledDialogContent.module.js +0 -4
- package/dist/components/feedback/dialog/StyledDialogTitle.module.js +0 -4
- package/dist/components/icons/arrow-expand/ArrowExpand.js +0 -18
- package/dist/components/icons/arrow-expand/index.js +0 -1
- package/dist/components/icons/arrow-shrink/ArrowShrink.js +0 -18
- package/dist/components/icons/arrow-shrink/index.js +0 -1
- package/dist/components/inputs/checkbox/StyledCheckbox.js +0 -20
- package/dist/components/inputs/radio-button/StyledRadio.js +0 -17
- package/dist/datetime/components/date-picker/components/HelperTextWithTooltip.js +0 -39
- package/dist/datetime/shared-components/ExpandIcon.js +0 -18
- package/dist/datetime/shared-components/StyledFormControl.js +0 -23
- package/dist/datetime/shared-components/StyledInputField.js +0 -47
- package/dist/datetime/shared-components/StyledSelect.js +0 -47
- package/dist/datetime/shared-components/StyledSelectItem.js +0 -13
- package/dist/datetime/shared-components/StyledTooltip.js +0 -32
- package/dist/src/components/icons/arrow-expand/ArrowExpand.d.ts +0 -2
- package/dist/src/components/icons/arrow-expand/index.d.ts +0 -1
- package/dist/src/components/icons/arrow-shrink/ArrowShrink.d.ts +0 -2
- package/dist/src/components/icons/arrow-shrink/index.d.ts +0 -1
- package/dist/src/components/inputs/checkbox/StyledCheckbox.d.ts +0 -4
- package/dist/src/components/inputs/radio-button/StyledRadio.d.ts +0 -4
- package/dist/src/components/inputs/radio-button/StyledRadioGroup.d.ts +0 -4
- package/dist/src/components/inputs/switch/StyledSwitch.d.ts +0 -5
- package/dist/src/components/utils/accordion/StyledAccordion.d.ts +0 -2
- package/dist/src/components/utils/accordion/StyledAccordionDetails.d.ts +0 -2
- package/dist/src/components/utils/accordion/StyledAccordionSummary.d.ts +0 -8
- package/dist/src/datetime/components/date-picker/components/HelperTextWithTooltip.d.ts +0 -5
|
@@ -1,162 +1,240 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { ChevronDownIcon as
|
|
3
|
-
import { CloseIcon as
|
|
4
|
-
import { CheckIcon as
|
|
5
|
-
import { PlusIconCircle as
|
|
6
|
-
import { StyledChip as
|
|
7
|
-
import { StyledCheckbox as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import { jsx as
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const e =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
1
|
+
import { cn as P } from "../../../helpers/cn.js";
|
|
2
|
+
import { ChevronDownIcon as Ue } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
|
|
3
|
+
import { CloseIcon as He } from "../../icons/close-icon/CloseIcon.js";
|
|
4
|
+
import { CheckIcon as Te } from "../../icons/check-icon/CheckIcon.js";
|
|
5
|
+
import { PlusIconCircle as Ve } from "../../icons/plus-icon-circle/PlusIconCircle.js";
|
|
6
|
+
import { StyledChip as Ye } from "../../data-display/chip/StyledChip.js";
|
|
7
|
+
import { StyledCheckbox as O } from "../checkbox/base-ui/StyledCheckbox.js";
|
|
8
|
+
import { TOP_LAYER_PROPS as Oe, TOP_LAYER_RESET_STYLE as Be, getOpenModalDialogAncestor as qe, useTopLayerRef as Ge } from "../../../hooks/useTopLayer.hook.js";
|
|
9
|
+
import { LoadingIcon as Je } from "../../../table/shared-components/LoadingIcon.js";
|
|
10
|
+
import B from "./StyledSelectAutocomplete.module.js";
|
|
11
|
+
import { useMemo as M, useRef as q, useState as w } from "react";
|
|
12
|
+
import { jsx as s, jsxs as y } from "react/jsx-runtime";
|
|
13
|
+
import { FloatingPortal as Qe, autoUpdate as Xe, flip as Ze, offset as Ke, shift as et, size as tt, useDismiss as rt, useFloating as lt, useInteractions as st, useMergeRefs as G, useRole as ot } from "@floating-ui/react";
|
|
14
|
+
var at = (l) => typeof l == "object" && l !== null && "label" in l ? String(l.label) : String(l), J = (l) => typeof l == "object" && l !== null && "disabled" in l && !!l.disabled;
|
|
15
|
+
function yt({ dataTest: l, options: p, renderInput: Q, value: v, onChange: N, getOptionLabel: X, getOptionKey: D, isOptionEqualToValue: L, renderOption: _, renderValue: j, filterOptions: I, loading: E, loadingText: Z = "Loading…", noOptionsText: K = "No options", disabled: R, readOnly: m, size: ee = "small", disableClearable: te, disableCloseOnSelect: re, popupIcon: le, autoHeight: se, multiple: oe, allowSelectAll: ae, selectAllLabel: z = "Select all", fullWidth: ne, classes: ce, inputValue: F, onInputChange: ie, open: W, onOpen: de, onClose: ue, className: pe, wrapperClassName: me, getOptionDisabled: fe, slotProps: U }) {
|
|
16
|
+
const o = oe === !0, n = X ?? at, S = (e, t) => L ? L(e, t) : e === t, [he, ge] = w(!1), a = W ?? he, f = (e) => {
|
|
17
|
+
e && (m || R) || (W === void 0 && ge(e), e ? de?.() : ue?.());
|
|
18
|
+
}, [be, xe] = w(""), h = F ?? be, C = (e, t, r) => {
|
|
19
|
+
F === void 0 && xe(t), ie?.(e, t, r);
|
|
20
|
+
}, [g, $] = w(null), we = q([]), H = q(null), [ye, ve] = w(null), [Ne, De] = w(null), c = o ? Array.isArray(v) ? v : [] : [], b = o ? null : v ?? null, T = (e) => o ? c.some((t) => S(e, t)) : b !== null && S(e, b), V = M(() => {
|
|
21
|
+
const e = [...p];
|
|
22
|
+
if (I) return I(e, { inputValue: h });
|
|
23
|
+
const t = !o && b !== null ? n(b).toLowerCase() : null;
|
|
24
|
+
if (!h || h.toLowerCase() === t) return e;
|
|
25
|
+
const r = h.toLowerCase();
|
|
26
|
+
return e.filter((d) => n(d).toLowerCase().includes(r));
|
|
27
|
+
}, [
|
|
28
|
+
p,
|
|
29
|
+
h,
|
|
30
|
+
I,
|
|
31
|
+
v
|
|
32
|
+
]), i = M(() => V.slice(0, 100), [V]), { refs: A, floatingStyles: Re, context: Y } = lt({
|
|
33
|
+
open: a,
|
|
34
|
+
onOpenChange: f,
|
|
35
|
+
placement: "bottom-start",
|
|
36
|
+
strategy: "fixed",
|
|
37
|
+
whileElementsMounted: Xe,
|
|
38
|
+
middleware: [
|
|
39
|
+
Ke(4),
|
|
40
|
+
Ze({ padding: 8 }),
|
|
41
|
+
et({ padding: 8 }),
|
|
42
|
+
tt({ apply({ rects: e, availableHeight: t }) {
|
|
43
|
+
ve(e.reference.width), De(se ? t - 8 : Math.min(t - 8, 320));
|
|
44
|
+
} })
|
|
45
|
+
]
|
|
46
|
+
}), { getReferenceProps: Se, getFloatingProps: Ce, getItemProps: Ae } = st([rt(Y), ot(Y, { role: "listbox" })]), Pe = G([A.setReference]), Ie = G([Ge(A.setFloating)]), $e = M(() => a ? qe(A.reference.current) : void 0, [a, A]), k = (e, t) => {
|
|
47
|
+
if (o) {
|
|
48
|
+
const r = c.some((u) => S(t, u)), d = r ? c.filter((u) => !S(t, u)) : [...c, t];
|
|
49
|
+
N?.(e, d, r ? "removeOption" : "selectOption", { option: t }), C(e, "", "reset"), re || f(!1);
|
|
50
|
+
} else
|
|
51
|
+
N?.(e, t, "selectOption", { option: t }), C(e, n(t), "reset"), f(!1);
|
|
52
|
+
}, ke = (e) => {
|
|
53
|
+
N?.(e, o ? [] : null, "clear", void 0), C(e, "", "clear");
|
|
54
|
+
}, Me = (e) => {
|
|
55
|
+
if (e.key === "Enter" && a && g != null && i[g] != null) {
|
|
56
|
+
e.preventDefault();
|
|
57
|
+
const t = i[g];
|
|
58
|
+
J(t) || k(e, t);
|
|
59
|
+
} else if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
60
|
+
if (e.preventDefault(), !a) {
|
|
61
|
+
$(null), f(!0);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (i.length === 0) return;
|
|
65
|
+
const t = e.key === "ArrowDown" ? 1 : -1;
|
|
66
|
+
$((r) => r == null ? t > 0 ? 0 : i.length - 1 : (r + t + i.length) % i.length);
|
|
67
|
+
}
|
|
68
|
+
}, Le = !te && !m && !R && (o ? c.length > 0 : b !== null), _e = (e) => {
|
|
69
|
+
e.preventDefault(), !(R || m) && (H.current?.focus(), f(!a));
|
|
70
|
+
}, je = o ? j ? j(c, ({ index: e }) => ({ "data-index": e })) : c.map((e, t) => /* @__PURE__ */ s(Ye, {
|
|
71
|
+
dataTest: `selected-chip-${n(e)}`,
|
|
72
|
+
label: n(e),
|
|
73
|
+
readOnly: m,
|
|
74
|
+
onDelete: m ? void 0 : (r) => k(r, e)
|
|
75
|
+
}, D ? D(e) : `${n(e)}-${t}`)) : void 0, Ee = /* @__PURE__ */ y("span", {
|
|
76
|
+
className: "flex items-center gap-1",
|
|
77
|
+
children: [
|
|
78
|
+
E && /* @__PURE__ */ s(Je, {
|
|
79
|
+
width: 20,
|
|
80
|
+
height: 20,
|
|
81
|
+
className: "animate-spin"
|
|
67
82
|
}),
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"& li[aria-selected=true].MuiAutocomplete-option.Mui-focused": { background: "var(--colors-gama-50) !important" },
|
|
81
|
-
"&:has([data-select-all-header]:hover) .MuiAutocomplete-option.Mui-focused": { background: "transparent !important" },
|
|
82
|
-
"&:has([data-select-all-header]:hover) li[aria-selected=true].MuiAutocomplete-option.Mui-focused": { background: "var(--colors-gama-50) !important" }
|
|
83
|
-
},
|
|
84
|
-
children: [l && d.length > 0 && /* @__PURE__ */ L("div", {
|
|
85
|
-
"data-select-all-header": !0,
|
|
86
|
-
className: "flex items-center gap-x-[10px] border-[1px] border-b border-solid border-delta-200 bg-delta-50 py-2 pl-3 text-xs",
|
|
87
|
-
onMouseDown: (t) => t.preventDefault(),
|
|
88
|
-
role: "presentation",
|
|
89
|
-
children: [/* @__PURE__ */ o(R, {
|
|
90
|
-
size: "small",
|
|
91
|
-
dataTest: `${s}-select-all`,
|
|
92
|
-
checked: $,
|
|
93
|
-
indeterminate: ee,
|
|
94
|
-
hideWrapper: !0,
|
|
95
|
-
onChange: te,
|
|
96
|
-
"aria-label": C ?? "Select all"
|
|
97
|
-
}), /* @__PURE__ */ o("span", {
|
|
98
|
-
className: "truncate text-[10px] font-semibold uppercase text-delta-600",
|
|
99
|
-
children: C ?? "Select all"
|
|
100
|
-
})]
|
|
101
|
-
}), e]
|
|
83
|
+
Le && /* @__PURE__ */ s("button", {
|
|
84
|
+
type: "button",
|
|
85
|
+
"aria-label": "Clear",
|
|
86
|
+
"data-testid": `${l}-clear`,
|
|
87
|
+
className: "flex min-h-6 min-w-6 cursor-pointer items-center justify-center rounded-full border-0 bg-delta-50",
|
|
88
|
+
onMouseDown: (e) => {
|
|
89
|
+
e.preventDefault(), ke(e);
|
|
90
|
+
},
|
|
91
|
+
children: /* @__PURE__ */ s(He, {
|
|
92
|
+
width: 20,
|
|
93
|
+
height: 20,
|
|
94
|
+
className: "text-delta-700"
|
|
102
95
|
})
|
|
103
|
-
},
|
|
104
|
-
renderOption: G ?? ((e, t, { selected: r }) => {
|
|
105
|
-
const a = e, m = e.id ?? i(t);
|
|
106
|
-
return n ? /* @__PURE__ */ A("li", {
|
|
107
|
-
...a,
|
|
108
|
-
key: m,
|
|
109
|
-
className: v(e.className, "flex items-center gap-x-[10px] border-0 border-b border-solid border-delta-200")
|
|
110
|
-
}, /* @__PURE__ */ o(R, {
|
|
111
|
-
dataTest: `${s}-${i(t)}-checkbox`,
|
|
112
|
-
checked: r,
|
|
113
|
-
size: "small",
|
|
114
|
-
hideWrapper: !0
|
|
115
|
-
}), /* @__PURE__ */ o("span", {
|
|
116
|
-
className: "flex-1 truncate py-2 text-sm text-delta-700",
|
|
117
|
-
children: u?.(t) ?? i(t)
|
|
118
|
-
})) : /* @__PURE__ */ A("li", {
|
|
119
|
-
...a,
|
|
120
|
-
key: m,
|
|
121
|
-
className: v(e.className, "flex items-center gap-x-1")
|
|
122
|
-
}, /* @__PURE__ */ o("span", {
|
|
123
|
-
className: "w-5",
|
|
124
|
-
children: r && /* @__PURE__ */ o(se, {
|
|
125
|
-
width: 20,
|
|
126
|
-
height: 20,
|
|
127
|
-
style: { color: "var(--colors-gama-500)" }
|
|
128
|
-
})
|
|
129
|
-
}), /* @__PURE__ */ o("span", {
|
|
130
|
-
className: "flex-1 truncate py-2 text-sm text-delta-700",
|
|
131
|
-
children: u?.(t) ?? i(t)
|
|
132
|
-
}));
|
|
133
96
|
}),
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
"
|
|
137
|
-
"
|
|
138
|
-
"
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
97
|
+
m ? null : /* @__PURE__ */ s("button", {
|
|
98
|
+
type: "button",
|
|
99
|
+
"aria-label": "Toggle options",
|
|
100
|
+
"aria-expanded": a,
|
|
101
|
+
"data-testid": `${l}-popup-indicator`,
|
|
102
|
+
className: "flex cursor-pointer items-center border-0 bg-transparent",
|
|
103
|
+
onMouseDown: _e,
|
|
104
|
+
children: le ?? (o ? /* @__PURE__ */ s(Ve, {
|
|
105
|
+
width: 24,
|
|
106
|
+
height: 24,
|
|
107
|
+
className: "text-delta-700"
|
|
108
|
+
}) : /* @__PURE__ */ s(Ue, {
|
|
109
|
+
width: 24,
|
|
110
|
+
height: 24,
|
|
111
|
+
className: P(B["select-custom-icon"], "text-delta-700 transition-transform", a && "rotate-180")
|
|
112
|
+
}))
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
}), ze = {
|
|
116
|
+
disabled: R,
|
|
117
|
+
size: ee,
|
|
118
|
+
fullWidth: !0,
|
|
119
|
+
value: h,
|
|
120
|
+
onChange: (e) => {
|
|
121
|
+
C(e, e.target.value, "input"), a || f(!0);
|
|
122
|
+
},
|
|
123
|
+
onKeyDown: Me,
|
|
124
|
+
slotProps: {
|
|
125
|
+
htmlInput: {
|
|
126
|
+
...Se(),
|
|
127
|
+
ref: H,
|
|
128
|
+
onClick: () => f(!0),
|
|
129
|
+
role: "combobox",
|
|
130
|
+
"aria-autocomplete": "list",
|
|
131
|
+
"aria-expanded": a,
|
|
132
|
+
"aria-activedescendant": a && g != null ? `${l}-option-${g}` : void 0,
|
|
133
|
+
autoComplete: "off",
|
|
134
|
+
readOnly: m
|
|
148
135
|
},
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
136
|
+
input: {
|
|
137
|
+
ref: Pe,
|
|
138
|
+
startAdornment: je,
|
|
139
|
+
endAdornment: Ee
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}, Fe = (e, t, r) => {
|
|
143
|
+
const { key: d, ...u } = e;
|
|
144
|
+
return /* @__PURE__ */ y("li", {
|
|
145
|
+
...u,
|
|
146
|
+
className: P("box-border flex min-h-10 cursor-pointer items-center gap-x-3 px-3 py-1.5 text-base text-delta-700 first:-mt-1", "aria-selected:bg-gama-50 data-[active]:bg-gama-50 data-[active]:text-delta-800", "aria-disabled:cursor-default aria-disabled:!bg-transparent aria-disabled:text-delta-300", o && "border-0 border-b border-solid border-delta-200"),
|
|
147
|
+
children: [o ? /* @__PURE__ */ s(O, {
|
|
148
|
+
dataTest: `${l}-${n(t)}-checkbox`,
|
|
149
|
+
checked: r.selected,
|
|
150
|
+
size: "small",
|
|
151
|
+
hideWrapper: !0,
|
|
152
|
+
decorative: !0
|
|
153
|
+
}) : /* @__PURE__ */ s("span", {
|
|
154
|
+
className: "w-5",
|
|
155
|
+
children: r.selected && /* @__PURE__ */ s(Te, {
|
|
152
156
|
width: 20,
|
|
153
157
|
height: 20,
|
|
154
|
-
className: "text-
|
|
158
|
+
className: "text-gama-500"
|
|
155
159
|
})
|
|
160
|
+
}), /* @__PURE__ */ s("span", {
|
|
161
|
+
className: "flex-1 truncate",
|
|
162
|
+
children: n(t)
|
|
163
|
+
})]
|
|
164
|
+
}, d);
|
|
165
|
+
}, We = (e, t) => {
|
|
166
|
+
const r = fe?.(e) ?? J(e), d = {
|
|
167
|
+
...Ae({
|
|
168
|
+
onMouseDown: (x) => x.preventDefault(),
|
|
169
|
+
onClick: (x) => {
|
|
170
|
+
r || k(x, e);
|
|
171
|
+
},
|
|
172
|
+
onMouseMove: () => $(r ? null : t)
|
|
173
|
+
}),
|
|
174
|
+
key: D ? String(D(e)) : `${n(e)}-${t}`,
|
|
175
|
+
ref: (x) => {
|
|
176
|
+
we.current[t] = x;
|
|
177
|
+
},
|
|
178
|
+
role: "option",
|
|
179
|
+
id: `${l}-option-${t}`,
|
|
180
|
+
"aria-selected": T(e),
|
|
181
|
+
"aria-disabled": r || void 0,
|
|
182
|
+
"data-active": g === t ? "" : void 0
|
|
183
|
+
}, u = {
|
|
184
|
+
selected: T(e),
|
|
185
|
+
index: t,
|
|
186
|
+
inputValue: h
|
|
187
|
+
};
|
|
188
|
+
return _ ? _(d, e, u) : Fe(d, e, u);
|
|
189
|
+
};
|
|
190
|
+
return /* @__PURE__ */ y("div", {
|
|
191
|
+
className: P(B.styledSelectAutocompleteWrapper, !ne && "w-auto", me, pe),
|
|
192
|
+
children: [Q(ze), a && /* @__PURE__ */ s(Qe, {
|
|
193
|
+
root: $e,
|
|
194
|
+
children: /* @__PURE__ */ y("ul", {
|
|
195
|
+
ref: Ie,
|
|
196
|
+
...Oe,
|
|
197
|
+
style: {
|
|
198
|
+
...Be,
|
|
199
|
+
...Re,
|
|
200
|
+
width: ye ?? void 0,
|
|
201
|
+
maxHeight: Ne ?? void 0,
|
|
202
|
+
fontFamily: "Roboto, Helvetica, Arial, sans-serif",
|
|
203
|
+
...U?.popper?.style
|
|
204
|
+
},
|
|
205
|
+
...Ce(),
|
|
206
|
+
className: P("z-[1300] m-0 list-none overflow-auto rounded-lg border border-solid border-delta-300 bg-white p-0 shadow-[0px_2px_4px_0px_rgba(34,33,51,0.15)]", ce?.listbox, U?.popper?.className),
|
|
207
|
+
children: [ae && o && /* @__PURE__ */ y("div", {
|
|
208
|
+
role: "group",
|
|
209
|
+
className: "flex min-h-12 items-center gap-x-1 border-0 border-b border-solid border-delta-200 px-4 text-sm text-delta-700",
|
|
210
|
+
children: [/* @__PURE__ */ s(O, {
|
|
211
|
+
dataTest: `${l}-select-all`,
|
|
212
|
+
"aria-label": z,
|
|
213
|
+
checked: p.length > 0 && c.length === p.length,
|
|
214
|
+
size: "small",
|
|
215
|
+
hideWrapper: !0,
|
|
216
|
+
onChange: (e) => {
|
|
217
|
+
e.stopPropagation();
|
|
218
|
+
const t = p.length > 0 && c.length === p.length;
|
|
219
|
+
N?.(e, t ? [] : p, t ? "clear" : "selectOption", void 0);
|
|
220
|
+
}
|
|
221
|
+
}), /* @__PURE__ */ s("span", {
|
|
222
|
+
className: "flex-1 truncate py-2",
|
|
223
|
+
children: z
|
|
224
|
+
})]
|
|
225
|
+
}), E ? /* @__PURE__ */ s("li", {
|
|
226
|
+
role: "presentation",
|
|
227
|
+
className: "px-3 py-2 text-sm text-delta-600",
|
|
228
|
+
children: Z
|
|
229
|
+
}) : i.length === 0 ? /* @__PURE__ */ s("li", {
|
|
230
|
+
role: "presentation",
|
|
231
|
+
className: "px-3 py-2 text-sm text-delta-600",
|
|
232
|
+
children: K
|
|
233
|
+
}) : i.map(We)]
|
|
156
234
|
})
|
|
157
|
-
})
|
|
235
|
+
})]
|
|
158
236
|
});
|
|
159
237
|
}
|
|
160
238
|
export {
|
|
161
|
-
|
|
239
|
+
yt as StyledSelectAutocomplete
|
|
162
240
|
};
|
|
@@ -1,56 +1,104 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
...a.sx,
|
|
28
|
-
"& .MuiSlider-track": {
|
|
29
|
-
backgroundColor: a.disabled ? "var(--colors-gray-200)" : "var(--colors-gama-500)",
|
|
30
|
-
borderColor: a.disabled ? "var(--colors-gray-200)" : "var(--colors-gama-500)"
|
|
31
|
-
},
|
|
32
|
-
"& .MuiSlider-mark": {
|
|
33
|
-
backgroundColor: "white",
|
|
34
|
-
border: "1px solid var(--colors-delta-300)",
|
|
35
|
-
borderRadius: "50%",
|
|
36
|
-
height: "8px",
|
|
37
|
-
width: "8px",
|
|
38
|
-
"&.MuiSlider-markActive": {
|
|
39
|
-
backgroundColor: a.disabled ? "var(--colors-gray-200)" : "var(--colors-gama-500)",
|
|
40
|
-
border: "1px solid",
|
|
41
|
-
borderColor: a.disabled ? "var(--colors-gray-200)" : "var(--colors-gama-500)",
|
|
42
|
-
opacity: 1
|
|
43
|
-
}
|
|
44
|
-
}
|
|
1
|
+
import { cn as n } from "../../../helpers/cn.js";
|
|
2
|
+
import { ErrorOutlineIcon as C } from "../../icons/error-outline-icon/ErrorOutlineIcon.js";
|
|
3
|
+
import { StyledFormHelperText as I } from "../../miscellaneous/StyledFormHelperText.js";
|
|
4
|
+
import g from "./StyledSlider.module.js";
|
|
5
|
+
import { useState as tt } from "react";
|
|
6
|
+
import { jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
7
|
+
var R = (s, e, o) => o === e ? 0 : Math.min(100, Math.max(0, (s - e) / (o - e) * 100)), et = (s) => Array.isArray(s) ? [s[0] ?? 0, s[1] ?? 0] : null, ct = ({ dataTest: s, min: e = 0, max: o = 100, step: p = 1, value: z, defaultValue: E, disabled: v, size: H = "medium", orientation: L = "horizontal", marks: M, name: K, className: O, classes: u, slotProps: w, error: y, errorText: X, helperText: U, ariaLabel: S, ariaLabelledBy: Y, onChange: _, onChangeCommitted: j }) => {
|
|
8
|
+
const a = L === "vertical", f = H === "small" ? 6 : 8, [G, J] = tt(E ?? e), A = z ?? G, i = et(A), d = i !== null, Q = (y ?? !1) || !!U, W = y ? X ?? "Required" : U, T = (M === !0 && Number.isFinite(p) && p > 0 && o > e ? Array.from({ length: Math.floor((o - e) / p) + 1 }, (t, l) => ({ value: e + p * l })) : Array.isArray(M) ? M : []).filter((t) => t.value >= e && t.value <= o), B = d ? Math.min(i[0], i[1]) : e, $ = d ? Math.max(i[0], i[1]) : A, F = (t) => d ? t >= B && t <= $ : t <= $, P = d ? R(B, e, o) : 0, V = R($, e, o) - P, Z = a ? {
|
|
9
|
+
bottom: `${P}%`,
|
|
10
|
+
height: `${V}%`
|
|
11
|
+
} : {
|
|
12
|
+
left: `${P}%`,
|
|
13
|
+
width: `${V}%`
|
|
14
|
+
}, q = (t) => {
|
|
15
|
+
const l = R(t, e, o);
|
|
16
|
+
return a ? { bottom: `${l}%` } : { left: `${l}%` };
|
|
17
|
+
}, k = (t) => {
|
|
18
|
+
if (v) return;
|
|
19
|
+
const l = t.currentTarget.getBoundingClientRect(), r = a ? 1 - (t.clientY - l.top) / l.height : (t.clientX - l.left) / l.width, m = e + Math.round(Math.min(1, Math.max(0, r)) * ((o - e) / p)) * p, h = Math.min(o, Math.max(e, m));
|
|
20
|
+
N(_, t, h, d && Math.abs((i?.[1] ?? e) - h) < Math.abs((i?.[0] ?? e) - h) ? 1 : 0);
|
|
21
|
+
}, N = (t, l, r, m) => {
|
|
22
|
+
let h = r;
|
|
23
|
+
if (!d) h = r;
|
|
24
|
+
else {
|
|
25
|
+
const c = [i?.[0] ?? 0, i?.[1] ?? 0];
|
|
26
|
+
c[m] = r, m === 0 && c[0] > c[1] && (c[0] = c[1]), m === 1 && c[1] < c[0] && (c[1] = c[0]), h = c;
|
|
45
27
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
28
|
+
z === void 0 && J(h), t && t(l, h, m);
|
|
29
|
+
}, D = (t, l) => /* @__PURE__ */ b("input", {
|
|
30
|
+
type: "range",
|
|
31
|
+
"data-testid": d ? `${s}-thumb-${t}` : s,
|
|
32
|
+
name: K,
|
|
33
|
+
min: e,
|
|
34
|
+
max: o,
|
|
35
|
+
step: p,
|
|
36
|
+
value: l,
|
|
37
|
+
disabled: v,
|
|
38
|
+
"aria-orientation": L,
|
|
39
|
+
"aria-label": typeof S == "function" ? S(t) : S,
|
|
40
|
+
"aria-labelledby": Y,
|
|
41
|
+
className: n(g.SliderInput, a ? g.Vertical : g.Horizontal, !a && "z-0", H === "small" && g.Small, v && g.Disabled, u?.thumb, w?.thumb?.className),
|
|
42
|
+
onChange: (r) => N(_, r, Number(r.currentTarget.value), t),
|
|
43
|
+
onPointerUp: (r) => N(j, r, Number(r.currentTarget.value), t),
|
|
44
|
+
onKeyUp: (r) => N(j, r, Number(r.currentTarget.value), t)
|
|
45
|
+
}, t);
|
|
46
|
+
return /* @__PURE__ */ x("div", {
|
|
47
|
+
className: n("relative flex", a ? "h-full w-8 flex-col items-center" : "mt-px w-full flex-col", u?.root, O),
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ x("div", {
|
|
50
|
+
className: n("relative", a ? "h-full w-8" : "h-4 w-full"),
|
|
51
|
+
children: [/* @__PURE__ */ x("div", {
|
|
52
|
+
onPointerDown: k,
|
|
53
|
+
className: n("absolute", a ? "left-1/2 w-1 -translate-x-1/2" : "top-[calc(50%+6px)] h-1 -translate-y-1/2"),
|
|
54
|
+
style: a ? {
|
|
55
|
+
top: f,
|
|
56
|
+
bottom: f
|
|
57
|
+
} : {
|
|
58
|
+
left: f,
|
|
59
|
+
right: f
|
|
60
|
+
},
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ b("div", { className: n("absolute inset-0 rounded-full bg-delta-100", u?.rail, w?.rail?.className) }),
|
|
63
|
+
/* @__PURE__ */ b("div", {
|
|
64
|
+
className: n("absolute rounded-full", a ? "left-0 w-full" : "top-0 h-full", v ? "bg-delta-200" : "bg-gama-500", u?.track),
|
|
65
|
+
style: Z
|
|
66
|
+
}),
|
|
67
|
+
T.map((t) => {
|
|
68
|
+
const l = F(t.value);
|
|
69
|
+
return /* @__PURE__ */ b("span", {
|
|
70
|
+
className: n("absolute z-10 box-border h-2 w-2 -translate-x-1/2 rounded-full border border-solid", a ? "left-1/2 translate-y-1/2" : "top-1/2 -translate-y-1/2", l ? n(v ? "border-delta-200 bg-delta-200" : "border-gama-500 bg-gama-500", u?.markActive) : n("border-delta-300 bg-white", u?.mark)),
|
|
71
|
+
style: q(t.value)
|
|
72
|
+
}, t.value);
|
|
73
|
+
})
|
|
74
|
+
]
|
|
75
|
+
}), d ? [D(0, i[0]), D(1, i[1])] : D(0, A)]
|
|
76
|
+
}),
|
|
77
|
+
T.some((t) => t.label != null) && /* @__PURE__ */ b("div", {
|
|
78
|
+
className: n(a ? "pointer-events-none absolute inset-x-0" : "relative mt-[14px] h-6"),
|
|
79
|
+
style: a ? {
|
|
80
|
+
top: f,
|
|
81
|
+
bottom: f
|
|
82
|
+
} : {
|
|
83
|
+
marginLeft: f,
|
|
84
|
+
marginRight: f
|
|
85
|
+
},
|
|
86
|
+
children: T.map((t) => t.label == null ? null : /* @__PURE__ */ b("span", {
|
|
87
|
+
className: n("absolute text-base font-semibold text-delta-700", a ? "left-[37px] translate-y-1/2" : "-translate-x-1/2", F(t.value) && u?.markLabelActive, u?.markLabel, w?.markLabel?.className),
|
|
88
|
+
style: q(t.value),
|
|
89
|
+
children: t.label
|
|
90
|
+
}, t.value))
|
|
91
|
+
}),
|
|
92
|
+
Q && /* @__PURE__ */ x(I, {
|
|
93
|
+
className: n("m-0 flex items-center gap-1 pt-1 text-sm", y ? "text-error-500" : "text-delta-600"),
|
|
94
|
+
children: [y && /* @__PURE__ */ b(C, {
|
|
95
|
+
width: 20,
|
|
96
|
+
height: 20
|
|
97
|
+
}), W]
|
|
98
|
+
})
|
|
99
|
+
]
|
|
100
|
+
});
|
|
53
101
|
};
|
|
54
102
|
export {
|
|
55
|
-
|
|
103
|
+
ct as StyledSlider
|
|
56
104
|
};
|