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,5 +1,6 @@
|
|
|
1
1
|
var _excluded = ["defaultValue", "disabled", "focusOnOpen", "format", "id", "inline", "messages", "minuteStep", "name", "onChange", "onPartialChange", "readOnly", "showSeconds", "value"],
|
|
2
|
-
_excluded2 = ["plain", "focusIndicator"]
|
|
2
|
+
_excluded2 = ["plain", "focusIndicator", "aria-describedby", "aria-invalid"],
|
|
3
|
+
_excluded3 = ["icon", "kind"];
|
|
3
4
|
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); }
|
|
4
5
|
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; }
|
|
5
6
|
// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
@@ -11,49 +12,55 @@ import { MessageContext } from '../../contexts/MessageContext';
|
|
|
11
12
|
import { useForwardedRef } from '../../utils';
|
|
12
13
|
import { normalizeStep } from '../../utils/dates';
|
|
13
14
|
import { useThemeValue } from '../../utils/useThemeValue';
|
|
14
|
-
import {
|
|
15
|
+
import { getSectionTokenFromType } from '../../utils/sectionHelpers';
|
|
15
16
|
import { Box } from '../Box';
|
|
16
17
|
import { Button } from '../Button';
|
|
17
18
|
import { FormContext } from '../Form';
|
|
19
|
+
import { FormFieldContext } from '../FormField/FormFieldContext';
|
|
18
20
|
import { Keyboard } from '../Keyboard';
|
|
19
21
|
import { StyledTimeInputDisplay, StyledTimeInputField, StyledTimeInputSegment, StyledTimeInputSeparator, StyledTimeInputContainer, StyledTimeInput } from './StyledTimeInput';
|
|
20
22
|
import { TimeInputPopup } from './TimeInputPopup';
|
|
21
23
|
import { TimeInputPropTypes } from './propTypes';
|
|
22
24
|
import { useSectionedTimeField } from './useSectionedTimeField';
|
|
23
|
-
import { getSectionAriaMeta, getSectionName, pad, sectionTypeFromSection, SECTION_HOUR, SECTION_MINUTE, SECTION_PERIOD, SECTION_SECOND } from './utils';
|
|
24
|
-
var getDisplaySectionKey = function getDisplaySectionKey(section) {
|
|
25
|
-
if (section === SECTION_HOUR) return 'hour';
|
|
26
|
-
if (section === SECTION_MINUTE) return 'minute';
|
|
27
|
-
if (section === SECTION_SECOND) return 'second';
|
|
28
|
-
return 'period';
|
|
29
|
-
};
|
|
25
|
+
import { getSectionAriaMeta, getSectionName, pad, sectionTypeFromSection, sectionKey, SECTION_HOUR, SECTION_MINUTE, SECTION_PERIOD, SECTION_SECOND } from './utils';
|
|
30
26
|
var getDisplaySectionPrefix = function getDisplaySectionPrefix(section, index) {
|
|
31
27
|
if (index === 0) return '';
|
|
32
28
|
return section === SECTION_PERIOD ? ' ' : ':';
|
|
33
29
|
};
|
|
34
|
-
var getDisplaySectionText = function getDisplaySectionText(_ref) {
|
|
35
|
-
var key = _ref.key,
|
|
36
|
-
section = _ref.section,
|
|
37
|
-
sections = _ref.sections;
|
|
38
|
-
if (sections[key] === undefined) return getSectionTokenFromType(sectionTypeFromSection(section));
|
|
39
|
-
if (section === SECTION_PERIOD) return sections[key];
|
|
40
|
-
return pad(sections[key]);
|
|
41
|
-
};
|
|
42
30
|
var getSectionOrder = function getSectionOrder(format, showSeconds) {
|
|
43
|
-
if (showSeconds === void 0) {
|
|
44
|
-
showSeconds = format === '12';
|
|
45
|
-
}
|
|
46
31
|
var numericSections = showSeconds ? [SECTION_HOUR, SECTION_MINUTE, SECTION_SECOND] : [SECTION_HOUR, SECTION_MINUTE];
|
|
47
32
|
if (format === '12') {
|
|
48
33
|
return [].concat(numericSections, [SECTION_PERIOD]);
|
|
49
34
|
}
|
|
50
35
|
return numericSections;
|
|
51
36
|
};
|
|
37
|
+
var getContainerFill = function getContainerFill(container) {
|
|
38
|
+
if (container === void 0) {
|
|
39
|
+
container = {};
|
|
40
|
+
}
|
|
41
|
+
var fillWidth = container.width === undefined;
|
|
42
|
+
var fillHeight = container.height === undefined;
|
|
43
|
+
if (fillWidth && fillHeight) return true;
|
|
44
|
+
if (fillWidth) return 'horizontal';
|
|
45
|
+
if (fillHeight) return 'vertical';
|
|
46
|
+
return false;
|
|
47
|
+
};
|
|
48
|
+
var resolveDropButtonIcon = function resolveDropButtonIcon(icon) {
|
|
49
|
+
if (/*#__PURE__*/React.isValidElement(icon)) {
|
|
50
|
+
var _icon$props$ariaHidd;
|
|
51
|
+
return /*#__PURE__*/React.cloneElement(icon, {
|
|
52
|
+
'aria-hidden': (_icon$props$ariaHidd = icon.props['aria-hidden']) != null ? _icon$props$ariaHidd : true
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (typeof icon === 'function' || icon != null && icon.$$typeof) return /*#__PURE__*/React.createElement(icon, {
|
|
56
|
+
'aria-hidden': true
|
|
57
|
+
});
|
|
58
|
+
return icon;
|
|
59
|
+
};
|
|
52
60
|
var buildPlaceholder = function buildPlaceholder(sectionOrder) {
|
|
53
61
|
return sectionOrder.map(function (section, index) {
|
|
54
62
|
var token = getSectionTokenFromType(sectionTypeFromSection(section));
|
|
55
|
-
|
|
56
|
-
return "" + (section === SECTION_PERIOD ? ' ' : ':') + token;
|
|
63
|
+
return "" + getDisplaySectionPrefix(section, index) + token;
|
|
57
64
|
}).join('');
|
|
58
65
|
};
|
|
59
66
|
|
|
@@ -71,28 +78,29 @@ var getDefaultFormat = function getDefaultFormat() {
|
|
|
71
78
|
}
|
|
72
79
|
};
|
|
73
80
|
var DEFAULT_FORMAT = getDefaultFormat();
|
|
74
|
-
var TimeInput = /*#__PURE__*/forwardRef(function (
|
|
75
|
-
var _theme$timeInput, _theme$global, _theme$
|
|
76
|
-
var defaultValue =
|
|
77
|
-
disabled =
|
|
78
|
-
|
|
79
|
-
focusOnOpen =
|
|
80
|
-
|
|
81
|
-
format =
|
|
82
|
-
id =
|
|
83
|
-
|
|
84
|
-
inline =
|
|
85
|
-
messages =
|
|
86
|
-
|
|
87
|
-
minuteStep =
|
|
88
|
-
name =
|
|
89
|
-
onChange =
|
|
90
|
-
onPartialChange =
|
|
91
|
-
|
|
92
|
-
readOnly =
|
|
93
|
-
showSeconds =
|
|
94
|
-
|
|
95
|
-
|
|
81
|
+
var TimeInput = /*#__PURE__*/forwardRef(function (_ref, refArg) {
|
|
82
|
+
var _theme$timeInput, _theme$timeInput2, _theme$timeInput$cont, _theme$timeInput3, _theme$global, _theme$timeInput4;
|
|
83
|
+
var defaultValue = _ref.defaultValue,
|
|
84
|
+
disabled = _ref.disabled,
|
|
85
|
+
_ref$focusOnOpen = _ref.focusOnOpen,
|
|
86
|
+
focusOnOpen = _ref$focusOnOpen === void 0 ? true : _ref$focusOnOpen,
|
|
87
|
+
_ref$format = _ref.format,
|
|
88
|
+
format = _ref$format === void 0 ? DEFAULT_FORMAT : _ref$format,
|
|
89
|
+
id = _ref.id,
|
|
90
|
+
_ref$inline = _ref.inline,
|
|
91
|
+
inline = _ref$inline === void 0 ? false : _ref$inline,
|
|
92
|
+
messages = _ref.messages,
|
|
93
|
+
_ref$minuteStep = _ref.minuteStep,
|
|
94
|
+
minuteStep = _ref$minuteStep === void 0 ? 1 : _ref$minuteStep,
|
|
95
|
+
name = _ref.name,
|
|
96
|
+
onChange = _ref.onChange,
|
|
97
|
+
onPartialChange = _ref.onPartialChange,
|
|
98
|
+
_ref$readOnly = _ref.readOnly,
|
|
99
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
100
|
+
_ref$showSeconds = _ref.showSeconds,
|
|
101
|
+
showSeconds = _ref$showSeconds === void 0 ? false : _ref$showSeconds,
|
|
102
|
+
valueArg = _ref.value,
|
|
103
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
96
104
|
var _useThemeValue = useThemeValue(),
|
|
97
105
|
theme = _useThemeValue.theme,
|
|
98
106
|
passThemeFlag = _useThemeValue.passThemeFlag;
|
|
@@ -100,6 +108,8 @@ var TimeInput = /*#__PURE__*/forwardRef(function (_ref2, refArg) {
|
|
|
100
108
|
var _useContext = useContext(MessageContext),
|
|
101
109
|
formatMessage = _useContext.format;
|
|
102
110
|
var formContext = useContext(FormContext);
|
|
111
|
+
var _useContext2 = useContext(FormFieldContext),
|
|
112
|
+
setFieldFocusIndicator = _useContext2.setFocusIndicator;
|
|
103
113
|
var useFormInput = formContext.useFormInput;
|
|
104
114
|
var inputRef = useForwardedRef(refArg);
|
|
105
115
|
var containerRef = useRef();
|
|
@@ -110,11 +120,9 @@ var TimeInput = /*#__PURE__*/forwardRef(function (_ref2, refArg) {
|
|
|
110
120
|
}),
|
|
111
121
|
value = _useFormInput[0],
|
|
112
122
|
setValue = _useFormInput[1];
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
}, []);
|
|
123
|
+
if (inline && (disabled || readOnly)) {
|
|
124
|
+
console.warn('TimeInput is rendered inline and is either disabled or read-only. ' + 'TimeInput ignores disabled and readOnly props when rendered inline.');
|
|
125
|
+
}
|
|
118
126
|
var _formContext$useFormF = formContext.useFormField({}),
|
|
119
127
|
inForm = _formContext$useFormF.inForm;
|
|
120
128
|
var formFieldLabelId = inForm && id ? "grommet-" + id + "__label" : undefined;
|
|
@@ -134,11 +142,23 @@ var TimeInput = /*#__PURE__*/forwardRef(function (_ref2, refArg) {
|
|
|
134
142
|
var segmentRefs = useRef({});
|
|
135
143
|
var plainProp = rest.plain,
|
|
136
144
|
focusIndicatorProp = rest.focusIndicator,
|
|
145
|
+
ariaDescribedBy = rest['aria-describedby'],
|
|
146
|
+
ariaInvalid = rest['aria-invalid'],
|
|
137
147
|
inputRest = _objectWithoutPropertiesLoose(rest, _excluded2);
|
|
148
|
+
|
|
149
|
+
// FormField merges its generated error id into aria-describedby
|
|
150
|
+
// alongside any id the consumer already had on the child. Split those
|
|
151
|
+
// back apart so a pre-existing description stays on every segment,
|
|
152
|
+
// while the error id itself is only added to the segment(s) it's about.
|
|
153
|
+
var errorId = id ? "grommet-" + id + "__error" : undefined;
|
|
154
|
+
var describedByTokens = ariaDescribedBy ? ariaDescribedBy.split(' ').filter(Boolean) : [];
|
|
155
|
+
var hasErrorDescribedBy = !!errorId && describedByTokens.includes(errorId);
|
|
156
|
+
var consumerDescribedBy = describedByTokens.filter(function (token) {
|
|
157
|
+
return token !== errorId;
|
|
158
|
+
}).join(' ') || undefined;
|
|
138
159
|
var normalizedMinuteStep = useMemo(function () {
|
|
139
160
|
return normalizeStep(minuteStep);
|
|
140
161
|
}, [minuteStep]);
|
|
141
|
-
var resolvedShowSeconds = showSeconds !== undefined ? showSeconds : format === '12';
|
|
142
162
|
var handleInvalid = useCallback(function () {
|
|
143
163
|
var error = formatMessage({
|
|
144
164
|
id: 'timeInput.invalidTime',
|
|
@@ -147,22 +167,25 @@ var TimeInput = /*#__PURE__*/forwardRef(function (_ref2, refArg) {
|
|
|
147
167
|
announce(error, 'assertive');
|
|
148
168
|
}, [announce, formatMessage, messages]);
|
|
149
169
|
var announceCurrentValue = useCallback(function (nextSections) {
|
|
150
|
-
if (nextSections.hour === undefined || nextSections.minute === undefined || nextSections.second === undefined) return;
|
|
170
|
+
if (nextSections.hour === undefined || nextSections.minute === undefined || showSeconds && nextSections.second === undefined) return;
|
|
151
171
|
var period = format === '12' ? " " + (nextSections.period || 'AM') : '';
|
|
172
|
+
var messageId = showSeconds ? 'timeInput.currentValue' : 'timeInput.currentValueWithoutSeconds';
|
|
152
173
|
announce(formatMessage({
|
|
153
|
-
id:
|
|
174
|
+
id: messageId,
|
|
154
175
|
messages: messages,
|
|
155
|
-
values: {
|
|
176
|
+
values: _extends({
|
|
156
177
|
hour: nextSections.hour,
|
|
157
|
-
minute: nextSections.minute
|
|
158
|
-
|
|
178
|
+
minute: nextSections.minute
|
|
179
|
+
}, showSeconds ? {
|
|
180
|
+
second: nextSections.second
|
|
181
|
+
} : {}, {
|
|
159
182
|
period: period
|
|
160
|
-
}
|
|
183
|
+
})
|
|
161
184
|
}), 'polite');
|
|
162
|
-
}, [announce, format, formatMessage, messages]);
|
|
185
|
+
}, [announce, format, formatMessage, messages, showSeconds]);
|
|
163
186
|
var sectionOrder = useMemo(function () {
|
|
164
|
-
return getSectionOrder(format,
|
|
165
|
-
}, [format,
|
|
187
|
+
return getSectionOrder(format, showSeconds);
|
|
188
|
+
}, [format, showSeconds]);
|
|
166
189
|
var firstSection = sectionOrder[0] || SECTION_HOUR;
|
|
167
190
|
var lastSection = sectionOrder[sectionOrder.length - 1] || SECTION_HOUR;
|
|
168
191
|
var _useSectionedTimeFiel = useSectionedTimeField({
|
|
@@ -227,8 +250,7 @@ var TimeInput = /*#__PURE__*/forwardRef(function (_ref2, refArg) {
|
|
|
227
250
|
}
|
|
228
251
|
});
|
|
229
252
|
}
|
|
230
|
-
var
|
|
231
|
-
var sectionValue = sections[sectionKey];
|
|
253
|
+
var sectionValue = sections[sectionKey(section)];
|
|
232
254
|
if (sectionValue === undefined) {
|
|
233
255
|
return formatMessage({
|
|
234
256
|
id: 'timeInput.activeSection',
|
|
@@ -266,19 +288,36 @@ var TimeInput = /*#__PURE__*/forwardRef(function (_ref2, refArg) {
|
|
|
266
288
|
displaySectionsData[pendingSection] = pendingDigits[pendingSection];
|
|
267
289
|
}
|
|
268
290
|
return sectionOrder.map(function (section, index) {
|
|
269
|
-
var key =
|
|
291
|
+
var key = sectionKey(section);
|
|
292
|
+
var sectionValue = displaySectionsData[key];
|
|
293
|
+
var text;
|
|
294
|
+
if (sectionValue === undefined) {
|
|
295
|
+
text = getSectionTokenFromType(sectionTypeFromSection(section));
|
|
296
|
+
} else if (section === SECTION_PERIOD) {
|
|
297
|
+
text = sectionValue;
|
|
298
|
+
} else {
|
|
299
|
+
text = pad(sectionValue);
|
|
300
|
+
}
|
|
270
301
|
return {
|
|
271
|
-
|
|
272
|
-
prefix: getDisplaySectionPrefix(section, index),
|
|
273
|
-
text: getDisplaySectionText({
|
|
274
|
-
key: key,
|
|
302
|
+
ariaMeta: getSectionAriaMeta({
|
|
275
303
|
section: section,
|
|
276
|
-
|
|
304
|
+
format: format,
|
|
305
|
+
sections: sections
|
|
277
306
|
}),
|
|
278
|
-
|
|
307
|
+
section: section,
|
|
308
|
+
prefix: getDisplaySectionPrefix(section, index),
|
|
309
|
+
text: text,
|
|
310
|
+
filled: sectionValue !== undefined
|
|
279
311
|
};
|
|
280
312
|
});
|
|
281
|
-
}, [sectionOrder, sections
|
|
313
|
+
}, [format, pendingDigits, sectionOrder, sections]);
|
|
314
|
+
|
|
315
|
+
// A required-field error is caused by whichever section(s) are still
|
|
316
|
+
// empty, so only announce it there; once every section has a value the
|
|
317
|
+
// error must be about the value as a whole, so announce it everywhere.
|
|
318
|
+
var allSectionsFilled = displaySections.every(function (entry) {
|
|
319
|
+
return entry.filled;
|
|
320
|
+
});
|
|
282
321
|
var onDisplaySectionMouseDown = useCallback(function (section, event) {
|
|
283
322
|
if (readOnly) return;
|
|
284
323
|
if (disabled) return;
|
|
@@ -315,8 +354,8 @@ var TimeInput = /*#__PURE__*/forwardRef(function (_ref2, refArg) {
|
|
|
315
354
|
}).sort(function (a, b) {
|
|
316
355
|
return a.rect.left - b.rect.left;
|
|
317
356
|
});
|
|
318
|
-
var sectionFromBounds = sectionsWithRects.find(function (
|
|
319
|
-
var rect =
|
|
357
|
+
var sectionFromBounds = sectionsWithRects.find(function (_ref2) {
|
|
358
|
+
var rect = _ref2.rect;
|
|
320
359
|
return x >= rect.left && x <= rect.right;
|
|
321
360
|
});
|
|
322
361
|
if ((sectionFromBounds == null || (_sectionFromBounds$no = sectionFromBounds.node) == null || (_sectionFromBounds$no = _sectionFromBounds$no.dataset) == null ? void 0 : _sectionFromBounds$no.section) !== undefined) {
|
|
@@ -326,8 +365,8 @@ var TimeInput = /*#__PURE__*/forwardRef(function (_ref2, refArg) {
|
|
|
326
365
|
return;
|
|
327
366
|
}
|
|
328
367
|
}
|
|
329
|
-
var zones = sectionsWithRects.map(function (
|
|
330
|
-
var rect =
|
|
368
|
+
var zones = sectionsWithRects.map(function (_ref3, index) {
|
|
369
|
+
var rect = _ref3.rect;
|
|
331
370
|
var prev = sectionsWithRects[index - 1];
|
|
332
371
|
var next = sectionsWithRects[index + 1];
|
|
333
372
|
var start = prev !== undefined ? (prev.rect.right + rect.left) / 2 : Number.NEGATIVE_INFINITY;
|
|
@@ -338,9 +377,9 @@ var TimeInput = /*#__PURE__*/forwardRef(function (_ref2, refArg) {
|
|
|
338
377
|
end: end
|
|
339
378
|
};
|
|
340
379
|
});
|
|
341
|
-
var zone = zones.find(function (
|
|
342
|
-
var start =
|
|
343
|
-
end =
|
|
380
|
+
var zone = zones.find(function (_ref4) {
|
|
381
|
+
var start = _ref4.start,
|
|
382
|
+
end = _ref4.end;
|
|
344
383
|
return x >= start && x <= end;
|
|
345
384
|
}) || zones[0] || null;
|
|
346
385
|
if (zone) {
|
|
@@ -372,6 +411,7 @@ var TimeInput = /*#__PURE__*/forwardRef(function (_ref2, refArg) {
|
|
|
372
411
|
}, 0);
|
|
373
412
|
}, [activeSection, focusSection]);
|
|
374
413
|
var onSegmentFocus = useCallback(function (section) {
|
|
414
|
+
setFieldFocusIndicator == null || setFieldFocusIndicator(true);
|
|
375
415
|
if (!segmentFocused && !readOnly && !disabled && !open) {
|
|
376
416
|
announce(formatMessage({
|
|
377
417
|
id: 'timeInput.openDrop',
|
|
@@ -381,24 +421,26 @@ var TimeInput = /*#__PURE__*/forwardRef(function (_ref2, refArg) {
|
|
|
381
421
|
setSegmentFocused(true);
|
|
382
422
|
if (readOnly || disabled) return;
|
|
383
423
|
setActiveSection(section);
|
|
384
|
-
}, [announce, disabled, formatMessage, messages, open, readOnly, segmentFocused, setActiveSection]);
|
|
424
|
+
}, [announce, disabled, formatMessage, messages, open, readOnly, segmentFocused, setFieldFocusIndicator, setActiveSection]);
|
|
385
425
|
var onSegmentBlur = useCallback(function () {
|
|
386
426
|
requestAnimationFrame(function () {
|
|
427
|
+
var _containerRef$current;
|
|
387
428
|
var _document = document,
|
|
388
429
|
activeElement = _document.activeElement;
|
|
389
430
|
var isSegmentFocused = Object.values(segmentRefs.current).includes(activeElement);
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
return;
|
|
393
|
-
}
|
|
394
|
-
if (!isSegmentFocused) {
|
|
431
|
+
var isInsideTimeInput = (_containerRef$current = containerRef.current) == null ? void 0 : _containerRef$current.contains(activeElement);
|
|
432
|
+
if (!isSegmentFocused || !isInsideTimeInput) {
|
|
395
433
|
setSegmentFocused(false);
|
|
396
434
|
}
|
|
397
435
|
});
|
|
398
|
-
}, [
|
|
436
|
+
}, []);
|
|
399
437
|
var onSegmentKeyDown = useCallback(function (section, event) {
|
|
400
438
|
if (readOnly || disabled) return;
|
|
401
|
-
var key = event.key
|
|
439
|
+
var key = event.key,
|
|
440
|
+
ctrlKey = event.ctrlKey,
|
|
441
|
+
metaKey = event.metaKey,
|
|
442
|
+
altKey = event.altKey;
|
|
443
|
+
if (ctrlKey || metaKey || altKey && key !== 'ArrowDown') return;
|
|
402
444
|
if (activeSection !== section) {
|
|
403
445
|
setActiveSection(section);
|
|
404
446
|
}
|
|
@@ -407,10 +449,12 @@ var TimeInput = /*#__PURE__*/forwardRef(function (_ref2, refArg) {
|
|
|
407
449
|
var next = moveSection(1);
|
|
408
450
|
setActiveSection(next);
|
|
409
451
|
focusSection(next);
|
|
452
|
+
event.stopPropagation();
|
|
410
453
|
return;
|
|
411
454
|
}
|
|
412
455
|
if (key === 'ArrowLeft') {
|
|
413
456
|
event.preventDefault();
|
|
457
|
+
event.stopPropagation();
|
|
414
458
|
var _next = moveSection(-1);
|
|
415
459
|
setActiveSection(_next);
|
|
416
460
|
focusSection(_next);
|
|
@@ -418,48 +462,51 @@ var TimeInput = /*#__PURE__*/forwardRef(function (_ref2, refArg) {
|
|
|
418
462
|
}
|
|
419
463
|
if (key === 'Home') {
|
|
420
464
|
event.preventDefault();
|
|
465
|
+
event.stopPropagation();
|
|
421
466
|
setActiveSection(firstSection);
|
|
422
467
|
focusSection(firstSection);
|
|
423
468
|
return;
|
|
424
469
|
}
|
|
425
470
|
if (key === 'End') {
|
|
426
471
|
event.preventDefault();
|
|
472
|
+
event.stopPropagation();
|
|
427
473
|
setActiveSection(lastSection);
|
|
428
474
|
focusSection(lastSection);
|
|
429
475
|
return;
|
|
430
476
|
}
|
|
431
477
|
if (key === 'ArrowUp') {
|
|
432
478
|
event.preventDefault();
|
|
479
|
+
event.stopPropagation();
|
|
433
480
|
incrementSection(section, open ? -1 : 1);
|
|
434
481
|
return;
|
|
435
482
|
}
|
|
436
483
|
if (key === 'ArrowDown') {
|
|
437
|
-
if (
|
|
484
|
+
if (altKey) {
|
|
438
485
|
event.preventDefault();
|
|
486
|
+
event.stopPropagation();
|
|
439
487
|
openPicker();
|
|
440
488
|
return;
|
|
441
489
|
}
|
|
442
490
|
event.preventDefault();
|
|
491
|
+
event.stopPropagation();
|
|
443
492
|
incrementSection(section, open ? 1 : -1);
|
|
444
493
|
return;
|
|
445
494
|
}
|
|
446
495
|
if (key === 'Delete' || key === 'Backspace') {
|
|
447
496
|
event.preventDefault();
|
|
497
|
+
event.stopPropagation();
|
|
448
498
|
clearActiveSection();
|
|
449
499
|
return;
|
|
450
500
|
}
|
|
451
|
-
if (key === 'Enter') {
|
|
452
|
-
event.preventDefault();
|
|
453
|
-
if (open) closePicker();
|
|
454
|
-
return;
|
|
455
|
-
}
|
|
456
|
-
if (key === 'Escape' && open) {
|
|
501
|
+
if ((key === 'Enter' || key === 'Escape') && open) {
|
|
457
502
|
event.preventDefault();
|
|
503
|
+
event.stopPropagation();
|
|
458
504
|
closePicker();
|
|
459
505
|
return;
|
|
460
506
|
}
|
|
461
507
|
if (key === ' ' || key === 'Spacebar') {
|
|
462
508
|
event.preventDefault();
|
|
509
|
+
event.stopPropagation();
|
|
463
510
|
openPicker();
|
|
464
511
|
return;
|
|
465
512
|
}
|
|
@@ -467,21 +514,23 @@ var TimeInput = /*#__PURE__*/forwardRef(function (_ref2, refArg) {
|
|
|
467
514
|
var lower = key.toLowerCase();
|
|
468
515
|
if (lower === 'a') {
|
|
469
516
|
event.preventDefault();
|
|
517
|
+
event.stopPropagation();
|
|
470
518
|
setSectionValue(SECTION_PERIOD, 'AM');
|
|
471
519
|
} else if (lower === 'p') {
|
|
472
520
|
event.preventDefault();
|
|
521
|
+
event.stopPropagation();
|
|
473
522
|
setSectionValue(SECTION_PERIOD, 'PM');
|
|
474
523
|
}
|
|
475
524
|
return;
|
|
476
525
|
}
|
|
477
526
|
if (/^\d$/.test(key)) {
|
|
478
527
|
event.preventDefault();
|
|
528
|
+
event.stopPropagation();
|
|
479
529
|
var _next2 = applyDigit(Number(key));
|
|
480
530
|
var targetSection = _next2 != null ? _next2 : section;
|
|
481
531
|
setActiveSection(targetSection);
|
|
482
|
-
if (targetSection
|
|
483
|
-
|
|
484
|
-
} else {
|
|
532
|
+
if (targetSection !== section) {
|
|
533
|
+
// moving to a different section focus for digit',
|
|
485
534
|
focusSection(targetSection);
|
|
486
535
|
}
|
|
487
536
|
}
|
|
@@ -537,13 +586,33 @@ var TimeInput = /*#__PURE__*/forwardRef(function (_ref2, refArg) {
|
|
|
537
586
|
});
|
|
538
587
|
}, []);
|
|
539
588
|
var showActiveSection = (segmentFocused || open) && !readOnly && !disabled;
|
|
589
|
+
var containerTheme = (_theme$timeInput = theme.timeInput) == null ? void 0 : _theme$timeInput.container;
|
|
590
|
+
var dropButtonTheme = (_theme$timeInput2 = theme.timeInput) == null ? void 0 : _theme$timeInput2.dropButton;
|
|
591
|
+
var dropButtonKind = 'toolbar';
|
|
592
|
+
var dropButtonIcon = /*#__PURE__*/React.createElement(GrommetClockIcon, {
|
|
593
|
+
"aria-hidden": "true"
|
|
594
|
+
});
|
|
595
|
+
if (typeof dropButtonTheme === 'string') {
|
|
596
|
+
dropButtonKind = dropButtonTheme;
|
|
597
|
+
} else if (dropButtonTheme && typeof dropButtonTheme === 'object' && ! /*#__PURE__*/React.isValidElement(dropButtonTheme) && !dropButtonTheme.$$typeof) {
|
|
598
|
+
var icon = dropButtonTheme.icon,
|
|
599
|
+
kind = dropButtonTheme.kind,
|
|
600
|
+
buttonTheme = _objectWithoutPropertiesLoose(dropButtonTheme, _excluded3);
|
|
601
|
+
dropButtonIcon = resolveDropButtonIcon(icon != null ? icon : dropButtonIcon);
|
|
602
|
+
if (kind) {
|
|
603
|
+
dropButtonKind = kind;
|
|
604
|
+
} else {
|
|
605
|
+
var hasButtonTheme = Object.keys(buttonTheme).length > 0;
|
|
606
|
+
dropButtonKind = hasButtonTheme ? buttonTheme : 'toolbar';
|
|
607
|
+
}
|
|
608
|
+
}
|
|
540
609
|
if (inline) {
|
|
541
610
|
return /*#__PURE__*/React.createElement(TimeInputPopup, _extends({
|
|
542
611
|
inline: true,
|
|
543
612
|
activeSection: activeSection,
|
|
544
613
|
format: format,
|
|
545
614
|
formatMessage: formatMessage,
|
|
546
|
-
focusOnOpen: focusOnOpen,
|
|
615
|
+
focusOnOpen: inline ? false : focusOnOpen,
|
|
547
616
|
hoursOptions: hoursOptions,
|
|
548
617
|
incrementSection: incrementSection,
|
|
549
618
|
messages: messages,
|
|
@@ -561,21 +630,29 @@ var TimeInput = /*#__PURE__*/forwardRef(function (_ref2, refArg) {
|
|
|
561
630
|
ref: containerRef,
|
|
562
631
|
direction: "row",
|
|
563
632
|
border: !plainProp,
|
|
564
|
-
fill:
|
|
565
|
-
|
|
633
|
+
fill: getContainerFill(containerTheme)
|
|
634
|
+
}, containerTheme, {
|
|
635
|
+
round: (_theme$timeInput$cont = (_theme$timeInput3 = theme.timeInput) == null || (_theme$timeInput3 = _theme$timeInput3.container) == null ? void 0 : _theme$timeInput3.round) != null ? _theme$timeInput$cont : (_theme$global = theme.global) == null || (_theme$global = _theme$global.control) == null || (_theme$global = _theme$global.border) == null ? void 0 : _theme$global.radius,
|
|
566
636
|
disabled: disabled,
|
|
637
|
+
plain: plainProp,
|
|
638
|
+
$inputPlain: plainProp,
|
|
567
639
|
readOnlyProp: readOnly,
|
|
568
640
|
focusIndicator: (focusIndicatorProp != null ? focusIndicatorProp : true) && !iconFocused
|
|
569
|
-
}, passThemeFlag), /*#__PURE__*/React.createElement(StyledTimeInputField, passThemeFlag, /*#__PURE__*/React.createElement(StyledTimeInputDisplay, _extends({
|
|
641
|
+
}, passThemeFlag), /*#__PURE__*/React.createElement(StyledTimeInputField, passThemeFlag, /*#__PURE__*/React.createElement(StyledTimeInputDisplay, _extends({}, (_theme$timeInput4 = theme.timeInput) == null ? void 0 : _theme$timeInput4.value, {
|
|
642
|
+
align: "center",
|
|
643
|
+
direction: "row",
|
|
644
|
+
overflow: "hidden",
|
|
570
645
|
role: "group",
|
|
571
646
|
"aria-label": groupLabel,
|
|
572
647
|
"aria-labelledby": formFieldLabelId,
|
|
573
648
|
onMouseDown: onDisplayMouseDown
|
|
574
|
-
}, passThemeFlag), displaySections.map(function (
|
|
575
|
-
var
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
649
|
+
}, passThemeFlag), displaySections.map(function (_ref5) {
|
|
650
|
+
var ariaMeta = _ref5.ariaMeta,
|
|
651
|
+
section = _ref5.section,
|
|
652
|
+
prefix = _ref5.prefix,
|
|
653
|
+
text = _ref5.text,
|
|
654
|
+
filled = _ref5.filled;
|
|
655
|
+
var describeSegment = !filled || allSectionsFilled;
|
|
579
656
|
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
580
657
|
key: section
|
|
581
658
|
}, !!prefix && /*#__PURE__*/React.createElement(StyledTimeInputSeparator, _extends({
|
|
@@ -584,6 +661,7 @@ var TimeInput = /*#__PURE__*/forwardRef(function (_ref2, refArg) {
|
|
|
584
661
|
ref: function ref(segmentNode) {
|
|
585
662
|
segmentRefs.current[section] = segmentNode;
|
|
586
663
|
},
|
|
664
|
+
responsive: false,
|
|
587
665
|
tabIndex: !readOnly && !disabled && activeSection === section ? 0 : -1,
|
|
588
666
|
$active: showActiveSection && activeSection === section,
|
|
589
667
|
$filled: filled,
|
|
@@ -596,28 +674,17 @@ var TimeInput = /*#__PURE__*/forwardRef(function (_ref2, refArg) {
|
|
|
596
674
|
},
|
|
597
675
|
onPaste: onSegmentPaste,
|
|
598
676
|
"data-active": showActiveSection && activeSection === section,
|
|
599
|
-
"data-testid": showActiveSection && activeSection === section ? 'time-input-active-section' : undefined,
|
|
600
677
|
"data-section": section
|
|
601
678
|
}, passThemeFlag, {
|
|
602
679
|
"aria-label": getSectionName(section, format, formatMessage, messages),
|
|
603
680
|
role: "spinbutton",
|
|
604
681
|
"aria-disabled": disabled || undefined,
|
|
605
682
|
"aria-readonly": readOnly || undefined,
|
|
606
|
-
"aria-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
"aria-valuemin": getSectionAriaMeta({
|
|
612
|
-
section: section,
|
|
613
|
-
format: format,
|
|
614
|
-
sections: sections
|
|
615
|
-
}).min,
|
|
616
|
-
"aria-valuemax": getSectionAriaMeta({
|
|
617
|
-
section: section,
|
|
618
|
-
format: format,
|
|
619
|
-
sections: sections
|
|
620
|
-
}).max,
|
|
683
|
+
"aria-invalid": ariaInvalid && describeSegment || undefined,
|
|
684
|
+
"aria-describedby": [consumerDescribedBy, describeSegment && hasErrorDescribedBy ? errorId : undefined].filter(Boolean).join(' ') || undefined,
|
|
685
|
+
"aria-valuenow": ariaMeta.now,
|
|
686
|
+
"aria-valuemin": ariaMeta.min,
|
|
687
|
+
"aria-valuemax": ariaMeta.max,
|
|
621
688
|
"aria-valuetext": getSectionValueAnnouncement(section)
|
|
622
689
|
}), text));
|
|
623
690
|
})), /*#__PURE__*/React.createElement(StyledTimeInput, _extends({
|
|
@@ -639,10 +706,9 @@ var TimeInput = /*#__PURE__*/forwardRef(function (_ref2, refArg) {
|
|
|
639
706
|
type: "hidden",
|
|
640
707
|
value: value || ''
|
|
641
708
|
}), !readOnly && /*#__PURE__*/React.createElement(Button, {
|
|
642
|
-
|
|
643
|
-
|
|
709
|
+
kind: dropButtonKind,
|
|
710
|
+
icon: dropButtonIcon,
|
|
644
711
|
disabled: disabled,
|
|
645
|
-
margin: (_theme$timeInput2 = theme.timeInput) == null || (_theme$timeInput2 = _theme$timeInput2.button) == null ? void 0 : _theme$timeInput2.margin,
|
|
646
712
|
"aria-label": formatMessage({
|
|
647
713
|
id: 'timeInput.chooseTime',
|
|
648
714
|
messages: messages
|
|
@@ -652,6 +718,7 @@ var TimeInput = /*#__PURE__*/forwardRef(function (_ref2, refArg) {
|
|
|
652
718
|
"aria-controls": id ? id + "__drop" : undefined,
|
|
653
719
|
onFocus: function onFocus() {
|
|
654
720
|
setIconFocused(true);
|
|
721
|
+
setFieldFocusIndicator == null || setFieldFocusIndicator(false);
|
|
655
722
|
},
|
|
656
723
|
onBlur: function onBlur() {
|
|
657
724
|
setIconFocused(false);
|