@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
@@ -0,0 +1,85 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import Pressable from "react-native-web/dist/exports/Pressable";
4
+ import Image from "react-native-web/dist/exports/Image";
5
+ import { useCarousel } from './CarouselContext';
6
+ /**
7
+ * `Carousel.Thumbnail` is used to wrap the content of an individual slide and is suppsoed to be the
8
+ * only top-level component passed to the `Carousel`
9
+ */
10
+
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+
13
+ const CarouselThumbnail = _ref => {
14
+ let {
15
+ accessibilityLabel,
16
+ alt,
17
+ index,
18
+ src
19
+ } = _ref;
20
+ const {
21
+ activeIndex,
22
+ itemLabel,
23
+ totalItems,
24
+ getCopyWithPlaceholders,
25
+ goTo,
26
+ themeTokens
27
+ } = useCarousel();
28
+ const thumbnailTitle = alt !== null && alt !== void 0 ? alt : getCopyWithPlaceholders('stepTrackerLabel').replace(/%\{itemLabel\}/g, itemLabel).replace(/%\{stepNumber\}/g, index).replace(/%\{stepCount\}/g, totalItems);
29
+
30
+ const handlePress = () => goTo(index);
31
+
32
+ const handleKeyDown = event => {
33
+ // Allow using the spacebar for navigation
34
+ if ((event === null || event === void 0 ? void 0 : event.key) === ' ') goTo(index);
35
+ };
36
+
37
+ const {
38
+ thumbnailBorderColor,
39
+ thumbnailBorderRadius,
40
+ thumbnailBorderWidth,
41
+ thumbnailMargin,
42
+ thumbnailPadding,
43
+ thumbnailSelectedBorderColor,
44
+ thumbnailSelectedBorderWidth,
45
+ thumbnailSize
46
+ } = themeTokens;
47
+ const styles = {
48
+ pressable: {
49
+ borderColor: thumbnailBorderColor,
50
+ borderRadius: thumbnailBorderRadius,
51
+ borderWidth: thumbnailBorderWidth,
52
+ margin: thumbnailMargin,
53
+ padding: thumbnailPadding
54
+ },
55
+ image: {
56
+ height: thumbnailSize,
57
+ width: thumbnailSize
58
+ },
59
+ selected: {
60
+ borderColor: thumbnailSelectedBorderColor,
61
+ borderWidth: thumbnailSelectedBorderWidth,
62
+ padding: thumbnailPadding - thumbnailSelectedBorderWidth + thumbnailBorderWidth
63
+ }
64
+ };
65
+ return /*#__PURE__*/_jsx(Pressable, {
66
+ onKeyDown: handleKeyDown,
67
+ onPress: handlePress,
68
+ style: [styles.pressable, index === activeIndex && styles.selected],
69
+ children: /*#__PURE__*/_jsx(Image, {
70
+ accessibilityIgnoresInvertColors: true,
71
+ accessibilityLabel: accessibilityLabel !== null && accessibilityLabel !== void 0 ? accessibilityLabel : alt,
72
+ source: src,
73
+ style: styles.image,
74
+ title: thumbnailTitle
75
+ })
76
+ }, src);
77
+ };
78
+
79
+ CarouselThumbnail.propTypes = {
80
+ accessibilityLabel: PropTypes.string,
81
+ alt: PropTypes.string,
82
+ index: PropTypes.number,
83
+ src: PropTypes.string
84
+ };
85
+ export default CarouselThumbnail;
@@ -0,0 +1,66 @@
1
+ import React, { forwardRef } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import View from "react-native-web/dist/exports/View";
4
+ import { useCarousel } from './CarouselContext';
5
+ import CarouselThumbnail from './CarouselThumbnail';
6
+ import { StackWrap } from '../StackView';
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ const CarouselThumbnailNavigation = /*#__PURE__*/forwardRef((_ref, ref) => {
9
+ let {
10
+ thumbnails = []
11
+ } = _ref;
12
+ const {
13
+ totalItems,
14
+ themeTokens
15
+ } = useCarousel();
16
+
17
+ if (thumbnails.length !== totalItems) {
18
+ throw new Error('Thumbnail set provided does not match the number of slides in the carousel');
19
+ }
20
+
21
+ const {
22
+ thumbnailContainerPaddingTop,
23
+ thumbnailMargin
24
+ } = themeTokens;
25
+ const stackWrapTokens = {
26
+ justifyContent: 'flex-start'
27
+ };
28
+ const containerStyles = {
29
+ justifyContent: 'center',
30
+ alignItems: 'center',
31
+ paddingTop: thumbnailContainerPaddingTop - thumbnailMargin
32
+ };
33
+ return /*#__PURE__*/_jsx(View, {
34
+ style: containerStyles,
35
+ children: /*#__PURE__*/_jsx(StackWrap, {
36
+ direction: "row",
37
+ tokens: stackWrapTokens,
38
+ ref: ref,
39
+ children: thumbnails.map((_ref2, index) => {
40
+ let {
41
+ accessibilityLabel,
42
+ alt,
43
+ src
44
+ } = _ref2;
45
+ return /*#__PURE__*/_jsx(CarouselThumbnail, {
46
+ accessibilityLabel: accessibilityLabel,
47
+ alt: alt,
48
+ index: index,
49
+ src: src
50
+ }, src);
51
+ })
52
+ })
53
+ });
54
+ });
55
+ CarouselThumbnailNavigation.displayName = 'CarouselThumbnailNavigation';
56
+ CarouselThumbnailNavigation.propTypes = {
57
+ /**
58
+ * An array of objects containing information on the thumbnail images.
59
+ */
60
+ thumbnails: PropTypes.arrayOf(PropTypes.shape({
61
+ accessibilityLabel: PropTypes.string,
62
+ alt: PropTypes.string,
63
+ src: PropTypes.string
64
+ })).isRequired
65
+ };
66
+ export default CarouselThumbnailNavigation;
@@ -4,13 +4,15 @@ export default {
4
4
  carouselLabel: '%{stepCount} items',
5
5
  iconButtonLabel: 'Show %{itemLabel} %{targetStep} of %{stepCount}',
6
6
  stepLabel: '%{itemLabel} %{stepNumber}',
7
- stepTrackerLabel: '%{itemLabel} %{stepNumber} of %{stepCount}'
7
+ stepTrackerLabel: '%{itemLabel} %{stepNumber} of %{stepCount}',
8
+ skipLink: 'Skip %{title}'
8
9
  },
