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