@telus-uds/components-base 1.39.0 → 1.41.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 +30 -2
- package/component-docs.json +358 -67
- package/lib/A11yInfoProvider/index.js +0 -8
- package/lib/Button/ButtonBase.js +68 -38
- package/lib/ExpandCollapse/Panel.js +9 -3
- package/lib/Icon/IconText.js +1 -1
- package/lib/InputSupports/InputSupports.js +10 -3
- package/lib/Notification/Notification.js +21 -10
- package/lib/Pagination/Pagination.js +57 -14
- package/lib/Radio/Radio.js +5 -1
- package/lib/Select/Select.js +14 -4
- package/lib/Typography/Typography.js +14 -0
- package/lib-module/A11yInfoProvider/index.js +0 -7
- package/lib-module/Button/ButtonBase.js +68 -38
- package/lib-module/ExpandCollapse/Panel.js +9 -3
- package/lib-module/Icon/IconText.js +1 -1
- package/lib-module/InputSupports/InputSupports.js +10 -3
- package/lib-module/Notification/Notification.js +20 -10
- package/lib-module/Pagination/Pagination.js +56 -14
- package/lib-module/Radio/Radio.js +5 -1
- package/lib-module/Select/Select.js +14 -4
- package/lib-module/Typography/Typography.js +14 -0
- package/package.json +2 -2
- package/src/A11yInfoProvider/index.jsx +0 -10
- package/src/Button/ButtonBase.jsx +44 -26
- package/src/ExpandCollapse/Control.jsx +1 -0
- package/src/ExpandCollapse/Panel.jsx +12 -2
- package/src/Icon/IconText.jsx +1 -1
- package/src/InputSupports/InputSupports.jsx +13 -1
- package/src/Notification/Notification.jsx +15 -10
- package/src/Pagination/Pagination.jsx +63 -13
- package/src/Radio/Radio.jsx +5 -1
- package/src/Select/Select.jsx +10 -1
- package/src/Typography/Typography.jsx +13 -2
|
@@ -39,8 +39,6 @@ const A11yInfoProvider = _ref => {
|
|
|
39
39
|
|
|
40
40
|
const motionSubscription = _AccessibilityInfo.default.addEventListener('reduceMotionChanged', setReduceMotionEnabled);
|
|
41
41
|
|
|
42
|
-
const screenReaderSubscription = _AccessibilityInfo.default.addEventListener('screenReaderChanged', setScreenReaderEnabled);
|
|
43
|
-
|
|
44
42
|
const setInitialA11yInfo = async () => {
|
|
45
43
|
const [initialReduceMotionEnabled, initialScreenReaderEnabled] = await Promise.all([_AccessibilityInfo.default.isReduceMotionEnabled(), _AccessibilityInfo.default.isScreenReaderEnabled()]); // Browsers can't detect screen readers; in RNW isScreenReaderEnabled() is always `true`
|
|
46
44
|
// https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/exports/AccessibilityInfo/index.js#L14
|
|
@@ -61,12 +59,6 @@ const A11yInfoProvider = _ref => {
|
|
|
61
59
|
} else if (typeof _AccessibilityInfo.default.removeEventListener === 'function') {
|
|
62
60
|
_AccessibilityInfo.default.removeEventListener('reduceMotionChanged', setReduceMotionEnabled);
|
|
63
61
|
}
|
|
64
|
-
|
|
65
|
-
if (typeof (screenReaderSubscription === null || screenReaderSubscription === void 0 ? void 0 : screenReaderSubscription.remove) === 'function') {
|
|
66
|
-
screenReaderSubscription === null || screenReaderSubscription === void 0 ? void 0 : screenReaderSubscription.remove();
|
|
67
|
-
} else if (typeof _AccessibilityInfo.default.removeEventListener === 'function') {
|
|
68
|
-
_AccessibilityInfo.default.removeEventListener('screenReaderChanged', setScreenReaderEnabled);
|
|
69
|
-
}
|
|
70
62
|
};
|
|
71
63
|
}, []);
|
|
72
64
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ReducedMotionContext.Provider, {
|
package/lib/Button/ButtonBase.js
CHANGED
|
@@ -66,11 +66,12 @@ const selectOuterContainerStyles = _ref2 => {
|
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
const
|
|
69
|
+
const selectOuterSizeStyles = _ref3 => {
|
|
70
70
|
let {
|
|
71
71
|
outerBorderGap,
|
|
72
72
|
outerBorderWidth,
|
|
73
|
-
width
|
|
73
|
+
width,
|
|
74
|
+
height
|
|
74
75
|
} = _ref3;
|
|
75
76
|
// The inner container's bounding box is the bounding box of the button overall
|
|
76
77
|
// so this many device pixels will sit outside of the overall bounding box
|
|
@@ -78,10 +79,16 @@ const selectOuterWidthStyles = _ref3 => {
|
|
|
78
79
|
outerBorderGap,
|
|
79
80
|
outerBorderWidth
|
|
80
81
|
});
|
|
81
|
-
const
|
|
82
|
+
const sizeStyles = {}; // Apply width/height tokens: number === pixels, string === explicit units e.g. %
|
|
83
|
+
|
|
84
|
+
if (typeof width === 'number' || typeof height === 'number') {
|
|
85
|
+
sizeStyles.width = width ? width + outerBorderOffset * 2 : width;
|
|
86
|
+
sizeStyles.height = height ? height + outerBorderOffset * 2 : height;
|
|
87
|
+
return sizeStyles;
|
|
88
|
+
}
|
|
82
89
|
|
|
83
90
|
if (!width) {
|
|
84
|
-
return { ...
|
|
91
|
+
return { ...sizeStyles,
|
|
85
92
|
// Wrap content, stopping a flex parent's default align-items: stretch stretching focus ring beyond content
|
|
86
93
|
..._Platform.default.select({
|
|
87
94
|
// width: fit-content isn't supported on Firefox; can't cascade props like CSS `width: fit-content; width: --moz-fit-content;`
|
|
@@ -90,30 +97,26 @@ const selectOuterWidthStyles = _ref3 => {
|
|
|
90
97
|
}
|
|
91
98
|
})
|
|
92
99
|
};
|
|
93
|
-
} // Apply width tokens: number === pixels, string === explicit units e.g. %
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if (typeof width === 'number') {
|
|
97
|
-
widthStyles.width = width + outerBorderOffset * 2;
|
|
98
|
-
return widthStyles;
|
|
99
100
|
} // Ensure the negative margin doesn't make element off-centre
|
|
100
101
|
|
|
101
102
|
|
|
102
103
|
if (_Platform.default.OS === 'web') {
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
sizeStyles.width = `calc(${width} + ${outerBorderOffset * 2}px)`;
|
|
105
|
+
sizeStyles.height = `calc(${height} + ${outerBorderOffset * 2}px)`;
|
|
106
|
+
return sizeStyles;
|
|
105
107
|
} // Can't use calc() on native but (unlike on web) flexGrow fills the container width here
|
|
106
108
|
|
|
107
109
|
|
|
108
110
|
if (width === '100%') {
|
|
109
|
-
|
|
110
|
-
return
|
|
111
|
+
sizeStyles.flexGrow = 1;
|
|
112
|
+
return sizeStyles;
|
|
111
113
|
} // Slight offset not such a concern if % width < 100%, as the button isn't centered anyway.
|
|
112
114
|
// If centering support is added (e.g. alignSelf: center), set marginHorizontal 0 when centered.
|
|
113
115
|
|
|
114
116
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
+
sizeStyles.width = width;
|
|
118
|
+
sizeStyles.height = height;
|
|
119
|
+
return sizeStyles;
|
|
117
120
|
};
|
|
118
121
|
|
|
119
122
|
const selectInnerContainerStyles = _ref4 => {
|
|
@@ -125,38 +128,68 @@ const selectInnerContainerStyles = _ref4 => {
|
|
|
125
128
|
paddingBottom,
|
|
126
129
|
shadow,
|
|
127
130
|
borderWidth,
|
|
131
|
+
borderLeftWidth,
|
|
132
|
+
borderRightWidth,
|
|
133
|
+
borderTopWidth,
|
|
134
|
+
borderBottomWidth,
|
|
128
135
|
minWidth
|
|
129
136
|
} = _ref4;
|
|
130
137
|
|
|
131
138
|
// Subtract border width from padding so overall button width/height doesn't
|
|
132
139
|
// jump around if the border width changes (avoiding NaN and negative padding)
|
|
133
|
-
const offsetBorder =
|
|
140
|
+
const offsetBorder = _ref5 => {
|
|
141
|
+
let {
|
|
142
|
+
value,
|
|
143
|
+
borderSize = borderWidth
|
|
144
|
+
} = _ref5;
|
|
145
|
+
return typeof value === 'number' && typeof borderSize === 'number' ? Math.max(0, value - borderSize) : value;
|
|
146
|
+
};
|
|
134
147
|
|
|
135
148
|
return {
|
|
136
|
-
paddingLeft: offsetBorder(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
149
|
+
paddingLeft: offsetBorder({
|
|
150
|
+
value: paddingLeft,
|
|
151
|
+
borderSize: borderLeftWidth
|
|
152
|
+
}),
|
|
153
|
+
paddingRight: offsetBorder({
|
|
154
|
+
value: paddingRight,
|
|
155
|
+
borderSize: borderRightWidth
|
|
156
|
+
}),
|
|
157
|
+
paddingTop: offsetBorder({
|
|
158
|
+
value: paddingTop,
|
|
159
|
+
borderSize: borderTopWidth
|
|
160
|
+
}),
|
|
161
|
+
paddingBottom: offsetBorder({
|
|
162
|
+
value: paddingBottom,
|
|
163
|
+
borderSize: borderBottomWidth
|
|
164
|
+
}),
|
|
140
165
|
backgroundColor,
|
|
141
166
|
minWidth,
|
|
142
167
|
...(0, _ThemeProvider.applyShadowToken)(shadow)
|
|
143
168
|
};
|
|
144
169
|
};
|
|
145
170
|
|
|
146
|
-
const selectBorderStyles =
|
|
171
|
+
const selectBorderStyles = _ref6 => {
|
|
147
172
|
let {
|
|
148
173
|
borderColor,
|
|
149
174
|
borderWidth,
|
|
150
|
-
borderRadius
|
|
151
|
-
|
|
175
|
+
borderRadius,
|
|
176
|
+
borderLeftWidth,
|
|
177
|
+
borderRightWidth,
|
|
178
|
+
borderTopWidth,
|
|
179
|
+
borderBottomWidth
|
|
180
|
+
} = _ref6;
|
|
152
181
|
return {
|
|
153
182
|
borderColor,
|
|
154
183
|
borderWidth,
|
|
155
|
-
borderRadius
|
|
184
|
+
borderRadius,
|
|
185
|
+
borderLeftWidth,
|
|
186
|
+
borderRightWidth,
|
|
187
|
+
borderTopWidth,
|
|
188
|
+
borderBottomWidth
|
|
156
189
|
};
|
|
157
190
|
};
|
|
158
191
|
|
|
159
|
-
const selectTextStyles = (
|
|
192
|
+
const selectTextStyles = (_ref7, themeOptions) => {
|
|
160
193
|
let {
|
|
161
194
|
fontSize,
|
|
162
195
|
color,
|
|
@@ -166,7 +199,7 @@ const selectTextStyles = (_ref6, themeOptions) => {
|
|
|
166
199
|
textAlign,
|
|
167
200
|
textLine,
|
|
168
201
|
textLineStyle
|
|
169
|
-
} =
|
|
202
|
+
} = _ref7;
|
|
170
203
|
return (0, _ThemeProvider.applyTextStyles)({
|
|
171
204
|
fontSize,
|
|
172
205
|
color,
|
|
@@ -180,10 +213,10 @@ const selectTextStyles = (_ref6, themeOptions) => {
|
|
|
180
213
|
});
|
|
181
214
|
};
|
|
182
215
|
|
|
183
|
-
const selectWebOnlyStyles = (inactive, themeTokens,
|
|
216
|
+
const selectWebOnlyStyles = (inactive, themeTokens, _ref8) => {
|
|
184
217
|
let {
|
|
185
218
|
accessibilityRole
|
|
186
|
-
} =
|
|
219
|
+
} = _ref8;
|
|
187
220
|
return _Platform.default.select({
|
|
188
221
|
web: {
|
|
189
222
|
// if it would overflow the container, wraps instead
|
|
@@ -196,19 +229,19 @@ const selectWebOnlyStyles = (inactive, themeTokens, _ref7) => {
|
|
|
196
229
|
});
|
|
197
230
|
};
|
|
198
231
|
|
|
199
|
-
const selectItemIconTokens =
|
|
232
|
+
const selectItemIconTokens = _ref9 => {
|
|
200
233
|
let {
|
|
201
234
|
color,
|
|
202
235
|
iconColor,
|
|
203
236
|
iconSize
|
|
204
|
-
} =
|
|
237
|
+
} = _ref9;
|
|
205
238
|
return {
|
|
206
239
|
size: iconSize,
|
|
207
240
|
color: iconColor || color
|
|
208
241
|
};
|
|
209
242
|
};
|
|
210
243
|
|
|
211
|
-
const ButtonBase = /*#__PURE__*/(0, _react.forwardRef)((
|
|
244
|
+
const ButtonBase = /*#__PURE__*/(0, _react.forwardRef)((_ref10, ref) => {
|
|
212
245
|
let {
|
|
213
246
|
id,
|
|
214
247
|
href,
|
|
@@ -223,7 +256,7 @@ const ButtonBase = /*#__PURE__*/(0, _react.forwardRef)((_ref9, ref) => {
|
|
|
223
256
|
iconPosition = icon ? 'left' : undefined,
|
|
224
257
|
iconProps,
|
|
225
258
|
...rawRest
|
|
226
|
-
} =
|
|
259
|
+
} = _ref10;
|
|
227
260
|
|
|
228
261
|
const {
|
|
229
262
|
onPress,
|
|
@@ -242,7 +275,7 @@ const ButtonBase = /*#__PURE__*/(0, _react.forwardRef)((_ref9, ref) => {
|
|
|
242
275
|
|
|
243
276
|
const getPressableStyle = pressableState => {
|
|
244
277
|
const themeTokens = resolveButtonTokens(pressableState);
|
|
245
|
-
return [staticStyles.row, selectWebOnlyStyles(inactive, themeTokens, systemProps), selectOuterContainerStyles(themeTokens),
|
|
278
|
+
return [staticStyles.row, selectWebOnlyStyles(inactive, themeTokens, systemProps), selectOuterContainerStyles(themeTokens), selectOuterSizeStyles(themeTokens)];
|
|
246
279
|
};
|
|
247
280
|
|
|
248
281
|
const {
|
|
@@ -314,10 +347,7 @@ const staticStyles = _StyleSheet.default.create({
|
|
|
314
347
|
// Apply all button alignment horizontally; no vertical stacking within a button
|
|
315
348
|
flexDirection: 'row'
|
|
316
349
|
},
|
|
317
|
-
text: {
|
|
318
|
-
flexGrow: 1,
|
|
319
|
-
// On native but not web, flexShrink here wraps text prematurely
|
|
320
|
-
..._Platform.default.select({
|
|
350
|
+
text: { ..._Platform.default.select({
|
|
321
351
|
// TODO: https://github.com/telus/universal-design-system/issues/487
|
|
322
352
|
web: {
|
|
323
353
|
transition: 'color 200ms'
|
|
@@ -33,8 +33,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
33
33
|
|
|
34
34
|
const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]); // just void functions for now, since there are no style tokens for a panel or control at this point
|
|
35
35
|
|
|
36
|
-
const selectGroupStyles = () => {};
|
|
37
|
-
|
|
38
36
|
const selectContainerStyles = _ref => {
|
|
39
37
|
let {
|
|
40
38
|
contentPaddingLeft,
|
|
@@ -111,13 +109,21 @@ const ExpandCollapsePanel = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) =>
|
|
|
111
109
|
const focusabilityProps = isExpanded ? {} : _utils.a11yProps.nonFocusableProps;
|
|
112
110
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
113
111
|
ref: ref,
|
|
114
|
-
style:
|
|
112
|
+
style: themeTokens,
|
|
115
113
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Control.default, { ...selectedProps,
|
|
116
114
|
isExpanded: isExpanded,
|
|
117
115
|
tokens: controlTokens,
|
|
116
|
+
variant: variant,
|
|
118
117
|
onPress: handleControlPress,
|
|
119
118
|
ref: controlRef,
|
|
120
119
|
children: control
|
|
120
|
+
}), isExpanded && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
121
|
+
style: {
|
|
122
|
+
borderTopColor: themeTokens.expandDividerColor,
|
|
123
|
+
borderTopWidth: themeTokens.expanddDividerWidth,
|
|
124
|
+
marginLeft: themeTokens.contentPaddingLeft,
|
|
125
|
+
marginRight: themeTokens.contentPaddingRight
|
|
126
|
+
}
|
|
121
127
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Animated.default.View, {
|
|
122
128
|
ref: animatedRef,
|
|
123
129
|
style: animatedStyles,
|
package/lib/Icon/IconText.js
CHANGED
|
@@ -53,7 +53,7 @@ const IconText = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
53
53
|
}); // Inline images on Android are always baseline-aligned which makes them look misaligned - offset it.
|
|
54
54
|
// See abandoned issue https://github.com/facebook/react-native/issues/6529
|
|
55
55
|
|
|
56
|
-
const size = iconProps === null || iconProps === void 0 ? void 0 : (_iconProps$tokens = iconProps.tokens) === null || _iconProps$tokens === void 0 ? void 0 : _iconProps$tokens.size;
|
|
56
|
+
const size = (iconProps === null || iconProps === void 0 ? void 0 : (_iconProps$tokens = iconProps.tokens) === null || _iconProps$tokens === void 0 ? void 0 : _iconProps$tokens.size) ?? 0;
|
|
57
57
|
const iconAdjustedAndriod = /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
58
58
|
style: {
|
|
59
59
|
transform: [{
|
|
@@ -35,6 +35,7 @@ const InputSupports = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
35
35
|
hint,
|
|
36
36
|
hintPosition = 'inline',
|
|
37
37
|
feedback,
|
|
38
|
+
feedbackTokens = {},
|
|
38
39
|
tooltip,
|
|
39
40
|
validation,
|
|
40
41
|
nativeID
|
|
@@ -68,11 +69,12 @@ const InputSupports = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
68
69
|
}), typeof children === 'function' ? children({
|
|
69
70
|
inputId,
|
|
70
71
|
...a11yProps
|
|
71
|
-
}) : children, feedback
|
|
72
|
+
}) : children, feedback ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Feedback.default, {
|
|
72
73
|
id: feedbackId,
|
|
73
74
|
title: feedback,
|
|
74
|
-
validation: validation
|
|
75
|
-
|
|
75
|
+
validation: validation,
|
|
76
|
+
tokens: feedbackTokens
|
|
77
|
+
}) : null]
|
|
76
78
|
});
|
|
77
79
|
});
|
|
78
80
|
InputSupports.displayName = 'InputSupports';
|
|
@@ -105,6 +107,11 @@ InputSupports.propTypes = {
|
|
|
105
107
|
*/
|
|
106
108
|
feedback: _propTypes.default.string,
|
|
107
109
|
|
|
110
|
+
/**
|
|
111
|
+
* Additional tokens to override the default feedback tokens.
|
|
112
|
+
*/
|
|
113
|
+
feedbackTokens: _propTypes.default.objectOf(_propTypes.default.string),
|
|
114
|
+
|
|
108
115
|
/**
|
|
109
116
|
* Content of an optional `Tooltip`. If set, a tooltip button will be shown next to the label.
|
|
110
117
|
*/
|
|
@@ -17,12 +17,14 @@ var _ThemeProvider = require("../ThemeProvider");
|
|
|
17
17
|
|
|
18
18
|
var _utils = require("../utils");
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _IconButton = _interopRequireDefault(require("../IconButton"));
|
|
21
21
|
|
|
22
22
|
var _useCopy = _interopRequireDefault(require("../utils/useCopy"));
|
|
23
23
|
|
|
24
24
|
var _dictionary = _interopRequireDefault(require("./dictionary"));
|
|
25
25
|
|
|
26
|
+
var _ViewportProvider = require("../ViewportProvider");
|
|
27
|
+
|
|
26
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
29
|
|
|
28
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -56,7 +58,8 @@ const selectIconContainerStyles = _ref2 => {
|
|
|
56
58
|
iconGap
|
|
57
59
|
} = _ref2;
|
|
58
60
|
return {
|
|
59
|
-
paddingRight: iconGap
|
|
61
|
+
paddingRight: iconGap,
|
|
62
|
+
placeContent: 'center'
|
|
60
63
|
};
|
|
61
64
|
};
|
|
62
65
|
|
|
@@ -76,7 +79,8 @@ const selectDismissButtonContainerStyles = _ref4 => {
|
|
|
76
79
|
dismissButtonGap
|
|
77
80
|
} = _ref4;
|
|
78
81
|
return {
|
|
79
|
-
paddingLeft: dismissButtonGap
|
|
82
|
+
paddingLeft: dismissButtonGap,
|
|
83
|
+
placeContent: 'center'
|
|
80
84
|
};
|
|
81
85
|
};
|
|
82
86
|
|
|
@@ -147,8 +151,10 @@ const Notification = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
147
151
|
...rest
|
|
148
152
|
} = _ref5;
|
|
149
153
|
const [isDismissed, setIsDismissed] = (0, _react.useState)(false);
|
|
154
|
+
const viewport = (0, _ViewportProvider.useViewport)();
|
|
150
155
|
const themeTokens = (0, _ThemeProvider.useThemeTokens)('Notification', tokens, variant, {
|
|
151
|
-
system
|
|
156
|
+
system,
|
|
157
|
+
viewport
|
|
152
158
|
});
|
|
153
159
|
const getCopy = (0, _useCopy.default)({
|
|
154
160
|
dictionary: _dictionary.default,
|
|
@@ -172,11 +178,11 @@ const Notification = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
172
178
|
});
|
|
173
179
|
const {
|
|
174
180
|
icon: IconComponent,
|
|
175
|
-
dismissIcon: DismissIconComponent
|
|
181
|
+
dismissIcon: DismissIconComponent,
|
|
182
|
+
dismissIconColor
|
|
176
183
|
} = themeTokens;
|
|
177
184
|
|
|
178
|
-
const onDismissPress = () => setIsDismissed(true);
|
|
179
|
-
|
|
185
|
+
const onDismissPress = () => setIsDismissed(true);
|
|
180
186
|
|
|
181
187
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
182
188
|
ref: ref,
|
|
@@ -196,10 +202,16 @@ const Notification = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
|
|
|
196
202
|
}) : content]
|
|
197
203
|
}), dismissible && DismissIconComponent && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
198
204
|
style: selectDismissButtonContainerStyles(themeTokens),
|
|
199
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
205
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
206
|
+
action: "close",
|
|
200
207
|
onPress: onDismissPress,
|
|
208
|
+
icon: DismissIconComponent,
|
|
201
209
|
accessibilityRole: "button",
|
|
202
210
|
accessibilityLabel: getCopy('dismiss'),
|
|
211
|
+
variant: {
|
|
212
|
+
inverse: dismissIconColor === '#ffffff',
|
|
213
|
+
size: 'small'
|
|
214
|
+
},
|
|
203
215
|
children: () => /*#__PURE__*/(0, _jsxRuntime.jsx)(DismissIconComponent, { ...selectDismissIconProps(themeTokens)
|
|
204
216
|
})
|
|
205
217
|
})
|
|
@@ -239,8 +251,7 @@ exports.default = _default;
|
|
|
239
251
|
|
|
240
252
|
const staticStyles = _StyleSheet.default.create({
|
|
241
253
|
container: {
|
|
242
|
-
flexDirection: 'row'
|
|
243
|
-
justifyContent: 'center'
|
|
254
|
+
flexDirection: 'row'
|
|
244
255
|
},
|
|
245
256
|
contentContainer: {
|
|
246
257
|
flexDirection: 'row',
|
|
@@ -78,6 +78,20 @@ const Pagination = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
78
78
|
const {
|
|
79
79
|
themeOptions
|
|
80
80
|
} = (0, _ThemeProvider.useTheme)();
|
|
81
|
+
const {
|
|
82
|
+
borderColor,
|
|
83
|
+
borderWidth,
|
|
84
|
+
borderLeftWidth,
|
|
85
|
+
borderRightWidth,
|
|
86
|
+
borderTopWidth,
|
|
87
|
+
borderBottomWidth,
|
|
88
|
+
ellipsisPadding,
|
|
89
|
+
ellipsisBorderRightWidth,
|
|
90
|
+
ellipsisBorderLeftWidth,
|
|
91
|
+
ellipsisBorderTopWidth,
|
|
92
|
+
ellipsisBorderBottomWidth,
|
|
93
|
+
ellipsisHeight
|
|
94
|
+
} = themeTokens;
|
|
81
95
|
|
|
82
96
|
const items = _react.default.Children.toArray(children);
|
|
83
97
|
|
|
@@ -96,6 +110,18 @@ const Pagination = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
96
110
|
});
|
|
97
111
|
const ellipsisTextStyles = selectTextStyles(themeTokens, themeOptions);
|
|
98
112
|
|
|
113
|
+
const ellipisContainerStyles = _StyleSheet.default.create({
|
|
114
|
+
container: {
|
|
115
|
+
height: ellipsisHeight,
|
|
116
|
+
padding: ellipsisPadding,
|
|
117
|
+
borderRightWidth: ellipsisBorderRightWidth,
|
|
118
|
+
borderLeftWidth: ellipsisBorderLeftWidth,
|
|
119
|
+
borderTopWidth: ellipsisBorderTopWidth,
|
|
120
|
+
borderBottomWidth: ellipsisBorderBottomWidth,
|
|
121
|
+
borderColor
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
|
|
99
125
|
if (items.length === 0) {
|
|
100
126
|
return null;
|
|
101
127
|
} // TODO: replace with a spacing component when https://github.com/telus/universal-design-system/pull/531 is implemented
|
|
@@ -129,9 +155,14 @@ const Pagination = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
129
155
|
}
|
|
130
156
|
|
|
131
157
|
if (shouldRenderEllipsis(itemIndex)) {
|
|
132
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
133
|
-
style:
|
|
134
|
-
|
|
158
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
159
|
+
style: { ...ellipisContainerStyles.container
|
|
160
|
+
},
|
|
161
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
162
|
+
style: { ...ellipsisTextStyles
|
|
163
|
+
},
|
|
164
|
+
children: "..."
|
|
165
|
+
})
|
|
135
166
|
}, "...");
|
|
136
167
|
}
|
|
137
168
|
|
|
@@ -145,19 +176,31 @@ const Pagination = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
145
176
|
linkRouterProps: linkRouterProps
|
|
146
177
|
})];
|
|
147
178
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
148
|
-
style: staticStyles.container
|
|
179
|
+
style: { ...staticStyles.container
|
|
180
|
+
},
|
|
149
181
|
ref: ref,
|
|
150
182
|
...selectProps(rest),
|
|
151
|
-
children:
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
},
|
|
183
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
184
|
+
style: {
|
|
185
|
+
borderColor,
|
|
186
|
+
borderWidth,
|
|
187
|
+
borderLeftWidth,
|
|
188
|
+
borderRightWidth,
|
|
189
|
+
borderTopWidth,
|
|
190
|
+
borderBottomWidth,
|
|
191
|
+
...staticStyles.container
|
|
192
|
+
},
|
|
193
|
+
children: buttons // keep the keys in-line with the page numbers regardless of which buttons are actually rendered
|
|
194
|
+
.map((element, index) => [element, `page-${index + 1}`]).filter(_ref3 => {
|
|
195
|
+
let [element] = _ref3;
|
|
196
|
+
return element !== null;
|
|
197
|
+
}).map(_ref4 => {
|
|
198
|
+
let [element, key] = _ref4;
|
|
199
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
200
|
+
right: gap,
|
|
201
|
+
children: element
|
|
202
|
+
}, key);
|
|
203
|
+
})
|
|
161
204
|
})
|
|
162
205
|
});
|
|
163
206
|
});
|
package/lib/Radio/Radio.js
CHANGED
|
@@ -66,6 +66,8 @@ const selectDescriptionStyles = _ref2 => {
|
|
|
66
66
|
descriptionFontSize,
|
|
67
67
|
descriptionLineHeight,
|
|
68
68
|
descriptionMarginLeft,
|
|
69
|
+
descriptionFontName,
|
|
70
|
+
descriptionFontWeight,
|
|
69
71
|
inputSize,
|
|
70
72
|
fontColor,
|
|
71
73
|
labelMarginLeft = 0
|
|
@@ -75,7 +77,9 @@ const selectDescriptionStyles = _ref2 => {
|
|
|
75
77
|
color: fontColor,
|
|
76
78
|
...(0, _ThemeProvider.applyTextStyles)({
|
|
77
79
|
fontSize: descriptionFontSize,
|
|
78
|
-
lineHeight: descriptionLineHeight
|
|
80
|
+
lineHeight: descriptionLineHeight,
|
|
81
|
+
fontName: descriptionFontName,
|
|
82
|
+
fontWeight: descriptionFontWeight
|
|
79
83
|
})
|
|
80
84
|
};
|
|
81
85
|
};
|
package/lib/Select/Select.js
CHANGED
|
@@ -175,6 +175,15 @@ const selectValidationIconContainerStyles = _ref6 => {
|
|
|
175
175
|
})
|
|
176
176
|
};
|
|
177
177
|
};
|
|
178
|
+
|
|
179
|
+
const selectCustomFeedbackStyles = _ref7 => {
|
|
180
|
+
let {
|
|
181
|
+
feedbackBackgroundColor
|
|
182
|
+
} = _ref7;
|
|
183
|
+
return {
|
|
184
|
+
backgroundColor: feedbackBackgroundColor
|
|
185
|
+
};
|
|
186
|
+
};
|
|
178
187
|
/**
|
|
179
188
|
* A basic form single-choice select component. Use in forms or individually to receive user's input.
|
|
180
189
|
*
|
|
@@ -209,7 +218,7 @@ const selectValidationIconContainerStyles = _ref6 => {
|
|
|
209
218
|
*/
|
|
210
219
|
|
|
211
220
|
|
|
212
|
-
const Select = /*#__PURE__*/(0, _react.forwardRef)((
|
|
221
|
+
const Select = /*#__PURE__*/(0, _react.forwardRef)((_ref8, ref) => {
|
|
213
222
|
let {
|
|
214
223
|
value,
|
|
215
224
|
initialValue,
|
|
@@ -223,7 +232,7 @@ const Select = /*#__PURE__*/(0, _react.forwardRef)((_ref7, ref) => {
|
|
|
223
232
|
variant,
|
|
224
233
|
testID,
|
|
225
234
|
...rest
|
|
226
|
-
} =
|
|
235
|
+
} = _ref8;
|
|
227
236
|
const {
|
|
228
237
|
currentValue,
|
|
229
238
|
setValue
|
|
@@ -265,11 +274,12 @@ const Select = /*#__PURE__*/(0, _react.forwardRef)((_ref7, ref) => {
|
|
|
265
274
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputSupports.default, { ...supportsProps,
|
|
266
275
|
...selectedProps,
|
|
267
276
|
validation: validation,
|
|
268
|
-
|
|
277
|
+
feedbackTokens: selectCustomFeedbackStyles(themeTokens),
|
|
278
|
+
children: _ref9 => {
|
|
269
279
|
let {
|
|
270
280
|
inputId,
|
|
271
281
|
...props
|
|
272
|
-
} =
|
|
282
|
+
} = _ref9;
|
|
273
283
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
|
|
274
284
|
style: selectOuterBorderStyles(themeTokens),
|
|
275
285
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Picker.default, {
|
|
@@ -71,6 +71,7 @@ const Typography = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
71
71
|
align = undefined,
|
|
72
72
|
tokens,
|
|
73
73
|
dataSet,
|
|
74
|
+
strikeThrough = false,
|
|
74
75
|
...rest
|
|
75
76
|
} = _ref2;
|
|
76
77
|
const viewport = (0, _ViewportProvider.useViewport)();
|
|
@@ -117,16 +118,24 @@ const Typography = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
|
|
|
117
118
|
return resetTagStyling(children);
|
|
118
119
|
};
|
|
119
120
|
|
|
121
|
+
const textDecorationLine = strikeThrough ? 'line-through' : 'none';
|
|
122
|
+
const textStyles = resolvedTextProps.style ? { ...resolvedTextProps.style,
|
|
123
|
+
textDecorationLine
|
|
124
|
+
} : {
|
|
125
|
+
textDecorationLine
|
|
126
|
+
};
|
|
120
127
|
return block ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
|
|
121
128
|
ref: ref,
|
|
122
129
|
...containerProps,
|
|
123
130
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, { ...resolvedTextProps,
|
|
131
|
+
style: textStyles,
|
|
124
132
|
children: sanitizeChildren(children)
|
|
125
133
|
})
|
|
126
134
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
|
|
127
135
|
ref: ref,
|
|
128
136
|
...containerProps,
|
|
129
137
|
...resolvedTextProps,
|
|
138
|
+
style: textStyles,
|
|
130
139
|
children: sanitizeChildren(children)
|
|
131
140
|
});
|
|
132
141
|
});
|
|
@@ -136,6 +145,11 @@ Typography.propTypes = { ...selectedContainerPropTypes,
|
|
|
136
145
|
tokens: (0, _utils2.getTokensPropType)('Typography'),
|
|
137
146
|
variant: _utils2.variantProp.propType,
|
|
138
147
|
|
|
148
|
+
/**
|
|
149
|
+
* Renders the text with "text-decoration: 'line-through'" applied.
|
|
150
|
+
*/
|
|
151
|
+
strikeThrough: _propTypes.default.bool,
|
|
152
|
+
|
|
139
153
|
/**
|
|
140
154
|
* Renders the text as a semantic heading. If a html heading tag is provided, uses that tag on Web.
|
|
141
155
|
*
|
|
@@ -20,7 +20,6 @@ const A11yInfoProvider = _ref => {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
const motionSubscription = AccessibilityInfo.addEventListener('reduceMotionChanged', setReduceMotionEnabled);
|
|
23
|
-
const screenReaderSubscription = AccessibilityInfo.addEventListener('screenReaderChanged', setScreenReaderEnabled);
|
|
24
23
|
|
|
25
24
|
const setInitialA11yInfo = async () => {
|
|
26
25
|
const [initialReduceMotionEnabled, initialScreenReaderEnabled] = await Promise.all([AccessibilityInfo.isReduceMotionEnabled(), AccessibilityInfo.isScreenReaderEnabled()]); // Browsers can't detect screen readers; in RNW isScreenReaderEnabled() is always `true`
|
|
@@ -42,12 +41,6 @@ const A11yInfoProvider = _ref => {
|
|
|
42
41
|
} else if (typeof AccessibilityInfo.removeEventListener === 'function') {
|
|
43
42
|
AccessibilityInfo.removeEventListener('reduceMotionChanged', setReduceMotionEnabled);
|
|
44
43
|
}
|
|
45
|
-
|
|
46
|
-
if (typeof (screenReaderSubscription === null || screenReaderSubscription === void 0 ? void 0 : screenReaderSubscription.remove) === 'function') {
|
|
47
|
-
screenReaderSubscription === null || screenReaderSubscription === void 0 ? void 0 : screenReaderSubscription.remove();
|
|
48
|
-
} else if (typeof AccessibilityInfo.removeEventListener === 'function') {
|
|
49
|
-
AccessibilityInfo.removeEventListener('screenReaderChanged', setScreenReaderEnabled);
|
|
50
|
-
}
|
|
51
44
|
};
|
|
52
45
|
}, []);
|
|
53
46
|
return /*#__PURE__*/_jsx(ReducedMotionContext.Provider, {
|