@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,15 +1,8 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = require("react");
8
- var _Dimensions = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Dimensions"));
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1
+ import { useCallback, useEffect, useRef, useState } from 'react';
10
2
  // TODO: add react-native as a peer dep and support native apps too.
11
3
  // That requires some fiddling with Allium repo storybook config, babel, etc,
12
4
  // unless ADS gets merged back into UDS monorepo.
5
+ import Dimensions from "react-native-web/dist/exports/Dimensions";
13
6
  const adjustHorizontalToFit = (initialOffset, windowWidth, sourceWidth) => {
14
7
  const offset = Math.max(0, initialOffset);
15
8
  const otherEdgeOverflow = Math.max(0, offset + sourceWidth - windowWidth);
@@ -132,14 +125,14 @@ const useOverlaidPosition = _ref3 => {
132
125
  }
133
126
  } = _ref3;
134
127
  // Element in main document flow that the targetRef element is positioned around
135
- const sourceRef = (0, _react.useRef)(null);
136
- const [sourceLayout, setSourceLayout] = (0, _react.useState)(null);
128
+ const sourceRef = useRef(null);
129
+ const [sourceLayout, setSourceLayout] = useState(null);
137
130
 
138
131
  // Element in a modal or portal overlay positioned to appear adjacent to sourceRef
