@telus-uds/components-base 1.8.1 → 1.8.4

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 (288) hide show
  1. package/CHANGELOG.md +35 -2
  2. package/component-docs.json +711 -669
  3. package/lib/A11yInfoProvider/index.js +4 -3
  4. package/lib/A11yText/index.js +6 -5
  5. package/lib/ActivityIndicator/Spinner.js +14 -13
  6. package/lib/ActivityIndicator/Spinner.native.js +10 -8
  7. package/lib/ActivityIndicator/index.js +6 -5
  8. package/lib/ActivityIndicator/shared.js +1 -1
  9. package/lib/BaseProvider/index.js +13 -10
  10. package/lib/Box/Box.js +20 -19
  11. package/lib/Button/Button.js +7 -6
  12. package/lib/Button/ButtonBase.js +97 -79
  13. package/lib/Button/ButtonGroup.js +34 -32
  14. package/lib/Button/ButtonLink.js +9 -7
  15. package/lib/Button/index.js +4 -4
  16. package/lib/Button/propTypes.js +1 -1
  17. package/lib/Card/Card.js +8 -7
  18. package/lib/Card/CardBase.js +35 -31
  19. package/lib/Card/PressableCardBase.js +14 -12
  20. package/lib/Checkbox/Checkbox.js +97 -83
  21. package/lib/Checkbox/CheckboxGroup.js +29 -27
  22. package/lib/Checkbox/CheckboxInput.js +12 -10
  23. package/lib/Divider/Divider.js +10 -9
  24. package/lib/ExpandCollapse/Control.js +42 -36
  25. package/lib/ExpandCollapse/ExpandCollapse.js +11 -10
  26. package/lib/ExpandCollapse/Panel.js +29 -40
  27. package/lib/Feedback/Feedback.js +48 -35
  28. package/lib/Fieldset/Fieldset.js +16 -15
  29. package/lib/Fieldset/FieldsetContainer.js +16 -13
  30. package/lib/Fieldset/FieldsetContainer.native.js +11 -8
  31. package/lib/Fieldset/Legend.js +10 -7
  32. package/lib/Fieldset/Legend.native.js +10 -7
  33. package/lib/FlexGrid/Col/Col.js +18 -17
  34. package/lib/FlexGrid/FlexGrid.js +15 -14
  35. package/lib/FlexGrid/Row/Row.js +13 -12
  36. package/lib/HorizontalScroll/HorizontalScroll.js +25 -20
  37. package/lib/HorizontalScroll/HorizontalScrollButton.js +18 -14
  38. package/lib/HorizontalScroll/ScrollViewEnd.js +6 -5
  39. package/lib/HorizontalScroll/ScrollViewEnd.native.js +12 -9
  40. package/lib/HorizontalScroll/itemPositions.js +19 -13
  41. package/lib/Icon/Icon.js +11 -10
  42. package/lib/Icon/IconText.js +8 -7
  43. package/lib/Icon/index.js +5 -5
  44. package/lib/IconButton/IconButton.js +50 -42
  45. package/lib/InputLabel/InputLabel.js +37 -30
  46. package/lib/InputLabel/LabelContent.js +12 -9
  47. package/lib/InputLabel/LabelContent.native.js +9 -6
  48. package/lib/InputSupports/InputSupports.js +11 -10
  49. package/lib/InputSupports/useInputSupports.js +7 -6
  50. package/lib/Link/ChevronLink.js +9 -8
  51. package/lib/Link/InlinePressable.js +13 -10
  52. package/lib/Link/InlinePressable.native.js +20 -16
  53. package/lib/Link/Link.js +10 -9
  54. package/lib/Link/LinkBase.js +96 -78
  55. package/lib/Link/TextButton.js +9 -8
  56. package/lib/List/List.js +20 -13
  57. package/lib/List/ListItem.js +103 -79
  58. package/lib/Modal/Modal.js +74 -60
  59. package/lib/Notification/Notification.js +46 -33
  60. package/lib/Pagination/PageButton.js +13 -12
  61. package/lib/Pagination/Pagination.js +43 -30
  62. package/lib/Pagination/SideButton.js +21 -18
  63. package/lib/Pagination/usePagination.js +7 -6
  64. package/lib/Progress/Progress.js +23 -19
  65. package/lib/Progress/ProgressBar.js +25 -21
  66. package/lib/Progress/ProgressBarBackground.js +7 -6
  67. package/lib/Radio/Radio.js +80 -69
  68. package/lib/Radio/RadioButton.js +63 -53
  69. package/lib/Radio/RadioGroup.js +30 -28
  70. package/lib/Radio/RadioInput.js +12 -10
  71. package/lib/RadioCard/RadioCard.js +16 -15
  72. package/lib/RadioCard/RadioCardGroup.js +30 -28
  73. package/lib/Search/Search.js +52 -32
  74. package/lib/Select/Group.js +5 -4
  75. package/lib/Select/Group.native.js +4 -3
  76. package/lib/Select/Item.js +10 -7
  77. package/lib/Select/Item.native.js +1 -9
  78. package/lib/Select/Picker.js +16 -15
  79. package/lib/Select/Picker.native.js +49 -38
  80. package/lib/Select/Select.js +134 -113
  81. package/lib/SideNav/Item.js +39 -33
  82. package/lib/SideNav/ItemContent.js +15 -12
  83. package/lib/SideNav/ItemsGroup.js +13 -11
  84. package/lib/SideNav/SideNav.js +21 -18
  85. package/lib/Skeleton/Skeleton.js +60 -44
  86. package/lib/Skeleton/skeleton.constant.js +1 -1
  87. package/lib/Skeleton/skeletonWebAnimation.js +1 -1
  88. package/lib/Spacer/Spacer.js +6 -5
  89. package/lib/StackView/StackView.js +12 -11
  90. package/lib/StackView/StackWrap.js +5 -3
  91. package/lib/StackView/StackWrapBox.js +12 -11
  92. package/lib/StackView/StackWrapGap.js +11 -10
  93. package/lib/StackView/common.js +14 -11
  94. package/lib/StackView/getStackedContent.js +10 -9
  95. package/lib/StackView/index.js +1 -1
  96. package/lib/StepTracker/Step.js +122 -103
  97. package/lib/StepTracker/StepTracker.js +48 -38
  98. package/lib/Tabs/Tabs.js +57 -27
  99. package/lib/Tabs/TabsItem.js +78 -68
  100. package/lib/Tags/Tags.js +68 -62
  101. package/lib/TextInput/TextArea.js +26 -20
  102. package/lib/TextInput/TextInput.js +20 -15
  103. package/lib/TextInput/TextInputBase.js +74 -62
  104. package/lib/TextInput/index.js +4 -4
  105. package/lib/ThemeProvider/ThemeProvider.js +6 -5
  106. package/lib/ThemeProvider/index.js +5 -5
  107. package/lib/ThemeProvider/useSetTheme.js +6 -3
  108. package/lib/ThemeProvider/useThemeTokens.js +7 -2
  109. package/lib/ThemeProvider/utils/styles.js +50 -43
  110. package/lib/ThemeProvider/utils/theme-tokens.js +33 -21
  111. package/lib/ToggleSwitch/ToggleSwitch.js +90 -74
  112. package/lib/ToggleSwitch/ToggleSwitchGroup.js +37 -35
  113. package/lib/Tooltip/Backdrop.js +6 -13
  114. package/lib/Tooltip/Backdrop.native.js +5 -4
  115. package/lib/Tooltip/Tooltip.js +81 -65
  116. package/lib/Tooltip/getTooltipPosition.js +29 -18
  117. package/lib/TooltipButton/TooltipButton.js +28 -21
  118. package/lib/Typography/Typography.js +37 -33
  119. package/lib/ViewportProvider/ViewportProvider.js +4 -3
  120. package/lib/ViewportProvider/useViewportListener.js +6 -3
  121. package/lib/index.js +54 -54
  122. package/lib/utils/a11y/semantics.js +5 -2
  123. package/lib/utils/a11y/textSize.js +8 -6
  124. package/lib/utils/animation/useVerticalExpandAnimation.js +46 -19
  125. package/lib/utils/children.js +4 -3
  126. package/lib/utils/index.js +10 -10
  127. package/lib/utils/input.js +28 -29
  128. package/lib/utils/pressability.js +36 -22
  129. package/lib/utils/props/clickProps.js +2 -1
  130. package/lib/utils/props/componentPropType.js +3 -3
  131. package/lib/utils/props/getPropSelector.js +6 -3
  132. package/lib/utils/props/handlerProps.js +25 -19
  133. package/lib/utils/props/hrefAttrsProp.js +14 -11
  134. package/lib/utils/props/index.js +12 -12
  135. package/lib/utils/props/inputSupportsProps.js +15 -12
  136. package/lib/utils/props/linkProps.js +7 -6
  137. package/lib/utils/props/pressProps.js +1 -1
  138. package/lib/utils/props/selectSystemProps.js +2 -2
  139. package/lib/utils/props/tokens.js +29 -15
  140. package/lib/utils/ssr.js +6 -2
  141. package/lib/utils/useCopy.js +6 -4
  142. package/lib/utils/useHash.js +2 -1
  143. package/lib/utils/useResponsiveProp.js +1 -1
  144. package/lib/utils/useSpacingScale.js +3 -1
  145. package/lib/utils/useUniqueId.js +3 -2
  146. package/lib/utils/withLinkRouter.js +6 -5
  147. package/lib-module/A11yInfoProvider/index.js +4 -3
  148. package/lib-module/A11yText/index.js +6 -5
  149. package/lib-module/ActivityIndicator/Spinner.js +14 -13
  150. package/lib-module/ActivityIndicator/Spinner.native.js +9 -8
  151. package/lib-module/ActivityIndicator/index.js +6 -5
  152. package/lib-module/BaseProvider/index.js +13 -10
  153. package/lib-module/Box/Box.js +20 -19
  154. package/lib-module/Button/Button.js +7 -6
  155. package/lib-module/Button/ButtonBase.js +96 -79
  156. package/lib-module/Button/ButtonGroup.js +34 -32
  157. package/lib-module/Button/ButtonLink.js +8 -7
  158. package/lib-module/Card/Card.js +8 -7
  159. package/lib-module/Card/CardBase.js +35 -31
  160. package/lib-module/Card/PressableCardBase.js +12 -11
  161. package/lib-module/Checkbox/Checkbox.js +97 -83
  162. package/lib-module/Checkbox/CheckboxGroup.js +29 -27
  163. package/lib-module/Checkbox/CheckboxInput.js +12 -10
  164. package/lib-module/Divider/Divider.js +10 -9
  165. package/lib-module/ExpandCollapse/Control.js +42 -36
  166. package/lib-module/ExpandCollapse/ExpandCollapse.js +11 -10
  167. package/lib-module/ExpandCollapse/Panel.js +29 -37
  168. package/lib-module/Feedback/Feedback.js +46 -33
  169. package/lib-module/Fieldset/Fieldset.js +16 -15
  170. package/lib-module/Fieldset/FieldsetContainer.js +16 -13
  171. package/lib-module/Fieldset/FieldsetContainer.native.js +11 -8
  172. package/lib-module/Fieldset/Legend.js +10 -7
  173. package/lib-module/Fieldset/Legend.native.js +10 -7
  174. package/lib-module/FlexGrid/Col/Col.js +18 -17
  175. package/lib-module/FlexGrid/FlexGrid.js +15 -14
  176. package/lib-module/FlexGrid/Row/Row.js +13 -12
  177. package/lib-module/HorizontalScroll/HorizontalScroll.js +24 -19
  178. package/lib-module/HorizontalScroll/HorizontalScrollButton.js +18 -14
  179. package/lib-module/HorizontalScroll/ScrollViewEnd.js +6 -5
  180. package/lib-module/HorizontalScroll/ScrollViewEnd.native.js +12 -9
  181. package/lib-module/HorizontalScroll/itemPositions.js +18 -12
  182. package/lib-module/Icon/Icon.js +10 -9
  183. package/lib-module/Icon/IconText.js +9 -7
  184. package/lib-module/IconButton/IconButton.js +48 -41
  185. package/lib-module/InputLabel/InputLabel.js +37 -30
  186. package/lib-module/InputLabel/LabelContent.js +12 -9
  187. package/lib-module/InputLabel/LabelContent.native.js +9 -6
  188. package/lib-module/InputSupports/InputSupports.js +11 -10
  189. package/lib-module/InputSupports/useInputSupports.js +7 -6
  190. package/lib-module/Link/ChevronLink.js +9 -8
  191. package/lib-module/Link/InlinePressable.js +13 -10
  192. package/lib-module/Link/InlinePressable.native.js +20 -16
  193. package/lib-module/Link/Link.js +10 -9
  194. package/lib-module/Link/LinkBase.js +94 -77
  195. package/lib-module/Link/TextButton.js +9 -8
  196. package/lib-module/List/List.js +20 -13
  197. package/lib-module/List/ListItem.js +103 -78
  198. package/lib-module/Modal/Modal.js +74 -60
  199. package/lib-module/Notification/Notification.js +46 -33
  200. package/lib-module/Pagination/PageButton.js +13 -12
  201. package/lib-module/Pagination/Pagination.js +43 -30
  202. package/lib-module/Pagination/SideButton.js +21 -18
  203. package/lib-module/Pagination/usePagination.js +7 -6
  204. package/lib-module/Progress/Progress.js +23 -19
  205. package/lib-module/Progress/ProgressBar.js +25 -21
  206. package/lib-module/Progress/ProgressBarBackground.js +7 -6
  207. package/lib-module/Radio/Radio.js +80 -69
  208. package/lib-module/Radio/RadioButton.js +62 -52
  209. package/lib-module/Radio/RadioGroup.js +30 -28
  210. package/lib-module/Radio/RadioInput.js +12 -10
  211. package/lib-module/RadioCard/RadioCard.js +16 -15
  212. package/lib-module/RadioCard/RadioCardGroup.js +30 -28
  213. package/lib-module/Search/Search.js +52 -32
  214. package/lib-module/Select/Group.js +5 -4
  215. package/lib-module/Select/Group.native.js +4 -3
  216. package/lib-module/Select/Item.js +10 -7
  217. package/lib-module/Select/Item.native.js +1 -7
  218. package/lib-module/Select/Picker.js +16 -15
  219. package/lib-module/Select/Picker.native.js +46 -36
  220. package/lib-module/Select/Select.js +134 -113
  221. package/lib-module/SideNav/Item.js +39 -33
  222. package/lib-module/SideNav/ItemContent.js +14 -11
  223. package/lib-module/SideNav/ItemsGroup.js +13 -11
  224. package/lib-module/SideNav/SideNav.js +21 -18
  225. package/lib-module/Skeleton/Skeleton.js +60 -44
  226. package/lib-module/Skeleton/skeletonWebAnimation.js +1 -1
  227. package/lib-module/Spacer/Spacer.js +6 -5
  228. package/lib-module/StackView/StackView.js +12 -11
  229. package/lib-module/StackView/StackWrap.js +5 -3
  230. package/lib-module/StackView/StackWrapBox.js +12 -11
  231. package/lib-module/StackView/StackWrapGap.js +11 -10
  232. package/lib-module/StackView/common.js +14 -11
  233. package/lib-module/StackView/getStackedContent.js +10 -9
  234. package/lib-module/StepTracker/Step.js +122 -103
  235. package/lib-module/StepTracker/StepTracker.js +48 -38
  236. package/lib-module/Tabs/Tabs.js +57 -27
  237. package/lib-module/Tabs/TabsItem.js +77 -68
  238. package/lib-module/Tags/Tags.js +68 -62
  239. package/lib-module/TextInput/TextArea.js +26 -20
  240. package/lib-module/TextInput/TextInput.js +19 -15
  241. package/lib-module/TextInput/TextInputBase.js +74 -62
  242. package/lib-module/ThemeProvider/ThemeProvider.js +5 -4
  243. package/lib-module/ThemeProvider/useSetTheme.js +6 -3
  244. package/lib-module/ThemeProvider/useThemeTokens.js +7 -2
  245. package/lib-module/ThemeProvider/utils/styles.js +48 -41
  246. package/lib-module/ThemeProvider/utils/theme-tokens.js +32 -20
  247. package/lib-module/ToggleSwitch/ToggleSwitch.js +90 -74
  248. package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +37 -35
  249. package/lib-module/Tooltip/Backdrop.js +6 -13
  250. package/lib-module/Tooltip/Backdrop.native.js +5 -4
  251. package/lib-module/Tooltip/Tooltip.js +81 -65
  252. package/lib-module/Tooltip/getTooltipPosition.js +29 -18
  253. package/lib-module/TooltipButton/TooltipButton.js +28 -21
  254. package/lib-module/Typography/Typography.js +35 -31
  255. package/lib-module/ViewportProvider/ViewportProvider.js +4 -3
  256. package/lib-module/ViewportProvider/useViewportListener.js +6 -3
  257. package/lib-module/utils/a11y/semantics.js +4 -1
  258. package/lib-module/utils/a11y/textSize.js +7 -5
  259. package/lib-module/utils/animation/useVerticalExpandAnimation.js +47 -20
  260. package/lib-module/utils/children.js +4 -3
  261. package/lib-module/utils/input.js +28 -29
  262. package/lib-module/utils/pressability.js +35 -21
  263. package/lib-module/utils/props/clickProps.js +2 -1
  264. package/lib-module/utils/props/componentPropType.js +3 -3
  265. package/lib-module/utils/props/getPropSelector.js +6 -3
  266. package/lib-module/utils/props/handlerProps.js +24 -18
  267. package/lib-module/utils/props/hrefAttrsProp.js +14 -11
  268. package/lib-module/utils/props/inputSupportsProps.js +15 -12
  269. package/lib-module/utils/props/linkProps.js +7 -6
  270. package/lib-module/utils/props/selectSystemProps.js +2 -2
  271. package/lib-module/utils/props/tokens.js +27 -14
  272. package/lib-module/utils/ssr.js +5 -2
  273. package/lib-module/utils/useCopy.js +6 -4
  274. package/lib-module/utils/useHash.js +2 -1
  275. package/lib-module/utils/useSpacingScale.js +3 -1
  276. package/lib-module/utils/useUniqueId.js +3 -2
  277. package/lib-module/utils/withLinkRouter.js +6 -5
  278. package/package.json +13 -11
  279. package/src/ExpandCollapse/Panel.jsx +2 -19
  280. package/src/List/List.jsx +34 -19
  281. package/src/List/ListItem.jsx +12 -2
  282. package/src/Modal/Modal.jsx +2 -1
  283. package/src/Pagination/Pagination.jsx +3 -0
  284. package/src/Search/Search.jsx +11 -0
  285. package/src/Select/Item.native.jsx +0 -7
  286. package/src/Tabs/Tabs.jsx +24 -2
  287. package/src/Tabs/TabsItem.jsx +6 -5
  288. package/src/utils/animation/useVerticalExpandAnimation.js +47 -13
