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,13 +1,14 @@
|
|
|
1
1
|
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); }
|
|
2
2
|
// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import React from 'react';
|
|
4
|
+
import React, { useContext } from 'react';
|
|
5
5
|
import styled from 'styled-components';
|
|
6
6
|
import { Copy } from 'grommet-icons/icons/Copy';
|
|
7
7
|
import { Button } from '../Button';
|
|
8
8
|
import { Tip } from '../Tip';
|
|
9
9
|
import { edgeStyle } from '../../utils/styles';
|
|
10
10
|
import { useThemeValue } from '../../utils/useThemeValue';
|
|
11
|
+
import { MessageContext } from '../../contexts/MessageContext';
|
|
11
12
|
|
|
12
13
|
// to overcome `plain` styling due to (icon && !label) condition
|
|
13
14
|
// in buttons without theme.button.default, apply the padding here
|
|
@@ -21,16 +22,31 @@ var StyledButton = styled(Button).withConfig({
|
|
|
21
22
|
});
|
|
22
23
|
export var CopyButton = function CopyButton(_ref) {
|
|
23
24
|
var _theme$textInput, _theme$global$input$p, _theme$global$input$p2, _theme$global$input$p3;
|
|
24
|
-
var
|
|
25
|
-
|
|
25
|
+
var ariaLabel = _ref.ariaLabel,
|
|
26
|
+
authoredType = _ref.authoredType,
|
|
27
|
+
disabled = _ref.disabled,
|
|
28
|
+
messages = _ref.messages,
|
|
29
|
+
onCopy = _ref.onCopy,
|
|
26
30
|
onBlurCopy = _ref.onBlurCopy,
|
|
27
|
-
readOnlyCopyPrompt = _ref.readOnlyCopyPrompt,
|
|
28
31
|
tip = _ref.tip,
|
|
29
32
|
value = _ref.value;
|
|
30
33
|
var _useThemeValue = useThemeValue(),
|
|
31
34
|
theme = _useThemeValue.theme,
|
|
32
35
|
passThemeFlag = _useThemeValue.passThemeFlag;
|
|
36
|
+
var _useContext = useContext(MessageContext),
|
|
37
|
+
format = _useContext.format;
|
|
33
38
|
var CopyIcon = ((_theme$textInput = theme.textInput) == null || (_theme$textInput = _theme$textInput.icons) == null ? void 0 : _theme$textInput.copy) || Copy;
|
|
39
|
+
// never expose the masked value via the accessible name
|
|
40
|
+
var buttonAriaLabel = ariaLabel || ((authoredType == null ? void 0 : authoredType.toLowerCase()) !== 'password' && (value || value === 0) ? format({
|
|
41
|
+
id: 'input.readOnlyCopy.promptWithValue',
|
|
42
|
+
messages: messages,
|
|
43
|
+
values: {
|
|
44
|
+
value: value
|
|
45
|
+
}
|
|
46
|
+
}) : format({
|
|
47
|
+
id: 'input.readOnlyCopy.prompt',
|
|
48
|
+
messages: messages
|
|
49
|
+
}));
|
|
34
50
|
return /*#__PURE__*/React.createElement(Tip, {
|
|
35
51
|
dropProps: {
|
|
36
52
|
align: {
|
|
@@ -40,7 +56,7 @@ export var CopyButton = function CopyButton(_ref) {
|
|
|
40
56
|
content: tip
|
|
41
57
|
}, /*#__PURE__*/React.createElement(StyledButton, _extends({
|
|
42
58
|
disabled: disabled,
|
|
43
|
-
onClick:
|
|
59
|
+
onClick: onCopy,
|
|
44
60
|
icon: /*#__PURE__*/React.createElement(CopyIcon, null),
|
|
45
61
|
pad: {
|
|
46
62
|
horizontal: (_theme$global$input$p = theme.global.input.padding) == null ? void 0 : _theme$global$input$p.horizontal,
|
|
@@ -53,6 +69,6 @@ export var CopyButton = function CopyButton(_ref) {
|
|
|
53
69
|
},
|
|
54
70
|
onBlur: onBlurCopy,
|
|
55
71
|
onMouseOut: onBlurCopy,
|
|
56
|
-
"aria-label":
|
|
72
|
+
"aria-label": buttonAriaLabel
|
|
57
73
|
}, passThemeFlag)));
|
|
58
74
|
};
|
|
@@ -1,2 +1,30 @@
|
|
|
1
1
|
## TextInput
|
|
2
|
-
Documentation for this component: https://v2.grommet.io/textinput
|
|
2
|
+
Documentation for this component: https://v2.grommet.io/textinput
|
|
3
|
+
|
|
4
|
+
### Shared Input Appearance
|
|
5
|
+
|
|
6
|
+
`global.input` accepts the `BoxPartThemeType` properties `background`, `border`,
|
|
7
|
+
`elevation`, `height`, `margin`, `pad`, `round`, and `width`. Its `hover`, `focus`,
|
|
8
|
+
`disabled`, and `readOnly` parts accept `BoxStateThemeType`: `background`,
|
|
9
|
+
`border`, `elevation`, `pad`, and `round`. `placeholder` accepts text `color`,
|
|
10
|
+
`size`, and `weight`. Validation error styling remains owned by FormField.
|
|
11
|
+
|
|
12
|
+
These opt-in defaults are shared by TextInput, TextArea, and MaskedInput. The
|
|
13
|
+
visible surfaces of Select, SelectMultiple, formatted DateInput, and FileInput
|
|
14
|
+
also consume them. Wrapper-owned controls apply the border and fill once;
|
|
15
|
+
TextInput and formatted DateInput keep text padding on the inner input.
|
|
16
|
+
Render-function values and component-specific extension CSS retain their own
|
|
17
|
+
styling responsibilities.
|
|
18
|
+
|
|
19
|
+
Plain inputs, including those made plain by FormField, do not paint the shared
|
|
20
|
+
background, border, elevation, or interactive surface states. Their spacing
|
|
21
|
+
continues to follow the input padding configuration. Style the FormField
|
|
22
|
+
wrapper through `formField` and its per-input parts instead.
|
|
23
|
+
|
|
24
|
+
`pad` takes precedence over legacy `padding` and uses Box spacing values without
|
|
25
|
+
legacy border subtraction. Existing `padding`, `font`, `weight`, and `extend`
|
|
26
|
+
behavior is retained. Partial border-state objects inherit normal border fields.
|
|
27
|
+
Disabled controls suppress hover/focus appearance states; read-only controls
|
|
28
|
+
suppress interactive appearance states. Existing global focus indicators remain
|
|
29
|
+
in place. Global input extension CSS runs after the new native input defaults;
|
|
30
|
+
component-specific extension hooks remain later overrides.
|
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import { controlBorderStyle, disabledStyle, getInputPadBySide, inputStyle, parseMetricToNum, plainInputStyle, textAlignStyle, widthStyle, styledComponentsConfig } from '../../utils';
|
|
5
|
-
import {
|
|
4
|
+
import { controlBorderStyle, disabledStyle, getInputPadBySide, inputAppearanceStyle, inputStyle, parseMetricToNum, plainInputStyle, textAlignStyle, widthStyle, styledComponentsConfig } from '../../utils';
|
|
5
|
+
import { inputPadForIcon } from '../../utils/styles';
|
|
6
6
|
import { readOnlyStyle } from '../../utils/readOnly';
|
|
7
|
-
var getInlineButtonPad = function getInlineButtonPad(props) {
|
|
8
|
-
var rightInset = Number.parseFloat(getInputPadBySide(props, 'right'));
|
|
9
|
-
var iconPad = Number.parseFloat(getInputIconPad(props));
|
|
10
|
-
var trailingIconPad = props.hasTrailingIcon ? iconPad : 0;
|
|
11
|
-
// Reserve both the icon space and the control's edge inset so text clears
|
|
12
|
-
// the flush-right password toggle, and the reversed icon when both coexist.
|
|
13
|
-
return iconPad + trailingIconPad + rightInset + "px";
|
|
14
|
-
};
|
|
15
7
|
var getPlainStyle = function getPlainStyle(plain) {
|
|
16
8
|
if (plain === 'full') {
|
|
17
|
-
return css(["", "
|
|
9
|
+
return css(["", ";padding:0;"], plainInputStyle);
|
|
18
10
|
}
|
|
19
11
|
return plain && plainInputStyle;
|
|
20
12
|
};
|
|
@@ -26,15 +18,21 @@ var StyledTextInput = styled.input.withConfig(styledComponentsConfig).withConfig
|
|
|
26
18
|
}, function (props) {
|
|
27
19
|
return (props.hasButton || props.readOnlyCopy) && 'min-width: 0;';
|
|
28
20
|
}, function (props) {
|
|
29
|
-
return props.
|
|
30
|
-
}, function (props) {
|
|
31
|
-
return props.readOnly && "border: none;";
|
|
21
|
+
return (props.readOnly || props.hasButton) && "border: none;";
|
|
32
22
|
}, function (props) {
|
|
33
23
|
return getPlainStyle(props.plain);
|
|
34
24
|
}, function (props) {
|
|
35
|
-
return props.icon && inputPadForIcon;
|
|
25
|
+
return props.icon && !props.hasActionsGroup && inputPadForIcon;
|
|
26
|
+
}, function (props) {
|
|
27
|
+
return (
|
|
28
|
+
// the static leading icon already pads its right side
|
|
29
|
+
props.hasLeadingIcon && props.hasActionsGroup && 'padding-left: 0px;'
|
|
30
|
+
);
|
|
36
31
|
}, function (props) {
|
|
37
|
-
return
|
|
32
|
+
return (
|
|
33
|
+
// avoid a second, native clear button on type="search" in WebKit/Blink
|
|
34
|
+
props.hasClear && "&::-webkit-search-cancel-button {\n -webkit-appearance: none;\n appearance: none;\n }"
|
|
35
|
+
);
|
|
38
36
|
}, function (props) {
|
|
39
37
|
return props.disabled && disabledStyle(props.theme.textInput.disabled && props.theme.textInput.disabled.opacity);
|
|
40
38
|
}, function (props) {
|
|
@@ -50,13 +48,23 @@ var StyledTextInputContainer = styled.div.withConfig(styledComponentsConfig).wit
|
|
|
50
48
|
})(["position:relative;width:100%;", " ", ";", ";", " ", ";"], function (props) {
|
|
51
49
|
return props.widthProp && props.readOnlyProp && widthStyle(props.widthProp, props.theme);
|
|
52
50
|
}, function (props) {
|
|
53
|
-
return
|
|
51
|
+
return (
|
|
52
|
+
// The container owns the border so the actions group remains inside
|
|
53
|
+
// the field.
|
|
54
|
+
(props.readOnlyProp || props.hasButton) && !props.plain && controlBorderStyle
|
|
55
|
+
);
|
|
54
56
|
}, function (props) {
|
|
55
57
|
return (props.readOnlyCopy || props.hasButton) && "\n box-sizing: border-box;\n flex-direction: row;\n display: flex;\n align-items: stretch;\n ";
|
|
56
58
|
}, function (props) {
|
|
57
59
|
return props.readOnlyProp && !props.plain && readOnlyStyle(props.theme);
|
|
58
60
|
}, function (props) {
|
|
59
|
-
|
|
61
|
+
var _props$theme$textInpu;
|
|
62
|
+
var appearance = (props.readOnlyProp || props.hasButton) && inputAppearanceStyle(props, {
|
|
63
|
+
wrapper: true,
|
|
64
|
+
skipPadding: true
|
|
65
|
+
});
|
|
66
|
+
var extend = (_props$theme$textInpu = props.theme.textInput) == null || (_props$theme$textInpu = _props$theme$textInpu.container) == null ? void 0 : _props$theme$textInpu.extend;
|
|
67
|
+
return appearance ? css(["", "", ""], appearance, extend) : extend;
|
|
60
68
|
});
|
|
61
69
|
var StyledPlaceholder = styled.div.withConfig(styledComponentsConfig).withConfig({
|
|
62
70
|
displayName: "StyledTextInput__StyledPlaceholder",
|
|
@@ -70,20 +78,19 @@ var StyledIcon = styled.div.withConfig(styledComponentsConfig).withConfig({
|
|
|
70
78
|
displayName: "StyledTextInput__StyledIcon",
|
|
71
79
|
componentId: "sc-1x30a0s-3"
|
|
72
80
|
})(["position:absolute;display:flex;justify:center;top:50%;transform:translateY(-50%);pointer-events:none;", ""], function (props) {
|
|
81
|
+
if (props.hasActionsGroup) {
|
|
82
|
+
return "\n position: static;\n align-items: center;\n transform: none;\n padding-left: " + getInputPadBySide(props, 'left') + ";\n padding-right: " + getInputPadBySide(props, 'right') + ";\n ";
|
|
83
|
+
}
|
|
73
84
|
return props.reverse ? "right: " + getInputPadBySide(props, 'right') + ";" : "left: " + getInputPadBySide(props, 'left') + ";";
|
|
74
85
|
});
|
|
75
|
-
var
|
|
76
|
-
displayName: "
|
|
86
|
+
var StyledActionsGroup = styled.div.withConfig(styledComponentsConfig).withConfig({
|
|
87
|
+
displayName: "StyledTextInput__StyledActionsGroup",
|
|
77
88
|
componentId: "sc-1x30a0s-4"
|
|
78
|
-
})(["
|
|
79
|
-
var StyledInlineIcon = styled.div.withConfig(styledComponentsConfig).withConfig({
|
|
80
|
-
displayName: "StyledTextInput__StyledInlineIcon",
|
|
81
|
-
componentId: "sc-1x30a0s-5"
|
|
82
|
-
})(["display:flex;align-items:center;justify-content:center;pointer-events:none;"]);
|
|
89
|
+
})(["display:flex;align-items:stretch;z-index:1;"]);
|
|
83
90
|
var StyledSuggestions = styled.ol.withConfig(styledComponentsConfig).withConfig({
|
|
84
91
|
displayName: "StyledTextInput__StyledSuggestions",
|
|
85
|
-
componentId: "sc-1x30a0s-
|
|
92
|
+
componentId: "sc-1x30a0s-5"
|
|
86
93
|
})(["border-top-left-radius:0;border-top-right-radius:0;margin:0;padding:0;list-style-type:none;", ";"], function (props) {
|
|
87
94
|
return props.theme.textInput && props.theme.textInput.suggestions && props.theme.textInput.suggestions.extend;
|
|
88
95
|
});
|
|
89
|
-
export { StyledTextInput, StyledTextInputContainer, StyledPlaceholder, StyledIcon,
|
|
96
|
+
export { StyledTextInput, StyledTextInputContainer, StyledPlaceholder, StyledIcon, StyledActionsGroup, StyledSuggestions };
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
var _excluded = ["a11yTitle", "defaultSuggestion", "defaultValue", "disabled", "dropAlign", "dropHeight", "
|
|
1
|
+
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"];
|
|
2
2
|
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); }
|
|
3
|
+
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 }; })(); }
|
|
4
|
+
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); }
|
|
5
|
+
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); }
|
|
6
|
+
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); }); }; }
|
|
3
7
|
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; }
|
|
4
8
|
// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
5
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
@@ -13,7 +17,7 @@ import { Keyboard } from '../Keyboard';
|
|
|
13
17
|
import { FormContext } from '../Form/FormContext';
|
|
14
18
|
import { AnnounceContext } from '../../contexts';
|
|
15
19
|
import { isNodeAfterScroll, isNodeBeforeScroll, sizeStyle, useForwardedRef, useSizedIcon } from '../../utils';
|
|
16
|
-
import { StyledTextInput, StyledTextInputContainer, StyledPlaceholder, StyledIcon,
|
|
20
|
+
import { StyledTextInput, StyledTextInputContainer, StyledPlaceholder, StyledIcon, StyledActionsGroup, StyledSuggestions } from './StyledTextInput';
|
|
17
21
|
import { MessageContext } from '../../contexts/MessageContext';
|
|
18
22
|
import { TextInputPropTypes } from './propTypes';
|
|
19
23
|
import { CopyButton } from './CopyButton';
|
|
@@ -44,21 +48,32 @@ var ContainerBox = styled(Box).withConfig({
|
|
|
44
48
|
})(["", ";@media screen and (-ms-high-contrast:active),(-ms-high-contrast:none){width:100%;}"], function (props) {
|
|
45
49
|
return props.dropHeight ? sizeStyle('max-height', props.dropHeight, props.theme) : 'max-height: inherit;';
|
|
46
50
|
});
|
|
51
|
+
var StyledInlineActionButton = styled(Button).withConfig({
|
|
52
|
+
displayName: "TextInput__StyledInlineActionButton",
|
|
53
|
+
componentId: "sc-1ai0c08-1"
|
|
54
|
+
})(["padding-top:0;padding-bottom:0;", ""], function (props) {
|
|
55
|
+
return props.$hidden && 'visibility: hidden;';
|
|
56
|
+
});
|
|
57
|
+
var isEmptyValue = function isEmptyValue(value) {
|
|
58
|
+
return value === undefined || value === null || value === '';
|
|
59
|
+
};
|
|
47
60
|
var defaultDropAlign = {
|
|
48
61
|
top: 'bottom',
|
|
49
62
|
left: 'left'
|
|
50
63
|
};
|
|
51
64
|
var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
52
|
-
var _inputRef$
|
|
65
|
+
var _inputRef$current4, _inputRef$current5, _theme$textInput, _theme$textInput2, _theme$textInput3;
|
|
53
66
|
var a11yTitle = _ref.a11yTitle,
|
|
67
|
+
clear = _ref.clear,
|
|
68
|
+
copy = _ref.copy,
|
|
54
69
|
defaultSuggestion = _ref.defaultSuggestion,
|
|
55
70
|
defaultValue = _ref.defaultValue,
|
|
56
71
|
disabled = _ref.disabled,
|
|
57
72
|
_ref$dropAlign = _ref.dropAlign,
|
|
58
73
|
dropAlign = _ref$dropAlign === void 0 ? defaultDropAlign : _ref$dropAlign,
|
|
59
74
|
dropHeight = _ref.dropHeight,
|
|
60
|
-
dropTarget = _ref.dropTarget,
|
|
61
75
|
dropProps = _ref.dropProps,
|
|
76
|
+
dropTarget = _ref.dropTarget,
|
|
62
77
|
_ref$focusIndicator = _ref.focusIndicator,
|
|
63
78
|
focusIndicator = _ref$focusIndicator === void 0 ? true : _ref$focusIndicator,
|
|
64
79
|
icon = _ref.icon,
|
|
@@ -67,6 +82,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
67
82
|
name = _ref.name,
|
|
68
83
|
_onBlur = _ref.onBlur,
|
|
69
84
|
onChange = _ref.onChange,
|
|
85
|
+
onClickCopy = _ref.onClickCopy,
|
|
70
86
|
_onFocus = _ref.onFocus,
|
|
71
87
|
onKeyDown = _ref.onKeyDown,
|
|
72
88
|
onSelect = _ref.onSelect,
|
|
@@ -113,15 +129,22 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
113
129
|
var _useState3 = useState(false),
|
|
114
130
|
passwordRevealed = _useState3[0],
|
|
115
131
|
setPasswordRevealed = _useState3[1];
|
|
132
|
+
// uncontrolled inputs outside a Form don't re-render on change, so track
|
|
133
|
+
// emptiness here to toggle the clear button
|
|
134
|
+
var _useState4 = useState(function () {
|
|
135
|
+
return !isEmptyValue(defaultValue);
|
|
136
|
+
}),
|
|
137
|
+
uncontrolledHasValue = _useState4[0],
|
|
138
|
+
setUncontrolledHasValue = _useState4[1];
|
|
116
139
|
var handleSuggestionSelect = useMemo(function () {
|
|
117
140
|
return onSelect && !onSuggestionSelect ? onSelect : onSuggestionSelect;
|
|
118
141
|
}, [onSelect, onSuggestionSelect]);
|
|
119
142
|
var handleTextSelect = useMemo(function () {
|
|
120
143
|
return onSelect && onSuggestionSelect ? onSelect : undefined;
|
|
121
144
|
}, [onSelect, onSuggestionSelect]);
|
|
122
|
-
var
|
|
123
|
-
suggestionsAtClose =
|
|
124
|
-
setSuggestionsAtClose =
|
|
145
|
+
var _useState5 = useState(),
|
|
146
|
+
suggestionsAtClose = _useState5[0],
|
|
147
|
+
setSuggestionsAtClose = _useState5[1];
|
|
125
148
|
var readOnlyCopyValidation = format({
|
|
126
149
|
id: 'input.readOnlyCopy.validation',
|
|
127
150
|
messages: messages
|
|
@@ -130,9 +153,9 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
130
153
|
id: 'input.readOnlyCopy.prompt',
|
|
131
154
|
messages: messages
|
|
132
155
|
});
|
|
133
|
-
var
|
|
134
|
-
tip =
|
|
135
|
-
setTip =
|
|
156
|
+
var _useState6 = useState(readOnlyCopyPrompt),
|
|
157
|
+
tip = _useState6[0],
|
|
158
|
+
setTip = _useState6[1];
|
|
136
159
|
var showPasswordMessage = format({
|
|
137
160
|
id: 'textInput.showPassword',
|
|
138
161
|
messages: messages
|
|
@@ -141,20 +164,84 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
141
164
|
id: 'textInput.hidePassword',
|
|
142
165
|
messages: messages
|
|
143
166
|
});
|
|
144
|
-
var
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
167
|
+
var clearMessage = format({
|
|
168
|
+
id: 'textInput.clear',
|
|
169
|
+
messages: messages
|
|
170
|
+
});
|
|
171
|
+
var handleCopyClick = /*#__PURE__*/function () {
|
|
172
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(event) {
|
|
173
|
+
var _ref3, _inputRef$current$val, _inputRef$current;
|
|
174
|
+
var currentValue;
|
|
175
|
+
return _regenerator().w(function (_context) {
|
|
176
|
+
while (1) switch (_context.n) {
|
|
177
|
+
case 0:
|
|
178
|
+
// uncontrolled inputs keep their current text on the DOM node, not
|
|
179
|
+
// in `value`, which stays undefined outside a Form
|
|
180
|
+
currentValue = (_ref3 = (_inputRef$current$val = (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.value) != null ? _inputRef$current$val : value) != null ? _ref3 : '';
|
|
181
|
+
if (!onClickCopy) {
|
|
182
|
+
_context.n = 2;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
_context.n = 1;
|
|
186
|
+
return onClickCopy(event, currentValue);
|
|
187
|
+
case 1:
|
|
188
|
+
_context.n = 3;
|
|
189
|
+
break;
|
|
190
|
+
case 2:
|
|
191
|
+
_context.n = 3;
|
|
192
|
+
return navigator.clipboard.writeText(currentValue);
|
|
193
|
+
case 3:
|
|
194
|
+
announce(readOnlyCopyValidation, 'assertive');
|
|
195
|
+
setTip(readOnlyCopyValidation);
|
|
196
|
+
case 4:
|
|
197
|
+
return _context.a(2);
|
|
198
|
+
}
|
|
199
|
+
}, _callee);
|
|
200
|
+
}));
|
|
201
|
+
return function handleCopyClick(_x) {
|
|
202
|
+
return _ref2.apply(this, arguments);
|
|
203
|
+
};
|
|
204
|
+
}();
|
|
149
205
|
var onBlurCopy = function onBlurCopy() {
|
|
150
206
|
if (tip === readOnlyCopyValidation) setTip(readOnlyCopyPrompt);
|
|
151
207
|
};
|
|
208
|
+
var handleClearClick = function handleClearClick() {
|
|
209
|
+
// Set the value natively so React emits onChange for controlled,
|
|
210
|
+
// uncontrolled, and Form-managed inputs alike.
|
|
211
|
+
var nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value').set;
|
|
212
|
+
nativeInputValueSetter.call(inputRef.current, '');
|
|
213
|
+
inputRef.current.dispatchEvent(new Event('input', {
|
|
214
|
+
bubbles: true
|
|
215
|
+
}));
|
|
216
|
+
// the clear button hides once the value is empty
|
|
217
|
+
inputRef.current.focus();
|
|
218
|
+
};
|
|
152
219
|
var authoredType = typeProp || (password ? 'password' : undefined);
|
|
153
220
|
var passwordToggle = password && authoredType === 'password' && !readOnlyCopy;
|
|
154
221
|
useEffect(function () {
|
|
155
222
|
// When the toggle stops applying, return the input to its authored type.
|
|
156
223
|
if (!passwordToggle) setPasswordRevealed(false);
|
|
157
224
|
}, [passwordToggle]);
|
|
225
|
+
|
|
226
|
+
// form reset changes the value without firing onChange
|
|
227
|
+
useEffect(function () {
|
|
228
|
+
var _inputRef$current2;
|
|
229
|
+
var form = clear ? (_inputRef$current2 = inputRef.current) == null ? void 0 : _inputRef$current2.form : undefined;
|
|
230
|
+
if (!form) return undefined;
|
|
231
|
+
var timer;
|
|
232
|
+
var handleFormReset = function handleFormReset() {
|
|
233
|
+
// reset fires before the browser restores field values
|
|
234
|
+
timer = setTimeout(function () {
|
|
235
|
+
var _inputRef$current3;
|
|
236
|
+
return setUncontrolledHasValue(!!((_inputRef$current3 = inputRef.current) != null && _inputRef$current3.value));
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
form.addEventListener('reset', handleFormReset);
|
|
240
|
+
return function () {
|
|
241
|
+
clearTimeout(timer);
|
|
242
|
+
form.removeEventListener('reset', handleFormReset);
|
|
243
|
+
};
|
|
244
|
+
}, [clear, inputRef]);
|
|
158
245
|
var openDrop = useCallback(function () {
|
|
159
246
|
setShowDrop(true);
|
|
160
247
|
announce(format({
|
|
@@ -211,15 +298,15 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
211
298
|
|
|
212
299
|
// activeSuggestionIndex unifies mouse and keyboard interaction of
|
|
213
300
|
// the suggestions
|
|
214
|
-
var
|
|
215
|
-
activeSuggestionIndex =
|
|
216
|
-
setActiveSuggestionIndex =
|
|
301
|
+
var _useState7 = useState(resetSuggestionIndex),
|
|
302
|
+
activeSuggestionIndex = _useState7[0],
|
|
303
|
+
setActiveSuggestionIndex = _useState7[1];
|
|
217
304
|
|
|
218
305
|
// Only update active suggestion index when the mouse actually moves,
|
|
219
306
|
// not when suggestions are moving under the mouse.
|
|
220
|
-
var
|
|
221
|
-
mouseMovedSinceLastKey =
|
|
222
|
-
setMouseMovedSinceLastKey =
|
|
307
|
+
var _useState8 = useState(),
|
|
308
|
+
mouseMovedSinceLastKey = _useState8[0],
|
|
309
|
+
setMouseMovedSinceLastKey = _useState8[1];
|
|
223
310
|
|
|
224
311
|
// set activeSuggestionIndex when value changes
|
|
225
312
|
useEffect(function () {
|
|
@@ -262,7 +349,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
262
349
|
if (readOnly && inputRef != null && inputRef.current && inputRef.current.scrollLeft > 0) {
|
|
263
350
|
inputRef.current.scrollLeft = 0;
|
|
264
351
|
}
|
|
265
|
-
}, [readOnly, inputRef, inputRef == null || (_inputRef$
|
|
352
|
+
}, [readOnly, inputRef, inputRef == null || (_inputRef$current4 = inputRef.current) == null ? void 0 : _inputRef$current4.scrollLeft]);
|
|
266
353
|
var setValueFromSuggestion = function setValueFromSuggestion(event, suggestion) {
|
|
267
354
|
// if we stole the focus in the drop, perhaps by interacting with
|
|
268
355
|
// a suggestion button or the scrollbar, give it back
|
|
@@ -276,6 +363,9 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
276
363
|
handleSuggestionSelect(adjustedEvent);
|
|
277
364
|
}
|
|
278
365
|
setValue(suggestion);
|
|
366
|
+
if (clear) {
|
|
367
|
+
setUncontrolledHasValue(!isEmptyValue(suggestion));
|
|
368
|
+
}
|
|
279
369
|
};
|
|
280
370
|
var onNextSuggestion = useCallback(function (event) {
|
|
281
371
|
event.preventDefault();
|
|
@@ -291,7 +381,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
291
381
|
}, [activeSuggestionIndex]);
|
|
292
382
|
|
|
293
383
|
// account for input value in both controlled and uncontrolled scenarios
|
|
294
|
-
var hasValue = value || ((_inputRef$
|
|
384
|
+
var hasValue = value || ((_inputRef$current5 = inputRef.current) == null ? void 0 : _inputRef$current5.value);
|
|
295
385
|
var showStyledPlaceholder = useMemo(function () {
|
|
296
386
|
return placeholder && typeof placeholder !== 'string' && !hasValue;
|
|
297
387
|
}, [hasValue, placeholder]);
|
|
@@ -413,22 +503,36 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
413
503
|
var textInputIcon = useSizedIcon(icon, rest.size, theme);
|
|
414
504
|
var showPasswordIcon = (_theme$textInput = theme.textInput) == null || (_theme$textInput = _theme$textInput.icons) == null ? void 0 : _theme$textInput.showPassword;
|
|
415
505
|
var hidePasswordIcon = (_theme$textInput2 = theme.textInput) == null || (_theme$textInput2 = _theme$textInput2.icons) == null ? void 0 : _theme$textInput2.hidePassword;
|
|
506
|
+
var clearIcon = (_theme$textInput3 = theme.textInput) == null || (_theme$textInput3 = _theme$textInput3.icons) == null ? void 0 : _theme$textInput3.clear;
|
|
416
507
|
var inputType = authoredType;
|
|
417
508
|
if (passwordToggle) {
|
|
418
509
|
inputType = passwordRevealed ? 'text' : 'password';
|
|
419
510
|
}
|
|
420
511
|
var showTextInputIcon = !!textInputIcon && !readOnlyCopy;
|
|
421
|
-
var
|
|
422
|
-
|
|
423
|
-
var ReadOnlyCopyButton = /*#__PURE__*/React.createElement(CopyButton, {
|
|
512
|
+
var copyButtonElement = /*#__PURE__*/React.createElement(CopyButton, {
|
|
513
|
+
authoredType: authoredType,
|
|
424
514
|
disabled: disabled,
|
|
515
|
+
messages: messages,
|
|
425
516
|
onBlurCopy: onBlurCopy,
|
|
426
|
-
|
|
427
|
-
readOnlyCopyPrompt: readOnlyCopyPrompt,
|
|
517
|
+
onCopy: handleCopyClick,
|
|
428
518
|
tip: tip,
|
|
429
519
|
value: value
|
|
430
520
|
});
|
|
431
|
-
var
|
|
521
|
+
var clearable = clear && !readOnly;
|
|
522
|
+
var hasClearableValue = value !== undefined && value !== null ? value !== '' : uncontrolledHasValue;
|
|
523
|
+
var clearButton = clearable ? /*#__PURE__*/React.createElement(StyledInlineActionButton, _extends({
|
|
524
|
+
disabled: disabled,
|
|
525
|
+
kind: "toolbar",
|
|
526
|
+
icon: renderIcon(clearIcon, {
|
|
527
|
+
'aria-hidden': true
|
|
528
|
+
}),
|
|
529
|
+
onClick: handleClearClick,
|
|
530
|
+
"aria-label": clearMessage
|
|
531
|
+
// keep the slot while empty so the input width doesn't shift
|
|
532
|
+
,
|
|
533
|
+
$hidden: !hasClearableValue
|
|
534
|
+
}, passThemeFlag)) : undefined;
|
|
535
|
+
var passwordToggleButton = passwordToggle ? /*#__PURE__*/React.createElement(StyledInlineActionButton, _extends({
|
|
432
536
|
disabled: disabled,
|
|
433
537
|
kind: "toolbar",
|
|
434
538
|
icon: passwordRevealed ? renderIcon(hidePasswordIcon, {
|
|
@@ -442,10 +546,21 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
442
546
|
});
|
|
443
547
|
},
|
|
444
548
|
"aria-label": passwordRevealed ? hidePasswordMessage : showPasswordMessage
|
|
445
|
-
}) : undefined;
|
|
446
|
-
var
|
|
549
|
+
}, passThemeFlag)) : undefined;
|
|
550
|
+
var copyButton = readOnlyCopy || copy ? copyButtonElement : undefined;
|
|
551
|
+
// Order: clear sits next to the text, then password visibility, then the
|
|
552
|
+
// non-destructive copy action.
|
|
553
|
+
var actionsGroup = clearButton || passwordToggleButton || copyButton ? /*#__PURE__*/React.createElement(StyledActionsGroup, passThemeFlag, clearButton, passwordToggleButton, copyButton) : undefined;
|
|
554
|
+
var hasActionsGroup = !!actionsGroup;
|
|
555
|
+
var iconOnRight = reverse;
|
|
556
|
+
var showLeadingIcon = showTextInputIcon && !iconOnRight;
|
|
557
|
+
var showTrailingIcon = showTextInputIcon && iconOnRight;
|
|
447
558
|
return /*#__PURE__*/React.createElement(StyledTextInputContainer, _extends({
|
|
448
|
-
|
|
559
|
+
$inputDisabled: disabled,
|
|
560
|
+
hasButton: !!actionsGroup,
|
|
561
|
+
icon: showTextInputIcon && !hasActionsGroup ? icon : undefined,
|
|
562
|
+
reverse: iconOnRight,
|
|
563
|
+
size: rest.size,
|
|
449
564
|
readOnlyProp: readOnly // readOnlyProp to avoid passing to DOM
|
|
450
565
|
,
|
|
451
566
|
readOnlyCopy: readOnlyCopy,
|
|
@@ -455,12 +570,14 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
455
570
|
onMouseMove: function onMouseMove() {
|
|
456
571
|
return setMouseMovedSinceLastKey(true);
|
|
457
572
|
}
|
|
458
|
-
}, passThemeFlag),
|
|
459
|
-
reverse:
|
|
573
|
+
}, passThemeFlag), showStyledPlaceholder && /*#__PURE__*/React.createElement(StyledPlaceholder, passThemeFlag, placeholder), showLeadingIcon && /*#__PURE__*/React.createElement(StyledIcon, {
|
|
574
|
+
reverse: iconOnRight,
|
|
575
|
+
hasActionsGroup: hasActionsGroup,
|
|
460
576
|
theme: theme
|
|
461
577
|
}, textInputIcon), /*#__PURE__*/React.createElement(Keyboard, _extends({
|
|
462
578
|
target: focus ? 'document' : undefined
|
|
463
579
|
}, keyboardProps), /*#__PURE__*/React.createElement(StyledTextInput, _extends({
|
|
580
|
+
$inputInner: readOnly || hasActionsGroup,
|
|
464
581
|
"aria-label": a11yTitle,
|
|
465
582
|
ref: inputRef,
|
|
466
583
|
id: id,
|
|
@@ -469,11 +586,13 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
469
586
|
disabled: disabled,
|
|
470
587
|
plain: plain,
|
|
471
588
|
placeholder: typeof placeholder === 'string' ? placeholder : undefined,
|
|
472
|
-
icon: showTextInputIcon ? icon : undefined,
|
|
473
|
-
reverse:
|
|
589
|
+
icon: showTextInputIcon && !hasActionsGroup ? icon : undefined,
|
|
590
|
+
reverse: iconOnRight,
|
|
474
591
|
focus: focus,
|
|
475
|
-
hasButton:
|
|
476
|
-
|
|
592
|
+
hasButton: hasActionsGroup,
|
|
593
|
+
hasActionsGroup: hasActionsGroup,
|
|
594
|
+
hasClear: clearable,
|
|
595
|
+
hasLeadingIcon: showLeadingIcon,
|
|
477
596
|
hasTrailingIcon: showTrailingIcon,
|
|
478
597
|
focusIndicator: focusIndicator,
|
|
479
598
|
textAlign: textAlign,
|
|
@@ -519,13 +638,17 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
519
638
|
openDrop();
|
|
520
639
|
}
|
|
521
640
|
setValue(event.target.value);
|
|
641
|
+
if (clear) {
|
|
642
|
+
setUncontrolledHasValue(!!event.target.value);
|
|
643
|
+
}
|
|
522
644
|
setActiveSuggestionIndex(resetSuggestionIndex);
|
|
523
645
|
if (onChange) onChange(event);
|
|
524
646
|
}
|
|
525
|
-
}))),
|
|
526
|
-
reverse:
|
|
647
|
+
}))), actionsGroup, showTrailingIcon && /*#__PURE__*/React.createElement(StyledIcon, {
|
|
648
|
+
reverse: iconOnRight,
|
|
649
|
+
hasActionsGroup: hasActionsGroup,
|
|
527
650
|
theme: theme
|
|
528
|
-
}, textInputIcon), !
|
|
651
|
+
}, textInputIcon), !readOnly && drop);
|
|
529
652
|
});
|
|
530
653
|
TextInput.displayName = 'TextInput';
|
|
531
654
|
TextInput.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';
|
|
@@ -6,6 +6,7 @@ var PropType = {};
|
|
|
6
6
|
if (process.env.NODE_ENV !== 'production') {
|
|
7
7
|
PropType = {
|
|
8
8
|
a11yTitle: PropTypes.string,
|
|
9
|
+
clear: PropTypes.bool,
|
|
9
10
|
defaultSuggestion: PropTypes.number,
|
|
10
11
|
dropAlign: PropTypes.shape({
|
|
11
12
|
top: PropTypes.oneOf(['top', 'bottom']),
|
|
@@ -20,6 +21,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
20
21
|
id: PropTypes.string,
|
|
21
22
|
focusIndicator: PropTypes.bool,
|
|
22
23
|
messages: PropTypes.shape({
|
|
24
|
+
clear: PropTypes.string,
|
|
23
25
|
enterSelect: PropTypes.string,
|
|
24
26
|
hidePassword: PropTypes.string,
|
|
25
27
|
showPassword: PropTypes.string,
|
|
@@ -29,6 +31,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
29
31
|
}),
|
|
30
32
|
name: PropTypes.string,
|
|
31
33
|
onChange: PropTypes.func,
|
|
34
|
+
onClickCopy: PropTypes.func,
|
|
32
35
|
onSelect: PropTypes.func,
|
|
33
36
|
onSuggestionSelect: PropTypes.func,
|
|
34
37
|
onSuggestionsOpen: PropTypes.func,
|
|
@@ -36,6 +39,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
36
39
|
password: PropTypes.bool,
|
|
37
40
|
placeholder: PropTypes.node,
|
|
38
41
|
plain: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['full'])]),
|
|
42
|
+
copy: PropTypes.bool,
|
|
39
43
|
readOnlyCopy: PropTypes.bool,
|
|
40
44
|
reverse: PropTypes.bool,
|
|
41
45
|
size: PropTypes.oneOfType([PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge', 'xxlarge', '2xl', '3xl', '4xl', '5xl', '6xl']), PropTypes.string]),
|