@carbon/react 1.103.0 → 1.104.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/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +990 -1245
- package/es/_virtual/_rolldown/runtime.js +25 -0
- package/es/components/AILabel/index.d.ts +29 -2
- package/es/components/AILabel/index.js +114 -169
- package/es/components/AISkeleton/AISkeletonIcon.js +23 -27
- package/es/components/AISkeleton/AISkeletonPlaceholder.js +19 -27
- package/es/components/AISkeleton/AISkeletonText.js +26 -39
- package/es/components/Accordion/Accordion.Skeleton.js +55 -79
- package/es/components/Accordion/Accordion.js +43 -61
- package/es/components/Accordion/AccordionItem.js +102 -156
- package/es/components/Accordion/AccordionProvider.js +18 -15
- package/es/components/AspectRatio/AspectRatio.js +41 -47
- package/es/components/BadgeIndicator/index.js +28 -33
- package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +39 -50
- package/es/components/Breadcrumb/Breadcrumb.js +39 -51
- package/es/components/Breadcrumb/BreadcrumbItem.js +80 -83
- package/es/components/Button/Button.Skeleton.js +49 -58
- package/es/components/Button/Button.d.ts +1 -1
- package/es/components/Button/Button.js +146 -240
- package/es/components/Button/ButtonBase.js +82 -104
- package/es/components/Button/index.js +13 -6
- package/es/components/ButtonSet/ButtonSet.js +74 -98
- package/es/components/ButtonSet/index.js +12 -4
- package/es/components/ChatButton/ChatButton.Skeleton.js +27 -27
- package/es/components/ChatButton/ChatButton.js +64 -79
- package/es/components/Checkbox/Checkbox.Skeleton.js +26 -25
- package/es/components/Checkbox/Checkbox.js +116 -195
- package/es/components/Checkbox/index.js +13 -5
- package/es/components/CheckboxGroup/CheckboxGroup.js +100 -148
- package/es/components/ClassPrefix/index.js +21 -17
- package/es/components/CodeSnippet/CodeSnippet.Skeleton.js +45 -42
- package/es/components/CodeSnippet/CodeSnippet.js +210 -299
- package/es/components/ComboBox/ComboBox.js +621 -970
- package/es/components/ComboBox/index.js +12 -4
- package/es/components/ComboButton/index.js +172 -208
- package/es/components/ComposedModal/ComposedModal.js +311 -450
- package/es/components/ComposedModal/ComposedModalPresence.js +47 -42
- package/es/components/ComposedModal/ModalFooter.js +127 -207
- package/es/components/ComposedModal/ModalHeader.js +71 -101
- package/es/components/ComposedModal/useComposedModalState.js +21 -15
- package/es/components/ContainedList/ContainedList.js +67 -102
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +49 -67
- package/es/components/ContainedList/ContainedListItem/index.js +12 -4
- package/es/components/ContainedList/index.js +15 -12
- package/es/components/ContentSwitcher/ContentSwitcher.js +108 -140
- package/es/components/ContextMenu/useContextMenu.js +41 -36
- package/es/components/Copy/Copy.js +97 -117
- package/es/components/Copy/index.js +12 -4
- package/es/components/CopyButton/CopyButton.js +81 -94
- package/es/components/CopyButton/index.js +12 -4
- package/es/components/DangerButton/DangerButton.js +11 -9
- package/es/components/DataTable/DataTable.d.ts +11 -11
- package/es/components/DataTable/DataTable.js +448 -630
- package/es/components/DataTable/Table.js +111 -156
- package/es/components/DataTable/TableActionList.js +14 -6
- package/es/components/DataTable/TableBatchAction.js +25 -34
- package/es/components/DataTable/TableBatchActions.js +78 -113
- package/es/components/DataTable/TableBody.js +26 -19
- package/es/components/DataTable/TableCell.js +31 -46
- package/es/components/DataTable/TableContainer.js +75 -82
- package/es/components/DataTable/TableContext.js +14 -6
- package/es/components/DataTable/TableDecoratorRow.js +30 -36
- package/es/components/DataTable/TableExpandHeader.js +53 -90
- package/es/components/DataTable/TableExpandRow.js +82 -119
- package/es/components/DataTable/TableExpandedRow.js +45 -51
- package/es/components/DataTable/TableHead.js +7 -5
- package/es/components/DataTable/TableHeader.js +138 -181
- package/es/components/DataTable/TableRow.d.ts +1 -1
- package/es/components/DataTable/TableRow.js +42 -76
- package/es/components/DataTable/TableSelectAll.js +42 -70
- package/es/components/DataTable/TableSelectRow.js +63 -98
- package/es/components/DataTable/TableSlugRow.js +35 -43
- package/es/components/DataTable/TableToolbar.js +33 -45
- package/es/components/DataTable/TableToolbarAction.js +25 -20
- package/es/components/DataTable/TableToolbarContent.js +14 -6
- package/es/components/DataTable/TableToolbarMenu.js +35 -46
- package/es/components/DataTable/TableToolbarSearch.js +97 -187
- package/es/components/DataTable/state/getDerivedStateFromProps.js +38 -43
- package/es/components/DataTable/state/sortStates.js +11 -9
- package/es/components/DataTable/state/sorting.js +53 -72
- package/es/components/DataTable/tools/cells.js +15 -7
- package/es/components/DataTable/tools/denormalize.js +27 -19
- package/es/components/DataTable/tools/filter.js +21 -22
- package/es/components/DataTable/tools/normalize.js +57 -72
- package/es/components/DataTable/tools/sorting.js +50 -71
- package/es/components/DataTableSkeleton/DataTableSkeleton.js +66 -94
- package/es/components/DatePicker/DatePicker.Skeleton.js +44 -51
- package/es/components/DatePicker/DatePicker.js +485 -752
- package/es/components/DatePicker/DatePickerLocales.js +75 -126
- package/es/components/DatePicker/index.js +13 -5
- package/es/components/DatePicker/plugins/appendToPlugin.js +31 -45
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +127 -171
- package/es/components/DatePicker/plugins/rangePlugin.js +40 -48
- package/es/components/DatePicker/utils.js +11 -3
- package/es/components/DatePickerInput/DatePickerInput.js +179 -289
- package/es/components/DatePickerInput/index.js +12 -4
- package/es/components/Dialog/Dialog.js +303 -574
- package/es/components/Dialog/index.js +18 -2
- package/es/components/Dropdown/Dropdown.Skeleton.js +26 -38
- package/es/components/Dropdown/Dropdown.js +344 -535
- package/es/components/Dropdown/index.js +13 -5
- package/es/components/ErrorBoundary/ErrorBoundary.js +36 -58
- package/es/components/ErrorBoundary/ErrorBoundaryContext.js +14 -9
- package/es/components/ExpandableSearch/ExpandableSearch.js +60 -69
- package/es/components/ExpandableSearch/index.js +12 -4
- package/es/components/FeatureFlags/index.d.ts +11 -2
- package/es/components/FeatureFlags/index.js +79 -77
- package/es/components/FileUploader/FileUploader.Skeleton.js +35 -30
- package/es/components/FileUploader/FileUploader.js +269 -343
- package/es/components/FileUploader/FileUploaderButton.js +110 -160
- package/es/components/FileUploader/FileUploaderDropContainer.js +144 -221
- package/es/components/FileUploader/FileUploaderItem.js +138 -157
- package/es/components/FileUploader/Filename.d.ts +1 -1
- package/es/components/FileUploader/Filename.js +53 -72
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +26 -28
- package/es/components/FluidComboBox/FluidComboBox.js +54 -105
- package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.js +56 -53
- package/es/components/FluidDatePicker/FluidDatePicker.js +46 -68
- package/es/components/FluidDatePickerInput/FluidDatePickerInput.js +23 -16
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +26 -28
- package/es/components/FluidDropdown/FluidDropdown.js +55 -111
- package/es/components/FluidForm/FluidForm.js +29 -31
- package/es/components/FluidForm/FormContext.js +12 -6
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +26 -28
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +67 -197
- package/es/components/FluidNumberInput/FluidNumberInput.Skeleton.js +27 -30
- package/es/components/FluidNumberInput/FluidNumberInput.js +63 -147
- package/es/components/FluidSearch/FluidSearch.Skeleton.js +27 -30
- package/es/components/FluidSearch/FluidSearch.js +41 -84
- package/es/components/FluidSelect/FluidSelect.Skeleton.js +26 -28
- package/es/components/FluidSelect/FluidSelect.js +40 -76
- package/es/components/FluidSelect/index.js +13 -5
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +27 -30
- package/es/components/FluidTextArea/FluidTextArea.js +48 -112
- package/es/components/FluidTextInput/FluidPasswordInput.js +44 -99
- package/es/components/FluidTextInput/FluidTextInput.Skeleton.js +27 -30
- package/es/components/FluidTextInput/FluidTextInput.js +49 -104
- package/es/components/FluidTextInput/index.js +14 -6
- package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.js +30 -33
- package/es/components/FluidTimePicker/FluidTimePicker.js +68 -115
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +28 -47
- package/es/components/Form/Form.js +23 -25
- package/es/components/FormGroup/FormGroup.js +45 -67
- package/es/components/FormItem/FormItem.js +23 -25
- package/es/components/FormLabel/FormLabel.js +28 -34
- package/es/components/Grid/CSSGrid.d.ts +1 -1
- package/es/components/Grid/CSSGrid.js +85 -127
- package/es/components/Grid/Column.js +192 -324
- package/es/components/Grid/ColumnHang.js +28 -36
- package/es/components/Grid/FlexGrid.js +40 -60
- package/es/components/Grid/Grid.js +29 -42
- package/es/components/Grid/GridContext.js +36 -42
- package/es/components/Grid/Row.js +31 -49
- package/es/components/Heading/index.js +36 -51
- package/es/components/Icon/Icon.Skeleton.js +21 -21
- package/es/components/IconButton/index.js +117 -178
- package/es/components/IconIndicator/index.d.ts +1 -1
- package/es/components/IconIndicator/index.js +59 -60
- package/es/components/IdPrefix/index.js +21 -17
- package/es/components/InlineCheckbox/InlineCheckbox.js +69 -113
- package/es/components/InlineCheckbox/index.js +12 -4
- package/es/components/InlineLoading/InlineLoading.js +83 -100
- package/es/components/InlineLoading/index.js +12 -4
- package/es/components/Layer/LayerContext.js +12 -4
- package/es/components/Layer/LayerLevel.js +20 -4
- package/es/components/Layer/index.js +54 -66
- package/es/components/Layout/index.js +77 -109
- package/es/components/LayoutDirection/LayoutDirection.d.ts +1 -1
- package/es/components/LayoutDirection/LayoutDirection.js +33 -37
- package/es/components/LayoutDirection/LayoutDirectionContext.js +12 -6
- package/es/components/LayoutDirection/useLayoutDirection.js +15 -7
- package/es/components/Link/Link.js +63 -108
- package/es/components/Link/index.js +12 -4
- package/es/components/ListBox/ListBox.js +78 -126
- package/es/components/ListBox/ListBoxField.js +24 -43
- package/es/components/ListBox/ListBoxMenu.js +36 -42
- package/es/components/ListBox/ListBoxMenuIcon.js +39 -40
- package/es/components/ListBox/ListBoxMenuItem.js +67 -88
- package/es/components/ListBox/ListBoxPropTypes.js +17 -5
- package/es/components/ListBox/ListBoxSelection.js +71 -96
- package/es/components/ListBox/index.js +16 -14
- package/es/components/ListBox/next/ListBoxSelection.js +79 -117
- package/es/components/ListBox/next/ListBoxTrigger.js +44 -48
- package/es/components/ListItem/ListItem.js +25 -28
- package/es/components/Loading/Loading.js +64 -73
- package/es/components/Loading/index.js +12 -4
- package/es/components/Menu/Menu.js +220 -363
- package/es/components/Menu/MenuContext.d.ts +1 -1
- package/es/components/Menu/MenuContext.js +41 -38
- package/es/components/Menu/MenuItem.js +282 -413
- package/es/components/MenuButton/index.js +134 -195
- package/es/components/Modal/Modal.js +500 -660
- package/es/components/Modal/ModalPresence.js +39 -37
- package/es/components/Modal/index.js +13 -5
- package/es/components/ModalWrapper/ModalWrapper.d.ts +2 -2
- package/es/components/ModalWrapper/ModalWrapper.js +106 -130
- package/es/components/MultiSelect/FilterableMultiSelect.js +605 -918
- package/es/components/MultiSelect/MultiSelect.js +454 -716
- package/es/components/MultiSelect/MultiSelectPropTypes.js +13 -30
- package/es/components/MultiSelect/filter.js +14 -9
- package/es/components/MultiSelect/tools/sorting.js +21 -34
- package/es/components/Notification/Notification.js +508 -785
- package/es/components/NumberInput/NumberFormatPropTypes.js +69 -30
- package/es/components/NumberInput/NumberInput.Skeleton.js +29 -33
- package/es/components/NumberInput/NumberInput.js +565 -947
- package/es/components/OrderedList/OrderedList.js +31 -44
- package/es/components/OverflowMenu/OverflowMenu.js +335 -450
- package/es/components/OverflowMenu/index.js +25 -16
- package/es/components/OverflowMenu/next/index.js +154 -186
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +100 -160
- package/es/components/OverflowMenuItem/index.js +12 -4
- package/es/components/OverflowMenuV2/index.js +15 -13
- package/es/components/PageHeader/PageHeader.js +297 -442
- package/es/components/PageHeader/index.js +24 -2
- package/es/components/Pagination/Pagination.Skeleton.js +34 -35
- package/es/components/Pagination/Pagination.d.ts +1 -1
- package/es/components/Pagination/Pagination.js +251 -356
- package/es/components/Pagination/experimental/PageSelector.js +38 -54
- package/es/components/Pagination/experimental/Pagination-story.d.ts +114 -0
- package/es/components/Pagination/experimental/Pagination.js +144 -196
- package/es/components/PaginationNav/PaginationNav.js +320 -426
- package/es/components/Popover/index.js +318 -437
- package/es/components/PrimaryButton/PrimaryButton.js +11 -9
- package/es/components/ProgressBar/ProgressBar.js +117 -143
- package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +42 -38
- package/es/components/ProgressIndicator/ProgressIndicator.js +146 -243
- package/es/components/RadioButton/RadioButton.Skeleton.js +23 -25
- package/es/components/RadioButton/RadioButton.js +101 -174
- package/es/components/RadioButton/index.js +12 -4
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +135 -207
- package/es/components/RadioTile/RadioTile.js +104 -168
- package/es/components/RadioTile/index.js +12 -4
- package/es/components/Search/Search.Skeleton.js +28 -33
- package/es/components/Search/Search.js +182 -278
- package/es/components/Search/index.js +13 -5
- package/es/components/Search/utils.js +11 -3
- package/es/components/SecondaryButton/SecondaryButton.js +11 -9
- package/es/components/Select/Select.Skeleton.js +27 -30
- package/es/components/Select/Select.js +178 -257
- package/es/components/Select/index.js +13 -5
- package/es/components/SelectItem/SelectItem.js +33 -48
- package/es/components/SelectItem/index.js +12 -4
- package/es/components/SelectItemGroup/SelectItemGroup.js +27 -37
- package/es/components/ShapeIndicator/index.d.ts +1 -1
- package/es/components/ShapeIndicator/index.js +74 -80
- package/es/components/SkeletonIcon/SkeletonIcon.js +21 -24
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +15 -24
- package/es/components/SkeletonText/SkeletonText.js +67 -81
- package/es/components/SkeletonText/index.js +12 -4
- package/es/components/Slider/Slider.Skeleton.js +68 -91
- package/es/components/Slider/Slider.js +864 -1315
- package/es/components/Slider/SliderHandles.js +73 -66
- package/es/components/Stack/HStack.js +19 -11
- package/es/components/Stack/Stack.js +56 -80
- package/es/components/Stack/VStack.js +19 -11
- package/es/components/StructuredList/StructuredList.Skeleton.js +55 -48
- package/es/components/StructuredList/StructuredList.js +178 -317
- package/es/components/Switch/IconSwitch.js +99 -145
- package/es/components/Switch/Switch.js +66 -99
- package/es/components/TabContent/TabContent.js +28 -34
- package/es/components/Tabs/Tabs.Skeleton.js +41 -36
- package/es/components/Tabs/Tabs.js +732 -1149
- package/es/components/Tabs/usePressable.js +97 -112
- package/es/components/Tag/DismissibleTag.js +119 -156
- package/es/components/Tag/OperationalTag.js +91 -111
- package/es/components/Tag/SelectableTag.js +94 -129
- package/es/components/Tag/Tag.Skeleton.js +26 -30
- package/es/components/Tag/Tag.js +152 -200
- package/es/components/Tag/isEllipsisActive.js +13 -8
- package/es/components/Text/Text.js +66 -79
- package/es/components/Text/TextDirection.js +36 -37
- package/es/components/Text/TextDirectionContext.js +14 -8
- package/es/components/Text/createTextComponent.js +21 -20
- package/es/components/TextArea/TextArea.Skeleton.js +25 -29
- package/es/components/TextArea/TextArea.js +315 -422
- package/es/components/TextArea/index.js +13 -5
- package/es/components/TextInput/ControlledPasswordInput.js +133 -198
- package/es/components/TextInput/PasswordInput.js +196 -303
- package/es/components/TextInput/TextInput.Skeleton.js +24 -28
- package/es/components/TextInput/TextInput.js +219 -317
- package/es/components/TextInput/index.js +13 -5
- package/es/components/TextInput/util.js +21 -25
- package/es/components/Theme/index.js +79 -95
- package/es/components/Tile/Tile.js +394 -593
- package/es/components/TileGroup/TileGroup.js +70 -111
- package/es/components/TimePicker/TimePicker.d.ts +1 -1
- package/es/components/TimePicker/TimePicker.js +148 -247
- package/es/components/TimePickerSelect/TimePickerSelect.js +43 -58
- package/es/components/Toggle/Toggle.Skeleton.js +24 -22
- package/es/components/Toggle/Toggle.js +102 -171
- package/es/components/ToggleSmall/ToggleSmall.Skeleton.js +46 -51
- package/es/components/Toggletip/index.d.ts +2 -2
- package/es/components/Toggletip/index.js +170 -256
- package/es/components/Tooltip/DefinitionTooltip.js +98 -138
- package/es/components/Tooltip/Tooltip.js +188 -263
- package/es/components/TreeView/TreeContext.js +13 -5
- package/es/components/TreeView/TreeNode.js +361 -500
- package/es/components/TreeView/TreeView.js +164 -237
- package/es/components/UIShell/Content.js +23 -30
- package/es/components/UIShell/Header.js +25 -29
- package/es/components/UIShell/HeaderContainer.js +31 -40
- package/es/components/UIShell/HeaderGlobalAction.js +65 -90
- package/es/components/UIShell/HeaderGlobalBar.js +16 -9
- package/es/components/UIShell/HeaderMenu.js +141 -215
- package/es/components/UIShell/HeaderMenuButton.js +43 -66
- package/es/components/UIShell/HeaderMenuItem.js +49 -76
- package/es/components/UIShell/HeaderName.js +32 -44
- package/es/components/UIShell/HeaderNavigation.js +32 -37
- package/es/components/UIShell/HeaderPanel.js +74 -97
- package/es/components/UIShell/HeaderSideNavItems.js +27 -33
- package/es/components/UIShell/Link.js +29 -50
- package/es/components/UIShell/SideNav.js +132 -241
- package/es/components/UIShell/SideNavContext.js +21 -15
- package/es/components/UIShell/SideNavDetails.js +29 -34
- package/es/components/UIShell/SideNavDivider.js +21 -21
- package/es/components/UIShell/SideNavFooter.js +43 -52
- package/es/components/UIShell/SideNavHeader.js +26 -35
- package/es/components/UIShell/SideNavIcon.js +28 -33
- package/es/components/UIShell/SideNavItem.js +28 -33
- package/es/components/UIShell/SideNavItems.js +31 -40
- package/es/components/UIShell/SideNavLink.js +52 -79
- package/es/components/UIShell/SideNavLinkText.js +24 -25
- package/es/components/UIShell/SideNavMenu.js +102 -143
- package/es/components/UIShell/SideNavMenuItem.js +40 -52
- package/es/components/UIShell/SideNavSwitcher.js +59 -68
- package/es/components/UIShell/SkipToContent.js +28 -36
- package/es/components/UIShell/Switcher.js +69 -99
- package/es/components/UIShell/SwitcherDivider.js +16 -24
- package/es/components/UIShell/SwitcherItem.js +74 -114
- package/es/components/UnorderedList/UnorderedList.js +28 -37
- package/es/feature-flags.js +19 -10
- package/es/index.js +249 -242
- package/es/internal/FloatingMenu.js +246 -292
- package/es/internal/OptimizedResize.js +35 -46
- package/es/internal/Selection.js +99 -132
- package/es/internal/clamp.js +12 -4
- package/es/internal/defaultItemToString.js +15 -9
- package/es/internal/deprecateFieldOnObject.js +22 -14
- package/es/internal/environment.js +15 -7
- package/es/internal/getAnnouncement.js +16 -13
- package/es/internal/keyboard/keys.js +48 -48
- package/es/internal/keyboard/match.js +25 -42
- package/es/internal/keyboard/navigation.js +22 -27
- package/es/internal/noopFn.js +10 -2
- package/es/internal/useAttachedMenu.js +43 -51
- package/es/internal/useControllableState.js +43 -48
- package/es/internal/useDelayedState.js +30 -35
- package/es/internal/useEvent.js +39 -35
- package/es/internal/useId.js +51 -87
- package/es/internal/useIdPrefix.js +13 -5
- package/es/internal/useIsomorphicEffect.js +12 -4
- package/es/internal/useMatchMedia.js +29 -21
- package/es/internal/useMergedRefs.js +26 -22
- package/es/internal/useNoInteractiveChildren.js +70 -99
- package/es/internal/useNormalizedInputProps.js +47 -51
- package/es/internal/useOutsideClick.js +21 -24
- package/es/internal/useOverflowItems.js +89 -90
- package/es/internal/usePrefix.js +13 -5
- package/es/internal/usePresence.js +51 -54
- package/es/internal/usePresenceContext.js +35 -35
- package/es/internal/usePreviousValue.js +26 -18
- package/es/internal/useResizeObserver.js +57 -66
- package/es/internal/useSavedCallback.js +24 -17
- package/es/internal/utils.js +17 -9
- package/es/internal/warning.js +17 -22
- package/es/internal/wrapFocus.js +77 -98
- package/es/prop-types/AriaPropTypes.js +14 -6
- package/es/prop-types/deprecate.js +30 -27
- package/es/prop-types/deprecateComponent.js +17 -8
- package/es/prop-types/deprecateValuesWithin.js +18 -21
- package/es/prop-types/isRequiredOneOf.js +21 -24
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +14 -14
- package/es/tools/events.js +17 -21
- package/es/tools/mapPopoverAlign.js +19 -18
- package/es/tools/mergeRefs.js +14 -17
- package/es/tools/setupGetInstanceId.js +16 -8
- package/es/tools/toggleClass.js +17 -9
- package/es/tools/wrapComponent.js +34 -39
- package/icons/index.d.ts +2 -1
- package/icons/index.esm.js +2 -2
- package/icons/index.js +7 -10
- package/lib/_virtual/_rolldown/runtime.js +50 -0
- package/lib/components/AILabel/index.d.ts +29 -2
- package/lib/components/AILabel/index.js +118 -171
- package/lib/components/AISkeleton/AISkeletonIcon.js +27 -31
- package/lib/components/AISkeleton/AISkeletonPlaceholder.js +29 -31
- package/lib/components/AISkeleton/AISkeletonText.js +30 -43
- package/lib/components/Accordion/Accordion.Skeleton.js +59 -84
- package/lib/components/Accordion/Accordion.js +47 -65
- package/lib/components/Accordion/AccordionItem.js +106 -160
- package/lib/components/Accordion/AccordionProvider.js +20 -17
- package/lib/components/AspectRatio/AspectRatio.js +45 -51
- package/lib/components/BadgeIndicator/index.js +33 -39
- package/lib/components/Breadcrumb/Breadcrumb.Skeleton.js +43 -55
- package/lib/components/Breadcrumb/Breadcrumb.js +43 -55
- package/lib/components/Breadcrumb/BreadcrumbItem.js +84 -87
- package/lib/components/Button/Button.Skeleton.js +53 -63
- package/lib/components/Button/Button.d.ts +1 -1
- package/lib/components/Button/Button.js +149 -244
- package/lib/components/Button/ButtonBase.js +85 -108
- package/lib/components/Button/index.js +13 -15
- package/lib/components/ButtonSet/ButtonSet.js +78 -102
- package/lib/components/ButtonSet/index.js +12 -9
- package/lib/components/ChatButton/ChatButton.Skeleton.js +31 -31
- package/lib/components/ChatButton/ChatButton.js +68 -83
- package/lib/components/Checkbox/Checkbox.Skeleton.js +30 -30
- package/lib/components/Checkbox/Checkbox.js +119 -198
- package/lib/components/Checkbox/index.js +13 -11
- package/lib/components/CheckboxGroup/CheckboxGroup.js +104 -152
- package/lib/components/ClassPrefix/index.js +24 -19
- package/lib/components/CodeSnippet/CodeSnippet.Skeleton.js +49 -47
- package/lib/components/CodeSnippet/CodeSnippet.js +215 -303
- package/lib/components/ComboBox/ComboBox.js +626 -974
- package/lib/components/ComboBox/index.js +12 -9
- package/lib/components/ComboButton/index.js +176 -210
- package/lib/components/ComposedModal/ComposedModal.js +315 -454
- package/lib/components/ComposedModal/ComposedModalPresence.js +49 -44
- package/lib/components/ComposedModal/ModalFooter.js +131 -209
- package/lib/components/ComposedModal/ModalHeader.js +75 -103
- package/lib/components/ComposedModal/useComposedModalState.js +22 -17
- package/lib/components/ContainedList/ContainedList.js +77 -106
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +59 -71
- package/lib/components/ContainedList/ContainedListItem/index.js +12 -9
- package/lib/components/ContainedList/index.js +18 -15
- package/lib/components/ContentSwitcher/ContentSwitcher.js +112 -142
- package/lib/components/ContextMenu/useContextMenu.js +42 -40
- package/lib/components/Copy/Copy.js +101 -121
- package/lib/components/Copy/index.js +12 -9
- package/lib/components/CopyButton/CopyButton.js +85 -98
- package/lib/components/CopyButton/index.js +12 -9
- package/lib/components/DangerButton/DangerButton.js +19 -13
- package/lib/components/DataTable/DataTable.d.ts +11 -11
- package/lib/components/DataTable/DataTable.js +474 -655
- package/lib/components/DataTable/Table.js +115 -161
- package/lib/components/DataTable/TableActionList.js +15 -11
- package/lib/components/DataTable/TableBatchAction.js +28 -38
- package/lib/components/DataTable/TableBatchActions.js +82 -117
- package/lib/components/DataTable/TableBody.js +29 -23
- package/lib/components/DataTable/TableCell.js +35 -50
- package/lib/components/DataTable/TableContainer.js +79 -86
- package/lib/components/DataTable/TableContext.js +15 -8
- package/lib/components/DataTable/TableDecoratorRow.js +34 -40
- package/lib/components/DataTable/TableExpandHeader.js +57 -94
- package/lib/components/DataTable/TableExpandRow.js +86 -123
- package/lib/components/DataTable/TableExpandedRow.js +49 -55
- package/lib/components/DataTable/TableHead.js +8 -10
- package/lib/components/DataTable/TableHeader.js +142 -185
- package/lib/components/DataTable/TableRow.d.ts +1 -1
- package/lib/components/DataTable/TableRow.js +46 -80
- package/lib/components/DataTable/TableSelectAll.js +46 -74
- package/lib/components/DataTable/TableSelectRow.js +67 -102
- package/lib/components/DataTable/TableSlugRow.js +39 -47
- package/lib/components/DataTable/TableToolbar.js +37 -49
- package/lib/components/DataTable/TableToolbarAction.js +28 -24
- package/lib/components/DataTable/TableToolbarContent.js +15 -11
- package/lib/components/DataTable/TableToolbarMenu.js +39 -50
- package/lib/components/DataTable/TableToolbarSearch.js +101 -191
- package/lib/components/DataTable/state/getDerivedStateFromProps.js +38 -47
- package/lib/components/DataTable/state/sortStates.js +11 -10
- package/lib/components/DataTable/state/sorting.js +54 -76
- package/lib/components/DataTable/tools/cells.js +15 -8
- package/lib/components/DataTable/tools/denormalize.js +27 -22
- package/lib/components/DataTable/tools/filter.js +21 -23
- package/lib/components/DataTable/tools/normalize.js +57 -76
- package/lib/components/DataTable/tools/sorting.js +50 -75
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +70 -98
- package/lib/components/DatePicker/DatePicker.Skeleton.js +48 -56
- package/lib/components/DatePicker/DatePicker.js +491 -756
- package/lib/components/DatePicker/DatePickerLocales.js +75 -127
- package/lib/components/DatePicker/index.js +13 -11
- package/lib/components/DatePicker/plugins/appendToPlugin.js +31 -46
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +127 -175
- package/lib/components/DatePicker/plugins/rangePlugin.js +42 -50
- package/lib/components/DatePicker/utils.js +11 -4
- package/lib/components/DatePickerInput/DatePickerInput.js +183 -293
- package/lib/components/DatePickerInput/index.js +12 -9
- package/lib/components/Dialog/Dialog.js +307 -576
- package/lib/components/Dialog/index.js +21 -13
- package/lib/components/Dropdown/Dropdown.Skeleton.js +30 -43
- package/lib/components/Dropdown/Dropdown.js +348 -539
- package/lib/components/Dropdown/index.js +13 -11
- package/lib/components/ErrorBoundary/ErrorBoundary.js +39 -62
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +15 -11
- package/lib/components/ExpandableSearch/ExpandableSearch.js +63 -73
- package/lib/components/ExpandableSearch/index.js +12 -9
- package/lib/components/FeatureFlags/index.d.ts +11 -2
- package/lib/components/FeatureFlags/index.js +82 -79
- package/lib/components/FileUploader/FileUploader.Skeleton.js +39 -35
- package/lib/components/FileUploader/FileUploader.js +273 -347
- package/lib/components/FileUploader/FileUploaderButton.js +114 -164
- package/lib/components/FileUploader/FileUploaderDropContainer.js +148 -225
- package/lib/components/FileUploader/FileUploaderItem.js +142 -161
- package/lib/components/FileUploader/Filename.d.ts +1 -1
- package/lib/components/FileUploader/Filename.js +56 -76
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +30 -32
- package/lib/components/FluidComboBox/FluidComboBox.js +58 -109
- package/lib/components/FluidDatePicker/FluidDatePicker.Skeleton.js +60 -57
- package/lib/components/FluidDatePicker/FluidDatePicker.js +50 -72
- package/lib/components/FluidDatePickerInput/FluidDatePickerInput.js +25 -20
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +30 -32
- package/lib/components/FluidDropdown/FluidDropdown.js +59 -115
- package/lib/components/FluidForm/FluidForm.js +33 -35
- package/lib/components/FluidForm/FormContext.js +13 -8
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +30 -32
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +71 -201
- package/lib/components/FluidNumberInput/FluidNumberInput.Skeleton.js +31 -34
- package/lib/components/FluidNumberInput/FluidNumberInput.js +67 -151
- package/lib/components/FluidSearch/FluidSearch.Skeleton.js +31 -34
- package/lib/components/FluidSearch/FluidSearch.js +45 -88
- package/lib/components/FluidSelect/FluidSelect.Skeleton.js +30 -32
- package/lib/components/FluidSelect/FluidSelect.js +44 -80
- package/lib/components/FluidSelect/index.js +13 -11
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +31 -34
- package/lib/components/FluidTextArea/FluidTextArea.js +52 -116
- package/lib/components/FluidTextInput/FluidPasswordInput.js +48 -103
- package/lib/components/FluidTextInput/FluidTextInput.Skeleton.js +31 -34
- package/lib/components/FluidTextInput/FluidTextInput.js +53 -108
- package/lib/components/FluidTextInput/index.js +14 -13
- package/lib/components/FluidTimePicker/FluidTimePicker.Skeleton.js +34 -37
- package/lib/components/FluidTimePicker/FluidTimePicker.js +72 -119
- package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +31 -51
- package/lib/components/Form/Form.js +27 -29
- package/lib/components/FormGroup/FormGroup.js +49 -71
- package/lib/components/FormItem/FormItem.js +27 -29
- package/lib/components/FormLabel/FormLabel.js +32 -38
- package/lib/components/Grid/CSSGrid.d.ts +1 -1
- package/lib/components/Grid/CSSGrid.js +89 -129
- package/lib/components/Grid/Column.js +196 -328
- package/lib/components/Grid/ColumnHang.js +32 -38
- package/lib/components/Grid/FlexGrid.js +44 -62
- package/lib/components/Grid/Grid.js +32 -44
- package/lib/components/Grid/GridContext.js +39 -44
- package/lib/components/Grid/Row.js +35 -53
- package/lib/components/Heading/index.js +39 -53
- package/lib/components/Icon/Icon.Skeleton.js +25 -23
- package/lib/components/IconButton/index.js +121 -180
- package/lib/components/IconIndicator/index.d.ts +1 -1
- package/lib/components/IconIndicator/index.js +63 -63
- package/lib/components/IdPrefix/index.js +24 -19
- package/lib/components/InlineCheckbox/InlineCheckbox.js +72 -117
- package/lib/components/InlineCheckbox/index.js +12 -9
- package/lib/components/InlineLoading/InlineLoading.js +87 -104
- package/lib/components/InlineLoading/index.js +12 -9
- package/lib/components/Layer/LayerContext.js +14 -6
- package/lib/components/Layer/LayerLevel.js +20 -6
- package/lib/components/Layer/index.js +58 -68
- package/lib/components/Layout/index.js +81 -111
- package/lib/components/LayoutDirection/LayoutDirection.d.ts +1 -1
- package/lib/components/LayoutDirection/LayoutDirection.js +36 -40
- package/lib/components/LayoutDirection/LayoutDirectionContext.js +14 -8
- package/lib/components/LayoutDirection/useLayoutDirection.js +16 -9
- package/lib/components/Link/Link.js +67 -112
- package/lib/components/Link/index.js +12 -9
- package/lib/components/ListBox/ListBox.js +82 -130
- package/lib/components/ListBox/ListBoxField.js +33 -47
- package/lib/components/ListBox/ListBoxMenu.js +39 -46
- package/lib/components/ListBox/ListBoxMenuIcon.js +43 -44
- package/lib/components/ListBox/ListBoxMenuItem.js +71 -92
- package/lib/components/ListBox/ListBoxPropTypes.js +21 -9
- package/lib/components/ListBox/ListBoxSelection.js +75 -100
- package/lib/components/ListBox/index.js +17 -21
- package/lib/components/ListBox/next/ListBoxSelection.js +83 -121
- package/lib/components/ListBox/next/ListBoxTrigger.js +48 -52
- package/lib/components/ListItem/ListItem.js +29 -32
- package/lib/components/Loading/Loading.js +68 -77
- package/lib/components/Loading/index.js +12 -9
- package/lib/components/Menu/Menu.js +224 -365
- package/lib/components/Menu/MenuContext.d.ts +1 -1
- package/lib/components/Menu/MenuContext.js +42 -40
- package/lib/components/Menu/MenuItem.js +286 -415
- package/lib/components/MenuButton/index.js +138 -197
- package/lib/components/Modal/Modal.js +504 -665
- package/lib/components/Modal/ModalPresence.js +41 -39
- package/lib/components/Modal/index.js +13 -10
- package/lib/components/ModalWrapper/ModalWrapper.d.ts +2 -2
- package/lib/components/ModalWrapper/ModalWrapper.js +112 -134
- package/lib/components/MultiSelect/FilterableMultiSelect.js +611 -920
- package/lib/components/MultiSelect/MultiSelect.js +459 -718
- package/lib/components/MultiSelect/MultiSelectPropTypes.js +15 -32
- package/lib/components/MultiSelect/filter.js +14 -10
- package/lib/components/MultiSelect/tools/sorting.js +21 -35
- package/lib/components/Notification/Notification.js +514 -787
- package/lib/components/NumberInput/NumberFormatPropTypes.js +72 -33
- package/lib/components/NumberInput/NumberInput.Skeleton.js +33 -37
- package/lib/components/NumberInput/NumberInput.js +569 -950
- package/lib/components/OrderedList/OrderedList.js +35 -48
- package/lib/components/OverflowMenu/OverflowMenu.js +341 -454
- package/lib/components/OverflowMenu/index.js +27 -21
- package/lib/components/OverflowMenu/next/index.js +158 -188
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +104 -164
- package/lib/components/OverflowMenuItem/index.js +12 -9
- package/lib/components/OverflowMenuV2/index.js +25 -15
- package/lib/components/PageHeader/PageHeader.js +301 -444
- package/lib/components/PageHeader/index.js +27 -19
- package/lib/components/Pagination/Pagination.Skeleton.js +38 -37
- package/lib/components/Pagination/Pagination.d.ts +1 -1
- package/lib/components/Pagination/Pagination.js +256 -360
- package/lib/components/Pagination/experimental/PageSelector.js +48 -58
- package/lib/components/Pagination/experimental/Pagination-story.d.ts +114 -0
- package/lib/components/Pagination/experimental/Pagination.js +148 -200
- package/lib/components/PaginationNav/PaginationNav.js +324 -430
- package/lib/components/Popover/index.js +323 -440
- package/lib/components/PrimaryButton/PrimaryButton.js +19 -13
- package/lib/components/ProgressBar/ProgressBar.js +121 -147
- package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +46 -43
- package/lib/components/ProgressIndicator/ProgressIndicator.js +150 -245
- package/lib/components/RadioButton/RadioButton.Skeleton.js +27 -27
- package/lib/components/RadioButton/RadioButton.js +105 -178
- package/lib/components/RadioButton/index.js +12 -9
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +139 -211
- package/lib/components/RadioTile/RadioTile.js +108 -172
- package/lib/components/RadioTile/index.js +12 -9
- package/lib/components/Search/Search.Skeleton.js +32 -38
- package/lib/components/Search/Search.js +185 -281
- package/lib/components/Search/index.js +13 -11
- package/lib/components/Search/utils.js +11 -4
- package/lib/components/SecondaryButton/SecondaryButton.js +19 -13
- package/lib/components/Select/Select.Skeleton.js +31 -35
- package/lib/components/Select/Select.js +182 -261
- package/lib/components/Select/index.js +13 -11
- package/lib/components/SelectItem/SelectItem.js +37 -52
- package/lib/components/SelectItem/index.js +12 -9
- package/lib/components/SelectItemGroup/SelectItemGroup.js +31 -41
- package/lib/components/ShapeIndicator/index.d.ts +1 -1
- package/lib/components/ShapeIndicator/index.js +78 -83
- package/lib/components/SkeletonIcon/SkeletonIcon.js +25 -28
- package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +25 -28
- package/lib/components/SkeletonText/SkeletonText.js +71 -85
- package/lib/components/SkeletonText/index.js +12 -9
- package/lib/components/Slider/Slider.Skeleton.js +72 -95
- package/lib/components/Slider/Slider.js +868 -1319
- package/lib/components/Slider/SliderHandles.js +75 -68
- package/lib/components/Stack/HStack.js +22 -14
- package/lib/components/Stack/Stack.js +60 -82
- package/lib/components/Stack/VStack.js +22 -14
- package/lib/components/StructuredList/StructuredList.Skeleton.js +59 -52
- package/lib/components/StructuredList/StructuredList.js +182 -319
- package/lib/components/Switch/IconSwitch.js +103 -149
- package/lib/components/Switch/Switch.js +70 -103
- package/lib/components/TabContent/TabContent.js +32 -38
- package/lib/components/Tabs/Tabs.Skeleton.js +45 -41
- package/lib/components/Tabs/Tabs.js +738 -1153
- package/lib/components/Tabs/usePressable.js +98 -114
- package/lib/components/Tag/DismissibleTag.js +123 -160
- package/lib/components/Tag/OperationalTag.js +95 -115
- package/lib/components/Tag/SelectableTag.js +98 -133
- package/lib/components/Tag/Tag.Skeleton.js +30 -32
- package/lib/components/Tag/Tag.js +156 -204
- package/lib/components/Tag/isEllipsisActive.js +13 -9
- package/lib/components/Text/Text.js +69 -81
- package/lib/components/Text/TextDirection.js +39 -39
- package/lib/components/Text/TextDirectionContext.js +15 -10
- package/lib/components/Text/createTextComponent.js +29 -22
- package/lib/components/TextArea/TextArea.Skeleton.js +29 -34
- package/lib/components/TextArea/TextArea.js +319 -426
- package/lib/components/TextArea/index.js +13 -11
- package/lib/components/TextInput/ControlledPasswordInput.js +137 -202
- package/lib/components/TextInput/PasswordInput.js +200 -307
- package/lib/components/TextInput/TextInput.Skeleton.js +28 -33
- package/lib/components/TextInput/TextInput.js +223 -321
- package/lib/components/TextInput/index.js +13 -11
- package/lib/components/TextInput/util.js +21 -26
- package/lib/components/Theme/index.js +83 -97
- package/lib/components/Tile/Tile.js +398 -595
- package/lib/components/TileGroup/TileGroup.js +73 -113
- package/lib/components/TimePicker/TimePicker.d.ts +1 -1
- package/lib/components/TimePicker/TimePicker.js +152 -251
- package/lib/components/TimePickerSelect/TimePickerSelect.js +47 -62
- package/lib/components/Toggle/Toggle.Skeleton.js +28 -24
- package/lib/components/Toggle/Toggle.js +106 -176
- package/lib/components/ToggleSmall/ToggleSmall.Skeleton.js +50 -53
- package/lib/components/Toggletip/index.d.ts +2 -2
- package/lib/components/Toggletip/index.js +174 -258
- package/lib/components/Tooltip/DefinitionTooltip.js +102 -140
- package/lib/components/Tooltip/Tooltip.js +192 -265
- package/lib/components/TreeView/TreeContext.js +14 -7
- package/lib/components/TreeView/TreeNode.js +365 -504
- package/lib/components/TreeView/TreeView.js +169 -242
- package/lib/components/UIShell/Content.js +27 -34
- package/lib/components/UIShell/Header.js +29 -33
- package/lib/components/UIShell/HeaderContainer.js +34 -44
- package/lib/components/UIShell/HeaderGlobalAction.js +69 -94
- package/lib/components/UIShell/HeaderGlobalBar.js +17 -14
- package/lib/components/UIShell/HeaderMenu.js +146 -221
- package/lib/components/UIShell/HeaderMenuButton.js +47 -70
- package/lib/components/UIShell/HeaderMenuItem.js +53 -80
- package/lib/components/UIShell/HeaderName.js +36 -48
- package/lib/components/UIShell/HeaderNavigation.js +36 -41
- package/lib/components/UIShell/HeaderPanel.js +78 -101
- package/lib/components/UIShell/HeaderSideNavItems.js +31 -37
- package/lib/components/UIShell/Link.js +32 -54
- package/lib/components/UIShell/SideNav.js +136 -245
- package/lib/components/UIShell/SideNavContext.js +23 -17
- package/lib/components/UIShell/SideNavDetails.js +33 -38
- package/lib/components/UIShell/SideNavDivider.js +25 -25
- package/lib/components/UIShell/SideNavFooter.js +47 -56
- package/lib/components/UIShell/SideNavHeader.js +30 -39
- package/lib/components/UIShell/SideNavIcon.js +32 -37
- package/lib/components/UIShell/SideNavItem.js +32 -37
- package/lib/components/UIShell/SideNavItems.js +35 -44
- package/lib/components/UIShell/SideNavLink.js +56 -83
- package/lib/components/UIShell/SideNavLinkText.js +28 -29
- package/lib/components/UIShell/SideNavMenu.js +106 -148
- package/lib/components/UIShell/SideNavMenuItem.js +44 -56
- package/lib/components/UIShell/SideNavSwitcher.js +63 -72
- package/lib/components/UIShell/SkipToContent.js +32 -40
- package/lib/components/UIShell/Switcher.js +73 -103
- package/lib/components/UIShell/SwitcherDivider.js +26 -28
- package/lib/components/UIShell/SwitcherItem.js +78 -118
- package/lib/components/UnorderedList/UnorderedList.js +32 -41
- package/lib/feature-flags.js +21 -13
- package/lib/index.js +622 -602
- package/lib/internal/FloatingMenu.js +249 -296
- package/lib/internal/OptimizedResize.js +35 -47
- package/lib/internal/Selection.js +102 -134
- package/lib/internal/clamp.js +12 -5
- package/lib/internal/defaultItemToString.js +15 -10
- package/lib/internal/deprecateFieldOnObject.js +23 -16
- package/lib/internal/environment.js +15 -8
- package/lib/internal/getAnnouncement.js +16 -14
- package/lib/internal/keyboard/keys.js +48 -49
- package/lib/internal/keyboard/match.js +25 -43
- package/lib/internal/keyboard/navigation.js +22 -29
- package/lib/internal/noopFn.js +10 -3
- package/lib/internal/useAttachedMenu.js +44 -53
- package/lib/internal/useControllableState.js +44 -50
- package/lib/internal/useDelayedState.js +31 -37
- package/lib/internal/useEvent.js +40 -37
- package/lib/internal/useId.js +54 -91
- package/lib/internal/useIdPrefix.js +15 -7
- package/lib/internal/useIsomorphicEffect.js +13 -8
- package/lib/internal/useMatchMedia.js +30 -23
- package/lib/internal/useMergedRefs.js +27 -24
- package/lib/internal/useNoInteractiveChildren.js +73 -101
- package/lib/internal/useNormalizedInputProps.js +55 -53
- package/lib/internal/useOutsideClick.js +22 -26
- package/lib/internal/useOverflowItems.js +90 -94
- package/lib/internal/usePrefix.js +15 -7
- package/lib/internal/usePresence.js +52 -56
- package/lib/internal/usePresenceContext.js +36 -37
- package/lib/internal/usePreviousValue.js +27 -20
- package/lib/internal/useResizeObserver.js +58 -68
- package/lib/internal/useSavedCallback.js +25 -19
- package/lib/internal/utils.js +18 -11
- package/lib/internal/warning.js +24 -23
- package/lib/internal/wrapFocus.js +78 -100
- package/lib/prop-types/AriaPropTypes.js +17 -9
- package/lib/prop-types/deprecate.js +30 -29
- package/lib/prop-types/deprecateComponent.js +17 -10
- package/lib/prop-types/deprecateValuesWithin.js +18 -23
- package/lib/prop-types/isRequiredOneOf.js +21 -25
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +14 -15
- package/lib/tools/events.js +17 -22
- package/lib/tools/mapPopoverAlign.js +19 -19
- package/lib/tools/mergeRefs.js +14 -18
- package/lib/tools/setupGetInstanceId.js +16 -9
- package/lib/tools/toggleClass.js +17 -10
- package/lib/tools/wrapComponent.js +38 -43
- package/package.json +10 -16
- package/es/_virtual/_rollupPluginBabelHelpers.js +0 -40
- package/es/components/DataTable/stories/examples/TableToolbarFilter.d.ts +0 -54
- package/es/node_modules/es-toolkit/dist/compat/function/debounce.js +0 -55
- package/es/node_modules/es-toolkit/dist/compat/function/throttle.js +0 -23
- package/es/node_modules/es-toolkit/dist/function/debounce.js +0 -70
- package/lib/_virtual/_rollupPluginBabelHelpers.js +0 -45
- package/lib/components/DataTable/stories/examples/TableToolbarFilter.d.ts +0 -54
- package/lib/node_modules/es-toolkit/dist/compat/function/debounce.js +0 -57
- package/lib/node_modules/es-toolkit/dist/compat/function/throttle.js +0 -25
- package/lib/node_modules/es-toolkit/dist/function/debounce.js +0 -72
|
@@ -1,1336 +1,885 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 2026
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
require(
|
|
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
|
-
const translationIds = {
|
|
51
|
-
'carbon.slider.auto-correct-announcement': 'carbon.slider.auto-correct-announcement'
|
|
52
|
-
};
|
|
53
|
-
const defaultTranslations = {
|
|
54
|
-
[translationIds['carbon.slider.auto-correct-announcement']]: 'The inputted value "{correctedValue}" was corrected to the nearest allowed digit.'
|
|
8
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.js');
|
|
9
|
+
const require_usePrefix = require('../../internal/usePrefix.js');
|
|
10
|
+
const require_Text = require('../Text/Text.js');
|
|
11
|
+
const require_keys = require('../../internal/keyboard/keys.js');
|
|
12
|
+
const require_match = require('../../internal/keyboard/match.js');
|
|
13
|
+
const require_useId = require('../../internal/useId.js');
|
|
14
|
+
const require_deprecate = require('../../prop-types/deprecate.js');
|
|
15
|
+
const require_Tooltip = require('../Tooltip/Tooltip.js');
|
|
16
|
+
const require_useNormalizedInputProps = require('../../internal/useNormalizedInputProps.js');
|
|
17
|
+
const require_clamp = require('../../internal/clamp.js');
|
|
18
|
+
const require_SliderHandles = require('./SliderHandles.js');
|
|
19
|
+
let classnames = require("classnames");
|
|
20
|
+
classnames = require_runtime.__toESM(classnames);
|
|
21
|
+
let react = require("react");
|
|
22
|
+
react = require_runtime.__toESM(react);
|
|
23
|
+
let prop_types = require("prop-types");
|
|
24
|
+
prop_types = require_runtime.__toESM(prop_types);
|
|
25
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
let _carbon_icons_react = require("@carbon/icons-react");
|
|
27
|
+
let es_toolkit_compat = require("es-toolkit/compat");
|
|
28
|
+
|
|
29
|
+
//#region src/components/Slider/Slider.tsx
|
|
30
|
+
/**
|
|
31
|
+
* Copyright IBM Corp. 2016, 2026
|
|
32
|
+
*
|
|
33
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
34
|
+
* LICENSE file in the root directory of this source tree.
|
|
35
|
+
*/
|
|
36
|
+
const ThumbWrapper = ({ hasTooltip, className, style, children, ...rest }) => {
|
|
37
|
+
if (hasTooltip) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Tooltip.Tooltip, {
|
|
38
|
+
className,
|
|
39
|
+
style,
|
|
40
|
+
...rest,
|
|
41
|
+
children
|
|
42
|
+
});
|
|
43
|
+
else return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
44
|
+
className,
|
|
45
|
+
style,
|
|
46
|
+
children
|
|
47
|
+
});
|
|
55
48
|
};
|
|
49
|
+
const translationIds = { "carbon.slider.auto-correct-announcement": "carbon.slider.auto-correct-announcement" };
|
|
50
|
+
const defaultTranslations = { [translationIds["carbon.slider.auto-correct-announcement"]]: "The inputted value \"{correctedValue}\" was corrected to the nearest allowed digit." };
|
|
56
51
|
const defaultTranslateWithId = (messageId, args) => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
return template;
|
|
52
|
+
const template = defaultTranslations[messageId];
|
|
53
|
+
if (args?.correctedValue) return template.replace("{correctedValue}", args.correctedValue);
|
|
54
|
+
return template;
|
|
62
55
|
};
|
|
63
56
|
const defaultFormatLabel = (value, label) => {
|
|
64
|
-
|
|
57
|
+
return `${value}${label ?? ""}`;
|
|
65
58
|
};
|
|
66
|
-
const hasUpperValue = valueUpper => typeof valueUpper !==
|
|
67
|
-
|
|
68
|
-
// TODO: Assuming a 16ms throttle corresponds to 60 FPS, should it be halved,
|
|
69
|
-
// since many systems can handle 120 FPS? If it doesn't correspond to 60 FPS,
|
|
70
|
-
// what does it correspond to?
|
|
59
|
+
const hasUpperValue = (valueUpper) => typeof valueUpper !== "undefined";
|
|
71
60
|
/**
|
|
72
|
-
|
|
73
|
-
|
|
61
|
+
* Minimum time between processed "drag" events in milliseconds.
|
|
62
|
+
*/
|
|
74
63
|
const EVENT_THROTTLE = 16;
|
|
75
|
-
const DRAG_EVENT_TYPES = new Set([
|
|
76
|
-
const DRAG_STOP_EVENT_TYPES = new Set([
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
let newValue = getAdjustedValue({
|
|
859
|
-
value: newValueInput,
|
|
860
|
-
min,
|
|
861
|
-
max
|
|
862
|
-
});
|
|
863
|
-
|
|
864
|
-
// TODO: Just return the value.
|
|
865
|
-
// Next adjust to the opposite handle.
|
|
866
|
-
if (handle === HandlePosition.LOWER && valueUpper) {
|
|
867
|
-
newValue = newValue > valueUpper ? valueUpper : newValue;
|
|
868
|
-
} else if (handle === HandlePosition.UPPER && value) {
|
|
869
|
-
newValue = newValue < value ? value : newValue;
|
|
870
|
-
}
|
|
871
|
-
return newValue;
|
|
872
|
-
};
|
|
873
|
-
const getAdjustedValue = ({
|
|
874
|
-
value,
|
|
875
|
-
min,
|
|
876
|
-
max
|
|
877
|
-
}) => {
|
|
878
|
-
// TODO: Just return the value.
|
|
879
|
-
if (value < min) {
|
|
880
|
-
value = min;
|
|
881
|
-
}
|
|
882
|
-
if (value > max) {
|
|
883
|
-
value = max;
|
|
884
|
-
}
|
|
885
|
-
return value;
|
|
886
|
-
};
|
|
887
|
-
|
|
888
|
-
/**
|
|
889
|
-
* Get the bounding rect for the requested handles' DOM element.
|
|
890
|
-
*
|
|
891
|
-
* If the bounding rect is not available, a new, empty DOMRect is returned.
|
|
892
|
-
*/
|
|
893
|
-
const getHandleBoundingRect = handle => {
|
|
894
|
-
let boundingRect;
|
|
895
|
-
if (handle === HandlePosition.LOWER) {
|
|
896
|
-
boundingRect = thumbRef.current?.getBoundingClientRect();
|
|
897
|
-
} else {
|
|
898
|
-
boundingRect = thumbRefUpper.current?.getBoundingClientRect();
|
|
899
|
-
}
|
|
900
|
-
return boundingRect ?? new DOMRect();
|
|
901
|
-
};
|
|
902
|
-
const getClientXFromEvent = event => {
|
|
903
|
-
let clientX;
|
|
904
|
-
if ('clientX' in event) {
|
|
905
|
-
clientX = event.clientX;
|
|
906
|
-
} else if ('touches' in event && 0 in event.touches && 'clientX' in event.touches[0]) {
|
|
907
|
-
clientX = event.touches[0].clientX;
|
|
908
|
-
}
|
|
909
|
-
return clientX;
|
|
910
|
-
};
|
|
911
|
-
React.useEffect(() => {
|
|
912
|
-
const {
|
|
913
|
-
isValid,
|
|
914
|
-
isValidUpper
|
|
915
|
-
} = stateRef.current;
|
|
916
|
-
const derivedState = {};
|
|
917
|
-
|
|
918
|
-
// Will override state in favor of invalid prop
|
|
919
|
-
if (props.invalid === true) {
|
|
920
|
-
if (isValid === true) derivedState.isValid = false;
|
|
921
|
-
if (isValidUpper === true) derivedState.isValidUpper = false;
|
|
922
|
-
} else if (props.invalid === false) {
|
|
923
|
-
if (isValid === false) derivedState.isValid = true;
|
|
924
|
-
if (isValidUpper === false) derivedState.isValidUpper = true;
|
|
925
|
-
}
|
|
926
|
-
if (Object.keys(derivedState).length) {
|
|
927
|
-
setState(derivedState);
|
|
928
|
-
}
|
|
929
|
-
}, [props.invalid]);
|
|
930
|
-
const {
|
|
931
|
-
ariaLabelInput,
|
|
932
|
-
unstable_ariaLabelInputUpper: ariaLabelInputUpper,
|
|
933
|
-
className,
|
|
934
|
-
hideTextInput = false,
|
|
935
|
-
id: idProp,
|
|
936
|
-
min,
|
|
937
|
-
minLabel,
|
|
938
|
-
max,
|
|
939
|
-
maxLabel,
|
|
940
|
-
formatLabel = defaultFormatLabel,
|
|
941
|
-
labelText,
|
|
942
|
-
hideLabel,
|
|
943
|
-
step = 1,
|
|
944
|
-
inputType = 'number',
|
|
945
|
-
invalidText,
|
|
946
|
-
required,
|
|
947
|
-
disabled = false,
|
|
948
|
-
name,
|
|
949
|
-
unstable_nameUpper: nameUpper,
|
|
950
|
-
light,
|
|
951
|
-
readOnly = false,
|
|
952
|
-
warn = false,
|
|
953
|
-
warnText,
|
|
954
|
-
translateWithId: t = defaultTranslateWithId,
|
|
955
|
-
...other
|
|
956
|
-
} = props;
|
|
957
|
-
const id = idProp ?? generatedId;
|
|
958
|
-
const {
|
|
959
|
-
value,
|
|
960
|
-
valueUpper,
|
|
961
|
-
isValid,
|
|
962
|
-
isValidUpper,
|
|
963
|
-
correctedValue,
|
|
964
|
-
correctedPosition,
|
|
965
|
-
isRtl
|
|
966
|
-
} = state;
|
|
967
|
-
const normalizedProps = useNormalizedInputProps.useNormalizedInputProps({
|
|
968
|
-
id,
|
|
969
|
-
disabled,
|
|
970
|
-
readOnly,
|
|
971
|
-
invalid: !isValid,
|
|
972
|
-
warn
|
|
973
|
-
});
|
|
974
|
-
const normalizedUpperProps = useNormalizedInputProps.useNormalizedInputProps({
|
|
975
|
-
id,
|
|
976
|
-
disabled,
|
|
977
|
-
readOnly,
|
|
978
|
-
invalid: !isValidUpper,
|
|
979
|
-
warn
|
|
980
|
-
});
|
|
981
|
-
delete other.invalid;
|
|
982
|
-
delete other.onRelease;
|
|
983
|
-
delete other.stepMultiplier;
|
|
984
|
-
delete other.unstable_valueUpper;
|
|
985
|
-
const showWarning = normalizedProps.warn || correctedPosition === HandlePosition.LOWER && isValid;
|
|
986
|
-
const showWarningUpper = normalizedUpperProps.warn || correctedPosition === (twoHandles ? HandlePosition.UPPER : HandlePosition.LOWER) && (twoHandles ? isValidUpper : isValid);
|
|
987
|
-
const labelId = `${id}-label`;
|
|
988
|
-
const labelClasses = cx(`${prefix}--label`, {
|
|
989
|
-
[`${prefix}--visually-hidden`]: hideLabel,
|
|
990
|
-
[`${prefix}--label--disabled`]: disabled
|
|
991
|
-
});
|
|
992
|
-
const containerClasses = cx(`${prefix}--slider-container`, {
|
|
993
|
-
[`${prefix}--slider-container--two-handles`]: twoHandles,
|
|
994
|
-
[`${prefix}--slider-container--disabled`]: disabled,
|
|
995
|
-
[`${prefix}--slider-container--readonly`]: readOnly,
|
|
996
|
-
[`${prefix}--slider-container--rtl`]: isRtl
|
|
997
|
-
});
|
|
998
|
-
const sliderClasses = cx(`${prefix}--slider`, {
|
|
999
|
-
[`${prefix}--slider--disabled`]: disabled,
|
|
1000
|
-
[`${prefix}--slider--readonly`]: readOnly
|
|
1001
|
-
});
|
|
1002
|
-
const fixedInputClasses = [`${prefix}--text-input`, `${prefix}--slider-text-input`];
|
|
1003
|
-
const conditionalInputClasses = {
|
|
1004
|
-
[`${prefix}--text-input--light`]: light
|
|
1005
|
-
};
|
|
1006
|
-
const lowerInputClasses = cx([...fixedInputClasses, `${prefix}--slider-text-input--lower`, conditionalInputClasses, {
|
|
1007
|
-
[`${prefix}--text-input--invalid`]: normalizedProps.invalid,
|
|
1008
|
-
[`${prefix}--slider-text-input--warn`]: showWarning
|
|
1009
|
-
}]);
|
|
1010
|
-
const upperInputClasses = cx([...fixedInputClasses, `${prefix}--slider-text-input--upper`, conditionalInputClasses, {
|
|
1011
|
-
[`${prefix}--text-input--invalid`]: twoHandles ? normalizedUpperProps.invalid : normalizedProps.invalid,
|
|
1012
|
-
[`${prefix}--slider-text-input--warn`]: showWarningUpper
|
|
1013
|
-
}]);
|
|
1014
|
-
const lowerInputWrapperClasses = cx([`${prefix}--text-input-wrapper`, `${prefix}--slider-text-input-wrapper`, `${prefix}--slider-text-input-wrapper--lower`, {
|
|
1015
|
-
[`${prefix}--text-input-wrapper--readonly`]: readOnly,
|
|
1016
|
-
[`${prefix}--slider-text-input-wrapper--hidden`]: hideTextInput
|
|
1017
|
-
}]);
|
|
1018
|
-
const upperInputWrapperClasses = cx([`${prefix}--text-input-wrapper`, `${prefix}--slider-text-input-wrapper`, `${prefix}--slider-text-input-wrapper--upper`, {
|
|
1019
|
-
[`${prefix}--text-input-wrapper--readonly`]: readOnly,
|
|
1020
|
-
[`${prefix}--slider-text-input-wrapper--hidden`]: hideTextInput
|
|
1021
|
-
}]);
|
|
1022
|
-
const lowerThumbClasses = cx(`${prefix}--slider__thumb`, {
|
|
1023
|
-
[`${prefix}--slider__thumb--lower`]: twoHandles
|
|
1024
|
-
});
|
|
1025
|
-
const upperThumbClasses = cx(`${prefix}--slider__thumb`, {
|
|
1026
|
-
[`${prefix}--slider__thumb--upper`]: twoHandles
|
|
1027
|
-
});
|
|
1028
|
-
const lowerThumbWrapperClasses = cx([`${prefix}--icon-tooltip`, `${prefix}--slider__thumb-wrapper`, {
|
|
1029
|
-
[`${prefix}--slider__thumb-wrapper--lower`]: twoHandles
|
|
1030
|
-
}]);
|
|
1031
|
-
const upperThumbWrapperClasses = cx([`${prefix}--icon-tooltip`, `${prefix}--slider__thumb-wrapper`, {
|
|
1032
|
-
[`${prefix}--slider__thumb-wrapper--upper`]: twoHandles
|
|
1033
|
-
}]);
|
|
1034
|
-
const lowerThumbWrapperProps = {
|
|
1035
|
-
style: {
|
|
1036
|
-
insetInlineStart: `${state.left}%`
|
|
1037
|
-
}
|
|
1038
|
-
};
|
|
1039
|
-
const upperThumbWrapperProps = {
|
|
1040
|
-
style: {
|
|
1041
|
-
insetInlineStart: `${state.leftUpper}%`
|
|
1042
|
-
}
|
|
1043
|
-
};
|
|
1044
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
1045
|
-
className: cx(`${prefix}--form-item`, className)
|
|
1046
|
-
}, /*#__PURE__*/React.createElement(Text.Text, {
|
|
1047
|
-
as: "label",
|
|
1048
|
-
htmlFor: twoHandles ? undefined : id,
|
|
1049
|
-
className: labelClasses,
|
|
1050
|
-
id: labelId
|
|
1051
|
-
}, labelText), /*#__PURE__*/React.createElement("div", {
|
|
1052
|
-
className: containerClasses
|
|
1053
|
-
}, twoHandles ? /*#__PURE__*/React.createElement("div", {
|
|
1054
|
-
className: lowerInputWrapperClasses
|
|
1055
|
-
}, /*#__PURE__*/React.createElement("input", {
|
|
1056
|
-
type: hideTextInput ? 'hidden' : inputType,
|
|
1057
|
-
id: `${id}-lower-input-for-slider`,
|
|
1058
|
-
name: name,
|
|
1059
|
-
className: lowerInputClasses,
|
|
1060
|
-
value: value,
|
|
1061
|
-
"aria-label": ariaLabelInput,
|
|
1062
|
-
disabled: disabled,
|
|
1063
|
-
required: required,
|
|
1064
|
-
min: min,
|
|
1065
|
-
max: max,
|
|
1066
|
-
step: step,
|
|
1067
|
-
onChange: onChangeInput,
|
|
1068
|
-
onBlur: onBlurInput,
|
|
1069
|
-
onKeyUp: props.onInputKeyUp,
|
|
1070
|
-
onKeyDown: onInputKeyDown,
|
|
1071
|
-
"data-invalid": normalizedProps.invalid ? true : null,
|
|
1072
|
-
"data-handle-position": HandlePosition.LOWER,
|
|
1073
|
-
"aria-invalid": normalizedProps.invalid ? true : undefined,
|
|
1074
|
-
readOnly: readOnly
|
|
1075
|
-
}), normalizedProps.invalid && /*#__PURE__*/React.createElement(iconsReact.WarningFilled, {
|
|
1076
|
-
className: `${prefix}--slider__invalid-icon`
|
|
1077
|
-
}), showWarning && /*#__PURE__*/React.createElement(iconsReact.WarningAltFilled, {
|
|
1078
|
-
className: `${prefix}--slider__invalid-icon ${prefix}--slider__invalid-icon--warning`
|
|
1079
|
-
})) : null, /*#__PURE__*/React.createElement(Text.Text, {
|
|
1080
|
-
className: `${prefix}--slider__range-label`
|
|
1081
|
-
}, formatLabel(min, minLabel)), /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({
|
|
1082
|
-
className: sliderClasses,
|
|
1083
|
-
ref: node => {
|
|
1084
|
-
elementRef.current = node;
|
|
1085
|
-
},
|
|
1086
|
-
onMouseDown: onDragStart,
|
|
1087
|
-
onTouchStart: onDragStart,
|
|
1088
|
-
onKeyDown: onKeyDown,
|
|
1089
|
-
role: "presentation",
|
|
1090
|
-
tabIndex: -1,
|
|
1091
|
-
"data-invalid": (twoHandles ? normalizedProps.invalid || normalizedUpperProps.invalid : normalizedProps.invalid) ? true : null
|
|
1092
|
-
}, other), /*#__PURE__*/React.createElement(ThumbWrapper, _rollupPluginBabelHelpers.extends({
|
|
1093
|
-
hasTooltip: hideTextInput,
|
|
1094
|
-
className: lowerThumbWrapperClasses,
|
|
1095
|
-
label: formatLabel(value, undefined),
|
|
1096
|
-
align: "top"
|
|
1097
|
-
}, lowerThumbWrapperProps), /*#__PURE__*/React.createElement("div", {
|
|
1098
|
-
className: lowerThumbClasses,
|
|
1099
|
-
role: "slider",
|
|
1100
|
-
id: twoHandles ? undefined : id,
|
|
1101
|
-
tabIndex: readOnly || disabled ? undefined : 0,
|
|
1102
|
-
"aria-valuetext": formatLabel(value, undefined),
|
|
1103
|
-
"aria-valuemax": twoHandles ? valueUpper : max,
|
|
1104
|
-
"aria-valuemin": min,
|
|
1105
|
-
"aria-valuenow": value,
|
|
1106
|
-
"aria-labelledby": twoHandles ? undefined : labelId,
|
|
1107
|
-
"aria-label": twoHandles ? ariaLabelInput : undefined,
|
|
1108
|
-
ref: thumbRef,
|
|
1109
|
-
onFocus: () => setState({
|
|
1110
|
-
activeHandle: HandlePosition.LOWER
|
|
1111
|
-
})
|
|
1112
|
-
}, twoHandles && !isRtl ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SliderHandles.LowerHandle, {
|
|
1113
|
-
"aria-label": ariaLabelInput
|
|
1114
|
-
}), /*#__PURE__*/React.createElement(SliderHandles.LowerHandleFocus, {
|
|
1115
|
-
"aria-label": ariaLabelInput
|
|
1116
|
-
})) : twoHandles && isRtl ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SliderHandles.UpperHandle, {
|
|
1117
|
-
"aria-label": ariaLabelInputUpper
|
|
1118
|
-
}), /*#__PURE__*/React.createElement(SliderHandles.UpperHandleFocus, {
|
|
1119
|
-
"aria-label": ariaLabelInputUpper
|
|
1120
|
-
})) : undefined)), hasUpperValue(valueUpper) ? /*#__PURE__*/React.createElement(ThumbWrapper, _rollupPluginBabelHelpers.extends({
|
|
1121
|
-
hasTooltip: hideTextInput,
|
|
1122
|
-
className: upperThumbWrapperClasses,
|
|
1123
|
-
label: formatLabel(valueUpper, undefined),
|
|
1124
|
-
align: "top"
|
|
1125
|
-
}, upperThumbWrapperProps), /*#__PURE__*/React.createElement("div", {
|
|
1126
|
-
className: upperThumbClasses,
|
|
1127
|
-
role: "slider",
|
|
1128
|
-
tabIndex: readOnly || disabled ? undefined : 0,
|
|
1129
|
-
"aria-valuemax": max,
|
|
1130
|
-
"aria-valuemin": value,
|
|
1131
|
-
"aria-valuenow": valueUpper,
|
|
1132
|
-
"aria-label": ariaLabelInputUpper,
|
|
1133
|
-
ref: thumbRefUpper,
|
|
1134
|
-
onFocus: () => setState({
|
|
1135
|
-
activeHandle: HandlePosition.UPPER
|
|
1136
|
-
})
|
|
1137
|
-
}, !isRtl ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SliderHandles.UpperHandle, {
|
|
1138
|
-
"aria-label": ariaLabelInputUpper
|
|
1139
|
-
}), /*#__PURE__*/React.createElement(SliderHandles.UpperHandleFocus, {
|
|
1140
|
-
"aria-label": ariaLabelInputUpper
|
|
1141
|
-
})) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SliderHandles.LowerHandle, {
|
|
1142
|
-
"aria-label": ariaLabelInput
|
|
1143
|
-
}), /*#__PURE__*/React.createElement(SliderHandles.LowerHandleFocus, {
|
|
1144
|
-
"aria-label": ariaLabelInput
|
|
1145
|
-
})))) : null, /*#__PURE__*/React.createElement("div", {
|
|
1146
|
-
className: `${prefix}--slider__track`,
|
|
1147
|
-
ref: node => {
|
|
1148
|
-
trackRef.current = node;
|
|
1149
|
-
}
|
|
1150
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
1151
|
-
className: `${prefix}--slider__filled-track`,
|
|
1152
|
-
ref: filledTrackRef
|
|
1153
|
-
})), /*#__PURE__*/React.createElement(Text.Text, {
|
|
1154
|
-
className: `${prefix}--slider__range-label`
|
|
1155
|
-
}, formatLabel(max, maxLabel)), /*#__PURE__*/React.createElement("div", {
|
|
1156
|
-
className: upperInputWrapperClasses
|
|
1157
|
-
}, /*#__PURE__*/React.createElement("input", {
|
|
1158
|
-
type: hideTextInput ? 'hidden' : inputType,
|
|
1159
|
-
id: `${id}-${twoHandles ? 'upper-' : ''}input-for-slider`,
|
|
1160
|
-
name: twoHandles ? nameUpper : name,
|
|
1161
|
-
className: upperInputClasses,
|
|
1162
|
-
value: twoHandles ? valueUpper : value,
|
|
1163
|
-
"aria-labelledby": !ariaLabelInput && !twoHandles ? labelId : undefined,
|
|
1164
|
-
"aria-label": twoHandles ? ariaLabelInputUpper : ariaLabelInput ? ariaLabelInput : undefined,
|
|
1165
|
-
disabled: disabled,
|
|
1166
|
-
required: required,
|
|
1167
|
-
min: min,
|
|
1168
|
-
max: max,
|
|
1169
|
-
step: step,
|
|
1170
|
-
onChange: onChangeInput,
|
|
1171
|
-
onBlur: onBlurInput,
|
|
1172
|
-
onKeyDown: onInputKeyDown,
|
|
1173
|
-
onKeyUp: props.onInputKeyUp,
|
|
1174
|
-
"data-invalid": (twoHandles ? normalizedUpperProps.invalid : normalizedProps.invalid) ? true : null,
|
|
1175
|
-
"data-handle-position": twoHandles ? HandlePosition.UPPER : null,
|
|
1176
|
-
"aria-invalid": (twoHandles ? normalizedUpperProps.invalid : normalizedProps.invalid) ? true : undefined,
|
|
1177
|
-
readOnly: readOnly
|
|
1178
|
-
}), (twoHandles ? normalizedUpperProps.invalid : normalizedProps.invalid) && /*#__PURE__*/React.createElement(iconsReact.WarningFilled, {
|
|
1179
|
-
className: `${prefix}--slider__invalid-icon`
|
|
1180
|
-
}), showWarningUpper && /*#__PURE__*/React.createElement(iconsReact.WarningAltFilled, {
|
|
1181
|
-
className: `${prefix}--slider__invalid-icon ${prefix}--slider__invalid-icon--warning`
|
|
1182
|
-
}))), (normalizedProps.invalid || normalizedUpperProps.invalid) && /*#__PURE__*/React.createElement(Text.Text, {
|
|
1183
|
-
as: "div",
|
|
1184
|
-
className: cx(`${prefix}--slider__validation-msg`, `${prefix}--slider__validation-msg--invalid`, `${prefix}--form-requirement`)
|
|
1185
|
-
}, invalidText), (normalizedProps.warn || normalizedUpperProps.warn) && /*#__PURE__*/React.createElement(Text.Text, {
|
|
1186
|
-
as: "div",
|
|
1187
|
-
className: cx(`${prefix}--slider__validation-msg`, `${prefix}--form-requirement`)
|
|
1188
|
-
}, warnText), correctedValue && /*#__PURE__*/React.createElement(Text.Text, {
|
|
1189
|
-
as: "div",
|
|
1190
|
-
role: "alert",
|
|
1191
|
-
className: cx(`${prefix}--slider__status-msg`, `${prefix}--form-requirement`)
|
|
1192
|
-
}, t(translationIds['carbon.slider.auto-correct-announcement'], {
|
|
1193
|
-
correctedValue
|
|
1194
|
-
})));
|
|
64
|
+
const DRAG_EVENT_TYPES = new Set(["mousemove", "touchmove"]);
|
|
65
|
+
const DRAG_STOP_EVENT_TYPES = new Set([
|
|
66
|
+
"mouseup",
|
|
67
|
+
"touchend",
|
|
68
|
+
"touchcancel"
|
|
69
|
+
]);
|
|
70
|
+
var HandlePosition = /* @__PURE__ */ function(HandlePosition) {
|
|
71
|
+
HandlePosition["LOWER"] = "lower";
|
|
72
|
+
HandlePosition["UPPER"] = "upper";
|
|
73
|
+
return HandlePosition;
|
|
74
|
+
}(HandlePosition || {});
|
|
75
|
+
const Slider = (props) => {
|
|
76
|
+
const [state, setState] = (0, react.useReducer)((prev, args) => ({
|
|
77
|
+
...prev,
|
|
78
|
+
...args
|
|
79
|
+
}), {
|
|
80
|
+
value: props.value,
|
|
81
|
+
valueUpper: props.unstable_valueUpper,
|
|
82
|
+
left: 0,
|
|
83
|
+
leftUpper: 0,
|
|
84
|
+
needsOnRelease: false,
|
|
85
|
+
isValid: true,
|
|
86
|
+
isValidUpper: true,
|
|
87
|
+
activeHandle: void 0,
|
|
88
|
+
correctedValue: null,
|
|
89
|
+
correctedPosition: null,
|
|
90
|
+
isRtl: false
|
|
91
|
+
});
|
|
92
|
+
const stateRef = (0, react.useRef)(state);
|
|
93
|
+
(0, react.useEffect)(() => {
|
|
94
|
+
stateRef.current = state;
|
|
95
|
+
}, [state]);
|
|
96
|
+
const propsRef = (0, react.useRef)(props);
|
|
97
|
+
(0, react.useEffect)(() => {
|
|
98
|
+
propsRef.current = props;
|
|
99
|
+
}, [props]);
|
|
100
|
+
const thumbRef = (0, react.useRef)(null);
|
|
101
|
+
const thumbRefUpper = (0, react.useRef)(null);
|
|
102
|
+
const filledTrackRef = (0, react.useRef)(null);
|
|
103
|
+
const elementRef = (0, react.useRef)(null);
|
|
104
|
+
const trackRef = (0, react.useRef)(null);
|
|
105
|
+
const generatedId = require_useId.useId();
|
|
106
|
+
const prefix = require_usePrefix.usePrefix();
|
|
107
|
+
const twoHandles = hasUpperValue(state.valueUpper);
|
|
108
|
+
/**
|
|
109
|
+
* Sets up initial slider position and value in response to component mount.
|
|
110
|
+
*/
|
|
111
|
+
(0, react.useEffect)(() => {
|
|
112
|
+
if (elementRef.current) {
|
|
113
|
+
const isRtl = document?.dir === "rtl";
|
|
114
|
+
if (twoHandles) {
|
|
115
|
+
const { value, left } = calcValue({
|
|
116
|
+
value: stateRef.current.value,
|
|
117
|
+
useRawValue: true
|
|
118
|
+
});
|
|
119
|
+
const { value: valueUpper, left: leftUpper } = calcValue({
|
|
120
|
+
value: stateRef.current.valueUpper,
|
|
121
|
+
useRawValue: true
|
|
122
|
+
});
|
|
123
|
+
setState({
|
|
124
|
+
isRtl,
|
|
125
|
+
value,
|
|
126
|
+
left,
|
|
127
|
+
valueUpper,
|
|
128
|
+
leftUpper
|
|
129
|
+
});
|
|
130
|
+
} else {
|
|
131
|
+
const { value, left } = calcValue({
|
|
132
|
+
value: stateRef.current.value,
|
|
133
|
+
useRawValue: true
|
|
134
|
+
});
|
|
135
|
+
setState({
|
|
136
|
+
isRtl,
|
|
137
|
+
value,
|
|
138
|
+
left
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return () => {
|
|
143
|
+
DRAG_STOP_EVENT_TYPES.forEach((element) => elementRef.current?.ownerDocument.removeEventListener(element, onDragStop));
|
|
144
|
+
DRAG_EVENT_TYPES.forEach((element) => elementRef.current?.ownerDocument.removeEventListener(element, handleDrag));
|
|
145
|
+
};
|
|
146
|
+
}, []);
|
|
147
|
+
(0, react.useEffect)(() => {
|
|
148
|
+
if (twoHandles) {
|
|
149
|
+
if (filledTrackRef.current) filledTrackRef.current.style.transform = state.isRtl ? `translate(${100 - state.leftUpper}%, -50%) scaleX(${(state.leftUpper - state.left) / 100})` : `translate(${state.left}%, -50%) scaleX(${(state.leftUpper - state.left) / 100})`;
|
|
150
|
+
} else if (filledTrackRef.current) filledTrackRef.current.style.transform = state.isRtl ? `translate(100%, -50%) scaleX(-${state.left / 100})` : `translate(0%, -50%) scaleX(${state.left / 100})`;
|
|
151
|
+
}, [
|
|
152
|
+
state.left,
|
|
153
|
+
state.leftUpper,
|
|
154
|
+
state.isRtl
|
|
155
|
+
]);
|
|
156
|
+
const prevValsRef = (0, react.useRef)(null);
|
|
157
|
+
(0, react.useEffect)(() => {
|
|
158
|
+
const prev = prevValsRef.current;
|
|
159
|
+
if (prev && (prev.value !== state.value || prev.valueUpper !== state.valueUpper) && typeof props.onChange === "function") props.onChange({
|
|
160
|
+
value: state.value,
|
|
161
|
+
valueUpper: state.valueUpper
|
|
162
|
+
});
|
|
163
|
+
prevValsRef.current = {
|
|
164
|
+
value: state.value,
|
|
165
|
+
valueUpper: state.valueUpper
|
|
166
|
+
};
|
|
167
|
+
}, [
|
|
168
|
+
state.value,
|
|
169
|
+
state.valueUpper,
|
|
170
|
+
props.onChange
|
|
171
|
+
]);
|
|
172
|
+
(0, react.useEffect)(() => {
|
|
173
|
+
if (state.needsOnRelease && typeof props.onRelease === "function") {
|
|
174
|
+
props.onRelease({
|
|
175
|
+
value: state.value,
|
|
176
|
+
valueUpper: state.valueUpper
|
|
177
|
+
});
|
|
178
|
+
setState({ needsOnRelease: false });
|
|
179
|
+
}
|
|
180
|
+
}, [
|
|
181
|
+
state.needsOnRelease,
|
|
182
|
+
state.value,
|
|
183
|
+
state.valueUpper,
|
|
184
|
+
props.onRelease
|
|
185
|
+
]);
|
|
186
|
+
const prevSyncKeysRef = (0, react.useRef)(null);
|
|
187
|
+
(0, react.useEffect)(() => {
|
|
188
|
+
const prev = prevSyncKeysRef.current;
|
|
189
|
+
const next = [
|
|
190
|
+
props.value,
|
|
191
|
+
props.unstable_valueUpper,
|
|
192
|
+
props.max,
|
|
193
|
+
props.min
|
|
194
|
+
];
|
|
195
|
+
if (!prev || prev[0] !== next[0] || prev[1] !== next[1] || prev[2] !== next[2] || prev[3] !== next[3]) {
|
|
196
|
+
setState(calcValue({
|
|
197
|
+
value: props.value,
|
|
198
|
+
useRawValue: true
|
|
199
|
+
}));
|
|
200
|
+
if (typeof props.unstable_valueUpper !== "undefined") {
|
|
201
|
+
const { value: valueUpper, left: leftUpper } = calcValue({
|
|
202
|
+
value: props.unstable_valueUpper,
|
|
203
|
+
useRawValue: true
|
|
204
|
+
});
|
|
205
|
+
setState({
|
|
206
|
+
valueUpper,
|
|
207
|
+
leftUpper
|
|
208
|
+
});
|
|
209
|
+
} else setState({
|
|
210
|
+
valueUpper: void 0,
|
|
211
|
+
leftUpper: void 0
|
|
212
|
+
});
|
|
213
|
+
prevSyncKeysRef.current = next;
|
|
214
|
+
}
|
|
215
|
+
}, [
|
|
216
|
+
props.value,
|
|
217
|
+
props.unstable_valueUpper,
|
|
218
|
+
props.max,
|
|
219
|
+
props.min
|
|
220
|
+
]);
|
|
221
|
+
/**
|
|
222
|
+
* Rounds a given value to the nearest step defined by the slider's `step`
|
|
223
|
+
* prop.
|
|
224
|
+
*
|
|
225
|
+
* @param value - The value to adjust to the nearest step. Defaults to `0`.
|
|
226
|
+
* @returns The value rounded to the precision determined by the step.
|
|
227
|
+
*/
|
|
228
|
+
const nearestStepValue = (value = 0) => {
|
|
229
|
+
const decimals = (props.step?.toString().split(".")[1] ?? "").length;
|
|
230
|
+
return Number(value.toFixed(decimals));
|
|
231
|
+
};
|
|
232
|
+
const handleDrag = (event) => {
|
|
233
|
+
if (event instanceof globalThis.MouseEvent || event instanceof globalThis.TouchEvent) onDrag(event);
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* Sets up "drag" event handlers and calls `onDrag` in case dragging
|
|
237
|
+
* started on somewhere other than the thumb without a corresponding "move"
|
|
238
|
+
* event.
|
|
239
|
+
*/
|
|
240
|
+
const onDragStart = (evt) => {
|
|
241
|
+
if (props.disabled || props.readOnly) return;
|
|
242
|
+
evt.preventDefault();
|
|
243
|
+
DRAG_STOP_EVENT_TYPES.forEach((element) => {
|
|
244
|
+
elementRef.current?.ownerDocument.addEventListener(element, onDragStop);
|
|
245
|
+
});
|
|
246
|
+
DRAG_EVENT_TYPES.forEach((element) => {
|
|
247
|
+
elementRef.current?.ownerDocument.addEventListener(element, handleDrag);
|
|
248
|
+
});
|
|
249
|
+
const clientX = getClientXFromEvent(evt.nativeEvent);
|
|
250
|
+
let activeHandle;
|
|
251
|
+
if (twoHandles) {
|
|
252
|
+
if (evt.target == thumbRef.current) activeHandle = HandlePosition.LOWER;
|
|
253
|
+
else if (evt.target == thumbRefUpper.current) activeHandle = HandlePosition.UPPER;
|
|
254
|
+
else if (clientX) if (calcDistanceToHandle(HandlePosition.LOWER, clientX) <= calcDistanceToHandle(HandlePosition.UPPER, clientX)) activeHandle = HandlePosition.LOWER;
|
|
255
|
+
else activeHandle = HandlePosition.UPPER;
|
|
256
|
+
}
|
|
257
|
+
const focusOptions = { preventScroll: true };
|
|
258
|
+
if (twoHandles) {
|
|
259
|
+
if (thumbRef.current && activeHandle === HandlePosition.LOWER) thumbRef.current.focus(focusOptions);
|
|
260
|
+
else if (thumbRefUpper.current && activeHandle === HandlePosition.UPPER) thumbRefUpper.current.focus(focusOptions);
|
|
261
|
+
} else if (thumbRef.current) thumbRef.current.focus(focusOptions);
|
|
262
|
+
setState({ activeHandle });
|
|
263
|
+
onDrag(evt.nativeEvent, activeHandle);
|
|
264
|
+
};
|
|
265
|
+
/**
|
|
266
|
+
* Removes "drag" and "drag stop" event handlers and calls sets the flag
|
|
267
|
+
* indicating that the `onRelease` callback should be called.
|
|
268
|
+
*/
|
|
269
|
+
const onDragStop = () => {
|
|
270
|
+
if (props.disabled || props.readOnly) return;
|
|
271
|
+
DRAG_STOP_EVENT_TYPES.forEach((element) => {
|
|
272
|
+
elementRef.current?.ownerDocument.removeEventListener(element, onDragStop);
|
|
273
|
+
});
|
|
274
|
+
DRAG_EVENT_TYPES.forEach((element) => {
|
|
275
|
+
elementRef.current?.ownerDocument.removeEventListener(element, handleDrag);
|
|
276
|
+
});
|
|
277
|
+
setState({
|
|
278
|
+
needsOnRelease: true,
|
|
279
|
+
isValid: true,
|
|
280
|
+
isValidUpper: true
|
|
281
|
+
});
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* Handles a "drag" event by recalculating the value/thumb and setting state
|
|
285
|
+
* accordingly.
|
|
286
|
+
*
|
|
287
|
+
* @param evt The event.
|
|
288
|
+
* @param activeHandle The first drag event call, we may have an explicit
|
|
289
|
+
* activeHandle value, which is to be used before state is used.
|
|
290
|
+
*/
|
|
291
|
+
const _onDragRef = (0, react.useRef)(null);
|
|
292
|
+
_onDragRef.current = (evt, activeHandle) => {
|
|
293
|
+
activeHandle = activeHandle ?? stateRef.current.activeHandle;
|
|
294
|
+
if (propsRef.current.disabled || propsRef.current.readOnly || !evt) return;
|
|
295
|
+
const { value, left } = calcValue({
|
|
296
|
+
clientX: getClientXFromEvent(evt),
|
|
297
|
+
value: stateRef.current.value
|
|
298
|
+
});
|
|
299
|
+
if (twoHandles && activeHandle) setValueLeftForHandle(activeHandle, {
|
|
300
|
+
value: nearestStepValue(value),
|
|
301
|
+
left
|
|
302
|
+
});
|
|
303
|
+
else setState({
|
|
304
|
+
value: nearestStepValue(value),
|
|
305
|
+
left,
|
|
306
|
+
isValid: true
|
|
307
|
+
});
|
|
308
|
+
setState({
|
|
309
|
+
correctedValue: null,
|
|
310
|
+
correctedPosition: null
|
|
311
|
+
});
|
|
312
|
+
};
|
|
313
|
+
/**
|
|
314
|
+
* Throttles calls to `_onDrag` by limiting events to being processed at
|
|
315
|
+
* most once every `EVENT_THROTTLE` milliseconds.
|
|
316
|
+
*/
|
|
317
|
+
const onDrag = (0, react.useMemo)(() => (0, es_toolkit_compat.throttle)((evt, activeHandle) => {
|
|
318
|
+
_onDragRef.current?.(evt, activeHandle);
|
|
319
|
+
}, EVENT_THROTTLE, {
|
|
320
|
+
leading: true,
|
|
321
|
+
trailing: false
|
|
322
|
+
}), []);
|
|
323
|
+
/**
|
|
324
|
+
* Handles a `keydown` event by recalculating the value/thumb and setting
|
|
325
|
+
* state accordingly.
|
|
326
|
+
*/
|
|
327
|
+
const onKeyDown = (evt) => {
|
|
328
|
+
if (props.disabled || props.readOnly) return;
|
|
329
|
+
const { step = 1, stepMultiplier = 4 } = props;
|
|
330
|
+
let delta = 0;
|
|
331
|
+
if (require_match.matches(evt, [require_keys.ArrowDown, require_keys.ArrowLeft])) delta = -step;
|
|
332
|
+
else if (require_match.matches(evt, [require_keys.ArrowUp, require_keys.ArrowRight])) delta = step;
|
|
333
|
+
else return;
|
|
334
|
+
if (evt.shiftKey) delta *= stepMultiplier;
|
|
335
|
+
if (twoHandles && state.activeHandle) {
|
|
336
|
+
const { value, left } = calcValue({ value: calcValueForDelta((state.activeHandle === HandlePosition.LOWER ? state.value : state.valueUpper) ?? props.min, delta, props.step) });
|
|
337
|
+
setValueLeftForHandle(state.activeHandle, {
|
|
338
|
+
value: nearestStepValue(value),
|
|
339
|
+
left
|
|
340
|
+
});
|
|
341
|
+
} else {
|
|
342
|
+
const { value, left } = calcValue({ value: calcValueForDelta(state.value, delta, props.step) });
|
|
343
|
+
setState({
|
|
344
|
+
value: nearestStepValue(value),
|
|
345
|
+
left,
|
|
346
|
+
isValid: true
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
setState({
|
|
350
|
+
correctedValue: null,
|
|
351
|
+
correctedPosition: null
|
|
352
|
+
});
|
|
353
|
+
};
|
|
354
|
+
/**
|
|
355
|
+
* Provides the two-way binding for the input field of the Slider. It also
|
|
356
|
+
* Handles a change to the input field by recalculating the value/thumb and
|
|
357
|
+
* setting state accordingly.
|
|
358
|
+
*/
|
|
359
|
+
const onChangeInput = (evt) => {
|
|
360
|
+
if (props.disabled || props.readOnly) return;
|
|
361
|
+
if (!evt || !("target" in evt) || typeof evt.target.value !== "string") return;
|
|
362
|
+
const activeHandle = evt.target.dataset.handlePosition ?? HandlePosition.LOWER;
|
|
363
|
+
const targetValue = Number.parseFloat(evt.target.value);
|
|
364
|
+
if (twoHandles) if (isNaN(targetValue)) setValueForHandle(activeHandle, evt.target.value);
|
|
365
|
+
else if (isValidValueForPosition({
|
|
366
|
+
handle: activeHandle,
|
|
367
|
+
value: targetValue,
|
|
368
|
+
min: props.min,
|
|
369
|
+
max: props.max
|
|
370
|
+
})) processNewInputValue(evt.target);
|
|
371
|
+
else setValueForHandle(activeHandle, targetValue);
|
|
372
|
+
else if (isNaN(targetValue)) setState({ value: evt.target.value });
|
|
373
|
+
else if (isValidValue({
|
|
374
|
+
value: targetValue,
|
|
375
|
+
min: props.min,
|
|
376
|
+
max: props.max
|
|
377
|
+
})) processNewInputValue(evt.target);
|
|
378
|
+
else setState({ value: targetValue });
|
|
379
|
+
};
|
|
380
|
+
/**
|
|
381
|
+
* Checks for validity of input value after clicking out of the input. It also
|
|
382
|
+
* Handles state change to isValid state.
|
|
383
|
+
*/
|
|
384
|
+
const onBlurInput = (evt) => {
|
|
385
|
+
if (!evt || !("target" in evt) || typeof evt.target.value !== "string") return;
|
|
386
|
+
const { value: targetValue } = evt.target;
|
|
387
|
+
processNewInputValue(evt.target);
|
|
388
|
+
props.onBlur?.({
|
|
389
|
+
value: targetValue,
|
|
390
|
+
handlePosition: evt.target.dataset.handlePosition
|
|
391
|
+
});
|
|
392
|
+
};
|
|
393
|
+
const onInputKeyDown = (evt) => {
|
|
394
|
+
if (props.disabled || props.readOnly || !(evt.target instanceof HTMLInputElement)) return;
|
|
395
|
+
if (!evt || !("target" in evt) || typeof evt.target.value !== "string") return;
|
|
396
|
+
if (require_match.matches(evt, [require_keys.Enter])) processNewInputValue(evt.target);
|
|
397
|
+
};
|
|
398
|
+
const processNewInputValue = (input) => {
|
|
399
|
+
setState({
|
|
400
|
+
correctedValue: null,
|
|
401
|
+
correctedPosition: null
|
|
402
|
+
});
|
|
403
|
+
const targetValue = Number.parseFloat(input.value);
|
|
404
|
+
const validity = !isNaN(targetValue);
|
|
405
|
+
const handlePosition = input.dataset.handlePosition;
|
|
406
|
+
if (handlePosition === HandlePosition.LOWER) setState({ isValid: validity });
|
|
407
|
+
else if (handlePosition === HandlePosition.UPPER) setState({ isValidUpper: validity });
|
|
408
|
+
setState({ isValid: validity });
|
|
409
|
+
if (validity) {
|
|
410
|
+
const adjustedValue = handlePosition ? getAdjustedValueForPosition({
|
|
411
|
+
handle: handlePosition,
|
|
412
|
+
value: targetValue,
|
|
413
|
+
min: props.min,
|
|
414
|
+
max: props.max
|
|
415
|
+
}) : getAdjustedValue({
|
|
416
|
+
value: targetValue,
|
|
417
|
+
min: props.min,
|
|
418
|
+
max: props.max
|
|
419
|
+
});
|
|
420
|
+
if (adjustedValue !== targetValue) setState({
|
|
421
|
+
correctedValue: targetValue.toString(),
|
|
422
|
+
correctedPosition: handlePosition ?? null
|
|
423
|
+
});
|
|
424
|
+
else setState({
|
|
425
|
+
correctedValue: null,
|
|
426
|
+
correctedPosition: null
|
|
427
|
+
});
|
|
428
|
+
const { value, left } = calcValue({
|
|
429
|
+
value: adjustedValue,
|
|
430
|
+
useRawValue: true
|
|
431
|
+
});
|
|
432
|
+
if (handlePosition) setValueLeftForHandle(handlePosition, {
|
|
433
|
+
value: nearestStepValue(value),
|
|
434
|
+
left
|
|
435
|
+
});
|
|
436
|
+
else setState({
|
|
437
|
+
value,
|
|
438
|
+
left
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
const calcLeftPercent = ({ clientX, value, range }) => {
|
|
443
|
+
const boundingRect = elementRef.current?.getBoundingClientRect?.();
|
|
444
|
+
let width = boundingRect ? boundingRect.right - boundingRect.left : 0;
|
|
445
|
+
if (width <= 0) width = 1;
|
|
446
|
+
if (clientX) return (state.isRtl ? (boundingRect?.right ?? 0) - clientX : clientX - (boundingRect?.left ?? 0)) / width;
|
|
447
|
+
else if (value !== null && typeof value !== "undefined" && range) return range === 0 ? 0 : (value - props.min) / range;
|
|
448
|
+
return 0;
|
|
449
|
+
};
|
|
450
|
+
/**
|
|
451
|
+
* Calculates the discrete value (snapped to the nearest step) along
|
|
452
|
+
* with the corresponding handle position percentage.
|
|
453
|
+
*/
|
|
454
|
+
const calcDiscreteValueAndPercent = ({ leftPercent }) => {
|
|
455
|
+
const { step = 1, min, max } = props;
|
|
456
|
+
const numSteps = Math.floor((max - min) / step) + 1;
|
|
457
|
+
/** Index of the step that corresponds to `leftPercent`. */
|
|
458
|
+
const stepIndex = Math.round(leftPercent * (numSteps - 1));
|
|
459
|
+
return {
|
|
460
|
+
discreteValue: stepIndex === numSteps - 1 ? max : min + step * stepIndex,
|
|
461
|
+
discretePercent: stepIndex / (numSteps - 1)
|
|
462
|
+
};
|
|
463
|
+
};
|
|
464
|
+
/**
|
|
465
|
+
* Calculates the slider's value and handle position based on either a
|
|
466
|
+
* mouse/touch event or an explicit value.
|
|
467
|
+
*/
|
|
468
|
+
const calcValue = ({ clientX, value, useRawValue }) => {
|
|
469
|
+
/** `leftPercentRaw` clamped between 0 and 1. */
|
|
470
|
+
const leftPercent = require_clamp.clamp(calcLeftPercent({
|
|
471
|
+
clientX,
|
|
472
|
+
value,
|
|
473
|
+
range: props.max - props.min
|
|
474
|
+
}), 0, 1);
|
|
475
|
+
if (useRawValue) return {
|
|
476
|
+
value,
|
|
477
|
+
left: leftPercent * 100
|
|
478
|
+
};
|
|
479
|
+
const { discreteValue, discretePercent } = calcDiscreteValueAndPercent({ leftPercent });
|
|
480
|
+
return {
|
|
481
|
+
value: discreteValue,
|
|
482
|
+
left: discretePercent * 100
|
|
483
|
+
};
|
|
484
|
+
};
|
|
485
|
+
const calcDistanceToHandle = (handle, clientX) => {
|
|
486
|
+
const handleBoundingRect = getHandleBoundingRect(handle);
|
|
487
|
+
/** x-coordinate of the midpoint. */
|
|
488
|
+
const handleX = handleBoundingRect.left + handleBoundingRect.width / 2;
|
|
489
|
+
return Math.abs(handleX - clientX);
|
|
490
|
+
};
|
|
491
|
+
/**
|
|
492
|
+
* Calculates a new slider value based on the current value, a change delta,
|
|
493
|
+
* and a step.
|
|
494
|
+
*
|
|
495
|
+
* @param currentValue - The starting value from which the slider is moving.
|
|
496
|
+
* @param delta - The amount to adjust the current value by.
|
|
497
|
+
* @param step - The step. Defaults to `1`.
|
|
498
|
+
* @returns The new slider value, rounded to the same number of decimal places
|
|
499
|
+
* as the step.
|
|
500
|
+
*/
|
|
501
|
+
const calcValueForDelta = (currentValue, delta, step = 1) => {
|
|
502
|
+
const newValue = (delta > 0 ? Math.round(currentValue / step) * step : currentValue) + delta;
|
|
503
|
+
const decimals = (step.toString().split(".")[1] || "").length;
|
|
504
|
+
return Number(newValue.toFixed(decimals));
|
|
505
|
+
};
|
|
506
|
+
/**
|
|
507
|
+
* Sets state relevant to the given handle position.
|
|
508
|
+
*
|
|
509
|
+
* Guards against setting either lower or upper values beyond its counterpart.
|
|
510
|
+
*/
|
|
511
|
+
const setValueLeftForHandle = (handle, { value: newValue, left: newLeft }) => {
|
|
512
|
+
const { value, valueUpper, left, leftUpper } = state;
|
|
513
|
+
if (handle === HandlePosition.LOWER) setState({
|
|
514
|
+
value: valueUpper && newValue > valueUpper ? valueUpper : newValue,
|
|
515
|
+
left: valueUpper && newValue > valueUpper ? leftUpper : newLeft,
|
|
516
|
+
isValid: true
|
|
517
|
+
});
|
|
518
|
+
else setState({
|
|
519
|
+
valueUpper: value && newValue < value ? value : newValue,
|
|
520
|
+
leftUpper: value && newValue < value ? left : newLeft,
|
|
521
|
+
isValidUpper: true
|
|
522
|
+
});
|
|
523
|
+
};
|
|
524
|
+
const setValueForHandle = (handle, value) => {
|
|
525
|
+
if (handle === HandlePosition.LOWER) setState({
|
|
526
|
+
value,
|
|
527
|
+
isValid: true
|
|
528
|
+
});
|
|
529
|
+
else setState({
|
|
530
|
+
valueUpper: value,
|
|
531
|
+
isValidUpper: true
|
|
532
|
+
});
|
|
533
|
+
};
|
|
534
|
+
const isValidValueForPosition = ({ handle, value: newValue, min, max }) => {
|
|
535
|
+
const { value, valueUpper } = state;
|
|
536
|
+
if (!isValidValue({
|
|
537
|
+
value: newValue,
|
|
538
|
+
min,
|
|
539
|
+
max
|
|
540
|
+
})) return false;
|
|
541
|
+
if (handle === HandlePosition.LOWER) return !valueUpper || newValue <= valueUpper;
|
|
542
|
+
else if (handle === HandlePosition.UPPER) return !value || newValue >= value;
|
|
543
|
+
return false;
|
|
544
|
+
};
|
|
545
|
+
const isValidValue = ({ value, min, max }) => {
|
|
546
|
+
return !(value < min || value > max);
|
|
547
|
+
};
|
|
548
|
+
const getAdjustedValueForPosition = ({ handle, value: newValueInput, min, max }) => {
|
|
549
|
+
const { value, valueUpper } = state;
|
|
550
|
+
let newValue = getAdjustedValue({
|
|
551
|
+
value: newValueInput,
|
|
552
|
+
min,
|
|
553
|
+
max
|
|
554
|
+
});
|
|
555
|
+
if (handle === HandlePosition.LOWER && valueUpper) newValue = newValue > valueUpper ? valueUpper : newValue;
|
|
556
|
+
else if (handle === HandlePosition.UPPER && value) newValue = newValue < value ? value : newValue;
|
|
557
|
+
return newValue;
|
|
558
|
+
};
|
|
559
|
+
const getAdjustedValue = ({ value, min, max }) => {
|
|
560
|
+
if (value < min) value = min;
|
|
561
|
+
if (value > max) value = max;
|
|
562
|
+
return value;
|
|
563
|
+
};
|
|
564
|
+
/**
|
|
565
|
+
* Get the bounding rect for the requested handles' DOM element.
|
|
566
|
+
*
|
|
567
|
+
* If the bounding rect is not available, a new, empty DOMRect is returned.
|
|
568
|
+
*/
|
|
569
|
+
const getHandleBoundingRect = (handle) => {
|
|
570
|
+
let boundingRect;
|
|
571
|
+
if (handle === HandlePosition.LOWER) boundingRect = thumbRef.current?.getBoundingClientRect();
|
|
572
|
+
else boundingRect = thumbRefUpper.current?.getBoundingClientRect();
|
|
573
|
+
return boundingRect ?? new DOMRect();
|
|
574
|
+
};
|
|
575
|
+
const getClientXFromEvent = (event) => {
|
|
576
|
+
let clientX;
|
|
577
|
+
if ("clientX" in event) clientX = event.clientX;
|
|
578
|
+
else if ("touches" in event && 0 in event.touches && "clientX" in event.touches[0]) clientX = event.touches[0].clientX;
|
|
579
|
+
return clientX;
|
|
580
|
+
};
|
|
581
|
+
(0, react.useEffect)(() => {
|
|
582
|
+
const { isValid, isValidUpper } = stateRef.current;
|
|
583
|
+
const derivedState = {};
|
|
584
|
+
if (props.invalid === true) {
|
|
585
|
+
if (isValid === true) derivedState.isValid = false;
|
|
586
|
+
if (isValidUpper === true) derivedState.isValidUpper = false;
|
|
587
|
+
} else if (props.invalid === false) {
|
|
588
|
+
if (isValid === false) derivedState.isValid = true;
|
|
589
|
+
if (isValidUpper === false) derivedState.isValidUpper = true;
|
|
590
|
+
}
|
|
591
|
+
if (Object.keys(derivedState).length) setState(derivedState);
|
|
592
|
+
}, [props.invalid]);
|
|
593
|
+
const { ariaLabelInput, unstable_ariaLabelInputUpper: ariaLabelInputUpper, className, hideTextInput = false, id: idProp, min, minLabel, max, maxLabel, formatLabel = defaultFormatLabel, labelText, hideLabel, step = 1, inputType = "number", invalidText, required, disabled = false, name, unstable_nameUpper: nameUpper, light, readOnly = false, warn = false, warnText, translateWithId: t = defaultTranslateWithId, ...other } = props;
|
|
594
|
+
const id = idProp ?? generatedId;
|
|
595
|
+
const { value, valueUpper, isValid, isValidUpper, correctedValue, correctedPosition, isRtl } = state;
|
|
596
|
+
const normalizedProps = require_useNormalizedInputProps.useNormalizedInputProps({
|
|
597
|
+
id,
|
|
598
|
+
disabled,
|
|
599
|
+
readOnly,
|
|
600
|
+
invalid: !isValid,
|
|
601
|
+
warn
|
|
602
|
+
});
|
|
603
|
+
const normalizedUpperProps = require_useNormalizedInputProps.useNormalizedInputProps({
|
|
604
|
+
id,
|
|
605
|
+
disabled,
|
|
606
|
+
readOnly,
|
|
607
|
+
invalid: !isValidUpper,
|
|
608
|
+
warn
|
|
609
|
+
});
|
|
610
|
+
delete other.invalid;
|
|
611
|
+
delete other.onRelease;
|
|
612
|
+
delete other.stepMultiplier;
|
|
613
|
+
delete other.unstable_valueUpper;
|
|
614
|
+
const showWarning = normalizedProps.warn || correctedPosition === HandlePosition.LOWER && isValid;
|
|
615
|
+
const showWarningUpper = normalizedUpperProps.warn || correctedPosition === (twoHandles ? HandlePosition.UPPER : HandlePosition.LOWER) && (twoHandles ? isValidUpper : isValid);
|
|
616
|
+
const labelId = `${id}-label`;
|
|
617
|
+
const labelClasses = (0, classnames.default)(`${prefix}--label`, {
|
|
618
|
+
[`${prefix}--visually-hidden`]: hideLabel,
|
|
619
|
+
[`${prefix}--label--disabled`]: disabled
|
|
620
|
+
});
|
|
621
|
+
const containerClasses = (0, classnames.default)(`${prefix}--slider-container`, {
|
|
622
|
+
[`${prefix}--slider-container--two-handles`]: twoHandles,
|
|
623
|
+
[`${prefix}--slider-container--disabled`]: disabled,
|
|
624
|
+
[`${prefix}--slider-container--readonly`]: readOnly,
|
|
625
|
+
[`${prefix}--slider-container--rtl`]: isRtl
|
|
626
|
+
});
|
|
627
|
+
const sliderClasses = (0, classnames.default)(`${prefix}--slider`, {
|
|
628
|
+
[`${prefix}--slider--disabled`]: disabled,
|
|
629
|
+
[`${prefix}--slider--readonly`]: readOnly
|
|
630
|
+
});
|
|
631
|
+
const fixedInputClasses = [`${prefix}--text-input`, `${prefix}--slider-text-input`];
|
|
632
|
+
const conditionalInputClasses = { [`${prefix}--text-input--light`]: light };
|
|
633
|
+
const lowerInputClasses = (0, classnames.default)([
|
|
634
|
+
...fixedInputClasses,
|
|
635
|
+
`${prefix}--slider-text-input--lower`,
|
|
636
|
+
conditionalInputClasses,
|
|
637
|
+
{
|
|
638
|
+
[`${prefix}--text-input--invalid`]: normalizedProps.invalid,
|
|
639
|
+
[`${prefix}--slider-text-input--warn`]: showWarning
|
|
640
|
+
}
|
|
641
|
+
]);
|
|
642
|
+
const upperInputClasses = (0, classnames.default)([
|
|
643
|
+
...fixedInputClasses,
|
|
644
|
+
`${prefix}--slider-text-input--upper`,
|
|
645
|
+
conditionalInputClasses,
|
|
646
|
+
{
|
|
647
|
+
[`${prefix}--text-input--invalid`]: twoHandles ? normalizedUpperProps.invalid : normalizedProps.invalid,
|
|
648
|
+
[`${prefix}--slider-text-input--warn`]: showWarningUpper
|
|
649
|
+
}
|
|
650
|
+
]);
|
|
651
|
+
const lowerInputWrapperClasses = (0, classnames.default)([
|
|
652
|
+
`${prefix}--text-input-wrapper`,
|
|
653
|
+
`${prefix}--slider-text-input-wrapper`,
|
|
654
|
+
`${prefix}--slider-text-input-wrapper--lower`,
|
|
655
|
+
{
|
|
656
|
+
[`${prefix}--text-input-wrapper--readonly`]: readOnly,
|
|
657
|
+
[`${prefix}--slider-text-input-wrapper--hidden`]: hideTextInput
|
|
658
|
+
}
|
|
659
|
+
]);
|
|
660
|
+
const upperInputWrapperClasses = (0, classnames.default)([
|
|
661
|
+
`${prefix}--text-input-wrapper`,
|
|
662
|
+
`${prefix}--slider-text-input-wrapper`,
|
|
663
|
+
`${prefix}--slider-text-input-wrapper--upper`,
|
|
664
|
+
{
|
|
665
|
+
[`${prefix}--text-input-wrapper--readonly`]: readOnly,
|
|
666
|
+
[`${prefix}--slider-text-input-wrapper--hidden`]: hideTextInput
|
|
667
|
+
}
|
|
668
|
+
]);
|
|
669
|
+
const lowerThumbClasses = (0, classnames.default)(`${prefix}--slider__thumb`, { [`${prefix}--slider__thumb--lower`]: twoHandles });
|
|
670
|
+
const upperThumbClasses = (0, classnames.default)(`${prefix}--slider__thumb`, { [`${prefix}--slider__thumb--upper`]: twoHandles });
|
|
671
|
+
const lowerThumbWrapperClasses = (0, classnames.default)([
|
|
672
|
+
`${prefix}--icon-tooltip`,
|
|
673
|
+
`${prefix}--slider__thumb-wrapper`,
|
|
674
|
+
{ [`${prefix}--slider__thumb-wrapper--lower`]: twoHandles }
|
|
675
|
+
]);
|
|
676
|
+
const upperThumbWrapperClasses = (0, classnames.default)([
|
|
677
|
+
`${prefix}--icon-tooltip`,
|
|
678
|
+
`${prefix}--slider__thumb-wrapper`,
|
|
679
|
+
{ [`${prefix}--slider__thumb-wrapper--upper`]: twoHandles }
|
|
680
|
+
]);
|
|
681
|
+
const lowerThumbWrapperProps = { style: { insetInlineStart: `${state.left}%` } };
|
|
682
|
+
const upperThumbWrapperProps = { style: { insetInlineStart: `${state.leftUpper}%` } };
|
|
683
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
684
|
+
className: (0, classnames.default)(`${prefix}--form-item`, className),
|
|
685
|
+
children: [
|
|
686
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
|
|
687
|
+
as: "label",
|
|
688
|
+
htmlFor: twoHandles ? void 0 : id,
|
|
689
|
+
className: labelClasses,
|
|
690
|
+
id: labelId,
|
|
691
|
+
children: labelText
|
|
692
|
+
}),
|
|
693
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
694
|
+
className: containerClasses,
|
|
695
|
+
children: [
|
|
696
|
+
twoHandles ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
697
|
+
className: lowerInputWrapperClasses,
|
|
698
|
+
children: [
|
|
699
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
700
|
+
type: hideTextInput ? "hidden" : inputType,
|
|
701
|
+
id: `${id}-lower-input-for-slider`,
|
|
702
|
+
name,
|
|
703
|
+
className: lowerInputClasses,
|
|
704
|
+
value,
|
|
705
|
+
"aria-label": ariaLabelInput,
|
|
706
|
+
disabled,
|
|
707
|
+
required,
|
|
708
|
+
min,
|
|
709
|
+
max,
|
|
710
|
+
step,
|
|
711
|
+
onChange: onChangeInput,
|
|
712
|
+
onBlur: onBlurInput,
|
|
713
|
+
onKeyUp: props.onInputKeyUp,
|
|
714
|
+
onKeyDown: onInputKeyDown,
|
|
715
|
+
"data-invalid": normalizedProps.invalid ? true : null,
|
|
716
|
+
"data-handle-position": HandlePosition.LOWER,
|
|
717
|
+
"aria-invalid": normalizedProps.invalid ? true : void 0,
|
|
718
|
+
readOnly
|
|
719
|
+
}),
|
|
720
|
+
normalizedProps.invalid && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_carbon_icons_react.WarningFilled, { className: `${prefix}--slider__invalid-icon` }),
|
|
721
|
+
showWarning && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_carbon_icons_react.WarningAltFilled, { className: `${prefix}--slider__invalid-icon ${prefix}--slider__invalid-icon--warning` })
|
|
722
|
+
]
|
|
723
|
+
}) : null,
|
|
724
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
|
|
725
|
+
className: `${prefix}--slider__range-label`,
|
|
726
|
+
children: formatLabel(min, minLabel)
|
|
727
|
+
}),
|
|
728
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
729
|
+
className: sliderClasses,
|
|
730
|
+
ref: (node) => {
|
|
731
|
+
elementRef.current = node;
|
|
732
|
+
},
|
|
733
|
+
onMouseDown: onDragStart,
|
|
734
|
+
onTouchStart: onDragStart,
|
|
735
|
+
onKeyDown,
|
|
736
|
+
role: "presentation",
|
|
737
|
+
tabIndex: -1,
|
|
738
|
+
"data-invalid": (twoHandles ? normalizedProps.invalid || normalizedUpperProps.invalid : normalizedProps.invalid) ? true : null,
|
|
739
|
+
...other,
|
|
740
|
+
children: [
|
|
741
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThumbWrapper, {
|
|
742
|
+
hasTooltip: hideTextInput,
|
|
743
|
+
className: lowerThumbWrapperClasses,
|
|
744
|
+
label: formatLabel(value, void 0),
|
|
745
|
+
align: "top",
|
|
746
|
+
...lowerThumbWrapperProps,
|
|
747
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
748
|
+
className: lowerThumbClasses,
|
|
749
|
+
role: "slider",
|
|
750
|
+
id: twoHandles ? void 0 : id,
|
|
751
|
+
tabIndex: readOnly || disabled ? void 0 : 0,
|
|
752
|
+
"aria-valuetext": formatLabel(value, void 0),
|
|
753
|
+
"aria-valuemax": twoHandles ? valueUpper : max,
|
|
754
|
+
"aria-valuemin": min,
|
|
755
|
+
"aria-valuenow": value,
|
|
756
|
+
"aria-labelledby": twoHandles ? void 0 : labelId,
|
|
757
|
+
"aria-label": twoHandles ? ariaLabelInput : void 0,
|
|
758
|
+
ref: thumbRef,
|
|
759
|
+
onFocus: () => setState({ activeHandle: HandlePosition.LOWER }),
|
|
760
|
+
children: twoHandles && !isRtl ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SliderHandles.LowerHandle, { "aria-label": ariaLabelInput }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SliderHandles.LowerHandleFocus, { "aria-label": ariaLabelInput })] }) : twoHandles && isRtl ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SliderHandles.UpperHandle, { "aria-label": ariaLabelInputUpper }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SliderHandles.UpperHandleFocus, { "aria-label": ariaLabelInputUpper })] }) : void 0
|
|
761
|
+
})
|
|
762
|
+
}),
|
|
763
|
+
hasUpperValue(valueUpper) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThumbWrapper, {
|
|
764
|
+
hasTooltip: hideTextInput,
|
|
765
|
+
className: upperThumbWrapperClasses,
|
|
766
|
+
label: formatLabel(valueUpper, void 0),
|
|
767
|
+
align: "top",
|
|
768
|
+
...upperThumbWrapperProps,
|
|
769
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
770
|
+
className: upperThumbClasses,
|
|
771
|
+
role: "slider",
|
|
772
|
+
tabIndex: readOnly || disabled ? void 0 : 0,
|
|
773
|
+
"aria-valuemax": max,
|
|
774
|
+
"aria-valuemin": value,
|
|
775
|
+
"aria-valuenow": valueUpper,
|
|
776
|
+
"aria-label": ariaLabelInputUpper,
|
|
777
|
+
ref: thumbRefUpper,
|
|
778
|
+
onFocus: () => setState({ activeHandle: HandlePosition.UPPER }),
|
|
779
|
+
children: !isRtl ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SliderHandles.UpperHandle, { "aria-label": ariaLabelInputUpper }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SliderHandles.UpperHandleFocus, { "aria-label": ariaLabelInputUpper })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SliderHandles.LowerHandle, { "aria-label": ariaLabelInput }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SliderHandles.LowerHandleFocus, { "aria-label": ariaLabelInput })] })
|
|
780
|
+
})
|
|
781
|
+
}) : null,
|
|
782
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
783
|
+
className: `${prefix}--slider__track`,
|
|
784
|
+
ref: (node) => {
|
|
785
|
+
trackRef.current = node;
|
|
786
|
+
}
|
|
787
|
+
}),
|
|
788
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
789
|
+
className: `${prefix}--slider__filled-track`,
|
|
790
|
+
ref: filledTrackRef
|
|
791
|
+
})
|
|
792
|
+
]
|
|
793
|
+
}),
|
|
794
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
|
|
795
|
+
className: `${prefix}--slider__range-label`,
|
|
796
|
+
children: formatLabel(max, maxLabel)
|
|
797
|
+
}),
|
|
798
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
799
|
+
className: upperInputWrapperClasses,
|
|
800
|
+
children: [
|
|
801
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
802
|
+
type: hideTextInput ? "hidden" : inputType,
|
|
803
|
+
id: `${id}-${twoHandles ? "upper-" : ""}input-for-slider`,
|
|
804
|
+
name: twoHandles ? nameUpper : name,
|
|
805
|
+
className: upperInputClasses,
|
|
806
|
+
value: twoHandles ? valueUpper : value,
|
|
807
|
+
"aria-labelledby": !ariaLabelInput && !twoHandles ? labelId : void 0,
|
|
808
|
+
"aria-label": twoHandles ? ariaLabelInputUpper : ariaLabelInput ? ariaLabelInput : void 0,
|
|
809
|
+
disabled,
|
|
810
|
+
required,
|
|
811
|
+
min,
|
|
812
|
+
max,
|
|
813
|
+
step,
|
|
814
|
+
onChange: onChangeInput,
|
|
815
|
+
onBlur: onBlurInput,
|
|
816
|
+
onKeyDown: onInputKeyDown,
|
|
817
|
+
onKeyUp: props.onInputKeyUp,
|
|
818
|
+
"data-invalid": (twoHandles ? normalizedUpperProps.invalid : normalizedProps.invalid) ? true : null,
|
|
819
|
+
"data-handle-position": twoHandles ? HandlePosition.UPPER : null,
|
|
820
|
+
"aria-invalid": (twoHandles ? normalizedUpperProps.invalid : normalizedProps.invalid) ? true : void 0,
|
|
821
|
+
readOnly
|
|
822
|
+
}),
|
|
823
|
+
(twoHandles ? normalizedUpperProps.invalid : normalizedProps.invalid) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_carbon_icons_react.WarningFilled, { className: `${prefix}--slider__invalid-icon` }),
|
|
824
|
+
showWarningUpper && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_carbon_icons_react.WarningAltFilled, { className: `${prefix}--slider__invalid-icon ${prefix}--slider__invalid-icon--warning` })
|
|
825
|
+
]
|
|
826
|
+
})
|
|
827
|
+
]
|
|
828
|
+
}),
|
|
829
|
+
(normalizedProps.invalid || normalizedUpperProps.invalid) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
|
|
830
|
+
as: "div",
|
|
831
|
+
className: (0, classnames.default)(`${prefix}--slider__validation-msg`, `${prefix}--slider__validation-msg--invalid`, `${prefix}--form-requirement`),
|
|
832
|
+
children: invalidText
|
|
833
|
+
}),
|
|
834
|
+
(normalizedProps.warn || normalizedUpperProps.warn) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
|
|
835
|
+
as: "div",
|
|
836
|
+
className: (0, classnames.default)(`${prefix}--slider__validation-msg`, `${prefix}--form-requirement`),
|
|
837
|
+
children: warnText
|
|
838
|
+
}),
|
|
839
|
+
correctedValue && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
|
|
840
|
+
as: "div",
|
|
841
|
+
role: "alert",
|
|
842
|
+
className: (0, classnames.default)(`${prefix}--slider__status-msg`, `${prefix}--form-requirement`),
|
|
843
|
+
children: t(translationIds["carbon.slider.auto-correct-announcement"], { correctedValue })
|
|
844
|
+
})
|
|
845
|
+
]
|
|
846
|
+
});
|
|
1195
847
|
};
|
|
1196
848
|
Slider.propTypes = {
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
* `Specify whether the Slider is currently invalid
|
|
1231
|
-
*/
|
|
1232
|
-
invalid: PropTypes.bool,
|
|
1233
|
-
/**
|
|
1234
|
-
* Provide the text that is displayed when the Slider is in an invalid state
|
|
1235
|
-
*/
|
|
1236
|
-
invalidText: PropTypes.node,
|
|
1237
|
-
/**
|
|
1238
|
-
* The label for the slider.
|
|
1239
|
-
*/
|
|
1240
|
-
labelText: PropTypes.node,
|
|
1241
|
-
/**
|
|
1242
|
-
* Specify whether you want the underlying label to be visually hidden
|
|
1243
|
-
*/
|
|
1244
|
-
hideLabel: PropTypes.bool,
|
|
1245
|
-
/**
|
|
1246
|
-
* `true` to use the light version.
|
|
1247
|
-
*/
|
|
1248
|
-
light: deprecate.deprecate(PropTypes.bool, 'The `light` prop for `Slider` is no longer needed and has ' + 'been deprecated in v11 in favor of the new `Layer` component. It will be moved in the next major release.'),
|
|
1249
|
-
/**
|
|
1250
|
-
* The maximum value.
|
|
1251
|
-
*/
|
|
1252
|
-
max: PropTypes.number.isRequired,
|
|
1253
|
-
/**
|
|
1254
|
-
* The label associated with the maximum value.
|
|
1255
|
-
*/
|
|
1256
|
-
maxLabel: PropTypes.string,
|
|
1257
|
-
/**
|
|
1258
|
-
* The minimum value.
|
|
1259
|
-
*/
|
|
1260
|
-
min: PropTypes.number.isRequired,
|
|
1261
|
-
/**
|
|
1262
|
-
* The label associated with the minimum value.
|
|
1263
|
-
*/
|
|
1264
|
-
minLabel: PropTypes.string,
|
|
1265
|
-
/**
|
|
1266
|
-
* The `name` attribute of the `<input>`.
|
|
1267
|
-
*/
|
|
1268
|
-
name: PropTypes.string,
|
|
1269
|
-
/**
|
|
1270
|
-
* Provide an optional function to be called when the input element
|
|
1271
|
-
* loses focus
|
|
1272
|
-
*/
|
|
1273
|
-
onBlur: PropTypes.func,
|
|
1274
|
-
/**
|
|
1275
|
-
* The callback to get notified of change in value.
|
|
1276
|
-
*/
|
|
1277
|
-
onChange: PropTypes.func,
|
|
1278
|
-
/**
|
|
1279
|
-
* Provide an optional function to be called when a key is pressed in the number input.
|
|
1280
|
-
*/
|
|
1281
|
-
onInputKeyUp: PropTypes.func,
|
|
1282
|
-
/**
|
|
1283
|
-
* The callback to get notified of value on handle release.
|
|
1284
|
-
*/
|
|
1285
|
-
onRelease: PropTypes.func,
|
|
1286
|
-
/**
|
|
1287
|
-
* Whether the slider should be read-only
|
|
1288
|
-
*/
|
|
1289
|
-
readOnly: PropTypes.bool,
|
|
1290
|
-
/**
|
|
1291
|
-
* `true` to specify if the control is required.
|
|
1292
|
-
*/
|
|
1293
|
-
required: PropTypes.bool,
|
|
1294
|
-
/**
|
|
1295
|
-
* A value determining how much the value should increase/decrease by moving the thumb by mouse. If a value other than 1 is provided and the input is *not* hidden, the new step requirement should be added to a visible label. Values outside the `step` increment will be considered invalid.
|
|
1296
|
-
*/
|
|
1297
|
-
step: PropTypes.number,
|
|
1298
|
-
/**
|
|
1299
|
-
* A value determining how much the value should increase/decrease by Shift+arrow keys,
|
|
1300
|
-
* which will be `(max - min) / stepMultiplier`.
|
|
1301
|
-
*/
|
|
1302
|
-
stepMultiplier: PropTypes.number,
|
|
1303
|
-
/**
|
|
1304
|
-
* Supply a method to translate internal strings with your i18n tool of
|
|
1305
|
-
* choice. Translation keys are available on the `translationIds` field for
|
|
1306
|
-
* this component.
|
|
1307
|
-
*/
|
|
1308
|
-
translateWithId: PropTypes.func,
|
|
1309
|
-
/**
|
|
1310
|
-
* The `ariaLabel` for the upper bound `<input>` when there are two handles.
|
|
1311
|
-
*/
|
|
1312
|
-
unstable_ariaLabelInputUpper: PropTypes.string,
|
|
1313
|
-
/**
|
|
1314
|
-
* The `name` attribute of the upper bound `<input>` when there are two handles.
|
|
1315
|
-
*/
|
|
1316
|
-
unstable_nameUpper: PropTypes.string,
|
|
1317
|
-
/**
|
|
1318
|
-
* The upper bound when there are two handles.
|
|
1319
|
-
*/
|
|
1320
|
-
unstable_valueUpper: PropTypes.number,
|
|
1321
|
-
/**
|
|
1322
|
-
* The value of the slider. When there are two handles, value is the lower
|
|
1323
|
-
* bound.
|
|
1324
|
-
*/
|
|
1325
|
-
value: PropTypes.number.isRequired,
|
|
1326
|
-
/**
|
|
1327
|
-
* `Specify whether the Slider is in a warn state
|
|
1328
|
-
*/
|
|
1329
|
-
warn: PropTypes.bool,
|
|
1330
|
-
/**
|
|
1331
|
-
* Provide the text that is displayed when the Slider is in a warn state
|
|
1332
|
-
*/
|
|
1333
|
-
warnText: PropTypes.node
|
|
849
|
+
ariaLabelInput: prop_types.default.string,
|
|
850
|
+
children: prop_types.default.node,
|
|
851
|
+
className: prop_types.default.string,
|
|
852
|
+
disabled: prop_types.default.bool,
|
|
853
|
+
formatLabel: prop_types.default.func,
|
|
854
|
+
hideTextInput: prop_types.default.bool,
|
|
855
|
+
id: prop_types.default.string,
|
|
856
|
+
inputType: prop_types.default.string,
|
|
857
|
+
invalid: prop_types.default.bool,
|
|
858
|
+
invalidText: prop_types.default.node,
|
|
859
|
+
labelText: prop_types.default.node,
|
|
860
|
+
hideLabel: prop_types.default.bool,
|
|
861
|
+
light: require_deprecate.deprecate(prop_types.default.bool, "The `light` prop for `Slider` is no longer needed and has been deprecated in v11 in favor of the new `Layer` component. It will be moved in the next major release."),
|
|
862
|
+
max: prop_types.default.number.isRequired,
|
|
863
|
+
maxLabel: prop_types.default.string,
|
|
864
|
+
min: prop_types.default.number.isRequired,
|
|
865
|
+
minLabel: prop_types.default.string,
|
|
866
|
+
name: prop_types.default.string,
|
|
867
|
+
onBlur: prop_types.default.func,
|
|
868
|
+
onChange: prop_types.default.func,
|
|
869
|
+
onInputKeyUp: prop_types.default.func,
|
|
870
|
+
onRelease: prop_types.default.func,
|
|
871
|
+
readOnly: prop_types.default.bool,
|
|
872
|
+
required: prop_types.default.bool,
|
|
873
|
+
step: prop_types.default.number,
|
|
874
|
+
stepMultiplier: prop_types.default.number,
|
|
875
|
+
translateWithId: prop_types.default.func,
|
|
876
|
+
unstable_ariaLabelInputUpper: prop_types.default.string,
|
|
877
|
+
unstable_nameUpper: prop_types.default.string,
|
|
878
|
+
unstable_valueUpper: prop_types.default.number,
|
|
879
|
+
value: prop_types.default.number.isRequired,
|
|
880
|
+
warn: prop_types.default.bool,
|
|
881
|
+
warnText: prop_types.default.node
|
|
1334
882
|
};
|
|
1335
883
|
|
|
1336
|
-
|
|
884
|
+
//#endregion
|
|
885
|
+
exports.default = Slider;
|