@telus-uds/components-base 1.12.1 → 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 (69) hide show
  1. package/CHANGELOG.md +20 -2
  2. package/component-docs.json +740 -33
  3. package/lib/Button/ButtonGroup.js +7 -0
  4. package/lib/Carousel/Carousel.js +69 -12
  5. package/lib/Carousel/CarouselContext.js +17 -11
  6. package/lib/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +73 -0
  7. package/lib/Carousel/CarouselTabs/CarouselTabs.js +70 -0
  8. package/lib/Carousel/CarouselTabs/CarouselTabsPanel.js +95 -0
  9. package/lib/Carousel/CarouselTabs/CarouselTabsPanelItem.js +148 -0
  10. package/lib/Carousel/CarouselTabs/index.js +13 -0
  11. package/lib/Carousel/CarouselThumbnail.js +99 -0
  12. package/lib/Carousel/CarouselThumbnailNavigation.js +87 -0
  13. package/lib/Carousel/dictionary.js +4 -2
  14. package/lib/Carousel/index.js +10 -1
  15. package/lib/Checkbox/CheckboxGroup.js +7 -0
  16. package/lib/Link/InlinePressable.js +1 -8
  17. package/lib/Link/LinkBase.js +5 -6
  18. package/lib/Radio/RadioGroup.js +8 -0
  19. package/lib/RadioCard/RadioCardGroup.js +7 -0
  20. package/lib/SkipLink/SkipLink.js +216 -0
  21. package/lib/SkipLink/index.js +13 -0
  22. package/lib/ThemeProvider/ThemeProvider.js +6 -1
  23. package/lib/ToggleSwitch/ToggleSwitchGroup.js +7 -0
  24. package/lib/index.js +9 -0
  25. package/lib-module/Button/ButtonGroup.js +7 -0
  26. package/lib-module/Carousel/Carousel.js +66 -11
  27. package/lib-module/Carousel/CarouselContext.js +17 -11
  28. package/lib-module/Carousel/CarouselFirstFocus/CarouselFirstFocus.js +51 -0
  29. package/lib-module/Carousel/CarouselTabs/CarouselTabs.js +50 -0
  30. package/lib-module/Carousel/CarouselTabs/CarouselTabsPanel.js +76 -0
  31. package/lib-module/Carousel/CarouselTabs/CarouselTabsPanelItem.js +126 -0
  32. package/lib-module/Carousel/CarouselTabs/index.js +2 -0
  33. package/lib-module/Carousel/CarouselThumbnail.js +85 -0
  34. package/lib-module/Carousel/CarouselThumbnailNavigation.js +66 -0
  35. package/lib-module/Carousel/dictionary.js +4 -2
  36. package/lib-module/Carousel/index.js +2 -1
  37. package/lib-module/Checkbox/CheckboxGroup.js +7 -0
  38. package/lib-module/Link/InlinePressable.js +1 -8
  39. package/lib-module/Link/LinkBase.js +5 -6
  40. package/lib-module/Radio/RadioGroup.js +8 -0
  41. package/lib-module/RadioCard/RadioCardGroup.js +7 -0
  42. package/lib-module/SkipLink/SkipLink.js +188 -0
  43. package/lib-module/SkipLink/index.js +2 -0
  44. package/lib-module/ThemeProvider/ThemeProvider.js +5 -1
  45. package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +7 -0
  46. package/lib-module/index.js +1 -0
  47. package/package.json +46 -47
  48. package/src/Button/ButtonGroup.jsx +6 -0
  49. package/src/Carousel/Carousel.jsx +68 -10
  50. package/src/Carousel/CarouselContext.jsx +22 -9
  51. package/src/Carousel/CarouselFirstFocus/CarouselFirstFocus.jsx +49 -0
  52. package/src/Carousel/CarouselTabs/CarouselTabs.jsx +37 -0
  53. package/src/Carousel/CarouselTabs/CarouselTabsPanel.jsx +69 -0
  54. package/src/Carousel/CarouselTabs/CarouselTabsPanelItem.jsx +119 -0
  55. package/src/Carousel/CarouselTabs/index.js +3 -0
  56. package/src/Carousel/CarouselThumbnail.jsx +77 -0
  57. package/src/Carousel/CarouselThumbnailNavigation.jsx +53 -0
  58. package/src/Carousel/dictionary.js +4 -2
  59. package/src/Carousel/index.js +1 -0
  60. package/src/Checkbox/CheckboxGroup.jsx +7 -0
  61. package/src/Link/InlinePressable.jsx +2 -8
  62. package/src/Link/LinkBase.jsx +7 -16
  63. package/src/Radio/RadioGroup.jsx +7 -0
  64. package/src/RadioCard/RadioCardGroup.jsx +6 -0
  65. package/src/SkipLink/SkipLink.jsx +179 -0
  66. package/src/SkipLink/index.js +3 -0
  67. package/src/ThemeProvider/ThemeProvider.jsx +7 -1
  68. package/src/ToggleSwitch/ToggleSwitchGroup.jsx +6 -0
  69. package/src/index.js +1 -0
@@ -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';
@@ -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
  */
