@telus-uds/components-base 1.18.1 → 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 +22 -2
- package/component-docs.json +111 -16
- package/jest.config-android.js +17 -0
- package/jest.config-ios.js +18 -0
- package/jest.config-web.js +31 -0
- 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 +8 -4
- package/lib/Button/ButtonDropdown.js +207 -0
- package/lib/Button/ButtonGroup.js +1 -1
- package/lib/Carousel/Carousel.js +31 -5
- package/lib/Carousel/CarouselContext.js +1 -1
- package/lib/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +1 -1
- package/lib/Carousel/CarouselTabs/CarouselTabsPanel.js +1 -10
- 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/SideButton.js +6 -4
- 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/Responsive/Responsive.js +58 -0
- package/lib/Responsive/index.js +13 -0
- package/lib/Search/Search.js +30 -63
- 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 +11 -5
- package/lib/TextInput/TextInputBase.js +53 -19
- 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/index.js +9 -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 +8 -4
- package/lib-module/Button/ButtonDropdown.js +181 -0
- package/lib-module/Button/ButtonGroup.js +1 -1
- package/lib-module/Carousel/Carousel.js +31 -5
- package/lib-module/Carousel/CarouselContext.js +1 -1
- package/lib-module/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +1 -1
- package/lib-module/Carousel/CarouselTabs/CarouselTabsPanel.js +1 -10
- 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/SideButton.js +6 -4
- 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/Responsive/Responsive.js +45 -0
- package/lib-module/Responsive/index.js +2 -0
- package/lib-module/Search/Search.js +30 -61
- 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 +11 -5
- package/lib-module/TextInput/TextInputBase.js +52 -19
- 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/index.js +1 -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 +7 -4
- package/src/Button/ButtonBase.jsx +4 -2
- package/src/Carousel/Carousel.jsx +42 -10
- package/src/Carousel/CarouselTabs/CarouselTabsPanel.jsx +0 -10
- package/src/Pagination/SideButton.jsx +5 -5
- package/src/Responsive/Responsive.jsx +33 -0
- package/src/Responsive/index.js +3 -0
- package/src/Search/Search.jsx +17 -32
- package/src/Tags/Tags.jsx +46 -33
- package/src/TextInput/TextInputBase.jsx +46 -16
- package/src/index.js +1 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _MultiSelectFilter = _interopRequireDefault(require("./MultiSelectFilter"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = _MultiSelectFilter.default;
|
|
13
|
+
exports.default = _default;
|
|
@@ -54,8 +54,8 @@ const PageButton = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
54
54
|
key: 'active-item'
|
|
55
55
|
} : {};
|
|
56
56
|
const accessibilityRole = href !== undefined ? 'link' : 'button';
|
|
57
|
-
const activeLabel = isActive ?
|
|
58
|
-
const accessibilityLabel =
|
|
57
|
+
const activeLabel = isActive ? ` ${getCopy('currentLabel')}` : '';
|
|
58
|
+
const accessibilityLabel = `${getCopy('goToLabel')} ${label}${activeLabel}`;
|
|
59
59
|
|
|
60
60
|
const {
|
|
61
61
|
hrefAttrs,
|
|
@@ -110,11 +110,9 @@ const Pagination = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
110
110
|
LinkRouter: LinkRouter,
|
|
111
111
|
linkRouterProps: linkRouterProps
|
|
112
112
|
}), ...items.map((_child, itemIndex) => {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const buttonLabel = "".concat(itemIndex + 1);
|
|
113
|
+
const buttonLabel = `${itemIndex + 1}`;
|
|
116
114
|
const itemProps = getItemProps(itemIndex);
|
|
117
|
-
const ItemLinkRouter =
|
|
115
|
+
const ItemLinkRouter = itemProps.LinkRouter ?? LinkRouter;
|
|
118
116
|
const itemLinkRouterProps = { ...linkRouterProps,
|
|
119
117
|
...itemProps.linkRouterProps
|
|
120
118
|
};
|
|
@@ -151,7 +149,7 @@ const Pagination = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
151
149
|
ref: ref,
|
|
152
150
|
...selectProps(rest),
|
|
153
151
|
children: buttons // keep the keys in-line with the page numbers regardless of which buttons are actually rendered
|
|
154
|
-
.map((element, index) => [element,
|
|
152
|
+
.map((element, index) => [element, `page-${index + 1}`]).filter(_ref3 => {
|
|
155
153
|
let [element] = _ref3;
|
|
156
154
|
return element !== null;
|
|
157
155
|
}).map(_ref4 => {
|
|
@@ -34,10 +34,12 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
34
34
|
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; }
|
|
35
35
|
|
|
36
36
|
// We need to drop the icon here since it gets rendered via children and not
|
|
37
|
-
// `ButtonBase` in order to tap into the state of the button
|
|
37
|
+
// `ButtonBase` in order to tap into the state of the button; `displayLabel` flag
|
|
38
|
+
// is also not needed
|
|
38
39
|
const selectButtonTokens = _ref => {
|
|
39
40
|
let {
|
|
40
41
|
icon: _,
|
|
42
|
+
displayLabel: __,
|
|
41
43
|
...rest
|
|
42
44
|
} = _ref;
|
|
43
45
|
return (0, _utils.selectTokens)('Button', rest);
|
|
@@ -82,7 +84,8 @@ const SideButton = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
|
82
84
|
copy
|
|
83
85
|
});
|
|
84
86
|
const {
|
|
85
|
-
icon
|
|
87
|
+
icon,
|
|
88
|
+
displayLabel
|
|
86
89
|
} = getTokens(tokens, buttonVariant);
|
|
87
90
|
|
|
88
91
|
const getButtonTokens = buttonState => selectButtonTokens(getTokens(buttonState));
|
|
@@ -90,7 +93,6 @@ const SideButton = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
|
90
93
|
const getIconTokens = buttonState => selectIconTokens(getTokens(buttonState), direction);
|
|
91
94
|
|
|
92
95
|
const label = direction === 'previous' ? getCopy('previousText') : getCopy('nextText');
|
|
93
|
-
const showLabel = viewport !== 'sm' && viewport !== 'xs';
|
|
94
96
|
const accessibilityLabel = direction === 'previous' ? getCopy('previousLabel') : getCopy('nextLabel');
|
|
95
97
|
const accessibilityRole = href !== undefined ? 'link' : 'button';
|
|
96
98
|
|
|
@@ -124,7 +126,7 @@ const SideButton = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
|
|
|
124
126
|
space: 1,
|
|
125
127
|
iconPosition: directionToSide[direction],
|
|
126
128
|
iconProps: iconProps,
|
|
127
|
-
children:
|
|
129
|
+
children: displayLabel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
128
130
|
style: textStyles,
|
|
129
131
|
children: label
|
|
130
132
|
})
|
|
@@ -21,7 +21,7 @@ function usePagination(_ref) {
|
|
|
21
21
|
);
|
|
22
22
|
|
|
23
23
|
const getItemProps = index => {
|
|
24
|
-
var _items$index
|
|
24
|
+
var _items$index;
|
|
25
25
|
|
|
26
26
|
const {
|
|
27
27
|
onPress,
|
|
@@ -29,7 +29,7 @@ function usePagination(_ref) {
|
|
|
29
29
|
hrefAttrs,
|
|
30
30
|
variant,
|
|
31
31
|
tokens
|
|
32
|
-
} = (
|
|
32
|
+
} = ((_items$index = items[index]) === null || _items$index === void 0 ? void 0 : _items$index.props) ?? {};
|
|
33
33
|
return {
|
|
34
34
|
onPress,
|
|
35
35
|
href,
|
|
@@ -43,7 +43,7 @@ const selectBarStyles = (_ref, percentage) => {
|
|
|
43
43
|
borderRadius,
|
|
44
44
|
outlineWidth,
|
|
45
45
|
outlineColor,
|
|
46
|
-
width:
|
|
46
|
+
width: `${percentage}%`
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
/**
|
|
@@ -104,7 +104,7 @@ const ProgressBar = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
104
104
|
min: 0,
|
|
105
105
|
max: 100,
|
|
106
106
|
now: percentage,
|
|
107
|
-
text:
|
|
107
|
+
text: `${percentage}%`
|
|
108
108
|
},
|
|
109
109
|
...rest
|
|
110
110
|
});
|
|
@@ -112,7 +112,7 @@ const ProgressBar = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
112
112
|
ref: ref,
|
|
113
113
|
style: [staticStyles.bar, selectBarStyles(themeTokens, percentage)],
|
|
114
114
|
...selectedProps,
|
|
115
|
-
children: children
|
|
115
|
+
children: children ?? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProgressBarBackground.default, {
|
|
116
116
|
variant: variant
|
|
117
117
|
})
|
|
118
118
|
}) : null;
|
|
@@ -21,8 +21,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
21
21
|
|
|
22
22
|
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; }
|
|
23
23
|
|
|
24
|
-
const inactiveBackground =
|
|
25
|
-
const negativeBackground =
|
|
24
|
+
const inactiveBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='DisabledProgress7' patternUnits='userSpaceOnUse' width='8' height='8'%3E%3Crect width='8' height='8' fill='%23B2B9BF'%3E%3C/rect%3E%3Ccircle cx='4' cy='4' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='0' cy='0' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='0' cy='8' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='8' cy='0' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='8' cy='8' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3C/pattern%3E%3C/defs%3E%3Cpath d='M 0 0 L 0 140 L 2000 2000 L 2000 0 Z' style='fill: url("%23DisabledProgress7");'%3E%3C/path%3E%3C/svg%3E`;
|
|
25
|
+
const negativeBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='NegativeProgress6' patternUnits='userSpaceOnUse' width='8' height='8'%3E%3Crect width='8' height='8' fill='%23C12335'%3E%3C/rect%3E%3Cpath d='M 0,8 l 8,-8 M -2,2 l 4,-4 M 6,10 l 4,-4' stroke-width='2' shape-rendering='auto' stroke='%23e7adb4' stroke-linecap='square'%3E%3C/path%3E%3C/pattern%3E%3C/defs%3E%3Cpath d='M 0 0 L 0 140 L 2000 2000 L 2000 0 Z' style='fill: url("%23NegativeProgress6");'%3E%3C/path%3E%3C/svg%3E`;
|
|
26
26
|
const ProgressBarBackground = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
27
27
|
let {
|
|
28
28
|
variant
|
|
@@ -40,7 +40,7 @@ const ProgressBarBackground = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) =>
|
|
|
40
40
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageBackground.default, {
|
|
41
41
|
ref: ref,
|
|
42
42
|
source: {
|
|
43
|
-
uri:
|
|
43
|
+
uri: `data:image/svg+xml,${source}`
|
|
44
44
|
},
|
|
45
45
|
style: staticStyles.imageBackground
|
|
46
46
|
});
|
|
@@ -0,0 +1,91 @@
|
|
|
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 _StackView = require("../StackView");
|
|
13
|
+
|
|
14
|
+
var _ThemeProvider = require("../ThemeProvider");
|
|
15
|
+
|
|
16
|
+
var _utils = require("../utils");
|
|
17
|
+
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
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); }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
// pass through and type relevant system props - add more sets for interactive components
|
|
27
|
+
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
|
|
28
|
+
|
|
29
|
+
const isQuickListItem = element => {
|
|
30
|
+
var _element$type, _element$type2;
|
|
31
|
+
|
|
32
|
+
const elementName = (element === null || element === void 0 ? void 0 : (_element$type = element.type) === null || _element$type === void 0 ? void 0 : _element$type.displayName) || (element === null || element === void 0 ? void 0 : (_element$type2 = element.type) === null || _element$type2 === void 0 ? void 0 : _element$type2.name);
|
|
33
|
+
return Boolean(elementName.match(/QuickLinksFeatureItem/));
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* QuickLinksFeature renders a list of interactive items.
|
|
37
|
+
* - This is the base component that is used as a wrapper and accepts a List of `QuickLinksFeature.Item`
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
const QuickLinksFeature = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
42
|
+
let {
|
|
43
|
+
tokens,
|
|
44
|
+
variant,
|
|
45
|
+
tag = 'ul',
|
|
46
|
+
children,
|
|
47
|
+
...rest
|
|
48
|
+
} = _ref;
|
|
49
|
+
const {
|
|
50
|
+
stackGap,
|
|
51
|
+
stackJustify,
|
|
52
|
+
stackSpace
|
|
53
|
+
} = (0, _ThemeProvider.useThemeTokens)('QuickLinksFeature', tokens, variant);
|
|
54
|
+
|
|
55
|
+
const items = _react.Children.map(children, child => {
|
|
56
|
+
if (isQuickListItem(child)) {
|
|
57
|
+
return /*#__PURE__*/(0, _react.cloneElement)(child, child.props);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return null;
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_StackView.StackWrap, {
|
|
64
|
+
space: stackSpace,
|
|
65
|
+
gap: stackGap,
|
|
66
|
+
tokens: {
|
|
67
|
+
justifyContent: stackJustify
|
|
68
|
+
},
|
|
69
|
+
tag: tag,
|
|
70
|
+
ref: ref,
|
|
71
|
+
...selectProps(rest),
|
|
72
|
+
children: items
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
QuickLinksFeature.displayName = 'QuickLinksFeature';
|
|
76
|
+
QuickLinksFeature.propTypes = { ...selectedSystemPropTypes,
|
|
77
|
+
tokens: (0, _utils.getTokensPropType)('QuickLinksFeature'),
|
|
78
|
+
variant: _utils.variantProp.propType,
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Default wrapper tag, by default it's "ul"
|
|
82
|
+
*/
|
|
83
|
+
tag: _propTypes.default.string,
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* QuickLinksFeature.Item component
|
|
87
|
+
*/
|
|
88
|
+
children: _propTypes.default.node
|
|
89
|
+
};
|
|
90
|
+
var _default = QuickLinksFeature;
|
|
91
|
+
exports.default = _default;
|
|
@@ -0,0 +1,157 @@
|
|
|
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 _Image = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Image"));
|
|
13
|
+
|
|
14
|
+
var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
|
|
15
|
+
|
|
16
|
+
var _Text = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Text"));
|
|
17
|
+
|
|
18
|
+
var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
|
|
19
|
+
|
|
20
|
+
var _utils = require("../utils");
|
|
21
|
+
|
|
22
|
+
var _ViewportProvider = require("../ViewportProvider");
|
|
23
|
+
|
|
24
|
+
var _ThemeProvider = require("../ThemeProvider");
|
|
25
|
+
|
|
26
|
+
var _Link = require("../Link");
|
|
27
|
+
|
|
28
|
+
var _StackView = require("../StackView");
|
|
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
|
+
// pass through and type relevant system props - add more sets for interactive components
|
|
39
|
+
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.linkProps]);
|
|
40
|
+
|
|
41
|
+
const selectImageStyle = imageDimension => ({
|
|
42
|
+
width: imageDimension,
|
|
43
|
+
height: imageDimension,
|
|
44
|
+
..._Platform.default.select({
|
|
45
|
+
// TODO: https://github.com/telus/universal-design-system/issues/487
|
|
46
|
+
web: {
|
|
47
|
+
transition: 'width 200ms, height 200ms'
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const selectContainerStyle = _ref => {
|
|
53
|
+
let {
|
|
54
|
+
contentMaxDimension,
|
|
55
|
+
textAlign
|
|
56
|
+
} = _ref;
|
|
57
|
+
return {
|
|
58
|
+
textAlign,
|
|
59
|
+
width: contentMaxDimension,
|
|
60
|
+
overflow: 'hidden'
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const selectImageContainerStyle = contentMaxDimension => ({
|
|
65
|
+
width: contentMaxDimension,
|
|
66
|
+
height: contentMaxDimension,
|
|
67
|
+
justifyContent: 'center',
|
|
68
|
+
alignItems: 'center'
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* Component export along with QuickLinksFeature to be used as children
|
|
72
|
+
*
|
|
73
|
+
* It will receive a image source and a accessibility label and will render a link accordingly with the theme tokens
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
const QuickLinksFeatureItem = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
78
|
+
let {
|
|
79
|
+
tokens,
|
|
80
|
+
variant,
|
|
81
|
+
children,
|
|
82
|
+
imageAccessibilityLabel,
|
|
83
|
+
imageSource,
|
|
84
|
+
...rest
|
|
85
|
+
} = _ref2;
|
|
86
|
+
const viewport = (0, _ViewportProvider.useViewport)();
|
|
87
|
+
const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('QuickLinksFeatureItem', tokens, variant);
|
|
88
|
+
const [hover, setHover] = (0, _react.useState)(false);
|
|
89
|
+
const {
|
|
90
|
+
contentDirection,
|
|
91
|
+
contentSpace,
|
|
92
|
+
contentAlignItems,
|
|
93
|
+
contentMaxDimension,
|
|
94
|
+
imageDimension,
|
|
95
|
+
textAlign
|
|
96
|
+
} = getTokens({
|
|
97
|
+
viewport,
|
|
98
|
+
hover
|
|
99
|
+
});
|
|
100
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Link.Link, {
|
|
101
|
+
ref: ref,
|
|
102
|
+
tokens: state => {
|
|
103
|
+
setHover(state.hover);
|
|
104
|
+
return getTokens(state);
|
|
105
|
+
},
|
|
106
|
+
...selectProps(rest),
|
|
107
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
108
|
+
style: selectContainerStyle({
|
|
109
|
+
contentMaxDimension,
|
|
110
|
+
textAlign
|
|
111
|
+
}),
|
|
112
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_StackView.StackWrap, {
|
|
113
|
+
direction: contentDirection,
|
|
114
|
+
space: contentSpace,
|
|
115
|
+
tokens: {
|
|
116
|
+
alignItems: contentAlignItems
|
|
117
|
+
},
|
|
118
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
119
|
+
style: selectImageContainerStyle(contentMaxDimension),
|
|
120
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Image.default, {
|
|
121
|
+
accessibilityIgnoresInvertColors: true,
|
|
122
|
+
imageAccessibilityLabel: imageAccessibilityLabel,
|
|
123
|
+
source: imageSource,
|
|
124
|
+
style: selectImageStyle(imageDimension)
|
|
125
|
+
})
|
|
126
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
127
|
+
children: children
|
|
128
|
+
})]
|
|
129
|
+
})
|
|
130
|
+
})
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
QuickLinksFeatureItem.displayName = 'QuickLinksFeatureItem';
|
|
134
|
+
QuickLinksFeatureItem.propTypes = { ..._utils.withLinkRouter.propTypes,
|
|
135
|
+
...selectedSystemPropTypes,
|
|
136
|
+
tokens: (0, _utils.getTokensPropType)('QuickLinksFeatureItem'),
|
|
137
|
+
variant: _utils.variantProp.propType,
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Text which will be rendered within the Link
|
|
141
|
+
*/
|
|
142
|
+
children: _propTypes.default.node.isRequired,
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Image accessibility label
|
|
146
|
+
*/
|
|
147
|
+
imageAccessibilityLabel: _propTypes.default.string.isRequired,
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Image node or Image url
|
|
151
|
+
*/
|
|
152
|
+
imageSource: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]).isRequired
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
var _default = (0, _utils.withLinkRouter)(QuickLinksFeatureItem);
|
|
156
|
+
|
|
157
|
+
exports.default = _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _QuickLinksFeature = _interopRequireDefault(require("./QuickLinksFeature"));
|
|
9
|
+
|
|
10
|
+
var _QuickLinksFeatureItem = _interopRequireDefault(require("./QuickLinksFeatureItem"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
_QuickLinksFeature.default.Item = _QuickLinksFeatureItem.default;
|
|
15
|
+
var _default = _QuickLinksFeature.default;
|
|
16
|
+
exports.default = _default;
|
package/lib/Radio/Radio.js
CHANGED
|
@@ -70,7 +70,7 @@ const selectDescriptionStyles = _ref2 => {
|
|
|
70
70
|
labelMarginLeft = 0
|
|
71
71
|
} = _ref2;
|
|
72
72
|
return {
|
|
73
|
-
marginLeft: descriptionMarginLeft
|
|
73
|
+
marginLeft: descriptionMarginLeft ?? containerPaddingLeft + inputSize + labelMarginLeft,
|
|
74
74
|
...(0, _ThemeProvider.applyTextStyles)({
|
|
75
75
|
fontSize: descriptionFontSize,
|
|
76
76
|
lineHeight: descriptionLineHeight
|
|
@@ -174,7 +174,7 @@ const Radio = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
|
|
|
174
174
|
};
|
|
175
175
|
|
|
176
176
|
const uniqueId = (0, _utils.useUniqueId)('radio');
|
|
177
|
-
const inputId = id
|
|
177
|
+
const inputId = id ?? uniqueId;
|
|
178
178
|
const selectedProps = selectProps({
|
|
179
179
|
accessibilityRole: 'radio',
|
|
180
180
|
accessibilityState: {
|
package/lib/Radio/RadioGroup.js
CHANGED
|
@@ -122,7 +122,7 @@ const RadioGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
122
122
|
const uniqueFields = ['id', 'label'];
|
|
123
123
|
|
|
124
124
|
if (!(0, _utils.containUniqueFields)(items, uniqueFields)) {
|
|
125
|
-
throw new Error(
|
|
125
|
+
throw new Error(`RadioGroup items must have unique ${uniqueFields.join(', ')}`);
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
const radios = items.map((_ref2, index) => {
|
|
@@ -133,7 +133,7 @@ const RadioGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
133
133
|
ref: itemRef,
|
|
134
134
|
...itemRest
|
|
135
135
|
} = _ref2;
|
|
136
|
-
const radioId = id ||
|
|
136
|
+
const radioId = id || `Radio[${index}]`;
|
|
137
137
|
const isChecked = currentValue === radioId;
|
|
138
138
|
|
|
139
139
|
const handleChange = (newCheckedState, event) => {
|
|
@@ -102,7 +102,7 @@ const RadioCard = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
102
102
|
};
|
|
103
103
|
|
|
104
104
|
const uniqueId = (0, _utils.useUniqueId)('RadioCard');
|
|
105
|
-
const inputId = id
|
|
105
|
+
const inputId = id ?? uniqueId;
|
|
106
106
|
const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('RadioCard', tokens, variant);
|
|
107
107
|
|
|
108
108
|
const getCardTokens = cardState => (0, _Card.selectPressableCardTokens)(getTokens(cardState));
|
|
@@ -127,7 +127,7 @@ const RadioCardGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
127
127
|
const uniqueFields = ['id'];
|
|
128
128
|
|
|
129
129
|
if (!(0, _utils.containUniqueFields)(items, uniqueFields)) {
|
|
130
|
-
throw new Error(
|
|
130
|
+
throw new Error(`RadioCardGroup items must have unique ${uniqueFields.join(', ')}`);
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Fieldset.default, {
|
|
@@ -155,7 +155,7 @@ const RadioCardGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
155
155
|
onChange: itemOnChange,
|
|
156
156
|
...itemRest
|
|
157
157
|
} = _ref2;
|
|
158
|
-
const cardId = id ||
|
|
158
|
+
const cardId = id || `RadioCard[${index}]`;
|
|
159
159
|
|
|
160
160
|
const handleChange = (newCheckedState, event) => {
|
|
161
161
|
if (typeof itemOnChange === 'function') itemOnChange(newCheckedState, event);
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _systemConstants = require("@telus-uds/system-constants");
|
|
13
|
+
|
|
14
|
+
var _utils = require("../utils");
|
|
15
|
+
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Responsive conditionally renders children based on whether the viewport matches the provided
|
|
22
|
+
* min and max viewports.
|
|
23
|
+
*
|
|
24
|
+
* In SSR, like other viewport utilities, it treats the viewport as `xs` both in SSR itself and
|
|
25
|
+
* during first hydration on the client side; then if the viewport is not `xs`, it re-renders
|
|
26
|
+
* after hydration. This may cause a layout shift on devices other than the narrowest.
|
|
27
|
+
*/
|
|
28
|
+
const Responsive = _ref => {
|
|
29
|
+
let {
|
|
30
|
+
min = 'xs',
|
|
31
|
+
max,
|
|
32
|
+
children
|
|
33
|
+
} = _ref;
|
|
34
|
+
// Start returning children at the 'min' viewport or greater
|
|
35
|
+
const byViewports = {
|
|
36
|
+
[min]: children
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
if (max && max !== 'xl') {
|
|
40
|
+
// Stop returning children at the viewport one above 'max' or greater
|
|
41
|
+
const maxIndex = _systemConstants.viewports.keys.indexOf(max);
|
|
42
|
+
|
|
43
|
+
const maxPlusOne = maxIndex >= 0 ? _systemConstants.viewports.keys[maxIndex + 1] : null;
|
|
44
|
+
if (maxPlusOne) byViewports[maxPlusOne] = null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
48
|
+
children: (0, _utils.useResponsiveProp)(byViewports, null)
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
Responsive.propTypes = {
|
|
53
|
+
min: _propTypes.default.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
|
|
54
|
+
max: _propTypes.default.oneOf(['sm', 'md', 'lg', 'xl']),
|
|
55
|
+
children: _propTypes.default.node.isRequired
|
|
56
|
+
};
|
|
57
|
+
var _default = Responsive;
|
|
58
|
+
exports.default = _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _Responsive = _interopRequireDefault(require("./Responsive"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = _Responsive.default;
|
|
13
|
+
exports.default = _default;
|