@telus-uds/components-base 1.11.0 → 1.13.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 (132) hide show
  1. package/CHANGELOG.md +36 -2
  2. package/component-docs.json +796 -33
  3. package/lib/BaseProvider/index.js +7 -2
  4. package/lib/Button/ButtonBase.js +18 -14
  5. package/lib/Button/ButtonGroup.js +7 -0
  6. package/lib/Carousel/Carousel.js +83 -58
  7. package/lib/Carousel/CarouselContext.js +22 -8
  8. package/lib/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +73 -0
  9. package/lib/Carousel/CarouselStepTracker/CarouselStepTracker.js +56 -0
  10. package/lib/Carousel/CarouselStepTracker/index.js +13 -0
  11. package/lib/Carousel/CarouselTabs/CarouselTabs.js +70 -0
  12. package/lib/Carousel/CarouselTabs/CarouselTabsPanel.js +95 -0
  13. package/lib/Carousel/CarouselTabs/CarouselTabsPanelItem.js +148 -0
  14. package/lib/Carousel/CarouselTabs/index.js +13 -0
  15. package/lib/Carousel/CarouselThumbnail.js +99 -0
  16. package/lib/Carousel/CarouselThumbnailNavigation.js +87 -0
  17. package/lib/Carousel/dictionary.js +4 -2
  18. package/lib/Carousel/index.js +10 -1
  19. package/lib/Checkbox/Checkbox.js +7 -3
  20. package/lib/Checkbox/CheckboxGroup.js +8 -1
  21. package/lib/Feedback/Feedback.js +18 -10
  22. package/lib/Icon/IconText.js +5 -0
  23. package/lib/InputLabel/InputLabel.js +11 -5
  24. package/lib/Link/InlinePressable.js +1 -8
  25. package/lib/Link/LinkBase.js +12 -9
  26. package/lib/List/ListItem.js +7 -3
  27. package/lib/Notification/Notification.js +7 -2
  28. package/lib/Pagination/Pagination.js +7 -3
  29. package/lib/Radio/RadioGroup.js +8 -0
  30. package/lib/RadioCard/RadioCard.js +6 -1
  31. package/lib/RadioCard/RadioCardGroup.js +7 -0
  32. package/lib/Select/Select.js +7 -3
  33. package/lib/SkipLink/SkipLink.js +216 -0
  34. package/lib/SkipLink/index.js +13 -0
  35. package/lib/StepTracker/Step.js +8 -4
  36. package/lib/StepTracker/StepTracker.js +7 -3
  37. package/lib/Tabs/TabsItem.js +4 -0
  38. package/lib/TextInput/TextInputBase.js +7 -3
  39. package/lib/ThemeProvider/ThemeProvider.js +25 -3
  40. package/lib/ThemeProvider/utils/styles.js +8 -1
  41. package/lib/ThemeProvider/utils/theme-tokens.js +1 -1
  42. package/lib/ToggleSwitch/ToggleSwitchGroup.js +7 -0
  43. package/lib/Typography/Typography.js +6 -2
  44. package/lib/index.js +9 -0
  45. package/lib/utils/index.js +9 -0
  46. package/lib-module/BaseProvider/index.js +7 -2
  47. package/lib-module/Button/ButtonBase.js +7 -3
  48. package/lib-module/Button/ButtonGroup.js +7 -0
  49. package/lib-module/Carousel/Carousel.js +80 -57
  50. package/lib-module/Carousel/CarouselContext.js +21 -8
  51. package/lib-module/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +51 -0
  52. package/lib-module/Carousel/CarouselStepTracker/CarouselStepTracker.js +42 -0
  53. package/lib-module/Carousel/CarouselStepTracker/index.js +2 -0
  54. package/lib-module/Carousel/CarouselTabs/CarouselTabs.js +50 -0
  55. package/lib-module/Carousel/CarouselTabs/CarouselTabsPanel.js +76 -0
  56. package/lib-module/Carousel/CarouselTabs/CarouselTabsPanelItem.js +126 -0
  57. package/lib-module/Carousel/CarouselTabs/index.js +2 -0
  58. package/lib-module/Carousel/CarouselThumbnail.js +85 -0
  59. package/lib-module/Carousel/CarouselThumbnailNavigation.js +66 -0
  60. package/lib-module/Carousel/dictionary.js +4 -2
  61. package/lib-module/Carousel/index.js +2 -1
  62. package/lib-module/Checkbox/Checkbox.js +8 -4
  63. package/lib-module/Checkbox/CheckboxGroup.js +8 -1
  64. package/lib-module/Feedback/Feedback.js +19 -11
  65. package/lib-module/Icon/IconText.js +5 -0
  66. package/lib-module/InputLabel/InputLabel.js +12 -6
  67. package/lib-module/Link/InlinePressable.js +1 -8
  68. package/lib-module/Link/LinkBase.js +13 -10
  69. package/lib-module/List/ListItem.js +8 -4
  70. package/lib-module/Notification/Notification.js +8 -3
  71. package/lib-module/Pagination/Pagination.js +8 -4
  72. package/lib-module/Radio/RadioGroup.js +8 -0
  73. package/lib-module/RadioCard/RadioCard.js +7 -2
  74. package/lib-module/RadioCard/RadioCardGroup.js +7 -0
  75. package/lib-module/Select/Select.js +8 -4
  76. package/lib-module/SkipLink/SkipLink.js +188 -0
  77. package/lib-module/SkipLink/index.js +2 -0
  78. package/lib-module/StepTracker/Step.js +9 -5
  79. package/lib-module/StepTracker/StepTracker.js +8 -4
  80. package/lib-module/Tabs/TabsItem.js +5 -1
  81. package/lib-module/TextInput/TextInputBase.js +8 -4
  82. package/lib-module/ThemeProvider/ThemeProvider.js +24 -3
  83. package/lib-module/ThemeProvider/utils/styles.js +8 -1
  84. package/lib-module/ThemeProvider/utils/theme-tokens.js +1 -1
  85. package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +7 -0
  86. package/lib-module/Typography/Typography.js +7 -3
  87. package/lib-module/index.js +1 -0
  88. package/lib-module/utils/index.js +1 -0
  89. package/package.json +46 -47
  90. package/src/BaseProvider/index.jsx +6 -3
  91. package/src/Button/ButtonBase.jsx +8 -3
  92. package/src/Button/ButtonGroup.jsx +6 -0
  93. package/src/Carousel/Carousel.jsx +91 -64
  94. package/src/Carousel/CarouselContext.jsx +29 -5
  95. package/src/Carousel/CarouselFirstFocus/CarouselFirstFocus.jsx +49 -0
  96. package/src/Carousel/CarouselStepTracker/CarouselStepTracker.jsx +36 -0
  97. package/src/Carousel/CarouselStepTracker/index.js +3 -0
  98. package/src/Carousel/CarouselTabs/CarouselTabs.jsx +37 -0
  99. package/src/Carousel/CarouselTabs/CarouselTabsPanel.jsx +69 -0
  100. package/src/Carousel/CarouselTabs/CarouselTabsPanelItem.jsx +119 -0
  101. package/src/Carousel/CarouselTabs/index.js +3 -0
  102. package/src/Carousel/CarouselThumbnail.jsx +77 -0
  103. package/src/Carousel/CarouselThumbnailNavigation.jsx +53 -0
  104. package/src/Carousel/dictionary.js +4 -2
  105. package/src/Carousel/index.js +1 -0
  106. package/src/Checkbox/Checkbox.jsx +14 -11
  107. package/src/Checkbox/CheckboxGroup.jsx +8 -1
  108. package/src/Feedback/Feedback.jsx +14 -7
  109. package/src/Icon/IconText.jsx +2 -0
  110. package/src/InputLabel/InputLabel.jsx +13 -12
  111. package/src/Link/InlinePressable.jsx +2 -8
  112. package/src/Link/LinkBase.jsx +17 -20
  113. package/src/List/ListItem.jsx +9 -4
  114. package/src/Notification/Notification.jsx +5 -3
  115. package/src/Pagination/Pagination.jsx +6 -4
  116. package/src/Radio/RadioGroup.jsx +7 -0
  117. package/src/RadioCard/RadioCard.jsx +3 -2
  118. package/src/RadioCard/RadioCardGroup.jsx +6 -0
  119. package/src/Select/Select.jsx +12 -3
  120. package/src/SkipLink/SkipLink.jsx +179 -0
  121. package/src/SkipLink/index.js +3 -0
  122. package/src/StepTracker/Step.jsx +12 -4
  123. package/src/StepTracker/StepTracker.jsx +11 -10
  124. package/src/Tabs/TabsItem.jsx +3 -2
  125. package/src/TextInput/TextInputBase.jsx +11 -3
  126. package/src/ThemeProvider/ThemeProvider.jsx +22 -3
  127. package/src/ThemeProvider/utils/styles.js +9 -1
  128. package/src/ThemeProvider/utils/theme-tokens.js +1 -1
  129. package/src/ToggleSwitch/ToggleSwitchGroup.jsx +6 -0
  130. package/src/Typography/Typography.jsx +11 -12
  131. package/src/index.js +1 -0
  132. package/src/utils/index.js +1 -0
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import StyleSheet from "react-native-web/dist/exports/StyleSheet";
4
4
  import Text from "react-native-web/dist/exports/Text";