@@ -5,16 +5,17 @@
5
5
  import Platform from "react-native-web/dist/exports/Platform";
6
6
  import { fontBasePixels } from '@telus-uds/system-constants'; // Make design tokens fit React Native's text styles' specific requirements and quirks
7
7
 
8
- export function applyTextStyles({
9
- fontSize,
10
- fontScaleCap,
11
- lineHeight,
12
- letterSpacing,
13
- fontWeight = '400',
14
- fontName,
15
- fontStyle = 'normal',
16
- ...rest
17
- }) {
8
+ export function applyTextStyles(_ref) {
9
+ let {
10
+ fontSize,
11
+ fontScaleCap,
12
+ lineHeight,
13
+ letterSpacing,
14
+ fontWeight = '400',
15
+ fontName,
16
+ fontStyle = 'normal',
17
+ ...rest
18
+ } = _ref;
18
19
  const styles = { ...rest
19
20
  };
20
21
 
@@ -36,7 +37,7 @@ export function applyTextStyles({
36
37
  if (fontName) {
37
38
  // Don't set undefined font families. May need some validation here that the font is available.
38
39
  // Android doesn't recognise font weights natively so apply custom font weights via `fontFamily`.
39
- styles.fontFamily = `${fontName}${fontWeight}${fontStyle}`;
40
+ styles.fontFamily = "".concat(fontName).concat(fontWeight).concat(fontStyle);
40
41
  } else if (fontWeight) {
41
42
  // If using system default font, apply the font weight directly.
42
43
  // Font weight support in Android is limited to 'bold' or anything else === 'normal'.
@@ -72,17 +73,18 @@ export function applyShadowToken(shadowToken) {
72
73
  return applyShadow();
73
74
  }
74
75
 
75
- function applyWebShadow({
76
- inset,
77
- color = '',
78
- offsetX = 0,
79
- offsetY = 0,
80
- blur = 0,
81
- spread = 0
82
- }) {
76
+ function applyWebShadow(_ref2) {
77
+ let {
78
+ inset,
79
+ color = '',
80
+ offsetX = 0,
81
+ offsetY = 0,
82
+ blur = 0,
83
+ spread = 0
84
+ } = _ref2;
83
85
  const insetString = inset ? 'inset ' : '';
84
86
  const boxShadow = {
85
- boxShadow: `${insetString}${offsetX}px ${offsetY}px ${blur}px ${spread}px ${color}`
87
+ boxShadow: "".concat(insetString).concat(offsetX, "px ").concat(offsetY, "px ").concat(blur, "px ").concat(spread, "px ").concat(color)
86
88
  };
87
89
  return boxShadow;
88
90
  }
@@ -111,14 +113,15 @@ function applyAndroidShadow(shadowToken) {
111
113
  return {};
112
114
  }
113
115
 
114
- function applyIosShadow({
115
- inset,
116
- color,
117
- offsetX,
118
- offsetY,
119
- spread,
120
- blur
121
- }) {
116
+ function applyIosShadow(_ref3) {
117
+ let {
118
+ inset,
119
+ color,
120
+ offsetX,
121
+ offsetY,
122
+ spread,
123
+ blur
124
+ } = _ref3;
122
125
  // React Native iOS doesn't support inset shadows.
123
126
  // TODO: maybe use a library or workaround for inset shadows. This is a sizable task and would
124
127
  // involve changing component implementations to use a custom view, can't be done with styles alone.
@@ -149,7 +152,8 @@ const verticalAlignToFlexRowAlign = {
149
152
  middle: 'center',
150
153
  bottom: 'flex-end'
151
154
  };
152
- export function verticalAlignRow(verticalAlign, reverse = false) {
155
+ export function verticalAlignRow(verticalAlign) {
156
+ let reverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
153
157
  return {
154
158
  flexDirection: reverse ? 'row-reverse' : 'row',
155
159
  alignItems: verticalAlignToFlexRowAlign[verticalAlign]
@@ -160,15 +164,18 @@ export function verticalAlignRow(verticalAlign, reverse = false) {
160
164
  * that matches the border radius of any inner border.
161
165
  */
162
166
 
163
- export const applyOuterBorder = ({
164
- outerBorderColor,
165
- outerBorderWidth = 0,
166
- outerBorderGap = 0,
167
- borderRadius = 0
168
- }) => ({
169
- margin: 0 - outerBorderWidth - outerBorderGap,
170
- padding: outerBorderGap,
171
- borderRadius: borderRadius + outerBorderGap + outerBorderWidth,
172
- borderWidth: outerBorderWidth,
173
- borderColor: outerBorderColor
174
- });
167
+ export const applyOuterBorder = _ref4 => {
168
+ let {
169
+ outerBorderColor,
170
+ outerBorderWidth = 0,
171
+ outerBorderGap = 0,
172
+ borderRadius = 0
173
+ } = _ref4;
174
+ return {
175
+ margin: 0 - outerBorderWidth - outerBorderGap,
176
+ padding: outerBorderGap,
177
+ borderRadius: borderRadius + outerBorderGap + outerBorderWidth,
178
+ borderWidth: outerBorderWidth,
179
+ borderColor: outerBorderColor
180
+ };
181
+ };
@@ -17,26 +17,29 @@ export const getComponentTheme = (theme, componentName) => {
17
17
  // Give clear and understandable error messages for common dev errors, for example,
18
18
  // typo in component name, missing export or accessing old version of theme
19
19
  if (!theme) {
20
- throw new Error(`Called useTheme's getStyle on "${componentName}" with no theme provided`);
20
+ throw new Error("Called useTheme's getStyle on \"".concat(componentName, "\" with no theme provided"));
21
21
  }
22
22
 
23
23
  const themeName = ((_theme$metadata = theme.metadata) === null || _theme$metadata === void 0 ? void 0 : _theme$metadata.name) || '';
24
24
 
25
25
  if (!theme.components) {
26
- throw new Error(`Theme "${themeName}" has no components defined (looking for "${componentName}")`);
26
+ throw new Error("Theme \"".concat(themeName, "\" has no components defined (looking for \"").concat(componentName, "\")"));
27
27
  }
28
28
 
29
29
  const componentTheme = theme.components[componentName];
30
30
 
31
31
  if (!componentTheme) {
32
- throw new Error(`Theme "${themeName}" does not have styles for component "${componentName}"`);
32
+ throw new Error("Theme \"".concat(themeName, "\" does not have styles for component \"").concat(componentName, "\""));
33
33
  }
34
34
 
35
35
  return componentTheme;
36
36
  };
37
- export const doesThemeConditionApply = ([key, value], appearances) => {
37
+ export const doesThemeConditionApply = (_ref, appearances) => {
38
+ var _appearances$key;
39
+
40
+ let [key, value] = _ref;
38
41
  // use null rather than undefined so we can serialise the value in themes
39
- const appearanceValue = appearances[key] ?? null;
42
+ const appearanceValue = (_appearances$key = appearances[key]) !== null && _appearances$key !== void 0 ? _appearances$key : null;
40
43
  return Array.isArray(value) ? value.includes(appearanceValue) : value === appearanceValue;
41
44
  };
42
45
  export const doesThemeRuleApply = (rule, appearances) => Object.entries(rule.if).every(condition => doesThemeConditionApply(condition, appearances));
@@ -57,12 +60,18 @@ export const doesThemeRuleApply = (rule, appearances) => Object.entries(rule.if)
57
60
  * @returns {TokensSet} - object containing resolved tokens with overrides applied
58
61
  */
59
62
 
60
- export const resolveThemeTokens = (defaultTokens, appearances = {}, tokenOverrides) => {
63
+ export const resolveThemeTokens = function (defaultTokens) {
64
+ let appearances = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
65
+ let tokenOverrides = arguments.length > 2 ? arguments[2] : undefined;
66
+
61
67
  const resolve = tokens => typeof tokens === 'function' ? tokens(appearances) : tokens;
62
68
 
63
69
  if (!tokenOverrides) return resolve(defaultTokens);
64
- return Object.entries(resolve(tokenOverrides)).reduce((mergedTokens, [tokenName, tokenValue]) => tokenValue === undefined ? mergedTokens : { ...mergedTokens,
65
- [tokenName]: tokenValue
70
+ return Object.entries(resolve(tokenOverrides)).reduce((mergedTokens, _ref2) => {
71
+ let [tokenName, tokenValue] = _ref2;
72
+ return tokenValue === undefined ? mergedTokens : { ...mergedTokens,
73
+ [tokenName]: tokenValue
74
+ };
66
75
  }, resolve(defaultTokens));
67
76
  };
68
77
  /**
@@ -95,9 +104,13 @@ export const validateThemeTokens = (themeTokens, validator, componentName) => {
95
104
  * @returns {AppearanceSet}
96
105
  */
97
106
 
98
- export const mergeAppearances = (variants = {}, states) => states ? { ...states,
99
- ...variants
100
- } : variants;
107
+ export const mergeAppearances = function () {
108
+ let variants = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
109
+ let states = arguments.length > 1 ? arguments[1] : undefined;
110
+ return states ? { ...states,
111
+ ...variants
112
+ } : variants;
113
+ };
101
114
  /**
102
115
  * Get a set of theme tokens by applying a theme's component rules based on a component's variants and state.
103
116
  *
@@ -110,10 +123,13 @@ export const mergeAppearances = (variants = {}, states) => states ? { ...states,
110
123
  * @returns {object} Set of resolved theme tokens
111
124
  */
112
125
 
113
- export const getThemeTokens = ({
114
- rules = [],
115
- tokens: defaultThemeTokens = {}
116
- }, tokensProp, variants = {}, states) => {
126
+ export const getThemeTokens = function (_ref3, tokensProp) {
127
+ let {
128
+ rules = [],
129
+ tokens: defaultThemeTokens = {}
130
+ } = _ref3;
131
+ let variants = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
132
+ let states = arguments.length > 3 ? arguments[3] : undefined;
117
133
  const appearances = mergeAppearances(variants, states); // TODO: if in dev mode, validate the appearances and provided propTokens
118
134
  // Get the theme's default tokens set and merge tokens from applicable theme rules over it
119
135
 
@@ -142,10 +158,6 @@ export const validateThemeTokensVersion = theme => {
142
158
  const actualThemeTokensVersion = theme === null || theme === void 0 ? void 0 : (_theme$metadata2 = theme.metadata) === null || _theme$metadata2 === void 0 ? void 0 : _theme$metadata2.themeTokensVersion;
143
159
 
144
160
  if (!semVerSatisfies(actualThemeTokensVersion, expectedThemeTokensVersion)) {
145
- throw new Error(`Invalid UDS token schema version detected.
146
-
147
- The UDS base components ${pkg.name} v${pkg.version} are only compatible with UDS themes that are built with @telus-uds/system-theme-tokens version that is semver compatible with ${expectedThemeTokensVersion}. The current theme was built with @telus-uds/system-theme-tokens v${actualThemeTokensVersion}.
148
-
149
- If you see this error than most likely you have attempted to install ${pkg.name} and a UDS theme manually because you are building a multi-brand application. If you are building a single brand application, consider installing the brand specific design system package such as @telus-uds/ds-allium. For more information, see https://github.com/telus/universal-design-system/blob/main/packages/docs-uds/docs/multi-brand-usage.md`);
161
+ throw new Error("Invalid UDS token schema version detected.\n\nThe UDS base components ".concat(pkg.name, " v").concat(pkg.version, " are only compatible with UDS themes that are built with @telus-uds/system-theme-tokens version that is semver compatible with ").concat(expectedThemeTokensVersion, ". The current theme was built with @telus-uds/system-theme-tokens v").concat(actualThemeTokensVersion, ".\n\nIf you see this error than most likely you have attempted to install ").concat(pkg.name, " and a UDS theme manually because you are building a multi-brand application. If you are building a single brand application, consider installing the brand specific design system package such as @telus-uds/ds-allium. For more information, see https://github.com/telus/universal-design-system/blob/main/packages/docs-uds/docs/multi-brand-usage.md"));
150
162
  }
151
163
  };
@@ -19,84 +19,100 @@ const selectButtonTokens = tokens => selectTokens('Button', { ...tokens,
19
19
  }); // Map and rename icon-specific tokens to name used within Icon
20
20
 
21
21
 
22
- const selectIconTokens = ({
23
- iconSize,
24
- iconColor
25
- }) => ({
26
- size: iconSize,
27
- color: iconColor
28
- });
22
+ const selectIconTokens = _ref => {
23
+ let {
24
+ iconSize,
25
+ iconColor
26
+ } = _ref;
27
+ return {
28
+ size: iconSize,
29
+ color: iconColor
30
+ };
31
+ };
29
32
 
30
- const selectTrackStyles = ({
31
- trackBorderWidth,
32
- trackBorderColor,
33
- trackBorderRadius,
34
- width
35
- }) => ({
36
- borderWidth: trackBorderWidth,
37
- borderColor: trackBorderColor,
38
- borderRadius: trackBorderRadius,
39
- width
40
- });
33
+ const selectTrackStyles = _ref2 => {
34
+ let {
35
+ trackBorderWidth,
36
+ trackBorderColor,
37
+ trackBorderRadius,
38
+ width
39
+ } = _ref2;
40
+ return {
41
+ borderWidth: trackBorderWidth,
42
+ borderColor: trackBorderColor,
43
+ borderRadius: trackBorderRadius,
44
+ width
45
+ };
46
+ };
41
47
 
42
- const selectSwitchStyles = ({
43
- switchSize,
44
- switchColor,
45
- switchBorderWidth,
46
- switchBorderColor,
47
- switchBorderRadius,
48
- switchShadow
49
- }) => ({
50
- width: switchSize,
51
- height: switchSize,
52
- backgroundColor: switchColor,
53
- borderWidth: switchBorderWidth,
54
- borderColor: switchBorderColor,
55
- borderRadius: switchBorderRadius,
56
- ...applyShadowToken(switchShadow),
57
- ...Platform.select({
58
- // TODO: https://github.com/telus/universal-design-system/issues/487
59
- web: {
60
- transition: 'transform 200ms'
61
- }
62
- })
63
- });
48
+ const selectSwitchStyles = _ref3 => {
49
+ let {
50
+ switchSize,
51
+ switchColor,
52
+ switchBorderWidth,
53
+ switchBorderColor,
54
+ switchBorderRadius,
55
+ switchShadow
56
+ } = _ref3;
57
+ return {
58
+ width: switchSize,
59
+ height: switchSize,
60
+ backgroundColor: switchColor,
61
+ borderWidth: switchBorderWidth,
62
+ borderColor: switchBorderColor,
63
+ borderRadius: switchBorderRadius,
64
+ ...applyShadowToken(switchShadow),
65
+ ...Platform.select({
66
+ // TODO: https://github.com/telus/universal-design-system/issues/487
67
+ web: {
68
+ transition: 'transform 200ms'
69
+ }
70
+ })
71
+ };
72
+ };
64
73
 
65
- const selectLabelStyles = ({
66
- labelMarginLeft
67
- }) => ({
68
- marginLeft: labelMarginLeft
69
- });
74
+ const selectLabelStyles = _ref4 => {
75
+ let {
76
+ labelMarginLeft
77
+ } = _ref4;
78
+ return {
79
+ marginLeft: labelMarginLeft
80
+ };
81
+ };
70
82
 
71
- const selectLabelTokens = ({
72
- labelColor,
73
- labelFontName,
74
- labelFontSize,
75
- labelFontWeight,
76
- labelLineHeight
77
- }) => ({
78
- color: labelColor,
79
- fontName: labelFontName,
80
- fontWeight: labelFontWeight,
81
- fontSize: labelFontSize,
82
- lineHeight: labelLineHeight
83
- });
83
+ const selectLabelTokens = _ref5 => {
84
+ let {
85
+ labelColor,
86
+ labelFontName,
87
+ labelFontSize,
88
+ labelFontWeight,
89
+ labelLineHeight
90
+ } = _ref5;
91
+ return {
92
+ color: labelColor,
93
+ fontName: labelFontName,
94
+ fontWeight: labelFontWeight,
95
+ fontSize: labelFontSize,
96
+ lineHeight: labelLineHeight
97
+ };
98
+ };
84
99
 
85
- const ToggleSwitch = /*#__PURE__*/forwardRef(({
86
- copy = 'en',
87
- value,
88
- initialValue,
89
- onChange,
90
- id,
91
- label,
92
- inactive,
93
- tokens,
94
- tooltip,
95
- variant,
96
- accessibilityRole = 'switch',
97
- accessibilityLabel = label,
98
- ...rest
99
- }, ref) => {
100
+ const ToggleSwitch = /*#__PURE__*/forwardRef((_ref6, ref) => {
101
+ let {
102
+ copy = 'en',
103
+ value,
104
+ initialValue,
105
+ onChange,
106
+ id,
107
+ label,
108
+ inactive,
109
+ tokens,
110
+ tooltip,
111
+ variant,
112
+ accessibilityRole = 'switch',
113
+ accessibilityLabel = label,
114
+ ...rest
115
+ } = _ref6;
100
116
  const getTokens = useThemeTokensCallback('ToggleSwitch', tokens, variant);
101
117
  const themeTokens = getTokens();
102
118
  const {
@@ -113,7 +129,7 @@ const ToggleSwitch = /*#__PURE__*/forwardRef(({
113
129
  const getButtonTokens = buttonState => selectButtonTokens(getTokens(buttonState));
114
130
 
115
131
  const uniqueId = useUniqueId('toggleSwitch');
116
- const inputId = id ?? uniqueId;
132
+ const inputId = id !== null && id !== void 0 ? id : uniqueId;
117
133
  return /*#__PURE__*/_jsxs(StackView, {
118
134
  space: 2,
119
135
  direction: "row",
@@ -11,31 +11,32 @@ import { a11yProps, containUniqueFields, focusHandlerProps, getTokensPropType, s
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
12
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
13
13
  const [selectItemProps, selectedItemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, viewProps]);
14
- const ToggleSwitchGroup = /*#__PURE__*/forwardRef(({
15
- copy = 'en',
16
- variant,
17
- tokens,
18
- items = [],
19
- values,
20
- initialValues,
21
- maxValues = 1,
22
- onChange,
23
- readOnly = false,
24
- inactive = false,
25
- feedback,
26
- hint,
27
- tooltip,
28
- legend,
29
- name: inputGroupName,
30
- accessibilityRole = maxValues === 1 ? 'radiogroup' // radiogroup is cross-platform; only web aria has generic groups
31
- : Platform.select({
32
- web: 'group',
33
- default: 'none'
34
- }),
35
- toggleSwitchTokens,
36
- validation,
37
- ...rest
38
- }, ref) => {
14
+ const ToggleSwitchGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
15
+ let {
16
+ copy = 'en',
17
+ variant,
18
+ tokens,
19
+ items = [],
20
+ values,
21
+ initialValues,
22
+ maxValues = 1,
23
+ onChange,
24
+ readOnly = false,
25
+ inactive = false,
26
+ feedback,
27
+ hint,
28
+ tooltip,
29
+ legend,
30
+ name: inputGroupName,
31
+ accessibilityRole = maxValues === 1 ? 'radiogroup' // radiogroup is cross-platform; only web aria has generic groups
32
+ : Platform.select({
33
+ web: 'group',
34
+ default: 'none'
35
+ }),
36
+ toggleSwitchTokens,
37
+ validation,
38
+ ...rest
39
+ } = _ref;
39
40
  const viewport = useViewport();
40
41
  const {
41
42
  space,
@@ -61,18 +62,19 @@ const ToggleSwitchGroup = /*#__PURE__*/forwardRef(({
61
62
  const uniqueFields = ['id', 'label'];
62
63
 
63
64
  if (!containUniqueFields(items, uniqueFields)) {
64
- throw new Error(`ToggleSwitchGroup items must have unique ${uniqueFields.join(', ')}`);
65
+ throw new Error("ToggleSwitchGroup items must have unique ".concat(uniqueFields.join(', ')));
65
66
  }
66
67
 
67
- const toggleSwitches = items.map(({
68
- label,
69
- id = label,
70
- accessibilityLabel = label,
71
- onChange: itemOnChange,
72
- ref: itemRef,
73
- tooltip: itemTooltip,
74
- ...itemRest
75
- }, index) => {
68
+ const toggleSwitches = items.map((_ref2, index) => {
69
+ let {
70
+ label,
71
+ id = label,
72
+ accessibilityLabel = label,
73
+ onChange: itemOnChange,
74
+ ref: itemRef,
75
+ tooltip: itemTooltip,
76
+ ...itemRest
77
+ } = _ref2;
76
78
  const isSelected = currentValues.includes(id);
77
79
 
78
80
  const handleChange = (newCheckedState, event) => {
@@ -8,15 +8,7 @@ function createPortalNode(nodeId) {
8
8
  // this way the backdrop stays in place when scrolling the window - that's why we need to
9
9
  // position it at the scroll position when rendering
10
10
 
11
- node.style.cssText = `
12
- position: absolute;
13
- top: ${window.scrollY}px;
14
- left: ${window.scrollX}px;
15
- right: 0;
16
- bottom: 0;
17
- z-index: 9999;
18
- pointer-events: none;
19
- `;
11
+ node.style.cssText = "\n position: absolute; \n top: ".concat(window.scrollY, "px;\n left: ").concat(window.scrollX, "px; \n right: 0; \n bottom: 0; \n z-index: 9999; \n pointer-events: none;\n ");
20
12
  document.body.appendChild(node);
21
13
  return node;
22
14
  }
@@ -31,12 +23,13 @@ function removePortalNode(nodeId) {
31
23
  */
32
24
 
33
25
 
34
- function Backdrop({
35
- children
36
- }) {
26
+ function Backdrop(_ref) {
27
+ let {
28
+ children
29
+ } = _ref;
37
30
  const [portalNode, setPortalNode] = useState();
38
31
  useEffect(() => {
39
- const nodeId = `tooltip-backdrop-${Date.now()}`;
32
+ const nodeId = "tooltip-backdrop-".concat(Date.now());
40
33
  const node = createPortalNode(nodeId);
41
34
  setPortalNode(node);
42
35
  return () => {
@@ -13,10 +13,11 @@ import PropTypes from 'prop-types';
13
13
 
14
14
  import { jsx as _jsx } from "react/jsx-runtime";
15
15
 
16
- function Backdrop({
17
- onPress,
18
- children
19
- }) {
16
+ function Backdrop(_ref) {
17
+ let {
18
+ onPress,
19
+ children
20
+ } = _ref;
20
21
  return /*#__PURE__*/_jsx(Modal, {
21
22
  transparent: true,
22
23
  children: /*#__PURE__*/_jsx(TouchableWithoutFeedback, {