@telus-uds/components-base 1.10.0 → 1.12.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.
Files changed (117) hide show
  1. package/CHANGELOG.md +37 -3
  2. package/component-docs.json +413 -62
  3. package/lib/BaseProvider/index.js +7 -2
  4. package/lib/Button/ButtonBase.js +18 -14
  5. package/lib/Carousel/Carousel.js +92 -71
  6. package/lib/Carousel/CarouselContext.js +12 -4
  7. package/lib/Carousel/CarouselItem/CarouselItem.js +24 -9
  8. package/lib/Carousel/CarouselStepTracker/CarouselStepTracker.js +56 -0
  9. package/lib/Carousel/CarouselStepTracker/index.js +13 -0
  10. package/lib/Carousel/dictionary.js +23 -0
  11. package/lib/Checkbox/Checkbox.js +7 -3
  12. package/lib/Checkbox/CheckboxGroup.js +1 -1
  13. package/lib/Feedback/Feedback.js +18 -10
  14. package/lib/Icon/IconText.js +5 -0
  15. package/lib/InputLabel/InputLabel.js +11 -5
  16. package/lib/InputSupports/InputSupports.js +10 -3
  17. package/lib/InputSupports/useInputSupports.js +3 -2
  18. package/lib/Link/LinkBase.js +7 -3
  19. package/lib/List/ListItem.js +7 -3
  20. package/lib/Modal/Modal.js +4 -0
  21. package/lib/Notification/Notification.js +7 -2
  22. package/lib/Pagination/Pagination.js +7 -3
  23. package/lib/RadioCard/RadioCard.js +6 -1
  24. package/lib/Select/Select.js +7 -3
  25. package/lib/Skeleton/Skeleton.js +1 -0
  26. package/lib/StepTracker/Step.js +8 -4
  27. package/lib/StepTracker/StepTracker.js +17 -13
  28. package/lib/Tabs/TabsItem.js +4 -0
  29. package/lib/TextInput/TextInput.js +3 -1
  30. package/lib/TextInput/TextInputBase.js +7 -3
  31. package/lib/ThemeProvider/ThemeProvider.js +20 -3
  32. package/lib/ThemeProvider/utils/styles.js +8 -1
  33. package/lib/ThemeProvider/utils/theme-tokens.js +1 -1
  34. package/lib/Typography/Typography.js +6 -2
  35. package/lib/index.js +9 -0
  36. package/lib/utils/index.js +9 -0
  37. package/lib/utils/props/clickProps.js +2 -2
  38. package/lib/utils/props/handlerProps.js +77 -31
  39. package/lib/utils/useScrollBlocking.js +66 -0
  40. package/lib/utils/useScrollBlocking.native.js +11 -0
  41. package/lib-module/BaseProvider/index.js +7 -2
  42. package/lib-module/Button/ButtonBase.js +7 -3
  43. package/lib-module/Carousel/Carousel.js +85 -70
  44. package/lib-module/Carousel/CarouselContext.js +11 -4
  45. package/lib-module/Carousel/CarouselItem/CarouselItem.js +25 -10
  46. package/lib-module/Carousel/CarouselStepTracker/CarouselStepTracker.js +42 -0
  47. package/lib-module/Carousel/CarouselStepTracker/index.js +2 -0
  48. package/lib-module/Carousel/dictionary.js +16 -0
  49. package/lib-module/Checkbox/Checkbox.js +8 -4
  50. package/lib-module/Checkbox/CheckboxGroup.js +1 -1
  51. package/lib-module/Feedback/Feedback.js +19 -11
  52. package/lib-module/Icon/IconText.js +5 -0
  53. package/lib-module/InputLabel/InputLabel.js +12 -6
  54. package/lib-module/InputSupports/InputSupports.js +10 -3
  55. package/lib-module/InputSupports/useInputSupports.js +3 -2
  56. package/lib-module/Link/LinkBase.js +8 -4
  57. package/lib-module/List/ListItem.js +8 -4
  58. package/lib-module/Modal/Modal.js +3 -0
  59. package/lib-module/Notification/Notification.js +8 -3
  60. package/lib-module/Pagination/Pagination.js +8 -4
  61. package/lib-module/RadioCard/RadioCard.js +7 -2
  62. package/lib-module/Select/Select.js +8 -4
  63. package/lib-module/Skeleton/Skeleton.js +1 -0
  64. package/lib-module/StepTracker/Step.js +9 -5
  65. package/lib-module/StepTracker/StepTracker.js +17 -14
  66. package/lib-module/Tabs/TabsItem.js +5 -1
  67. package/lib-module/TextInput/TextInput.js +3 -1
  68. package/lib-module/TextInput/TextInputBase.js +8 -4
  69. package/lib-module/ThemeProvider/ThemeProvider.js +20 -3
  70. package/lib-module/ThemeProvider/utils/styles.js +8 -1
  71. package/lib-module/ThemeProvider/utils/theme-tokens.js +1 -1
  72. package/lib-module/Typography/Typography.js +7 -3
  73. package/lib-module/index.js +1 -0
  74. package/lib-module/utils/index.js +1 -0
  75. package/lib-module/utils/props/clickProps.js +2 -2
  76. package/lib-module/utils/props/handlerProps.js +78 -31
  77. package/lib-module/utils/useScrollBlocking.js +58 -0
  78. package/lib-module/utils/useScrollBlocking.native.js +2 -0
  79. package/package.json +3 -3
  80. package/src/BaseProvider/index.jsx +6 -3
  81. package/src/Button/ButtonBase.jsx +8 -3
  82. package/src/Carousel/Carousel.jsx +106 -74
  83. package/src/Carousel/CarouselContext.jsx +15 -4
  84. package/src/Carousel/CarouselItem/CarouselItem.jsx +26 -8
  85. package/src/Carousel/CarouselStepTracker/CarouselStepTracker.jsx +36 -0
  86. package/src/Carousel/CarouselStepTracker/index.js +3 -0
  87. package/src/Carousel/dictionary.js +16 -0
  88. package/src/Checkbox/Checkbox.jsx +14 -11
  89. package/src/Checkbox/CheckboxGroup.jsx +1 -1
  90. package/src/Feedback/Feedback.jsx +14 -7
  91. package/src/Icon/IconText.jsx +2 -0
  92. package/src/InputLabel/InputLabel.jsx +13 -12
  93. package/src/InputSupports/InputSupports.jsx +18 -3
  94. package/src/InputSupports/useInputSupports.js +2 -2
  95. package/src/Link/LinkBase.jsx +10 -4
  96. package/src/List/ListItem.jsx +9 -4
  97. package/src/Modal/Modal.jsx +3 -1
  98. package/src/Notification/Notification.jsx +5 -3
  99. package/src/Pagination/Pagination.jsx +6 -4
  100. package/src/RadioCard/RadioCard.jsx +3 -2
  101. package/src/Select/Select.jsx +12 -3
  102. package/src/Skeleton/Skeleton.jsx +1 -0
  103. package/src/StepTracker/Step.jsx +12 -4
  104. package/src/StepTracker/StepTracker.jsx +20 -13
  105. package/src/Tabs/TabsItem.jsx +3 -2
  106. package/src/TextInput/TextInput.jsx +1 -1
  107. package/src/TextInput/TextInputBase.jsx +11 -3
  108. package/src/ThemeProvider/ThemeProvider.jsx +16 -3
  109. package/src/ThemeProvider/utils/styles.js +9 -1
  110. package/src/ThemeProvider/utils/theme-tokens.js +1 -1
  111. package/src/Typography/Typography.jsx +11 -12
  112. package/src/index.js +1 -0
  113. package/src/utils/index.js +1 -0
  114. package/src/utils/props/clickProps.js +2 -2
  115. package/src/utils/props/handlerProps.js +64 -16
  116. package/src/utils/useScrollBlocking.js +57 -0
  117. package/src/utils/useScrollBlocking.native.js +2 -0
