@telus-uds/components-base 1.8.3 → 1.9.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/CHANGELOG.md +37 -2
- package/component-docs.json +17 -1
- package/lib/ActivityIndicator/Spinner.js +7 -7
- package/lib/ActivityIndicator/Spinner.native.js +2 -2
- package/lib/Button/ButtonBase.js +2 -2
- package/lib/Button/ButtonGroup.js +1 -1
- package/lib/Card/Card.js +9 -4
- package/lib/Checkbox/Checkbox.js +5 -3
- package/lib/Checkbox/CheckboxGroup.js +2 -2
- package/lib/Divider/Divider.js +2 -2
- package/lib/ExpandCollapse/Panel.js +12 -18
- package/lib/FlexGrid/Col/Col.js +1 -1
- package/lib/Icon/Icon.js +1 -1
- package/lib/Link/InlinePressable.js +5 -1
- package/lib/Link/LinkBase.js +5 -2
- package/lib/List/List.js +8 -2
- package/lib/Pagination/PageButton.js +2 -2
- package/lib/Pagination/Pagination.js +5 -3
- package/lib/Pagination/usePagination.js +2 -2
- package/lib/Progress/ProgressBar.js +3 -3
- package/lib/Progress/ProgressBarBackground.js +3 -3
- package/lib/Radio/Radio.js +2 -2
- package/lib/Radio/RadioGroup.js +2 -2
- package/lib/RadioCard/RadioCard.js +1 -1
- package/lib/RadioCard/RadioCardGroup.js +2 -2
- package/lib/Search/Search.js +1 -1
- package/lib/SideNav/SideNav.js +2 -2
- package/lib/Skeleton/Skeleton.js +1 -1
- package/lib/Skeleton/skeletonWebAnimation.js +1 -1
- package/lib/StackView/StackWrap.js +3 -1
- package/lib/StackView/getStackedContent.js +2 -2
- package/lib/Tabs/Tabs.js +28 -3
- package/lib/Tabs/TabsItem.js +5 -6
- package/lib/Tags/Tags.js +1 -1
- package/lib/TextInput/TextInput.js +0 -11
- package/lib/TextInput/TextInputBase.js +9 -0
- package/lib/TextInput/propTypes.js +3 -8
- package/lib/ThemeProvider/utils/styles.js +2 -2
- package/lib/ThemeProvider/utils/theme-tokens.js +7 -9
- package/lib/ToggleSwitch/ToggleSwitch.js +1 -1
- package/lib/ToggleSwitch/ToggleSwitchGroup.js +1 -1
- package/lib/Tooltip/Backdrop.js +2 -10
- package/lib/utils/animation/useVerticalExpandAnimation.js +40 -14
- package/lib/utils/children.js +2 -2
- package/lib/utils/input.js +6 -12
- package/lib/utils/props/componentPropType.js +3 -3
- package/lib/utils/props/selectSystemProps.js +2 -2
- package/lib/utils/props/textInputProps.js +8 -1
- package/lib/utils/props/tokens.js +2 -2
- package/lib/utils/useSpacingScale.js +3 -1
- package/lib/utils/useUniqueId.js +1 -1
- package/lib-module/A11yInfoProvider/index.js +63 -0
- package/lib-module/A11yText/index.js +56 -0
- package/lib-module/ActivityIndicator/Spinner.js +77 -0
- package/lib-module/ActivityIndicator/Spinner.native.js +144 -0
- package/lib-module/ActivityIndicator/index.js +41 -0
- package/lib-module/ActivityIndicator/shared.js +12 -0
- package/lib-module/BaseProvider/index.js +29 -0
- package/lib-module/Box/Box.js +244 -0
- package/lib-module/Box/index.js +2 -0
- package/lib-module/Button/Button.js +26 -0
- package/lib-module/Button/ButtonBase.js +271 -0
- package/lib-module/Button/ButtonGroup.js +247 -0
- package/lib-module/Button/ButtonLink.js +40 -0
- package/lib-module/Button/index.js +4 -0
- package/lib-module/Button/propTypes.js +36 -0
- package/lib-module/Card/Card.js +85 -0
- package/lib-module/Card/CardBase.js +66 -0
- package/lib-module/Card/PressableCardBase.js +114 -0
- package/lib-module/Card/index.js +4 -0
- package/lib-module/Checkbox/Checkbox.js +348 -0
- package/lib-module/Checkbox/CheckboxGroup.js +233 -0
- package/lib-module/Checkbox/CheckboxInput.js +60 -0
- package/lib-module/Checkbox/CheckboxInput.native.js +6 -0
- package/lib-module/Checkbox/index.js +3 -0
- package/lib-module/Divider/Divider.js +124 -0
- package/lib-module/Divider/index.js +2 -0
- package/lib-module/ExpandCollapse/Accordion.js +15 -0
- package/lib-module/ExpandCollapse/Control.js +136 -0
- package/lib-module/ExpandCollapse/ExpandCollapse.js +95 -0
- package/lib-module/ExpandCollapse/Panel.js +159 -0
- package/lib-module/ExpandCollapse/index.js +7 -0
- package/lib-module/Feedback/Feedback.js +157 -0
- package/lib-module/Feedback/index.js +2 -0
- package/lib-module/Fieldset/Fieldset.js +153 -0
- package/lib-module/Fieldset/FieldsetContainer.js +32 -0
- package/lib-module/Fieldset/FieldsetContainer.native.js +23 -0
- package/lib-module/Fieldset/Legend.js +24 -0
- package/lib-module/Fieldset/Legend.native.js +31 -0
- package/lib-module/Fieldset/cssReset.js +14 -0
- package/lib-module/Fieldset/index.js +2 -0
- package/lib-module/FlexGrid/Col/Col.js +276 -0
- package/lib-module/FlexGrid/Col/index.js +2 -0
- package/lib-module/FlexGrid/FlexGrid.js +148 -0
- package/lib-module/FlexGrid/Row/Row.js +184 -0
- package/lib-module/FlexGrid/Row/index.js +2 -0
- package/lib-module/FlexGrid/helpers/index.js +18 -0
- package/lib-module/FlexGrid/index.js +2 -0
- package/lib-module/FlexGrid/providers/GutterContext.js +3 -0
- package/lib-module/HorizontalScroll/HorizontalScroll.js +175 -0
- package/lib-module/HorizontalScroll/HorizontalScrollButton.js +81 -0
- package/lib-module/HorizontalScroll/ScrollViewEnd.js +48 -0
- package/lib-module/HorizontalScroll/ScrollViewEnd.native.js +27 -0
- package/lib-module/HorizontalScroll/dictionary.js +11 -0
- package/lib-module/HorizontalScroll/index.js +11 -0
- package/lib-module/HorizontalScroll/itemPositions.js +112 -0
- package/lib-module/Icon/Icon.js +62 -0
- package/lib-module/Icon/IconText.js +83 -0
- package/lib-module/Icon/index.js +4 -0
- package/lib-module/IconButton/IconButton.js +122 -0
- package/lib-module/IconButton/index.js +2 -0
- package/lib-module/InputLabel/InputLabel.js +148 -0
- package/lib-module/InputLabel/LabelContent.js +27 -0
- package/lib-module/InputLabel/LabelContent.native.js +19 -0
- package/lib-module/InputLabel/index.js +2 -0
- package/lib-module/InputSupports/InputSupports.js +96 -0
- package/lib-module/InputSupports/index.js +2 -0
- package/lib-module/InputSupports/useInputSupports.js +32 -0
- package/lib-module/Link/ChevronLink.js +52 -0
- package/lib-module/Link/InlinePressable.js +44 -0
- package/lib-module/Link/InlinePressable.native.js +89 -0
- package/lib-module/Link/Link.js +28 -0
- package/lib-module/Link/LinkBase.js +243 -0
- package/lib-module/Link/TextButton.js +35 -0
- package/lib-module/Link/index.js +5 -0
- package/lib-module/List/List.js +62 -0
- package/lib-module/List/ListItem.js +248 -0
- package/lib-module/List/index.js +5 -0
- package/lib-module/Modal/Modal.js +222 -0
- package/lib-module/Modal/dictionary.js +9 -0
- package/lib-module/Modal/index.js +2 -0
- package/lib-module/Notification/Notification.js +209 -0
- package/lib-module/Notification/dictionary.js +8 -0
- package/lib-module/Notification/index.js +2 -0
- package/lib-module/Pagination/PageButton.js +66 -0
- package/lib-module/Pagination/Pagination.js +153 -0
- package/lib-module/Pagination/SideButton.js +106 -0
- package/lib-module/Pagination/dictionary.js +18 -0
- package/lib-module/Pagination/index.js +2 -0
- package/lib-module/Pagination/usePagination.js +73 -0
- package/lib-module/Progress/Progress.js +89 -0
- package/lib-module/Progress/ProgressBar.js +138 -0
- package/lib-module/Progress/ProgressBarBackground.js +42 -0
- package/lib-module/Progress/index.js +4 -0
- package/lib-module/Radio/Radio.js +285 -0
- package/lib-module/Radio/RadioButton.js +138 -0
- package/lib-module/Radio/RadioGroup.js +243 -0
- package/lib-module/Radio/RadioInput.js +62 -0
- package/lib-module/Radio/RadioInput.native.js +6 -0
- package/lib-module/Radio/index.js +3 -0
- package/lib-module/RadioCard/RadioCard.js +219 -0
- package/lib-module/RadioCard/RadioCardGroup.js +250 -0
- package/lib-module/RadioCard/index.js +3 -0
- package/lib-module/Search/Search.js +261 -0
- package/lib-module/Search/dictionary.js +12 -0
- package/lib-module/Search/index.js +2 -0
- package/lib-module/Select/Group.js +21 -0
- package/lib-module/Select/Group.native.js +15 -0
- package/lib-module/Select/Item.js +20 -0
- package/lib-module/Select/Item.native.js +3 -0
- package/lib-module/Select/Picker.js +68 -0
- package/lib-module/Select/Picker.native.js +120 -0
- package/lib-module/Select/Select.js +337 -0
- package/lib-module/Select/index.js +6 -0
- package/lib-module/SideNav/Item.js +145 -0
- package/lib-module/SideNav/ItemContent.js +48 -0
- package/lib-module/SideNav/ItemsGroup.js +117 -0
- package/lib-module/SideNav/SideNav.js +136 -0
- package/lib-module/SideNav/index.js +1 -0
- package/lib-module/Skeleton/Skeleton.js +179 -0
- package/lib-module/Skeleton/index.js +2 -0
- package/lib-module/Skeleton/skeleton.constant.js +3 -0
- package/lib-module/Skeleton/skeletonWebAnimation.js +18 -0
- package/lib-module/Skeleton/useSkeletonNativeAnimation.js +24 -0
- package/lib-module/Spacer/Spacer.js +98 -0
- package/lib-module/Spacer/index.js +2 -0
- package/lib-module/StackView/StackView.js +125 -0
- package/lib-module/StackView/StackWrap.js +50 -0
- package/lib-module/StackView/StackWrap.native.js +3 -0
- package/lib-module/StackView/StackWrapBox.js +115 -0
- package/lib-module/StackView/StackWrapGap.js +59 -0
- package/lib-module/StackView/common.js +35 -0
- package/lib-module/StackView/getStackedContent.js +124 -0
- package/lib-module/StackView/index.js +5 -0
- package/lib-module/StepTracker/Step.js +248 -0
- package/lib-module/StepTracker/StepTracker.js +185 -0
- package/lib-module/StepTracker/dictionary.js +10 -0
- package/lib-module/StepTracker/index.js +2 -0
- package/lib-module/Tabs/Tabs.js +143 -0
- package/lib-module/Tabs/TabsItem.js +224 -0
- package/lib-module/Tabs/index.js +2 -0
- package/lib-module/Tags/Tags.js +251 -0
- package/lib-module/Tags/index.js +2 -0
- package/lib-module/TextInput/TextArea.js +94 -0
- package/lib-module/TextInput/TextInput.js +64 -0
- package/lib-module/TextInput/TextInputBase.js +254 -0
- package/lib-module/TextInput/index.js +3 -0
- package/lib-module/TextInput/propTypes.js +33 -0
- package/lib-module/ThemeProvider/ThemeProvider.js +36 -0
- package/lib-module/ThemeProvider/index.js +6 -0
- package/lib-module/ThemeProvider/useSetTheme.js +25 -0
- package/lib-module/ThemeProvider/useTheme.js +14 -0
- package/lib-module/ThemeProvider/useThemeTokens.js +110 -0
- package/lib-module/ThemeProvider/utils/index.js +2 -0
- package/lib-module/ThemeProvider/utils/styles.js +181 -0
- package/lib-module/ThemeProvider/utils/theme-tokens.js +163 -0
- package/lib-module/ToggleSwitch/ToggleSwitch.js +250 -0
- package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +220 -0
- package/lib-module/ToggleSwitch/index.js +3 -0
- package/lib-module/Tooltip/Backdrop.js +45 -0
- package/lib-module/Tooltip/Backdrop.native.js +44 -0
- package/lib-module/Tooltip/Tooltip.js +348 -0
- package/lib-module/Tooltip/dictionary.js +8 -0
- package/lib-module/Tooltip/getTooltipPosition.js +175 -0
- package/lib-module/Tooltip/index.js +2 -0
- package/lib-module/TooltipButton/TooltipButton.js +78 -0
- package/lib-module/TooltipButton/index.js +2 -0
- package/lib-module/Typography/Typography.js +124 -0
- package/lib-module/Typography/index.js +2 -0
- package/lib-module/ViewportProvider/ViewportProvider.js +29 -0
- package/lib-module/ViewportProvider/index.js +3 -0
- package/lib-module/ViewportProvider/useViewport.js +3 -0
- package/lib-module/ViewportProvider/useViewportListener.js +46 -0
- package/lib-module/index.js +48 -0
- package/lib-module/utils/a11y/index.js +2 -0
- package/lib-module/utils/a11y/semantics.js +157 -0
- package/lib-module/utils/a11y/textSize.js +36 -0
- package/lib-module/utils/animation/index.js +2 -0
- package/lib-module/utils/animation/useVerticalExpandAnimation.js +88 -0
- package/lib-module/utils/children.js +119 -0
- package/lib-module/utils/containUniqueFields.js +26 -0
- package/lib-module/utils/index.js +16 -0
- package/lib-module/utils/info/index.js +7 -0
- package/lib-module/utils/info/platform/index.js +11 -0
- package/lib-module/utils/info/platform/platform.android.js +1 -0
- package/lib-module/utils/info/platform/platform.ios.js +1 -0
- package/lib-module/utils/info/platform/platform.js +1 -0
- package/lib-module/utils/info/platform/platform.native.js +4 -0
- package/lib-module/utils/info/versions.js +5 -0
- package/lib-module/utils/input.js +179 -0
- package/lib-module/utils/pressability.js +111 -0
- package/lib-module/utils/props/a11yProps.js +140 -0
- package/lib-module/utils/props/clickProps.js +26 -0
- package/lib-module/utils/props/componentPropType.js +63 -0
- package/lib-module/utils/props/copyPropTypes.js +2 -0
- package/lib-module/utils/props/getPropSelector.js +9 -0
- package/lib-module/utils/props/handlerProps.js +65 -0
- package/lib-module/utils/props/hrefAttrsProp.js +33 -0
- package/lib-module/utils/props/index.js +19 -0
- package/lib-module/utils/props/inputSupportsProps.js +62 -0
- package/lib-module/utils/props/linkProps.js +44 -0
- package/lib-module/utils/props/paddingProp.js +9 -0
- package/lib-module/utils/props/pressProps.js +42 -0
- package/lib-module/utils/props/rectProp.js +9 -0
- package/lib-module/utils/props/responsiveProps.js +30 -0
- package/lib-module/utils/props/selectSystemProps.js +24 -0
- package/lib-module/utils/props/spacingProps.js +56 -0
- package/lib-module/utils/props/textInputProps.js +201 -0
- package/lib-module/utils/props/textProps.js +59 -0
- package/lib-module/utils/props/tokens.js +133 -0
- package/lib-module/utils/props/variantProp.js +18 -0
- package/lib-module/utils/props/viewProps.js +22 -0
- package/lib-module/utils/ssr.js +38 -0
- package/lib-module/utils/useCopy.js +44 -0
- package/lib-module/utils/useHash.js +45 -0
- package/lib-module/utils/useHash.native.js +7 -0
- package/lib-module/utils/useResponsiveProp.js +47 -0
- package/lib-module/utils/useSpacingScale.js +125 -0
- package/lib-module/utils/useUniqueId.js +13 -0
- package/lib-module/utils/withLinkRouter.js +83 -0
- package/package.json +3 -3
- package/src/Card/Card.jsx +6 -4
- package/src/Checkbox/Checkbox.jsx +3 -1
- package/src/ExpandCollapse/Panel.jsx +10 -20
- package/src/Link/InlinePressable.jsx +5 -2
- package/src/Link/LinkBase.jsx +4 -1
- package/src/List/List.jsx +6 -2
- package/src/Tabs/Tabs.jsx +24 -2
- package/src/Tabs/TabsItem.jsx +6 -5
- package/src/TextInput/TextInput.jsx +1 -8
- package/src/TextInput/TextInputBase.jsx +11 -1
- package/src/TextInput/propTypes.js +3 -7
- package/src/utils/animation/useVerticalExpandAnimation.js +47 -13
- package/src/utils/props/textInputProps.js +7 -1
package/lib/SideNav/SideNav.js
CHANGED
|
@@ -82,7 +82,7 @@ const SideNav = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
82
82
|
|
|
83
83
|
const renderItem = (item, index, groupId) => {
|
|
84
84
|
const {
|
|
85
|
-
itemId =
|
|
85
|
+
itemId = "item-".concat(index),
|
|
86
86
|
onPress
|
|
87
87
|
} = item.props;
|
|
88
88
|
|
|
@@ -110,7 +110,7 @@ const SideNav = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
110
110
|
|
|
111
111
|
if (child.type === _ItemsGroup.default) {
|
|
112
112
|
const {
|
|
113
|
-
groupId =
|
|
113
|
+
groupId = "group-".concat(index)
|
|
114
114
|
} = child.props;
|
|
115
115
|
const isGroupActive = active.itemId !== undefined && active.groupId === groupId;
|
|
116
116
|
|
package/lib/Skeleton/Skeleton.js
CHANGED
|
@@ -144,7 +144,7 @@ const Skeleton = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
144
144
|
style: [selectSkeletonStyles({ ...themeTokens,
|
|
145
145
|
fadeAnimation: getAnimationBaseOnPlatform()
|
|
146
146
|
}), getStyledBasedOnShape()]
|
|
147
|
-
},
|
|
147
|
+
}, "skeleton-".concat(index + 1));
|
|
148
148
|
};
|
|
149
149
|
|
|
150
150
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_StackView.default, {
|
|
@@ -8,7 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _skeleton = require("./skeleton.constant");
|
|
9
9
|
|
|
10
10
|
var _default = {
|
|
11
|
-
animationDuration:
|
|
11
|
+
animationDuration: "".concat(_skeleton.ANIMATION_DURATION, "ms"),
|
|
12
12
|
animationTimingFunction: 'ease-in-out',
|
|
13
13
|
animationDelay: '0.5s',
|
|
14
14
|
animationIterationCount: 'infinite',
|
|
@@ -40,11 +40,13 @@ const exampleGapValue = '1px';
|
|
|
40
40
|
*/
|
|
41
41
|
|
|
42
42
|
const StackWrap = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
43
|
+
var _props$gap;
|
|
44
|
+
|
|
43
45
|
const {
|
|
44
46
|
space
|
|
45
47
|
} = props; // Don't apply separate gap if `null` or `undefined`, so can be unset in Storybook etc
|
|
46
48
|
|
|
47
|
-
const gap = props.gap
|
|
49
|
+
const gap = (_props$gap = props.gap) !== null && _props$gap !== void 0 ? _props$gap : space;
|
|
48
50
|
const canUseCSSGap = _Platform.default.OS === 'web' && gap === space && cssSupports('gap', exampleGapValue);
|
|
49
51
|
return canUseCSSGap ?
|
|
50
52
|
/*#__PURE__*/
|
|
@@ -65,7 +65,7 @@ const getStackedContent = (children, _ref) => {
|
|
|
65
65
|
const validChildren = _react.Children.toArray(topLevelChildren).filter(Boolean);
|
|
66
66
|
|
|
67
67
|
const content = validChildren.reduce((newChildren, child, index) => {
|
|
68
|
-
const boxID =
|
|
68
|
+
const boxID = "Stack-Box-".concat(index);
|
|
69
69
|
const item = box ?
|
|
70
70
|
/*#__PURE__*/
|
|
71
71
|
// If wrapped in Box, that Box needs a key.
|
|
@@ -75,7 +75,7 @@ const getStackedContent = (children, _ref) => {
|
|
|
75
75
|
testID: boxID
|
|
76
76
|
}, child) : child;
|
|
77
77
|
if (!index || !space && !divider) return [...newChildren, item];
|
|
78
|
-
const testID =
|
|
78
|
+
const testID = "Stack-".concat(divider ? 'Divider' : 'Spacer', "-").concat(index);
|
|
79
79
|
const commonProps = {
|
|
80
80
|
testID,
|
|
81
81
|
key: testID,
|
package/lib/Tabs/Tabs.js
CHANGED
|
@@ -34,12 +34,32 @@ const {
|
|
|
34
34
|
selectHorizontalScrollTokens,
|
|
35
35
|
useItemPositions
|
|
36
36
|
} = _HorizontalScroll.horizontalScrollUtils;
|
|
37
|
+
|
|
38
|
+
const getDefaultTabItemAccessibilityRole = parentRole => {
|
|
39
|
+
switch (parentRole) {
|
|
40
|
+
case 'tablist':
|
|
41
|
+
return 'tab';
|
|
42
|
+
|
|
43
|
+
case 'navigation':
|
|
44
|
+
return 'link';
|
|
45
|
+
|
|
46
|
+
default:
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
37
50
|
/**
|
|
38
51
|
* Tabs renders a horizontally-scrolling menu of selectable buttons which may link
|
|
39
52
|
* to a page or control what content is displayed on this page.
|
|
53
|
+
*
|
|
54
|
+
* If you are using Tabs to navigate to a new page (web-only) you should pass
|
|
55
|
+
* `navigation`as the `accessibilityRole` to te Tabs component, this will cause
|
|
56
|
+
* TabItems to default to a role of link and obtain aria-current behaviour.
|
|
40
57
|
*/
|
|
41
58
|
|
|
59
|
+
|
|
42
60
|
const Tabs = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
61
|
+
var _restProps$accessibil;
|
|
62
|
+
|
|
43
63
|
let {
|
|
44
64
|
tokens,
|
|
45
65
|
itemTokens,
|
|
@@ -76,14 +96,17 @@ const Tabs = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
76
96
|
const hashId = hashItem && (hashItem.id || hashItem.label);
|
|
77
97
|
if (hashId) setTimeout(setValue(hashId, event), 500);
|
|
78
98
|
}, [items, setValue]), isPositioningReady);
|
|
99
|
+
const restProps = selectProps(rest);
|
|
100
|
+
const parentAccessibilityRole = (_restProps$accessibil = restProps.accessibilityRole) !== null && _restProps$accessibil !== void 0 ? _restProps$accessibil : 'tablist';
|
|
101
|
+
const defaultTabItemAccessibiltyRole = getDefaultTabItemAccessibilityRole(parentAccessibilityRole);
|
|
79
102
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_HorizontalScroll.default, {
|
|
80
103
|
ref: ref,
|
|
81
104
|
ScrollButton: _HorizontalScroll.HorizontalScrollButton,
|
|
82
105
|
itemPositions: itemPositions,
|
|
83
106
|
tokens: selectHorizontalScrollTokens(themeTokens),
|
|
84
107
|
scrollButtonTokens: scrollButtonTokens,
|
|
85
|
-
accessibilityRole:
|
|
86
|
-
...
|
|
108
|
+
accessibilityRole: parentAccessibilityRole,
|
|
109
|
+
...restProps,
|
|
87
110
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_StackView.default, {
|
|
88
111
|
space: space,
|
|
89
112
|
direction: "row",
|
|
@@ -92,11 +115,12 @@ const Tabs = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
92
115
|
href,
|
|
93
116
|
label,
|
|
94
117
|
id,
|
|
118
|
+
accessibilityRole = defaultTabItemAccessibiltyRole,
|
|
95
119
|
ref: itemRef,
|
|
96
120
|
LinkRouter: ItemLinkRouter = LinkRouter,
|
|
97
121
|
linkRouterProps: itemLinkRouterProps
|
|
98
122
|
} = _ref3;
|
|
99
|
-
const itemId = id
|
|
123
|
+
const itemId = id !== null && id !== void 0 ? id : label;
|
|
100
124
|
const isSelected = Boolean(currentValue && currentValue === itemId);
|
|
101
125
|
|
|
102
126
|
const handlePress = event => setValue(itemId, event);
|
|
@@ -110,6 +134,7 @@ const Tabs = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
110
134
|
selected: isSelected,
|
|
111
135
|
itemPositions: itemPositions,
|
|
112
136
|
index: index,
|
|
137
|
+
accessibilityRole: accessibilityRole,
|
|
113
138
|
LinkRouter: ItemLinkRouter,
|
|
114
139
|
linkRouterProps: { ...linkRouterProps,
|
|
115
140
|
...itemLinkRouterProps
|
package/lib/Tabs/TabsItem.js
CHANGED
|
@@ -117,13 +117,11 @@ const TabsItem = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
|
|
|
117
117
|
itemPositions,
|
|
118
118
|
index,
|
|
119
119
|
children,
|
|
120
|
-
accessibilityRole
|
|
121
|
-
|
|
122
|
-
{
|
|
123
|
-
current: selected ? 'page' : false
|
|
124
|
-
} : {
|
|
120
|
+
accessibilityRole,
|
|
121
|
+
accessibilityCurrent = _Platform.default.OS === 'web' && accessibilityRole === 'link' && selected ? 'page' : undefined,
|
|
122
|
+
accessibilityState = accessibilityRole === 'tab' ? {
|
|
125
123
|
selected
|
|
126
|
-
},
|
|
124
|
+
} : undefined,
|
|
127
125
|
...rawRest
|
|
128
126
|
} = _ref4;
|
|
129
127
|
|
|
@@ -162,6 +160,7 @@ const TabsItem = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
|
|
|
162
160
|
} : undefined;
|
|
163
161
|
const selectedProps = selectProps({
|
|
164
162
|
accessibilityRole,
|
|
163
|
+
accessibilityCurrent,
|
|
165
164
|
accessibilityState,
|
|
166
165
|
...rest
|
|
167
166
|
});
|
package/lib/Tags/Tags.js
CHANGED
|
@@ -129,7 +129,7 @@ const Tags = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
129
129
|
const uniqueFields = ['id', 'label'];
|
|
130
130
|
|
|
131
131
|
if (!(0, _utils.containUniqueFields)(items, uniqueFields)) {
|
|
132
|
-
throw new Error(
|
|
132
|
+
throw new Error("Tags items must have unique ".concat(uniqueFields.join(', ')));
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_StackView.StackWrap, {
|
|
@@ -7,8 +7,6 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
|
-
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
11
|
-
|
|
12
10
|
var _utils = require("../utils");
|
|
13
11
|
|
|
14
12
|
var _InputSupports = _interopRequireDefault(require("../InputSupports"));
|
|
@@ -49,17 +47,8 @@ const TextInput = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
49
47
|
let {
|
|
50
48
|
tokens,
|
|
51
49
|
variant = {},
|
|
52
|
-
pattern,
|
|
53
50
|
...rest
|
|
54
51
|
} = _ref;
|
|
55
|
-
|
|
56
|
-
_react.default.useEffect(() => {
|
|
57
|
-
if (_Platform.default.OS === 'web' && pattern && ref.current) {
|
|
58
|
-
// eslint-disable-next-line no-param-reassign
|
|
59
|
-
ref.current.pattern = pattern;
|
|
60
|
-
}
|
|
61
|
-
}, [ref, pattern]);
|
|
62
|
-
|
|
63
52
|
const {
|
|
64
53
|
supportsProps,
|
|
65
54
|
...selectedProps
|
|
@@ -156,6 +156,7 @@ const TextInputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
156
156
|
onBlur,
|
|
157
157
|
onMouseOver,
|
|
158
158
|
onMouseOut,
|
|
159
|
+
pattern,
|
|
159
160
|
tokens,
|
|
160
161
|
variant = {},
|
|
161
162
|
...rest
|
|
@@ -194,6 +195,14 @@ const TextInputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
194
195
|
onChange,
|
|
195
196
|
readOnly
|
|
196
197
|
});
|
|
198
|
+
const element = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
199
|
+
(0, _react.useEffect)(() => {
|
|
200
|
+
if (_Platform.default.OS === 'web' && pattern && element) {
|
|
201
|
+
// React Native Web doesn't support `pattern`, so we have to attach it via a ref,
|
|
202
|
+
// which a `pattern` user must provide anyway to call .checkValidity() on the element.
|
|
203
|
+
element.pattern = pattern;
|
|
204
|
+
}
|
|
205
|
+
}, [element, pattern]);
|
|
197
206
|
|
|
198
207
|
const handleChangeText = event => {
|
|
199
208
|
var _event$nativeEvent, _event$target;
|
|
@@ -7,10 +7,10 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
|
|
10
|
-
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
11
|
-
|
|
12
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
11
|
|
|
12
|
+
// These are prop types specific to UDS TextInput; see also ../utils/props/textInputProps
|
|
13
|
+
// for generic React Native props and HTML input attrs that are passed through.
|
|
14
14
|
const textInputPropTypes = {
|
|
15
15
|
/**
|
|
16
16
|
* If the input's state is to be controlled by a parent component, use this prop
|
|
@@ -38,12 +38,7 @@ const textInputPropTypes = {
|
|
|
38
38
|
* Use to react upon input's value changes. Required when the `value` prop is set.
|
|
39
39
|
* Will receive the input's value as an argument.
|
|
40
40
|
*/
|
|
41
|
-
onChange: _propTypes.default.func
|
|
42
|
-
..._Platform.default.select({
|
|
43
|
-
web: {
|
|
44
|
-
pattern: _propTypes.default.string
|
|
45
|
-
}
|
|
46
|
-
})
|
|
41
|
+
onChange: _propTypes.default.func
|
|
47
42
|
};
|
|
48
43
|
var _default = textInputPropTypes;
|
|
49
44
|
exports.default = _default;
|
|
@@ -51,7 +51,7 @@ function applyTextStyles(_ref) {
|
|
|
51
51
|
if (fontName) {
|
|
52
52
|
// Don't set undefined font families. May need some validation here that the font is available.
|
|
53
53
|
// Android doesn't recognise font weights natively so apply custom font weights via `fontFamily`.
|
|
54
|
-
styles.fontFamily =
|
|
54
|
+
styles.fontFamily = "".concat(fontName).concat(fontWeight).concat(fontStyle);
|
|
55
55
|
} else if (fontWeight) {
|
|
56
56
|
// If using system default font, apply the font weight directly.
|
|
57
57
|
// Font weight support in Android is limited to 'bold' or anything else === 'normal'.
|
|
@@ -101,7 +101,7 @@ function applyWebShadow(_ref2) {
|
|
|
101
101
|
} = _ref2;
|
|
102
102
|
const insetString = inset ? 'inset ' : '';
|
|
103
103
|
const boxShadow = {
|
|
104
|
-
boxShadow:
|
|
104
|
+
boxShadow: "".concat(insetString).concat(offsetX, "px ").concat(offsetY, "px ").concat(blur, "px ").concat(spread, "px ").concat(color)
|
|
105
105
|
};
|
|
106
106
|
return boxShadow;
|
|
107
107
|
}
|
|
@@ -28,19 +28,19 @@ const getComponentTheme = (theme, componentName) => {
|
|
|
28
28
|
// Give clear and understandable error messages for common dev errors, for example,
|
|
29
29
|
// typo in component name, missing export or accessing old version of theme
|
|
30
30
|
if (!theme) {
|
|
31
|
-
throw new Error(
|
|
31
|
+
throw new Error("Called useTheme's getStyle on \"".concat(componentName, "\" with no theme provided"));
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
const themeName = ((_theme$metadata = theme.metadata) === null || _theme$metadata === void 0 ? void 0 : _theme$metadata.name) || '';
|
|
35
35
|
|
|
36
36
|
if (!theme.components) {
|
|
37
|
-
throw new Error(
|
|
37
|
+
throw new Error("Theme \"".concat(themeName, "\" has no components defined (looking for \"").concat(componentName, "\")"));
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
const componentTheme = theme.components[componentName];
|
|
41
41
|
|
|
42
42
|
if (!componentTheme) {
|
|
43
|
-
throw new Error(
|
|
43
|
+
throw new Error("Theme \"".concat(themeName, "\" does not have styles for component \"").concat(componentName, "\""));
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
return componentTheme;
|
|
@@ -49,9 +49,11 @@ const getComponentTheme = (theme, componentName) => {
|
|
|
49
49
|
exports.getComponentTheme = getComponentTheme;
|
|
50
50
|
|
|
51
51
|
const doesThemeConditionApply = (_ref, appearances) => {
|
|
52
|
+
var _appearances$key;
|
|
53
|
+
|
|
52
54
|
let [key, value] = _ref;
|
|
53
55
|
// use null rather than undefined so we can serialise the value in themes
|
|
54
|
-
const appearanceValue = appearances[key]
|
|
56
|
+
const appearanceValue = (_appearances$key = appearances[key]) !== null && _appearances$key !== void 0 ? _appearances$key : null;
|
|
55
57
|
return Array.isArray(value) ? value.includes(appearanceValue) : value === appearanceValue;
|
|
56
58
|
};
|
|
57
59
|
|
|
@@ -192,11 +194,7 @@ const validateThemeTokensVersion = theme => {
|
|
|
192
194
|
const actualThemeTokensVersion = theme === null || theme === void 0 ? void 0 : (_theme$metadata2 = theme.metadata) === null || _theme$metadata2 === void 0 ? void 0 : _theme$metadata2.themeTokensVersion;
|
|
193
195
|
|
|
194
196
|
if (!(0, _satisfies.default)(actualThemeTokensVersion, expectedThemeTokensVersion)) {
|
|
195
|
-
throw new Error(
|
|
196
|
-
|
|
197
|
-
The UDS base components ${_package.default.name} v${_package.default.version} are only compatible with UDS themes that are built with @telus-uds/system-theme-tokens version that is semver compatible with ${expectedThemeTokensVersion}. The current theme was built with @telus-uds/system-theme-tokens v${actualThemeTokensVersion}.
|
|
198
|
-
|
|
199
|
-
If you see this error than most likely you have attempted to install ${_package.default.name} and a UDS theme manually because you are building a multi-brand application. If you are building a single brand application, consider installing the brand specific design system package such as @telus-uds/ds-allium. For more information, see https://github.com/telus/universal-design-system/blob/main/packages/docs-uds/docs/multi-brand-usage.md`);
|
|
197
|
+
throw new Error("Invalid UDS token schema version detected.\n\nThe UDS base components ".concat(_package.default.name, " v").concat(_package.default.version, " are only compatible with UDS themes that are built with @telus-uds/system-theme-tokens version that is semver compatible with ").concat(expectedThemeTokensVersion, ". The current theme was built with @telus-uds/system-theme-tokens v").concat(actualThemeTokensVersion, ".\n\nIf you see this error than most likely you have attempted to install ").concat(_package.default.name, " and a UDS theme manually because you are building a multi-brand application. If you are building a single brand application, consider installing the brand specific design system package such as @telus-uds/ds-allium. For more information, see https://github.com/telus/universal-design-system/blob/main/packages/docs-uds/docs/multi-brand-usage.md"));
|
|
200
198
|
}
|
|
201
199
|
};
|
|
202
200
|
|
|
@@ -153,7 +153,7 @@ const ToggleSwitch = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
|
|
|
153
153
|
const getButtonTokens = buttonState => selectButtonTokens(getTokens(buttonState));
|
|
154
154
|
|
|
155
155
|
const uniqueId = (0, _utils.useUniqueId)('toggleSwitch');
|
|
156
|
-
const inputId = id
|
|
156
|
+
const inputId = id !== null && id !== void 0 ? id : uniqueId;
|
|
157
157
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_StackView.default, {
|
|
158
158
|
space: 2,
|
|
159
159
|
direction: "row",
|
|
@@ -86,7 +86,7 @@ const ToggleSwitchGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
86
86
|
const uniqueFields = ['id', 'label'];
|
|
87
87
|
|
|
88
88
|
if (!(0, _utils.containUniqueFields)(items, uniqueFields)) {
|
|
89
|
-
throw new Error(
|
|
89
|
+
throw new Error("ToggleSwitchGroup items must have unique ".concat(uniqueFields.join(', ')));
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
const toggleSwitches = items.map((_ref2, index) => {
|
package/lib/Tooltip/Backdrop.js
CHANGED
|
@@ -19,15 +19,7 @@ function createPortalNode(nodeId) {
|
|
|
19
19
|
// this way the backdrop stays in place when scrolling the window - that's why we need to
|
|
20
20
|
// position it at the scroll position when rendering
|
|
21
21
|
|
|
22
|
-
node.style.cssText =
|
|
23
|
-
position: absolute;
|
|
24
|
-
top: ${window.scrollY}px;
|
|
25
|
-
left: ${window.scrollX}px;
|
|
26
|
-
right: 0;
|
|
27
|
-
bottom: 0;
|
|
28
|
-
z-index: 9999;
|
|
29
|
-
pointer-events: none;
|
|
30
|
-
`;
|
|
22
|
+
node.style.cssText = "\n position: absolute; \n top: ".concat(window.scrollY, "px;\n left: ").concat(window.scrollX, "px; \n right: 0; \n bottom: 0; \n z-index: 9999; \n pointer-events: none;\n ");
|
|
31
23
|
document.body.appendChild(node);
|
|
32
24
|
return node;
|
|
33
25
|
}
|
|
@@ -48,7 +40,7 @@ function Backdrop(_ref) {
|
|
|
48
40
|
} = _ref;
|
|
49
41
|
const [portalNode, setPortalNode] = (0, _react.useState)();
|
|
50
42
|
(0, _react.useEffect)(() => {
|
|
51
|
-
const nodeId =
|
|
43
|
+
const nodeId = "tooltip-backdrop-".concat(Date.now());
|
|
52
44
|
const node = createPortalNode(nodeId);
|
|
53
45
|
setPortalNode(node);
|
|
54
46
|
return () => {
|
|
@@ -24,16 +24,22 @@ function useVerticalExpandAnimation(_ref) {
|
|
|
24
24
|
tokens
|
|
25
25
|
} = _ref;
|
|
26
26
|
const [isAnimating, setIsAnimating] = (0, _react.useState)(false);
|
|
27
|
+
const [wasExpanded, setWasExpanded] = (0, _react.useState)(isExpanded);
|
|
28
|
+
const expandStateChanged = isExpanded !== wasExpanded;
|
|
27
29
|
const expandAnimatedValue = (0, _react.useRef)(new _Animated.default.Value(0)).current;
|
|
28
30
|
const elementRef = (0, _react.useRef)(null);
|
|
29
31
|
const {
|
|
30
32
|
expandDuration,
|
|
31
33
|
collapseDuration
|
|
32
|
-
} = tokens;
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
} = tokens;
|
|
35
|
+
(0, _react.useLayoutEffect)(() => {
|
|
36
|
+
if (expandStateChanged) {
|
|
37
|
+
setIsAnimating(true);
|
|
38
|
+
setWasExpanded(isExpanded);
|
|
39
|
+
}
|
|
40
|
+
}, [expandStateChanged, isExpanded]);
|
|
35
41
|
(0, _react.useEffect)(() => {
|
|
36
|
-
const onComplete = () =>
|
|
42
|
+
const onComplete = () => setIsAnimating(false);
|
|
37
43
|
|
|
38
44
|
if (_Platform.default.OS === 'web') {
|
|
39
45
|
if (!elementRef.current) return () => {}; // React Native Web does not pass `onTransitionEnd` through, must attach manually.
|
|
@@ -55,20 +61,40 @@ function useVerticalExpandAnimation(_ref) {
|
|
|
55
61
|
|
|
56
62
|
animation.start(onComplete);
|
|
57
63
|
return () => animation.stop();
|
|
58
|
-
}, [isExpanded, expandAnimatedValue, containerHeight, expandDuration, collapseDuration]);
|
|
64
|
+
}, [isExpanded, expandAnimatedValue, containerHeight, expandDuration, collapseDuration]);
|
|
65
|
+
const containerStyles = {};
|
|
66
|
+
if (isAnimating || expandStateChanged) containerStyles.overflow = 'hidden';
|
|
59
67
|
|
|
60
|
-
|
|
61
|
-
visibility: 'hidden'
|
|
62
|
-
} : {}; // don't visually collapse the container until we have it measured
|
|
63
|
-
|
|
64
|
-
if (containerHeight !== null) {
|
|
68
|
+
if (!isExpanded && !isAnimating && !expandStateChanged) {
|
|
65
69
|
if (_Platform.default.OS === 'web') {
|
|
66
|
-
|
|
67
|
-
containerStyles.
|
|
68
|
-
containerStyles.height = isExpanded ? containerHeight : 0;
|
|
70
|
+
// Without `visibility: 'hidden', descendents are focusable on web even when collapsed.
|
|
71
|
+
containerStyles.visibility = 'hidden';
|
|
69
72
|
} else {
|
|
70
|
-
|
|
73
|
+
// There's no `visibility: hidden` in React Native, and display: none causes a flicker on expand.
|
|
74
|
+
// Without some form of hiding, some children leak through even when closed e.g. `List.Item` bullets.
|
|
75
|
+
containerStyles.opacity = 0;
|
|
76
|
+
}
|
|
77
|
+
} // don't visually collapse the container until we have it measured
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
if (containerHeight === null) {
|
|
81
|
+
if (_Platform.default.OS === 'web') {
|
|
82
|
+
// on web we can hide the contents until we have the container measured and avoid occasional jitter
|
|
83
|
+
// this won't work on native platforms
|
|
84
|
+
containerStyles.height = 0;
|
|
85
|
+
containerStyles.visibility = 'hidden';
|
|
71
86
|
}
|
|
87
|
+
} else if (_Platform.default.OS === 'web') {
|
|
88
|
+
const transitionDuration = isExpanded ? expandDuration : collapseDuration;
|
|
89
|
+
containerStyles.transition = "height ".concat(transitionDuration, "ms ease-in-out");
|
|
90
|
+
containerStyles.height = isExpanded ? containerHeight : 0;
|
|
91
|
+
} else if (_Platform.default.OS === 'ios' && isExpanded && !isAnimating && !expandStateChanged && typeof containerHeight === 'number') {
|
|
92
|
+
// iOS reflows text while the height animation is in progress. Sometimes, it hits a timing bug where
|
|
93
|
+
// it fails to reflow properly after the last animation frame, leaving the last line of text not visible.
|
|
94
|
+
// Force reflow after animation completes with a static height non-identical to the last animated height.
|
|
95
|
+
containerStyles.height = containerHeight + 1;
|
|
96
|
+
} else {
|
|
97
|
+
containerStyles.height = expandAnimatedValue;
|
|
72
98
|
}
|
|
73
99
|
|
|
74
100
|
return [containerStyles, elementRef];
|
package/lib/utils/children.js
CHANGED
|
@@ -73,7 +73,7 @@ const isWrapable = child => {
|
|
|
73
73
|
return isStringOrNumber(child) || child.type === _A11yText.default || ((_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.name) === 'FootnoteLink';
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
const combineKeys = childrenArray => childrenArray.reduce((newKey, child) =>
|
|
76
|
+
const combineKeys = childrenArray => childrenArray.reduce((newKey, child) => "".concat(newKey).concat(child.key || ''), ''); // Group wrappable children for one `<Text>` parent, merging adjacent text nodes
|
|
77
77
|
|
|
78
78
|
|
|
79
79
|
const wrapChild = (child, wrappedText) => {
|
|
@@ -82,7 +82,7 @@ const wrapChild = (child, wrappedText) => {
|
|
|
82
82
|
|
|
83
83
|
if (lastIndex >= 0 && isStringOrNumber(child) && isStringOrNumber(wrappedText[lastIndex])) {
|
|
84
84
|
/* eslint-disable-next-line no-param-reassign */
|
|
85
|
-
wrappedText[lastIndex] =
|
|
85
|
+
wrappedText[lastIndex] = "".concat(wrappedText[lastIndex]).concat(child);
|
|
86
86
|
} else {
|
|
87
87
|
wrappedText.push(child);
|
|
88
88
|
}
|
package/lib/utils/input.js
CHANGED
|
@@ -28,29 +28,23 @@ const validateProps = (_ref, _ref2, hookName) => {
|
|
|
28
28
|
const usageError = error => {
|
|
29
29
|
// Errors inside hooks in React Native get incomplete stack traces pointing at parent component only.
|
|
30
30
|
// Help devs out by telling them exactly which hook threw the error as well as why.
|
|
31
|
-
throw new Error(
|
|
32
|
-
|
|
33
|
-
Consumers of this hook must be one of:
|
|
34
|
-
1. An "uncontrolled" component responding directly to user actions, with an optional \`initialValue${s}\` but no \`value${s}\` prop,
|
|
35
|
-
2. A "controlled" component where an always-defined \`value${s}\` prop is managed by an \`onChange\` handler, with no \`initialValue${s}\`,
|
|
36
|
-
3. A "read-only" component, with \`readOnly\` prop set as \`true\`.
|
|
37
|
-
`);
|
|
31
|
+
throw new Error("".concat(hookName, " ").concat(error, ".\n\nConsumers of this hook must be one of:\n1. An \"uncontrolled\" component responding directly to user actions, with an optional `initialValue").concat(s, "` but no `value").concat(s, "` prop,\n2. A \"controlled\" component where an always-defined `value").concat(s, "` prop is managed by an `onChange` handler, with no `initialValue").concat(s, "`,\n3. A \"read-only\" component, with `readOnly` prop set as `true`.\n"));
|
|
38
32
|
};
|
|
39
33
|
|
|
40
34
|
if (value && !onChange && !readOnly) {
|
|
41
|
-
usageError(
|
|
35
|
+
usageError("has `value".concat(s, "` prop without `onChange` or `readOnly`"));
|
|
42
36
|
}
|
|
43
37
|
|
|
44
38
|
if (initialValue && value) {
|
|
45
|
-
usageError(
|
|
39
|
+
usageError("has both `initialValue".concat(s, "` and `value").concat(s, "`"));
|
|
46
40
|
}
|
|
47
41
|
|
|
48
42
|
if (isControlled && !isCurrentlyControlled) {
|
|
49
|
-
usageError(
|
|
43
|
+
usageError("stopped receiving `value".concat(s, "` from parent after delegating state management"));
|
|
50
44
|
}
|
|
51
45
|
|
|
52
46
|
if (!isControlled && isCurrentlyControlled) {
|
|
53
|
-
usageError(
|
|
47
|
+
usageError("started receiving `value".concat(s, "` from parent after starting managing own state"));
|
|
54
48
|
}
|
|
55
49
|
};
|
|
56
50
|
/**
|
|
@@ -164,7 +158,7 @@ const useMultipleInputValues = function () {
|
|
|
164
158
|
onChange,
|
|
165
159
|
value: values,
|
|
166
160
|
// if we're controlling our own state, always start with an array
|
|
167
|
-
initialValue: initialValues
|
|
161
|
+
initialValue: initialValues !== null && initialValues !== void 0 ? initialValues : values === undefined ? [] : undefined
|
|
168
162
|
}, 'useMultipleInputValues');
|
|
169
163
|
const enforceMaxValues = (0, _react.useCallback)(newValues => {
|
|
170
164
|
if (!maxValues) return newValues;
|
|
@@ -33,8 +33,8 @@ function componentPropType(passedName) {
|
|
|
33
33
|
const nameInProp = ((_props$propName$type = props[propName].type) === null || _props$propName$type === void 0 ? void 0 : _props$propName$type.displayName) || ((_props$propName$type2 = props[propName].type) === null || _props$propName$type2 === void 0 ? void 0 : _props$propName$type2.name);
|
|
34
34
|
|
|
35
35
|
if (!nameInProp || !passedNames.includes(nameInProp)) {
|
|
36
|
-
const propDescription = nameInProp ?
|
|
37
|
-
return new Error(
|
|
36
|
+
const propDescription = nameInProp ? "Component ".concat(nameInProp) : typeof props[propName];
|
|
37
|
+
return new Error("".concat(componentName, ": ").concat(propDescription, " was passed to `").concat(propName, "` prop; should be ").concat(passedNames.join(' or ')));
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
return undefined;
|
|
@@ -42,7 +42,7 @@ function componentPropType(passedName) {
|
|
|
42
42
|
|
|
43
43
|
const checkRequired = (props, propName, componentName) => {
|
|
44
44
|
if (props[propName] === undefined) {
|
|
45
|
-
return new Error(
|
|
45
|
+
return new Error("The prop `".concat(propName, "` is marked as required in `").concat(componentName, "`, but its value is ").concat(props[propName], "."));
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
return undefined;
|
|
@@ -10,7 +10,7 @@ exports.default = selectSystemProps;
|
|
|
10
10
|
function selectSystemProps(systemPropHelpers) {
|
|
11
11
|
const selectProps = props => systemPropHelpers.reduce((acc, propHelper) => {
|
|
12
12
|
if (typeof (propHelper === null || propHelper === void 0 ? void 0 : propHelper.select) !== 'function') {
|
|
13
|
-
throw new Error(
|
|
13
|
+
throw new Error("An invalid system prop helper has been passed to 'selectSystemProps': prop selector ('.select') is missing in ".concat(propHelper));
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
return { ...acc,
|
|
@@ -20,7 +20,7 @@ function selectSystemProps(systemPropHelpers) {
|
|
|
20
20
|
|
|
21
21
|
const selectedPropTypes = systemPropHelpers.reduce((acc, propHelper) => {
|
|
22
22
|
if (!(propHelper !== null && propHelper !== void 0 && propHelper.types)) {
|
|
23
|
-
throw new Error(
|
|
23
|
+
throw new Error("An invalid system prop helper has been passed to 'selectSystemProps': types selector ('.types') is missing in ".concat(propHelper));
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
return { ...acc,
|
|
@@ -147,7 +147,14 @@ const crossPlatform = { ...textProps,
|
|
|
147
147
|
const webOnly = {
|
|
148
148
|
disabled: _propTypes.default.bool,
|
|
149
149
|
dir: _propTypes.default.oneOf(['auto', 'ltr', 'rtl']),
|
|
150
|
-
lang: _propTypes.default.string
|
|
150
|
+
lang: _propTypes.default.string,
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Sets the HTML input `pattern` attr. Not supported by React Native Web, but is supported by UDS.
|
|
154
|
+
* Must also pass in a ref and check validity by calling the HTML element's checkValidity method:
|
|
155
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/checkValidity
|
|
156
|
+
*/
|
|
157
|
+
pattern: _propTypes.default.string
|
|
151
158
|
};
|
|
152
159
|
/**
|
|
153
160
|
* These props are supported in React Native but not React Native Web.
|
|
@@ -22,7 +22,7 @@ const getTokenNames = componentName => {
|
|
|
22
22
|
const componentTokenSchema = _systemThemeTokens.components[componentName];
|
|
23
23
|
|
|
24
24
|
if (!componentTokenSchema) {
|
|
25
|
-
throw new Error(
|
|
25
|
+
throw new Error("No \"".concat(componentName, "\" tokenKeys in @telus-uds/system-theme-tokens"));
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
return Object.keys(componentTokenSchema);
|
|
@@ -63,7 +63,7 @@ exports.getTokenNames = getTokenNames;
|
|
|
63
63
|
const selectTokens = (specifier, tokens, prefix) => {
|
|
64
64
|
const tokenNames = typeof specifier === 'string' ? getTokenNames(specifier) : specifier;
|
|
65
65
|
const filteredTokens = tokenNames.reduce((validTokens, key) => {
|
|
66
|
-
const prefixedKey = prefix ?
|
|
66
|
+
const prefixedKey = prefix ? "".concat(prefix).concat(key[0].toUpperCase()).concat(key.slice(1)) : key;
|
|
67
67
|
const token = tokens[prefixedKey];
|
|
68
68
|
return token !== undefined ? { ...validTokens,
|
|
69
69
|
[key]: token
|
|
@@ -110,6 +110,8 @@ const resolveSpacingOptions = space => {
|
|
|
110
110
|
|
|
111
111
|
|
|
112
112
|
const useSpacingScale = spaceValue => {
|
|
113
|
+
var _spaceValue$space;
|
|
114
|
+
|
|
113
115
|
// In future, may need to consider window height as well as width, particularly for native apps,
|
|
114
116
|
// e.g. to ensure designs don't look lost on large, tall, not-so-wide portrait screens.
|
|
115
117
|
const viewport = (0, _ViewportProvider.useViewport)();
|
|
@@ -119,7 +121,7 @@ const useSpacingScale = spaceValue => {
|
|
|
119
121
|
overridden,
|
|
120
122
|
subtract = 0
|
|
121
123
|
} = resolveSpacingOptions(spaceValue);
|
|
122
|
-
const space = !overridden && ((spaceValue === null || spaceValue === void 0 ? void 0 : spaceValue.space)
|
|
124
|
+
const space = !overridden && ((_spaceValue$space = spaceValue === null || spaceValue === void 0 ? void 0 : spaceValue.space) !== null && _spaceValue$space !== void 0 ? _spaceValue$space : (0, _useResponsiveProp.resolveResponsiveProp)(spaceValue, viewport, 0));
|
|
123
125
|
const {
|
|
124
126
|
size
|
|
125
127
|
} = (0, _ThemeProvider.useThemeTokens)('spacingScale', tokens, variant, {
|
package/lib/utils/useUniqueId.js
CHANGED
|
@@ -13,7 +13,7 @@ function useUniqueId() {
|
|
|
13
13
|
let prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
14
14
|
const [uniqueId] = (0, _react.useState)(() => {
|
|
15
15
|
id += 1;
|
|
16
|
-
return
|
|
16
|
+
return "".concat(prefix, "-").concat(id);
|
|
17
17
|
});
|
|
18
18
|
return uniqueId;
|
|
19
19
|
}
|