@carbon/react 1.29.0 → 1.30.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 +16 -5
- package/es/components/Accordion/Accordion.Skeleton.js +0 -7
- package/es/components/Accordion/Accordion.js +1 -8
- package/es/components/Accordion/AccordionItem.js +5 -19
- package/es/components/AspectRatio/AspectRatio.js +0 -5
- package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +0 -3
- package/es/components/Breadcrumb/Breadcrumb.js +0 -3
- package/es/components/Breadcrumb/BreadcrumbItem.js +0 -7
- package/es/components/Button/Button.Skeleton.js +2 -7
- package/es/components/Button/Button.js +2 -36
- package/es/components/ButtonSet/ButtonSet.js +0 -2
- package/es/components/Checkbox/Checkbox.Skeleton.js +0 -1
- package/es/components/Checkbox/Checkbox.js +4 -20
- package/es/components/CheckboxGroup/CheckboxGroup.js +0 -11
- package/es/components/ClassPrefix/index.d.ts +26 -0
- package/es/components/ClassPrefix/index.js +0 -2
- package/es/components/CodeSnippet/CodeSnippet.Skeleton.js +0 -5
- package/es/components/CodeSnippet/CodeSnippet.js +6 -45
- package/es/components/ComboBox/ComboBox.js +12 -79
- package/es/components/ComboBox/tools/filter.js +0 -1
- package/es/components/ComboButton/index.js +0 -14
- package/es/components/ComposedModal/ComposedModal.js +2 -32
- package/es/components/ComposedModal/ModalFooter.js +0 -21
- package/es/components/ComposedModal/ModalHeader.js +0 -12
- package/es/components/ContainedList/ContainedList.js +5 -32
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +0 -6
- package/es/components/ContentSwitcher/ContentSwitcher.js +11 -23
- package/es/components/ContextMenu/useContextMenu.js +1 -6
- package/es/components/Copy/Copy.js +8 -31
- package/es/components/CopyButton/CopyButton.js +0 -4
- package/es/components/DangerButton/DangerButton.js +0 -1
- package/es/components/DataTable/DataTable.js +171 -91
- package/es/components/DataTable/Table.js +0 -6
- package/es/components/DataTable/TableBatchAction.js +0 -4
- package/es/components/DataTable/TableBatchActions.js +0 -8
- package/es/components/DataTable/TableBody.js +0 -1
- package/es/components/DataTable/TableContainer.js +0 -5
- package/es/components/DataTable/TableExpandHeader.js +0 -7
- package/es/components/DataTable/TableExpandRow.js +0 -6
- package/es/components/DataTable/TableExpandedRow.js +0 -6
- package/es/components/DataTable/TableHeader.d.ts +1 -1
- package/es/components/DataTable/TableHeader.js +3 -19
- package/es/components/DataTable/TableRow.js +4 -5
- package/es/components/DataTable/TableSelectAll.js +0 -8
- package/es/components/DataTable/TableSelectRow.js +2 -10
- package/es/components/DataTable/TableToolbar.js +0 -3
- package/es/components/DataTable/TableToolbarMenu.d.ts +1 -1
- package/es/components/DataTable/TableToolbarMenu.js +3 -6
- package/es/components/DataTable/TableToolbarSearch.js +2 -30
- package/es/components/DataTable/state/getDerivedStateFromProps.js +0 -4
- package/es/components/DataTable/state/sorting.js +5 -8
- package/es/components/DataTable/tools/denormalize.js +2 -2
- package/es/components/DataTable/tools/filter.js +0 -2
- package/es/components/DataTable/tools/instanceId.js +0 -1
- package/es/components/DataTable/tools/normalize.js +10 -10
- package/es/components/DataTable/tools/sorting.js +5 -13
- package/es/components/DataTableSkeleton/DataTableSkeleton.js +5 -20
- package/es/components/DatePicker/DatePicker.Skeleton.js +0 -6
- package/es/components/DatePicker/DatePicker.js +154 -177
- package/es/components/DatePicker/plugins/appendToPlugin.js +3 -7
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +14 -25
- package/es/components/DatePicker/plugins/rangePlugin.js +2 -7
- package/es/components/DatePickerInput/DatePickerInput.js +2 -28
- package/es/components/Dropdown/Dropdown.Skeleton.js +0 -2
- package/es/components/Dropdown/Dropdown.js +43 -52
- package/es/components/ErrorBoundary/ErrorBoundary.js +0 -10
- package/es/components/ErrorBoundary/ErrorBoundaryContext.js +0 -1
- package/es/components/ExpandableSearch/ExpandableSearch.js +1 -10
- package/es/components/FeatureFlags/index.js +8 -20
- package/es/components/FileUploader/FileUploader.Skeleton.js +0 -2
- package/es/components/FileUploader/FileUploader.js +3 -38
- package/es/components/FileUploader/FileUploaderButton.js +3 -24
- package/es/components/FileUploader/FileUploaderDropContainer.js +1 -28
- package/es/components/FileUploader/FileUploaderItem.js +1 -11
- package/es/components/FileUploader/Filename.js +0 -10
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +0 -1
- package/es/components/FluidComboBox/FluidComboBox.js +0 -18
- package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.js +0 -2
- package/es/components/FluidDatePicker/FluidDatePicker.js +0 -6
- package/es/components/FluidDatePickerInput/FluidDatePickerInput.js +2 -1
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +0 -1
- package/es/components/FluidDropdown/FluidDropdown.js +0 -18
- package/es/components/FluidForm/FluidForm.js +0 -2
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +0 -1
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +0 -19
- package/es/components/FluidSelect/FluidSelect.Skeleton.js +0 -1
- package/es/components/FluidSelect/FluidSelect.js +0 -10
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +0 -1
- package/es/components/FluidTextArea/FluidTextArea.js +0 -20
- package/es/components/FluidTextInput/FluidTextInput.Skeleton.js +0 -1
- package/es/components/FluidTextInput/FluidTextInput.js +0 -14
- package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.js +0 -3
- package/es/components/FluidTimePicker/FluidTimePicker.js +1 -11
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +0 -6
- package/es/components/Form/Form.d.ts +23 -0
- package/es/components/Form/Form.js +3 -6
- package/es/components/Form/index.d.ts +7 -0
- package/es/components/FormGroup/FormGroup.js +0 -7
- package/es/components/FormItem/FormItem.js +0 -2
- package/es/components/FormLabel/FormLabel.js +1 -7
- package/es/components/Grid/CSSGrid.js +2 -15
- package/es/components/Grid/Column.js +18 -59
- package/es/components/Grid/ColumnHang.js +2 -5
- package/es/components/Grid/FlexGrid.js +2 -8
- package/es/components/Grid/Grid.js +0 -8
- package/es/components/Grid/GridContext.js +1 -3
- package/es/components/Grid/Row.js +2 -7
- package/es/components/Heading/index.js +0 -4
- package/es/components/Icon/Icon.Skeleton.js +2 -2
- package/es/components/IconButton/index.js +0 -10
- package/es/components/IdPrefix/index.js +0 -2
- package/es/components/InlineCheckbox/InlineCheckbox.js +0 -14
- package/es/components/InlineLoading/InlineLoading.js +0 -12
- package/es/components/Layer/index.js +3 -6
- package/es/components/Layout/LayoutDirection.js +0 -3
- package/es/components/Layout/useLayoutDirection.js +0 -1
- package/es/components/Link/Link.js +3 -10
- package/es/components/ListBox/ListBox.js +2 -13
- package/es/components/ListBox/ListBoxField.js +0 -5
- package/es/components/ListBox/ListBoxMenuIcon.js +0 -4
- package/es/components/ListBox/ListBoxMenuItem.js +2 -6
- package/es/components/ListBox/ListBoxPropTypes.d.ts +2 -2
- package/es/components/ListBox/ListBoxSelection.js +1 -13
- package/es/components/ListBox/next/ListBoxSelection.js +1 -14
- package/es/components/ListBox/next/ListBoxTrigger.js +1 -3
- package/es/components/ListItem/ListItem.d.ts +23 -0
- package/es/components/ListItem/ListItem.js +4 -8
- package/es/components/ListItem/index.d.ts +7 -0
- package/es/components/Loading/Loading.js +0 -6
- package/es/components/Menu/Menu.js +22 -40
- package/es/components/Menu/MenuContext.js +4 -5
- package/es/components/Menu/MenuItem.js +5 -39
- package/es/components/MenuButton/index.js +0 -9
- package/es/components/Modal/Modal.js +0 -43
- package/es/components/ModalWrapper/ModalWrapper.js +2 -15
- package/es/components/MultiSelect/FilterableMultiSelect.js +2 -60
- package/es/components/MultiSelect/MultiSelect.js +22 -70
- package/es/components/MultiSelect/MultiSelectPropTypes.js +0 -1
- package/es/components/MultiSelect/index.js +0 -1
- package/es/components/MultiSelect/tools/itemToString.js +0 -2
- package/es/components/MultiSelect/tools/sorting.js +3 -4
- package/es/components/Notification/Notification.js +0 -78
- package/es/components/NumberInput/NumberInput.Skeleton.js +0 -2
- package/es/components/NumberInput/NumberInput.js +3 -60
- package/es/components/OrderedList/OrderedList.d.ts +39 -0
- package/es/components/OrderedList/OrderedList.js +7 -19
- package/es/components/{Form/index.js → OrderedList/index.d.ts} +1 -3
- package/es/components/OverflowMenu/OverflowMenu.js +65 -86
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +6 -23
- package/es/components/OverflowMenuV2/index.js +0 -5
- package/es/components/Pagination/Pagination.Skeleton.js +0 -2
- package/es/components/Pagination/Pagination.js +11 -47
- package/es/components/Pagination/experimental/PageSelector.js +0 -10
- package/es/components/Pagination/experimental/Pagination.js +2 -48
- package/es/components/PaginationNav/PaginationNav.js +15 -59
- package/es/components/Popover/index.d.ts +14 -8
- package/es/components/Popover/index.js +44 -48
- package/es/components/PrimaryButton/PrimaryButton.js +0 -1
- package/es/components/ProgressBar/ProgressBar.js +0 -15
- package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +0 -4
- package/es/components/ProgressIndicator/ProgressIndicator.js +2 -40
- package/es/components/RadioButton/RadioButton.Skeleton.js +0 -1
- package/es/components/RadioButton/RadioButton.js +0 -13
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +3 -23
- package/es/components/RadioTile/RadioTile.js +0 -12
- package/es/components/Search/Search.Skeleton.js +0 -2
- package/es/components/Search/Search.js +1 -28
- package/es/components/SecondaryButton/SecondaryButton.js +0 -1
- package/es/components/Select/Select.Skeleton.js +0 -2
- package/es/components/Select/Select.d.ts +1 -1
- package/es/components/Select/Select.js +6 -33
- package/es/components/SelectItem/SelectItem.js +0 -5
- package/es/components/SelectItemGroup/SelectItemGroup.d.ts +0 -1
- package/es/components/SelectItemGroup/SelectItemGroup.js +1 -7
- package/es/components/SkeletonIcon/SkeletonIcon.js +0 -2
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +0 -1
- package/es/components/SkeletonText/SkeletonText.js +0 -12
- package/es/components/Slider/Slider.Skeleton.js +0 -2
- package/es/components/Slider/Slider.d.ts +0 -1
- package/es/components/Slider/Slider.js +112 -135
- package/es/components/Stack/Stack.js +1 -8
- package/es/components/StructuredList/StructuredList.Skeleton.js +0 -5
- package/es/components/StructuredList/StructuredList.js +1 -25
- package/es/components/Switch/IconSwitch.js +0 -18
- package/es/components/Switch/Switch.js +0 -11
- package/es/components/TabContent/TabContent.js +2 -6
- package/es/components/Tabs/Tabs.Skeleton.js +0 -4
- package/es/components/Tabs/Tabs.js +135 -104
- package/es/components/Tabs/usePressable.js +18 -31
- package/es/components/Tag/Tag.Skeleton.js +0 -2
- package/es/components/Tag/Tag.js +0 -15
- package/es/components/Text/Text.js +5 -18
- package/es/components/Text/TextDirection.js +0 -3
- package/es/components/Text/TextDirectionContext.js +0 -1
- package/es/components/Text/createTextComponent.js +0 -3
- package/es/components/TextArea/TextArea.Skeleton.js +0 -2
- package/es/components/TextArea/TextArea.js +11 -33
- package/es/components/TextInput/ControlledPasswordInput.js +0 -20
- package/es/components/TextInput/PasswordInput.js +0 -25
- package/es/components/TextInput/TextInput.Skeleton.js +0 -2
- package/es/components/TextInput/TextInput.d.ts +1 -1
- package/es/components/TextInput/TextInput.js +5 -33
- package/es/components/TextInput/util.js +3 -5
- package/es/components/Theme/index.js +1 -6
- package/es/components/Tile/Tile.js +32 -59
- package/es/components/TileGroup/TileGroup.js +1 -22
- package/es/components/TimePicker/TimePicker.js +6 -32
- package/es/components/TimePickerSelect/TimePickerSelect.js +2 -5
- package/es/components/Toggle/Toggle.Skeleton.js +0 -8
- package/es/components/Toggle/Toggle.js +0 -16
- package/es/components/ToggleSmall/ToggleSmall.Skeleton.js +0 -7
- package/es/components/Toggletip/index.d.ts +148 -0
- package/es/components/Toggletip/index.js +20 -44
- package/es/components/Tooltip/DefinitionTooltip.js +0 -11
- package/es/components/Tooltip/Tooltip.d.ts +1 -1
- package/es/components/Tooltip/Tooltip.js +4 -21
- package/es/components/TreeView/TreeNode.js +21 -66
- package/es/components/TreeView/TreeView.js +11 -67
- package/es/components/UIShell/Content.js +2 -4
- package/es/components/UIShell/Header.js +0 -2
- package/es/components/UIShell/HeaderContainer.d.ts +33 -0
- package/es/components/UIShell/HeaderContainer.js +13 -11
- package/es/components/UIShell/HeaderGlobalAction.js +0 -6
- package/es/components/UIShell/HeaderGlobalBar.js +0 -1
- package/es/components/UIShell/HeaderMenu.js +32 -31
- package/es/components/UIShell/HeaderMenuButton.js +2 -4
- package/es/components/UIShell/HeaderMenuItem.js +0 -8
- package/es/components/UIShell/HeaderName.js +0 -5
- package/es/components/UIShell/HeaderNavigation.js +0 -2
- package/es/components/UIShell/HeaderPanel.js +0 -2
- package/es/components/UIShell/HeaderSideNavItems.js +0 -2
- package/es/components/UIShell/Link.js +2 -3
- package/es/components/UIShell/SideNav.d.ts +3 -1
- package/es/components/UIShell/SideNav.js +44 -36
- package/es/components/UIShell/SideNavDetails.js +0 -3
- package/es/components/UIShell/SideNavDivider.js +0 -1
- package/es/components/UIShell/SideNavFooter.js +1 -4
- package/es/components/UIShell/SideNavHeader.js +0 -4
- package/es/components/UIShell/SideNavIcon.js +0 -3
- package/es/components/UIShell/SideNavItem.js +0 -3
- package/es/components/UIShell/SideNavItems.js +2 -6
- package/es/components/UIShell/SideNavLink.js +3 -7
- package/es/components/UIShell/SideNavLinkText.js +0 -2
- package/es/components/UIShell/SideNavMenu.js +0 -16
- package/es/components/UIShell/SideNavMenuItem.js +0 -2
- package/es/components/UIShell/SideNavSwitcher.js +2 -5
- package/es/components/UIShell/SkipToContent.d.ts +32 -0
- package/es/components/UIShell/SkipToContent.js +8 -15
- package/es/components/UIShell/Switcher.js +0 -2
- package/es/components/UIShell/SwitcherDivider.js +0 -1
- package/es/components/UIShell/SwitcherItem.js +0 -3
- package/es/components/UnorderedList/UnorderedList.d.ts +34 -0
- package/es/components/UnorderedList/UnorderedList.js +6 -16
- package/es/components/UnorderedList/index.d.ts +7 -0
- package/es/index.js +7 -8
- package/es/internal/ClickListener.js +3 -13
- package/es/internal/FloatingMenu.js +57 -63
- package/es/internal/OptimizedResize.js +6 -12
- package/es/internal/Selection.js +2 -25
- package/es/internal/createClassWrapper.js +0 -2
- package/es/internal/deprecateFieldOnObject.js +0 -4
- package/es/internal/focus/index.js +0 -1
- package/es/internal/keyboard/keys.js +2 -1
- package/es/internal/keyboard/match.js +1 -6
- package/es/internal/keyboard/navigation.js +8 -7
- package/es/internal/useAnnouncer.js +0 -1
- package/es/internal/useAttachedMenu.js +1 -9
- package/es/internal/useControllableState.js +6 -13
- package/es/internal/useDelayedState.js +2 -4
- package/es/internal/useEffectOnce.js +0 -1
- package/es/internal/useEvent.js +61 -3
- package/es/internal/useId.js +2 -5
- package/es/internal/useIsomorphicEffect.js +1 -0
- package/es/internal/useMergedRefs.js +2 -2
- package/es/internal/useNoInteractiveChildren.js +2 -13
- package/es/internal/useNormalizedInputProps.js +0 -3
- package/es/internal/useSavedCallback.js +1 -2
- package/es/internal/warning.js +0 -3
- package/es/internal/wrapFocus.js +1 -8
- package/es/prop-types/deprecate.js +2 -5
- package/es/prop-types/isRequiredOneOf.js +2 -5
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +0 -2
- package/es/tools/array.js +0 -3
- package/es/tools/events.js +0 -3
- package/es/tools/mergeRefs.js +0 -2
- package/es/tools/wrapComponent.js +2 -5
- package/lib/_virtual/_rollupPluginBabelHelpers.js +17 -4
- package/lib/components/Accordion/Accordion.Skeleton.js +0 -7
- package/lib/components/Accordion/Accordion.js +1 -27
- package/lib/components/Accordion/AccordionItem.js +5 -19
- package/lib/components/AspectRatio/AspectRatio.js +0 -5
- package/lib/components/Breadcrumb/Breadcrumb.Skeleton.js +0 -3
- package/lib/components/Breadcrumb/Breadcrumb.js +0 -3
- package/lib/components/Breadcrumb/BreadcrumbItem.js +0 -7
- package/lib/components/Button/Button.Skeleton.js +2 -26
- package/lib/components/Button/Button.js +2 -36
- package/lib/components/ButtonSet/ButtonSet.js +0 -2
- package/lib/components/Checkbox/Checkbox.Skeleton.js +0 -1
- package/lib/components/Checkbox/Checkbox.js +4 -20
- package/lib/components/CheckboxGroup/CheckboxGroup.js +0 -11
- package/lib/components/ClassPrefix/index.d.ts +26 -0
- package/lib/components/ClassPrefix/index.js +0 -2
- package/lib/components/CodeSnippet/CodeSnippet.Skeleton.js +0 -5
- package/lib/components/CodeSnippet/CodeSnippet.js +6 -45
- package/lib/components/ComboBox/ComboBox.js +19 -86
- package/lib/components/ComboBox/tools/filter.js +0 -1
- package/lib/components/ComboButton/index.js +0 -14
- package/lib/components/ComposedModal/ComposedModal.js +2 -32
- package/lib/components/ComposedModal/ModalFooter.js +0 -21
- package/lib/components/ComposedModal/ModalHeader.js +0 -12
- package/lib/components/ContainedList/ContainedList.js +5 -32
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +0 -6
- package/lib/components/ContentSwitcher/ContentSwitcher.js +11 -23
- package/lib/components/ContextMenu/useContextMenu.js +1 -6
- package/lib/components/Copy/Copy.js +8 -50
- package/lib/components/CopyButton/CopyButton.js +0 -4
- package/lib/components/DangerButton/DangerButton.js +0 -1
- package/lib/components/DataTable/DataTable.js +171 -91
- package/lib/components/DataTable/Table.js +0 -6
- package/lib/components/DataTable/TableBatchAction.js +0 -4
- package/lib/components/DataTable/TableBatchActions.js +0 -8
- package/lib/components/DataTable/TableBody.js +0 -1
- package/lib/components/DataTable/TableContainer.js +0 -5
- package/lib/components/DataTable/TableExpandHeader.js +0 -7
- package/lib/components/DataTable/TableExpandRow.js +0 -6
- package/lib/components/DataTable/TableExpandedRow.js +0 -6
- package/lib/components/DataTable/TableHeader.d.ts +1 -1
- package/lib/components/DataTable/TableHeader.js +3 -19
- package/lib/components/DataTable/TableRow.js +4 -5
- package/lib/components/DataTable/TableSelectAll.js +0 -8
- package/lib/components/DataTable/TableSelectRow.js +2 -10
- package/lib/components/DataTable/TableToolbar.js +0 -3
- package/lib/components/DataTable/TableToolbarMenu.d.ts +1 -1
- package/lib/components/DataTable/TableToolbarMenu.js +3 -6
- package/lib/components/DataTable/TableToolbarSearch.js +2 -30
- package/lib/components/DataTable/state/getDerivedStateFromProps.js +0 -4
- package/lib/components/DataTable/state/sorting.js +5 -8
- package/lib/components/DataTable/tools/denormalize.js +2 -2
- package/lib/components/DataTable/tools/filter.js +0 -2
- package/lib/components/DataTable/tools/instanceId.js +0 -1
- package/lib/components/DataTable/tools/normalize.js +10 -10
- package/lib/components/DataTable/tools/sorting.js +5 -13
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +5 -20
- package/lib/components/DatePicker/DatePicker.Skeleton.js +0 -6
- package/lib/components/DatePicker/DatePicker.js +154 -177
- package/lib/components/DatePicker/plugins/appendToPlugin.js +3 -7
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +14 -25
- package/lib/components/DatePicker/plugins/rangePlugin.js +2 -7
- package/lib/components/DatePickerInput/DatePickerInput.js +2 -28
- package/lib/components/Dropdown/Dropdown.Skeleton.js +0 -2
- package/lib/components/Dropdown/Dropdown.js +50 -59
- package/lib/components/ErrorBoundary/ErrorBoundary.js +0 -10
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +0 -1
- package/lib/components/ExpandableSearch/ExpandableSearch.js +1 -10
- package/lib/components/FeatureFlags/index.js +8 -20
- package/lib/components/FileUploader/FileUploader.Skeleton.js +0 -2
- package/lib/components/FileUploader/FileUploader.js +3 -57
- package/lib/components/FileUploader/FileUploaderButton.js +3 -43
- package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -28
- package/lib/components/FileUploader/FileUploaderItem.js +1 -30
- package/lib/components/FileUploader/Filename.js +0 -10
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +0 -1
- package/lib/components/FluidComboBox/FluidComboBox.js +0 -18
- package/lib/components/FluidDatePicker/FluidDatePicker.Skeleton.js +0 -2
- package/lib/components/FluidDatePicker/FluidDatePicker.js +0 -6
- package/lib/components/FluidDatePickerInput/FluidDatePickerInput.js +2 -1
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +0 -1
- package/lib/components/FluidDropdown/FluidDropdown.js +0 -18
- package/lib/components/FluidForm/FluidForm.js +0 -2
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +0 -1
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +0 -19
- package/lib/components/FluidSelect/FluidSelect.Skeleton.js +0 -1
- package/lib/components/FluidSelect/FluidSelect.js +0 -10
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +0 -1
- package/lib/components/FluidTextArea/FluidTextArea.js +0 -20
- package/lib/components/FluidTextInput/FluidTextInput.Skeleton.js +0 -1
- package/lib/components/FluidTextInput/FluidTextInput.js +0 -14
- package/lib/components/FluidTimePicker/FluidTimePicker.Skeleton.js +0 -3
- package/lib/components/FluidTimePicker/FluidTimePicker.js +1 -11
- package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +0 -6
- package/lib/components/Form/Form.d.ts +23 -0
- package/lib/components/Form/Form.js +3 -6
- package/lib/components/Form/index.d.ts +7 -0
- package/lib/components/FormGroup/FormGroup.js +0 -7
- package/lib/components/FormItem/FormItem.js +0 -2
- package/lib/components/FormLabel/FormLabel.js +1 -26
- package/lib/components/Grid/CSSGrid.js +2 -15
- package/lib/components/Grid/Column.js +18 -59
- package/lib/components/Grid/ColumnHang.js +2 -5
- package/lib/components/Grid/FlexGrid.js +2 -8
- package/lib/components/Grid/Grid.js +0 -8
- package/lib/components/Grid/GridContext.js +1 -3
- package/lib/components/Grid/Row.js +2 -7
- package/lib/components/Heading/index.js +0 -4
- package/lib/components/Icon/Icon.Skeleton.js +2 -2
- package/lib/components/IconButton/index.js +0 -10
- package/lib/components/IdPrefix/index.js +0 -2
- package/lib/components/InlineCheckbox/InlineCheckbox.js +0 -14
- package/lib/components/InlineLoading/InlineLoading.js +0 -12
- package/lib/components/Layer/index.js +3 -6
- package/lib/components/Layout/LayoutDirection.js +0 -3
- package/lib/components/Layout/useLayoutDirection.js +0 -1
- package/lib/components/Link/Link.js +3 -10
- package/lib/components/ListBox/ListBox.js +2 -13
- package/lib/components/ListBox/ListBoxField.js +0 -5
- package/lib/components/ListBox/ListBoxMenuIcon.js +0 -4
- package/lib/components/ListBox/ListBoxMenuItem.js +2 -6
- package/lib/components/ListBox/ListBoxPropTypes.d.ts +2 -2
- package/lib/components/ListBox/ListBoxSelection.js +1 -13
- package/lib/components/ListBox/next/ListBoxSelection.js +1 -14
- package/lib/components/ListBox/next/ListBoxTrigger.js +1 -3
- package/lib/components/ListItem/ListItem.d.ts +23 -0
- package/lib/components/ListItem/ListItem.js +4 -8
- package/lib/components/ListItem/index.d.ts +7 -0
- package/lib/components/Loading/Loading.js +0 -6
- package/lib/components/Menu/Menu.js +22 -40
- package/lib/components/Menu/MenuContext.js +4 -5
- package/lib/components/Menu/MenuItem.js +5 -39
- package/lib/components/MenuButton/index.js +0 -9
- package/lib/components/Modal/Modal.js +0 -43
- package/lib/components/ModalWrapper/ModalWrapper.js +2 -15
- package/lib/components/MultiSelect/FilterableMultiSelect.js +8 -66
- package/lib/components/MultiSelect/MultiSelect.js +30 -78
- package/lib/components/MultiSelect/MultiSelectPropTypes.js +0 -1
- package/lib/components/MultiSelect/index.js +0 -1
- package/lib/components/MultiSelect/tools/itemToString.js +0 -2
- package/lib/components/MultiSelect/tools/sorting.js +3 -4
- package/lib/components/Notification/Notification.js +0 -78
- package/lib/components/NumberInput/NumberInput.Skeleton.js +0 -2
- package/lib/components/NumberInput/NumberInput.js +3 -60
- package/lib/components/OrderedList/OrderedList.d.ts +39 -0
- package/lib/components/OrderedList/OrderedList.js +7 -19
- package/lib/components/OrderedList/index.d.ts +7 -0
- package/lib/components/OverflowMenu/OverflowMenu.js +65 -86
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +6 -23
- package/lib/components/OverflowMenuV2/index.js +0 -5
- package/lib/components/Pagination/Pagination.Skeleton.js +0 -2
- package/lib/components/Pagination/Pagination.js +11 -47
- package/lib/components/Pagination/experimental/PageSelector.js +0 -10
- package/lib/components/Pagination/experimental/Pagination.js +2 -67
- package/lib/components/PaginationNav/PaginationNav.js +15 -78
- package/lib/components/Popover/index.d.ts +14 -8
- package/lib/components/Popover/index.js +44 -48
- package/lib/components/PrimaryButton/PrimaryButton.js +0 -1
- package/lib/components/ProgressBar/ProgressBar.js +0 -15
- package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +0 -4
- package/lib/components/ProgressIndicator/ProgressIndicator.js +2 -40
- package/lib/components/RadioButton/RadioButton.Skeleton.js +0 -1
- package/lib/components/RadioButton/RadioButton.js +0 -13
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +3 -23
- package/lib/components/RadioTile/RadioTile.js +0 -12
- package/lib/components/Search/Search.Skeleton.js +0 -2
- package/lib/components/Search/Search.js +1 -28
- package/lib/components/SecondaryButton/SecondaryButton.js +0 -1
- package/lib/components/Select/Select.Skeleton.js +0 -2
- package/lib/components/Select/Select.d.ts +1 -1
- package/lib/components/Select/Select.js +6 -33
- package/lib/components/SelectItem/SelectItem.js +0 -5
- package/lib/components/SelectItemGroup/SelectItemGroup.d.ts +0 -1
- package/lib/components/SelectItemGroup/SelectItemGroup.js +1 -26
- package/lib/components/SkeletonIcon/SkeletonIcon.js +0 -2
- package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +0 -1
- package/lib/components/SkeletonText/SkeletonText.js +0 -12
- package/lib/components/Slider/Slider.Skeleton.js +0 -2
- package/lib/components/Slider/Slider.d.ts +0 -1
- package/lib/components/Slider/Slider.js +112 -154
- package/lib/components/Stack/Stack.js +1 -8
- package/lib/components/StructuredList/StructuredList.Skeleton.js +0 -5
- package/lib/components/StructuredList/StructuredList.js +1 -25
- package/lib/components/Switch/IconSwitch.js +0 -18
- package/lib/components/Switch/Switch.js +0 -11
- package/lib/components/TabContent/TabContent.js +2 -6
- package/lib/components/Tabs/Tabs.Skeleton.js +0 -4
- package/lib/components/Tabs/Tabs.js +133 -102
- package/lib/components/Tabs/usePressable.js +18 -31
- package/lib/components/Tag/Tag.Skeleton.js +0 -2
- package/lib/components/Tag/Tag.js +0 -15
- package/lib/components/Text/Text.js +5 -18
- package/lib/components/Text/TextDirection.js +0 -3
- package/lib/components/Text/TextDirectionContext.js +0 -1
- package/lib/components/Text/createTextComponent.js +0 -3
- package/lib/components/TextArea/TextArea.Skeleton.js +0 -2
- package/lib/components/TextArea/TextArea.js +10 -32
- package/lib/components/TextInput/ControlledPasswordInput.js +0 -20
- package/lib/components/TextInput/PasswordInput.js +0 -25
- package/lib/components/TextInput/TextInput.Skeleton.js +0 -2
- package/lib/components/TextInput/TextInput.d.ts +1 -1
- package/lib/components/TextInput/TextInput.js +5 -52
- package/lib/components/TextInput/util.js +3 -5
- package/lib/components/Theme/index.js +1 -6
- package/lib/components/Tile/Tile.js +31 -58
- package/lib/components/TileGroup/TileGroup.js +1 -22
- package/lib/components/TimePicker/TimePicker.js +6 -32
- package/lib/components/TimePickerSelect/TimePickerSelect.js +2 -5
- package/lib/components/Toggle/Toggle.Skeleton.js +0 -8
- package/lib/components/Toggle/Toggle.js +0 -16
- package/lib/components/ToggleSmall/ToggleSmall.Skeleton.js +0 -7
- package/lib/components/Toggletip/index.d.ts +148 -0
- package/lib/components/Toggletip/index.js +20 -44
- package/lib/components/Tooltip/DefinitionTooltip.js +0 -11
- package/lib/components/Tooltip/Tooltip.d.ts +1 -1
- package/lib/components/Tooltip/Tooltip.js +4 -21
- package/lib/components/TreeView/TreeNode.js +21 -66
- package/lib/components/TreeView/TreeView.js +11 -67
- package/lib/components/UIShell/Content.js +2 -4
- package/lib/components/UIShell/Header.js +0 -2
- package/lib/components/UIShell/HeaderContainer.d.ts +33 -0
- package/lib/components/UIShell/HeaderContainer.js +13 -11
- package/lib/components/UIShell/HeaderGlobalAction.js +0 -6
- package/lib/components/UIShell/HeaderGlobalBar.js +0 -1
- package/lib/components/UIShell/HeaderMenu.js +32 -31
- package/lib/components/UIShell/HeaderMenuButton.js +2 -4
- package/lib/components/UIShell/HeaderMenuItem.js +0 -8
- package/lib/components/UIShell/HeaderName.js +0 -5
- package/lib/components/UIShell/HeaderNavigation.js +0 -2
- package/lib/components/UIShell/HeaderPanel.js +0 -2
- package/lib/components/UIShell/HeaderSideNavItems.js +0 -2
- package/lib/components/UIShell/Link.js +2 -3
- package/lib/components/UIShell/SideNav.d.ts +3 -1
- package/lib/components/UIShell/SideNav.js +43 -35
- package/lib/components/UIShell/SideNavDetails.js +0 -3
- package/lib/components/UIShell/SideNavDivider.js +0 -1
- package/lib/components/UIShell/SideNavFooter.js +1 -4
- package/lib/components/UIShell/SideNavHeader.js +0 -4
- package/lib/components/UIShell/SideNavIcon.js +0 -3
- package/lib/components/UIShell/SideNavItem.js +0 -3
- package/lib/components/UIShell/SideNavItems.js +2 -6
- package/lib/components/UIShell/SideNavLink.js +3 -7
- package/lib/components/UIShell/SideNavLinkText.js +0 -2
- package/lib/components/UIShell/SideNavMenu.js +0 -16
- package/lib/components/UIShell/SideNavMenuItem.js +0 -2
- package/lib/components/UIShell/SideNavSwitcher.js +2 -5
- package/lib/components/UIShell/SkipToContent.d.ts +32 -0
- package/lib/components/UIShell/SkipToContent.js +8 -15
- package/lib/components/UIShell/Switcher.js +0 -2
- package/lib/components/UIShell/SwitcherDivider.js +0 -1
- package/lib/components/UIShell/SwitcherItem.js +0 -3
- package/lib/components/UnorderedList/UnorderedList.d.ts +34 -0
- package/lib/components/UnorderedList/UnorderedList.js +6 -16
- package/lib/components/UnorderedList/index.d.ts +7 -0
- package/lib/index.js +42 -43
- package/lib/internal/ClickListener.js +3 -13
- package/lib/internal/FloatingMenu.js +57 -63
- package/lib/internal/OptimizedResize.js +6 -12
- package/lib/internal/Selection.js +2 -25
- package/lib/internal/createClassWrapper.js +0 -2
- package/lib/internal/deprecateFieldOnObject.js +0 -4
- package/lib/internal/focus/index.js +0 -1
- package/lib/internal/keyboard/keys.js +2 -1
- package/lib/internal/keyboard/match.js +1 -6
- package/lib/internal/keyboard/navigation.js +8 -7
- package/lib/internal/useAnnouncer.js +0 -1
- package/lib/internal/useAttachedMenu.js +1 -9
- package/lib/internal/useControllableState.js +6 -13
- package/lib/internal/useDelayedState.js +2 -4
- package/lib/internal/useEffectOnce.js +0 -1
- package/lib/internal/useEvent.js +61 -2
- package/lib/internal/useId.js +2 -5
- package/lib/internal/useIsomorphicEffect.js +1 -0
- package/lib/internal/useMergedRefs.js +2 -2
- package/lib/internal/useNoInteractiveChildren.js +2 -13
- package/lib/internal/useNormalizedInputProps.js +0 -3
- package/lib/internal/useSavedCallback.js +1 -2
- package/lib/internal/warning.js +0 -3
- package/lib/internal/wrapFocus.js +1 -8
- package/lib/prop-types/deprecate.js +2 -5
- package/lib/prop-types/isRequiredOneOf.js +2 -5
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +0 -2
- package/lib/tools/array.js +0 -3
- package/lib/tools/events.js +0 -3
- package/lib/tools/mergeRefs.js +0 -2
- package/lib/tools/wrapComponent.js +2 -5
- package/package.json +9 -9
- package/es/components/Tab/Tab.js +0 -185
- package/es/components/Tab/index.js +0 -14
- package/es/components/TimePickerSelect/index.js +0 -13
- package/lib/components/Form/index.js +0 -17
- package/lib/components/Tab/Tab.js +0 -214
- package/lib/components/Tab/index.js +0 -39
- package/lib/components/TimePickerSelect/index.js +0 -38
|
@@ -14,7 +14,6 @@ var React = require('react');
|
|
|
14
14
|
var PropTypes = require('prop-types');
|
|
15
15
|
var cx = require('classnames');
|
|
16
16
|
var throttle = require('lodash.throttle');
|
|
17
|
-
var FeatureFlags = require('@carbon/feature-flags');
|
|
18
17
|
var keys = require('../../internal/keyboard/keys.js');
|
|
19
18
|
var match = require('../../internal/keyboard/match.js');
|
|
20
19
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
@@ -24,127 +23,91 @@ var iconsReact = require('@carbon/icons-react');
|
|
|
24
23
|
|
|
25
24
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
26
25
|
|
|
27
|
-
function _interopNamespace(e) {
|
|
28
|
-
if (e && e.__esModule) return e;
|
|
29
|
-
var n = Object.create(null);
|
|
30
|
-
if (e) {
|
|
31
|
-
Object.keys(e).forEach(function (k) {
|
|
32
|
-
if (k !== 'default') {
|
|
33
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
34
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
35
|
-
enumerable: true,
|
|
36
|
-
get: function () { return e[k]; }
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
n["default"] = e;
|
|
42
|
-
return Object.freeze(n);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
26
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
46
27
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
47
28
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
48
29
|
var throttle__default = /*#__PURE__*/_interopDefaultLegacy(throttle);
|
|
49
|
-
var FeatureFlags__namespace = /*#__PURE__*/_interopNamespace(FeatureFlags);
|
|
50
30
|
|
|
51
31
|
const defaultFormatLabel = (value, label) => {
|
|
52
32
|
return typeof label === 'function' ? label(value) : `${value}${label}`;
|
|
53
33
|
};
|
|
34
|
+
|
|
54
35
|
/**
|
|
55
36
|
* Minimum time between processed "drag" events.
|
|
56
37
|
*/
|
|
57
|
-
|
|
58
|
-
|
|
59
38
|
const EVENT_THROTTLE = 16; // ms
|
|
60
39
|
|
|
61
40
|
/**
|
|
62
41
|
* Event types that trigger "drags".
|
|
63
42
|
*/
|
|
64
|
-
|
|
65
43
|
const DRAG_EVENT_TYPES = new Set(['mousemove', 'touchmove']);
|
|
44
|
+
|
|
66
45
|
/**
|
|
67
46
|
* Event types that trigger a "drag" to stop.
|
|
68
47
|
*/
|
|
69
|
-
|
|
70
48
|
const DRAG_STOP_EVENT_TYPES = new Set(['mouseup', 'touchend', 'touchcancel']);
|
|
71
49
|
class Slider extends React.PureComponent {
|
|
72
50
|
constructor(props) {
|
|
73
51
|
super(props);
|
|
74
|
-
|
|
75
52
|
_rollupPluginBabelHelpers.defineProperty(this, "state", {
|
|
76
53
|
value: this.props.value,
|
|
77
54
|
left: 0,
|
|
78
55
|
needsOnRelease: false,
|
|
79
56
|
isValid: true
|
|
80
57
|
});
|
|
81
|
-
|
|
82
58
|
_rollupPluginBabelHelpers.defineProperty(this, "thumbRef", void 0);
|
|
83
|
-
|
|
84
59
|
_rollupPluginBabelHelpers.defineProperty(this, "filledTrackRef", void 0);
|
|
85
|
-
|
|
86
60
|
_rollupPluginBabelHelpers.defineProperty(this, "element", null);
|
|
87
|
-
|
|
88
61
|
_rollupPluginBabelHelpers.defineProperty(this, "inputId", '');
|
|
89
|
-
|
|
90
62
|
_rollupPluginBabelHelpers.defineProperty(this, "track", void 0);
|
|
91
|
-
|
|
92
63
|
_rollupPluginBabelHelpers.defineProperty(this, "onDragStart", evt => {
|
|
93
64
|
// Do nothing if component is disabled
|
|
94
65
|
if (this.props.disabled || this.props.readOnly) {
|
|
95
66
|
return;
|
|
96
|
-
}
|
|
97
|
-
|
|
67
|
+
}
|
|
98
68
|
|
|
69
|
+
// Register drag stop handlers
|
|
99
70
|
DRAG_STOP_EVENT_TYPES.forEach(element => {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
(_this$element = this.element) === null || _this$element === void 0 ? void 0 : _this$element.ownerDocument.addEventListener(element, this.onDragStop);
|
|
103
|
-
}); // Register drag handlers
|
|
71
|
+
this.element?.ownerDocument.addEventListener(element, this.onDragStop);
|
|
72
|
+
});
|
|
104
73
|
|
|
74
|
+
// Register drag handlers
|
|
105
75
|
DRAG_EVENT_TYPES.forEach(element => {
|
|
106
|
-
|
|
76
|
+
this.element?.ownerDocument.addEventListener(element, this.onDrag);
|
|
77
|
+
});
|
|
107
78
|
|
|
108
|
-
|
|
109
|
-
}); // Perform first recalculation since we probably didn't click exactly in the
|
|
79
|
+
// Perform first recalculation since we probably didn't click exactly in the
|
|
110
80
|
// middle of the thumb
|
|
111
|
-
|
|
112
81
|
this.onDrag(evt);
|
|
113
82
|
});
|
|
114
|
-
|
|
115
83
|
_rollupPluginBabelHelpers.defineProperty(this, "onDragStop", () => {
|
|
116
84
|
// Do nothing if component is disabled
|
|
117
85
|
if (this.props.disabled || this.props.readOnly) {
|
|
118
86
|
return;
|
|
119
|
-
}
|
|
120
|
-
|
|
87
|
+
}
|
|
121
88
|
|
|
89
|
+
// Remove drag stop handlers
|
|
122
90
|
DRAG_STOP_EVENT_TYPES.forEach(element => {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
(_this$element3 = this.element) === null || _this$element3 === void 0 ? void 0 : _this$element3.ownerDocument.removeEventListener(element, this.onDragStop);
|
|
126
|
-
}); // Remove drag handlers
|
|
91
|
+
this.element?.ownerDocument.removeEventListener(element, this.onDragStop);
|
|
92
|
+
});
|
|
127
93
|
|
|
94
|
+
// Remove drag handlers
|
|
128
95
|
DRAG_EVENT_TYPES.forEach(element => {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
(_this$element4 = this.element) === null || _this$element4 === void 0 ? void 0 : _this$element4.ownerDocument.removeEventListener(element, this.onDrag);
|
|
132
|
-
}); // Set needsOnRelease flag so event fires on next update
|
|
96
|
+
this.element?.ownerDocument.removeEventListener(element, this.onDrag);
|
|
97
|
+
});
|
|
133
98
|
|
|
99
|
+
// Set needsOnRelease flag so event fires on next update
|
|
134
100
|
this.setState({
|
|
135
101
|
needsOnRelease: true,
|
|
136
102
|
isValid: true
|
|
137
103
|
});
|
|
138
104
|
});
|
|
139
|
-
|
|
140
105
|
_rollupPluginBabelHelpers.defineProperty(this, "_onDrag", evt => {
|
|
141
106
|
// Do nothing if component is disabled or we have no event
|
|
142
107
|
if (this.props.disabled || this.props.readOnly || !evt) {
|
|
143
108
|
return;
|
|
144
109
|
}
|
|
145
|
-
|
|
146
110
|
let clientX;
|
|
147
|
-
|
|
148
111
|
if ('clientX' in evt) {
|
|
149
112
|
clientX = evt.clientX;
|
|
150
113
|
} else if ('touches' in evt && 0 in evt.touches && 'clientX' in evt.touches[0]) {
|
|
@@ -153,7 +116,6 @@ class Slider extends React.PureComponent {
|
|
|
153
116
|
// Do nothing if we have no valid clientX
|
|
154
117
|
return;
|
|
155
118
|
}
|
|
156
|
-
|
|
157
119
|
const {
|
|
158
120
|
value,
|
|
159
121
|
left
|
|
@@ -166,20 +128,16 @@ class Slider extends React.PureComponent {
|
|
|
166
128
|
isValid: true
|
|
167
129
|
});
|
|
168
130
|
});
|
|
169
|
-
|
|
170
131
|
_rollupPluginBabelHelpers.defineProperty(this, "onDrag", throttle__default["default"](this._onDrag, EVENT_THROTTLE, {
|
|
171
132
|
leading: true,
|
|
172
133
|
trailing: false
|
|
173
134
|
}));
|
|
174
|
-
|
|
175
135
|
_rollupPluginBabelHelpers.defineProperty(this, "onKeyDown", evt => {
|
|
176
136
|
// Do nothing if component is disabled or we don't have a valid event
|
|
177
137
|
if (this.props.disabled || this.props.readOnly || !('which' in evt)) {
|
|
178
138
|
return;
|
|
179
139
|
}
|
|
180
|
-
|
|
181
140
|
let delta = 0;
|
|
182
|
-
|
|
183
141
|
if (match.matches(evt.which, [keys.ArrowDown, keys.ArrowLeft])) {
|
|
184
142
|
delta = -(this.props.step ?? Slider.defaultProps.step);
|
|
185
143
|
} else if (match.matches(evt.which, [keys.ArrowUp, keys.ArrowRight])) {
|
|
@@ -187,14 +145,13 @@ class Slider extends React.PureComponent {
|
|
|
187
145
|
} else {
|
|
188
146
|
// Ignore keys we don't want to handle
|
|
189
147
|
return;
|
|
190
|
-
}
|
|
191
|
-
|
|
148
|
+
}
|
|
192
149
|
|
|
150
|
+
// If shift was held, account for the stepMultiplier
|
|
193
151
|
if (evt.shiftKey) {
|
|
194
152
|
const stepMultiplier = this.props.stepMultiplier;
|
|
195
153
|
delta *= stepMultiplier ?? Slider.defaultProps.stepMultiplier;
|
|
196
154
|
}
|
|
197
|
-
|
|
198
155
|
Math.floor(this.state.value / (this.props.step ?? Slider.defaultProps.step)) * (this.props.step ?? Slider.defaultProps.step);
|
|
199
156
|
const {
|
|
200
157
|
value,
|
|
@@ -210,20 +167,19 @@ class Slider extends React.PureComponent {
|
|
|
210
167
|
isValid: true
|
|
211
168
|
});
|
|
212
169
|
});
|
|
213
|
-
|
|
214
170
|
_rollupPluginBabelHelpers.defineProperty(this, "onChange", evt => {
|
|
215
171
|
// Do nothing if component is disabled
|
|
216
172
|
if (this.props.disabled || this.props.readOnly) {
|
|
217
173
|
return;
|
|
218
|
-
}
|
|
219
|
-
|
|
174
|
+
}
|
|
220
175
|
|
|
176
|
+
// Do nothing if we have no valid event, target, or value
|
|
221
177
|
if (!evt || !('target' in evt) || typeof evt.target.value !== 'string') {
|
|
222
178
|
return;
|
|
223
179
|
}
|
|
180
|
+
const targetValue = Number.parseFloat(evt.target.value);
|
|
224
181
|
|
|
225
|
-
|
|
226
|
-
|
|
182
|
+
// Avoid calling calcValue for invalid numbers, but still update the state
|
|
227
183
|
if (isNaN(targetValue)) {
|
|
228
184
|
this.setState({
|
|
229
185
|
value: evt.target.value
|
|
@@ -242,16 +198,13 @@ class Slider extends React.PureComponent {
|
|
|
242
198
|
});
|
|
243
199
|
}
|
|
244
200
|
});
|
|
245
|
-
|
|
246
201
|
_rollupPluginBabelHelpers.defineProperty(this, "onBlur", evt => {
|
|
247
|
-
var _this$props$onBlur, _this$props;
|
|
248
|
-
|
|
249
202
|
// Do nothing if we have no valid event, target, or value
|
|
250
203
|
if (!evt || !('target' in evt) || typeof evt.target.value !== 'string') {
|
|
251
204
|
return;
|
|
252
|
-
}
|
|
253
|
-
|
|
205
|
+
}
|
|
254
206
|
|
|
207
|
+
// determine validity of input change after clicking out of input
|
|
255
208
|
const validity = evt.target.checkValidity();
|
|
256
209
|
const {
|
|
257
210
|
value
|
|
@@ -259,44 +212,39 @@ class Slider extends React.PureComponent {
|
|
|
259
212
|
this.setState({
|
|
260
213
|
isValid: validity
|
|
261
214
|
});
|
|
262
|
-
|
|
215
|
+
this.props.onBlur?.({
|
|
263
216
|
value
|
|
264
217
|
});
|
|
265
218
|
});
|
|
266
|
-
|
|
267
219
|
_rollupPluginBabelHelpers.defineProperty(this, "calcValue", _ref => {
|
|
268
|
-
var _this$element5, _this$element5$getBou;
|
|
269
|
-
|
|
270
220
|
let {
|
|
271
221
|
clientX,
|
|
272
222
|
value,
|
|
273
223
|
useRawValue = false
|
|
274
224
|
} = _ref;
|
|
275
225
|
const range = this.props.max - this.props.min;
|
|
276
|
-
const boundingRect =
|
|
226
|
+
const boundingRect = this.element?.getBoundingClientRect?.();
|
|
277
227
|
const totalSteps = range / (this.props.step ?? Slider.defaultProps.step);
|
|
278
|
-
let width = boundingRect ? boundingRect.right - boundingRect.left : 0;
|
|
228
|
+
let width = boundingRect ? boundingRect.right - boundingRect.left : 0;
|
|
279
229
|
|
|
230
|
+
// Enforce a minimum width of at least 1 for calculations
|
|
280
231
|
if (width <= 0) {
|
|
281
232
|
width = 1;
|
|
282
|
-
}
|
|
283
|
-
// use the provided value or state's value to calculate it instead.
|
|
284
|
-
|
|
233
|
+
}
|
|
285
234
|
|
|
235
|
+
// If a clientX is specified, use it to calculate the leftPercent. If not,
|
|
236
|
+
// use the provided value or state's value to calculate it instead.
|
|
286
237
|
let leftPercent;
|
|
287
|
-
|
|
288
238
|
if (clientX != null) {
|
|
289
|
-
const leftOffset = clientX - (
|
|
239
|
+
const leftOffset = clientX - (boundingRect?.left ?? 0);
|
|
290
240
|
leftPercent = leftOffset / width;
|
|
291
241
|
} else {
|
|
292
242
|
if (value == null) {
|
|
293
243
|
value = this.state.value;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
|
|
244
|
+
}
|
|
245
|
+
// prevent NaN calculation if the range is 0
|
|
297
246
|
leftPercent = range === 0 ? 0 : (value - this.props.min) / range;
|
|
298
247
|
}
|
|
299
|
-
|
|
300
248
|
if (useRawValue) {
|
|
301
249
|
// Adjusts only for min/max of thumb position
|
|
302
250
|
return {
|
|
@@ -304,7 +252,6 @@ class Slider extends React.PureComponent {
|
|
|
304
252
|
left: Math.min(1, Math.max(0, leftPercent)) * 100
|
|
305
253
|
};
|
|
306
254
|
}
|
|
307
|
-
|
|
308
255
|
let steppedValue = Math.round(leftPercent * totalSteps) * (this.props.step ?? Slider.defaultProps.step);
|
|
309
256
|
const steppedPercent = this.clamp(steppedValue / range, 0, 1);
|
|
310
257
|
steppedValue = this.clamp(steppedValue + this.props.min, this.props.min, this.props.max);
|
|
@@ -313,15 +260,13 @@ class Slider extends React.PureComponent {
|
|
|
313
260
|
left: steppedPercent * 100
|
|
314
261
|
};
|
|
315
262
|
});
|
|
316
|
-
|
|
317
263
|
this.thumbRef = /*#__PURE__*/React__default["default"].createRef();
|
|
318
264
|
this.filledTrackRef = /*#__PURE__*/React__default["default"].createRef();
|
|
319
265
|
}
|
|
266
|
+
|
|
320
267
|
/**
|
|
321
268
|
* Sets up initial slider position and value in response to component mount.
|
|
322
269
|
*/
|
|
323
|
-
|
|
324
|
-
|
|
325
270
|
componentDidMount() {
|
|
326
271
|
if (this.element) {
|
|
327
272
|
const {
|
|
@@ -336,6 +281,7 @@ class Slider extends React.PureComponent {
|
|
|
336
281
|
});
|
|
337
282
|
}
|
|
338
283
|
}
|
|
284
|
+
|
|
339
285
|
/**
|
|
340
286
|
* Handles firing of `onChange` and `onRelease` callbacks to parent in
|
|
341
287
|
* response to state changes.
|
|
@@ -344,47 +290,44 @@ class Slider extends React.PureComponent {
|
|
|
344
290
|
* @param {*} prevState The previous Slider state, used to see if callbacks
|
|
345
291
|
* should be called.
|
|
346
292
|
*/
|
|
347
|
-
|
|
348
|
-
|
|
349
293
|
componentDidUpdate(prevProps, prevState) {
|
|
350
294
|
// Fire onChange event handler if present, if there's a usable value, and
|
|
351
295
|
// if the value is different from the last one
|
|
296
|
+
|
|
352
297
|
if (this.thumbRef.current) {
|
|
353
298
|
this.thumbRef.current.style.left = `${this.state.left}%`;
|
|
354
299
|
}
|
|
355
|
-
|
|
356
300
|
if (this.filledTrackRef.current) {
|
|
357
301
|
this.filledTrackRef.current.style.transform = `translate(0%, -50%) scaleX(${this.state.left / 100})`;
|
|
358
302
|
}
|
|
359
|
-
|
|
360
303
|
if (prevState.value !== this.state.value && typeof this.props.onChange === 'function') {
|
|
361
304
|
this.props.onChange({
|
|
362
305
|
value: this.state.value
|
|
363
306
|
});
|
|
364
|
-
}
|
|
365
|
-
|
|
307
|
+
}
|
|
366
308
|
|
|
309
|
+
// Fire onRelease event handler if present and if needed
|
|
367
310
|
if (this.state.needsOnRelease && typeof this.props.onRelease === 'function') {
|
|
368
311
|
this.props.onRelease({
|
|
369
312
|
value: this.state.value
|
|
370
|
-
});
|
|
371
|
-
|
|
313
|
+
});
|
|
314
|
+
// Reset the flag
|
|
372
315
|
this.setState({
|
|
373
316
|
needsOnRelease: false
|
|
374
317
|
});
|
|
375
|
-
}
|
|
376
|
-
// Otherwise, do prop -> state sync without "value capping".
|
|
377
|
-
|
|
318
|
+
}
|
|
378
319
|
|
|
320
|
+
// If value from props does not change, do nothing here.
|
|
321
|
+
// Otherwise, do prop -> state sync without "value capping".
|
|
379
322
|
if (prevProps.value === this.props.value && prevProps.max === this.props.max && prevProps.min === this.props.min) {
|
|
380
323
|
return;
|
|
381
324
|
}
|
|
382
|
-
|
|
383
325
|
this.setState(this.calcValue({
|
|
384
326
|
value: this.props.value,
|
|
385
327
|
useRawValue: true
|
|
386
328
|
}));
|
|
387
329
|
}
|
|
330
|
+
|
|
388
331
|
/**
|
|
389
332
|
* Synonymous to ECMA2017+ `Math.clamp`.
|
|
390
333
|
*
|
|
@@ -394,11 +337,10 @@ class Slider extends React.PureComponent {
|
|
|
394
337
|
*
|
|
395
338
|
* @returns `val` if `max>=val>=min`; `min` if `val<min`; `max` if `val>max`.
|
|
396
339
|
*/
|
|
397
|
-
|
|
398
|
-
|
|
399
340
|
clamp(val, min, max) {
|
|
400
341
|
return Math.max(min, Math.min(val, max));
|
|
401
342
|
}
|
|
343
|
+
|
|
402
344
|
/**
|
|
403
345
|
* Sets up "drag" event handlers and calls `this.onDrag` in case dragging
|
|
404
346
|
* started on somewhere other than the thumb without a corresponding "move"
|
|
@@ -407,29 +349,84 @@ class Slider extends React.PureComponent {
|
|
|
407
349
|
* @param {Event} evt The event.
|
|
408
350
|
*/
|
|
409
351
|
|
|
352
|
+
/**
|
|
353
|
+
* Unregisters "drag" and "drag stop" event handlers and calls sets the flag
|
|
354
|
+
* indicating that the `onRelease` callback should be called.
|
|
355
|
+
*/
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Handles a "drag" event by recalculating the value/thumb and setting state
|
|
359
|
+
* accordingly.
|
|
360
|
+
*
|
|
361
|
+
* @param {Event} evt The event.
|
|
362
|
+
*/
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Throttles calls to `this._onDrag` by limiting events to being processed at
|
|
366
|
+
* most once every `EVENT_THROTTLE` milliseconds.
|
|
367
|
+
*/
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Handles a `keydown` event by recalculating the value/thumb and setting
|
|
371
|
+
* state accordingly.
|
|
372
|
+
*
|
|
373
|
+
* @param {Event} evt The event.
|
|
374
|
+
*/
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Provides the two-way binding for the input field of the Slider. It also
|
|
378
|
+
* Handles a change to the input field by recalculating the value/thumb and
|
|
379
|
+
* setting state accordingly.
|
|
380
|
+
*
|
|
381
|
+
* @param {Event} evt The event.
|
|
382
|
+
*/
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Checks for validity of input value after clicking out of the input. It also
|
|
386
|
+
* Handles state change to isValid state.
|
|
387
|
+
*
|
|
388
|
+
* @param {Event} evt The event.
|
|
389
|
+
*/
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Calculates a new Slider `value` and `left` (thumb offset) given a `clientX`,
|
|
393
|
+
* `value`, or neither of those.
|
|
394
|
+
* - If `clientX` is specified, it will be used in
|
|
395
|
+
* conjunction with the Slider's bounding rectangle to calculate the new
|
|
396
|
+
* values.
|
|
397
|
+
* - If `clientX` is not specified and `value` is, it will be used to
|
|
398
|
+
* calculate new values as though it were the current value of the Slider.
|
|
399
|
+
* - If neither `clientX` nor `value` are specified, `this.props.value` will
|
|
400
|
+
* be used to calculate the new values as though it were the current value
|
|
401
|
+
* of the Slider.
|
|
402
|
+
*
|
|
403
|
+
* @param {object} params
|
|
404
|
+
* @param {number} [params.clientX] Optional clientX value expected to be from
|
|
405
|
+
* an event fired by one of the Slider's `DRAG_EVENT_TYPES` events.
|
|
406
|
+
* @param {number} [params.value] Optional value use during calculations if
|
|
407
|
+
* clientX is not provided.
|
|
408
|
+
* @param {boolean} [params.useRawValue=false] `true` to use the given value as-is.
|
|
409
|
+
*/
|
|
410
410
|
|
|
411
411
|
// syncs invalid state and prop
|
|
412
412
|
static getDerivedStateFromProps(props, state) {
|
|
413
413
|
const {
|
|
414
414
|
isValid
|
|
415
|
-
} = state;
|
|
416
|
-
|
|
415
|
+
} = state;
|
|
416
|
+
// will override state in favor of invalid prop
|
|
417
417
|
if (props.invalid === true && isValid === true) {
|
|
418
418
|
return {
|
|
419
419
|
isValid: false
|
|
420
420
|
};
|
|
421
421
|
}
|
|
422
|
-
|
|
423
422
|
if (props.invalid === false && isValid === false) {
|
|
424
423
|
return {
|
|
425
424
|
isValid: true
|
|
426
425
|
};
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
|
|
426
|
+
}
|
|
427
|
+
//if invalid prop is not provided, state will remain the same
|
|
430
428
|
return null;
|
|
431
429
|
}
|
|
432
|
-
|
|
433
430
|
render() {
|
|
434
431
|
const {
|
|
435
432
|
ariaLabelInput,
|
|
@@ -461,13 +458,6 @@ class Slider extends React.PureComponent {
|
|
|
461
458
|
value,
|
|
462
459
|
isValid
|
|
463
460
|
} = this.state;
|
|
464
|
-
const scope = this.context;
|
|
465
|
-
let enabled;
|
|
466
|
-
|
|
467
|
-
if (scope.enabled) {
|
|
468
|
-
enabled = scope.enabled('enable-v11-release');
|
|
469
|
-
}
|
|
470
|
-
|
|
471
461
|
return /*#__PURE__*/React__default["default"].createElement(usePrefix.PrefixContext.Consumer, null, prefix => {
|
|
472
462
|
const labelId = `${id}-label`;
|
|
473
463
|
const labelClasses = cx__default["default"](`${prefix}--label`, {
|
|
@@ -477,7 +467,7 @@ class Slider extends React.PureComponent {
|
|
|
477
467
|
[`${prefix}--slider--disabled`]: disabled
|
|
478
468
|
}, {
|
|
479
469
|
[`${prefix}--slider--readonly`]: readOnly
|
|
480
|
-
}
|
|
470
|
+
});
|
|
481
471
|
const inputClasses = cx__default["default"](`${prefix}--text-input`, `${prefix}--slider-text-input`, {
|
|
482
472
|
[`${prefix}--text-input--light`]: light,
|
|
483
473
|
[`${prefix}--text-input--invalid`]: !readOnly && isValid === false,
|
|
@@ -485,7 +475,7 @@ class Slider extends React.PureComponent {
|
|
|
485
475
|
[`${prefix}--slider-text-input--warn`]: !readOnly && warn
|
|
486
476
|
});
|
|
487
477
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
488
|
-
className:
|
|
478
|
+
className: cx__default["default"](`${prefix}--form-item`, className)
|
|
489
479
|
}, /*#__PURE__*/React__default["default"].createElement("label", {
|
|
490
480
|
htmlFor: id,
|
|
491
481
|
className: labelClasses,
|
|
@@ -555,153 +545,123 @@ class Slider extends React.PureComponent {
|
|
|
555
545
|
}, warnText));
|
|
556
546
|
});
|
|
557
547
|
}
|
|
558
|
-
|
|
559
548
|
}
|
|
560
|
-
|
|
561
549
|
_rollupPluginBabelHelpers.defineProperty(Slider, "propTypes", {
|
|
562
550
|
/**
|
|
563
551
|
* The `ariaLabel` for the `<input>`.
|
|
564
552
|
*/
|
|
565
553
|
ariaLabelInput: PropTypes__default["default"].string,
|
|
566
|
-
|
|
567
554
|
/**
|
|
568
555
|
* The child nodes.
|
|
569
556
|
*/
|
|
570
557
|
children: PropTypes__default["default"].node,
|
|
571
|
-
|
|
572
558
|
/**
|
|
573
559
|
* The CSS class name for the slider.
|
|
574
560
|
*/
|
|
575
561
|
className: PropTypes__default["default"].string,
|
|
576
|
-
|
|
577
562
|
/**
|
|
578
563
|
* `true` to disable this slider.
|
|
579
564
|
*/
|
|
580
565
|
disabled: PropTypes__default["default"].bool,
|
|
581
|
-
|
|
582
566
|
/**
|
|
583
567
|
* The callback to format the label associated with the minimum/maximum value.
|
|
584
568
|
*/
|
|
585
569
|
formatLabel: PropTypes__default["default"].func,
|
|
586
|
-
|
|
587
570
|
/**
|
|
588
571
|
* `true` to hide the number input box.
|
|
589
572
|
*/
|
|
590
573
|
hideTextInput: PropTypes__default["default"].bool,
|
|
591
|
-
|
|
592
574
|
/**
|
|
593
575
|
* The ID of the `<input>`.
|
|
594
576
|
*/
|
|
595
577
|
id: PropTypes__default["default"].string,
|
|
596
|
-
|
|
597
578
|
/**
|
|
598
579
|
* The `type` attribute of the `<input>`.
|
|
599
580
|
*/
|
|
600
581
|
inputType: PropTypes__default["default"].string,
|
|
601
|
-
|
|
602
582
|
/**
|
|
603
583
|
* `Specify whether the Slider is currently invalid
|
|
604
584
|
*/
|
|
605
585
|
invalid: PropTypes__default["default"].bool,
|
|
606
|
-
|
|
607
586
|
/**
|
|
608
587
|
* Provide the text that is displayed when the Slider is in an invalid state
|
|
609
588
|
*/
|
|
610
589
|
invalidText: PropTypes__default["default"].node,
|
|
611
|
-
|
|
612
590
|
/**
|
|
613
591
|
* The label for the slider.
|
|
614
592
|
*/
|
|
615
593
|
labelText: PropTypes__default["default"].node,
|
|
616
|
-
|
|
617
594
|
/**
|
|
618
595
|
* `true` to use the light version.
|
|
619
596
|
*/
|
|
620
597
|
light: deprecate["default"](PropTypes__default["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.'),
|
|
621
|
-
|
|
622
598
|
/**
|
|
623
599
|
* The maximum value.
|
|
624
600
|
*/
|
|
625
601
|
max: PropTypes__default["default"].number.isRequired,
|
|
626
|
-
|
|
627
602
|
/**
|
|
628
603
|
* The label associated with the maximum value.
|
|
629
604
|
*/
|
|
630
605
|
maxLabel: PropTypes__default["default"].string,
|
|
631
|
-
|
|
632
606
|
/**
|
|
633
607
|
* The minimum value.
|
|
634
608
|
*/
|
|
635
609
|
min: PropTypes__default["default"].number.isRequired,
|
|
636
|
-
|
|
637
610
|
/**
|
|
638
611
|
* The label associated with the minimum value.
|
|
639
612
|
*/
|
|
640
613
|
minLabel: PropTypes__default["default"].string,
|
|
641
|
-
|
|
642
614
|
/**
|
|
643
615
|
* The `name` attribute of the `<input>`.
|
|
644
616
|
*/
|
|
645
617
|
name: PropTypes__default["default"].string,
|
|
646
|
-
|
|
647
618
|
/**
|
|
648
619
|
* Provide an optional function to be called when the input element
|
|
649
620
|
* loses focus
|
|
650
621
|
*/
|
|
651
622
|
onBlur: PropTypes__default["default"].func,
|
|
652
|
-
|
|
653
623
|
/**
|
|
654
624
|
* The callback to get notified of change in value.
|
|
655
625
|
*/
|
|
656
626
|
onChange: PropTypes__default["default"].func,
|
|
657
|
-
|
|
658
627
|
/**
|
|
659
628
|
* Provide an optional function to be called when a key is pressed in the number input
|
|
660
629
|
*/
|
|
661
630
|
onInputKeyUp: PropTypes__default["default"].func,
|
|
662
|
-
|
|
663
631
|
/**
|
|
664
632
|
* The callback to get notified of value on handle release.
|
|
665
633
|
*/
|
|
666
634
|
onRelease: PropTypes__default["default"].func,
|
|
667
|
-
|
|
668
635
|
/**
|
|
669
636
|
* Whether the slider should be read-only
|
|
670
637
|
*/
|
|
671
638
|
readOnly: PropTypes__default["default"].bool,
|
|
672
|
-
|
|
673
639
|
/**
|
|
674
640
|
* `true` to specify if the control is required.
|
|
675
641
|
*/
|
|
676
642
|
required: PropTypes__default["default"].bool,
|
|
677
|
-
|
|
678
643
|
/**
|
|
679
644
|
* 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 of the `step` increment will be considered invalid.
|
|
680
645
|
*/
|
|
681
646
|
step: PropTypes__default["default"].number,
|
|
682
|
-
|
|
683
647
|
/**
|
|
684
648
|
* A value determining how much the value should increase/decrease by Shift+arrow keys,
|
|
685
649
|
* which will be `(max - min) / stepMultiplier`.
|
|
686
650
|
*/
|
|
687
651
|
stepMultiplier: PropTypes__default["default"].number,
|
|
688
|
-
|
|
689
652
|
/**
|
|
690
653
|
* The value.
|
|
691
654
|
*/
|
|
692
655
|
value: PropTypes__default["default"].number.isRequired,
|
|
693
|
-
|
|
694
656
|
/**
|
|
695
657
|
* `Specify whether the Slider is in a warn state
|
|
696
658
|
*/
|
|
697
659
|
warn: PropTypes__default["default"].bool,
|
|
698
|
-
|
|
699
660
|
/**
|
|
700
661
|
* Provide the text that is displayed when the Slider is in an warn state
|
|
701
662
|
*/
|
|
702
663
|
warnText: PropTypes__default["default"].node
|
|
703
664
|
});
|
|
704
|
-
|
|
705
665
|
_rollupPluginBabelHelpers.defineProperty(Slider, "defaultProps", {
|
|
706
666
|
hideTextInput: false,
|
|
707
667
|
step: 1,
|
|
@@ -710,10 +670,8 @@ _rollupPluginBabelHelpers.defineProperty(Slider, "defaultProps", {
|
|
|
710
670
|
minLabel: '',
|
|
711
671
|
maxLabel: '',
|
|
712
672
|
inputType: 'number',
|
|
713
|
-
ariaLabelInput: FeatureFlags__namespace.enabled('enable-v11-release') ? undefined : 'Slider number input',
|
|
714
673
|
readOnly: false
|
|
715
674
|
});
|
|
716
|
-
|
|
717
675
|
_rollupPluginBabelHelpers.defineProperty(Slider, "contextType", index.FeatureFlagContext);
|
|
718
676
|
|
|
719
677
|
exports["default"] = Slider;
|