@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
@@ -3,7 +3,7 @@ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
3
3
  import Text from "react-native-web/dist/exports/Text";
4
4
  import View from "react-native-web/dist/exports/View";
5
5
  import PropTypes from 'prop-types';
6
- import { applyTextStyles, useThemeTokens } from '../ThemeProvider';
6
+ import { applyTextStyles, useTheme, useThemeTokens } from '../ThemeProvider';
7
7
  import { a11yProps, getTokensPropType, selectSystemProps, selectTokens, variantProp, viewProps } from '../utils';
8
8
  import LabelContent from './LabelContent';
9
9
  import Tooltip from '../Tooltip';
@@ -12,9 +12,11 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
12
12
  import { Fragment as _Fragment } from "react/jsx-runtime";
13
13
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
14
14
 
15
- const selectLabelStyles = tokens => applyTextStyles(selectTokens('Typography', tokens));
15
+ const selectLabelStyles = (tokens, themeOptions) => applyTextStyles({ ...selectTokens('Typography', tokens),
16
+ themeOptions
17
+ });
16
18
 
17
- const selectHintStyles = _ref => {
19
+ const selectHintStyles = (_ref, themeOptions) => {
18
20
  let {
19
21
  hintColor,
20
22
  hintFontName,
@@ -27,7 +29,8 @@ const selectHintStyles = _ref => {
27
29
  fontName: hintFontName,
28
30
  fontSize: hintFontSize,
29
31
  fontWeight: hintFontWeight,
30
- lineHeight: hintLineHeight
32
+ lineHeight: hintLineHeight,
33
+ themeOptions
31
34
  });
32
35
  };
33
36
 
@@ -56,19 +59,22 @@ const InputLabel = /*#__PURE__*/forwardRef((_ref3, ref) => {
56
59
  const themeTokens = useThemeTokens('InputLabel', tokens, variant);
57
60
  const hasTooltip = tooltip !== undefined;
58
61
  const isHintInline = hintPosition === 'inline';
62
+ const {
63
+ themeOptions
64
+ } = useTheme();
59
65
  return /*#__PURE__*/_jsxs(_Fragment, {
60
66
  children: [/*#__PURE__*/_jsxs(View, {
61
67
  ref: ref,
62
68
  style: staticStyles.container,
63
69
  ...selectProps(rest),
64
70
  children: [/*#__PURE__*/_jsx(Text, {
65
- style: [selectLabelStyles(themeTokens), selectGapStyles(themeTokens), staticStyles.label],
71
+ style: [selectLabelStyles(themeTokens, themeOptions), selectGapStyles(themeTokens), staticStyles.label],
66
72
  children: /*#__PURE__*/_jsx(LabelContent, {
67
73
  forId: forId,
68
74
  children: label
69
75
  })
70
76
  }), hint && isHintInline && /*#__PURE__*/_jsx(Text, {
71
- style: [selectHintStyles(themeTokens), hasTooltip && selectGapStyles(themeTokens), staticStyles.label],
77
+ style: [selectHintStyles(themeTokens, themeOptions), hasTooltip && selectGapStyles(themeTokens), staticStyles.label],
72
78
  nativeID: hintId,
73
79
  children: hint
74
80
  }), hasTooltip && /*#__PURE__*/_jsx(View, {
@@ -16,7 +16,8 @@ const InputSupports = /*#__PURE__*/forwardRef((_ref, ref) => {
16
16
  hintPosition = 'inline',
17
17
  feedback,
18
18
  tooltip,
19
- validation
19
+ validation,
20
+ nativeID
20
21
  } = _ref;
21
22
  const {
22
23
  space
@@ -30,7 +31,8 @@ const InputSupports = /*#__PURE__*/forwardRef((_ref, ref) => {
30
31
  feedback,
31
32
  hint,
32
33
  label,
33
- validation
34
+ validation,
35
+ nativeID
34
36
  });
35
37
  return /*#__PURE__*/_jsxs(StackView, {
36
38
  space: space,
@@ -91,6 +93,11 @@ InputSupports.propTypes = {
91
93
  /**
92
94
  * Use to visually mark an input as valid or invalid.
93
95
  */
94
- validation: PropTypes.oneOf(['error', 'success'])
96
+ validation: PropTypes.oneOf(['error', 'success']),
97
+
98
+ /**
99
+ * ID for DOM element on web
100
+ */
101
+ nativeID: PropTypes.string
95
102
  };
96
103
  export default InputSupports;
@@ -7,7 +7,8 @@ const useInputSupports = _ref => {
7
7
  label,
8
8
  feedback,
9
9
  validation,
10
- hint
10
+ hint,
11
+ nativeID
11
12
  } = _ref;
12
13
  const hasValidationError = validation === 'error';
13
14
  const inputId = useUniqueId('input');
@@ -22,7 +23,7 @@ const useInputSupports = _ref => {
22
23
  accessibilityInvalid: hasValidationError
23
24
  };
24
25
  return {
25
- inputId,
26
+ inputId: nativeID || inputId,
26
27
  hintId,
27
28
  feedbackId,
28
29
  a11yProps
@@ -7,7 +7,7 @@ import { a11yProps, clickProps, getTokensPropType, hrefAttrsProp, linkProps, sel
7
7
  import { resolvePressableTokens } from '../utils/pressability';
8
8
  import { withLinkRouter } from '../utils';
9
9
  import InlinePressable from './InlinePressable';
10
- import { applyTextStyles, applyOuterBorder } from '../ThemeProvider';
10
+ import { applyTextStyles, applyOuterBorder, useTheme } from '../ThemeProvider';
11
11
  import { IconText, iconComponentPropTypes } from '../Icon';
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, linkProps, viewProps]);
@@ -53,7 +53,7 @@ const selectTextStyles = _ref2 => {
53
53
  };
54
54
  };
55
55
 
56
- const selectBlockStyles = _ref3 => {
56
+ const selectBlockStyles = (_ref3, themeOptions) => {
57
57
  let {
58
58
  blockFontWeight,
59
59
  blockFontSize,
@@ -64,7 +64,8 @@ const selectBlockStyles = _ref3 => {
64
64
  fontWeight: blockFontWeight,
65
65
  fontSize: blockFontSize,
66
66
  lineHeight: blockLineHeight,
67
- fontName: blockFontName
67
+ fontName: blockFontName,
68
+ themeOptions
68
69
  });
69
70
  };
70
71
 
@@ -164,6 +165,9 @@ const LinkBase = /*#__PURE__*/forwardRef((_ref6, ref) => {
164
165
  const hasIcon = Boolean(icon || defaultThemeTokens.icon); // On web, this makes focus rings wrap only the link, not the entire block
165
166
 
166
167
  const blockLeftStyle = Platform.OS === 'web' && staticStyles.blockLeft;
168
+ const {
169
+ themeOptions
170
+ } = useTheme();
167
171
  return /*#__PURE__*/_jsx(InlinePressable, { ...selectedProps,
168
172
  inline: hasIcon // assuming links without icons should be inline (even if they are long)
169
173
  ,
@@ -180,7 +184,7 @@ const LinkBase = /*#__PURE__*/forwardRef((_ref6, ref) => {
180
184
  const iconTokens = selectIconTokens(themeTokens); // TODO: may need to apply some smarter text inheritance here if inline to avoid native
181
185
  // issues like double-application of line heights breaking align-items: baseline
182
186
 
183
- const blockTextStyles = selectBlockStyles(themeTokens);
187
+ const blockTextStyles = selectBlockStyles(themeTokens, themeOptions);
184
188
  const IconComponent = icon || themeTokens.icon;
185
189
  const {
186
190
  iconSpace
@@ -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 { useThemeTokens, applyTextStyles } from '../ThemeProvider';
6
+ import { useTheme, useThemeTokens, applyTextStyles } from '../ThemeProvider';
7
7
  import { a11yProps, getTokensPropType, selectSystemProps, variantProp, viewProps, wrapStringsInText } from '../utils';
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
9
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -68,7 +68,7 @@ const selectBulletPositioningStyles = _ref5 => {
68
68
  };
69
69
  };
70
70
 
71
- const selectItemStyles = _ref6 => {
71
+ const selectItemStyles = (_ref6, themeOptions) => {
72
72
  let {
73
73
  itemFontWeight,
74
74
  itemFontSize,
@@ -79,7 +79,8 @@ const selectItemStyles = _ref6 => {
79
79
  fontWeight: itemFontWeight,
80
80
  fontSize: itemFontSize,
81
81
  lineHeight: itemLineHeight,
82
- fontName: itemFontName
82
+ fontName: itemFontName,
83
+ themeOptions
83
84
  });
84
85
  };
85
86
 
@@ -127,7 +128,10 @@ const ListItem = /*#__PURE__*/forwardRef((_ref9, ref) => {
127
128
  ...rest
128
129
  } = _ref9;
129
130
  const themeTokens = useThemeTokens('List', tokens, variant);
130
- const itemStyles = selectItemStyles(themeTokens);
131
+ const {
132
+ themeOptions
133
+ } = useTheme();
134
+ const itemStyles = selectItemStyles(themeTokens, themeOptions);
131
135
  const itemBlockStyles = selectItemBlockStyles(themeTokens);
132
136
  const dividerStyles = selectDividerStyles(themeTokens);
133
137
  const itemBulletContainerStyles = selectBulletContainerStyles(themeTokens);
@@ -10,6 +10,7 @@ import { a11yProps, copyPropTypes, getTokensPropType, selectSystemProps, useCopy
10
10
  import { useViewport } from '../ViewportProvider';
11
11
  import IconButton from '../IconButton';
12
12
  import dictionary from './dictionary';
13
+ import useScrollBlocking from '../utils/useScrollBlocking';
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
14
15
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
16
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
@@ -110,6 +111,7 @@ const Modal = /*#__PURE__*/forwardRef((_ref5, ref) => {
110
111
  viewport,
111
112
  maxWidth
112
113
  });
114
+ const modalRef = useScrollBlocking(isOpen);
113
115
  const {
114
116
  closeIcon: CloseIconComponent
115
117
  } = themeTokens;
@@ -140,6 +142,7 @@ const Modal = /*#__PURE__*/forwardRef((_ref5, ref) => {
140
142
  ...selectProps(rest),
141
143
  children: /*#__PURE__*/_jsxs(View, {
142
144
  style: [staticStyles.positioningContainer],
145
+ ref: modalRef,
143
146
  children: [/*#__PURE__*/_jsx(View, {
144
147
  style: [staticStyles.sizingContainer, selectContainerStyles(themeTokens)],
145
148
  pointerEvents: "box-none" // don't capture backdrop press events
@@ -2,7 +2,7 @@ import React, { forwardRef, useState } from 'react';
2
2
  import StyleSheet from "react-native-web/dist/exports/StyleSheet";
3
3
  import View from "react-native-web/dist/exports/View";
4
4
  import PropTypes from 'prop-types';
5
- import { applyTextStyles, useThemeTokens } from '../ThemeProvider';
5
+ import { applyTextStyles, useTheme, useThemeTokens } from '../ThemeProvider';
6
6
  import { a11yProps, getTokensPropType, selectSystemProps, selectTokens, variantProp, viewProps, wrapStringsInText } from '../utils';
7
7
  import ButtonBase from '../Button/ButtonBase';
8
8
  import useCopy from '../utils/useCopy';
@@ -14,7 +14,9 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
14
14
  const selectContainerStyles = tokens => ({ ...tokens
15
15
  });
16
16
 
17
- const selectTextStyles = tokens => applyTextStyles(selectTokens('Typography', tokens));
17
+ const selectTextStyles = (tokens, themeOptions) => applyTextStyles({ ...selectTokens('Typography', tokens),
18
+ themeOptions
19
+ });
18
20
 
19
21
  const selectIconProps = _ref => {
20
22
  let {
@@ -126,12 +128,15 @@ const Notification = /*#__PURE__*/forwardRef((_ref5, ref) => {
126
128
  dictionary,
127
129
  copy
128
130
  });
131
+ const {
132
+ themeOptions
133
+ } = useTheme();
129
134
 
130
135
  if (isDismissed) {
131
136
  return null;
132
137
  }
133
138
 
134
- const textStyles = selectTextStyles(themeTokens);
139
+ const textStyles = selectTextStyles(themeTokens, themeOptions);
135
140
  const content = wrapStringsInText(typeof children === 'function' ? children({
136
141
  textStyles
137
142
  }) : children, {
@@ -3,7 +3,7 @@ import View from "react-native-web/dist/exports/View";
3
3
  import Text from "react-native-web/dist/exports/Text";
4
4
  import StyleSheet from "react-native-web/dist/exports/StyleSheet";
5
5
  import { a11yProps, componentPropType, copyPropTypes, getTokensPropType, selectSystemProps, variantProp, viewProps, withLinkRouter } from '../utils';
6
- import { applyTextStyles, useThemeTokens } from '../ThemeProvider';
6
+ import { applyTextStyles, useTheme, useThemeTokens } from '../ThemeProvider';
7
7
  import { useViewport } from '../ViewportProvider';
8
8
  import Box from '../Box';
9
9
  import usePagination from './usePagination';
@@ -12,7 +12,7 @@ import SideButton from './SideButton';
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
14
14
 
15
- const selectTextStyles = _ref => {
15
+ const selectTextStyles = (_ref, themeOptions) => {
16
16
  let {
17
17
  color,
18
18
  fontName,
@@ -25,7 +25,8 @@ const selectTextStyles = _ref => {
25
25
  fontName,
26
26
  fontSize,
27
27
  fontWeight,
28
- lineHeight
28
+ lineHeight,
29
+ themeOptions
29
30
  });
30
31
  };
31
32
 
@@ -49,6 +50,9 @@ const Pagination = /*#__PURE__*/forwardRef((_ref2, ref) => {
49
50
  } = useThemeTokens('Pagination', tokens, variant, {
50
51
  viewport
51
52
  });
53
+ const {
54
+ themeOptions
55
+ } = useTheme();
52
56
  const items = React.Children.toArray(children);
53
57
  const {
54
58
  isItemActive,
@@ -63,7 +67,7 @@ const Pagination = /*#__PURE__*/forwardRef((_ref2, ref) => {
63
67
  items,
64
68
  truncateAbove
65
69
  });
66
- const ellipsisTextStyles = selectTextStyles(themeTokens);
70
+ const ellipsisTextStyles = selectTextStyles(themeTokens, themeOptions);
67
71
 
68
72
  if (items.length === 0) {
69
73
  return null;
@@ -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,
@@ -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,
@@ -19,6 +19,7 @@ const selectSkeletonStyles = _ref => {
19
19
  return {
20
20
  backgroundColor: color,
21
21
  borderRadius: radius,
22
+ maxWidth: '100%',
22
23
  ...fadeAnimation
23
24
  };
24
25
  };
@@ -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,26 +151,25 @@ 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
  })]
154
158
  })
155
159
  });
156
160
  });
157
- StepTracker.displayName = 'StepTracker';
161
+ StepTracker.displayName = 'StepTracker'; // If a language dictionary entry is provided, it must contain every key
162
+
163
+ const dictionaryContentShape = PropTypes.shape({
164
+ stepLabel: PropTypes.string.isRequired,
165
+ stepTrackerLabel: PropTypes.string.isRequired
166
+ });
158
167
  StepTracker.propTypes = { ...selectedSystemPropTypes,
159
168
  current: PropTypes.number,
160
- copy: PropTypes.oneOf(['en', 'fr']),
169
+ copy: PropTypes.oneOfType([PropTypes.oneOf(['en', 'fr']), dictionaryContentShape]),
161
170
  dictionary: PropTypes.shape({
162
- en: PropTypes.shape({
163
- stepLabel: PropTypes.string,
164
- stepTrackerLabel: PropTypes.string
165
- }),
166
- fr: PropTypes.shape({
167
- stepLabel: PropTypes.string,
168
- stepTrackerLabel: PropTypes.string
169
- })
171
+ en: dictionaryContentShape,
172
+ fr: dictionaryContentShape
170
173
  }),
171
174
  steps: PropTypes.arrayOf(PropTypes.string),
172
175
  tokens: getTokensPropType('StepTracker'),
@@ -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, {
@@ -40,7 +40,9 @@ const TextInput = /*#__PURE__*/forwardRef((_ref, ref) => {
40
40
  validation: supportsProps.validation
41
41
  }
42
42
  };
43
- return /*#__PURE__*/_jsx(InputSupports, { ...supportsProps,
43
+ return /*#__PURE__*/_jsx(InputSupports, {
44
+ nativeID: selectedProps.nativeID,
45
+ ...supportsProps,
44
46
  children: _ref2 => {
45
47
  let {
46
48
  inputId,
@@ -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, {
@@ -9,7 +9,11 @@ export const ThemeSetterContext = /*#__PURE__*/createContext(uninitialisedError)
9
9
  const ThemeProvider = _ref => {
10
10
  let {
11
11
  children,
12
- defaultTheme
12
+ defaultTheme,
13
+ // TODO: switch `forceAbsoluteFontSizing` to be false by default in the next major version
14
+ themeOptions = {
15
+ forceAbsoluteFontSizing: true
16
+ }
13
17
  } = _ref;
14
18
  const [theme, setTheme] = useState(defaultTheme); // Validate the theme tokens version on every render.
15
19
  // This will intentionally break the application when attempting to use an invalid theme.
@@ -19,7 +23,9 @@ const ThemeProvider = _ref => {
19
23
  return /*#__PURE__*/_jsx(ThemeSetterContext.Provider, {
20
24
  value: setTheme,
21
25
  children: /*#__PURE__*/_jsx(ThemeContext.Provider, {
22
- value: theme,
26
+ value: { ...theme,
27
+ themeOptions
28
+ },
23
29
  children: children
24
30
  })
25
31
  });
@@ -31,6 +37,17 @@ ThemeProvider.propTypes = {
31
37
  metadata: PropTypes.shape({
32
38
  themeTokensVersion: PropTypes.string.isRequired
33
39
  }).isRequired
34
- }).isRequired
40
+ }).isRequired,
41
+
42
+ /**
43
+ * An object containing options allowing to customize the theming experience:
44
+ *
45
+ * - `forceAbsoluteFontSizing`: available on web only; when set to true, allows
46
+ * using absolute font sizing (in pixels, doesn't scale) instead of the
47
+ * relative sizing (in `rem`, scales depending on the browser settings)
48
+ */
49
+ themeOptions: PropTypes.shape({
50
+ forceAbsoluteFontSizing: PropTypes.bool
51
+ })
35
52
  };
36
53
  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') {