@telus-uds/components-web 2.21.2 → 2.22.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 (241) hide show
  1. package/CHANGELOG.md +13 -2
  2. package/lib/Badge/Badge.js +2 -14
  3. package/lib/Badge/index.js +0 -3
  4. package/lib/BlockQuote/BlockQuote.js +4 -25
  5. package/lib/BlockQuote/index.js +0 -3
  6. package/lib/Breadcrumbs/Breadcrumbs.js +9 -36
  7. package/lib/Breadcrumbs/Item/Item.js +15 -25
  8. package/lib/Breadcrumbs/index.js +0 -2
  9. package/lib/Callout/Callout.js +2 -24
  10. package/lib/Callout/index.js +0 -3
  11. package/lib/Card/Card.js +15 -29
  12. package/lib/Card/CardContent.js +5 -18
  13. package/lib/Card/CardFooter.js +7 -19
  14. package/lib/Card/index.js +0 -3
  15. package/lib/Countdown/Countdown.js +5 -24
  16. package/lib/Countdown/Segment.js +3 -15
  17. package/lib/Countdown/index.js +0 -3
  18. package/lib/Countdown/types.js +2 -7
  19. package/lib/Countdown/useCountdown.js +0 -7
  20. package/lib/DatePicker/CalendarContainer.js +0 -5
  21. package/lib/DatePicker/DatePicker.js +9 -61
  22. package/lib/DatePicker/dictionary.js +0 -8
  23. package/lib/DatePicker/index.js +0 -3
  24. package/lib/DatePicker/reactDatesCss.js +0 -2
  25. package/lib/Disclaimer/Disclaimer.js +5 -14
  26. package/lib/Disclaimer/index.js +0 -2
  27. package/lib/ExpandCollapseMini/ExpandCollapseMini.js +6 -17
  28. package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +12 -25
  29. package/lib/ExpandCollapseMini/index.js +0 -3
  30. package/lib/Footnote/Footnote.js +17 -63
  31. package/lib/Footnote/FootnoteLink.js +3 -24
  32. package/lib/Footnote/index.js +0 -4
  33. package/lib/IconButton/IconButton.js +4 -14
  34. package/lib/IconButton/index.js +0 -3
  35. package/lib/Image/Image.js +5 -24
  36. package/lib/Image/index.js +0 -3
  37. package/lib/List/List.js +0 -2
  38. package/lib/List/ListItem.js +0 -8
  39. package/lib/List/index.js +0 -4
  40. package/lib/NavigationBar/NavigationBar.js +10 -35
  41. package/lib/NavigationBar/NavigationItem.js +5 -17
  42. package/lib/NavigationBar/NavigationSubMenu.js +3 -19
  43. package/lib/NavigationBar/collapseItems.js +6 -9
  44. package/lib/NavigationBar/index.js +0 -3
  45. package/lib/NavigationBar/resolveItemSelection.js +2 -3
  46. package/lib/OptimizeImage/OptimizeImage.js +6 -27
  47. package/lib/OptimizeImage/index.js +0 -3
  48. package/lib/OptimizeImage/utils/getFallbackUrl.js +0 -4
  49. package/lib/OptimizeImage/utils/getOptimizedUrl.js +0 -8
  50. package/lib/OptimizeImage/utils/hasWebpSupport.js +1 -5
  51. package/lib/OptimizeImage/utils/index.js +0 -4
  52. package/lib/OptimizeImage/utils/isSvgUrl.js +0 -1
  53. package/lib/OrderedList/Item.js +4 -21
  54. package/lib/OrderedList/ItemBase.js +2 -9
  55. package/lib/OrderedList/OrderedList.js +11 -22
  56. package/lib/OrderedList/OrderedListBase.js +3 -13
  57. package/lib/OrderedList/index.js +0 -4
  58. package/lib/Paragraph/Paragraph.js +3 -18
  59. package/lib/Paragraph/index.js +0 -3
  60. package/lib/PreviewCard/AuthorDate.js +1 -10
  61. package/lib/PreviewCard/PreviewCard.js +15 -35
  62. package/lib/PreviewCard/index.js +0 -3
  63. package/lib/PriceLockup/PriceLockup.js +78 -75
  64. package/lib/PriceLockup/index.js +0 -3
  65. package/lib/PriceLockup/tokens.js +0 -2
  66. package/lib/Progress/ProgressBar.js +5 -16
  67. package/lib/Progress/index.js +0 -4
  68. package/lib/QuantitySelector/QuantitySelector.js +8 -42
  69. package/lib/QuantitySelector/SideButton.js +4 -11
  70. package/lib/QuantitySelector/index.js +0 -3
  71. package/lib/QuantitySelector/styles.js +0 -6
  72. package/lib/ResponsiveImage/ResponsiveImage.js +5 -20
  73. package/lib/ResponsiveImage/index.js +0 -3
  74. package/lib/Ribbon/Ribbon.js +4 -20
  75. package/lib/Ribbon/index.js +0 -3
  76. package/lib/SkeletonProvider/SkeletonImage.js +0 -10
  77. package/lib/SkeletonProvider/SkeletonProvider.js +4 -22
  78. package/lib/SkeletonProvider/SkeletonTypography.js +0 -10
  79. package/lib/SkeletonProvider/index.js +0 -3
  80. package/lib/Span/Span.js +3 -17
  81. package/lib/Span/index.js +0 -3
  82. package/lib/Spinner/Spinner.js +11 -39
  83. package/lib/Spinner/SpinnerContent.js +2 -18
  84. package/lib/Spinner/index.js +0 -3
  85. package/lib/StoryCard/StoryCard.js +11 -31
  86. package/lib/StoryCard/index.js +0 -3
  87. package/lib/Table/Body.js +0 -6
  88. package/lib/Table/Cell.js +4 -24
  89. package/lib/Table/Header.js +0 -9
  90. package/lib/Table/Row.js +0 -8
  91. package/lib/Table/SubHeading.js +0 -9
  92. package/lib/Table/Table.js +5 -23
  93. package/lib/Table/index.js +0 -8
  94. package/lib/TermsAndConditions/ExpandCollapse.js +4 -14
  95. package/lib/TermsAndConditions/TermsAndConditions.js +7 -29
  96. package/lib/TermsAndConditions/index.js +0 -2
  97. package/lib/Testimonial/Testimonial.js +2 -26
  98. package/lib/Testimonial/index.js +0 -3
  99. package/lib/Toast/Toast.js +4 -25
  100. package/lib/Toast/index.js +0 -3
  101. package/lib/Video/ControlBar/ControlBar.js +2 -25
  102. package/lib/Video/ControlBar/Controls/VideoButton/VideoButton.js +4 -17
  103. package/lib/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +4 -20
  104. package/lib/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +12 -26
  105. package/lib/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +8 -23
  106. package/lib/Video/MiddleControlButton/MiddleControlButton.js +2 -12
  107. package/lib/Video/Video.js +122 -194
  108. package/lib/Video/index.js +0 -3
  109. package/lib/VideoPicker/VideoPicker.js +6 -32
  110. package/lib/VideoPicker/VideoPickerPlayer.js +2 -10
  111. package/lib/VideoPicker/VideoPickerThumbnail.js +7 -28
  112. package/lib/VideoPicker/VideoSlider.js +7 -17
  113. package/lib/VideoPicker/index.js +0 -3
  114. package/lib/VideoPicker/videoPropType.js +2 -8
  115. package/lib/WaffleGrid/WaffleGrid.js +11 -28
  116. package/lib/WaffleGrid/index.js +0 -3
  117. package/lib/WebPortal/WebPortal.js +1 -5
  118. package/lib/WebPortal/index.js +0 -3
  119. package/lib/WebVideo/WebVideo.js +4 -30
  120. package/lib/WebVideo/index.js +0 -3
  121. package/lib/baseExports.js +6 -1
  122. package/lib/index.js +0 -49
  123. package/lib/shared/FullBleedContent/FullBleedContent.js +5 -17
  124. package/lib/shared/FullBleedContent/getFullBleedBorderRadius.js +0 -11
  125. package/lib/shared/FullBleedContent/index.js +0 -5
  126. package/lib/shared/FullBleedContent/useFullBleedContentProps.js +1 -12
  127. package/lib/shared/VideoSplash/SplashButton/SplashButton.js +2 -12
  128. package/lib/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +7 -23
  129. package/lib/shared/VideoSplash/VideoSplash.js +4 -17
  130. package/lib/shared/VideoSplash/helpers.js +0 -6
  131. package/lib/utils/index.js +0 -9
  132. package/lib/utils/logger.js +0 -6
  133. package/lib/utils/media.js +2 -11
  134. package/lib/utils/renderStructuredContent.js +14 -31
  135. package/lib/utils/ssr.js +0 -6
  136. package/lib/utils/transforms.js +0 -2
  137. package/lib/utils/useOverlaidPosition.js +6 -28
  138. package/lib/utils/useTypographyTheme.js +4 -5
  139. package/lib-module/Badge/Badge.js +2 -5
  140. package/lib-module/BlockQuote/BlockQuote.js +4 -15
  141. package/lib-module/Breadcrumbs/Breadcrumbs.js +9 -25
  142. package/lib-module/Breadcrumbs/Item/Item.js +15 -12
  143. package/lib-module/Callout/Callout.js +2 -16
  144. package/lib-module/Card/Card.js +14 -17
  145. package/lib-module/Card/CardContent.js +5 -8
  146. package/lib-module/Card/CardFooter.js +7 -9
  147. package/lib-module/Countdown/Countdown.js +6 -11
  148. package/lib-module/Countdown/Segment.js +6 -8
  149. package/lib-module/Countdown/types.js +2 -1
  150. package/lib-module/Countdown/useCountdown.js +0 -6
  151. package/lib-module/DatePicker/CalendarContainer.js +3 -1
  152. package/lib-module/DatePicker/DatePicker.js +9 -39
  153. package/lib-module/DatePicker/dictionary.js +0 -8
  154. package/lib-module/Disclaimer/Disclaimer.js +5 -4
  155. package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +6 -8
  156. package/lib-module/ExpandCollapseMini/ExpandCollapseMiniControl.js +13 -19
  157. package/lib-module/Footnote/Footnote.js +17 -41
  158. package/lib-module/Footnote/FootnoteLink.js +3 -12
  159. package/lib-module/IconButton/IconButton.js +4 -6
  160. package/lib-module/Image/Image.js +5 -14
  161. package/lib-module/NavigationBar/NavigationBar.js +10 -20
  162. package/lib-module/NavigationBar/NavigationItem.js +5 -5
  163. package/lib-module/NavigationBar/NavigationSubMenu.js +3 -8
  164. package/lib-module/NavigationBar/collapseItems.js +6 -8
  165. package/lib-module/NavigationBar/resolveItemSelection.js +2 -2
  166. package/lib-module/OptimizeImage/OptimizeImage.js +6 -16
  167. package/lib-module/OptimizeImage/utils/getFallbackUrl.js +0 -1
  168. package/lib-module/OptimizeImage/utils/getOptimizedUrl.js +0 -5
  169. package/lib-module/OptimizeImage/utils/hasWebpSupport.js +1 -5
  170. package/lib-module/OrderedList/Item.js +4 -7
  171. package/lib-module/OrderedList/ItemBase.js +2 -3
  172. package/lib-module/OrderedList/OrderedList.js +11 -9
  173. package/lib-module/OrderedList/OrderedListBase.js +3 -3
  174. package/lib-module/Paragraph/Paragraph.js +3 -8
  175. package/lib-module/PreviewCard/AuthorDate.js +1 -4
  176. package/lib-module/PreviewCard/PreviewCard.js +16 -19
  177. package/lib-module/PriceLockup/PriceLockup.js +78 -57
  178. package/lib-module/Progress/ProgressBar.js +7 -8
  179. package/lib-module/QuantitySelector/QuantitySelector.js +8 -30
  180. package/lib-module/QuantitySelector/SideButton.js +4 -6
  181. package/lib-module/ResponsiveImage/ResponsiveImage.js +5 -12
  182. package/lib-module/Ribbon/Ribbon.js +4 -9
  183. package/lib-module/SkeletonProvider/SkeletonImage.js +0 -5
  184. package/lib-module/SkeletonProvider/SkeletonProvider.js +4 -12
  185. package/lib-module/SkeletonProvider/SkeletonTypography.js +0 -5
  186. package/lib-module/Span/Span.js +3 -7
  187. package/lib-module/Spinner/Spinner.js +11 -24
  188. package/lib-module/Spinner/SpinnerContent.js +2 -8
  189. package/lib-module/StoryCard/StoryCard.js +12 -17
  190. package/lib-module/Table/Body.js +0 -2
  191. package/lib-module/Table/Cell.js +4 -14
  192. package/lib-module/Table/Header.js +0 -2
  193. package/lib-module/Table/Row.js +0 -2
  194. package/lib-module/Table/SubHeading.js +0 -2
  195. package/lib-module/Table/Table.js +5 -6
  196. package/lib-module/TermsAndConditions/ExpandCollapse.js +4 -2
  197. package/lib-module/TermsAndConditions/TermsAndConditions.js +7 -9
  198. package/lib-module/Testimonial/Testimonial.js +2 -11
  199. package/lib-module/Toast/Toast.js +4 -15
  200. package/lib-module/Video/ControlBar/ControlBar.js +2 -9
  201. package/lib-module/Video/ControlBar/Controls/VideoButton/VideoButton.js +4 -8
  202. package/lib-module/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +4 -8
  203. package/lib-module/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +12 -13
  204. package/lib-module/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +8 -10
  205. package/lib-module/Video/MiddleControlButton/MiddleControlButton.js +2 -3
  206. package/lib-module/Video/Video.js +122 -173
  207. package/lib-module/VideoPicker/VideoPicker.js +6 -15
  208. package/lib-module/VideoPicker/VideoPickerPlayer.js +2 -3
  209. package/lib-module/VideoPicker/VideoPickerThumbnail.js +7 -13
  210. package/lib-module/VideoPicker/VideoSlider.js +6 -9
  211. package/lib-module/VideoPicker/videoPropType.js +2 -1
  212. package/lib-module/WaffleGrid/WaffleGrid.js +11 -15
  213. package/lib-module/WebPortal/WebPortal.js +1 -1
  214. package/lib-module/WebVideo/WebVideo.js +4 -15
  215. package/lib-module/baseExports.js +3 -2
  216. package/lib-module/index.js +0 -1
  217. package/lib-module/shared/FullBleedContent/FullBleedContent.js +5 -10
  218. package/lib-module/shared/FullBleedContent/getFullBleedBorderRadius.js +0 -10
  219. package/lib-module/shared/FullBleedContent/useFullBleedContentProps.js +1 -11
  220. package/lib-module/shared/VideoSplash/SplashButton/SplashButton.js +2 -3
  221. package/lib-module/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +7 -12
  222. package/lib-module/shared/VideoSplash/VideoSplash.js +4 -4
  223. package/lib-module/utils/logger.js +2 -2
  224. package/lib-module/utils/media.js +2 -9
  225. package/lib-module/utils/renderStructuredContent.js +14 -25
  226. package/lib-module/utils/ssr.js +0 -4
  227. package/lib-module/utils/useOverlaidPosition.js +8 -27
  228. package/lib-module/utils/useTypographyTheme.js +4 -4
  229. package/package.json +3 -3
  230. package/src/PriceLockup/PriceLockup.jsx +36 -11
  231. package/src/baseExports.js +1 -0
  232. package/src/index.js +0 -1
  233. package/lib/Modal/Modal.js +0 -146
  234. package/lib/Modal/ModalContent.js +0 -203
  235. package/lib/Modal/index.js +0 -13
  236. package/lib-module/Modal/Modal.js +0 -132
  237. package/lib-module/Modal/ModalContent.js +0 -181
  238. package/lib-module/Modal/index.js +0 -2
  239. package/src/Modal/Modal.jsx +0 -121
  240. package/src/Modal/ModalContent.jsx +0 -167
  241. package/src/Modal/index.js +0 -3