@@ -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;
@@ -12,7 +12,7 @@ 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
  };
@@ -169,14 +170,12 @@ const LinkBase = /*#__PURE__*/forwardRef((_ref6, ref) => {
169
170
  themeOptions
170
171
  } = useTheme();
171
172
  return /*#__PURE__*/_jsx(InlinePressable, { ...selectedProps,
172
- inline: hasIcon // assuming links without icons should be inline (even if they are long)
173
- ,
174
173
  ref: ref,
175
174
  style: linkState => {
176
175
  const themeTokens = resolveLinkTokens(linkState);
177
- const outerBorderStyles = selectOuterBorderStyles(themeTokens);
176
+ const outerBorderStyles = selectOuterBorderStyles(themeTokens, hasIcon);
178
177
  const decorationStyles = selectDecorationStyles(themeTokens);
179
- return [outerBorderStyles, blockLeftStyle, decorationStyles, hasIcon && staticStyles.rowContainer];
178
+ return [outerBorderStyles, blockLeftStyle, decorationStyles, staticStyles.rowContainer];
180
179
  },
181
180
  children: linkState => {
182
181
  const themeTokens = resolveLinkTokens(linkState);
@@ -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
  */
@@ -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
  */
@@ -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;
@@ -1,6 +1,7 @@
1
1
  import React, { createContext, useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { validateThemeTokensVersion } from './utils';
4
+ import responsiveProps from '../utils/props/responsiveProps';
4
5
  import { jsx as _jsx } from "react/jsx-runtime";
5
6
  export const uninitialisedError = new Error('Theme context used outside of ThemeProvider');
6
7
  export const ThemeContext = /*#__PURE__*/createContext(uninitialisedError);
@@ -45,9 +46,12 @@ ThemeProvider.propTypes = {
45
46
  * - `forceAbsoluteFontSizing`: available on web only; when set to true, allows
46
47
  * using absolute font sizing (in pixels, doesn't scale) instead of the
47
48
  * relative sizing (in `rem`, scales depending on the browser settings)
49
+ * - `contentMaxWidth`: allows configuration of the content max width to be used in components
50
+ * such as Footnote and Notification to avoid content to stretch width more then the page's width
48
51
  */
49
52
  themeOptions: PropTypes.shape({
50
- forceAbsoluteFontSizing: PropTypes.bool
53
+ forceAbsoluteFontSizing: PropTypes.bool,
54
+ contentMaxWidth: responsiveProps.getTypeOptionallyByViewport(PropTypes.number)
51
55
  })
52
56
  };
53
57
  export default ThemeProvider;
@@ -25,6 +25,7 @@ const ToggleSwitchGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
25
25
  inactive = false,
26
26
  feedback,
27
27
  hint,
28
+ hintPosition = 'inline',
28
29
  tooltip,
29
30
  legend,
30
31
  name: inputGroupName,
@@ -110,6 +111,7 @@ const ToggleSwitchGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
110
111
  legend: legend,
111
112
  tooltip: tooltip,
112
113
  hint: hint,
114
+ hintPosition: hintPosition,
113
115
  space: fieldSpace,
114
116
  feedback: feedback,
115
117
  inactive: inactive,
@@ -192,6 +194,11 @@ ToggleSwitchGroup.propTypes = { ...selectedSystemPropTypes,
192
194
  */
193
195
  hint: PropTypes.string,
194
196
 
197
+ /**
198
+ * Position of the hint relative to label. Use `below` to display a larger hint below the label.
199
+ */
200
+ hintPosition: PropTypes.oneOf(['inline', 'below']),
201
+
195
202
  /**
196
203
  * Optional tooltip text content to include alongside the legend and hint.
197
204
  */
@@ -32,6 +32,7 @@ export { default as Search } from './Search';
32
32
  export { default as Select } from './Select';
33
33
  export { default as SideNav } from './SideNav';
34
34
  export { default as Skeleton } from './Skeleton';
35
+ export { default as SkipLink } from './SkipLink';
35
36
  export { default as Spacer } from './Spacer';
36
37
  export { default as StackView } from './StackView';
37
38
  export * from './StackView';
package/package.json CHANGED
@@ -1,21 +1,55 @@
1
1
  {
2
- "name": "@telus-uds/components-base",
3
- "version": "1.12.1",
2
+ "author": "TELUS Digital",
3
+ "browserslist": [
4
+ "extends @telus-uds/browserslist-config"
5
+ ],
6
+ "bugs": {
7
+ "url": "https://github.com/telus/universal-design-system/issues"
8
+ },
9
+ "dependencies": {
10
+ "airbnb-prop-types": "^2.16.0",
11
+ "@telus-uds/system-constants": "^1.0.4",
12
+ "@telus-uds/system-theme-tokens": "^2.2.0",
13
+ "lodash.debounce": "^4.0.8",
14
+ "lodash.merge": "^4.6.2",
15
+ "prop-types": "^15.7.2",
16
+ "react-native-picker-select": "^8.0.4",
17
+ "semver": "^7.3.5"
18
+ },
4
19
  "description": "Base components",
20
+ "devDependencies": {
21
+ "@storybook/addon-a11y": "^6.5.6",
22
+ "@storybook/addon-essentials": "^6.5.6",
23
+ "@storybook/cli": "^6.5.6",
24
+ "@storybook/react": "^6.5.6",
25
+ "@storybook/builder-webpack5": "^6.5.6",
26
+ "@storybook/manager-webpack5": "^6.5.6",
27
+ "@telus-uds/browserslist-config": "^1.0.4",
28
+ "@testing-library/jest-native": "^4.0.1",
29
+ "@testing-library/react-hooks": "^7.0.1",
30
+ "@testing-library/react-native": "^7.2.0",
31
+ "react-test-renderer": "^16.3.2",
32
+ "webpack": "5.x"
33
+ },
34
+ "directories": {
35
+ "lib": "lib",
36
+ "test": "__tests__"
37
+ },
38
+ "homepage": "https://github.com/telus/universal-design-system#readme",
5
39
  "keywords": [
6
40
  "base"
7
41
  ],
8
- "author": "TELUS Digital",
9
- "homepage": "https://github.com/telus/universal-design-system#readme",
10
42
  "license": "UNLICENSED",
11
43
  "main": "lib/index.js",
12
44
  "module": "lib-module/index.js",
13
- "react-native": "src/index.js",
14
- "sideEffects": false,
15
- "directories": {
16
- "lib": "lib",
17
- "test": "__tests__"
45
+ "name": "@telus-uds/components-base",
46
+ "peerDependencies": {
47
+ "react": "^17.0.2",
48
+ "react-dom": "^17.0.2",
49
+ "react-native": "*",
50
+ "react-native-web": "~0.17.5"
18
51
  },
52
+ "react-native": "src/index.js",
19
53
  "repository": {
20
54
  "type": "git",
21
55
  "url": "git+https://github.com/telus/universal-design-system.git"
@@ -31,46 +65,11 @@
31
65
  "build:code": "npm run build:main && npm run build:module",
32
66
  "build:docs": "babel-node --plugins=@nearform/babel-plugin-react-docgen generate-component-docs.js",
33
67
  "storybook": "start-storybook",
34
- "build-storybook": "build-storybook",
35
- "dev": "npm run build:code --watch"
36
- },
37
- "bugs": {
38
- "url": "https://github.com/telus/universal-design-system/issues"
68
+ "build-storybook": "build-storybook"
39
69
  },
70
+ "sideEffects": false,
40
71
  "standard-engine": {
41
72
  "skip": true
42
73
  },
43
- "browserslist": [
44
- "extends @telus-uds/browserslist-config"
45
- ],
46
- "peerDependencies": {
47
- "react": "^17.0.2",
48
- "react-dom": "^17.0.2",
49
- "react-native": "*",
50
- "react-native-web": "~0.17.5"
51
- },
52
- "devDependencies": {
53
- "@storybook/addon-a11y": "^6.5.6",
54
- "@storybook/addon-essentials": "^6.5.6",
55
- "@storybook/cli": "^6.5.6",
56
- "@storybook/react": "^6.5.6",
57
- "@storybook/builder-webpack5": "^6.5.6",
58
- "@storybook/manager-webpack5": "^6.5.6",
59
- "@telus-uds/browserslist-config": "^1.0.4",
60
- "@testing-library/jest-native": "^4.0.1",
61
- "@testing-library/react-hooks": "^7.0.1",
62
- "@testing-library/react-native": "^7.2.0",
63
- "react-test-renderer": "^16.3.2",
64
- "webpack": "5.x"
65
- },
66
- "dependencies": {
67
- "airbnb-prop-types": "^2.16.0",
68
- "@telus-uds/system-constants": "^1.0.4",
69
- "@telus-uds/system-theme-tokens": "^2.1.0",
70
- "lodash.debounce": "^4.0.8",
71
- "lodash.merge": "^4.6.2",
72
- "prop-types": "^15.7.2",
73
- "react-native-picker-select": "^8.0.4",
74
- "semver": "^7.3.5"
75
- }
74
+ "version": "1.13.0"
76
75
  }
@@ -45,6 +45,7 @@ const ButtonGroup = forwardRef(
45
45
  legend,
46
46
  tooltip,
47
47
  hint,
48
+ hintPosition = 'inline',
48
49
  validation,
49
50
  feedback,
50
51
  name: inputGroupName,
@@ -94,6 +95,7 @@ const ButtonGroup = forwardRef(
94
95
  legend={legend}
95
96
  tooltip={tooltip}
96
97
  hint={hint}
98
+ hintPosition={hintPosition}
97
99
  space={fieldSpace}
98
100
  feedback={feedback}
99
101
  readOnly={readOnly}
@@ -217,6 +219,10 @@ ButtonGroup.propTypes = {
217
219
  * Optional additional text giving more detail to help a user make a choice.
218
220
  */
219
221
  hint: PropTypes.string,
222
+ /**
223
+ * Position of the hint relative to label. Use `below` to display a larger hint below the label.
224
+ */
225
+ hintPosition: PropTypes.oneOf(['inline', 'below']),
220
226
  /**
221
227
  * Optional tooltip text content to include alongside the legend and hint.
222
228
  */