@telus-uds/components-web 2.44.0 → 3.0.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 (315) hide show
  1. package/.eslintrc.cjs +26 -0
  2. package/CHANGELOG.md +13 -2
  3. package/babel.config.cjs +4 -0
  4. package/jest.config.cjs +29 -0
  5. package/lib/Badge/Badge.js +21 -29
  6. package/lib/Badge/index.js +2 -10
  7. package/lib/BlockQuote/BlockQuote.js +31 -39
  8. package/lib/BlockQuote/index.js +2 -10
  9. package/lib/Breadcrumbs/Breadcrumbs.js +39 -49
  10. package/lib/Breadcrumbs/Item/Item.js +26 -34
  11. package/lib/Breadcrumbs/index.js +1 -13
  12. package/lib/Callout/Callout.js +19 -27
  13. package/lib/Callout/index.js +2 -10
  14. package/lib/Card/Card.js +44 -54
  15. package/lib/Card/CardContent.js +17 -25
  16. package/lib/Card/CardFooter.js +16 -24
  17. package/lib/Card/index.js +2 -10
  18. package/lib/Countdown/Countdown.js +34 -42
  19. package/lib/Countdown/Segment.js +26 -34
  20. package/lib/Countdown/constants.js +4 -14
  21. package/lib/Countdown/dictionary.js +2 -9
  22. package/lib/Countdown/index.js +2 -10
  23. package/lib/Countdown/types.js +18 -28
  24. package/lib/Countdown/useCountdown.js +4 -11
  25. package/lib/DatePicker/CalendarContainer.js +6 -12
  26. package/lib/DatePicker/DatePicker.js +94 -103
  27. package/lib/DatePicker/dictionary.js +1 -8
  28. package/lib/DatePicker/index.js +2 -10
  29. package/lib/DatePicker/reactDatesCss.js +3 -10
  30. package/lib/Disclaimer/Disclaimer.js +15 -23
  31. package/lib/Disclaimer/index.js +1 -13
  32. package/lib/ExpandCollapseMini/ExpandCollapseMini.js +16 -24
  33. package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +17 -26
  34. package/lib/ExpandCollapseMini/index.js +2 -10
  35. package/lib/Footnote/Footnote.js +85 -95
  36. package/lib/Footnote/FootnoteLink.js +25 -33
  37. package/lib/Footnote/dictionary.js +2 -9
  38. package/lib/Footnote/index.js +4 -12
  39. package/lib/IconButton/IconButton.js +12 -20
  40. package/lib/IconButton/index.js +2 -10
  41. package/lib/Image/Image.js +17 -25
  42. package/lib/Image/index.js +6 -18
  43. package/lib/Image/server.js +4 -12
  44. package/lib/List/List.js +2 -9
  45. package/lib/List/ListItem.js +10 -18
  46. package/lib/List/index.js +4 -12
  47. package/lib/NavigationBar/NavigationBar.js +51 -59
  48. package/lib/NavigationBar/NavigationItem.js +19 -27
  49. package/lib/NavigationBar/NavigationSubMenu.js +34 -40
  50. package/lib/NavigationBar/collapseItems.js +1 -11
  51. package/lib/NavigationBar/index.js +4 -12
  52. package/lib/NavigationBar/resolveItemSelection.js +1 -8
  53. package/lib/OptimizeImage/OptimizeImage.js +26 -34
  54. package/lib/OptimizeImage/index.js +2 -10
  55. package/lib/OptimizeImage/utils/getFallbackUrl.js +3 -10
  56. package/lib/OptimizeImage/utils/getImageUrls.js +9 -16
  57. package/lib/OptimizeImage/utils/getOptimizedUrl.js +3 -10
  58. package/lib/OptimizeImage/utils/hasWebpSupport.js +1 -7
  59. package/lib/OptimizeImage/utils/index.js +5 -34
  60. package/lib/OptimizeImage/utils/isSvgUrl.js +1 -7
  61. package/lib/OrderedList/Item.js +28 -36
  62. package/lib/OrderedList/ItemBase.js +8 -16
  63. package/lib/OrderedList/OrderedList.js +22 -30
  64. package/lib/OrderedList/OrderedListBase.js +12 -20
  65. package/lib/OrderedList/constants.js +1 -8
  66. package/lib/OrderedList/index.js +4 -12
  67. package/lib/Paragraph/Paragraph.js +22 -30
  68. package/lib/Paragraph/index.js +2 -10
  69. package/lib/PreviewCard/AuthorDate.js +17 -21
  70. package/lib/PreviewCard/PreviewCard.js +40 -49
  71. package/lib/PreviewCard/index.js +2 -10
  72. package/lib/PriceLockup/PriceLockup.js +56 -64
  73. package/lib/PriceLockup/index.js +2 -10
  74. package/lib/PriceLockup/tokens.js +2 -9
  75. package/lib/Progress/ProgressBar.js +17 -24
  76. package/lib/Progress/index.js +4 -12
  77. package/lib/QuantitySelector/QuantitySelector.js +55 -63
  78. package/lib/QuantitySelector/SideButton.js +15 -23
  79. package/lib/QuantitySelector/dictionary.js +2 -9
  80. package/lib/QuantitySelector/index.js +2 -10
  81. package/lib/QuantitySelector/styles.js +4 -13
  82. package/lib/ResponsiveImage/ResponsiveImage.js +29 -37
  83. package/lib/ResponsiveImage/index.js +2 -10
  84. package/lib/Ribbon/Ribbon.js +22 -30
  85. package/lib/Ribbon/index.js +2 -10
  86. package/lib/SkeletonProvider/SkeletonImage.js +14 -22
  87. package/lib/SkeletonProvider/SkeletonProvider.js +17 -25
  88. package/lib/SkeletonProvider/SkeletonTypography.js +14 -22
  89. package/lib/SkeletonProvider/index.js +2 -10
  90. package/lib/Span/Span.js +23 -31
  91. package/lib/Span/index.js +2 -10
  92. package/lib/Spinner/Spinner.js +43 -51
  93. package/lib/Spinner/SpinnerContent.js +21 -29
  94. package/lib/Spinner/constants.js +4 -14
  95. package/lib/Spinner/index.js +2 -10
  96. package/lib/StoryCard/StoryCard.js +40 -49
  97. package/lib/StoryCard/index.js +2 -10
  98. package/lib/Table/Body.js +7 -15
  99. package/lib/Table/Cell.js +28 -38
  100. package/lib/Table/Header.js +11 -19
  101. package/lib/Table/Row.js +8 -16
  102. package/lib/Table/SubHeading.js +10 -18
  103. package/lib/Table/Table.js +26 -35
  104. package/lib/Table/index.js +12 -20
  105. package/lib/TermsAndConditions/ExpandCollapse.js +22 -30
  106. package/lib/TermsAndConditions/TermsAndConditions.js +52 -60
  107. package/lib/TermsAndConditions/dictionary.js +2 -9
  108. package/lib/TermsAndConditions/index.js +1 -13
  109. package/lib/Testimonial/Testimonial.js +37 -45
  110. package/lib/Testimonial/index.js +2 -10
  111. package/lib/Toast/Toast.js +32 -42
  112. package/lib/Toast/index.js +2 -10
  113. package/lib/Video/ControlBar/ControlBar.js +73 -81
  114. package/lib/Video/ControlBar/Controls/VideoButton/VideoButton.js +16 -24
  115. package/lib/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +27 -35
  116. package/lib/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +27 -36
  117. package/lib/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +30 -38
  118. package/lib/Video/MiddleControlButton/MiddleControlButton.js +16 -24
  119. package/lib/Video/Video.js +74 -83
  120. package/lib/Video/index.js +2 -10
  121. package/lib/Video/videoText.js +1 -8
  122. package/lib/VideoPicker/VideoPicker.js +43 -53
  123. package/lib/VideoPicker/VideoPickerPlayer.js +17 -25
  124. package/lib/VideoPicker/VideoPickerThumbnail.js +38 -46
  125. package/lib/VideoPicker/VideoSlider.js +17 -26
  126. package/lib/VideoPicker/index.js +2 -10
  127. package/lib/VideoPicker/videoPropType.js +9 -18
  128. package/lib/WaffleGrid/WaffleGrid.js +33 -43
  129. package/lib/WaffleGrid/index.js +2 -10
  130. package/lib/WebVideo/WebVideo.js +42 -52
  131. package/lib/WebVideo/index.js +2 -10
  132. package/lib/WebVideo/utils/index.js +3 -11
  133. package/lib/baseExports.js +18 -431
  134. package/lib/index.js +38 -323
  135. package/lib/server.js +4 -12
  136. package/lib/shared/ConditionalWrapper/ConditionalWrapper.js +9 -17
  137. package/lib/shared/ConditionalWrapper/index.js +2 -10
  138. package/lib/shared/FullBleedContent/FullBleedContent.js +21 -29
  139. package/lib/shared/FullBleedContent/getFullBleedBorderRadius.js +1 -8
  140. package/lib/shared/FullBleedContent/index.js +4 -24
  141. package/lib/shared/FullBleedContent/useFullBleedContentProps.js +4 -11
  142. package/lib/shared/VideoSplash/SplashButton/SplashButton.js +19 -27
  143. package/lib/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +27 -35
  144. package/lib/shared/VideoSplash/VideoSplash.js +24 -32
  145. package/lib/shared/VideoSplash/helpers.js +5 -14
  146. package/lib/utils/index.js +10 -75
  147. package/lib/utils/isElementFocusable.js +1 -8
  148. package/lib/utils/logger.js +6 -15
  149. package/lib/utils/media.js +5 -11
  150. package/lib/utils/renderStructuredContent.js +8 -15
  151. package/lib/utils/ssr.js +5 -12
  152. package/lib/utils/theming/get-theme-from-server.js +2 -10
  153. package/lib/utils/theming/with-client-theme.js +9 -17
  154. package/lib/utils/theming/with-server-theme.js +11 -19
  155. package/lib/utils/transforms.js +3 -11
  156. package/lib/utils/useOverlaidPosition.js +15 -23
  157. package/lib/utils/useTypographyTheme.js +6 -13
  158. package/package.json +18 -20
  159. package/src/Card/Card.jsx +2 -2
  160. package/src/DatePicker/DatePicker.jsx +1 -2
  161. package/src/PreviewCard/AuthorDate.jsx +5 -3
  162. package/src/utils/logger.js +2 -2
  163. package/lib-module/Badge/Badge.js +0 -121
  164. package/lib-module/Badge/index.js +0 -2
  165. package/lib-module/BlockQuote/BlockQuote.js +0 -204
  166. package/lib-module/BlockQuote/index.js +0 -2
  167. package/lib-module/Breadcrumbs/Breadcrumbs.js +0 -250
  168. package/lib-module/Breadcrumbs/Item/Item.js +0 -175
  169. package/lib-module/Breadcrumbs/index.js +0 -1
  170. package/lib-module/Callout/Callout.js +0 -135
  171. package/lib-module/Callout/index.js +0 -2
  172. package/lib-module/Card/Card.js +0 -251
  173. package/lib-module/Card/CardContent.js +0 -90
  174. package/lib-module/Card/CardFooter.js +0 -78
  175. package/lib-module/Card/index.js +0 -2
  176. package/lib-module/Countdown/Countdown.js +0 -169
  177. package/lib-module/Countdown/Segment.js +0 -96
  178. package/lib-module/Countdown/constants.js +0 -4
  179. package/lib-module/Countdown/dictionary.js +0 -22
  180. package/lib-module/Countdown/index.js +0 -2
  181. package/lib-module/Countdown/types.js +0 -24
  182. package/lib-module/Countdown/useCountdown.js +0 -26
  183. package/lib-module/DatePicker/CalendarContainer.js +0 -208
  184. package/lib-module/DatePicker/DatePicker.js +0 -519
  185. package/lib-module/DatePicker/dictionary.js +0 -119
  186. package/lib-module/DatePicker/index.js +0 -2
  187. package/lib-module/DatePicker/reactDatesCss.js +0 -3
  188. package/lib-module/Disclaimer/Disclaimer.js +0 -54
  189. package/lib-module/Disclaimer/index.js +0 -1
  190. package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +0 -73
  191. package/lib-module/ExpandCollapseMini/ExpandCollapseMiniControl.js +0 -117
  192. package/lib-module/ExpandCollapseMini/index.js +0 -2
  193. package/lib-module/Footnote/Footnote.js +0 -632
  194. package/lib-module/Footnote/FootnoteLink.js +0 -118
  195. package/lib-module/Footnote/dictionary.js +0 -12
  196. package/lib-module/Footnote/index.js +0 -4
  197. package/lib-module/IconButton/IconButton.js +0 -55
  198. package/lib-module/IconButton/index.js +0 -2
  199. package/lib-module/Image/Image.js +0 -83
  200. package/lib-module/Image/index.js +0 -9
  201. package/lib-module/Image/server.js +0 -4
  202. package/lib-module/List/List.js +0 -2
  203. package/lib-module/List/ListItem.js +0 -28
  204. package/lib-module/List/index.js +0 -4
  205. package/lib-module/NavigationBar/NavigationBar.js +0 -224
  206. package/lib-module/NavigationBar/NavigationItem.js +0 -87
  207. package/lib-module/NavigationBar/NavigationSubMenu.js +0 -162
  208. package/lib-module/NavigationBar/collapseItems.js +0 -41
  209. package/lib-module/NavigationBar/index.js +0 -4
  210. package/lib-module/NavigationBar/resolveItemSelection.js +0 -16
  211. package/lib-module/OptimizeImage/OptimizeImage.js +0 -92
  212. package/lib-module/OptimizeImage/index.js +0 -2
  213. package/lib-module/OptimizeImage/utils/getFallbackUrl.js +0 -7
  214. package/lib-module/OptimizeImage/utils/getImageUrls.js +0 -12
  215. package/lib-module/OptimizeImage/utils/getOptimizedUrl.js +0 -17
  216. package/lib-module/OptimizeImage/utils/hasWebpSupport.js +0 -28
  217. package/lib-module/OptimizeImage/utils/index.js +0 -5
  218. package/lib-module/OptimizeImage/utils/isSvgUrl.js +0 -3
  219. package/lib-module/OrderedList/Item.js +0 -145
  220. package/lib-module/OrderedList/ItemBase.js +0 -27
  221. package/lib-module/OrderedList/OrderedList.js +0 -86
  222. package/lib-module/OrderedList/OrderedListBase.js +0 -45
  223. package/lib-module/OrderedList/constants.js +0 -2
  224. package/lib-module/OrderedList/index.js +0 -4
  225. package/lib-module/Paragraph/Paragraph.js +0 -90
  226. package/lib-module/Paragraph/index.js +0 -2
  227. package/lib-module/PreviewCard/AuthorDate.js +0 -57
  228. package/lib-module/PreviewCard/PreviewCard.js +0 -209
  229. package/lib-module/PreviewCard/index.js +0 -2
  230. package/lib-module/PriceLockup/PriceLockup.js +0 -335
  231. package/lib-module/PriceLockup/index.js +0 -2
  232. package/lib-module/PriceLockup/tokens.js +0 -55
  233. package/lib-module/Progress/ProgressBar.js +0 -83
  234. package/lib-module/Progress/index.js +0 -4
  235. package/lib-module/QuantitySelector/QuantitySelector.js +0 -261
  236. package/lib-module/QuantitySelector/SideButton.js +0 -70
  237. package/lib-module/QuantitySelector/dictionary.js +0 -26
  238. package/lib-module/QuantitySelector/index.js +0 -2
  239. package/lib-module/QuantitySelector/styles.js +0 -9
  240. package/lib-module/ResponsiveImage/ResponsiveImage.js +0 -95
  241. package/lib-module/ResponsiveImage/index.js +0 -2
  242. package/lib-module/Ribbon/Ribbon.js +0 -216
  243. package/lib-module/Ribbon/index.js +0 -2
  244. package/lib-module/SkeletonProvider/SkeletonImage.js +0 -39
  245. package/lib-module/SkeletonProvider/SkeletonProvider.js +0 -57
  246. package/lib-module/SkeletonProvider/SkeletonTypography.js +0 -38
  247. package/lib-module/SkeletonProvider/index.js +0 -2
  248. package/lib-module/Span/Span.js +0 -72
  249. package/lib-module/Span/index.js +0 -2
  250. package/lib-module/Spinner/Spinner.js +0 -215
  251. package/lib-module/Spinner/SpinnerContent.js +0 -94
  252. package/lib-module/Spinner/constants.js +0 -4
  253. package/lib-module/Spinner/index.js +0 -2
  254. package/lib-module/StoryCard/StoryCard.js +0 -212
  255. package/lib-module/StoryCard/index.js +0 -2
  256. package/lib-module/Table/Body.js +0 -17
  257. package/lib-module/Table/Cell.js +0 -176
  258. package/lib-module/Table/Header.js +0 -25
  259. package/lib-module/Table/Row.js +0 -19
  260. package/lib-module/Table/SubHeading.js +0 -23
  261. package/lib-module/Table/Table.js +0 -114
  262. package/lib-module/Table/index.js +0 -12
  263. package/lib-module/TermsAndConditions/ExpandCollapse.js +0 -153
  264. package/lib-module/TermsAndConditions/TermsAndConditions.js +0 -277
  265. package/lib-module/TermsAndConditions/dictionary.js +0 -16
  266. package/lib-module/TermsAndConditions/index.js +0 -1
  267. package/lib-module/Testimonial/Testimonial.js +0 -234
  268. package/lib-module/Testimonial/index.js +0 -2
  269. package/lib-module/Toast/Toast.js +0 -158
  270. package/lib-module/Toast/index.js +0 -2
  271. package/lib-module/Video/ControlBar/ControlBar.js +0 -288
  272. package/lib-module/Video/ControlBar/Controls/VideoButton/VideoButton.js +0 -70
  273. package/lib-module/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +0 -163
  274. package/lib-module/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +0 -203
  275. package/lib-module/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +0 -191
  276. package/lib-module/Video/MiddleControlButton/MiddleControlButton.js +0 -71
  277. package/lib-module/Video/Video.js +0 -959
  278. package/lib-module/Video/index.js +0 -2
  279. package/lib-module/Video/videoText.js +0 -55
  280. package/lib-module/VideoPicker/VideoPicker.js +0 -190
  281. package/lib-module/VideoPicker/VideoPickerPlayer.js +0 -48
  282. package/lib-module/VideoPicker/VideoPickerThumbnail.js +0 -218
  283. package/lib-module/VideoPicker/VideoSlider.js +0 -82
  284. package/lib-module/VideoPicker/index.js +0 -2
  285. package/lib-module/VideoPicker/videoPropType.js +0 -10
  286. package/lib-module/WaffleGrid/WaffleGrid.js +0 -157
  287. package/lib-module/WaffleGrid/index.js +0 -2
  288. package/lib-module/WebVideo/WebVideo.js +0 -191
  289. package/lib-module/WebVideo/index.js +0 -2
  290. package/lib-module/WebVideo/utils/index.js +0 -50
  291. package/lib-module/baseExports.js +0 -19
  292. package/lib-module/index.js +0 -40
  293. package/lib-module/server.js +0 -5
  294. package/lib-module/shared/ConditionalWrapper/ConditionalWrapper.js +0 -22
  295. package/lib-module/shared/ConditionalWrapper/index.js +0 -2
  296. package/lib-module/shared/FullBleedContent/FullBleedContent.js +0 -101
  297. package/lib-module/shared/FullBleedContent/getFullBleedBorderRadius.js +0 -55
  298. package/lib-module/shared/FullBleedContent/index.js +0 -4
  299. package/lib-module/shared/FullBleedContent/useFullBleedContentProps.js +0 -55
  300. package/lib-module/shared/VideoSplash/SplashButton/SplashButton.js +0 -84
  301. package/lib-module/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +0 -223
  302. package/lib-module/shared/VideoSplash/VideoSplash.js +0 -65
  303. package/lib-module/shared/VideoSplash/helpers.js +0 -23
  304. package/lib-module/utils/index.js +0 -10
  305. package/lib-module/utils/isElementFocusable.js +0 -8
  306. package/lib-module/utils/logger.js +0 -18
  307. package/lib-module/utils/media.js +0 -39
  308. package/lib-module/utils/renderStructuredContent.js +0 -66
  309. package/lib-module/utils/ssr.js +0 -37
  310. package/lib-module/utils/theming/get-theme-from-server.js +0 -16
  311. package/lib-module/utils/theming/with-client-theme.js +0 -24
  312. package/lib-module/utils/theming/with-server-theme.js +0 -26
  313. package/lib-module/utils/transforms.js +0 -4
  314. package/lib-module/utils/useOverlaidPosition.js +0 -216
  315. package/lib-module/utils/useTypographyTheme.js +0 -24