@@ -74,7 +74,7 @@ const selectInputStyles = (_ref, isChecked) => {
74
74
  };
75
75
  };
76
76
 
77
- const selectLabelStyles = _ref2 => {
77
+ const selectLabelStyles = (_ref2, themeOptions) => {
78
78
  let {
79
79
  labelColor,
80
80
  labelFontName,
@@ -90,7 +90,8 @@ const selectLabelStyles = _ref2 => {
90
90
  fontName: labelFontName,
91
91
  fontWeight: labelFontWeight,
92
92
  fontSize: labelFontSize,
93
- lineHeight: labelLineHeight
93
+ lineHeight: labelLineHeight,
94
+ themeOptions
94
95
  })
95
96
  };
96
97
  };
@@ -215,6 +216,9 @@ const Checkbox = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
215
216
 
216
217
  const uniqueId = (0, _useUniqueId.default)('checkbox');
217
218
  const inputId = id !== null && id !== void 0 ? id : uniqueId;
219
+ const {
220
+ themeOptions
221
+ } = (0, _ThemeProvider.useTheme)();
218
222
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
219
223
  style: staticStyles.wrapper,
220
224
  ref: ref,
@@ -246,7 +250,7 @@ const Checkbox = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
246
250
  pressed
247
251
  });
248
252
  const iconTokens = selectIconTokens(stateTokens);