5
5
  import View from "react-native-web/dist/exports/View";
6
- import { useThemeTokensCallback, applyTextStyles } from '../ThemeProvider';
6
+ import { applyTextStyles, useTheme, useThemeTokensCallback } from '../ThemeProvider';
7
7
  import { a11yProps, focusHandlerProps, getTokensPropType, selectSystemProps, selectTokens, useInputValue, useUniqueId, variantProp, viewProps } from '../utils';
8
8
  import { PressableCardBase, selectPressableCardTokens } from '../Card';
9
9
  import StackView from '../StackView';
@@ -84,6 +84,9 @@ const RadioCard = /*#__PURE__*/forwardRef((_ref, ref) => {
84
84
 
85
85
  const getCardTokens = cardState => selectPressableCardTokens(getTokens(cardState));
86
86
 
87
+ const {
88
+ themeOptions
89
+ } = useTheme();
87
90
  return /*#__PURE__*/_jsx(PressableCardBase, {
88
91
  ref: ref,
89
92
  inactive: inactive,
@@ -104,7 +107,9 @@ const RadioCard = /*#__PURE__*/forwardRef((_ref, ref) => {
104
107
  } = getTokens(cardState);
105
108
  const radioTokens = selectRadioButtonTokens(themeTokens, 'radio');
106
109
  const titleTokens = selectTokens('Typography', themeTokens);
107
- const textStyle = applyTextStyles(titleTokens);
110
+ const textStyle = applyTextStyles({ ...titleTokens,
111
+ themeOptions
112
+ });
108
113
  return /*#__PURE__*/_jsxs(StackView, {
109
114
  direction: "row",
110
115
  space: radioSpace,
@@ -70,6 +70,7 @@ const RadioCardGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
70
70
  legend,
71
71
  tooltip,
72
72
  hint,
73
+ hintPosition = 'inline',
73
74
  validation,
74
75
  feedback,
75
76
  initialCheckedId,
@@ -114,6 +115,7 @@ const RadioCardGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
114
115
  legend: legend,
115
116
  tooltip: tooltip,
116
117
  hint: hint,
118
+ hintPosition: hintPosition,
117
119
  space: fieldSpace,
118
120
  feedback: feedback,
119
121
  inactive: inactive || readOnly,
@@ -199,6 +201,11 @@ RadioCardGroup.propTypes = { ...selectedSystemPropTypes,
199
201
  */
200
202
  hint: PropTypes.string,
201
203
 
204
+ /**
205
+ * Position of the hint relative to label. Use `below` to display a larger hint below the label.
206
+ */
207
+ hintPosition: PropTypes.oneOf(['inline', 'below']),
208
+
202
209
  /**
203
210
  * Optional tooltip text content to include alongside the legend and hint.
204
211
  */
@@ -3,7 +3,7 @@ import View from "react-native-web/dist/exports/View";
3
3
  import Platform from "react-native-web/dist/exports/Platform";
4
4
  import StyleSheet from "react-native-web/dist/exports/StyleSheet";
5
5
  import PropTypes from 'prop-types';
6
- import { applyTextStyles, useThemeTokens, applyOuterBorder } from '../ThemeProvider';
6
+ import { applyTextStyles, useThemeTokens, applyOuterBorder, useTheme } from '../ThemeProvider';
7
7
  import { a11yProps, componentPropType, getTokensPropType, inputSupportsProps, selectSystemProps, useInputValue, variantProp, viewProps } from '../utils';
8
8
  import Picker from './Picker';
9
9
  import InputSupports from '../InputSupports';
@@ -11,7 +11,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
11
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
12
12
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, inputSupportsProps, viewProps]);
13
13
 
14
- const selectInputStyles = (_ref, inactive) => {
14
+ const selectInputStyles = (_ref, themeOptions, inactive) => {
15
15
  let {
16
16
  backgroundColor,
17
17
  color,
@@ -41,7 +41,8 @@ const selectInputStyles = (_ref, inactive) => {
41
41
  fontName,
42
42
  fontSize,
43
43
  lineHeight,
44
- fontWeight
44
+ fontWeight,
45
+ themeOptions
45
46
  });
46
47
  const webStyles = Platform.select({
47
48
  web: {
@@ -228,6 +229,9 @@ const Select = /*#__PURE__*/forwardRef((_ref7, ref) => {
228
229
  icon: IconComponent,
229
230
  validationIcon: ValidationIconComponent
230
231
  } = themeTokens;
232
+ const {
233
+ themeOptions
234
+ } = useTheme();
231
235
  return /*#__PURE__*/_jsx(InputSupports, { ...supportsProps,
232
236
  ...selectedProps,
233
237
  children: _ref8 => {
@@ -239,7 +243,7 @@ const Select = /*#__PURE__*/forwardRef((_ref7, ref) => {
239
243
  style: selectOuterBorderStyles(themeTokens),
240
244
  children: [/*#__PURE__*/_jsx(Picker, {
241
245
  ref: ref,
242
- style: selectInputStyles(themeTokens, inactive),
246
+ style: selectInputStyles(themeTokens, themeOptions, inactive),
243
247
  onFocus: handleFocus,
244
248
  onBlur: handleBlur,
245
249
  onMouseOver: handleMouseOver,
@@ -0,0 +1,188 @@
1
+ import React, { forwardRef } from 'react';
2
+ import Platform from "react-native-web/dist/exports/Platform";
3
+ import Pressable from "react-native-web/dist/exports/Pressable";
4
+ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
5
+ import Text from "react-native-web/dist/exports/Text";
6
+ import PropTypes from 'prop-types';
7
+ import { useThemeTokensCallback } from '../ThemeProvider';
8
+ import { a11yProps, clickProps, getTokensPropType, linkProps, resolvePressableTokens, selectSystemProps, variantProp, withLinkRouter } from '../utils';
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, linkProps]); // ensure explicit selection of tokens
11
+
12
+ const selectStyles = _ref => {
13
+ let {
14
+ backgroundColor,
15
+ outlineColor,
16
+ outlineOffset,
17
+ outlineStyle,
18
+ outlineWidth,
19
+ paddingHorizontal,
20
+ paddingVertical,
21
+ borderRadius
22
+ } = _ref;
23
+ return {
24
+ backgroundColor,
25
+ outlineColor,
26
+ outlineOffset,
27
+ outlineStyle,
28
+ outlineWidth,
29
+ paddingHorizontal,
30
+ paddingVertical,
31
+ borderRadius
32
+ };
33
+ };
34
+
35
+ const selectTextStyles = _ref2 => {
36
+ let {
37
+ color
38
+ } = _ref2;
39
+ return {
40
+ color
41
+ };
42
+ };
43
+ /**
44
+ * A generic Skip link component, unstyled by default.
45
+ * A Skip link component help keyboard-only users, screen reader users to skip
46
+ * sections and navigate to the content they want.
47
+ *
48
+ * ## Component API
49
+ *
50
+ * For common uses, pass a `href` that is a # link to a DOM id that can be skipped to (web only).
51
+ *
52
+ * The element with this ID should be focusable, e.g. `<Box nativeID="skip-target" focusable>`.
53
+ *
54
+ * Other custom behaviour may be set by passing an `onPress` function, and routers may be integrated
55
+ * in the same way as other navigation-related components by passing a `LinkRouter`; but a # anchor
56
+ * href on web and/or a `targetRef` for cross-platform applications is the recommended approach.
57
+ *
58
+ * ## Visible styling
59
+ *
60
+ * When focused, the skip link shows as a visible element similar to a simplified ButtonLink using
61
+ * UDS theming. The `tokens` prop may be used to override these styles.
62
+ *
63
+ * To control the background of a skip link, the following tokens can be used:
64
+ *
65
+ * - `backgroundColor`
66
+ * *
67
+ * In order to control the color of the skip link text, the following tokens can be used:
68
+ *
69
+ * - `color`
70
+ *
71
+ * ### Padding
72
+ *
73
+ * The following padding tokens can be used:
74
+ *
75
+ * - `paddingHorizontal`
76
+ * - `paddingVertical`
77
+ *
78
+ * ### Outline
79
+ *
80
+ * The following tokens to control the outline:
81
+ *
82
+ * - `outlineColor`
83
+ * - `outlineOffset`
84
+ * - `outlineStyle`
85
+ * - `outlineWidth`
86
+ *
87
+ * ## Usability and A11y guidelines
88
+ *
89
+ * - The skip link component is visually hidden until a keyboard press activates it.
90
+ * - Usually, you should place the skip link immediately after the opening <body> tag.
91
+ * - This lets users bypass top-level navigation links and jump to the main content on a page.
92
+ * - Also consider using SkipLink before a complex feature containing many focusable elements.
93
+ *
94
+ * ## Accessibility
95
+ *
96
+ * Skip link supports all the common a11y and link props.
97
+ */
98
+
99
+
100
+ const SkipLink = /*#__PURE__*/forwardRef((_ref3, ref) => {
101
+ let {
102
+ tokens,
103
+ variant,
104
+ href,
105
+ children,
106
+ ...rawRest
107
+ } = _ref3;
108
+ const {
109
+ onPress,
110
+ ...rest
111
+ } = clickProps.toPressProps(rawRest);
112
+ const getTokens = useThemeTokensCallback('SkipLink', tokens, variant);
113
+ const defaultTokens = getTokens();
114
+
115
+ const resolveLinkTokens = pressState => resolvePressableTokens(defaultTokens, pressState);
116
+
117
+ const handlePress = event => {
118
+ if (typeof onPress === 'function') onPress(event); // TODO - support native apps with something based on refs and/or setAccessibilityFocus
119
+ };
120
+
121
+ return /*#__PURE__*/_jsx(Pressable, {
122
+ ref: ref,
123
+ accessibilityRole: "link",
124
+ onPress: handlePress,
125
+ href: href,
126
+ style: _ref4 => {
127
+ let {
128
+ focused: focus
129
+ } = _ref4;
130
+ const themeTokens = getTokens({
131
+ focus
132
+ });
133
+ const skipLinkStyle = selectStyles(themeTokens);
134
+ return [staticStyles.absolute, skipLinkStyle, !focus && staticStyles.hidden];
135
+ },
136
+ ...selectProps(rest),
137
+ children: pressState => {
138
+ const themeTokens = resolveLinkTokens(pressState);
139
+ const textStyles = selectTextStyles(themeTokens);
140
+ return /*#__PURE__*/_jsx(Text, {
141
+ style: [textStyles, staticStyles.baseline],
142
+ children: children
143
+ });
144
+ }
145
+ });
146
+ });
147
+ SkipLink.displayName = 'SkipLink';
148
+ SkipLink.propTypes = { ...selectedSystemPropTypes,
149
+
150
+ /**
151
+ * The text content shown or read out when the SkipLink is focused, usually a string.
152
+ */
153
+ children: PropTypes.node,
154
+
155
+ /**
156
+ * The target to skip to. Usually an anchor link to a section id (e.g. href="#main-section").
157
+ */
158
+ href: PropTypes.string,
159
+ tokens: getTokensPropType('SkipLink'),
160
+ variant: variantProp.propType
161
+ };
162
+ const staticStyles = StyleSheet.create({
163
+ baseline: {
164
+ alignSelf: 'baseline'
165
+ },
166
+ absolute: {
167
+ margin: 0,
168
+ position: 'absolute',
169
+ top: 0,
170
+ left: 0
171
+ },
172
+ hidden: {
173
+ overflow: 'hidden',
174
+ ...Platform.select({
175
+ web: {
176
+ clip: 'rect(0 0 0 0)',
177
+ clipPath: 'inset(50%)'
178
+ },
179
+ default: {
180
+ // width / height of 0 would make it non-focusable
181
+ height: 1,
182
+ width: 1,
183
+ opacity: 0
184
+ }
185
+ })
186
+ }
187
+ });
188
+ export default withLinkRouter(SkipLink);
@@ -0,0 +1,2 @@
1
+ import SkipLink from './SkipLink';
2
+ export default SkipLink;
@@ -6,7 +6,7 @@ import View from "react-native-web/dist/exports/View";
6
6
  import StackView from '../StackView';
7
7
  import Icon from '../Icon';
8
8
  import { a11yProps, getTokensPropType, selectSystemProps, variantProp, viewProps } from '../utils';
9
- import { applyTextStyles } from '../ThemeProvider';
9
+ import { applyTextStyles, useTheme } from '../ThemeProvider';
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
12
12
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
@@ -110,7 +110,7 @@ const selectLabelContainerStyles = _ref5 => {
110
110
  };
111
111
  };
112
112
 
113
- const selectLabelStyles = (_ref6, isCurrent) => {
113
+ const selectLabelStyles = (_ref6, themeOptions, isCurrent) => {
114
114
  let {
115
115
  labelColor,
116
116
  labelCurrentColor,
@@ -125,7 +125,8 @@ const selectLabelStyles = (_ref6, isCurrent) => {
125
125
  fontSize: labelFontSize,
126
126
  lineHeight: labelLineHeight,
127
127
  fontWeight: isCurrent ? labelCurrentFontWeight : labelFontWeight,
128
- fontName: labelFontName
128
+ fontName: labelFontName,
129
+ themeOptions
129
130
  });
130
131
  };
131
132
 
@@ -166,6 +167,9 @@ const Step = _ref7 => {
166
167
  const isCompleted = status > stepIndex;
167
168
  const isCurrent = status === stepIndex;
168
169
  const isActive = isCompleted || isCurrent;
170
+ const {
171
+ themeOptions
172
+ } = useTheme();
169
173
  return /*#__PURE__*/_jsxs(StackView, {
170
174
  space: 0,
171
175
  tokens: {
@@ -200,12 +204,12 @@ const Step = _ref7 => {
200
204
  }), showStepLabel && /*#__PURE__*/_jsxs(View, {
201
205
  style: [staticStyles.stepLabelContainer, selectLabelContainerStyles(tokens)],
202
206
  children: [showStepName && /*#__PURE__*/_jsx(Text, {
203
- style: [staticStyles.centeredText, selectLabelStyles(tokens, isCurrent)],
207
+ style: [staticStyles.centeredText, selectLabelStyles(tokens, themeOptions, isCurrent)],
204
208
  children: name
205
209
  }), /*#__PURE__*/_jsx(StackView, {
206
210
  direction: "row",
207
211
  children: /*#__PURE__*/_jsx(Text, {
208
- style: [staticStyles.centeredText, tokens.labelDirection === 'column' && staticStyles.wrappingLabel, selectLabelStyles(tokens, isCurrent)],
212
+ style: [staticStyles.centeredText, tokens.labelDirection === 'column' && staticStyles.wrappingLabel, selectLabelStyles(tokens, themeOptions, isCurrent)],
209
213
  children: label
210
214
  })
211
215
  })]
@@ -4,7 +4,7 @@ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
4
4
  import Text from "react-native-web/dist/exports/Text";
5
5
  import View from "react-native-web/dist/exports/View";
6
6
  import StackView from '../StackView';
7
- import { applyTextStyles, useThemeTokens } from '../ThemeProvider';
7
+ import { applyTextStyles, useTheme, useThemeTokens } from '../ThemeProvider';
8
8
  import { a11yProps, getTokensPropType, selectSystemProps, variantProp, viewProps } from '../utils';
9
9
  import { useViewport } from '../ViewportProvider';
10
10
  import useCopy from '../utils/useCopy';
@@ -38,7 +38,7 @@ const selectStepTrackerLabelContainerStyles = _ref2 => {
38
38
  };
39
39
  };
40
40
 
41
- const selectStepTrackerLabelStyles = _ref3 => {
41
+ const selectStepTrackerLabelStyles = (_ref3, themeOptions) => {
42
42
  let {
43
43
  labelColor,
44
44
  labelFontSize,
@@ -51,7 +51,8 @@ const selectStepTrackerLabelStyles = _ref3 => {
51
51
  fontSize: labelFontSize,
52
52
  lineHeight: labelLineHeight,
53
53
  fontWeight: labelFontWeight,
54
- fontName: labelFontName
54
+ fontName: labelFontName,
55
+ themeOptions
55
56
  });
56
57
  };
57
58
  /**
@@ -113,6 +114,9 @@ const StepTracker = /*#__PURE__*/forwardRef((_ref4, ref) => {
113
114
 
114
115
  const getStepLabel = index => themeTokens.showStepLabel ? getCopy('stepLabel').replace('%{stepNumber}', index + 1) : '';
115
116
 
117
+ const {
118
+ themeOptions
119
+ } = useTheme();
116
120
  if (!steps.length) return null;
117
121
  const selectedProps = selectProps({
118
122
  accessibilityLabel: stepTrackerLabel,
@@ -147,7 +151,7 @@ const StepTracker = /*#__PURE__*/forwardRef((_ref4, ref) => {
147
151
  }), showStepTrackerLabel && /*#__PURE__*/_jsx(View, {
148
152
  style: [staticStyles.stepTrackerLabelContainer, selectStepTrackerLabelContainerStyles(themeTokens)],
149
153
  children: /*#__PURE__*/_jsx(Text, {
150
- style: selectStepTrackerLabelStyles(themeTokens),
154
+ style: selectStepTrackerLabelStyles(themeTokens, themeOptions),
151
155
  children: stepTrackerLabel
152
156
  })
153
157
  })]
@@ -5,7 +5,7 @@ import Pressable from "react-native-web/dist/exports/Pressable";
5
5
  import StyleSheet from "react-native-web/dist/exports/StyleSheet";
6
6
  import Text from "react-native-web/dist/exports/Text";
7
7
  import View from "react-native-web/dist/exports/View";
8
- import { applyTextStyles, useThemeTokensCallback } from '../ThemeProvider';
8
+ import { applyTextStyles, useTheme, useThemeTokensCallback } from '../ThemeProvider';
9
9
  import { a11yProps, clickProps, getTokensPropType, linkProps, resolvePressableTokens, selectSystemProps, selectTokens, variantProp, viewProps, withLinkRouter } from '../utils';
10
10
  import Spacer from '../Spacer';
11
11
  import { horizontalScrollUtils } from '../HorizontalScroll';
@@ -105,6 +105,9 @@ const TabsItem = /*#__PURE__*/forwardRef((_ref4, ref) => {
105
105
  onPress,
106
106
  ...rest
107
107
  } = clickProps.toPressProps(rawRest);
108
+ const {
109
+ themeOptions
110
+ } = useTheme();
108
111
  const getTokens = useThemeTokensCallback('TabsItem', tokens, variant);
109
112
 
110
113
  const resolveTokens = pressableState => resolvePressableTokens(getTokens, pressableState, {
@@ -170,6 +173,7 @@ const TabsItem = /*#__PURE__*/forwardRef((_ref4, ref) => {
170
173
  const highlightTriangleStyle = hasHighlightTriangle && selectHighlightTriangleStyles(themeTokens);
171
174
  const containerStyles = selectContainerStyles(themeTokens);
172
175
  const textStyles = applyTextStyles({ ...selectTokens('Typography', themeTokens),
176
+ themeOptions,
173
177
  textAlign
174
178
  });
175
179
  return /*#__PURE__*/_jsxs(View, {
@@ -4,13 +4,13 @@ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
4
4
  import NativeTextInput from "react-native-web/dist/exports/TextInput";
5
5
  import View from "react-native-web/dist/exports/View";
6
6
  import PropTypes from 'prop-types';
7
- import { applyTextStyles, useThemeTokens, applyOuterBorder } from '../ThemeProvider';
7
+ import { applyTextStyles, useTheme, useThemeTokens, applyOuterBorder } from '../ThemeProvider';
8
8
  import { a11yProps, getTokensPropType, selectSystemProps, textInputHandlerProps, textInputProps, useInputValue, variantProp, viewProps } from '../utils';
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
11
11
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, textInputHandlerProps, textInputProps, viewProps]);
12
12
 
13
- const selectInputStyles = (_ref, inactive) => {
13
+ const selectInputStyles = (_ref, themeOptions, inactive) => {
14
14
  let {
15
15
  backgroundColor,
16
16
  color,
@@ -41,7 +41,8 @@ const selectInputStyles = (_ref, inactive) => {
41
41
  fontName,
42
42
  fontSize,
43
43
  lineHeight,
44
- fontWeight
44
+ fontWeight,
45
+ themeOptions
45
46
  });
46
47
 
47
48
  function linesToHeight(lines) {
@@ -210,9 +211,12 @@ const TextInputBase = /*#__PURE__*/forwardRef((_ref5, ref) => {
210
211
  // Input could lead to changing its state from uncontrolled to controlled
211
212
  value: isControlled ? currentValue : undefined
212
213
  };
214
+ const {
215
+ themeOptions
216
+ } = useTheme();
213
217
  const nativeInputStyle = selectInputStyles({ ...themeTokens,
214
218
  height
215
- }, inactive);
219
+ }, themeOptions, inactive);
216
220
  return /*#__PURE__*/_jsxs(View, {
217
221
  style: selectOuterBorderStyles(themeTokens),
218
222
  children: [/*#__PURE__*/_jsx(NativeTextInput, {
@@ -1,6 +1,7 @@
1
1
  import React, { createContext, useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { validateThemeTokensVersion } from './utils';
4
+ import responsiveProps from '../utils/props/responsiveProps';
4
5
  import { jsx as _jsx } from "react/jsx-runtime";
5
6
  export const uninitialisedError = new Error('Theme context used outside of ThemeProvider');
6
7
  export const ThemeContext = /*#__PURE__*/createContext(uninitialisedError);
@@ -9,7 +10,11 @@ export const ThemeSetterContext = /*#__PURE__*/createContext(uninitialisedError)
9
10
  const ThemeProvider = _ref => {
10
11
  let {
11
12
  children,
12
- defaultTheme
13
+ defaultTheme,
14
+ // TODO: switch `forceAbsoluteFontSizing` to be false by default in the next major version
15
+ themeOptions = {
16
+ forceAbsoluteFontSizing: true
17
+ }
13
18
  } = _ref;
14
19
  const [theme, setTheme] = useState(defaultTheme); // Validate the theme tokens version on every render.
15
20
  // This will intentionally break the application when attempting to use an invalid theme.
@@ -19,7 +24,9 @@ const ThemeProvider = _ref => {
19
24
  return /*#__PURE__*/_jsx(ThemeSetterContext.Provider, {
20
25
  value: setTheme,
21
26
  children: /*#__PURE__*/_jsx(ThemeContext.Provider, {
22
- value: theme,
27
+ value: { ...theme,
28
+ themeOptions
29
+ },
23
30
  children: children
24
31
  })
25
32
  });
@@ -31,6 +38,20 @@ ThemeProvider.propTypes = {
31
38
  metadata: PropTypes.shape({
32
39
  themeTokensVersion: PropTypes.string.isRequired
33
40
  }).isRequired
34
- }).isRequired
41
+ }).isRequired,
42
+
43
+ /**
44
+ * An object containing options allowing to customize the theming experience:
45
+ *
46
+ * - `forceAbsoluteFontSizing`: available on web only; when set to true, allows
47
+ * using absolute font sizing (in pixels, doesn't scale) instead of the
48
+ * relative sizing (in `rem`, scales depending on the browser settings)
49
+ * - `contentMaxWidth`: allows configuration of the content max width to be used in components
50
+ * such as Footnote and Notification to avoid content to stretch width more then the page's width
51
+ */
52
+ themeOptions: PropTypes.shape({
53
+ forceAbsoluteFontSizing: PropTypes.bool,
54
+ contentMaxWidth: responsiveProps.getTypeOptionallyByViewport(PropTypes.number)
55
+ })
35
56
  };
36
57
  export default ThemeProvider;
@@ -14,14 +14,21 @@ export function applyTextStyles(_ref) {
14
14
  fontWeight = '400',
15
15
  fontName,
16
16
  fontStyle = 'normal',
17
+ themeOptions = {
18
+ // TODO: switch `forceAbsoluteFontSizing` to be false by default in the next major version
19
+ forceAbsoluteFontSizing: true
20
+ },
17
21
  ...rest
18
22
  } = _ref;
19
23
  const styles = { ...rest
20
24
  };
25
+ const {
26
+ forceAbsoluteFontSizing
27
+ } = themeOptions;
21
28
 
22
29
  if (fontSize) {
23
30
  // If relative font sizes are needed, catch and calculate them here
24
- styles.fontSize = fontSize;
31
+ styles.fontSize = Platform.OS === 'web' && !forceAbsoluteFontSizing ? "".concat(fontSize / fontBasePixels, "rem") : fontSize;
25
32
  }
26
33
 
27
34
  if (typeof lineHeight === 'number') {
@@ -158,6 +158,6 @@ export const validateThemeTokensVersion = theme => {
158
158
  const actualThemeTokensVersion = theme === null || theme === void 0 ? void 0 : (_theme$metadata2 = theme.metadata) === null || _theme$metadata2 === void 0 ? void 0 : _theme$metadata2.themeTokensVersion;
159
159
 
160
160
  if (!semVerSatisfies(actualThemeTokensVersion, expectedThemeTokensVersion)) {
161
- throw new Error("Invalid UDS token schema version detected.\n\nThe UDS base components ".concat(pkg.name, " v").concat(pkg.version, " are only compatible with UDS themes that are built with @telus-uds/system-theme-tokens version that is semver compatible with ").concat(expectedThemeTokensVersion, ". The current theme was built with @telus-uds/system-theme-tokens v").concat(actualThemeTokensVersion, ".\n\nIf you see this error than most likely you have attempted to install ").concat(pkg.name, " and a UDS theme manually because you are building a multi-brand application. If you are building a single brand application, consider installing the brand specific design system package such as @telus-uds/ds-allium. For more information, see https://github.com/telus/universal-design-system/blob/main/packages/docs-uds/docs/multi-brand-usage.md"));
161
+ throw new Error("Invalid UDS token schema version detected.\n\nThe UDS base components ".concat(pkg.name, " v").concat(pkg.version, " are only compatible with UDS themes that are built with @telus-uds/system-theme-tokens version that is semver compatible with ").concat(expectedThemeTokensVersion, ". The current theme was built with @telus-uds/system-theme-tokens v").concat(actualThemeTokensVersion, ".\n\nIf you see this error than most likely you have attempted to install ").concat(pkg.name, " and a UDS theme manually because you are building a multi-brand application. If you are building a single brand application, consider installing the brand specific design system package such as @telus-uds/ds-allium. For more information, see https://github.com/telus/universal-design-system/blob/main/docs/docs/multi-brand-usage.md"));
162
162
  }
163
163
  };
@@ -25,6 +25,7 @@ const ToggleSwitchGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
25
25
  inactive = false,
26
26
  feedback,
27
27
  hint,
28
+ hintPosition = 'inline',
28
29
  tooltip,
29
30
  legend,
30
31
  name: inputGroupName,
@@ -110,6 +111,7 @@ const ToggleSwitchGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
110
111
  legend: legend,
111
112
  tooltip: tooltip,
112
113
  hint: hint,
114
+ hintPosition: hintPosition,
113
115
  space: fieldSpace,
114
116
  feedback: feedback,
115
117
  inactive: inactive,
@@ -192,6 +194,11 @@ ToggleSwitchGroup.propTypes = { ...selectedSystemPropTypes,
192
194
  */
193
195
  hint: PropTypes.string,
194
196
 
197
+ /**
198
+ * Position of the hint relative to label. Use `below` to display a larger hint below the label.
199
+ */
200
+ hintPosition: PropTypes.oneOf(['inline', 'below']),
201
+
195
202
  /**
196
203
  * Optional tooltip text content to include alongside the legend and hint.
197
204
  */
@@ -2,7 +2,7 @@ import React, { forwardRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import Text from "react-native-web/dist/exports/Text";
4
4
  import View from "react-native-web/dist/exports/View";
5
- import { useThemeTokens } from '../ThemeProvider';
5
+ import { useTheme, useThemeTokens } from '../ThemeProvider';
6
6
  import { useViewport } from '../ViewportProvider';
7
7
  import { applyTextStyles } from '../ThemeProvider/utils';
8
8
  import { a11yProps, variantProp, getTokensPropType, getMaxFontMultiplier, headingTags, selectSystemProps, textTags, textProps, viewProps, getA11yPropsFromHtmlTag } from '../utils';
@@ -14,7 +14,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
14
14
  const [selectContainerProps, selectedContainerPropTypes] = selectSystemProps([a11yProps, viewProps]);
15
15
  const [selectTextProps, selectedTextPropTypes] = selectSystemProps([textProps]);
16
16
 
17
- const selectTextStyles = _ref => {
17
+ const selectTextStyles = (_ref, themeOptions) => {
18
18
  let {
19
19
  fontWeight,
20
20
  fontSize,
@@ -31,6 +31,7 @@ const selectTextStyles = _ref => {
31
31
  color,
32
32
  lineHeight,
33
33
  fontName,
34
+ themeOptions,
34
35
  textAlign,
35
36
  textTransform,
36
37
  letterSpacing
@@ -55,10 +56,13 @@ const Typography = /*#__PURE__*/forwardRef((_ref2, ref) => {
55
56
  const themeTokens = useThemeTokens('Typography', tokens, variant, {
56
57
  viewport
57
58
  });
59
+ const {
60
+ themeOptions
61
+ } = useTheme();
58
62
  const resolvedTextProps = { ...selectTextProps(rest),
59
63
  style: selectTextStyles(align ? { ...themeTokens,
60
64
  textAlign: align
61
- } : themeTokens),
65
+ } : themeTokens, themeOptions),
62
66
  dataSet,
63
67
  maxFontSizeMultiplier: getMaxFontMultiplier(themeTokens)
64
68
  };
@@ -32,6 +32,7 @@ export { default as Search } from './Search';
32
32
  export { default as Select } from './Select';
33
33
  export { default as SideNav } from './SideNav';
34
34
  export { default as Skeleton } from './Skeleton';
35
+ export { default as SkipLink } from './SkipLink';
35
36
  export { default as Spacer } from './Spacer';
36
37
  export { default as StackView } from './StackView';
37
38
  export * from './StackView';
@@ -9,6 +9,7 @@ export { default as useCopy } from './useCopy';
9
9
  export { default as useHash } from './useHash';
10
10
  export { default as useSpacingScale } from './useSpacingScale';
11
11
  export { default as useResponsiveProp } from './useResponsiveProp';
12
+ export { default as useScrollBlocking } from './useScrollBlocking';
12
13
  export * from './useResponsiveProp';
13
14
  export { default as useUniqueId } from './useUniqueId';
14
15
  export { default as withLinkRouter } from './withLinkRouter';