@telus-uds/components-base 1.19.0 → 1.19.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 +2 -2
- package/lib/ActivityIndicator/Spinner.js +7 -7
- package/lib/ActivityIndicator/Spinner.native.js +2 -2
- package/lib/BaseProvider/HydrationContext.js +1 -1
- package/lib/BaseProvider/TamaguiProvider.js +30 -0
- package/lib/Button/ButtonBase.js +2 -2
- package/lib/Button/ButtonDropdown.js +207 -0
- package/lib/Button/ButtonGroup.js +1 -1
- package/lib/Carousel/Carousel.js +2 -4
- package/lib/Carousel/CarouselContext.js +1 -1
- package/lib/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +1 -1
- package/lib/Carousel/CarouselThumbnail.js +2 -2
- package/lib/Checkbox/Checkbox.js +1 -1
- package/lib/Checkbox/CheckboxGroup.js +2 -2
- package/lib/Divider/Divider.js +2 -2
- package/lib/FlexGrid/Col/Col.js +1 -1
- package/lib/Icon/Icon.js +1 -1
- package/lib/MultiSelectFilter/ModalOverlay.js +136 -0
- package/lib/MultiSelectFilter/MultiSelectFilter.js +314 -0
- package/lib/MultiSelectFilter/dictionary.js +19 -0
- package/lib/MultiSelectFilter/index.js +13 -0
- package/lib/Pagination/PageButton.js +2 -2
- package/lib/Pagination/Pagination.js +3 -5
- package/lib/Pagination/usePagination.js +2 -2
- package/lib/Progress/ProgressBar.js +3 -3
- package/lib/Progress/ProgressBarBackground.js +3 -3
- package/lib/QuickLinksFeature/QuickLinksFeature.js +91 -0
- package/lib/QuickLinksFeature/QuickLinksFeatureItem.js +157 -0
- package/lib/QuickLinksFeature/index.js +16 -0
- 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/Select/constants.js +15 -0
- 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 +1 -3
- package/lib/StackView/getStackedContent.js +2 -2
- package/lib/Tabs/Tabs.js +2 -4
- package/lib/Tags/Tags.js +1 -1
- package/lib/TextInput/dictionary.js +19 -0
- package/lib/ThemeProvider/utils/styles.js +3 -3
- package/lib/ThemeProvider/utils/theme-tokens.js +9 -7
- package/lib/Timeline/Timeline.js +1 -1
- package/lib/ToggleSwitch/ToggleSwitch.js +1 -1
- package/lib/ToggleSwitch/ToggleSwitchGroup.js +1 -1
- package/lib/Tooltip/Backdrop.js +10 -2
- package/lib/Tooltip/Tooltip.native.js +357 -0
- package/lib/Tooltip/shared.js +39 -0
- package/lib/Validator/Validator.js +271 -0
- package/lib/Validator/index.js +13 -0
- package/lib/utils/BaseView/BaseView.js +64 -0
- package/lib/utils/BaseView/BaseView.native.js +16 -0
- package/lib/utils/BaseView/index.js +13 -0
- package/lib/utils/animation/useVerticalExpandAnimation.js +1 -1
- package/lib/utils/children.js +2 -2
- package/lib/utils/floating-ui/index.js +43 -0
- package/lib/utils/floating-ui/index.native.js +43 -0
- package/lib/utils/input.js +12 -6
- package/lib/utils/props/componentPropType.js +3 -3
- package/lib/utils/props/selectSystemProps.js +2 -2
- package/lib/utils/props/tokens.js +2 -2
- package/lib/utils/useOverlaidPosition.js +243 -0
- package/lib/utils/useSpacingScale.js +1 -3
- package/lib/utils/useUniqueId.js +1 -1
- package/lib-module/ActivityIndicator/Spinner.js +7 -7
- package/lib-module/ActivityIndicator/Spinner.native.js +2 -2
- package/lib-module/BaseProvider/HydrationContext.js +1 -1
- package/lib-module/BaseProvider/TamaguiProvider.js +22 -0
- package/lib-module/Button/ButtonBase.js +2 -2
- package/lib-module/Button/ButtonDropdown.js +181 -0
- package/lib-module/Button/ButtonGroup.js +1 -1
- package/lib-module/Carousel/Carousel.js +2 -4
- package/lib-module/Carousel/CarouselContext.js +1 -1
- package/lib-module/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +1 -1
- package/lib-module/Carousel/CarouselThumbnail.js +2 -2
- package/lib-module/Checkbox/Checkbox.js +1 -1
- package/lib-module/Checkbox/CheckboxGroup.js +2 -2
- package/lib-module/Divider/Divider.js +2 -2
- package/lib-module/FlexGrid/Col/Col.js +1 -1
- package/lib-module/Icon/Icon.js +1 -1
- package/lib-module/MultiSelectFilter/ModalOverlay.js +112 -0
- package/lib-module/MultiSelectFilter/MultiSelectFilter.js +286 -0
- package/lib-module/MultiSelectFilter/dictionary.js +12 -0
- package/lib-module/MultiSelectFilter/index.js +2 -0
- package/lib-module/Pagination/PageButton.js +2 -2
- package/lib-module/Pagination/Pagination.js +3 -5
- package/lib-module/Pagination/usePagination.js +2 -2
- package/lib-module/Progress/ProgressBar.js +3 -3
- package/lib-module/Progress/ProgressBarBackground.js +3 -3
- package/lib-module/QuickLinksFeature/QuickLinksFeature.js +69 -0
- package/lib-module/QuickLinksFeature/QuickLinksFeatureItem.js +130 -0
- package/lib-module/QuickLinksFeature/index.js +4 -0
- package/lib-module/Radio/Radio.js +2 -2
- package/lib-module/Radio/RadioGroup.js +2 -2
- package/lib-module/RadioCard/RadioCard.js +1 -1
- package/lib-module/RadioCard/RadioCardGroup.js +2 -2
- package/lib-module/Search/Search.js +1 -1
- package/lib-module/Select/constants.js +5 -0
- package/lib-module/SideNav/SideNav.js +2 -2
- package/lib-module/Skeleton/Skeleton.js +1 -1
- package/lib-module/Skeleton/skeletonWebAnimation.js +1 -1
- package/lib-module/StackView/StackWrap.js +1 -3
- package/lib-module/StackView/getStackedContent.js +2 -2
- package/lib-module/Tabs/Tabs.js +2 -4
- package/lib-module/Tags/Tags.js +1 -1
- package/lib-module/TextInput/dictionary.js +12 -0
- package/lib-module/ThemeProvider/utils/styles.js +3 -3
- package/lib-module/ThemeProvider/utils/theme-tokens.js +9 -7
- package/lib-module/Timeline/Timeline.js +1 -1
- package/lib-module/ToggleSwitch/ToggleSwitch.js +1 -1
- package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +1 -1
- package/lib-module/Tooltip/Backdrop.js +10 -2
- package/lib-module/Tooltip/Tooltip.native.js +326 -0
- package/lib-module/Tooltip/shared.js +27 -0
- package/lib-module/Validator/Validator.js +245 -0
- package/lib-module/Validator/index.js +2 -0
- package/lib-module/utils/BaseView/BaseView.js +43 -0
- package/lib-module/utils/BaseView/BaseView.native.js +6 -0
- package/lib-module/utils/BaseView/index.js +2 -0
- package/lib-module/utils/animation/useVerticalExpandAnimation.js +1 -1
- package/lib-module/utils/children.js +2 -2
- package/lib-module/utils/floating-ui/index.js +1 -0
- package/lib-module/utils/floating-ui/index.native.js +1 -0
- package/lib-module/utils/input.js +12 -6
- package/lib-module/utils/props/componentPropType.js +3 -3
- package/lib-module/utils/props/selectSystemProps.js +2 -2
- package/lib-module/utils/props/tokens.js +2 -2
- package/lib-module/utils/useOverlaidPosition.js +232 -0
- package/lib-module/utils/useSpacingScale.js +1 -3
- package/lib-module/utils/useUniqueId.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-base
|
|
2
2
|
|
|
3
|
-
This log was last generated on Fri, 14 Oct 2022 19:
|
|
3
|
+
This log was last generated on Fri, 14 Oct 2022 19:30:03 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
7
|
## 1.19.0
|
|
8
8
|
|
|
9
|
-
Fri, 14 Oct 2022 19:
|
|
9
|
+
Fri, 14 Oct 2022 19:30:03 GMT
|
|
10
10
|
|
|
11
11
|
### Minor changes
|
|
12
12
|
|
|
@@ -23,14 +23,14 @@ const MIN_SVG_LENGTH = _shared.MIN_STROKE_ANGLE / 360 * SVG_CIRCUMFERENCE;
|
|
|
23
23
|
const MAX_SVG_LENGTH = (1 - _shared.MIN_EMPTY_ANGLE / 360) * SVG_CIRCUMFERENCE;
|
|
24
24
|
const animationProps = {
|
|
25
25
|
begin: '0s',
|
|
26
|
-
dur:
|
|
26
|
+
dur: `${_shared.DURATION}ms`,
|
|
27
27
|
fill: 'freeze',
|
|
28
28
|
repeatCount: 'indefinite'
|
|
29
29
|
};
|
|
30
30
|
const bezierProps = {
|
|
31
31
|
calcMode: 'spline',
|
|
32
32
|
keyTimes: '0; 0.5; 1',
|
|
33
|
-
keySplines:
|
|
33
|
+
keySplines: `${_shared.BEZIER.join(', ')} ; ${_shared.BEZIER.join(', ')}`
|
|
34
34
|
}; // We're using svg rather than css here to define the animation to avoid needing to introduce css injection mechanism
|
|
35
35
|
// It's possible to replicate this functionality with RNW animations, but it snags on chrome at least, see https://github.com/telus/universal-design-system/pull/477 for details.
|
|
36
36
|
|
|
@@ -46,8 +46,8 @@ const Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
46
46
|
} = (0, _A11yInfoProvider.useA11yInfo)();
|
|
47
47
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
48
48
|
ref: ref,
|
|
49
|
-
width:
|
|
50
|
-
height:
|
|
49
|
+
width: `${size}px`,
|
|
50
|
+
height: `${size}px`,
|
|
51
51
|
viewBox: "0 0 48 48",
|
|
52
52
|
"aria-valuetext": label,
|
|
53
53
|
role: "progressbar",
|
|
@@ -56,7 +56,7 @@ const Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
56
56
|
children: [reduceMotionEnabled ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)("animateTransform", {
|
|
57
57
|
attributeName: "transform",
|
|
58
58
|
type: "rotate",
|
|
59
|
-
values:
|
|
59
|
+
values: `-180 24 24;${360 + _shared.MIN_STROKE_ANGLE - 180} 24 24`,
|
|
60
60
|
...animationProps
|
|
61
61
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("circle", {
|
|
62
62
|
fill: "none",
|
|
@@ -71,12 +71,12 @@ const Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
71
71
|
children: reduceMotionEnabled ? null : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
72
72
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("animate", {
|
|
73
73
|
attributeName: "stroke-dashoffset",
|
|
74
|
-
values:
|
|
74
|
+
values: `0;-10;${MIN_SVG_LENGTH - SVG_CIRCUMFERENCE}`,
|
|
75
75
|
...animationProps,
|
|
76
76
|
...bezierProps
|
|
77
77
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("animate", {
|
|
78
78
|
attributeName: "stroke-dasharray",
|
|
79
|
-
values:
|
|
79
|
+
values: `${MIN_SVG_LENGTH}, 200;${MAX_SVG_LENGTH}, 200;${MIN_SVG_LENGTH}, 200`,
|
|
80
80
|
...animationProps,
|
|
81
81
|
...bezierProps
|
|
82
82
|
})]
|
|
@@ -95,7 +95,7 @@ const Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
const direction = index ? -1 : +1;
|
|
98
|
-
return
|
|
98
|
+
return `${direction * (180 - (sa + ea)) * easing(progress) + rotation}deg`;
|
|
99
99
|
});
|
|
100
100
|
const layerStyle = {
|
|
101
101
|
width: size,
|
|
@@ -110,7 +110,7 @@ const Spinner = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
110
110
|
layerStyle.transform = [{
|
|
111
111
|
rotate: timer.interpolate({
|
|
112
112
|
inputRange: [0, 1],
|
|
113
|
-
outputRange: [
|
|
113
|
+
outputRange: [`${0 + ea + sa}deg`, `${2 * 360 + ea + sa}deg`]
|
|
114
114
|
})
|
|
115
115
|
}];
|
|
116
116
|
viewportStyle.transform = [{
|
|
@@ -59,7 +59,7 @@ const HydrationProvider = _ref => {
|
|
|
59
59
|
}, []); // If we've got a HydrationProvider inside a HydrationProvider somehow, defer to the top one
|
|
60
60
|
|
|
61
61
|
const valueFromAncestor = useHydrationContext();
|
|
62
|
-
const isHydrating = valueFromAncestor
|
|
62
|
+
const isHydrating = valueFromAncestor ?? Boolean(!hasMounted && hasWebStyleTag());
|
|
63
63
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(HydrationContext.Provider, {
|
|
64
64
|
value: isHydrating,
|
|
65
65
|
children: children
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _componentsMultiPlatform = require("@telus-uds/components-multi-platform");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
const TamaguiWrapper = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
extended,
|
|
15
|
+
children
|
|
16
|
+
} = _ref;
|
|
17
|
+
console.log('extended', extended);
|
|
18
|
+
return extended ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsMultiPlatform.TamaguiProvider, {
|
|
19
|
+
config: _componentsMultiPlatform.config,
|
|
20
|
+
disableInjectCSS: true,
|
|
21
|
+
defaultTheme: "light",
|
|
22
|
+
children: children
|
|
23
|
+
}) : children;
|
|
24
|
+
};
|
|
25
|
+
TamaguiWrapper.propTypes = {
|
|
26
|
+
children: _propTypes.default.node.isRequired,
|
|
27
|
+
extended: _propTypes.default.bool
|
|
28
|
+
};
|
|
29
|
+
var _default = TamaguiWrapper;
|
|
30
|
+
exports.default = _default;
|
package/lib/Button/ButtonBase.js
CHANGED
|
@@ -100,7 +100,7 @@ const selectOuterWidthStyles = _ref3 => {
|
|
|
100
100
|
|
|
101
101
|
|
|
102
102
|
if (_Platform.default.OS === 'web') {
|
|
103
|
-
widthStyles.width =
|
|
103
|
+
widthStyles.width = `calc(${width} + ${outerBorderOffset * 2}px)`;
|
|
104
104
|
return widthStyles;
|
|
105
105
|
} // Can't use calc() on native but (unlike on web) flexGrow fills the container width here
|
|
106
106
|
|
|
@@ -187,7 +187,7 @@ const selectWebOnlyStyles = (inactive, themeTokens, _ref7) => {
|
|
|
187
187
|
return _Platform.default.select({
|
|
188
188
|
web: {
|
|
189
189
|
// if it would overflow the container, wraps instead
|
|
190
|
-
maxWidth:
|
|
190
|
+
maxWidth: `calc(100% + ${getOuterBorderOffset(themeTokens) * 2}px)`,
|
|
191
191
|
outline: 'none',
|
|
192
192
|
// removes the default browser :focus outline
|
|
193
193
|
...(0, _utils.getCursorStyle)(inactive, accessibilityRole)
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
13
|
+
|
|
14
|
+
var _Text = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Text"));
|
|
15
|
+
|
|
16
|
+
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
17
|
+
|
|
18
|
+
var _propTypes2 = _interopRequireWildcard(require("./propTypes"));
|
|
19
|
+
|
|
20
|
+
var _ButtonBase = _interopRequireDefault(require("./ButtonBase"));
|
|
21
|
+
|
|
22
|
+
var _ThemeProvider = require("../ThemeProvider");
|
|
23
|
+
|
|
24
|
+
var _utils = require("../utils");
|
|
25
|
+
|
|
26
|
+
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
27
|
+
|
|
28
|
+
var _StackView = require("../StackView");
|
|
29
|
+
|
|
30
|
+
var _pressability = require("../utils/pressability");
|
|
31
|
+
|
|
32
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
33
|
+
|
|
34
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
35
|
+
|
|
36
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
|
+
|
|
38
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
39
|
+
|
|
40
|
+
const selectIconTokens = _ref => {
|
|
41
|
+
let {
|
|
42
|
+
icon,
|
|
43
|
+
iconPosition,
|
|
44
|
+
iconSpace,
|
|
45
|
+
iconSize,
|
|
46
|
+
iconColor,
|
|
47
|
+
iconBackground,
|
|
48
|
+
iconBorderRadius,
|
|
49
|
+
iconAlignSelf,
|
|
50
|
+
iconPadding,
|
|
51
|
+
iconTranslateX,
|
|
52
|
+
iconTranslateY
|
|
53
|
+
} = _ref;
|
|
54
|
+
return {
|
|
55
|
+
icon,
|
|
56
|
+
iconPosition,
|
|
57
|
+
iconSpace,
|
|
58
|
+
iconWrapperStyle: {
|
|
59
|
+
backgroundColor: iconBackground,
|
|
60
|
+
borderRadius: iconBorderRadius,
|
|
61
|
+
alignSelf: iconAlignSelf,
|
|
62
|
+
padding: iconPadding,
|
|
63
|
+
..._Platform.default.select({
|
|
64
|
+
// TODO: https://github.com/telus/universal-design-system/issues/487
|
|
65
|
+
web: {
|
|
66
|
+
transition: 'color 200ms, background 200ms'
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
},
|
|
70
|
+
iconTokens: {
|
|
71
|
+
size: iconSize,
|
|
72
|
+
color: iconColor,
|
|
73
|
+
translateX: iconTranslateX,
|
|
74
|
+
translateY: iconTranslateY
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const ButtonDropdown = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
80
|
+
let {
|
|
81
|
+
value,
|
|
82
|
+
initialValue,
|
|
83
|
+
onChange,
|
|
84
|
+
label,
|
|
85
|
+
tokens,
|
|
86
|
+
variant,
|
|
87
|
+
inactive = false,
|
|
88
|
+
readOnly = false,
|
|
89
|
+
children = null,
|
|
90
|
+
accessibilityRole = 'radio',
|
|
91
|
+
...props
|
|
92
|
+
} = _ref2;
|
|
93
|
+
const {
|
|
94
|
+
currentValue: isOpen,
|
|
95
|
+
setValue: setIsOpen
|
|
96
|
+
} = (0, _utils.useInputValue)({
|
|
97
|
+
value,
|
|
98
|
+
initialValue,
|
|
99
|
+
onChange,
|
|
100
|
+
readOnly
|
|
101
|
+
}, 'useButtonDropdownValues');
|
|
102
|
+
const extraState = {
|
|
103
|
+
open: isOpen,
|
|
104
|
+
inactive,
|
|
105
|
+
...variant
|
|
106
|
+
};
|
|
107
|
+
const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('ButtonDropdown', tokens, extraState);
|
|
108
|
+
|
|
109
|
+
const getButtonTokens = buttonState => (0, _utils.selectTokens)('Button', getTokens(buttonState)); // Pass an object of relevant component state as first argument for any passed-in press handlers
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
const pressHandlers = (0, _pressability.getPressHandlersWithArgs)(props, [{
|
|
113
|
+
label,
|
|
114
|
+
open: isOpen
|
|
115
|
+
}]);
|
|
116
|
+
|
|
117
|
+
const handlePress = event => {
|
|
118
|
+
if (!inactive) {
|
|
119
|
+
if (pressHandlers.onPress) pressHandlers === null || pressHandlers === void 0 ? void 0 : pressHandlers.onPress(event);
|
|
120
|
+
setIsOpen(!isOpen, event);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonBase.default, {
|
|
125
|
+
ref: ref,
|
|
126
|
+
...pressHandlers,
|
|
127
|
+
onPress: handlePress,
|
|
128
|
+
tokens: getButtonTokens,
|
|
129
|
+
inactive: inactive,
|
|
130
|
+
icon: () => null,
|
|
131
|
+
accessibilityRole: accessibilityRole,
|
|
132
|
+
...props,
|
|
133
|
+
children: _ref3 => {
|
|
134
|
+
let {
|
|
135
|
+
textStyles,
|
|
136
|
+
...buttonState
|
|
137
|
+
} = _ref3;
|
|
138
|
+
// TODO: once Icon/IconButton designs are stable, see if this sort of styling around
|
|
139
|
+
// an icon should go in Icon itself, or possibly via an IconText token set. Related issues:
|
|
140
|
+
// - Icon: https://github.com/telus/universal-design-system/issues/327
|
|
141
|
+
// - IconButton: https://github.com/telus/universal-design-system/issues/281
|
|
142
|
+
// - Token sets: https://github.com/telus/universal-design-system/issues/782
|
|
143
|
+
const itemTokens = getTokens(buttonState);
|
|
144
|
+
const {
|
|
145
|
+
iconTokens,
|
|
146
|
+
iconPosition,
|
|
147
|
+
iconSpace,
|
|
148
|
+
iconWrapperStyle,
|
|
149
|
+
icon: IconComponent
|
|
150
|
+
} = selectIconTokens(itemTokens);
|
|
151
|
+
const iconContent = IconComponent ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
152
|
+
style: iconWrapperStyle,
|
|
153
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
154
|
+
icon: IconComponent,
|
|
155
|
+
tokens: iconTokens
|
|
156
|
+
})
|
|
157
|
+
}) : null;
|
|
158
|
+
|
|
159
|
+
const childrenContent = () => typeof children === 'function' ? children({ ...(0, _utils.resolvePressableState)(buttonState, extraState),
|
|
160
|
+
textStyles
|
|
161
|
+
}) : children;
|
|
162
|
+
|
|
163
|
+
const content = children ? childrenContent() : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
164
|
+
style: textStyles,
|
|
165
|
+
children: label
|
|
166
|
+
});
|
|
167
|
+
return (0, _StackView.getStackedContent)(iconPosition === 'left' ? [iconContent, content] : [content, iconContent], {
|
|
168
|
+
space: iconSpace,
|
|
169
|
+
direction: 'row'
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
ButtonDropdown.displayName = 'ButtonDropdown';
|
|
175
|
+
ButtonDropdown.propTypes = { ..._utils.a11yProps.types,
|
|
176
|
+
..._utils.focusHandlerProps.types,
|
|
177
|
+
..._propTypes2.default,
|
|
178
|
+
children: _propTypes2.textAndA11yText,
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Callback called when a controlled ButtonDropdown gets interacted with.
|
|
182
|
+
*/
|
|
183
|
+
onChange: _propTypes.default.func,
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* `value` prop is being used to set the 'open' state of ButtonDropdown. Use it for
|
|
187
|
+
* controlled ButtonDropdown. For uncontrolled ButtonDropdown, use `initialValue`.
|
|
188
|
+
*/
|
|
189
|
+
value: _propTypes.default.bool,
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Use `initialValue` to provide the initial value for an uncontrolled version.
|
|
193
|
+
*/
|
|
194
|
+
initialValue: _propTypes.default.bool,
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* The label of ButtonDropdown.
|
|
198
|
+
*/
|
|
199
|
+
label: _propTypes.default.string,
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* By default, `ButtonDropdown` is treated by accessibility tools as a radio button.
|
|
203
|
+
*/
|
|
204
|
+
accessibilityRole: _propTypes.default.string
|
|
205
|
+
};
|
|
206
|
+
var _default = ButtonDropdown;
|
|
207
|
+
exports.default = _default;
|
|
@@ -92,7 +92,7 @@ const ButtonGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
92
92
|
const uniqueFields = ['id', 'label'];
|
|
93
93
|
|
|
94
94
|
if (!(0, _utils.containUniqueFields)(items, uniqueFields)) {
|
|
95
|
-
throw new Error(
|
|
95
|
+
throw new Error(`ButtonGroup items must have unique ${uniqueFields.join(', ')}`);
|
|
96
96
|
} // Some web screenreaders e.g. MacOS Voiceover don't handle radiogroups properly unless radio is direct child of radiogroup
|
|
97
97
|
|
|
98
98
|
|
package/lib/Carousel/Carousel.js
CHANGED
|
@@ -157,8 +157,6 @@ const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_u
|
|
|
157
157
|
*/
|
|
158
158
|
|
|
159
159
|
const Carousel = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
160
|
-
var _systemProps$accessib;
|
|
161
|
-
|
|
162
160
|
let {
|
|
163
161
|
tokens,
|
|
164
162
|
variant,
|
|
@@ -447,7 +445,7 @@ const Carousel = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
447
445
|
const getCopyWithPlaceholders = _react.default.useCallback(copyKey => {
|
|
448
446
|
const copyText = getCopy(copyKey).replace(/%\{title\}/g, title).replace(/%\{itemLabel\}/g, itemLabel).replace(/%\{stepNumber\}/g, activeIndex + 1).replace(/%\{stepCount\}/g, childrenArray.length); // First word might be a lowercase placeholder: capitalize the first letter
|
|
449
447
|
|
|
450
|
-
return
|
|
448
|
+
return `${copyText[0].toUpperCase()}${copyText.slice(1)}`;
|
|
451
449
|
}, [activeIndex, childrenArray.length, itemLabel, getCopy, title]);
|
|
452
450
|
|
|
453
451
|
const activePanelNavigation = tabs && showPanelTabs ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CarouselTabsPanel.default, {
|
|
@@ -471,7 +469,7 @@ const Carousel = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
471
469
|
// otherwise read the current position on focus
|
|
472
470
|
|
|
473
471
|
|
|
474
|
-
const containerAccessibilityLabel =
|
|
472
|
+
const containerAccessibilityLabel = systemProps.accessibilityLabel ?? isFirstFocusContainer ? `${title ? `${title} ` : ''}${getCopyWithPlaceholders('stepTrackerLabel')}` : title;
|
|
475
473
|
const containerProps = {
|
|
476
474
|
accessibilityLabel: containerAccessibilityLabel,
|
|
477
475
|
// If used for focus, attach the ref and draw a focus box around the whole carousel
|
|
@@ -54,7 +54,7 @@ function useCarousel() {
|
|
|
54
54
|
const context = _react.default.useContext(CarouselContext);
|
|
55
55
|
|
|
56
56
|
if (context === undefined) {
|
|
57
|
-
throw new Error(
|
|
57
|
+
throw new Error(`'useCarousel' must be used within a 'CarouselProvider'`);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
return context;
|
|
@@ -40,7 +40,7 @@ const CarouselFirstFocus = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
40
40
|
} = (0, _CarouselContext.useCarousel)(); // TODO: integrate skip link description if behaving as skip link.
|
|
41
41
|
// Consider moving this content to aria-live area while only the skip link is focused.
|
|
42
42
|
|
|
43
|
-
const accessibilityLabel =
|
|
43
|
+
const accessibilityLabel = `${title}, ${getCopyWithPlaceholders('stepTrackerLabel')}`;
|
|
44
44
|
|
|
45
45
|
const accessibilityRole = _Platform.default.select({
|
|
46
46
|
web: 'link',
|
|
@@ -38,7 +38,7 @@ const CarouselThumbnail = _ref => {
|
|
|
38
38
|
goTo,
|
|
39
39
|
themeTokens
|
|
40
40
|
} = (0, _CarouselContext.useCarousel)();
|
|
41
|
-
const thumbnailTitle = alt
|
|
41
|
+
const thumbnailTitle = alt ?? getCopyWithPlaceholders('stepTrackerLabel').replace(/%\{itemLabel\}/g, itemLabel).replace(/%\{stepNumber\}/g, index).replace(/%\{stepCount\}/g, totalItems);
|
|
42
42
|
|
|
43
43
|
const handlePress = () => goTo(index);
|
|
44
44
|
|
|
@@ -81,7 +81,7 @@ const CarouselThumbnail = _ref => {
|
|
|
81
81
|
style: [styles.pressable, index === activeIndex && styles.selected],
|
|
82
82
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Image.default, {
|
|
83
83
|
accessibilityIgnoresInvertColors: true,
|
|
84
|
-
accessibilityLabel: accessibilityLabel
|
|
84
|
+
accessibilityLabel: accessibilityLabel ?? alt,
|
|
85
85
|
source: src,
|
|
86
86
|
style: styles.image,
|
|
87
87
|
title: thumbnailTitle
|
package/lib/Checkbox/Checkbox.js
CHANGED
|
@@ -215,7 +215,7 @@ const Checkbox = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
215
215
|
};
|
|
216
216
|
|
|
217
217
|
const uniqueId = (0, _useUniqueId.default)('checkbox');
|
|
218
|
-
const inputId = id
|
|
218
|
+
const inputId = id ?? uniqueId;
|
|
219
219
|
const {
|
|
220
220
|
themeOptions
|
|
221
221
|
} = (0, _ThemeProvider.useTheme)();
|
|
@@ -120,7 +120,7 @@ const CheckboxGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
120
120
|
const uniqueFields = ['id', 'label'];
|
|
121
121
|
|
|
122
122
|
if (!(0, _utils.containUniqueFields)(items, uniqueFields)) {
|
|
123
|
-
throw new Error(
|
|
123
|
+
throw new Error(`CheckboxGroup items must have unique ${uniqueFields.join(', ')}`);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
const checkboxes = items.map((_ref2, index) => {
|
|
@@ -131,7 +131,7 @@ const CheckboxGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
131
131
|
ref: itemRef,
|
|
132
132
|
...itemRest
|
|
133
133
|
} = _ref2;
|
|
134
|
-
const checkboxId = id ||
|
|
134
|
+
const checkboxId = id || `Checkbox[${index}]`;
|
|
135
135
|
|
|
136
136
|
const handleChange = (newCheckedState, event) => {
|
|
137
137
|
if (typeof itemOnChange === 'function') itemOnChange(newCheckedState, event);
|
package/lib/Divider/Divider.js
CHANGED
|
@@ -116,9 +116,9 @@ const Divider = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
116
116
|
};
|
|
117
117
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
118
118
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Spacer.default, { ...spacerProps,
|
|
119
|
-
testID: testID ?
|
|
119
|
+
testID: testID ? `${testID}-Spacer-before` : undefined
|
|
120
120
|
}), divider, /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spacer.default, { ...spacerProps,
|
|
121
|
-
testID: testID ?
|
|
121
|
+
testID: testID ? `${testID}-Spacer-after` : undefined
|
|
122
122
|
})]
|
|
123
123
|
});
|
|
124
124
|
});
|
package/lib/FlexGrid/Col/Col.js
CHANGED
|
@@ -69,7 +69,7 @@ const Col = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
69
69
|
const horizontalAlignLevel = getHorizontalAlignLevel();
|
|
70
70
|
|
|
71
71
|
const toPercent = num => {
|
|
72
|
-
return
|
|
72
|
+
return `${num / 12 * 100}%`;
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
const calculateWidth = value => {
|
package/lib/Icon/Icon.js
CHANGED
|
@@ -48,7 +48,7 @@ const Icon = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
48
48
|
// TODO: systematise animations.
|
|
49
49
|
// https://github.com/telus/universal-design-system/issues/487
|
|
50
50
|
transition: 'transform 200ms, color 200ms',
|
|
51
|
-
transform: [themeTokens.scale ?
|
|
51
|
+
transform: [themeTokens.scale ? `scale(${themeTokens.scale})` : '', themeTokens.translateX ? `translateX(${themeTokens.translateX}px)` : '', themeTokens.translateY ? `translateY(${themeTokens.translateY}px)` : ''].filter(exists => exists).join(' ')
|
|
52
52
|
},
|
|
53
53
|
dataSet: dataSet,
|
|
54
54
|
children: iconContent
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
13
|
+
|
|
14
|
+
var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
|
|
15
|
+
|
|
16
|
+
var _portal = require("@gorhom/portal");
|
|
17
|
+
|
|
18
|
+
var _utils = require("../utils");
|
|
19
|
+
|
|
20
|
+
var _ViewportProvider = require("../ViewportProvider");
|
|
21
|
+
|
|
22
|
+
var _ThemeProvider = require("../ThemeProvider");
|
|
23
|
+
|
|
24
|
+
var _dictionary = _interopRequireDefault(require("./dictionary"));
|
|
25
|
+
|
|
26
|
+
var _Card = _interopRequireDefault(require("../Card"));
|
|
27
|
+
|
|
28
|
+
var _IconButton = _interopRequireDefault(require("../IconButton"));
|
|
29
|
+
|
|
30
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
31
|
+
|
|
32
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
|
+
|
|
34
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
|
+
|
|
36
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
|
+
|
|
38
|
+
const staticStyles = _StyleSheet.default.create({
|
|
39
|
+
positioner: {
|
|
40
|
+
flex: 1,
|
|
41
|
+
// Grow to maxWidth when possible, shrink when not possible
|
|
42
|
+
position: 'absolute',
|
|
43
|
+
height: 330,
|
|
44
|
+
paddingTop: 5,
|
|
45
|
+
zIndex: 10000 // Position on top of all the other overlays, including backdrops and modals
|
|
46
|
+
|
|
47
|
+
},
|
|
48
|
+
closeButtonContainer: {
|
|
49
|
+
position: 'absolute',
|
|
50
|
+
top: 0,
|
|
51
|
+
right: 0,
|
|
52
|
+
zIndex: 1
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const selectCloseButtonContainerStyles = _ref => {
|
|
57
|
+
let {
|
|
58
|
+
paddingRight,
|
|
59
|
+
paddingTop
|
|
60
|
+
} = _ref;
|
|
61
|
+
return {
|
|
62
|
+
paddingRight,
|
|
63
|
+
paddingTop
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const selectPaddingContainerStyles = _ref2 => {
|
|
68
|
+
let {
|
|
69
|
+
paddingTop,
|
|
70
|
+
paddingLeft,
|
|
71
|
+
paddingRight
|
|
72
|
+
} = _ref2;
|
|
73
|
+
return {
|
|
74
|
+
paddingBottom: 35,
|
|
75
|
+
paddingTop,
|
|
76
|
+
paddingLeft,
|
|
77
|
+
paddingRight
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const ModalOverlay = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
82
|
+
let {
|
|
83
|
+
children,
|
|
84
|
+
tokens,
|
|
85
|
+
variant,
|
|
86
|
+
copy,
|
|
87
|
+
onClose
|
|
88
|
+
} = _ref3;
|
|
89
|
+
const viewport = (0, _ViewportProvider.useViewport)();
|
|
90
|
+
const themeTokens = (0, _ThemeProvider.useThemeTokens)('Modal', tokens, variant, {
|
|
91
|
+
viewport,
|
|
92
|
+
maxWidth: false
|
|
93
|
+
});
|
|
94
|
+
const {
|
|
95
|
+
closeIcon: CloseIconComponent,
|
|
96
|
+
maxWidth
|
|
97
|
+
} = themeTokens;
|
|
98
|
+
const getCopy = (0, _utils.useCopy)({
|
|
99
|
+
dictionary: _dictionary.default,
|
|
100
|
+
copy
|
|
101
|
+
});
|
|
102
|
+
const closeLabel = getCopy('closeButton');
|
|
103
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
104
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_portal.Portal, {
|
|
105
|
+
ref: ref,
|
|
106
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
107
|
+
style: [{
|
|
108
|
+
minWidth: maxWidth
|
|
109
|
+
}, staticStyles.positioner],
|
|
110
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Card.default, {
|
|
111
|
+
tokens: selectPaddingContainerStyles(themeTokens),
|
|
112
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
113
|
+
style: [staticStyles.closeButtonContainer, selectCloseButtonContainerStyles(themeTokens)],
|
|
114
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
115
|
+
onPress: onClose,
|
|
116
|
+
icon: CloseIconComponent,
|
|
117
|
+
accessibilityRole: "button",
|
|
118
|
+
accessibilityLabel: closeLabel,
|
|
119
|
+
tokens: (0, _utils.selectTokens)('IconButton', themeTokens, 'close')
|
|
120
|
+
})
|
|
121
|
+
}), children]
|
|
122
|
+
})
|
|
123
|
+
})
|
|
124
|
+
})
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
ModalOverlay.displayName = 'ModalOverlay';
|
|
128
|
+
ModalOverlay.propTypes = {
|
|
129
|
+
children: _propTypes.default.node.isRequired,
|
|
130
|
+
variant: _utils.variantProp.propType,
|
|
131
|
+
tokens: (0, _utils.getTokensPropType)('Modal'),
|
|
132
|
+
copy: _utils.copyPropTypes,
|
|
133
|
+
onClose: _propTypes.default.func
|
|
134
|
+
};
|
|
135
|
+
var _default = ModalOverlay;
|
|
136
|
+
exports.default = _default;
|