@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
@@ -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, {
@@ -27,8 +27,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
27
27
  * InlinePressable is an alternative to React Native's Pressable that works better when nested
28
28
  * inline inside Text. It accepts the same props as React Native's Pressable.
29
29
  *
30
- * On Web it simply passes its props to Pressable and defaults to `inline-flex` instead of `flex`.
31
- *
32
30
  * @param {PressableProps} PressableProps
33
31
  */
34
32
  // React Native exports prop Types but not propTypes, use JSDoc types here rather than duplicate RN
@@ -37,12 +35,11 @@ const InlinePressable = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
37
35
  let {
38
36
  children,
39
37
  style,
40
- inline = false,
41
38
  ...props
42
39
  } = _ref;
43
40
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
44
41
  ref: ref,
45
- style: pressState => [staticStyles[inline ? 'inline' : 'inlineFlex'], typeof style === 'function' ? style(pressState) : style],
42
+ style: pressState => [staticStyles.inline, typeof style === 'function' ? style(pressState) : style],
46
43
  ...props,
47
44
  children: pressState => typeof children === 'function' ? children(pressState) : children
48
45
  });
@@ -51,11 +48,7 @@ InlinePressable.displayName = 'InlinePressable';
51
48
 
52
49
  const staticStyles = _StyleSheet.default.create({
53
50
  inline: {
54
- // Stop Pressable defaulting to (block) flex
55
51
  display: 'inline'
56
- },
57
- inlineFlex: {
58
- display: 'inline-flex'
59
52
  }
60
53
  });
61
54
 
@@ -37,7 +37,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
37
37
 
38
38
  const [selectProps, selectedSystemPropTypes] = (0, _props.selectSystemProps)([_props.a11yProps, _props.linkProps, _props.viewProps]);
39
39
 
40
- const selectOuterBorderStyles = _ref => {
40
+ const selectOuterBorderStyles = (_ref, hasIcon) => {
41
41
  let {
42
42
  outerBorderColor,
43
43
  outerBorderWidth,
@@ -58,7 +58,8 @@ const selectOuterBorderStyles = _ref => {
58
58
  }),
59
59
  // Stops focus ring stretching horizontally if parent has display: block
60
60
  // width: fit-content isn't supported on Firefox; can't cascade props like CSS `width: fit-content; width: --moz-fit-content;`
61
- display: 'inline-flex'
61
+ display: hasIcon ? 'inline-flex' : 'inline' // Stop Pressable defaulting to (block) flex
62
+
62
63
  } : {}
63
64
  );
64
65
  };
@@ -78,7 +79,7 @@ const selectTextStyles = _ref2 => {
78
79
  };
79
80
  };
80
81
 