249
- const labelStyles = selectLabelStyles(stateTokens);
253
+ const labelStyles = selectLabelStyles(stateTokens, themeOptions);
250
254
  const alignWithLabel = label ? [staticStyles.alignWithLabel, {
251
255
  height: labelStyles.lineHeight
252
256
  }] : null;
@@ -69,7 +69,7 @@ const [selectItemProps, selectedItemPropTypes] = (0, _utils.selectSystemProps)([
69
69
  * @example
70
70
  * ```jsx
71
71
  * <CheckboxGroup
72
- * initialCheckedId="check1"
72
+ * initialCheckedIds="check1"
73
73
  * items={[
74
74
  * { label: 'Checkbox 1', id: 'check1' },
75
75
  * { label: 'Checkbox 2', id: 'check2' },
@@ -33,24 +33,29 @@ const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_u
33
33
 
34
34
  const selectStyles = tokens => (0, _utils.selectTokens)('Feedback', tokens);
35
35
 
36
- const selectTitleTextStyles = _ref => {
36
+ const selectTitleTextStyles = (_ref, themeOptions) => {
37
37
  let {
38
38
  titleFontSize,
39
39
  ...tokens
40
40
  } = _ref;
41
- return (0, _ThemeProvider.applyTextStyles)((0, _utils.selectTokens)('Typography', { ...tokens,
42
- fontSize: titleFontSize
43
- }));
41
+ return (0, _ThemeProvider.applyTextStyles)({ ...(0, _utils.selectTokens)('Typography', { ...tokens,
42
+ fontSize: titleFontSize,
43
+ themeOptions
44
+ }),
45
+ themeOptions
46
+ });
44
47
  };
45
48
 
46
- const selectContentTextStyles = _ref2 => {
49
+ const selectContentTextStyles = (_ref2, themeOptions) => {
47
50
  let {
48
51
  contentFontSize,
49
52
  ...tokens
50
53
  } = _ref2;
51
- return (0, _ThemeProvider.applyTextStyles)((0, _utils.selectTokens)('Typography', { ...tokens,
52
- fontSize: contentFontSize
53
- }));
54
+ return (0, _ThemeProvider.applyTextStyles)({ ...(0, _utils.selectTokens)('Typography', { ...tokens,
55
+ fontSize: contentFontSize
56
+ }),
57
+ themeOptions
58
+ });
54
59
  };
55
60
 
56
61
  const selectIconTokens = _ref3 => {
@@ -111,8 +116,11 @@ const Feedback = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
111
116
  const {
112
117
  icon: IconComponent
113
118
  } = themeTokens;
114
- const titleTextStyles = selectTitleTextStyles(themeTokens);
115
- const contentTextStyles = selectContentTextStyles(themeTokens);
119
+ const {
120
+ themeOptions
121
+ } = (0, _ThemeProvider.useTheme)();
122
+ const titleTextStyles = selectTitleTextStyles(themeTokens, themeOptions);
123
+ const contentTextStyles = selectContentTextStyles(themeTokens, themeOptions);
116
124
  const content = typeof children === 'string' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
117
125
  style: contentTextStyles,
118
126
  children: children
@@ -69,6 +69,9 @@ const IconText = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
69
69
  });
70
70
  IconText.displayName = 'IconText';
71
71
  IconText.propTypes = {
72
+ /* eslint-disable react/no-unused-prop-types */
73
+ // eslint is having hard time seeing these props through forwardRef
74
+
72
75
  /**
73
76
  * Amount of space to separate the text content and icon. Uses the themes's spacing scale
74
77
  * (see useSpacingScale for more info).
@@ -97,6 +100,8 @@ IconText.propTypes = {
97
100
  * `<Typography>` component, or a component that renders `<Text>`.
98
101
  */
99
102
  children: _propTypes.default.node
103
+ /* eslint-enable react/no-unused-prop-types */
104
+
100
105
  };
101
106
  var _default = IconText;
102
107
  exports.default = _default;
@@ -33,9 +33,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
33
33
 
34
34
  const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
35
35
 
36
- const selectLabelStyles = tokens => (0, _ThemeProvider.applyTextStyles)((0, _utils.selectTokens)('Typography', tokens));
36
+ const selectLabelStyles = (tokens, themeOptions) => (0, _ThemeProvider.applyTextStyles)({ ...(0, _utils.selectTokens)('Typography', tokens),
37
+ themeOptions
38
+ });
37
39
 
38
- const selectHintStyles = _ref => {
40
+ const selectHintStyles = (_ref, themeOptions) => {
39
41
  let {
40
42
  hintColor,
41
43
  hintFontName,
@@ -48,7 +50,8 @@ const selectHintStyles = _ref => {
48
50
  fontName: hintFontName,
49
51
  fontSize: hintFontSize,
50
52
  fontWeight: hintFontWeight,
51
- lineHeight: hintLineHeight
53
+ lineHeight: hintLineHeight,
54
+ themeOptions
52
55
  });
53
56
  };
54
57
 
@@ -77,19 +80,22 @@ const InputLabel = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
77
80
  const themeTokens = (0, _ThemeProvider.useThemeTokens)('InputLabel', tokens, variant);
78
81
  const hasTooltip = tooltip !== undefined;
79
82
  const isHintInline = hintPosition === 'inline';
83
+ const {
84
+ themeOptions
85
+ } = (0, _ThemeProvider.useTheme)();
80
86
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
81
87
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
82
88
  ref: ref,
83
89
  style: staticStyles.container,
84
90
  ...selectProps(rest),
85
91
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
86
- style: [selectLabelStyles(themeTokens), selectGapStyles(themeTokens), staticStyles.label],
92
+ style: [selectLabelStyles(themeTokens, themeOptions), selectGapStyles(themeTokens), staticStyles.label],
87
93
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_LabelContent.default, {
88
94
  forId: forId,
89
95
  children: label
90
96
  })
91
97
  }), hint && isHintInline && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
92
- style: [selectHintStyles(themeTokens), hasTooltip && selectGapStyles(themeTokens), staticStyles.label],
98
+ style: [selectHintStyles(themeTokens, themeOptions), hasTooltip && selectGapStyles(themeTokens), staticStyles.label],
93
99
  nativeID: hintId,
94
100
  children: hint
95
101
  }), hasTooltip && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
@@ -36,7 +36,8 @@ const InputSupports = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
36
36
  hintPosition = 'inline',
37
37
  feedback,
38
38
  tooltip,
39
- validation
39
+ validation,
40
+ nativeID
40
41
  } = _ref;
41
42
  const {
42
43
  space
@@ -50,7 +51,8 @@ const InputSupports = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
50
51
  feedback,
51
52
  hint,
52
53
  label,
53
- validation
54
+ validation,
55
+ nativeID
54
56
  });
55
57
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_StackView.default, {
56
58
  space: space,
@@ -111,7 +113,12 @@ InputSupports.propTypes = {
111
113
  /**
112
114
  * Use to visually mark an input as valid or invalid.
113
115
  */
114
- validation: _propTypes.default.oneOf(['error', 'success'])
116
+ validation: _propTypes.default.oneOf(['error', 'success']),
117
+
118
+ /**
119
+ * ID for DOM element on web
120
+ */
121
+ nativeID: _propTypes.default.string
115
122
  };
116
123
  var _default = InputSupports;
117
124
  exports.default = _default;
@@ -16,7 +16,8 @@ const useInputSupports = _ref => {
16
16
  label,
17
17
  feedback,
18
18
  validation,
19
- hint
19
+ hint,
20
+ nativeID
20
21
  } = _ref;
21
22
  const hasValidationError = validation === 'error';
22
23
  const inputId = (0, _useUniqueId.default)('input');
@@ -31,7 +32,7 @@ const useInputSupports = _ref => {
31
32
  accessibilityInvalid: hasValidationError
32
33
  };
33
34
  return {
34
- inputId,
35
+ inputId: nativeID || inputId,
35
36
  hintId,
36
37
  feedbackId,
37
38
  a11yProps
@@ -78,7 +78,7 @@ const selectTextStyles = _ref2 => {
78
78
  };
79
79
  };
80
80
 
81
- const selectBlockStyles = _ref3 => {
81
+ const selectBlockStyles = (_ref3, themeOptions) => {
82
82
  let {
83
83
  blockFontWeight,
84
84
  blockFontSize,
@@ -89,7 +89,8 @@ const selectBlockStyles = _ref3 => {
89
89
  fontWeight: blockFontWeight,
90
90
  fontSize: blockFontSize,
91
91
  lineHeight: blockLineHeight,
92
- fontName: blockFontName
92
+ fontName: blockFontName,
93
+ themeOptions
93
94
  });
94
95
  };
95
96
 
@@ -192,6 +193,9 @@ const LinkBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
192
193
  const hasIcon = Boolean(icon || defaultThemeTokens.icon); // On web, this makes focus rings wrap only the link, not the entire block
193
194
 
194
195
  const blockLeftStyle = _Platform.default.OS === 'web' && staticStyles.blockLeft;
196
+ const {
197
+ themeOptions
198
+ } = (0, _ThemeProvider.useTheme)();
195
199
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InlinePressable.default, { ...selectedProps,
196
200
  inline: hasIcon // assuming links without icons should be inline (even if they are long)
197
201
  ,
@@ -208,7 +212,7 @@ const LinkBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
208
212
  const iconTokens = selectIconTokens(themeTokens); // TODO: may need to apply some smarter text inheritance here if inline to avoid native
209
213
  // issues like double-application of line heights breaking align-items: baseline
210
214
 
211
- const blockTextStyles = selectBlockStyles(themeTokens);
215
+ const blockTextStyles = selectBlockStyles(themeTokens, themeOptions);
212
216
  const IconComponent = icon || themeTokens.icon;
213
217
  const {
214
218
  iconSpace
@@ -87,7 +87,7 @@ const selectBulletPositioningStyles = _ref5 => {
87
87
  };
88
88
  };
89
89
 
90
- const selectItemStyles = _ref6 => {
90
+ const selectItemStyles = (_ref6, themeOptions) => {
91
91
  let {
92
92
  itemFontWeight,
93
93
  itemFontSize,
@@ -98,7 +98,8 @@ const selectItemStyles = _ref6 => {
98
98
  fontWeight: itemFontWeight,
99
99
  fontSize: itemFontSize,
100
100
  lineHeight: itemLineHeight,
101
- fontName: itemFontName
101
+ fontName: itemFontName,
102
+ themeOptions
102
103
  });
103
104
  };
104
105
 
@@ -146,7 +147,10 @@ const ListItem = /*#__PURE__*/(0, _react.forwardRef)((_ref9, ref) => {
146
147
  ...rest
147
148
  } = _ref9;
148
149
  const themeTokens = (0, _ThemeProvider.useThemeTokens)('List', tokens, variant);
149
- const itemStyles = selectItemStyles(themeTokens);
150
+ const {
151
+ themeOptions
152
+ } = (0, _ThemeProvider.useTheme)();
153
+ const itemStyles = selectItemStyles(themeTokens, themeOptions);
150
154
  const itemBlockStyles = selectItemBlockStyles(themeTokens);
151
155
  const dividerStyles = selectDividerStyles(themeTokens);
152
156
  const itemBulletContainerStyles = selectBulletContainerStyles(themeTokens);
@@ -29,6 +29,8 @@ var _IconButton = _interopRequireDefault(require("../IconButton"));
29
29
 
30
30
  var _dictionary = _interopRequireDefault(require("./dictionary"));
31
31
 
32
+ var _useScrollBlocking = _interopRequireDefault(require("../utils/useScrollBlocking"));
33
+
32
34
  var _jsxRuntime = require("react/jsx-runtime");
33
35
 
34
36
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -135,6 +137,7 @@ const Modal = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
135
137
  viewport,
136
138
  maxWidth
137
139
  });
140
+ const modalRef = (0, _useScrollBlocking.default)(isOpen);
138
141
  const {
139
142
  closeIcon: CloseIconComponent
140
143
  } = themeTokens;
@@ -165,6 +168,7 @@ const Modal = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
165
168
  ...selectProps(rest),
166
169
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
167
170
  style: [staticStyles.positioningContainer],
171
+ ref: modalRef,
168
172
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
169
173
  style: [staticStyles.sizingContainer, selectContainerStyles(themeTokens)],
170
174
  pointerEvents: "box-none" // don't capture backdrop press events
@@ -36,7 +36,9 @@ const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_u
36
36
  const selectContainerStyles = tokens => ({ ...tokens
37
37
  });
38
38
 
39
- const selectTextStyles = tokens => (0, _ThemeProvider.applyTextStyles)((0, _utils.selectTokens)('Typography', tokens));
39
+ const selectTextStyles = (tokens, themeOptions) => (0, _ThemeProvider.applyTextStyles)({ ...(0, _utils.selectTokens)('Typography', tokens),
40
+ themeOptions
41
+ });
40
42
 
41
43
  const selectIconProps = _ref => {
42
44
  let {
@@ -148,12 +150,15 @@ const Notification = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
148
150
  dictionary: _dictionary.default,
149
151
  copy
150
152
  });
153
+ const {
154
+ themeOptions
155
+ } = (0, _ThemeProvider.useTheme)();
151
156
 
152
157
  if (isDismissed) {
153
158
  return null;
154
159
  }
155
160
 
156
- const textStyles = selectTextStyles(themeTokens);
161
+ const textStyles = selectTextStyles(themeTokens, themeOptions);
157
162
  const content = (0, _utils.wrapStringsInText)(typeof children === 'function' ? children({
158
163
  textStyles
159
164
  }) : children, {
@@ -37,7 +37,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
37
37
 
38
38
  const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.viewProps]);
39
39
 
40
- const selectTextStyles = _ref => {
40
+ const selectTextStyles = (_ref, themeOptions) => {
41
41
  let {
42
42
  color,
43
43
  fontName,
@@ -50,7 +50,8 @@ const selectTextStyles = _ref => {
50
50
  fontName,
51
51
  fontSize,
52
52
  fontWeight,
53
- lineHeight
53
+ lineHeight,
54
+ themeOptions
54
55
  });
55
56
  };
56
57
 
@@ -74,6 +75,9 @@ const Pagination = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
74
75
  } = (0, _ThemeProvider.useThemeTokens)('Pagination', tokens, variant, {
75
76
  viewport
76
77
  });
78
+ const {
79
+ themeOptions
80
+ } = (0, _ThemeProvider.useTheme)();
77
81
 
78
82
  const items = _react.default.Children.toArray(children);
79
83
 
@@ -90,7 +94,7 @@ const Pagination = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
90
94
  items,
91
95
  truncateAbove
92
96
  });
93
- const ellipsisTextStyles = selectTextStyles(themeTokens);
97
+ const ellipsisTextStyles = selectTextStyles(themeTokens, themeOptions);
94
98
 
95
99
  if (items.length === 0) {
96
100
  return null;
@@ -107,6 +107,9 @@ const RadioCard = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
107
107
 
108
108
  const getCardTokens = cardState => (0, _Card.selectPressableCardTokens)(getTokens(cardState));
109
109
 
110
+ const {
111
+ themeOptions
112
+ } = (0, _ThemeProvider.useTheme)();
110
113
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Card.PressableCardBase, {
111
114
  ref: ref,
112
115
  inactive: inactive,
@@ -127,7 +130,9 @@ const RadioCard = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
127
130
  } = getTokens(cardState);
128
131
  const radioTokens = (0, _RadioButton.selectRadioButtonTokens)(themeTokens, 'radio');
129
132
  const titleTokens = (0, _utils.selectTokens)('Typography', themeTokens);
130
- const textStyle = (0, _ThemeProvider.applyTextStyles)(titleTokens);
133
+ const textStyle = (0, _ThemeProvider.applyTextStyles)({ ...titleTokens,
134
+ themeOptions
135
+ });
131
136
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_StackView.default, {
132
137
  direction: "row",
133
138
  space: radioSpace,
@@ -33,7 +33,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
33
33
 
34
34
  const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.inputSupportsProps, _utils.viewProps]);
35
35
 
36
- const selectInputStyles = (_ref, inactive) => {
36
+ const selectInputStyles = (_ref, themeOptions, inactive) => {
37
37
  let {
38
38
  backgroundColor,
39
39
  color,
@@ -63,7 +63,8 @@ const selectInputStyles = (_ref, inactive) => {
63
63
  fontName,
64
64
  fontSize,
65
65
  lineHeight,
66
- fontWeight
66
+ fontWeight,
67
+ themeOptions
67
68
  });
68
69
 
69
70
  const webStyles = _Platform.default.select({
@@ -252,6 +253,9 @@ const Select = /*#__PURE__*/(0, _react.forwardRef)((_ref7, ref) => {
252
253
  icon: IconComponent,
253
254
  validationIcon: ValidationIconComponent
254
255
  } = themeTokens;
256
+ const {
257
+ themeOptions
258
+ } = (0, _ThemeProvider.useTheme)();
255
259
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputSupports.default, { ...supportsProps,
256
260
  ...selectedProps,
257
261
  children: _ref8 => {
@@ -263,7 +267,7 @@ const Select = /*#__PURE__*/(0, _react.forwardRef)((_ref7, ref) => {
263
267
  style: selectOuterBorderStyles(themeTokens),
264
268
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Picker.default, {
265
269
  ref: ref,
266
- style: selectInputStyles(themeTokens, inactive),
270
+ style: selectInputStyles(themeTokens, themeOptions, inactive),
267
271
  onFocus: handleFocus,
268
272
  onBlur: handleBlur,
269
273
  onMouseOver: handleMouseOver,
@@ -42,6 +42,7 @@ const selectSkeletonStyles = _ref => {
42
42
  return {
43
43
  backgroundColor: color,
44
44
  borderRadius: radius,
45
+ maxWidth: '100%',
45
46
  ...fadeAnimation
46
47
  };
47
48
  };
@@ -128,7 +128,7 @@ const selectLabelContainerStyles = _ref5 => {
128
128
  };
129
129
  };
130
130
 
131
- const selectLabelStyles = (_ref6, isCurrent) => {
131
+ const selectLabelStyles = (_ref6, themeOptions, isCurrent) => {
132
132
  let {
133
133
  labelColor,
134
134
  labelCurrentColor,
@@ -143,7 +143,8 @@ const selectLabelStyles = (_ref6, isCurrent) => {
143
143
  fontSize: labelFontSize,
144
144
  lineHeight: labelLineHeight,
145
145
  fontWeight: isCurrent ? labelCurrentFontWeight : labelFontWeight,
146
- fontName: labelFontName
146
+ fontName: labelFontName,
147
+ themeOptions
147
148
  });
148
149
  };
149
150
 
@@ -184,6 +185,9 @@ const Step = _ref7 => {
184
185
  const isCompleted = status > stepIndex;
185
186
  const isCurrent = status === stepIndex;
186
187
  const isActive = isCompleted || isCurrent;
188
+ const {
189
+ themeOptions
190
+ } = (0, _ThemeProvider.useTheme)();
187
191
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_StackView.default, {
188
192
  space: 0,
189
193
  tokens: {
@@ -218,12 +222,12 @@ const Step = _ref7 => {
218
222
  }), showStepLabel && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
219
223
  style: [staticStyles.stepLabelContainer, selectLabelContainerStyles(tokens)],
220
224
  children: [showStepName && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
221
- style: [staticStyles.centeredText, selectLabelStyles(tokens, isCurrent)],
225
+ style: [staticStyles.centeredText, selectLabelStyles(tokens, themeOptions, isCurrent)],
222
226
  children: name
223
227
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_StackView.default, {
224
228
  direction: "row",
225
229
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
226
- style: [staticStyles.centeredText, tokens.labelDirection === 'column' && staticStyles.wrappingLabel, selectLabelStyles(tokens, isCurrent)],
230
+ style: [staticStyles.centeredText, tokens.labelDirection === 'column' && staticStyles.wrappingLabel, selectLabelStyles(tokens, themeOptions, isCurrent)],
227
231
  children: label
228
232
  })
229
233
  })]
@@ -63,7 +63,7 @@ const selectStepTrackerLabelContainerStyles = _ref2 => {
63
63
  };
64
64
  };
65
65
 
66
- const selectStepTrackerLabelStyles = _ref3 => {
66
+ const selectStepTrackerLabelStyles = (_ref3, themeOptions) => {
67
67
  let {
68
68
  labelColor,
69
69
  labelFontSize,
@@ -76,7 +76,8 @@ const selectStepTrackerLabelStyles = _ref3 => {
76
76
  fontSize: labelFontSize,
77
77
  lineHeight: labelLineHeight,
78
78
  fontWeight: labelFontWeight,
79
- fontName: labelFontName
79
+ fontName: labelFontName,
80
+ themeOptions
80
81
  });
81
82
  };
82
83
  /**
@@ -138,6 +139,9 @@ const StepTracker = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
138
139
 
139
140
  const getStepLabel = index => themeTokens.showStepLabel ? getCopy('stepLabel').replace('%{stepNumber}', index + 1) : '';
140
141
 
142
+ const {
143
+ themeOptions
144
+ } = (0, _ThemeProvider.useTheme)();
141
145
  if (!steps.length) return null;
142
146
  const selectedProps = selectProps({
143
147
  accessibilityLabel: stepTrackerLabel,
@@ -172,26 +176,26 @@ const StepTracker = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
172
176
  }), showStepTrackerLabel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
173
177
  style: [staticStyles.stepTrackerLabelContainer, selectStepTrackerLabelContainerStyles(themeTokens)],
174
178
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
175
- style: selectStepTrackerLabelStyles(themeTokens),
179
+ style: selectStepTrackerLabelStyles(themeTokens, themeOptions),
176
180
  children: stepTrackerLabel
177
181
  })
178
182
  })]
179
183
  })
180
184
  });
181
185
  });
182
- StepTracker.displayName = 'StepTracker';
186
+ StepTracker.displayName = 'StepTracker'; // If a language dictionary entry is provided, it must contain every key
187
+
188
+ const dictionaryContentShape = _propTypes.default.shape({
189
+ stepLabel: _propTypes.default.string.isRequired,
190
+ stepTrackerLabel: _propTypes.default.string.isRequired
191
+ });
192
+
183
193
  StepTracker.propTypes = { ...selectedSystemPropTypes,
184
194
  current: _propTypes.default.number,
185
- copy: _propTypes.default.oneOf(['en', 'fr']),
195
+ copy: _propTypes.default.oneOfType([_propTypes.default.oneOf(['en', 'fr']), dictionaryContentShape]),
186
196
  dictionary: _propTypes.default.shape({
187
- en: _propTypes.default.shape({
188
- stepLabel: _propTypes.default.string,
189
- stepTrackerLabel: _propTypes.default.string
190
- }),
191
- fr: _propTypes.default.shape({
192
- stepLabel: _propTypes.default.string,
193
- stepTrackerLabel: _propTypes.default.string
194
- })
197
+ en: dictionaryContentShape,
198
+ fr: dictionaryContentShape
195
199
  }),
196
200
  steps: _propTypes.default.arrayOf(_propTypes.default.string),
197
201
  tokens: (0, _utils.getTokensPropType)('StepTracker'),
@@ -131,6 +131,9 @@ const TabsItem = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
131
131
  ...rest
132
132
  } = _utils.clickProps.toPressProps(rawRest);
133
133
 
134
+ const {
135
+ themeOptions
136
+ } = (0, _ThemeProvider.useTheme)();
134
137
  const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('TabsItem', tokens, variant);
135
138
 
136
139
  const resolveTokens = pressableState => (0, _utils.resolvePressableTokens)(getTokens, pressableState, {
@@ -197,6 +200,7 @@ const TabsItem = /*#__PURE__*/(0, _react.forwardRef)((_ref4, ref) => {
197
200
  const highlightTriangleStyle = hasHighlightTriangle && selectHighlightTriangleStyles(themeTokens);
198
201
  const containerStyles = selectContainerStyles(themeTokens);
199
202
  const textStyles = (0, _ThemeProvider.applyTextStyles)({ ...(0, _utils.selectTokens)('Typography', themeTokens),
203
+ themeOptions,
200
204
  textAlign
201
205
  });
202
206
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
@@ -59,7 +59,9 @@ const TextInput = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
59
59
  validation: supportsProps.validation
60
60
  }
61
61
  };
62
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputSupports.default, { ...supportsProps,
62
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputSupports.default, {
63
+ nativeID: selectedProps.nativeID,
64
+ ...supportsProps,
63
65
  children: _ref2 => {
64
66
  let {
65
67
  inputId,
@@ -31,7 +31,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
31
31
 
32
32
  const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.textInputHandlerProps, _utils.textInputProps, _utils.viewProps]);
33
33
 
34
- const selectInputStyles = (_ref, inactive) => {
34
+ const selectInputStyles = (_ref, themeOptions, inactive) => {
35
35
  let {
36
36
  backgroundColor,
37
37
  color,
@@ -62,7 +62,8 @@ const selectInputStyles = (_ref, inactive) => {
62
62
  fontName,
63
63
  fontSize,
64
64
  lineHeight,
65
- fontWeight
65
+ fontWeight,
66
+ themeOptions
66
67
  });
67
68
 
68
69
  function linesToHeight(lines) {
@@ -233,9 +234,12 @@ const TextInputBase = /*#__PURE__*/(0, _react.forwardRef)((_ref5, ref) => {
233
234
  // Input could lead to changing its state from uncontrolled to controlled
234
235
  value: isControlled ? currentValue : undefined
235
236
  };
237
+ const {
238
+ themeOptions
239
+ } = (0, _ThemeProvider.useTheme)();
236
240
  const nativeInputStyle = selectInputStyles({ ...themeTokens,
237
241
  height
238
- }, inactive);
242
+ }, themeOptions, inactive);
239
243
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_View.default, {
240
244
  style: selectOuterBorderStyles(themeTokens),
241
245
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TextInput.default, {
@@ -29,7 +29,11 @@ exports.ThemeSetterContext = ThemeSetterContext;
29
29
  const ThemeProvider = _ref => {
30
30
  let {
31
31
  children,
32
- defaultTheme
32
+ defaultTheme,
33
+ // TODO: switch `forceAbsoluteFontSizing` to be false by default in the next major version
34
+ themeOptions = {
35
+ forceAbsoluteFontSizing: true
36
+ }
33
37
  } = _ref;
34
38
  const [theme, setTheme] = (0, _react.useState)(defaultTheme); // Validate the theme tokens version on every render.
35
39
  // This will intentionally break the application when attempting to use an invalid theme.
@@ -39,7 +43,9 @@ const ThemeProvider = _ref => {
39
43
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(ThemeSetterContext.Provider, {
40
44
  value: setTheme,
41
45
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ThemeContext.Provider, {
42
- value: theme,
46
+ value: { ...theme,
47
+ themeOptions
48
+ },
43
49
  children: children
44
50
  })
45
51
  });
@@ -51,7 +57,18 @@ ThemeProvider.propTypes = {
51
57
  metadata: _propTypes.default.shape({
52
58
  themeTokensVersion: _propTypes.default.string.isRequired
53
59
  }).isRequired
54
- }).isRequired
60
+ }).isRequired,
61
+
62
+ /**
63
+ * An object containing options allowing to customize the theming experience:
64
+ *
65
+ * - `forceAbsoluteFontSizing`: available on web only; when set to true, allows
66
+ * using absolute font sizing (in pixels, doesn't scale) instead of the
67
+ * relative sizing (in `rem`, scales depending on the browser settings)
68
+ */
69
+ themeOptions: _propTypes.default.shape({
70
+ forceAbsoluteFontSizing: _propTypes.default.bool
71
+ })
55
72
  };
56
73
  var _default = ThemeProvider;
57
74
  exports.default = _default;