@telus-uds/components-base 1.72.0 → 1.74.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.
Files changed (71) hide show
  1. package/CHANGELOG.md +35 -2
  2. package/lib/Box/Box.js +17 -6
  3. package/lib/ExpandCollapse/Panel.js +1 -1
  4. package/lib/FlexGrid/Col/Col.js +42 -19
  5. package/lib/FlexGrid/FlexGrid.js +40 -17
  6. package/lib/FlexGrid/Row/Row.js +45 -22
  7. package/lib/Footnote/Footnote.js +328 -0
  8. package/lib/Footnote/FootnoteLink.js +108 -0
  9. package/lib/Footnote/dictionary.js +19 -0
  10. package/lib/Footnote/index.js +12 -0
  11. package/lib/Listbox/ListboxGroup.js +7 -1
  12. package/lib/MultiSelectFilter/MultiSelectFilter.js +1 -0
  13. package/lib/Notification/Notification.js +13 -5
  14. package/lib/OrderedList/ItemBase.js +7 -1
  15. package/lib/Responsive/Responsive.js +32 -14
  16. package/lib/Responsive/ResponsiveProp.js +46 -0
  17. package/lib/Responsive/ResponsiveWithMediaQueryStyleSheet.js +75 -0
  18. package/lib/ThemeProvider/ThemeProvider.js +5 -2
  19. package/lib/ThemeProvider/index.js +9 -1
  20. package/lib/ThemeProvider/useResponsiveThemeTokens.js +89 -0
  21. package/lib/Typography/Typography.js +50 -22
  22. package/lib/index.js +8 -0
  23. package/lib/server.js +40 -0
  24. package/lib/utils/ssr-media-query/utils/create-media-query-styles.js +39 -6
  25. package/lib-module/Box/Box.js +17 -6
  26. package/lib-module/ExpandCollapse/Panel.js +1 -1
  27. package/lib-module/FlexGrid/Col/Col.js +42 -19
  28. package/lib-module/FlexGrid/FlexGrid.js +40 -17
  29. package/lib-module/FlexGrid/Row/Row.js +45 -22
  30. package/lib-module/Footnote/Footnote.js +319 -0
  31. package/lib-module/Footnote/FootnoteLink.js +101 -0
  32. package/lib-module/Footnote/dictionary.js +12 -0
  33. package/lib-module/Footnote/index.js +4 -0
  34. package/lib-module/Listbox/ListboxGroup.js +7 -1
  35. package/lib-module/MultiSelectFilter/MultiSelectFilter.js +1 -0
  36. package/lib-module/Notification/Notification.js +13 -5
  37. package/lib-module/OrderedList/ItemBase.js +7 -1
  38. package/lib-module/Responsive/Responsive.js +32 -15
  39. package/lib-module/Responsive/ResponsiveProp.js +39 -0
  40. package/lib-module/Responsive/ResponsiveWithMediaQueryStyleSheet.js +67 -0
  41. package/lib-module/ThemeProvider/ThemeProvider.js +5 -2
  42. package/lib-module/ThemeProvider/index.js +1 -0
  43. package/lib-module/ThemeProvider/useResponsiveThemeTokens.js +81 -0
  44. package/lib-module/Typography/Typography.js +52 -24
  45. package/lib-module/index.js +1 -0
  46. package/lib-module/server.js +4 -0
  47. package/lib-module/utils/ssr-media-query/utils/create-media-query-styles.js +36 -6
  48. package/package.json +13 -2
  49. package/src/Box/Box.jsx +35 -17
  50. package/src/ExpandCollapse/Panel.jsx +1 -1
  51. package/src/FlexGrid/Col/Col.jsx +42 -13
  52. package/src/FlexGrid/FlexGrid.jsx +40 -11
  53. package/src/FlexGrid/Row/Row.jsx +40 -16
  54. package/src/Footnote/Footnote.jsx +316 -0
  55. package/src/Footnote/FootnoteLink.jsx +95 -0
  56. package/src/Footnote/dictionary.js +12 -0
  57. package/src/Footnote/index.js +6 -0
  58. package/src/Listbox/ListboxGroup.jsx +9 -2
  59. package/src/MultiSelectFilter/MultiSelectFilter.jsx +2 -0
  60. package/src/Notification/Notification.jsx +15 -3
  61. package/src/OrderedList/ItemBase.jsx +14 -2
  62. package/src/Responsive/Responsive.jsx +31 -12
  63. package/src/Responsive/ResponsiveProp.jsx +33 -0
  64. package/src/Responsive/ResponsiveWithMediaQueryStyleSheet.jsx +60 -0
  65. package/src/ThemeProvider/ThemeProvider.jsx +5 -2
  66. package/src/ThemeProvider/index.js +1 -0
  67. package/src/ThemeProvider/useResponsiveThemeTokens.js +85 -0
  68. package/src/Typography/Typography.jsx +77 -24
  69. package/src/index.js +1 -0
  70. package/src/server.js +4 -0
  71. package/src/utils/ssr-media-query/utils/create-media-query-styles.js +21 -6
