grommet 2.57.0 → 2.59.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/all/stories/AllComponents.stories.js +2 -1
- package/components/Accordion/Accordion.js +2 -1
- package/components/Accordion/stories/CustomHeader.stories.js +2 -1
- package/components/AccordionPanel/AccordionPanel.js +2 -1
- package/components/Anchor/Anchor.js +2 -1
- package/components/Anchor/StyledAnchor.js +2 -1
- package/components/Avatar/Avatar.js +2 -1
- package/components/Box/Box.js +2 -1
- package/components/Box/ResponsiveContainerProvider.js +2 -1
- package/components/Box/StyledBox.js +3 -2
- package/components/Box/stories/ColorContrast.stories.js +36 -0
- package/components/Box/stories/ResponsiveContainer.stories.js +2 -1
- package/components/Button/Badge.js +2 -1
- package/components/Button/BusyAnimation.js +9 -2
- package/components/Button/Button.js +14 -4
- package/components/Button/StyledButton.js +2 -1
- package/components/Button/StyledButtonKind.js +2 -1
- package/components/Button/stories/Busy.stories.js +2 -1
- package/components/Calendar/Calendar.js +2 -1
- package/components/Calendar/StyledCalendar.js +2 -1
- package/components/Calendar/stories/ActiveDate.stories.js +2 -1
- package/components/Calendar/stories/CustomDay.stories.js +2 -1
- package/components/Calendar/stories/CustomHeader.stories.js +2 -1
- package/components/Calendar/stories/CustomThemed/CustomSizeHeading.stories.js +2 -1
- package/components/Calendar/stories/Dual.stories.js +2 -1
- package/components/Calendar/stories/HeaderLevel.stories.js +2 -1
- package/components/Calendar/stories/Multiple.stories.js +2 -1
- package/components/Calendar/stories/ShowAdjacentDays.stories.js +2 -1
- package/components/Calendar/stories/Simple.stories.js +2 -1
- package/components/Card/Card.js +2 -1
- package/components/Cards/Cards.js +2 -1
- package/components/Cards/index.d.ts +2 -16
- package/components/Carousel/Carousel.js +2 -1
- package/components/Carousel/CarouselChild.js +2 -1
- package/components/Carousel/StyledCarousel.js +2 -1
- package/components/Chart/Chart.js +2 -1
- package/components/Chart/StyledChart.js +2 -1
- package/components/Chart/stories/Rich.stories.js +2 -1
- package/components/Chart/stories/Scan.stories.js +2 -1
- package/components/Chart/stories/Window.stories.js +2 -1
- package/components/Chart/stories/Zoom.stories.js +2 -1
- package/components/CheckBox/CheckBox.js +2 -1
- package/components/CheckBox/README.md +95 -0
- package/components/CheckBox/StyledCheckBox.js +104 -16
- package/components/CheckBox/stories/CustomThemed/Appearance.stories.tsx +160 -0
- package/components/CheckBox/stories/CustomThemed/Custom.stories.js +2 -1
- package/components/CheckBox/stories/CustomThemed/CustomToggle.stories.js +2 -1
- package/components/CheckBox/stories/Indeterminate.stories.js +2 -1
- package/components/CheckBox/stories/NoLabel.stories.js +2 -1
- package/components/CheckBox/stories/Simple.stories.js +2 -1
- package/components/CheckBox/stories/WithStickyDiv.stories.js +2 -1
- package/components/CheckBoxGroup/CheckBoxGroup.js +2 -1
- package/components/CheckBoxGroup/stories/Children.stories.js +2 -1
- package/components/CheckBoxGroup/stories/InitialValues.stories.js +2 -1
- package/components/Clock/Analog.js +2 -1
- package/components/Clock/Clock.js +2 -1
- package/components/Clock/Digital.js +2 -1
- package/components/Clock/StyledClock.js +2 -1
- package/components/Collapsible/Collapsible.js +2 -1
- package/components/Data/Data.js +2 -1
- package/components/Data/DataForm.js +2 -1
- package/components/Data/stories/Infinite.stories.js +2 -1
- package/components/Data/stories/Inline.stories.js +2 -1
- package/components/Data/stories/OnSelect.stories.js +2 -1
- package/components/Data/stories/SpaceX.stories.js +2 -1
- package/components/Data/stories/StarWars.stories.js +2 -1
- package/components/DataChart/DataChart.js +2 -1
- package/components/DataChart/Detail.js +2 -1
- package/components/DataChart/Legend.js +2 -1
- package/components/DataChart/XAxis.js +2 -1
- package/components/DataChart/XGuide.js +2 -1
- package/components/DataChart/YAxis.js +2 -1
- package/components/DataChart/YGuide.js +2 -1
- package/components/DataChart/stories/Prediction.stories.js +2 -1
- package/components/DataClearFilters/DataClearFilters.js +2 -1
- package/components/DataClearFilters/stories/Simple.stories.js +2 -1
- package/components/DataFilter/DataFilter.js +2 -1
- package/components/DataFilters/DataFilters.js +2 -1
- package/components/DataSearch/DataSearch.js +2 -1
- package/components/DataSort/DataSort.js +2 -1
- package/components/DataSummary/DataSummary.js +2 -1
- package/components/DataTable/Body.js +2 -1
- package/components/DataTable/Cell.js +2 -1
- package/components/DataTable/DataTable.js +2 -1
- package/components/DataTable/ExpanderCell.js +2 -1
- package/components/DataTable/Footer.js +2 -1
- package/components/DataTable/GroupedBody.js +2 -1
- package/components/DataTable/Header.js +2 -1
- package/components/DataTable/PlaceholderBody.js +2 -1
- package/components/DataTable/Resizer.js +2 -1
- package/components/DataTable/Searcher.js +2 -1
- package/components/DataTable/StyledDataTable.js +3 -2
- package/components/DataTable/stories/ControlledGrouped.stories.js +2 -1
- package/components/DataTable/stories/OnUpdate.stories.js +2 -1
- package/components/DataTable/stories/SpaceX.stories.js +2 -1
- package/components/DataTable/stories/SpaceXUngrouped.stories.js +2 -1
- package/components/DataTable/stories/rowDetails.stories.js +2 -1
- package/components/DataTableColumns/DataTableColumns.js +2 -1
- package/components/DataTableGroupBy/DataTableGroupBy.js +2 -1
- package/components/DataView/DataView.js +2 -1
- package/components/DateInput/DateInput.js +14 -7
- package/components/DateInput/stories/FormatInline.stories.js +2 -1
- package/components/DateTimeInput/DateTimeInput.js +21 -12
- package/components/DateTimeInput/StyledDateTimeInput.js +11 -2
- package/components/Diagram/Diagram.js +2 -1
- package/components/Diagram/StyledDiagram.js +2 -1
- package/components/Diagram/stories/Animated.stories.js +2 -1
- package/components/Diagram/stories/Progressing.stories.js +2 -1
- package/components/Drop/Drop.js +2 -1
- package/components/Drop/DropContainer.js +2 -1
- package/components/Drop/StyledDrop.js +2 -1
- package/components/Drop/stories/CustomThemed/Lazy.stories.js +2 -1
- package/components/Drop/stories/CustomThemed/Themed.stories.js +2 -1
- package/components/Drop/stories/Inline.stories.js +2 -1
- package/components/Drop/stories/Meter.stories.js +2 -1
- package/components/Drop/stories/Multiple.stories.js +2 -1
- package/components/Drop/stories/Overflow.stories.js +2 -1
- package/components/Drop/stories/Plain.stories.js +2 -1
- package/components/Drop/stories/Progressive.stories.js +2 -1
- package/components/Drop/stories/Simple.stories.js +2 -1
- package/components/Drop/stories/Styled.stories.js +2 -1
- package/components/DropButton/DropButton.js +2 -1
- package/components/FileInput/FileInput.js +78 -21
- package/components/FileInput/README.md +5 -0
- package/components/FocusedContainer.js +4 -2
- package/components/Form/Form.js +2 -1
- package/components/Form/FormContext.js +2 -1
- package/components/Form/stories/ArrayOfFormFields.stories.js +2 -1
- package/components/Form/stories/Controlled.stories.js +2 -1
- package/components/Form/stories/ControlledInput.stories.js +2 -1
- package/components/Form/stories/ControlledInputLazy.stories.js +2 -1
- package/components/Form/stories/ControlledLazy.stories.js +2 -1
- package/components/Form/stories/CustomThemed/FieldBorderPosition.stories.js +2 -1
- package/components/Form/stories/CustomThemed/FieldCustomStates.stories.js +2 -1
- package/components/Form/stories/DynamicFields.stories.js +2 -1
- package/components/Form/stories/FieldStates.stories.js +2 -1
- package/components/Form/stories/SolicitedFeedback.stories.js +2 -1
- package/components/Form/stories/UnsolicitedFeedback.stories.js +2 -1
- package/components/Form/stories/ValidateOnChange.stories.js +2 -1
- package/components/Form/stories/ValidateOnMount.stories.js +2 -1
- package/components/FormField/FormField.js +235 -76
- package/components/FormField/FormFieldContext.js +12 -0
- package/components/FormField/README.md +56 -1
- package/components/FormField/stories/CustomThemed/Appearance.stories.tsx +630 -0
- package/components/FormField/stories/Simple.stories.js +2 -1
- package/components/Grid/Grid.js +2 -1
- package/components/Grid/StyledGrid.js +2 -1
- package/components/Grid/stories/ResponsiveCards.stories.js +2 -1
- package/components/Grommet/Grommet.js +6 -2
- package/components/Grommet/StyledGrommet.js +5 -4
- package/components/Grommet/index.d.ts +10 -0
- package/components/Grommet/propTypes.js +6 -1
- package/components/Header/Header.js +2 -1
- package/components/Header/stories/Sticky.stories.js +2 -1
- package/components/Heading/Heading.js +2 -1
- package/components/Heading/HeadingSkeleton.js +2 -1
- package/components/Heading/StyledHeading.js +2 -1
- package/components/Image/Image.js +2 -1
- package/components/Image/StyledImage.js +2 -1
- package/components/InfiniteScroll/InfiniteScroll.js +2 -1
- package/components/Layer/Layer.js +2 -1
- package/components/Layer/LayerContainer.js +2 -1
- package/components/Layer/StyledLayer.js +2 -1
- package/components/List/List.js +2 -1
- package/components/List/stories/Order.stories.js +2 -1
- package/components/List/stories/Pinned.stories.js +2 -1
- package/components/Markdown/Markdown.js +2 -1
- package/components/MaskedInput/MaskedInput.js +2 -1
- package/components/Menu/Menu.js +3 -2
- package/components/Meter/Bar.js +2 -1
- package/components/Meter/Circle.js +2 -1
- package/components/Meter/Meter.js +2 -1
- package/components/Meter/StyledMeter.js +2 -1
- package/components/Meter/stories/Circle.stories.js +2 -1
- package/components/Meter/stories/VerticalBarMultiple.stories.js +2 -1
- package/components/NameValueList/NameValueList.js +2 -1
- package/components/NameValuePair/NameValuePair.js +2 -1
- package/components/Nav/stories/CustomThemed/JustifySidebar.stories.js +2 -1
- package/components/Nav/stories/Sidebar.stories.js +2 -1
- package/components/Notification/Notification.js +2 -1
- package/components/Notification/stories/Global.stories.js +2 -1
- package/components/Notification/stories/Title.stories.js +2 -1
- package/components/Notification/stories/TitleAndMessage.stories.js +2 -1
- package/components/Page/Page.js +2 -1
- package/components/Page/stories/PageNotificaton.stories.js +2 -1
- package/components/PageContent/PageContent.js +2 -1
- package/components/PageHeader/PageHeader.js +2 -1
- package/components/PageHeader/stories/MultipleActions.stories.js +2 -1
- package/components/Pagination/Pagination.js +2 -1
- package/components/Pagination/PaginationStep.js +2 -1
- package/components/Pagination/PaginationSummary.js +2 -1
- package/components/Pagination/stories/Grid.stories.js +2 -1
- package/components/Paragraph/Paragraph.js +2 -1
- package/components/Paragraph/ParagraphSkeleton.js +2 -1
- package/components/Paragraph/StyledParagraph.js +2 -1
- package/components/RadioButton/README.md +93 -1
- package/components/RadioButton/RadioButton.js +13 -5
- package/components/RadioButton/StyledRadioButton.js +103 -10
- package/components/RadioButton/stories/CustomThemed/Appearance.stories.tsx +190 -0
- package/components/RadioButtonGroup/RadioButtonGroup.js +2 -1
- package/components/RadioButtonGroup/stories/Children.stories.js +2 -1
- package/components/RadioButtonGroup/stories/CustomThemed/CustomTheme.stories.js +2 -1
- package/components/RadioButtonGroup/stories/Disabled.stories.js +2 -1
- package/components/RangeInput/RangeInput.js +2 -1
- package/components/RangeInput/StyledRangeInput.js +2 -1
- package/components/RangeInput/stories/CustomThemed/Bounds.stories.js +2 -1
- package/components/RangeSelector/EdgeControl.js +2 -1
- package/components/RangeSelector/RangeSelector.js +2 -1
- package/components/RangeSelector/index.d.ts +1 -10
- package/components/RangeSelector/stories/Basic.stories.js +2 -1
- package/components/RangeSelector/stories/CustomThemed/Custom.stories.js +2 -1
- package/components/RangeSelector/stories/CustomThemed/CustomEdgeControl.stories.js +2 -1
- package/components/RangeSelector/stories/Label.stories.js +2 -1
- package/components/RangeSelector/stories/Simple.stories.js +2 -1
- package/components/RangeSelector/stories/Step.stories.js +2 -1
- package/components/RangeSelector/stories/Thin.stories.js +2 -1
- package/components/RangeSelector/stories/Vertical.stories.js +2 -1
- package/components/RoutedAnchor/RoutedAnchor.js +2 -1
- package/components/RoutedButton/RoutedButton.js +2 -1
- package/components/Select/DefaultSelectTextInput.js +2 -1
- package/components/Select/Select.js +2 -1
- package/components/Select/SelectContainer.js +4 -3
- package/components/Select/StyledSelect.js +14 -4
- package/components/Select/stories/ChildrenRender.stories.js +2 -1
- package/components/Select/stories/Clear.stories.js +2 -1
- package/components/Select/stories/Controlled.stories.js +2 -1
- package/components/Select/stories/CustomThemed/CustomSearch.stories.js +2 -1
- package/components/Select/stories/Disabled.stories.js +2 -1
- package/components/Select/stories/InsideFormField.stories.js +2 -1
- package/components/Select/stories/Multiple.stories.js +2 -1
- package/components/Select/stories/ObjectOptions.stories.js +2 -1
- package/components/Select/stories/Search.stories.js +2 -1
- package/components/Select/stories/Simple.stories.js +2 -1
- package/components/Select/stories/ValueLabel.stories.js +2 -1
- package/components/Select/stories/components/SearchBorderBox.js +2 -1
- package/components/Select/stories/components/SearchInput.js +2 -1
- package/components/Select/utils.js +2 -1
- package/components/SelectMultiple/SelectMultiple.js +10 -4
- package/components/SelectMultiple/SelectMultipleContainer.js +2 -1
- package/components/SelectMultiple/SelectMultipleValue.js +2 -1
- package/components/SelectMultiple/SelectionSummary.js +2 -1
- package/components/SelectMultiple/stories/CustomMessages.stories.js +2 -1
- package/components/SelectMultiple/stories/Default.stories.js +2 -1
- package/components/SelectMultiple/stories/Disabled.stories.js +2 -1
- package/components/SelectMultiple/stories/FormField.stories.js +2 -1
- package/components/SelectMultiple/stories/Help.stories.js +2 -1
- package/components/SelectMultiple/stories/Limited.stories.js +2 -1
- package/components/SelectMultiple/stories/ObjectOptions.stories.js +2 -1
- package/components/SelectMultiple/stories/ShowSelectedInline.stories.js +2 -1
- package/components/Skeleton/Skeleton.js +2 -1
- package/components/Skeleton/SkeletonContext.js +2 -1
- package/components/Skeleton/stories/CustomThemed/Custom.stories.js +2 -1
- package/components/Skeleton/stories/GridContainer.stories.js +2 -1
- package/components/SkipLink/SkipLink.js +2 -1
- package/components/SkipLinks/SkipLinks.js +2 -1
- package/components/Spinner/Spinner.js +2 -1
- package/components/Spinner/stories/Animation.stories.js +2 -1
- package/components/Spinner/stories/Announced.stories.js +2 -1
- package/components/Stack/Stack.js +2 -1
- package/components/Stack/StyledStack.js +2 -1
- package/components/StarRating/StarRating.js +2 -1
- package/components/Stepper/Stepper.js +138 -101
- package/components/Stepper/StepperContext.js +5 -4
- package/components/Stepper/StepperDescription.js +6 -8
- package/components/Stepper/StepperHelperText.js +13 -15
- package/components/Stepper/StepperIndicator.js +37 -34
- package/components/Stepper/StepperLabel.js +11 -23
- package/components/Stepper/StepperStep.js +139 -82
- package/components/Stepper/StyledStepper.js +168 -115
- package/components/Stepper/index.d.ts +25 -13
- package/components/Stepper/index.js +5 -1
- package/components/Stepper/propTypes.js +3 -0
- package/components/Stepper/stories/Children.stories.tsx +73 -0
- package/components/Stepper/stories/CustomThemed.stories.tsx +301 -0
- package/components/Stepper/stories/CustomThemedHpe.stories.tsx +328 -0
- package/components/Stepper/stories/DisabledSteps.stories.js +2 -1
- package/components/Stepper/stories/ErrorStates.stories.js +2 -1
- package/components/Stepper/stories/HorizontalSteps.stories.js +2 -1
- package/components/Stepper/stories/Interactive.stories.js +2 -1
- package/components/Stepper/stories/KeyboardNavigation.stories.js +2 -1
- package/components/Stepper/stories/NestedSubSteps.stories.js +2 -1
- package/components/Stepper/stories/ThemingLightDark.stories.js +2 -1
- package/components/Stepper/stories/VerticalSteps.stories.js +2 -1
- package/components/Stepper/utils.js +54 -0
- package/components/Tab/StyledTab.js +2 -1
- package/components/Tab/Tab.js +2 -1
- package/components/Table/StyledTable.js +2 -1
- package/components/Table/Table.js +2 -1
- package/components/Table/stories/InfiniteScrollInTable.stories.js +2 -1
- package/components/TableBody/TableBody.js +2 -1
- package/components/TableCell/TableCell.js +2 -1
- package/components/TableFooter/TableFooter.js +2 -1
- package/components/TableHeader/TableHeader.js +2 -1
- package/components/TableRow/TableRow.js +2 -1
- package/components/Tabs/StyledTabs.js +2 -1
- package/components/Tabs/Tabs.js +2 -1
- package/components/Tabs/stories/CustomThemed/States.stories.js +2 -1
- package/components/Tabs/stories/Responsive.stories.js +2 -1
- package/components/Tag/Tag.js +2 -1
- package/components/Text/StyledText.js +2 -1
- package/components/Text/Text.js +2 -1
- package/components/Text/TextSkeleton.js +2 -1
- package/components/TextArea/StyledTextArea.js +5 -2
- package/components/TextArea/TextArea.js +2 -1
- package/components/TextArea/stories/CustomThemed/Themed.stories.js +2 -1
- package/components/TextArea/stories/InsideFormField.stories.js +2 -1
- package/components/TextArea/stories/NonResizable.stories.js +2 -1
- package/components/TextArea/stories/Simple.stories.js +2 -1
- package/components/TextInput/CopyButton.js +24 -6
- package/components/TextInput/README.md +29 -1
- package/components/TextInput/StyledTextInput.js +34 -26
- package/components/TextInput/TextInput.js +165 -41
- package/components/TextInput/index.d.ts +14 -3
- package/components/TextInput/propTypes.js +4 -0
- package/components/TextInput/stories/Clear.stories.tsx +68 -0
- package/components/TextInput/stories/ClearFormField.stories.tsx +45 -0
- package/components/TextInput/stories/Copy.stories.tsx +42 -0
- package/components/TextInput/stories/CopySecret.stories.tsx +44 -0
- package/components/TextInput/stories/InsideFormField.stories.js +2 -1
- package/components/TimeInput/README.md +24 -1
- package/components/TimeInput/StyledTimeInput.js +102 -28
- package/components/TimeInput/TimeInput.js +189 -121
- package/components/TimeInput/TimeInputPopup.js +116 -118
- package/components/TimeInput/index.d.ts +2 -0
- package/components/TimeInput/propTypes.js +2 -0
- package/components/TimeInput/stories/Controlled.stories.tsx +2 -2
- package/components/TimeInput/stories/CustomThemed.stories.tsx +79 -0
- package/components/TimeInput/stories/CustomThemedHpe.stories.tsx +115 -0
- package/components/TimeInput/stories/Form.stories.tsx +1 -0
- package/components/TimeInput/stories/Inline.stories.tsx +28 -0
- package/components/TimeInput/stories/ShowSeconds.stories.tsx +28 -0
- package/components/TimeInput/useSectionedTimeField.js +2 -2
- package/components/TimeInput/utils.js +13 -62
- package/components/Tip/Tip.js +2 -1
- package/components/Tip/stories/HeaderActions.stories.js +2 -1
- package/components/ToggleGroup/ToggleGroup.js +2 -1
- package/components/ToggleGroup/stories/Controlled.stories.js +2 -1
- package/components/Toolbar/Toolbar.js +2 -1
- package/components/Video/StyledVideo.js +2 -1
- package/components/Video/Video.js +2 -1
- package/components/Wizard/Wizard.js +409 -212
- package/components/Wizard/WizardContent.js +63 -36
- package/components/Wizard/WizardContext.js +5 -1
- package/components/Wizard/WizardFooter.js +14 -15
- package/components/Wizard/WizardHeader.js +12 -7
- package/components/Wizard/WizardProgress.js +28 -6
- package/components/Wizard/index.d.ts +35 -4
- package/components/Wizard/propTypes.js +6 -1
- package/components/Wizard/stories/BasicLinear.stories.js +14 -11
- package/components/Wizard/stories/Branching.stories.js +2 -1
- package/components/Wizard/stories/ClickableSteps.stories.js +105 -0
- package/components/Wizard/stories/Composable.stories.js +2 -1
- package/components/Wizard/stories/Controlled.stories.js +2 -1
- package/components/Wizard/stories/ExternalForm.stories.js +115 -0
- package/components/Wizard/stories/LongContent.stories.js +2 -1
- package/components/Wizard/stories/Modal.stories.js +2 -1
- package/components/Wizard/stories/NestedSubSteps.stories.js +2 -1
- package/components/Wizard/stories/NonClosableHeader.stories.js +69 -0
- package/components/Wizard/stories/ProgressiveSubSteps.stories.tsx +209 -0
- package/components/Wizard/stories/Validation.stories.js +20 -9
- package/components/WorldMap/WorldMap.js +2 -1
- package/contexts/AnalyticsContext/AnalyticsContext.js +2 -1
- package/contexts/AnnounceContext/stories/Polite.stories.js +2 -1
- package/contexts/RootsContext.js +2 -1
- package/contexts/ThemeContext/stories/ThemeContextExtend.stories.js +2 -1
- package/es6/components/Box/StyledBox.js +1 -1
- package/es6/components/Box/stories/ColorContrast.stories.js +31 -0
- package/es6/components/Button/BusyAnimation.js +7 -1
- package/es6/components/Button/Button.js +12 -3
- package/es6/components/Cards/index.d.ts +2 -16
- package/es6/components/CheckBox/README.md +95 -0
- package/es6/components/CheckBox/StyledCheckBox.js +103 -14
- package/es6/components/CheckBox/stories/CustomThemed/Appearance.stories.tsx +160 -0
- package/es6/components/DataTable/StyledDataTable.js +2 -2
- package/es6/components/DateInput/DateInput.js +13 -6
- package/es6/components/DateTimeInput/DateTimeInput.js +19 -11
- package/es6/components/DateTimeInput/StyledDateTimeInput.js +10 -2
- package/es6/components/FileInput/FileInput.js +77 -20
- package/es6/components/FileInput/README.md +5 -0
- package/es6/components/FocusedContainer.js +2 -1
- package/es6/components/FormField/FormField.js +231 -73
- package/es6/components/FormField/FormFieldContext.js +7 -0
- package/es6/components/FormField/README.md +56 -1
- package/es6/components/FormField/stories/CustomThemed/Appearance.stories.tsx +630 -0
- package/es6/components/Grommet/Grommet.js +4 -1
- package/es6/components/Grommet/StyledGrommet.js +4 -4
- package/es6/components/Grommet/index.d.ts +10 -0
- package/es6/components/Grommet/propTypes.js +6 -1
- package/es6/components/Menu/Menu.js +1 -1
- package/es6/components/RadioButton/README.md +93 -1
- package/es6/components/RadioButton/RadioButton.js +11 -4
- package/es6/components/RadioButton/StyledRadioButton.js +102 -8
- package/es6/components/RadioButton/stories/CustomThemed/Appearance.stories.tsx +190 -0
- package/es6/components/RangeSelector/index.d.ts +1 -10
- package/es6/components/Select/SelectContainer.js +2 -2
- package/es6/components/Select/StyledSelect.js +13 -4
- package/es6/components/SelectMultiple/SelectMultiple.js +9 -3
- package/es6/components/Stepper/Stepper.js +137 -101
- package/es6/components/Stepper/StepperContext.js +5 -4
- package/es6/components/Stepper/StepperDescription.js +6 -8
- package/es6/components/Stepper/StepperHelperText.js +13 -15
- package/es6/components/Stepper/StepperIndicator.js +38 -35
- package/es6/components/Stepper/StepperLabel.js +11 -23
- package/es6/components/Stepper/StepperStep.js +137 -81
- package/es6/components/Stepper/StyledStepper.js +167 -113
- package/es6/components/Stepper/index.d.ts +25 -13
- package/es6/components/Stepper/index.js +2 -1
- package/es6/components/Stepper/propTypes.js +3 -0
- package/es6/components/Stepper/stories/Children.stories.tsx +73 -0
- package/es6/components/Stepper/stories/CustomThemed.stories.tsx +301 -0
- package/es6/components/Stepper/stories/CustomThemedHpe.stories.tsx +328 -0
- package/es6/components/Stepper/utils.js +50 -0
- package/es6/components/TextArea/StyledTextArea.js +4 -2
- package/es6/components/TextInput/CopyButton.js +22 -6
- package/es6/components/TextInput/README.md +29 -1
- package/es6/components/TextInput/StyledTextInput.js +34 -27
- package/es6/components/TextInput/TextInput.js +164 -41
- package/es6/components/TextInput/index.d.ts +14 -3
- package/es6/components/TextInput/propTypes.js +4 -0
- package/es6/components/TextInput/stories/Clear.stories.tsx +68 -0
- package/es6/components/TextInput/stories/ClearFormField.stories.tsx +45 -0
- package/es6/components/TextInput/stories/Copy.stories.tsx +42 -0
- package/es6/components/TextInput/stories/CopySecret.stories.tsx +44 -0
- package/es6/components/TimeInput/README.md +24 -1
- package/es6/components/TimeInput/StyledTimeInput.js +101 -28
- package/es6/components/TimeInput/TimeInput.js +189 -122
- package/es6/components/TimeInput/TimeInputPopup.js +115 -118
- package/es6/components/TimeInput/index.d.ts +2 -0
- package/es6/components/TimeInput/propTypes.js +2 -0
- package/es6/components/TimeInput/stories/Controlled.stories.tsx +2 -2
- package/es6/components/TimeInput/stories/CustomThemed.stories.tsx +79 -0
- package/es6/components/TimeInput/stories/CustomThemedHpe.stories.tsx +115 -0
- package/es6/components/TimeInput/stories/Form.stories.tsx +1 -0
- package/es6/components/TimeInput/stories/Inline.stories.tsx +28 -0
- package/es6/components/TimeInput/stories/ShowSeconds.stories.tsx +28 -0
- package/es6/components/TimeInput/useSectionedTimeField.js +2 -2
- package/es6/components/TimeInput/utils.js +12 -61
- package/es6/components/Wizard/Wizard.js +407 -212
- package/es6/components/Wizard/WizardContent.js +62 -36
- package/es6/components/Wizard/WizardContext.js +3 -0
- package/es6/components/Wizard/WizardFooter.js +14 -15
- package/es6/components/Wizard/WizardHeader.js +12 -7
- package/es6/components/Wizard/WizardProgress.js +28 -6
- package/es6/components/Wizard/index.d.ts +35 -4
- package/es6/components/Wizard/propTypes.js +6 -1
- package/es6/components/Wizard/stories/BasicLinear.stories.js +11 -11
- package/es6/components/Wizard/stories/ClickableSteps.stories.js +99 -0
- package/es6/components/Wizard/stories/ExternalForm.stories.js +111 -0
- package/es6/components/Wizard/stories/NonClosableHeader.stories.js +63 -0
- package/es6/components/Wizard/stories/ProgressiveSubSteps.stories.tsx +209 -0
- package/es6/components/Wizard/stories/Validation.stories.js +18 -9
- package/es6/languages/default.json +7 -1
- package/es6/themes/base.d.ts +166 -153
- package/es6/themes/base.js +263 -201
- package/es6/utils/DOM.js +10 -7
- package/es6/utils/background.js +9 -7
- package/es6/utils/border.js +7 -0
- package/es6/utils/colors.js +84 -12
- package/es6/utils/legacyColorIsDark.js +17 -0
- package/es6/utils/styles.js +157 -29
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/languages/default.json +7 -1
- package/package.json +36 -36
- package/themes/base.d.ts +166 -153
- package/themes/base.js +263 -201
- package/tools/draft-release-version-pr.js +1 -0
- package/tools/generate-release-notes.js +1 -1
- package/tools/license-header.js +1 -1
- package/tools/pack.js +1 -1
- package/tools/release-checklist.js +1 -1
- package/tools/release-notes-utils.js +1 -0
- package/tools/release-preparation.md +55 -0
- package/tools/release-stable.js +1 -1
- package/tools/release-styled-components-beta-stable.js +1 -1
- package/utils/DOM.js +10 -7
- package/utils/background.js +9 -7
- package/utils/border.js +8 -1
- package/utils/colors.js +84 -12
- package/utils/legacyColorIsDark.js +21 -0
- package/utils/styles.js +158 -32
- package/utils/useId.js +2 -1
- package/components/Stepper/StepConnector.js +0 -38
- package/es6/components/Stepper/StepConnector.js +0 -33
|
@@ -1,26 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.StyledTextInputContainer = exports.StyledTextInput = exports.StyledSuggestions = exports.StyledPlaceholder = exports.
|
|
4
|
+
exports.StyledTextInputContainer = exports.StyledTextInput = exports.StyledSuggestions = exports.StyledPlaceholder = exports.StyledIcon = exports.StyledActionsGroup = void 0;
|
|
5
5
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
6
6
|
var _utils = require("../../utils");
|
|
7
7
|
var _styles = require("../../utils/styles");
|
|
8
8
|
var _readOnly = require("../../utils/readOnly");
|
|
9
|
-
|
|
9
|
+
var cache;
|
|
10
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, "default": e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
10
11
|
// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
11
12
|
// SPDX-License-Identifier: Apache-2.0
|
|
12
13
|
|
|
13
|
-
var getInlineButtonPad = function getInlineButtonPad(props) {
|
|
14
|
-
var rightInset = Number.parseFloat((0, _utils.getInputPadBySide)(props, 'right'));
|
|
15
|
-
var iconPad = Number.parseFloat((0, _styles.getInputIconPad)(props));
|
|
16
|
-
var trailingIconPad = props.hasTrailingIcon ? iconPad : 0;
|
|
17
|
-
// Reserve both the icon space and the control's edge inset so text clears
|
|
18
|
-
// the flush-right password toggle, and the reversed icon when both coexist.
|
|
19
|
-
return iconPad + trailingIconPad + rightInset + "px";
|
|
20
|
-
};
|
|
21
14
|
var getPlainStyle = function getPlainStyle(plain) {
|
|
22
15
|
if (plain === 'full') {
|
|
23
|
-
return (0, _styledComponents.css)(["", "
|
|
16
|
+
return (0, _styledComponents.css)(["", ";padding:0;"], _utils.plainInputStyle);
|
|
24
17
|
}
|
|
25
18
|
return plain && _utils.plainInputStyle;
|
|
26
19
|
};
|
|
@@ -32,15 +25,21 @@ var StyledTextInput = exports.StyledTextInput = _styledComponents["default"].inp
|
|
|
32
25
|
}, function (props) {
|
|
33
26
|
return (props.hasButton || props.readOnlyCopy) && 'min-width: 0;';
|
|
34
27
|
}, function (props) {
|
|
35
|
-
return props.
|
|
36
|
-
}, function (props) {
|
|
37
|
-
return props.readOnly && "border: none;";
|
|
28
|
+
return (props.readOnly || props.hasButton) && "border: none;";
|
|
38
29
|
}, function (props) {
|
|
39
30
|
return getPlainStyle(props.plain);
|
|
40
31
|
}, function (props) {
|
|
41
|
-
return props.icon && _styles.inputPadForIcon;
|
|
32
|
+
return props.icon && !props.hasActionsGroup && _styles.inputPadForIcon;
|
|
33
|
+
}, function (props) {
|
|
34
|
+
return (
|
|
35
|
+
// the static leading icon already pads its right side
|
|
36
|
+
props.hasLeadingIcon && props.hasActionsGroup && 'padding-left: 0px;'
|
|
37
|
+
);
|
|
42
38
|
}, function (props) {
|
|
43
|
-
return
|
|
39
|
+
return (
|
|
40
|
+
// avoid a second, native clear button on type="search" in WebKit/Blink
|
|
41
|
+
props.hasClear && "&::-webkit-search-cancel-button {\n -webkit-appearance: none;\n appearance: none;\n }"
|
|
42
|
+
);
|
|
44
43
|
}, function (props) {
|
|
45
44
|
return props.disabled && (0, _utils.disabledStyle)(props.theme.textInput.disabled && props.theme.textInput.disabled.opacity);
|
|
46
45
|
}, function (props) {
|
|
@@ -56,13 +55,23 @@ var StyledTextInputContainer = exports.StyledTextInputContainer = _styledCompone
|
|
|
56
55
|
})(["position:relative;width:100%;", " ", ";", ";", " ", ";"], function (props) {
|
|
57
56
|
return props.widthProp && props.readOnlyProp && (0, _utils.widthStyle)(props.widthProp, props.theme);
|
|
58
57
|
}, function (props) {
|
|
59
|
-
return
|
|
58
|
+
return (
|
|
59
|
+
// The container owns the border so the actions group remains inside
|
|
60
|
+
// the field.
|
|
61
|
+
(props.readOnlyProp || props.hasButton) && !props.plain && _utils.controlBorderStyle
|
|
62
|
+
);
|
|
60
63
|
}, function (props) {
|
|
61
64
|
return (props.readOnlyCopy || props.hasButton) && "\n box-sizing: border-box;\n flex-direction: row;\n display: flex;\n align-items: stretch;\n ";
|
|
62
65
|
}, function (props) {
|
|
63
66
|
return props.readOnlyProp && !props.plain && (0, _readOnly.readOnlyStyle)(props.theme);
|
|
64
67
|
}, function (props) {
|
|
65
|
-
|
|
68
|
+
var _props$theme$textInpu;
|
|
69
|
+
var appearance = (props.readOnlyProp || props.hasButton) && (0, _utils.inputAppearanceStyle)(props, {
|
|
70
|
+
wrapper: true,
|
|
71
|
+
skipPadding: true
|
|
72
|
+
});
|
|
73
|
+
var extend = (_props$theme$textInpu = props.theme.textInput) == null || (_props$theme$textInpu = _props$theme$textInpu.container) == null ? void 0 : _props$theme$textInpu.extend;
|
|
74
|
+
return appearance ? (0, _styledComponents.css)(["", "", ""], appearance, extend) : extend;
|
|
66
75
|
});
|
|
67
76
|
var StyledPlaceholder = exports.StyledPlaceholder = _styledComponents["default"].div.withConfig(_utils.styledComponentsConfig).withConfig({
|
|
68
77
|
displayName: "StyledTextInput__StyledPlaceholder",
|
|
@@ -76,19 +85,18 @@ var StyledIcon = exports.StyledIcon = _styledComponents["default"].div.withConfi
|
|
|
76
85
|
displayName: "StyledTextInput__StyledIcon",
|
|
77
86
|
componentId: "sc-1x30a0s-3"
|
|
78
87
|
})(["position:absolute;display:flex;justify:center;top:50%;transform:translateY(-50%);pointer-events:none;", ""], function (props) {
|
|
88
|
+
if (props.hasActionsGroup) {
|
|
89
|
+
return "\n position: static;\n align-items: center;\n transform: none;\n padding-left: " + (0, _utils.getInputPadBySide)(props, 'left') + ";\n padding-right: " + (0, _utils.getInputPadBySide)(props, 'right') + ";\n ";
|
|
90
|
+
}
|
|
79
91
|
return props.reverse ? "right: " + (0, _utils.getInputPadBySide)(props, 'right') + ";" : "left: " + (0, _utils.getInputPadBySide)(props, 'left') + ";";
|
|
80
92
|
});
|
|
81
|
-
var
|
|
82
|
-
displayName: "
|
|
93
|
+
var StyledActionsGroup = exports.StyledActionsGroup = _styledComponents["default"].div.withConfig(_utils.styledComponentsConfig).withConfig({
|
|
94
|
+
displayName: "StyledTextInput__StyledActionsGroup",
|
|
83
95
|
componentId: "sc-1x30a0s-4"
|
|
84
|
-
})(["
|
|
85
|
-
var StyledInlineIcon = exports.StyledInlineIcon = _styledComponents["default"].div.withConfig(_utils.styledComponentsConfig).withConfig({
|
|
86
|
-
displayName: "StyledTextInput__StyledInlineIcon",
|
|
87
|
-
componentId: "sc-1x30a0s-5"
|
|
88
|
-
})(["display:flex;align-items:center;justify-content:center;pointer-events:none;"]);
|
|
96
|
+
})(["display:flex;align-items:stretch;z-index:1;"]);
|
|
89
97
|
var StyledSuggestions = exports.StyledSuggestions = _styledComponents["default"].ol.withConfig(_utils.styledComponentsConfig).withConfig({
|
|
90
98
|
displayName: "StyledTextInput__StyledSuggestions",
|
|
91
|
-
componentId: "sc-1x30a0s-
|
|
99
|
+
componentId: "sc-1x30a0s-5"
|
|
92
100
|
})(["border-top-left-radius:0;border-top-right-radius:0;margin:0;padding:0;list-style-type:none;", ";"], function (props) {
|
|
93
101
|
return props.theme.textInput && props.theme.textInput.suggestions && props.theme.textInput.suggestions.extend;
|
|
94
102
|
});
|
|
@@ -17,11 +17,16 @@ var _MessageContext = require("../../contexts/MessageContext");
|
|
|
17
17
|
var _propTypes = require("./propTypes");
|
|
18
18
|
var _CopyButton = require("./CopyButton");
|
|
19
19
|
var _useThemeValue2 = require("../../utils/useThemeValue");
|
|
20
|
-
var _excluded = ["a11yTitle", "defaultSuggestion", "defaultValue", "disabled", "dropAlign", "dropHeight", "
|
|
20
|
+
var _excluded = ["a11yTitle", "clear", "copy", "defaultSuggestion", "defaultValue", "disabled", "dropAlign", "dropHeight", "dropProps", "dropTarget", "focusIndicator", "icon", "id", "messages", "name", "onBlur", "onChange", "onClickCopy", "onFocus", "onKeyDown", "onSelect", "onSuggestionSelect", "onSuggestionsClose", "onSuggestionsOpen", "password", "placeholder", "plain", "readOnly", "readOnlyCopy", "reverse", "suggestions", "textAlign", "type", "value", "width"]; // SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
21
21
|
// SPDX-License-Identifier: Apache-2.0
|
|
22
22
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
23
|
-
|
|
23
|
+
var cache;
|
|
24
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, "default": e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
24
25
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
26
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
27
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
28
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
29
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
25
30
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
26
31
|
var renderLabel = function renderLabel(suggestion) {
|
|
27
32
|
if (suggestion && typeof suggestion === 'object') {
|
|
@@ -49,21 +54,32 @@ var ContainerBox = (0, _styledComponents["default"])(_Box.Box).withConfig({
|
|
|
49
54
|
})(["", ";@media screen and (-ms-high-contrast:active),(-ms-high-contrast:none){width:100%;}"], function (props) {
|
|
50
55
|
return props.dropHeight ? (0, _utils.sizeStyle)('max-height', props.dropHeight, props.theme) : 'max-height: inherit;';
|
|
51
56
|
});
|
|
57
|
+
var StyledInlineActionButton = (0, _styledComponents["default"])(_Button.Button).withConfig({
|
|
58
|
+
displayName: "TextInput__StyledInlineActionButton",
|
|
59
|
+
componentId: "sc-1ai0c08-1"
|
|
60
|
+
})(["padding-top:0;padding-bottom:0;", ""], function (props) {
|
|
61
|
+
return props.$hidden && 'visibility: hidden;';
|
|
62
|
+
});
|
|
63
|
+
var isEmptyValue = function isEmptyValue(value) {
|
|
64
|
+
return value === undefined || value === null || value === '';
|
|
65
|
+
};
|
|
52
66
|
var defaultDropAlign = {
|
|
53
67
|
top: 'bottom',
|
|
54
68
|
left: 'left'
|
|
55
69
|
};
|
|
56
70
|
var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
57
|
-
var _inputRef$
|
|
71
|
+
var _inputRef$current4, _inputRef$current5, _theme$textInput, _theme$textInput2, _theme$textInput3;
|
|
58
72
|
var a11yTitle = _ref.a11yTitle,
|
|
73
|
+
clear = _ref.clear,
|
|
74
|
+
copy = _ref.copy,
|
|
59
75
|
defaultSuggestion = _ref.defaultSuggestion,
|
|
60
76
|
defaultValue = _ref.defaultValue,
|
|
61
77
|
disabled = _ref.disabled,
|
|
62
78
|
_ref$dropAlign = _ref.dropAlign,
|
|
63
79
|
dropAlign = _ref$dropAlign === void 0 ? defaultDropAlign : _ref$dropAlign,
|
|
64
80
|
dropHeight = _ref.dropHeight,
|
|
65
|
-
dropTarget = _ref.dropTarget,
|
|
66
81
|
dropProps = _ref.dropProps,
|
|
82
|
+
dropTarget = _ref.dropTarget,
|
|
67
83
|
_ref$focusIndicator = _ref.focusIndicator,
|
|
68
84
|
focusIndicator = _ref$focusIndicator === void 0 ? true : _ref$focusIndicator,
|
|
69
85
|
icon = _ref.icon,
|
|
@@ -72,6 +88,7 @@ var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
72
88
|
name = _ref.name,
|
|
73
89
|
_onBlur = _ref.onBlur,
|
|
74
90
|
onChange = _ref.onChange,
|
|
91
|
+
onClickCopy = _ref.onClickCopy,
|
|
75
92
|
_onFocus = _ref.onFocus,
|
|
76
93
|
onKeyDown = _ref.onKeyDown,
|
|
77
94
|
onSelect = _ref.onSelect,
|
|
@@ -118,15 +135,22 @@ var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
118
135
|
var _useState3 = (0, _react.useState)(false),
|
|
119
136
|
passwordRevealed = _useState3[0],
|
|
120
137
|
setPasswordRevealed = _useState3[1];
|
|
138
|
+
// uncontrolled inputs outside a Form don't re-render on change, so track
|
|
139
|
+
// emptiness here to toggle the clear button
|
|
140
|
+
var _useState4 = (0, _react.useState)(function () {
|
|
141
|
+
return !isEmptyValue(defaultValue);
|
|
142
|
+
}),
|
|
143
|
+
uncontrolledHasValue = _useState4[0],
|
|
144
|
+
setUncontrolledHasValue = _useState4[1];
|
|
121
145
|
var handleSuggestionSelect = (0, _react.useMemo)(function () {
|
|
122
146
|
return onSelect && !onSuggestionSelect ? onSelect : onSuggestionSelect;
|
|
123
147
|
}, [onSelect, onSuggestionSelect]);
|
|
124
148
|
var handleTextSelect = (0, _react.useMemo)(function () {
|
|
125
149
|
return onSelect && onSuggestionSelect ? onSelect : undefined;
|
|
126
150
|
}, [onSelect, onSuggestionSelect]);
|
|
127
|
-
var
|
|
128
|
-
suggestionsAtClose =
|
|
129
|
-
setSuggestionsAtClose =
|
|
151
|
+
var _useState5 = (0, _react.useState)(),
|
|
152
|
+
suggestionsAtClose = _useState5[0],
|
|
153
|
+
setSuggestionsAtClose = _useState5[1];
|
|
130
154
|
var readOnlyCopyValidation = format({
|
|
131
155
|
id: 'input.readOnlyCopy.validation',
|
|
132
156
|
messages: messages
|
|
@@ -135,9 +159,9 @@ var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
135
159
|
id: 'input.readOnlyCopy.prompt',
|
|
136
160
|
messages: messages
|
|
137
161
|
});
|
|
138
|
-
var
|
|
139
|
-
tip =
|
|
140
|
-
setTip =
|
|
162
|
+
var _useState6 = (0, _react.useState)(readOnlyCopyPrompt),
|
|
163
|
+
tip = _useState6[0],
|
|
164
|
+
setTip = _useState6[1];
|
|
141
165
|
var showPasswordMessage = format({
|
|
142
166
|
id: 'textInput.showPassword',
|
|
143
167
|
messages: messages
|
|
@@ -146,20 +170,84 @@ var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
146
170
|
id: 'textInput.hidePassword',
|
|
147
171
|
messages: messages
|
|
148
172
|
});
|
|
149
|
-
var
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
173
|
+
var clearMessage = format({
|
|
174
|
+
id: 'textInput.clear',
|
|
175
|
+
messages: messages
|
|
176
|
+
});
|
|
177
|
+
var handleCopyClick = /*#__PURE__*/function () {
|
|
178
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(event) {
|
|
179
|
+
var _ref3, _inputRef$current$val, _inputRef$current;
|
|
180
|
+
var currentValue;
|
|
181
|
+
return _regenerator().w(function (_context) {
|
|
182
|
+
while (1) switch (_context.n) {
|
|
183
|
+
case 0:
|
|
184
|
+
// uncontrolled inputs keep their current text on the DOM node, not
|
|
185
|
+
// in `value`, which stays undefined outside a Form
|
|
186
|
+
currentValue = (_ref3 = (_inputRef$current$val = (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.value) != null ? _inputRef$current$val : value) != null ? _ref3 : '';
|
|
187
|
+
if (!onClickCopy) {
|
|
188
|
+
_context.n = 2;
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
_context.n = 1;
|
|
192
|
+
return onClickCopy(event, currentValue);
|
|
193
|
+
case 1:
|
|
194
|
+
_context.n = 3;
|
|
195
|
+
break;
|
|
196
|
+
case 2:
|
|
197
|
+
_context.n = 3;
|
|
198
|
+
return navigator.clipboard.writeText(currentValue);
|
|
199
|
+
case 3:
|
|
200
|
+
announce(readOnlyCopyValidation, 'assertive');
|
|
201
|
+
setTip(readOnlyCopyValidation);
|
|
202
|
+
case 4:
|
|
203
|
+
return _context.a(2);
|
|
204
|
+
}
|
|
205
|
+
}, _callee);
|
|
206
|
+
}));
|
|
207
|
+
return function handleCopyClick(_x) {
|
|
208
|
+
return _ref2.apply(this, arguments);
|
|
209
|
+
};
|
|
210
|
+
}();
|
|
154
211
|
var onBlurCopy = function onBlurCopy() {
|
|
155
212
|
if (tip === readOnlyCopyValidation) setTip(readOnlyCopyPrompt);
|
|
156
213
|
};
|
|
214
|
+
var handleClearClick = function handleClearClick() {
|
|
215
|
+
// Set the value natively so React emits onChange for controlled,
|
|
216
|
+
// uncontrolled, and Form-managed inputs alike.
|
|
217
|
+
var nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value').set;
|
|
218
|
+
nativeInputValueSetter.call(inputRef.current, '');
|
|
219
|
+
inputRef.current.dispatchEvent(new Event('input', {
|
|
220
|
+
bubbles: true
|
|
221
|
+
}));
|
|
222
|
+
// the clear button hides once the value is empty
|
|
223
|
+
inputRef.current.focus();
|
|
224
|
+
};
|
|
157
225
|
var authoredType = typeProp || (password ? 'password' : undefined);
|
|
158
226
|
var passwordToggle = password && authoredType === 'password' && !readOnlyCopy;
|
|
159
227
|
(0, _react.useEffect)(function () {
|
|
160
228
|
// When the toggle stops applying, return the input to its authored type.
|
|
161
229
|
if (!passwordToggle) setPasswordRevealed(false);
|
|
162
230
|
}, [passwordToggle]);
|
|
231
|
+
|
|
232
|
+
// form reset changes the value without firing onChange
|
|
233
|
+
(0, _react.useEffect)(function () {
|
|
234
|
+
var _inputRef$current2;
|
|
235
|
+
var form = clear ? (_inputRef$current2 = inputRef.current) == null ? void 0 : _inputRef$current2.form : undefined;
|
|
236
|
+
if (!form) return undefined;
|
|
237
|
+
var timer;
|
|
238
|
+
var handleFormReset = function handleFormReset() {
|
|
239
|
+
// reset fires before the browser restores field values
|
|
240
|
+
timer = setTimeout(function () {
|
|
241
|
+
var _inputRef$current3;
|
|
242
|
+
return setUncontrolledHasValue(!!((_inputRef$current3 = inputRef.current) != null && _inputRef$current3.value));
|
|
243
|
+
});
|
|
244
|
+
};
|
|
245
|
+
form.addEventListener('reset', handleFormReset);
|
|
246
|
+
return function () {
|
|
247
|
+
clearTimeout(timer);
|
|
248
|
+
form.removeEventListener('reset', handleFormReset);
|
|
249
|
+
};
|
|
250
|
+
}, [clear, inputRef]);
|
|
163
251
|
var openDrop = (0, _react.useCallback)(function () {
|
|
164
252
|
setShowDrop(true);
|
|
165
253
|
announce(format({
|
|
@@ -216,15 +304,15 @@ var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
216
304
|
|
|
217
305
|
// activeSuggestionIndex unifies mouse and keyboard interaction of
|
|
218
306
|
// the suggestions
|
|
219
|
-
var
|
|
220
|
-
activeSuggestionIndex =
|
|
221
|
-
setActiveSuggestionIndex =
|
|
307
|
+
var _useState7 = (0, _react.useState)(resetSuggestionIndex),
|
|
308
|
+
activeSuggestionIndex = _useState7[0],
|
|
309
|
+
setActiveSuggestionIndex = _useState7[1];
|
|
222
310
|
|
|
223
311
|
// Only update active suggestion index when the mouse actually moves,
|
|
224
312
|
// not when suggestions are moving under the mouse.
|
|
225
|
-
var
|
|
226
|
-
mouseMovedSinceLastKey =
|
|
227
|
-
setMouseMovedSinceLastKey =
|
|
313
|
+
var _useState8 = (0, _react.useState)(),
|
|
314
|
+
mouseMovedSinceLastKey = _useState8[0],
|
|
315
|
+
setMouseMovedSinceLastKey = _useState8[1];
|
|
228
316
|
|
|
229
317
|
// set activeSuggestionIndex when value changes
|
|
230
318
|
(0, _react.useEffect)(function () {
|
|
@@ -267,7 +355,7 @@ var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
267
355
|
if (readOnly && inputRef != null && inputRef.current && inputRef.current.scrollLeft > 0) {
|
|
268
356
|
inputRef.current.scrollLeft = 0;
|
|
269
357
|
}
|
|
270
|
-
}, [readOnly, inputRef, inputRef == null || (_inputRef$
|
|
358
|
+
}, [readOnly, inputRef, inputRef == null || (_inputRef$current4 = inputRef.current) == null ? void 0 : _inputRef$current4.scrollLeft]);
|
|
271
359
|
var setValueFromSuggestion = function setValueFromSuggestion(event, suggestion) {
|
|
272
360
|
// if we stole the focus in the drop, perhaps by interacting with
|
|
273
361
|
// a suggestion button or the scrollbar, give it back
|
|
@@ -281,6 +369,9 @@ var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
281
369
|
handleSuggestionSelect(adjustedEvent);
|
|
282
370
|
}
|
|
283
371
|
setValue(suggestion);
|
|
372
|
+
if (clear) {
|
|
373
|
+
setUncontrolledHasValue(!isEmptyValue(suggestion));
|
|
374
|
+
}
|
|
284
375
|
};
|
|
285
376
|
var onNextSuggestion = (0, _react.useCallback)(function (event) {
|
|
286
377
|
event.preventDefault();
|
|
@@ -296,7 +387,7 @@ var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
296
387
|
}, [activeSuggestionIndex]);
|
|
297
388
|
|
|
298
389
|
// account for input value in both controlled and uncontrolled scenarios
|
|
299
|
-
var hasValue = value || ((_inputRef$
|
|
390
|
+
var hasValue = value || ((_inputRef$current5 = inputRef.current) == null ? void 0 : _inputRef$current5.value);
|
|
300
391
|
var showStyledPlaceholder = (0, _react.useMemo)(function () {
|
|
301
392
|
return placeholder && typeof placeholder !== 'string' && !hasValue;
|
|
302
393
|
}, [hasValue, placeholder]);
|
|
@@ -418,22 +509,36 @@ var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
418
509
|
var textInputIcon = (0, _utils.useSizedIcon)(icon, rest.size, theme);
|
|
419
510
|
var showPasswordIcon = (_theme$textInput = theme.textInput) == null || (_theme$textInput = _theme$textInput.icons) == null ? void 0 : _theme$textInput.showPassword;
|
|
420
511
|
var hidePasswordIcon = (_theme$textInput2 = theme.textInput) == null || (_theme$textInput2 = _theme$textInput2.icons) == null ? void 0 : _theme$textInput2.hidePassword;
|
|
512
|
+
var clearIcon = (_theme$textInput3 = theme.textInput) == null || (_theme$textInput3 = _theme$textInput3.icons) == null ? void 0 : _theme$textInput3.clear;
|
|
421
513
|
var inputType = authoredType;
|
|
422
514
|
if (passwordToggle) {
|
|
423
515
|
inputType = passwordRevealed ? 'text' : 'password';
|
|
424
516
|
}
|
|
425
517
|
var showTextInputIcon = !!textInputIcon && !readOnlyCopy;
|
|
426
|
-
var
|
|
427
|
-
|
|
428
|
-
var ReadOnlyCopyButton = /*#__PURE__*/_react["default"].createElement(_CopyButton.CopyButton, {
|
|
518
|
+
var copyButtonElement = /*#__PURE__*/_react["default"].createElement(_CopyButton.CopyButton, {
|
|
519
|
+
authoredType: authoredType,
|
|
429
520
|
disabled: disabled,
|
|
521
|
+
messages: messages,
|
|
430
522
|
onBlurCopy: onBlurCopy,
|
|
431
|
-
|
|
432
|
-
readOnlyCopyPrompt: readOnlyCopyPrompt,
|
|
523
|
+
onCopy: handleCopyClick,
|
|
433
524
|
tip: tip,
|
|
434
525
|
value: value
|
|
435
526
|
});
|
|
436
|
-
var
|
|
527
|
+
var clearable = clear && !readOnly;
|
|
528
|
+
var hasClearableValue = value !== undefined && value !== null ? value !== '' : uncontrolledHasValue;
|
|
529
|
+
var clearButton = clearable ? /*#__PURE__*/_react["default"].createElement(StyledInlineActionButton, _extends({
|
|
530
|
+
disabled: disabled,
|
|
531
|
+
kind: "toolbar",
|
|
532
|
+
icon: renderIcon(clearIcon, {
|
|
533
|
+
'aria-hidden': true
|
|
534
|
+
}),
|
|
535
|
+
onClick: handleClearClick,
|
|
536
|
+
"aria-label": clearMessage
|
|
537
|
+
// keep the slot while empty so the input width doesn't shift
|
|
538
|
+
,
|
|
539
|
+
$hidden: !hasClearableValue
|
|
540
|
+
}, passThemeFlag)) : undefined;
|
|
541
|
+
var passwordToggleButton = passwordToggle ? /*#__PURE__*/_react["default"].createElement(StyledInlineActionButton, _extends({
|
|
437
542
|
disabled: disabled,
|
|
438
543
|
kind: "toolbar",
|
|
439
544
|
icon: passwordRevealed ? renderIcon(hidePasswordIcon, {
|
|
@@ -447,10 +552,21 @@ var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
447
552
|
});
|
|
448
553
|
},
|
|
449
554
|
"aria-label": passwordRevealed ? hidePasswordMessage : showPasswordMessage
|
|
450
|
-
}) : undefined;
|
|
451
|
-
var
|
|
555
|
+
}, passThemeFlag)) : undefined;
|
|
556
|
+
var copyButton = readOnlyCopy || copy ? copyButtonElement : undefined;
|
|
557
|
+
// Order: clear sits next to the text, then password visibility, then the
|
|
558
|
+
// non-destructive copy action.
|
|
559
|
+
var actionsGroup = clearButton || passwordToggleButton || copyButton ? /*#__PURE__*/_react["default"].createElement(_StyledTextInput.StyledActionsGroup, passThemeFlag, clearButton, passwordToggleButton, copyButton) : undefined;
|
|
560
|
+
var hasActionsGroup = !!actionsGroup;
|
|
561
|
+
var iconOnRight = reverse;
|
|
562
|
+
var showLeadingIcon = showTextInputIcon && !iconOnRight;
|
|
563
|
+
var showTrailingIcon = showTextInputIcon && iconOnRight;
|
|
452
564
|
return /*#__PURE__*/_react["default"].createElement(_StyledTextInput.StyledTextInputContainer, _extends({
|
|
453
|
-
|
|
565
|
+
$inputDisabled: disabled,
|
|
566
|
+
hasButton: !!actionsGroup,
|
|
567
|
+
icon: showTextInputIcon && !hasActionsGroup ? icon : undefined,
|
|
568
|
+
reverse: iconOnRight,
|
|
569
|
+
size: rest.size,
|
|
454
570
|
readOnlyProp: readOnly // readOnlyProp to avoid passing to DOM
|
|
455
571
|
,
|
|
456
572
|
readOnlyCopy: readOnlyCopy,
|
|
@@ -460,12 +576,14 @@ var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
460
576
|
onMouseMove: function onMouseMove() {
|
|
461
577
|
return setMouseMovedSinceLastKey(true);
|
|
462
578
|
}
|
|
463
|
-
}, passThemeFlag),
|
|
464
|
-
reverse:
|
|
579
|
+
}, passThemeFlag), showStyledPlaceholder && /*#__PURE__*/_react["default"].createElement(_StyledTextInput.StyledPlaceholder, passThemeFlag, placeholder), showLeadingIcon && /*#__PURE__*/_react["default"].createElement(_StyledTextInput.StyledIcon, {
|
|
580
|
+
reverse: iconOnRight,
|
|
581
|
+
hasActionsGroup: hasActionsGroup,
|
|
465
582
|
theme: theme
|
|
466
583
|
}, textInputIcon), /*#__PURE__*/_react["default"].createElement(_Keyboard.Keyboard, _extends({
|
|
467
584
|
target: focus ? 'document' : undefined
|
|
468
585
|
}, keyboardProps), /*#__PURE__*/_react["default"].createElement(_StyledTextInput.StyledTextInput, _extends({
|
|
586
|
+
$inputInner: readOnly || hasActionsGroup,
|
|
469
587
|
"aria-label": a11yTitle,
|
|
470
588
|
ref: inputRef,
|
|
471
589
|
id: id,
|
|
@@ -474,11 +592,13 @@ var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
474
592
|
disabled: disabled,
|
|
475
593
|
plain: plain,
|
|
476
594
|
placeholder: typeof placeholder === 'string' ? placeholder : undefined,
|
|
477
|
-
icon: showTextInputIcon ? icon : undefined,
|
|
478
|
-
reverse:
|
|
595
|
+
icon: showTextInputIcon && !hasActionsGroup ? icon : undefined,
|
|
596
|
+
reverse: iconOnRight,
|
|
479
597
|
focus: focus,
|
|
480
|
-
hasButton:
|
|
481
|
-
|
|
598
|
+
hasButton: hasActionsGroup,
|
|
599
|
+
hasActionsGroup: hasActionsGroup,
|
|
600
|
+
hasClear: clearable,
|
|
601
|
+
hasLeadingIcon: showLeadingIcon,
|
|
482
602
|
hasTrailingIcon: showTrailingIcon,
|
|
483
603
|
focusIndicator: focusIndicator,
|
|
484
604
|
textAlign: textAlign,
|
|
@@ -524,13 +644,17 @@ var TextInput = exports.TextInput = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
524
644
|
openDrop();
|
|
525
645
|
}
|
|
526
646
|
setValue(event.target.value);
|
|
647
|
+
if (clear) {
|
|
648
|
+
setUncontrolledHasValue(!!event.target.value);
|
|
649
|
+
}
|
|
527
650
|
setActiveSuggestionIndex(resetSuggestionIndex);
|
|
528
651
|
if (onChange) onChange(event);
|
|
529
652
|
}
|
|
530
|
-
}))),
|
|
531
|
-
reverse:
|
|
653
|
+
}))), actionsGroup, showTrailingIcon && /*#__PURE__*/_react["default"].createElement(_StyledTextInput.StyledIcon, {
|
|
654
|
+
reverse: iconOnRight,
|
|
655
|
+
hasActionsGroup: hasActionsGroup,
|
|
532
656
|
theme: theme
|
|
533
|
-
}, textInputIcon), !
|
|
657
|
+
}, textInputIcon), !readOnly && drop);
|
|
534
658
|
});
|
|
535
659
|
TextInput.displayName = 'TextInput';
|
|
536
660
|
TextInput.propTypes = _propTypes.TextInputPropTypes;
|
|
@@ -13,6 +13,9 @@ export interface TextInputProps
|
|
|
13
13
|
'onSelect' | 'size' | 'placeholder' | 'width'
|
|
14
14
|
> {
|
|
15
15
|
a11yTitle?: A11yTitleType;
|
|
16
|
+
clear?: boolean;
|
|
17
|
+
copy?: boolean;
|
|
18
|
+
defaultSuggestion?: number;
|
|
16
19
|
dropAlign?: {
|
|
17
20
|
top?: 'top' | 'bottom';
|
|
18
21
|
bottom?: 'top' | 'bottom';
|
|
@@ -20,13 +23,13 @@ export interface TextInputProps
|
|
|
20
23
|
left?: 'left' | 'right';
|
|
21
24
|
};
|
|
22
25
|
dropHeight?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | string;
|
|
23
|
-
dropTarget?: object;
|
|
24
26
|
dropProps?: DropType;
|
|
27
|
+
dropTarget?: object;
|
|
25
28
|
focusIndicator?: boolean;
|
|
26
|
-
defaultSuggestion?: number;
|
|
27
29
|
icon?: React.ReactNode;
|
|
28
30
|
id?: string;
|
|
29
31
|
messages?: {
|
|
32
|
+
clear?: string;
|
|
30
33
|
enterSelect?: string;
|
|
31
34
|
hidePassword?: string;
|
|
32
35
|
showPassword?: string;
|
|
@@ -35,6 +38,14 @@ export interface TextInputProps
|
|
|
35
38
|
suggestionIsOpen?: string;
|
|
36
39
|
};
|
|
37
40
|
name?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Called when the copy button is activated. The value is unmasked; do not
|
|
43
|
+
* log, persist, or transmit it unless explicitly required.
|
|
44
|
+
*/
|
|
45
|
+
onClickCopy?: (
|
|
46
|
+
event: React.MouseEvent<HTMLButtonElement>,
|
|
47
|
+
value: string,
|
|
48
|
+
) => void | Promise<void>;
|
|
38
49
|
onSelect?: (x: {
|
|
39
50
|
target: React.RefObject<HTMLElement | null>['current'];
|
|
40
51
|
suggestion: any;
|
|
@@ -43,8 +54,8 @@ export interface TextInputProps
|
|
|
43
54
|
target: React.RefObject<HTMLElement | null>['current'];
|
|
44
55
|
suggestion: any;
|
|
45
56
|
}) => void;
|
|
46
|
-
onSuggestionsOpen?: () => void;
|
|
47
57
|
onSuggestionsClose?: () => void;
|
|
58
|
+
onSuggestionsOpen?: () => void;
|
|
48
59
|
password?: boolean;
|
|
49
60
|
placeholder?: string | React.ReactNode;
|
|
50
61
|
plain?: boolean | 'full';
|
|
@@ -12,6 +12,7 @@ var PropType = {};
|
|
|
12
12
|
if (process.env.NODE_ENV !== 'production') {
|
|
13
13
|
PropType = {
|
|
14
14
|
a11yTitle: _propTypes["default"].string,
|
|
15
|
+
clear: _propTypes["default"].bool,
|
|
15
16
|
defaultSuggestion: _propTypes["default"].number,
|
|
16
17
|
dropAlign: _propTypes["default"].shape({
|
|
17
18
|
top: _propTypes["default"].oneOf(['top', 'bottom']),
|
|
@@ -26,6 +27,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
26
27
|
id: _propTypes["default"].string,
|
|
27
28
|
focusIndicator: _propTypes["default"].bool,
|
|
28
29
|
messages: _propTypes["default"].shape({
|
|
30
|
+
clear: _propTypes["default"].string,
|
|
29
31
|
enterSelect: _propTypes["default"].string,
|
|
30
32
|
hidePassword: _propTypes["default"].string,
|
|
31
33
|
showPassword: _propTypes["default"].string,
|
|
@@ -35,6 +37,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
35
37
|
}),
|
|
36
38
|
name: _propTypes["default"].string,
|
|
37
39
|
onChange: _propTypes["default"].func,
|
|
40
|
+
onClickCopy: _propTypes["default"].func,
|
|
38
41
|
onSelect: _propTypes["default"].func,
|
|
39
42
|
onSuggestionSelect: _propTypes["default"].func,
|
|
40
43
|
onSuggestionsOpen: _propTypes["default"].func,
|
|
@@ -42,6 +45,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
42
45
|
password: _propTypes["default"].bool,
|
|
43
46
|
placeholder: _propTypes["default"].node,
|
|
44
47
|
plain: _propTypes["default"].oneOfType([_propTypes["default"].bool, _propTypes["default"].oneOf(['full'])]),
|
|
48
|
+
copy: _propTypes["default"].bool,
|
|
45
49
|
readOnlyCopy: _propTypes["default"].bool,
|
|
46
50
|
reverse: _propTypes["default"].bool,
|
|
47
51
|
size: _propTypes["default"].oneOfType([_propTypes["default"].oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge', 'xxlarge', '2xl', '3xl', '4xl', '5xl', '6xl']), _propTypes["default"].string]),
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
import { Search } from 'grommet-icons';
|
|
7
|
+
import { Box, TextInput } from 'grommet';
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof TextInput> = {
|
|
10
|
+
title: 'Input/TextInput/Clear',
|
|
11
|
+
component: TextInput,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof TextInput>;
|
|
16
|
+
|
|
17
|
+
const ClearExample = () => {
|
|
18
|
+
const [value, setValue] = React.useState<string>('Clearable value');
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
22
|
+
// <Grommet theme={...}>
|
|
23
|
+
<Box fill align="center" justify="start" pad="large" gap="medium">
|
|
24
|
+
<Box width="medium" gap="small">
|
|
25
|
+
<TextInput
|
|
26
|
+
value={value}
|
|
27
|
+
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
|
|
28
|
+
setValue(event.target.value)
|
|
29
|
+
}
|
|
30
|
+
clear
|
|
31
|
+
aria-label="Controlled value"
|
|
32
|
+
/>
|
|
33
|
+
<TextInput
|
|
34
|
+
defaultValue="Uncontrolled value"
|
|
35
|
+
clear
|
|
36
|
+
aria-label="Uncontrolled value"
|
|
37
|
+
/>
|
|
38
|
+
<TextInput
|
|
39
|
+
icon={<Search />}
|
|
40
|
+
placeholder="Search"
|
|
41
|
+
clear
|
|
42
|
+
aria-label="Search"
|
|
43
|
+
/>
|
|
44
|
+
<TextInput
|
|
45
|
+
icon={<Search />}
|
|
46
|
+
reverse
|
|
47
|
+
placeholder="Search"
|
|
48
|
+
clear
|
|
49
|
+
aria-label="Search"
|
|
50
|
+
/>
|
|
51
|
+
<TextInput
|
|
52
|
+
icon={<Search />}
|
|
53
|
+
reverse
|
|
54
|
+
password
|
|
55
|
+
clear
|
|
56
|
+
copy
|
|
57
|
+
placeholder="Search"
|
|
58
|
+
aria-label="Search"
|
|
59
|
+
/>
|
|
60
|
+
</Box>
|
|
61
|
+
</Box>
|
|
62
|
+
// </Grommet>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const Clear: Story = {
|
|
67
|
+
render: () => <ClearExample />,
|
|
68
|
+
};
|