@telus-uds/components-web 2.43.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 +21 -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 +105 -101
  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 +17 -4
  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 -506
  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,251 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Card as CardBase, getTokensPropType, paddingProp, responsiveProps, selectSystemProps, StackView, useThemeTokens, useThemeTokensCallback, variantProp, a11yProps, viewProps, PressableCardBase } from '@telus-uds/components-base';
4
- import { useResponsiveProp } from '@telus-uds/components-web';
5
- import styled from 'styled-components';
6
- import CardContent from './CardContent';
7
- import CardFooter from './CardFooter';
8
- import FullBleedContent, { getFullBleedBorderRadius, useFullBleedContentProps } from '../shared/FullBleedContent';
9
- import ConditionalWrapper from '../shared/ConditionalWrapper';
10
-
11
- // Passes React Native-oriented system props through UDS Card
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- import { jsxs as _jsxs } from "react/jsx-runtime";
14
- const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
15
-
16
- /**
17
- * A basic card component, unstyled by default.
18
- *
19
- * ## Component API
20
- *
21
- * ### With Footer
22
- *
23
- * Pass any component or simply a string in the `footer` prop in order to render
24
- * a card with a footer (which uses the `alternative` background).
25
- *
26
- * ### With Full Bleed Content
27
- *
28
- * Use `fullBleedContent` prop to add a full bleed style image, video or other content to the
29
- * card. This prop accepts an object with the following properties:
30
- * - `alt`: alt tag for an image,
31
- * - `src`: default image source,
32
- * - `position`: `none`, `bottom`, `left`, `right` or `top`, depending on where you would like your full bleed image to be placed,
33
- * - `imgCol`: set the span of the image per viewport (based on 12 column value for width of card) when `position` of image is on `left` or `right`
34
- * - all the props from the `ResponsiveImage` component in case you want that full bleed image to be responsive,
35
- * - `content`: pass a custom JSX to be used for rendering of the full bleed content (defaults to `ResponsiveImage`
36
- * receiving the other props).
37
- *
38
- * Note that `position` can be responsive, i.e. different for different viewports. A full bleed content with position
39
- * {xs: 'none', md: 'left'} for example, will have a full bleed content to the left of card content when viewed on desktops
40
- * viewports, and no content when viewed on mobile viewports.
41
- *
42
- * ## Accessibility
43
- * `Card` component accepts all the standard accessibility props.
44
- */
45
- const DynamicWidthContainer = /*#__PURE__*/styled.div.withConfig({
46
- displayName: "Card__DynamicWidthContainer",
47
- componentId: "components-web__sc-1elbtwd-0"
48
- })(_ref => {
49
- let {
50
- width,
51
- display,
52
- borderRadius,
53
- overflow
54
- } = _ref;
55
- return {
56
- width,
57
- display,
58
- borderRadius,
59
- overflow
60
- };
61
- });
62
- const Card = /*#__PURE__*/React.forwardRef(function () {
63
- let {
64
- children,
65
- footer,
66
- footerPadding,
67
- fullBleedImage,
68
- fullBleedContent = fullBleedImage,
69
- tokens = {},
70
- variant,
71
- interactiveCard,
72
- onPress,
73
- dataSet,
74
- backgroundImage,
75
- ...rest
76
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
77
- fullBleedContent: {
78
- position: null
79
- }
80
- };
81
- let ref = arguments.length > 1 ? arguments[1] : undefined;
82
- const {
83
- contentStackAlign,
84
- contentStackDirection,
85
- fullBleedContentPosition,
86
- fullBleedContentProps
87
- } = useFullBleedContentProps(fullBleedContent);
88
- const {
89
- imgCol
90
- } = fullBleedContentProps;
91
-
92
- // If the card has rounded corners and a full bleed image, we need to apply
93
- // those corners on the image as well, but partially
94
- const {
95
- borderRadius
96
- } = useThemeTokens('Card', tokens, variant);
97
- const getThemeTokens = useThemeTokensCallback('Card', interactiveCard === null || interactiveCard === void 0 ? void 0 : interactiveCard.tokens, {
98
- interactive: true,
99
- ...((interactiveCard === null || interactiveCard === void 0 ? void 0 : interactiveCard.variant) || {})
100
- });
101
- const hasFooter = Boolean(footer);
102
- const fullBleedBorderRadius = getFullBleedBorderRadius(borderRadius, fullBleedContentPosition, hasFooter);
103
-
104
- // takes imgCol from fullBleedContent if present, to dynamically set width of image
105
- // card content will adapt to the size of image to add up to 100% width of card width
106
- // pass as props to ConditionalWrapper
107
- const imgColCurrentViewport = useResponsiveProp(imgCol);
108
- const maxCol = 12;
109
- const fullBleedImageWidth = `${imgColCurrentViewport / maxCol * 100}%`;
110
- const adaptiveContentWidth = `${(maxCol - imgColCurrentViewport) / maxCol * 100}%`;
111
- const isImageWidthAdjustable = imgCol && (fullBleedContentPosition === 'left' || fullBleedContentPosition === 'right');
112
- const contentWrapperStyleProps = {
113
- width: adaptiveContentWidth,
114
- display: imgColCurrentViewport >= maxCol ? 'none' : undefined
115
- };
116
- const imageWrapperStyleProps = {
117
- width: fullBleedImageWidth,
118
- borderRadius: imgColCurrentViewport >= maxCol ? borderRadius : undefined,
119
- overflow: imgColCurrentViewport >= maxCol ? 'hidden' : undefined,
120
- display: imgColCurrentViewport === 0 ? 'none' : undefined
121
- };
122
- const columnFlex = {
123
- flexGrow: interactiveCard !== null && interactiveCard !== void 0 && interactiveCard.body ? 0 : 1,
124
- flexShrink: 1,
125
- justifyContent: 'space-between'
126
- };
127
- // When interactive area is present, spacing tokens should only be applied
128
- // to individual Card sections, not Card as a whole
129
- const {
130
- paddingTop,
131
- paddingBottom,
132
- paddingLeft,
133
- paddingRight,
134
- ...restOfTokens
135
- } = tokens;
136
- return /*#__PURE__*/_jsxs(CardBase, {
137
- ref: ref,
138
- variant: {
139
- ...variant,
140
- padding: 'custom'
141
- },
142
- tokens: restOfTokens,
143
- backgroundImage: backgroundImage,
144
- ...selectProps(rest),
145
- children: [interactiveCard !== null && interactiveCard !== void 0 && interactiveCard.body ? /*#__PURE__*/_jsx(PressableCardBase, {
146
- ref: ref,
147
- tokens: getThemeTokens,
148
- dataSet: dataSet,
149
- onPress: onPress,
150
- ...selectProps(rest),
151
- children: typeof (interactiveCard === null || interactiveCard === void 0 ? void 0 : interactiveCard.body) === 'function' ? interactiveCard.body() : interactiveCard.body
152
- }) : null, children || fullBleedContentPosition !== 'none' ? /*#__PURE__*/_jsxs(StackView, {
153
- direction: contentStackDirection,
154
- tokens: {
155
- ...columnFlex,
156
- alignItems: contentStackAlign
157
- },
158
- space: 0,
159
- children: [children ? /*#__PURE__*/_jsx(ConditionalWrapper, {
160
- WrapperComponent: DynamicWidthContainer,
161
- wrapperProps: contentWrapperStyleProps,
162
- condition: isImageWidthAdjustable,
163
- children: /*#__PURE__*/_jsx(CardContent, {
164
- tokens: tokens,
165
- variant: variant,
166
- withFooter: hasFooter,
167
- children: children
168
- })
169
- }) : null, fullBleedContentPosition !== 'none' && /*#__PURE__*/_jsx(ConditionalWrapper, {
170
- WrapperComponent: DynamicWidthContainer,
171
- wrapperProps: imageWrapperStyleProps,
172
- condition: isImageWidthAdjustable,
173
- children: /*#__PURE__*/_jsx(FullBleedContent, {
174
- borderRadius: fullBleedBorderRadius,
175
- ...fullBleedContentProps,
176
- position: fullBleedContentPosition
177
- })
178
- })]
179
- }) : null, footer && /*#__PURE__*/_jsx(CardFooter, {
180
- padding: footerPadding,
181
- tokens: tokens,
182
- variant: variant,
183
- children: footer
184
- })]
185
- });
186
- });
187
- const positionValues = ['none', 'bottom', 'left', 'right', 'top'];
188
- const alignValues = ['start', 'end', 'center', 'stretch'];
189
- const PositionedFullBleedContentPropType = PropTypes.shape({
190
- position: responsiveProps.getTypeOptionallyByViewport(PropTypes.oneOf(positionValues)).isRequired,
191
- align: responsiveProps.getTypeOptionallyByViewport(PropTypes.oneOf(alignValues)),
192
- // eslint-disable-next-line react/forbid-foreign-prop-types
193
- ...FullBleedContent.propTypes
194
- });
195
- Card.displayName = 'Card';
196
- Card.propTypes = {
197
- ...selectedSystemPropTypes,
198
- /**
199
- * Card content.
200
- */
201
- children: PropTypes.node,
202
- /**
203
- * Card footer.
204
- */
205
- footer: PropTypes.node,
206
- /**
207
- * Custom card footer padding.
208
- */
209
- footerPadding: paddingProp.propType,
210
- /**
211
- * Full bleed image to be placed on the card, deprecated in favor of `fullBleedContent`.
212
- *
213
- * @deprecated
214
- */
215
- fullBleedImage: PositionedFullBleedContentPropType,
216
- /**
217
- * Full bleed content to be placed on the card.
218
- */
219
- fullBleedContent: PositionedFullBleedContentPropType,
220
- /**
221
- * Card tokens.
222
- */
223
- tokens: getTokensPropType('Card'),
224
- /**
225
- * Card variant.
226
- */
227
- variant: variantProp.propType,
228
- /**
229
- * Function to call on pressing the card.
230
- * Note: This is only available when `interactive` variant is used.
231
- */
232
- onPress: PropTypes.func,
233
- /**
234
- * Object to set interactive card's properties
235
- */
236
- interactiveCard: PropTypes.shape({
237
- body: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
238
- tokens: getTokensPropType('Card'),
239
- variant: variantProp.propType
240
- }),
241
- /**
242
- * Apply background image to the card.
243
- */
244
- backgroundImage: PropTypes.shape({
245
- // src is either a URI string or an object when used responsively to provide different image sources for different screen sizes
246
- src: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired,
247
- alt: PropTypes.string,
248
- resizeMode: responsiveProps.getTypeOptionallyByViewport(PropTypes.oneOf(['cover', 'contain', 'stretch', 'repeat', 'center']))
249
- })
250
- };
251
- export default Card;
@@ -1,90 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { getTokensPropType, selectSystemProps, useThemeTokens, useViewport, variantProp } 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 CardContentContainer = /*#__PURE__*/styled.div.withConfig({
9
- displayName: "CardContent__CardContentContainer",
10
- componentId: "components-web__sc-1k2501q-0"
11
- })(_ref => {
12
- let {
13
- borderRadius,
14
- paddingBottom,
15
- paddingLeft,
16
- paddingRight,
17
- paddingTop,
18
- withFooter,
19
- contentAlignItems: alignItems,
20
- contentFlexGrow: flexGrow,
21
- contentFlexShrink: flexShrink,
22
- contentJustifyContent: justifyContent,
23
- borderWidth
24
- } = _ref;
25
- return {
26
- // We need to make sure to have sharp corners on the bottom
27
- // if the card has a footer
28
- borderBottomLeftRadius: withFooter ? 0 : borderRadius,
29
- borderBottomRightRadius: withFooter ? 0 : borderRadius,
30
- borderTopLeftRadius: borderRadius,
31
- borderTopRightRadius: borderRadius,
32
- paddingBottom: paddingBottom - borderWidth,
33
- paddingLeft: paddingLeft - borderWidth,
34
- paddingRight: paddingRight - borderWidth,
35
- paddingTop: paddingTop - borderWidth,
36
- display: 'flex',
37
- flexDirection: 'column',
38
- alignItems,
39
- flexGrow,
40
- flexShrink,
41
- justifyContent
42
- };
43
- });
44
-
45
- /**
46
- * Card content, applying the card tokens as per the theme used.
47
- */
48
- const CardContent = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
49
- let {
50
- children,
51
- flexContent,
52
- tokens,
53
- variant,
54
- withFooter = false,
55
- ...rest
56
- } = _ref2;
57
- const viewport = useViewport();
58
- const themeTokens = useThemeTokens('Card', tokens, variant, {
59
- viewport
60
- });
61
- return /*#__PURE__*/_jsx(CardContentContainer, {
62
- ...themeTokens,
63
- flexContent: flexContent,
64
- withFooter: withFooter,
65
- ref: ref,
66
- ...selectProps(rest),
67
- children: children
68
- });
69
- });
70
- CardContent.displayName = 'CardContent';
71
- CardContent.propTypes = {
72
- ...selectedSystemPropTypes,
73
- /**
74
- * Card section content.
75
- */
76
- children: PropTypes.node,
77
- /**
78
- * Card tokens.
79
- */
80
- tokens: getTokensPropType('Card'),
81
- /**
82
- * Card variant.
83
- */
84
- variant: variantProp.propType,
85
- /**
86
- * Whether the card has a footer.
87
- */
88
- withFooter: PropTypes.bool
89
- };
90
- export default CardContent;
@@ -1,78 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { getTokensPropType, paddingProp, selectSystemProps, useThemeTokens, useViewport, variantProp } 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 CardFooterContainer = /*#__PURE__*/styled.div.withConfig({
9
- displayName: "CardFooter__CardFooterContainer",
10
- componentId: "components-web__sc-pm6vns-0"
11
- })(_ref => {
12
- let {
13
- backgroundColor,
14
- borderRadius,
15
- paddingBottom,
16
- paddingLeft,
17
- paddingRight,
18
- paddingTop
19
- } = _ref;
20
- return {
21
- backgroundColor,
22
- borderBottomLeftRadius: borderRadius,
23
- borderBottomRightRadius: borderRadius,
24
- // @todo circle back to the following non-standard value to
25
- // see if it can be integrated into the palette
26
- boxShadow: 'inset 0px 1px 3px rgba(0, 0, 0, 0.05)',
27
- paddingBottom,
28
- paddingLeft,
29
- paddingRight,
30
- paddingTop
31
- };
32
- });
33
-
34
- /**
35
- * Card footer, applying the tokens as per the theme used.
36
- */
37
- const CardFooter = _ref2 => {
38
- let {
39
- children,
40
- padding,
41
- tokens,
42
- variant,
43
- ...rest
44
- } = _ref2;
45
- const viewport = useViewport();
46
- const themeTokens = useThemeTokens('Card', tokens, {
47
- ...variant,
48
- background: 'alternative'
49
- }, {
50
- viewport
51
- });
52
- return /*#__PURE__*/_jsx(CardFooterContainer, {
53
- ...themeTokens,
54
- ...padding,
55
- ...selectProps(rest),
56
- children: children
57
- });
58
- };
59
- CardFooter.propTypes = {
60
- ...selectedSystemPropTypes,
61
- /**
62
- * Card footer content.
63
- */
64
- children: PropTypes.node,
65
- /**
66
- * Card footer padding.
67
- */
68
- padding: paddingProp.propType,
69
- /**
70
- * Card tokens.
71
- */
72
- tokens: getTokensPropType('Card'),
73
- /**
74
- * Card variant.
75
- */
76
- variant: variantProp.propType
77
- };
78
- export default CardFooter;
@@ -1,2 +0,0 @@
1
- import Card from './Card';
2
- export default Card;
@@ -1,169 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Spacer, StackView, Typography, selectSystemProps, useViewport, useThemeTokens, applyTextStyles, getTokensPropType } from '@telus-uds/components-base';
4
- import { viewports } from '@telus-uds/system-constants';
5
- import styled from 'styled-components';
6
- // Reading these from the RN palette since they will be used to generate
7
- // the `Typography` tokens
8
- import { htmlAttrs, transformGradient } from '../utils';
9
- import Segment from './Segment';
10
- import useCountdown from './useCountdown';
11
- import { countdownVariantPropType, dictionaryContentShape } from './types';
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- import { jsxs as _jsxs } from "react/jsx-runtime";
14
- const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
15
- const Container = /*#__PURE__*/styled.div.withConfig({
16
- displayName: "Countdown__Container",
17
- componentId: "components-web__sc-18tqcb2-0"
18
- })(_ref => {
19
- let {
20
- variant: {
21
- feature,
22
- inverse,
23
- large
24
- },
25
- themeTokens,
26
- gradient
27
- } = _ref;
28
- return {
29
- ...(large || feature ? {
30
- display: 'flex',
31
- flex: 0
32
- } : {}),
33
- ...(feature && {
34
- borderRadius: themeTokens.containerBorderRadius,
35
- borderColor: themeTokens.containerBorderColor,
36
- borderStyle: 'solid',
37
- borderWidth: `${themeTokens.containerBorderWidth}px`,
38
- justifyContent: 'center',
39
- paddingBottom: `${themeTokens.containerPaddingBottomTop}px`,
40
- paddingLeft: `${themeTokens.containerPaddingLeftRight}px`,
41
- paddingRight: `${themeTokens.containerPaddingLeftRight}px`,
42
- paddingTop: `${themeTokens.containerPaddingBottomTop}px`,
43
- width: 'fit-content'
44
- }),
45
- ...(feature && !inverse && gradient && {
46
- background: `linear-gradient(#fff 0 0) padding-box, ${gradient} border-box`
47
- })
48
- };
49
- });
50
- const getLabelTokens = themeTokens => ({
51
- color: themeTokens.labelBorderColor,
52
- fontSize: themeTokens.labelFontSize,
53
- fontWeight: themeTokens.labelFontWeight,
54
- lineHeight: themeTokens.labelLineHeight
55
- });
56
- const getMainTextTokens = _ref2 => {
57
- let {
58
- labelBorderColor,
59
- textTimerFontWeight,
60
- textFontSize,
61
- textLineHeight,
62
- textTimerFontName
63
- } = _ref2;
64
- return {
65
- color: labelBorderColor,
66
- lineHeight: textLineHeight,
67
- fontWeight: textTimerFontWeight,
68
- fontSize: textFontSize,
69
- fontName: textTimerFontName
70
- };
71
- };
72
- const Countdown = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
73
- let {
74
- copy = 'en',
75
- targetTime,
76
- tokens,
77
- variant = {},
78
- ...rest
79
- } = _ref3;
80
- const [days, hours, minutes, seconds] = useCountdown(targetTime);
81
- const viewport = useViewport();
82
- const {
83
- feature,
84
- large,
85
- label,
86
- noDivider
87
- } = variant;
88
- if (noDivider && !label) {
89
- throw new Error('`noDivider` variant can only be used with `label` enabled!');
90
- }
91
- const themeTokens = useThemeTokens('Countdown', tokens, variant, {
92
- viewport
93
- });
94
- const segmentFontSize = themeTokens.textFontSize;
95
- const semanticGradient = themeTokens.containerGradient && transformGradient(themeTokens.containerGradient);
96
- const mainTextTokens = getMainTextTokens(themeTokens);
97
- const divider = noDivider === true ?
98
- /*#__PURE__*/
99
- // StackView-based subcontainer adds a 1-step space on the each side of the divider
100
- _jsx(Spacer, {
101
- direction: "row",
102
- space: (feature || large) && viewport !== viewports.xs ? 4 : 1
103
- }) : /*#__PURE__*/_jsx(Typography, {
104
- tokens: mainTextTokens,
105
- children: ":"
106
- });
107
- const labelTokens = getLabelTokens(themeTokens);
108
- const segmentProps = {
109
- copy,
110
- labelTokens,
111
- numberTokens: mainTextTokens,
112
- segmentFontSize,
113
- variant
114
- };
115
- return (
116
- /*#__PURE__*/
117
- // Making it focusable for accessibility purposes
118
- _jsx(Container, {
119
- ref: ref,
120
- variant: variant,
121
- ...selectProps(rest),
122
- tabIndex: 0,
123
- themeTokens: themeTokens,
124
- gradient: semanticGradient,
125
- children: /*#__PURE__*/_jsxs(StackView, {
126
- direction: "row",
127
- space: 1,
128
- children: [/*#__PURE__*/_jsx(Segment, {
129
- labelKey: "day",
130
- number: days,
131
- segmentWidth: String(days).length,
132
- ...segmentProps
133
- }), divider, /*#__PURE__*/_jsx(Segment, {
134
- labelKey: "hour",
135
- number: hours,
136
- ...segmentProps,
137
- ...applyTextStyles(themeTokens)
138
- }), divider, /*#__PURE__*/_jsx(Segment, {
139
- labelKey: "minute",
140
- number: minutes,
141
- ...segmentProps,
142
- ...applyTextStyles(themeTokens)
143
- }), divider, /*#__PURE__*/_jsx(Segment, {
144
- labelKey: "second",
145
- number: seconds,
146
- ...segmentProps,
147
- ...applyTextStyles(themeTokens)
148
- })]
149
- })
150
- })
151
- );
152
- });
153
- Countdown.displayName = 'Countdown';
154
- Countdown.propTypes = {
155
- ...selectedSystemPropTypes,
156
- tokens: getTokensPropType('Countdown'),
157
- /**
158
- * Copy language identifier (`'en'` or `'fr'`) or a dictionary instance (an object with
159
- * the following keys: days, day, hours, hour, minutes, minute, seconds, second)
160
- */
161
- copy: PropTypes.oneOfType([PropTypes.oneOf(['en', 'fr']), dictionaryContentShape]),
162
- /**
163
- * An instance of JavaScript `Date` object or a string parseable via `Date.parse()`
164
- * representing a point in the future to count down to.
165
- */
166
- targetTime: PropTypes.instanceOf(Date),
167
- variant: countdownVariantPropType
168
- };
169
- export default Countdown;
@@ -1,96 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { StackView, Typography, useCopy } from '@telus-uds/components-base';
4
- import styled from 'styled-components';
5
- import dictionary from './dictionary';
6
- import { countdownVariantPropType, dictionaryContentShape } from './types';
7
- // !TODO: put this back
8
- import { SEGMENT_WIDTH_TO_FONT_SIZE_RATIO } from './constants';
9
-
10
- // Pads with zeros on the left if it's a single digit number
11
- import { jsx as _jsx } from "react/jsx-runtime";
12
- import { jsxs as _jsxs } from "react/jsx-runtime";
13
- const pad = function (number) {
14
- let segmentWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
15
- return String(number).padStart(segmentWidth, '0');
16
- };
17
- const Container = /*#__PURE__*/styled.div.withConfig({
18
- displayName: "Segment__Container",
19
- componentId: "components-web__sc-yrh35y-0"
20
- })(_ref => {
21
- let {
22
- segmentFontSize,
23
- segmentWidth = 2,
24
- variant: {
25
- feature
26
- }
27
- } = _ref;
28
- return {
29
- justifyContent: 'space-evenly',
30
- display: 'inline-flex',
31
- ...(feature && {
32
- // This is required because when the numbers for Countdown change, the character widths will change and thereby effecting the container demensions.
33
- width: `${segmentFontSize * SEGMENT_WIDTH_TO_FONT_SIZE_RATIO * segmentWidth}px`,
34
- display: 'flex'
35
- })
36
- };
37
- });
38
- // A segment of the countdown string: we need to make sure it
39
- // keeps its width constant to prevent the whole component from
40
- // being automatically resized while using variable size fonts
41
- const Segment = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
42
- let {
43
- copy = 'en',
44
- segmentFontSize,
45
- labelKey,
46
- labelTokens,
47
- number,
48
- numberTokens,
49
- segmentWidth = 2,
50
- variant = {}
51
- } = _ref2;
52
- const getCopy = useCopy({
53
- dictionary,
54
- copy
55
- });
56
- const {
57
- label,
58
- large,
59
- feature
60
- } = variant;
61
- return /*#__PURE__*/_jsx(Container, {
62
- segmentFontSize: segmentFontSize,
63
- segmentWidth: segmentWidth,
64
- variant: variant,
65
- ref: ref,
66
- children: /*#__PURE__*/_jsxs(StackView, {
67
- direction: large || feature ? 'column' : 'row',
68
- space: large || feature ? 0 : 1,
69
- tokens: {
70
- alignItems: 'center'
71
- },
72
- children: [/*#__PURE__*/_jsx(Typography, {
73
- tokens: numberTokens,
74
- children: pad(number, segmentWidth)
75
- }), label && /*#__PURE__*/_jsx(Typography, {
76
- tokens: labelTokens,
77
- children: getCopy(number === 1 ? labelKey : `${labelKey}s`)
78
- })]
79
- })
80
- });
81
- });
82
- Segment.displayName = 'Segment';
83
- Segment.propTypes = {
84
- /**
85
- * Copy language identifier or a dictionary instance.
86
- */
87
- copy: PropTypes.oneOfType([PropTypes.oneOf(['en', 'fr']), dictionaryContentShape]),
88
- segmentFontSize: PropTypes.number,
89
- labelKey: PropTypes.oneOf(['day', 'hour', 'minute', 'second']),
90
- labelTokens: PropTypes.object,
91
- number: PropTypes.number,
92
- numberTokens: PropTypes.object,
93
- segmentWidth: PropTypes.number,
94
- variant: countdownVariantPropType
95
- };
96
- export default Segment;
@@ -1,4 +0,0 @@
1
- export const DEFAULT_FONT_SIZE = 16;
2
- export const LARGE_FONT_SIZE = 64;
3
- export const XS_FONT_SIZE = 28;
4
- export const SEGMENT_WIDTH_TO_FONT_SIZE_RATIO = 0.8;