@telus-uds/components-base 1.66.0 → 1.67.1
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/CHANGELOG.md +23 -3
- package/lib/A11yInfoProvider/index.js +5 -20
- package/lib/A11yText/index.js +3 -17
- package/lib/ActivityIndicator/Spinner.js +2 -9
- package/lib/ActivityIndicator/Spinner.native.js +4 -27
- package/lib/ActivityIndicator/index.js +1 -13
- package/lib/ActivityIndicator/shared.js +0 -3
- package/lib/Autocomplete/Autocomplete.js +34 -85
- package/lib/Autocomplete/Loading.js +0 -10
- package/lib/Autocomplete/Suggestions.js +0 -11
- package/lib/Autocomplete/index.js +0 -3
- package/lib/BaseProvider/HydrationContext.js +4 -18
- package/lib/BaseProvider/index.js +0 -12
- package/lib/Box/Box.js +10 -35
- package/lib/Box/index.js +0 -3
- package/lib/Button/Button.js +4 -13
- package/lib/Button/ButtonBase.js +23 -55
- package/lib/Button/ButtonDropdown.js +7 -32
- package/lib/Button/ButtonGroup.js +15 -48
- package/lib/Button/ButtonLink.js +3 -17
- package/lib/Button/index.js +0 -5
- package/lib/Button/propTypes.js +0 -15
- package/lib/Card/Card.js +3 -14
- package/lib/Card/CardBase.js +5 -16
- package/lib/Card/PressableCardBase.js +7 -30
- package/lib/Card/index.js +0 -7
- package/lib/Carousel/Carousel.js +22 -115
- package/lib/Carousel/CarouselContext.js +0 -14
- package/lib/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +6 -18
- package/lib/Carousel/CarouselItem/CarouselItem.js +5 -20
- package/lib/Carousel/CarouselItem/index.js +0 -3
- package/lib/Carousel/CarouselStepTracker/CarouselStepTracker.js +0 -9
- package/lib/Carousel/CarouselStepTracker/index.js +0 -3
- package/lib/Carousel/CarouselTabs/CarouselTabs.js +5 -15
- package/lib/Carousel/CarouselTabs/CarouselTabsPanel.js +7 -16
- package/lib/Carousel/CarouselTabs/CarouselTabsPanelItem.js +2 -22
- package/lib/Carousel/CarouselTabs/index.js +0 -3
- package/lib/Carousel/CarouselThumbnail.js +1 -16
- package/lib/Carousel/CarouselThumbnailNavigation.js +0 -15
- package/lib/Carousel/index.js +0 -5
- package/lib/Checkbox/Checkbox.js +5 -44
- package/lib/Checkbox/CheckboxButton.js +7 -33
- package/lib/Checkbox/CheckboxGroup.js +14 -45
- package/lib/Checkbox/CheckboxInput.js +1 -11
- package/lib/Checkbox/CheckboxInput.native.js +0 -2
- package/lib/Checkbox/index.js +0 -4
- package/lib/CheckboxCard/CheckboxCard.js +4 -37
- package/lib/CheckboxCard/index.js +0 -3
- package/lib/CheckboxCardGroup/CheckboxCardGroup.js +216 -0
- package/lib/CheckboxCardGroup/index.js +10 -0
- package/lib/Divider/Divider.js +13 -24
- package/lib/Divider/index.js +0 -3
- package/lib/ExpandCollapse/Accordion.js +1 -9
- package/lib/ExpandCollapse/Control.js +10 -32
- package/lib/ExpandCollapse/ExpandCollapse.js +3 -19
- package/lib/ExpandCollapse/Panel.js +13 -38
- package/lib/ExpandCollapse/index.js +0 -5
- package/lib/Feedback/Feedback.js +13 -30
- package/lib/Feedback/index.js +0 -3
- package/lib/Fieldset/Fieldset.js +6 -37
- package/lib/Fieldset/FieldsetContainer.js +1 -10
- package/lib/Fieldset/FieldsetContainer.native.js +0 -8
- package/lib/Fieldset/Legend.js +1 -10
- package/lib/Fieldset/Legend.native.js +1 -13
- package/lib/Fieldset/index.js +0 -3
- package/lib/FlexGrid/Col/Col.js +10 -53
- package/lib/FlexGrid/Col/index.js +0 -3
- package/lib/FlexGrid/FlexGrid.js +3 -34
- package/lib/FlexGrid/Row/Row.js +0 -38
- package/lib/FlexGrid/Row/index.js +0 -3
- package/lib/FlexGrid/helpers/index.js +0 -4
- package/lib/FlexGrid/index.js +0 -3
- package/lib/FlexGrid/providers/GutterContext.js +0 -4
- package/lib/HorizontalScroll/HorizontalScroll.js +17 -45
- package/lib/HorizontalScroll/HorizontalScrollButton.js +1 -17
- package/lib/HorizontalScroll/ScrollViewEnd.js +5 -13
- package/lib/HorizontalScroll/ScrollViewEnd.native.js +1 -10
- package/lib/HorizontalScroll/index.js +0 -7
- package/lib/HorizontalScroll/itemPositions.js +8 -19
- package/lib/Icon/Icon.js +4 -17
- package/lib/Icon/IconText.js +5 -25
- package/lib/Icon/index.js +0 -6
- package/lib/IconButton/IconButton.js +5 -37
- package/lib/IconButton/index.js +0 -3
- package/lib/InputLabel/InputLabel.js +4 -28
- package/lib/InputLabel/LabelContent.js +2 -8
- package/lib/InputLabel/LabelContent.native.js +0 -8
- package/lib/InputLabel/index.js +0 -3
- package/lib/InputSupports/InputSupports.js +0 -21
- package/lib/InputSupports/index.js +0 -3
- package/lib/InputSupports/useInputSupports.js +2 -6
- package/lib/Link/ChevronLink.js +7 -18
- package/lib/Link/InlinePressable.js +0 -10
- package/lib/Link/InlinePressable.native.js +5 -18
- package/lib/Link/Link.js +0 -8
- package/lib/Link/LinkBase.js +17 -47
- package/lib/Link/TextButton.js +3 -16
- package/lib/Link/index.js +0 -5
- package/lib/List/List.js +5 -21
- package/lib/List/ListItem.js +1 -11
- package/lib/List/ListItemBase.js +5 -34
- package/lib/List/ListItemContent.js +1 -14
- package/lib/List/ListItemMark.js +3 -23
- package/lib/List/PressableListItemBase.js +2 -28
- package/lib/List/index.js +0 -4
- package/lib/Listbox/GroupControl.js +0 -14
- package/lib/Listbox/Listbox.js +15 -40
- package/lib/Listbox/ListboxContext.js +0 -7
- package/lib/Listbox/ListboxGroup.js +7 -19
- package/lib/Listbox/ListboxItem.js +3 -17
- package/lib/Listbox/ListboxOverlay.js +4 -20
- package/lib/Listbox/PressableItem.js +3 -18
- package/lib/Listbox/index.js +0 -3
- package/lib/Modal/Modal.js +94 -45
- package/lib/Modal/ModalContent.js +184 -0
- package/lib/Modal/index.js +0 -3
- package/lib/MultiSelectFilter/ModalOverlay.js +1 -20
- package/lib/MultiSelectFilter/MultiSelectFilter.js +20 -69
- package/lib/MultiSelectFilter/index.js +0 -3
- package/lib/Notification/Notification.js +11 -38
- package/lib/Notification/index.js +0 -3
- package/lib/Pagination/PageButton.js +2 -22
- package/lib/Pagination/Pagination.js +21 -42
- package/lib/Pagination/SideButton.js +0 -24
- package/lib/Pagination/index.js +0 -3
- package/lib/Pagination/usePagination.js +4 -9
- package/lib/Progress/Progress.js +3 -17
- package/lib/Progress/ProgressBar.js +3 -25
- package/lib/Progress/ProgressBarBackground.js +0 -12
- package/lib/Progress/index.js +0 -4
- package/lib/QuickLinks/QuickLinks.js +1 -18
- package/lib/QuickLinks/QuickLinksCard.js +1 -11
- package/lib/QuickLinks/QuickLinksItem.js +3 -17
- package/lib/QuickLinks/index.js +0 -4
- package/lib/QuickLinksFeature/QuickLinksFeature.js +3 -20
- package/lib/QuickLinksFeature/QuickLinksFeatureItem.js +7 -30
- package/lib/QuickLinksFeature/index.js +0 -4
- package/lib/Radio/Radio.js +5 -39
- package/lib/Radio/RadioButton.js +7 -26
- package/lib/Radio/RadioGroup.js +6 -39
- package/lib/Radio/RadioInput.js +1 -11
- package/lib/Radio/RadioInput.native.js +0 -2
- package/lib/Radio/index.js +0 -4
- package/lib/RadioCard/RadioCard.js +5 -38
- package/lib/RadioCard/RadioCardGroup.js +25 -40
- package/lib/RadioCard/index.js +0 -4
- package/lib/Responsive/Responsive.js +1 -14
- package/lib/Responsive/index.js +0 -3
- package/lib/Search/Search.js +22 -45
- package/lib/Search/index.js +0 -3
- package/lib/Select/Group.js +0 -8
- package/lib/Select/Group.native.js +0 -6
- package/lib/Select/Item.js +0 -7
- package/lib/Select/Item.native.js +0 -2
- package/lib/Select/Picker.js +0 -8
- package/lib/Select/Picker.native.js +6 -22
- package/lib/Select/Select.js +9 -52
- package/lib/Select/index.js +0 -5
- package/lib/SideNav/Item.js +5 -29
- package/lib/SideNav/ItemContent.js +1 -14
- package/lib/SideNav/ItemsGroup.js +9 -31
- package/lib/SideNav/SideNav.js +9 -33
- package/lib/SideNav/index.js +0 -2
- package/lib/Skeleton/Skeleton.js +10 -42
- package/lib/Skeleton/index.js +0 -3
- package/lib/Skeleton/skeletonWebAnimation.js +0 -2
- package/lib/Skeleton/useSkeletonNativeAnimation.js +1 -9
- package/lib/SkipLink/SkipLink.js +7 -27
- package/lib/SkipLink/index.js +0 -3
- package/lib/Spacer/Spacer.js +4 -20
- package/lib/Spacer/index.js +0 -3
- package/lib/StackView/StackView.js +3 -21
- package/lib/StackView/StackWrap.js +11 -21
- package/lib/StackView/StackWrap.native.js +0 -3
- package/lib/StackView/StackWrapBox.js +5 -21
- package/lib/StackView/StackWrapGap.js +1 -14
- package/lib/StackView/common.js +0 -6
- package/lib/StackView/getStackedContent.js +10 -21
- package/lib/StackView/index.js +0 -5
- package/lib/StepTracker/Step.js +3 -27
- package/lib/StepTracker/StepTracker.js +5 -32
- package/lib/StepTracker/index.js +0 -3
- package/lib/Tabs/Tabs.js +7 -30
- package/lib/Tabs/TabsItem.js +13 -38
- package/lib/Tabs/index.js +0 -3
- package/lib/Tags/Tags.js +9 -42
- package/lib/Tags/index.js +0 -3
- package/lib/TextInput/TextArea.js +11 -20
- package/lib/TextInput/TextInput.js +7 -16
- package/lib/TextInput/TextInputBase.js +12 -58
- package/lib/TextInput/index.js +0 -3
- package/lib/TextInput/propTypes.js +0 -8
- package/lib/ThemeProvider/ThemeProvider.js +10 -18
- package/lib/ThemeProvider/index.js +0 -9
- package/lib/ThemeProvider/useSetTheme.js +6 -9
- package/lib/ThemeProvider/useTheme.js +2 -7
- package/lib/ThemeProvider/useThemeTokens.js +1 -9
- package/lib/ThemeProvider/utils/index.js +0 -4
- package/lib/ThemeProvider/utils/styles.js +14 -35
- package/lib/ThemeProvider/utils/theme-tokens.js +15 -43
- package/lib/Timeline/Timeline.js +11 -27
- package/lib/Timeline/index.js +0 -3
- package/lib/ToggleSwitch/ToggleSwitch.js +12 -43
- package/lib/ToggleSwitch/ToggleSwitchGroup.js +4 -38
- package/lib/ToggleSwitch/index.js +0 -3
- package/lib/Tooltip/Backdrop.js +4 -11
- package/lib/Tooltip/Backdrop.native.js +1 -14
- package/lib/Tooltip/Tooltip.js +9 -37
- package/lib/Tooltip/Tooltip.native.js +14 -45
- package/lib/Tooltip/getTooltipPosition.js +26 -31
- package/lib/Tooltip/index.js +0 -5
- package/lib/Tooltip/shared.js +0 -10
- package/lib/TooltipButton/TooltipButton.js +5 -20
- package/lib/TooltipButton/index.js +0 -3
- package/lib/Typography/Typography.js +15 -38
- package/lib/Typography/index.js +0 -3
- package/lib/Validator/Validator.js +10 -58
- package/lib/Validator/index.js +0 -3
- package/lib/ViewportProvider/ViewportProvider.js +1 -13
- package/lib/ViewportProvider/index.js +0 -5
- package/lib/ViewportProvider/useViewport.js +0 -4
- package/lib/ViewportProvider/useViewportListener.js +3 -12
- package/lib/index.js +8 -71
- package/lib/utils/BaseView/BaseView.js +3 -17
- package/lib/utils/BaseView/BaseView.native.js +0 -3
- package/lib/utils/BaseView/index.js +0 -3
- package/lib/utils/a11y/index.js +0 -4
- package/lib/utils/a11y/semantics.js +14 -32
- package/lib/utils/a11y/textSize.js +1 -8
- package/lib/utils/animation/index.js +0 -2
- package/lib/utils/animation/useVerticalExpandAnimation.js +5 -18
- package/lib/utils/children.js +16 -28
- package/lib/utils/containUniqueFields.js +2 -5
- package/lib/utils/floating-ui/index.js +0 -1
- package/lib/utils/floating-ui/index.native.js +0 -1
- package/lib/utils/hasOwnProperty.js +0 -1
- package/lib/utils/htmlAttrs.js +2 -4
- package/lib/utils/index.js +0 -31
- package/lib/utils/info/index.js +0 -4
- package/lib/utils/info/platform/index.js +0 -4
- package/lib/utils/info/versions.js +0 -3
- package/lib/utils/input.js +12 -24
- package/lib/utils/pressability.js +7 -21
- package/lib/utils/props/a11yProps.js +19 -25
- package/lib/utils/props/clickProps.js +0 -4
- package/lib/utils/props/componentPropType.js +0 -14
- package/lib/utils/props/copyPropTypes.js +0 -4
- package/lib/utils/props/getPropSelector.js +11 -12
- package/lib/utils/props/handlerProps.js +2 -23
- package/lib/utils/props/hrefAttrsProp.js +0 -4
- package/lib/utils/props/index.js +0 -22
- package/lib/utils/props/inputSupportsProps.js +0 -9
- package/lib/utils/props/linkProps.js +2 -12
- package/lib/utils/props/paddingProp.js +0 -3
- package/lib/utils/props/pressProps.js +2 -8
- package/lib/utils/props/rectProp.js +0 -3
- package/lib/utils/props/responsiveProps.js +1 -5
- package/lib/utils/props/selectSystemProps.js +4 -6
- package/lib/utils/props/spacingProps.js +3 -10
- package/lib/utils/props/textInputProps.js +10 -31
- package/lib/utils/props/textProps.js +6 -11
- package/lib/utils/props/tokens.js +7 -26
- package/lib/utils/props/variantProp.js +0 -3
- package/lib/utils/props/viewProps.js +0 -5
- package/lib/utils/ssr.js +13 -33
- package/lib/utils/useCopy.js +3 -6
- package/lib/utils/useHash.js +5 -10
- package/lib/utils/useHash.native.js +0 -2
- package/lib/utils/useOverlaidPosition.js +6 -29
- package/lib/utils/useResponsiveProp.js +6 -13
- package/lib/utils/useSafeLayoutEffect.js +5 -10
- package/lib/utils/useScrollBlocking.js +3 -11
- package/lib/utils/useScrollBlocking.native.js +0 -2
- package/lib/utils/useSpacingScale.js +5 -8
- package/lib/utils/useUniqueId.js +0 -4
- package/lib/utils/withLinkRouter.js +13 -18
- package/lib-module/A11yInfoProvider/index.js +5 -9
- package/lib-module/A11yText/index.js +3 -4
- package/lib-module/ActivityIndicator/Spinner.js +2 -2
- package/lib-module/ActivityIndicator/Spinner.native.js +4 -6
- package/lib-module/ActivityIndicator/index.js +1 -5
- package/lib-module/ActivityIndicator/shared.js +2 -1
- package/lib-module/Autocomplete/Autocomplete.js +34 -59
- package/lib-module/Autocomplete/Loading.js +0 -2
- package/lib-module/BaseProvider/HydrationContext.js +4 -7
- package/lib-module/BaseProvider/index.js +0 -3
- package/lib-module/Box/Box.js +10 -24
- package/lib-module/Button/Button.js +4 -2
- package/lib-module/Button/ButtonBase.js +23 -35
- package/lib-module/Button/ButtonDropdown.js +7 -16
- package/lib-module/Button/ButtonGroup.js +15 -32
- package/lib-module/Button/ButtonLink.js +3 -2
- package/lib-module/Button/propTypes.js +0 -7
- package/lib-module/Card/Card.js +3 -2
- package/lib-module/Card/CardBase.js +5 -4
- package/lib-module/Card/PressableCardBase.js +7 -11
- package/lib-module/Carousel/Carousel.js +22 -60
- package/lib-module/Carousel/CarouselContext.js +0 -5
- package/lib-module/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +7 -5
- package/lib-module/Carousel/CarouselItem/CarouselItem.js +5 -11
- package/lib-module/Carousel/CarouselStepTracker/CarouselStepTracker.js +0 -2
- package/lib-module/Carousel/CarouselTabs/CarouselTabs.js +3 -4
- package/lib-module/Carousel/CarouselTabs/CarouselTabsPanel.js +7 -6
- package/lib-module/Carousel/CarouselTabs/CarouselTabsPanelItem.js +2 -10
- package/lib-module/Carousel/CarouselThumbnail.js +1 -7
- package/lib-module/Carousel/CarouselThumbnailNavigation.js +0 -2
- package/lib-module/Checkbox/Checkbox.js +5 -23
- package/lib-module/Checkbox/CheckboxButton.js +7 -17
- package/lib-module/Checkbox/CheckboxGroup.js +14 -31
- package/lib-module/Checkbox/CheckboxInput.js +1 -3
- package/lib-module/Checkbox/CheckboxInput.native.js +0 -1
- package/lib-module/CheckboxCard/CheckboxCard.js +4 -21
- package/lib-module/CheckboxCardGroup/CheckboxCardGroup.js +206 -0
- package/lib-module/CheckboxCardGroup/index.js +2 -0
- package/lib-module/Divider/Divider.js +13 -11
- package/lib-module/ExpandCollapse/Accordion.js +1 -1
- package/lib-module/ExpandCollapse/Control.js +10 -17
- package/lib-module/ExpandCollapse/ExpandCollapse.js +3 -9
- package/lib-module/ExpandCollapse/Panel.js +13 -23
- package/lib-module/Feedback/Feedback.js +13 -16
- package/lib-module/Fieldset/Fieldset.js +6 -25
- package/lib-module/Fieldset/FieldsetContainer.js +1 -1
- package/lib-module/Fieldset/FieldsetContainer.native.js +0 -1
- package/lib-module/Fieldset/Legend.js +1 -1
- package/lib-module/Fieldset/Legend.native.js +1 -1
- package/lib-module/FlexGrid/Col/Col.js +10 -37
- package/lib-module/FlexGrid/FlexGrid.js +3 -17
- package/lib-module/FlexGrid/Row/Row.js +0 -25
- package/lib-module/FlexGrid/helpers/index.js +0 -3
- package/lib-module/HorizontalScroll/HorizontalScroll.js +17 -27
- package/lib-module/HorizontalScroll/HorizontalScrollButton.js +1 -3
- package/lib-module/HorizontalScroll/ScrollViewEnd.js +5 -4
- package/lib-module/HorizontalScroll/ScrollViewEnd.native.js +0 -1
- package/lib-module/HorizontalScroll/itemPositions.js +11 -10
- package/lib-module/Icon/Icon.js +4 -8
- package/lib-module/Icon/IconText.js +6 -17
- package/lib-module/IconButton/IconButton.js +7 -20
- package/lib-module/InputLabel/InputLabel.js +4 -13
- package/lib-module/InputLabel/LabelContent.js +2 -1
- package/lib-module/InputLabel/LabelContent.native.js +0 -1
- package/lib-module/InputSupports/InputSupports.js +0 -9
- package/lib-module/InputSupports/useInputSupports.js +2 -4
- package/lib-module/Link/ChevronLink.js +7 -7
- package/lib-module/Link/InlinePressable.js +0 -2
- package/lib-module/Link/InlinePressable.native.js +4 -12
- package/lib-module/Link/LinkBase.js +17 -25
- package/lib-module/Link/TextButton.js +3 -5
- package/lib-module/List/List.js +5 -9
- package/lib-module/List/ListItem.js +1 -1
- package/lib-module/List/ListItemBase.js +5 -17
- package/lib-module/List/ListItemContent.js +1 -4
- package/lib-module/List/ListItemMark.js +3 -16
- package/lib-module/List/PressableListItemBase.js +2 -6
- package/lib-module/Listbox/GroupControl.js +0 -2
- package/lib-module/Listbox/Listbox.js +15 -23
- package/lib-module/Listbox/ListboxContext.js +0 -2
- package/lib-module/Listbox/ListboxGroup.js +6 -4
- package/lib-module/Listbox/ListboxItem.js +2 -1
- package/lib-module/Listbox/ListboxOverlay.js +3 -4
- package/lib-module/Listbox/PressableItem.js +2 -7
- package/lib-module/Modal/Modal.js +94 -25
- package/lib-module/Modal/ModalContent.js +175 -0
- package/lib-module/MultiSelectFilter/ModalOverlay.js +1 -4
- package/lib-module/MultiSelectFilter/MultiSelectFilter.js +20 -42
- package/lib-module/Notification/Notification.js +11 -22
- package/lib-module/Pagination/PageButton.js +2 -6
- package/lib-module/Pagination/Pagination.js +21 -21
- package/lib-module/Pagination/SideButton.js +3 -8
- package/lib-module/Pagination/usePagination.js +4 -8
- package/lib-module/Progress/Progress.js +3 -7
- package/lib-module/Progress/ProgressBar.js +3 -11
- package/lib-module/Progress/ProgressBarBackground.js +0 -2
- package/lib-module/QuickLinks/QuickLinks.js +1 -6
- package/lib-module/QuickLinks/QuickLinksCard.js +1 -3
- package/lib-module/QuickLinks/QuickLinksItem.js +3 -2
- package/lib-module/QuickLinksFeature/QuickLinksFeature.js +5 -9
- package/lib-module/QuickLinksFeature/QuickLinksFeatureItem.js +9 -13
- package/lib-module/Radio/Radio.js +5 -22
- package/lib-module/Radio/RadioButton.js +8 -10
- package/lib-module/Radio/RadioGroup.js +6 -25
- package/lib-module/Radio/RadioInput.js +1 -3
- package/lib-module/Radio/RadioInput.native.js +0 -1
- package/lib-module/RadioCard/RadioCard.js +5 -21
- package/lib-module/RadioCard/RadioCardGroup.js +25 -27
- package/lib-module/Responsive/Responsive.js +1 -6
- package/lib-module/Search/Search.js +22 -31
- package/lib-module/Select/Group.js +0 -3
- package/lib-module/Select/Group.native.js +0 -3
- package/lib-module/Select/Item.js +0 -3
- package/lib-module/Select/Item.native.js +0 -1
- package/lib-module/Select/Picker.native.js +8 -10
- package/lib-module/Select/Select.js +10 -35
- package/lib-module/SideNav/Item.js +5 -16
- package/lib-module/SideNav/ItemContent.js +1 -2
- package/lib-module/SideNav/ItemsGroup.js +9 -19
- package/lib-module/SideNav/SideNav.js +9 -22
- package/lib-module/Skeleton/Skeleton.js +10 -25
- package/lib-module/Skeleton/skeletonWebAnimation.js +0 -1
- package/lib-module/Skeleton/useSkeletonNativeAnimation.js +1 -3
- package/lib-module/SkipLink/SkipLink.js +7 -9
- package/lib-module/Spacer/Spacer.js +4 -7
- package/lib-module/StackView/StackView.js +3 -7
- package/lib-module/StackView/StackWrap.js +13 -13
- package/lib-module/StackView/StackWrap.native.js +2 -1
- package/lib-module/StackView/StackWrapBox.js +5 -8
- package/lib-module/StackView/StackWrapGap.js +1 -1
- package/lib-module/StackView/getStackedContent.js +10 -10
- package/lib-module/StepTracker/Step.js +3 -14
- package/lib-module/StepTracker/StepTracker.js +5 -13
- package/lib-module/Tabs/Tabs.js +7 -16
- package/lib-module/Tabs/TabsItem.js +13 -16
- package/lib-module/Tags/Tags.js +9 -26
- package/lib-module/TextInput/TextArea.js +11 -8
- package/lib-module/TextInput/TextInput.js +7 -5
- package/lib-module/TextInput/TextInputBase.js +13 -39
- package/lib-module/TextInput/propTypes.js +3 -7
- package/lib-module/ThemeProvider/ThemeProvider.js +10 -9
- package/lib-module/ThemeProvider/useSetTheme.js +6 -7
- package/lib-module/ThemeProvider/useTheme.js +2 -5
- package/lib-module/ThemeProvider/useThemeTokens.js +1 -2
- package/lib-module/ThemeProvider/utils/styles.js +15 -27
- package/lib-module/ThemeProvider/utils/theme-tokens.js +15 -20
- package/lib-module/Timeline/Timeline.js +11 -17
- package/lib-module/ToggleSwitch/ToggleSwitch.js +13 -26
- package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +4 -23
- package/lib-module/Tooltip/Backdrop.js +4 -7
- package/lib-module/Tooltip/Backdrop.native.js +1 -4
- package/lib-module/Tooltip/Tooltip.js +9 -18
- package/lib-module/Tooltip/Tooltip.native.js +14 -23
- package/lib-module/Tooltip/getTooltipPosition.js +26 -30
- package/lib-module/Tooltip/shared.js +0 -6
- package/lib-module/TooltipButton/TooltipButton.js +5 -8
- package/lib-module/Typography/Typography.js +14 -22
- package/lib-module/Validator/Validator.js +10 -42
- package/lib-module/ViewportProvider/ViewportProvider.js +1 -3
- package/lib-module/ViewportProvider/useViewportListener.js +6 -8
- package/lib-module/index.js +1 -0
- package/lib-module/utils/BaseView/BaseView.js +3 -4
- package/lib-module/utils/BaseView/BaseView.native.js +0 -1
- package/lib-module/utils/a11y/semantics.js +14 -27
- package/lib-module/utils/a11y/textSize.js +1 -2
- package/lib-module/utils/animation/useVerticalExpandAnimation.js +8 -11
- package/lib-module/utils/children.js +17 -19
- package/lib-module/utils/containUniqueFields.js +2 -4
- package/lib-module/utils/htmlAttrs.js +2 -1
- package/lib-module/utils/info/index.js +2 -1
- package/lib-module/utils/info/platform/index.js +4 -1
- package/lib-module/utils/info/versions.js +2 -1
- package/lib-module/utils/input.js +11 -19
- package/lib-module/utils/pressability.js +8 -7
- package/lib-module/utils/props/a11yProps.js +22 -20
- package/lib-module/utils/props/clickProps.js +0 -1
- package/lib-module/utils/props/componentPropType.js +0 -13
- package/lib-module/utils/props/getPropSelector.js +12 -8
- package/lib-module/utils/props/handlerProps.js +2 -19
- package/lib-module/utils/props/hrefAttrsProp.js +2 -2
- package/lib-module/utils/props/inputSupportsProps.js +0 -6
- package/lib-module/utils/props/linkProps.js +2 -3
- package/lib-module/utils/props/pressProps.js +2 -2
- package/lib-module/utils/props/responsiveProps.js +1 -3
- package/lib-module/utils/props/selectSystemProps.js +4 -5
- package/lib-module/utils/props/spacingProps.js +4 -3
- package/lib-module/utils/props/textInputProps.js +13 -27
- package/lib-module/utils/props/textProps.js +9 -7
- package/lib-module/utils/props/tokens.js +10 -13
- package/lib-module/utils/props/variantProp.js +1 -1
- package/lib-module/utils/props/viewProps.js +0 -1
- package/lib-module/utils/ssr.js +14 -18
- package/lib-module/utils/useCopy.js +3 -5
- package/lib-module/utils/useHash.js +5 -9
- package/lib-module/utils/useHash.native.js +0 -1
- package/lib-module/utils/useOverlaidPosition.js +6 -25
- package/lib-module/utils/useResponsiveProp.js +6 -7
- package/lib-module/utils/useSafeLayoutEffect.js +5 -7
- package/lib-module/utils/useScrollBlocking.js +3 -10
- package/lib-module/utils/useSpacingScale.js +4 -4
- package/lib-module/utils/useUniqueId.js +0 -2
- package/lib-module/utils/withLinkRouter.js +13 -10
- package/package.json +2 -2
- package/src/Checkbox/CheckboxGroup.jsx +10 -8
- package/src/CheckboxCardGroup/CheckboxCardGroup.jsx +231 -0
- package/src/CheckboxCardGroup/index.js +3 -0
- package/src/Modal/Modal.jsx +98 -5
- package/src/Modal/ModalContent.jsx +171 -0
- package/src/RadioCard/RadioCardGroup.jsx +23 -2
- package/src/index.js +1 -0
|
@@ -29,9 +29,10 @@ const staticStyles = StyleSheet.create({
|
|
|
29
29
|
flexShrink: 0
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs, inputSupportsProps, textInputHandlerProps, textInputProps]);
|
|
33
|
-
// `substring` based in the array of `matchIndexes` provided
|
|
32
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs, inputSupportsProps, textInputHandlerProps, textInputProps]);
|
|
34
33
|
|
|
34
|
+
// Returns JSX to display a bold string `str` with unbolded occurrences of the
|
|
35
|
+
// `substring` based in the array of `matchIndexes` provided
|
|
35
36
|
const highlightAllMatches = function (str) {
|
|
36
37
|
let substring = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
37
38
|
let matchIndexes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
@@ -46,7 +47,8 @@ const highlightAllMatches = function (str) {
|
|
|
46
47
|
tokens: {
|
|
47
48
|
color: resultsTextColor
|
|
48
49
|
},
|
|
49
|
-
children: matchIndexes.reduce((acc, matchIndex, index) => [...acc,
|
|
50
|
+
children: matchIndexes.reduce((acc, matchIndex, index) => [...acc,
|
|
51
|
+
// Add a piece of the string up to the first occurrence of the substring
|
|
50
52
|
index === 0 && (str.slice(0, matchIndex) ?? ''),
|
|
51
53
|
/*#__PURE__*/
|
|
52
54
|
// Unbold the occurrence of the substring (while keeping the original casing)
|
|
@@ -58,39 +60,35 @@ const highlightAllMatches = function (str) {
|
|
|
58
60
|
color: resultsTextColor
|
|
59
61
|
},
|
|
60
62
|
children: str.slice(matchIndex, matchIndex + substring.length)
|
|
61
|
-
}, matchIndex),
|
|
63
|
+
}, matchIndex),
|
|
64
|
+
// Add the rest of the string until the next occurrence or the end of it
|
|
62
65
|
str.slice(matchIndex + substring.length, matchIndexes[index + 1] ?? str.length)], [])
|
|
63
66
|
})
|
|
64
67
|
);
|
|
65
68
|
};
|
|
66
|
-
|
|
67
69
|
const highlight = function () {
|
|
68
70
|
let items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
69
71
|
let text = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
70
72
|
let color = arguments.length > 2 ? arguments[2] : undefined;
|
|
71
73
|
return items.reduce((acc, item) => {
|
|
72
74
|
var _Array$from;
|
|
73
|
-
|
|
74
75
|
const matches = (_Array$from = Array.from(matchAll(item.label.toLowerCase(), text.toLowerCase().replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&')))) === null || _Array$from === void 0 ? void 0 : _Array$from.map(_ref => {
|
|
75
76
|
let {
|
|
76
77
|
index
|
|
77
78
|
} = _ref;
|
|
78
79
|
return index;
|
|
79
80
|
});
|
|
80
|
-
|
|
81
81
|
if (matches !== null && matches !== void 0 && matches.length) {
|
|
82
|
-
return [...acc, {
|
|
82
|
+
return [...acc, {
|
|
83
|
+
...item,
|
|
83
84
|
label: highlightAllMatches(item.label, text, matches, color)
|
|
84
85
|
}];
|
|
85
86
|
}
|
|
86
|
-
|
|
87
87
|
return [...acc, item];
|
|
88
88
|
}, []);
|
|
89
89
|
};
|
|
90
|
-
|
|
91
90
|
const Autocomplete = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
92
91
|
var _ref3;
|
|
93
|
-
|
|
94
92
|
let {
|
|
95
93
|
children,
|
|
96
94
|
copy = 'en',
|
|
@@ -115,27 +113,31 @@ const Autocomplete = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
115
113
|
color: resultsTextColor
|
|
116
114
|
} = useThemeTokens('Search', {}, {
|
|
117
115
|
focus: true
|
|
118
|
-
});
|
|
116
|
+
});
|
|
117
|
+
// The wrapped input is mostly responsible for controlled vs uncontrolled handling,
|
|
119
118
|
// but we also need to adjust suggestions based on the mode:
|
|
120
119
|
// - in controlled mode we rely entirely on the suggestions passed via the `items` prop,
|
|
121
120
|
// - in uncontrolled mode we filter the suggestions ourselves based on the `initialItems`
|
|
122
121
|
// prop and the text entered
|
|
122
|
+
const isControlled = value !== undefined;
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
// We need to store current items for uncontrolled usage
|
|
126
125
|
const [currentItems, setCurrentItems] = useState(initialItems);
|
|
127
|
-
const [otherItems, setOtherItems] = useState(items);
|
|
126
|
+
const [otherItems, setOtherItems] = useState(items);
|
|
128
127
|
|
|
128
|
+
// We need to store the current value as well to be able to highlight it
|
|
129
129
|
const [currentValue, setCurrentValue] = useState(value ?? initialValue);
|
|
130
130
|
const inputTokens = {
|
|
131
131
|
paddingLeft: INPUT_LEFT_PADDING
|
|
132
|
-
};
|
|
132
|
+
};
|
|
133
133
|
|
|
134
|
+
// Setting up the overlay
|
|
134
135
|
const openOverlayRef = useRef();
|
|
135
136
|
const [isExpanded, setIsExpanded] = useState(((_ref3 = value ?? initialValue) === null || _ref3 === void 0 ? void 0 : _ref3.length) >= minToSuggestion);
|
|
136
137
|
const [isFocused, setisFocused] = useState(false);
|
|
137
|
-
const [sourceLayout, setSourceLayout] = useState(null);
|
|
138
|
+
const [sourceLayout, setSourceLayout] = useState(null);
|
|
138
139
|
|
|
140
|
+
// When it's nested, selected value
|
|
139
141
|
const [nestedSelectedValue, setNestedSelectedValue] = useState(null);
|
|
140
142
|
const {
|
|
141
143
|
supportsProps,
|
|
@@ -158,28 +160,25 @@ const Autocomplete = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
158
160
|
vertical: Platform.OS !== 'web' && (hint || inputLabel) ? 28 : 4
|
|
159
161
|
}
|
|
160
162
|
});
|
|
161
|
-
const targetRef = useRef(null);
|
|
163
|
+
const targetRef = useRef(null);
|
|
164
|
+
// We limit the number of suggestions displayed to avoid huge lists
|
|
162
165
|
// TODO: add a way to make the `Listbox` occupy fixed height and be scrollable
|
|
163
166
|
// within that height, which will unlock similar behaviour for `AutoComplete` as well
|
|
164
|
-
|
|
165
167
|
const itemsToSuggest = function () {
|
|
166
168
|
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
167
169
|
return maxSuggestions ? data.slice(0, maxSuggestions) : [...data];
|
|
168
170
|
};
|
|
169
|
-
|
|
170
171
|
const getCopy = useCopy({
|
|
171
172
|
dictionary,
|
|
172
173
|
copy
|
|
173
|
-
});
|
|
174
|
-
|
|
174
|
+
});
|
|
175
|
+
// Tracking input width changes to resize the listbox overlay accordingly
|
|
175
176
|
const [inputWidth, setInputWidth] = useState();
|
|
176
177
|
useSafeLayoutEffect(() => {
|
|
177
178
|
if (Platform.OS === 'web') {
|
|
178
179
|
const updateInputWidth = () => {
|
|
179
180
|
var _inputRef$current;
|
|
180
|
-
|
|
181
181
|
setInputWidth((inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.clientWidth) + 4); // adding back all the input borders / outlines
|
|
182
|
-
|
|
183
182
|
setIsExpanded(false); // close the suggestions while the input is changing
|
|
184
183
|
};
|
|
185
184
|
|
|
@@ -192,32 +191,25 @@ const Autocomplete = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
192
191
|
Dimensions.removeEventListener('change', throttledUpdateInputWidth);
|
|
193
192
|
};
|
|
194
193
|
}
|
|
195
|
-
|
|
196
194
|
setInputWidth(sourceLayout === null || sourceLayout === void 0 ? void 0 : sourceLayout.width);
|
|
197
195
|
return () => {};
|
|
198
196
|
}, [inputRef, sourceLayout]);
|
|
199
|
-
|
|
200
197
|
const handleMeasure = event => {
|
|
201
198
|
onTargetLayout(event);
|
|
202
|
-
|
|
203
199
|
if (Platform.OS !== 'web') {
|
|
204
200
|
var _inputRef$current2;
|
|
205
|
-
|
|
206
201
|
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.measureInWindow((x, y, width) => {
|
|
207
202
|
setInputWidth(width);
|
|
208
203
|
});
|
|
209
204
|
}
|
|
210
205
|
};
|
|
211
|
-
|
|
212
206
|
const handleChange = newValue => {
|
|
213
207
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue || '');
|
|
214
208
|
setCurrentValue(newValue);
|
|
215
209
|
setIsExpanded((newValue === null || newValue === void 0 ? void 0 : newValue.length) >= minToSuggestion);
|
|
216
|
-
|
|
217
210
|
if (!isControlled && initialItems !== undefined) {
|
|
218
211
|
setCurrentItems(initialItems.filter(_ref4 => {
|
|
219
212
|
var _label$toLowerCase;
|
|
220
|
-
|
|
221
213
|
let {
|
|
222
214
|
label
|
|
223
215
|
} = _ref4;
|
|
@@ -225,10 +217,8 @@ const Autocomplete = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
225
217
|
}));
|
|
226
218
|
}
|
|
227
219
|
};
|
|
228
|
-
|
|
229
220
|
const handleSelect = selectedId => {
|
|
230
221
|
var _ref5;
|
|
231
|
-
|
|
232
222
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect(selectedId);
|
|
233
223
|
const {
|
|
234
224
|
label: newValue,
|
|
@@ -241,25 +231,22 @@ const Autocomplete = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
241
231
|
return id === selectedId;
|
|
242
232
|
});
|
|
243
233
|
if (title) return;
|
|
244
|
-
|
|
245
234
|
if (!nested) {
|
|
246
235
|
setNestedSelectedValue(null);
|
|
247
236
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
248
237
|
setIsExpanded(false);
|
|
249
238
|
}
|
|
250
|
-
|
|
251
239
|
setCurrentValue(newValue);
|
|
252
240
|
if (!isControlled && inputRef !== null && inputRef !== void 0 && inputRef.current) inputRef.current.value = newValue;
|
|
253
241
|
if (nested) setNestedSelectedValue(newValue);
|
|
254
242
|
};
|
|
243
|
+
|
|
255
244
|
/**
|
|
256
245
|
* When an item that is nested equal "true" is selected this useEffect is executed.
|
|
257
246
|
* The nested item is added to the item list at the top, the if validates it doesn't exist
|
|
258
247
|
* within the list, if doesn't exist the nested item is added to the top of the list,
|
|
259
248
|
* the nested item is added with an id equal "0"
|
|
260
249
|
*/
|
|
261
|
-
|
|
262
|
-
|
|
263
250
|
useEffect(() => {
|
|
264
251
|
if (nestedSelectedValue && !items.find(item => item.id === 0)) {
|
|
265
252
|
const tmpItems = [...items];
|
|
@@ -269,16 +256,15 @@ const Autocomplete = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
269
256
|
id: 0
|
|
270
257
|
});
|
|
271
258
|
setOtherItems(tmpItems.map(item => {
|
|
272
|
-
return {
|
|
259
|
+
return {
|
|
260
|
+
...item,
|
|
273
261
|
nestedChild: item.id !== 0
|
|
274
262
|
};
|
|
275
263
|
}));
|
|
276
264
|
}
|
|
277
265
|
}, [nestedSelectedValue, items]);
|
|
278
|
-
|
|
279
266
|
const handleClose = event => {
|
|
280
267
|
var _openOverlayRef$curre, _openOverlayRef$curre2;
|
|
281
|
-
|
|
282
268
|
if (event.type === 'keydown') {
|
|
283
269
|
if (event.key === 'Escape' || event.key === 27) {
|
|
284
270
|
setIsExpanded(false);
|
|
@@ -296,12 +282,12 @@ const Autocomplete = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
296
282
|
setNestedSelectedValue(null);
|
|
297
283
|
}
|
|
298
284
|
};
|
|
299
|
-
|
|
300
285
|
const itemsToShow = currentValue ? itemsToSuggest(highlight(isControlled ? items : currentItems, currentValue, resultsTextColor)) : [];
|
|
301
286
|
const helpTextToShow = isFocused && !currentValue ? helpText : noResults ?? getCopy('noResults');
|
|
302
287
|
return /*#__PURE__*/_jsxs(View, {
|
|
303
288
|
style: staticStyles.container,
|
|
304
|
-
children: [/*#__PURE__*/_jsx(InputSupports, {
|
|
289
|
+
children: [/*#__PURE__*/_jsx(InputSupports, {
|
|
290
|
+
...supportsProps,
|
|
305
291
|
accessibilityAutoComplete: "list",
|
|
306
292
|
accessibilityControls: "autocomplete",
|
|
307
293
|
accessibilityExpanded: isExpanded,
|
|
@@ -375,11 +361,11 @@ const Autocomplete = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
375
361
|
parentRef: inputRef,
|
|
376
362
|
ref: targetRef
|
|
377
363
|
})
|
|
378
|
-
}), (targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) && /*#__PURE__*/_jsx(View
|
|
364
|
+
}), (targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) && /*#__PURE__*/_jsx(View
|
|
365
|
+
// This catches and shifts focus to other interactive elements.
|
|
379
366
|
, {
|
|
380
367
|
onFocus: () => {
|
|
381
368
|
var _targetRef$current;
|
|
382
|
-
|
|
383
369
|
return targetRef === null || targetRef === void 0 ? void 0 : (_targetRef$current = targetRef.current) === null || _targetRef$current === void 0 ? void 0 : _targetRef$current.focus();
|
|
384
370
|
},
|
|
385
371
|
tabIndex: 0
|
|
@@ -387,15 +373,16 @@ const Autocomplete = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
387
373
|
})]
|
|
388
374
|
});
|
|
389
375
|
});
|
|
390
|
-
Autocomplete.displayName = 'Autocomplete';
|
|
376
|
+
Autocomplete.displayName = 'Autocomplete';
|
|
391
377
|
|
|
378
|
+
// If a language dictionary entry is provided, it must contain every key
|
|
392
379
|
const dictionaryContentShape = PropTypes.shape({
|
|
393
380
|
hasResults: PropTypes.string.isRequired,
|
|
394
381
|
loading: PropTypes.string.isRequired,
|
|
395
382
|
noResults: PropTypes.string.isRequired
|
|
396
383
|
});
|
|
397
|
-
Autocomplete.propTypes = {
|
|
398
|
-
|
|
384
|
+
Autocomplete.propTypes = {
|
|
385
|
+
...selectedSystemPropTypes,
|
|
399
386
|
/**
|
|
400
387
|
* Can be used to provide a function that renders a custom input:
|
|
401
388
|
* <Autocomplete items={items} value={currentValue}>
|
|
@@ -413,17 +400,14 @@ Autocomplete.propTypes = { ...selectedSystemPropTypes,
|
|
|
413
400
|
* </Autocomplete>
|
|
414
401
|
*/
|
|
415
402
|
children: PropTypes.func,
|
|
416
|
-
|
|
417
403
|
/**
|
|
418
404
|
* Copy language identifier
|
|
419
405
|
*/
|
|
420
406
|
copy: PropTypes.oneOfType([PropTypes.oneOf(['en', 'fr']), dictionaryContentShape]),
|
|
421
|
-
|
|
422
407
|
/**
|
|
423
408
|
* Set to true in order to display the loading indicator instead of results
|
|
424
409
|
*/
|
|
425
410
|
isLoading: PropTypes.bool,
|
|
426
|
-
|
|
427
411
|
/**
|
|
428
412
|
* List of items to display as suggestions
|
|
429
413
|
*/
|
|
@@ -431,47 +415,38 @@ Autocomplete.propTypes = { ...selectedSystemPropTypes,
|
|
|
431
415
|
id: PropTypes.string,
|
|
432
416
|
label: PropTypes.string
|
|
433
417
|
})),
|
|
434
|
-
|
|
435
418
|
/**
|
|
436
419
|
* Label to display alongside the spinner when in a loading state
|
|
437
420
|
*/
|
|
438
421
|
loadingLabel: PropTypes.string,
|
|
439
|
-
|
|
440
422
|
/**
|
|
441
423
|
* Minimum number of characters typed for a list of suggestions to appear
|
|
442
424
|
*/
|
|
443
425
|
minToSuggestion: PropTypes.number,
|
|
444
|
-
|
|
445
426
|
/**
|
|
446
427
|
* Maximum number of suggestions provided at the same time
|
|
447
428
|
*/
|
|
448
429
|
maxSuggestions: PropTypes.number,
|
|
449
|
-
|
|
450
430
|
/**
|
|
451
431
|
* Text or JSX to render when no results are available
|
|
452
432
|
*/
|
|
453
433
|
noResults: PropTypes.node,
|
|
454
|
-
|
|
455
434
|
/**
|
|
456
435
|
* Help text to display when the input is focused and empty
|
|
457
436
|
*/
|
|
458
437
|
helpText: PropTypes.string,
|
|
459
|
-
|
|
460
438
|
/**
|
|
461
439
|
* Handler function to be called when the input value changes
|
|
462
440
|
*/
|
|
463
441
|
onChange: PropTypes.func,
|
|
464
|
-
|
|
465
442
|
/**
|
|
466
443
|
* Handler function to be called when the clear button (appears if the handler is passed) is pressed
|
|
467
444
|
*/
|
|
468
445
|
onClear: PropTypes.func,
|
|
469
|
-
|
|
470
446
|
/**
|
|
471
447
|
* Callback function to be called when an item is selected from the list
|
|
472
448
|
*/
|
|
473
449
|
onSelect: PropTypes.func,
|
|
474
|
-
|
|
475
450
|
/**
|
|
476
451
|
* Input value for controlled usage
|
|
477
452
|
*/
|
|
@@ -6,7 +6,6 @@ import Box from '../Box';
|
|
|
6
6
|
import StackView from '../StackView';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
-
|
|
10
9
|
const Loading = _ref => {
|
|
11
10
|
let {
|
|
12
11
|
label
|
|
@@ -29,7 +28,6 @@ const Loading = _ref => {
|
|
|
29
28
|
})
|
|
30
29
|
});
|
|
31
30
|
};
|
|
32
|
-
|
|
33
31
|
Loading.propTypes = {
|
|
34
32
|
label: PropTypes.string
|
|
35
33
|
};
|
|
@@ -4,16 +4,14 @@ import Platform from "react-native-web/dist/exports/Platform";
|
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
const HydrationContext = /*#__PURE__*/createContext();
|
|
6
6
|
const isSSR = typeof window === 'undefined';
|
|
7
|
-
|
|
8
7
|
const hasWebStyleTag = () => {
|
|
9
8
|
var _document;
|
|
10
|
-
|
|
11
9
|
if (isSSR || Platform.OS !== 'web' || typeof document !== 'object') {
|
|
12
10
|
return false;
|
|
13
11
|
}
|
|
14
|
-
|
|
15
12
|
return Boolean((_document = document) === null || _document === void 0 ? void 0 : _document.getElementById('react-native-stylesheet'));
|
|
16
13
|
};
|
|
14
|
+
|
|
17
15
|
/**
|
|
18
16
|
* Returns true if this render cycle is the hydration of existing SSR content.
|
|
19
17
|
*
|
|
@@ -21,14 +19,12 @@ const hasWebStyleTag = () => {
|
|
|
21
19
|
* during the very first client-side render or hydration, but not available on the server,
|
|
22
20
|
* to ensure no changes happen until the original SSR DOM has been hydrated.
|
|
23
21
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
22
|
export const useHydrationContext = () => useContext(HydrationContext);
|
|
23
|
+
|
|
27
24
|
/**
|
|
28
25
|
* Allows components and hooks to observe if SSR hydration is currently in progress
|
|
29
26
|
* and if so, to re-render with content that differs to the server when it is complete.
|
|
30
27
|
*/
|
|
31
|
-
|
|
32
28
|
export const HydrationProvider = _ref => {
|
|
33
29
|
let {
|
|
34
30
|
children
|
|
@@ -36,8 +32,9 @@ export const HydrationProvider = _ref => {
|
|
|
36
32
|
const [hasMounted, setHasMounted] = useState(false);
|
|
37
33
|
useEffect(() => {
|
|
38
34
|
setHasMounted(true);
|
|
39
|
-
}, []);
|
|
35
|
+
}, []);
|
|
40
36
|
|
|
37
|
+
// If we've got a HydrationProvider inside a HydrationProvider somehow, defer to the top one
|
|
41
38
|
const valueFromAncestor = useHydrationContext();
|
|
42
39
|
const isHydrating = valueFromAncestor ?? Boolean(!hasMounted && hasWebStyleTag());
|
|
43
40
|
return /*#__PURE__*/_jsx(HydrationContext.Provider, {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var _ThemeProvider$propTy;
|
|
2
|
-
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
5
4
|
import { PortalProvider } from '@gorhom/portal';
|
|
@@ -8,7 +7,6 @@ import ViewportProvider from '../ViewportProvider';
|
|
|
8
7
|
import ThemeProvider from '../ThemeProvider';
|
|
9
8
|
import { HydrationProvider } from './HydrationContext';
|
|
10
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
|
|
12
10
|
const BaseProvider = _ref => {
|
|
13
11
|
let {
|
|
14
12
|
defaultTheme,
|
|
@@ -29,7 +27,6 @@ const BaseProvider = _ref => {
|
|
|
29
27
|
})
|
|
30
28
|
});
|
|
31
29
|
};
|
|
32
|
-
|
|
33
30
|
BaseProvider.propTypes = {
|
|
34
31
|
children: PropTypes.node.isRequired,
|
|
35
32
|
defaultTheme: (_ThemeProvider$propTy = ThemeProvider.propTypes) === null || _ThemeProvider$propTy === void 0 ? void 0 : _ThemeProvider$propTy.defaultTheme,
|
package/lib-module/Box/Box.js
CHANGED
|
@@ -6,6 +6,7 @@ import { useThemeTokens } from '../ThemeProvider';
|
|
|
6
6
|
import { a11yProps, getA11yPropsFromHtmlTag, getTokensPropType, layoutTags, selectSystemProps, spacingProps, useSpacingScale, variantProp, viewProps } from '../utils';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
9
|
+
|
|
9
10
|
/**
|
|
10
11
|
* @typedef {import('../utils/props/spacingProps.js').SpacingValue} SpacingValue
|
|
11
12
|
* @typedef {import('../utils/props/spacingProps.js').SpacingIndex} SpacingIndex
|
|
@@ -34,7 +35,6 @@ const selectBoxStyles = _ref => {
|
|
|
34
35
|
borderBottomLeftRadius,
|
|
35
36
|
borderBottomRightRadius
|
|
36
37
|
};
|
|
37
|
-
|
|
38
38
|
if (gradient) {
|
|
39
39
|
const {
|
|
40
40
|
angle,
|
|
@@ -42,9 +42,8 @@ const selectBoxStyles = _ref => {
|
|
|
42
42
|
} = gradient;
|
|
43
43
|
styles.backgroundImage = `linear-gradient(${angle}deg, ${stopOne.color}, 75% , ${stopTwo.color})`;
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
const paddings = ['paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom'];
|
|
46
|
+
// Only set on styles if token provided because we spread this object after the spacing scale values
|
|
48
47
|
paddings.forEach(side => {
|
|
49
48
|
if (rest[side]) {
|
|
50
49
|
styles[side] = rest[side];
|
|
@@ -52,6 +51,7 @@ const selectBoxStyles = _ref => {
|
|
|
52
51
|
});
|
|
53
52
|
return styles;
|
|
54
53
|
};
|
|
54
|
+
|
|
55
55
|
/**
|
|
56
56
|
* A layout utility component. Use Box to create space (padding) around content.
|
|
57
57
|
*
|
|
@@ -117,8 +117,6 @@ const selectBoxStyles = _ref => {
|
|
|
117
117
|
* text content is inside a scrollable box, as screens are not scrollable by default and even very
|
|
118
118
|
* short text will require scrolling on small devices at the highest accessibility text scaling settings.
|
|
119
119
|
*/
|
|
120
|
-
|
|
121
|
-
|
|
122
120
|
const Box = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
123
121
|
let {
|
|
124
122
|
space,
|
|
@@ -153,11 +151,11 @@ const Box = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
153
151
|
paddingBottom: useSpacingScale(bottom),
|
|
154
152
|
...selectBoxStyles(themeTokens)
|
|
155
153
|
};
|
|
156
|
-
|
|
157
154
|
if (scroll) {
|
|
158
155
|
const scrollProps = typeof scroll === 'object' ? scroll : {};
|
|
159
156
|
scrollProps.contentContainerStyle = [styles, scrollProps.contentContainerStyle];
|
|
160
|
-
return /*#__PURE__*/_jsx(ScrollView, {
|
|
157
|
+
return /*#__PURE__*/_jsx(ScrollView, {
|
|
158
|
+
...scrollProps,
|
|
161
159
|
...props,
|
|
162
160
|
testID: testID,
|
|
163
161
|
dataSet: dataSet,
|
|
@@ -165,8 +163,8 @@ const Box = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
165
163
|
children: children
|
|
166
164
|
});
|
|
167
165
|
}
|
|
168
|
-
|
|
169
|
-
|
|
166
|
+
return /*#__PURE__*/_jsx(View, {
|
|
167
|
+
...props,
|
|
170
168
|
style: styles,
|
|
171
169
|
testID: testID,
|
|
172
170
|
dataSet: dataSet,
|
|
@@ -175,59 +173,52 @@ const Box = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
175
173
|
});
|
|
176
174
|
});
|
|
177
175
|
Box.displayName = 'Box';
|
|
178
|
-
Box.propTypes = {
|
|
176
|
+
Box.propTypes = {
|
|
177
|
+
...selectedSystemPropTypes,
|
|
179
178
|
variant: variantProp.propType,
|
|
180
179
|
tokens: getTokensPropType('Box'),
|
|
181
|
-
|
|
182
180
|
/**
|
|
183
181
|
* Sets default padding on all sides of the box using the theme's spacing scale.
|
|
184
182
|
*
|
|
185
183
|
* @see {@link SpacingValue}
|
|
186
184
|
*/
|
|
187
185
|
space: spacingProps.types.spacingValue,
|
|
188
|
-
|
|
189
186
|
/**
|
|
190
187
|
* Sets top and bottom padding using the theme's spacing scale.
|
|
191
188
|
*
|
|
192
189
|
* @see {@link SpacingValue}
|
|
193
190
|
*/
|
|
194
191
|
vertical: spacingProps.types.spacingValue,
|
|
195
|
-
|
|
196
192
|
/**
|
|
197
193
|
* Sets left and right padding using the theme's spacing scale.
|
|
198
194
|
*
|
|
199
195
|
* @see {@link SpacingValue}
|
|
200
196
|
*/
|
|
201
197
|
horizontal: spacingProps.types.spacingValue,
|
|
202
|
-
|
|
203
198
|
/**
|
|
204
199
|
* Sets bottom padding using the theme's spacing scale.
|
|
205
200
|
*
|
|
206
201
|
* @see {@link SpacingValue}
|
|
207
202
|
*/
|
|
208
203
|
bottom: spacingProps.types.spacingValue,
|
|
209
|
-
|
|
210
204
|
/**
|
|
211
205
|
* Sets left padding using the theme's spacing scale.
|
|
212
206
|
*
|
|
213
207
|
* @see {@link SpacingValue}
|
|
214
208
|
*/
|
|
215
209
|
left: spacingProps.types.spacingValue,
|
|
216
|
-
|
|
217
210
|
/**
|
|
218
211
|
* Sets right padding using the theme's spacing scale.
|
|
219
212
|
*
|
|
220
213
|
* @see {@link SpacingValue}
|
|
221
214
|
*/
|
|
222
215
|
right: spacingProps.types.spacingValue,
|
|
223
|
-
|
|
224
216
|
/**
|
|
225
217
|
* Sets top padding using the theme's spacing scale.
|
|
226
218
|
*
|
|
227
219
|
* @see {@link SpacingValue}
|
|
228
220
|
*/
|
|
229
221
|
top: spacingProps.types.spacingValue,
|
|
230
|
-
|
|
231
222
|
/**
|
|
232
223
|
* Sets the `flex` style, which controls `flexGrow`, `flexShrink` and `flexBasis` styles.
|
|
233
224
|
*
|
|
@@ -237,14 +228,12 @@ Box.propTypes = { ...selectedSystemPropTypes,
|
|
|
237
228
|
* With the default `0`, the box takes its minimum width from its content.
|
|
238
229
|
*/
|
|
239
230
|
flex: PropTypes.number,
|
|
240
|
-
|
|
241
231
|
/**
|
|
242
232
|
* Renders a scrollable ScrollView instead of an unscrollable View.
|
|
243
233
|
*
|
|
244
234
|
* May take an object of ScrollView props which are passed to the rendered ScrollView.
|
|
245
235
|
*/
|
|
246
236
|
scroll: PropTypes.oneOfType([PropTypes.bool, ScrollView.propTypes ? PropTypes.shape(ScrollView.propTypes) : PropTypes.object]),
|
|
247
|
-
|
|
248
237
|
/**
|
|
249
238
|
* Optional semantic HTML tag, to apply to the container on web. Does not change styling.
|
|
250
239
|
*
|
|
@@ -252,18 +241,15 @@ Box.propTypes = { ...selectedSystemPropTypes,
|
|
|
252
241
|
* is not defined, the accessibilityRole will default to "heading".
|
|
253
242
|
*/
|
|
254
243
|
tag: PropTypes.oneOf(layoutTags),
|
|
255
|
-
|
|
256
244
|
/**
|
|
257
245
|
* Use in tests if the box itself needs to be targetted and no other way of selecting the
|
|
258
246
|
* box is available (e.g. it cannot be targetted using an appropriate `accessibilityRole`).
|
|
259
247
|
*/
|
|
260
248
|
testID: PropTypes.string,
|
|
261
|
-
|
|
262
249
|
/**
|
|
263
250
|
* @ignore
|
|
264
251
|
*/
|
|
265
252
|
dataSet: PropTypes.object,
|
|
266
|
-
|
|
267
253
|
/**
|
|
268
254
|
* Box accepts any content as children.
|
|
269
255
|
*/
|
|
@@ -18,14 +18,16 @@ const Button = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
18
18
|
...variant
|
|
19
19
|
};
|
|
20
20
|
const getTokens = useThemeTokensCallback('Button', tokens, buttonVariant);
|
|
21
|
-
return /*#__PURE__*/_jsx(ButtonBase, {
|
|
21
|
+
return /*#__PURE__*/_jsx(ButtonBase, {
|
|
22
|
+
...props,
|
|
22
23
|
tokens: getTokens,
|
|
23
24
|
accessibilityRole: accessibilityRole,
|
|
24
25
|
ref: ref
|
|
25
26
|
});
|
|
26
27
|
});
|
|
27
28
|
Button.displayName = 'Button';
|
|
28
|
-
Button.propTypes = {
|
|
29
|
+
Button.propTypes = {
|
|
30
|
+
...a11yProps.types,
|
|
29
31
|
...buttonPropTypes,
|
|
30
32
|
children: textAndA11yText
|
|
31
33
|
};
|