@telus-uds/components-base 1.12.0 → 1.14.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 +41 -2
  2. package/component-docs.json +933 -55
  3. package/lib/BaseProvider/index.js +7 -2
  4. package/lib/Button/ButtonBase.js +52 -19
  5. package/lib/Button/ButtonGroup.js +7 -0
  6. package/lib/Button/propTypes.js +18 -0
  7. package/lib/Carousel/Carousel.js +83 -58
  8. package/lib/Carousel/CarouselContext.js +22 -8
  9. package/lib/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +73 -0
  10. package/lib/Carousel/CarouselStepTracker/CarouselStepTracker.js +56 -0
  11. package/lib/Carousel/CarouselStepTracker/index.js +13 -0
  12. package/lib/Carousel/CarouselTabs/CarouselTabs.js +70 -0
  13. package/lib/Carousel/CarouselTabs/CarouselTabsPanel.js +95 -0
  14. package/lib/Carousel/CarouselTabs/CarouselTabsPanelItem.js +148 -0
  15. package/lib/Carousel/CarouselTabs/index.js +13 -0
  16. package/lib/Carousel/CarouselThumbnail.js +99 -0
  17. package/lib/Carousel/CarouselThumbnailNavigation.js +87 -0
  18. package/lib/Carousel/dictionary.js +4 -2
  19. package/lib/Carousel/index.js +10 -1
  20. package/lib/Checkbox/Checkbox.js +7 -3
  21. package/lib/Checkbox/CheckboxGroup.js +8 -1
  22. package/lib/Feedback/Feedback.js +18 -10
  23. package/lib/Icon/IconText.js +6 -1
  24. package/lib/InputLabel/InputLabel.js +11 -5
  25. package/lib/Link/InlinePressable.js +1 -8
  26. package/lib/Link/LinkBase.js +13 -10
  27. package/lib/List/ListItem.js +8 -4
  28. package/lib/Notification/Notification.js +44 -24
  29. package/lib/Pagination/Pagination.js +7 -3
  30. package/lib/Radio/RadioGroup.js +8 -0
  31. package/lib/RadioCard/RadioCard.js +6 -1
  32. package/lib/RadioCard/RadioCardGroup.js +7 -0
  33. package/lib/Select/Select.js +7 -3
  34. package/lib/SkipLink/SkipLink.js +216 -0
  35. package/lib/SkipLink/index.js +13 -0
  36. package/lib/StepTracker/Step.js +8 -4
  37. package/lib/StepTracker/StepTracker.js +7 -3
  38. package/lib/Tabs/TabsItem.js +4 -0
  39. package/lib/TextInput/TextInputBase.js +7 -3
  40. package/lib/ThemeProvider/ThemeProvider.js +25 -3
  41. package/lib/ThemeProvider/utils/styles.js +8 -1
  42. package/lib/ThemeProvider/utils/theme-tokens.js +1 -1
  43. package/lib/ToggleSwitch/ToggleSwitchGroup.js +7 -0
  44. package/lib/Typography/Typography.js +6 -2
  45. package/lib/index.js +9 -0
  46. package/lib-module/BaseProvider/index.js +7 -2
  47. package/lib-module/Button/ButtonBase.js +41 -9
  48. package/lib-module/Button/ButtonGroup.js +7 -0
  49. package/lib-module/Button/propTypes.js +17 -0
  50. package/lib-module/Carousel/Carousel.js +80 -57
  51. package/lib-module/Carousel/CarouselContext.js +21 -8
  52. package/lib-module/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +51 -0
  53. package/lib-module/Carousel/CarouselStepTracker/CarouselStepTracker.js +42 -0
  54. package/lib-module/Carousel/CarouselStepTracker/index.js +2 -0
  55. package/lib-module/Carousel/CarouselTabs/CarouselTabs.js +50 -0
  56. package/lib-module/Carousel/CarouselTabs/CarouselTabsPanel.js +76 -0
  57. package/lib-module/Carousel/CarouselTabs/CarouselTabsPanelItem.js +126 -0
  58. package/lib-module/Carousel/CarouselTabs/index.js +2 -0
  59. package/lib-module/Carousel/CarouselThumbnail.js +85 -0
  60. package/lib-module/Carousel/CarouselThumbnailNavigation.js +66 -0
  61. package/lib-module/Carousel/dictionary.js +4 -2
  62. package/lib-module/Carousel/index.js +2 -1
  63. package/lib-module/Checkbox/Checkbox.js +8 -4
  64. package/lib-module/Checkbox/CheckboxGroup.js +8 -1
  65. package/lib-module/Feedback/Feedback.js +19 -11
  66. package/lib-module/Icon/IconText.js +6 -1
  67. package/lib-module/InputLabel/InputLabel.js +12 -6
  68. package/lib-module/Link/InlinePressable.js +1 -8
  69. package/lib-module/Link/LinkBase.js +14 -11
  70. package/lib-module/List/ListItem.js +9 -5
  71. package/lib-module/Notification/Notification.js +46 -26
  72. package/lib-module/Pagination/Pagination.js +8 -4
  73. package/lib-module/Radio/RadioGroup.js +8 -0
  74. package/lib-module/RadioCard/RadioCard.js +7 -2
  75. package/lib-module/RadioCard/RadioCardGroup.js +7 -0
  76. package/lib-module/Select/Select.js +8 -4
  77. package/lib-module/SkipLink/SkipLink.js +188 -0
  78. package/lib-module/SkipLink/index.js +2 -0
  79. package/lib-module/StepTracker/Step.js +9 -5
  80. package/lib-module/StepTracker/StepTracker.js +8 -4
  81. package/lib-module/Tabs/TabsItem.js +5 -1
  82. package/lib-module/TextInput/TextInputBase.js +8 -4
  83. package/lib-module/ThemeProvider/ThemeProvider.js +24 -3
  84. package/lib-module/ThemeProvider/utils/styles.js +8 -1
  85. package/lib-module/ThemeProvider/utils/theme-tokens.js +1 -1
  86. package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +7 -0
  87. package/lib-module/Typography/Typography.js +7 -3
  88. package/lib-module/index.js +1 -0
  89. package/package.json +46 -47
  90. package/src/BaseProvider/index.jsx +6 -3
  91. package/src/Button/ButtonBase.jsx +36 -12
  92. package/src/Button/ButtonGroup.jsx +6 -0
  93. package/src/Button/propTypes.js +14 -0
  94. package/src/Carousel/Carousel.jsx +91 -64
  95. package/src/Carousel/CarouselContext.jsx +29 -5
  96. package/src/Carousel/CarouselFirstFocus/CarouselFirstFocus.jsx +49 -0
  97. package/src/Carousel/CarouselStepTracker/CarouselStepTracker.jsx +36 -0
  98. package/src/Carousel/CarouselStepTracker/index.js +3 -0
  99. package/src/Carousel/CarouselTabs/CarouselTabs.jsx +37 -0
  100. package/src/Carousel/CarouselTabs/CarouselTabsPanel.jsx +69 -0
  101. package/src/Carousel/CarouselTabs/CarouselTabsPanelItem.jsx +119 -0
  102. package/src/Carousel/CarouselTabs/index.js +3 -0
  103. package/src/Carousel/CarouselThumbnail.jsx +77 -0
  104. package/src/Carousel/CarouselThumbnailNavigation.jsx +53 -0
  105. package/src/Carousel/dictionary.js +4 -2
  106. package/src/Carousel/index.js +1 -0
  107. package/src/Checkbox/Checkbox.jsx +14 -11
  108. package/src/Checkbox/CheckboxGroup.jsx +8 -1
  109. package/src/Feedback/Feedback.jsx +14 -7
  110. package/src/Icon/IconText.jsx +3 -1
  111. package/src/InputLabel/InputLabel.jsx +13 -12
  112. package/src/Link/InlinePressable.jsx +2 -8
  113. package/src/Link/LinkBase.jsx +18 -21
  114. package/src/List/ListItem.jsx +10 -5
  115. package/src/Notification/Notification.jsx +40 -23
  116. package/src/Pagination/Pagination.jsx +6 -4
  117. package/src/Radio/RadioGroup.jsx +7 -0
  118. package/src/RadioCard/RadioCard.jsx +3 -2
  119. package/src/RadioCard/RadioCardGroup.jsx +6 -0
  120. package/src/Select/Select.jsx +12 -3
  121. package/src/SkipLink/SkipLink.jsx +179 -0
  122. package/src/SkipLink/index.js +3 -0
  123. package/src/StepTracker/Step.jsx +12 -4
  124. package/src/StepTracker/StepTracker.jsx +11 -10
  125. package/src/Tabs/TabsItem.jsx +3 -2
  126. package/src/TextInput/TextInputBase.jsx +11 -3
  127. package/src/ThemeProvider/ThemeProvider.jsx +22 -3
  128. package/src/ThemeProvider/utils/styles.js +9 -1
  129. package/src/ThemeProvider/utils/theme-tokens.js +1 -1
  130. package/src/ToggleSwitch/ToggleSwitchGroup.jsx +6 -0
  131. package/src/Typography/Typography.jsx +11 -12
  132. package/src/index.js +1 -0