@@ -0,0 +1,328 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
10
+ var _Text = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Text"));
11
+ var _Dimensions = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Dimensions"));
12
+ var _TouchableWithoutFeedback = _interopRequireDefault(require("react-native-web/dist/cjs/exports/TouchableWithoutFeedback"));
13
+ var _Modal = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Modal"));
14
+ var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
15
+ var _SafeAreaView = _interopRequireDefault(require("react-native-web/dist/cjs/exports/SafeAreaView"));
16
+ var _ScrollView = _interopRequireDefault(require("react-native-web/dist/cjs/exports/ScrollView"));
17
+ var _dictionary = _interopRequireDefault(require("./dictionary"));
18
+ var _utils = require("../utils");
19
+ var _ViewportProvider = require("../ViewportProvider");
20
+ var _ThemeProvider = require("../ThemeProvider");
21
+ var _Typography = _interopRequireDefault(require("../Typography"));
22
+ var _Icon = _interopRequireDefault(require("../Icon"));
23
+ var _OrderedList = _interopRequireDefault(require("../OrderedList"));
24
+ var _jsxRuntime = require("react/jsx-runtime");
25
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26
+ 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); }
27
+ 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; }
28
+ const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.htmlAttrs, _utils.viewProps]);
29
+ const selectFootnoteStyle = _ref => {
30
+ let {
31
+ screenHeight,
32
+ footnoteBackground,
33
+ isVisible,
34
+ footnoteBorderTopSizeMd,
35
+ footnoteBorderColorMd
36
+ } = _ref;
37
+ return {
38
+ left: 0,
39
+ backgroundColor: footnoteBackground,
40
+ display: isVisible ? 'flex' : 'none',
41
+ height: screenHeight,
42
+ borderTopColor: footnoteBorderColorMd,
43
+ borderTopWidth: footnoteBorderTopSizeMd
44
+ };
45
+ };
46
+ const selectFootnoteHeaderContentStyle = _ref2 => {
47
+ let {
48
+ footnoteHeaderPaddingTop,
49
+ footnoteHeaderPaddingBottom,
50
+ footnoteHeaderPaddingRight,
51
+ footnoteHeaderPaddingLeft,
52
+ headerMargin
53
+ } = _ref2;
54
+ return {
55
+ paddingTop: footnoteHeaderPaddingTop,
56
+ paddingBottom: footnoteHeaderPaddingBottom,
57
+ paddingRight: footnoteHeaderPaddingRight,
58
+ paddingLeft: footnoteHeaderPaddingLeft,
59
+ marginRight: headerMargin
60
+ };
61
+ };
62
+ const selectFootnoteCloseButtonStyle = _ref3 => {
63
+ let {
64
+ closeButtonBorderSize,
65
+ closeButtonBorderColor,
66
+ closeButtonHeight,
67
+ closeButtonBackgroundColor,
68
+ closeButtonMarginTop,
69
+ closeButtonMarginRight,
70
+ closeButtonMarginBottom,
71
+ closeButtonMarginLeft,
72
+ closeButtonWidth
73
+ } = _ref3;
74
+ return {
75
+ backgroundColor: closeButtonBackgroundColor,
76
+ borderWidth: closeButtonBorderSize,
77
+ borderColor: closeButtonBorderColor,
78
+ height: closeButtonHeight,
79
+ marginTop: closeButtonMarginTop,
80
+ marginRight: closeButtonMarginRight,
81
+ marginBottom: closeButtonMarginBottom,
82
+ marginLeft: closeButtonMarginLeft,
83
+ width: closeButtonWidth
84
+ };
85
+ };
86
+ const selectFootnoteBodyStyle = _ref4 => {
87
+ let {
88
+ maxWidth,
89
+ footnoteBodyBackground,
90
+ footnoteBodyPaddingTop,
91
+ footnoteBodyPaddingRight,
92
+ footnoteBodyPaddingBottom,
93
+ footnoteBodyPaddingLeft,
94
+ screenWidth
95
+ } = _ref4;
96
+ return {
97
+ maxWidth,
98
+ backgroundColor: footnoteBodyBackground,
99
+ paddingTop: footnoteBodyPaddingTop,
100
+ paddingRight: footnoteBodyPaddingRight * 2,
101
+ paddingBottom: footnoteBodyPaddingBottom,
102
+ paddingLeft: footnoteBodyPaddingLeft,
103
+ width: screenWidth
104
+ };
105
+ };
106
+ const selectCustomContentFontStyle = _ref5 => {
107
+ let {
108
+ listItemColor,
109
+ listItemFontSize,
110
+ listItemLineHeight,
111
+ listItemPaddingLeft,
112
+ listItemFontName,
113
+ listItemFontWeight
114
+ } = _ref5;
115
+ return {
116
+ fontSize: listItemFontSize,
117
+ lineHeight: listItemLineHeight * listItemFontSize,
118
+ paddingLeft: listItemPaddingLeft,
119
+ color: listItemColor,
120
+ fontName: listItemFontName,
121
+ fontWeight: listItemFontWeight
122
+ };
123
+ };
124
+
125
+ /**
126
+ * Use `Footnote` to display a single legal content.
127
+ *
128
+ * ## Usage Criteria
129
+ *
130
+ * - Use `Footnote` to display a single legal statement
131
+ * - Display on top of all UI, including other sticky elements such as Cart Summary
132
+ * - Dismiss by clicking on the close button, clicking anywhere outside of the `Footnote`
133
+ * - Use copy to set language, ‘en’ for English or ‘fr’ for French
134
+ *
135
+ * ## Accessibility requirements
136
+ *
137
+ * - Only one instance of `Footnote` should display at a time
138
+ * - Place `Footnote` as the last element in the body or main
139
+ * - When `Footnote` is open, the inert prop must be set on all children of body excluding the Footnote
140
+ * - When `Footnote` is closed, focus must return to the initiating element
141
+ */
142
+ const Footnote = _ref6 => {
143
+ let {
144
+ copy = 'en',
145
+ number = undefined,
146
+ content = undefined,
147
+ onClose,
148
+ isOpen = false,
149
+ tokens,
150
+ variant = {},
151
+ dictionary = _dictionary.default,
152
+ ...rest
153
+ } = _ref6;
154
+ const viewport = (0, _ViewportProvider.useViewport)();
155
+ const themeTokens = (0, _ThemeProvider.useThemeTokens)('Footnote', tokens, variant, {
156
+ viewport
157
+ });
158
+ const themeOptions = (0, _ThemeProvider.useTheme)();
159
+ const getCopy = (0, _utils.useCopy)({
160
+ dictionary,
161
+ copy
162
+ });
163
+ const [isVisible, setIsVisible] = (0, _react.useState)(false);
164
+ const screenHeight = _Dimensions.default.get('screen').height;
165
+ const screenWidth = _Dimensions.default.get('screen').width;
166
+ const getFootnoteBodyContent = (0, _react.useCallback)(() => {
167
+ if (!number || !content) {
168
+ return null;
169
+ }
170
+ if ( /*#__PURE__*/_react.default.isValidElement(content)) {
171
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
172
+ style: selectCustomContentFontStyle(themeTokens),
173
+ children: content
174
+ });
175
+ }
176
+ return (
177
+ /*#__PURE__*/
178
+ // TODO: Extract the OrderedList.Item from the array when the issue #4361 is fixed
179
+ (0, _jsxRuntime.jsx)(_OrderedList.default, {
180
+ start: number,
181
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_OrderedList.default.Item, {
182
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
183
+ style: selectCustomContentFontStyle(themeTokens),
184
+ children: content
185
+ })
186
+ }, number)]
187
+ })
188
+ );
189
+ }, [content, number, themeTokens]);
190
+ (0, _react.useEffect)(() => {
191
+ if (isOpen) {
192
+ setIsVisible(true);
193
+ }
194
+ }, [isOpen]);
195
+ const closeFootnote = (0, _react.useCallback)((event, options) => {
196
+ onClose(event, options);
197
+ setIsVisible(false);
198
+ }, [onClose]);
199
+ const handleClose = event => closeFootnote(event, {
200
+ returnFocus: true
201
+ });
202
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
203
+ ...selectProps(rest),
204
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.default, {
205
+ visible: isVisible,
206
+ animationType: "slide",
207
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SafeAreaView.default, {
208
+ style: staticStyles.container,
209
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScrollView.default, {
210
+ style: selectFootnoteStyle({
211
+ screenHeight,
212
+ isVisible,
213
+ ...themeTokens
214
+ }),
215
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
216
+ style: staticStyles.content,
217
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
218
+ style: [selectFootnoteHeaderContentStyle(themeTokens), staticStyles.headerContent],
219
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
220
+ tokens: {
221
+ fontSize: themeTokens === null || themeTokens === void 0 ? void 0 : themeTokens.headerFontSize,
222
+ lineHeight: themeTokens === null || themeTokens === void 0 ? void 0 : themeTokens.headerLineHeight
223
+ },
224
+ variant: {
225
+ size: 'h4'
226
+ },
227
+ children: getCopy('heading')
228
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TouchableWithoutFeedback.default, {
229
+ onPress: handleClose,
230
+ accessibilityLabel: getCopy('close'),
231
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
232
+ style: [selectFootnoteCloseButtonStyle(themeTokens), staticStyles.closeButton],
233
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
234
+ icon: themeTokens === null || themeTokens === void 0 ? void 0 : themeTokens.closeIcon,
235
+ tokens: {
236
+ size: themeTokens === null || themeTokens === void 0 ? void 0 : themeTokens.closeButtonIconSize
237
+ }
238
+ })
239
+ })
240
+ })]
241
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
242
+ style: selectFootnoteBodyStyle({
243
+ maxWidth: themeOptions.contentMaxWidth,
244
+ screenWidth,
245
+ ...themeTokens
246
+ }),
247
+ children: getFootnoteBodyContent()
248
+ })]
249
+ })
250
+ })
251
+ })
252
+ })
253
+ });
254
+ };
255
+ const copyShape = _propTypes.default.shape({
256
+ close: _propTypes.default.string.isRequired,
257
+ heading: _propTypes.default.string.isRequired
258
+ });
259
+
260
+ // If a language dictionary entry is provided, it must contain every key
261
+ const dictionaryContentShape = _propTypes.default.shape({
262
+ a11yLabel: _propTypes.default.string.isRequired,
263
+ close: _propTypes.default.string.isRequired,
264
+ heading: _propTypes.default.string.isRequired
265
+ });
266
+ Footnote.propTypes = {
267
+ ...selectedSystemPropTypes,
268
+ tokens: (0, _utils.getTokensPropType)('Footnote'),
269
+ /**
270
+ * The content.
271
+ */
272
+ content: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.element]),
273
+ /**
274
+ * Use the `copy` prop to either select provided English or French copy by passing 'en' or 'fr' respectively.
275
+ * To provide your own, pass a JSON object with the keys `heading` and `close`.
276
+ */
277
+ copy: _propTypes.default.oneOfType([_propTypes.default.oneOf(['en', 'fr']), copyShape]),
278
+ /**
279
+ * A boolean flag used hide or show the `Footnote`. Set to `true` to open the `Footnote`.
280
+ */
281
+ isOpen: _propTypes.default.bool,
282
+ /**
283
+ * The number, must match the number of the `FootnoteLink` that initiated the `Footnote`.
284
+ */
285
+ number: _propTypes.default.number,
286
+ /**
287
+ * A callback function to handle the closing of the footnote.
288
+ *
289
+ * @param {SyntheticEvent} event The React `SyntheticEvent`
290
+ * @param {Object} options Custom options
291
+ * @param {boolean} options.returnFocus Should the `Footnote` return focus on close
292
+ */
293
+ onClose: _propTypes.default.func.isRequired,
294
+ /**
295
+ * Override the default dictionary, by passing the complete dictionary object for `en` and `fr`
296
+ */
297
+ dictionary: _propTypes.default.shape({
298
+ en: dictionaryContentShape,
299
+ fr: dictionaryContentShape
300
+ })
301
+ };
302
+ var _default = Footnote;
303
+ exports.default = _default;
304
+ const staticStyles = _StyleSheet.default.create({
305
+ container: {
306
+ flex: 1
307
+ },
308
+ content: {
309
+ marginLeft: 'auto',
310
+ marginRight: 'auto',
311
+ left: 0,
312
+ right: 0,
313
+ maxWidth: 1200,
314
+ paddingBottom: 100
315
+ },
316
+ headerContent: {
317
+ alignItems: 'center',
318
+ display: 'flex',
319
+ flexDirection: 'row',
320
+ justifyContent: 'space-between'
321
+ },
322
+ closeButton: {
323
+ alignItems: 'center',
324
+ borderRadius: 50,
325
+ display: 'flex',
326
+ justifyContent: 'center'
327
+ }
328
+ });
@@ -0,0 +1,108 @@
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 _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
10
+ var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
11
+ var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
12
+ var _TouchableWithoutFeedback = _interopRequireDefault(require("react-native-web/dist/cjs/exports/TouchableWithoutFeedback"));
13
+ var _dictionary = _interopRequireDefault(require("./dictionary"));
14
+ var _utils = require("../utils");
15
+ var _ThemeProvider = require("../ThemeProvider");
16
+ var _jsxRuntime = require("react/jsx-runtime");
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+ const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.htmlAttrs, _utils.viewProps]);
19
+
20
+ // The top property varies between devices due to how devices render the viewport.
21
+ const selectTextStyle = _ref => {
22
+ let {
23
+ fontSize,
24
+ lineHeight
25
+ } = _ref;
26
+ return {
27
+ fontSize,
28
+ lineHeight: lineHeight !== 1 ? lineHeight : fontSize * 2,
29
+ ..._Platform.default.select({
30
+ ios: {
31
+ top: -fontSize / 2
32
+ },
33
+ android: {
34
+ top: fontSize / 4
35
+ },
36
+ web: {
37
+ top: -fontSize / 2.8
38
+ }
39
+ })
40
+ };
41
+ };
42
+ const FootnoteLink = _ref2 => {
43
+ let {
44
+ copy = 'en',
45
+ content = [],
46
+ onClick,
47
+ tokens,
48
+ variant = {},
49
+ ...rest
50
+ } = _ref2;
51
+ const themeTokens = (0, _ThemeProvider.useThemeTokens)('FootnoteLink', tokens, variant);
52
+ const textStyles = (0, _ThemeProvider.applyTextStyles)(themeTokens);
53
+ const numbers = Array.isArray(content) ? content : [content];
54
+ const refs = numbers.map(() => /*#__PURE__*/_react.default.createRef());
55
+ const handleOnClick = index => {
56
+ onClick(numbers[index], refs[index]);
57
+ };
58
+ const getCopy = (0, _utils.useCopy)({
59
+ dictionary: _dictionary.default,
60
+ copy
61
+ });
62
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
63
+ children: numbers.map((num, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
64
+ accessibilityLabel: getCopy('a11yLabel'),
65
+ ref: refs[index],
66
+ ...selectProps(rest),
67
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TouchableWithoutFeedback.default, {
68
+ onPress: handleOnClick,
69
+ accessibilityRole: "button",
70
+ children: (0, _utils.wrapStringsInText)(`${num}${index !== numbers.length - 1 ? ',' : ''}`, {
71
+ style: {
72
+ ...textStyles,
73
+ ...staticStyles.text,
74
+ ...selectTextStyle(themeTokens)
75
+ }
76
+ })
77
+ })
78
+ }, num))
79
+ });
80
+ };
81
+ const copyShape = _propTypes.default.shape({
82
+ a11yLabel: _propTypes.default.string.isRequired
83
+ });
84
+ FootnoteLink.propTypes = {
85
+ ...selectedSystemPropTypes,
86
+ /**
87
+ * Use the `copy` prop to either select provided English or French copy by passing 'en' or 'fr' respectively.
88
+ * To provide your own, pass a JSON object with the key `a11yLabel`.
89
+ */
90
+ copy: _propTypes.default.oneOfType([_propTypes.default.oneOf(['en', 'fr']), copyShape]),
91
+ /**
92
+ * The footnote number, or multiple numbers if passed as an array.
93
+ * If using an array, a comma-separated group of numbers will be rendered as superscript.
94
+ */
95
+ content: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.arrayOf(_propTypes.default.number), _propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]).isRequired,
96
+ /**
97
+ * A callback function to handle the click of a FootnoteLink.
98
+ */
99
+ onClick: _propTypes.default.func.isRequired
100
+ };
101
+ var _default = FootnoteLink;
102
+ exports.default = _default;
103
+ const staticStyles = _StyleSheet.default.create({
104
+ text: {
105
+ position: 'relative',
106
+ textDecorationLine: 'underline'
107
+ }
108
+ });
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _default = {
8
+ en: {
9
+ a11yLabel: 'Read legal footnote',
10
+ close: 'close',
11
+ heading: 'Terms and conditions'
12
+ },
13
+ fr: {
14
+ a11yLabel: 'Lire la note de bas de page légale',
15
+ close: 'fermer',
16
+ heading: 'Modalités et conditions'
17
+ }
18
+ };
19
+ exports.default = _default;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _Footnote = _interopRequireDefault(require("./Footnote"));
8
+ var _FootnoteLink = _interopRequireDefault(require("./FootnoteLink"));
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ _Footnote.default.Link = _FootnoteLink.default;
11
+ var _default = _Footnote.default;
12
+ exports.default = _default;
@@ -8,6 +8,7 @@ var _react = _interopRequireWildcard(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
10
10
  var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
11
+ var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
11
12
  var _utils = require("../utils");
12
13
  var _ExpandCollapse = _interopRequireDefault(require("../ExpandCollapse"));
13
14
  var _ListboxItem = _interopRequireDefault(require("./ListboxItem"));
@@ -30,6 +31,11 @@ const styles = _StyleSheet.default.create({
30
31
  padding: 0
31
32
  }
32
33
  });
