@carbon/react 1.27.0 → 1.28.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/_virtual/_rollupPluginBabelHelpers.js +1 -313
- package/es/components/Accordion/Accordion.Skeleton.js +28 -30
- package/es/components/Accordion/Accordion.js +18 -21
- package/es/components/Accordion/AccordionItem.js +37 -49
- package/es/components/AspectRatio/AspectRatio.js +10 -12
- package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +10 -11
- package/es/components/Breadcrumb/Breadcrumb.js +14 -13
- package/es/components/Breadcrumb/BreadcrumbItem.js +24 -22
- package/es/components/Button/Button.Skeleton.js +25 -23
- package/es/components/Button/Button.js +77 -72
- package/es/components/ButtonSet/ButtonSet.js +12 -10
- package/es/components/Checkbox/Checkbox.Skeleton.js +10 -11
- package/es/components/Checkbox/Checkbox.js +55 -52
- package/es/components/CheckboxGroup/CheckboxGroup.js +33 -31
- package/es/components/ClassPrefix/index.js +4 -2
- package/es/components/CodeSnippet/CodeSnippet.Skeleton.js +15 -14
- package/es/components/CodeSnippet/CodeSnippet.js +199 -102
- package/es/components/ComboBox/ComboBox.js +349 -178
- package/es/components/ComboBox/tools/filter.js +6 -4
- package/es/components/ComboButton/index.js +38 -43
- package/es/components/ComposedModal/ComposedModal.js +187 -85
- package/es/components/ComposedModal/ModalFooter.js +54 -49
- package/es/components/ComposedModal/ModalHeader.js +39 -26
- package/es/components/ContainedList/ContainedList.js +18 -17
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +20 -18
- package/es/components/ContentSwitcher/ContentSwitcher.js +83 -98
- package/es/components/ContentSwitcher/index.js +1 -1
- package/es/components/ContextMenu/useContextMenu.js +12 -21
- package/es/components/Copy/Copy.js +24 -29
- package/es/components/CopyButton/CopyButton.js +10 -10
- package/es/components/DangerButton/DangerButton.js +3 -5
- package/es/components/DataTable/DataTable.js +334 -361
- package/es/components/DataTable/Table.js +29 -26
- package/es/components/DataTable/TableActionList.js +2 -4
- package/es/components/DataTable/TableBatchAction.js +2 -4
- package/es/components/DataTable/TableBatchActions.js +29 -30
- package/es/components/DataTable/TableBody.js +7 -8
- package/es/components/DataTable/TableCell.js +1 -1
- package/es/components/DataTable/TableContainer.js +23 -23
- package/es/components/DataTable/TableContext.js +1 -1
- package/es/components/DataTable/TableExpandHeader.js +19 -21
- package/es/components/DataTable/TableExpandRow.js +23 -23
- package/es/components/DataTable/TableExpandedRow.js +18 -23
- package/es/components/DataTable/TableHead.js +1 -1
- package/es/components/DataTable/TableHeader.js +45 -41
- package/es/components/DataTable/TableRow.js +7 -8
- package/es/components/DataTable/TableSelectAll.js +13 -11
- package/es/components/DataTable/TableSelectRow.js +29 -21
- package/es/components/DataTable/TableToolbar.js +19 -14
- package/es/components/DataTable/TableToolbarAction.js +6 -6
- package/es/components/DataTable/TableToolbarContent.js +2 -4
- package/es/components/DataTable/TableToolbarMenu.js +11 -12
- package/es/components/DataTable/TableToolbarSearch.js +52 -71
- package/es/components/DataTable/state/getDerivedStateFromProps.js +15 -15
- package/es/components/DataTable/state/sortStates.js +1 -1
- package/es/components/DataTable/state/sorting.js +28 -20
- package/es/components/DataTable/tools/cells.js +1 -3
- package/es/components/DataTable/tools/denormalize.js +4 -17
- package/es/components/DataTable/tools/filter.js +18 -16
- package/es/components/DataTable/tools/instanceId.js +2 -2
- package/es/components/DataTable/tools/normalize.js +28 -25
- package/es/components/DataTable/tools/sorting.js +28 -25
- package/es/components/DataTableSkeleton/DataTableSkeleton.js +36 -38
- package/es/components/DatePicker/DatePicker.Skeleton.js +17 -18
- package/es/components/DatePicker/DatePicker.js +206 -195
- package/es/components/DatePicker/plugins/appendToPlugin.js +45 -43
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +117 -107
- package/es/components/DatePicker/plugins/rangePlugin.js +19 -11
- package/es/components/DatePickerInput/DatePickerInput.js +83 -74
- package/es/components/Dropdown/Dropdown.Skeleton.js +13 -12
- package/es/components/Dropdown/Dropdown.js +266 -109
- package/es/components/ErrorBoundary/ErrorBoundary.js +27 -48
- package/es/components/ErrorBoundary/ErrorBoundaryContext.js +3 -2
- package/es/components/ExpandableSearch/ExpandableSearch.d.ts +13 -0
- package/es/components/ExpandableSearch/ExpandableSearch.js +18 -25
- package/es/components/FeatureFlags/index.js +25 -43
- package/es/components/FileUploader/FileUploader.Skeleton.js +8 -9
- package/es/components/FileUploader/FileUploader.js +120 -147
- package/es/components/FileUploader/FileUploaderButton.js +36 -48
- package/es/components/FileUploader/FileUploaderDropContainer.js +49 -53
- package/es/components/FileUploader/FileUploaderItem.js +30 -30
- package/es/components/FileUploader/Filename.js +13 -14
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +11 -12
- package/es/components/FluidComboBox/FluidComboBox.js +11 -9
- package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.js +18 -18
- package/es/components/FluidDatePicker/FluidDatePicker.js +19 -16
- package/es/components/FluidDatePickerInput/FluidDatePickerInput.js +3 -3
- package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +11 -12
- package/es/components/FluidDropdown/FluidDropdown.js +11 -9
- package/es/components/FluidForm/FluidForm.js +9 -10
- package/es/components/FluidForm/FormContext.js +1 -1
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +11 -12
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +12 -10
- package/es/components/FluidSelect/FluidSelect.Skeleton.js +11 -12
- package/es/components/FluidSelect/FluidSelect.js +9 -9
- package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +9 -10
- package/es/components/FluidTextArea/FluidTextArea.js +7 -8
- package/es/components/FluidTextInput/FluidTextInput.Skeleton.js +9 -10
- package/es/components/FluidTextInput/FluidTextInput.js +10 -9
- package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.js +11 -10
- package/es/components/FluidTimePicker/FluidTimePicker.js +30 -26
- package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +7 -7
- package/es/components/Form/Form.js +9 -10
- package/es/components/FormGroup/FormGroup.js +16 -17
- package/es/components/FormItem/FormItem.js +8 -9
- package/es/components/FormLabel/FormLabel.js +11 -10
- package/es/components/Grid/CSSGrid.js +38 -39
- package/es/components/Grid/Column.js +86 -79
- package/es/components/Grid/ColumnHang.js +12 -14
- package/es/components/Grid/FlexGrid.js +19 -21
- package/es/components/Grid/Grid.js +2 -2
- package/es/components/Grid/GridContext.js +12 -11
- package/es/components/Grid/Row.js +16 -18
- package/es/components/Heading/index.js +11 -13
- package/es/components/Icon/Icon.Skeleton.js +10 -12
- package/es/components/IconButton/index.js +19 -22
- package/es/components/IdPrefix/index.js +4 -2
- package/es/components/InlineCheckbox/InlineCheckbox.js +89 -36
- package/es/components/InlineLoading/InlineLoading.js +23 -25
- package/es/components/Layer/LayerContext.js +1 -1
- package/es/components/Layer/index.js +17 -18
- package/es/components/Layout/LayoutDirection.js +8 -10
- package/es/components/Layout/LayoutDirectionContext.js +1 -1
- package/es/components/Link/Link.js +25 -25
- package/es/components/ListBox/ListBox.js +38 -31
- package/es/components/ListBox/ListBoxField.js +9 -10
- package/es/components/ListBox/ListBoxMenu.js +9 -10
- package/es/components/ListBox/ListBoxMenuIcon.js +16 -14
- package/es/components/ListBox/ListBoxMenuItem.js +23 -26
- package/es/components/ListBox/ListBoxPropTypes.js +4 -4
- package/es/components/ListBox/ListBoxSelection.js +30 -25
- package/es/components/ListBox/index.js +1 -1
- package/es/components/ListBox/next/ListBoxSelection.js +27 -24
- package/es/components/ListBox/next/ListBoxTrigger.js +20 -19
- package/es/components/ListItem/ListItem.js +9 -10
- package/es/components/Loading/Loading.js +24 -24
- package/es/components/Menu/Menu.js +67 -80
- package/es/components/Menu/MenuContext.js +9 -12
- package/es/components/Menu/MenuItem.js +104 -128
- package/es/components/MenuButton/index.js +37 -41
- package/es/components/Modal/Modal.js +281 -120
- package/es/components/ModalWrapper/ModalWrapper.js +72 -96
- package/es/components/MultiSelect/FilterableMultiSelect.js +299 -163
- package/es/components/MultiSelect/MultiSelect.js +162 -174
- package/es/components/MultiSelect/MultiSelectPropTypes.js +1 -1
- package/es/components/MultiSelect/tools/itemToString.js +3 -4
- package/es/components/MultiSelect/tools/sorting.js +15 -13
- package/es/components/Notification/Notification.js +436 -164
- package/es/components/NumberInput/NumberInput.Skeleton.js +10 -11
- package/es/components/NumberInput/NumberInput.js +140 -139
- package/es/components/OrderedList/OrderedList.js +17 -15
- package/es/components/OverflowMenu/OverflowMenu.js +359 -227
- package/es/components/OverflowMenu/index.js +1 -1
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +32 -37
- package/es/components/OverflowMenuV2/index.js +26 -28
- package/es/components/Pagination/Pagination.Skeleton.js +9 -10
- package/es/components/Pagination/Pagination.js +98 -140
- package/es/components/Pagination/experimental/PageSelector.js +16 -16
- package/es/components/Pagination/experimental/Pagination.js +73 -94
- package/es/components/PaginationNav/PaginationNav.js +98 -117
- package/es/components/Popover/index.js +74 -80
- package/es/components/PrimaryButton/PrimaryButton.js +3 -5
- package/es/components/ProgressBar/ProgressBar.js +39 -37
- package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +15 -14
- package/es/components/ProgressIndicator/ProgressIndicator.js +71 -71
- package/es/components/RadioButton/RadioButton.Skeleton.js +9 -10
- package/es/components/RadioButton/RadioButton.js +27 -27
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +55 -65
- package/es/components/RadioTile/RadioTile.js +27 -25
- package/es/components/Search/Search.Skeleton.js +16 -16
- package/es/components/Search/Search.d.ts +83 -0
- package/es/components/Search/Search.js +65 -72
- package/es/components/Search/index.d.ts +11 -0
- package/es/components/SecondaryButton/SecondaryButton.js +3 -5
- package/es/components/Select/Select.Skeleton.js +12 -13
- package/es/components/Select/Select.js +79 -73
- package/es/components/SelectItem/SelectItem.js +17 -13
- package/es/components/SelectItemGroup/SelectItemGroup.js +11 -12
- package/es/components/SkeletonIcon/SkeletonIcon.js +11 -11
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +11 -11
- package/es/components/SkeletonText/SkeletonText.js +29 -29
- package/es/components/Slider/Slider.Skeleton.js +17 -18
- package/es/components/Slider/Slider.js +306 -329
- package/es/components/Slider/index.js +1 -1
- package/es/components/Stack/Stack.js +19 -20
- package/es/components/Stack/index.js +2 -2
- package/es/components/StructuredList/StructuredList.Skeleton.js +25 -24
- package/es/components/StructuredList/StructuredList.js +134 -106
- package/es/components/Switch/IconSwitch.js +48 -54
- package/es/components/Switch/Switch.js +33 -31
- package/es/components/Tab/Tab.js +77 -83
- package/es/components/Tab/index.js +1 -1
- package/es/components/TabContent/TabContent.js +16 -18
- package/es/components/Tabs/Tabs.Skeleton.js +14 -13
- package/es/components/Tabs/Tabs.js +195 -206
- package/es/components/Tabs/usePressable.js +27 -36
- package/es/components/Tag/Tag.Skeleton.js +10 -9
- package/es/components/Tag/Tag.js +34 -31
- package/es/components/Text/Text.js +20 -20
- package/es/components/Text/TextDirection.js +8 -7
- package/es/components/Text/TextDirectionContext.js +1 -1
- package/es/components/Text/index.js +1 -1
- package/es/components/TextArea/TextArea.Skeleton.js +11 -12
- package/es/components/TextArea/TextArea.js +89 -83
- package/es/components/TextInput/ControlledPasswordInput.js +79 -73
- package/es/components/TextInput/PasswordInput.js +101 -91
- package/es/components/TextInput/TextInput.Skeleton.js +11 -12
- package/es/components/TextInput/TextInput.js +104 -92
- package/es/components/TextInput/util.js +26 -28
- package/es/components/Theme/index.js +25 -20
- package/es/components/Tile/Tile.js +135 -176
- package/es/components/TileGroup/TileGroup.js +55 -70
- package/es/components/TileGroup/index.js +1 -1
- package/es/components/TimePicker/TimePicker.js +60 -67
- package/es/components/TimePickerSelect/TimePickerSelect.js +20 -18
- package/es/components/TimePickerSelect/index.js +1 -1
- package/es/components/Toggle/Toggle.Skeleton.js +63 -52
- package/es/components/Toggle/Toggle.js +44 -48
- package/es/components/ToggleSmall/ToggleSmall.Skeleton.js +56 -50
- package/es/components/Toggletip/index.js +52 -48
- package/es/components/Tooltip/DefinitionTooltip.js +24 -31
- package/es/components/Tooltip/Tooltip.js +35 -50
- package/es/components/TreeView/TreeNode.js +94 -74
- package/es/components/TreeView/TreeView.js +72 -83
- package/es/components/UIShell/Content.js +12 -14
- package/es/components/UIShell/Header.js +16 -12
- package/es/components/UIShell/HeaderContainer.js +8 -14
- package/es/components/UIShell/HeaderGlobalAction.js +26 -19
- package/es/components/UIShell/HeaderGlobalBar.js +1 -3
- package/es/components/UIShell/HeaderMenu.js +114 -129
- package/es/components/UIShell/HeaderMenuButton.js +31 -22
- package/es/components/UIShell/HeaderMenuItem.js +28 -20
- package/es/components/UIShell/HeaderName.js +19 -14
- package/es/components/UIShell/HeaderNavigation.js +19 -15
- package/es/components/UIShell/HeaderPanel.js +23 -17
- package/es/components/UIShell/HeaderSideNavItems.js +11 -9
- package/es/components/UIShell/Link.js +11 -11
- package/es/components/UIShell/SideNav.js +66 -62
- package/es/components/UIShell/SideNavDetails.js +11 -12
- package/es/components/UIShell/SideNavDivider.js +5 -3
- package/es/components/UIShell/SideNavFooter.js +12 -12
- package/es/components/UIShell/SideNavHeader.js +8 -6
- package/es/components/UIShell/SideNavIcon.js +11 -8
- package/es/components/UIShell/SideNavItem.js +11 -9
- package/es/components/UIShell/SideNavItems.js +13 -11
- package/es/components/UIShell/SideNavLink.js +19 -17
- package/es/components/UIShell/SideNavLinkText.js +8 -9
- package/es/components/UIShell/SideNavMenu.js +28 -35
- package/es/components/UIShell/SideNavMenuItem.js +14 -14
- package/es/components/UIShell/SideNavSwitcher.js +19 -19
- package/es/components/UIShell/SkipToContent.js +10 -11
- package/es/components/UIShell/Switcher.js +20 -11
- package/es/components/UIShell/SwitcherDivider.js +10 -9
- package/es/components/UIShell/SwitcherItem.js +26 -19
- package/es/components/UIShell/_utils.js +1 -1
- package/es/components/UnorderedList/UnorderedList.js +14 -14
- package/es/index.js +5 -5
- package/es/internal/ClickListener.js +49 -65
- package/es/internal/FloatingMenu.js +193 -200
- package/es/internal/OptimizedResize.js +9 -8
- package/es/internal/Selection.js +92 -111
- package/es/internal/createClassWrapper.js +2 -2
- package/es/internal/deprecateFieldOnObject.js +5 -3
- package/es/internal/environment.js +1 -1
- package/es/internal/focus/index.js +1 -1
- package/es/internal/keyboard/keys.js +11 -11
- package/es/internal/keyboard/match.js +7 -6
- package/es/internal/keyboard/navigation.js +15 -5
- package/es/internal/useAnnouncer.js +2 -2
- package/es/internal/useAttachedMenu.js +12 -20
- package/es/internal/useControllableState.js +11 -16
- package/es/internal/useDelayedState.js +9 -18
- package/es/internal/useEffectOnce.js +4 -4
- package/es/internal/useEvent.js +4 -4
- package/es/internal/useId.js +15 -19
- package/es/internal/useIdPrefix.js +1 -1
- package/es/internal/useIsomorphicEffect.js +1 -1
- package/es/internal/useMergedRefs.js +3 -3
- package/es/internal/useNoInteractiveChildren.js +8 -19
- package/es/internal/useNormalizedInputProps.js +16 -14
- package/es/internal/usePrefix.js +1 -1
- package/es/internal/useSavedCallback.js +3 -3
- package/es/internal/warning.js +4 -4
- package/es/internal/wrapFocus.js +16 -21
- package/es/prop-types/AriaPropTypes.js +1 -1
- package/es/prop-types/deprecate.js +6 -5
- package/es/prop-types/isRequiredOneOf.js +12 -25
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +2 -2
- package/es/prop-types/types.js +1 -1
- package/es/tools/array.js +1 -1
- package/es/tools/events.js +21 -14
- package/es/tools/mergeRefs.js +3 -3
- package/es/tools/setupGetInstanceId.js +1 -1
- package/es/tools/uniqueId.js +3 -3
- package/es/tools/wrapComponent.js +14 -13
- package/lib/_virtual/_rollupPluginBabelHelpers.js +0 -336
- package/lib/components/Accordion/Accordion.Skeleton.js +27 -29
- package/lib/components/Accordion/Accordion.js +17 -20
- package/lib/components/Accordion/AccordionItem.js +36 -48
- package/lib/components/AspectRatio/AspectRatio.js +9 -11
- package/lib/components/Breadcrumb/Breadcrumb.Skeleton.js +9 -10
- package/lib/components/Breadcrumb/Breadcrumb.js +13 -12
- package/lib/components/Breadcrumb/BreadcrumbItem.js +23 -21
- package/lib/components/Button/Button.Skeleton.js +24 -22
- package/lib/components/Button/Button.js +76 -71
- package/lib/components/ButtonSet/ButtonSet.js +11 -9
- package/lib/components/Checkbox/Checkbox.Skeleton.js +9 -10
- package/lib/components/Checkbox/Checkbox.js +54 -51
- package/lib/components/CheckboxGroup/CheckboxGroup.js +32 -30
- package/lib/components/ClassPrefix/index.js +4 -2
- package/lib/components/CodeSnippet/CodeSnippet.Skeleton.js +14 -13
- package/lib/components/CodeSnippet/CodeSnippet.js +198 -101
- package/lib/components/ComboBox/ComboBox.js +348 -177
- package/lib/components/ComboBox/tools/filter.js +6 -4
- package/lib/components/ComboButton/index.js +37 -42
- package/lib/components/ComposedModal/ComposedModal.js +187 -85
- package/lib/components/ComposedModal/ModalFooter.js +53 -48
- package/lib/components/ComposedModal/ModalHeader.js +38 -25
- package/lib/components/ContainedList/ContainedList.js +18 -17
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +20 -18
- package/lib/components/ContentSwitcher/ContentSwitcher.js +82 -97
- package/lib/components/ContentSwitcher/index.js +1 -1
- package/lib/components/ContextMenu/useContextMenu.js +12 -21
- package/lib/components/Copy/Copy.js +23 -28
- package/lib/components/CopyButton/CopyButton.js +9 -9
- package/lib/components/DangerButton/DangerButton.js +3 -5
- package/lib/components/DataTable/DataTable.js +332 -359
- package/lib/components/DataTable/Table.js +28 -25
- package/lib/components/DataTable/TableActionList.js +2 -4
- package/lib/components/DataTable/TableBatchAction.js +2 -4
- package/lib/components/DataTable/TableBatchActions.js +28 -29
- package/lib/components/DataTable/TableBody.js +6 -7
- package/lib/components/DataTable/TableCell.js +1 -1
- package/lib/components/DataTable/TableContainer.js +22 -22
- package/lib/components/DataTable/TableContext.js +1 -1
- package/lib/components/DataTable/TableExpandHeader.js +18 -20
- package/lib/components/DataTable/TableExpandRow.js +22 -22
- package/lib/components/DataTable/TableExpandedRow.js +17 -22
- package/lib/components/DataTable/TableHead.js +1 -1
- package/lib/components/DataTable/TableHeader.js +43 -39
- package/lib/components/DataTable/TableRow.js +7 -8
- package/lib/components/DataTable/TableSelectAll.js +13 -11
- package/lib/components/DataTable/TableSelectRow.js +28 -20
- package/lib/components/DataTable/TableToolbar.js +18 -13
- package/lib/components/DataTable/TableToolbarAction.js +5 -5
- package/lib/components/DataTable/TableToolbarContent.js +2 -4
- package/lib/components/DataTable/TableToolbarMenu.js +10 -11
- package/lib/components/DataTable/TableToolbarSearch.js +51 -70
- package/lib/components/DataTable/state/getDerivedStateFromProps.js +15 -15
- package/lib/components/DataTable/state/sortStates.js +1 -1
- package/lib/components/DataTable/state/sorting.js +28 -20
- package/lib/components/DataTable/tools/cells.js +1 -3
- package/lib/components/DataTable/tools/denormalize.js +4 -17
- package/lib/components/DataTable/tools/filter.js +18 -16
- package/lib/components/DataTable/tools/instanceId.js +2 -2
- package/lib/components/DataTable/tools/normalize.js +28 -25
- package/lib/components/DataTable/tools/sorting.js +27 -24
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +35 -37
- package/lib/components/DatePicker/DatePicker.Skeleton.js +16 -17
- package/lib/components/DatePicker/DatePicker.js +205 -194
- package/lib/components/DatePicker/plugins/appendToPlugin.js +45 -43
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +117 -107
- package/lib/components/DatePicker/plugins/rangePlugin.js +19 -11
- package/lib/components/DatePickerInput/DatePickerInput.js +83 -74
- package/lib/components/Dropdown/Dropdown.Skeleton.js +12 -11
- package/lib/components/Dropdown/Dropdown.js +265 -108
- package/lib/components/ErrorBoundary/ErrorBoundary.js +27 -48
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +3 -2
- package/lib/components/ExpandableSearch/ExpandableSearch.d.ts +13 -0
- package/lib/components/ExpandableSearch/ExpandableSearch.js +17 -24
- package/lib/components/FeatureFlags/index.js +25 -43
- package/lib/components/FileUploader/FileUploader.Skeleton.js +7 -8
- package/lib/components/FileUploader/FileUploader.js +119 -146
- package/lib/components/FileUploader/FileUploaderButton.js +35 -47
- package/lib/components/FileUploader/FileUploaderDropContainer.js +48 -52
- package/lib/components/FileUploader/FileUploaderItem.js +29 -29
- package/lib/components/FileUploader/Filename.js +12 -13
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +10 -11
- package/lib/components/FluidComboBox/FluidComboBox.js +10 -8
- package/lib/components/FluidDatePicker/FluidDatePicker.Skeleton.js +17 -17
- package/lib/components/FluidDatePicker/FluidDatePicker.js +18 -15
- package/lib/components/FluidDatePickerInput/FluidDatePickerInput.js +3 -3
- package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +10 -11
- package/lib/components/FluidDropdown/FluidDropdown.js +10 -8
- package/lib/components/FluidForm/FluidForm.js +8 -9
- package/lib/components/FluidForm/FormContext.js +1 -1
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +10 -11
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +11 -9
- package/lib/components/FluidSelect/FluidSelect.Skeleton.js +10 -11
- package/lib/components/FluidSelect/FluidSelect.js +8 -8
- package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +8 -9
- package/lib/components/FluidTextArea/FluidTextArea.js +6 -7
- package/lib/components/FluidTextInput/FluidTextInput.Skeleton.js +8 -9
- package/lib/components/FluidTextInput/FluidTextInput.js +9 -8
- package/lib/components/FluidTimePicker/FluidTimePicker.Skeleton.js +10 -9
- package/lib/components/FluidTimePicker/FluidTimePicker.js +30 -26
- package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +6 -6
- package/lib/components/Form/Form.js +8 -9
- package/lib/components/FormGroup/FormGroup.js +15 -16
- package/lib/components/FormItem/FormItem.js +7 -8
- package/lib/components/FormLabel/FormLabel.js +10 -9
- package/lib/components/Grid/CSSGrid.js +37 -38
- package/lib/components/Grid/Column.js +85 -78
- package/lib/components/Grid/ColumnHang.js +11 -13
- package/lib/components/Grid/FlexGrid.js +19 -21
- package/lib/components/Grid/Grid.js +2 -2
- package/lib/components/Grid/GridContext.js +12 -11
- package/lib/components/Grid/Row.js +16 -18
- package/lib/components/Heading/index.js +11 -13
- package/lib/components/Icon/Icon.Skeleton.js +9 -11
- package/lib/components/IconButton/index.js +18 -21
- package/lib/components/IdPrefix/index.js +4 -2
- package/lib/components/InlineCheckbox/InlineCheckbox.js +89 -36
- package/lib/components/InlineLoading/InlineLoading.js +22 -24
- package/lib/components/Layer/LayerContext.js +1 -1
- package/lib/components/Layer/index.js +16 -17
- package/lib/components/Layout/LayoutDirection.js +7 -9
- package/lib/components/Layout/LayoutDirectionContext.js +1 -1
- package/lib/components/Link/Link.js +24 -24
- package/lib/components/ListBox/ListBox.js +37 -30
- package/lib/components/ListBox/ListBoxField.js +8 -9
- package/lib/components/ListBox/ListBoxMenu.js +8 -9
- package/lib/components/ListBox/ListBoxMenuIcon.js +16 -14
- package/lib/components/ListBox/ListBoxMenuItem.js +22 -25
- package/lib/components/ListBox/ListBoxPropTypes.js +4 -4
- package/lib/components/ListBox/ListBoxSelection.js +30 -25
- package/lib/components/ListBox/index.js +1 -1
- package/lib/components/ListBox/next/ListBoxSelection.js +26 -23
- package/lib/components/ListBox/next/ListBoxTrigger.js +19 -18
- package/lib/components/ListItem/ListItem.js +8 -9
- package/lib/components/Loading/Loading.js +23 -23
- package/lib/components/Menu/Menu.js +66 -79
- package/lib/components/Menu/MenuContext.js +9 -12
- package/lib/components/Menu/MenuItem.js +103 -127
- package/lib/components/MenuButton/index.js +36 -40
- package/lib/components/Modal/Modal.js +280 -119
- package/lib/components/ModalWrapper/ModalWrapper.js +71 -95
- package/lib/components/MultiSelect/FilterableMultiSelect.js +298 -162
- package/lib/components/MultiSelect/MultiSelect.js +163 -175
- package/lib/components/MultiSelect/MultiSelectPropTypes.js +1 -1
- package/lib/components/MultiSelect/tools/itemToString.js +3 -4
- package/lib/components/MultiSelect/tools/sorting.js +15 -13
- package/lib/components/Notification/Notification.js +434 -162
- package/lib/components/NumberInput/NumberInput.Skeleton.js +9 -10
- package/lib/components/NumberInput/NumberInput.js +139 -138
- package/lib/components/OrderedList/OrderedList.js +16 -14
- package/lib/components/OverflowMenu/OverflowMenu.js +358 -226
- package/lib/components/OverflowMenu/index.js +1 -1
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +31 -36
- package/lib/components/OverflowMenuV2/index.js +25 -27
- package/lib/components/Pagination/Pagination.Skeleton.js +8 -9
- package/lib/components/Pagination/Pagination.js +97 -139
- package/lib/components/Pagination/experimental/PageSelector.js +17 -17
- package/lib/components/Pagination/experimental/Pagination.js +72 -93
- package/lib/components/PaginationNav/PaginationNav.js +97 -116
- package/lib/components/Popover/index.js +73 -79
- package/lib/components/PrimaryButton/PrimaryButton.js +3 -5
- package/lib/components/ProgressBar/ProgressBar.js +38 -36
- package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +14 -13
- package/lib/components/ProgressIndicator/ProgressIndicator.js +70 -70
- package/lib/components/RadioButton/RadioButton.Skeleton.js +8 -9
- package/lib/components/RadioButton/RadioButton.js +26 -26
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +54 -64
- package/lib/components/RadioTile/RadioTile.js +26 -24
- package/lib/components/Search/Search.Skeleton.js +15 -15
- package/lib/components/Search/Search.d.ts +83 -0
- package/lib/components/Search/Search.js +62 -69
- package/lib/components/Search/index.d.ts +11 -0
- package/lib/components/SecondaryButton/SecondaryButton.js +3 -5
- package/lib/components/Select/Select.Skeleton.js +11 -12
- package/lib/components/Select/Select.js +78 -72
- package/lib/components/SelectItem/SelectItem.js +16 -12
- package/lib/components/SelectItemGroup/SelectItemGroup.js +10 -11
- package/lib/components/SkeletonIcon/SkeletonIcon.js +10 -10
- package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +10 -10
- package/lib/components/SkeletonText/SkeletonText.js +28 -28
- package/lib/components/Slider/Slider.Skeleton.js +16 -17
- package/lib/components/Slider/Slider.js +305 -328
- package/lib/components/Slider/index.js +1 -1
- package/lib/components/Stack/Stack.js +18 -19
- package/lib/components/Stack/index.js +2 -2
- package/lib/components/StructuredList/StructuredList.Skeleton.js +24 -23
- package/lib/components/StructuredList/StructuredList.js +133 -105
- package/lib/components/Switch/IconSwitch.js +45 -51
- package/lib/components/Switch/Switch.js +33 -31
- package/lib/components/Tab/Tab.js +76 -82
- package/lib/components/Tab/index.js +1 -1
- package/lib/components/TabContent/TabContent.js +15 -17
- package/lib/components/Tabs/Tabs.Skeleton.js +13 -12
- package/lib/components/Tabs/Tabs.js +194 -205
- package/lib/components/Tabs/usePressable.js +27 -36
- package/lib/components/Tag/Tag.Skeleton.js +9 -8
- package/lib/components/Tag/Tag.js +33 -30
- package/lib/components/Text/Text.js +19 -19
- package/lib/components/Text/TextDirection.js +8 -7
- package/lib/components/Text/TextDirectionContext.js +1 -1
- package/lib/components/Text/index.js +1 -1
- package/lib/components/TextArea/TextArea.Skeleton.js +10 -11
- package/lib/components/TextArea/TextArea.js +88 -82
- package/lib/components/TextInput/ControlledPasswordInput.js +78 -72
- package/lib/components/TextInput/PasswordInput.js +100 -90
- package/lib/components/TextInput/TextInput.Skeleton.js +10 -11
- package/lib/components/TextInput/TextInput.js +104 -92
- package/lib/components/TextInput/util.js +28 -30
- package/lib/components/Theme/index.js +24 -19
- package/lib/components/Tile/Tile.js +134 -175
- package/lib/components/TileGroup/TileGroup.js +54 -69
- package/lib/components/TileGroup/index.js +1 -1
- package/lib/components/TimePicker/TimePicker.js +59 -66
- package/lib/components/TimePickerSelect/TimePickerSelect.js +19 -17
- package/lib/components/TimePickerSelect/index.js +1 -1
- package/lib/components/Toggle/Toggle.Skeleton.js +68 -57
- package/lib/components/Toggle/Toggle.js +43 -47
- package/lib/components/ToggleSmall/ToggleSmall.Skeleton.js +60 -54
- package/lib/components/Toggletip/index.js +51 -47
- package/lib/components/Tooltip/DefinitionTooltip.js +23 -30
- package/lib/components/Tooltip/Tooltip.js +34 -49
- package/lib/components/TreeView/TreeNode.js +93 -73
- package/lib/components/TreeView/TreeView.js +71 -82
- package/lib/components/UIShell/Content.js +12 -14
- package/lib/components/UIShell/Header.js +15 -11
- package/lib/components/UIShell/HeaderContainer.js +8 -14
- package/lib/components/UIShell/HeaderGlobalAction.js +25 -18
- package/lib/components/UIShell/HeaderGlobalBar.js +1 -3
- package/lib/components/UIShell/HeaderMenu.js +113 -128
- package/lib/components/UIShell/HeaderMenuButton.js +30 -21
- package/lib/components/UIShell/HeaderMenuItem.js +27 -19
- package/lib/components/UIShell/HeaderName.js +18 -13
- package/lib/components/UIShell/HeaderNavigation.js +18 -14
- package/lib/components/UIShell/HeaderPanel.js +22 -16
- package/lib/components/UIShell/HeaderSideNavItems.js +11 -9
- package/lib/components/UIShell/Link.js +11 -11
- package/lib/components/UIShell/SideNav.js +65 -61
- package/lib/components/UIShell/SideNavDetails.js +10 -11
- package/lib/components/UIShell/SideNavDivider.js +5 -3
- package/lib/components/UIShell/SideNavFooter.js +12 -12
- package/lib/components/UIShell/SideNavHeader.js +8 -6
- package/lib/components/UIShell/SideNavIcon.js +11 -8
- package/lib/components/UIShell/SideNavItem.js +11 -9
- package/lib/components/UIShell/SideNavItems.js +13 -11
- package/lib/components/UIShell/SideNavLink.js +18 -16
- package/lib/components/UIShell/SideNavLinkText.js +7 -8
- package/lib/components/UIShell/SideNavMenu.js +28 -35
- package/lib/components/UIShell/SideNavMenuItem.js +13 -13
- package/lib/components/UIShell/SideNavSwitcher.js +19 -19
- package/lib/components/UIShell/SkipToContent.js +9 -10
- package/lib/components/UIShell/Switcher.js +19 -10
- package/lib/components/UIShell/SwitcherDivider.js +9 -8
- package/lib/components/UIShell/SwitcherItem.js +25 -18
- package/lib/components/UIShell/_utils.js +1 -1
- package/lib/components/UnorderedList/UnorderedList.js +13 -13
- package/lib/index.js +10 -10
- package/lib/internal/ClickListener.js +49 -65
- package/lib/internal/FloatingMenu.js +192 -199
- package/lib/internal/OptimizedResize.js +9 -8
- package/lib/internal/Selection.js +91 -110
- package/lib/internal/createClassWrapper.js +2 -2
- package/lib/internal/deprecateFieldOnObject.js +5 -3
- package/lib/internal/environment.js +1 -1
- package/lib/internal/focus/index.js +1 -1
- package/lib/internal/keyboard/keys.js +11 -11
- package/lib/internal/keyboard/match.js +7 -6
- package/lib/internal/keyboard/navigation.js +15 -5
- package/lib/internal/useAnnouncer.js +2 -2
- package/lib/internal/useAttachedMenu.js +12 -20
- package/lib/internal/useControllableState.js +11 -16
- package/lib/internal/useDelayedState.js +9 -18
- package/lib/internal/useEffectOnce.js +4 -4
- package/lib/internal/useEvent.js +4 -4
- package/lib/internal/useId.js +14 -18
- package/lib/internal/useIdPrefix.js +1 -1
- package/lib/internal/useIsomorphicEffect.js +1 -1
- package/lib/internal/useMergedRefs.js +3 -3
- package/lib/internal/useNoInteractiveChildren.js +8 -19
- package/lib/internal/useNormalizedInputProps.js +16 -14
- package/lib/internal/usePrefix.js +1 -1
- package/lib/internal/useSavedCallback.js +3 -3
- package/lib/internal/warning.js +4 -4
- package/lib/internal/wrapFocus.js +16 -21
- package/lib/prop-types/AriaPropTypes.js +1 -1
- package/lib/prop-types/deprecate.js +6 -5
- package/lib/prop-types/isRequiredOneOf.js +15 -28
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +2 -2
- package/lib/prop-types/types.js +1 -1
- package/lib/tools/array.js +1 -1
- package/lib/tools/events.js +21 -14
- package/lib/tools/mergeRefs.js +3 -3
- package/lib/tools/setupGetInstanceId.js +1 -1
- package/lib/tools/uniqueId.js +3 -3
- package/lib/tools/wrapComponent.js +14 -13
- package/package.json +6 -6
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import React__default, { useState, useContext, useEffect } from 'react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
@@ -17,113 +17,123 @@ import { FormContext } from '../FluidForm/FormContext.js';
|
|
|
17
17
|
import deprecate from '../../prop-types/deprecate.js';
|
|
18
18
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
warnText = _ref.warnText,
|
|
58
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
59
|
-
|
|
60
|
-
var _useState = useState(type),
|
|
61
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
62
|
-
inputType = _useState2[0],
|
|
63
|
-
setInputType = _useState2[1];
|
|
64
|
-
|
|
65
|
-
var prefix = usePrefix();
|
|
66
|
-
var normalizedProps = useNormalizedInputProps({
|
|
67
|
-
id: id,
|
|
68
|
-
invalid: invalid,
|
|
69
|
-
invalidText: invalidText,
|
|
70
|
-
warn: warn,
|
|
71
|
-
warnText: warnText,
|
|
72
|
-
readOnly: readOnly,
|
|
73
|
-
disabled: disabled
|
|
20
|
+
const PasswordInput = /*#__PURE__*/React__default.forwardRef(function PasswordInput(_ref, ref) {
|
|
21
|
+
let {
|
|
22
|
+
className,
|
|
23
|
+
disabled = false,
|
|
24
|
+
helperText,
|
|
25
|
+
hideLabel,
|
|
26
|
+
hidePasswordLabel = 'Hide password',
|
|
27
|
+
id,
|
|
28
|
+
inline,
|
|
29
|
+
invalid = false,
|
|
30
|
+
invalidText,
|
|
31
|
+
labelText,
|
|
32
|
+
light,
|
|
33
|
+
onChange = () => {},
|
|
34
|
+
onClick = () => {},
|
|
35
|
+
onTogglePasswordVisibility,
|
|
36
|
+
placeholder,
|
|
37
|
+
readOnly,
|
|
38
|
+
size = 'md',
|
|
39
|
+
showPasswordLabel = 'Show password',
|
|
40
|
+
tooltipPosition = 'bottom',
|
|
41
|
+
tooltipAlignment = 'center',
|
|
42
|
+
type = 'password',
|
|
43
|
+
warn = false,
|
|
44
|
+
warnText,
|
|
45
|
+
...rest
|
|
46
|
+
} = _ref;
|
|
47
|
+
const [inputType, setInputType] = useState(type);
|
|
48
|
+
const prefix = usePrefix();
|
|
49
|
+
const normalizedProps = useNormalizedInputProps({
|
|
50
|
+
id,
|
|
51
|
+
invalid,
|
|
52
|
+
invalidText,
|
|
53
|
+
warn,
|
|
54
|
+
warnText,
|
|
55
|
+
readOnly,
|
|
56
|
+
disabled
|
|
74
57
|
});
|
|
58
|
+
const {
|
|
59
|
+
isFluid
|
|
60
|
+
} = useContext(FormContext);
|
|
75
61
|
|
|
76
|
-
|
|
77
|
-
isFluid = _useContext.isFluid;
|
|
78
|
-
|
|
79
|
-
var handleTogglePasswordVisibility = function handleTogglePasswordVisibility(event) {
|
|
62
|
+
const handleTogglePasswordVisibility = event => {
|
|
80
63
|
setInputType(inputType === 'password' ? 'text' : 'password');
|
|
81
64
|
onTogglePasswordVisibility && onTogglePasswordVisibility(event);
|
|
82
65
|
};
|
|
83
66
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
67
|
+
const textInputClasses = cx(`${prefix}--text-input`, `${prefix}--password-input`, className, {
|
|
68
|
+
[`${prefix}--text-input--light`]: light,
|
|
69
|
+
[`${prefix}--text-input--invalid`]: normalizedProps.invalid,
|
|
70
|
+
[`${prefix}--text-input--warning`]: normalizedProps.warn,
|
|
71
|
+
[`${prefix}--text-input--${size}`]: size
|
|
72
|
+
});
|
|
73
|
+
const sharedTextInputProps = {
|
|
74
|
+
id,
|
|
75
|
+
onChange: evt => {
|
|
89
76
|
if (!disabled) {
|
|
90
|
-
|
|
77
|
+
onChange(evt);
|
|
91
78
|
}
|
|
92
79
|
},
|
|
93
|
-
onClick:
|
|
80
|
+
onClick: evt => {
|
|
94
81
|
if (!disabled) {
|
|
95
|
-
|
|
82
|
+
onClick(evt);
|
|
96
83
|
}
|
|
97
84
|
},
|
|
98
|
-
placeholder
|
|
85
|
+
placeholder,
|
|
99
86
|
type: inputType,
|
|
100
87
|
className: textInputClasses,
|
|
101
|
-
ref
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
88
|
+
ref,
|
|
89
|
+
...rest
|
|
90
|
+
};
|
|
91
|
+
const inputWrapperClasses = cx(`${prefix}--form-item`, `${prefix}--text-input-wrapper`, `${prefix}--password-input-wrapper`, {
|
|
92
|
+
[`${prefix}--text-input-wrapper--light`]: light,
|
|
93
|
+
[`${prefix}--text-input-wrapper--inline`]: inline,
|
|
94
|
+
[`${prefix}--text-input--fluid`]: isFluid
|
|
95
|
+
});
|
|
96
|
+
const labelClasses = cx(`${prefix}--label`, {
|
|
97
|
+
[`${prefix}--visually-hidden`]: hideLabel,
|
|
98
|
+
[`${prefix}--label--disabled`]: disabled,
|
|
99
|
+
[`${prefix}--label--inline`]: inline,
|
|
100
|
+
[`${prefix}--label--inline--${size}`]: inline && !!size
|
|
101
|
+
});
|
|
102
|
+
const helperTextClasses = cx(`${prefix}--form__helper-text`, {
|
|
103
|
+
[`${prefix}--form__helper-text--disabled`]: disabled,
|
|
104
|
+
[`${prefix}--form__helper-text--inline`]: inline
|
|
105
|
+
});
|
|
106
|
+
const fieldOuterWrapperClasses = cx(`${prefix}--text-input__field-outer-wrapper`, {
|
|
107
|
+
[`${prefix}--text-input__field-outer-wrapper--inline`]: inline
|
|
108
|
+
});
|
|
109
|
+
const fieldWrapperClasses = cx(`${prefix}--text-input__field-wrapper`, {
|
|
110
|
+
[`${prefix}--text-input__field-wrapper--warning`]: normalizedProps.warn
|
|
111
|
+
});
|
|
112
|
+
const iconClasses = cx({
|
|
113
|
+
[`${prefix}--text-input__invalid-icon`]: normalizedProps.invalid || normalizedProps.warn,
|
|
114
|
+
[`${prefix}--text-input__invalid-icon--warning`]: normalizedProps.warn
|
|
115
|
+
});
|
|
116
|
+
const label = labelText ? /*#__PURE__*/React__default.createElement("label", {
|
|
111
117
|
htmlFor: id,
|
|
112
118
|
className: labelClasses
|
|
113
119
|
}, labelText) : null;
|
|
114
|
-
|
|
120
|
+
const helper = helperText ? /*#__PURE__*/React__default.createElement("div", {
|
|
115
121
|
id: normalizedProps.helperId,
|
|
116
122
|
className: helperTextClasses
|
|
117
123
|
}, helperText) : null;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
className:
|
|
124
|
+
const passwordIsVisible = inputType === 'text';
|
|
125
|
+
const passwordVisibilityIcon = passwordIsVisible ? /*#__PURE__*/React__default.createElement(ViewOff, {
|
|
126
|
+
className: `${prefix}--icon-visibility-off`
|
|
121
127
|
}) : /*#__PURE__*/React__default.createElement(View, {
|
|
122
|
-
className:
|
|
128
|
+
className: `${prefix}--icon-visibility-on`
|
|
129
|
+
});
|
|
130
|
+
const passwordVisibilityToggleClasses = cx(`${prefix}--text-input--password__visibility__toggle`, `${prefix}--btn`, `${prefix}--btn--icon-only`, `${prefix}--tooltip__trigger`, `${prefix}--tooltip--a11y`, {
|
|
131
|
+
[`${prefix}--btn--disabled`]: disabled,
|
|
132
|
+
[`${prefix}--tooltip--${tooltipPosition}`]: tooltipPosition,
|
|
133
|
+
[`${prefix}--tooltip--align-${tooltipAlignment}`]: tooltipAlignment
|
|
123
134
|
});
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
sharedTextInputProps: sharedTextInputProps,
|
|
135
|
+
const input = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("input", _extends({}, textInputProps({
|
|
136
|
+
sharedTextInputProps,
|
|
127
137
|
invalid: normalizedProps.invalid,
|
|
128
138
|
invalidId: normalizedProps.invalidId,
|
|
129
139
|
warn: normalizedProps.warn,
|
|
@@ -134,23 +144,23 @@ var PasswordInput = /*#__PURE__*/React__default.forwardRef(function PasswordInpu
|
|
|
134
144
|
disabled: disabled,
|
|
135
145
|
"data-toggle-password-visibility": inputType === 'password'
|
|
136
146
|
})), isFluid && /*#__PURE__*/React__default.createElement("hr", {
|
|
137
|
-
className:
|
|
147
|
+
className: `${prefix}--text-input__divider`
|
|
138
148
|
}), /*#__PURE__*/React__default.createElement("button", {
|
|
139
149
|
type: "button",
|
|
140
150
|
className: passwordVisibilityToggleClasses,
|
|
141
151
|
disabled: disabled,
|
|
142
152
|
onClick: handleTogglePasswordVisibility
|
|
143
153
|
}, !disabled && /*#__PURE__*/React__default.createElement("span", {
|
|
144
|
-
className:
|
|
154
|
+
className: `${prefix}--assistive-text`
|
|
145
155
|
}, passwordIsVisible ? hidePasswordLabel : showPasswordLabel), passwordVisibilityIcon));
|
|
146
|
-
useEffect(
|
|
156
|
+
useEffect(() => {
|
|
147
157
|
setInputType(type);
|
|
148
158
|
}, [type]);
|
|
149
|
-
|
|
159
|
+
const Icon = normalizedProps.icon;
|
|
150
160
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
151
161
|
className: inputWrapperClasses
|
|
152
162
|
}, !inline ? label : /*#__PURE__*/React__default.createElement("div", {
|
|
153
|
-
className:
|
|
163
|
+
className: `${prefix}--text-input__label-helper-wrapper`
|
|
154
164
|
}, label, !isFluid && helper), /*#__PURE__*/React__default.createElement("div", {
|
|
155
165
|
className: fieldOuterWrapperClasses
|
|
156
166
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -5,26 +5,25 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import React__default from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var prefix = usePrefix();
|
|
14
|
+
const TextInputSkeleton = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
hideLabel,
|
|
17
|
+
className,
|
|
18
|
+
...rest
|
|
19
|
+
} = _ref;
|
|
20
|
+
const prefix = usePrefix();
|
|
22
21
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
23
|
-
className: cx(
|
|
22
|
+
className: cx(`${prefix}--form-item`, className)
|
|
24
23
|
}, rest), !hideLabel && /*#__PURE__*/React__default.createElement("span", {
|
|
25
|
-
className:
|
|
24
|
+
className: `${prefix}--label ${prefix}--skeleton`
|
|
26
25
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
27
|
-
className:
|
|
26
|
+
className: `${prefix}--skeleton ${prefix}--text-input`
|
|
28
27
|
}));
|
|
29
28
|
};
|
|
30
29
|
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
8
|
import PropTypes from 'prop-types';
|
|
10
9
|
import React__default, { useState, useContext } from 'react';
|
|
11
10
|
import cx from 'classnames';
|
|
@@ -21,129 +20,142 @@ import * as FeatureFlags from '@carbon/feature-flags';
|
|
|
21
20
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
22
21
|
import { useAnnouncer } from '../../internal/useAnnouncer.js';
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
var _useState = useState((defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.toString().length) || (value === null || value === void 0 ? void 0 : value.toString().length) || 0),
|
|
65
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
66
|
-
textCount = _useState2[0],
|
|
67
|
-
setTextCount = _useState2[1];
|
|
68
|
-
|
|
69
|
-
var normalizedProps = useNormalizedInputProps({
|
|
70
|
-
id: id,
|
|
71
|
-
readOnly: readOnly,
|
|
72
|
-
disabled: disabled,
|
|
73
|
-
invalid: invalid,
|
|
74
|
-
invalidText: invalidText,
|
|
75
|
-
warn: warn,
|
|
76
|
-
warnText: warnText
|
|
23
|
+
const TextInput = /*#__PURE__*/React__default.forwardRef(function TextInput(_ref, ref) {
|
|
24
|
+
let {
|
|
25
|
+
className,
|
|
26
|
+
disabled = false,
|
|
27
|
+
helperText,
|
|
28
|
+
hideLabel,
|
|
29
|
+
id,
|
|
30
|
+
inline = false,
|
|
31
|
+
invalid = false,
|
|
32
|
+
invalidText,
|
|
33
|
+
labelText,
|
|
34
|
+
light,
|
|
35
|
+
onChange = () => {},
|
|
36
|
+
onClick = () => {},
|
|
37
|
+
placeholder,
|
|
38
|
+
readOnly,
|
|
39
|
+
size = 'md',
|
|
40
|
+
type = 'text',
|
|
41
|
+
warn = false,
|
|
42
|
+
warnText,
|
|
43
|
+
enableCounter = false,
|
|
44
|
+
maxCount,
|
|
45
|
+
...rest
|
|
46
|
+
} = _ref;
|
|
47
|
+
const prefix = usePrefix();
|
|
48
|
+
const enabled = useFeatureFlag('enable-v11-release');
|
|
49
|
+
const {
|
|
50
|
+
defaultValue,
|
|
51
|
+
value
|
|
52
|
+
} = rest;
|
|
53
|
+
const [textCount, setTextCount] = useState((defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.toString().length) || (value === null || value === void 0 ? void 0 : value.toString().length) || 0);
|
|
54
|
+
const normalizedProps = useNormalizedInputProps({
|
|
55
|
+
id,
|
|
56
|
+
readOnly,
|
|
57
|
+
disabled,
|
|
58
|
+
invalid,
|
|
59
|
+
invalidText,
|
|
60
|
+
warn,
|
|
61
|
+
warnText
|
|
77
62
|
});
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
63
|
+
const textInputClasses = cx(`${prefix}--text-input`, [enabled ? null : className], {
|
|
64
|
+
[`${prefix}--text-input--light`]: light,
|
|
65
|
+
[`${prefix}--text-input--invalid`]: normalizedProps.invalid,
|
|
66
|
+
[`${prefix}--text-input--warning`]: normalizedProps.warn,
|
|
67
|
+
[`${prefix}--text-input--${size}`]: size
|
|
68
|
+
});
|
|
69
|
+
const sharedTextInputProps = {
|
|
70
|
+
id,
|
|
71
|
+
onChange: evt => {
|
|
83
72
|
if (!normalizedProps.disabled) {
|
|
84
73
|
var _evt$target$value;
|
|
85
74
|
|
|
86
75
|
setTextCount((_evt$target$value = evt.target.value) === null || _evt$target$value === void 0 ? void 0 : _evt$target$value.length);
|
|
87
|
-
|
|
88
|
-
_onChange(evt);
|
|
76
|
+
onChange(evt);
|
|
89
77
|
}
|
|
90
78
|
},
|
|
91
|
-
onClick:
|
|
79
|
+
onClick: evt => {
|
|
92
80
|
if (!normalizedProps.disabled) {
|
|
93
|
-
|
|
81
|
+
onClick(evt);
|
|
94
82
|
}
|
|
95
83
|
},
|
|
96
|
-
placeholder
|
|
97
|
-
type
|
|
98
|
-
ref
|
|
84
|
+
placeholder,
|
|
85
|
+
type,
|
|
86
|
+
ref,
|
|
99
87
|
className: textInputClasses,
|
|
100
88
|
title: placeholder,
|
|
101
89
|
disabled: normalizedProps.disabled,
|
|
102
|
-
readOnly
|
|
103
|
-
|
|
90
|
+
readOnly,
|
|
91
|
+
['aria-describedby']: helperText && normalizedProps.helperId,
|
|
92
|
+
...rest
|
|
93
|
+
};
|
|
104
94
|
|
|
105
95
|
if (enableCounter) {
|
|
106
96
|
sharedTextInputProps.maxLength = maxCount;
|
|
107
97
|
}
|
|
108
98
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
99
|
+
const inputWrapperClasses = cx([enabled ? cx(`${prefix}--form-item`, className) : `${prefix}--form-item`], `${prefix}--text-input-wrapper`, {
|
|
100
|
+
[`${prefix}--text-input-wrapper--readonly`]: readOnly,
|
|
101
|
+
[`${prefix}--text-input-wrapper--light`]: light,
|
|
102
|
+
[`${prefix}--text-input-wrapper--inline`]: inline,
|
|
103
|
+
[`${prefix}--text-input-wrapper--inline--invalid`]: inline && normalizedProps.invalid
|
|
104
|
+
});
|
|
105
|
+
const labelClasses = cx(`${prefix}--label`, {
|
|
106
|
+
[`${prefix}--visually-hidden`]: hideLabel,
|
|
107
|
+
[`${prefix}--label--disabled`]: normalizedProps.disabled,
|
|
108
|
+
[`${prefix}--label--inline`]: inline,
|
|
109
|
+
[`${prefix}--label--inline--${size}`]: inline && !!size
|
|
110
|
+
});
|
|
111
|
+
const helperTextClasses = cx(`${prefix}--form__helper-text`, {
|
|
112
|
+
[`${prefix}--form__helper-text--disabled`]: normalizedProps.disabled,
|
|
113
|
+
[`${prefix}--form__helper-text--inline`]: inline
|
|
114
|
+
});
|
|
115
|
+
const fieldOuterWrapperClasses = cx(`${prefix}--text-input__field-outer-wrapper`, {
|
|
116
|
+
[`${prefix}--text-input__field-outer-wrapper--inline`]: inline
|
|
117
|
+
});
|
|
118
|
+
const fieldWrapperClasses = cx(`${prefix}--text-input__field-wrapper`, {
|
|
119
|
+
[`${prefix}--text-input__field-wrapper--warning`]: normalizedProps.warn
|
|
120
|
+
});
|
|
121
|
+
const iconClasses = cx({
|
|
122
|
+
[`${prefix}--text-input__invalid-icon`]: normalizedProps.invalid || normalizedProps.warn,
|
|
123
|
+
[`${prefix}--text-input__invalid-icon--warning`]: normalizedProps.warn
|
|
124
|
+
});
|
|
125
|
+
const counterClasses = cx(`${prefix}--label`, {
|
|
126
|
+
[`${prefix}--label--disabled`]: disabled,
|
|
127
|
+
[`${prefix}--text-input__label-counter`]: true
|
|
128
|
+
});
|
|
129
|
+
const counter = enableCounter && maxCount ? /*#__PURE__*/React__default.createElement("div", {
|
|
117
130
|
className: counterClasses
|
|
118
|
-
},
|
|
119
|
-
|
|
131
|
+
}, `${textCount}/${maxCount}`) : null;
|
|
132
|
+
const label = labelText ? /*#__PURE__*/React__default.createElement("label", {
|
|
120
133
|
htmlFor: id,
|
|
121
134
|
className: labelClasses
|
|
122
135
|
}, labelText) : null;
|
|
123
|
-
|
|
124
|
-
className:
|
|
136
|
+
const labelWrapper = /*#__PURE__*/React__default.createElement("div", {
|
|
137
|
+
className: `${prefix}--text-input__label-wrapper`
|
|
125
138
|
}, label, counter);
|
|
126
|
-
|
|
139
|
+
const helper = helperText ? /*#__PURE__*/React__default.createElement("div", {
|
|
127
140
|
id: normalizedProps.helperId,
|
|
128
141
|
className: helperTextClasses
|
|
129
142
|
}, helperText) : null;
|
|
130
|
-
|
|
131
|
-
sharedTextInputProps
|
|
143
|
+
const input = /*#__PURE__*/React__default.createElement("input", textInputProps({
|
|
144
|
+
sharedTextInputProps,
|
|
132
145
|
invalid: normalizedProps.invalid,
|
|
133
146
|
invalidId: normalizedProps.invalidId,
|
|
134
147
|
warn: normalizedProps.warn,
|
|
135
148
|
warnId: normalizedProps.warnId
|
|
136
149
|
}));
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
var Icon = normalizedProps.icon;
|
|
150
|
+
const {
|
|
151
|
+
isFluid
|
|
152
|
+
} = useContext(FormContext);
|
|
153
|
+
const ariaAnnouncement = useAnnouncer(textCount, maxCount);
|
|
154
|
+
const Icon = normalizedProps.icon;
|
|
143
155
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
144
156
|
className: inputWrapperClasses
|
|
145
157
|
}, !inline ? labelWrapper : /*#__PURE__*/React__default.createElement("div", {
|
|
146
|
-
className:
|
|
158
|
+
className: `${prefix}--text-input__label-helper-wrapper`
|
|
147
159
|
}, labelWrapper, !isFluid && (normalizedProps.validation || helper)), /*#__PURE__*/React__default.createElement("div", {
|
|
148
160
|
className: fieldOuterWrapperClasses
|
|
149
161
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -152,10 +164,10 @@ var TextInput = /*#__PURE__*/React__default.forwardRef(function TextInput(_ref,
|
|
|
152
164
|
}, Icon && /*#__PURE__*/React__default.createElement(Icon, {
|
|
153
165
|
className: iconClasses
|
|
154
166
|
}), input, /*#__PURE__*/React__default.createElement("span", {
|
|
155
|
-
className:
|
|
167
|
+
className: `${prefix}--text-input__counter-alert`,
|
|
156
168
|
role: "alert"
|
|
157
169
|
}, ariaAnnouncement), isFluid && /*#__PURE__*/React__default.createElement("hr", {
|
|
158
|
-
className:
|
|
170
|
+
className: `${prefix}--text-input__divider`
|
|
159
171
|
}), isFluid && !inline && normalizedProps.validation), !isFluid && !inline && (normalizedProps.validation || helper)));
|
|
160
172
|
});
|
|
161
173
|
TextInput.displayName = 'TextInput';
|
|
@@ -5,42 +5,40 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const invalidProps = invalidId => ({
|
|
9
|
+
'data-invalid': true,
|
|
10
|
+
'aria-invalid': true,
|
|
11
|
+
'aria-describedby': invalidId
|
|
12
|
+
});
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
'aria-invalid': true,
|
|
14
|
-
'aria-describedby': invalidId
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
var warnProps = function warnProps(warnId) {
|
|
19
|
-
return {
|
|
20
|
-
'aria-describedby': warnId
|
|
21
|
-
};
|
|
22
|
-
};
|
|
14
|
+
const warnProps = warnId => ({
|
|
15
|
+
'aria-describedby': warnId
|
|
16
|
+
});
|
|
23
17
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
-
};
|
|
18
|
+
const helperProps = helperId => ({
|
|
19
|
+
'aria-describedby': helperId
|
|
20
|
+
});
|
|
29
21
|
/**
|
|
30
22
|
* @param {{sharedTextInputProps: object, invalid?: boolean, invalidId?: string, warn?: boolean, warnId?: string, hasHelper?: boolean, helperId?: string}} config
|
|
31
23
|
* @returns {object}
|
|
32
24
|
*/
|
|
33
25
|
|
|
34
26
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
27
|
+
const textInputProps = _ref => {
|
|
28
|
+
let {
|
|
29
|
+
sharedTextInputProps,
|
|
30
|
+
invalid,
|
|
31
|
+
invalidId,
|
|
32
|
+
warn,
|
|
33
|
+
warnId,
|
|
34
|
+
hasHelper,
|
|
35
|
+
helperId
|
|
36
|
+
} = _ref;
|
|
37
|
+
return { ...sharedTextInputProps,
|
|
38
|
+
...(invalid ? invalidProps(invalidId) : {}),
|
|
39
|
+
...(warn ? warnProps(warnId) : {}),
|
|
40
|
+
...(hasHelper ? helperProps(helperId) : {})
|
|
41
|
+
};
|
|
44
42
|
};
|
|
45
43
|
|
|
46
44
|
export { textInputProps };
|