139
- const targetRef = (0, _react.useRef)(null);
140
- const [targetDimensions, setTargetDimensions] = (0, _react.useState)(null);
141
- const [windowDimensions, setWindowDimensions] = (0, _react.useState)(null);
142
- const onTargetLayout = (0, _react.useCallback)(_ref4 => {
132
+ const targetRef = useRef(null);
133
+ const [targetDimensions, setTargetDimensions] = useState(null);
134
+ const [windowDimensions, setWindowDimensions] = useState(null);
135
+ const onTargetLayout = useCallback(_ref4 => {
143
136
  let {
144
137
  nativeEvent: {
145
138
  layout: {
@@ -164,13 +157,13 @@ const useOverlaidPosition = _ref3 => {
164
157
  });
165
158
  }, []);
166
159
  const readyToShow = Boolean(isShown && sourceRef.current);
167
- (0, _react.useEffect)(() => {
160
+ useEffect(() => {
168
161
  const handleDimensionsChange = _ref5 => {
169
162
  var _sourceRef$current;
170
163
  let {
171
164
  window
172
165
  } = _ref5;
173
- (_sourceRef$current = sourceRef.current) === null || _sourceRef$current === void 0 ? void 0 : _sourceRef$current.measureInWindow((x, y, width, height) => {
166
+ (_sourceRef$current = sourceRef.current) === null || _sourceRef$current === void 0 || _sourceRef$current.measureInWindow((x, y, width, height) => {
174
167
  // Could add a debouncer here if there's too many rerenders during gradual resizes
175
168
  setWindowDimensions(window);
176
169
  setSourceLayout({
@@ -187,17 +180,17 @@ const useOverlaidPosition = _ref3 => {
187
180
  if (typeof ((_subscription = subscription) === null || _subscription === void 0 ? void 0 : _subscription.remove) === 'function') {
188
181
  // React Native >=0.65.0
189
182
  subscription.remove();
190
- } else if (typeof _Dimensions.default.remove === 'function') {
183
+ } else if (typeof Dimensions.remove === 'function') {
191
184
  // React Native <0.65.0
192
- _Dimensions.default.remove('change', handleDimensionsChange);
185
+ Dimensions.remove('change', handleDimensionsChange);
193
186
  }
194
187
  setSourceLayout(null);
195
188
  setTargetDimensions(null);
196
189
  };
197
190
  if (readyToShow) {
198
- subscription = _Dimensions.default.addEventListener('change', handleDimensionsChange);
191
+ subscription = Dimensions.addEventListener('change', handleDimensionsChange);
199
192
  handleDimensionsChange({
200
- window: _Dimensions.default.get('window')
193
+ window: Dimensions.get('window')
201
194
  });
202
195
  } else {
203
196
  unsubscribe();
@@ -220,5 +213,4 @@ const useOverlaidPosition = _ref3 => {
220
213
  isReady
221
214
  };
222
215
  };
223
- var _default = useOverlaidPosition;
224
- exports.default = _default;
216
+ export default useOverlaidPosition;
@@ -1,23 +1,17 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _componentsBase = require("@telus-uds/components-base");
1
+ import { applyTextStyles, useTheme, useThemeTokens, useViewport } from '@telus-uds/components-base';
8
2
  const useTypographyTheme = (variant, tokens) => {
9
- const viewport = (0, _componentsBase.useViewport)();
10
- const themeTokens = (0, _componentsBase.useThemeTokens)('Typography', tokens, variant, {
3
+ const viewport = useViewport();
4
+ const themeTokens = useThemeTokens('Typography', tokens, variant, {
11
5
  viewport
12
6
  });
13
7
  const {
14
8
  themeOptions
15
- } = (0, _componentsBase.useTheme)();
9
+ } = useTheme();
16
10
  const {
17
11
  fontSize,
18
12
  lineHeight,
19
13
  ...rnStyles
20
- } = (0, _componentsBase.applyTextStyles)({
14
+ } = applyTextStyles({
21
15
  ...themeTokens,
22
16
  themeOptions
23
17
  });
@@ -27,5 +21,4 @@ const useTypographyTheme = (variant, tokens) => {
27
21
  lineHeight: `${lineHeight}px`
28
22
  };
29
23
  };
30
- var _default = useTypographyTheme;
31
- exports.default = _default;
24
+ export default useTypographyTheme;
package/package.json CHANGED
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "author": "TELUS Digital",
3
+ "type": "module",
3
4
  "browserslist": [
4
5
  "extends @telus-uds/browserslist-config"
5
6
  ],
6
7
  "dependencies": {
7
8
  "@gorhom/portal": "^1.0.14",
8
- "@telus-uds/components-base": "1.97.0",
9
- "@telus-uds/system-constants": "^1.3.0",
9
+ "@telus-uds/components-base": "1.97.1",
10
+ "@telus-uds/system-constants": "^2.0.0",
10
11
  "fscreen": "^1.2.0",
11
12
  "lodash.omit": "^4.5.0",
12
13
  "moment": "2.29.4",
13
14
  "react-dates": "^21.8.0",
14
15
  "react-helmet-async": "^1.3.0",
15
16
  "react-moment-proptypes": "^1.8.1",
16
- "@telus-uds/system-theme-tokens": "^2.66.0",
17
+ "@telus-uds/system-theme-tokens": "^3.0.0",
17
18
  "prop-types": "^15.7.2",
18
19
  "lodash.throttle": "^4.1.1",
19
20
  "react-youtube": "^10.1.0",
@@ -21,20 +22,20 @@
21
22
  },
22
23
  "exports": {
23
24
  ".": {
24
- "import": "./lib-module/index.js",
25
- "require": "./lib/index.js"
25
+ "import": "./lib/index.js",
26
+ "default": "./lib/index.js"
26
27
  },
27
28
  "./*": {
28
- "import": "./lib-module/*/index.js",
29
- "require": "./lib/*/index.js"
29
+ "import": "./lib/*/index.js",
30
+ "default": "./lib/index.js"
30
31
  },
31
32
  "./server": {
32
- "import": "./lib-module/server.js",
33
- "require": "./lib/server.js"
33
+ "import": "./lib/server.js",
34
+ "default": "./lib/server.js"
34
35
  },
35
36
  "./server/*": {
36
- "import": "./lib-module/*/server.js",
37
- "require": "./lib/server/*/server.js"
37
+ "import": "./lib/*/server.js",
38
+ "default": "./lib/*/server.js"
38
39
  }
39
40
  },
40
41
  "description": "UDS mult-brand web components",
@@ -56,12 +57,12 @@
56
57
  "homepage": "https://github.com/telus/universal-design-system#readme",
57
58
  "license": "MIT",
58
59
  "main": "lib/index.js",
59
- "module": "lib-module/index.js",
60
+ "module": "lib/index.js",
60
61
  "name": "@telus-uds/components-web",
61
62
  "peerDependencies": {
62
- "react": "^17.0.2 || ^18.0.0",
63
- "react-dom": "^17.0.2 || ^18.0.0",
64
- "react-native-web": "~0.17.7 || ~0.18.7",
63
+ "react": "^18.2.0",
64
+ "react-dom": "^18.2.0",
65
+ "react-native-web": "^0.19.10",
65
66
  "styled-components": "^5.3.0"
66
67
  },
67
68
  "repository": {
@@ -69,10 +70,7 @@
69
70
  "url": "git+https://github.com/telus/universal-design-system.git"
70
71
  },
71
72
  "scripts": {
72
- "build": "npm run build:code",
73
- "build:main": "babel src -d lib",
74
- "build:module": "babel src -d lib-module --env-name module",
75
- "build:code": "npm run build:main && npm run build:module",
73
+ "build": "babel src -d lib --env-name module",
76
74
  "format": "prettier --write .",
77
75
  "lint": "telus-standard",
78
76
  "lint:fix": "telus-standard --fix",
@@ -83,5 +81,5 @@
83
81
  "skip": true
84
82
  },
85
83
  "types": "types/index.d.ts",
86
- "version": "2.44.0"
84
+ "version": "3.0.0"
87
85
  }
package/src/Card/Card.jsx CHANGED
@@ -12,9 +12,9 @@ import {
12
12
  variantProp,
13
13
  a11yProps,
14
14
  viewProps,
15
- PressableCardBase
15
+ PressableCardBase,
16
+ useResponsiveProp
16
17
  } from '@telus-uds/components-base'
17
- import { useResponsiveProp } from '@telus-uds/components-web'
18
18
  import styled from 'styled-components'
19
19
  import CardContent from './CardContent'
20
20
  import CardFooter from './CardFooter'
@@ -3,8 +3,7 @@ import PropTypes from 'prop-types'
3
3
  import styled from 'styled-components'
4
4
  import momentPropTypes from 'react-moment-proptypes'
5
5
  import 'react-dates/initialize'
6
- import SingleDatePicker from 'react-dates/lib/components/SingleDatePicker'
7
- import DayPickerSingleDateController from 'react-dates/lib/components/DayPickerSingleDateController'
6
+ import { SingleDatePicker, DayPickerSingleDateController } from 'react-dates'
8
7
  import {
9
8
  IconButton,
10
9
  TextInput,
@@ -10,10 +10,10 @@ import { StackWrap, Typography, useThemeTokens } from '@telus-uds/components-bas
10
10
  * Add same locale-based date formatting as StoryCard when ready.
11
11
  * Get locale based on decision of https://github.com/telus/universal-design-system/issues/715
12
12
  */
13
- const AuthorDate = ({ author, date }) => {
13
+ const AuthorDate = React.forwardRef(({ author, date }, ref) => {
14
14
  const { separatorColor: color } = useThemeTokens('PreviewCard', {}, {})
15
15
  return (
16
- <StackWrap space={2}>
16
+ <StackWrap space={2} ref={ref}>
17
17
  <Typography variant={{ size: 'small', colour: 'secondary' }}>{author}</Typography>
18
18
  <Typography variant={{ size: 'small' }} tokens={{ color }}>
19
19
  ·
@@ -21,7 +21,9 @@ const AuthorDate = ({ author, date }) => {
21
21
  <Typography variant={{ size: 'small', colour: 'secondary' }}>{date}</Typography>
22
22
  </StackWrap>
23
23
  )
24
- }
24
+ })
25
+
26
+ AuthorDate.displayName = 'AuthorDate'
25
27
 
26
28
  AuthorDate.propTypes = {
27
29
  /**
@@ -3,7 +3,7 @@ export const deprecate = (componentName, message) => {
3
3
  return
4
4
  }
5
5
 
6
- console.warn(`[Allium] [Deprecate] ${componentName}: ${message}`) // eslint-disable-line no-console
6
+ console.warn(`[Allium] [Deprecate] ${componentName}: ${message}`)
7
7
  }
8
8
 
9
9
  export const warn = (componentName, message) => {
@@ -11,7 +11,7 @@ export const warn = (componentName, message) => {
11
11
  return
12
12
  }
13
13
 
14
- console.warn(`[Allium] ${componentName}: ${message}`) // eslint-disable-line no-console
14
+ console.warn(`[Allium] ${componentName}: ${message}`)
15
15
  }
16
16
 
17
17
  export default {
@@ -1,121 +0,0 @@
1
- import React from 'react';
2
- import styled from 'styled-components';
3
- import PropTypes from 'prop-types';
4
- import { selectSystemProps, Typography, getTokensPropType, useThemeTokens } from '@telus-uds/components-base';
5
- import { htmlAttrs, transformGradient } from '../utils';
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
8
- const BadgeContainer = /*#__PURE__*/styled.div.withConfig({
9
- displayName: "Badge__BadgeContainer",
10
- componentId: "components-web__sc-tsiuo2-0"
11
- })(["background:", ";border:", ";display:inline-flex;justify-content:center;padding:", ";border-radius:", ";width:fit-content;", ""], _ref => {
12
- let {
13
- background
14
- } = _ref;
15
- return background;
16
- }, _ref2 => {
17
- let {
18
- border
19
- } = _ref2;
20
- return border;
21
- }, _ref3 => {
22
- let {
23
- padding
24
- } = _ref3;
25
- return padding;
26
- }, _ref4 => {
27
- let {
28
- radius
29
- } = _ref4;
30
- return radius;
31
- }, _ref5 => {
32
- let {
33
- isOutlineOffer,
34
- isAlternative,
35
- gradient
36
- } = _ref5;
37
- return (isOutlineOffer || isAlternative) && `
38
- > div {
39
- background: ${gradient};
40
- -webkit-background-clip: text;
41
- ${gradient && '-webkit-text-fill-color: transparent;'}
42
- }`;
43
- });
44
- const fontSizeMapping = {
45
- 12: 'micro',
46
- 14: 'small',
47
- 16: 'h6'
48
- };
49
- const Badge = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
50
- let {
51
- children,
52
- tokens,
53
- variant = {},
54
- ...rest
55
- } = _ref6;
56
- const {
57
- backgroundColor,
58
- gradient,
59
- borderColor,
60
- borderRadius,
61
- borderWidth,
62
- color,
63
- paddingLeft,
64
- paddingRight,
65
- paddingTop,
66
- paddingBottom,
67
- fontName,
68
- fontWeight,
69
- fontSize
70
- } = useThemeTokens('Badge', tokens, variant);
71
- const semanticGradient = gradient && transformGradient(gradient);
72
- const {
73
- outline,
74
- purpose,
75
- alternative
76
- } = variant;
77
- let background = backgroundColor;
78
- const isOutlineOffer = purpose === 'offer' && outline;
79
- if ((isOutlineOffer || alternative) && gradient) {
80
- background = `linear-gradient(#fff 0 0) padding-box, ${semanticGradient} border-box`;
81
- } else if (purpose === 'offer' && gradient) {
82
- background = semanticGradient;
83
- }
84
- return /*#__PURE__*/_jsx(BadgeContainer, {
85
- isOutlineOffer: isOutlineOffer,
86
- isAlternative: alternative,
87
- padding: `${paddingTop}px ${paddingRight}px ${paddingBottom}px ${paddingLeft}px`,
88
- radius: `${borderRadius}px`,
89
- background: background,
90
- fontName: fontName,
91
- fontWeight: fontWeight,
92
- gradient: semanticGradient,
93
- border: `${borderWidth}px solid ${borderColor}`,
94
- ref: ref,
95
- ...selectProps(rest),
96
- children: /*#__PURE__*/_jsx(Typography, {
97
- tokens: {
98
- fontName,
99
- fontWeight,
100
- color
101
- },
102
- variant: {
103
- size: fontSizeMapping[fontSize]
104
- },
105
- children: children
106
- })
107
- });
108
- });
109
- Badge.displayName = 'Badge';
110
- Badge.propTypes = {
111
- ...selectedSystemPropTypes,
112
- children: PropTypes.node,
113
- tokens: getTokensPropType('Badge'),
114
- variant: PropTypes.exact({
115
- outline: PropTypes.bool,
116
- purpose: PropTypes.oneOf(['offer', 'editorial']),
117
- alternative: PropTypes.bool,
118
- inverse: PropTypes.bool
119
- })
120
- };
121
- export default Badge;
@@ -1,2 +0,0 @@
1
- import Badge from './Badge';
2
- export default Badge;
@@ -1,204 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Link, selectSystemProps, StackView, Typography, useThemeTokens, withLinkRouter, useViewport, getTokensPropType } from '@telus-uds/components-base';
4
- import styled from 'styled-components';
5
- import { htmlAttrs, transformGradient } from '../utils';
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- import { jsxs as _jsxs } from "react/jsx-runtime";
8
- const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
9
- const BlockQuoteContainer = /*#__PURE__*/styled.blockquote.withConfig({
10
- displayName: "BlockQuote__BlockQuoteContainer",
11
- componentId: "components-web__sc-vals3u-0"
12
- })(["margin:0;position:relative;padding-left:", ";padding-right:", ";padding-bottom:", ";padding-top:", ";&::before{content:'';left:0;top:0;position:absolute;height:100%;width:", ";background:", ";}"], _ref => {
13
- let {
14
- paddingLeft
15
- } = _ref;
16
- return `${paddingLeft}px`;
17
- }, _ref2 => {
18
- let {
19
- paddingRight
20
- } = _ref2;
21
- return `${paddingRight}px`;
22
- }, _ref3 => {
23
- let {
24
- paddingBottom
25
- } = _ref3;
26
- return `${paddingBottom}px`;
27
- }, _ref4 => {
28
- let {
29
- paddingTop
30
- } = _ref4;
31
- return `${paddingTop}px`;
32
- }, _ref5 => {
33
- let {
34
- width
35
- } = _ref5;
36
- return `${width}px`;
37
- }, _ref6 => {
38
- let {
39
- backgroundGradient
40
- } = _ref6;
41
- return backgroundGradient && transformGradient(backgroundGradient);
42
- });
43
- const QuoteContainer = /*#__PURE__*/styled.div.withConfig({
44
- displayName: "BlockQuote__QuoteContainer",
45
- componentId: "components-web__sc-vals3u-1"
46
- })(["margin-bottom:", ";"], _ref7 => {
47
- let {
48
- marginBottom
49
- } = _ref7;
50
- return `${marginBottom}px`;
51
- });
52
- const BlockQuote = /*#__PURE__*/React.forwardRef((_ref8, ref) => {
53
- let {
54
- children,
55
- link,
56
- additionalInfo,
57
- linkHref,
58
- textStyle = 'large',
59
- LinkRouter,
60
- linkRouterProps,
61
- tokens,
62
- variant,
63
- ...rest
64
- } = _ref8;
65
- const viewport = useViewport();
66
- const {
67
- color,
68
- paddingTop,
69
- paddingBottom,
70
- paddingLeft,
71
- paddingRight,
72
- marginBottom,
73
- width,
74
- backgroundGradient,
75
- titleHeadingFontSize,
76
- titleHeadingFontName,
77
- titleHeadingFontWeight,
78
- titleHeadingLineHeight,
79
- titleFontSize,
80
- titleFontName,
81
- titleFontWeight,
82
- titleLineHeight,
83
- linkFontSize,
84
- linkFontName,
85
- linkFontWeight,
86
- linkLineHeight
87
- } = useThemeTokens('BlockQuote', tokens, variant, {
88
- viewport
89
- });
90
- const mappedTextSize = textStyle === 'heading' ? 'h3' : textStyle;
91
- const titleTokens = textStyle === 'heading' ? {
92
- fontSize: titleHeadingFontSize,
93
- fontName: titleHeadingFontName,
94
- fontWeight: titleHeadingFontWeight,
95
- lineHeight: titleHeadingLineHeight
96
- } : {
97
- fontSize: titleFontSize,
98
- fontName: titleFontName,
99
- fontWeight: titleFontWeight,
100
- lineHeight: titleLineHeight
101
- };
102
- const renderLink = () => {
103
- if (linkHref) {
104
- return /*#__PURE__*/_jsx(Link, {
105
- href: linkHref,
106
- tokens: {
107
- blockFontSize: linkFontSize,
108
- blockFontName: linkFontName,
109
- blockFontWeight: linkFontWeight,
110
- blockLineHeight: linkLineHeight,
111
- color
112
- },
113
- variant: {
114
- alternative: true
115
- },
116
- LinkRouter: LinkRouter,
117
- linkRouterProps: linkRouterProps,
118
- children: link
119
- });
120
- }
121
- return /*#__PURE__*/_jsx(Typography, {
122
- tokens: {
123
- color,
124
- fontName: linkFontName,
125
- fontSize: linkFontSize,
126
- fontWeight: linkFontWeight,
127
- lineHeight: linkLineHeight
128
- },
129
- children: link
130
- });
131
- };
132
- const renderQuote = () => {
133
- const quote = /*#__PURE__*/_jsx(Typography, {
134
- tokens: {
135
- color,
136
- ...titleTokens
137
- },
138
- variant: {
139
- size: mappedTextSize
140
- },
141
- children: children
142
- });
143
- if (additionalInfo || link) {
144
- return /*#__PURE__*/_jsx(QuoteContainer, {
145
- marginBottom: marginBottom,
146
- children: quote
147
- });
148
- }
149
- return quote;
150
- };
151
- return /*#__PURE__*/_jsxs(BlockQuoteContainer, {
152
- ...selectProps(rest),
153
- paddingTop: paddingTop,
154
- paddingBottom: paddingBottom,
155
- paddingLeft: paddingLeft,
156
- paddingRight: paddingRight,
157
- width: width,
158
- backgroundGradient: backgroundGradient,
159
- ref: ref,
160
- children: [renderQuote(), (additionalInfo || link) && /*#__PURE__*/_jsxs(StackView, {
161
- space: 0,
162
- children: [link && renderLink(), additionalInfo && /*#__PURE__*/_jsx(Typography, {
163
- tokens: {
164
- color
165
- },
166
- variant: {
167
- size: 'small'
168
- },
169
- children: additionalInfo
170
- })]
171
- })]
172
- });
173
- });
174
- BlockQuote.displayName = 'BlockQuote';
175
- BlockQuote.propTypes = {
176
- ...selectedSystemPropTypes,
177
- ...withLinkRouter.propTypes,
178
- tokens: getTokensPropType('BlockQuote'),
179
- variant: PropTypes.exact({
180
- alternative: PropTypes.bool,
181
- size: PropTypes.string
182
- }),
183
- /**
184
- * Children nodes that can be added
185
- */
186
- children: PropTypes.node.isRequired,
187
- /**
188
- * External source's identifier (e.g. author's name)
189
- */
190
- link: PropTypes.string,
191
- /**
192
- * External source's URL
193
- */
194
- linkHref: PropTypes.string,
195
- /**
196
- * To provide additional information about the source, rendered underneath `link`
197
- */
198
- additionalInfo: PropTypes.string,
199
- /**
200
- * Whether to render BlockQuote as a heading size of `h3` or large text size
201
- */
202
- textStyle: PropTypes.oneOf(['large', 'heading'])
203
- };
204
- export default BlockQuote;
@@ -1,2 +0,0 @@
1
- import BlockQuote from './BlockQuote';
2
- export default BlockQuote;