@carbon/react 1.92.0 → 1.93.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 +1011 -970
- package/es/components/AILabel/index.js +4 -4
- package/es/components/Breadcrumb/BreadcrumbItem.js +1 -1
- package/es/components/Button/Button.js +2 -2
- package/es/components/ChatButton/ChatButton.js +1 -1
- package/es/components/Checkbox/Checkbox.js +1 -1
- package/es/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/es/components/ComboBox/ComboBox.d.ts +3 -11
- package/es/components/ComboBox/ComboBox.js +15 -25
- package/es/components/ComboButton/index.d.ts +5 -8
- package/es/components/ComboButton/index.js +9 -12
- package/es/components/ComposedModal/ComposedModal.js +22 -36
- package/es/components/DataTable/DataTable.d.ts +25 -16
- package/es/components/DataTable/DataTable.js +33 -34
- package/es/components/DataTable/Table.js +2 -2
- package/es/components/DataTable/TableBatchActions.d.ts +49 -10
- package/es/components/DataTable/TableBatchActions.js +26 -21
- package/es/components/DataTable/TableExpandHeader.js +2 -2
- package/es/components/DataTable/TableExpandRow.js +1 -1
- package/es/components/DataTable/TableHeader.d.ts +8 -10
- package/es/components/DataTable/TableHeader.js +11 -13
- package/es/components/DataTable/TableRow.js +5 -5
- package/es/components/DataTable/TableSlugRow.js +1 -1
- package/es/components/DataTable/TableToolbarMenu.js +1 -1
- package/es/components/DataTable/TableToolbarSearch.d.ts +8 -7
- package/es/components/DataTable/TableToolbarSearch.js +11 -11
- package/es/components/DataTable/index.d.ts +2 -2
- package/es/components/DataTable/state/sorting.d.ts +2 -2
- package/es/components/DataTable/state/sorting.js +1 -1
- package/es/components/DataTable/tools/sorting.js +1 -1
- package/es/components/DatePicker/DatePicker.js +9 -9
- package/es/components/DatePickerInput/DatePickerInput.js +5 -5
- package/es/components/Dialog/Dialog.js +6 -6
- package/es/components/Dropdown/Dropdown.d.ts +1 -1
- package/es/components/Dropdown/Dropdown.js +8 -8
- package/es/components/ErrorBoundary/ErrorBoundaryContext.js +1 -1
- package/es/components/FileUploader/FileUploader.js +4 -4
- package/es/components/FileUploader/FileUploaderButton.js +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/es/components/FileUploader/FileUploaderItem.js +2 -2
- package/es/components/FluidComboBox/FluidComboBox.d.ts +4 -7
- package/es/components/FluidComboBox/FluidComboBox.js +1 -1
- package/es/components/FluidDropdown/FluidDropdown.d.ts +4 -8
- package/es/components/FluidDropdown/FluidDropdown.js +1 -1
- package/es/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +3 -7
- package/es/components/FluidMultiSelect/FluidMultiSelect.d.ts +3 -7
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +3 -3
- package/es/components/FluidNumberInput/FluidNumberInput.d.ts +4 -7
- package/es/components/FluidNumberInput/FluidNumberInput.js +2 -2
- package/es/components/FluidSearch/FluidSearch.js +1 -1
- package/es/components/FluidSelect/FluidSelect.js +1 -1
- package/es/components/FluidTextInput/FluidTextInput.js +1 -1
- package/es/components/FluidTimePicker/FluidTimePicker.js +3 -3
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +1 -1
- package/es/components/Grid/CSSGrid.js +3 -3
- package/es/components/Grid/Column.js +2 -2
- package/es/components/Grid/ColumnHang.js +1 -1
- package/es/components/Grid/FlexGrid.js +1 -1
- package/es/components/Grid/Row.js +1 -1
- package/es/components/Heading/index.js +2 -2
- package/es/components/IconButton/index.js +2 -2
- package/es/components/IconIndicator/index.js +2 -2
- package/es/components/InlineCheckbox/InlineCheckbox.js +1 -1
- package/es/components/Layout/index.js +2 -2
- package/es/components/LayoutDirection/LayoutDirection.js +1 -1
- package/es/components/Link/Link.js +2 -2
- package/es/components/ListBox/ListBoxField.d.ts +0 -1
- package/es/components/ListBox/ListBoxMenuIcon.d.ts +8 -4
- package/es/components/ListBox/ListBoxMenuIcon.js +10 -6
- package/es/components/ListBox/ListBoxMenuItem.js +2 -2
- package/es/components/ListBox/ListBoxSelection.d.ts +3 -6
- package/es/components/ListBox/ListBoxSelection.js +5 -10
- package/es/components/ListBox/index.d.ts +5 -3
- package/es/components/ListBox/next/ListBoxSelection.d.ts +6 -13
- package/es/components/ListBox/next/ListBoxSelection.js +16 -8
- package/es/components/ListBox/next/ListBoxTrigger.d.ts +5 -10
- package/es/components/ListBox/next/ListBoxTrigger.js +6 -6
- package/es/components/Menu/MenuContext.js +1 -1
- package/es/components/Menu/MenuItem.js +1 -1
- package/es/components/MenuButton/index.js +5 -5
- package/es/components/Modal/Modal.js +20 -36
- package/es/components/ModalWrapper/ModalWrapper.js +2 -2
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +3 -12
- package/es/components/MultiSelect/FilterableMultiSelect.js +18 -27
- package/es/components/MultiSelect/MultiSelect.d.ts +2 -2
- package/es/components/MultiSelect/MultiSelect.js +12 -12
- package/es/components/Notification/Notification.js +1 -1
- package/es/components/NumberInput/NumberInput.d.ts +2 -5
- package/es/components/NumberInput/NumberInput.js +13 -18
- package/es/components/OverflowMenu/OverflowMenu.d.ts +2 -2
- package/es/components/OverflowMenu/OverflowMenu.js +4 -4
- package/es/components/OverflowMenu/next/index.d.ts +1 -1
- package/es/components/OverflowMenu/next/index.js +2 -2
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
- package/es/components/PageHeader/PageHeader.js +12 -12
- package/es/components/Pagination/Pagination.js +3 -3
- package/es/components/PaginationNav/PaginationNav.d.ts +6 -9
- package/es/components/PaginationNav/PaginationNav.js +21 -22
- package/es/components/Popover/index.js +8 -8
- package/es/components/ProgressBar/ProgressBar.js +2 -2
- package/es/components/ProgressIndicator/ProgressIndicator.d.ts +11 -15
- package/es/components/ProgressIndicator/ProgressIndicator.js +15 -15
- package/es/components/RadioButton/RadioButton.js +1 -1
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/es/components/RadioTile/RadioTile.js +1 -1
- package/es/components/Select/Select.js +7 -5
- package/es/components/ShapeIndicator/index.js +2 -2
- package/es/components/Slider/Slider.d.ts +7 -9
- package/es/components/Slider/Slider.js +16 -20
- package/es/components/Stack/HStack.js +1 -1
- package/es/components/Stack/Stack.js +1 -1
- package/es/components/Stack/VStack.js +1 -1
- package/es/components/StructuredList/StructuredList.js +3 -3
- package/es/components/Tabs/Tabs.js +12 -12
- package/es/components/Tag/DismissibleTag.js +3 -3
- package/es/components/Tag/OperationalTag.js +2 -2
- package/es/components/Tag/SelectableTag.js +2 -2
- package/es/components/Tag/Tag.js +4 -4
- package/es/components/Tag/isEllipsisActive.js +1 -1
- package/es/components/Text/Text.js +1 -1
- package/es/components/TextArea/TextArea.js +1 -1
- package/es/components/TextInput/PasswordInput.js +4 -4
- package/es/components/TextInput/TextInput.js +3 -3
- package/es/components/Theme/index.js +3 -3
- package/es/components/Tile/Tile.js +3 -3
- package/es/components/TimePicker/TimePicker.js +1 -1
- package/es/components/Toggletip/index.js +4 -4
- package/es/components/Tooltip/DefinitionTooltip.js +1 -1
- package/es/components/Tooltip/Tooltip.js +3 -3
- package/es/components/TreeView/TreeNode.js +6 -6
- package/es/components/TreeView/TreeView.js +5 -5
- package/es/components/UIShell/HeaderContainer.js +1 -1
- package/es/components/UIShell/HeaderMenu.js +1 -1
- package/es/components/UIShell/Link.js +2 -2
- package/es/components/UIShell/SideNavItems.js +1 -1
- package/es/components/UIShell/Switcher.js +1 -1
- package/es/components/UIShell/SwitcherItem.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/internal/FloatingMenu.js +4 -4
- package/es/internal/Selection.js +6 -6
- package/es/internal/useMergedRefs.js +1 -1
- package/es/internal/useNoInteractiveChildren.js +4 -4
- package/es/internal/useOutsideClick.js +1 -1
- package/es/internal/useOverflowItems.js +6 -6
- package/es/internal/useResizeObserver.js +3 -3
- package/es/internal/useSavedCallback.js +1 -1
- package/es/internal/warning.js +1 -1
- package/es/prop-types/isRequiredOneOf.js +2 -2
- package/es/tools/events.js +1 -1
- package/es/tools/wrapComponent.js +1 -1
- package/es/types/common.d.ts +6 -2
- package/lib/components/AILabel/index.js +4 -4
- package/lib/components/Breadcrumb/BreadcrumbItem.js +1 -1
- package/lib/components/Button/Button.js +2 -2
- package/lib/components/ChatButton/ChatButton.js +1 -1
- package/lib/components/Checkbox/Checkbox.js +1 -1
- package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/lib/components/ComboBox/ComboBox.d.ts +3 -11
- package/lib/components/ComboBox/ComboBox.js +15 -25
- package/lib/components/ComboButton/index.d.ts +5 -8
- package/lib/components/ComboButton/index.js +9 -12
- package/lib/components/ComposedModal/ComposedModal.js +21 -35
- package/lib/components/DataTable/DataTable.d.ts +25 -16
- package/lib/components/DataTable/DataTable.js +33 -34
- package/lib/components/DataTable/Table.js +2 -2
- package/lib/components/DataTable/TableBatchActions.d.ts +49 -10
- package/lib/components/DataTable/TableBatchActions.js +26 -21
- package/lib/components/DataTable/TableExpandHeader.js +2 -2
- package/lib/components/DataTable/TableExpandRow.js +1 -1
- package/lib/components/DataTable/TableHeader.d.ts +8 -10
- package/lib/components/DataTable/TableHeader.js +11 -13
- package/lib/components/DataTable/TableRow.js +5 -5
- package/lib/components/DataTable/TableSlugRow.js +1 -1
- package/lib/components/DataTable/TableToolbarMenu.js +1 -1
- package/lib/components/DataTable/TableToolbarSearch.d.ts +8 -7
- package/lib/components/DataTable/TableToolbarSearch.js +11 -11
- package/lib/components/DataTable/index.d.ts +2 -2
- package/lib/components/DataTable/state/sorting.d.ts +2 -2
- package/lib/components/DataTable/state/sorting.js +1 -1
- package/lib/components/DataTable/tools/sorting.js +1 -1
- package/lib/components/DatePicker/DatePicker.js +9 -9
- package/lib/components/DatePickerInput/DatePickerInput.js +5 -5
- package/lib/components/Dialog/Dialog.js +6 -6
- package/lib/components/Dropdown/Dropdown.d.ts +1 -1
- package/lib/components/Dropdown/Dropdown.js +8 -8
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +1 -1
- package/lib/components/FileUploader/FileUploader.js +4 -4
- package/lib/components/FileUploader/FileUploaderButton.js +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -1
- package/lib/components/FileUploader/FileUploaderItem.js +2 -2
- package/lib/components/FluidComboBox/FluidComboBox.d.ts +4 -7
- package/lib/components/FluidComboBox/FluidComboBox.js +1 -1
- package/lib/components/FluidDropdown/FluidDropdown.d.ts +4 -8
- package/lib/components/FluidDropdown/FluidDropdown.js +1 -1
- package/lib/components/FluidMultiSelect/FluidFilterableMultiSelect.d.ts +3 -7
- package/lib/components/FluidMultiSelect/FluidMultiSelect.d.ts +3 -7
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +3 -3
- package/lib/components/FluidNumberInput/FluidNumberInput.d.ts +4 -7
- package/lib/components/FluidNumberInput/FluidNumberInput.js +2 -2
- package/lib/components/FluidSearch/FluidSearch.js +1 -1
- package/lib/components/FluidSelect/FluidSelect.js +1 -1
- package/lib/components/FluidTextInput/FluidTextInput.js +1 -1
- package/lib/components/FluidTimePicker/FluidTimePicker.js +3 -3
- package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +1 -1
- package/lib/components/Grid/CSSGrid.js +3 -3
- package/lib/components/Grid/Column.js +2 -2
- package/lib/components/Grid/ColumnHang.js +1 -1
- package/lib/components/Grid/FlexGrid.js +1 -1
- package/lib/components/Grid/Row.js +1 -1
- package/lib/components/Heading/index.js +2 -2
- package/lib/components/IconButton/index.js +2 -2
- package/lib/components/IconIndicator/index.js +2 -2
- package/lib/components/InlineCheckbox/InlineCheckbox.js +1 -1
- package/lib/components/Layout/index.js +2 -2
- package/lib/components/LayoutDirection/LayoutDirection.js +1 -1
- package/lib/components/Link/Link.js +2 -2
- package/lib/components/ListBox/ListBoxField.d.ts +0 -1
- package/lib/components/ListBox/ListBoxMenuIcon.d.ts +8 -4
- package/lib/components/ListBox/ListBoxMenuIcon.js +10 -6
- package/lib/components/ListBox/ListBoxMenuItem.js +2 -2
- package/lib/components/ListBox/ListBoxSelection.d.ts +3 -6
- package/lib/components/ListBox/ListBoxSelection.js +4 -10
- package/lib/components/ListBox/index.d.ts +5 -3
- package/lib/components/ListBox/next/ListBoxSelection.d.ts +6 -13
- package/lib/components/ListBox/next/ListBoxSelection.js +16 -8
- package/lib/components/ListBox/next/ListBoxTrigger.d.ts +5 -10
- package/lib/components/ListBox/next/ListBoxTrigger.js +5 -6
- package/lib/components/Menu/MenuContext.js +1 -1
- package/lib/components/Menu/MenuItem.js +1 -1
- package/lib/components/MenuButton/index.js +5 -5
- package/lib/components/Modal/Modal.js +19 -35
- package/lib/components/ModalWrapper/ModalWrapper.js +2 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +3 -12
- package/lib/components/MultiSelect/FilterableMultiSelect.js +18 -27
- package/lib/components/MultiSelect/MultiSelect.d.ts +2 -2
- package/lib/components/MultiSelect/MultiSelect.js +12 -12
- package/lib/components/Notification/Notification.js +1 -1
- package/lib/components/NumberInput/NumberInput.d.ts +2 -5
- package/lib/components/NumberInput/NumberInput.js +12 -18
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +2 -2
- package/lib/components/OverflowMenu/OverflowMenu.js +4 -4
- package/lib/components/OverflowMenu/next/index.d.ts +1 -1
- package/lib/components/OverflowMenu/next/index.js +2 -2
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +2 -2
- package/lib/components/PageHeader/PageHeader.js +12 -12
- package/lib/components/Pagination/Pagination.js +3 -3
- package/lib/components/PaginationNav/PaginationNav.d.ts +6 -9
- package/lib/components/PaginationNav/PaginationNav.js +21 -22
- package/lib/components/Popover/index.js +8 -8
- package/lib/components/ProgressBar/ProgressBar.js +2 -2
- package/lib/components/ProgressIndicator/ProgressIndicator.d.ts +11 -15
- package/lib/components/ProgressIndicator/ProgressIndicator.js +15 -15
- package/lib/components/RadioButton/RadioButton.js +1 -1
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/lib/components/RadioTile/RadioTile.js +1 -1
- package/lib/components/Select/Select.js +7 -5
- package/lib/components/ShapeIndicator/index.js +2 -2
- package/lib/components/Slider/Slider.d.ts +7 -9
- package/lib/components/Slider/Slider.js +16 -20
- package/lib/components/Stack/HStack.js +1 -1
- package/lib/components/Stack/Stack.js +1 -1
- package/lib/components/Stack/VStack.js +1 -1
- package/lib/components/StructuredList/StructuredList.js +3 -3
- package/lib/components/Tabs/Tabs.js +12 -12
- package/lib/components/Tag/DismissibleTag.js +3 -3
- package/lib/components/Tag/OperationalTag.js +2 -2
- package/lib/components/Tag/SelectableTag.js +2 -2
- package/lib/components/Tag/Tag.js +4 -4
- package/lib/components/Tag/isEllipsisActive.js +1 -1
- package/lib/components/Text/Text.js +1 -1
- package/lib/components/TextArea/TextArea.js +1 -1
- package/lib/components/TextInput/PasswordInput.js +4 -4
- package/lib/components/TextInput/TextInput.js +3 -3
- package/lib/components/Theme/index.js +3 -3
- package/lib/components/Tile/Tile.js +3 -3
- package/lib/components/TimePicker/TimePicker.js +1 -1
- package/lib/components/Toggletip/index.js +4 -4
- package/lib/components/Tooltip/DefinitionTooltip.js +1 -1
- package/lib/components/Tooltip/Tooltip.js +3 -3
- package/lib/components/TreeView/TreeNode.js +6 -6
- package/lib/components/TreeView/TreeView.js +5 -5
- package/lib/components/UIShell/HeaderContainer.js +1 -1
- package/lib/components/UIShell/HeaderMenu.js +1 -1
- package/lib/components/UIShell/Link.js +2 -2
- package/lib/components/UIShell/SideNavItems.js +1 -1
- package/lib/components/UIShell/Switcher.js +1 -1
- package/lib/components/UIShell/SwitcherItem.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/internal/FloatingMenu.js +4 -4
- package/lib/internal/Selection.js +6 -6
- package/lib/internal/useMergedRefs.js +1 -1
- package/lib/internal/useNoInteractiveChildren.js +4 -4
- package/lib/internal/useOutsideClick.js +1 -1
- package/lib/internal/useOverflowItems.js +6 -6
- package/lib/internal/useResizeObserver.js +3 -3
- package/lib/internal/useSavedCallback.js +1 -1
- package/lib/internal/warning.js +1 -1
- package/lib/prop-types/isRequiredOneOf.js +2 -2
- package/lib/tools/events.js +1 -1
- package/lib/tools/wrapComponent.js +1 -1
- package/lib/types/common.d.ts +6 -2
- package/package.json +9 -9
|
@@ -131,7 +131,7 @@ const PageHeaderContent = /*#__PURE__*/React.forwardRef(({
|
|
|
131
131
|
return element.offsetHeight < element.scrollHeight;
|
|
132
132
|
};
|
|
133
133
|
useLayoutEffect(() => {
|
|
134
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/
|
|
134
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
135
135
|
titleRef.current && isEllipsisActive(titleRef.current);
|
|
136
136
|
}, [title]);
|
|
137
137
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
@@ -203,7 +203,7 @@ PageHeaderContent.propTypes = {
|
|
|
203
203
|
|
|
204
204
|
const PageHeaderContentPageActions = ({
|
|
205
205
|
className,
|
|
206
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
206
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
207
207
|
children,
|
|
208
208
|
menuButtonLabel = 'Actions',
|
|
209
209
|
actions,
|
|
@@ -239,7 +239,7 @@ const PageHeaderContentPageActions = ({
|
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
});
|
|
242
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
242
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
243
243
|
}, []);
|
|
244
244
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
245
245
|
className: classNames,
|
|
@@ -383,26 +383,26 @@ const PageHeaderTabBar = /*#__PURE__*/React.forwardRef(({
|
|
|
383
383
|
sm: 4
|
|
384
384
|
}, children)));
|
|
385
385
|
}
|
|
386
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/
|
|
386
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
387
387
|
const [openPopover, setOpenPopover] = useState(false);
|
|
388
388
|
const tagSize = tags[0]?.size || 'md';
|
|
389
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/
|
|
389
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
390
390
|
const instanceId = useId('PageHeaderTabBar');
|
|
391
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/
|
|
391
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
392
392
|
const tagsWithIds = useMemo(() => {
|
|
393
393
|
return tags.map((tag, index) => ({
|
|
394
394
|
...tag,
|
|
395
395
|
id: tag.id || `tag-${index}-${instanceId}`
|
|
396
396
|
}));
|
|
397
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
397
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
398
398
|
}, [tags]);
|
|
399
399
|
|
|
400
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/
|
|
400
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
401
401
|
const tagsContainerRef = useRef(null);
|
|
402
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/
|
|
402
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
403
403
|
const offsetRef = useRef(null);
|
|
404
404
|
// To close popover when window resizes
|
|
405
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/
|
|
405
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
406
406
|
useEffect(() => {
|
|
407
407
|
const handleResize = () => {
|
|
408
408
|
// Close the popover when window resizes to prevent unwanted opens
|
|
@@ -419,14 +419,14 @@ const PageHeaderTabBar = /*#__PURE__*/React.forwardRef(({
|
|
|
419
419
|
visibleItems = [],
|
|
420
420
|
hiddenItems = [],
|
|
421
421
|
itemRefHandler = () => {}
|
|
422
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/
|
|
422
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
423
423
|
} = useOverflowItems(tagsWithIds, tagsContainerRef, offsetRef) || {
|
|
424
424
|
visibleItems: [],
|
|
425
425
|
hiddenItems: [],
|
|
426
426
|
itemRefHandler: () => {}
|
|
427
427
|
};
|
|
428
428
|
|
|
429
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/
|
|
429
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
430
430
|
const handleOverflowClick = useCallback(event => {
|
|
431
431
|
event.stopPropagation();
|
|
432
432
|
setOpenPopover(prev => !prev);
|
|
@@ -50,7 +50,7 @@ function getPageSize(pageSizes, pageSize) {
|
|
|
50
50
|
return pageSizes[0].value;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
53
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
54
54
|
const Pagination = /*#__PURE__*/React.forwardRef(({
|
|
55
55
|
backwardText = 'Previous page',
|
|
56
56
|
className: customClassName = '',
|
|
@@ -62,7 +62,7 @@ const Pagination = /*#__PURE__*/React.forwardRef(({
|
|
|
62
62
|
itemRangeText = (min, max, total) => `${min}–${max} of ${total} items`,
|
|
63
63
|
itemsPerPageText = 'Items per page:',
|
|
64
64
|
onChange,
|
|
65
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
66
66
|
pageNumberText: _pageNumberText = 'Page Number',
|
|
67
67
|
pageRangeText = (_current, total) => `of ${total} ${total === 1 ? 'page' : 'pages'}`,
|
|
68
68
|
page: controlledPage = 1,
|
|
@@ -125,7 +125,7 @@ const Pagination = /*#__PURE__*/React.forwardRef(({
|
|
|
125
125
|
handleFocus(focusTarget);
|
|
126
126
|
setFocusTarget(null);
|
|
127
127
|
}
|
|
128
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/
|
|
128
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
129
129
|
}, [focusTarget]);
|
|
130
130
|
|
|
131
131
|
// Sync state with props
|
|
@@ -5,19 +5,16 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import { TranslateWithId } from '../../types/common';
|
|
8
|
+
import type { TranslateWithId } from '../../types/common';
|
|
9
9
|
type TooltipAlignment = 'start' | 'center' | 'end';
|
|
10
10
|
type TooltipPosition = 'top' | 'right' | 'bottom' | 'left';
|
|
11
11
|
declare const translationIds: {
|
|
12
|
-
readonly 'carbon.pagination-nav.next': "
|
|
13
|
-
readonly 'carbon.pagination-nav.previous': "
|
|
14
|
-
readonly 'carbon.pagination-nav.item': "
|
|
15
|
-
readonly 'carbon.pagination-nav.active': "
|
|
16
|
-
readonly 'carbon.pagination-nav.of': "of";
|
|
12
|
+
readonly 'carbon.pagination-nav.next': "carbon.pagination-nav.next";
|
|
13
|
+
readonly 'carbon.pagination-nav.previous': "carbon.pagination-nav.previous";
|
|
14
|
+
readonly 'carbon.pagination-nav.item': "carbon.pagination-nav.item";
|
|
15
|
+
readonly 'carbon.pagination-nav.active': "carbon.pagination-nav.active";
|
|
16
|
+
readonly 'carbon.pagination-nav.of': "carbon.pagination-nav.of";
|
|
17
17
|
};
|
|
18
|
-
/**
|
|
19
|
-
* Message ids that will be passed to translateWithId().
|
|
20
|
-
*/
|
|
21
18
|
type TranslationKey = keyof typeof translationIds;
|
|
22
19
|
export interface DirectionButtonProps {
|
|
23
20
|
/**
|
|
@@ -18,20 +18,22 @@ import { clamp } from '../../internal/clamp.js';
|
|
|
18
18
|
|
|
19
19
|
var _CaretRight, _CaretLeft, _option;
|
|
20
20
|
const translationIds = {
|
|
21
|
-
'carbon.pagination-nav.next': '
|
|
22
|
-
'carbon.pagination-nav.previous': '
|
|
23
|
-
'carbon.pagination-nav.item': '
|
|
24
|
-
'carbon.pagination-nav.active': '
|
|
25
|
-
'carbon.pagination-nav.of': 'of'
|
|
21
|
+
'carbon.pagination-nav.next': 'carbon.pagination-nav.next',
|
|
22
|
+
'carbon.pagination-nav.previous': 'carbon.pagination-nav.previous',
|
|
23
|
+
'carbon.pagination-nav.item': 'carbon.pagination-nav.item',
|
|
24
|
+
'carbon.pagination-nav.active': 'carbon.pagination-nav.active',
|
|
25
|
+
'carbon.pagination-nav.of': 'carbon.pagination-nav.of'
|
|
26
|
+
};
|
|
27
|
+
const defaultTranslations = {
|
|
28
|
+
[translationIds['carbon.pagination-nav.next']]: 'Next',
|
|
29
|
+
[translationIds['carbon.pagination-nav.previous']]: 'Previous',
|
|
30
|
+
[translationIds['carbon.pagination-nav.item']]: 'Page',
|
|
31
|
+
[translationIds['carbon.pagination-nav.active']]: 'Active',
|
|
32
|
+
[translationIds['carbon.pagination-nav.of']]: 'of'
|
|
33
|
+
};
|
|
34
|
+
const defaultTranslateWithId = messageId => {
|
|
35
|
+
return defaultTranslations[messageId];
|
|
26
36
|
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Message ids that will be passed to translateWithId().
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
function translateWithId(messageId) {
|
|
33
|
-
return translationIds[messageId];
|
|
34
|
-
}
|
|
35
37
|
|
|
36
38
|
// https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
|
|
37
39
|
function usePrevious(value) {
|
|
@@ -88,7 +90,7 @@ function PaginationItem({
|
|
|
88
90
|
page,
|
|
89
91
|
isActive,
|
|
90
92
|
onClick,
|
|
91
|
-
translateWithId: t =
|
|
93
|
+
translateWithId: t = defaultTranslateWithId
|
|
92
94
|
}) {
|
|
93
95
|
const prefix = usePrefix();
|
|
94
96
|
const itemLabel = t('carbon.pagination-nav.item');
|
|
@@ -111,7 +113,7 @@ function PaginationOverflow({
|
|
|
111
113
|
count = NaN,
|
|
112
114
|
onSelect,
|
|
113
115
|
disableOverflow,
|
|
114
|
-
translateWithId: t =
|
|
116
|
+
translateWithId: t = defaultTranslateWithId
|
|
115
117
|
}) {
|
|
116
118
|
const prefix = usePrefix();
|
|
117
119
|
|
|
@@ -178,7 +180,7 @@ const PaginationNav = /*#__PURE__*/React.forwardRef(({
|
|
|
178
180
|
size = 'lg',
|
|
179
181
|
tooltipAlignment,
|
|
180
182
|
tooltipPosition,
|
|
181
|
-
translateWithId: t =
|
|
183
|
+
translateWithId: t = defaultTranslateWithId,
|
|
182
184
|
...rest
|
|
183
185
|
}, ref) => {
|
|
184
186
|
const smMediaQuery = `(max-width: ${breakpoints.sm.width})`;
|
|
@@ -379,8 +381,7 @@ PaginationItem.propTypes = {
|
|
|
379
381
|
*/
|
|
380
382
|
page: PropTypes.number,
|
|
381
383
|
/**
|
|
382
|
-
*
|
|
383
|
-
* and returns the localized string for the message
|
|
384
|
+
* Translates component strings using your i18n tool.
|
|
384
385
|
*/
|
|
385
386
|
translateWithId: PropTypes.func
|
|
386
387
|
};
|
|
@@ -398,8 +399,7 @@ PaginationOverflow.propTypes = {
|
|
|
398
399
|
*/
|
|
399
400
|
onSelect: PropTypes.func,
|
|
400
401
|
/**
|
|
401
|
-
*
|
|
402
|
-
* and returns the localized string for the message
|
|
402
|
+
* Translates component strings using your i18n tool.
|
|
403
403
|
*/
|
|
404
404
|
translateWithId: PropTypes.func
|
|
405
405
|
};
|
|
@@ -449,8 +449,7 @@ PaginationNav.propTypes = {
|
|
|
449
449
|
*/
|
|
450
450
|
totalItems: PropTypes.number,
|
|
451
451
|
/**
|
|
452
|
-
*
|
|
453
|
-
* and returns the localized string for the message
|
|
452
|
+
* Translates component strings using your i18n tool.
|
|
454
453
|
*/
|
|
455
454
|
translateWithId: PropTypes.func
|
|
456
455
|
};
|
|
@@ -48,10 +48,10 @@ const Popover = /*#__PURE__*/React.forwardRef(function PopoverRenderFunction({
|
|
|
48
48
|
open,
|
|
49
49
|
alignmentAxisOffset,
|
|
50
50
|
...rest
|
|
51
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
52
52
|
},
|
|
53
53
|
//this is a workaround, have to come back and fix this.
|
|
54
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
55
55
|
forwardRef) {
|
|
56
56
|
const prefix = usePrefix();
|
|
57
57
|
const floating = useRef(null);
|
|
@@ -94,9 +94,9 @@ forwardRef) {
|
|
|
94
94
|
// we look to see if any of the children has a className containing "slug"
|
|
95
95
|
const initialCaretHeight = React.Children.toArray(children).some(x => {
|
|
96
96
|
return (
|
|
97
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
98
98
|
x?.props?.className?.includes('slug') ||
|
|
99
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
100
100
|
x?.props?.className?.includes('ai-label')
|
|
101
101
|
);
|
|
102
102
|
}) ? 7 : 6;
|
|
@@ -217,7 +217,7 @@ forwardRef) {
|
|
|
217
217
|
[`${prefix}--popover--tab-tip`]: isTabTip
|
|
218
218
|
}, customClassName);
|
|
219
219
|
const mappedChildren = React.Children.map(children, child => {
|
|
220
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
220
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
221
221
|
const item = child;
|
|
222
222
|
const displayName = item?.type?.displayName;
|
|
223
223
|
|
|
@@ -232,13 +232,13 @@ forwardRef) {
|
|
|
232
232
|
const isTriggerComponent = enableFloatingStyles && displayName && ['ToggletipButton'].includes(displayName);
|
|
233
233
|
const isAllowedTriggerComponent = enableFloatingStyles && !['ToggletipContent', 'PopoverContent'].includes(displayName);
|
|
234
234
|
if (/*#__PURE__*/React.isValidElement(item) && (isTriggerElement || isTriggerComponent || isAllowedTriggerComponent)) {
|
|
235
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
235
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
236
236
|
const className = item?.props?.className;
|
|
237
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
237
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
238
238
|
const ref = (item?.props).ref;
|
|
239
239
|
const tabTipClasses = cx(`${prefix}--popover--tab-tip__button`, className);
|
|
240
240
|
|
|
241
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/
|
|
241
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
242
242
|
return /*#__PURE__*/React.cloneElement(item, {
|
|
243
243
|
className: isTabTip && item?.type === 'button' ? tabTipClasses : className || '',
|
|
244
244
|
// With cloneElement, if you pass a `ref`, it overrides the original ref.
|
|
@@ -55,7 +55,7 @@ function ProgressBar({
|
|
|
55
55
|
});
|
|
56
56
|
let StatusIcon = null;
|
|
57
57
|
if (isError) {
|
|
58
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
58
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
59
59
|
StatusIcon = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
60
60
|
return /*#__PURE__*/React.createElement(ErrorFilled, _extends({
|
|
61
61
|
ref: ref,
|
|
@@ -63,7 +63,7 @@ function ProgressBar({
|
|
|
63
63
|
}, props));
|
|
64
64
|
});
|
|
65
65
|
} else if (isFinished) {
|
|
66
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
66
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
67
67
|
StatusIcon = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
68
68
|
return /*#__PURE__*/React.createElement(CheckmarkFilled, _extends({
|
|
69
69
|
ref: ref,
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2016,
|
|
2
|
+
* Copyright IBM Corp. 2016, 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
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import { TranslateWithId } from '../../types/common';
|
|
10
|
-
declare const
|
|
11
|
-
readonly 'carbon.progress-step.complete': "
|
|
12
|
-
readonly 'carbon.progress-step.incomplete': "
|
|
13
|
-
readonly 'carbon.progress-step.current': "
|
|
14
|
-
readonly 'carbon.progress-step.invalid': "
|
|
9
|
+
import type { TranslateWithId } from '../../types/common';
|
|
10
|
+
declare const translationIds: {
|
|
11
|
+
readonly 'carbon.progress-step.complete': "carbon.progress-step.complete";
|
|
12
|
+
readonly 'carbon.progress-step.incomplete': "carbon.progress-step.incomplete";
|
|
13
|
+
readonly 'carbon.progress-step.current': "carbon.progress-step.current";
|
|
14
|
+
readonly 'carbon.progress-step.invalid': "carbon.progress-step.invalid";
|
|
15
15
|
};
|
|
16
|
-
|
|
17
|
-
* Message ids that will be passed to translateWithId().
|
|
18
|
-
*/
|
|
19
|
-
type TranslationKey = keyof typeof defaultTranslations;
|
|
16
|
+
type TranslationKey = keyof typeof translationIds;
|
|
20
17
|
export interface ProgressIndicatorProps extends Omit<React.HTMLAttributes<HTMLUListElement>, 'onChange'> {
|
|
21
18
|
/**
|
|
22
19
|
* Provide `<ProgressStep>` components to be rendered in the
|
|
@@ -32,7 +29,7 @@ export interface ProgressIndicatorProps extends Omit<React.HTMLAttributes<HTMLUL
|
|
|
32
29
|
*/
|
|
33
30
|
currentIndex?: number;
|
|
34
31
|
/**
|
|
35
|
-
* Optional callback called if a ProgressStep is clicked on.
|
|
32
|
+
* Optional callback called if a ProgressStep is clicked on. Returns the index of the step.
|
|
36
33
|
*/
|
|
37
34
|
onChange?: (data: number) => void;
|
|
38
35
|
/**
|
|
@@ -61,7 +58,7 @@ declare namespace ProgressIndicator {
|
|
|
61
58
|
*/
|
|
62
59
|
currentIndex: PropTypes.Requireable<number>;
|
|
63
60
|
/**
|
|
64
|
-
* Optional callback called if a ProgressStep is clicked on.
|
|
61
|
+
* Optional callback called if a ProgressStep is clicked on. Returns the index of the step.
|
|
65
62
|
*/
|
|
66
63
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
67
64
|
/**
|
|
@@ -176,8 +173,7 @@ declare namespace ProgressStep {
|
|
|
176
173
|
*/
|
|
177
174
|
tooltipId: PropTypes.Requireable<string>;
|
|
178
175
|
/**
|
|
179
|
-
*
|
|
180
|
-
* internationalized string.
|
|
176
|
+
* Translates component strings using your i18n tool.
|
|
181
177
|
*/
|
|
182
178
|
translateWithId: PropTypes.Requireable<(...args: any[]) => any>;
|
|
183
179
|
};
|
|
@@ -16,20 +16,21 @@ import { usePrefix } from '../../internal/usePrefix.js';
|
|
|
16
16
|
import { Text } from '../Text/Text.js';
|
|
17
17
|
import '../Text/TextDirection.js';
|
|
18
18
|
|
|
19
|
+
const translationIds = {
|
|
20
|
+
'carbon.progress-step.complete': 'carbon.progress-step.complete',
|
|
21
|
+
'carbon.progress-step.incomplete': 'carbon.progress-step.incomplete',
|
|
22
|
+
'carbon.progress-step.current': 'carbon.progress-step.current',
|
|
23
|
+
'carbon.progress-step.invalid': 'carbon.progress-step.invalid'
|
|
24
|
+
};
|
|
19
25
|
const defaultTranslations = {
|
|
20
|
-
'carbon.progress-step.complete': 'Complete',
|
|
21
|
-
'carbon.progress-step.incomplete': 'Incomplete',
|
|
22
|
-
'carbon.progress-step.current': 'Current',
|
|
23
|
-
'carbon.progress-step.invalid': 'Invalid'
|
|
26
|
+
[translationIds['carbon.progress-step.complete']]: 'Complete',
|
|
27
|
+
[translationIds['carbon.progress-step.incomplete']]: 'Incomplete',
|
|
28
|
+
[translationIds['carbon.progress-step.current']]: 'Current',
|
|
29
|
+
[translationIds['carbon.progress-step.invalid']]: 'Invalid'
|
|
24
30
|
};
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Message ids that will be passed to translateWithId().
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
function translateWithId(messageId) {
|
|
31
|
+
const defaultTranslateWithId = messageId => {
|
|
31
32
|
return defaultTranslations[messageId];
|
|
32
|
-
}
|
|
33
|
+
};
|
|
33
34
|
function ProgressIndicator({
|
|
34
35
|
children,
|
|
35
36
|
className: customClassName,
|
|
@@ -101,7 +102,7 @@ ProgressIndicator.propTypes = {
|
|
|
101
102
|
*/
|
|
102
103
|
currentIndex: PropTypes.number,
|
|
103
104
|
/**
|
|
104
|
-
* Optional callback called if a ProgressStep is clicked on.
|
|
105
|
+
* Optional callback called if a ProgressStep is clicked on. Returns the index of the step.
|
|
105
106
|
*/
|
|
106
107
|
onChange: PropTypes.func,
|
|
107
108
|
/**
|
|
@@ -123,7 +124,7 @@ function ProgressStep({
|
|
|
123
124
|
secondaryLabel,
|
|
124
125
|
disabled,
|
|
125
126
|
onClick,
|
|
126
|
-
translateWithId: t =
|
|
127
|
+
translateWithId: t = defaultTranslateWithId,
|
|
127
128
|
...rest
|
|
128
129
|
}) {
|
|
129
130
|
const prefix = usePrefix();
|
|
@@ -253,8 +254,7 @@ ProgressStep.propTypes = {
|
|
|
253
254
|
*/
|
|
254
255
|
tooltipId: PropTypes.string,
|
|
255
256
|
/**
|
|
256
|
-
*
|
|
257
|
-
* internationalized string.
|
|
257
|
+
* Translates component strings using your i18n tool.
|
|
258
258
|
*/
|
|
259
259
|
translateWithId: PropTypes.func
|
|
260
260
|
};
|
|
@@ -53,7 +53,7 @@ const RadioButton = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
53
53
|
const candidateIsAILabel = isComponentElement(candidate, AILabel);
|
|
54
54
|
const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/cloneElement(candidate, {
|
|
55
55
|
size: candidate.props?.['kind'] === 'inline' ? 'md' : 'mini'
|
|
56
|
-
}) :
|
|
56
|
+
}) : candidate;
|
|
57
57
|
return /*#__PURE__*/React.createElement("div", {
|
|
58
58
|
className: wrapperClasses
|
|
59
59
|
}, /*#__PURE__*/React.createElement("input", _extends({}, rest, {
|
|
@@ -110,7 +110,7 @@ const RadioButtonGroup = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
110
110
|
const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/cloneElement(candidate, {
|
|
111
111
|
size: 'mini',
|
|
112
112
|
kind: 'default'
|
|
113
|
-
}) :
|
|
113
|
+
}) : candidate;
|
|
114
114
|
return /*#__PURE__*/React.createElement("div", {
|
|
115
115
|
className: wrapperClasses,
|
|
116
116
|
ref: mergeRefs(divRef, ref)
|
|
@@ -78,7 +78,7 @@ const RadioTile = /*#__PURE__*/React.forwardRef(({
|
|
|
78
78
|
const candidateIsAILabel = isComponentElement(candidate, AILabel);
|
|
79
79
|
const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/cloneElement(candidate, {
|
|
80
80
|
size: 'xs'
|
|
81
|
-
}) :
|
|
81
|
+
}) : candidate;
|
|
82
82
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
|
|
83
83
|
checked: checked,
|
|
84
84
|
className: `${prefix}--tile-input`,
|
|
@@ -53,11 +53,13 @@ const Select = /*#__PURE__*/React.forwardRef(({
|
|
|
53
53
|
// Convert children to an array of valid elements once using type narrowing
|
|
54
54
|
const validChildren = React.Children.toArray(children).filter(child => /*#__PURE__*/React.isValidElement(child));
|
|
55
55
|
|
|
56
|
-
// Find the default option based on the specified defaultValue
|
|
57
|
-
const
|
|
56
|
+
// Find the default option based on the specified defaultValue or value
|
|
57
|
+
const selectedValue = other?.value || other?.defaultValue;
|
|
58
|
+
const selectedOption = validChildren.find(child => child.props?.value === selectedValue);
|
|
58
59
|
|
|
59
|
-
// Use the
|
|
60
|
-
|
|
60
|
+
// Use the provided title prop, or the selected option's text if available;
|
|
61
|
+
// otherwise, fallback to the first option's text
|
|
62
|
+
const initialTitle = other?.title || selectedOption?.props?.text || validChildren[0]?.props?.text || '';
|
|
61
63
|
const [title, setTitle] = useState(initialTitle);
|
|
62
64
|
const selectClasses = cx({
|
|
63
65
|
[`${prefix}--select`]: true,
|
|
@@ -139,7 +141,7 @@ const Select = /*#__PURE__*/React.forwardRef(({
|
|
|
139
141
|
const candidateIsAILabel = isComponentElement(candidate, AILabel);
|
|
140
142
|
const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/cloneElement(candidate, {
|
|
141
143
|
size: 'mini'
|
|
142
|
-
}) :
|
|
144
|
+
}) : candidate;
|
|
143
145
|
const input = (() => {
|
|
144
146
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("select", _extends({}, other, ariaProps, {
|
|
145
147
|
id: id,
|
|
@@ -46,13 +46,13 @@ const shapeTypes = {
|
|
|
46
46
|
incomplete: incompleteIcon,
|
|
47
47
|
draft: CircleStroke
|
|
48
48
|
};
|
|
49
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
49
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
50
50
|
const ShapeIndicator = /*#__PURE__*/React.forwardRef(({
|
|
51
51
|
className: customClassName,
|
|
52
52
|
kind,
|
|
53
53
|
label,
|
|
54
54
|
textSize = 12,
|
|
55
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
56
56
|
...rest
|
|
57
57
|
}, ref) => {
|
|
58
58
|
const prefix = usePrefix();
|
|
@@ -6,22 +6,20 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { type InputHTMLAttributes, type KeyboardEventHandler, type ReactNode } from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
|
-
import { TranslateWithId } from '../../types/common';
|
|
9
|
+
import type { TranslateWithId } from '../../types/common';
|
|
10
10
|
declare const translationIds: {
|
|
11
|
-
readonly
|
|
11
|
+
readonly 'carbon.slider.auto-correct-announcement': "carbon.slider.auto-correct-announcement";
|
|
12
|
+
};
|
|
13
|
+
type TranslationKey = keyof typeof translationIds;
|
|
14
|
+
type TranslationArgs = {
|
|
15
|
+
correctedValue?: string;
|
|
12
16
|
};
|
|
13
|
-
/**
|
|
14
|
-
* Message ids that will be passed to translateWithId().
|
|
15
|
-
*/
|
|
16
|
-
type TranslationKey = (typeof translationIds)[keyof typeof translationIds];
|
|
17
17
|
declare enum HandlePosition {
|
|
18
18
|
LOWER = "lower",
|
|
19
19
|
UPPER = "upper"
|
|
20
20
|
}
|
|
21
21
|
type ExcludedAttributes = 'onChange' | 'onBlur';
|
|
22
|
-
export interface SliderProps extends Omit<InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes>, TranslateWithId<TranslationKey, {
|
|
23
|
-
correctedValue?: string;
|
|
24
|
-
}> {
|
|
22
|
+
export interface SliderProps extends Omit<InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes>, TranslateWithId<TranslationKey, TranslationArgs> {
|
|
25
23
|
/**
|
|
26
24
|
* The `ariaLabel` for the `<input>`.
|
|
27
25
|
*/
|
|
@@ -42,22 +42,18 @@ const ThumbWrapper = ({
|
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
const translationIds = {
|
|
45
|
-
|
|
45
|
+
'carbon.slider.auto-correct-announcement': 'carbon.slider.auto-correct-announcement'
|
|
46
46
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const {
|
|
55
|
-
correctedValue
|
|
56
|
-
} = translationState;
|
|
57
|
-
return `The inputted value "${correctedValue}" was corrected to the nearest allowed digit.`;
|
|
47
|
+
const defaultTranslations = {
|
|
48
|
+
[translationIds['carbon.slider.auto-correct-announcement']]: 'The inputted value "{correctedValue}" was corrected to the nearest allowed digit.'
|
|
49
|
+
};
|
|
50
|
+
const defaultTranslateWithId = (messageId, args) => {
|
|
51
|
+
const template = defaultTranslations[messageId];
|
|
52
|
+
if (args?.correctedValue) {
|
|
53
|
+
return template.replace('{correctedValue}', args.correctedValue);
|
|
58
54
|
}
|
|
59
|
-
return
|
|
60
|
-
}
|
|
55
|
+
return template;
|
|
56
|
+
};
|
|
61
57
|
const defaultFormatLabel = (value, label) => {
|
|
62
58
|
return `${value}${label ?? ''}`;
|
|
63
59
|
};
|
|
@@ -693,7 +689,7 @@ const Slider = props => {
|
|
|
693
689
|
min,
|
|
694
690
|
max
|
|
695
691
|
} = props;
|
|
696
|
-
const numSteps = Math.floor((max - min) / step) +
|
|
692
|
+
const numSteps = Math.floor((max - min) / step) + 1;
|
|
697
693
|
/** Index of the step that corresponds to `leftPercent`. */
|
|
698
694
|
const stepIndex = Math.round(leftPercent * (numSteps - 1));
|
|
699
695
|
const discreteValue = stepIndex === numSteps - 1 ? max : min + step * stepIndex;
|
|
@@ -955,7 +951,7 @@ const Slider = props => {
|
|
|
955
951
|
hideLabel,
|
|
956
952
|
step = 1,
|
|
957
953
|
// TODO: Other properties are deleted below. Why isn't this one?
|
|
958
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/
|
|
954
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
959
955
|
stepMultiplier: _stepMultiplier,
|
|
960
956
|
inputType = 'number',
|
|
961
957
|
invalidText,
|
|
@@ -967,7 +963,7 @@ const Slider = props => {
|
|
|
967
963
|
readOnly = false,
|
|
968
964
|
warn,
|
|
969
965
|
warnText,
|
|
970
|
-
translateWithId: t =
|
|
966
|
+
translateWithId: t = defaultTranslateWithId,
|
|
971
967
|
...other
|
|
972
968
|
} = props;
|
|
973
969
|
delete other.onRelease;
|
|
@@ -984,11 +980,11 @@ const Slider = props => {
|
|
|
984
980
|
} = state;
|
|
985
981
|
const showWarning = !readOnly && warn ||
|
|
986
982
|
// TODO: https://github.com/carbon-design-system/carbon/issues/18991#issuecomment-2795709637
|
|
987
|
-
// eslint-disable-next-line valid-typeof , no-constant-binary-expression -- https://github.com/carbon-design-system/carbon/issues/
|
|
983
|
+
// eslint-disable-next-line valid-typeof , no-constant-binary-expression -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
988
984
|
typeof correctedValue !== null && correctedPosition === HandlePosition.LOWER && isValid;
|
|
989
985
|
const showWarningUpper = !readOnly && warn ||
|
|
990
986
|
// TODO: https://github.com/carbon-design-system/carbon/issues/18991#issuecomment-2795709637
|
|
991
|
-
// eslint-disable-next-line valid-typeof, no-constant-binary-expression -- https://github.com/carbon-design-system/carbon/issues/
|
|
987
|
+
// eslint-disable-next-line valid-typeof, no-constant-binary-expression -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
992
988
|
typeof correctedValue !== null && correctedPosition === (twoHandles ? HandlePosition.UPPER : HandlePosition.LOWER) && (twoHandles ? isValidUpper : isValid);
|
|
993
989
|
return /*#__PURE__*/React.createElement(PrefixContext.Consumer, null, prefix => {
|
|
994
990
|
const labelId = `${id}-label`;
|
|
@@ -1196,7 +1192,7 @@ const Slider = props => {
|
|
|
1196
1192
|
as: "div",
|
|
1197
1193
|
role: "alert",
|
|
1198
1194
|
className: cx(`${prefix}--slider__status-msg`, `${prefix}--form-requirement`)
|
|
1199
|
-
}, t(translationIds.
|
|
1195
|
+
}, t(translationIds['carbon.slider.auto-correct-announcement'], {
|
|
1200
1196
|
correctedValue
|
|
1201
1197
|
})));
|
|
1202
1198
|
});
|
|
@@ -9,7 +9,7 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import React, { forwardRef } from 'react';
|
|
10
10
|
import { Stack } from './Stack.js';
|
|
11
11
|
|
|
12
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
12
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
13
13
|
const HStack = /*#__PURE__*/forwardRef((props, ref) => {
|
|
14
14
|
return /*#__PURE__*/React.createElement(Stack, _extends({}, props, {
|
|
15
15
|
ref: ref,
|
|
@@ -35,7 +35,7 @@ const SPACING_STEPS = Array.from({
|
|
|
35
35
|
* - https://paste.twilio.design/layout/stack/
|
|
36
36
|
* - https://github.com/Workday/canvas-kit/blob/f2f599654876700f483a1d8c5de82a41315c76f1/modules/labs-react/layout/lib/Stack.tsx
|
|
37
37
|
*/
|
|
38
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
38
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
39
39
|
const Stack = /*#__PURE__*/forwardRef((props, ref) => {
|
|
40
40
|
const {
|
|
41
41
|
as: BaseComponent = 'div',
|
|
@@ -9,7 +9,7 @@ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js
|
|
|
9
9
|
import React, { forwardRef } from 'react';
|
|
10
10
|
import { Stack } from './Stack.js';
|
|
11
11
|
|
|
12
|
-
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/
|
|
12
|
+
// eslint-disable-next-line react/display-name -- https://github.com/carbon-design-system/carbon/issues/20452
|
|
13
13
|
const VStack = /*#__PURE__*/forwardRef((props, ref) => {
|
|
14
14
|
return /*#__PURE__*/React.createElement(Stack, _extends({}, props, {
|
|
15
15
|
ref: ref,
|