grommet 2.47.0 → 2.48.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 +1 -2
- package/components/Accordion/Accordion.js +1 -2
- package/components/Accordion/stories/CustomHeader.stories.js +1 -2
- package/components/AccordionPanel/AccordionPanel.js +1 -2
- package/components/Anchor/Anchor.js +5 -6
- package/components/Anchor/StyledAnchor.js +1 -2
- package/components/Avatar/Avatar.js +1 -2
- package/components/Box/Box.js +6 -3
- package/components/Box/ResponsiveContainerProvider.js +1 -2
- package/components/Box/StyledBox.js +4 -3
- package/components/Box/stories/ResponsiveContainer.stories.js +1 -2
- package/components/Button/Badge.js +1 -2
- package/components/Button/BusyAnimation.js +1 -2
- package/components/Button/Button.js +1 -2
- package/components/Button/StyledButton.js +4 -3
- package/components/Button/StyledButtonKind.js +4 -3
- package/components/Button/index.d.ts +1 -1
- package/components/Button/propTypes.js +1 -1
- package/components/Button/stories/Busy.stories.js +1 -2
- package/components/Calendar/Calendar.js +152 -130
- package/components/Calendar/StyledCalendar.js +34 -37
- package/components/Calendar/stories/ActiveDate.stories.js +1 -2
- package/components/Calendar/stories/CustomDay.stories.js +1 -2
- package/components/Calendar/stories/CustomHeader.stories.js +1 -2
- package/components/Calendar/stories/CustomThemed/CustomSizeHeading.stories.js +1 -2
- package/components/Calendar/stories/Dual.stories.js +1 -4
- package/components/Calendar/stories/HeaderLevel.stories.js +1 -2
- package/components/Calendar/stories/Multiple.stories.js +1 -2
- package/components/Calendar/stories/ShowAdjacentDays.stories.js +2 -3
- package/components/Calendar/stories/Simple.stories.js +1 -2
- package/components/Card/Card.js +1 -2
- package/components/Cards/Cards.js +1 -2
- package/components/Carousel/Carousel.js +1 -2
- package/components/Carousel/CarouselChild.js +1 -2
- package/components/Carousel/StyledCarousel.js +1 -2
- package/components/Chart/Chart.js +4 -5
- package/components/Chart/StyledChart.js +1 -2
- package/components/Chart/stories/Rich.stories.js +1 -2
- package/components/Chart/stories/Scan.stories.js +1 -2
- package/components/Chart/stories/Window.stories.js +1 -2
- package/components/Chart/stories/Zoom.stories.js +1 -2
- package/components/CheckBox/CheckBox.js +1 -2
- package/components/CheckBox/StyledCheckBox.js +1 -2
- package/components/CheckBox/stories/CustomThemed/Custom.stories.js +1 -2
- package/components/CheckBox/stories/CustomThemed/CustomToggle.stories.js +1 -2
- package/components/CheckBox/stories/Indeterminate.stories.js +1 -2
- package/components/CheckBox/stories/NoLabel.stories.js +1 -2
- package/components/CheckBox/stories/Simple.stories.js +1 -2
- package/components/CheckBox/stories/WithStickyDiv.stories.js +1 -2
- package/components/CheckBoxGroup/CheckBoxGroup.js +15 -4
- package/components/CheckBoxGroup/stories/Children.stories.js +1 -2
- package/components/CheckBoxGroup/stories/InitialValues.stories.js +1 -2
- package/components/Clock/Analog.js +1 -2
- package/components/Clock/Clock.js +1 -2
- package/components/Clock/Digital.js +1 -2
- package/components/Clock/StyledClock.js +1 -2
- package/components/Collapsible/Collapsible.js +1 -2
- package/components/Data/Data.js +1 -2
- package/components/Data/DataForm.js +1 -2
- package/components/Data/index.d.ts +3 -0
- package/components/Data/propTypes.js +4 -1
- package/components/Data/stories/Infinite.stories.js +2 -3
- package/components/Data/stories/Inline.stories.js +1 -2
- package/components/Data/stories/OnSelect.stories.js +2 -3
- package/components/Data/stories/SpaceX.stories.js +2 -3
- package/components/Data/stories/StarWars.stories.js +13 -39
- package/components/DataChart/DataChart.js +4 -5
- package/components/DataChart/Detail.js +1 -2
- package/components/DataChart/Legend.js +1 -2
- package/components/DataChart/XAxis.js +1 -2
- package/components/DataChart/XGuide.js +1 -2
- package/components/DataChart/YAxis.js +1 -2
- package/components/DataChart/YGuide.js +1 -2
- package/components/DataChart/stories/Prediction.stories.js +1 -2
- package/components/DataClearFilters/DataClearFilters.js +1 -2
- package/components/DataClearFilters/stories/Simple.stories.js +1 -2
- package/components/DataFilter/DataFilter.js +5 -3
- package/components/DataFilters/DataFilters.js +1 -2
- package/components/DataSearch/DataSearch.js +1 -2
- package/components/DataSort/DataSort.js +3 -3
- package/components/DataSummary/DataSummary.js +1 -2
- package/components/DataTable/Body.js +106 -35
- package/components/DataTable/Cell.js +1 -2
- package/components/DataTable/DataTable.js +49 -16
- package/components/DataTable/ExpanderCell.js +55 -7
- package/components/DataTable/Footer.js +1 -2
- package/components/DataTable/GroupedBody.js +12 -5
- package/components/DataTable/Header.js +83 -32
- package/components/DataTable/PlaceholderBody.js +1 -2
- package/components/DataTable/Resizer.js +164 -47
- package/components/DataTable/Searcher.js +36 -7
- package/components/DataTable/StyledDataTable.js +2 -3
- package/components/DataTable/index.d.ts +19 -0
- package/components/DataTable/propTypes.js +19 -0
- package/components/DataTable/stories/ControlledGrouped.stories.js +5 -2
- package/components/DataTable/stories/Grouped.stories.js +7 -1
- package/components/DataTable/stories/GroupedOnSelect.stories.js +7 -1
- package/components/DataTable/stories/OnUpdate.stories.js +4 -2
- package/components/DataTable/stories/SpaceX.stories.js +9 -3
- package/components/DataTable/stories/SpaceXUngrouped.stories.js +2 -3
- package/components/DataTable/stories/Styled.stories.js +5 -1
- package/components/DataTable/stories/rowDetails.stories.js +19 -43
- package/components/DataTableColumns/DataTableColumns.js +15 -2
- package/components/DataTableGroupBy/DataTableGroupBy.js +1 -2
- package/components/DataView/DataView.js +1 -2
- package/components/DateInput/DateInput.js +13 -13
- package/components/DateInput/stories/FormatInline.stories.js +1 -2
- package/components/Diagram/Diagram.js +1 -2
- package/components/Diagram/StyledDiagram.js +1 -2
- package/components/Diagram/stories/Animated.stories.js +1 -2
- package/components/Diagram/stories/Progressing.stories.js +1 -2
- package/components/Drop/Drop.js +1 -2
- package/components/Drop/DropContainer.js +1 -2
- package/components/Drop/StyledDrop.js +1 -2
- package/components/Drop/stories/CustomThemed/Lazy.stories.js +1 -2
- package/components/Drop/stories/CustomThemed/Themed.stories.js +1 -2
- package/components/Drop/stories/Inline.stories.js +1 -2
- package/components/Drop/stories/Meter.stories.js +1 -2
- package/components/Drop/stories/Multiple.stories.js +1 -2
- package/components/Drop/stories/Overflow.stories.js +1 -2
- package/components/Drop/stories/Plain.stories.js +1 -2
- package/components/Drop/stories/Progressive.stories.js +1 -2
- package/components/Drop/stories/Simple.stories.js +1 -2
- package/components/Drop/stories/Styled.stories.js +1 -2
- package/components/DropButton/DropButton.js +1 -2
- package/components/FileInput/FileInput.js +38 -6
- package/components/FileInput/index.d.ts +10 -1
- package/components/FileInput/propTypes.js +11 -0
- package/components/FocusedContainer.js +1 -2
- package/components/Form/Form.js +11 -12
- package/components/Form/FormContext.js +1 -2
- package/components/Form/stories/ArrayOfFormFields.stories.js +1 -2
- package/components/Form/stories/Controlled.stories.js +2 -2
- package/components/Form/stories/ControlledInput.stories.js +2 -2
- package/components/Form/stories/ControlledInputLazy.stories.js +2 -2
- package/components/Form/stories/ControlledLazy.stories.js +2 -2
- package/components/Form/stories/CustomThemed/Custom.stories.js +1 -0
- package/components/Form/stories/CustomThemed/FieldBorderPosition.stories.js +1 -2
- package/components/Form/stories/CustomThemed/FieldCustomStates.stories.js +1 -2
- package/components/Form/stories/DynamicFields.stories.js +1 -2
- package/components/Form/stories/FieldStates.stories.js +1 -2
- package/components/Form/stories/FieldWithChildren.stories.js +2 -0
- package/components/Form/stories/SolicitedFeedback.stories.js +1 -2
- package/components/Form/stories/Uncontrolled.stories.js +1 -0
- package/components/Form/stories/UnsolicitedFeedback.stories.js +1 -2
- package/components/Form/stories/ValidateOnBlur.stories.js +1 -1
- package/components/Form/stories/ValidateOnChange.stories.js +1 -2
- package/components/Form/stories/ValidateOnMount.stories.js +1 -2
- package/components/Form/stories/typescript/TypedForm.stories.tsx +7 -1
- package/components/FormField/FormField.js +23 -3
- package/components/FormField/stories/Simple.stories.js +1 -2
- package/components/Grid/Grid.js +1 -2
- package/components/Grid/StyledGrid.js +1 -2
- package/components/Grid/stories/ResponsiveCards.stories.js +1 -2
- package/components/Grommet/Grommet.js +1 -2
- package/components/Grommet/StyledGrommet.js +1 -2
- package/components/Grommet/index.d.ts +30 -0
- package/components/Grommet/propTypes.js +31 -1
- package/components/Header/Header.js +1 -2
- package/components/Header/stories/Sticky.stories.js +1 -2
- package/components/Heading/Heading.js +1 -2
- package/components/Heading/HeadingSkeleton.js +1 -2
- package/components/Heading/StyledHeading.js +1 -2
- package/components/Image/Image.js +1 -2
- package/components/Image/StyledImage.js +1 -2
- package/components/InfiniteScroll/InfiniteScroll.js +1 -2
- package/components/Layer/Layer.js +37 -13
- package/components/Layer/LayerContainer.js +19 -17
- package/components/Layer/StyledLayer.js +1 -2
- package/components/Layer/stories/Form.stories.js +1 -1
- package/components/List/List.js +135 -146
- package/components/List/index.d.ts +3 -0
- package/components/List/propTypes.js +3 -0
- package/components/List/stories/Order.stories.js +1 -2
- package/components/List/stories/Pinned.stories.js +1 -2
- package/components/Markdown/Markdown.js +1 -2
- package/components/MaskedInput/MaskedInput.js +1 -2
- package/components/Menu/Menu.js +1 -2
- package/components/Meter/Bar.js +1 -2
- package/components/Meter/Circle.js +1 -2
- package/components/Meter/Meter.js +1 -2
- package/components/Meter/StyledMeter.js +1 -2
- package/components/Meter/stories/Circle.stories.js +1 -2
- package/components/Meter/stories/VerticalBarMultiple.stories.js +1 -2
- package/components/NameValueList/NameValueList.js +1 -2
- package/components/NameValuePair/NameValuePair.js +1 -2
- package/components/Nav/stories/CustomThemed/JustifySidebar.stories.js +1 -2
- package/components/Nav/stories/Sidebar.stories.js +1 -2
- package/components/Notification/Notification.js +21 -6
- package/components/Notification/index.d.ts +3 -0
- package/components/Notification/propTypes.js +3 -0
- package/components/Notification/stories/Global.stories.js +1 -2
- package/components/Notification/stories/Title.stories.js +1 -2
- package/components/Notification/stories/TitleAndMessage.stories.js +1 -2
- package/components/Page/Page.js +1 -2
- package/components/Page/stories/PageNotificaton.stories.js +1 -2
- package/components/PageContent/PageContent.js +1 -2
- package/components/PageHeader/PageHeader.js +1 -2
- package/components/PageHeader/stories/MultipleActions.stories.js +1 -2
- package/components/Pagination/Pagination.js +1 -2
- package/components/Pagination/PaginationStep.js +1 -2
- package/components/Pagination/PaginationSummary.js +1 -2
- package/components/Pagination/stories/Grid.stories.js +1 -2
- package/components/Paragraph/Paragraph.js +1 -2
- package/components/Paragraph/ParagraphSkeleton.js +1 -2
- package/components/Paragraph/StyledParagraph.js +1 -2
- package/components/RadioButton/RadioButton.js +1 -2
- package/components/RadioButton/StyledRadioButton.js +3 -4
- package/components/RadioButtonGroup/RadioButtonGroup.js +17 -7
- package/components/RadioButtonGroup/stories/Children.stories.js +1 -2
- package/components/RadioButtonGroup/stories/CustomThemed/CustomTheme.stories.js +1 -2
- package/components/RadioButtonGroup/stories/Disabled.stories.js +1 -2
- package/components/RangeInput/RangeInput.js +2 -3
- package/components/RangeInput/StyledRangeInput.js +1 -2
- package/components/RangeInput/stories/CustomThemed/Bounds.stories.js +1 -2
- package/components/RangeSelector/EdgeControl.js +56 -13
- package/components/RangeSelector/RangeSelector.js +12 -25
- package/components/RangeSelector/stories/Basic.stories.js +1 -2
- package/components/RangeSelector/stories/CustomThemed/Custom.stories.js +1 -2
- package/components/RangeSelector/stories/CustomThemed/CustomEdgeControl.stories.js +1 -2
- package/components/RangeSelector/stories/Label.stories.js +1 -2
- package/components/RangeSelector/stories/Simple.stories.js +1 -2
- package/components/RangeSelector/stories/Step.stories.js +1 -2
- package/components/RangeSelector/stories/Thin.stories.js +1 -2
- package/components/RangeSelector/stories/Vertical.stories.js +1 -2
- package/components/RoutedAnchor/RoutedAnchor.js +1 -2
- package/components/RoutedButton/RoutedButton.js +1 -2
- package/components/Select/DefaultSelectTextInput.js +1 -2
- package/components/Select/Select.js +17 -4
- package/components/Select/SelectContainer.js +33 -10
- package/components/Select/stories/ChildrenRender.stories.js +1 -2
- package/components/Select/stories/Clear.stories.js +1 -2
- package/components/Select/stories/Controlled.stories.js +1 -2
- package/components/Select/stories/CustomThemed/CustomSearch.stories.js +1 -2
- package/components/Select/stories/Disabled.stories.js +1 -2
- package/components/Select/stories/InsideFormField.stories.js +1 -2
- package/components/Select/stories/Multiple.stories.js +1 -2
- package/components/Select/stories/ObjectOptions.stories.js +1 -2
- package/components/Select/stories/Search.stories.js +1 -2
- package/components/Select/stories/Simple.stories.js +1 -2
- package/components/Select/stories/ValueLabel.stories.js +1 -2
- package/components/Select/stories/components/SearchBorderBox.js +1 -2
- package/components/Select/stories/components/SearchInput.js +1 -2
- package/components/Select/utils.js +13 -4
- package/components/SelectMultiple/SelectMultiple.js +32 -19
- package/components/SelectMultiple/SelectMultipleContainer.js +26 -17
- package/components/SelectMultiple/SelectMultipleValue.js +1 -2
- package/components/SelectMultiple/SelectionSummary.js +1 -2
- package/components/SelectMultiple/stories/CustomMessages.stories.js +1 -2
- package/components/SelectMultiple/stories/Default.stories.js +1 -2
- package/components/SelectMultiple/stories/Disabled.stories.js +1 -2
- package/components/SelectMultiple/stories/FormField.stories.js +1 -2
- package/components/SelectMultiple/stories/Help.stories.js +1 -2
- package/components/SelectMultiple/stories/Limited.stories.js +1 -2
- package/components/SelectMultiple/stories/ObjectOptions.stories.js +1 -2
- package/components/SelectMultiple/stories/ShowSelectedInline.stories.js +1 -2
- package/components/Skeleton/Skeleton.js +6 -3
- package/components/Skeleton/SkeletonContext.js +1 -2
- package/components/Skeleton/stories/CustomThemed/Custom.stories.js +1 -4
- package/components/Skeleton/stories/GridContainer.stories.js +1 -2
- package/components/Skeleton/stories/Simple.stories.js +0 -1
- package/components/SkipLink/SkipLink.js +1 -2
- package/components/SkipLinks/SkipLinks.js +1 -2
- package/components/Spinner/Spinner.js +1 -2
- package/components/Spinner/stories/Animation.stories.js +1 -2
- package/components/Spinner/stories/Announced.stories.js +1 -2
- package/components/Stack/Stack.js +1 -2
- package/components/Stack/StyledStack.js +1 -2
- package/components/StarRating/StarRating.js +1 -2
- package/components/Tab/StyledTab.js +1 -2
- package/components/Tab/Tab.js +1 -2
- package/components/Table/StyledTable.js +1 -2
- package/components/Table/Table.js +1 -2
- package/components/Table/stories/InfiniteScrollInTable.stories.js +1 -2
- package/components/TableBody/TableBody.js +1 -2
- package/components/TableCell/TableCell.js +21 -5
- package/components/TableFooter/TableFooter.js +1 -2
- package/components/TableHeader/TableHeader.js +1 -2
- package/components/TableRow/TableRow.js +1 -2
- package/components/Tabs/StyledTabs.js +1 -2
- package/components/Tabs/Tabs.js +1 -2
- package/components/Tabs/stories/CustomThemed/States.stories.js +1 -2
- package/components/Tabs/stories/Responsive.stories.js +1 -2
- package/components/Tag/Tag.js +1 -2
- package/components/Text/StyledText.js +1 -2
- package/components/Text/Text.js +1 -2
- package/components/Text/TextSkeleton.js +1 -2
- package/components/TextArea/StyledTextArea.js +1 -2
- package/components/TextArea/TextArea.js +1 -2
- package/components/TextArea/stories/CustomThemed/Themed.stories.js +1 -2
- package/components/TextArea/stories/InsideFormField.stories.js +1 -2
- package/components/TextArea/stories/NonResizable.stories.js +1 -2
- package/components/TextArea/stories/Simple.stories.js +1 -2
- package/components/TextInput/CopyButton.js +3 -1
- package/components/TextInput/StyledTextInput.js +1 -2
- package/components/TextInput/TextInput.js +5 -3
- package/components/TextInput/stories/InsideFormField.stories.js +1 -2
- package/components/Tip/Tip.js +1 -2
- package/components/Tip/stories/HeaderActions.stories.js +1 -2
- package/components/ToggleGroup/ToggleGroup.js +1 -2
- package/components/ToggleGroup/stories/Controlled.stories.js +1 -2
- package/components/Toolbar/Toolbar.js +1 -2
- package/components/Video/StyledVideo.js +1 -2
- package/components/Video/Video.js +13 -14
- package/components/WorldMap/WorldMap.js +1 -2
- package/contexts/AnalyticsContext/AnalyticsContext.js +1 -2
- package/contexts/AnnounceContext/AnnounceContext.js +28 -5
- package/contexts/AnnounceContext/stories/Polite.stories.js +1 -2
- package/contexts/RootsContext.js +1 -2
- package/contexts/ThemeContext/stories/ThemeContextExtend.stories.js +1 -2
- package/es6/components/Anchor/Anchor.js +4 -4
- package/es6/components/Box/Box.js +5 -1
- package/es6/components/Box/StyledBox.js +4 -2
- package/es6/components/Button/StyledButton.js +3 -1
- package/es6/components/Button/StyledButtonKind.js +3 -1
- package/es6/components/Button/index.d.ts +1 -1
- package/es6/components/Button/propTypes.js +1 -1
- package/es6/components/Calendar/Calendar.js +151 -128
- package/es6/components/Calendar/StyledCalendar.js +34 -36
- package/es6/components/Calendar/stories/Dual.stories.js +0 -2
- package/es6/components/Calendar/stories/ShowAdjacentDays.stories.js +1 -1
- package/es6/components/Chart/Chart.js +3 -3
- package/es6/components/CheckBoxGroup/CheckBoxGroup.js +14 -2
- package/es6/components/Data/index.d.ts +3 -0
- package/es6/components/Data/propTypes.js +4 -1
- package/es6/components/Data/stories/Infinite.stories.js +1 -1
- package/es6/components/Data/stories/OnSelect.stories.js +1 -1
- package/es6/components/Data/stories/SpaceX.stories.js +1 -1
- package/es6/components/Data/stories/StarWars.stories.js +13 -38
- package/es6/components/DataChart/DataChart.js +3 -3
- package/es6/components/DataFilter/DataFilter.js +4 -1
- package/es6/components/DataSort/DataSort.js +2 -1
- package/es6/components/DataTable/Body.js +106 -33
- package/es6/components/DataTable/DataTable.js +48 -14
- package/es6/components/DataTable/ExpanderCell.js +54 -6
- package/es6/components/DataTable/GroupedBody.js +11 -3
- package/es6/components/DataTable/Header.js +82 -30
- package/es6/components/DataTable/Resizer.js +165 -46
- package/es6/components/DataTable/Searcher.js +36 -6
- package/es6/components/DataTable/StyledDataTable.js +1 -1
- package/es6/components/DataTable/index.d.ts +19 -0
- package/es6/components/DataTable/propTypes.js +19 -0
- package/es6/components/DataTable/stories/ControlledGrouped.stories.js +4 -0
- package/es6/components/DataTable/stories/Grouped.stories.js +7 -1
- package/es6/components/DataTable/stories/GroupedOnSelect.stories.js +7 -1
- package/es6/components/DataTable/stories/OnUpdate.stories.js +3 -0
- package/es6/components/DataTable/stories/SpaceX.stories.js +8 -1
- package/es6/components/DataTable/stories/SpaceXUngrouped.stories.js +1 -1
- package/es6/components/DataTable/stories/Styled.stories.js +5 -1
- package/es6/components/DataTable/stories/rowDetails.stories.js +19 -42
- package/es6/components/DataTableColumns/DataTableColumns.js +14 -0
- package/es6/components/DateInput/DateInput.js +13 -12
- package/es6/components/FileInput/FileInput.js +37 -4
- package/es6/components/FileInput/index.d.ts +10 -1
- package/es6/components/FileInput/propTypes.js +11 -0
- package/es6/components/Form/Form.js +10 -10
- package/es6/components/Form/stories/Controlled.stories.js +1 -0
- package/es6/components/Form/stories/ControlledInput.stories.js +1 -0
- package/es6/components/Form/stories/ControlledInputLazy.stories.js +1 -0
- package/es6/components/Form/stories/ControlledLazy.stories.js +1 -0
- package/es6/components/Form/stories/CustomThemed/Custom.stories.js +1 -0
- package/es6/components/Form/stories/FieldWithChildren.stories.js +2 -0
- package/es6/components/Form/stories/Uncontrolled.stories.js +1 -0
- package/es6/components/Form/stories/ValidateOnBlur.stories.js +1 -1
- package/es6/components/Form/stories/typescript/TypedForm.stories.tsx +7 -1
- package/es6/components/FormField/FormField.js +22 -1
- package/es6/components/Grommet/index.d.ts +30 -0
- package/es6/components/Grommet/propTypes.js +31 -1
- package/es6/components/Layer/Layer.js +37 -12
- package/es6/components/Layer/LayerContainer.js +20 -16
- package/es6/components/Layer/stories/Form.stories.js +1 -1
- package/es6/components/List/List.js +136 -146
- package/es6/components/List/index.d.ts +3 -0
- package/es6/components/List/propTypes.js +3 -0
- package/es6/components/Notification/Notification.js +22 -5
- package/es6/components/Notification/index.d.ts +3 -0
- package/es6/components/Notification/propTypes.js +3 -0
- package/es6/components/RadioButton/StyledRadioButton.js +2 -2
- package/es6/components/RadioButtonGroup/RadioButtonGroup.js +16 -5
- package/es6/components/RangeInput/RangeInput.js +1 -1
- package/es6/components/RangeSelector/EdgeControl.js +57 -12
- package/es6/components/RangeSelector/RangeSelector.js +11 -23
- package/es6/components/Select/Select.js +17 -3
- package/es6/components/Select/SelectContainer.js +32 -8
- package/es6/components/Select/utils.js +11 -1
- package/es6/components/SelectMultiple/SelectMultiple.js +32 -18
- package/es6/components/SelectMultiple/SelectMultipleContainer.js +25 -15
- package/es6/components/Skeleton/Skeleton.js +5 -1
- package/es6/components/Skeleton/stories/CustomThemed/Custom.stories.js +0 -2
- package/es6/components/Skeleton/stories/Simple.stories.js +0 -1
- package/es6/components/TableCell/TableCell.js +20 -3
- package/es6/components/TextInput/CopyButton.js +3 -1
- package/es6/components/TextInput/TextInput.js +4 -1
- package/es6/components/Video/Video.js +12 -12
- package/es6/contexts/AnnounceContext/AnnounceContext.js +28 -5
- package/es6/languages/default.json +33 -3
- package/es6/themes/base.d.ts +20 -0
- package/es6/themes/base.js +22 -8
- package/es6/utils/styles.js +53 -45
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/languages/default.json +33 -3
- package/package.json +32 -32
- package/themes/base.d.ts +20 -0
- package/themes/base.js +22 -8
- package/utils/styles.js +53 -45
- package/utils/useId.js +1 -2
|
@@ -106,7 +106,7 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
106
106
|
name: name,
|
|
107
107
|
value: valueProp,
|
|
108
108
|
initialValue: [],
|
|
109
|
-
validate: [maxSize ? function () {
|
|
109
|
+
validate: [typeof maxSize === 'number' ? function () {
|
|
110
110
|
var fileList = [].concat(files);
|
|
111
111
|
var message = '';
|
|
112
112
|
var numOfInvalidFiles = fileList.filter(function (_ref2) {
|
|
@@ -114,6 +114,7 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
114
114
|
return size > maxSize;
|
|
115
115
|
}).length;
|
|
116
116
|
if (numOfInvalidFiles) {
|
|
117
|
+
var _fileList$find;
|
|
117
118
|
var messageId = 'fileInput.maxSizeSingle';
|
|
118
119
|
if (multiple) {
|
|
119
120
|
messageId = "fileInput.maxSizeMultiple." + (numOfInvalidFiles === 1 ? 'singular' : 'plural');
|
|
@@ -122,6 +123,10 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
122
123
|
id: messageId,
|
|
123
124
|
messages: messages,
|
|
124
125
|
values: {
|
|
126
|
+
fileName: (_fileList$find = fileList.find(function (_ref3) {
|
|
127
|
+
var size = _ref3.size;
|
|
128
|
+
return size > maxSize;
|
|
129
|
+
})) == null ? void 0 : _fileList$find.name,
|
|
125
130
|
maxSize: formatBytes(maxSize),
|
|
126
131
|
numOfFiles: numOfInvalidFiles
|
|
127
132
|
}
|
|
@@ -262,6 +267,9 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
262
267
|
multiple: multiple,
|
|
263
268
|
disabled: disabled,
|
|
264
269
|
plain: true,
|
|
270
|
+
"aria-invalid": maxSize && files.some(function (f) {
|
|
271
|
+
return f.size > maxSize;
|
|
272
|
+
}) || max != null && files.length > max,
|
|
265
273
|
rightOffset: rightOffset
|
|
266
274
|
}, passThemeFlag, rest, {
|
|
267
275
|
onDragOver: function onDragOver() {
|
|
@@ -315,6 +323,7 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
315
323
|
// The focus here is redundant for keyboard users
|
|
316
324
|
, {
|
|
317
325
|
tabIndex: -1,
|
|
326
|
+
disabled: disabled,
|
|
318
327
|
ref: controlRef,
|
|
319
328
|
kind: theme.fileInput.button,
|
|
320
329
|
label: format({
|
|
@@ -330,6 +339,7 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
330
339
|
, {
|
|
331
340
|
tabIndex: -1,
|
|
332
341
|
alignSelf: "center",
|
|
342
|
+
disabled: disabled,
|
|
333
343
|
ref: controlRef,
|
|
334
344
|
margin: "small",
|
|
335
345
|
onClick: function onClick() {
|
|
@@ -381,6 +391,7 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
381
391
|
// The focus here is redundant for keyboard users
|
|
382
392
|
, {
|
|
383
393
|
tabIndex: -1,
|
|
394
|
+
disabled: disabled,
|
|
384
395
|
ref: controlRef,
|
|
385
396
|
kind: theme.fileInput.button,
|
|
386
397
|
label: format({
|
|
@@ -396,6 +407,7 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
396
407
|
, {
|
|
397
408
|
tabIndex: -1,
|
|
398
409
|
alignSelf: "center",
|
|
410
|
+
disabled: disabled,
|
|
399
411
|
ref: controlRef,
|
|
400
412
|
margin: "small",
|
|
401
413
|
onClick: function onClick() {
|
|
@@ -407,6 +419,12 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
407
419
|
messages: messages
|
|
408
420
|
})
|
|
409
421
|
})))), files.length > 0 && files.length <= aggregateThreshold && files.map(function (file, index) {
|
|
422
|
+
var messageId = '';
|
|
423
|
+
if (maxSize && file.size > maxSize) {
|
|
424
|
+
messageId = 'fileInput.alert.maxSize';
|
|
425
|
+
} else if (max && index >= max) {
|
|
426
|
+
messageId = 'fileInput.alert.maxFile';
|
|
427
|
+
}
|
|
410
428
|
return /*#__PURE__*/React.createElement(Box, {
|
|
411
429
|
key: file.name,
|
|
412
430
|
justify: "between",
|
|
@@ -416,7 +434,17 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
416
434
|
gap: "xsmall",
|
|
417
435
|
align: "center",
|
|
418
436
|
direction: "row"
|
|
419
|
-
}), (maxSize && file.size > maxSize || max && index >= max) && /*#__PURE__*/React.createElement(CircleAlert,
|
|
437
|
+
}), (typeof maxSize === 'number' && file.size > maxSize || typeof max === 'number' && index >= max) && /*#__PURE__*/React.createElement(CircleAlert, {
|
|
438
|
+
a11yTitle: format({
|
|
439
|
+
id: messageId,
|
|
440
|
+
messages: messages,
|
|
441
|
+
values: {
|
|
442
|
+
maxFile: max,
|
|
443
|
+
fileName: file.name,
|
|
444
|
+
maxSize: formatBytes(maxSize)
|
|
445
|
+
}
|
|
446
|
+
})
|
|
447
|
+
}), /*#__PURE__*/React.createElement(Label, _extends({
|
|
420
448
|
weight: theme.global.input.weight || theme.global.input.font.weight,
|
|
421
449
|
truncate: true
|
|
422
450
|
}, passThemeFlag), file.name)), /*#__PURE__*/React.createElement(Box, {
|
|
@@ -427,8 +455,11 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
427
455
|
ref: index ? undefined : removeRef,
|
|
428
456
|
a11yTitle: format({
|
|
429
457
|
id: 'fileInput.remove',
|
|
430
|
-
messages: messages
|
|
431
|
-
|
|
458
|
+
messages: messages,
|
|
459
|
+
values: {
|
|
460
|
+
fileName: file.name
|
|
461
|
+
}
|
|
462
|
+
}),
|
|
432
463
|
icon: /*#__PURE__*/React.createElement(RemoveIcon, null),
|
|
433
464
|
hoverIndicator: true,
|
|
434
465
|
disabled: disabled,
|
|
@@ -453,6 +484,7 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
453
484
|
// The focus here is redundant for keyboard users
|
|
454
485
|
, {
|
|
455
486
|
tabIndex: -1,
|
|
487
|
+
disabled: disabled,
|
|
456
488
|
ref: controlRef,
|
|
457
489
|
kind: theme.fileInput.button,
|
|
458
490
|
label: format({
|
|
@@ -467,6 +499,7 @@ var FileInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
467
499
|
// The focus here is redundant for keyboard users
|
|
468
500
|
, {
|
|
469
501
|
tabIndex: -1,
|
|
502
|
+
disabled: disabled,
|
|
470
503
|
ref: controlRef,
|
|
471
504
|
margin: "small",
|
|
472
505
|
onClick: function onClick() {
|
|
@@ -12,13 +12,22 @@ export interface FileInputProps {
|
|
|
12
12
|
id?: string;
|
|
13
13
|
maxSize?: number;
|
|
14
14
|
messages?: {
|
|
15
|
+
alert?: {
|
|
16
|
+
maxFile?: string;
|
|
17
|
+
maxSize?: string;
|
|
18
|
+
};
|
|
15
19
|
browse?: string;
|
|
16
20
|
dropPrompt?: string;
|
|
17
21
|
dropPromptMultiple?: string;
|
|
18
22
|
files?: string;
|
|
23
|
+
maxFile?: string;
|
|
24
|
+
maxSizeSingle?: string;
|
|
25
|
+
maxSizeMultiple?: {
|
|
26
|
+
singular?: string;
|
|
27
|
+
plural?: string;
|
|
28
|
+
};
|
|
19
29
|
remove?: string;
|
|
20
30
|
removeAll?: string;
|
|
21
|
-
maxFile?: string;
|
|
22
31
|
};
|
|
23
32
|
multiple?: boolean | { aggregateThreshold?: number; max?: number };
|
|
24
33
|
name?: string;
|
|
@@ -5,11 +5,22 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
5
5
|
confirmRemove: PropTypes.func,
|
|
6
6
|
disabled: PropTypes.bool,
|
|
7
7
|
id: PropTypes.string,
|
|
8
|
+
maxSize: PropTypes.number,
|
|
8
9
|
messages: PropTypes.shape({
|
|
10
|
+
alert: PropTypes.shape({
|
|
11
|
+
maxFile: PropTypes.string,
|
|
12
|
+
maxSize: PropTypes.string
|
|
13
|
+
}),
|
|
9
14
|
browse: PropTypes.string,
|
|
10
15
|
dropPrompt: PropTypes.string,
|
|
11
16
|
dropPromptMultiple: PropTypes.string,
|
|
12
17
|
files: PropTypes.string,
|
|
18
|
+
maxFile: PropTypes.string,
|
|
19
|
+
maxSizeSingle: PropTypes.string,
|
|
20
|
+
maxSizeMultiple: PropTypes.shape({
|
|
21
|
+
singular: PropTypes.string,
|
|
22
|
+
plural: PropTypes.string
|
|
23
|
+
}),
|
|
13
24
|
remove: PropTypes.string,
|
|
14
25
|
removeAll: PropTypes.string
|
|
15
26
|
}),
|
|
@@ -532,22 +532,22 @@ var Form = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
532
532
|
if (initialValue !== undefined) setInputValue(nextComponentValue);
|
|
533
533
|
}];
|
|
534
534
|
};
|
|
535
|
-
var useFormField = function useFormField(
|
|
536
|
-
var errorArg =
|
|
537
|
-
infoArg =
|
|
538
|
-
name =
|
|
539
|
-
required =
|
|
540
|
-
disabled =
|
|
541
|
-
validateArg =
|
|
542
|
-
validateOnArg =
|
|
535
|
+
var useFormField = function useFormField(_ref0) {
|
|
536
|
+
var errorArg = _ref0.error,
|
|
537
|
+
infoArg = _ref0.info,
|
|
538
|
+
name = _ref0.name,
|
|
539
|
+
required = _ref0.required,
|
|
540
|
+
disabled = _ref0.disabled,
|
|
541
|
+
validateArg = _ref0.validate,
|
|
542
|
+
validateOnArg = _ref0.validateOn;
|
|
543
543
|
var error = disabled ? undefined : errorArg || validationResults.errors[name];
|
|
544
544
|
var info = infoArg || validationResults.infos[name];
|
|
545
545
|
useEffect(function () {
|
|
546
546
|
setValidateOn(function (prevValues) {
|
|
547
547
|
var _extends2;
|
|
548
548
|
if (typeof prevValues === 'string') {
|
|
549
|
-
var
|
|
550
|
-
return
|
|
549
|
+
var _ref1;
|
|
550
|
+
return _ref1 = {}, _ref1[name] = validateOnArg || validateOnProp, _ref1;
|
|
551
551
|
}
|
|
552
552
|
return _extends({}, prevValues, (_extends2 = {}, _extends2[name] = validateOnArg || validateOnProp, _extends2));
|
|
553
553
|
});
|
|
@@ -76,6 +76,7 @@ export var Controlled = function Controlled() {
|
|
|
76
76
|
name: "subscribe",
|
|
77
77
|
label: "Subscribe?"
|
|
78
78
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
79
|
+
label: "Time of day",
|
|
79
80
|
htmlFor: "ampm",
|
|
80
81
|
name: "ampm"
|
|
81
82
|
}, /*#__PURE__*/React.createElement(RadioButtonGroup, {
|
|
@@ -98,6 +98,7 @@ export var ControlledInput = function ControlledInput() {
|
|
|
98
98
|
return setSubscribe(event.target.checked);
|
|
99
99
|
}
|
|
100
100
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
101
|
+
label: "Time of day",
|
|
101
102
|
htmlFor: "ampm",
|
|
102
103
|
name: "ampm"
|
|
103
104
|
}, /*#__PURE__*/React.createElement(RadioButtonGroup, {
|
|
@@ -107,6 +107,7 @@ export var ControlledInputLazy = function ControlledInputLazy() {
|
|
|
107
107
|
return setSubscribe(event.target.checked);
|
|
108
108
|
}
|
|
109
109
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
110
|
+
label: "Time of day",
|
|
110
111
|
htmlFor: "ampm",
|
|
111
112
|
name: "ampm"
|
|
112
113
|
}, /*#__PURE__*/React.createElement(RadioButtonGroup, {
|
|
@@ -84,6 +84,7 @@ export var ControlledLazy = function ControlledLazy() {
|
|
|
84
84
|
name: "subscribe",
|
|
85
85
|
label: "Subscribe?"
|
|
86
86
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
87
|
+
label: "Time of day",
|
|
87
88
|
htmlFor: "ampm",
|
|
88
89
|
name: "ampm"
|
|
89
90
|
}, /*#__PURE__*/React.createElement(RadioButtonGroup, {
|
|
@@ -98,6 +98,7 @@ export var Custom = function Custom() {
|
|
|
98
98
|
name: "subscribe",
|
|
99
99
|
label: "Subscribe?"
|
|
100
100
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
101
|
+
label: "Time of day",
|
|
101
102
|
htmlFor: "ampm",
|
|
102
103
|
name: "ampm"
|
|
103
104
|
}, /*#__PURE__*/React.createElement(RadioButtonGroup, {
|
|
@@ -83,6 +83,7 @@ export var FieldWithChildren = function FieldWithChildren() {
|
|
|
83
83
|
id: "password",
|
|
84
84
|
type: "password"
|
|
85
85
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
86
|
+
label: "Subscription options",
|
|
86
87
|
htmlFor: "subscription",
|
|
87
88
|
name: "subscription"
|
|
88
89
|
}, /*#__PURE__*/React.createElement(CheckBoxGroup, {
|
|
@@ -90,6 +91,7 @@ export var FieldWithChildren = function FieldWithChildren() {
|
|
|
90
91
|
id: "subscription",
|
|
91
92
|
options: ['subscribe', 'receive email notifications']
|
|
92
93
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
94
|
+
label: "Time of day",
|
|
93
95
|
htmlFor: "ampm",
|
|
94
96
|
name: "ampm"
|
|
95
97
|
}, /*#__PURE__*/React.createElement(RadioButtonGroup, {
|
|
@@ -58,6 +58,7 @@ export var Uncontrolled = function Uncontrolled() {
|
|
|
58
58
|
name: "subscribe",
|
|
59
59
|
label: "Subscribe?"
|
|
60
60
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
61
|
+
label: "Time of day",
|
|
61
62
|
htmlFor: "ampm",
|
|
62
63
|
name: "ampm"
|
|
63
64
|
}, /*#__PURE__*/React.createElement(RadioButtonGroup, {
|
|
@@ -57,7 +57,7 @@ export var ValidateOnBlur = function ValidateOnBlur() {
|
|
|
57
57
|
})), /*#__PURE__*/React.createElement(FormField, {
|
|
58
58
|
label: "Size",
|
|
59
59
|
name: "select-size",
|
|
60
|
-
htmlFor: "select-
|
|
60
|
+
htmlFor: "select-size",
|
|
61
61
|
required: true,
|
|
62
62
|
validate: function validate(val) {
|
|
63
63
|
if (val === 'small') {
|
|
@@ -84,7 +84,13 @@ export const TypedForm = () => {
|
|
|
84
84
|
<FormField name="subscribe" pad>
|
|
85
85
|
<CheckBox label="Subscribe?" name="subscribe" id="subscribe" />
|
|
86
86
|
</FormField>
|
|
87
|
-
<FormField
|
|
87
|
+
<FormField
|
|
88
|
+
label="Time of day"
|
|
89
|
+
name="ampm"
|
|
90
|
+
htmlFor="ampm"
|
|
91
|
+
pad
|
|
92
|
+
options={['morning', 'evening']}
|
|
93
|
+
>
|
|
88
94
|
<RadioButtonGroup
|
|
89
95
|
name="ampm"
|
|
90
96
|
id="ampm"
|
|
@@ -399,6 +399,26 @@ var FormField = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
399
399
|
}, "*"), /*#__PURE__*/React.createElement(ScreenReaderOnly, null, "required"));
|
|
400
400
|
var showRequiredIndicator = required && requiredIndicator;
|
|
401
401
|
if (typeof required === 'object' && required.indicator === false) showRequiredIndicator = false;
|
|
402
|
+
|
|
403
|
+
// Check if child is Select or SelectMultiple and modify htmlFor if needed
|
|
404
|
+
var adjustedHtmlFor = htmlFor;
|
|
405
|
+
if (htmlFor) {
|
|
406
|
+
var isSelectComponent = false;
|
|
407
|
+
|
|
408
|
+
// Check if children contain Select or SelectMultiple
|
|
409
|
+
if (children) {
|
|
410
|
+
Children.forEach(children, function (child) {
|
|
411
|
+
if (child && child.type && (child.type.displayName === 'Select' || child.type.displayName === 'SelectMultiple') && child.props.id === htmlFor) {
|
|
412
|
+
isSelectComponent = true;
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
// If it's a Select component and htmlFor doesn't end with __input, add it
|
|
418
|
+
if (isSelectComponent && !htmlFor.endsWith('__input')) {
|
|
419
|
+
adjustedHtmlFor = htmlFor + "__input";
|
|
420
|
+
}
|
|
421
|
+
}
|
|
402
422
|
return /*#__PURE__*/React.createElement(FormFieldBox, _extends({
|
|
403
423
|
ref: formFieldRef,
|
|
404
424
|
className: className,
|
|
@@ -438,7 +458,8 @@ var FormField = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
438
458
|
} : undefined
|
|
439
459
|
}, containerRest, passThemeFlag), label && component !== CheckBox || help ? /*#__PURE__*/React.createElement(React.Fragment, null, label && component !== CheckBox && /*#__PURE__*/React.createElement(Text, _extends({
|
|
440
460
|
as: "label",
|
|
441
|
-
htmlFor:
|
|
461
|
+
id: htmlFor ? "grommet-" + adjustedHtmlFor + "__label" : undefined,
|
|
462
|
+
htmlFor: adjustedHtmlFor
|
|
442
463
|
}, labelStyle), label, showRequiredIndicator ? requiredIndicator : undefined), /*#__PURE__*/React.createElement(Message, _extends({
|
|
443
464
|
message: help
|
|
444
465
|
}, themeHelpProps))) : undefined, contents, /*#__PURE__*/React.createElement(Message, _extends({
|
|
@@ -77,11 +77,31 @@ export interface GrommetProps {
|
|
|
77
77
|
total?: string;
|
|
78
78
|
totalSingle?: string;
|
|
79
79
|
};
|
|
80
|
+
dataTable?: {
|
|
81
|
+
ascending?: string;
|
|
82
|
+
collapse?: string;
|
|
83
|
+
collapseAll?: string;
|
|
84
|
+
decrease?: string;
|
|
85
|
+
descending?: string;
|
|
86
|
+
increase?: string;
|
|
87
|
+
expand?: string;
|
|
88
|
+
expandAll?: string;
|
|
89
|
+
resizerAria?: string;
|
|
90
|
+
rows?: string;
|
|
91
|
+
rowsChanged?: string;
|
|
92
|
+
rowsSingle?: string;
|
|
93
|
+
searchBy?: string;
|
|
94
|
+
total?: string;
|
|
95
|
+
totalSingle?: string;
|
|
96
|
+
};
|
|
80
97
|
dataTableColumns?: {
|
|
81
98
|
open?: string;
|
|
82
99
|
order?: string;
|
|
100
|
+
pinned?: string;
|
|
83
101
|
select?: string;
|
|
84
102
|
tip?: string;
|
|
103
|
+
orderAria?: string;
|
|
104
|
+
selectAria?: string;
|
|
85
105
|
};
|
|
86
106
|
dataTableGroupBy?: {
|
|
87
107
|
clear?: string;
|
|
@@ -91,6 +111,10 @@ export interface GrommetProps {
|
|
|
91
111
|
label?: string;
|
|
92
112
|
};
|
|
93
113
|
fileInput?: {
|
|
114
|
+
alert?: {
|
|
115
|
+
maxFile?: string;
|
|
116
|
+
maxSize?: string;
|
|
117
|
+
};
|
|
94
118
|
browse?: string;
|
|
95
119
|
dropPrompt?: string;
|
|
96
120
|
dropPromptMultiple?: string;
|
|
@@ -120,6 +144,9 @@ export interface GrommetProps {
|
|
|
120
144
|
};
|
|
121
145
|
};
|
|
122
146
|
};
|
|
147
|
+
list?: {
|
|
148
|
+
pinned?: string;
|
|
149
|
+
};
|
|
123
150
|
menu?: {
|
|
124
151
|
openMenu?: string;
|
|
125
152
|
closeMenu?: string;
|
|
@@ -142,6 +169,9 @@ export interface GrommetProps {
|
|
|
142
169
|
plural?: string;
|
|
143
170
|
};
|
|
144
171
|
};
|
|
172
|
+
notification?: {
|
|
173
|
+
close?: string;
|
|
174
|
+
};
|
|
145
175
|
pagination?: {
|
|
146
176
|
stepLabel?: string;
|
|
147
177
|
summary?: string;
|
|
@@ -79,11 +79,31 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
79
79
|
total: PropTypes.string,
|
|
80
80
|
totalSingle: PropTypes.string
|
|
81
81
|
}),
|
|
82
|
+
dataTable: PropTypes.shape({
|
|
83
|
+
ascending: PropTypes.string,
|
|
84
|
+
collapse: PropTypes.string,
|
|
85
|
+
collapseAll: PropTypes.string,
|
|
86
|
+
decrease: PropTypes.string,
|
|
87
|
+
descending: PropTypes.string,
|
|
88
|
+
increase: PropTypes.string,
|
|
89
|
+
expand: PropTypes.string,
|
|
90
|
+
expandAll: PropTypes.string,
|
|
91
|
+
resizerAria: PropTypes.string,
|
|
92
|
+
rows: PropTypes.string,
|
|
93
|
+
rowsChanged: PropTypes.string,
|
|
94
|
+
rowsSingle: PropTypes.string,
|
|
95
|
+
searchBy: PropTypes.string,
|
|
96
|
+
total: PropTypes.string,
|
|
97
|
+
totalSingle: PropTypes.string
|
|
98
|
+
}),
|
|
82
99
|
dataTableColumns: PropTypes.shape({
|
|
83
100
|
open: PropTypes.string,
|
|
84
101
|
order: PropTypes.string,
|
|
102
|
+
pinned: PropTypes.string,
|
|
85
103
|
select: PropTypes.string,
|
|
86
|
-
tip: PropTypes.string
|
|
104
|
+
tip: PropTypes.string,
|
|
105
|
+
selectAria: PropTypes.string,
|
|
106
|
+
orderAria: PropTypes.string
|
|
87
107
|
}),
|
|
88
108
|
dataTableGroupBy: PropTypes.shape({
|
|
89
109
|
clear: PropTypes.string,
|
|
@@ -93,6 +113,10 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
93
113
|
label: PropTypes.string
|
|
94
114
|
}),
|
|
95
115
|
fileInput: PropTypes.shape({
|
|
116
|
+
alert: PropTypes.shape({
|
|
117
|
+
maxFile: PropTypes.string,
|
|
118
|
+
maxSize: PropTypes.string
|
|
119
|
+
}),
|
|
96
120
|
browse: PropTypes.string,
|
|
97
121
|
dropPrompt: PropTypes.string,
|
|
98
122
|
dropPromptMultiple: PropTypes.string,
|
|
@@ -122,6 +146,9 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
122
146
|
})
|
|
123
147
|
})
|
|
124
148
|
}),
|
|
149
|
+
list: PropTypes.shape({
|
|
150
|
+
pinned: PropTypes.string
|
|
151
|
+
}),
|
|
125
152
|
menu: PropTypes.shape({
|
|
126
153
|
openMenu: PropTypes.string,
|
|
127
154
|
closeMenu: PropTypes.string
|
|
@@ -144,6 +171,9 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
144
171
|
plural: PropTypes.string
|
|
145
172
|
})
|
|
146
173
|
}),
|
|
174
|
+
notifcation: PropTypes.shape({
|
|
175
|
+
close: PropTypes.string
|
|
176
|
+
}),
|
|
147
177
|
pagination: PropTypes.shape({
|
|
148
178
|
stepLabel: PropTypes.string,
|
|
149
179
|
summary: PropTypes.string,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React, { forwardRef, useContext, useEffect, useState } from 'react';
|
|
2
|
+
import React, { forwardRef, useContext, useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
4
|
import { useLayoutEffect } from '../../utils/use-isomorphic-layout-effect';
|
|
5
5
|
import { getNewContainer } from '../../utils';
|
|
@@ -10,26 +10,49 @@ import { LayerPropTypes } from './propTypes';
|
|
|
10
10
|
var Layer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
11
11
|
var animate = props.animate,
|
|
12
12
|
animation = props.animation,
|
|
13
|
+
_props$modal = props.modal,
|
|
14
|
+
modal = _props$modal === void 0 ? true : _props$modal,
|
|
13
15
|
targetChildPosition = props.targetChildPosition;
|
|
14
16
|
var _useState = useState(),
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
layerContainer = _useState[0],
|
|
18
|
+
setLayerContainer = _useState[1];
|
|
19
|
+
var containerTarget = useContext(ContainerTargetContext);
|
|
20
|
+
var originalFocusedElementRef = useRef(null);
|
|
21
|
+
var focusWithinLayerRef = useRef(false);
|
|
17
22
|
useEffect(function () {
|
|
18
|
-
|
|
23
|
+
originalFocusedElementRef.current = document.activeElement;
|
|
19
24
|
}, []);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
useEffect(function () {
|
|
26
|
+
var handleFocusIn = function handleFocusIn(event) {
|
|
27
|
+
if (layerContainer != null && layerContainer.contains != null && layerContainer.contains(event.target)) {
|
|
28
|
+
focusWithinLayerRef.current = true;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
var handleFocusOut = function handleFocusOut(event) {
|
|
32
|
+
if (layerContainer != null && layerContainer.contains != null && layerContainer.contains(event.target) && !layerContainer.contains(event.relatedTarget)) {
|
|
33
|
+
focusWithinLayerRef.current = false;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
document.addEventListener('focusin', handleFocusIn);
|
|
37
|
+
document.addEventListener('focusout', handleFocusOut);
|
|
38
|
+
return function () {
|
|
39
|
+
document.removeEventListener('focusin', handleFocusIn);
|
|
40
|
+
document.removeEventListener('focusout', handleFocusOut);
|
|
41
|
+
};
|
|
42
|
+
}, [layerContainer]);
|
|
24
43
|
useEffect(function () {
|
|
25
44
|
return setLayerContainer(getNewContainer(containerTarget, targetChildPosition));
|
|
26
45
|
}, [containerTarget, targetChildPosition]);
|
|
27
|
-
|
|
28
46
|
// just a few things to clean up when the Layer is unmounted
|
|
29
47
|
useLayoutEffect(function () {
|
|
30
48
|
return function () {
|
|
49
|
+
var originalFocusedElement = originalFocusedElementRef.current;
|
|
31
50
|
if (originalFocusedElement) {
|
|
32
|
-
|
|
51
|
+
// Restore focus if:
|
|
52
|
+
// - modal layer (always restore), or
|
|
53
|
+
// - non-modal layer that had focus when it closed
|
|
54
|
+
var shouldRestoreFocus = modal || !modal && focusWithinLayerRef.current;
|
|
55
|
+
if (shouldRestoreFocus && originalFocusedElement.focus) {
|
|
33
56
|
// wait for the fixed positioning to come back to normal
|
|
34
57
|
// see layer styling for reference
|
|
35
58
|
setTimeout(function () {
|
|
@@ -67,10 +90,12 @@ var Layer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
67
90
|
}
|
|
68
91
|
}
|
|
69
92
|
};
|
|
70
|
-
}, [animate, animation, containerTarget, layerContainer,
|
|
93
|
+
}, [animate, animation, containerTarget, layerContainer, modal]);
|
|
71
94
|
return layerContainer ? /*#__PURE__*/createPortal(/*#__PURE__*/React.createElement(LayerContainer, _extends({
|
|
72
95
|
ref: ref
|
|
73
|
-
}, props
|
|
96
|
+
}, props, {
|
|
97
|
+
modal: modal
|
|
98
|
+
})), layerContainer) : null;
|
|
74
99
|
});
|
|
75
100
|
Layer.displayName = 'Layer';
|
|
76
101
|
Layer.propTypes = LayerPropTypes;
|
|
@@ -2,16 +2,25 @@ var _excluded = ["background", "children", "full", "id", "margin", "modal", "onC
|
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
4
|
import React, { forwardRef, useContext, useEffect, useMemo, useRef } from 'react';
|
|
5
|
-
import { ThemeContext } from 'styled-components';
|
|
5
|
+
import styled, { ThemeContext } from 'styled-components';
|
|
6
6
|
import { FocusedContainer } from '../FocusedContainer';
|
|
7
7
|
import { Keyboard } from '../Keyboard';
|
|
8
8
|
import { ResponsiveContext } from '../../contexts/ResponsiveContext';
|
|
9
9
|
import { OptionsContext } from '../../contexts/OptionsContext';
|
|
10
10
|
import { ContainerTargetContext } from '../../contexts/ContainerTargetContext';
|
|
11
11
|
import { useAnalytics } from '../../contexts/AnalyticsContext';
|
|
12
|
-
import { backgroundIsDark, findVisibleParent, PortalContext } from '../../utils';
|
|
12
|
+
import { backgroundIsDark, findVisibleParent, PortalContext, styledComponentsConfig } from '../../utils';
|
|
13
13
|
import { StyledLayer, StyledContainer, StyledOverlay } from './StyledLayer';
|
|
14
14
|
import { useThemeValue } from '../../utils/useThemeValue';
|
|
15
|
+
|
|
16
|
+
// The FocusSpan ensures the LayerContainer has focus when
|
|
17
|
+
// it is opened for user to start tabbing inside it.
|
|
18
|
+
// It helps for escaping the LayerContainer using the keyboard.
|
|
19
|
+
// It is hidden visually but still part of the accessibility tree.
|
|
20
|
+
var FocusSpan = styled.span.withConfig(styledComponentsConfig).withConfig({
|
|
21
|
+
displayName: "LayerContainer__FocusSpan",
|
|
22
|
+
componentId: "sc-1srj14c-0"
|
|
23
|
+
})(["width:0;height:0;overflow:hidden;position:absolute;clip-path:inset(50%);white-space:nowrap;border:0;&:focus{outline:none;}"]);
|
|
15
24
|
var LayerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
16
25
|
var background = _ref.background,
|
|
17
26
|
children = _ref.children,
|
|
@@ -20,8 +29,7 @@ var LayerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
20
29
|
id = _ref.id,
|
|
21
30
|
_ref$margin = _ref.margin,
|
|
22
31
|
margin = _ref$margin === void 0 ? 'none' : _ref$margin,
|
|
23
|
-
|
|
24
|
-
modal = _ref$modal === void 0 ? true : _ref$modal,
|
|
32
|
+
modal = _ref.modal,
|
|
25
33
|
onClickOutside = _ref.onClickOutside,
|
|
26
34
|
onEsc = _ref.onEsc,
|
|
27
35
|
plain = _ref.plain,
|
|
@@ -40,6 +48,7 @@ var LayerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
40
48
|
// should not be supported in v3
|
|
41
49
|
var _useContext = useContext(OptionsContext),
|
|
42
50
|
layerOptions = _useContext.layer;
|
|
51
|
+
var focusSpanRef = useRef();
|
|
43
52
|
var containerRef = useRef();
|
|
44
53
|
var layerRef = useRef();
|
|
45
54
|
var portalContext = useContext(PortalContext);
|
|
@@ -77,8 +86,7 @@ var LayerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
77
86
|
// Once layer is open we make sure it has focus so that you
|
|
78
87
|
// can start tabbing inside the layer. If the caller put focus
|
|
79
88
|
// on an element already, we honor that. Otherwise, we put
|
|
80
|
-
// the focus
|
|
81
|
-
// more details.
|
|
89
|
+
// the focus on the hidden span.
|
|
82
90
|
var element = document.activeElement;
|
|
83
91
|
while (element) {
|
|
84
92
|
if (element === containerRef.current) {
|
|
@@ -87,14 +95,11 @@ var LayerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
87
95
|
}
|
|
88
96
|
element = element.parentElement;
|
|
89
97
|
}
|
|
98
|
+
if (modal && !element && focusSpanRef.current) {
|
|
99
|
+
focusSpanRef.current.focus();
|
|
100
|
+
}
|
|
90
101
|
}
|
|
91
102
|
}, [modal, position, ref]);
|
|
92
|
-
useEffect(function () {
|
|
93
|
-
if (position !== 'hidden') {
|
|
94
|
-
var node = layerRef.current || containerRef.current || ref.current;
|
|
95
|
-
if (node && node.scrollIntoView) node.scrollIntoView();
|
|
96
|
-
}
|
|
97
|
-
}, [position, ref]);
|
|
98
103
|
useEffect(function () {
|
|
99
104
|
var onClickDocument = function onClickDocument(event) {
|
|
100
105
|
// determine which portal id the target is in, if any
|
|
@@ -114,7 +119,6 @@ var LayerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
114
119
|
onClickOutside(event);
|
|
115
120
|
}
|
|
116
121
|
};
|
|
117
|
-
|
|
118
122
|
// if user provides an onClickOutside function, listen for mousedown event
|
|
119
123
|
if (onClickOutside) {
|
|
120
124
|
document.addEventListener('mousedown', onClickDocument);
|
|
@@ -124,7 +128,6 @@ var LayerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
124
128
|
var windowWidth = window.innerWidth;
|
|
125
129
|
var windowHeight = window.innerHeight;
|
|
126
130
|
var target = findVisibleParent(layerTarget);
|
|
127
|
-
|
|
128
131
|
// affects StyledLayer
|
|
129
132
|
var layer = layerRef.current;
|
|
130
133
|
if (layer && target) {
|
|
@@ -133,11 +136,9 @@ var LayerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
133
136
|
layer.style.top = '';
|
|
134
137
|
layer.style.bottom = '';
|
|
135
138
|
layer.style.width = '';
|
|
136
|
-
|
|
137
139
|
// get bounds
|
|
138
140
|
var targetRect = target.getBoundingClientRect();
|
|
139
141
|
var layerRect = layer.getBoundingClientRect();
|
|
140
|
-
|
|
141
142
|
// ensure that layer moves with the target
|
|
142
143
|
layer.style.left = targetRect.left + "px";
|
|
143
144
|
layer.style.right = windowWidth - targetRect.right + "px";
|
|
@@ -186,6 +187,9 @@ var LayerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
186
187
|
// or outside of the layer
|
|
187
188
|
,
|
|
188
189
|
"data-g-portal-id": portalId
|
|
190
|
+
}), /*#__PURE__*/React.createElement(FocusSpan, {
|
|
191
|
+
ref: focusSpanRef,
|
|
192
|
+
tabIndex: "-1"
|
|
189
193
|
}), children);
|
|
190
194
|
content = /*#__PURE__*/React.createElement(StyledLayer, _extends({
|
|
191
195
|
ref: layerRef,
|