@carbon/react 1.27.0 → 1.28.0-rc.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/es/_virtual/_rollupPluginBabelHelpers.js +1 -313
- package/es/components/Accordion/Accordion.Skeleton.js +28 -30
- package/es/components/Accordion/Accordion.js +18 -21
- package/es/components/Accordion/AccordionItem.js +37 -49
- package/es/components/AspectRatio/AspectRatio.js +10 -12
- package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +10 -11
- package/es/components/Breadcrumb/Breadcrumb.js +14 -13
- package/es/components/Breadcrumb/BreadcrumbItem.js +24 -22
- package/es/components/Button/Button.Skeleton.js +25 -23
- package/es/components/Button/Button.js +77 -72
- package/es/components/ButtonSet/ButtonSet.js +12 -10
- package/es/components/Checkbox/Checkbox.Skeleton.js +10 -11
- package/es/components/Checkbox/Checkbox.js +55 -52
- package/es/components/CheckboxGroup/CheckboxGroup.js +33 -31
- package/es/components/ClassPrefix/index.js +4 -2
- package/es/components/CodeSnippet/CodeSnippet.Skeleton.js +15 -14
- package/es/components/CodeSnippet/CodeSnippet.js +199 -102
- package/es/components/ComboBox/ComboBox.js +349 -178
- package/es/components/ComboBox/tools/filter.js +6 -4
- package/es/components/ComboButton/index.js +38 -43
- package/es/components/ComposedModal/ComposedModal.js +187 -85
- package/es/components/ComposedModal/ModalFooter.js +54 -49
- package/es/components/ComposedModal/ModalHeader.js +39 -26
- package/es/components/ContainedList/ContainedList.js +18 -17
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +20 -18
- package/es/components/ContentSwitcher/ContentSwitcher.js +83 -98
- package/es/components/ContentSwitcher/index.js +1 -1
- package/es/components/ContextMenu/useContextMenu.js +12 -21
- package/es/components/Copy/Copy.js +24 -29
- package/es/components/CopyButton/CopyButton.js +10 -10
- package/es/components/DangerButton/DangerButton.js +3 -5
- package/es/components/DataTable/DataTable.js +334 -361
- package/es/components/DataTable/Table.js +29 -26
- package/es/components/DataTable/TableActionList.js +2 -4
- package/es/components/DataTable/TableBatchAction.js +2 -4
- package/es/components/DataTable/TableBatchActions.js +29 -30
- package/es/components/DataTable/TableBody.js +7 -8
- package/es/components/DataTable/TableCell.js +1 -1
- package/es/components/DataTable/TableContainer.js +23 -23
- package/es/components/DataTable/TableContext.js +1 -1
- package/es/components/DataTable/TableExpandHeader.js +19 -21
- package/es/components/DataTable/TableExpandRow.js +23 -23
- package/es/components/DataTable/TableExpandedRow.js +18 -23
- package/es/components/DataTable/TableHead.js +1 -1
- package/es/components/DataTable/TableHeader.js +45 -41
- package/es/components/DataTable/TableRow.js +7 -8
- package/es/components/DataTable/TableSelectAll.js +13 -11
- package/es/components/DataTable/TableSelectRow.js +29 -21
- package/es/components/DataTable/TableToolbar.js +19 -14
- package/es/components/DataTable/TableToolbarAction.js +6 -6
- package/es/components/DataTable/TableToolbarContent.js +2 -4
- package/es/components/DataTable/TableToolbarMenu.js +11 -12
- package/es/components/DataTable/TableToolbarSearch.js +52 -71
- package/es/components/DataTable/state/getDerivedStateFromProps.js +15 -15
- package/es/components/DataTable/state/sortStates.js +1 -1
- package/es/components/DataTable/state/sorting.js +28 -20
- package/es/components/DataTable/tools/cells.js +1 -3
- package/es/components/DataTable/tools/denormalize.js +4 -17
- package/es/components/DataTable/tools/filter.js +18 -16
- package/es/components/DataTable/tools/instanceId.js +2 -2
- package/es/components/DataTable/tools/normalize.js +28 -25
- package/es/components/DataTable/tools/sorting.js +28 -25
- package/es/components/DataTableSkeleton/DataTableSkeleton.js +36 -38
- package/es/components/DatePicker/DatePicker.Skeleton.js +17 -18
- package/es/components/DatePicker/DatePicker.js +206 -195
- package/es/components/DatePicker/plugins/appendToPlugin.js +45 -43
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +117 -107
- package/es/components/DatePicker/plugins/rangePlugin.js +19 -11
- package/es/components/DatePickerInput/DatePickerInput.js +83 -74
- package/es/components/Dropdown/Dropdown.Skeleton.js +13 -12
- package/es/components/Dropdown/Dropdown.js +266 -109
- package/es/components/ErrorBoundary/ErrorBoundary.js +27 -48
- package/es/components/ErrorBoundary/ErrorBoundaryContext.js +3 -2
- package/es/components/ExpandableSearch/ExpandableSearch.d.ts +13 -0
- package/es/components/ExpandableSearch/ExpandableSearch.js +18 -25
- package/es/components/FeatureFlags/index.js +25 -43
- package/es/components/FileUploader/FileUploader.Skeleton.js +8 -9
- package/es/components/FileUploader/FileUploader.js +120 -147
- package/es/components/FileUploader/FileUploaderButton.js +36 -48
- package/es/components/FileUploader/FileUploaderDropContainer.js +49 -53
- package/es/components/FileUploader/FileUploaderItem.js +30 -30
- package/es/components/FileUploader/Filename.js +13 -14
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +11 -12
- package/es/components/FluidComboBox/FluidComboBox.js +11 -9
- package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.js +18 -18
- package/es/components/FluidDatePicker/FluidDatePicker.js +19 -16
- package/es/components/FluidDatePickerInput/FluidDatePickerInput.js +3 -3
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +11 -12
- package/es/components/FluidDropdown/FluidDropdown.js +11 -9
- package/es/components/FluidForm/FluidForm.js +9 -10
- package/es/components/FluidForm/FormContext.js +1 -1
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +11 -12
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +12 -10
- package/es/components/FluidSelect/FluidSelect.Skeleton.js +11 -12
- package/es/components/FluidSelect/FluidSelect.js +9 -9
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +9 -10
- package/es/components/FluidTextArea/FluidTextArea.js +7 -8
- package/es/components/FluidTextInput/FluidTextInput.Skeleton.js +9 -10
- package/es/components/FluidTextInput/FluidTextInput.js +10 -9
- package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.js +11 -10
- package/es/components/FluidTimePicker/FluidTimePicker.js +30 -26
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +7 -7
- package/es/components/Form/Form.js +9 -10
- package/es/components/FormGroup/FormGroup.js +16 -17
- package/es/components/FormItem/FormItem.js +8 -9
- package/es/components/FormLabel/FormLabel.js +11 -10
- package/es/components/Grid/CSSGrid.js +38 -39
- package/es/components/Grid/Column.js +86 -79
- package/es/components/Grid/ColumnHang.js +12 -14
- package/es/components/Grid/FlexGrid.js +19 -21
- package/es/components/Grid/Grid.js +2 -2
- package/es/components/Grid/GridContext.js +12 -11
- package/es/components/Grid/Row.js +16 -18
- package/es/components/Heading/index.js +11 -13
- package/es/components/Icon/Icon.Skeleton.js +10 -12
- package/es/components/IconButton/index.js +19 -22
- package/es/components/IdPrefix/index.js +4 -2
- package/es/components/InlineCheckbox/InlineCheckbox.js +89 -36
- package/es/components/InlineLoading/InlineLoading.js +23 -25
- package/es/components/Layer/LayerContext.js +1 -1
- package/es/components/Layer/index.js +17 -18
- package/es/components/Layout/LayoutDirection.js +8 -10
- package/es/components/Layout/LayoutDirectionContext.js +1 -1
- package/es/components/Link/Link.js +25 -25
- package/es/components/ListBox/ListBox.js +38 -31
- package/es/components/ListBox/ListBoxField.js +9 -10
- package/es/components/ListBox/ListBoxMenu.js +9 -10
- package/es/components/ListBox/ListBoxMenuIcon.js +16 -14
- package/es/components/ListBox/ListBoxMenuItem.js +23 -26
- package/es/components/ListBox/ListBoxPropTypes.js +4 -4
- package/es/components/ListBox/ListBoxSelection.js +30 -25
- package/es/components/ListBox/index.js +1 -1
- package/es/components/ListBox/next/ListBoxSelection.js +27 -24
- package/es/components/ListBox/next/ListBoxTrigger.js +20 -19
- package/es/components/ListItem/ListItem.js +9 -10
- package/es/components/Loading/Loading.js +24 -24
- package/es/components/Menu/Menu.js +67 -80
- package/es/components/Menu/MenuContext.js +9 -12
- package/es/components/Menu/MenuItem.js +104 -128
- package/es/components/MenuButton/index.js +37 -41
- package/es/components/Modal/Modal.js +281 -120
- package/es/components/ModalWrapper/ModalWrapper.js +72 -96
- package/es/components/MultiSelect/FilterableMultiSelect.js +299 -163
- package/es/components/MultiSelect/MultiSelect.js +162 -174
- package/es/components/MultiSelect/MultiSelectPropTypes.js +1 -1
- package/es/components/MultiSelect/tools/itemToString.js +3 -4
- package/es/components/MultiSelect/tools/sorting.js +15 -13
- package/es/components/Notification/Notification.js +436 -164
- package/es/components/NumberInput/NumberInput.Skeleton.js +10 -11
- package/es/components/NumberInput/NumberInput.js +140 -139
- package/es/components/OrderedList/OrderedList.js +17 -15
- package/es/components/OverflowMenu/OverflowMenu.js +359 -227
- package/es/components/OverflowMenu/index.js +1 -1
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +32 -37
- package/es/components/OverflowMenuV2/index.js +26 -28
- package/es/components/Pagination/Pagination.Skeleton.js +9 -10
- package/es/components/Pagination/Pagination.js +98 -140
- package/es/components/Pagination/experimental/PageSelector.js +16 -16
- package/es/components/Pagination/experimental/Pagination.js +73 -94
- package/es/components/PaginationNav/PaginationNav.js +98 -117
- package/es/components/Popover/index.js +74 -80
- package/es/components/PrimaryButton/PrimaryButton.js +3 -5
- package/es/components/ProgressBar/ProgressBar.js +39 -37
- package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +15 -14
- package/es/components/ProgressIndicator/ProgressIndicator.js +71 -71
- package/es/components/RadioButton/RadioButton.Skeleton.js +9 -10
- package/es/components/RadioButton/RadioButton.js +27 -27
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +55 -65
- package/es/components/RadioTile/RadioTile.js +27 -25
- package/es/components/Search/Search.Skeleton.js +16 -16
- package/es/components/Search/Search.d.ts +83 -0
- package/es/components/Search/Search.js +65 -72
- package/es/components/Search/index.d.ts +11 -0
- package/es/components/SecondaryButton/SecondaryButton.js +3 -5
- package/es/components/Select/Select.Skeleton.js +12 -13
- package/es/components/Select/Select.js +79 -73
- package/es/components/SelectItem/SelectItem.js +17 -13
- package/es/components/SelectItemGroup/SelectItemGroup.js +11 -12
- package/es/components/SkeletonIcon/SkeletonIcon.js +11 -11
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +11 -11
- package/es/components/SkeletonText/SkeletonText.js +29 -29
- package/es/components/Slider/Slider.Skeleton.js +17 -18
- package/es/components/Slider/Slider.js +306 -329
- package/es/components/Slider/index.js +1 -1
- package/es/components/Stack/Stack.js +19 -20
- package/es/components/Stack/index.js +2 -2
- package/es/components/StructuredList/StructuredList.Skeleton.js +25 -24
- package/es/components/StructuredList/StructuredList.js +134 -106
- package/es/components/Switch/IconSwitch.js +48 -54
- package/es/components/Switch/Switch.js +33 -31
- package/es/components/Tab/Tab.js +77 -83
- package/es/components/Tab/index.js +1 -1
- package/es/components/TabContent/TabContent.js +16 -18
- package/es/components/Tabs/Tabs.Skeleton.js +14 -13
- package/es/components/Tabs/Tabs.js +195 -206
- package/es/components/Tabs/usePressable.js +27 -36
- package/es/components/Tag/Tag.Skeleton.js +10 -9
- package/es/components/Tag/Tag.js +34 -31
- package/es/components/Text/Text.js +20 -20
- package/es/components/Text/TextDirection.js +8 -7
- package/es/components/Text/TextDirectionContext.js +1 -1
- package/es/components/Text/index.js +1 -1
- package/es/components/TextArea/TextArea.Skeleton.js +11 -12
- package/es/components/TextArea/TextArea.js +89 -83
- package/es/components/TextInput/ControlledPasswordInput.js +79 -73
- package/es/components/TextInput/PasswordInput.js +101 -91
- package/es/components/TextInput/TextInput.Skeleton.js +11 -12
- package/es/components/TextInput/TextInput.js +104 -92
- package/es/components/TextInput/util.js +26 -28
- package/es/components/Theme/index.js +25 -20
- package/es/components/Tile/Tile.js +135 -176
- package/es/components/TileGroup/TileGroup.js +55 -70
- package/es/components/TileGroup/index.js +1 -1
- package/es/components/TimePicker/TimePicker.js +60 -67
- package/es/components/TimePickerSelect/TimePickerSelect.js +20 -18
- package/es/components/TimePickerSelect/index.js +1 -1
- package/es/components/Toggle/Toggle.Skeleton.js +63 -52
- package/es/components/Toggle/Toggle.js +44 -48
- package/es/components/ToggleSmall/ToggleSmall.Skeleton.js +56 -50
- package/es/components/Toggletip/index.js +52 -48
- package/es/components/Tooltip/DefinitionTooltip.js +24 -31
- package/es/components/Tooltip/Tooltip.js +35 -50
- package/es/components/TreeView/TreeNode.js +94 -74
- package/es/components/TreeView/TreeView.js +72 -83
- package/es/components/UIShell/Content.js +12 -14
- package/es/components/UIShell/Header.js +16 -12
- package/es/components/UIShell/HeaderContainer.js +8 -14
- package/es/components/UIShell/HeaderGlobalAction.js +26 -19
- package/es/components/UIShell/HeaderGlobalBar.js +1 -3
- package/es/components/UIShell/HeaderMenu.js +114 -129
- package/es/components/UIShell/HeaderMenuButton.js +31 -22
- package/es/components/UIShell/HeaderMenuItem.js +28 -20
- package/es/components/UIShell/HeaderName.js +19 -14
- package/es/components/UIShell/HeaderNavigation.js +19 -15
- package/es/components/UIShell/HeaderPanel.js +23 -17
- package/es/components/UIShell/HeaderSideNavItems.js +11 -9
- package/es/components/UIShell/Link.js +11 -11
- package/es/components/UIShell/SideNav.js +66 -62
- package/es/components/UIShell/SideNavDetails.js +11 -12
- package/es/components/UIShell/SideNavDivider.js +5 -3
- package/es/components/UIShell/SideNavFooter.js +12 -12
- package/es/components/UIShell/SideNavHeader.js +8 -6
- package/es/components/UIShell/SideNavIcon.js +11 -8
- package/es/components/UIShell/SideNavItem.js +11 -9
- package/es/components/UIShell/SideNavItems.js +13 -11
- package/es/components/UIShell/SideNavLink.js +19 -17
- package/es/components/UIShell/SideNavLinkText.js +8 -9
- package/es/components/UIShell/SideNavMenu.js +28 -35
- package/es/components/UIShell/SideNavMenuItem.js +14 -14
- package/es/components/UIShell/SideNavSwitcher.js +19 -19
- package/es/components/UIShell/SkipToContent.js +10 -11
- package/es/components/UIShell/Switcher.js +20 -11
- package/es/components/UIShell/SwitcherDivider.js +10 -9
- package/es/components/UIShell/SwitcherItem.js +26 -19
- package/es/components/UIShell/_utils.js +1 -1
- package/es/components/UnorderedList/UnorderedList.js +14 -14
- package/es/index.js +5 -5
- package/es/internal/ClickListener.js +49 -65
- package/es/internal/FloatingMenu.js +193 -200
- package/es/internal/OptimizedResize.js +9 -8
- package/es/internal/Selection.js +92 -111
- package/es/internal/createClassWrapper.js +2 -2
- package/es/internal/deprecateFieldOnObject.js +5 -3
- package/es/internal/environment.js +1 -1
- package/es/internal/focus/index.js +1 -1
- package/es/internal/keyboard/keys.js +11 -11
- package/es/internal/keyboard/match.js +7 -6
- package/es/internal/keyboard/navigation.js +15 -5
- package/es/internal/useAnnouncer.js +2 -2
- package/es/internal/useAttachedMenu.js +12 -20
- package/es/internal/useControllableState.js +11 -16
- package/es/internal/useDelayedState.js +9 -18
- package/es/internal/useEffectOnce.js +4 -4
- package/es/internal/useEvent.js +4 -4
- package/es/internal/useId.js +15 -19
- package/es/internal/useIdPrefix.js +1 -1
- package/es/internal/useIsomorphicEffect.js +1 -1
- package/es/internal/useMergedRefs.js +3 -3
- package/es/internal/useNoInteractiveChildren.js +8 -19
- package/es/internal/useNormalizedInputProps.js +16 -14
- package/es/internal/usePrefix.js +1 -1
- package/es/internal/useSavedCallback.js +3 -3
- package/es/internal/warning.js +4 -4
- package/es/internal/wrapFocus.js +16 -21
- package/es/prop-types/AriaPropTypes.js +1 -1
- package/es/prop-types/deprecate.js +6 -5
- package/es/prop-types/isRequiredOneOf.js +12 -25
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +2 -2
- package/es/prop-types/types.js +1 -1
- package/es/tools/array.js +1 -1
- package/es/tools/events.js +21 -14
- package/es/tools/mergeRefs.js +3 -3
- package/es/tools/setupGetInstanceId.js +1 -1
- package/es/tools/uniqueId.js +3 -3
- package/es/tools/wrapComponent.js +14 -13
- package/lib/_virtual/_rollupPluginBabelHelpers.js +0 -336
- package/lib/components/Accordion/Accordion.Skeleton.js +27 -29
- package/lib/components/Accordion/Accordion.js +17 -20
- package/lib/components/Accordion/AccordionItem.js +36 -48
- package/lib/components/AspectRatio/AspectRatio.js +9 -11
- package/lib/components/Breadcrumb/Breadcrumb.Skeleton.js +9 -10
- package/lib/components/Breadcrumb/Breadcrumb.js +13 -12
- package/lib/components/Breadcrumb/BreadcrumbItem.js +23 -21
- package/lib/components/Button/Button.Skeleton.js +24 -22
- package/lib/components/Button/Button.js +76 -71
- package/lib/components/ButtonSet/ButtonSet.js +11 -9
- package/lib/components/Checkbox/Checkbox.Skeleton.js +9 -10
- package/lib/components/Checkbox/Checkbox.js +54 -51
- package/lib/components/CheckboxGroup/CheckboxGroup.js +32 -30
- package/lib/components/ClassPrefix/index.js +4 -2
- package/lib/components/CodeSnippet/CodeSnippet.Skeleton.js +14 -13
- package/lib/components/CodeSnippet/CodeSnippet.js +198 -101
- package/lib/components/ComboBox/ComboBox.js +348 -177
- package/lib/components/ComboBox/tools/filter.js +6 -4
- package/lib/components/ComboButton/index.js +37 -42
- package/lib/components/ComposedModal/ComposedModal.js +187 -85
- package/lib/components/ComposedModal/ModalFooter.js +53 -48
- package/lib/components/ComposedModal/ModalHeader.js +38 -25
- package/lib/components/ContainedList/ContainedList.js +18 -17
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +20 -18
- package/lib/components/ContentSwitcher/ContentSwitcher.js +82 -97
- package/lib/components/ContentSwitcher/index.js +1 -1
- package/lib/components/ContextMenu/useContextMenu.js +12 -21
- package/lib/components/Copy/Copy.js +23 -28
- package/lib/components/CopyButton/CopyButton.js +9 -9
- package/lib/components/DangerButton/DangerButton.js +3 -5
- package/lib/components/DataTable/DataTable.js +332 -359
- package/lib/components/DataTable/Table.js +28 -25
- package/lib/components/DataTable/TableActionList.js +2 -4
- package/lib/components/DataTable/TableBatchAction.js +2 -4
- package/lib/components/DataTable/TableBatchActions.js +28 -29
- package/lib/components/DataTable/TableBody.js +6 -7
- package/lib/components/DataTable/TableCell.js +1 -1
- package/lib/components/DataTable/TableContainer.js +22 -22
- package/lib/components/DataTable/TableContext.js +1 -1
- package/lib/components/DataTable/TableExpandHeader.js +18 -20
- package/lib/components/DataTable/TableExpandRow.js +22 -22
- package/lib/components/DataTable/TableExpandedRow.js +17 -22
- package/lib/components/DataTable/TableHead.js +1 -1
- package/lib/components/DataTable/TableHeader.js +43 -39
- package/lib/components/DataTable/TableRow.js +7 -8
- package/lib/components/DataTable/TableSelectAll.js +13 -11
- package/lib/components/DataTable/TableSelectRow.js +28 -20
- package/lib/components/DataTable/TableToolbar.js +18 -13
- package/lib/components/DataTable/TableToolbarAction.js +5 -5
- package/lib/components/DataTable/TableToolbarContent.js +2 -4
- package/lib/components/DataTable/TableToolbarMenu.js +10 -11
- package/lib/components/DataTable/TableToolbarSearch.js +51 -70
- package/lib/components/DataTable/state/getDerivedStateFromProps.js +15 -15
- package/lib/components/DataTable/state/sortStates.js +1 -1
- package/lib/components/DataTable/state/sorting.js +28 -20
- package/lib/components/DataTable/tools/cells.js +1 -3
- package/lib/components/DataTable/tools/denormalize.js +4 -17
- package/lib/components/DataTable/tools/filter.js +18 -16
- package/lib/components/DataTable/tools/instanceId.js +2 -2
- package/lib/components/DataTable/tools/normalize.js +28 -25
- package/lib/components/DataTable/tools/sorting.js +27 -24
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +35 -37
- package/lib/components/DatePicker/DatePicker.Skeleton.js +16 -17
- package/lib/components/DatePicker/DatePicker.js +205 -194
- package/lib/components/DatePicker/plugins/appendToPlugin.js +45 -43
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +117 -107
- package/lib/components/DatePicker/plugins/rangePlugin.js +19 -11
- package/lib/components/DatePickerInput/DatePickerInput.js +83 -74
- package/lib/components/Dropdown/Dropdown.Skeleton.js +12 -11
- package/lib/components/Dropdown/Dropdown.js +265 -108
- package/lib/components/ErrorBoundary/ErrorBoundary.js +27 -48
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +3 -2
- package/lib/components/ExpandableSearch/ExpandableSearch.d.ts +13 -0
- package/lib/components/ExpandableSearch/ExpandableSearch.js +17 -24
- package/lib/components/FeatureFlags/index.js +25 -43
- package/lib/components/FileUploader/FileUploader.Skeleton.js +7 -8
- package/lib/components/FileUploader/FileUploader.js +119 -146
- package/lib/components/FileUploader/FileUploaderButton.js +35 -47
- package/lib/components/FileUploader/FileUploaderDropContainer.js +48 -52
- package/lib/components/FileUploader/FileUploaderItem.js +29 -29
- package/lib/components/FileUploader/Filename.js +12 -13
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +10 -11
- package/lib/components/FluidComboBox/FluidComboBox.js +10 -8
- package/lib/components/FluidDatePicker/FluidDatePicker.Skeleton.js +17 -17
- package/lib/components/FluidDatePicker/FluidDatePicker.js +18 -15
- package/lib/components/FluidDatePickerInput/FluidDatePickerInput.js +3 -3
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +10 -11
- package/lib/components/FluidDropdown/FluidDropdown.js +10 -8
- package/lib/components/FluidForm/FluidForm.js +8 -9
- package/lib/components/FluidForm/FormContext.js +1 -1
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +10 -11
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +11 -9
- package/lib/components/FluidSelect/FluidSelect.Skeleton.js +10 -11
- package/lib/components/FluidSelect/FluidSelect.js +8 -8
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +8 -9
- package/lib/components/FluidTextArea/FluidTextArea.js +6 -7
- package/lib/components/FluidTextInput/FluidTextInput.Skeleton.js +8 -9
- package/lib/components/FluidTextInput/FluidTextInput.js +9 -8
- package/lib/components/FluidTimePicker/FluidTimePicker.Skeleton.js +10 -9
- package/lib/components/FluidTimePicker/FluidTimePicker.js +30 -26
- package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +6 -6
- package/lib/components/Form/Form.js +8 -9
- package/lib/components/FormGroup/FormGroup.js +15 -16
- package/lib/components/FormItem/FormItem.js +7 -8
- package/lib/components/FormLabel/FormLabel.js +10 -9
- package/lib/components/Grid/CSSGrid.js +37 -38
- package/lib/components/Grid/Column.js +85 -78
- package/lib/components/Grid/ColumnHang.js +11 -13
- package/lib/components/Grid/FlexGrid.js +19 -21
- package/lib/components/Grid/Grid.js +2 -2
- package/lib/components/Grid/GridContext.js +12 -11
- package/lib/components/Grid/Row.js +16 -18
- package/lib/components/Heading/index.js +11 -13
- package/lib/components/Icon/Icon.Skeleton.js +9 -11
- package/lib/components/IconButton/index.js +18 -21
- package/lib/components/IdPrefix/index.js +4 -2
- package/lib/components/InlineCheckbox/InlineCheckbox.js +89 -36
- package/lib/components/InlineLoading/InlineLoading.js +22 -24
- package/lib/components/Layer/LayerContext.js +1 -1
- package/lib/components/Layer/index.js +16 -17
- package/lib/components/Layout/LayoutDirection.js +7 -9
- package/lib/components/Layout/LayoutDirectionContext.js +1 -1
- package/lib/components/Link/Link.js +24 -24
- package/lib/components/ListBox/ListBox.js +37 -30
- package/lib/components/ListBox/ListBoxField.js +8 -9
- package/lib/components/ListBox/ListBoxMenu.js +8 -9
- package/lib/components/ListBox/ListBoxMenuIcon.js +16 -14
- package/lib/components/ListBox/ListBoxMenuItem.js +22 -25
- package/lib/components/ListBox/ListBoxPropTypes.js +4 -4
- package/lib/components/ListBox/ListBoxSelection.js +30 -25
- package/lib/components/ListBox/index.js +1 -1
- package/lib/components/ListBox/next/ListBoxSelection.js +26 -23
- package/lib/components/ListBox/next/ListBoxTrigger.js +19 -18
- package/lib/components/ListItem/ListItem.js +8 -9
- package/lib/components/Loading/Loading.js +23 -23
- package/lib/components/Menu/Menu.js +66 -79
- package/lib/components/Menu/MenuContext.js +9 -12
- package/lib/components/Menu/MenuItem.js +103 -127
- package/lib/components/MenuButton/index.js +36 -40
- package/lib/components/Modal/Modal.js +280 -119
- package/lib/components/ModalWrapper/ModalWrapper.js +71 -95
- package/lib/components/MultiSelect/FilterableMultiSelect.js +298 -162
- package/lib/components/MultiSelect/MultiSelect.js +163 -175
- package/lib/components/MultiSelect/MultiSelectPropTypes.js +1 -1
- package/lib/components/MultiSelect/tools/itemToString.js +3 -4
- package/lib/components/MultiSelect/tools/sorting.js +15 -13
- package/lib/components/Notification/Notification.js +434 -162
- package/lib/components/NumberInput/NumberInput.Skeleton.js +9 -10
- package/lib/components/NumberInput/NumberInput.js +139 -138
- package/lib/components/OrderedList/OrderedList.js +16 -14
- package/lib/components/OverflowMenu/OverflowMenu.js +358 -226
- package/lib/components/OverflowMenu/index.js +1 -1
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +31 -36
- package/lib/components/OverflowMenuV2/index.js +25 -27
- package/lib/components/Pagination/Pagination.Skeleton.js +8 -9
- package/lib/components/Pagination/Pagination.js +97 -139
- package/lib/components/Pagination/experimental/PageSelector.js +17 -17
- package/lib/components/Pagination/experimental/Pagination.js +72 -93
- package/lib/components/PaginationNav/PaginationNav.js +97 -116
- package/lib/components/Popover/index.js +73 -79
- package/lib/components/PrimaryButton/PrimaryButton.js +3 -5
- package/lib/components/ProgressBar/ProgressBar.js +38 -36
- package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +14 -13
- package/lib/components/ProgressIndicator/ProgressIndicator.js +70 -70
- package/lib/components/RadioButton/RadioButton.Skeleton.js +8 -9
- package/lib/components/RadioButton/RadioButton.js +26 -26
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +54 -64
- package/lib/components/RadioTile/RadioTile.js +26 -24
- package/lib/components/Search/Search.Skeleton.js +15 -15
- package/lib/components/Search/Search.d.ts +83 -0
- package/lib/components/Search/Search.js +62 -69
- package/lib/components/Search/index.d.ts +11 -0
- package/lib/components/SecondaryButton/SecondaryButton.js +3 -5
- package/lib/components/Select/Select.Skeleton.js +11 -12
- package/lib/components/Select/Select.js +78 -72
- package/lib/components/SelectItem/SelectItem.js +16 -12
- package/lib/components/SelectItemGroup/SelectItemGroup.js +10 -11
- package/lib/components/SkeletonIcon/SkeletonIcon.js +10 -10
- package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +10 -10
- package/lib/components/SkeletonText/SkeletonText.js +28 -28
- package/lib/components/Slider/Slider.Skeleton.js +16 -17
- package/lib/components/Slider/Slider.js +305 -328
- package/lib/components/Slider/index.js +1 -1
- package/lib/components/Stack/Stack.js +18 -19
- package/lib/components/Stack/index.js +2 -2
- package/lib/components/StructuredList/StructuredList.Skeleton.js +24 -23
- package/lib/components/StructuredList/StructuredList.js +133 -105
- package/lib/components/Switch/IconSwitch.js +45 -51
- package/lib/components/Switch/Switch.js +33 -31
- package/lib/components/Tab/Tab.js +76 -82
- package/lib/components/Tab/index.js +1 -1
- package/lib/components/TabContent/TabContent.js +15 -17
- package/lib/components/Tabs/Tabs.Skeleton.js +13 -12
- package/lib/components/Tabs/Tabs.js +194 -205
- package/lib/components/Tabs/usePressable.js +27 -36
- package/lib/components/Tag/Tag.Skeleton.js +9 -8
- package/lib/components/Tag/Tag.js +33 -30
- package/lib/components/Text/Text.js +19 -19
- package/lib/components/Text/TextDirection.js +8 -7
- package/lib/components/Text/TextDirectionContext.js +1 -1
- package/lib/components/Text/index.js +1 -1
- package/lib/components/TextArea/TextArea.Skeleton.js +10 -11
- package/lib/components/TextArea/TextArea.js +88 -82
- package/lib/components/TextInput/ControlledPasswordInput.js +78 -72
- package/lib/components/TextInput/PasswordInput.js +100 -90
- package/lib/components/TextInput/TextInput.Skeleton.js +10 -11
- package/lib/components/TextInput/TextInput.js +104 -92
- package/lib/components/TextInput/util.js +28 -30
- package/lib/components/Theme/index.js +24 -19
- package/lib/components/Tile/Tile.js +134 -175
- package/lib/components/TileGroup/TileGroup.js +54 -69
- package/lib/components/TileGroup/index.js +1 -1
- package/lib/components/TimePicker/TimePicker.js +59 -66
- package/lib/components/TimePickerSelect/TimePickerSelect.js +19 -17
- package/lib/components/TimePickerSelect/index.js +1 -1
- package/lib/components/Toggle/Toggle.Skeleton.js +68 -57
- package/lib/components/Toggle/Toggle.js +43 -47
- package/lib/components/ToggleSmall/ToggleSmall.Skeleton.js +60 -54
- package/lib/components/Toggletip/index.js +51 -47
- package/lib/components/Tooltip/DefinitionTooltip.js +23 -30
- package/lib/components/Tooltip/Tooltip.js +34 -49
- package/lib/components/TreeView/TreeNode.js +93 -73
- package/lib/components/TreeView/TreeView.js +71 -82
- package/lib/components/UIShell/Content.js +12 -14
- package/lib/components/UIShell/Header.js +15 -11
- package/lib/components/UIShell/HeaderContainer.js +8 -14
- package/lib/components/UIShell/HeaderGlobalAction.js +25 -18
- package/lib/components/UIShell/HeaderGlobalBar.js +1 -3
- package/lib/components/UIShell/HeaderMenu.js +113 -128
- package/lib/components/UIShell/HeaderMenuButton.js +30 -21
- package/lib/components/UIShell/HeaderMenuItem.js +27 -19
- package/lib/components/UIShell/HeaderName.js +18 -13
- package/lib/components/UIShell/HeaderNavigation.js +18 -14
- package/lib/components/UIShell/HeaderPanel.js +22 -16
- package/lib/components/UIShell/HeaderSideNavItems.js +11 -9
- package/lib/components/UIShell/Link.js +11 -11
- package/lib/components/UIShell/SideNav.js +65 -61
- package/lib/components/UIShell/SideNavDetails.js +10 -11
- package/lib/components/UIShell/SideNavDivider.js +5 -3
- package/lib/components/UIShell/SideNavFooter.js +12 -12
- package/lib/components/UIShell/SideNavHeader.js +8 -6
- package/lib/components/UIShell/SideNavIcon.js +11 -8
- package/lib/components/UIShell/SideNavItem.js +11 -9
- package/lib/components/UIShell/SideNavItems.js +13 -11
- package/lib/components/UIShell/SideNavLink.js +18 -16
- package/lib/components/UIShell/SideNavLinkText.js +7 -8
- package/lib/components/UIShell/SideNavMenu.js +28 -35
- package/lib/components/UIShell/SideNavMenuItem.js +13 -13
- package/lib/components/UIShell/SideNavSwitcher.js +19 -19
- package/lib/components/UIShell/SkipToContent.js +9 -10
- package/lib/components/UIShell/Switcher.js +19 -10
- package/lib/components/UIShell/SwitcherDivider.js +9 -8
- package/lib/components/UIShell/SwitcherItem.js +25 -18
- package/lib/components/UIShell/_utils.js +1 -1
- package/lib/components/UnorderedList/UnorderedList.js +13 -13
- package/lib/index.js +10 -10
- package/lib/internal/ClickListener.js +49 -65
- package/lib/internal/FloatingMenu.js +192 -199
- package/lib/internal/OptimizedResize.js +9 -8
- package/lib/internal/Selection.js +91 -110
- package/lib/internal/createClassWrapper.js +2 -2
- package/lib/internal/deprecateFieldOnObject.js +5 -3
- package/lib/internal/environment.js +1 -1
- package/lib/internal/focus/index.js +1 -1
- package/lib/internal/keyboard/keys.js +11 -11
- package/lib/internal/keyboard/match.js +7 -6
- package/lib/internal/keyboard/navigation.js +15 -5
- package/lib/internal/useAnnouncer.js +2 -2
- package/lib/internal/useAttachedMenu.js +12 -20
- package/lib/internal/useControllableState.js +11 -16
- package/lib/internal/useDelayedState.js +9 -18
- package/lib/internal/useEffectOnce.js +4 -4
- package/lib/internal/useEvent.js +4 -4
- package/lib/internal/useId.js +14 -18
- package/lib/internal/useIdPrefix.js +1 -1
- package/lib/internal/useIsomorphicEffect.js +1 -1
- package/lib/internal/useMergedRefs.js +3 -3
- package/lib/internal/useNoInteractiveChildren.js +8 -19
- package/lib/internal/useNormalizedInputProps.js +16 -14
- package/lib/internal/usePrefix.js +1 -1
- package/lib/internal/useSavedCallback.js +3 -3
- package/lib/internal/warning.js +4 -4
- package/lib/internal/wrapFocus.js +16 -21
- package/lib/prop-types/AriaPropTypes.js +1 -1
- package/lib/prop-types/deprecate.js +6 -5
- package/lib/prop-types/isRequiredOneOf.js +15 -28
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +2 -2
- package/lib/prop-types/types.js +1 -1
- package/lib/tools/array.js +1 -1
- package/lib/tools/events.js +21 -14
- package/lib/tools/mergeRefs.js +3 -3
- package/lib/tools/setupGetInstanceId.js +1 -1
- package/lib/tools/uniqueId.js +3 -3
- package/lib/tools/wrapComponent.js +14 -13
- package/package.json +6 -6
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { defineProperty as _defineProperty,
|
|
8
|
+
import { defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import React__default, { PureComponent } from 'react';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import cx from 'classnames';
|
|
@@ -17,113 +17,102 @@ import { PrefixContext } from '../../internal/usePrefix.js';
|
|
|
17
17
|
import deprecate from '../../prop-types/deprecate.js';
|
|
18
18
|
import { FeatureFlagContext } from '../FeatureFlags/index.js';
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var defaultFormatLabel = function defaultFormatLabel(value, label) {
|
|
23
|
-
return typeof label === 'function' ? label(value) : "".concat(value).concat(label);
|
|
20
|
+
const defaultFormatLabel = (value, label) => {
|
|
21
|
+
return typeof label === 'function' ? label(value) : `${value}${label}`;
|
|
24
22
|
};
|
|
25
23
|
/**
|
|
26
24
|
* Minimum time between processed "drag" events.
|
|
27
25
|
*/
|
|
28
26
|
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
const EVENT_THROTTLE = 16; // ms
|
|
31
29
|
|
|
32
30
|
/**
|
|
33
31
|
* Event types that trigger "drags".
|
|
34
32
|
*/
|
|
35
33
|
|
|
36
|
-
|
|
34
|
+
const DRAG_EVENT_TYPES = new Set(['mousemove', 'touchmove']);
|
|
37
35
|
/**
|
|
38
36
|
* Event types that trigger a "drag" to stop.
|
|
39
37
|
*/
|
|
40
38
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var _super = _createSuper(Slider);
|
|
47
|
-
|
|
48
|
-
function Slider(props) {
|
|
49
|
-
var _this;
|
|
50
|
-
|
|
51
|
-
_classCallCheck(this, Slider);
|
|
52
|
-
|
|
53
|
-
_this = _super.call(this, props);
|
|
39
|
+
const DRAG_STOP_EVENT_TYPES = new Set(['mouseup', 'touchend', 'touchcancel']);
|
|
40
|
+
class Slider extends PureComponent {
|
|
41
|
+
constructor(props) {
|
|
42
|
+
super(props);
|
|
54
43
|
|
|
55
|
-
_defineProperty(
|
|
56
|
-
value:
|
|
44
|
+
_defineProperty(this, "state", {
|
|
45
|
+
value: this.props.value,
|
|
57
46
|
left: 0,
|
|
58
47
|
needsOnRelease: false,
|
|
59
48
|
isValid: true
|
|
60
49
|
});
|
|
61
50
|
|
|
62
|
-
_defineProperty(
|
|
51
|
+
_defineProperty(this, "thumbRef", void 0);
|
|
63
52
|
|
|
64
|
-
_defineProperty(
|
|
53
|
+
_defineProperty(this, "filledTrackRef", void 0);
|
|
65
54
|
|
|
66
|
-
_defineProperty(
|
|
55
|
+
_defineProperty(this, "element", null);
|
|
67
56
|
|
|
68
|
-
_defineProperty(
|
|
57
|
+
_defineProperty(this, "inputId", '');
|
|
69
58
|
|
|
70
|
-
_defineProperty(
|
|
59
|
+
_defineProperty(this, "track", void 0);
|
|
71
60
|
|
|
72
|
-
_defineProperty(
|
|
61
|
+
_defineProperty(this, "onDragStart", evt => {
|
|
73
62
|
// Do nothing if component is disabled
|
|
74
|
-
if (
|
|
63
|
+
if (this.props.disabled || this.props.readOnly) {
|
|
75
64
|
return;
|
|
76
65
|
} // Register drag stop handlers
|
|
77
66
|
|
|
78
67
|
|
|
79
|
-
DRAG_STOP_EVENT_TYPES.forEach(
|
|
68
|
+
DRAG_STOP_EVENT_TYPES.forEach(element => {
|
|
80
69
|
var _this$element;
|
|
81
70
|
|
|
82
|
-
(_this$element =
|
|
71
|
+
(_this$element = this.element) === null || _this$element === void 0 ? void 0 : _this$element.ownerDocument.addEventListener(element, this.onDragStop);
|
|
83
72
|
}); // Register drag handlers
|
|
84
73
|
|
|
85
|
-
DRAG_EVENT_TYPES.forEach(
|
|
74
|
+
DRAG_EVENT_TYPES.forEach(element => {
|
|
86
75
|
var _this$element2;
|
|
87
76
|
|
|
88
|
-
(_this$element2 =
|
|
77
|
+
(_this$element2 = this.element) === null || _this$element2 === void 0 ? void 0 : _this$element2.ownerDocument.addEventListener(element, this.onDrag);
|
|
89
78
|
}); // Perform first recalculation since we probably didn't click exactly in the
|
|
90
79
|
// middle of the thumb
|
|
91
80
|
|
|
92
|
-
|
|
81
|
+
this.onDrag(evt);
|
|
93
82
|
});
|
|
94
83
|
|
|
95
|
-
_defineProperty(
|
|
84
|
+
_defineProperty(this, "onDragStop", () => {
|
|
96
85
|
// Do nothing if component is disabled
|
|
97
|
-
if (
|
|
86
|
+
if (this.props.disabled || this.props.readOnly) {
|
|
98
87
|
return;
|
|
99
88
|
} // Remove drag stop handlers
|
|
100
89
|
|
|
101
90
|
|
|
102
|
-
DRAG_STOP_EVENT_TYPES.forEach(
|
|
91
|
+
DRAG_STOP_EVENT_TYPES.forEach(element => {
|
|
103
92
|
var _this$element3;
|
|
104
93
|
|
|
105
|
-
(_this$element3 =
|
|
94
|
+
(_this$element3 = this.element) === null || _this$element3 === void 0 ? void 0 : _this$element3.ownerDocument.removeEventListener(element, this.onDragStop);
|
|
106
95
|
}); // Remove drag handlers
|
|
107
96
|
|
|
108
|
-
DRAG_EVENT_TYPES.forEach(
|
|
97
|
+
DRAG_EVENT_TYPES.forEach(element => {
|
|
109
98
|
var _this$element4;
|
|
110
99
|
|
|
111
|
-
(_this$element4 =
|
|
100
|
+
(_this$element4 = this.element) === null || _this$element4 === void 0 ? void 0 : _this$element4.ownerDocument.removeEventListener(element, this.onDrag);
|
|
112
101
|
}); // Set needsOnRelease flag so event fires on next update
|
|
113
102
|
|
|
114
|
-
|
|
103
|
+
this.setState({
|
|
115
104
|
needsOnRelease: true,
|
|
116
105
|
isValid: true
|
|
117
106
|
});
|
|
118
107
|
});
|
|
119
108
|
|
|
120
|
-
_defineProperty(
|
|
109
|
+
_defineProperty(this, "_onDrag", evt => {
|
|
121
110
|
// Do nothing if component is disabled or we have no event
|
|
122
|
-
if (
|
|
111
|
+
if (this.props.disabled || this.props.readOnly || !evt) {
|
|
123
112
|
return;
|
|
124
113
|
}
|
|
125
114
|
|
|
126
|
-
|
|
115
|
+
let clientX;
|
|
127
116
|
|
|
128
117
|
if ('clientX' in evt) {
|
|
129
118
|
clientX = evt.clientX;
|
|
@@ -134,42 +123,36 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
|
|
|
134
123
|
return;
|
|
135
124
|
}
|
|
136
125
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
value
|
|
145
|
-
left
|
|
126
|
+
const {
|
|
127
|
+
value,
|
|
128
|
+
left
|
|
129
|
+
} = this.calcValue({
|
|
130
|
+
clientX
|
|
131
|
+
});
|
|
132
|
+
this.setState({
|
|
133
|
+
value,
|
|
134
|
+
left,
|
|
146
135
|
isValid: true
|
|
147
136
|
});
|
|
148
137
|
});
|
|
149
138
|
|
|
150
|
-
_defineProperty(
|
|
139
|
+
_defineProperty(this, "onDrag", throttle(this._onDrag, EVENT_THROTTLE, {
|
|
151
140
|
leading: true,
|
|
152
141
|
trailing: false
|
|
153
142
|
}));
|
|
154
143
|
|
|
155
|
-
_defineProperty(
|
|
156
|
-
var _this$props$step3, _this$props$step4, _this$props$step5, _this$props$step6;
|
|
157
|
-
|
|
144
|
+
_defineProperty(this, "onKeyDown", evt => {
|
|
158
145
|
// Do nothing if component is disabled or we don't have a valid event
|
|
159
|
-
if (
|
|
146
|
+
if (this.props.disabled || this.props.readOnly || !('which' in evt)) {
|
|
160
147
|
return;
|
|
161
148
|
}
|
|
162
149
|
|
|
163
|
-
|
|
150
|
+
let delta = 0;
|
|
164
151
|
|
|
165
152
|
if (matches(evt.which, [ArrowDown, ArrowLeft])) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
delta = -((_this$props$step = _this.props.step) !== null && _this$props$step !== void 0 ? _this$props$step : Slider.defaultProps.step);
|
|
153
|
+
delta = -(this.props.step ?? Slider.defaultProps.step);
|
|
169
154
|
} else if (matches(evt.which, [ArrowUp, ArrowRight])) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
delta = (_this$props$step2 = _this.props.step) !== null && _this$props$step2 !== void 0 ? _this$props$step2 : Slider.defaultProps.step;
|
|
155
|
+
delta = this.props.step ?? Slider.defaultProps.step;
|
|
173
156
|
} else {
|
|
174
157
|
// Ignore keys we don't want to handle
|
|
175
158
|
return;
|
|
@@ -177,30 +160,29 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
|
|
|
177
160
|
|
|
178
161
|
|
|
179
162
|
if (evt.shiftKey) {
|
|
180
|
-
|
|
181
|
-
delta *= stepMultiplier
|
|
163
|
+
const stepMultiplier = this.props.stepMultiplier;
|
|
164
|
+
delta *= stepMultiplier ?? Slider.defaultProps.stepMultiplier;
|
|
182
165
|
}
|
|
183
166
|
|
|
184
|
-
Math.floor(
|
|
185
|
-
|
|
186
|
-
|
|
167
|
+
Math.floor(this.state.value / (this.props.step ?? Slider.defaultProps.step)) * (this.props.step ?? Slider.defaultProps.step);
|
|
168
|
+
const {
|
|
169
|
+
value,
|
|
170
|
+
left
|
|
171
|
+
} = this.calcValue({
|
|
187
172
|
// Ensures custom value from `<input>` won't cause skipping next stepping point with right arrow key,
|
|
188
173
|
// e.g. Typing 51 in `<input>`, moving focus onto the thumb and the hitting right arrow key should yield 52 instead of 54
|
|
189
|
-
value: (delta > 0 ? Math.floor(
|
|
190
|
-
})
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
_this.setState({
|
|
195
|
-
value: value,
|
|
196
|
-
left: left,
|
|
174
|
+
value: (delta > 0 ? Math.floor(this.state.value / (this.props.step ?? Slider.defaultProps.step)) * (this.props.step ?? Slider.defaultProps.step) : this.state.value) + delta
|
|
175
|
+
});
|
|
176
|
+
this.setState({
|
|
177
|
+
value,
|
|
178
|
+
left,
|
|
197
179
|
isValid: true
|
|
198
180
|
});
|
|
199
181
|
});
|
|
200
182
|
|
|
201
|
-
_defineProperty(
|
|
183
|
+
_defineProperty(this, "onChange", evt => {
|
|
202
184
|
// Do nothing if component is disabled
|
|
203
|
-
if (
|
|
185
|
+
if (this.props.disabled || this.props.readOnly) {
|
|
204
186
|
return;
|
|
205
187
|
} // Do nothing if we have no valid event, target, or value
|
|
206
188
|
|
|
@@ -209,28 +191,28 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
|
|
|
209
191
|
return;
|
|
210
192
|
}
|
|
211
193
|
|
|
212
|
-
|
|
194
|
+
const targetValue = Number.parseFloat(evt.target.value); // Avoid calling calcValue for invalid numbers, but still update the state
|
|
213
195
|
|
|
214
196
|
if (isNaN(targetValue)) {
|
|
215
|
-
|
|
197
|
+
this.setState({
|
|
216
198
|
value: evt.target.value
|
|
217
199
|
});
|
|
218
200
|
} else {
|
|
219
|
-
|
|
201
|
+
const {
|
|
202
|
+
value,
|
|
203
|
+
left
|
|
204
|
+
} = this.calcValue({
|
|
220
205
|
value: targetValue,
|
|
221
206
|
useRawValue: true
|
|
222
|
-
})
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
_this.setState({
|
|
227
|
-
value: _value,
|
|
228
|
-
left: left
|
|
207
|
+
});
|
|
208
|
+
this.setState({
|
|
209
|
+
value,
|
|
210
|
+
left
|
|
229
211
|
});
|
|
230
212
|
}
|
|
231
213
|
});
|
|
232
214
|
|
|
233
|
-
_defineProperty(
|
|
215
|
+
_defineProperty(this, "onBlur", evt => {
|
|
234
216
|
var _this$props$onBlur, _this$props;
|
|
235
217
|
|
|
236
218
|
// Do nothing if we have no valid event, target, or value
|
|
@@ -239,29 +221,30 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
|
|
|
239
221
|
} // determine validity of input change after clicking out of input
|
|
240
222
|
|
|
241
223
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
224
|
+
const validity = evt.target.checkValidity();
|
|
225
|
+
const {
|
|
226
|
+
value
|
|
227
|
+
} = evt.target;
|
|
228
|
+
this.setState({
|
|
246
229
|
isValid: validity
|
|
247
230
|
});
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
value: value
|
|
231
|
+
(_this$props$onBlur = (_this$props = this.props).onBlur) === null || _this$props$onBlur === void 0 ? void 0 : _this$props$onBlur.call(_this$props, {
|
|
232
|
+
value
|
|
251
233
|
});
|
|
252
234
|
});
|
|
253
235
|
|
|
254
|
-
_defineProperty(
|
|
255
|
-
var _this$element5, _this$element5$getBou
|
|
236
|
+
_defineProperty(this, "calcValue", _ref => {
|
|
237
|
+
var _this$element5, _this$element5$getBou;
|
|
256
238
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
239
|
+
let {
|
|
240
|
+
clientX,
|
|
241
|
+
value,
|
|
242
|
+
useRawValue = false
|
|
243
|
+
} = _ref;
|
|
244
|
+
const range = this.props.max - this.props.min;
|
|
245
|
+
const boundingRect = (_this$element5 = this.element) === null || _this$element5 === void 0 ? void 0 : (_this$element5$getBou = _this$element5.getBoundingClientRect) === null || _this$element5$getBou === void 0 ? void 0 : _this$element5$getBou.call(_this$element5);
|
|
246
|
+
const totalSteps = range / (this.props.step ?? Slider.defaultProps.step);
|
|
247
|
+
let width = boundingRect ? boundingRect.right - boundingRect.left : 0; // Enforce a minimum width of at least 1 for calculations
|
|
265
248
|
|
|
266
249
|
if (width <= 0) {
|
|
267
250
|
width = 1;
|
|
@@ -269,274 +252,268 @@ var Slider = /*#__PURE__*/function (_PureComponent) {
|
|
|
269
252
|
// use the provided value or state's value to calculate it instead.
|
|
270
253
|
|
|
271
254
|
|
|
272
|
-
|
|
255
|
+
let leftPercent;
|
|
273
256
|
|
|
274
257
|
if (clientX != null) {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
var leftOffset = clientX - ((_boundingRect$left = boundingRect === null || boundingRect === void 0 ? void 0 : boundingRect.left) !== null && _boundingRect$left !== void 0 ? _boundingRect$left : 0);
|
|
258
|
+
const leftOffset = clientX - ((boundingRect === null || boundingRect === void 0 ? void 0 : boundingRect.left) ?? 0);
|
|
278
259
|
leftPercent = leftOffset / width;
|
|
279
260
|
} else {
|
|
280
261
|
if (value == null) {
|
|
281
|
-
value =
|
|
262
|
+
value = this.state.value;
|
|
282
263
|
} // prevent NaN calculation if the range is 0
|
|
283
264
|
|
|
284
265
|
|
|
285
|
-
leftPercent = range === 0 ? 0 : (value -
|
|
266
|
+
leftPercent = range === 0 ? 0 : (value - this.props.min) / range;
|
|
286
267
|
}
|
|
287
268
|
|
|
288
269
|
if (useRawValue) {
|
|
289
270
|
// Adjusts only for min/max of thumb position
|
|
290
271
|
return {
|
|
291
|
-
value
|
|
272
|
+
value,
|
|
292
273
|
left: Math.min(1, Math.max(0, leftPercent)) * 100
|
|
293
274
|
};
|
|
294
275
|
}
|
|
295
276
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
steppedValue = _this.clamp(steppedValue + _this.props.min, _this.props.min, _this.props.max);
|
|
277
|
+
let steppedValue = Math.round(leftPercent * totalSteps) * (this.props.step ?? Slider.defaultProps.step);
|
|
278
|
+
const steppedPercent = this.clamp(steppedValue / range, 0, 1);
|
|
279
|
+
steppedValue = this.clamp(steppedValue + this.props.min, this.props.min, this.props.max);
|
|
301
280
|
return {
|
|
302
281
|
value: steppedValue,
|
|
303
282
|
left: steppedPercent * 100
|
|
304
283
|
};
|
|
305
284
|
});
|
|
306
285
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
return _this;
|
|
286
|
+
this.thumbRef = /*#__PURE__*/React__default.createRef();
|
|
287
|
+
this.filledTrackRef = /*#__PURE__*/React__default.createRef();
|
|
310
288
|
}
|
|
311
289
|
/**
|
|
312
290
|
* Sets up initial slider position and value in response to component mount.
|
|
313
291
|
*/
|
|
314
292
|
|
|
315
293
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
left: left
|
|
329
|
-
});
|
|
330
|
-
}
|
|
294
|
+
componentDidMount() {
|
|
295
|
+
if (this.element) {
|
|
296
|
+
const {
|
|
297
|
+
value,
|
|
298
|
+
left
|
|
299
|
+
} = this.calcValue({
|
|
300
|
+
useRawValue: true
|
|
301
|
+
});
|
|
302
|
+
this.setState({
|
|
303
|
+
value,
|
|
304
|
+
left
|
|
305
|
+
});
|
|
331
306
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
}, {
|
|
342
|
-
key: "componentDidUpdate",
|
|
343
|
-
value: function componentDidUpdate(prevProps, prevState) {
|
|
344
|
-
// Fire onChange event handler if present, if there's a usable value, and
|
|
345
|
-
// if the value is different from the last one
|
|
346
|
-
if (this.thumbRef.current) {
|
|
347
|
-
this.thumbRef.current.style.left = "".concat(this.state.left, "%");
|
|
348
|
-
}
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Handles firing of `onChange` and `onRelease` callbacks to parent in
|
|
310
|
+
* response to state changes.
|
|
311
|
+
*
|
|
312
|
+
* @param {*} prevProps prevProps
|
|
313
|
+
* @param {*} prevState The previous Slider state, used to see if callbacks
|
|
314
|
+
* should be called.
|
|
315
|
+
*/
|
|
349
316
|
|
|
350
|
-
if (this.filledTrackRef.current) {
|
|
351
|
-
this.filledTrackRef.current.style.transform = "translate(0%, -50%) scaleX(".concat(this.state.left / 100, ")");
|
|
352
|
-
}
|
|
353
317
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
318
|
+
componentDidUpdate(prevProps, prevState) {
|
|
319
|
+
// Fire onChange event handler if present, if there's a usable value, and
|
|
320
|
+
// if the value is different from the last one
|
|
321
|
+
if (this.thumbRef.current) {
|
|
322
|
+
this.thumbRef.current.style.left = `${this.state.left}%`;
|
|
323
|
+
}
|
|
359
324
|
|
|
325
|
+
if (this.filledTrackRef.current) {
|
|
326
|
+
this.filledTrackRef.current.style.transform = `translate(0%, -50%) scaleX(${this.state.left / 100})`;
|
|
327
|
+
}
|
|
360
328
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
329
|
+
if (prevState.value !== this.state.value && typeof this.props.onChange === 'function') {
|
|
330
|
+
this.props.onChange({
|
|
331
|
+
value: this.state.value
|
|
332
|
+
});
|
|
333
|
+
} // Fire onRelease event handler if present and if needed
|
|
365
334
|
|
|
366
|
-
this.setState({
|
|
367
|
-
needsOnRelease: false
|
|
368
|
-
});
|
|
369
|
-
} // If value from props does not change, do nothing here.
|
|
370
|
-
// Otherwise, do prop -> state sync without "value capping".
|
|
371
335
|
|
|
336
|
+
if (this.state.needsOnRelease && typeof this.props.onRelease === 'function') {
|
|
337
|
+
this.props.onRelease({
|
|
338
|
+
value: this.state.value
|
|
339
|
+
}); // Reset the flag
|
|
372
340
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
}
|
|
341
|
+
this.setState({
|
|
342
|
+
needsOnRelease: false
|
|
343
|
+
});
|
|
344
|
+
} // If value from props does not change, do nothing here.
|
|
345
|
+
// Otherwise, do prop -> state sync without "value capping".
|
|
376
346
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
}));
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* Synonymous to ECMA2017+ `Math.clamp`.
|
|
384
|
-
*
|
|
385
|
-
* @param {number} val
|
|
386
|
-
* @param {number} min
|
|
387
|
-
* @param {number} max
|
|
388
|
-
*
|
|
389
|
-
* @returns `val` if `max>=val>=min`; `min` if `val<min`; `max` if `val>max`.
|
|
390
|
-
*/
|
|
391
|
-
|
|
392
|
-
}, {
|
|
393
|
-
key: "clamp",
|
|
394
|
-
value: function clamp(val, min, max) {
|
|
395
|
-
return Math.max(min, Math.min(val, max));
|
|
347
|
+
|
|
348
|
+
if (prevProps.value === this.props.value && prevProps.max === this.props.max && prevProps.min === this.props.min) {
|
|
349
|
+
return;
|
|
396
350
|
}
|
|
397
|
-
/**
|
|
398
|
-
* Sets up "drag" event handlers and calls `this.onDrag` in case dragging
|
|
399
|
-
* started on somewhere other than the thumb without a corresponding "move"
|
|
400
|
-
* event.
|
|
401
|
-
*
|
|
402
|
-
* @param {Event} evt The event.
|
|
403
|
-
*/
|
|
404
|
-
|
|
405
|
-
}, {
|
|
406
|
-
key: "render",
|
|
407
|
-
value: function render() {
|
|
408
|
-
var _this2 = this;
|
|
409
|
-
|
|
410
|
-
var _this$props2 = this.props,
|
|
411
|
-
ariaLabelInput = _this$props2.ariaLabelInput,
|
|
412
|
-
className = _this$props2.className,
|
|
413
|
-
hideTextInput = _this$props2.hideTextInput,
|
|
414
|
-
_this$props2$id = _this$props2.id,
|
|
415
|
-
id = _this$props2$id === void 0 ? this.inputId = this.inputId || "__carbon-slider_".concat(Math.random().toString(36).substr(2)) : _this$props2$id,
|
|
416
|
-
min = _this$props2.min,
|
|
417
|
-
minLabel = _this$props2.minLabel,
|
|
418
|
-
max = _this$props2.max,
|
|
419
|
-
maxLabel = _this$props2.maxLabel,
|
|
420
|
-
_this$props2$formatLa = _this$props2.formatLabel,
|
|
421
|
-
formatLabel = _this$props2$formatLa === void 0 ? defaultFormatLabel : _this$props2$formatLa,
|
|
422
|
-
labelText = _this$props2.labelText,
|
|
423
|
-
step = _this$props2.step;
|
|
424
|
-
_this$props2.stepMultiplier;
|
|
425
|
-
var inputType = _this$props2.inputType,
|
|
426
|
-
required = _this$props2.required,
|
|
427
|
-
disabled = _this$props2.disabled,
|
|
428
|
-
name = _this$props2.name,
|
|
429
|
-
light = _this$props2.light,
|
|
430
|
-
readOnly = _this$props2.readOnly,
|
|
431
|
-
other = _objectWithoutProperties(_this$props2, _excluded);
|
|
432
|
-
|
|
433
|
-
delete other.onRelease;
|
|
434
|
-
delete other.invalid;
|
|
435
|
-
var _this$state = this.state,
|
|
436
|
-
value = _this$state.value,
|
|
437
|
-
isValid = _this$state.isValid;
|
|
438
|
-
var scope = this.context;
|
|
439
|
-
var enabled;
|
|
440
|
-
|
|
441
|
-
if (scope.enabled) {
|
|
442
|
-
enabled = scope.enabled('enable-v11-release');
|
|
443
|
-
}
|
|
444
351
|
|
|
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
|
-
}), /*#__PURE__*/React__default.createElement("div", {
|
|
484
|
-
className: "".concat(prefix, "--slider__track"),
|
|
485
|
-
ref: function ref(node) {
|
|
486
|
-
_this2.track = node;
|
|
487
|
-
}
|
|
488
|
-
}), /*#__PURE__*/React__default.createElement("div", {
|
|
489
|
-
className: "".concat(prefix, "--slider__filled-track"),
|
|
490
|
-
ref: _this2.filledTrackRef
|
|
491
|
-
})), /*#__PURE__*/React__default.createElement("span", {
|
|
492
|
-
className: "".concat(prefix, "--slider__range-label")
|
|
493
|
-
}, formatLabel(max, maxLabel)), /*#__PURE__*/React__default.createElement("input", {
|
|
494
|
-
type: hideTextInput ? 'hidden' : inputType,
|
|
495
|
-
id: "".concat(id, "-input-for-slider"),
|
|
496
|
-
name: name,
|
|
497
|
-
className: inputClasses,
|
|
498
|
-
value: value,
|
|
499
|
-
"aria-labelledby": !ariaLabelInput ? labelId : undefined,
|
|
500
|
-
"aria-label": ariaLabelInput ? ariaLabelInput : undefined,
|
|
501
|
-
disabled: disabled,
|
|
502
|
-
required: required,
|
|
503
|
-
min: min,
|
|
504
|
-
max: max,
|
|
505
|
-
step: step,
|
|
506
|
-
onChange: _this2.onChange,
|
|
507
|
-
onBlur: _this2.onBlur,
|
|
508
|
-
onKeyUp: _this2.props.onInputKeyUp,
|
|
509
|
-
"data-invalid": isValid ? null : true,
|
|
510
|
-
"aria-invalid": isValid ? undefined : true,
|
|
511
|
-
readOnly: readOnly
|
|
512
|
-
})));
|
|
513
|
-
});
|
|
352
|
+
this.setState(this.calcValue({
|
|
353
|
+
value: this.props.value,
|
|
354
|
+
useRawValue: true
|
|
355
|
+
}));
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Synonymous to ECMA2017+ `Math.clamp`.
|
|
359
|
+
*
|
|
360
|
+
* @param {number} val
|
|
361
|
+
* @param {number} min
|
|
362
|
+
* @param {number} max
|
|
363
|
+
*
|
|
364
|
+
* @returns `val` if `max>=val>=min`; `min` if `val<min`; `max` if `val>max`.
|
|
365
|
+
*/
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
clamp(val, min, max) {
|
|
369
|
+
return Math.max(min, Math.min(val, max));
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Sets up "drag" event handlers and calls `this.onDrag` in case dragging
|
|
373
|
+
* started on somewhere other than the thumb without a corresponding "move"
|
|
374
|
+
* event.
|
|
375
|
+
*
|
|
376
|
+
* @param {Event} evt The event.
|
|
377
|
+
*/
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
// syncs invalid state and prop
|
|
381
|
+
static getDerivedStateFromProps(props, state) {
|
|
382
|
+
const {
|
|
383
|
+
isValid
|
|
384
|
+
} = state; // will override state in favor of invalid prop
|
|
385
|
+
|
|
386
|
+
if (props.invalid === true && isValid === true) {
|
|
387
|
+
return {
|
|
388
|
+
isValid: false
|
|
389
|
+
};
|
|
514
390
|
}
|
|
515
|
-
}], [{
|
|
516
|
-
key: "getDerivedStateFromProps",
|
|
517
|
-
value: // syncs invalid state and prop
|
|
518
|
-
function getDerivedStateFromProps(props, state) {
|
|
519
|
-
var isValid = state.isValid; // will override state in favor of invalid prop
|
|
520
391
|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
392
|
+
if (props.invalid === false && isValid === false) {
|
|
393
|
+
return {
|
|
394
|
+
isValid: true
|
|
395
|
+
};
|
|
396
|
+
} //if invalid prop is not provided, state will remain the same
|
|
526
397
|
|
|
527
|
-
if (props.invalid === false && isValid === false) {
|
|
528
|
-
return {
|
|
529
|
-
isValid: true
|
|
530
|
-
};
|
|
531
|
-
} //if invalid prop is not provided, state will remain the same
|
|
532
398
|
|
|
399
|
+
return null;
|
|
400
|
+
}
|
|
533
401
|
|
|
534
|
-
|
|
402
|
+
render() {
|
|
403
|
+
const {
|
|
404
|
+
ariaLabelInput,
|
|
405
|
+
className,
|
|
406
|
+
hideTextInput,
|
|
407
|
+
id = this.inputId = this.inputId || `__carbon-slider_${Math.random().toString(36).substr(2)}`,
|
|
408
|
+
min,
|
|
409
|
+
minLabel,
|
|
410
|
+
max,
|
|
411
|
+
maxLabel,
|
|
412
|
+
formatLabel = defaultFormatLabel,
|
|
413
|
+
labelText,
|
|
414
|
+
step,
|
|
415
|
+
stepMultiplier: _stepMultiplier,
|
|
416
|
+
inputType,
|
|
417
|
+
required,
|
|
418
|
+
disabled,
|
|
419
|
+
name,
|
|
420
|
+
light,
|
|
421
|
+
readOnly,
|
|
422
|
+
...other
|
|
423
|
+
} = this.props;
|
|
424
|
+
delete other.onRelease;
|
|
425
|
+
delete other.invalid;
|
|
426
|
+
const {
|
|
427
|
+
value,
|
|
428
|
+
isValid
|
|
429
|
+
} = this.state;
|
|
430
|
+
const scope = this.context;
|
|
431
|
+
let enabled;
|
|
432
|
+
|
|
433
|
+
if (scope.enabled) {
|
|
434
|
+
enabled = scope.enabled('enable-v11-release');
|
|
535
435
|
}
|
|
536
|
-
}]);
|
|
537
436
|
|
|
538
|
-
|
|
539
|
-
}
|
|
437
|
+
return /*#__PURE__*/React__default.createElement(PrefixContext.Consumer, null, prefix => {
|
|
438
|
+
const labelId = `${id}-label`;
|
|
439
|
+
const labelClasses = cx(`${prefix}--label`, {
|
|
440
|
+
[`${prefix}--label--disabled`]: disabled
|
|
441
|
+
});
|
|
442
|
+
const sliderClasses = cx(`${prefix}--slider`, {
|
|
443
|
+
[`${prefix}--slider--disabled`]: disabled
|
|
444
|
+
}, {
|
|
445
|
+
[`${prefix}--slider--readonly`]: readOnly
|
|
446
|
+
}, [enabled ? null : className]);
|
|
447
|
+
const inputClasses = cx(`${prefix}--text-input`, `${prefix}--slider-text-input`, {
|
|
448
|
+
[`${prefix}--text-input--light`]: light,
|
|
449
|
+
[`${prefix}--text-input--invalid`]: isValid === false,
|
|
450
|
+
[`${prefix}--slider-text-input--hidden`]: hideTextInput
|
|
451
|
+
});
|
|
452
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
453
|
+
className: enabled ? cx(`${prefix}--form-item`, className) : `${prefix}--form-item`
|
|
454
|
+
}, /*#__PURE__*/React__default.createElement("label", {
|
|
455
|
+
htmlFor: id,
|
|
456
|
+
className: labelClasses,
|
|
457
|
+
id: labelId
|
|
458
|
+
}, labelText), /*#__PURE__*/React__default.createElement("div", {
|
|
459
|
+
className: `${prefix}--slider-container`
|
|
460
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
461
|
+
className: `${prefix}--slider__range-label`
|
|
462
|
+
}, formatLabel(min, minLabel)), /*#__PURE__*/React__default.createElement("div", _extends({
|
|
463
|
+
className: sliderClasses,
|
|
464
|
+
ref: node => {
|
|
465
|
+
this.element = node;
|
|
466
|
+
},
|
|
467
|
+
onMouseDown: this.onDragStart,
|
|
468
|
+
onTouchStart: this.onDragStart,
|
|
469
|
+
onKeyDown: this.onKeyDown,
|
|
470
|
+
role: "presentation",
|
|
471
|
+
tabIndex: -1,
|
|
472
|
+
"data-invalid": isValid ? null : true
|
|
473
|
+
}, other), /*#__PURE__*/React__default.createElement("div", {
|
|
474
|
+
className: `${prefix}--slider__thumb`,
|
|
475
|
+
role: "slider",
|
|
476
|
+
id: id,
|
|
477
|
+
tabIndex: !readOnly ? 0 : -1,
|
|
478
|
+
"aria-valuemax": max,
|
|
479
|
+
"aria-valuemin": min,
|
|
480
|
+
"aria-valuenow": value,
|
|
481
|
+
"aria-labelledby": labelId,
|
|
482
|
+
ref: this.thumbRef
|
|
483
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
484
|
+
className: `${prefix}--slider__track`,
|
|
485
|
+
ref: node => {
|
|
486
|
+
this.track = node;
|
|
487
|
+
}
|
|
488
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
489
|
+
className: `${prefix}--slider__filled-track`,
|
|
490
|
+
ref: this.filledTrackRef
|
|
491
|
+
})), /*#__PURE__*/React__default.createElement("span", {
|
|
492
|
+
className: `${prefix}--slider__range-label`
|
|
493
|
+
}, formatLabel(max, maxLabel)), /*#__PURE__*/React__default.createElement("input", {
|
|
494
|
+
type: hideTextInput ? 'hidden' : inputType,
|
|
495
|
+
id: `${id}-input-for-slider`,
|
|
496
|
+
name: name,
|
|
497
|
+
className: inputClasses,
|
|
498
|
+
value: value,
|
|
499
|
+
"aria-labelledby": !ariaLabelInput ? labelId : undefined,
|
|
500
|
+
"aria-label": ariaLabelInput ? ariaLabelInput : undefined,
|
|
501
|
+
disabled: disabled,
|
|
502
|
+
required: required,
|
|
503
|
+
min: min,
|
|
504
|
+
max: max,
|
|
505
|
+
step: step,
|
|
506
|
+
onChange: this.onChange,
|
|
507
|
+
onBlur: this.onBlur,
|
|
508
|
+
onKeyUp: this.props.onInputKeyUp,
|
|
509
|
+
"data-invalid": isValid ? null : true,
|
|
510
|
+
"aria-invalid": isValid ? undefined : true,
|
|
511
|
+
readOnly: readOnly
|
|
512
|
+
})));
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
}
|
|
540
517
|
|
|
541
518
|
_defineProperty(Slider, "propTypes", {
|
|
542
519
|
/**
|