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
package/es6/utils/DOM.js
CHANGED
|
@@ -78,17 +78,20 @@ export var withinDropPortal = function withinDropPortal(node, portalContext) {
|
|
|
78
78
|
return true;
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
-
//
|
|
82
|
-
//
|
|
83
|
-
//
|
|
84
|
-
//
|
|
85
|
-
export var isFocusable = function isFocusable(element) {
|
|
81
|
+
// FormField focus-styling predicate, not a general DOM focusability check.
|
|
82
|
+
// Excludes buttons and links so they retain their own focus indicators.
|
|
83
|
+
// Include negative tabIndex when checking an already-focused element;
|
|
84
|
+
// descendant discovery requires a non-negative tabIndex.
|
|
85
|
+
export var isFocusable = function isFocusable(element, includeNegativeTabIndex) {
|
|
86
|
+
if (includeNegativeTabIndex === void 0) {
|
|
87
|
+
includeNegativeTabIndex = false;
|
|
88
|
+
}
|
|
86
89
|
if (!element || element.disabled) return false;
|
|
87
90
|
var tagName = element.tagName.toLowerCase();
|
|
88
91
|
if (tagName === 'input' || tagName === 'select' || tagName === 'textarea') return true;
|
|
89
92
|
// Only non-native-interactive elements with an explicit tabindex attribute
|
|
90
93
|
var isNativeInteractive = tagName === 'button' || tagName === 'a';
|
|
91
|
-
return !isNativeInteractive && element.tabIndex >= 0 && element.hasAttribute('tabindex');
|
|
94
|
+
return !isNativeInteractive && (includeNegativeTabIndex || element.tabIndex >= 0) && element.hasAttribute('tabindex');
|
|
92
95
|
};
|
|
93
96
|
|
|
94
97
|
// Get the first element that can receive focus
|
|
@@ -104,7 +107,7 @@ export var getFirstFocusableDescendant = function getFirstFocusableDescendant(el
|
|
|
104
107
|
};
|
|
105
108
|
export var shouldKeepFocus = function shouldKeepFocus(root) {
|
|
106
109
|
var element = root.activeElement;
|
|
107
|
-
if (isFocusable(element)) return true;
|
|
110
|
+
if (isFocusable(element, true)) return true;
|
|
108
111
|
return !!getFirstFocusableDescendant(element);
|
|
109
112
|
};
|
|
110
113
|
export var getNewContainer = function getNewContainer(target, targetChildPosition) {
|
package/es6/utils/background.js
CHANGED
|
@@ -75,20 +75,20 @@ export var backgroundIsDark = function backgroundIsDark(backgroundArg, theme) {
|
|
|
75
75
|
!opacity || opacity !== 'weak')) {
|
|
76
76
|
var backgroundColor = normalizeColor(background.color, theme);
|
|
77
77
|
if (backgroundColor) {
|
|
78
|
-
result = colorIsDark(backgroundColor);
|
|
78
|
+
result = colorIsDark(backgroundColor, theme);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
} else {
|
|
82
82
|
var _color = normalizeColor(background, theme);
|
|
83
83
|
if (_color) {
|
|
84
|
-
result = colorIsDark(_color);
|
|
84
|
+
result = colorIsDark(_color, theme);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
return result;
|
|
89
89
|
};
|
|
90
|
-
var darkContext = function darkContext(backgroundColor) {
|
|
91
|
-
var isDark = colorIsDark(backgroundColor);
|
|
90
|
+
var darkContext = function darkContext(backgroundColor, theme, text) {
|
|
91
|
+
var isDark = colorIsDark(backgroundColor, theme, text);
|
|
92
92
|
if (isDark === undefined) return undefined;
|
|
93
93
|
return isDark ? 'dark' : 'light';
|
|
94
94
|
};
|
|
@@ -118,13 +118,15 @@ export var backgroundAndTextColors = function backgroundAndTextColors(background
|
|
|
118
118
|
// set the textColor to have the best contrast against the background
|
|
119
119
|
// color.
|
|
120
120
|
if (!textColor && (opacity === undefined || opacity > 0.3)) {
|
|
121
|
-
var shade = darkContext(backgroundColor, theme);
|
|
122
|
-
|
|
121
|
+
var shade = darkContext(backgroundColor, theme, text);
|
|
122
|
+
// preserve undefined (unknown shade) so normalizeColor falls back
|
|
123
|
+
// to the ambient theme.dark instead of forcing the light side
|
|
124
|
+
textColor = normalizeColor(shade && text[shade] || text, theme, shade === undefined ? undefined : shade === 'dark');
|
|
123
125
|
}
|
|
124
126
|
}
|
|
125
127
|
} else {
|
|
126
128
|
backgroundColor = normalizeBackgroundColor(background, theme);
|
|
127
|
-
var _shade = darkContext(backgroundColor, theme);
|
|
129
|
+
var _shade = darkContext(backgroundColor, theme, text);
|
|
128
130
|
var transparent;
|
|
129
131
|
if (backgroundColor && canExtractRGBArray(backgroundColor)) {
|
|
130
132
|
var colorArray = getRGBArray(backgroundColor);
|
package/es6/utils/border.js
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
import { css } from 'styled-components';
|
|
4
4
|
import { normalizeColor } from './colors';
|
|
5
5
|
import { breakpointStyle } from './mixins';
|
|
6
|
+
export var hasSideSpecificBorder = function hasSideSpecificBorder(borderData) {
|
|
7
|
+
var borders = Array.isArray(borderData) ? borderData : [borderData];
|
|
8
|
+
return borders.some(function (data) {
|
|
9
|
+
var side = typeof data === 'string' ? data : data == null ? void 0 : data.side;
|
|
10
|
+
return side !== undefined && side !== 'all';
|
|
11
|
+
});
|
|
12
|
+
};
|
|
6
13
|
export var responsiveBorderStyle = function responsiveBorderStyle(data, theme) {
|
|
7
14
|
var color = normalizeColor(data.color || 'border', theme);
|
|
8
15
|
var borderSize = data.size || 'xsmall';
|
package/es6/utils/colors.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { LEGACY_COLOR_IS_DARK, legacyColorIsDark } from './legacyColorIsDark';
|
|
4
|
+
|
|
3
5
|
// Track which deprecated colors have already been warned about
|
|
4
6
|
var warnedColors = new Set();
|
|
5
7
|
var checkColorDeprecation = function checkColorDeprecation(color, theme, dark) {
|
|
@@ -136,29 +138,99 @@ export var getRGBArray = function getRGBArray(color) {
|
|
|
136
138
|
}
|
|
137
139
|
return color;
|
|
138
140
|
};
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
141
|
+
|
|
142
|
+
// sRGB-to-linear conversion constants.
|
|
143
|
+
// https://www.w3.org/TR/WCAG22/#dfn-relative-luminance
|
|
144
|
+
var SRGB_LINEAR_THRESHOLD = 0.04045;
|
|
145
|
+
var SRGB_LINEAR_DIVISOR = 12.92;
|
|
146
|
+
var SRGB_GAMMA_OFFSET = 0.055;
|
|
147
|
+
var SRGB_GAMMA_DIVISOR = 1.055;
|
|
148
|
+
var SRGB_GAMMA_EXPONENT = 2.4;
|
|
149
|
+
|
|
150
|
+
// Linearizes an sRGB channel (0-255) per the WCAG relative luminance spec.
|
|
151
|
+
// https://www.w3.org/TR/WCAG22/#dfn-relative-luminance
|
|
152
|
+
var linearizeChannel = function linearizeChannel(value) {
|
|
153
|
+
var c = value / 255;
|
|
154
|
+
return c <= SRGB_LINEAR_THRESHOLD ? c / SRGB_LINEAR_DIVISOR : Math.pow((c + SRGB_GAMMA_OFFSET) / SRGB_GAMMA_DIVISOR, SRGB_GAMMA_EXPONENT);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
// WCAG relative luminance coefficients for linearized sRGB channels.
|
|
158
|
+
// https://www.w3.org/TR/WCAG22/#dfn-relative-luminance
|
|
159
|
+
var RED_LUMINANCE_COEFFICIENT = 0.2126;
|
|
160
|
+
var GREEN_LUMINANCE_COEFFICIENT = 0.7152;
|
|
161
|
+
var BLUE_LUMINANCE_COEFFICIENT = 0.0722;
|
|
162
|
+
var relativeLuminance = function relativeLuminance(red, green, blue) {
|
|
163
|
+
return RED_LUMINANCE_COEFFICIENT * linearizeChannel(red) + GREEN_LUMINANCE_COEFFICIENT * linearizeChannel(green) + BLUE_LUMINANCE_COEFFICIENT * linearizeChannel(blue);
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
// Offset added to luminance values in the WCAG contrast ratio formula:
|
|
167
|
+
// (L1 + 0.05) / (L2 + 0.05). https://www.w3.org/TR/WCAG22/#dfn-contrast-ratio
|
|
168
|
+
var WCAG_CONTRAST_OFFSET = 0.05;
|
|
169
|
+
|
|
170
|
+
// Luminance at which black and white text have equal WCAG contrast ratios
|
|
171
|
+
// against the background: solving (1.05 / (L+0.05)) = ((L+0.05) / 0.05).
|
|
172
|
+
var EQUAL_CONTRAST_LUMINANCE = 0.179;
|
|
173
|
+
var luminanceOf = function luminanceOf(color, theme, dark) {
|
|
174
|
+
var resolved = theme && _normalizeColor(color, theme, dark) || color;
|
|
175
|
+
if (resolved && canExtractRGBArray(resolved)) {
|
|
176
|
+
var _getRGBArray = getRGBArray(resolved),
|
|
142
177
|
red = _getRGBArray[0],
|
|
143
178
|
green = _getRGBArray[1],
|
|
144
|
-
blue = _getRGBArray[2]
|
|
145
|
-
|
|
146
|
-
// if there is an alpha and it's greater than 50%, we can't really tell
|
|
147
|
-
if (alpha < 0.5) return undefined;
|
|
148
|
-
var brightness = (299 * red + 587 * green + 114 * blue) / 1000;
|
|
149
|
-
// From: http://www.had2know.com/technology/color-contrast-calculator-web-design.html
|
|
150
|
-
// Above domain is no longer registered.
|
|
151
|
-
return brightness < 125;
|
|
179
|
+
blue = _getRGBArray[2];
|
|
180
|
+
return relativeLuminance(red, green, blue);
|
|
152
181
|
}
|
|
153
182
|
return undefined;
|
|
154
183
|
};
|
|
155
|
-
|
|
184
|
+
|
|
185
|
+
// Luminance at which a pair of light/dark text colors have equal WCAG
|
|
186
|
+
// contrast against the background. text.light is the (typically darker)
|
|
187
|
+
// text used against light backgrounds and text.dark is the (typically
|
|
188
|
+
// lighter) text used against dark backgrounds. text defaults to
|
|
189
|
+
// theme.global.colors.text so callers that select an alternate text color
|
|
190
|
+
// pair (e.g. Button's explicit color prop) can pass it in and get a
|
|
191
|
+
// threshold that matches what will actually be selected. Falls back to the
|
|
192
|
+
// black/white derived EQUAL_CONTRAST_LUMINANCE when no usable text colors
|
|
193
|
+
// are available, preserving prior behavior for callers that don't pass one.
|
|
194
|
+
var equalContrastLuminance = function equalContrastLuminance(theme, text) {
|
|
195
|
+
if (text === void 0) {
|
|
196
|
+
var _theme$global;
|
|
197
|
+
text = theme == null || (_theme$global = theme.global) == null || (_theme$global = _theme$global.colors) == null ? void 0 : _theme$global.text;
|
|
198
|
+
}
|
|
199
|
+
if (!text) return EQUAL_CONTRAST_LUMINANCE;
|
|
200
|
+
// resolve both sides directly from text (a color name, a raw color, or a
|
|
201
|
+
// { dark, light } pair) with explicit dark args, so named theme colors
|
|
202
|
+
// (e.g. 'text') and aliases (e.g. text.dark: 'text-strong') resolve to
|
|
203
|
+
// the intended side rather than the theme's current mode
|
|
204
|
+
var darkTextLuminance = luminanceOf(text, theme, false);
|
|
205
|
+
var lightTextLuminance = luminanceOf(text, theme, true);
|
|
206
|
+
if (darkTextLuminance === undefined || lightTextLuminance === undefined) {
|
|
207
|
+
return EQUAL_CONTRAST_LUMINANCE;
|
|
208
|
+
}
|
|
209
|
+
return Math.sqrt((darkTextLuminance + WCAG_CONTRAST_OFFSET) * (lightTextLuminance + WCAG_CONTRAST_OFFSET)) - WCAG_CONTRAST_OFFSET;
|
|
210
|
+
};
|
|
211
|
+
export var colorIsDark = function colorIsDark(color, theme, text) {
|
|
156
212
|
if (color && canExtractRGBArray(color)) {
|
|
157
213
|
var _getRGBArray2 = getRGBArray(color),
|
|
158
214
|
red = _getRGBArray2[0],
|
|
159
215
|
green = _getRGBArray2[1],
|
|
160
216
|
blue = _getRGBArray2[2],
|
|
161
217
|
alpha = _getRGBArray2[3];
|
|
218
|
+
// if there is an alpha and it's greater than 50%, we can't really tell
|
|
219
|
+
if (alpha < 0.5) return undefined;
|
|
220
|
+
if (theme != null && theme[LEGACY_COLOR_IS_DARK]) {
|
|
221
|
+
return legacyColorIsDark(red, green, blue);
|
|
222
|
+
}
|
|
223
|
+
return relativeLuminance(red, green, blue) < equalContrastLuminance(theme, text);
|
|
224
|
+
}
|
|
225
|
+
return undefined;
|
|
226
|
+
};
|
|
227
|
+
export var getRGBA = function getRGBA(color, opacity) {
|
|
228
|
+
if (color && canExtractRGBArray(color)) {
|
|
229
|
+
var _getRGBArray3 = getRGBArray(color),
|
|
230
|
+
red = _getRGBArray3[0],
|
|
231
|
+
green = _getRGBArray3[1],
|
|
232
|
+
blue = _getRGBArray3[2],
|
|
233
|
+
alpha = _getRGBArray3[3];
|
|
162
234
|
var normalizedAlpha;
|
|
163
235
|
if (opacity !== undefined) {
|
|
164
236
|
normalizedAlpha = opacity;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
export var LEGACY_COLOR_IS_DARK = Symbol('legacyColorIsDark');
|
|
4
|
+
|
|
5
|
+
// Brightness weights documented by Had2Know's legacy contrast calculator.
|
|
6
|
+
// https://www.had2know.org/technology/color-contrast-calculator-web-design.html
|
|
7
|
+
var RED_BRIGHTNESS_COEFFICIENT = 299;
|
|
8
|
+
var GREEN_BRIGHTNESS_COEFFICIENT = 587;
|
|
9
|
+
var BLUE_BRIGHTNESS_COEFFICIENT = 114;
|
|
10
|
+
var BRIGHTNESS_COEFFICIENT_DIVISOR = 1000;
|
|
11
|
+
|
|
12
|
+
// Legacy cutoff; the source's 125 threshold is for color-pair difference.
|
|
13
|
+
var DARK_BRIGHTNESS_THRESHOLD = 125;
|
|
14
|
+
export var legacyColorIsDark = function legacyColorIsDark(red, green, blue) {
|
|
15
|
+
var brightness = (RED_BRIGHTNESS_COEFFICIENT * red + GREEN_BRIGHTNESS_COEFFICIENT * green + BLUE_BRIGHTNESS_COEFFICIENT * blue) / BRIGHTNESS_COEFFICIENT_DIVISOR;
|
|
16
|
+
return brightness < DARK_BRIGHTNESS_THRESHOLD;
|
|
17
|
+
};
|
package/es6/utils/styles.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
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); }
|
|
1
2
|
// SPDX-FileCopyrightText: © Hewlett Packard Enterprise Development LP
|
|
2
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
4
|
import { css } from 'styled-components';
|
|
4
5
|
import isPropValid from '@emotion/is-prop-valid';
|
|
5
6
|
import { backgroundStyle } from './background';
|
|
7
|
+
import { borderStyle as inputBorderStyle, hasSideSpecificBorder } from './border';
|
|
8
|
+
import { isObject } from './object';
|
|
6
9
|
import { normalizeColor } from './colors';
|
|
7
10
|
import { getBreakpointStyle } from './responsive';
|
|
8
11
|
import { breakpointStyle, parseMetricToNum } from './mixins';
|
|
@@ -261,6 +264,16 @@ var adjustPad = function adjustPad(props, value) {
|
|
|
261
264
|
return parseMetricToNum((props.theme.global.edgeSize[value] || value) + "px") + parseMetricToNum(props.theme.global.control.border.width + "px") + "px";
|
|
262
265
|
};
|
|
263
266
|
export var getInputPadBySide = function getInputPadBySide(props, side) {
|
|
267
|
+
var inputPad = props.theme.global.input.pad;
|
|
268
|
+
if (inputPad !== undefined) {
|
|
269
|
+
var _ref5, _ref6, _inputPad$logicalSide;
|
|
270
|
+
if (typeof inputPad === 'string') return props.theme.global.edgeSize[inputPad] || inputPad;
|
|
271
|
+
var _orientation = side === 'left' || side === 'right' ? 'horizontal' : 'vertical';
|
|
272
|
+
var logicalSide;
|
|
273
|
+
if (_orientation === 'horizontal') logicalSide = side === 'left' !== (props.theme.dir === 'rtl') ? 'start' : 'end';
|
|
274
|
+
var value = (_ref5 = (_ref6 = (_inputPad$logicalSide = inputPad[logicalSide]) != null ? _inputPad$logicalSide : inputPad[side]) != null ? _ref6 : inputPad[_orientation]) != null ? _ref5 : 'none';
|
|
275
|
+
return props.theme.global.edgeSize[value] || value;
|
|
276
|
+
}
|
|
264
277
|
if (typeof props.theme.global.input.padding !== 'object') {
|
|
265
278
|
var _adjustedPad = adjustPad(props, props.theme.global.input.padding);
|
|
266
279
|
return _adjustedPad;
|
|
@@ -285,29 +298,6 @@ var inputSizeStyle = function inputSizeStyle(props) {
|
|
|
285
298
|
}
|
|
286
299
|
return css(["font-size:", ";line-height:", ";"], data.size, data.height);
|
|
287
300
|
};
|
|
288
|
-
export var inputStyle = css(["box-sizing:border-box;", " font-family:inherit;border:none;-webkit-appearance:none;background:transparent;color:inherit;width:100%;", " ", " ", " margin:0;", " &:focus{", ";}", " ", " ::-webkit-search-decoration{-webkit-appearance:none;}&::-moz-focus-inner{border:none;outline:none;}&:-moz-placeholder,&::-moz-placeholder{opacity:1;}", ""], function (props) {
|
|
289
|
-
var _props$theme$text$pro;
|
|
290
|
-
return "font-size: " + (props.theme.global.input.font.size ? ((_props$theme$text$pro = props.theme.text[props.theme.global.input.font.size]) == null ? void 0 : _props$theme$text$pro.size) || props.theme.global.input.font.size : 'inherit') + ";";
|
|
291
|
-
}, function (props) {
|
|
292
|
-
return props.theme.global.input.font.height && "line-height: " + props.theme.global.input.font.height + ";";
|
|
293
|
-
}, function (props) {
|
|
294
|
-
return props.theme.global.input.padding && typeof props.theme.global.input.padding !== 'object' ? // On a breaking change release, this condition could be removed and
|
|
295
|
-
// just the edgeStyle could remain. Currently, this is needed for
|
|
296
|
-
// backwards compatibility since we are placing the calculation in
|
|
297
|
-
// base.js
|
|
298
|
-
"padding: " + (parseMetricToNum(props.theme.global.edgeSize[props.theme.global.input.padding] || props.theme.global.input.padding) - parseMetricToNum(props.theme.global.control.border.width)) + "px;" : edgeStyle('padding', props.theme.global.input.padding, props.responsive, props.theme.box.responsiveBreakpoint, props.theme);
|
|
299
|
-
}, function (props) {
|
|
300
|
-
return (
|
|
301
|
-
// for backwards compatibility, check if props.theme.global.input.weight
|
|
302
|
-
(props.theme.global.input.weight || props.theme.global.input.font.weight) && css(["font-weight:", ";"], props.theme.global.input.weight || props.theme.global.input.font.weight)
|
|
303
|
-
);
|
|
304
|
-
}, function (props) {
|
|
305
|
-
return props.size && inputSizeStyle(props);
|
|
306
|
-
}, function (props) {
|
|
307
|
-
return (!props.plain || props.focusIndicator) && focusStyle();
|
|
308
|
-
}, controlBorderStyle, placeholderStyle, function (props) {
|
|
309
|
-
return props.theme.global.input.extend;
|
|
310
|
-
});
|
|
311
301
|
|
|
312
302
|
// Apply padding on input to create space for icon.
|
|
313
303
|
// When theme.icon.matchSize is true, the space for the
|
|
@@ -317,11 +307,19 @@ export var inputPadForIcon = css(["", ""], function (props) {
|
|
|
317
307
|
var pad = getInputIconPad(props);
|
|
318
308
|
return props.reverse ? "padding-right: " + pad + ";" : "padding-left: " + pad + ";";
|
|
319
309
|
});
|
|
320
|
-
export var
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
310
|
+
export var scrollbarStyle = function scrollbarStyle(theme) {
|
|
311
|
+
var _theme$global$scrollb;
|
|
312
|
+
var width = theme.global && ((_theme$global$scrollb = theme.global.scrollbar) == null ? void 0 : _theme$global$scrollb.width);
|
|
313
|
+
var color = normalizeColor('scrollbar', theme);
|
|
314
|
+
if (!color && !width) return undefined;
|
|
315
|
+
return css(["", " ", ""], color && "scrollbar-color: " + color + " transparent;", width !== undefined && "scrollbar-width: " + width + ";");
|
|
316
|
+
};
|
|
317
|
+
export var overflowStyle = function overflowStyle(overflowProp, theme) {
|
|
318
|
+
var overflow = typeof overflowProp === 'string' ? "overflow: " + overflowProp + ";" : [overflowProp.horizontal && "overflow-x: " + overflowProp.horizontal + ";", overflowProp.vertical && "overflow-y: " + overflowProp.vertical + ";"].filter(Boolean).join(' ');
|
|
319
|
+
var scrollable = ['auto', 'scroll', 'overlay'].some(function (value) {
|
|
320
|
+
return overflow.includes(": " + value + ";");
|
|
321
|
+
});
|
|
322
|
+
return css(["", " ", ""], overflow, scrollable && scrollbarStyle(theme));
|
|
325
323
|
};
|
|
326
324
|
var ALIGN_SELF_MAP = {
|
|
327
325
|
center: 'center',
|
|
@@ -506,4 +504,134 @@ var heightStringStyle = function heightStringStyle(height, theme) {
|
|
|
506
504
|
};
|
|
507
505
|
export var heightStyle = function heightStyle(height, theme) {
|
|
508
506
|
return typeof height === 'object' ? heightObjectStyle(height, theme) : heightStringStyle(height, theme);
|
|
509
|
-
};
|
|
507
|
+
};
|
|
508
|
+
var inputPartStyle = function inputPartStyle(part, props, _temp5) {
|
|
509
|
+
var _props$responsive;
|
|
510
|
+
var _ref7 = _temp5 === void 0 ? {} : _temp5,
|
|
511
|
+
paddingOnly = _ref7.paddingOnly,
|
|
512
|
+
skipPadding = _ref7.skipPadding,
|
|
513
|
+
skipRound = _ref7.skipRound;
|
|
514
|
+
var theme = props.theme;
|
|
515
|
+
var responsive = (_props$responsive = props.responsive) != null ? _props$responsive : true;
|
|
516
|
+
var styles = [];
|
|
517
|
+
if (part.pad !== undefined && !skipPadding && props.plain !== 'full') styles.push(edgeStyle('padding', part.pad, responsive, theme.box.responsiveBreakpoint, theme));
|
|
518
|
+
if (paddingOnly) return styles;
|
|
519
|
+
if (part.background !== undefined) styles.push(backgroundStyle(part.background, theme, false));
|
|
520
|
+
if (part.border !== undefined) {
|
|
521
|
+
if (part.border === false) styles.push('border: none;');else {
|
|
522
|
+
if (hasSideSpecificBorder(part.border)) styles.push('border: none;');
|
|
523
|
+
styles.push(inputBorderStyle(part.border, responsive, theme));
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
if (part.elevation !== undefined) styles.push(elevationStyle(part.elevation));
|
|
527
|
+
if (part.height !== undefined && props.height === undefined) styles.push(heightStyle(part.height, theme));
|
|
528
|
+
if (part.width !== undefined && props.widthProp === undefined && props.$inputWidth === undefined && props.width === undefined) styles.push(widthStyle(part.width, theme));
|
|
529
|
+
if (part.margin !== undefined && props.margin === undefined) styles.push(edgeStyle('margin', part.margin, responsive, theme.box.responsiveBreakpoint, theme));
|
|
530
|
+
if (part.round !== undefined && !skipRound) styles.push(part.round === false ? 'border-radius: 0;' : roundStyle(part.round, responsive, theme));
|
|
531
|
+
return styles;
|
|
532
|
+
};
|
|
533
|
+
var _mergeInputBorder = function mergeInputBorder(base, override) {
|
|
534
|
+
if (override === undefined) return base;
|
|
535
|
+
if (Array.isArray(base) && isObject(override) && !override.side) return base.map(function (part) {
|
|
536
|
+
return _mergeInputBorder(part, override);
|
|
537
|
+
});
|
|
538
|
+
if (isObject(base) && isObject(override)) return _extends({}, base, override);
|
|
539
|
+
if (typeof base === 'string' && isObject(override)) return _extends({
|
|
540
|
+
side: base
|
|
541
|
+
}, override);
|
|
542
|
+
return override;
|
|
543
|
+
};
|
|
544
|
+
export var inputAppearanceStyle = function inputAppearanceStyle(props, _temp6) {
|
|
545
|
+
var _ref8 = _temp6 === void 0 ? {} : _temp6,
|
|
546
|
+
_ref8$wrapper = _ref8.wrapper,
|
|
547
|
+
wrapper = _ref8$wrapper === void 0 ? false : _ref8$wrapper,
|
|
548
|
+
_ref8$skipPadding = _ref8.skipPadding,
|
|
549
|
+
skipPadding = _ref8$skipPadding === void 0 ? false : _ref8$skipPadding,
|
|
550
|
+
_ref8$skipBasePadding = _ref8.skipBasePadding,
|
|
551
|
+
skipBasePadding = _ref8$skipBasePadding === void 0 ? false : _ref8$skipBasePadding,
|
|
552
|
+
_ref8$skipRound = _ref8.skipRound,
|
|
553
|
+
skipRound = _ref8$skipRound === void 0 ? false : _ref8$skipRound,
|
|
554
|
+
padSelector = _ref8.padSelector;
|
|
555
|
+
var input = props.theme.global.input;
|
|
556
|
+
var plain = wrapper ? props.plainSelect || props.$inputPlain || (props.readOnlyProp || props.hasButton) && props.plain : props.plain;
|
|
557
|
+
var disabled = props.disabled || props.$inputDisabled;
|
|
558
|
+
var readOnly = props.readOnly || props.readOnlyProp;
|
|
559
|
+
var options = {
|
|
560
|
+
paddingOnly: !!plain || props.$inputInner,
|
|
561
|
+
skipPadding: skipPadding,
|
|
562
|
+
skipRound: skipRound
|
|
563
|
+
};
|
|
564
|
+
var iconPadding = props.icon && !props.hasActionsGroup ? "padding-" + (props.reverse ? 'right' : 'left') + ": " + getInputIconPad(props) + ";" : undefined;
|
|
565
|
+
var legacyBorder = {
|
|
566
|
+
size: props.theme.global.control.border.width,
|
|
567
|
+
color: props.theme.global.control.border.color
|
|
568
|
+
};
|
|
569
|
+
var normalBorder = _mergeInputBorder(legacyBorder, input.border);
|
|
570
|
+
var partStyle = function partStyle(part) {
|
|
571
|
+
return inputPartStyle(part.border !== undefined ? _extends({}, part, {
|
|
572
|
+
border: _mergeInputBorder(normalBorder === false ? legacyBorder : normalBorder, part.border)
|
|
573
|
+
}) : part, props, options);
|
|
574
|
+
};
|
|
575
|
+
var padStyle = function padStyle(pad) {
|
|
576
|
+
var styles = inputPartStyle({
|
|
577
|
+
pad: pad
|
|
578
|
+
}, props, {
|
|
579
|
+
paddingOnly: true
|
|
580
|
+
});
|
|
581
|
+
return css(["input:not([type='hidden']){", " ", "}", ""], styles, iconPadding, padSelector && css(["", "{", "}"], padSelector, styles));
|
|
582
|
+
};
|
|
583
|
+
var styles = partStyle(skipBasePadding ? _extends({}, input, {
|
|
584
|
+
pad: undefined
|
|
585
|
+
}) : input);
|
|
586
|
+
var stateStyle = function stateStyle(part) {
|
|
587
|
+
var stateStyles = partStyle(part);
|
|
588
|
+
if (wrapper && skipPadding && part.pad !== undefined) stateStyles.push(padSelector ? padStyle(part.pad) : css(["input:not([type='hidden']){", " ", "}"], inputPartStyle({
|
|
589
|
+
pad: part.pad
|
|
590
|
+
}, props, {
|
|
591
|
+
paddingOnly: true
|
|
592
|
+
}), iconPadding));else if (part.pad !== undefined && iconPadding) {
|
|
593
|
+
stateStyles.push(iconPadding);
|
|
594
|
+
}
|
|
595
|
+
return stateStyles;
|
|
596
|
+
};
|
|
597
|
+
if (!plain) {
|
|
598
|
+
if (!disabled && !readOnly && input.hover) styles.push(css(["&:hover{", "}"], stateStyle(input.hover)));
|
|
599
|
+
if (!disabled && !readOnly && input.focus) styles.push(wrapper ? css(["&:focus-within{", "}"], stateStyle(input.focus)) : css(["&:focus{", "}"], stateStyle(input.focus)));
|
|
600
|
+
if (readOnly && input.readOnly) styles.push(stateStyle(input.readOnly));
|
|
601
|
+
if (disabled && input.disabled) styles.push(stateStyle(input.disabled));
|
|
602
|
+
}
|
|
603
|
+
if (!wrapper && input.placeholder) {
|
|
604
|
+
var _props$theme$text$pla;
|
|
605
|
+
var placeholder = input.placeholder;
|
|
606
|
+
var text = [];
|
|
607
|
+
if (placeholder.color !== undefined) text.push("color: " + normalizeColor(placeholder.color, props.theme) + ";");
|
|
608
|
+
if (placeholder.size !== undefined) text.push("font-size: " + (((_props$theme$text$pla = props.theme.text[placeholder.size]) == null ? void 0 : _props$theme$text$pla.size) || placeholder.size) + ";");
|
|
609
|
+
if (placeholder.weight !== undefined) text.push("font-weight: " + placeholder.weight + ";");
|
|
610
|
+
if (text.length > 0) styles.push(css(["&::placeholder{", "}"], text));
|
|
611
|
+
}
|
|
612
|
+
return styles.length > 0 ? css(["", ""], styles) : undefined;
|
|
613
|
+
};
|
|
614
|
+
export var inputStyle = css(["box-sizing:border-box;", " font-family:inherit;border:none;-webkit-appearance:none;background:transparent;color:inherit;width:100%;", " ", " ", " margin:0;", " &:focus{", ";}", " ", " ::-webkit-search-decoration{-webkit-appearance:none;}&::-moz-focus-inner{border:none;outline:none;}&:-moz-placeholder,&::-moz-placeholder{opacity:1;}", ""], function (props) {
|
|
615
|
+
var _props$theme$text$pro;
|
|
616
|
+
return "font-size: " + (props.theme.global.input.font.size ? ((_props$theme$text$pro = props.theme.text[props.theme.global.input.font.size]) == null ? void 0 : _props$theme$text$pro.size) || props.theme.global.input.font.size : 'inherit') + ";";
|
|
617
|
+
}, function (props) {
|
|
618
|
+
return props.theme.global.input.font.height && "line-height: " + props.theme.global.input.font.height + ";";
|
|
619
|
+
}, function (props) {
|
|
620
|
+
return props.theme.global.input.padding && typeof props.theme.global.input.padding !== 'object' ? // On a breaking change release, this condition could be removed and
|
|
621
|
+
// just the edgeStyle could remain. Currently, this is needed for
|
|
622
|
+
// backwards compatibility since we are placing the calculation in
|
|
623
|
+
// base.js
|
|
624
|
+
"padding: " + (parseMetricToNum(props.theme.global.edgeSize[props.theme.global.input.padding] || props.theme.global.input.padding) - parseMetricToNum(props.theme.global.control.border.width)) + "px;" : edgeStyle('padding', props.theme.global.input.padding, props.responsive, props.theme.box.responsiveBreakpoint, props.theme);
|
|
625
|
+
}, function (props) {
|
|
626
|
+
return (
|
|
627
|
+
// for backwards compatibility, check if props.theme.global.input.weight
|
|
628
|
+
(props.theme.global.input.weight || props.theme.global.input.font.weight) && css(["font-weight:", ";"], props.theme.global.input.weight || props.theme.global.input.font.weight)
|
|
629
|
+
);
|
|
630
|
+
}, function (props) {
|
|
631
|
+
return props.size && inputSizeStyle(props);
|
|
632
|
+
}, function (props) {
|
|
633
|
+
return (!props.plain || props.focusIndicator) && focusStyle();
|
|
634
|
+
}, controlBorderStyle, placeholderStyle, function (props) {
|
|
635
|
+
var appearance = inputAppearanceStyle(props);
|
|
636
|
+
return appearance ? css(["", " ", " ", ""], appearance, !props.$inputInner && (!props.plain || props.focusIndicator) && css(["&:focus{", "}"], focusStyle()), props.theme.global.input.extend) : props.theme.global.input.extend;
|
|
637
|
+
});
|