@@ -1,118 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import styled from 'styled-components';
4
- import { applyTextStyles, selectSystemProps, useCopy, useThemeTokens, variantProp } from '@telus-uds/components-base';
5
- import dictionary from './dictionary';
6
- import { htmlAttrs } from '../utils';
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
9
- const StyledSup = /*#__PURE__*/styled.sup.withConfig({
10
- displayName: "FootnoteLink__StyledSup",
11
- componentId: "components-web__sc-17nd7xo-0"
12
- })(_ref => {
13
- let {
14
- fontSize,
15
- lineHeight,
16
- paddingLeft,
17
- paddingRight,
18
- ...fontNameAndWeight
19
- } = _ref;
20
- return {
21
- border: 0,
22
- color: 'inherit',
23
- cursor: 'pointer',
24
- // we want to fallback on 'smaller' but have a valid size when a custom font size is provided.
25
- fontSize: fontSize ? `${fontSize}px` : 'smaller',
26
- lineHeight: lineHeight ?? `${fontSize * 2}px`,
27
- margin: 0,
28
- paddingVertical: 0,
29
- paddingLeft,
30
- paddingRight,
31
- textDecoration: 'underline',
32
- // apply font family
33
- ...applyTextStyles(fontNameAndWeight)
34
- };
35
- });
36
-
37
- /**
38
- * Use `FootnoteLink` to open `Footnote` component and display related legal content.
39
- *
40
- * ## Usage Criteria
41
- *
42
- * - Use FootnoteLink to open a Footnote component and display related legal content.
43
- * - Avoid using FootnoteLink if there is only one annotation on a page. Consider including
44
- * the annotation as part of the content whenever possible.
45
- */
46
- const FootnoteLink = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
47
- let {
48
- copy = 'en',
49
- number = [],
50
- onClick,
51
- fontSize,
52
- tokens,
53
- variant = {},
54
- ...rest
55
- } = _ref2;
56
- const themeTokens = useThemeTokens('FootnoteLink', tokens, variant);
57
- const numbers = Array.isArray(number) ? number : [number];
58
- const refs = numbers.map(() => /*#__PURE__*/React.createRef());
59
- const handleClick = index => {
60
- onClick(numbers[index], refs[index]);
61
- };
62
- const getCopy = useCopy({
63
- dictionary,
64
- copy
65
- });
66
- const handleOnClick = (event, index) => {
67
- event.preventDefault();
68
- event.stopPropagation();
69
- handleClick(index);
70
- };
71
- const handleOnKeyDown = (event, index) => {
72
- if (event.key === 'Enter' || event.key === 13) {
73
- handleClick(index);
74
- }
75
- };
76
- return /*#__PURE__*/_jsx("span", {
77
- ref: ref,
78
- children: numbers.map((num, index) => /*#__PURE__*/_jsx(StyledSup, {
79
- onKeyDown: event => handleOnKeyDown(event, index),
80
- role: "button",
81
- "aria-label": getCopy('a11yLabel'),
82
- ref: refs[index],
83
- onClick: event => handleOnClick(event, index),
84
- tabIndex: 0,
85
- ...selectProps(rest),
86
- ...themeTokens,
87
- fontSize: fontSize ?? themeTokens.fontSize,
88
- children: `${num}${index !== numbers.length - 1 ? ',' : ''}`
89
- }, num))
90
- });
91
- });
92
- FootnoteLink.displayName = 'FootnoteLink';
93
- const copyShape = PropTypes.shape({
94
- a11yLabel: PropTypes.string.isRequired
95
- });
96
- FootnoteLink.propTypes = {
97
- ...selectedSystemPropTypes,
98
- variant: variantProp.propType,
99
- /**
100
- * Use the `copy` prop to either select provided English or French copy by passing 'en' or 'fr' respectively.
101
- * To provide your own, pass a JSON object with the key `a11yLabel`.
102
- */
103
- copy: PropTypes.oneOfType([PropTypes.oneOf(['en', 'fr']), copyShape]),
104
- /**
105
- * The footnote number, or multiple numbers if passed as an array.
106
- * If using an array, a comma-separated group of numbers will be rendered as superscript.
107
- */
108
- number: PropTypes.oneOfType([PropTypes.number, PropTypes.arrayOf(PropTypes.number), PropTypes.string, PropTypes.arrayOf(PropTypes.string)]).isRequired,
109
- /**
110
- * A callback function to handle the click of a FootnoteLink.
111
- */
112
- onClick: PropTypes.func.isRequired,
113
- /**
114
- * Override default `fontSize` to set specific font size value
115
- */
116
- fontSize: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
117
- };
118
- export default FootnoteLink;
@@ -1,12 +0,0 @@
1
- export default {
2
- en: {
3
- a11yLabel: 'Read legal footnote',
4
- close: 'close',
5
- heading: 'Terms and conditions'
6
- },
7
- fr: {
8
- a11yLabel: 'Lire la note de bas de page légale',
9
- close: 'fermer',
10
- heading: 'Modalités et conditions'
11
- }
12
- };
@@ -1,4 +0,0 @@
1
- import Footnote from './Footnote';
2
- import FootnoteLink from './FootnoteLink';
3
- Footnote.Link = FootnoteLink;
4
- export default Footnote;
@@ -1,55 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { IconButton as IconButtonBase, useThemeTokens, getTokensPropType } from '@telus-uds/components-base';
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- const IconButton = /*#__PURE__*/React.forwardRef((_ref, ref) => {
6
- let {
7
- icon = null,
8
- action,
9
- tokens = {},
10
- variant = {},
11
- ...iconButtonProps
12
- } = _ref;
13
- const variantWithAction = action && !variant.action ? {
14
- ...variant,
15
- action
16
- } : variant;
17
- const {
18
- icon: themeIcon
19
- } = useThemeTokens('IconButton', tokens, variantWithAction);
20
- return (
21
- /*#__PURE__*/
22
- // If we want the arrow icons to have directional animation instead of scale, we can pass
23
- // either appropriate iconTransateX/Y here, or define and pass variants like { direction: 'left' }
24
- // which have theme rules that set `iconTranslateX` tokens in the theme rules and unset `iconScale`.
25
- _jsx(IconButtonBase, {
26
- ref: ref,
27
- ...iconButtonProps,
28
- tokens: tokens,
29
- variant: variant,
30
- icon: icon ?? themeIcon
31
- })
32
- );
33
- });
34
- const multiBrandIconNames = ['add', 'subtract', 'close', 'play', 'moveUp', 'moveDown', 'moveLeft', 'moveRight', 'expand'];
35
- IconButton.displayName = 'IconButton';
36
- const propsWithoutIcon = _ref2 => {
37
- let {
38
- icon,
39
- ...props
40
- } = _ref2;
41
- return props;
42
- };
43
- IconButton.propTypes = {
44
- ...propsWithoutIcon(IconButtonBase.propTypes),
45
- tokens: getTokensPropType('IconButton'),
46
- /**
47
- * To set the icon to a multi-brand compatabile icon
48
- */
49
- action: PropTypes.oneOf(multiBrandIconNames),
50
- /**
51
- * To set a custom icon
52
- */
53
- icon: PropTypes.func
54
- };
55
- export default IconButton;
@@ -1,2 +0,0 @@
1
- import IconButton from './IconButton';
2
- export default IconButton;
@@ -1,83 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { htmlAttrs, selectSystemProps, getTokensPropType } from '@telus-uds/components-base/server';
4
- import { warn } from '../utils/logger';
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
7
- const Image = /*#__PURE__*/React.forwardRef((_ref, ref) => {
8
- let {
9
- src,
10
- width,
11
- height,
12
- alt,
13
- rounded,
14
- loading = 'eager',
15
- tokens,
16
- theme,
17
- variant,
18
- ...rest
19
- } = _ref;
20
- let {
21
- borderRadius
22
- } = theme;
23
- const isCircle = rounded === 'circle';
24
- const isCorners = rounded === 'corners';
25
- const isSquare = width === height;
26
- if (isCircle && !isSquare) {
27
- warn('Image', 'rounded="circle" is not supported for non-square images. Please provide a square image, otherwise the resulting shape will not be a circle.');
28
- }
29
- if (isCircle) {
30
- borderRadius = '50%';
31
- } else if (isCorners) {
32
- borderRadius = '4px';
33
- }
34
- const style = {
35
- borderRadius,
36
- height: height ?? 'auto',
37
- maxWidth: '100%'
38
- };
39
- return /*#__PURE__*/_jsx("img", {
40
- ...selectProps(rest),
41
- style: style,
42
- src: src,
43
- width: width,
44
- height: height,
45
- alt: alt,
46
- loading: loading,
47
- ref: ref
48
- });
49
- });
50
- Image.displayName = 'Image';
51
- Image.propTypes = {
52
- ...selectedSystemPropTypes,
53
- /**
54
- * The src attribute for the HTML img element.
55
- */
56
-
57
- src: PropTypes.string.isRequired,
58
- /**
59
- * The alt attribute for the HTML img element. Setting this attribute to an empty string (alt="") indicates that this image is not a key part of the content, and that non-visual browsers may omit it from rendering.
60
- */
61
- alt: PropTypes.string.isRequired,
62
- /**
63
- * The image's width.
64
- */
65
- width: PropTypes.number.isRequired,
66
- /**
67
- * The image's height.
68
- */
69
- height: PropTypes.number,
70
- /**
71
- * Loading strategy.
72
- * @default 'eager'
73
- * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading
74
- */
75
- loading: PropTypes.oneOf(['eager', 'lazy']),
76
- /**
77
- * Make image render as a circle or with rounded corners.
78
- */
79
- rounded: PropTypes.oneOf(['circle', 'corners']),
80
- tokens: getTokensPropType('Image')
81
- };
82
- Image.displayName = 'Image';
83
- export default Image;
@@ -1,9 +0,0 @@
1
- 'use client';
2
-
3
- import Image from './Image';
4
- import withClientTheme from '../utils/theming/with-client-theme';
5
-
6
- // Exporting the unwrapped component separately for react-docgen to extract info for docsite
7
- export { Image as DefaultImage };
8
- const ClientThemedImage = withClientTheme(Image);
9
- export default ClientThemedImage;
@@ -1,4 +0,0 @@
1
- import withServerTheme from '../utils/theming/with-server-theme';
2
- import Image from './Image';
3
- const ServerThemedImage = withServerTheme(Image, 'Image');
4
- export default ServerThemedImage;
@@ -1,2 +0,0 @@
1
- import { ListBase as List } from '@telus-uds/components-base';
2
- export default List;
@@ -1,28 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { ListItem as ListItemBase, Typography } from '@telus-uds/components-base';
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- import { jsxs as _jsxs } from "react/jsx-runtime";
6
- const ListItem = /*#__PURE__*/React.forwardRef((_ref, ref) => {
7
- let {
8
- children,
9
- title,
10
- ...rest
11
- } = _ref;
12
- return /*#__PURE__*/_jsxs(ListItemBase, {
13
- ref: ref,
14
- ...rest,
15
- children: [Boolean(title) && /*#__PURE__*/_jsx(Typography, {
16
- variant: {
17
- size: 'h4'
18
- },
19
- children: title
20
- }), children]
21
- });
22
- });
23
- ListItem.displayName = 'ListItem';
24
- ListItem.propTypes = {
25
- children: PropTypes.node.isRequired,
26
- title: PropTypes.string
27
- };
28
- export default ListItem;
@@ -1,4 +0,0 @@
1
- import List from './List';
2
- import ListItem from './ListItem';
3
- List.Item = ListItem;
4
- export default List;
@@ -1,224 +0,0 @@
1
- var _withLinkRouter$propT, _withLinkRouter$propT2, _withLinkRouter$propT3, _withLinkRouter$propT4;
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
- import { selectSystemProps, StackView, Typography, useResponsiveProp, withLinkRouter } from '@telus-uds/components-base';
5
- import styled from 'styled-components';
6
- import { htmlAttrs } from '../utils';
7
- import NavigationItem from './NavigationItem';
8
- import NavigationSubMenu from './NavigationSubMenu';
9
- import collapseItems from './collapseItems';
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- import { jsxs as _jsxs } from "react/jsx-runtime";
12
- const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
13
- const Heading = /*#__PURE__*/styled.div.withConfig({
14
- displayName: "NavigationBar__Heading",
15
- componentId: "components-web__sc-1vis1gt-0"
16
- })({
17
- alignItems: 'center',
18
- display: 'flex',
19
- flex: 1,
20
- justifyContent: 'flex-start',
21
- '> *': {
22
- display: 'contents',
23
- letterSpacing: 0
24
- }
25
- });
26
-
27
- /**
28
- * NavigationBar can be used to allow customers to consistently navigate across
29
- * key pages within a specific product line
30
- */
31
- const NavigationBar = /*#__PURE__*/React.forwardRef((_ref, ref) => {
32
- let {
33
- accessibilityRole = 'navigation',
34
- heading,
35
- headingLevel = 'h1',
36
- items,
37
- onChange = () => {},
38
- selectedId,
39
- LinkRouter,
40
- linkRouterProps,
41
- ...rest
42
- } = _ref;
43
- const direction = useResponsiveProp({
44
- xs: 'column',
45
- sm: 'row'
46
- });
47
- const itemsForViewport = useResponsiveProp({
48
- xs: collapseItems(items, selectedId),
49
- lg: items
50
- });
51
- const openOverlayRef = React.useRef(null);
52
- const [openSubMenuId, setOpenSubMenuId] = React.useState(null);
53
- const handleSubMenuClose = event => {
54
- var _openOverlayRef$curre, _openOverlayRef$curre2;
55
- if (event.type === 'keydown') {
56
- if (event.key === 'Escape' || event.key === 27) {
57
- setOpenSubMenuId(null);
58
- }
59
- } else if (event.type === 'click' && openOverlayRef !== null && openOverlayRef !== void 0 && openOverlayRef.current && event.target && !(openOverlayRef !== null && openOverlayRef !== void 0 && (_openOverlayRef$curre = openOverlayRef.current) !== null && _openOverlayRef$curre !== void 0 && _openOverlayRef$curre.contains(event.target))) {
60
- setOpenSubMenuId(null);
61
- } else if (event.type === 'touchstart' && openOverlayRef !== null && openOverlayRef !== void 0 && openOverlayRef.current && event.touches[0].target && !(openOverlayRef !== null && openOverlayRef !== void 0 && (_openOverlayRef$curre2 = openOverlayRef.current) !== null && _openOverlayRef$curre2 !== void 0 && _openOverlayRef$curre2.contains(event.touches[0].target))) {
62
- setOpenSubMenuId(null);
63
- }
64
- };
65
- const navRefDefault = React.useRef(null);
66
- const navRef = ref ?? navRefDefault;
67
- const itemsRef = React.useRef(null);
68
-
69
- // Close the submenu when the user clicks outside the navigation bar
70
- const handleMouseDown = React.useCallback(event => {
71
- if (navRef.current && itemsRef.current) {
72
- // Get the bounding rectangles of the navigation bar and the items container
73
- const navRect = navRef.current.getBoundingClientRect();
74
- const itemsRect = itemsRef.current.getBoundingClientRect();
75
-
76
- // Check if the click was outside the navigation bar and the items container
77
- const isOutsideNav = event.clientX < navRect.left || event.clientX > navRect.right || event.clientY < navRect.top || event.clientY > navRect.bottom;
78
- const isOutsideItems = event.clientX < itemsRect.left || event.clientX > itemsRect.right || event.clientY < itemsRect.top || event.clientY > itemsRect.bottom;
79
- if (isOutsideNav && isOutsideItems) {
80
- setOpenSubMenuId(null);
81
- }
82
- }
83
- }, [navRef, itemsRef, setOpenSubMenuId]);
84
-
85
- // TODO: create a custom hook for that and use here and in the Footnote
86
- React.useEffect(() => {
87
- // Add listeners for mouse clicks outside and for key presses
88
- document.addEventListener('mousedown', handleMouseDown);
89
- if (openSubMenuId !== null) {
90
- window.addEventListener('click', handleSubMenuClose);
91
- window.addEventListener('keydown', handleSubMenuClose);
92
- window.addEventListener('touchstart', handleSubMenuClose);
93
- }
94
- return () => {
95
- // Remove listeners when the component is unmounted
96
- document.removeEventListener('mousedown', handleMouseDown);
97
- if (openSubMenuId !== null) {
98
- window.removeEventListener('click', handleSubMenuClose);
99
- window.removeEventListener('keydown', handleSubMenuClose);
100
- window.removeEventListener('touchstart', handleSubMenuClose);
101
- }
102
- };
103
- }, [openSubMenuId, handleMouseDown]);
104
- return /*#__PURE__*/_jsxs(StackView, {
105
- accessibilityRole: accessibilityRole,
106
- direction: direction,
107
- ref: navRef,
108
- space: 2,
109
- tokens: {
110
- alignItems: direction === 'column' ? 'flex-start' : 'center',
111
- justifyContent: 'flex-end'
112
- },
113
- ...selectProps(rest),
114
- children: [heading && /*#__PURE__*/_jsx(Heading, {
115
- children: /*#__PURE__*/_jsx(Typography, {
116
- variant: {
117
- size: 'h5'
118
- },
119
- heading: headingLevel,
120
- children: heading
121
- })
122
- }), itemsForViewport === null || itemsForViewport === void 0 ? void 0 : itemsForViewport.map((_ref2, index) => {
123
- let {
124
- href,
125
- label,
126
- id,
127
- onClick,
128
- ref: itemRef,
129
- LinkRouter: ItemLinkRouter = LinkRouter,
130
- linkRouterProps: itemLinkRouterProps,
131
- items: nestedItems,
132
- ...itemRest
133
- } = _ref2;
134
- const itemId = id ?? label;
135
- const handleClick = event => {
136
- if (nestedItems) {
137
- setOpenSubMenuId(openSubMenuId !== itemId ? itemId : null);
138
- }
139
- onClick === null || onClick === void 0 ? void 0 : onClick(event);
140
- onChange === null || onChange === void 0 ? void 0 : onChange(itemId, event);
141
- };
142
- const ItemComponent = nestedItems ? NavigationSubMenu : NavigationItem;
143
- const isOpen = itemId === openSubMenuId;
144
- return /*#__PURE__*/_jsx(ItemComponent, {
145
- ref: itemRef,
146
- href: href,
147
- onClick: handleClick
148
- // TODO: refactor to pass selected ID via context
149
- ,
150
- selectedId: selectedId,
151
- index: index,
152
- LinkRouter: ItemLinkRouter,
153
- linkRouterProps: {
154
- ...linkRouterProps,
155
- ...itemLinkRouterProps
156
- },
157
- items: nestedItems,
158
- selected: itemId === selectedId,
159
- itemsContainerRef: itemsRef,
160
- ...itemRest,
161
- ...(nestedItems && {
162
- isOpen
163
- }),
164
- ...(nestedItems && isOpen && {
165
- openOverlayRef
166
- }),
167
- children: label
168
- }, itemId);
169
- })]
170
- });
171
- });
172
- NavigationBar.displayName = 'NavigationBar';
173
- NavigationBar.propTypes = {
174
- ...selectedSystemPropTypes,
175
- ...withLinkRouter.propTypes,
176
- /**
177
- * NavigationBar pages
178
- *
179
- * Each `item` object must contain:
180
- * - `heading` - user-facing text in the tab link
181
- * - `href` - the URL of the page linked to. Do not use hash links, for content within a page, use `Tabs`.
182
- * - `id` - a stable, unique identifier of the page within the set. Not written into the HTML.
183
- */
184
- items: PropTypes.arrayOf(PropTypes.shape({
185
- label: PropTypes.string.isRequired,
186
- href: PropTypes.string,
187
- id: PropTypes.string.isRequired,
188
- onClick: PropTypes.func,
189
- selected: PropTypes.bool,
190
- LinkRouter: (_withLinkRouter$propT = withLinkRouter.propTypes) === null || _withLinkRouter$propT === void 0 ? void 0 : _withLinkRouter$propT.LinkRouter,
191
- linkRouterProps: (_withLinkRouter$propT2 = withLinkRouter.propTypes) === null || _withLinkRouter$propT2 === void 0 ? void 0 : _withLinkRouter$propT2.linkRouterProps,
192
- // One layer of nested links is allowed
193
- items: PropTypes.arrayOf(PropTypes.shape({
194
- label: PropTypes.string.isRequired,
195
- href: PropTypes.string,
196
- id: PropTypes.string.isRequired,
197
- onClick: PropTypes.func,
198
- selected: PropTypes.bool,
199
- LinkRouter: (_withLinkRouter$propT3 = withLinkRouter.propTypes) === null || _withLinkRouter$propT3 === void 0 ? void 0 : _withLinkRouter$propT3.LinkRouter,
200
- linkRouterProps: (_withLinkRouter$propT4 = withLinkRouter.propTypes) === null || _withLinkRouter$propT4 === void 0 ? void 0 : _withLinkRouter$propT4.linkRouterProps
201
- }))
202
- })).isRequired,
203
- /**
204
- * Common navigation bar heading.
205
- */
206
- heading: PropTypes.string,
207
- /**
208
- * Sets the `headingLevel` of the `heading`
209
- */
210
- headingLevel: PropTypes.oneOf(['h1', 'h2', 'h3', 'h4', 'h5', 'h6']),
211
- /**
212
- * Matches the `id` property of the item in `items` corresponding to the current page
213
- */
214
- selectedId: PropTypes.string.isRequired,
215
- /**
216
- * Optional function to be called on pressing a link
217
- */
218
- onChange: PropTypes.func,
219
- /**
220
- * Accesibility role for stackview
221
- */
222
- accessibilityRole: PropTypes.string
223
- };
224
- export default NavigationBar;
@@ -1,87 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Button, selectSystemProps, useResponsiveProp, useViewport, useThemeTokensCallback, getTokensPropType } from '@telus-uds/components-base';
4
- import styled from 'styled-components';
5
- import { htmlAttrs } from '../utils';
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
8
- const defaultMaxWidth = 192;
9
- const ItemContainer = /*#__PURE__*/styled.div.withConfig({
10
- displayName: "NavigationItem__ItemContainer",
11
- componentId: "components-web__sc-ql9x7c-0"
12
- })(_ref => {
13
- let {
14
- targetWidth
15
- } = _ref;
16
- return {
17
- display: 'flex',
18
- flexDirection: 'column',
19
- justifyContent: 'center',
20
- maxWidth: `${Math.max(defaultMaxWidth, targetWidth ?? 0)}px`,
21
- flexGrow: targetWidth ? 1 : 0,
22
- flexShrink: 1
23
- };
24
- });
25
-
26
- /**
27
- * NavigationItem within a NavigationBar component.
28
- *
29
- * This is rendered automatically by `NavigationBar` and isn't intended be used directly.
30
- */
31
- const NavigationItem = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
32
- let {
33
- accessibilityRole = 'link',
34
- // @todo switch to 'button' for dropdowns
35
- children,
36
- id,
37
- onClick: handleClick = () => {},
38
- selected = false,
39
- accessibilityState = {
40
- current: selected ? 'page' : false
41
- },
42
- href,
43
- tokens,
44
- variant = {},
45
- LinkRouter,
46
- linkRouterProps,
47
- ...rest
48
- } = _ref2;
49
- const selectedProps = selectProps(rest);
50
- const targetWidth = useResponsiveProp({
51
- xs: 288,
52
- lg: null
53
- });
54
- const viewport = useViewport();
55
- const getTokens = useThemeTokensCallback('NavigationBar', tokens, variant);
56
- const getStateTokens = state => getTokens({
57
- ...state,
58
- viewport
59
- });
60
- return /*#__PURE__*/_jsx(ItemContainer, {
61
- targetWidth: targetWidth,
62
- children: /*#__PURE__*/_jsx(Button, {
63
- accessibilityRole: accessibilityRole,
64
- accessibilityState: accessibilityState,
65
- onPress: handleClick,
66
- ref: ref,
67
- tokens: getStateTokens,
68
- variant: {
69
- selected
70
- },
71
- href: href,
72
- LinkRouter: LinkRouter,
73
- linkRouterProps: linkRouterProps,
74
- ...selectedProps,
75
- children: children
76
- })
77
- });
78
- });
79
- NavigationItem.displayName = 'NavigationItem';
80
- NavigationItem.propTypes = {
81
- ...selectedSystemPropTypes,
82
- tokens: getTokensPropType('NavigationBar'),
83
- onClick: PropTypes.func,
84
- selected: PropTypes.bool,
85
- children: PropTypes.oneOfType([PropTypes.string, PropTypes.func]).isRequired
86
- };
87
- export default NavigationItem;