9
10
  fr: {
10
11
  // TODO: French translations here
11
12
  carouselLabel: '(fr) %{stepCount} items',
12
13
  iconButtonLabel: '(fr) Show %{itemLabel} %{targetStep} of %{stepCount}',
13
14
  stepLabel: '(fr) %{itemLabel} %{stepNumber}',
14
- stepTrackerLabel: '(fr) %{itemLabel} %{stepNumber} of %{stepCount}'
15
+ stepTrackerLabel: '(fr) %{itemLabel} %{stepNumber} of %{stepCount}',
16
+ skipLink: '(fr) Skip %{title}'
15
17
  }
16
18
  };
@@ -1,2 +1,3 @@
1
1
  export * from './CarouselContext';
2
- export { default as Carousel } from './Carousel';
2
+ export { default as Carousel } from './Carousel';
3
+ export { default as CarouselTabs } from './CarouselTabs';
@@ -9,7 +9,7 @@ import CheckboxInput from './CheckboxInput';
9
9
  import CheckboxLabel from '../InputLabel/LabelContent';
10
10
  import Feedback from '../Feedback';
11
11
  import StackView from '../StackView';
12
- import { applyShadowToken, applyTextStyles, useThemeTokensCallback } from '../ThemeProvider';
12
+ import { applyShadowToken, applyTextStyles, useTheme, useThemeTokensCallback } from '../ThemeProvider';
13
13
  import { a11yProps, focusHandlerProps, getTokensPropType, selectSystemProps, useInputValue, variantProp, viewProps } from '../utils';