34
+ const getAccessibilityRole = () => _Platform.default.select({
35
+ ios: 'listitem',
36
+ android: 'none',
37
+ web: 'listitem'
38
+ });
33
39
  const ListboxGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
34
40
  let {
35
41
  id,
@@ -50,7 +56,7 @@ const ListboxGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
50
56
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
51
57
  id: "test",
52
58
  style: styles.groupWrapper,
53
- accessibilityRole: "listitem",
59
+ accessibilityRole: getAccessibilityRole(),
54
60
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandCollapse.default.Panel, {
55
61
  panelId: id ?? label,
56
62
  controlTokens: {
@@ -105,6 +105,7 @@ const MultiSelectFilter = _ref3 => {
105
105
  if (colSize === 1) return setMaxWidth(false);
106
106
  return colSize === 2 && setMaxWidth(true);
107
107
  }, [colSize]);
108
+ (0, _react.useEffect)(() => setCheckedIds(currentValues ?? []), [currentValues]);
108
109
  const {
109
110
  headerFontColor,
110
111
  headerFontSize,
@@ -22,10 +22,18 @@ const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_u
22
22
  const selectContainerStyles = tokens => ({
23
23
  ...tokens
24
24
  });
25
- const selectTextStyles = (tokens, themeOptions) => (0, _ThemeProvider.applyTextStyles)({
26
- ...(0, _utils.selectTokens)('Typography', tokens),
27
- themeOptions
28
- });
25
+ const selectTextStyles = (tokens, themeOptions, isDismissible) => {
26
+ const textTokens = (0, _utils.selectTokens)('Typography', tokens);
27
+ const styles = {
28
+ ...textTokens,
29
+ themeOptions,
30
+ overflow: 'hidden'
31
+ };
32
+ if (!isDismissible) {
33
+ styles.flexShrink = 1;
34
+ }
35
+ return (0, _ThemeProvider.applyTextStyles)(styles);
36
+ };
29
37
  const selectIconProps = _ref => {
30
38
  let {
31
39
  iconSize,
@@ -146,7 +154,7 @@ const Notification = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
146
154
  if (isDismissed) {
147
155
  return null;
148
156
  }
149
- const textStyles = selectTextStyles(themeTokens, themeOptions);
157
+ const textStyles = selectTextStyles(themeTokens, themeOptions, dismissible);
150
158
  const content = (0, _utils.wrapStringsInText)(typeof children === 'function' ? children({
151
159
  textStyles,
152
160
  variant
@@ -8,12 +8,18 @@ var _react = _interopRequireWildcard(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
10
10
  var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
11
+ var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
11
12
  var _jsxRuntime = require("react/jsx-runtime");
12
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
14
  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); }
14
15
  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; }
15
16
  /* eslint-disable react-native-a11y/has-valid-accessibility-role */
16
17
 
18
+ const getAccessibilityRole = () => _Platform.default.select({
19
+ ios: 'listitem',
20
+ android: 'none',
21
+ web: 'listitem'
22
+ });
17
23
  const Item = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
18
24
  let {
19
25
  children,
@@ -21,7 +27,7 @@ const Item = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
21
27
  ...rest
22
28
  } = _ref;
23
29
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
24
- accessibilityRole: "listitem",
30
+ accessibilityRole: getAccessibilityRole(),
25
31
  ref: ref,
26
32
  style: [staticStyles.container, style],
27
33
  ...rest,
@@ -6,37 +6,49 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
- var _systemConstants = require("@telus-uds/system-constants");
10
- var _utils = require("../utils");
9
+ var _ThemeProvider = require("../ThemeProvider");
10
+ var _ResponsiveProp = _interopRequireDefault(require("./ResponsiveProp"));
11
+ var _ResponsiveWithMediaQueryStyleSheet = _interopRequireDefault(require("./ResponsiveWithMediaQueryStyleSheet"));
11
12
  var _jsxRuntime = require("react/jsx-runtime");
12
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
14
  /**
14
15
  * Responsive conditionally renders children based on whether the viewport matches the provided
15
16
  * min and max viewports.
16
17
  *
17
- * In SSR, like other viewport utilities, it treats the viewport as `xs` both in SSR itself and
18
+ * If enableMediaQueryStyleSheet themeOption is set to false in ThemeProvider, then in SSR,
19
+ * like other viewport utilities, it treats the viewport as `xs` both in SSR itself and
18
20
  * during first hydration on the client side; then if the viewport is not `xs`, it re-renders
19
21
  * after hydration. This may cause a layout shift on devices other than the narrowest.
22
+ *
23
+ * If enableMediaQueryStyleSheet themeOption is set to true in ThemeProvider, then media query stylesheet
24
+ * is used to hide and show children of `Responsive` within a View.
20
25
  */const Responsive = _ref => {
21
26
  let {
22
27
  min = 'xs',
23
28
  max,
29
+ inheritedStyles = [],
24
30
  children
25
31
  } = _ref;
26
- // Start returning children at the 'min' viewport or greater
27
- const byViewports = {
28
- [min]: children
29
- };
30
- if (max && max !== 'xl') {
31
- // Stop returning children at the viewport one above 'max' or greater
32
- const maxIndex = _systemConstants.viewports.keys.indexOf(max);
33
- const maxPlusOne = maxIndex >= 0 ? _systemConstants.viewports.keys[maxIndex + 1] : null;
34
- if (maxPlusOne) byViewports[maxPlusOne] = null;
32
+ const {
33
+ themeOptions: {
34
+ enableMediaQueryStyleSheet
35
+ }
36
+ } = (0, _ThemeProvider.useTheme)();
37
+ if (enableMediaQueryStyleSheet) {
38
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ResponsiveWithMediaQueryStyleSheet.default, {
39
+ inheritedStyles: inheritedStyles,
40
+ min: min,
41
+ max: max,
42
+ children: children
43
+ });
35
44
  }
36
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
37
- children: (0, _utils.useResponsiveProp)(byViewports, null)
45
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ResponsiveProp.default, {
46
+ min: min,
47
+ max: max,
48
+ children: children
38
49
  });
39
50
  };
51
+ Responsive.displayName = 'Responsive';
40
52
  Responsive.propTypes = {
41
53
  /**
42
54
  * To hide children of `Responsive` if the current viewport is smaller than `min`
@@ -46,6 +58,12 @@ Responsive.propTypes = {
46
58
  * To hide children of `Responsive` if the current viewport is larger than `max`
47
59
  */
48
60
  max: _propTypes.default.oneOf(['sm', 'md', 'lg', 'xl']),
61
+ /**
62
+ * Styles to be inherited by `Responsive`.
63
+ * It should be an array of style property names.
64
+ * Note: This prop is only applicable when `enableMediaQueryStylesheet` is set to true in the `ThemeProvider`.
65
+ */
66
+ inheritedStyles: _propTypes.default.arrayOf(_propTypes.default.string),
49
67
  children: _propTypes.default.node.isRequired
50
68
  };
51
69
  var _default = Responsive;