@carbon/react 0.16.2 → 1.0.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/README.md +1 -1
- package/es/_virtual/ResizeObserver.es.js +13 -0
- package/es/_virtual/_commonjsHelpers.js +29 -0
- package/es/_virtual/_rollupPluginBabelHelpers.js +354 -0
- package/es/{prefix.js → _virtual/index.js} +2 -2
- package/es/_virtual/rangePlugin.js +10 -0
- package/es/components/Accordion/Accordion.Skeleton.js +103 -0
- package/es/components/Accordion/Accordion.js +68 -0
- package/es/components/Accordion/AccordionItem.js +181 -0
- package/es/components/Accordion/index.js +9 -0
- package/es/components/AccordionItem/index.js +11 -0
- package/es/components/AspectRatio/AspectRatio.js +67 -0
- package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +45 -0
- package/es/components/Breadcrumb/Breadcrumb.js +58 -0
- package/es/components/Breadcrumb/BreadcrumbItem.js +94 -0
- package/es/components/Button/Button.Skeleton.js +71 -0
- package/es/components/Button/Button.js +351 -0
- package/es/components/ButtonSet/ButtonSet.js +48 -0
- package/es/components/Checkbox/Checkbox.Skeleton.js +36 -0
- package/es/components/Checkbox/Checkbox.js +136 -0
- package/es/components/CodeSnippet/CodeSnippet.Skeleton.js +58 -0
- package/es/components/CodeSnippet/CodeSnippet.js +372 -0
- package/es/components/ComboBox/ComboBox.js +532 -0
- package/es/components/ComboBox/tools/filter.js +20 -0
- package/es/components/ComposedModal/ComposedModal.js +630 -0
- package/es/components/ComposedModal/index.js +19 -0
- package/es/components/ComposedModal/next/ComposedModal.js +223 -0
- package/es/components/ComposedModal/next/ModalFooter.js +213 -0
- package/es/components/ComposedModal/next/ModalHeader.js +127 -0
- package/es/components/ContentSwitcher/ContentSwitcher.js +185 -0
- package/es/components/ContextMenu/useContextMenu.js +57 -0
- package/es/components/Copy/Copy.js +124 -0
- package/es/components/CopyButton/CopyButton.js +67 -0
- package/es/components/DangerButton/DangerButton.js +20 -0
- package/es/components/DataTable/DataTable.js +638 -0
- package/es/components/DataTable/Table.js +90 -0
- package/es/components/DataTable/TableActionList.js +17 -0
- package/es/components/DataTable/TableBatchAction.js +45 -0
- package/es/components/DataTable/TableBatchActions.js +110 -0
- package/es/components/DataTable/TableBody.js +37 -0
- package/es/components/DataTable/TableCell.js +16 -0
- package/es/components/DataTable/TableContainer.js +66 -0
- package/es/components/DataTable/TableExpandHeader.js +86 -0
- package/es/components/DataTable/TableExpandRow.js +93 -0
- package/es/components/DataTable/TableExpandedRow.js +75 -0
- package/es/components/DataTable/TableHead.js +16 -0
- package/es/components/DataTable/TableHeader.js +187 -0
- package/es/components/DataTable/TableRow.js +41 -0
- package/es/components/DataTable/TableSelectAll.js +84 -0
- package/es/components/DataTable/TableSelectRow.js +97 -0
- package/es/components/DataTable/TableToolbar.js +48 -0
- package/es/components/DataTable/TableToolbarAction.js +31 -0
- package/es/components/DataTable/TableToolbarContent.js +17 -0
- package/es/components/DataTable/TableToolbarMenu.js +61 -0
- package/es/components/DataTable/TableToolbarSearch.js +242 -0
- package/es/components/DataTable/index.js +72 -0
- package/es/components/DataTable/state/getDerivedStateFromProps.js +52 -0
- package/es/components/DataTable/state/sortStates.js +19 -0
- package/es/components/DataTable/state/sorting.js +93 -0
- package/es/components/DataTable/tools/cells.js +21 -0
- package/es/components/DataTable/tools/denormalize.js +43 -0
- package/es/components/DataTable/tools/filter.js +42 -0
- package/es/components/DataTable/tools/instanceId.js +21 -0
- package/es/components/DataTable/tools/normalize.js +78 -0
- package/es/components/DataTable/tools/sorting.js +110 -0
- package/es/components/DataTableSkeleton/DataTableSkeleton.js +133 -0
- package/es/components/DatePicker/DatePicker.Skeleton.js +69 -0
- package/es/components/DatePicker/DatePicker.js +622 -0
- package/es/components/DatePicker/index.js +15 -0
- package/es/components/DatePicker/next/DatePicker.js +558 -0
- package/es/components/DatePicker/plugins/appendToPlugin.js +58 -0
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +89 -0
- package/es/components/DatePicker/plugins/rangePlugin.js +51 -0
- package/es/components/DatePickerInput/DatePickerInput.js +271 -0
- package/es/components/DatePickerInput/index.js +15 -0
- package/es/components/DatePickerInput/next/DatePickerInput.js +269 -0
- package/es/components/Dropdown/Dropdown.Skeleton.js +55 -0
- package/es/components/Dropdown/Dropdown.js +327 -0
- package/es/components/ErrorBoundary/ErrorBoundary.js +96 -0
- package/es/components/ErrorBoundary/ErrorBoundaryContext.js +16 -0
- package/es/components/ExpandableSearch/ExpandableSearch.js +67 -0
- package/es/components/ExpandableSearch/index.js +9 -0
- package/es/components/FeatureFlags/index.js +169 -0
- package/es/components/FileUploader/FileUploader.Skeleton.js +43 -0
- package/es/components/FileUploader/FileUploader.js +284 -0
- package/es/components/FileUploader/FileUploaderButton.js +198 -0
- package/es/components/FileUploader/FileUploaderDropContainer.js +223 -0
- package/es/components/FileUploader/FileUploaderItem.js +130 -0
- package/es/components/FileUploader/Filename.js +82 -0
- package/es/components/FileUploader/index.js +14 -0
- package/es/components/FluidForm/FluidForm.js +46 -0
- package/es/components/FluidForm/FormContext.js +14 -0
- package/es/components/Form/Form.js +41 -0
- package/es/components/FormGroup/FormGroup.js +97 -0
- package/es/components/FormItem/FormItem.js +41 -0
- package/es/components/FormLabel/FormLabel.js +48 -0
- package/es/components/Grid/CSSGrid.js +139 -0
- package/es/components/Grid/Column.js +363 -0
- package/es/components/Grid/ColumnHang.js +51 -0
- package/es/components/Grid/FlexGrid.js +76 -0
- package/es/components/Grid/Grid.js +63 -0
- package/es/components/Grid/GridContext.js +60 -0
- package/es/components/Grid/Row.js +65 -0
- package/es/components/Heading/index.js +62 -0
- package/es/components/Icon/Icon.Skeleton.js +45 -0
- package/es/components/IconButton/index.js +89 -0
- package/es/components/InlineCheckbox/InlineCheckbox.js +122 -0
- package/es/components/InlineLoading/InlineLoading.js +118 -0
- package/es/components/Layer/LayerContext.js +12 -0
- package/es/components/Layer/index.js +62 -0
- package/es/components/Link/Link.js +95 -0
- package/es/components/ListBox/ListBox.js +129 -0
- package/es/components/ListBox/ListBoxField.js +62 -0
- package/es/components/ListBox/ListBoxMenu.js +56 -0
- package/es/components/ListBox/ListBoxMenuIcon.js +61 -0
- package/es/components/ListBox/ListBoxMenuItem.js +87 -0
- package/es/components/ListBox/ListBoxPropTypes.js +14 -0
- package/es/components/ListBox/ListBoxSelection.js +148 -0
- package/es/components/ListBox/index.js +20 -0
- package/es/components/ListBox/next/ListBoxSelection.js +155 -0
- package/es/components/ListBox/next/ListBoxTrigger.js +68 -0
- package/es/components/ListItem/ListItem.js +41 -0
- package/es/components/Loading/Loading.js +102 -0
- package/es/components/Menu/Menu.js +328 -0
- package/es/components/Menu/MenuDivider.js +19 -0
- package/es/components/Menu/MenuGroup.js +34 -0
- package/es/components/Menu/MenuItem.js +58 -0
- package/es/components/Menu/MenuOption.js +250 -0
- package/es/components/Menu/MenuRadioGroup.js +50 -0
- package/es/components/Menu/MenuRadioGroupOptions.js +64 -0
- package/es/components/Menu/MenuSelectableItem.js +57 -0
- package/es/components/Menu/_utils.js +177 -0
- package/es/components/Menu/index.js +25 -0
- package/es/components/Modal/Modal.js +343 -0
- package/es/components/Modal/index.js +15 -0
- package/es/components/Modal/next/Modal.js +277 -0
- package/es/components/ModalWrapper/ModalWrapper.js +164 -0
- package/es/components/MultiSelect/FilterableMultiSelect.js +576 -0
- package/es/components/MultiSelect/MultiSelect.js +468 -0
- package/es/components/MultiSelect/MultiSelectPropTypes.js +41 -0
- package/es/components/MultiSelect/index.js +23 -0
- package/es/components/MultiSelect/next/FilterableMultiSelect.js +532 -0
- package/es/components/MultiSelect/tools/itemToString.js +24 -0
- package/es/components/MultiSelect/tools/sorting.js +53 -0
- package/es/components/Notification/Notification.js +530 -0
- package/es/components/Notification/index.js +42 -0
- package/es/components/Notification/next/Notification.js +684 -0
- package/es/components/NumberInput/NumberInput.Skeleton.js +44 -0
- package/es/components/NumberInput/NumberInput.js +515 -0
- package/es/components/OrderedList/OrderedList.js +66 -0
- package/es/components/OverflowMenu/OverflowMenu.js +516 -0
- package/es/components/OverflowMenu/index.js +14 -0
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +221 -0
- package/es/components/OverflowMenuItem/index.js +12 -0
- package/es/components/OverflowMenuV2/index.js +137 -0
- package/es/components/Pagination/Pagination.Skeleton.js +48 -0
- package/es/components/Pagination/Pagination.js +420 -0
- package/es/components/Pagination/experimental/PageSelector.js +81 -0
- package/es/components/Pagination/experimental/Pagination.js +281 -0
- package/es/components/Pagination/index.js +14 -0
- package/es/components/Pagination/next/Pagination.js +401 -0
- package/es/components/PaginationNav/PaginationNav.js +436 -0
- package/es/components/Popover/index.js +118 -0
- package/es/components/PrimaryButton/PrimaryButton.js +20 -0
- package/es/components/ProgressBar/ProgressBar.js +110 -0
- package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +50 -0
- package/es/components/ProgressIndicator/ProgressIndicator.js +323 -0
- package/es/components/ProgressIndicator/index.js +15 -0
- package/es/components/ProgressIndicator/next/ProgressIndicator.js +117 -0
- package/es/components/RadioButton/RadioButton.Skeleton.js +37 -0
- package/es/components/RadioButton/RadioButton.js +172 -0
- package/es/components/RadioButton/index.js +15 -0
- package/es/components/RadioButton/next/RadioButton.js +128 -0
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +190 -0
- package/es/components/RadioButtonGroup/index.js +15 -0
- package/es/components/RadioButtonGroup/next/RadioButtonGroup.js +141 -0
- package/es/components/RadioTile/RadioTile.js +147 -0
- package/es/components/Search/Search.Skeleton.js +50 -0
- package/es/components/Search/Search.js +289 -0
- package/es/components/Search/index.js +15 -0
- package/es/components/Search/next/Search.js +263 -0
- package/es/components/SearchFilterButton/SearchFilterButton.js +61 -0
- package/es/components/SearchLayoutButton/SearchLayoutButton.js +151 -0
- package/es/components/SecondaryButton/SecondaryButton.js +20 -0
- package/es/components/Select/Select.Skeleton.js +46 -0
- package/es/components/Select/Select.js +211 -0
- package/es/components/SelectItem/SelectItem.js +70 -0
- package/es/components/SelectItemGroup/SelectItemGroup.js +60 -0
- package/es/components/SkeletonIcon/SkeletonIcon.js +42 -0
- package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +37 -0
- package/es/components/SkeletonText/SkeletonText.js +114 -0
- package/es/components/Slider/Slider.Skeleton.js +56 -0
- package/es/components/Slider/Slider.js +649 -0
- package/es/components/Slider/index.js +14 -0
- package/es/components/Stack/Stack.js +102 -0
- package/es/components/Stack/index.js +26 -0
- package/es/components/StructuredList/StructuredList.Skeleton.js +82 -0
- package/es/components/StructuredList/StructuredList.js +307 -0
- package/es/components/StructuredList/index.js +43 -0
- package/es/components/StructuredList/next/StructuredList.js +330 -0
- package/es/components/Switch/Switch.js +124 -0
- package/es/components/Tab/Tab.js +191 -0
- package/es/components/Tab/index.js +15 -0
- package/es/components/TabContent/TabContent.js +77 -0
- package/es/components/Tabs/Tabs.Skeleton.js +53 -0
- package/es/components/Tabs/Tabs.js +618 -0
- package/es/components/Tabs/index.js +19 -0
- package/es/components/Tabs/next/Tabs.Skeleton.js +53 -0
- package/es/components/Tabs/next/Tabs.js +648 -0
- package/es/components/Tabs/next/usePressable.js +145 -0
- package/es/components/Tag/Tag.Skeleton.js +40 -0
- package/es/components/Tag/Tag.js +146 -0
- package/es/components/Text/Text.js +98 -0
- package/es/components/Text/TextDirectionContext.js +12 -0
- package/es/components/Text/createTextComponent.js +33 -0
- package/es/components/Text/index.js +13 -0
- package/es/components/TextArea/TextArea.Skeleton.js +44 -0
- package/es/components/TextArea/TextArea.js +220 -0
- package/es/components/TextInput/ControlledPasswordInput.js +234 -0
- package/es/components/TextInput/PasswordInput.js +286 -0
- package/es/components/TextInput/TextInput.Skeleton.js +44 -0
- package/es/components/TextInput/TextInput.js +239 -0
- package/es/components/TextInput/index.js +20 -0
- package/es/components/TextInput/util.js +33 -0
- package/es/components/Theme/index.js +103 -0
- package/es/components/Tile/Tile.js +767 -0
- package/es/components/Tile/index.js +19 -0
- package/es/components/Tile/next/Tile.js +647 -0
- package/es/components/TileGroup/TileGroup.js +164 -0
- package/es/components/TimePicker/TimePicker.js +256 -0
- package/es/components/TimePicker/index.js +15 -0
- package/es/components/TimePicker/next/TimePicker.js +218 -0
- package/es/components/TimePickerSelect/TimePickerSelect.js +82 -0
- package/es/components/TimePickerSelect/index.js +15 -0
- package/es/components/TimePickerSelect/next/TimePickerSelect.js +77 -0
- package/es/components/Toggle/Toggle.Skeleton.js +74 -0
- package/es/components/Toggle/Toggle.js +120 -0
- package/es/components/Toggle/index.js +19 -0
- package/es/components/Toggle/next/Toggle.js +158 -0
- package/es/components/ToggleSmall/ToggleSmall.Skeleton.js +71 -0
- package/es/components/ToggleSmall/ToggleSmall.js +104 -0
- package/es/components/Toolbar/Toolbar.js +121 -0
- package/es/components/ToolbarSearch/ToolbarSearch.js +168 -0
- package/es/components/Tooltip/next/DefinitionTooltip.js +122 -0
- package/es/components/Tooltip/next/Tooltip.js +154 -0
- package/es/components/TooltipDefinition/TooltipDefinition.js +167 -0
- package/es/components/TooltipIcon/TooltipIcon.js +235 -0
- package/es/components/TreeView/TreeNode.js +325 -0
- package/es/components/TreeView/TreeView.js +252 -0
- package/es/components/TreeView/index.js +13 -0
- package/es/components/UIShell/Content.js +50 -0
- package/es/components/UIShell/Header.js +37 -0
- package/es/components/UIShell/HeaderContainer.js +44 -0
- package/es/components/UIShell/HeaderGlobalAction.js +87 -0
- package/es/components/UIShell/HeaderGlobalBar.js +20 -0
- package/es/components/UIShell/HeaderMenu.js +240 -0
- package/es/components/UIShell/HeaderMenuButton.js +69 -0
- package/es/components/UIShell/HeaderMenuItem.js +73 -0
- package/es/components/UIShell/HeaderName.js +62 -0
- package/es/components/UIShell/HeaderNavigation.js +100 -0
- package/es/components/UIShell/HeaderPanel.js +52 -0
- package/es/components/UIShell/HeaderSideNavItems.js +50 -0
- package/es/components/UIShell/Link.js +49 -0
- package/es/components/UIShell/SideNav.js +227 -0
- package/es/components/UIShell/SideNavDetails.js +46 -0
- package/es/components/UIShell/SideNavDivider.js +30 -0
- package/es/components/UIShell/SideNavFooter.js +78 -0
- package/es/components/UIShell/SideNavHeader.js +50 -0
- package/es/components/UIShell/SideNavIcon.js +49 -0
- package/es/components/UIShell/SideNavItem.js +47 -0
- package/es/components/UIShell/SideNavItems.js +56 -0
- package/es/components/UIShell/SideNavLink.js +74 -0
- package/es/components/UIShell/SideNavLinkText.js +41 -0
- package/es/components/UIShell/SideNavMenu.js +198 -0
- package/es/components/UIShell/SideNavMenuItem.js +57 -0
- package/es/components/UIShell/SideNavSwitcher.js +80 -0
- package/es/components/UIShell/SkipToContent.js +57 -0
- package/es/components/UIShell/Switcher.js +45 -0
- package/es/components/UIShell/SwitcherDivider.js +35 -0
- package/es/components/UIShell/SwitcherItem.js +62 -0
- package/es/components/UIShell/_utils.js +10 -0
- package/es/components/UIShell/index.js +17 -0
- package/es/components/UIShell/next/HeaderNavigation.js +52 -0
- package/es/components/UIShell/next/SideNavMenu.js +160 -0
- package/es/components/UnorderedList/UnorderedList.js +59 -0
- package/es/index.js +190 -2
- package/es/internal/ClickListener.js +101 -0
- package/es/internal/ComponentToggle.js +42 -0
- package/es/internal/FeatureFlags.js +52 -0
- package/es/internal/FloatingMenu.js +483 -0
- package/es/internal/OptimizedResize.js +65 -0
- package/es/internal/Selection.js +243 -0
- package/es/internal/createClassWrapper.js +31 -0
- package/es/internal/deprecateFieldOnObject.js +26 -0
- package/es/internal/environment.js +15 -0
- package/es/internal/focus/index.js +16 -0
- package/es/internal/keyboard/keys.js +65 -0
- package/es/internal/keyboard/match.js +82 -0
- package/es/internal/keyboard/navigation.js +61 -0
- package/es/internal/useControllableState.js +86 -0
- package/es/internal/useDelayedState.js +54 -0
- package/es/internal/useEffectOnce.js +31 -0
- package/es/internal/useId.js +59 -0
- package/es/internal/useIsomorphicEffect.js +13 -0
- package/es/internal/useMatchMedia.js +51 -0
- package/es/internal/useMergedRefs.js +31 -0
- package/es/internal/useNoInteractiveChildren.js +92 -0
- package/es/internal/useNormalizedInputProps.js +88 -0
- package/es/internal/usePrefix.js +15 -0
- package/es/internal/useSavedCallback.js +32 -0
- package/es/internal/warning.js +28 -0
- package/es/internal/wrapFocus.js +75 -0
- package/es/node_modules/flatpickr/dist/l10n/index.js +1423 -0
- package/es/node_modules/flatpickr/dist/plugins/rangePlugin.js +196 -0
- package/es/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +1112 -0
- package/es/node_modules/use-resize-observer/polyfilled.js +112 -0
- package/es/prop-types/AriaPropTypes.js +16 -0
- package/es/prop-types/deprecate.js +33 -0
- package/es/prop-types/isRequiredOneOf.js +47 -0
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +29 -0
- package/es/prop-types/requiredIfValueExists.js +32 -0
- package/es/prop-types/types.js +10 -0
- package/es/tools/array.js +32 -0
- package/es/tools/createPropAdapter.js +63 -0
- package/es/tools/events.js +35 -0
- package/es/tools/mergeRefs.js +31 -0
- package/es/tools/setupGetInstanceId.js +19 -0
- package/es/tools/toggleClass.js +14 -0
- package/es/tools/uniqueId.js +15 -0
- package/es/tools/wrapComponent.js +42 -0
- package/icons/es/index.js +1 -1
- package/icons/lib/index.js +7 -1952
- package/lib/_virtual/ResizeObserver.es.js +17 -0
- package/lib/_virtual/_commonjsHelpers.js +35 -0
- package/lib/_virtual/_rollupPluginBabelHelpers.js +383 -0
- package/lib/{prefix.js → _virtual/index.js} +4 -2
- package/lib/_virtual/rangePlugin.js +14 -0
- package/lib/components/Accordion/Accordion.Skeleton.js +113 -0
- package/lib/components/Accordion/Accordion.js +97 -0
- package/lib/components/Accordion/AccordionItem.js +191 -0
- package/lib/components/Accordion/index.js +16 -0
- package/lib/components/AccordionItem/index.js +16 -0
- package/lib/components/AspectRatio/AspectRatio.js +77 -0
- package/lib/components/Breadcrumb/Breadcrumb.Skeleton.js +55 -0
- package/lib/components/Breadcrumb/Breadcrumb.js +68 -0
- package/lib/components/Breadcrumb/BreadcrumbItem.js +104 -0
- package/lib/components/Button/Button.Skeleton.js +100 -0
- package/lib/components/Button/Button.js +380 -0
- package/lib/components/ButtonSet/ButtonSet.js +58 -0
- package/lib/components/Checkbox/Checkbox.Skeleton.js +46 -0
- package/lib/components/Checkbox/Checkbox.js +146 -0
- package/lib/components/CodeSnippet/CodeSnippet.Skeleton.js +68 -0
- package/lib/components/CodeSnippet/CodeSnippet.js +383 -0
- package/lib/components/ComboBox/ComboBox.js +543 -0
- package/lib/components/ComboBox/tools/filter.js +24 -0
- package/lib/components/ComposedModal/ComposedModal.js +643 -0
- package/lib/components/ComposedModal/index.js +45 -0
- package/lib/components/ComposedModal/next/ComposedModal.js +234 -0
- package/lib/components/ComposedModal/next/ModalFooter.js +223 -0
- package/lib/components/ComposedModal/next/ModalHeader.js +137 -0
- package/lib/components/ContentSwitcher/ContentSwitcher.js +195 -0
- package/lib/components/ContextMenu/useContextMenu.js +61 -0
- package/lib/components/Copy/Copy.js +154 -0
- package/lib/components/CopyButton/CopyButton.js +77 -0
- package/lib/components/DangerButton/DangerButton.js +28 -0
- package/lib/components/DataTable/DataTable.js +667 -0
- package/lib/components/DataTable/Table.js +120 -0
- package/lib/components/DataTable/TableActionList.js +21 -0
- package/lib/components/DataTable/TableBatchAction.js +54 -0
- package/lib/components/DataTable/TableBatchActions.js +120 -0
- package/lib/components/DataTable/TableBody.js +46 -0
- package/lib/components/DataTable/TableCell.js +20 -0
- package/lib/components/DataTable/TableContainer.js +76 -0
- package/lib/components/DataTable/TableExpandHeader.js +96 -0
- package/lib/components/DataTable/TableExpandRow.js +103 -0
- package/lib/components/DataTable/TableExpandedRow.js +85 -0
- package/lib/components/DataTable/TableHead.js +20 -0
- package/lib/components/DataTable/TableHeader.js +197 -0
- package/lib/components/DataTable/TableRow.js +52 -0
- package/lib/components/DataTable/TableSelectAll.js +94 -0
- package/lib/components/DataTable/TableSelectRow.js +107 -0
- package/lib/components/DataTable/TableToolbar.js +77 -0
- package/lib/components/DataTable/TableToolbarAction.js +40 -0
- package/lib/components/DataTable/TableToolbarContent.js +21 -0
- package/lib/components/DataTable/TableToolbarMenu.js +71 -0
- package/lib/components/DataTable/TableToolbarSearch.js +252 -0
- package/lib/components/DataTable/index.js +76 -0
- package/lib/components/DataTable/state/getDerivedStateFromProps.js +56 -0
- package/lib/components/DataTable/state/sortStates.js +23 -0
- package/lib/components/DataTable/state/sorting.js +100 -0
- package/lib/components/DataTable/tools/cells.js +25 -0
- package/lib/components/DataTable/tools/denormalize.js +47 -0
- package/lib/components/DataTable/tools/filter.js +46 -0
- package/lib/components/DataTable/tools/instanceId.js +25 -0
- package/lib/components/DataTable/tools/normalize.js +82 -0
- package/lib/components/DataTable/tools/sorting.js +117 -0
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +143 -0
- package/lib/components/DatePicker/DatePicker.Skeleton.js +79 -0
- package/lib/components/DatePicker/DatePicker.js +633 -0
- package/lib/components/DatePicker/index.js +39 -0
- package/lib/components/DatePicker/next/DatePicker.js +569 -0
- package/lib/components/DatePicker/plugins/appendToPlugin.js +62 -0
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +93 -0
- package/lib/components/DatePicker/plugins/rangePlugin.js +55 -0
- package/lib/components/DatePickerInput/DatePickerInput.js +281 -0
- package/lib/components/DatePickerInput/index.js +39 -0
- package/lib/components/DatePickerInput/next/DatePickerInput.js +279 -0
- package/lib/components/Dropdown/Dropdown.Skeleton.js +65 -0
- package/lib/components/Dropdown/Dropdown.js +337 -0
- package/lib/components/ErrorBoundary/ErrorBoundary.js +105 -0
- package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +20 -0
- package/lib/components/ExpandableSearch/ExpandableSearch.js +76 -0
- package/lib/components/ExpandableSearch/index.js +16 -0
- package/lib/components/FeatureFlags/index.js +181 -0
- package/lib/components/FileUploader/FileUploader.Skeleton.js +53 -0
- package/lib/components/FileUploader/FileUploader.js +313 -0
- package/lib/components/FileUploader/FileUploaderButton.js +227 -0
- package/lib/components/FileUploader/FileUploaderDropContainer.js +233 -0
- package/lib/components/FileUploader/FileUploaderItem.js +159 -0
- package/lib/components/FileUploader/Filename.js +91 -0
- package/lib/components/FileUploader/index.js +38 -0
- package/lib/components/FluidForm/FluidForm.js +56 -0
- package/lib/components/FluidForm/FormContext.js +18 -0
- package/lib/components/Form/Form.js +51 -0
- package/lib/components/FormGroup/FormGroup.js +107 -0
- package/lib/components/FormItem/FormItem.js +51 -0
- package/lib/components/FormLabel/FormLabel.js +77 -0
- package/lib/components/Grid/CSSGrid.js +149 -0
- package/lib/components/Grid/Column.js +392 -0
- package/lib/components/Grid/ColumnHang.js +61 -0
- package/lib/components/Grid/FlexGrid.js +86 -0
- package/lib/components/Grid/Grid.js +72 -0
- package/lib/components/Grid/GridContext.js +88 -0
- package/lib/components/Grid/Row.js +75 -0
- package/lib/components/Heading/index.js +72 -0
- package/lib/components/Icon/Icon.Skeleton.js +55 -0
- package/lib/components/IconButton/index.js +98 -0
- package/lib/components/InlineCheckbox/InlineCheckbox.js +131 -0
- package/lib/components/InlineLoading/InlineLoading.js +128 -0
- package/lib/components/Layer/LayerContext.js +20 -0
- package/lib/components/Layer/index.js +72 -0
- package/lib/components/Link/Link.js +105 -0
- package/lib/components/ListBox/ListBox.js +139 -0
- package/lib/components/ListBox/ListBoxField.js +71 -0
- package/lib/components/ListBox/ListBoxMenu.js +65 -0
- package/lib/components/ListBox/ListBoxMenuIcon.js +72 -0
- package/lib/components/ListBox/ListBoxMenuItem.js +97 -0
- package/lib/components/ListBox/ListBoxPropTypes.js +42 -0
- package/lib/components/ListBox/ListBoxSelection.js +159 -0
- package/lib/components/ListBox/index.js +25 -0
- package/lib/components/ListBox/next/ListBoxSelection.js +166 -0
- package/lib/components/ListBox/next/ListBoxTrigger.js +79 -0
- package/lib/components/ListItem/ListItem.js +51 -0
- package/lib/components/Loading/Loading.js +112 -0
- package/lib/components/Menu/Menu.js +339 -0
- package/lib/components/Menu/MenuDivider.js +27 -0
- package/lib/components/Menu/MenuGroup.js +43 -0
- package/lib/components/Menu/MenuItem.js +67 -0
- package/lib/components/Menu/MenuOption.js +260 -0
- package/lib/components/Menu/MenuRadioGroup.js +59 -0
- package/lib/components/Menu/MenuRadioGroupOptions.js +73 -0
- package/lib/components/Menu/MenuSelectableItem.js +66 -0
- package/lib/components/Menu/_utils.js +191 -0
- package/lib/components/Menu/index.js +30 -0
- package/lib/components/Modal/Modal.js +353 -0
- package/lib/components/Modal/index.js +39 -0
- package/lib/components/Modal/next/Modal.js +287 -0
- package/lib/components/ModalWrapper/ModalWrapper.js +173 -0
- package/lib/components/MultiSelect/FilterableMultiSelect.js +588 -0
- package/lib/components/MultiSelect/MultiSelect.js +480 -0
- package/lib/components/MultiSelect/MultiSelectPropTypes.js +49 -0
- package/lib/components/MultiSelect/index.js +47 -0
- package/lib/components/MultiSelect/next/FilterableMultiSelect.js +544 -0
- package/lib/components/MultiSelect/tools/itemToString.js +32 -0
- package/lib/components/MultiSelect/tools/sorting.js +58 -0
- package/lib/components/Notification/Notification.js +544 -0
- package/lib/components/Notification/index.js +51 -0
- package/lib/components/Notification/next/Notification.js +698 -0
- package/lib/components/NumberInput/NumberInput.Skeleton.js +54 -0
- package/lib/components/NumberInput/NumberInput.js +546 -0
- package/lib/components/OrderedList/OrderedList.js +76 -0
- package/lib/components/OverflowMenu/OverflowMenu.js +547 -0
- package/lib/components/OverflowMenu/index.js +38 -0
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +250 -0
- package/lib/components/OverflowMenuItem/index.js +16 -0
- package/lib/components/OverflowMenuV2/index.js +147 -0
- package/lib/components/Pagination/Pagination.Skeleton.js +58 -0
- package/lib/components/Pagination/Pagination.js +430 -0
- package/lib/components/Pagination/experimental/PageSelector.js +91 -0
- package/lib/components/Pagination/experimental/Pagination.js +310 -0
- package/lib/components/Pagination/index.js +38 -0
- package/lib/components/Pagination/next/Pagination.js +411 -0
- package/lib/components/PaginationNav/PaginationNav.js +465 -0
- package/lib/components/Popover/index.js +129 -0
- package/lib/components/PrimaryButton/PrimaryButton.js +28 -0
- package/lib/components/ProgressBar/ProgressBar.js +120 -0
- package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +60 -0
- package/lib/components/ProgressIndicator/ProgressIndicator.js +334 -0
- package/lib/components/ProgressIndicator/index.js +39 -0
- package/lib/components/ProgressIndicator/next/ProgressIndicator.js +127 -0
- package/lib/components/RadioButton/RadioButton.Skeleton.js +47 -0
- package/lib/components/RadioButton/RadioButton.js +183 -0
- package/lib/components/RadioButton/index.js +39 -0
- package/lib/components/RadioButton/next/RadioButton.js +138 -0
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +200 -0
- package/lib/components/RadioButtonGroup/index.js +39 -0
- package/lib/components/RadioButtonGroup/next/RadioButtonGroup.js +151 -0
- package/lib/components/RadioTile/RadioTile.js +157 -0
- package/lib/components/Search/Search.Skeleton.js +60 -0
- package/lib/components/Search/Search.js +299 -0
- package/lib/components/Search/index.js +39 -0
- package/lib/components/Search/next/Search.js +273 -0
- package/lib/components/SearchFilterButton/SearchFilterButton.js +70 -0
- package/lib/components/SearchLayoutButton/SearchLayoutButton.js +160 -0
- package/lib/components/SecondaryButton/SecondaryButton.js +28 -0
- package/lib/components/Select/Select.Skeleton.js +56 -0
- package/lib/components/Select/Select.js +240 -0
- package/lib/components/SelectItem/SelectItem.js +80 -0
- package/lib/components/SelectItemGroup/SelectItemGroup.js +89 -0
- package/lib/components/SkeletonIcon/SkeletonIcon.js +52 -0
- package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +47 -0
- package/lib/components/SkeletonText/SkeletonText.js +124 -0
- package/lib/components/Slider/Slider.Skeleton.js +66 -0
- package/lib/components/Slider/Slider.js +679 -0
- package/lib/components/Slider/index.js +38 -0
- package/lib/components/Stack/Stack.js +112 -0
- package/lib/components/Stack/index.js +35 -0
- package/lib/components/StructuredList/StructuredList.Skeleton.js +92 -0
- package/lib/components/StructuredList/StructuredList.js +322 -0
- package/lib/components/StructuredList/index.js +52 -0
- package/lib/components/StructuredList/next/StructuredList.js +345 -0
- package/lib/components/Switch/Switch.js +134 -0
- package/lib/components/Tab/Tab.js +220 -0
- package/lib/components/Tab/index.js +39 -0
- package/lib/components/TabContent/TabContent.js +87 -0
- package/lib/components/Tabs/Tabs.Skeleton.js +63 -0
- package/lib/components/Tabs/Tabs.js +629 -0
- package/lib/components/Tabs/index.js +47 -0
- package/lib/components/Tabs/next/Tabs.Skeleton.js +63 -0
- package/lib/components/Tabs/next/Tabs.js +664 -0
- package/lib/components/Tabs/next/usePressable.js +149 -0
- package/lib/components/Tag/Tag.Skeleton.js +50 -0
- package/lib/components/Tag/Tag.js +156 -0
- package/lib/components/Text/Text.js +107 -0
- package/lib/components/Text/TextDirectionContext.js +16 -0
- package/lib/components/Text/createTextComponent.js +41 -0
- package/lib/components/Text/index.js +17 -0
- package/lib/components/TextArea/TextArea.Skeleton.js +54 -0
- package/lib/components/TextArea/TextArea.js +230 -0
- package/lib/components/TextInput/ControlledPasswordInput.js +244 -0
- package/lib/components/TextInput/PasswordInput.js +315 -0
- package/lib/components/TextInput/TextInput.Skeleton.js +54 -0
- package/lib/components/TextInput/TextInput.js +268 -0
- package/lib/components/TextInput/index.js +25 -0
- package/lib/components/TextInput/util.js +37 -0
- package/lib/components/Theme/index.js +116 -0
- package/lib/components/Tile/Tile.js +782 -0
- package/lib/components/Tile/index.js +48 -0
- package/lib/components/Tile/next/Tile.js +662 -0
- package/lib/components/TileGroup/TileGroup.js +173 -0
- package/lib/components/TimePicker/TimePicker.js +266 -0
- package/lib/components/TimePicker/index.js +39 -0
- package/lib/components/TimePicker/next/TimePicker.js +228 -0
- package/lib/components/TimePickerSelect/TimePickerSelect.js +92 -0
- package/lib/components/TimePickerSelect/index.js +39 -0
- package/lib/components/TimePickerSelect/next/TimePickerSelect.js +87 -0
- package/lib/components/Toggle/Toggle.Skeleton.js +84 -0
- package/lib/components/Toggle/Toggle.js +130 -0
- package/lib/components/Toggle/index.js +23 -0
- package/lib/components/Toggle/next/Toggle.js +169 -0
- package/lib/components/ToggleSmall/ToggleSmall.Skeleton.js +81 -0
- package/lib/components/ToggleSmall/ToggleSmall.js +114 -0
- package/lib/components/Toolbar/Toolbar.js +135 -0
- package/lib/components/ToolbarSearch/ToolbarSearch.js +178 -0
- package/lib/components/Tooltip/next/DefinitionTooltip.js +132 -0
- package/lib/components/Tooltip/next/Tooltip.js +164 -0
- package/lib/components/TooltipDefinition/TooltipDefinition.js +178 -0
- package/lib/components/TooltipIcon/TooltipIcon.js +245 -0
- package/lib/components/TreeView/TreeNode.js +335 -0
- package/lib/components/TreeView/TreeView.js +281 -0
- package/lib/components/TreeView/index.js +18 -0
- package/lib/components/UIShell/Content.js +60 -0
- package/lib/components/UIShell/Header.js +47 -0
- package/lib/components/UIShell/HeaderContainer.js +53 -0
- package/lib/components/UIShell/HeaderGlobalAction.js +97 -0
- package/lib/components/UIShell/HeaderGlobalBar.js +24 -0
- package/lib/components/UIShell/HeaderMenu.js +250 -0
- package/lib/components/UIShell/HeaderMenuButton.js +79 -0
- package/lib/components/UIShell/HeaderMenuItem.js +83 -0
- package/lib/components/UIShell/HeaderName.js +72 -0
- package/lib/components/UIShell/HeaderNavigation.js +110 -0
- package/lib/components/UIShell/HeaderPanel.js +62 -0
- package/lib/components/UIShell/HeaderSideNavItems.js +60 -0
- package/lib/components/UIShell/Link.js +59 -0
- package/lib/components/UIShell/SideNav.js +237 -0
- package/lib/components/UIShell/SideNavDetails.js +56 -0
- package/lib/components/UIShell/SideNavDivider.js +40 -0
- package/lib/components/UIShell/SideNavFooter.js +88 -0
- package/lib/components/UIShell/SideNavHeader.js +60 -0
- package/lib/components/UIShell/SideNavIcon.js +59 -0
- package/lib/components/UIShell/SideNavItem.js +57 -0
- package/lib/components/UIShell/SideNavItems.js +66 -0
- package/lib/components/UIShell/SideNavLink.js +84 -0
- package/lib/components/UIShell/SideNavLinkText.js +51 -0
- package/lib/components/UIShell/SideNavMenu.js +209 -0
- package/lib/components/UIShell/SideNavMenuItem.js +67 -0
- package/lib/components/UIShell/SideNavSwitcher.js +90 -0
- package/lib/components/UIShell/SkipToContent.js +67 -0
- package/lib/components/UIShell/Switcher.js +55 -0
- package/lib/components/UIShell/SwitcherDivider.js +45 -0
- package/lib/components/UIShell/SwitcherItem.js +72 -0
- package/lib/components/UIShell/_utils.js +14 -0
- package/lib/components/UIShell/index.js +42 -0
- package/lib/components/UIShell/next/HeaderNavigation.js +62 -0
- package/lib/components/UIShell/next/SideNavMenu.js +170 -0
- package/lib/components/UnorderedList/UnorderedList.js +69 -0
- package/lib/index.js +409 -858
- package/lib/internal/ClickListener.js +110 -0
- package/lib/internal/ComponentToggle.js +50 -0
- package/lib/internal/FeatureFlags.js +56 -0
- package/lib/internal/FloatingMenu.js +498 -0
- package/lib/internal/OptimizedResize.js +73 -0
- package/lib/internal/Selection.js +254 -0
- package/lib/internal/createClassWrapper.js +39 -0
- package/lib/internal/deprecateFieldOnObject.js +30 -0
- package/lib/internal/environment.js +19 -0
- package/lib/internal/focus/index.js +20 -0
- package/lib/internal/keyboard/keys.js +79 -0
- package/lib/internal/keyboard/match.js +87 -0
- package/lib/internal/keyboard/navigation.js +69 -0
- package/lib/internal/useControllableState.js +90 -0
- package/lib/internal/useDelayedState.js +58 -0
- package/lib/internal/useEffectOnce.js +35 -0
- package/lib/internal/useId.js +64 -0
- package/lib/internal/useIsomorphicEffect.js +17 -0
- package/lib/internal/useMatchMedia.js +55 -0
- package/lib/internal/useMergedRefs.js +35 -0
- package/lib/internal/useNoInteractiveChildren.js +97 -0
- package/lib/internal/useNormalizedInputProps.js +96 -0
- package/lib/internal/usePrefix.js +24 -0
- package/lib/internal/useSavedCallback.js +36 -0
- package/lib/internal/warning.js +32 -0
- package/lib/internal/wrapFocus.js +84 -0
- package/lib/node_modules/flatpickr/dist/l10n/index.js +1427 -0
- package/lib/node_modules/flatpickr/dist/plugins/rangePlugin.js +200 -0
- package/lib/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +1116 -0
- package/lib/node_modules/use-resize-observer/polyfilled.js +120 -0
- package/lib/prop-types/AriaPropTypes.js +24 -0
- package/lib/prop-types/deprecate.js +37 -0
- package/lib/prop-types/isRequiredOneOf.js +51 -0
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +33 -0
- package/lib/prop-types/requiredIfValueExists.js +36 -0
- package/lib/prop-types/types.js +14 -0
- package/lib/tools/array.js +36 -0
- package/lib/tools/createPropAdapter.js +67 -0
- package/lib/tools/events.js +39 -0
- package/lib/tools/mergeRefs.js +35 -0
- package/lib/tools/setupGetInstanceId.js +23 -0
- package/lib/tools/toggleClass.js +18 -0
- package/lib/tools/uniqueId.js +19 -0
- package/lib/tools/wrapComponent.js +52 -0
- package/package.json +50 -20
- package/scss/grid/_css-grid.scss +9 -0
- package/scss/grid/{_config.scss → _mixins.scss} +1 -1
- package/icons/es/icon-helpers/es/index.js +0 -141
- package/icons/es/icons-react/next/index.esm.js +0 -14
- package/icons/lib/icon-helpers/es/index.js +0 -146
- package/icons/lib/icons-react/next/index.esm.js +0 -1973
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2021
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, defineProperty as _defineProperty, objectSpread2 as _objectSpread2, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
+
import React__default, { useState, useContext, useEffect } from 'react';
|
|
10
|
+
import cx from 'classnames';
|
|
11
|
+
import PropTypes from 'prop-types';
|
|
12
|
+
import { ViewOff, View } from '@carbon/icons-react';
|
|
13
|
+
import { useNormalizedInputProps } from '../../internal/useNormalizedInputProps.js';
|
|
14
|
+
import { textInputProps } from './util.js';
|
|
15
|
+
import * as FeatureFlags from '@carbon/feature-flags';
|
|
16
|
+
import { usePrefix } from '../../internal/usePrefix.js';
|
|
17
|
+
import { FormContext } from '../FluidForm/FormContext.js';
|
|
18
|
+
|
|
19
|
+
var _excluded = ["className", "disabled", "helperText", "hideLabel", "hidePasswordLabel", "id", "inline", "invalid", "invalidText", "labelText", "light", "onChange", "onClick", "onTogglePasswordVisibility", "placeholder", "size", "showPasswordLabel", "tooltipPosition", "tooltipAlignment", "type", "warn", "warnText"];
|
|
20
|
+
var PasswordInput = /*#__PURE__*/React__default.forwardRef(function PasswordInput(_ref, ref) {
|
|
21
|
+
var _classNames, _classNames2, _classNames3, _classNames4, _classNames7, _classNames8;
|
|
22
|
+
|
|
23
|
+
var className = _ref.className,
|
|
24
|
+
_ref$disabled = _ref.disabled,
|
|
25
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
26
|
+
helperText = _ref.helperText,
|
|
27
|
+
hideLabel = _ref.hideLabel,
|
|
28
|
+
_ref$hidePasswordLabe = _ref.hidePasswordLabel,
|
|
29
|
+
hidePasswordLabel = _ref$hidePasswordLabe === void 0 ? 'Hide password' : _ref$hidePasswordLabe,
|
|
30
|
+
id = _ref.id,
|
|
31
|
+
inline = _ref.inline,
|
|
32
|
+
_ref$invalid = _ref.invalid,
|
|
33
|
+
invalid = _ref$invalid === void 0 ? false : _ref$invalid,
|
|
34
|
+
invalidText = _ref.invalidText,
|
|
35
|
+
labelText = _ref.labelText,
|
|
36
|
+
_ref$light = _ref.light,
|
|
37
|
+
light = _ref$light === void 0 ? false : _ref$light,
|
|
38
|
+
_ref$onChange = _ref.onChange,
|
|
39
|
+
_onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
40
|
+
_ref$onClick = _ref.onClick,
|
|
41
|
+
_onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
42
|
+
onTogglePasswordVisibility = _ref.onTogglePasswordVisibility,
|
|
43
|
+
placeholder = _ref.placeholder,
|
|
44
|
+
_ref$size = _ref.size,
|
|
45
|
+
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
46
|
+
_ref$showPasswordLabe = _ref.showPasswordLabel,
|
|
47
|
+
showPasswordLabel = _ref$showPasswordLabe === void 0 ? 'Show password' : _ref$showPasswordLabe,
|
|
48
|
+
_ref$tooltipPosition = _ref.tooltipPosition,
|
|
49
|
+
tooltipPosition = _ref$tooltipPosition === void 0 ? 'bottom' : _ref$tooltipPosition,
|
|
50
|
+
_ref$tooltipAlignment = _ref.tooltipAlignment,
|
|
51
|
+
tooltipAlignment = _ref$tooltipAlignment === void 0 ? 'center' : _ref$tooltipAlignment,
|
|
52
|
+
_ref$type = _ref.type,
|
|
53
|
+
type = _ref$type === void 0 ? 'password' : _ref$type,
|
|
54
|
+
warn = _ref.warn,
|
|
55
|
+
warnText = _ref.warnText,
|
|
56
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
57
|
+
|
|
58
|
+
var _useState = useState(type),
|
|
59
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
60
|
+
inputType = _useState2[0],
|
|
61
|
+
setInputType = _useState2[1];
|
|
62
|
+
|
|
63
|
+
var prefix = usePrefix();
|
|
64
|
+
var normalizedProps = useNormalizedInputProps({
|
|
65
|
+
id: id,
|
|
66
|
+
invalid: invalid,
|
|
67
|
+
invalidText: invalidText,
|
|
68
|
+
warn: warn,
|
|
69
|
+
warnText: warnText
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
var handleTogglePasswordVisibility = function handleTogglePasswordVisibility(event) {
|
|
73
|
+
setInputType(inputType === 'password' ? 'text' : 'password');
|
|
74
|
+
onTogglePasswordVisibility && onTogglePasswordVisibility(event);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
var textInputClasses = cx("".concat(prefix, "--text-input"), "".concat(prefix, "--password-input"), className, (_classNames = {}, _defineProperty(_classNames, "".concat(prefix, "--text-input--light"), light), _defineProperty(_classNames, "".concat(prefix, "--text-input--invalid"), normalizedProps.invalid), _defineProperty(_classNames, "".concat(prefix, "--text-input--warning"), normalizedProps.warn), _defineProperty(_classNames, "".concat(prefix, "--text-input--").concat(size), size), _classNames));
|
|
78
|
+
|
|
79
|
+
var sharedTextInputProps = _objectSpread2({
|
|
80
|
+
id: id,
|
|
81
|
+
onChange: function onChange(evt) {
|
|
82
|
+
if (!disabled) {
|
|
83
|
+
_onChange(evt);
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
onClick: function onClick(evt) {
|
|
87
|
+
if (!disabled) {
|
|
88
|
+
_onClick(evt);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
placeholder: placeholder,
|
|
92
|
+
type: inputType,
|
|
93
|
+
className: textInputClasses,
|
|
94
|
+
ref: ref
|
|
95
|
+
}, rest);
|
|
96
|
+
|
|
97
|
+
var inputWrapperClasses = cx("".concat(prefix, "--form-item"), "".concat(prefix, "--text-input-wrapper"), "".concat(prefix, "--password-input-wrapper"), (_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefix, "--text-input-wrapper--light"), light), _defineProperty(_classNames2, "".concat(prefix, "--text-input-wrapper--inline"), inline), _classNames2));
|
|
98
|
+
var labelClasses = cx("".concat(prefix, "--label"), (_classNames3 = {}, _defineProperty(_classNames3, "".concat(prefix, "--visually-hidden"), hideLabel), _defineProperty(_classNames3, "".concat(prefix, "--label--disabled"), disabled), _defineProperty(_classNames3, "".concat(prefix, "--label--inline"), inline), _defineProperty(_classNames3, "".concat(prefix, "--label--inline--").concat(size), inline && !!size), _classNames3));
|
|
99
|
+
var helperTextClasses = cx("".concat(prefix, "--form__helper-text"), (_classNames4 = {}, _defineProperty(_classNames4, "".concat(prefix, "--form__helper-text--disabled"), disabled), _defineProperty(_classNames4, "".concat(prefix, "--form__helper-text--inline"), inline), _classNames4));
|
|
100
|
+
var fieldOuterWrapperClasses = cx("".concat(prefix, "--text-input__field-outer-wrapper"), _defineProperty({}, "".concat(prefix, "--text-input__field-outer-wrapper--inline"), inline));
|
|
101
|
+
var fieldWrapperClasses = cx("".concat(prefix, "--text-input__field-wrapper"), _defineProperty({}, "".concat(prefix, "--text-input__field-wrapper--warning"), normalizedProps.warn));
|
|
102
|
+
var iconClasses = cx((_classNames7 = {}, _defineProperty(_classNames7, "".concat(prefix, "--text-input__invalid-icon"), normalizedProps.invalid || normalizedProps.warn), _defineProperty(_classNames7, "".concat(prefix, "--text-input__invalid-icon--warning"), normalizedProps.warn), _classNames7));
|
|
103
|
+
var label = labelText ? /*#__PURE__*/React__default.createElement("label", {
|
|
104
|
+
htmlFor: id,
|
|
105
|
+
className: labelClasses
|
|
106
|
+
}, labelText) : null;
|
|
107
|
+
var helper = helperText ? /*#__PURE__*/React__default.createElement("div", {
|
|
108
|
+
className: helperTextClasses
|
|
109
|
+
}, helperText) : null;
|
|
110
|
+
var passwordIsVisible = inputType === 'text';
|
|
111
|
+
var passwordVisibilityIcon = passwordIsVisible ? /*#__PURE__*/React__default.createElement(ViewOff, {
|
|
112
|
+
className: "".concat(prefix, "--icon-visibility-off")
|
|
113
|
+
}) : /*#__PURE__*/React__default.createElement(View, {
|
|
114
|
+
className: "".concat(prefix, "--icon-visibility-on")
|
|
115
|
+
});
|
|
116
|
+
var passwordVisibilityToggleClasses = cx("".concat(prefix, "--text-input--password__visibility__toggle"), "".concat(prefix, "--btn"), "".concat(prefix, "--btn--icon-only"), "".concat(prefix, "--tooltip__trigger"), "".concat(prefix, "--tooltip--a11y"), (_classNames8 = {}, _defineProperty(_classNames8, "".concat(prefix, "--btn--disabled"), disabled), _defineProperty(_classNames8, "".concat(prefix, "--tooltip--").concat(tooltipPosition), tooltipPosition), _defineProperty(_classNames8, "".concat(prefix, "--tooltip--align-").concat(tooltipAlignment), tooltipAlignment), _classNames8));
|
|
117
|
+
var input = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("input", _extends({}, textInputProps({
|
|
118
|
+
sharedTextInputProps: sharedTextInputProps,
|
|
119
|
+
invalid: normalizedProps.invalid,
|
|
120
|
+
invalidId: normalizedProps.invalidId,
|
|
121
|
+
warn: normalizedProps.warn,
|
|
122
|
+
warnId: normalizedProps.warnId
|
|
123
|
+
}), {
|
|
124
|
+
disabled: disabled,
|
|
125
|
+
"data-toggle-password-visibility": inputType === 'password'
|
|
126
|
+
})), /*#__PURE__*/React__default.createElement("button", {
|
|
127
|
+
type: "button",
|
|
128
|
+
className: passwordVisibilityToggleClasses,
|
|
129
|
+
disabled: disabled,
|
|
130
|
+
onClick: handleTogglePasswordVisibility
|
|
131
|
+
}, !disabled && /*#__PURE__*/React__default.createElement("span", {
|
|
132
|
+
className: "".concat(prefix, "--assistive-text")
|
|
133
|
+
}, passwordIsVisible ? hidePasswordLabel : showPasswordLabel), passwordVisibilityIcon));
|
|
134
|
+
|
|
135
|
+
var _useContext = useContext(FormContext),
|
|
136
|
+
isFluid = _useContext.isFluid;
|
|
137
|
+
|
|
138
|
+
useEffect(function () {
|
|
139
|
+
setInputType(type);
|
|
140
|
+
}, [type]);
|
|
141
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
142
|
+
className: inputWrapperClasses
|
|
143
|
+
}, !inline ? label : /*#__PURE__*/React__default.createElement("div", {
|
|
144
|
+
className: "".concat(prefix, "--text-input__label-helper-wrapper")
|
|
145
|
+
}, label, !isFluid && helper), /*#__PURE__*/React__default.createElement("div", {
|
|
146
|
+
className: fieldOuterWrapperClasses
|
|
147
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
148
|
+
className: fieldWrapperClasses,
|
|
149
|
+
"data-invalid": normalizedProps.invalid || null
|
|
150
|
+
}, normalizedProps.icon && /*#__PURE__*/React__default.createElement(normalizedProps.icon, {
|
|
151
|
+
className: iconClasses
|
|
152
|
+
}), input, isFluid && !inline && normalizedProps.validation), !isFluid && !inline && (normalizedProps.validation || helper)));
|
|
153
|
+
});
|
|
154
|
+
PasswordInput.displayName = 'PasswordInput';
|
|
155
|
+
PasswordInput.propTypes = {
|
|
156
|
+
/**
|
|
157
|
+
* Provide a custom className that is applied directly to the underlying
|
|
158
|
+
* `<input>` node
|
|
159
|
+
*/
|
|
160
|
+
className: PropTypes.string,
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Optionally provide the default value of the `<input>`
|
|
164
|
+
*/
|
|
165
|
+
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Specify whether the control is disabled
|
|
169
|
+
*/
|
|
170
|
+
disabled: PropTypes.bool,
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Provide text that is used alongside the control label for additional help
|
|
174
|
+
*/
|
|
175
|
+
helperText: PropTypes.node,
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Specify whether or not the underlying label is visually hidden
|
|
179
|
+
*/
|
|
180
|
+
hideLabel: PropTypes.bool,
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* "Hide password" tooltip text on password visibility toggle
|
|
184
|
+
*/
|
|
185
|
+
hidePasswordLabel: PropTypes.string,
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Provide a unique identifier for the input field
|
|
189
|
+
*/
|
|
190
|
+
id: PropTypes.string.isRequired,
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* `true` to use the inline version.
|
|
194
|
+
*/
|
|
195
|
+
inline: PropTypes.bool,
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Specify whether the control is currently invalid
|
|
199
|
+
*/
|
|
200
|
+
invalid: PropTypes.bool,
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Provide the text that is displayed when the control is in an invalid state
|
|
204
|
+
*/
|
|
205
|
+
invalidText: PropTypes.node,
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Provide the text that will be read by a screen reader when visiting this
|
|
209
|
+
* control
|
|
210
|
+
*/
|
|
211
|
+
labelText: PropTypes.node.isRequired,
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* `true` to use the light version. For use on $ui-01 backgrounds only.
|
|
215
|
+
* Don't use this to make tile background color same as container background color.
|
|
216
|
+
*/
|
|
217
|
+
light: PropTypes.bool,
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Optionally provide an `onChange` handler that is called whenever `<input>`
|
|
221
|
+
* is updated
|
|
222
|
+
*/
|
|
223
|
+
onChange: PropTypes.func,
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Optionally provide an `onClick` handler that is called whenever the
|
|
227
|
+
* `<input>` is clicked
|
|
228
|
+
*/
|
|
229
|
+
onClick: PropTypes.func,
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Callback function that is called whenever the toggle password visibility
|
|
233
|
+
* button is clicked
|
|
234
|
+
*/
|
|
235
|
+
onTogglePasswordVisibility: PropTypes.func,
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Specify the placeholder attribute for the `<input>`
|
|
239
|
+
*/
|
|
240
|
+
placeholder: PropTypes.string,
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* "Show password" tooltip text on password visibility toggle
|
|
244
|
+
*/
|
|
245
|
+
showPasswordLabel: PropTypes.string,
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Specify the size of the Text Input. Supports `sm`, `md`, or `lg`.
|
|
249
|
+
*/
|
|
250
|
+
size: FeatureFlags.enabled('enable-v11-release') ? PropTypes.oneOf(['sm', 'md', 'lg']) : PropTypes.string,
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Specify the alignment of the tooltip to the icon-only button.
|
|
254
|
+
* Can be one of: start, center, or end.
|
|
255
|
+
*/
|
|
256
|
+
tooltipAlignment: PropTypes.oneOf(['start', 'center', 'end']),
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Specify the direction of the tooltip for icon-only buttons.
|
|
260
|
+
* Can be either top, right, bottom, or left.
|
|
261
|
+
*/
|
|
262
|
+
tooltipPosition: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* The input type, either password or text
|
|
266
|
+
*/
|
|
267
|
+
type: PropTypes.oneOf(['password', 'text']),
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Provide the current value of the `<input>`
|
|
271
|
+
*/
|
|
272
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Specify whether the control is currently in warning state
|
|
276
|
+
*/
|
|
277
|
+
warn: PropTypes.bool,
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Provide the text that is displayed when the control is in warning state
|
|
281
|
+
*/
|
|
282
|
+
warnText: PropTypes.node
|
|
283
|
+
};
|
|
284
|
+
var PasswordInput$1 = PasswordInput;
|
|
285
|
+
|
|
286
|
+
export { PasswordInput$1 as default };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2021
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import React__default from 'react';
|
|
11
|
+
import cx from 'classnames';
|
|
12
|
+
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
|
+
|
|
14
|
+
var _excluded = ["hideLabel", "className"];
|
|
15
|
+
|
|
16
|
+
var TextInputSkeleton = function TextInputSkeleton(_ref) {
|
|
17
|
+
var hideLabel = _ref.hideLabel,
|
|
18
|
+
className = _ref.className,
|
|
19
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
20
|
+
|
|
21
|
+
var prefix = usePrefix();
|
|
22
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
23
|
+
className: cx("".concat(prefix, "--form-item"), className)
|
|
24
|
+
}, rest), !hideLabel && /*#__PURE__*/React__default.createElement("span", {
|
|
25
|
+
className: "".concat(prefix, "--label ").concat(prefix, "--skeleton")
|
|
26
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
27
|
+
className: "".concat(prefix, "--skeleton ").concat(prefix, "--text-input")
|
|
28
|
+
}));
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
TextInputSkeleton.propTypes = {
|
|
32
|
+
/**
|
|
33
|
+
* Specify an optional className to add to the form item wrapper.
|
|
34
|
+
*/
|
|
35
|
+
className: PropTypes.string,
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Specify whether the label should be hidden, or not
|
|
39
|
+
*/
|
|
40
|
+
hideLabel: PropTypes.bool
|
|
41
|
+
};
|
|
42
|
+
var TextInputSkeleton$1 = TextInputSkeleton;
|
|
43
|
+
|
|
44
|
+
export { TextInputSkeleton$1 as default };
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2021
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import React__default, { useContext } from 'react';
|
|
11
|
+
import cx from 'classnames';
|
|
12
|
+
import { useNormalizedInputProps } from '../../internal/useNormalizedInputProps.js';
|
|
13
|
+
import PasswordInput from './PasswordInput.js';
|
|
14
|
+
import ControlledPasswordInput from './ControlledPasswordInput.js';
|
|
15
|
+
import { textInputProps } from './util.js';
|
|
16
|
+
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
17
|
+
import * as FeatureFlags from '@carbon/feature-flags';
|
|
18
|
+
import { usePrefix } from '../../internal/usePrefix.js';
|
|
19
|
+
import { FormContext } from '../FluidForm/FormContext.js';
|
|
20
|
+
|
|
21
|
+
var _excluded = ["className", "disabled", "helperText", "hideLabel", "id", "inline", "invalid", "invalidText", "labelText", "light", "onChange", "onClick", "placeholder", "readOnly", "size", "type", "warn", "warnText"];
|
|
22
|
+
var TextInput = /*#__PURE__*/React__default.forwardRef(function TextInput(_ref, ref) {
|
|
23
|
+
var _classNames, _classNames2, _classNames3, _classNames4, _classNames7;
|
|
24
|
+
|
|
25
|
+
var className = _ref.className,
|
|
26
|
+
_ref$disabled = _ref.disabled,
|
|
27
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
28
|
+
helperText = _ref.helperText,
|
|
29
|
+
hideLabel = _ref.hideLabel,
|
|
30
|
+
id = _ref.id,
|
|
31
|
+
_ref$inline = _ref.inline,
|
|
32
|
+
inline = _ref$inline === void 0 ? false : _ref$inline,
|
|
33
|
+
_ref$invalid = _ref.invalid,
|
|
34
|
+
invalid = _ref$invalid === void 0 ? false : _ref$invalid,
|
|
35
|
+
invalidText = _ref.invalidText,
|
|
36
|
+
labelText = _ref.labelText,
|
|
37
|
+
_ref$light = _ref.light,
|
|
38
|
+
light = _ref$light === void 0 ? false : _ref$light,
|
|
39
|
+
_ref$onChange = _ref.onChange,
|
|
40
|
+
_onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
41
|
+
_ref$onClick = _ref.onClick,
|
|
42
|
+
_onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
43
|
+
placeholder = _ref.placeholder,
|
|
44
|
+
readOnly = _ref.readOnly,
|
|
45
|
+
_ref$size = _ref.size,
|
|
46
|
+
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
47
|
+
_ref$type = _ref.type,
|
|
48
|
+
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
49
|
+
_ref$warn = _ref.warn,
|
|
50
|
+
warn = _ref$warn === void 0 ? false : _ref$warn,
|
|
51
|
+
warnText = _ref.warnText,
|
|
52
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
53
|
+
|
|
54
|
+
var prefix = usePrefix();
|
|
55
|
+
var enabled = useFeatureFlag('enable-v11-release');
|
|
56
|
+
var normalizedProps = useNormalizedInputProps({
|
|
57
|
+
id: id,
|
|
58
|
+
readOnly: readOnly,
|
|
59
|
+
disabled: disabled,
|
|
60
|
+
invalid: invalid,
|
|
61
|
+
invalidText: invalidText,
|
|
62
|
+
warn: warn,
|
|
63
|
+
warnText: warnText
|
|
64
|
+
});
|
|
65
|
+
var customClassName = className !== null && className !== void 0 ? className : "".concat(prefix, "--text__input");
|
|
66
|
+
var textInputClasses = cx("".concat(prefix, "--text-input"), [enabled ? null : className], (_classNames = {}, _defineProperty(_classNames, customClassName, enabled), _defineProperty(_classNames, "".concat(prefix, "--text-input--light"), light), _defineProperty(_classNames, "".concat(prefix, "--text-input--invalid"), normalizedProps.invalid), _defineProperty(_classNames, "".concat(prefix, "--text-input--warning"), normalizedProps.warn), _defineProperty(_classNames, "".concat(prefix, "--text-input--").concat(size), size), _classNames));
|
|
67
|
+
|
|
68
|
+
var sharedTextInputProps = _objectSpread2(_defineProperty({
|
|
69
|
+
id: id,
|
|
70
|
+
onChange: function onChange(evt) {
|
|
71
|
+
if (!normalizedProps.disabled) {
|
|
72
|
+
_onChange(evt);
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
onClick: function onClick(evt) {
|
|
76
|
+
if (!normalizedProps.disabled) {
|
|
77
|
+
_onClick(evt);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
placeholder: placeholder,
|
|
81
|
+
type: type,
|
|
82
|
+
ref: ref,
|
|
83
|
+
className: textInputClasses,
|
|
84
|
+
title: placeholder,
|
|
85
|
+
disabled: normalizedProps.disabled,
|
|
86
|
+
readOnly: readOnly
|
|
87
|
+
}, 'aria-describedby', helperText && normalizedProps.helperId), rest);
|
|
88
|
+
|
|
89
|
+
var inputWrapperClasses = cx([enabled ? cx("".concat(prefix, "--form-item"), className) : "".concat(prefix, "--form-item")], "".concat(prefix, "--text-input-wrapper"), (_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefix, "--text-input-wrapper--readonly"), readOnly), _defineProperty(_classNames2, "".concat(prefix, "--text-input-wrapper--light"), light), _defineProperty(_classNames2, "".concat(prefix, "--text-input-wrapper--inline"), inline), _classNames2));
|
|
90
|
+
var labelClasses = cx("".concat(prefix, "--label"), (_classNames3 = {}, _defineProperty(_classNames3, "".concat(prefix, "--visually-hidden"), hideLabel), _defineProperty(_classNames3, "".concat(prefix, "--label--disabled"), normalizedProps.disabled), _defineProperty(_classNames3, "".concat(prefix, "--label--inline"), inline), _defineProperty(_classNames3, "".concat(prefix, "--label--inline--").concat(size), inline && !!size), _classNames3));
|
|
91
|
+
var helperTextClasses = cx("".concat(prefix, "--form__helper-text"), (_classNames4 = {}, _defineProperty(_classNames4, "".concat(prefix, "--form__helper-text--disabled"), normalizedProps.disabled), _defineProperty(_classNames4, "".concat(prefix, "--form__helper-text--inline"), inline), _classNames4));
|
|
92
|
+
var fieldOuterWrapperClasses = cx("".concat(prefix, "--text-input__field-outer-wrapper"), _defineProperty({}, "".concat(prefix, "--text-input__field-outer-wrapper--inline"), inline));
|
|
93
|
+
var fieldWrapperClasses = cx("".concat(prefix, "--text-input__field-wrapper"), _defineProperty({}, "".concat(prefix, "--text-input__field-wrapper--warning"), normalizedProps.warn));
|
|
94
|
+
var iconClasses = cx((_classNames7 = {}, _defineProperty(_classNames7, "".concat(prefix, "--text-input__invalid-icon"), normalizedProps.invalid || normalizedProps.warn), _defineProperty(_classNames7, "".concat(prefix, "--text-input__invalid-icon--warning"), normalizedProps.warn), _defineProperty(_classNames7, "".concat(prefix, "--text-input__readonly-icon"), readOnly), _classNames7));
|
|
95
|
+
var label = labelText ? /*#__PURE__*/React__default.createElement("label", {
|
|
96
|
+
htmlFor: id,
|
|
97
|
+
className: labelClasses
|
|
98
|
+
}, labelText) : null;
|
|
99
|
+
var helper = helperText ? /*#__PURE__*/React__default.createElement("div", {
|
|
100
|
+
id: normalizedProps.helperId,
|
|
101
|
+
className: helperTextClasses
|
|
102
|
+
}, helperText) : null;
|
|
103
|
+
var input = /*#__PURE__*/React__default.createElement("input", textInputProps({
|
|
104
|
+
sharedTextInputProps: sharedTextInputProps,
|
|
105
|
+
invalid: normalizedProps.invalid,
|
|
106
|
+
invalidId: normalizedProps.invalidId,
|
|
107
|
+
warn: normalizedProps.warn,
|
|
108
|
+
warnId: normalizedProps.warnId
|
|
109
|
+
}));
|
|
110
|
+
|
|
111
|
+
var _useContext = useContext(FormContext),
|
|
112
|
+
isFluid = _useContext.isFluid;
|
|
113
|
+
|
|
114
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
115
|
+
className: inputWrapperClasses
|
|
116
|
+
}, !inline ? label : /*#__PURE__*/React__default.createElement("div", {
|
|
117
|
+
className: "".concat(prefix, "--text-input__label-helper-wrapper")
|
|
118
|
+
}, label, !isFluid && helper), /*#__PURE__*/React__default.createElement("div", {
|
|
119
|
+
className: fieldOuterWrapperClasses
|
|
120
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
121
|
+
className: fieldWrapperClasses,
|
|
122
|
+
"data-invalid": normalizedProps.invalid || null
|
|
123
|
+
}, normalizedProps.icon && /*#__PURE__*/React__default.createElement(normalizedProps.icon, {
|
|
124
|
+
className: iconClasses
|
|
125
|
+
}), input, isFluid && /*#__PURE__*/React__default.createElement("hr", {
|
|
126
|
+
className: "".concat(prefix, "--text-input__divider")
|
|
127
|
+
}), isFluid && !inline && normalizedProps.validation), !isFluid && !inline && (normalizedProps.validation || helper)));
|
|
128
|
+
});
|
|
129
|
+
TextInput.displayName = 'TextInput';
|
|
130
|
+
TextInput.PasswordInput = PasswordInput;
|
|
131
|
+
TextInput.ControlledPasswordInput = ControlledPasswordInput;
|
|
132
|
+
TextInput.propTypes = {
|
|
133
|
+
/**
|
|
134
|
+
* Specify an optional className to be applied to the `<input>` node
|
|
135
|
+
*/
|
|
136
|
+
className: PropTypes.string,
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Optionally provide the default value of the `<input>`
|
|
140
|
+
*/
|
|
141
|
+
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Specify whether the `<input>` should be disabled
|
|
145
|
+
*/
|
|
146
|
+
disabled: PropTypes.bool,
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Provide text that is used alongside the control label for additional help
|
|
150
|
+
*/
|
|
151
|
+
helperText: PropTypes.node,
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Specify whether you want the underlying label to be visually hidden
|
|
155
|
+
*/
|
|
156
|
+
hideLabel: PropTypes.bool,
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Specify a custom `id` for the `<input>`
|
|
160
|
+
*/
|
|
161
|
+
id: PropTypes.string.isRequired,
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* `true` to use the inline version.
|
|
165
|
+
*/
|
|
166
|
+
inline: PropTypes.bool,
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Specify whether the control is currently invalid
|
|
170
|
+
*/
|
|
171
|
+
invalid: PropTypes.bool,
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Provide the text that is displayed when the control is in an invalid state
|
|
175
|
+
*/
|
|
176
|
+
invalidText: PropTypes.node,
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Provide the text that will be read by a screen reader when visiting this
|
|
180
|
+
* control
|
|
181
|
+
*/
|
|
182
|
+
labelText: PropTypes.node.isRequired,
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* `true` to use the light version. For use on $ui-01 backgrounds only.
|
|
186
|
+
* Don't use this to make tile background color same as container background color.
|
|
187
|
+
*/
|
|
188
|
+
light: PropTypes.bool,
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Optionally provide an `onChange` handler that is called whenever `<input>`
|
|
192
|
+
* is updated
|
|
193
|
+
*/
|
|
194
|
+
onChange: PropTypes.func,
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Optionally provide an `onClick` handler that is called whenever the
|
|
198
|
+
* `<input>` is clicked
|
|
199
|
+
*/
|
|
200
|
+
onClick: PropTypes.func,
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Specify the placeholder attribute for the `<input>`
|
|
204
|
+
*/
|
|
205
|
+
placeholder: PropTypes.string,
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Whether the input should be read-only
|
|
209
|
+
*/
|
|
210
|
+
readOnly: PropTypes.bool,
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Specify the size of the Text Input. Currently supports the following:
|
|
214
|
+
*/
|
|
215
|
+
size: FeatureFlags.enabled('enable-v11-release') ? PropTypes.oneOf(['sm', 'md', 'lg']) : PropTypes.oneOf(['sm', 'md', 'lg', 'xl']),
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Specify the type of the `<input>`
|
|
219
|
+
*/
|
|
220
|
+
type: PropTypes.string,
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Specify the value of the `<input>`
|
|
224
|
+
*/
|
|
225
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Specify whether the control is currently in warning state
|
|
229
|
+
*/
|
|
230
|
+
warn: PropTypes.bool,
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Provide the text that is displayed when the control is in warning state
|
|
234
|
+
*/
|
|
235
|
+
warnText: PropTypes.node
|
|
236
|
+
};
|
|
237
|
+
var TextInput$1 = TextInput;
|
|
238
|
+
|
|
239
|
+
export { TextInput$1 as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2021
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { deprecateFieldOnObject } from '../../internal/deprecateFieldOnObject.js';
|
|
9
|
+
import ControlledPasswordInput from './ControlledPasswordInput.js';
|
|
10
|
+
import PasswordInput from './PasswordInput.js';
|
|
11
|
+
import TextInput from './TextInput.js';
|
|
12
|
+
export { default } from './TextInput.js';
|
|
13
|
+
|
|
14
|
+
TextInput.ControlledPasswordInput = ControlledPasswordInput;
|
|
15
|
+
TextInput.PasswordInput = PasswordInput;
|
|
16
|
+
|
|
17
|
+
if (process.env.NODE_ENV !== "production") {
|
|
18
|
+
deprecateFieldOnObject(TextInput, 'ControlledPasswordInput', ControlledPasswordInput);
|
|
19
|
+
deprecateFieldOnObject(TextInput, 'PasswordInput', PasswordInput);
|
|
20
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2021
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
+
|
|
10
|
+
var invalidProps = function invalidProps(invalidId) {
|
|
11
|
+
return {
|
|
12
|
+
'data-invalid': true,
|
|
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
|
+
};
|
|
23
|
+
|
|
24
|
+
var textInputProps = function textInputProps(_ref) {
|
|
25
|
+
var sharedTextInputProps = _ref.sharedTextInputProps,
|
|
26
|
+
invalid = _ref.invalid,
|
|
27
|
+
invalidId = _ref.invalidId,
|
|
28
|
+
warn = _ref.warn,
|
|
29
|
+
warnId = _ref.warnId;
|
|
30
|
+
return _objectSpread2(_objectSpread2(_objectSpread2({}, sharedTextInputProps), invalid ? invalidProps(invalidId) : {}), warn ? warnProps(warnId) : {});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { textInputProps };
|