14
14
  import useUniqueId from '../utils/useUniqueId';
15
15
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -47,7 +47,7 @@ const selectInputStyles = (_ref, isChecked) => {
47
47
  };
48
48
  };
49
49
 
50
- const selectLabelStyles = _ref2 => {
50
+ const selectLabelStyles = (_ref2, themeOptions) => {
51
51
  let {
52
52
  labelColor,
53
53
  labelFontName,
@@ -63,7 +63,8 @@ const selectLabelStyles = _ref2 => {
63
63
  fontName: labelFontName,
64
64
  fontWeight: labelFontWeight,
65
65
  fontSize: labelFontSize,
66
- lineHeight: labelLineHeight
66
+ lineHeight: labelLineHeight,
67
+ themeOptions
67
68
  })
68
69
  };
69
70
  };
@@ -187,6 +188,9 @@ const Checkbox = /*#__PURE__*/forwardRef((_ref5, ref) => {
187
188
 
188
189
  const uniqueId = useUniqueId('checkbox');
189
190
  const inputId = id !== null && id !== void 0 ? id : uniqueId;
191
+ const {
192
+ themeOptions
193
+ } = useTheme();
190
194
  return /*#__PURE__*/_jsx(View, {
191
195
  style: staticStyles.wrapper,
192
196
  ref: ref,
@@ -218,7 +222,7 @@ const Checkbox = /*#__PURE__*/forwardRef((_ref5, ref) => {
218
222
  pressed
219
223
  });
220
224
  const iconTokens = selectIconTokens(stateTokens);
221
- const labelStyles = selectLabelStyles(stateTokens);
225
+ const labelStyles = selectLabelStyles(stateTokens, themeOptions);
222
226
  const alignWithLabel = label ? [staticStyles.alignWithLabel, {
223
227
  height: labelStyles.lineHeight
224
228
  }] : null;
@@ -46,7 +46,7 @@ const [selectItemProps, selectedItemPropTypes] = selectSystemProps([a11yProps, f
46
46
  * @example
47
47
  * ```jsx
48
48
  * <CheckboxGroup
49
- * initialCheckedId="check1"
49
+ * initialCheckedIds="check1"
50
50
  * items={[
51
51
  * { label: 'Checkbox 1', id: 'check1' },
52
52
  * { label: 'Checkbox 2', id: 'check2' },
@@ -67,6 +67,7 @@ const CheckboxGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
67
67
  legend,
68
68
  tooltip,
69
69
  hint,
70
+ hintPosition = 'inline',
70
71
  validation,
71
72
  feedback,
72
73
  initialCheckedIds,
@@ -133,6 +134,7 @@ const CheckboxGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
133
134
  legend: legend,
134
135
  tooltip: tooltip,
135
136
  hint: hint,
137
+ hintPosition: hintPosition,
136
138
  space: fieldSpace,
137
139
  feedback: feedback,
138
140
  inactive: inactive,
@@ -182,6 +184,11 @@ CheckboxGroup.propTypes = { ...selectedSystemPropTypes,
182
184
  */
183
185
  hint: PropTypes.string,
184
186
 
187
+ /**
188
+ * Position of the hint relative to label. Use `below` to display a larger hint below the label.
189
+ */
190
+ hintPosition: PropTypes.oneOf(['inline', 'below']),
191
+
185
192
  /**
186
193
  * Optional tooltip text content to include alongside the legend and hint.
187
194
  */
@@ -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 StackView from '../StackView';
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -12,24 +12,29 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
12
12
 
13
13
  const selectStyles = tokens => selectTokens('Feedback', tokens);
14
14
 
15
- const selectTitleTextStyles = _ref => {
15
+ const selectTitleTextStyles = (_ref, themeOptions) => {
16
16
  let {
17
17
  titleFontSize,
18
18
  ...tokens
19
19
  } = _ref;
20
- return applyTextStyles(selectTokens('Typography', { ...tokens,
21
- fontSize: titleFontSize
22
- }));
20
+ return applyTextStyles({ ...selectTokens('Typography', { ...tokens,
21
+ fontSize: titleFontSize,
22
+ themeOptions
23
+ }),
24
+ themeOptions
25
+ });
23
26
  };
24
27
 
25
- const selectContentTextStyles = _ref2 => {
28
+ const selectContentTextStyles = (_ref2, themeOptions) => {
26
29
  let {
27
30
  contentFontSize,
28
31
  ...tokens
29
32
  } = _ref2;
30
- return applyTextStyles(selectTokens('Typography', { ...tokens,
31
- fontSize: contentFontSize
32
- }));
33
+ return applyTextStyles({ ...selectTokens('Typography', { ...tokens,
34
+ fontSize: contentFontSize
35
+ }),
36
+ themeOptions
37
+ });
33
38
  };
34
39
 
35
40
  const selectIconTokens = _ref3 => {
@@ -90,8 +95,11 @@ const Feedback = /*#__PURE__*/forwardRef((_ref5, ref) => {
90
95
  const {
91
96
  icon: IconComponent
92
97
  } = themeTokens;
93
- const titleTextStyles = selectTitleTextStyles(themeTokens);
94
- const contentTextStyles = selectContentTextStyles(themeTokens);
98
+ const {
99
+ themeOptions
100
+ } = useTheme();
101
+ const titleTextStyles = selectTitleTextStyles(themeTokens, themeOptions);
102
+ const contentTextStyles = selectContentTextStyles(themeTokens, themeOptions);
95
103
  const content = typeof children === 'string' ? /*#__PURE__*/_jsx(Text, {
96
104
  style: contentTextStyles,
97
105
  children: children
@@ -51,6 +51,9 @@ const IconText = /*#__PURE__*/forwardRef((_ref, ref) => {
51
51
  });
52
52
  IconText.displayName = 'IconText';
53
53
  IconText.propTypes = {
54
+ /* eslint-disable react/no-unused-prop-types */
55
+ // eslint is having hard time seeing these props through forwardRef
56
+
54
57
  /**
55
58
  * Amount of space to separate the text content and icon. Uses the themes's spacing scale
56
59
  * (see useSpacingScale for more info).
@@ -79,5 +82,7 @@ IconText.propTypes = {
79
82
  * `<Typography>` component, or a component that renders `<Text>`.
80
83
  */
81
84
  children: PropTypes.node
85
+ /* eslint-enable react/no-unused-prop-types */
86
+
82
87
  };
83
88
  export default IconText;
@@ -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, {
@@ -9,8 +9,6 @@ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
9
9
  * InlinePressable is an alternative to React Native's Pressable that works better when nested
10
10
  * inline inside Text. It accepts the same props as React Native's Pressable.
11
11
  *
12
- * On Web it simply passes its props to Pressable and defaults to `inline-flex` instead of `flex`.
13
- *
14
12
  * @param {PressableProps} PressableProps
15
13
  */
16
14
  // React Native exports prop Types but not propTypes, use JSDoc types here rather than duplicate RN
@@ -21,12 +19,11 @@ const InlinePressable = /*#__PURE__*/forwardRef((_ref, ref) => {
21
19
  let {
22
20
  children,
23
21
  style,
24
- inline = false,
25
22
  ...props
26
23
  } = _ref;
27
24
  return /*#__PURE__*/_jsx(Pressable, {
28
25
  ref: ref,
29
- style: pressState => [staticStyles[inline ? 'inline' : 'inlineFlex'], typeof style === 'function' ? style(pressState) : style],
26
+ style: pressState => [staticStyles.inline, typeof style === 'function' ? style(pressState) : style],
30
27
  ...props,
31
28
  children: pressState => typeof children === 'function' ? children(pressState) : children
32
29
  });
@@ -34,11 +31,7 @@ const InlinePressable = /*#__PURE__*/forwardRef((_ref, ref) => {
34
31
  InlinePressable.displayName = 'InlinePressable';
35
32
  const staticStyles = StyleSheet.create({
36
33
  inline: {
37
- // Stop Pressable defaulting to (block) flex
38
34
  display: 'inline'
39
- },
40
- inlineFlex: {
41
- display: 'inline-flex'
42
35
  }
43
36
  });
44
37
  export default InlinePressable;
@@ -7,12 +7,12 @@ 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]);
14
14
 
15
- const selectOuterBorderStyles = _ref => {
15
+ const selectOuterBorderStyles = (_ref, hasIcon) => {
16
16
  let {
17
17
  outerBorderColor,
18
18
  outerBorderWidth,
@@ -33,7 +33,8 @@ const selectOuterBorderStyles = _ref => {
33
33
  }),
34
34
  // Stops focus ring stretching horizontally if parent has display: block
35
35
  // width: fit-content isn't supported on Firefox; can't cascade props like CSS `width: fit-content; width: --moz-fit-content;`
36
- display: 'inline-flex'
36
+ display: hasIcon ? 'inline-flex' : 'inline' // Stop Pressable defaulting to (block) flex
37
+
37
38
  } : {}
38
39
  );
39
40
  };
@@ -53,7 +54,7 @@ const selectTextStyles = _ref2 => {
53
54
  };
54
55
  };
55
56
 
56
- const selectBlockStyles = _ref3 => {
57
+ const selectBlockStyles = (_ref3, themeOptions) => {
57
58
  let {
58
59
  blockFontWeight,
59
60
  blockFontSize,
@@ -64,7 +65,8 @@ const selectBlockStyles = _ref3 => {
64
65
  fontWeight: blockFontWeight,
65
66
  fontSize: blockFontSize,
66
67
  lineHeight: blockLineHeight,
67
- fontName: blockFontName
68
+ fontName: blockFontName,
69
+ themeOptions
68
70
  });
69
71
  };
70
72
 
@@ -164,15 +166,16 @@ const LinkBase = /*#__PURE__*/forwardRef((_ref6, ref) => {
164
166
  const hasIcon = Boolean(icon || defaultThemeTokens.icon); // On web, this makes focus rings wrap only the link, not the entire block
165
167
 
166
168
  const blockLeftStyle = Platform.OS === 'web' && staticStyles.blockLeft;
169
+ const {
170
+ themeOptions
171
+ } = useTheme();
167
172
  return /*#__PURE__*/_jsx(InlinePressable, { ...selectedProps,
168
- inline: hasIcon // assuming links without icons should be inline (even if they are long)
169
- ,
170
173
  ref: ref,
171
174
  style: linkState => {
172
175
  const themeTokens = resolveLinkTokens(linkState);
173
- const outerBorderStyles = selectOuterBorderStyles(themeTokens);
176
+ const outerBorderStyles = selectOuterBorderStyles(themeTokens, hasIcon);
174
177
  const decorationStyles = selectDecorationStyles(themeTokens);
175
- return [outerBorderStyles, blockLeftStyle, decorationStyles, hasIcon && staticStyles.rowContainer];
178
+ return [outerBorderStyles, blockLeftStyle, decorationStyles, staticStyles.rowContainer];
176
179
  },
177
180
  children: linkState => {
178
181
  const themeTokens = resolveLinkTokens(linkState);
@@ -180,7 +183,7 @@ const LinkBase = /*#__PURE__*/forwardRef((_ref6, ref) => {
180
183
  const iconTokens = selectIconTokens(themeTokens); // TODO: may need to apply some smarter text inheritance here if inline to avoid native
181
184
  // issues like double-application of line heights breaking align-items: baseline
182
185
 
183
- const blockTextStyles = selectBlockStyles(themeTokens);
186
+ const blockTextStyles = selectBlockStyles(themeTokens, themeOptions);
184
187
  const IconComponent = icon || themeTokens.icon;
185
188
  const {
186
189
  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);
@@ -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;
@@ -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
  */