81
- const selectBlockStyles = _ref3 => {
82
+ const selectBlockStyles = (_ref3, themeOptions) => {
82
83
  let {
83
84
  blockFontWeight,
84
85
  blockFontSize,
@@ -89,7 +90,8 @@ const selectBlockStyles = _ref3 => {
89
90
  fontWeight: blockFontWeight,
90
91
  fontSize: blockFontSize,
91
92
  lineHeight: blockLineHeight,
92
- fontName: blockFontName
93
+ fontName: blockFontName,
94
+ themeOptions
93
95
  });
94
96
  };
95
97
 
@@ -192,15 +194,16 @@ const LinkBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
192
194
  const hasIcon = Boolean(icon || defaultThemeTokens.icon); // On web, this makes focus rings wrap only the link, not the entire block
193
195
 
194
196
  const blockLeftStyle = _Platform.default.OS === 'web' && staticStyles.blockLeft;
197
+ const {
198
+ themeOptions
199
+ } = (0, _ThemeProvider.useTheme)();
195
200
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InlinePressable.default, { ...selectedProps,
196
- inline: hasIcon // assuming links without icons should be inline (even if they are long)
197
- ,
198
201
  ref: ref,
199
202
  style: linkState => {
200
203
  const themeTokens = resolveLinkTokens(linkState);
201
- const outerBorderStyles = selectOuterBorderStyles(themeTokens);
204
+ const outerBorderStyles = selectOuterBorderStyles(themeTokens, hasIcon);
202
205
  const decorationStyles = selectDecorationStyles(themeTokens);
203
- return [outerBorderStyles, blockLeftStyle, decorationStyles, hasIcon && staticStyles.rowContainer];
206
+ return [outerBorderStyles, blockLeftStyle, decorationStyles, staticStyles.rowContainer];
204
207
  },
205
208
  children: linkState => {
206
209
  const themeTokens = resolveLinkTokens(linkState);
@@ -208,7 +211,7 @@ const LinkBase = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
208
211
  const iconTokens = selectIconTokens(themeTokens); // TODO: may need to apply some smarter text inheritance here if inline to avoid native
209
212
  // issues like double-application of line heights breaking align-items: baseline
210
213
 
211
- const blockTextStyles = selectBlockStyles(themeTokens);
214
+ const blockTextStyles = selectBlockStyles(themeTokens, themeOptions);
212
215
  const IconComponent = icon || themeTokens.icon;
213
216
  const {
214
217
  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);
@@ -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;
@@ -92,6 +92,7 @@ const RadioGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
92
92
  legend,
93
93
  tooltip,
94
94
  hint,
95
+ hintPosition = 'inline',
95
96
  validation,
96
97
  feedback,
97
98
  initialCheckedId,
@@ -141,6 +142,7 @@ const RadioGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
141
142
  };
142
143
 
143
144
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Radio.default, {
145
+ error: validation === 'error',
144
146
  ref: itemRef,
145
147
  id: radioId,
146
148
  checked: isChecked,
@@ -160,6 +162,7 @@ const RadioGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
160
162
  legend: legend,
161
163
  tooltip: tooltip,
162
164
  hint: hint,
165
+ hintPosition: hintPosition,
163
166
  space: fieldSpace,
164
167
  feedback: feedback,
165
168
  inactive: inactive,
@@ -215,6 +218,11 @@ RadioGroup.propTypes = { ...selectedSystemPropTypes,
215
218
  */
216
219
  hint: _propTypes.default.string,
217
220
 
221
+ /**
222
+ * Position of the hint relative to label. Use `below` to display a larger hint below the label.
223
+ */
224
+ hintPosition: _propTypes.default.oneOf(['inline', 'below']),
225
+
218
226
  /**
219
227
  * Optional tooltip text content to include alongside the legend and hint.
220
228
  */
@@ -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,
@@ -92,6 +92,7 @@ const RadioCardGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
92
92
  legend,
93
93
  tooltip,
94
94
  hint,
95
+ hintPosition = 'inline',
95
96
  validation,
96
97
  feedback,
97
98
  initialCheckedId,
@@ -136,6 +137,7 @@ const RadioCardGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
136
137
  legend: legend,
137
138
  tooltip: tooltip,
138
139
  hint: hint,
140
+ hintPosition: hintPosition,
139
141
  space: fieldSpace,
140
142
  feedback: feedback,
141
143
  inactive: inactive || readOnly,
@@ -221,6 +223,11 @@ RadioCardGroup.propTypes = { ...selectedSystemPropTypes,
221
223
  */
222
224
  hint: _propTypes.default.string,
223
225
 
226
+ /**
227
+ * Position of the hint relative to label. Use `below` to display a larger hint below the label.
228
+ */
229
+ hintPosition: _propTypes.default.oneOf(['inline', 'below']),
230
+
224
231
  /**
225
232
  * Optional tooltip text content to include alongside the legend and hint.
226
233
  */
@@ -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,
@@ -0,0 +1,216 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _Platform = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Platform"));
11
+
12
+ var _Pressable = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Pressable"));
13
+
14
+ var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
15
+
16
+ var _Text = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Text"));
17
+
18
+ var _propTypes = _interopRequireDefault(require("prop-types"));
19
+
20
+ var _ThemeProvider = require("../ThemeProvider");
21
+
22
+ var _utils = require("../utils");
23
+
24
+ var _jsxRuntime = require("react/jsx-runtime");
25
+
26
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
+
28
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
29
+
30
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
+
32
+ const [selectProps, selectedSystemPropTypes] = (0, _utils.selectSystemProps)([_utils.a11yProps, _utils.linkProps]); // ensure explicit selection of tokens
33
+
34
+ const selectStyles = _ref => {
35
+ let {
36
+ backgroundColor,
37
+ outlineColor,
38
+ outlineOffset,
39
+ outlineStyle,
40
+ outlineWidth,
41
+ paddingHorizontal,
42
+ paddingVertical,
43
+ borderRadius
44
+ } = _ref;
45
+ return {
46
+ backgroundColor,
47
+ outlineColor,
48
+ outlineOffset,
49
+ outlineStyle,
50
+ outlineWidth,
51
+ paddingHorizontal,
52
+ paddingVertical,
53
+ borderRadius
54
+ };
55
+ };
56
+
57
+ const selectTextStyles = _ref2 => {
58
+ let {
59
+ color
60
+ } = _ref2;
61
+ return {
62
+ color
63
+ };
64
+ };
65
+ /**
66
+ * A generic Skip link component, unstyled by default.
67
+ * A Skip link component help keyboard-only users, screen reader users to skip
68
+ * sections and navigate to the content they want.
69
+ *
70
+ * ## Component API
71
+ *
72
+ * For common uses, pass a `href` that is a # link to a DOM id that can be skipped to (web only).
73
+ *
74
+ * The element with this ID should be focusable, e.g. `<Box nativeID="skip-target" focusable>`.
75
+ *
76
+ * Other custom behaviour may be set by passing an `onPress` function, and routers may be integrated
77
+ * in the same way as other navigation-related components by passing a `LinkRouter`; but a # anchor
78
+ * href on web and/or a `targetRef` for cross-platform applications is the recommended approach.
79
+ *
80
+ * ## Visible styling
81
+ *
82
+ * When focused, the skip link shows as a visible element similar to a simplified ButtonLink using
83
+ * UDS theming. The `tokens` prop may be used to override these styles.
84
+ *
85
+ * To control the background of a skip link, the following tokens can be used:
86
+ *
87
+ * - `backgroundColor`
88
+ * *
89
+ * In order to control the color of the skip link text, the following tokens can be used:
90
+ *
91
+ * - `color`
92
+ *
93
+ * ### Padding
94
+ *
95
+ * The following padding tokens can be used:
96
+ *
97
+ * - `paddingHorizontal`
98
+ * - `paddingVertical`
99
+ *
100
+ * ### Outline
101
+ *
102
+ * The following tokens to control the outline:
103
+ *
104
+ * - `outlineColor`
105
+ * - `outlineOffset`
106
+ * - `outlineStyle`
107
+ * - `outlineWidth`
108
+ *
109
+ * ## Usability and A11y guidelines
110
+ *
111
+ * - The skip link component is visually hidden until a keyboard press activates it.
112
+ * - Usually, you should place the skip link immediately after the opening <body> tag.
113
+ * - This lets users bypass top-level navigation links and jump to the main content on a page.
114
+ * - Also consider using SkipLink before a complex feature containing many focusable elements.
115
+ *
116
+ * ## Accessibility
117
+ *
118
+ * Skip link supports all the common a11y and link props.
119
+ */
120
+
121
+
122
+ const SkipLink = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
123
+ let {
124
+ tokens,
125
+ variant,
126
+ href,
127
+ children,
128
+ ...rawRest
129
+ } = _ref3;
130
+
131
+ const {
132
+ onPress,
133
+ ...rest
134
+ } = _utils.clickProps.toPressProps(rawRest);
135
+
136
+ const getTokens = (0, _ThemeProvider.useThemeTokensCallback)('SkipLink', tokens, variant);
137
+ const defaultTokens = getTokens();
138
+
139
+ const resolveLinkTokens = pressState => (0, _utils.resolvePressableTokens)(defaultTokens, pressState);
140
+
141
+ const handlePress = event => {
142
+ if (typeof onPress === 'function') onPress(event); // TODO - support native apps with something based on refs and/or setAccessibilityFocus
143
+ };
144
+
145
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Pressable.default, {
146
+ ref: ref,
147
+ accessibilityRole: "link",
148
+ onPress: handlePress,
149
+ href: href,
150
+ style: _ref4 => {
151
+ let {
152
+ focused: focus
153
+ } = _ref4;
154
+ const themeTokens = getTokens({
155
+ focus
156
+ });
157
+ const skipLinkStyle = selectStyles(themeTokens);
158
+ return [staticStyles.absolute, skipLinkStyle, !focus && staticStyles.hidden];
159
+ },
160
+ ...selectProps(rest),
161
+ children: pressState => {
162
+ const themeTokens = resolveLinkTokens(pressState);
163
+ const textStyles = selectTextStyles(themeTokens);
164
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.default, {
165
+ style: [textStyles, staticStyles.baseline],
166
+ children: children
167
+ });
168
+ }
169
+ });
170
+ });
171
+ SkipLink.displayName = 'SkipLink';
172
+ SkipLink.propTypes = { ...selectedSystemPropTypes,
173
+
174
+ /**
175
+ * The text content shown or read out when the SkipLink is focused, usually a string.
176
+ */
177
+ children: _propTypes.default.node,
178
+
179
+ /**
180
+ * The target to skip to. Usually an anchor link to a section id (e.g. href="#main-section").
181
+ */
182
+ href: _propTypes.default.string,
183
+ tokens: (0, _utils.getTokensPropType)('SkipLink'),
184
+ variant: _utils.variantProp.propType
185
+ };
186
+
187
+ const staticStyles = _StyleSheet.default.create({
188
+ baseline: {
189
+ alignSelf: 'baseline'
190
+ },
191
+ absolute: {
192
+ margin: 0,
193
+ position: 'absolute',
194
+ top: 0,
195
+ left: 0
196
+ },
197
+ hidden: {
198
+ overflow: 'hidden',
199
+ ..._Platform.default.select({
200
+ web: {
201
+ clip: 'rect(0 0 0 0)',
202
+ clipPath: 'inset(50%)'
203
+ },
204
+ default: {
205
+ // width / height of 0 would make it non-focusable
206
+ height: 1,
207
+ width: 1,
208
+ opacity: 0
209
+ }
210
+ })
211
+ }
212
+ });
213
+
214
+ var _default = (0, _utils.withLinkRouter)(SkipLink);
215
+
216
+ exports.default = _default;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _SkipLink = _interopRequireDefault(require("./SkipLink"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ var _default = _SkipLink.default;
13
+ exports.default = _default;