@@ -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);
@@ -221,7 +225,7 @@ ListItem.propTypes = { ...selectedSystemPropTypes,
221
225
  /**
222
226
  * Renders side item icon
223
227
  */
224
- icon: PropTypes.func,
228
+ icon: PropTypes.elementType,
225
229
 
226
230
  /**
227
231
  * Will set display icon color
@@ -2,8 +2,8 @@ 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';
6
- import { a11yProps, getTokensPropType, selectSystemProps, selectTokens, variantProp, viewProps, wrapStringsInText } from '../utils';
5
+ import { applyTextStyles, useTheme, useThemeTokens } from '../ThemeProvider';
6
+ import { a11yProps, getTokensPropType, selectSystemProps, selectTokens, variantProp, viewProps, wrapStringsInText, useResponsiveProp } from '../utils';
7
7
  import ButtonBase from '../Button/ButtonBase';
8
8
  import useCopy from '../utils/useCopy';
9
9
  import dictionary from './dictionary';
@@ -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 {
@@ -55,6 +57,10 @@ const selectDismissButtonContainerStyles = _ref4 => {
55
57
  paddingLeft: dismissButtonGap
56
58
  };
57
59
  };
60
+
61
+ const selectContentContainerStyle = maxWidth => ({
62
+ width: maxWidth || '100%'
63
+ });
58
64
  /**
59
65
  * A banner that highlights important messages:
60
66
  * - Status message to show there is an error or outage of services
@@ -126,12 +132,16 @@ const Notification = /*#__PURE__*/forwardRef((_ref5, ref) => {
126
132
  dictionary,
127
133
  copy
128
134
  });
135
+ const {
136
+ themeOptions
137
+ } = useTheme();
138
+ const contentMaxWidth = useResponsiveProp(themeOptions === null || themeOptions === void 0 ? void 0 : themeOptions.contentMaxWidth);
129
139
 
130
140
  if (isDismissed) {
131
141
  return null;
132
142
  }
133
143
 
134
- const textStyles = selectTextStyles(themeTokens);
144
+ const textStyles = selectTextStyles(themeTokens, themeOptions);
135
145
  const content = wrapStringsInText(typeof children === 'function' ? children({
136
146
  textStyles
137
147
  }) : children, {
@@ -145,30 +155,33 @@ const Notification = /*#__PURE__*/forwardRef((_ref5, ref) => {
145
155
  const onDismissPress = () => setIsDismissed(true); // TODO: replace the dismiss button with IconButton when implemented (https://github.com/telus/universal-design-system/issues/281)
146
156
 
147
157
 
148
- return /*#__PURE__*/_jsxs(View, {
158
+ return /*#__PURE__*/_jsx(View, {
149
159
  ref: ref,
150
160
  style: [staticStyles.container, selectContainerStyles(themeTokens)],
151
161
  ...selectProps(rest),
152
- children: [IconComponent && /*#__PURE__*/_jsx(View, {
153
- style: selectIconContainerStyles(themeTokens),
154
- children: /*#__PURE__*/_jsx(IconComponent, { ...selectIconProps(themeTokens)
155
- })
156
- }), /*#__PURE__*/_jsx(View, {
157
- style: staticStyles.contentContainer,
158
- children: content && typeof content === 'function' ? content({
159
- textStyles,
160
- variant
161
- }) : content
162
- }), dismissible && DismissIconComponent && /*#__PURE__*/_jsx(View, {
163
- style: selectDismissButtonContainerStyles(themeTokens),
164
- children: /*#__PURE__*/_jsx(ButtonBase, {
165
- onPress: onDismissPress,
166
- accessibilityRole: "button",
167
- accessibilityLabel: getCopy('dismiss'),
168
- children: () => /*#__PURE__*/_jsx(DismissIconComponent, { ...selectDismissIconProps(themeTokens)
162
+ children: /*#__PURE__*/_jsxs(View, {
163
+ style: [staticStyles.content, selectContentContainerStyle(contentMaxWidth)],
164
+ children: [/*#__PURE__*/_jsxs(View, {
165
+ style: staticStyles.contentContainer,
166
+ children: [IconComponent && /*#__PURE__*/_jsx(View, {
167
+ style: selectIconContainerStyles(themeTokens),
168
+ children: /*#__PURE__*/_jsx(IconComponent, { ...selectIconProps(themeTokens)
169
+ })
170
+ }), content && typeof content === 'function' ? content({
171
+ textStyles,
172
+ variant
173
+ }) : content]
174
+ }), dismissible && DismissIconComponent && /*#__PURE__*/_jsx(View, {
175
+ style: selectDismissButtonContainerStyles(themeTokens),
176
+ children: /*#__PURE__*/_jsx(ButtonBase, {
177
+ onPress: onDismissPress,
178
+ accessibilityRole: "button",
179
+ accessibilityLabel: getCopy('dismiss'),
180
+ children: () => /*#__PURE__*/_jsx(DismissIconComponent, { ...selectDismissIconProps(themeTokens)
181
+ })
169
182
  })
170
- })
171
- })]
183
+ })]
184
+ })
172
185
  });
173
186
  });
174
187
  Notification.displayName = 'Notification';
@@ -201,9 +214,16 @@ Notification.propTypes = { ...selectedSystemPropTypes,
201
214
  export default Notification;
202
215
  const staticStyles = StyleSheet.create({
203
216
  container: {
204
- flexDirection: 'row'
217
+ flexDirection: 'row',
218
+ justifyContent: 'center'
205
219
  },
206
220
  contentContainer: {
207
- flex: 1
221
+ flexDirection: 'row',
222
+ flexShrink: 1
223
+ },
224
+ content: {
225
+ flexDirection: 'row',
226
+ flexShrink: 1,
227
+ justifyContent: 'space-between'
208
228
  }
209
229
  });
@@ -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;
@@ -69,6 +69,7 @@ const RadioGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
69
69
  legend,
70
70
  tooltip,
71
71
  hint,
72
+ hintPosition = 'inline',
72
73
  validation,
73
74
  feedback,
74
75
  initialCheckedId,
@@ -118,6 +119,7 @@ const RadioGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
118
119
  };
119
120
 
120
121
  return /*#__PURE__*/_jsx(Radio, {
122
+ error: validation === 'error',
121
123
  ref: itemRef,
122
124
  id: radioId,
123
125
  checked: isChecked,
@@ -137,6 +139,7 @@ const RadioGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
137
139
  legend: legend,
138
140
  tooltip: tooltip,
139
141
  hint: hint,
142
+ hintPosition: hintPosition,
140
143
  space: fieldSpace,
141
144
  feedback: feedback,
142
145
  inactive: inactive,
@@ -192,6 +195,11 @@ RadioGroup.propTypes = { ...selectedSystemPropTypes,
192
195
  */
193
196
  hint: PropTypes.string,
194
197
 
198
+ /**
199
+ * Position of the hint relative to label. Use `below` to display a larger hint below the label.
200
+ */
201
+ hintPosition: PropTypes.oneOf(['inline', 'below']),
202
+
195
203
  /**
196
204
  * Optional tooltip text content to include alongside the legend and hint.
197
205
  */
@@ -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, {