@carbon/react 1.29.0 → 1.30.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/_virtual/_rollupPluginBabelHelpers.js +16 -5
- package/es/components/Accordion/Accordion.Skeleton.js +0 -7
- package/es/components/Accordion/Accordion.js +1 -8
- package/es/components/Accordion/AccordionItem.js +5 -19
- package/es/components/AspectRatio/AspectRatio.js +0 -5
- package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +0 -3
- package/es/components/Breadcrumb/Breadcrumb.js +0 -3
- package/es/components/Breadcrumb/BreadcrumbItem.js +0 -7
- package/es/components/Button/Button.Skeleton.js +2 -7
- package/es/components/Button/Button.js +2 -36
- package/es/components/ButtonSet/ButtonSet.js +0 -2
- package/es/components/Checkbox/Checkbox.Skeleton.js +0 -1
- package/es/components/Checkbox/Checkbox.js +4 -20
- package/es/components/CheckboxGroup/CheckboxGroup.js +0 -11
- package/es/components/ClassPrefix/index.d.ts +26 -0
- package/es/components/ClassPrefix/index.js +0 -2
- package/es/components/CodeSnippet/CodeSnippet.Skeleton.js +0 -5
- package/es/components/CodeSnippet/CodeSnippet.js +6 -45
- package/es/components/ComboBox/ComboBox.js +12 -79
- package/es/components/ComboBox/tools/filter.js +0 -1
- package/es/components/ComboButton/index.js +0 -14
- package/es/components/ComposedModal/ComposedModal.js +2 -32
- package/es/components/ComposedModal/ModalFooter.js +0 -21
- package/es/components/ComposedModal/ModalHeader.js +0 -12
- package/es/components/ContainedList/ContainedList.js +5 -32
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +0 -6
- package/es/components/ContentSwitcher/ContentSwitcher.js +11 -23
- package/es/components/ContextMenu/useContextMenu.js +1 -6
- package/es/components/Copy/Copy.js +8 -31
- package/es/components/CopyButton/CopyButton.js +0 -4
- package/es/components/DangerButton/DangerButton.js +0 -1
- package/es/components/DataTable/DataTable.js +171 -91
- package/es/components/DataTable/Table.js +0 -6
- package/es/components/DataTable/TableBatchAction.js +0 -4
- package/es/components/DataTable/TableBatchActions.js +0 -8
- package/es/components/DataTable/TableBody.js +0 -1
- package/es/components/DataTable/TableContainer.js +0 -5
- package/es/components/DataTable/TableExpandHeader.js +0 -7
- package/es/components/DataTable/TableExpandRow.js +0 -6
- package/es/components/DataTable/TableExpandedRow.js +0 -6
- package/es/components/DataTable/TableHeader.d.ts +1 -1
- package/es/components/DataTable/TableHeader.js +3 -19
- package/es/components/DataTable/TableRow.js +4 -5
- package/es/components/DataTable/TableSelectAll.js +0 -8
- package/es/components/DataTable/TableSelectRow.js +2 -10
- package/es/components/DataTable/TableToolbar.js +0 -3
- package/es/components/DataTable/TableToolbarMenu.d.ts +1 -1
- package/es/components/DataTable/TableToolbarMenu.js +3 -6
- package/es/components/DataTable/TableToolbarSearch.js +2 -30
- package/es/components/DataTable/state/getDerivedStateFromProps.js +0 -4
- package/es/components/DataTable/state/sorting.js +5 -8
- package/es/components/DataTable/tools/denormalize.js +2 -2
- package/es/components/DataTable/tools/filter.js +0 -2
- package/es/components/DataTable/tools/instanceId.js +0 -1
- package/es/components/DataTable/tools/normalize.js +10 -10
- package/es/components/DataTable/tools/sorting.js +5 -13
- package/es/components/DataTableSkeleton/DataTableSkeleton.js +5 -20
- package/es/components/DatePicker/DatePicker.Skeleton.js +0 -6
- package/es/components/DatePicker/DatePicker.js +154 -177
- package/es/components/DatePicker/plugins/appendToPlugin.js +3 -7
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +14 -25
- package/es/components/DatePicker/plugins/rangePlugin.js +2 -7
- package/es/components/DatePickerInput/DatePickerInput.js +2 -28
- package/es/components/Dropdown/Dropdown.Skeleton.js +0 -2
- package/es/components/Dropdown/Dropdown.js +43 -52
- package/es/components/ErrorBoundary/ErrorBoundary.js +0 -10
- package/es/components/ErrorBoundary/ErrorBoundaryContext.js +0 -1
- package/es/components/ExpandableSearch/ExpandableSearch.js +1 -10
- package/es/components/FeatureFlags/index.js +8 -20
- package/es/components/FileUploader/FileUploader.Skeleton.js +0 -2
- package/es/components/FileUploader/FileUploader.js +3 -38
- package/es/components/FileUploader/FileUploaderButton.js +3 -24
- package/es/components/FileUploader/FileUploaderDropContainer.js +1 -28
- package/es/components/FileUploader/FileUploaderItem.js +1 -11
- package/es/components/FileUploader/Filename.js +0 -10
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +0 -1
- package/es/components/FluidComboBox/FluidComboBox.js +0 -18
- package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.js +0 -2
- package/es/components/FluidDatePicker/FluidDatePicker.js +0 -6
- package/es/components/FluidDatePickerInput/FluidDatePickerInput.js +2 -1
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +0 -1
- package/es/components/FluidDropdown/FluidDropdown.js +0 -18
- package/es/components/FluidForm/FluidForm.js +0 -2
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +0 -1
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +0 -19
- package/es/components/FluidSelect/FluidSelect.Skeleton.js +0 -1
- package/es/components/FluidSelect/FluidSelect.js +0 -10
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +0 -1
- package/es/components/FluidTextArea/FluidTextArea.js +0 -20
- package/es/components/FluidTextInput/FluidTextInput.Skeleton.js +0 -1
- package/es/components/FluidTextInput/FluidTextInput.js +0 -14
- package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.js +0 -3
- package/es/components/FluidTimePicker/FluidTimePicker.js +1 -11
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +0 -6
- package/es/components/Form/Form.d.ts +23 -0
- package/es/components/Form/Form.js +3 -6
- package/es/components/Form/index.d.ts +7 -0
- package/es/components/FormGroup/FormGroup.js +0 -7
- package/es/components/FormItem/FormItem.js +0 -2
- package/es/components/FormLabel/FormLabel.js +1 -7
- package/es/components/Grid/CSSGrid.js +2 -15
- package/es/components/Grid/Column.js +18 -59
- package/es/components/Grid/ColumnHang.js +2 -5
- package/es/components/Grid/FlexGrid.js +2 -8
- package/es/components/Grid/Grid.js +0 -8
- package/es/components/Grid/GridContext.js +1 -3
- package/es/components/Grid/Row.js +2 -7
- package/es/components/Heading/index.js +0 -4
- package/es/components/Icon/Icon.Skeleton.js +2 -2
- package/es/components/IconButton/index.js +0 -10
- package/es/components/IdPrefix/index.js +0 -2
- package/es/components/InlineCheckbox/InlineCheckbox.js +0 -14
- package/es/components/InlineLoading/InlineLoading.js +0 -12
- package/es/components/Layer/index.js +3 -6
- package/es/components/Layout/LayoutDirection.js +0 -3
- package/es/components/Layout/useLayoutDirection.js +0 -1
- package/es/components/Link/Link.js +3 -10
- package/es/components/ListBox/ListBox.js +2 -13
- package/es/components/ListBox/ListBoxField.js +0 -5
- package/es/components/ListBox/ListBoxMenuIcon.js +0 -4
- package/es/components/ListBox/ListBoxMenuItem.js +2 -6
- package/es/components/ListBox/ListBoxPropTypes.d.ts +2 -2
- package/es/components/ListBox/ListBoxSelection.js +1 -13
- package/es/components/ListBox/next/ListBoxSelection.js +1 -14
- package/es/components/ListBox/next/ListBoxTrigger.js +1 -3
- package/es/components/ListItem/ListItem.d.ts +23 -0
- package/es/components/ListItem/ListItem.js +4 -8
- package/es/components/ListItem/index.d.ts +7 -0
- package/es/components/Loading/Loading.js +0 -6
- package/es/components/Menu/Menu.js +22 -40
- package/es/components/Menu/MenuContext.js +4 -5
- package/es/components/Menu/MenuItem.js +5 -39
- package/es/components/MenuButton/index.js +0 -9
- package/es/components/Modal/Modal.js +0 -43
- package/es/components/ModalWrapper/ModalWrapper.js +2 -15
- package/es/components/MultiSelect/FilterableMultiSelect.js +2 -60
- package/es/components/MultiSelect/MultiSelect.js +22 -70
- package/es/components/MultiSelect/MultiSelectPropTypes.js +0 -1
- package/es/components/MultiSelect/index.js +0 -1
- package/es/components/MultiSelect/tools/itemToString.js +0 -2
- package/es/components/MultiSelect/tools/sorting.js +3 -4
- package/es/components/Notification/Notification.js +0 -78
- package/es/components/NumberInput/NumberInput.Skeleton.js +0 -2
- package/es/components/NumberInput/NumberInput.js +3 -60
- package/es/components/OrderedList/OrderedList.d.ts +39 -0
- package/es/components/OrderedList/OrderedList.js +7 -19
- package/es/components/{Form/index.js → OrderedList/index.d.ts} +1 -3
- package/es/components/OverflowMenu/OverflowMenu.js +65 -86
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +6 -23
- package/es/components/OverflowMenuV2/index.js +0 -5
- package/es/components/Pagination/Pagination.Skeleton.js +0 -2
- package/es/components/Pagination/Pagination.js +11 -47
- package/es/components/Pagination/experimental/PageSelector.js +0 -10
- package/es/components/Pagination/experimental/Pagination.js +2 -48
- package/es/components/PaginationNav/PaginationNav.js +15 -59
- package/es/components/Popover/index.d.ts +14 -8
- package/es/components/Popover/index.js +44 -48
- package/es/components/PrimaryButton/PrimaryButton.js +0 -1
- package/es/components/ProgressBar/ProgressBar.js +0 -15
- package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +0 -4
- package/es/components/ProgressIndicator/ProgressIndicator.js +2 -40
- package/es/components/RadioButton/RadioButton.Skeleton.js +0 -1
- package/es/components/RadioButton/RadioButton.js +0 -13
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +3 -23
- package/es/components/RadioTile/RadioTile.js +0 -12
- package/es/components/Search/Search.Skeleton.js +0 -2
- package/es/components/Search/Search.js +1 -28
- package/es/components/SecondaryButton/SecondaryButton.js +0 -1
- package/es/components/Select/Select.Skeleton.js +0 -2
- package/es/components/Select/Select.d.ts +1 -1
- package/es/components/Select/Select.js +6 -33
- package/es/components/SelectItem/SelectItem.js +0 -5
- package/es/components/SelectItemGroup/SelectItemGroup.d.ts +0 -1
- package/es/components/SelectItemGroup/SelectItemGroup.js +1 -7
- package/es/components/SkeletonIcon/SkeletonIcon.js +0 -2
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +0 -1
- package/es/components/SkeletonText/SkeletonText.js +0 -12
- package/es/components/Slider/Slider.Skeleton.js +0 -2
- package/es/components/Slider/Slider.d.ts +0 -1
- package/es/components/Slider/Slider.js +112 -135
- package/es/components/Stack/Stack.js +1 -8
- package/es/components/StructuredList/StructuredList.Skeleton.js +0 -5
- package/es/components/StructuredList/StructuredList.js +1 -25
- package/es/components/Switch/IconSwitch.js +0 -18
- package/es/components/Switch/Switch.js +0 -11
- package/es/components/TabContent/TabContent.js +2 -6
- package/es/components/Tabs/Tabs.Skeleton.js +0 -4
- package/es/components/Tabs/Tabs.js +135 -104
- package/es/components/Tabs/usePressable.js +18 -31
- package/es/components/Tag/Tag.Skeleton.js +0 -2
- package/es/components/Tag/Tag.js +0 -15
- package/es/components/Text/Text.js +5 -18
- package/es/components/Text/TextDirection.js +0 -3
- package/es/components/Text/TextDirectionContext.js +0 -1
- package/es/components/Text/createTextComponent.js +0 -3
- package/es/components/TextArea/TextArea.Skeleton.js +0 -2
- package/es/components/TextArea/TextArea.js +11 -33
- package/es/components/TextInput/ControlledPasswordInput.js +0 -20
- package/es/components/TextInput/PasswordInput.js +0 -25
- package/es/components/TextInput/TextInput.Skeleton.js +0 -2
- package/es/components/TextInput/TextInput.d.ts +1 -1
- package/es/components/TextInput/TextInput.js +5 -33
- package/es/components/TextInput/util.js +3 -5
- package/es/components/Theme/index.js +1 -6
- package/es/components/Tile/Tile.js +32 -59
- package/es/components/TileGroup/TileGroup.js +1 -22
- package/es/components/TimePicker/TimePicker.js +6 -32
- package/es/components/TimePickerSelect/TimePickerSelect.js +2 -5
- package/es/components/Toggle/Toggle.Skeleton.js +0 -8
- package/es/components/Toggle/Toggle.js +0 -16
- package/es/components/ToggleSmall/ToggleSmall.Skeleton.js +0 -7
- package/es/components/Toggletip/index.d.ts +148 -0
- package/es/components/Toggletip/index.js +20 -44
- package/es/components/Tooltip/DefinitionTooltip.js +0 -11
- package/es/components/Tooltip/Tooltip.d.ts +1 -1
- package/es/components/Tooltip/Tooltip.js +4 -21
- package/es/components/TreeView/TreeNode.js +21 -66
- package/es/components/TreeView/TreeView.js +11 -67
- package/es/components/UIShell/Content.js +2 -4
- package/es/components/UIShell/Header.js +0 -2
- package/es/components/UIShell/HeaderContainer.d.ts +33 -0
- package/es/components/UIShell/HeaderContainer.js +13 -11
- package/es/components/UIShell/HeaderGlobalAction.js +0 -6
- package/es/components/UIShell/HeaderGlobalBar.js +0 -1
- package/es/components/UIShell/HeaderMenu.js +32 -31
- package/es/components/UIShell/HeaderMenuButton.js +2 -4
- package/es/components/UIShell/HeaderMenuItem.js +0 -8
- package/es/components/UIShell/HeaderName.js +0 -5
- package/es/components/UIShell/HeaderNavigation.js +0 -2
- package/es/components/UIShell/HeaderPanel.js +0 -2
- package/es/components/UIShell/HeaderSideNavItems.js +0 -2
- package/es/components/UIShell/Link.js +2 -3
- package/es/components/UIShell/SideNav.d.ts +3 -1
- package/es/components/UIShell/SideNav.js +44 -36
- package/es/components/UIShell/SideNavDetails.js +0 -3
- package/es/components/UIShell/SideNavDivider.js +0 -1
- package/es/components/UIShell/SideNavFooter.js +1 -4
- package/es/components/UIShell/SideNavHeader.js +0 -4
- package/es/components/UIShell/SideNavIcon.js +0 -3
- package/es/components/UIShell/SideNavItem.js +0 -3
- package/es/components/UIShell/SideNavItems.js +2 -6
- package/es/components/UIShell/SideNavLink.js +3 -7
- package/es/components/UIShell/SideNavLinkText.js +0 -2
- package/es/components/UIShell/SideNavMenu.js +0 -16
- package/es/components/UIShell/SideNavMenuItem.js +0 -2
- package/es/components/UIShell/SideNavSwitcher.js +2 -5
- package/es/components/UIShell/SkipToContent.d.ts +32 -0
- package/es/components/UIShell/SkipToContent.js +8 -15
- package/es/components/UIShell/Switcher.js +0 -2
- package/es/components/UIShell/SwitcherDivider.js +0 -1
- package/es/components/UIShell/SwitcherItem.js +0 -3
- package/es/components/UnorderedList/UnorderedList.d.ts +34 -0
- package/es/components/UnorderedList/UnorderedList.js +6 -16
- package/es/components/UnorderedList/index.d.ts +7 -0
- package/es/index.js +7 -8
- package/es/internal/ClickListener.js +3 -13
- package/es/internal/FloatingMenu.js +57 -63
- package/es/internal/OptimizedResize.js +6 -12
- package/es/internal/Selection.js +2 -25
- package/es/internal/createClassWrapper.js +0 -2
- package/es/internal/deprecateFieldOnObject.js +0 -4
- package/es/internal/focus/index.js +0 -1
- package/es/internal/keyboard/keys.js +2 -1
- package/es/internal/keyboard/match.js +1 -6
- package/es/internal/keyboard/navigation.js +8 -7
- package/es/internal/useAnnouncer.js +0 -1
- package/es/internal/useAttachedMenu.js +1 -9
- package/es/internal/useControllableState.js +6 -13
- package/es/internal/useDelayedState.js +2 -4
- package/es/internal/useEffectOnce.js +0 -1
- package/es/internal/useEvent.js +61 -3
- package/es/internal/useId.js +2 -5
- package/es/internal/useIsomorphicEffect.js +1 -0
- package/es/internal/useMergedRefs.js +2 -2
- package/es/internal/useNoInteractiveChildren.js +2 -13
- package/es/internal/useNormalizedInputProps.js +0 -3
- package/es/internal/useSavedCallback.js +1 -2
- package/es/internal/warning.js +0 -3
- package/es/internal/wrapFocus.js +1 -8
- package/es/prop-types/deprecate.js +2 -5
- package/es/prop-types/isRequiredOneOf.js +2 -5
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +0 -2
- package/es/tools/array.js +0 -3
- package/es/tools/events.js +0 -3
- package/es/tools/mergeRefs.js +0 -2
- package/es/tools/wrapComponent.js +2 -5
- package/lib/_virtual/_rollupPluginBabelHelpers.js +17 -4
- package/lib/components/Accordion/Accordion.Skeleton.js +0 -7
- package/lib/components/Accordion/Accordion.js +1 -27
- package/lib/components/Accordion/AccordionItem.js +5 -19
- package/lib/components/AspectRatio/AspectRatio.js +0 -5
- package/lib/components/Breadcrumb/Breadcrumb.Skeleton.js +0 -3
- package/lib/components/Breadcrumb/Breadcrumb.js +0 -3
- package/lib/components/Breadcrumb/BreadcrumbItem.js +0 -7
- package/lib/components/Button/Button.Skeleton.js +2 -26
- package/lib/components/Button/Button.js +2 -36
- package/lib/components/ButtonSet/ButtonSet.js +0 -2
- package/lib/components/Checkbox/Checkbox.Skeleton.js +0 -1
- package/lib/components/Checkbox/Checkbox.js +4 -20
- package/lib/components/CheckboxGroup/CheckboxGroup.js +0 -11
- package/lib/components/ClassPrefix/index.d.ts +26 -0
- package/lib/components/ClassPrefix/index.js +0 -2
- package/lib/components/CodeSnippet/CodeSnippet.Skeleton.js +0 -5
- package/lib/components/CodeSnippet/CodeSnippet.js +6 -45
- package/lib/components/ComboBox/ComboBox.js +19 -86
- package/lib/components/ComboBox/tools/filter.js +0 -1
- package/lib/components/ComboButton/index.js +0 -14
- package/lib/components/ComposedModal/ComposedModal.js +2 -32
- package/lib/components/ComposedModal/ModalFooter.js +0 -21
- package/lib/components/ComposedModal/ModalHeader.js +0 -12
- package/lib/components/ContainedList/ContainedList.js +5 -32
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +0 -6
- package/lib/components/ContentSwitcher/ContentSwitcher.js +11 -23
- package/lib/components/ContextMenu/useContextMenu.js +1 -6
- package/lib/components/Copy/Copy.js +8 -50
- package/lib/components/CopyButton/CopyButton.js +0 -4
- package/lib/components/DangerButton/DangerButton.js +0 -1
- package/lib/components/DataTable/DataTable.js +171 -91
- package/lib/components/DataTable/Table.js +0 -6
- package/lib/components/DataTable/TableBatchAction.js +0 -4
- package/lib/components/DataTable/TableBatchActions.js +0 -8
- package/lib/components/DataTable/TableBody.js +0 -1
- package/lib/components/DataTable/TableContainer.js +0 -5
- package/lib/components/DataTable/TableExpandHeader.js +0 -7
- package/lib/components/DataTable/TableExpandRow.js +0 -6
- package/lib/components/DataTable/TableExpandedRow.js +0 -6
- package/lib/components/DataTable/TableHeader.d.ts +1 -1
- package/lib/components/DataTable/TableHeader.js +3 -19
- package/lib/components/DataTable/TableRow.js +4 -5
- package/lib/components/DataTable/TableSelectAll.js +0 -8
- package/lib/components/DataTable/TableSelectRow.js +2 -10
- package/lib/components/DataTable/TableToolbar.js +0 -3
- package/lib/components/DataTable/TableToolbarMenu.d.ts +1 -1
- package/lib/components/DataTable/TableToolbarMenu.js +3 -6
- package/lib/components/DataTable/TableToolbarSearch.js +2 -30
- package/lib/components/DataTable/state/getDerivedStateFromProps.js +0 -4
- package/lib/components/DataTable/state/sorting.js +5 -8
- package/lib/components/DataTable/tools/denormalize.js +2 -2
- package/lib/components/DataTable/tools/filter.js +0 -2
- package/lib/components/DataTable/tools/instanceId.js +0 -1
- package/lib/components/DataTable/tools/normalize.js +10 -10
- package/lib/components/DataTable/tools/sorting.js +5 -13
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +5 -20
- package/lib/components/DatePicker/DatePicker.Skeleton.js +0 -6
- package/lib/components/DatePicker/DatePicker.js +154 -177
- package/lib/components/DatePicker/plugins/appendToPlugin.js +3 -7
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +14 -25
- package/lib/components/DatePicker/plugins/rangePlugin.js +2 -7
- package/lib/components/DatePickerInput/DatePickerInput.js +2 -28
- package/lib/components/Dropdown/Dropdown.Skeleton.js +0 -2
- package/lib/components/Dropdown/Dropdown.js +50 -59
- package/lib/components/ErrorBoundary/ErrorBoundary.js +0 -10
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +0 -1
- package/lib/components/ExpandableSearch/ExpandableSearch.js +1 -10
- package/lib/components/FeatureFlags/index.js +8 -20
- package/lib/components/FileUploader/FileUploader.Skeleton.js +0 -2
- package/lib/components/FileUploader/FileUploader.js +3 -57
- package/lib/components/FileUploader/FileUploaderButton.js +3 -43
- package/lib/components/FileUploader/FileUploaderDropContainer.js +1 -28
- package/lib/components/FileUploader/FileUploaderItem.js +1 -30
- package/lib/components/FileUploader/Filename.js +0 -10
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +0 -1
- package/lib/components/FluidComboBox/FluidComboBox.js +0 -18
- package/lib/components/FluidDatePicker/FluidDatePicker.Skeleton.js +0 -2
- package/lib/components/FluidDatePicker/FluidDatePicker.js +0 -6
- package/lib/components/FluidDatePickerInput/FluidDatePickerInput.js +2 -1
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +0 -1
- package/lib/components/FluidDropdown/FluidDropdown.js +0 -18
- package/lib/components/FluidForm/FluidForm.js +0 -2
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +0 -1
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +0 -19
- package/lib/components/FluidSelect/FluidSelect.Skeleton.js +0 -1
- package/lib/components/FluidSelect/FluidSelect.js +0 -10
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +0 -1
- package/lib/components/FluidTextArea/FluidTextArea.js +0 -20
- package/lib/components/FluidTextInput/FluidTextInput.Skeleton.js +0 -1
- package/lib/components/FluidTextInput/FluidTextInput.js +0 -14
- package/lib/components/FluidTimePicker/FluidTimePicker.Skeleton.js +0 -3
- package/lib/components/FluidTimePicker/FluidTimePicker.js +1 -11
- package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +0 -6
- package/lib/components/Form/Form.d.ts +23 -0
- package/lib/components/Form/Form.js +3 -6
- package/lib/components/Form/index.d.ts +7 -0
- package/lib/components/FormGroup/FormGroup.js +0 -7
- package/lib/components/FormItem/FormItem.js +0 -2
- package/lib/components/FormLabel/FormLabel.js +1 -26
- package/lib/components/Grid/CSSGrid.js +2 -15
- package/lib/components/Grid/Column.js +18 -59
- package/lib/components/Grid/ColumnHang.js +2 -5
- package/lib/components/Grid/FlexGrid.js +2 -8
- package/lib/components/Grid/Grid.js +0 -8
- package/lib/components/Grid/GridContext.js +1 -3
- package/lib/components/Grid/Row.js +2 -7
- package/lib/components/Heading/index.js +0 -4
- package/lib/components/Icon/Icon.Skeleton.js +2 -2
- package/lib/components/IconButton/index.js +0 -10
- package/lib/components/IdPrefix/index.js +0 -2
- package/lib/components/InlineCheckbox/InlineCheckbox.js +0 -14
- package/lib/components/InlineLoading/InlineLoading.js +0 -12
- package/lib/components/Layer/index.js +3 -6
- package/lib/components/Layout/LayoutDirection.js +0 -3
- package/lib/components/Layout/useLayoutDirection.js +0 -1
- package/lib/components/Link/Link.js +3 -10
- package/lib/components/ListBox/ListBox.js +2 -13
- package/lib/components/ListBox/ListBoxField.js +0 -5
- package/lib/components/ListBox/ListBoxMenuIcon.js +0 -4
- package/lib/components/ListBox/ListBoxMenuItem.js +2 -6
- package/lib/components/ListBox/ListBoxPropTypes.d.ts +2 -2
- package/lib/components/ListBox/ListBoxSelection.js +1 -13
- package/lib/components/ListBox/next/ListBoxSelection.js +1 -14
- package/lib/components/ListBox/next/ListBoxTrigger.js +1 -3
- package/lib/components/ListItem/ListItem.d.ts +23 -0
- package/lib/components/ListItem/ListItem.js +4 -8
- package/lib/components/ListItem/index.d.ts +7 -0
- package/lib/components/Loading/Loading.js +0 -6
- package/lib/components/Menu/Menu.js +22 -40
- package/lib/components/Menu/MenuContext.js +4 -5
- package/lib/components/Menu/MenuItem.js +5 -39
- package/lib/components/MenuButton/index.js +0 -9
- package/lib/components/Modal/Modal.js +0 -43
- package/lib/components/ModalWrapper/ModalWrapper.js +2 -15
- package/lib/components/MultiSelect/FilterableMultiSelect.js +8 -66
- package/lib/components/MultiSelect/MultiSelect.js +30 -78
- package/lib/components/MultiSelect/MultiSelectPropTypes.js +0 -1
- package/lib/components/MultiSelect/index.js +0 -1
- package/lib/components/MultiSelect/tools/itemToString.js +0 -2
- package/lib/components/MultiSelect/tools/sorting.js +3 -4
- package/lib/components/Notification/Notification.js +0 -78
- package/lib/components/NumberInput/NumberInput.Skeleton.js +0 -2
- package/lib/components/NumberInput/NumberInput.js +3 -60
- package/lib/components/OrderedList/OrderedList.d.ts +39 -0
- package/lib/components/OrderedList/OrderedList.js +7 -19
- package/lib/components/OrderedList/index.d.ts +7 -0
- package/lib/components/OverflowMenu/OverflowMenu.js +65 -86
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +6 -23
- package/lib/components/OverflowMenuV2/index.js +0 -5
- package/lib/components/Pagination/Pagination.Skeleton.js +0 -2
- package/lib/components/Pagination/Pagination.js +11 -47
- package/lib/components/Pagination/experimental/PageSelector.js +0 -10
- package/lib/components/Pagination/experimental/Pagination.js +2 -67
- package/lib/components/PaginationNav/PaginationNav.js +15 -78
- package/lib/components/Popover/index.d.ts +14 -8
- package/lib/components/Popover/index.js +44 -48
- package/lib/components/PrimaryButton/PrimaryButton.js +0 -1
- package/lib/components/ProgressBar/ProgressBar.js +0 -15
- package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +0 -4
- package/lib/components/ProgressIndicator/ProgressIndicator.js +2 -40
- package/lib/components/RadioButton/RadioButton.Skeleton.js +0 -1
- package/lib/components/RadioButton/RadioButton.js +0 -13
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +3 -23
- package/lib/components/RadioTile/RadioTile.js +0 -12
- package/lib/components/Search/Search.Skeleton.js +0 -2
- package/lib/components/Search/Search.js +1 -28
- package/lib/components/SecondaryButton/SecondaryButton.js +0 -1
- package/lib/components/Select/Select.Skeleton.js +0 -2
- package/lib/components/Select/Select.d.ts +1 -1
- package/lib/components/Select/Select.js +6 -33
- package/lib/components/SelectItem/SelectItem.js +0 -5
- package/lib/components/SelectItemGroup/SelectItemGroup.d.ts +0 -1
- package/lib/components/SelectItemGroup/SelectItemGroup.js +1 -26
- package/lib/components/SkeletonIcon/SkeletonIcon.js +0 -2
- package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +0 -1
- package/lib/components/SkeletonText/SkeletonText.js +0 -12
- package/lib/components/Slider/Slider.Skeleton.js +0 -2
- package/lib/components/Slider/Slider.d.ts +0 -1
- package/lib/components/Slider/Slider.js +112 -154
- package/lib/components/Stack/Stack.js +1 -8
- package/lib/components/StructuredList/StructuredList.Skeleton.js +0 -5
- package/lib/components/StructuredList/StructuredList.js +1 -25
- package/lib/components/Switch/IconSwitch.js +0 -18
- package/lib/components/Switch/Switch.js +0 -11
- package/lib/components/TabContent/TabContent.js +2 -6
- package/lib/components/Tabs/Tabs.Skeleton.js +0 -4
- package/lib/components/Tabs/Tabs.js +133 -102
- package/lib/components/Tabs/usePressable.js +18 -31
- package/lib/components/Tag/Tag.Skeleton.js +0 -2
- package/lib/components/Tag/Tag.js +0 -15
- package/lib/components/Text/Text.js +5 -18
- package/lib/components/Text/TextDirection.js +0 -3
- package/lib/components/Text/TextDirectionContext.js +0 -1
- package/lib/components/Text/createTextComponent.js +0 -3
- package/lib/components/TextArea/TextArea.Skeleton.js +0 -2
- package/lib/components/TextArea/TextArea.js +10 -32
- package/lib/components/TextInput/ControlledPasswordInput.js +0 -20
- package/lib/components/TextInput/PasswordInput.js +0 -25
- package/lib/components/TextInput/TextInput.Skeleton.js +0 -2
- package/lib/components/TextInput/TextInput.d.ts +1 -1
- package/lib/components/TextInput/TextInput.js +5 -52
- package/lib/components/TextInput/util.js +3 -5
- package/lib/components/Theme/index.js +1 -6
- package/lib/components/Tile/Tile.js +31 -58
- package/lib/components/TileGroup/TileGroup.js +1 -22
- package/lib/components/TimePicker/TimePicker.js +6 -32
- package/lib/components/TimePickerSelect/TimePickerSelect.js +2 -5
- package/lib/components/Toggle/Toggle.Skeleton.js +0 -8
- package/lib/components/Toggle/Toggle.js +0 -16
- package/lib/components/ToggleSmall/ToggleSmall.Skeleton.js +0 -7
- package/lib/components/Toggletip/index.d.ts +148 -0
- package/lib/components/Toggletip/index.js +20 -44
- package/lib/components/Tooltip/DefinitionTooltip.js +0 -11
- package/lib/components/Tooltip/Tooltip.d.ts +1 -1
- package/lib/components/Tooltip/Tooltip.js +4 -21
- package/lib/components/TreeView/TreeNode.js +21 -66
- package/lib/components/TreeView/TreeView.js +11 -67
- package/lib/components/UIShell/Content.js +2 -4
- package/lib/components/UIShell/Header.js +0 -2
- package/lib/components/UIShell/HeaderContainer.d.ts +33 -0
- package/lib/components/UIShell/HeaderContainer.js +13 -11
- package/lib/components/UIShell/HeaderGlobalAction.js +0 -6
- package/lib/components/UIShell/HeaderGlobalBar.js +0 -1
- package/lib/components/UIShell/HeaderMenu.js +32 -31
- package/lib/components/UIShell/HeaderMenuButton.js +2 -4
- package/lib/components/UIShell/HeaderMenuItem.js +0 -8
- package/lib/components/UIShell/HeaderName.js +0 -5
- package/lib/components/UIShell/HeaderNavigation.js +0 -2
- package/lib/components/UIShell/HeaderPanel.js +0 -2
- package/lib/components/UIShell/HeaderSideNavItems.js +0 -2
- package/lib/components/UIShell/Link.js +2 -3
- package/lib/components/UIShell/SideNav.d.ts +3 -1
- package/lib/components/UIShell/SideNav.js +43 -35
- package/lib/components/UIShell/SideNavDetails.js +0 -3
- package/lib/components/UIShell/SideNavDivider.js +0 -1
- package/lib/components/UIShell/SideNavFooter.js +1 -4
- package/lib/components/UIShell/SideNavHeader.js +0 -4
- package/lib/components/UIShell/SideNavIcon.js +0 -3
- package/lib/components/UIShell/SideNavItem.js +0 -3
- package/lib/components/UIShell/SideNavItems.js +2 -6
- package/lib/components/UIShell/SideNavLink.js +3 -7
- package/lib/components/UIShell/SideNavLinkText.js +0 -2
- package/lib/components/UIShell/SideNavMenu.js +0 -16
- package/lib/components/UIShell/SideNavMenuItem.js +0 -2
- package/lib/components/UIShell/SideNavSwitcher.js +2 -5
- package/lib/components/UIShell/SkipToContent.d.ts +32 -0
- package/lib/components/UIShell/SkipToContent.js +8 -15
- package/lib/components/UIShell/Switcher.js +0 -2
- package/lib/components/UIShell/SwitcherDivider.js +0 -1
- package/lib/components/UIShell/SwitcherItem.js +0 -3
- package/lib/components/UnorderedList/UnorderedList.d.ts +34 -0
- package/lib/components/UnorderedList/UnorderedList.js +6 -16
- package/lib/components/UnorderedList/index.d.ts +7 -0
- package/lib/index.js +42 -43
- package/lib/internal/ClickListener.js +3 -13
- package/lib/internal/FloatingMenu.js +57 -63
- package/lib/internal/OptimizedResize.js +6 -12
- package/lib/internal/Selection.js +2 -25
- package/lib/internal/createClassWrapper.js +0 -2
- package/lib/internal/deprecateFieldOnObject.js +0 -4
- package/lib/internal/focus/index.js +0 -1
- package/lib/internal/keyboard/keys.js +2 -1
- package/lib/internal/keyboard/match.js +1 -6
- package/lib/internal/keyboard/navigation.js +8 -7
- package/lib/internal/useAnnouncer.js +0 -1
- package/lib/internal/useAttachedMenu.js +1 -9
- package/lib/internal/useControllableState.js +6 -13
- package/lib/internal/useDelayedState.js +2 -4
- package/lib/internal/useEffectOnce.js +0 -1
- package/lib/internal/useEvent.js +61 -2
- package/lib/internal/useId.js +2 -5
- package/lib/internal/useIsomorphicEffect.js +1 -0
- package/lib/internal/useMergedRefs.js +2 -2
- package/lib/internal/useNoInteractiveChildren.js +2 -13
- package/lib/internal/useNormalizedInputProps.js +0 -3
- package/lib/internal/useSavedCallback.js +1 -2
- package/lib/internal/warning.js +0 -3
- package/lib/internal/wrapFocus.js +1 -8
- package/lib/prop-types/deprecate.js +2 -5
- package/lib/prop-types/isRequiredOneOf.js +2 -5
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +0 -2
- package/lib/tools/array.js +0 -3
- package/lib/tools/events.js +0 -3
- package/lib/tools/mergeRefs.js +0 -2
- package/lib/tools/wrapComponent.js +2 -5
- package/package.json +9 -9
- package/es/components/Tab/Tab.js +0 -185
- package/es/components/Tab/index.js +0 -14
- package/es/components/TimePickerSelect/index.js +0 -13
- package/lib/components/Form/index.js +0 -17
- package/lib/components/Tab/Tab.js +0 -214
- package/lib/components/Tab/index.js +0 -39
- package/lib/components/TimePickerSelect/index.js +0 -38
|
@@ -70,13 +70,13 @@ const Checkbox = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
70
70
|
if (el && indeterminate) {
|
|
71
71
|
el.indeterminate = indeterminate;
|
|
72
72
|
}
|
|
73
|
-
|
|
74
73
|
if (typeof ref === 'function') {
|
|
75
74
|
ref(el);
|
|
76
75
|
} else if (ref && Object(ref) === ref) {
|
|
77
76
|
ref.current = el;
|
|
78
77
|
}
|
|
79
|
-
}
|
|
78
|
+
}
|
|
79
|
+
// readonly attribute not applicable to type="checkbox"
|
|
80
80
|
// see - https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox
|
|
81
81
|
,
|
|
82
82
|
"aria-readonly": readOnly,
|
|
@@ -84,9 +84,8 @@ const Checkbox = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
84
84
|
if (readOnly) {
|
|
85
85
|
// prevent default stops the checkbox being updated
|
|
86
86
|
evt.preventDefault();
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
}
|
|
88
|
+
// pass onClick event on to the user even if readonly
|
|
90
89
|
if (onClick) {
|
|
91
90
|
onClick(evt);
|
|
92
91
|
}
|
|
@@ -114,80 +113,65 @@ Checkbox.propTypes = {
|
|
|
114
113
|
* Specify whether the underlying input should be checked
|
|
115
114
|
*/
|
|
116
115
|
checked: PropTypes.bool,
|
|
117
|
-
|
|
118
116
|
/**
|
|
119
117
|
* Specify an optional className to be applied to the <label> node
|
|
120
118
|
*/
|
|
121
119
|
className: PropTypes.string,
|
|
122
|
-
|
|
123
120
|
/**
|
|
124
121
|
* Specify whether the underlying input should be checked by default
|
|
125
122
|
*/
|
|
126
123
|
defaultChecked: PropTypes.bool,
|
|
127
|
-
|
|
128
124
|
/**
|
|
129
125
|
* Specify whether the Checkbox should be disabled
|
|
130
126
|
*/
|
|
131
127
|
disabled: PropTypes.bool,
|
|
132
|
-
|
|
133
128
|
/**
|
|
134
129
|
* Provide text for the form group for additional help
|
|
135
130
|
*/
|
|
136
131
|
helperText: PropTypes.node,
|
|
137
|
-
|
|
138
132
|
/**
|
|
139
133
|
* Specify whether the label should be hidden, or not
|
|
140
134
|
*/
|
|
141
135
|
hideLabel: PropTypes.bool,
|
|
142
|
-
|
|
143
136
|
/**
|
|
144
137
|
* Provide an `id` to uniquely identify the Checkbox input
|
|
145
138
|
*/
|
|
146
139
|
id: PropTypes.string.isRequired,
|
|
147
|
-
|
|
148
140
|
/**
|
|
149
141
|
* Specify whether the Checkbox is in an indeterminate state
|
|
150
142
|
*/
|
|
151
143
|
indeterminate: PropTypes.bool,
|
|
152
|
-
|
|
153
144
|
/**
|
|
154
145
|
* Specify whether the Checkbox is currently invalid
|
|
155
146
|
*/
|
|
156
147
|
invalid: PropTypes.bool,
|
|
157
|
-
|
|
158
148
|
/**
|
|
159
149
|
* Provide the text that is displayed when the Checkbox is in an invalid state
|
|
160
150
|
*/
|
|
161
151
|
invalidText: PropTypes.node,
|
|
162
|
-
|
|
163
152
|
/**
|
|
164
153
|
* Provide a label to provide a description of the Checkbox input that you are
|
|
165
154
|
* exposing to the user
|
|
166
155
|
*/
|
|
167
156
|
labelText: PropTypes.node.isRequired,
|
|
168
|
-
|
|
169
157
|
/**
|
|
170
158
|
* Provide an optional handler that is called when the internal state of
|
|
171
159
|
* Checkbox changes. This handler is called with event and state info.
|
|
172
160
|
* `(event, { checked, id }) => void`
|
|
173
161
|
*/
|
|
174
162
|
onChange: PropTypes.func,
|
|
175
|
-
|
|
176
163
|
/**
|
|
177
164
|
* Specify whether the Checkbox is read-only
|
|
178
165
|
*/
|
|
179
166
|
readOnly: PropTypes.bool,
|
|
180
|
-
|
|
181
167
|
/**
|
|
182
168
|
* Specify a title for the <label> node for the Checkbox
|
|
183
169
|
*/
|
|
184
170
|
title: PropTypes.string,
|
|
185
|
-
|
|
186
171
|
/**
|
|
187
172
|
* Specify whether the Checkbox is currently in warning state
|
|
188
173
|
*/
|
|
189
174
|
warn: PropTypes.bool,
|
|
190
|
-
|
|
191
175
|
/**
|
|
192
176
|
* Provide the text that is displayed when the Checkbox is in warning state
|
|
193
177
|
*/
|
|
@@ -14,7 +14,6 @@ import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
|
|
|
14
14
|
import setupGetInstanceId from '../../tools/setupGetInstanceId.js';
|
|
15
15
|
|
|
16
16
|
const getInstanceId = setupGetInstanceId();
|
|
17
|
-
|
|
18
17
|
function CheckboxGroup(_ref) {
|
|
19
18
|
let {
|
|
20
19
|
children,
|
|
@@ -64,54 +63,44 @@ function CheckboxGroup(_ref) {
|
|
|
64
63
|
className: `${prefix}--form-requirement`
|
|
65
64
|
}, warnText))), showHelper && helper);
|
|
66
65
|
}
|
|
67
|
-
|
|
68
66
|
CheckboxGroup.propTypes = {
|
|
69
67
|
/**
|
|
70
68
|
* Provide the children form elements to be rendered inside of the <fieldset>
|
|
71
69
|
*/
|
|
72
70
|
children: PropTypes.node,
|
|
73
|
-
|
|
74
71
|
/**
|
|
75
72
|
* Provide a custom className to be applied to the containing <fieldset> node
|
|
76
73
|
*/
|
|
77
74
|
className: PropTypes.string,
|
|
78
|
-
|
|
79
75
|
/**
|
|
80
76
|
* Provide text for the form group for additional help
|
|
81
77
|
*/
|
|
82
78
|
helperText: PropTypes.node,
|
|
83
|
-
|
|
84
79
|
/**
|
|
85
80
|
* Specify whether the form group is currently invalid
|
|
86
81
|
*/
|
|
87
82
|
invalid: PropTypes.bool,
|
|
88
|
-
|
|
89
83
|
/**
|
|
90
84
|
* Provide the text that is displayed when the form group is in an invalid state
|
|
91
85
|
*/
|
|
92
86
|
invalidText: PropTypes.node,
|
|
93
|
-
|
|
94
87
|
/**
|
|
95
88
|
* Provide id for the fieldset <legend> which corresponds to the fieldset
|
|
96
89
|
* `aria-labelledby`
|
|
97
90
|
*/
|
|
98
91
|
legendId: PropTypes.node,
|
|
99
|
-
|
|
100
92
|
/**
|
|
101
93
|
* Provide the text to be rendered inside of the fieldset <legend>
|
|
102
94
|
*/
|
|
103
95
|
legendText: PropTypes.node.isRequired,
|
|
104
|
-
|
|
105
96
|
/**
|
|
106
97
|
* Whether the CheckboxGroup should be read-only
|
|
107
98
|
*/
|
|
108
99
|
readOnly: PropTypes.bool,
|
|
109
|
-
|
|
110
100
|
/**
|
|
111
101
|
* Specify whether the form group is currently in warning state
|
|
112
102
|
*/
|
|
113
103
|
warn: PropTypes.bool,
|
|
114
|
-
|
|
115
104
|
/**
|
|
116
105
|
* Provide the text that is displayed when the form group is in warning state
|
|
117
106
|
*/
|
|
@@ -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
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { PropsWithChildren } from 'react';
|
|
9
|
+
interface ClassPrefixProps {
|
|
10
|
+
/**
|
|
11
|
+
* The value used to prefix the CSS selectors
|
|
12
|
+
* used by Carbon components.
|
|
13
|
+
*/
|
|
14
|
+
prefix: string;
|
|
15
|
+
}
|
|
16
|
+
declare function ClassPrefix({ children, prefix, }: PropsWithChildren<ClassPrefixProps>): JSX.Element;
|
|
17
|
+
declare namespace ClassPrefix {
|
|
18
|
+
var propTypes: {
|
|
19
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
20
|
+
/**
|
|
21
|
+
* The value used to prefix the CSS selectors used by Carbon components
|
|
22
|
+
*/
|
|
23
|
+
prefix: PropTypes.Validator<string>;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export { ClassPrefix };
|
|
@@ -12,7 +12,6 @@ import React__default from 'react';
|
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
|
|
14
14
|
var _span, _span2, _span3, _span4;
|
|
15
|
-
|
|
16
15
|
function CodeSnippetSkeleton(_ref) {
|
|
17
16
|
let {
|
|
18
17
|
className: containerClassName,
|
|
@@ -26,7 +25,6 @@ function CodeSnippetSkeleton(_ref) {
|
|
|
26
25
|
[`${prefix}--snippet--single`]: type === 'single',
|
|
27
26
|
[`${prefix}--snippet--multi`]: type === 'multi'
|
|
28
27
|
});
|
|
29
|
-
|
|
30
28
|
if (type === 'single') {
|
|
31
29
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
32
30
|
className: className
|
|
@@ -34,7 +32,6 @@ function CodeSnippetSkeleton(_ref) {
|
|
|
34
32
|
className: `${prefix}--snippet-container`
|
|
35
33
|
}, _span || (_span = /*#__PURE__*/React__default.createElement("span", null))));
|
|
36
34
|
}
|
|
37
|
-
|
|
38
35
|
if (type === 'multi') {
|
|
39
36
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
40
37
|
className: className
|
|
@@ -43,13 +40,11 @@ function CodeSnippetSkeleton(_ref) {
|
|
|
43
40
|
}, _span2 || (_span2 = /*#__PURE__*/React__default.createElement("span", null)), _span3 || (_span3 = /*#__PURE__*/React__default.createElement("span", null)), _span4 || (_span4 = /*#__PURE__*/React__default.createElement("span", null))));
|
|
44
41
|
}
|
|
45
42
|
}
|
|
46
|
-
|
|
47
43
|
CodeSnippetSkeleton.propTypes = {
|
|
48
44
|
/**
|
|
49
45
|
* Specify an optional className to be applied to the container node
|
|
50
46
|
*/
|
|
51
47
|
className: PropTypes.string,
|
|
52
|
-
|
|
53
48
|
/**
|
|
54
49
|
* The type of the code snippet, including single or multi
|
|
55
50
|
*/
|
|
@@ -24,7 +24,6 @@ const defaultMaxCollapsedNumberOfRows = 15;
|
|
|
24
24
|
const defaultMaxExpandedNumberOfRows = 0;
|
|
25
25
|
const defaultMinCollapsedNumberOfRows = 3;
|
|
26
26
|
const defaultMinExpandedNumberOfRows = 16;
|
|
27
|
-
|
|
28
27
|
function CodeSnippet(_ref) {
|
|
29
28
|
let {
|
|
30
29
|
className,
|
|
@@ -63,7 +62,6 @@ function CodeSnippet(_ref) {
|
|
|
63
62
|
if (type === 'single') {
|
|
64
63
|
return codeContainerRef;
|
|
65
64
|
}
|
|
66
|
-
|
|
67
65
|
if (type === 'multi') {
|
|
68
66
|
return codeContentRef;
|
|
69
67
|
}
|
|
@@ -83,10 +81,9 @@ function CodeSnippet(_ref) {
|
|
|
83
81
|
};
|
|
84
82
|
}, [getCodeRef]);
|
|
85
83
|
const handleScroll = useCallback(() => {
|
|
86
|
-
if (type === 'inline' || type === 'single' && !
|
|
84
|
+
if (type === 'inline' || type === 'single' && !codeContainerRef?.current || type === 'multi' && !codeContentRef?.current) {
|
|
87
85
|
return;
|
|
88
86
|
}
|
|
89
|
-
|
|
90
87
|
const {
|
|
91
88
|
horizontalOverflow,
|
|
92
89
|
codeClientWidth,
|
|
@@ -99,23 +96,20 @@ function CodeSnippet(_ref) {
|
|
|
99
96
|
useResizeObserver({
|
|
100
97
|
ref: getCodeRef(),
|
|
101
98
|
onResize: () => {
|
|
102
|
-
if (codeContentRef
|
|
99
|
+
if (codeContentRef?.current && type === 'multi') {
|
|
103
100
|
const {
|
|
104
101
|
height
|
|
105
102
|
} = codeContentRef.current.getBoundingClientRect();
|
|
106
|
-
|
|
107
103
|
if (maxCollapsedNumberOfRows > 0 && (maxExpandedNumberOfRows <= 0 || maxExpandedNumberOfRows > maxCollapsedNumberOfRows) && height > maxCollapsedNumberOfRows * rowHeightInPixels) {
|
|
108
104
|
setShouldShowMoreLessBtn(true);
|
|
109
105
|
} else {
|
|
110
106
|
setShouldShowMoreLessBtn(false);
|
|
111
107
|
}
|
|
112
|
-
|
|
113
108
|
if (expandedCode && minExpandedNumberOfRows > 0 && height <= minExpandedNumberOfRows * rowHeightInPixels) {
|
|
114
109
|
setExpandedCode(false);
|
|
115
110
|
}
|
|
116
111
|
}
|
|
117
|
-
|
|
118
|
-
if (codeContentRef !== null && codeContentRef !== void 0 && codeContentRef.current && type === 'multi' || codeContainerRef !== null && codeContainerRef !== void 0 && codeContainerRef.current && type === 'single') {
|
|
112
|
+
if (codeContentRef?.current && type === 'multi' || codeContainerRef?.current && type === 'single') {
|
|
119
113
|
handleScroll();
|
|
120
114
|
}
|
|
121
115
|
}
|
|
@@ -123,19 +117,14 @@ function CodeSnippet(_ref) {
|
|
|
123
117
|
useEffect(() => {
|
|
124
118
|
handleScroll();
|
|
125
119
|
}, [handleScroll]);
|
|
126
|
-
|
|
127
120
|
const handleCopyClick = evt => {
|
|
128
|
-
if (copyText || innerCodeRef
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
copy(copyText ?? (innerCodeRef === null || innerCodeRef === void 0 ? void 0 : (_innerCodeRef$current = innerCodeRef.current) === null || _innerCodeRef$current === void 0 ? void 0 : _innerCodeRef$current.innerText));
|
|
121
|
+
if (copyText || innerCodeRef?.current) {
|
|
122
|
+
copy(copyText ?? innerCodeRef?.current?.innerText);
|
|
132
123
|
}
|
|
133
|
-
|
|
134
124
|
if (onClick) {
|
|
135
125
|
onClick(evt);
|
|
136
126
|
}
|
|
137
127
|
};
|
|
138
|
-
|
|
139
128
|
const codeSnippetClasses = cx(className, `${prefix}--snippet`, {
|
|
140
129
|
[`${prefix}--snippet--${type}`]: type,
|
|
141
130
|
[`${prefix}--snippet--disabled`]: type !== 'inline' && disabled,
|
|
@@ -146,7 +135,6 @@ function CodeSnippet(_ref) {
|
|
|
146
135
|
[`${prefix}--snippet--has-right-overflow`]: type == 'multi' && hasRightOverflow
|
|
147
136
|
});
|
|
148
137
|
const expandCodeBtnText = expandedCode ? showLessText : showMoreText;
|
|
149
|
-
|
|
150
138
|
if (type === 'inline') {
|
|
151
139
|
if (hideCopyButton) {
|
|
152
140
|
return /*#__PURE__*/React__default.createElement("span", {
|
|
@@ -156,7 +144,6 @@ function CodeSnippet(_ref) {
|
|
|
156
144
|
ref: innerCodeRef
|
|
157
145
|
}, children));
|
|
158
146
|
}
|
|
159
|
-
|
|
160
147
|
return /*#__PURE__*/React__default.createElement(Copy, _extends({}, rest, {
|
|
161
148
|
onClick: handleCopyClick,
|
|
162
149
|
"aria-label": deprecatedAriaLabel || ariaLabel,
|
|
@@ -169,17 +156,13 @@ function CodeSnippet(_ref) {
|
|
|
169
156
|
ref: innerCodeRef
|
|
170
157
|
}, children));
|
|
171
158
|
}
|
|
172
|
-
|
|
173
159
|
let containerStyle = {};
|
|
174
|
-
|
|
175
160
|
if (type === 'multi') {
|
|
176
161
|
const styles = {};
|
|
177
|
-
|
|
178
162
|
if (expandedCode) {
|
|
179
163
|
if (maxExpandedNumberOfRows > 0) {
|
|
180
164
|
styles.maxHeight = maxExpandedNumberOfRows * rowHeightInPixels;
|
|
181
165
|
}
|
|
182
|
-
|
|
183
166
|
if (minExpandedNumberOfRows > 0) {
|
|
184
167
|
styles.minHeight = minExpandedNumberOfRows * rowHeightInPixels;
|
|
185
168
|
}
|
|
@@ -187,17 +170,14 @@ function CodeSnippet(_ref) {
|
|
|
187
170
|
if (maxCollapsedNumberOfRows > 0) {
|
|
188
171
|
styles.maxHeight = maxCollapsedNumberOfRows * rowHeightInPixels;
|
|
189
172
|
}
|
|
190
|
-
|
|
191
173
|
if (minCollapsedNumberOfRows > 0) {
|
|
192
174
|
styles.minHeight = minCollapsedNumberOfRows * rowHeightInPixels;
|
|
193
175
|
}
|
|
194
176
|
}
|
|
195
|
-
|
|
196
177
|
if (Object.keys(styles).length) {
|
|
197
178
|
containerStyle.style = styles;
|
|
198
179
|
}
|
|
199
180
|
}
|
|
200
|
-
|
|
201
181
|
return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
|
202
182
|
className: codeSnippetClasses
|
|
203
183
|
}), /*#__PURE__*/React__default.createElement("div", _extends({
|
|
@@ -238,111 +218,92 @@ function CodeSnippet(_ref) {
|
|
|
238
218
|
role: "img"
|
|
239
219
|
})));
|
|
240
220
|
}
|
|
241
|
-
|
|
242
221
|
CodeSnippet.propTypes = {
|
|
243
222
|
/**
|
|
244
223
|
* Specify a label to be read by screen readers on the containing <textbox>
|
|
245
224
|
* node
|
|
246
225
|
*/
|
|
247
226
|
['aria-label']: PropTypes.string,
|
|
248
|
-
|
|
249
227
|
/**
|
|
250
228
|
* Deprecated, please use `aria-label` instead.
|
|
251
229
|
* Specify a label to be read by screen readers on the containing <textbox>
|
|
252
230
|
* node
|
|
253
231
|
*/
|
|
254
232
|
ariaLabel: deprecate(PropTypes.string, 'This prop syntax has been deprecated. Please use the new `aria-label`.'),
|
|
255
|
-
|
|
256
233
|
/**
|
|
257
234
|
* Provide the content of your CodeSnippet as a node or string
|
|
258
235
|
*/
|
|
259
236
|
children: PropTypes.node,
|
|
260
|
-
|
|
261
237
|
/**
|
|
262
238
|
* Specify an optional className to be applied to the container node
|
|
263
239
|
*/
|
|
264
240
|
className: PropTypes.string,
|
|
265
|
-
|
|
266
241
|
/**
|
|
267
242
|
* Specify the description for the Copy Button
|
|
268
243
|
*/
|
|
269
244
|
copyButtonDescription: PropTypes.string,
|
|
270
|
-
|
|
271
245
|
/**
|
|
272
246
|
* Optional text to copy. If not specified, the `children` node's `innerText`
|
|
273
247
|
* will be used as the copy value.
|
|
274
248
|
*/
|
|
275
249
|
copyText: PropTypes.string,
|
|
276
|
-
|
|
277
250
|
/**
|
|
278
251
|
* Specify whether or not the CodeSnippet should be disabled
|
|
279
252
|
*/
|
|
280
253
|
disabled: PropTypes.bool,
|
|
281
|
-
|
|
282
254
|
/**
|
|
283
255
|
* Specify the string displayed when the snippet is copied
|
|
284
256
|
*/
|
|
285
257
|
feedback: PropTypes.string,
|
|
286
|
-
|
|
287
258
|
/**
|
|
288
259
|
* Specify the time it takes for the feedback message to timeout
|
|
289
260
|
*/
|
|
290
261
|
feedbackTimeout: PropTypes.number,
|
|
291
|
-
|
|
292
262
|
/**
|
|
293
263
|
* Specify whether or not a copy button should be used/rendered.
|
|
294
264
|
*/
|
|
295
265
|
hideCopyButton: PropTypes.bool,
|
|
296
|
-
|
|
297
266
|
/**
|
|
298
267
|
* Specify whether you are using the light variant of the Code Snippet,
|
|
299
268
|
* typically used for inline snippet to display an alternate color
|
|
300
269
|
*/
|
|
301
|
-
light: deprecate(PropTypes.bool, 'The `light` prop for `CodeSnippet` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
|
|
302
270
|
|
|
271
|
+
light: deprecate(PropTypes.bool, 'The `light` prop for `CodeSnippet` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
|
|
303
272
|
/**
|
|
304
273
|
* Specify the maximum number of rows to be shown when in collapsed view
|
|
305
274
|
*/
|
|
306
275
|
maxCollapsedNumberOfRows: PropTypes.number,
|
|
307
|
-
|
|
308
276
|
/**
|
|
309
277
|
* Specify the maximum number of rows to be shown when in expanded view
|
|
310
278
|
*/
|
|
311
279
|
maxExpandedNumberOfRows: PropTypes.number,
|
|
312
|
-
|
|
313
280
|
/**
|
|
314
281
|
* Specify the minimum number of rows to be shown when in collapsed view
|
|
315
282
|
*/
|
|
316
283
|
minCollapsedNumberOfRows: PropTypes.number,
|
|
317
|
-
|
|
318
284
|
/**
|
|
319
285
|
* Specify the minimum number of rows to be shown when in expanded view
|
|
320
286
|
*/
|
|
321
287
|
minExpandedNumberOfRows: PropTypes.number,
|
|
322
|
-
|
|
323
288
|
/**
|
|
324
289
|
* An optional handler to listen to the `onClick` even fired by the Copy
|
|
325
290
|
* Button
|
|
326
291
|
*/
|
|
327
292
|
onClick: PropTypes.func,
|
|
328
|
-
|
|
329
293
|
/**
|
|
330
294
|
* Specify a string that is displayed when the Code Snippet has been
|
|
331
295
|
* interacted with to show more lines
|
|
332
296
|
*/
|
|
333
297
|
showLessText: PropTypes.string,
|
|
334
|
-
|
|
335
298
|
/**
|
|
336
299
|
* Specify a string that is displayed when the Code Snippet text is more
|
|
337
300
|
* than 15 lines
|
|
338
301
|
*/
|
|
339
302
|
showMoreText: PropTypes.string,
|
|
340
|
-
|
|
341
303
|
/**
|
|
342
304
|
* Provide the type of Code Snippet
|
|
343
305
|
*/
|
|
344
306
|
type: PropTypes.oneOf(['single', 'inline', 'multi']),
|
|
345
|
-
|
|
346
307
|
/**
|
|
347
308
|
* Specify whether or not to wrap the text.
|
|
348
309
|
*/
|