@@ -4,31 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _react = _interopRequireDefault(require("react"));
9
-
10
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
9
  var _styledComponents = _interopRequireDefault(require("styled-components"));
13
-
14
10
  var _componentsBase = require("@telus-uds/components-base");
15
-
16
11
  var _systemConstants = require("@telus-uds/system-constants");
17
-
18
12
  var _SplashButton = _interopRequireDefault(require("./SplashButton/SplashButton"));
19
-
20
13
  var _SplashButtonWithDetails = _interopRequireDefault(require("./SplashButtonWithDetails/SplashButtonWithDetails"));
21
-
22
14
  var _videoText = _interopRequireDefault(require("../../Video/videoText"));
23
-
24
15
  var _utils = require("../../utils");
25
-
26
16
  var _jsxRuntime = require("react/jsx-runtime");
27
-
28
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
-
30
18
  const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
31
-
32
19
  const SplashBackground = /*#__PURE__*/_styledComponents.default.div.withConfig({
33
20
  displayName: "VideoSplash__SplashBackground",
34
21
  componentId: "components-web__sc-1ejxt6-0"
@@ -48,7 +35,6 @@ const SplashBackground = /*#__PURE__*/_styledComponents.default.div.withConfig({
48
35
  cursor: 'pointer'
49
36
  };
50
37
  });
51
-
52
38
  const VideoSplash = _ref2 => {
53
39
  let {
54
40
  poster,
@@ -61,7 +47,8 @@ const VideoSplash = _ref2 => {
61
47
  const viewport = (0, _componentsBase.useViewport)();
62
48
  const showDetails = !simpleMode && viewport !== _systemConstants.viewports.xs;
63
49
  const label = _videoText.default[copy].watch;
64
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(SplashBackground, { ...selectProps(rest),
50
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(SplashBackground, {
51
+ ...selectProps(rest),
65
52
  onClick: onClick,
66
53
  videoPoster: poster,
67
54
  children: showDetails ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_SplashButtonWithDetails.default, {
@@ -74,8 +61,8 @@ const VideoSplash = _ref2 => {
74
61
  })
75
62
  });
76
63
  };
77
-
78
- VideoSplash.propTypes = { ...selectedSystemPropTypes,
64
+ VideoSplash.propTypes = {
65
+ ...selectedSystemPropTypes,
79
66
  onClick: _propTypes.default.func,
80
67
  poster: _propTypes.default.string,
81
68
  videoLength: _propTypes.default.number.isRequired,
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getTimestamp = exports.getAriaLabel = void 0;
7
-
8
7
  var _videoText = _interopRequireDefault(require("../../Video/videoText"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
9
  const getTimestamp = (videoLength, copy) => {
13
10
  const minutes = Math.floor(videoLength / 60);
14
11
  const seconds = Math.ceil(videoLength % 60);
@@ -21,9 +18,7 @@ const getTimestamp = (videoLength, copy) => {
21
18
  timestamp
22
19
  };
23
20
  };
24
-
25
21
  exports.getTimestamp = getTimestamp;
26
-
27
22
  const getAriaLabel = (timestamp, copy) => {
28
23
  const {
29
24
  minutes,
@@ -34,5 +29,4 @@ const getAriaLabel = (timestamp, copy) => {
34
29
  const secondsText = `${seconds} ${seconds !== 1 ? text.seconds : text.second}`;
35
30
  return text.ariaLabel.replace('{minutes}', minutesText).replace('{seconds}', secondsText);
36
31
  };
37
-
38
32
  exports.getAriaLabel = getAriaLabel;
@@ -57,21 +57,12 @@ Object.defineProperty(exports, "warn", {
57
57
  return _logger.warn;
58
58
  }
59
59
  });
60
-
61
60
  var _componentsBase = require("@telus-uds/components-base");
62
-
63
61
  var _logger = require("./logger");
64
-
65
62
  var _transforms = require("./transforms");
66
-
67
63
  var _useTypographyTheme = _interopRequireDefault(require("./useTypographyTheme"));
68
-
69
64
  var _media = _interopRequireDefault(require("./media"));
70
-
71
65
  var _ssr = _interopRequireDefault(require("./ssr"));
72
-
73
66
  var _renderStructuredContent = _interopRequireDefault(require("./renderStructuredContent"));
74
-
75
67
  var _useOverlaidPosition = _interopRequireDefault(require("./useOverlaidPosition"));
76
-
77
68
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -4,25 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.warn = exports.deprecate = exports.default = void 0;
7
-
8
7
  const deprecate = (componentName, message) => {
9
8
  if (process.env.NODE_ENV === 'production') {
10
9
  return;
11
10
  }
12
-
13
11
  console.warn(`[Allium] [Deprecate] ${componentName}: ${message}`); // eslint-disable-line no-console
14
12
  };
15
-
16
13
  exports.deprecate = deprecate;
17
-
18
14
  const warn = (componentName, message) => {
19
15
  if (process.env.NODE_ENV === 'production') {
20
16
  return;
21
17
  }
22
-
23
18
  console.warn(`[Allium] ${componentName}: ${message}`); // eslint-disable-line no-console
24
19
  };
25
-
26
20
  exports.warn = warn;
27
21
  var _default = {
28
22
  deprecate,
@@ -4,31 +4,24 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = media;
7
-
8
7
  var _systemConstants = require("@telus-uds/system-constants");
9
-
10
8
  function media() {
11
9
  return {
12
10
  query: {},
13
-
14
11
  from(breakpoint) {
15
12
  if (breakpoint !== _systemConstants.viewports.xs) {
16
13
  this.query.minWidth = breakpoint;
17
14
  }
18
-
19
15
  return this;
20
16
  },
21
-
22
17
  until(breakpoint) {
23
18
  this.query.maxWidth = breakpoint;
24
19
  return this;
25
20
  },
26
-
27
21
  and(custom) {
28
22
  this.query.and = custom;
29
23
  return this;
30
24
  },
31
-
32
25
  css(style) {
33
26
  const {
34
27
  minWidth,
@@ -37,18 +30,16 @@ function media() {
37
30
  } = this.query;
38
31
  const min = minWidth ? `(min-width: ${_systemConstants.viewports.map.get(minWidth)}px)` : undefined;
39
32
  const max = maxWidth ? `(max-width: ${_systemConstants.viewports.map.get(maxWidth) - 1}px)` : undefined;
40
-
41
33
  if (typeof min !== 'undefined' || typeof max !== 'undefined' || typeof and !== 'undefined') {
42
34
  const mediaQuery = `@media ${[min, max, and].filter(a => a).join(' and ')}`;
43
35
  this.query = {};
44
36
  return {
45
- [mediaQuery]: { ...(typeof style === 'function' ? style() : style)
37
+ [mediaQuery]: {
38
+ ...(typeof style === 'function' ? style() : style)
46
39
  }
47
40
  };
48
41
  }
49
-
50
42
  return typeof style === 'function' ? style() : style;
51
43
  }
52
-
53
44
  };
54
45
  }
@@ -4,86 +4,69 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _react = _interopRequireWildcard(require("react"));
9
-
10
8
  var _componentsBase = require("@telus-uds/components-base");
11
-
12
9
  var _jsxRuntime = require("react/jsx-runtime");
13
-
14
10
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
-
16
11
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
-
18
12
  /**
19
13
  * Takes a string content and marks up all the links in it by wrapping them
20
14
  * in `Link` component.
21
- */
22
- const generateLinks = content => {
15
+ */const generateLinks = content => {
23
16
  const linkRegex = /<\s*a([^>]*)>(.*?)<\s*\/\s*a>/g;
24
17
  const attributeRegex = /(\w+)\s*=\s*((["'])(.*?)\3|(?=\s|\/>))/g;
25
18
  const parts = content.split(linkRegex);
26
-
27
19
  if (parts.length === 1) {
28
20
  return parts;
29
- } // Start with first anchor text, attributes will be in the previous part
30
-
21
+ }
31
22
 
23
+ // Start with first anchor text, attributes will be in the previous part
32
24
  for (let i = 2; i < parts.length; i += 3) {
33
- const o = {}; // Get attributes from previous part
34
-
35
- const attributes = parts[i - 1].trim(); // Create object from attributes
25
+ const o = {};
26
+ // Get attributes from previous part
27
+ const attributes = parts[i - 1].trim();
36
28
 
29
+ // Create object from attributes
37
30
  const matchedAttributes = attributes.match(attributeRegex);
38
-
39
31
  if (matchedAttributes) {
40
32
  matchedAttributes.forEach(attribute => {
41
33
  const split = attribute.split('=');
42
34
  o[split[0]] = split[1].substr(1, split[1].length - 2);
43
35
  });
44
- } // Remove anchor attributes from parts
45
-
46
-
47
- parts[i - 1] = undefined; // Replace anchor text with Link in parts
48
-
49
- parts[i] = /*#__PURE__*/(0, _react.createElement)(_componentsBase.Link, { ...o,
36
+ }
37
+ // Remove anchor attributes from parts
38
+ parts[i - 1] = undefined;
39
+ // Replace anchor text with Link in parts
40
+ parts[i] = /*#__PURE__*/(0, _react.createElement)(_componentsBase.Link, {
41
+ ...o,
50
42
  key: i
51
43
  }, parts[i]);
52
44
  }
53
-
54
45
  return parts;
55
46
  };
47
+
56
48
  /**
57
49
  * Takes an array of strings and in each element replaces the breaks with `<br>` tags.
58
50
  */
59
-
60
-
61
51
  const generateBreaks = parts => {
62
52
  const breakRegex = /<br\s?\/*>/g;
63
53
  const partsWithBreaks = parts;
64
-
65
54
  for (let i = 0; i < partsWithBreaks.length; i += 1) {
66
55
  if (typeof partsWithBreaks[i] === 'string' && partsWithBreaks[i].search(breakRegex) !== -1) {
67
56
  const toSplit = partsWithBreaks[i].split(breakRegex);
68
-
69
57
  for (let x = 1; x < toSplit.length; x += 2) {
70
58
  toSplit.splice(x, 0, /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}, `break-${i}-${x}`));
71
59
  }
72
-
73
60
  partsWithBreaks[i] = toSplit;
74
61
  }
75
62
  }
76
-
77
63
  return partsWithBreaks;
78
64
  };
79
-
80
65
  const renderStructuredContent = content => {
81
66
  if (typeof content !== 'string') {
82
67
  return content;
83
68
  }
84
-
85
69
  return generateBreaks(generateLinks(content));
86
70
  };
87
-
88
71
  var _default = renderStructuredContent;
89
72
  exports.default = _default;
package/lib/utils/ssr.js CHANGED
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _styledComponents = require("styled-components");
9
-
10
8
  var _componentsBase = require("@telus-uds/components-base");
11
-
12
9
  /**
13
10
  * Returns object with `renderApp` and `getStyles` functions.
14
11
  * Weave these into your app's server-side render process:
@@ -33,18 +30,15 @@ const ssrStyles = function () {
33
30
  collectStyles = renderedApp => renderedApp
34
31
  } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
35
32
  const sheet = new _styledComponents.ServerStyleSheet();
36
-
37
33
  const getStyledComponentsStyles = () => {
38
34
  const styles = sheet.getStyleElement();
39
35
  sheet.seal();
40
36
  return styles;
41
37
  };
42
-
43
38
  return (0, _componentsBase.ssrStyles)(appName, {
44
39
  styleGetters: [getStyledComponentsStyles, ...styleGetters],
45
40
  collectStyles: renderedApp => collectStyles(sheet.collectStyles(renderedApp))
46
41
  });
47
42
  };
48
-
49
43
  var _default = ssrStyles;
50
44
  exports.default = _default;
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.transformGradient = exports.default = void 0;
7
-
8
7
  const transformGradient = gradient => `${gradient.type}-gradient(${gradient.angle}deg, ${gradient.stops[0].color} ${gradient.stops[0].stop * 100}%, ${gradient.stops[1].color} ${gradient.stops[1].stop * 100}%)`;
9
-
10
8
  exports.transformGradient = transformGradient;
11
9
  var _default = {
12
10
  transformGradient
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _react = require("react");
9
-
10
8
  var _Dimensions = _interopRequireDefault(require("react-native-web/dist/cjs/exports/Dimensions"));
11
-
12
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
10
  // TODO: add react-native as a peer dep and support native apps too.
15
11
  // That requires some fiddling with Allium repo storybook config, babel, etc,
16
12
  // unless ADS gets merged back into UDS monorepo.
@@ -24,34 +20,29 @@ const adjustHorizontalToFit = (initialOffset, windowWidth, sourceWidth) => {
24
20
  if (tooWideBy) adjusted.width = Math.max(0, sourceWidth - tooWideBy);
25
21
  return adjusted;
26
22
  };
27
-
28
23
  const getPosition = _ref => {
29
24
  let {
30
25
  edge,
31
26
  fromEdge,
32
27
  sourceSize
33
28
  } = _ref;
34
-
35
29
  switch (edge) {
36
30
  case 'near':
37
31
  return fromEdge;
38
-
39
32
  case 'mid':
40
33
  return fromEdge + sourceSize / 2;
41
-
42
34
  case 'far':
43
35
  return fromEdge + sourceSize;
44
-
45
36
  default:
46
37
  return 0;
47
38
  }
48
39
  };
49
-
50
40
  const getEdgeType = (align, alignSide) => {
51
41
  const alignTo = align[alignSide];
52
42
  const edge = ['center', 'middle'].includes(alignTo) && 'mid' || (alignSide === alignTo ? 'near' : 'far');
53
43
  return edge;
54
44
  };
45
+
55
46
  /**
56
47
  * Based on UDS's private getTooltipPosition but generalised.
57
48
  *
@@ -62,8 +53,6 @@ const getEdgeType = (align, alignSide) => {
62
53
  * before it is shown, which makes it account for the width being limiting in styles, custom font
63
54
  * rendering, etc.
64
55
  */
65
-
66
-
67
56
  function getOverlaidPosition(_ref2) {
68
57
  let {
69
58
  sourceLayout,
@@ -78,8 +67,9 @@ function getOverlaidPosition(_ref2) {
78
67
  const {
79
68
  scrollX = 0,
80
69
  scrollY = 0
81
- } = typeof window === 'object' ? window : {}; // Will have top, bottom, left and/or right offsets depending on `align`
70
+ } = typeof window === 'object' ? window : {};
82
71
 
72
+ // Will have top, bottom, left and/or right offsets depending on `align`
83
73
  const positioning = {};
84
74
  if (align.top) positioning.top = getPosition({
85
75
  edge: getEdgeType(align, 'top'),
@@ -111,20 +101,18 @@ function getOverlaidPosition(_ref2) {
111
101
  fromEdge: windowDimensions.width - (sourceLayout.x + scrollX + sourceLayout.width - (offsets.horizontal ?? 0)),
112
102
  sourceSize: sourceLayout.width
113
103
  });
114
-
115
104
  if (!(align.left && align.right)) {
116
105
  // Check if the position and/or width need adjusting to fit on the screen
117
106
  const side = align.right ? 'right' : 'left';
118
107
  const adjusted = adjustHorizontalToFit(positioning[side], windowDimensions.width, sourceLayout.width);
119
108
  if (typeof adjusted.width === 'number') positioning.width = adjusted.width;
120
-
121
109
  if (typeof adjusted.offset === 'number') {
122
110
  positioning[side] = adjusted.offset;
123
111
  }
124
112
  }
125
-
126
113
  return positioning;
127
114
  }
115
+
128
116
  /**
129
117
  * Positions an element in a modal or portal so that it appears tooltip-like below the
130
118
  * target element.
@@ -133,8 +121,6 @@ function getOverlaidPosition(_ref2) {
133
121
  * a small task because UDS's tooltip logic only really works for short text - it might be
134
122
  * better to use a third-party library).
135
123
  */
136
-
137
-
138
124
  const useOverlaidPosition = _ref3 => {
139
125
  let {
140
126
  isShown = false,
@@ -147,8 +133,9 @@ const useOverlaidPosition = _ref3 => {
147
133
  } = _ref3;
148
134
  // Element in main document flow that the targetRef element is positioned around
149
135
  const sourceRef = (0, _react.useRef)(null);
150
- const [sourceLayout, setSourceLayout] = (0, _react.useState)(null); // Element in a modal or portal overlay positioned to appear adjacent to sourceRef
136
+ const [sourceLayout, setSourceLayout] = (0, _react.useState)(null);
151
137
 
138
+ // Element in a modal or portal overlay positioned to appear adjacent to sourceRef
152
139
  const targetRef = (0, _react.useRef)(null);
153
140
  const [targetDimensions, setTargetDimensions] = (0, _react.useState)(null);
154
141
  const [windowDimensions, setWindowDimensions] = (0, _react.useState)(null);
@@ -173,7 +160,6 @@ const useOverlaidPosition = _ref3 => {
173
160
  height
174
161
  };
175
162
  }
176
-
177
163
  return previousDimensions;
178
164
  });
179
165
  }, []);
@@ -181,7 +167,6 @@ const useOverlaidPosition = _ref3 => {
181
167
  (0, _react.useEffect)(() => {
182
168
  const handleDimensionsChange = _ref5 => {
183
169
  var _sourceRef$current;
184
-
185
170
  let {
186
171
  window
187
172
  } = _ref5;
@@ -196,12 +181,9 @@ const useOverlaidPosition = _ref3 => {
196
181
  });
197
182
  });
198
183
  };
199
-
200
184
  let subscription;
201
-
202
185
  const unsubscribe = () => {
203
186
  var _subscription;
204
-
205
187
  if (typeof ((_subscription = subscription) === null || _subscription === void 0 ? void 0 : _subscription.remove) === 'function') {
206
188
  // React Native >=0.65.0
207
189
  subscription.remove();
@@ -209,11 +191,9 @@ const useOverlaidPosition = _ref3 => {
209
191
  // React Native <0.65.0
210
192
  _Dimensions.default.remove('change', handleDimensionsChange);
211
193
  }
212
-
213
194
  setSourceLayout(null);
214
195
  setTargetDimensions(null);
215
196
  };
216
-
217
197
  if (readyToShow) {
218
198
  subscription = _Dimensions.default.addEventListener('change', handleDimensionsChange);
219
199
  handleDimensionsChange({
@@ -222,7 +202,6 @@ const useOverlaidPosition = _ref3 => {
222
202
  } else {
223
203
  unsubscribe();
224
204
  }
225
-
226
205
  return unsubscribe;
227
206
  }, [readyToShow]);
228
207
  const isReady = Boolean(isShown && sourceLayout && windowDimensions && targetDimensions);
@@ -241,6 +220,5 @@ const useOverlaidPosition = _ref3 => {
241
220
  isReady
242
221
  };
243
222
  };
244
-
245
223
  var _default = useOverlaidPosition;
246
224
  exports.default = _default;
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _componentsBase = require("@telus-uds/components-base");
9
-
10
8
  const useTypographyTheme = (variant, tokens) => {
11
9
  const viewport = (0, _componentsBase.useViewport)();
12
10
  const themeTokens = (0, _componentsBase.useThemeTokens)('Typography', tokens, variant, {
@@ -19,14 +17,15 @@ const useTypographyTheme = (variant, tokens) => {
19
17
  fontSize,
20
18
  lineHeight,
21
19
  ...rnStyles
22
- } = (0, _componentsBase.applyTextStyles)({ ...themeTokens,
20
+ } = (0, _componentsBase.applyTextStyles)({
21
+ ...themeTokens,
23
22
  themeOptions
24
23
  });
25
- return { ...rnStyles,
24
+ return {
25
+ ...rnStyles,
26
26
  fontSize: `${fontSize}px`,
27
27
  lineHeight: `${lineHeight}px`
28
28
  };
29
29
  };
30
-
31
30
  var _default = useTypographyTheme;
32
31
  exports.default = _default;
@@ -41,7 +41,6 @@ const BadgeContainer = /*#__PURE__*/styled.div.withConfig({
41
41
  ${gradient && '-webkit-text-fill-color: transparent;'}
42
42
  }`;
43
43
  });
44
-
45
44
  const Badge = _ref6 => {
46
45
  let {
47
46
  children,
@@ -72,13 +71,11 @@ const Badge = _ref6 => {
72
71
  } = variant;
73
72
  let background = backgroundColor;
74
73
  const isOutlineOffer = purpose === 'offer' && outline;
75
-
76
74
  if ((isOutlineOffer || alternative) && gradient) {
77
75
  background = `linear-gradient(#fff 0 0) padding-box, ${semanticGradient} border-box`;
78
76
  } else if (purpose === 'offer' && gradient) {
79
77
  background = semanticGradient;
80
78
  }
81
-
82
79
  const fontSizeMapping = {
83
80
  12: 'micro',
84
81
  14: 'small',
@@ -108,8 +105,8 @@ const Badge = _ref6 => {
108
105
  })
109
106
  });
110
107
  };
111
-
112
- Badge.propTypes = { ...selectedSystemPropTypes,
108
+ Badge.propTypes = {
109
+ ...selectedSystemPropTypes,
113
110
  children: PropTypes.node,
114
111
  tokens: getTokensPropType('Badge'),
115
112
  variant: PropTypes.exact({
@@ -49,7 +49,6 @@ const QuoteContainer = /*#__PURE__*/styled.div.withConfig({
49
49
  } = _ref7;
50
50
  return `${marginBottom}px`;
51
51
  });
52
-
53
52
  const BlockQuote = _ref8 => {
54
53
  let {
55
54
  children,
@@ -100,7 +99,6 @@ const BlockQuote = _ref8 => {
100
99
  fontWeight: titleFontWeight,
101
100
  lineHeight: titleLineHeight
102
101
  };
103
-
104
102
  const renderLink = () => {
105
103
  if (linkHref) {
106
104
  return /*#__PURE__*/_jsx(Link, {
@@ -120,7 +118,6 @@ const BlockQuote = _ref8 => {
120
118
  children: link
121
119
  });
122
120
  }
123
-
124
121
  return /*#__PURE__*/_jsx(Typography, {
125
122
  tokens: {
126
123
  color,
@@ -132,7 +129,6 @@ const BlockQuote = _ref8 => {
132
129
  children: link
133
130
  });
134
131
  };
135
-
136
132
  const renderQuote = () => {
137
133
  const quote = /*#__PURE__*/_jsx(Typography, {
138
134
  tokens: {
@@ -144,18 +140,16 @@ const BlockQuote = _ref8 => {
144
140
  },
145
141
  children: children
146
142
  });
147
-
148
143
  if (additionalInfo || link) {
149
144
  return /*#__PURE__*/_jsx(QuoteContainer, {
150
145
  marginBottom: marginBottom,
151
146
  children: quote
152
147
  });
153
148
  }
154
-
155
149
  return quote;
156
150
  };
157
-
158
- return /*#__PURE__*/_jsxs(BlockQuoteContainer, { ...selectProps(rest),
151
+ return /*#__PURE__*/_jsxs(BlockQuoteContainer, {
152
+ ...selectProps(rest),
159
153
  paddingTop: paddingTop,
160
154
  paddingBottom: paddingBottom,
161
155
  paddingLeft: paddingLeft,
@@ -176,35 +170,30 @@ const BlockQuote = _ref8 => {
176
170
  })]
177
171
  });
178
172
  };
179
-
180
- BlockQuote.propTypes = { ...selectedSystemPropTypes,
173
+ BlockQuote.propTypes = {
174
+ ...selectedSystemPropTypes,
181
175
  ...withLinkRouter.propTypes,
182
176
  tokens: getTokensPropType('BlockQuote'),
183
177
  variant: PropTypes.exact({
184
178
  alternative: PropTypes.bool,
185
179
  size: PropTypes.string
186
180
  }),
187
-
188
181
  /**
189
182
  * Children nodes that can be added
190
183
  */
191
184
  children: PropTypes.node.isRequired,
192
-
193
185
  /**
194
186
  * External source's identifier (e.g. author's name)
195
187
  */
196
188
  link: PropTypes.string,
197
-
198
189
  /**
199
190
  * External source's URL
200
191
  */
201
192
  linkHref: PropTypes.string,
202
-
203
193
  /**
204
194
  * To provide additional information about the source, rendered underneath `link`
205
195
  */
206
196
  additionalInfo: PropTypes.string,
207
-
208
197
  /**
209
198
  * Whether to render BlockQuote as a heading size of `h3` or large text size
210
199
  */