@carbon/react 1.83.0-rc.0 → 1.84.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/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +895 -790
- package/README.md +1 -1
- package/es/components/AILabel/index.js +37 -40
- package/es/components/AISkeleton/AISkeletonIcon.js +6 -7
- package/es/components/AISkeleton/AISkeletonPlaceholder.js +6 -7
- package/es/components/AISkeleton/AISkeletonText.js +6 -7
- package/es/components/Accordion/Accordion.Skeleton.js +24 -25
- package/es/components/Accordion/Accordion.js +13 -14
- package/es/components/Accordion/AccordionItem.js +22 -23
- package/es/components/Accordion/AccordionProvider.js +6 -7
- package/es/components/AspectRatio/AspectRatio.js +9 -10
- package/es/components/BadgeIndicator/index.js +7 -8
- package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +9 -10
- package/es/components/Breadcrumb/Breadcrumb.js +3 -3
- package/es/components/Breadcrumb/BreadcrumbItem.js +9 -9
- package/es/components/Button/Button.Skeleton.js +10 -11
- package/es/components/Button/Button.js +5 -5
- package/es/components/Button/ButtonBase.js +27 -28
- package/es/components/ButtonSet/ButtonSet.js +2 -2
- package/es/components/ChatButton/ChatButton.Skeleton.js +7 -8
- package/es/components/ChatButton/ChatButton.js +13 -14
- package/es/components/Checkbox/Checkbox.Skeleton.js +8 -9
- package/es/components/Checkbox/Checkbox.js +33 -34
- package/es/components/CheckboxGroup/CheckboxGroup.js +28 -29
- package/es/components/ClassPrefix/index.js +6 -7
- package/es/components/CodeSnippet/CodeSnippet.Skeleton.js +12 -13
- package/es/components/CodeSnippet/CodeSnippet.js +41 -42
- package/es/components/ComboBox/ComboBox.js +42 -48
- package/es/components/ComboBox/tools/filter.js +9 -12
- package/es/components/ComboButton/index.js +22 -24
- package/es/components/ComposedModal/ComposedModal.js +49 -52
- package/es/components/ComposedModal/ModalFooter.js +42 -47
- package/es/components/ComposedModal/ModalHeader.js +21 -22
- package/es/components/ContainedList/ContainedList.js +17 -18
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +16 -17
- package/es/components/ContentSwitcher/ContentSwitcher.d.ts +17 -29
- package/es/components/ContentSwitcher/ContentSwitcher.js +100 -126
- package/es/components/ContentSwitcher/index.d.ts +3 -4
- package/es/components/ContextMenu/useContextMenu.js +1 -2
- package/es/components/Copy/Copy.js +13 -14
- package/es/components/CopyButton/CopyButton.js +14 -15
- package/es/components/DangerButton/DangerButton.js +2 -2
- package/es/components/DataTable/DataTable.d.ts +81 -283
- package/es/components/DataTable/DataTable.js +124 -172
- package/es/components/DataTable/Table.d.ts +2 -2
- package/es/components/DataTable/Table.js +19 -22
- package/es/components/DataTable/TableActionList.d.ts +1 -1
- package/es/components/DataTable/TableBatchAction.js +9 -12
- package/es/components/DataTable/TableBatchActions.js +27 -29
- package/es/components/DataTable/TableBody.d.ts +3 -3
- package/es/components/DataTable/TableBody.js +9 -12
- package/es/components/DataTable/TableCell.d.ts +3 -4
- package/es/components/DataTable/TableCell.js +2 -2
- package/es/components/DataTable/TableContainer.d.ts +2 -3
- package/es/components/DataTable/TableContainer.js +15 -16
- package/es/components/DataTable/TableDecoratorRow.js +8 -9
- package/es/components/DataTable/TableExpandHeader.d.ts +2 -3
- package/es/components/DataTable/TableExpandHeader.js +18 -19
- package/es/components/DataTable/TableExpandRow.js +20 -21
- package/es/components/DataTable/TableExpandedRow.d.ts +3 -3
- package/es/components/DataTable/TableExpandedRow.js +10 -11
- package/es/components/DataTable/TableHead.d.ts +1 -1
- package/es/components/DataTable/TableHeader.d.ts +4 -4
- package/es/components/DataTable/TableHeader.js +29 -30
- package/es/components/DataTable/TableRow.d.ts +3 -4
- package/es/components/DataTable/TableRow.js +4 -4
- package/es/components/DataTable/TableSelectAll.js +14 -15
- package/es/components/DataTable/TableSelectRow.js +16 -17
- package/es/components/DataTable/TableSlugRow.js +7 -8
- package/es/components/DataTable/TableToolbar.js +9 -10
- package/es/components/DataTable/TableToolbarAction.js +2 -2
- package/es/components/DataTable/TableToolbarContent.d.ts +1 -1
- package/es/components/DataTable/TableToolbarMenu.js +10 -11
- package/es/components/DataTable/TableToolbarSearch.js +24 -26
- package/es/components/DataTable/index.d.ts +1 -1
- package/es/components/DataTable/state/sorting.js +3 -4
- package/es/components/DataTable/tools/filter.js +10 -12
- package/es/components/DataTable/tools/normalize.js +6 -8
- package/es/components/DataTable/tools/sorting.js +24 -30
- package/es/components/DataTableSkeleton/DataTableSkeleton.js +26 -27
- package/es/components/DatePicker/DatePicker.Skeleton.js +15 -16
- package/es/components/DatePicker/DatePicker.js +104 -81
- package/es/components/DatePickerInput/DatePickerInput.d.ts +3 -4
- package/es/components/DatePickerInput/DatePickerInput.js +24 -25
- package/es/components/Dialog/index.d.ts +194 -10
- package/es/components/Dialog/index.js +458 -39
- package/es/components/Dropdown/Dropdown.Skeleton.d.ts +2 -3
- package/es/components/Dropdown/Dropdown.Skeleton.js +10 -11
- package/es/components/Dropdown/Dropdown.d.ts +3 -3
- package/es/components/Dropdown/Dropdown.js +57 -60
- package/es/components/ErrorBoundary/ErrorBoundary.js +4 -4
- package/es/components/ExpandableSearch/ExpandableSearch.js +11 -12
- package/es/components/FeatureFlags/index.js +13 -14
- package/es/components/FileUploader/FileUploader.Skeleton.d.ts +3 -3
- package/es/components/FileUploader/FileUploader.Skeleton.js +9 -10
- package/es/components/FileUploader/FileUploader.d.ts +2 -3
- package/es/components/FileUploader/FileUploader.js +33 -35
- package/es/components/FileUploader/FileUploaderButton.d.ts +2 -3
- package/es/components/FileUploader/FileUploaderButton.js +20 -21
- package/es/components/FileUploader/FileUploaderDropContainer.d.ts +2 -3
- package/es/components/FileUploader/FileUploaderDropContainer.js +20 -21
- package/es/components/FileUploader/FileUploaderItem.d.ts +2 -3
- package/es/components/FileUploader/FileUploaderItem.js +26 -27
- package/es/components/FileUploader/Filename.d.ts +3 -4
- package/es/components/FileUploader/Filename.js +16 -17
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +9 -10
- package/es/components/FluidComboBox/FluidComboBox.js +8 -9
- package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.js +16 -17
- package/es/components/FluidDatePicker/FluidDatePicker.js +13 -14
- package/es/components/FluidDatePickerInput/FluidDatePickerInput.js +3 -3
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +9 -10
- package/es/components/FluidDropdown/FluidDropdown.js +8 -9
- package/es/components/FluidForm/FluidForm.d.ts +3 -4
- package/es/components/FluidForm/FluidForm.js +8 -9
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +9 -10
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +10 -11
- package/es/components/FluidNumberInput/FluidNumberInput.Skeleton.js +9 -10
- package/es/components/FluidNumberInput/FluidNumberInput.d.ts +40 -1
- package/es/components/FluidNumberInput/FluidNumberInput.js +41 -8
- package/es/components/FluidSearch/FluidSearch.Skeleton.js +9 -10
- package/es/components/FluidSearch/FluidSearch.js +7 -8
- package/es/components/FluidSelect/FluidSelect.Skeleton.js +9 -10
- package/es/components/FluidSelect/FluidSelect.js +8 -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 +9 -10
- package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.js +8 -9
- package/es/components/FluidTimePicker/FluidTimePicker.js +23 -24
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +7 -8
- package/es/components/Form/Form.js +7 -8
- package/es/components/FormGroup/FormGroup.d.ts +3 -4
- package/es/components/FormGroup/FormGroup.js +15 -16
- package/es/components/FormItem/FormItem.js +7 -8
- package/es/components/FormLabel/FormLabel.js +8 -9
- package/es/components/Grid/CSSGrid.js +23 -25
- package/es/components/Grid/Column.js +32 -31
- package/es/components/Grid/ColumnHang.js +8 -9
- package/es/components/Grid/FlexGrid.js +12 -13
- package/es/components/Grid/Grid.js +3 -3
- package/es/components/Grid/GridContext.d.ts +2 -2
- package/es/components/Grid/GridContext.js +6 -7
- package/es/components/Grid/Row.js +10 -11
- package/es/components/Heading/index.js +13 -14
- package/es/components/Icon/Icon.Skeleton.js +6 -7
- package/es/components/IconButton/index.js +30 -26
- package/es/components/IconIndicator/index.js +10 -11
- package/es/components/IdPrefix/index.js +6 -7
- package/es/components/InlineCheckbox/InlineCheckbox.js +6 -6
- package/es/components/InlineLoading/InlineLoading.js +19 -20
- package/es/components/Layer/LayerContext.js +2 -2
- package/es/components/Layer/index.d.ts +4 -0
- package/es/components/Layer/index.js +21 -15
- package/es/components/Layout/index.js +24 -29
- package/es/components/LayoutDirection/LayoutDirection.js +10 -11
- package/es/components/LayoutDirection/LayoutDirectionContext.js +2 -2
- package/es/components/Link/Link.d.ts +1 -1
- package/es/components/Link/Link.js +19 -20
- package/es/components/ListBox/ListBox.d.ts +2 -3
- package/es/components/ListBox/ListBox.js +5 -5
- package/es/components/ListBox/ListBoxField.d.ts +3 -4
- package/es/components/ListBox/ListBoxField.js +8 -9
- package/es/components/ListBox/ListBoxMenu.d.ts +2 -3
- package/es/components/ListBox/ListBoxMenu.js +7 -8
- package/es/components/ListBox/ListBoxMenuIcon.js +8 -9
- package/es/components/ListBox/ListBoxMenuItem.d.ts +2 -3
- package/es/components/ListBox/ListBoxMenuItem.js +11 -13
- package/es/components/ListBox/ListBoxSelection.js +14 -15
- package/es/components/ListBox/next/ListBoxSelection.js +16 -17
- package/es/components/ListBox/next/ListBoxTrigger.js +8 -9
- package/es/components/ListItem/ListItem.js +7 -8
- package/es/components/Loading/Loading.d.ts +3 -3
- package/es/components/Loading/Loading.js +14 -15
- package/es/components/Menu/Menu.js +26 -27
- package/es/components/Menu/MenuItem.js +55 -60
- package/es/components/MenuButton/index.js +20 -22
- package/es/components/Modal/Modal.d.ts +2 -3
- package/es/components/Modal/Modal.js +85 -93
- package/es/components/ModalWrapper/ModalWrapper.js +9 -9
- package/es/components/MultiSelect/FilterableMultiSelect.js +68 -74
- package/es/components/MultiSelect/MultiSelect.js +65 -67
- package/es/components/MultiSelect/tools/sorting.js +11 -15
- package/es/components/Notification/Notification.js +137 -146
- package/es/components/NumberInput/NumberFormatPropTypes.d.ts +29 -0
- package/es/components/NumberInput/NumberFormatPropTypes.js +40 -0
- package/es/components/NumberInput/NumberInput.Skeleton.js +10 -11
- package/es/components/NumberInput/NumberInput.d.ts +39 -3
- package/es/components/NumberInput/NumberInput.js +195 -65
- package/es/components/OrderedList/OrderedList.js +9 -10
- package/es/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/es/components/OverflowMenu/OverflowMenu.js +42 -48
- package/es/components/OverflowMenu/index.js +3 -3
- package/es/components/OverflowMenu/next/index.js +17 -18
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +4 -4
- package/es/components/OverflowMenuV2/index.js +3 -3
- package/es/components/PageHeader/PageHeader.d.ts +29 -5
- package/es/components/PageHeader/PageHeader.js +136 -90
- package/es/components/Pagination/Pagination.Skeleton.js +12 -13
- package/es/components/Pagination/Pagination.js +40 -41
- package/es/components/Pagination/experimental/PageSelector.js +11 -12
- package/es/components/Pagination/experimental/Pagination.js +34 -35
- package/es/components/PaginationNav/PaginationNav.js +63 -68
- package/es/components/Popover/index.js +40 -42
- package/es/components/PrimaryButton/PrimaryButton.js +2 -2
- package/es/components/ProgressBar/ProgressBar.js +24 -25
- package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +12 -13
- package/es/components/ProgressIndicator/ProgressIndicator.js +49 -52
- package/es/components/RadioButton/RadioButton.Skeleton.js +4 -4
- package/es/components/RadioButton/RadioButton.js +10 -10
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +16 -16
- package/es/components/RadioTile/RadioTile.js +28 -29
- package/es/components/Search/Search.Skeleton.js +9 -10
- package/es/components/Search/Search.js +36 -38
- package/es/components/SecondaryButton/SecondaryButton.js +2 -2
- package/es/components/Select/Select.Skeleton.js +10 -11
- package/es/components/Select/Select.js +42 -43
- package/es/components/SelectItem/SelectItem.js +10 -11
- package/es/components/SelectItemGroup/SelectItemGroup.js +9 -10
- package/es/components/ShapeIndicator/index.js +13 -14
- package/es/components/SkeletonIcon/SkeletonIcon.d.ts +0 -4
- package/es/components/SkeletonIcon/SkeletonIcon.js +7 -12
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +6 -7
- package/es/components/SkeletonText/SkeletonText.js +12 -13
- package/es/components/Slider/Slider.Skeleton.js +25 -26
- package/es/components/Slider/Slider.js +99 -113
- package/es/components/Slider/SliderHandles.js +20 -20
- package/es/components/Stack/HStack.js +2 -2
- package/es/components/Stack/Stack.js +2 -2
- package/es/components/Stack/VStack.js +2 -2
- package/es/components/StructuredList/StructuredList.Skeleton.js +17 -18
- package/es/components/StructuredList/StructuredList.js +24 -24
- package/es/components/Switch/IconSwitch.js +3 -3
- package/es/components/Switch/Switch.js +4 -4
- package/es/components/TabContent/TabContent.js +2 -2
- package/es/components/Tabs/Tabs.Skeleton.js +12 -13
- package/es/components/Tabs/Tabs.js +141 -156
- package/es/components/Tabs/usePressable.js +7 -8
- package/es/components/Tag/DismissibleTag.js +26 -27
- package/es/components/Tag/OperationalTag.js +16 -17
- package/es/components/Tag/SelectableTag.js +19 -20
- package/es/components/Tag/Tag.Skeleton.js +7 -8
- package/es/components/Tag/Tag.js +33 -34
- package/es/components/Text/Text.js +9 -10
- package/es/components/Text/TextDirection.js +7 -8
- package/es/components/Text/createTextComponent.js +2 -2
- package/es/components/TextArea/TextArea.Skeleton.js +4 -4
- package/es/components/TextArea/TextArea.js +22 -22
- package/es/components/TextInput/ControlledPasswordInput.d.ts +2 -3
- package/es/components/TextInput/ControlledPasswordInput.js +36 -37
- package/es/components/TextInput/PasswordInput.js +40 -41
- package/es/components/TextInput/TextInput.Skeleton.js +9 -10
- package/es/components/TextInput/TextInput.js +43 -44
- package/es/components/TextInput/util.js +14 -17
- package/es/components/Theme/index.js +19 -21
- package/es/components/Tile/Tile.js +98 -104
- package/es/components/TileGroup/TileGroup.d.ts +3 -4
- package/es/components/TileGroup/TileGroup.js +8 -8
- package/es/components/TimePicker/TimePicker.d.ts +2 -3
- package/es/components/TimePicker/TimePicker.js +14 -14
- package/es/components/TimePickerSelect/TimePickerSelect.js +4 -4
- package/es/components/Toggle/Toggle.Skeleton.js +8 -9
- package/es/components/Toggle/Toggle.js +27 -28
- package/es/components/ToggleSmall/ToggleSmall.Skeleton.js +14 -15
- package/es/components/Toggletip/index.js +43 -49
- package/es/components/Tooltip/DefinitionTooltip.js +17 -18
- package/es/components/Tooltip/Tooltip.d.ts +3 -0
- package/es/components/Tooltip/Tooltip.js +39 -28
- package/es/components/TreeView/TreeNode.js +64 -56
- package/es/components/TreeView/TreeView.js +44 -37
- package/es/components/UIShell/Content.js +8 -9
- package/es/components/UIShell/Header.js +7 -8
- package/es/components/UIShell/HeaderContainer.js +7 -8
- package/es/components/UIShell/HeaderGlobalAction.js +14 -15
- package/es/components/UIShell/HeaderGlobalBar.d.ts +1 -1
- package/es/components/UIShell/HeaderMenu.d.ts +10 -112
- package/es/components/UIShell/HeaderMenu.js +154 -201
- package/es/components/UIShell/HeaderMenuButton.js +14 -15
- package/es/components/UIShell/HeaderMenuItem.js +21 -20
- package/es/components/UIShell/HeaderName.js +9 -10
- package/es/components/UIShell/HeaderNavigation.js +10 -11
- package/es/components/UIShell/HeaderPanel.js +11 -12
- package/es/components/UIShell/HeaderSideNavItems.js +7 -8
- package/es/components/UIShell/Link.js +11 -12
- package/es/components/UIShell/SideNav.js +30 -32
- package/es/components/UIShell/SideNavDetails.js +9 -10
- package/es/components/UIShell/SideNavDivider.js +6 -7
- package/es/components/UIShell/SideNavFooter.js +13 -14
- package/es/components/UIShell/SideNavHeader.js +8 -9
- package/es/components/UIShell/SideNavIcon.js +7 -8
- package/es/components/UIShell/SideNavItem.js +7 -8
- package/es/components/UIShell/SideNavItems.js +10 -11
- package/es/components/UIShell/SideNavLink.js +15 -16
- package/es/components/UIShell/SideNavLinkText.js +7 -8
- package/es/components/UIShell/SideNavMenu.js +20 -21
- package/es/components/UIShell/SideNavMenuItem.js +5 -5
- package/es/components/UIShell/SideNavSwitcher.js +8 -8
- package/es/components/UIShell/SkipToContent.js +9 -10
- package/es/components/UIShell/Switcher.js +12 -13
- package/es/components/UIShell/SwitcherDivider.js +6 -7
- package/es/components/UIShell/SwitcherItem.js +3 -3
- package/es/components/UnorderedList/UnorderedList.js +8 -9
- package/es/index.js +25 -26
- package/es/internal/FloatingMenu.js +30 -32
- package/es/internal/Selection.js +15 -17
- package/{lib/feature-flags.d.ts → es/internal/__mocks__/mockHTMLElement.d.ts} +4 -2
- package/es/internal/createClassWrapper.js +2 -2
- package/es/internal/getAnnouncement.d.ts +8 -0
- package/es/internal/getAnnouncement.js +22 -0
- package/es/internal/keyboard/match.js +6 -7
- package/es/internal/useControllableState.d.ts +1 -1
- package/es/internal/useControllableState.js +8 -9
- package/es/internal/useDelayedState.js +1 -2
- package/es/internal/useDocumentLang.d.ts +12 -0
- package/es/internal/useId.js +4 -6
- package/es/internal/useIdPrefix.js +3 -3
- package/es/internal/useMatchMedia.js +1 -2
- package/es/internal/useMergedRefs.d.ts +1 -1
- package/es/internal/useNoInteractiveChildren.js +2 -4
- package/es/internal/useNormalizedInputProps.js +12 -13
- package/es/internal/usePrefix.js +3 -3
- package/es/internal/useResizeObserver.d.ts +14 -0
- package/es/internal/useResizeObserver.js +73 -0
- package/es/internal/useSavedCallback.js +1 -3
- package/es/internal/wrapFocus.js +23 -35
- package/es/prop-types/deprecate.js +1 -4
- package/es/prop-types/deprecateValuesWithin.js +1 -4
- package/es/prop-types/isRequiredOneOf.js +1 -4
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +1 -4
- package/es/tools/events.js +1 -4
- package/es/tools/mergeRefs.js +9 -14
- package/es/tools/uniqueId.js +1 -2
- package/es/tools/wrapComponent.d.ts +3 -4
- package/es/tools/wrapComponent.js +11 -13
- package/es/types/common.d.ts +0 -2
- package/lib/components/AILabel/index.js +27 -30
- package/lib/components/AISkeleton/AISkeletonIcon.js +4 -5
- package/lib/components/AISkeleton/AISkeletonPlaceholder.js +4 -5
- package/lib/components/AISkeleton/AISkeletonText.js +4 -5
- package/lib/components/Accordion/Accordion.Skeleton.js +9 -10
- package/lib/components/Accordion/Accordion.js +10 -11
- package/lib/components/Accordion/AccordionItem.js +13 -14
- package/lib/components/Accordion/AccordionProvider.js +4 -5
- package/lib/components/AspectRatio/AspectRatio.js +7 -8
- package/lib/components/BadgeIndicator/index.js +5 -6
- package/lib/components/Breadcrumb/Breadcrumb.Skeleton.js +4 -5
- package/lib/components/Button/Button.Skeleton.js +7 -8
- package/lib/components/Button/ButtonBase.js +23 -24
- package/lib/components/ChatButton/ChatButton.Skeleton.js +5 -6
- package/lib/components/ChatButton/ChatButton.js +11 -12
- package/lib/components/Checkbox/Checkbox.Skeleton.js +4 -5
- package/lib/components/Checkbox/Checkbox.js +19 -20
- package/lib/components/CheckboxGroup/CheckboxGroup.js +16 -17
- package/lib/components/ClassPrefix/index.js +4 -5
- package/lib/components/CodeSnippet/CodeSnippet.Skeleton.js +5 -6
- package/lib/components/CodeSnippet/CodeSnippet.js +27 -29
- package/lib/components/ComboBox/ComboBox.js +24 -30
- package/lib/components/ComboBox/tools/filter.js +9 -12
- package/lib/components/ComboButton/index.js +16 -18
- package/lib/components/ComposedModal/ComposedModal.js +31 -34
- package/lib/components/ComposedModal/ModalFooter.js +37 -42
- package/lib/components/ComposedModal/ModalHeader.js +14 -15
- package/lib/components/ContainedList/ContainedList.js +10 -11
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +9 -10
- package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +17 -29
- package/lib/components/ContentSwitcher/ContentSwitcher.js +98 -124
- package/lib/components/ContentSwitcher/index.d.ts +3 -4
- package/lib/components/ContextMenu/useContextMenu.js +1 -2
- package/lib/components/Copy/Copy.js +11 -12
- package/lib/components/CopyButton/CopyButton.js +10 -11
- package/lib/components/DataTable/DataTable.d.ts +81 -283
- package/lib/components/DataTable/DataTable.js +123 -172
- package/lib/components/DataTable/Table.d.ts +2 -2
- package/lib/components/DataTable/Table.js +15 -18
- package/lib/components/DataTable/TableActionList.d.ts +1 -1
- package/lib/components/DataTable/TableBatchAction.js +8 -11
- package/lib/components/DataTable/TableBatchActions.js +18 -20
- package/lib/components/DataTable/TableBody.d.ts +3 -3
- package/lib/components/DataTable/TableBody.js +8 -11
- package/lib/components/DataTable/TableCell.d.ts +3 -4
- package/lib/components/DataTable/TableContainer.d.ts +2 -3
- package/lib/components/DataTable/TableContainer.js +9 -10
- package/lib/components/DataTable/TableDecoratorRow.js +4 -5
- package/lib/components/DataTable/TableExpandHeader.d.ts +2 -3
- package/lib/components/DataTable/TableExpandHeader.js +14 -15
- package/lib/components/DataTable/TableExpandRow.js +13 -14
- package/lib/components/DataTable/TableExpandedRow.d.ts +3 -3
- package/lib/components/DataTable/TableExpandedRow.js +6 -7
- package/lib/components/DataTable/TableHead.d.ts +1 -1
- package/lib/components/DataTable/TableHeader.d.ts +4 -4
- package/lib/components/DataTable/TableHeader.js +15 -16
- package/lib/components/DataTable/TableRow.d.ts +3 -4
- package/lib/components/DataTable/TableSelectAll.js +11 -12
- package/lib/components/DataTable/TableSelectRow.js +12 -13
- package/lib/components/DataTable/TableSlugRow.js +4 -5
- package/lib/components/DataTable/TableToolbar.js +7 -8
- package/lib/components/DataTable/TableToolbarContent.d.ts +1 -1
- package/lib/components/DataTable/TableToolbarMenu.js +8 -9
- package/lib/components/DataTable/TableToolbarSearch.js +22 -24
- package/lib/components/DataTable/index.d.ts +1 -1
- package/lib/components/DataTable/state/sorting.js +3 -4
- package/lib/components/DataTable/tools/filter.js +10 -12
- package/lib/components/DataTable/tools/normalize.js +6 -8
- package/lib/components/DataTable/tools/sorting.js +24 -30
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +11 -12
- package/lib/components/DatePicker/DatePicker.Skeleton.js +7 -8
- package/lib/components/DatePicker/DatePicker.js +87 -64
- package/lib/components/DatePickerInput/DatePickerInput.d.ts +3 -4
- package/lib/components/DatePickerInput/DatePickerInput.js +5 -6
- package/lib/components/Dialog/index.d.ts +194 -10
- package/lib/components/Dialog/index.js +457 -33
- package/lib/components/Dropdown/Dropdown.Skeleton.d.ts +2 -3
- package/lib/components/Dropdown/Dropdown.Skeleton.js +6 -7
- package/lib/components/Dropdown/Dropdown.d.ts +3 -3
- package/lib/components/Dropdown/Dropdown.js +40 -43
- package/lib/components/ErrorBoundary/ErrorBoundary.js +2 -2
- package/lib/components/ExpandableSearch/ExpandableSearch.js +9 -10
- package/lib/components/FeatureFlags/index.js +11 -12
- package/lib/components/FileUploader/FileUploader.Skeleton.d.ts +3 -3
- package/lib/components/FileUploader/FileUploader.Skeleton.js +4 -5
- package/lib/components/FileUploader/FileUploader.d.ts +2 -3
- package/lib/components/FileUploader/FileUploader.js +22 -24
- package/lib/components/FileUploader/FileUploaderButton.d.ts +2 -3
- package/lib/components/FileUploader/FileUploaderButton.js +16 -17
- package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +2 -3
- package/lib/components/FileUploader/FileUploaderDropContainer.js +15 -16
- package/lib/components/FileUploader/FileUploaderItem.d.ts +2 -3
- package/lib/components/FileUploader/FileUploaderItem.js +13 -14
- package/lib/components/FileUploader/Filename.d.ts +3 -4
- package/lib/components/FileUploader/Filename.js +9 -10
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +4 -5
- package/lib/components/FluidComboBox/FluidComboBox.js +5 -6
- package/lib/components/FluidDatePicker/FluidDatePicker.Skeleton.js +5 -6
- package/lib/components/FluidDatePicker/FluidDatePicker.js +10 -11
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +4 -5
- package/lib/components/FluidDropdown/FluidDropdown.js +5 -6
- package/lib/components/FluidForm/FluidForm.d.ts +3 -4
- package/lib/components/FluidForm/FluidForm.js +5 -6
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +4 -5
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +6 -7
- package/lib/components/FluidNumberInput/FluidNumberInput.Skeleton.js +4 -5
- package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +40 -1
- package/lib/components/FluidNumberInput/FluidNumberInput.js +38 -5
- package/lib/components/FluidSearch/FluidSearch.Skeleton.js +4 -5
- package/lib/components/FluidSearch/FluidSearch.js +4 -5
- package/lib/components/FluidSelect/FluidSelect.Skeleton.js +4 -5
- package/lib/components/FluidSelect/FluidSelect.js +5 -6
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +4 -5
- package/lib/components/FluidTextArea/FluidTextArea.js +4 -5
- package/lib/components/FluidTextInput/FluidTextInput.Skeleton.js +4 -5
- package/lib/components/FluidTextInput/FluidTextInput.js +5 -6
- package/lib/components/FluidTimePicker/FluidTimePicker.Skeleton.js +5 -6
- package/lib/components/FluidTimePicker/FluidTimePicker.js +11 -12
- package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +5 -6
- package/lib/components/Form/Form.js +5 -6
- package/lib/components/FormGroup/FormGroup.d.ts +3 -4
- package/lib/components/FormGroup/FormGroup.js +11 -12
- package/lib/components/FormItem/FormItem.js +5 -6
- package/lib/components/FormLabel/FormLabel.js +6 -7
- package/lib/components/Grid/CSSGrid.js +17 -19
- package/lib/components/Grid/Column.js +28 -27
- package/lib/components/Grid/ColumnHang.js +6 -7
- package/lib/components/Grid/FlexGrid.js +9 -10
- package/lib/components/Grid/GridContext.d.ts +2 -2
- package/lib/components/Grid/GridContext.js +10 -29
- package/lib/components/Grid/Row.js +8 -9
- package/lib/components/Heading/index.js +5 -6
- package/lib/components/Icon/Icon.Skeleton.js +4 -5
- package/lib/components/IconButton/index.js +26 -22
- package/lib/components/IconIndicator/index.js +7 -8
- package/lib/components/IdPrefix/index.js +4 -5
- package/lib/components/InlineLoading/InlineLoading.js +9 -10
- package/lib/components/Layer/index.d.ts +4 -0
- package/lib/components/Layer/index.js +16 -10
- package/lib/components/Layout/index.js +21 -26
- package/lib/components/LayoutDirection/LayoutDirection.js +6 -7
- package/lib/components/Link/Link.d.ts +1 -1
- package/lib/components/Link/Link.js +15 -16
- package/lib/components/ListBox/ListBox.d.ts +2 -3
- package/lib/components/ListBox/ListBoxField.d.ts +3 -4
- package/lib/components/ListBox/ListBoxField.js +6 -7
- package/lib/components/ListBox/ListBoxMenu.d.ts +2 -3
- package/lib/components/ListBox/ListBoxMenu.js +5 -6
- package/lib/components/ListBox/ListBoxMenuIcon.js +4 -5
- package/lib/components/ListBox/ListBoxMenuItem.d.ts +2 -3
- package/lib/components/ListBox/ListBoxMenuItem.js +8 -10
- package/lib/components/ListBox/ListBoxSelection.js +8 -9
- package/lib/components/ListBox/next/ListBoxSelection.js +9 -10
- package/lib/components/ListBox/next/ListBoxTrigger.js +5 -6
- package/lib/components/ListItem/ListItem.js +5 -6
- package/lib/components/Loading/Loading.d.ts +3 -3
- package/lib/components/Loading/Loading.js +8 -9
- package/lib/components/Menu/Menu.js +23 -24
- package/lib/components/Menu/MenuItem.js +39 -44
- package/lib/components/MenuButton/index.js +16 -18
- package/lib/components/Modal/Modal.d.ts +2 -3
- package/lib/components/Modal/Modal.js +55 -63
- package/lib/components/ModalWrapper/ModalWrapper.js +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.js +46 -52
- package/lib/components/MultiSelect/MultiSelect.js +43 -45
- package/lib/components/MultiSelect/tools/sorting.js +11 -15
- package/lib/components/Notification/Notification.js +96 -105
- package/lib/components/NumberInput/NumberFormatPropTypes.d.ts +29 -0
- package/lib/components/NumberInput/NumberFormatPropTypes.js +48 -0
- package/lib/components/NumberInput/NumberInput.Skeleton.js +6 -7
- package/lib/components/NumberInput/NumberInput.d.ts +39 -3
- package/lib/components/NumberInput/NumberInput.js +173 -43
- package/lib/components/OrderedList/OrderedList.js +7 -8
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +1 -1
- package/lib/components/OverflowMenu/OverflowMenu.js +35 -41
- package/lib/components/OverflowMenu/next/index.js +12 -13
- package/lib/components/PageHeader/PageHeader.d.ts +29 -5
- package/lib/components/PageHeader/PageHeader.js +119 -73
- package/lib/components/Pagination/Pagination.Skeleton.js +4 -5
- package/lib/components/Pagination/Pagination.js +24 -25
- package/lib/components/Pagination/experimental/PageSelector.js +8 -9
- package/lib/components/Pagination/experimental/Pagination.js +20 -21
- package/lib/components/PaginationNav/PaginationNav.js +33 -38
- package/lib/components/Popover/index.js +26 -28
- package/lib/components/ProgressBar/ProgressBar.js +11 -12
- package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +5 -6
- package/lib/components/ProgressIndicator/ProgressIndicator.js +29 -32
- package/lib/components/RadioTile/RadioTile.js +17 -18
- package/lib/components/Search/Search.Skeleton.js +5 -6
- package/lib/components/Search/Search.js +26 -28
- package/lib/components/Select/Select.Skeleton.js +5 -6
- package/lib/components/Select/Select.js +24 -25
- package/lib/components/SelectItem/SelectItem.js +8 -9
- package/lib/components/SelectItemGroup/SelectItemGroup.js +7 -8
- package/lib/components/ShapeIndicator/index.js +7 -8
- package/lib/components/SkeletonIcon/SkeletonIcon.d.ts +0 -4
- package/lib/components/SkeletonIcon/SkeletonIcon.js +5 -10
- package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +4 -5
- package/lib/components/SkeletonText/SkeletonText.js +8 -9
- package/lib/components/Slider/Slider.Skeleton.js +8 -9
- package/lib/components/Slider/Slider.js +69 -83
- package/lib/components/Slider/SliderHandles.js +6 -6
- package/lib/components/StructuredList/StructuredList.Skeleton.js +5 -6
- package/lib/components/Tabs/Tabs.Skeleton.js +5 -6
- package/lib/components/Tabs/Tabs.js +83 -98
- package/lib/components/Tabs/usePressable.js +7 -8
- package/lib/components/Tag/DismissibleTag.js +16 -17
- package/lib/components/Tag/OperationalTag.js +10 -11
- package/lib/components/Tag/SelectableTag.js +13 -14
- package/lib/components/Tag/Tag.Skeleton.js +5 -6
- package/lib/components/Tag/Tag.js +19 -20
- package/lib/components/Text/Text.js +6 -7
- package/lib/components/Text/TextDirection.js +5 -6
- package/lib/components/TextArea/TextArea.js +3 -3
- package/lib/components/TextInput/ControlledPasswordInput.d.ts +2 -3
- package/lib/components/TextInput/ControlledPasswordInput.js +24 -25
- package/lib/components/TextInput/PasswordInput.js +26 -27
- package/lib/components/TextInput/TextInput.Skeleton.js +5 -6
- package/lib/components/TextInput/TextInput.js +27 -28
- package/lib/components/TextInput/util.js +14 -17
- package/lib/components/Theme/index.js +10 -12
- package/lib/components/Tile/Tile.js +68 -74
- package/lib/components/TileGroup/TileGroup.d.ts +3 -4
- package/lib/components/TimePicker/TimePicker.d.ts +2 -3
- package/lib/components/Toggle/Toggle.Skeleton.js +4 -5
- package/lib/components/Toggle/Toggle.js +17 -18
- package/lib/components/ToggleSmall/ToggleSmall.Skeleton.js +6 -7
- package/lib/components/Toggletip/index.js +33 -39
- package/lib/components/Tooltip/DefinitionTooltip.js +13 -14
- package/lib/components/Tooltip/Tooltip.d.ts +3 -0
- package/lib/components/Tooltip/Tooltip.js +33 -22
- package/lib/components/TreeView/TreeNode.js +40 -32
- package/lib/components/TreeView/TreeView.js +41 -34
- package/lib/components/UIShell/Content.js +6 -7
- package/lib/components/UIShell/Header.js +5 -6
- package/lib/components/UIShell/HeaderContainer.js +5 -6
- package/lib/components/UIShell/HeaderGlobalAction.js +12 -13
- package/lib/components/UIShell/HeaderGlobalBar.d.ts +1 -1
- package/lib/components/UIShell/HeaderMenu.d.ts +10 -112
- package/lib/components/UIShell/HeaderMenu.js +152 -199
- package/lib/components/UIShell/HeaderMenuButton.js +10 -11
- package/lib/components/UIShell/HeaderMenuItem.js +17 -16
- package/lib/components/UIShell/HeaderName.js +6 -7
- package/lib/components/UIShell/HeaderNavigation.js +7 -8
- package/lib/components/UIShell/HeaderPanel.js +9 -10
- package/lib/components/UIShell/HeaderSideNavItems.js +5 -6
- package/lib/components/UIShell/Link.js +8 -9
- package/lib/components/UIShell/SideNav.js +23 -25
- package/lib/components/UIShell/SideNavDetails.js +6 -7
- package/lib/components/UIShell/SideNavDivider.js +3 -4
- package/lib/components/UIShell/SideNavFooter.js +6 -7
- package/lib/components/UIShell/SideNavHeader.js +5 -6
- package/lib/components/UIShell/SideNavIcon.js +5 -6
- package/lib/components/UIShell/SideNavItem.js +5 -6
- package/lib/components/UIShell/SideNavItems.js +5 -6
- package/lib/components/UIShell/SideNavLink.js +10 -11
- package/lib/components/UIShell/SideNavLinkText.js +5 -6
- package/lib/components/UIShell/SideNavMenu.js +11 -12
- package/lib/components/UIShell/SkipToContent.js +7 -8
- package/lib/components/UIShell/Switcher.js +4 -5
- package/lib/components/UIShell/SwitcherDivider.js +4 -5
- package/lib/components/UnorderedList/UnorderedList.js +6 -7
- package/lib/index.js +81 -82
- package/lib/internal/FloatingMenu.js +26 -28
- package/lib/internal/Selection.js +15 -17
- package/{es/feature-flags.d.ts → lib/internal/__mocks__/mockHTMLElement.d.ts} +4 -2
- package/lib/internal/getAnnouncement.d.ts +8 -0
- package/lib/internal/getAnnouncement.js +26 -0
- package/lib/internal/keyboard/match.js +6 -7
- package/lib/internal/useControllableState.d.ts +1 -1
- package/lib/internal/useControllableState.js +8 -9
- package/lib/internal/useDelayedState.js +1 -2
- package/lib/internal/useDocumentLang.d.ts +12 -0
- package/lib/internal/useId.js +2 -4
- package/lib/internal/useMatchMedia.js +1 -2
- package/lib/internal/useMergedRefs.d.ts +1 -1
- package/lib/internal/useNoInteractiveChildren.js +2 -4
- package/lib/internal/useNormalizedInputProps.js +9 -10
- package/lib/internal/useResizeObserver.d.ts +14 -0
- package/lib/internal/useResizeObserver.js +77 -0
- package/lib/internal/useSavedCallback.js +1 -3
- package/lib/internal/wrapFocus.js +23 -35
- package/lib/prop-types/deprecate.js +1 -4
- package/lib/prop-types/deprecateValuesWithin.js +1 -4
- package/lib/prop-types/isRequiredOneOf.js +1 -4
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +1 -4
- package/lib/tools/events.js +1 -4
- package/lib/tools/mergeRefs.js +9 -14
- package/lib/tools/uniqueId.js +1 -2
- package/lib/tools/wrapComponent.d.ts +3 -4
- package/lib/tools/wrapComponent.js +9 -11
- package/lib/types/common.d.ts +0 -2
- package/package.json +21 -20
- package/scss/components/content-switcher/_tokens.scss +9 -0
- package/telemetry.yml +27 -2
- package/es/components/ContentSwitcher/index.js +0 -13
- package/es/components/DataTable/index.js +0 -76
- package/es/internal/useAnnouncer.js +0 -21
- package/lib/components/ContentSwitcher/index.js +0 -18
- package/lib/components/DataTable/index.js +0 -82
- package/lib/internal/useAnnouncer.js +0 -25
|
@@ -54,16 +54,15 @@ const DIRECTION_BOTTOM = 'bottom';
|
|
|
54
54
|
* Computes the floating menu's position based on the menu size, trigger element
|
|
55
55
|
* position, offset, direction, and container.
|
|
56
56
|
*/
|
|
57
|
-
const getFloatingPosition =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
} = _ref;
|
|
57
|
+
const getFloatingPosition = ({
|
|
58
|
+
menuSize,
|
|
59
|
+
refPosition,
|
|
60
|
+
offset,
|
|
61
|
+
direction,
|
|
62
|
+
scrollX,
|
|
63
|
+
scrollY,
|
|
64
|
+
container
|
|
65
|
+
}) => {
|
|
67
66
|
const {
|
|
68
67
|
left: refLeft = 0,
|
|
69
68
|
top: refTop = 0,
|
|
@@ -106,24 +105,23 @@ const getFloatingPosition = _ref => {
|
|
|
106
105
|
};
|
|
107
106
|
return positions[direction]();
|
|
108
107
|
};
|
|
109
|
-
const FloatingMenu =
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
} = _ref2;
|
|
108
|
+
const FloatingMenu = ({
|
|
109
|
+
children,
|
|
110
|
+
flipped,
|
|
111
|
+
focusTrap,
|
|
112
|
+
menuDirection = DIRECTION_BOTTOM,
|
|
113
|
+
menuOffset = {
|
|
114
|
+
top: 0,
|
|
115
|
+
left: 0
|
|
116
|
+
},
|
|
117
|
+
menuRef: externalMenuRef,
|
|
118
|
+
onPlace,
|
|
119
|
+
selectorPrimaryFocus,
|
|
120
|
+
styles,
|
|
121
|
+
target = () => document.body,
|
|
122
|
+
triggerRef,
|
|
123
|
+
updateOrientation
|
|
124
|
+
}) => {
|
|
127
125
|
const prefix = React.useContext(usePrefix.PrefixContext);
|
|
128
126
|
const [floatingPosition, setFloatingPosition] = React.useState(undefined);
|
|
129
127
|
const menuBodyRef = React.useRef(null);
|
|
@@ -16,14 +16,13 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
16
16
|
|
|
17
17
|
var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
|
|
18
18
|
|
|
19
|
-
const callOnChangeHandler =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} = _ref;
|
|
19
|
+
const callOnChangeHandler = ({
|
|
20
|
+
isControlled,
|
|
21
|
+
isMounted,
|
|
22
|
+
onChangeHandlerControlled,
|
|
23
|
+
onChangeHandlerUncontrolled,
|
|
24
|
+
selectedItems
|
|
25
|
+
}) => {
|
|
27
26
|
if (isControlled) {
|
|
28
27
|
if (isMounted && onChangeHandlerControlled) {
|
|
29
28
|
onChangeHandlerControlled({
|
|
@@ -34,15 +33,14 @@ const callOnChangeHandler = _ref => {
|
|
|
34
33
|
onChangeHandlerUncontrolled(selectedItems);
|
|
35
34
|
}
|
|
36
35
|
};
|
|
37
|
-
const useSelection =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
} = _ref2;
|
|
36
|
+
const useSelection = ({
|
|
37
|
+
disabled,
|
|
38
|
+
onChange,
|
|
39
|
+
initialSelectedItems = [],
|
|
40
|
+
selectedItems: controlledItems,
|
|
41
|
+
selectAll = false,
|
|
42
|
+
filteredItems = []
|
|
43
|
+
}) => {
|
|
46
44
|
const isMounted = React.useRef(false);
|
|
47
45
|
const savedOnChange = React.useRef(onChange);
|
|
48
46
|
const [uncontrolledItems, setUncontrolledItems] = React.useState(initialSelectedItems);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp.
|
|
2
|
+
* Copyright IBM Corp. 2025, 2025
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
export {
|
|
7
|
+
export declare const mockHTMLElement: (options: HTMLElement) => {
|
|
8
|
+
mockRestore: () => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/** Returns an announcement message when the remaining count is low. */
|
|
8
|
+
export declare const getAnnouncement: (count: number, maxCount?: number, singularEntityName?: string, pluralEntityName?: string) => string | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
+
|
|
12
|
+
/** Returns an announcement message when the remaining count is low. */
|
|
13
|
+
const getAnnouncement = (count, maxCount, singularEntityName = 'character', pluralEntityName = 'characters') => {
|
|
14
|
+
if (typeof maxCount === 'undefined') return null;
|
|
15
|
+
const remaining = maxCount - count;
|
|
16
|
+
if (remaining <= 10 && remaining > 0) {
|
|
17
|
+
const entityName = remaining === 1 ? singularEntityName : pluralEntityName;
|
|
18
|
+
return `${remaining} ${entityName} left.`;
|
|
19
|
+
}
|
|
20
|
+
if (remaining <= 0) {
|
|
21
|
+
return `Maximum ${pluralEntityName} reached.`;
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
exports.getAnnouncement = getAnnouncement;
|
|
@@ -34,13 +34,12 @@ const matches = (event, keysToMatch) => {
|
|
|
34
34
|
* @param keyObj - An object with key properties to match against.
|
|
35
35
|
* @returns `true` if the event or code matches the key definition.
|
|
36
36
|
*/
|
|
37
|
-
const match = (eventOrCode,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
} = _ref;
|
|
37
|
+
const match = (eventOrCode, {
|
|
38
|
+
key,
|
|
39
|
+
which,
|
|
40
|
+
keyCode,
|
|
41
|
+
code
|
|
42
|
+
}) => {
|
|
44
43
|
if (typeof eventOrCode === 'string') {
|
|
45
44
|
return eventOrCode === key;
|
|
46
45
|
}
|
|
@@ -30,5 +30,5 @@ interface UseControllableStateConfig<T> {
|
|
|
30
30
|
* Note: This hook will warn if the component switches between controlled and
|
|
31
31
|
* uncontrolled states.
|
|
32
32
|
*/
|
|
33
|
-
export declare const useControllableState: <T>({ defaultValue, name, onChange, value, }: UseControllableStateConfig<T>) => [T, (stateOrUpdater: T | ((prev: T) => T)) => void];
|
|
33
|
+
export declare const useControllableState: <T>({ defaultValue, name, onChange, value, }: UseControllableStateConfig<T>) => [T, (stateOrUpdater: T | ((prev: T) => T)) => void, boolean];
|
|
34
34
|
export {};
|
|
@@ -20,13 +20,12 @@ var warning = require('./warning.js');
|
|
|
20
20
|
* Note: This hook will warn if the component switches between controlled and
|
|
21
21
|
* uncontrolled states.
|
|
22
22
|
*/
|
|
23
|
-
const useControllableState =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} = _ref;
|
|
23
|
+
const useControllableState = ({
|
|
24
|
+
defaultValue,
|
|
25
|
+
name = 'custom',
|
|
26
|
+
onChange,
|
|
27
|
+
value
|
|
28
|
+
}) => {
|
|
30
29
|
const [state, internalSetState] = React.useState(typeof value !== 'undefined' ? value : defaultValue);
|
|
31
30
|
const controlled = React.useRef(null);
|
|
32
31
|
if (controlled.current === null) {
|
|
@@ -55,9 +54,9 @@ const useControllableState = _ref => {
|
|
|
55
54
|
}
|
|
56
55
|
}, [name, value]);
|
|
57
56
|
if (controlled.current === true) {
|
|
58
|
-
return [value, setState];
|
|
57
|
+
return [value, setState, controlled.current];
|
|
59
58
|
}
|
|
60
|
-
return [state, setState];
|
|
59
|
+
return [state, setState, controlled.current];
|
|
61
60
|
};
|
|
62
61
|
|
|
63
62
|
exports.useControllableState = useControllableState;
|
|
@@ -27,8 +27,7 @@ function useDelayedState(initialState) {
|
|
|
27
27
|
const timeoutId = React.useRef(null);
|
|
28
28
|
// We use `useCallback` to match the signature of React's `useState` which will
|
|
29
29
|
// always return the same reference for the `setState` updater
|
|
30
|
-
const setStateWithDelay = React.useCallback(
|
|
31
|
-
let delayMs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
30
|
+
const setStateWithDelay = React.useCallback((stateToSet, delayMs = 0) => {
|
|
32
31
|
window.clearTimeout(timeoutId.current ?? undefined);
|
|
33
32
|
timeoutId.current = null;
|
|
34
33
|
if (delayMs === 0) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* React hook that returns the current document language and updates on changes.
|
|
9
|
+
*
|
|
10
|
+
* @returns {string} The current document language code.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useDocumentLang(): string;
|
package/lib/internal/useId.js
CHANGED
|
@@ -38,8 +38,7 @@ const defaultId = 'id';
|
|
|
38
38
|
* @param {string} [prefix]
|
|
39
39
|
* @returns {string}
|
|
40
40
|
*/
|
|
41
|
-
function useCompatibleId() {
|
|
42
|
-
let prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultId;
|
|
41
|
+
function useCompatibleId(prefix = defaultId) {
|
|
43
42
|
const contextPrefix = useIdPrefix.useIdPrefix();
|
|
44
43
|
const [id, setId] = React.useState(() => {
|
|
45
44
|
if (serverHandoffCompleted) {
|
|
@@ -66,8 +65,7 @@ function useCompatibleId() {
|
|
|
66
65
|
* @param {string} [prefix]
|
|
67
66
|
* @returns {string}
|
|
68
67
|
*/
|
|
69
|
-
function useReactId() {
|
|
70
|
-
let prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultId;
|
|
68
|
+
function useReactId(prefix = defaultId) {
|
|
71
69
|
const contextPrefix = useIdPrefix.useIdPrefix();
|
|
72
70
|
return `${contextPrefix ? `${contextPrefix}-` : ``}${prefix}-${_React.useId()}`;
|
|
73
71
|
}
|
|
@@ -17,8 +17,7 @@ var React = require('react');
|
|
|
17
17
|
* @param defaultState - The initial state to return before the media query is evaluated. Defaults to `false`.
|
|
18
18
|
* @returns Whether the media query matches.
|
|
19
19
|
*/
|
|
20
|
-
const useMatchMedia =
|
|
21
|
-
let defaultState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
20
|
+
const useMatchMedia = (mediaQuery, defaultState = false) => {
|
|
22
21
|
const [matches, setMatches] = React.useState(defaultState);
|
|
23
22
|
React.useEffect(() => {
|
|
24
23
|
const listener = event => {
|
|
@@ -13,4 +13,4 @@ import { type ForwardedRef, type Ref } from 'react';
|
|
|
13
13
|
* accepts an array of refs and returns a callback ref that, when attached to a
|
|
14
14
|
* node, assigns that node to every ref in the array.
|
|
15
15
|
*/
|
|
16
|
-
export declare const useMergedRefs: <T>(refs: ForwardedRef<T>[]) => Ref<T>;
|
|
16
|
+
export declare const useMergedRefs: <T>(refs: (ForwardedRef<T> | undefined)[]) => Ref<T>;
|
|
@@ -11,8 +11,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
11
11
|
|
|
12
12
|
var React = require('react');
|
|
13
13
|
|
|
14
|
-
function useNoInteractiveChildren(ref) {
|
|
15
|
-
let message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'component should have no interactive child nodes';
|
|
14
|
+
function useNoInteractiveChildren(ref, message = 'component should have no interactive child nodes') {
|
|
16
15
|
if (process.env.NODE_ENV !== 'production') {
|
|
17
16
|
// TODO: https://github.com/carbon-design-system/carbon/issues/19005
|
|
18
17
|
/*
|
|
@@ -29,8 +28,7 @@ function useNoInteractiveChildren(ref) {
|
|
|
29
28
|
}, []);
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
|
-
function useInteractiveChildrenNeedDescription(ref) {
|
|
33
|
-
let message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : `interactive child node(s) should have an \`aria-describedby\` property`;
|
|
31
|
+
function useInteractiveChildrenNeedDescription(ref, message = `interactive child node(s) should have an \`aria-describedby\` property`) {
|
|
34
32
|
if (process.env.NODE_ENV !== 'production') {
|
|
35
33
|
// TODO: https://github.com/carbon-design-system/carbon/issues/19005
|
|
36
34
|
/*
|
|
@@ -28,16 +28,15 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
28
28
|
* helper messages, and conditionally provides the appropriate validation
|
|
29
29
|
* message and accompanying icon.
|
|
30
30
|
*/
|
|
31
|
-
const useNormalizedInputProps =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} = _ref;
|
|
31
|
+
const useNormalizedInputProps = ({
|
|
32
|
+
id,
|
|
33
|
+
readOnly,
|
|
34
|
+
disabled,
|
|
35
|
+
invalid,
|
|
36
|
+
invalidText,
|
|
37
|
+
warn,
|
|
38
|
+
warnText
|
|
39
|
+
}) => {
|
|
41
40
|
const prefix = usePrefix.usePrefix();
|
|
42
41
|
const normalizedProps = {
|
|
43
42
|
disabled: !readOnly && disabled,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025, 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { RefObject } from 'react';
|
|
8
|
+
export declare const useResizeObserver: ({ ref, onResize, }: {
|
|
9
|
+
ref: RefObject<HTMLElement>;
|
|
10
|
+
onResize?: (rect: DOMRectReadOnly) => void;
|
|
11
|
+
}) => {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
+
|
|
12
|
+
var React = require('react');
|
|
13
|
+
|
|
14
|
+
const useResizeObserver = ({
|
|
15
|
+
ref,
|
|
16
|
+
onResize
|
|
17
|
+
}) => {
|
|
18
|
+
const [width, setWidth] = React.useState(-1);
|
|
19
|
+
const [height, setHeight] = React.useState(-1);
|
|
20
|
+
const entriesToHandle = React.useRef(null);
|
|
21
|
+
const cb = React.useRef(onResize);
|
|
22
|
+
React.useEffect(() => {
|
|
23
|
+
// ref for onResize removes it as dependency from useLayoutEffect
|
|
24
|
+
// This significantly reduces repeated calls if a function is redefined on every
|
|
25
|
+
// render
|
|
26
|
+
cb.current = onResize;
|
|
27
|
+
}, [onResize]);
|
|
28
|
+
React.useEffect(() => {
|
|
29
|
+
const getInitialSize = () => {
|
|
30
|
+
if (ref.current) {
|
|
31
|
+
const refComputedStyle = window.getComputedStyle(ref.current);
|
|
32
|
+
const initialWidth = (ref.current?.offsetWidth ?? 0) - (typeof refComputedStyle?.paddingLeft === 'string' && refComputedStyle?.paddingLeft.length ? parseFloat(refComputedStyle?.paddingLeft) : 0) - (typeof refComputedStyle?.paddingRight === 'string' && refComputedStyle?.paddingRight.length ? parseFloat(refComputedStyle?.paddingRight) : 0);
|
|
33
|
+
const initialHeight = (ref.current?.offsetHeight ?? 0) - (typeof refComputedStyle?.paddingTop === 'string' && refComputedStyle?.paddingTop.length ? parseFloat(refComputedStyle?.paddingTop) : 0) - (typeof refComputedStyle?.paddingBottom === 'string' && refComputedStyle?.paddingBottom.length ? parseFloat(refComputedStyle?.paddingBottom) : 0);
|
|
34
|
+
setWidth(initialWidth);
|
|
35
|
+
setHeight(initialHeight);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
if (!ref?.current || width >= 0 && height >= 0) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
getInitialSize();
|
|
42
|
+
}, [width, height]);
|
|
43
|
+
React.useLayoutEffect(() => {
|
|
44
|
+
if (!ref?.current) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const doCallbacks = () => {
|
|
48
|
+
if (!ref?.current || !Array.isArray(entriesToHandle?.current)) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const entry = entriesToHandle.current[0];
|
|
52
|
+
setWidth(entry.contentRect.width);
|
|
53
|
+
setHeight(entry.contentRect.height);
|
|
54
|
+
cb.current && cb.current(entry.contentRect);
|
|
55
|
+
};
|
|
56
|
+
const observer = new ResizeObserver(entries => {
|
|
57
|
+
// always update entriesToHandle
|
|
58
|
+
entriesToHandle.current = entries;
|
|
59
|
+
window.requestAnimationFrame(() => {
|
|
60
|
+
// do callbacks
|
|
61
|
+
doCallbacks();
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// observe all refs passed
|
|
66
|
+
observer.observe(ref.current);
|
|
67
|
+
return () => {
|
|
68
|
+
observer.disconnect();
|
|
69
|
+
};
|
|
70
|
+
}, []);
|
|
71
|
+
return {
|
|
72
|
+
width,
|
|
73
|
+
height
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
exports.useResizeObserver = useResizeObserver;
|
|
@@ -24,9 +24,7 @@ const useSavedCallback = callback => {
|
|
|
24
24
|
React.useEffect(() => {
|
|
25
25
|
savedCallback.current = callback;
|
|
26
26
|
}, [callback]);
|
|
27
|
-
return React.useCallback(
|
|
28
|
-
return savedCallback.current ? savedCallback.current(...arguments) : undefined;
|
|
29
|
-
}, []);
|
|
27
|
+
return React.useCallback((...args) => savedCallback.current ? savedCallback.current(...args) : undefined, []);
|
|
30
28
|
};
|
|
31
29
|
|
|
32
30
|
exports.useSavedCallback = useSavedCallback;
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
|
-
var React = require('react');
|
|
13
12
|
var tabbable = require('tabbable');
|
|
14
13
|
var navigation = require('./keyboard/navigation.js');
|
|
15
14
|
|
|
@@ -35,8 +34,7 @@ const DOCUMENT_POSITION_BROAD_FOLLOWING = typeof Node !== 'undefined' ? Node.DOC
|
|
|
35
34
|
* @returns {boolean} Whether the node or one of its ancestors is in a floating
|
|
36
35
|
* menu.
|
|
37
36
|
*/
|
|
38
|
-
const elementOrParentIsFloatingMenu =
|
|
39
|
-
let selectorsFloatingMenus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
37
|
+
const elementOrParentIsFloatingMenu = (node, selectorsFloatingMenus = []) => {
|
|
40
38
|
if (node instanceof Element && typeof node.closest === 'function') {
|
|
41
39
|
const allSelectorsFloatingMenus = ['.cds--overflow-menu-options', '.cds--tooltip', '.flatpickr-calendar', ...selectorsFloatingMenus];
|
|
42
40
|
return allSelectorsFloatingMenus.some(selector => !!node.closest(selector));
|
|
@@ -48,36 +46,29 @@ const elementOrParentIsFloatingMenu = function (node) {
|
|
|
48
46
|
* Ensures the focus is kept within the given container by implementing
|
|
49
47
|
* "focus-wrap" behavior.
|
|
50
48
|
*/
|
|
51
|
-
const wrapFocus =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
} = _ref;
|
|
49
|
+
const wrapFocus = ({
|
|
50
|
+
bodyNode,
|
|
51
|
+
startTrapNode,
|
|
52
|
+
endTrapNode,
|
|
53
|
+
currentActiveNode,
|
|
54
|
+
oldActiveNode,
|
|
55
|
+
selectorsFloatingMenus
|
|
56
|
+
}) => {
|
|
60
57
|
if (bodyNode && currentActiveNode && oldActiveNode && !bodyNode.contains(currentActiveNode) && !elementOrParentIsFloatingMenu(currentActiveNode, selectorsFloatingMenus)) {
|
|
61
58
|
const comparisonResult = oldActiveNode.compareDocumentPosition(currentActiveNode);
|
|
62
59
|
if (currentActiveNode === startTrapNode || comparisonResult & DOCUMENT_POSITION_BROAD_PRECEDING) {
|
|
63
|
-
const tabbableElement = Array.from(bodyNode.querySelectorAll(navigation.selectorTabbable)).reverse().find(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
} = _ref2;
|
|
67
|
-
return Boolean(offsetParent);
|
|
68
|
-
});
|
|
60
|
+
const tabbableElement = Array.from(bodyNode.querySelectorAll(navigation.selectorTabbable)).reverse().find(({
|
|
61
|
+
offsetParent
|
|
62
|
+
}) => Boolean(offsetParent));
|
|
69
63
|
if (tabbableElement) {
|
|
70
64
|
tabbableElement.focus();
|
|
71
65
|
} else if (bodyNode !== oldActiveNode) {
|
|
72
66
|
bodyNode.focus();
|
|
73
67
|
}
|
|
74
68
|
} else if (currentActiveNode === endTrapNode || comparisonResult & DOCUMENT_POSITION_BROAD_FOLLOWING) {
|
|
75
|
-
const tabbableElement = Array.from(bodyNode.querySelectorAll(navigation.selectorTabbable)).find(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
} = _ref3;
|
|
79
|
-
return Boolean(offsetParent);
|
|
80
|
-
});
|
|
69
|
+
const tabbableElement = Array.from(bodyNode.querySelectorAll(navigation.selectorTabbable)).find(({
|
|
70
|
+
offsetParent
|
|
71
|
+
}) => Boolean(offsetParent));
|
|
81
72
|
if (tabbableElement) {
|
|
82
73
|
tabbableElement.focus();
|
|
83
74
|
} else if (bodyNode !== oldActiveNode) {
|
|
@@ -93,18 +84,15 @@ const wrapFocus = _ref => {
|
|
|
93
84
|
*
|
|
94
85
|
* Note: This must be called *before* focus moves using `onKeyDown` or similar.
|
|
95
86
|
*/
|
|
96
|
-
const wrapFocusWithoutSentinels =
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
} = _ref4;
|
|
87
|
+
const wrapFocusWithoutSentinels = ({
|
|
88
|
+
containerNode,
|
|
89
|
+
currentActiveNode,
|
|
90
|
+
event
|
|
91
|
+
}) => {
|
|
102
92
|
if (!containerNode) return;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
}, []);
|
|
93
|
+
if (['blur', 'focusout', 'focusin', 'focus'].includes(event.type) && process.env.NODE_ENV !== 'production') {
|
|
94
|
+
throw new Error(`Error: wrapFocusWithoutSentinels(...) called in unsupported ${event.type} event.\n\nCall wrapFocusWithoutSentinels(...) from onKeyDown instead.`);
|
|
95
|
+
}
|
|
108
96
|
|
|
109
97
|
// Use `tabbable` to get the focusable elements in tab order.
|
|
110
98
|
// `selectorTabbable` returns elements in DOM order which is why it's not
|
|
@@ -13,7 +13,7 @@ var warning = require('../internal/warning.js');
|
|
|
13
13
|
|
|
14
14
|
const didWarnAboutDeprecation = {};
|
|
15
15
|
function deprecate(propType, message) {
|
|
16
|
-
function checker(props, propName, componentName) {
|
|
16
|
+
function checker(props, propName, componentName, ...rest) {
|
|
17
17
|
if (props[propName] === undefined) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
@@ -24,9 +24,6 @@ function deprecate(propType, message) {
|
|
|
24
24
|
};
|
|
25
25
|
process.env.NODE_ENV !== "production" ? warning.warning(false, message || `The prop \`${propName}\` has been deprecated for the ` + `${componentName} component. It will be removed in the next major ` + `release`) : void 0;
|
|
26
26
|
}
|
|
27
|
-
for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
28
|
-
rest[_key - 3] = arguments[_key];
|
|
29
|
-
}
|
|
30
27
|
return propType(props, propName, componentName, ...rest);
|
|
31
28
|
}
|
|
32
29
|
return checker;
|
|
@@ -13,7 +13,7 @@ var warning = require('../internal/warning.js');
|
|
|
13
13
|
|
|
14
14
|
const didWarnAboutDeprecation = {};
|
|
15
15
|
function deprecateValuesWithin(propType, allowedValues, propMappingFunction) {
|
|
16
|
-
return function checker(props, propName, componentName) {
|
|
16
|
+
return function checker(props, propName, componentName, ...rest) {
|
|
17
17
|
if (props[propName] === undefined) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
@@ -29,9 +29,6 @@ function deprecateValuesWithin(propType, allowedValues, propMappingFunction) {
|
|
|
29
29
|
process.env.NODE_ENV !== "production" ? warning.warning(false, message) : void 0;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
33
|
-
rest[_key - 3] = arguments[_key];
|
|
34
|
-
}
|
|
35
32
|
return propType(props, propName, componentName, ...rest);
|
|
36
33
|
};
|
|
37
34
|
}
|
|
@@ -19,13 +19,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
19
19
|
*/
|
|
20
20
|
const isRequiredOneOf = propTypes => {
|
|
21
21
|
const names = Object.keys(propTypes);
|
|
22
|
-
const checker = propType =>
|
|
22
|
+
const checker = propType => (props, propName, componentName, ...rest) => {
|
|
23
23
|
if (process.env.NODE_ENV !== 'production' && names.every(name => typeof props[name] === 'undefined')) {
|
|
24
24
|
return new Error(`${componentName} requires one of the following props: ${names.join(', ')}`);
|
|
25
25
|
}
|
|
26
|
-
for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
27
|
-
rest[_key - 3] = arguments[_key];
|
|
28
|
-
}
|
|
29
26
|
return propType(props, propName, componentName, ...rest);
|
|
30
27
|
};
|
|
31
28
|
return names.reduce((acc, name) => ({
|
|
@@ -17,13 +17,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
17
17
|
* becomes required if the prop corresponding to the provided prop name exists.
|
|
18
18
|
*/
|
|
19
19
|
function requiredIfGivenPropIsTruthy(name, propType) {
|
|
20
|
-
return function check(props, propName, componentName) {
|
|
20
|
+
return function check(props, propName, componentName, ...rest) {
|
|
21
21
|
if (process.env.NODE_ENV !== 'production' && props[name] == true && props[propName] == null) {
|
|
22
22
|
return new Error(`You must provide a value for \`${propName}\` in \`${componentName}\` if \`${name}\` exists.`);
|
|
23
23
|
}
|
|
24
|
-
for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
25
|
-
rest[_key - 3] = arguments[_key];
|
|
26
|
-
}
|
|
27
24
|
return propType(props, propName, componentName, ...rest);
|
|
28
25
|
};
|
|
29
26
|
}
|
package/lib/tools/events.js
CHANGED
|
@@ -18,10 +18,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
18
18
|
* @param handlers - An array of event handler functions.
|
|
19
19
|
* @returns A composite event handler.
|
|
20
20
|
*/
|
|
21
|
-
const composeEventHandlers = handlers =>
|
|
22
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
23
|
-
args[_key - 1] = arguments[_key];
|
|
24
|
-
}
|
|
21
|
+
const composeEventHandlers = handlers => (event, ...args) => {
|
|
25
22
|
for (const handler of handlers) {
|
|
26
23
|
if (event.defaultPrevented) {
|
|
27
24
|
break;
|
package/lib/tools/mergeRefs.js
CHANGED
|
@@ -13,20 +13,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
13
13
|
* @param {...Ref<Element>} refs List of React refs to merge.
|
|
14
14
|
* @returns {Ref<Element>} Merged React ref.
|
|
15
15
|
*/
|
|
16
|
-
const mergeRefs =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} else if (Object(ref) === ref) {
|
|
26
|
-
ref.current = el;
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
};
|
|
16
|
+
const mergeRefs = (...refs) => el => {
|
|
17
|
+
refs.forEach(ref => {
|
|
18
|
+
// https://github.com/facebook/react/issues/13029#issuecomment-410002316
|
|
19
|
+
if (typeof ref === 'function') {
|
|
20
|
+
ref(el);
|
|
21
|
+
} else if (Object(ref) === ref) {
|
|
22
|
+
ref.current = el;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
30
25
|
};
|
|
31
26
|
var mergeRefs$1 = mergeRefs;
|
|
32
27
|
|