@telus-uds/components-web 1.7.0 → 1.9.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 (220) hide show
  1. package/.eslintignore +2 -0
  2. package/.vscode/settings.json +7 -0
  3. package/CHANGELOG.md +39 -2
  4. package/lib/Autocomplete/Autocomplete.js +393 -0
  5. package/lib/Autocomplete/Loading.js +51 -0
  6. package/lib/Autocomplete/Suggestions.js +81 -0
  7. package/lib/Autocomplete/constants.js +19 -0
  8. package/lib/Autocomplete/dictionary.js +19 -0
  9. package/lib/Autocomplete/index.js +13 -0
  10. package/lib/BlockQuote/BlockQuote.js +173 -0
  11. package/lib/BlockQuote/index.js +13 -0
  12. package/lib/Callout/Callout.js +3 -0
  13. package/lib/Card/Card.js +180 -0
  14. package/lib/Card/CardContent.js +110 -0
  15. package/lib/Card/CardFooter.js +98 -0
  16. package/lib/Card/index.js +13 -0
  17. package/lib/Countdown/Countdown.js +189 -0
  18. package/lib/Countdown/Segment.js +111 -0
  19. package/lib/Countdown/constants.js +14 -0
  20. package/lib/Countdown/dictionary.js +29 -0
  21. package/lib/Countdown/index.js +13 -0
  22. package/lib/Countdown/types.js +39 -0
  23. package/lib/Countdown/useCountdown.js +40 -0
  24. package/lib/IconButton/IconButton.js +70 -0
  25. package/lib/IconButton/index.js +13 -0
  26. package/lib/Listbox/GroupControl.js +94 -0
  27. package/lib/Listbox/Listbox.js +164 -0
  28. package/lib/Listbox/ListboxGroup.js +129 -0
  29. package/lib/Listbox/ListboxItem.js +137 -0
  30. package/lib/Listbox/ListboxOverlay.js +89 -0
  31. package/lib/Listbox/PressableItem.js +149 -0
  32. package/lib/Listbox/index.js +13 -0
  33. package/lib/Modal/ModalContent.js +11 -4
  34. package/lib/NavigationBar/resolveItemSelection.js +24 -0
  35. package/lib/OptimizeImage/OptimizeImage.js +127 -0
  36. package/lib/OptimizeImage/index.js +13 -0
  37. package/lib/OptimizeImage/utils/getFallbackUrl.js +18 -0
  38. package/lib/OptimizeImage/utils/getOptimizedUrl.js +32 -0
  39. package/lib/OptimizeImage/utils/hasWebpSupport.js +38 -0
  40. package/lib/OptimizeImage/utils/index.js +31 -0
  41. package/lib/OptimizeImage/utils/isSvgUrl.js +10 -0
  42. package/lib/QuantitySelector/QuantitySelector.js +253 -0
  43. package/lib/QuantitySelector/dictionary.js +33 -0
  44. package/lib/QuantitySelector/index.js +13 -0
  45. package/lib/QuantitySelector/styles.js +40 -0
  46. package/lib/StoryCard/StoryCard.js +244 -0
  47. package/lib/StoryCard/index.js +13 -0
  48. package/lib/TermsAndConditions/ExpandCollapse.js +141 -0
  49. package/lib/TermsAndConditions/TermsAndConditions.js +221 -0
  50. package/lib/TermsAndConditions/dictionary.js +19 -0
  51. package/lib/TermsAndConditions/index.js +15 -0
  52. package/lib/Testimonial/Testimonial.js +226 -0
  53. package/lib/Testimonial/index.js +13 -0
  54. package/lib/Video/ControlBar/ControlBar.js +315 -0
  55. package/lib/Video/ControlBar/Controls/VideoButton/VideoButton.js +91 -0
  56. package/lib/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +186 -0
  57. package/lib/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +221 -0
  58. package/lib/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +213 -0
  59. package/lib/Video/MiddleControlButton/MiddleControlButton.js +89 -0
  60. package/lib/Video/Video.js +1072 -0
  61. package/lib/Video/index.js +13 -0
  62. package/lib/Video/videoText.js +62 -0
  63. package/lib/WebVideo/WebVideo.js +170 -0
  64. package/lib/WebVideo/index.js +13 -0
  65. package/lib/baseExports.js +0 -12
  66. package/lib/index.js +118 -1
  67. package/lib/shared/VideoSplash/SplashButton/SplashButton.js +102 -0
  68. package/lib/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +234 -0
  69. package/lib/shared/VideoSplash/VideoSplash.js +86 -0
  70. package/lib/shared/VideoSplash/helpers.js +38 -0
  71. package/lib/utils/index.js +8 -0
  72. package/lib/utils/useOverlaidPosition.js +246 -0
  73. package/lib-module/Autocomplete/Autocomplete.js +369 -0
  74. package/lib-module/Autocomplete/Loading.js +38 -0
  75. package/lib-module/Autocomplete/Suggestions.js +64 -0
  76. package/lib-module/Autocomplete/constants.js +5 -0
  77. package/lib-module/Autocomplete/dictionary.js +12 -0
  78. package/lib-module/Autocomplete/index.js +2 -0
  79. package/lib-module/BlockQuote/BlockQuote.js +156 -0
  80. package/lib-module/BlockQuote/index.js +2 -0
  81. package/lib-module/Callout/Callout.js +3 -0
  82. package/lib-module/Card/Card.js +158 -0
  83. package/lib-module/Card/CardContent.js +92 -0
  84. package/lib-module/Card/CardFooter.js +80 -0
  85. package/lib-module/Card/index.js +2 -0
  86. package/lib-module/Countdown/Countdown.js +165 -0
  87. package/lib-module/Countdown/Segment.js +94 -0
  88. package/lib-module/Countdown/constants.js +4 -0
  89. package/lib-module/Countdown/dictionary.js +22 -0
  90. package/lib-module/Countdown/index.js +2 -0
  91. package/lib-module/Countdown/types.js +23 -0
  92. package/lib-module/Countdown/useCountdown.js +32 -0
  93. package/lib-module/IconButton/IconButton.js +52 -0
  94. package/lib-module/IconButton/index.js +2 -0
  95. package/lib-module/Listbox/GroupControl.js +80 -0
  96. package/lib-module/Listbox/Listbox.js +142 -0
  97. package/lib-module/Listbox/ListboxGroup.js +106 -0
  98. package/lib-module/Listbox/ListboxItem.js +112 -0
  99. package/lib-module/Listbox/ListboxOverlay.js +68 -0
  100. package/lib-module/Listbox/PressableItem.js +128 -0
  101. package/lib-module/Listbox/index.js +2 -0
  102. package/lib-module/Modal/ModalContent.js +10 -4
  103. package/lib-module/NavigationBar/resolveItemSelection.js +16 -0
  104. package/lib-module/OptimizeImage/OptimizeImage.js +106 -0
  105. package/lib-module/OptimizeImage/index.js +2 -0
  106. package/lib-module/OptimizeImage/utils/getFallbackUrl.js +8 -0
  107. package/lib-module/OptimizeImage/utils/getOptimizedUrl.js +22 -0
  108. package/lib-module/OptimizeImage/utils/hasWebpSupport.js +32 -0
  109. package/lib-module/OptimizeImage/utils/index.js +4 -0
  110. package/lib-module/OptimizeImage/utils/isSvgUrl.js +3 -0
  111. package/lib-module/QuantitySelector/QuantitySelector.js +232 -0
  112. package/lib-module/QuantitySelector/dictionary.js +26 -0
  113. package/lib-module/QuantitySelector/index.js +2 -0
  114. package/lib-module/QuantitySelector/styles.js +21 -0
  115. package/lib-module/StoryCard/StoryCard.js +220 -0
  116. package/lib-module/StoryCard/index.js +2 -0
  117. package/lib-module/TermsAndConditions/ExpandCollapse.js +120 -0
  118. package/lib-module/TermsAndConditions/TermsAndConditions.js +193 -0
  119. package/lib-module/TermsAndConditions/dictionary.js +12 -0
  120. package/lib-module/TermsAndConditions/index.js +1 -0
  121. package/lib-module/Testimonial/Testimonial.js +204 -0
  122. package/lib-module/Testimonial/index.js +2 -0
  123. package/lib-module/Video/ControlBar/ControlBar.js +292 -0
  124. package/lib-module/Video/ControlBar/Controls/VideoButton/VideoButton.js +74 -0
  125. package/lib-module/Video/ControlBar/Controls/VideoMenu/VideoMenu.js +167 -0
  126. package/lib-module/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +201 -0
  127. package/lib-module/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.js +193 -0
  128. package/lib-module/Video/MiddleControlButton/MiddleControlButton.js +72 -0
  129. package/lib-module/Video/Video.js +1042 -0
  130. package/lib-module/Video/index.js +2 -0
  131. package/lib-module/Video/videoText.js +55 -0
  132. package/lib-module/WebVideo/WebVideo.js +144 -0
  133. package/lib-module/WebVideo/index.js +2 -0
  134. package/lib-module/baseExports.js +1 -1
  135. package/lib-module/index.js +13 -0
  136. package/lib-module/shared/VideoSplash/SplashButton/SplashButton.js +85 -0
  137. package/lib-module/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +216 -0
  138. package/lib-module/shared/VideoSplash/VideoSplash.js +65 -0
  139. package/lib-module/shared/VideoSplash/helpers.js +23 -0
  140. package/lib-module/utils/index.js +2 -1
  141. package/lib-module/utils/useOverlaidPosition.js +235 -0
  142. package/package.json +7 -5
  143. package/src/Autocomplete/Autocomplete.jsx +354 -0
  144. package/src/Autocomplete/Loading.jsx +18 -0
  145. package/src/Autocomplete/Suggestions.jsx +52 -0
  146. package/src/Autocomplete/constants.js +6 -0
  147. package/src/Autocomplete/dictionary.js +12 -0
  148. package/src/Autocomplete/index.js +3 -0
  149. package/src/BlockQuote/BlockQuote.jsx +130 -0
  150. package/src/BlockQuote/index.js +3 -0
  151. package/src/Callout/Callout.jsx +1 -1
  152. package/src/Card/Card.jsx +170 -0
  153. package/src/Card/CardContent.jsx +88 -0
  154. package/src/Card/CardFooter.jsx +70 -0
  155. package/src/Card/index.js +3 -0
  156. package/src/Countdown/Countdown.jsx +144 -0
  157. package/src/Countdown/Segment.jsx +69 -0
  158. package/src/Countdown/constants.js +4 -0
  159. package/src/Countdown/dictionary.js +22 -0
  160. package/src/Countdown/index.js +3 -0
  161. package/src/Countdown/types.js +23 -0
  162. package/src/Countdown/useCountdown.js +34 -0
  163. package/src/IconButton/IconButton.jsx +46 -0
  164. package/src/IconButton/index.js +3 -0
  165. package/src/Listbox/GroupControl.jsx +65 -0
  166. package/src/Listbox/Listbox.jsx +148 -0
  167. package/src/Listbox/ListboxGroup.jsx +110 -0
  168. package/src/Listbox/ListboxItem.jsx +101 -0
  169. package/src/Listbox/ListboxOverlay.jsx +71 -0
  170. package/src/Listbox/PressableItem.jsx +121 -0
  171. package/src/Listbox/index.js +3 -0
  172. package/src/Modal/ModalContent.jsx +8 -4
  173. package/src/NavigationBar/resolveItemSelection.js +11 -0
  174. package/src/OptimizeImage/OptimizeImage.jsx +131 -0
  175. package/src/OptimizeImage/index.js +3 -0
  176. package/src/OptimizeImage/utils/getFallbackUrl.js +9 -0
  177. package/src/OptimizeImage/utils/getOptimizedUrl.js +30 -0
  178. package/src/OptimizeImage/utils/hasWebpSupport.js +33 -0
  179. package/src/OptimizeImage/utils/index.js +5 -0
  180. package/src/OptimizeImage/utils/isSvgUrl.js +3 -0
  181. package/src/QuantitySelector/QuantitySelector.jsx +245 -0
  182. package/src/QuantitySelector/dictionary.js +27 -0
  183. package/src/QuantitySelector/index.js +3 -0
  184. package/src/QuantitySelector/styles.js +83 -0
  185. package/src/StoryCard/StoryCard.jsx +198 -0
  186. package/src/StoryCard/index.js +3 -0
  187. package/src/TermsAndConditions/ExpandCollapse.jsx +106 -0
  188. package/src/TermsAndConditions/TermsAndConditions.jsx +161 -0
  189. package/src/TermsAndConditions/dictionary.js +12 -0
  190. package/src/TermsAndConditions/index.js +1 -0
  191. package/src/Testimonial/Testimonial.jsx +169 -0
  192. package/src/Testimonial/index.js +3 -0
  193. package/src/Video/ControlBar/ControlBar.jsx +261 -0
  194. package/src/Video/ControlBar/Controls/VideoButton/VideoButton.jsx +61 -0
  195. package/src/Video/ControlBar/Controls/VideoMenu/VideoMenu.jsx +159 -0
  196. package/src/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.jsx +185 -0
  197. package/src/Video/ControlBar/Controls/VolumeSlider/VolumeSlider.jsx +184 -0
  198. package/src/Video/MiddleControlButton/MiddleControlButton.jsx +64 -0
  199. package/src/Video/Video.jsx +988 -0
  200. package/src/Video/index.js +3 -0
  201. package/src/Video/videoText.js +58 -0
  202. package/src/WebVideo/WebVideo.jsx +131 -0
  203. package/src/WebVideo/index.js +3 -0
  204. package/src/baseExports.js +0 -2
  205. package/src/index.js +13 -0
  206. package/src/shared/VideoSplash/SplashButton/SplashButton.jsx +64 -0
  207. package/src/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.jsx +128 -0
  208. package/src/shared/VideoSplash/VideoSplash.jsx +50 -0
  209. package/src/shared/VideoSplash/helpers.js +27 -0
  210. package/src/utils/index.js +10 -1
  211. package/src/utils/useOverlaidPosition.js +226 -0
  212. package/types/Autocomplete.d.ts +32 -0
  213. package/types/Card.d.ts +45 -0
  214. package/types/ControlBar.d.ts +59 -0
  215. package/types/MiddleControlButton.d.ts +15 -0
  216. package/types/Video.d.ts +39 -0
  217. package/types/VideoButton.d.ts +14 -0
  218. package/types/VideoMenu.d.ts +16 -0
  219. package/types/VideoProgressBar.d.ts +17 -0
  220. package/types/VolumeSlider.d.ts +20 -0
@@ -0,0 +1,244 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _componentsBase = require("@telus-uds/components-base");
13
+
14
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
15
+
16
+ var _FullBleedContent = _interopRequireWildcard(require("../shared/FullBleedContent"));
17
+
18
+ var _jsxRuntime = require("react/jsx-runtime");
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
22
+ 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); }
23
+
24
+ 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; }
25
+
26
+ /* eslint-disable react/require-default-props */
27
+ // Passes React Native-oriented system props through UDS PressableCardBase
28
+ const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_componentsBase.a11yProps, _componentsBase.focusHandlerProps, _componentsBase.viewProps]); // Stop changes to the card's inner border width causing the size and
29
+ // apparent position of the full bleed image to change.
30
+
31
+ const FullBleedOffsetOuter = /*#__PURE__*/_styledComponents.default.div.withConfig({
32
+ displayName: "StoryCard__FullBleedOffsetOuter",
33
+ componentId: "components-web__sc-yhvivu-0"
34
+ })(_ref => {
35
+ let {
36
+ borderOffset
37
+ } = _ref;
38
+ return {
39
+ overflow: 'hidden',
40
+ marginTop: borderOffset * 2
41
+ };
42
+ });
43
+
44
+ const FullBleedOffsetInner = /*#__PURE__*/_styledComponents.default.div.withConfig({
45
+ displayName: "StoryCard__FullBleedOffsetInner",
46
+ componentId: "components-web__sc-yhvivu-1"
47
+ })(_ref2 => {
48
+ let {
49
+ borderOffset
50
+ } = _ref2;
51
+ return {
52
+ position: 'relative',
53
+ margin: 0 - borderOffset
54
+ };
55
+ });
56
+ /**
57
+ * Showcase and guide users to another page, offering a description of that page's story.
58
+ * Whole card is interactive, width expands based on column or container.
59
+ *
60
+ * - Use `tag` to show category of content
61
+ * - Use `date` to show when the story was published
62
+ * - Use `title` to show title of the story
63
+ * - Use `description` to show description of the story
64
+ * - Use `href` to set the target URL
65
+ * - Use `fullBleedContent` to set the thumbnail image
66
+ */
67
+
68
+
69
+ const StoryCard = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
70
+ let {
71
+ tag,
72
+ date,
73
+ title,
74
+ description,
75
+ fullBleedImage,
76
+ fullBleedContent = fullBleedImage,
77
+ onPress,
78
+ href,
79
+ tokens,
80
+ variant = {},
81
+ ...rest
82
+ } = _ref3;
83
+ const {
84
+ fullBleedContentPosition,
85
+ contentStackDirection,
86
+ fullBleedContentProps
87
+ } = (0, _FullBleedContent.useFullBleedContentProps)({ ...fullBleedContent,
88
+ position: 'bottom'
89
+ });
90
+ const generalTokens = (0, _componentsBase.useThemeTokens)('StoryCard', tokens, variant);
91
+ const getTokens = (0, _componentsBase.useThemeTokensCallback)('StoryCard', tokens, variant);
92
+
93
+ const getPressableCardTokens = cardState => getTokens(cardState);
94
+
95
+ const {
96
+ hrefAttrs,
97
+ rest: unusedRest
98
+ } = _componentsBase.hrefAttrsProp.bundle(rest);
99
+
100
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.PressableCardBase, {
101
+ ref: ref,
102
+ onPress: onPress,
103
+ href: href,
104
+ hrefAttrs: hrefAttrs,
105
+ tokens: getPressableCardTokens,
106
+ ...selectProps(unusedRest),
107
+ children: cardState => {
108
+ const {
109
+ borderRadius,
110
+ borderWidth
111
+ } = getPressableCardTokens(cardState); // Stop content jumping around as border size changes
112
+
113
+ const borderOffset = borderWidth - generalTokens.borderWidth;
114
+ const fullBleedBorderRadius = (0, _FullBleedContent.getFullBleedBorderRadius)(borderRadius + borderOffset, fullBleedContentPosition);
115
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.StackView, {
116
+ direction: contentStackDirection,
117
+ tokens: {
118
+ justifyContent: 'space-between',
119
+ flexGrow: 1
120
+ },
121
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.Box, {
122
+ horizontal: {
123
+ xs: 4,
124
+ lg: 5,
125
+ options: {
126
+ subtract: borderOffset
127
+ }
128
+ },
129
+ vertical: {
130
+ xs: 5,
131
+ lg: 7,
132
+ options: {
133
+ subtract: borderOffset
134
+ }
135
+ },
136
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.StackWrap, {
137
+ space: 1,
138
+ tokens: {
139
+ justifyContent: 'space-between',
140
+ alignItems: 'baseline'
141
+ },
142
+ children: [Boolean(tag) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
143
+ variant: {
144
+ size: 'eyebrow',
145
+ colour: 'secondary'
146
+ },
147
+ children: tag
148
+ }), Boolean(date) &&
149
+ /*#__PURE__*/
150
+ // TODO: get user locale and apply date formatting: "MMM DD, YYYY" for `en` and "YYYY-MM-DD" for `fr`
151
+ // Get locale based on decision of https://github.com/telus/universal-design-system/issues/715
152
+ (0, _jsxRuntime.jsx)(_componentsBase.Typography, {
153
+ variant: {
154
+ size: 'small',
155
+ colour: 'secondary'
156
+ },
157
+ children: date
158
+ })]
159
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Spacer, {
160
+ space: 2
161
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Divider, {
162
+ variant: {
163
+ decorative: true
164
+ }
165
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Spacer, {
166
+ space: 3
167
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
168
+ variant: {
169
+ size: 'h3',
170
+ colour: 'secondary'
171
+ },
172
+ children: title
173
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Spacer, {
174
+ space: 2
175
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
176
+ children: description
177
+ })]
178
+ }), Boolean(fullBleedContentProps.src || fullBleedContentProps.content) && /*#__PURE__*/(0, _jsxRuntime.jsx)(FullBleedOffsetOuter, {
179
+ borderOffset: borderOffset,
180
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(FullBleedOffsetInner, {
181
+ borderOffset: borderOffset,
182
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullBleedContent.default, {
183
+ borderRadius: fullBleedBorderRadius,
184
+ ...fullBleedContentProps
185
+ })
186
+ })
187
+ })]
188
+ });
189
+ }
190
+ });
191
+ });
192
+ StoryCard.displayName = 'StoryCard';
193
+ StoryCard.propTypes = { ...selectedSystemPropTypes,
194
+
195
+ /**
196
+ * The URL of the story to be navigated to. Note that `Video` component does not play well when used within
197
+ * a `StoryCard` with `href` prop set (the volume and progress sliders can be clicked but are not draggable).
198
+ * Please use `onPress` prop instead `href` to organize navigation in cases like this.
199
+ *
200
+ * @see https://github.com/telus/allium-design-system/issues/6
201
+ */
202
+ href: _propTypes.default.string,
203
+
204
+ /**
205
+ * Optional function to be called on press e.g. for within-page navigation.
206
+ */
207
+ onPress: _propTypes.default.func,
208
+
209
+ /**
210
+ * Text stating the category of the content.
211
+ */
212
+ tag: _propTypes.default.string,
213
+
214
+ /**
215
+ * Text stating the date a story was published.
216
+ */
217
+ date: _propTypes.default.string.isRequired,
218
+
219
+ /**
220
+ * Text stating the title or headline of the story.
221
+ */
222
+ title: _propTypes.default.string.isRequired,
223
+
224
+ /**
225
+ * Text giving a short description of the story. One paragraph of plain text.
226
+ */
227
+ description: _propTypes.default.string.isRequired,
228
+
229
+ /**
230
+ * Full bleed image to be placed on the card, deprecated in favor of `fullBleedContent`.
231
+ *
232
+ * @deprecated
233
+ */
234
+ fullBleedImage: _propTypes.default.exact(_FullBleedContent.default.propTypes || {}),
235
+
236
+ /**
237
+ * Full bleed image to be placed on the card.
238
+ */
239
+ fullBleedContent: _propTypes.default.exact(_FullBleedContent.default.propTypes || {})
240
+ };
241
+
242
+ var _default = (0, _componentsBase.withLinkRouter)(StoryCard);
243
+
244
+ exports.default = _default;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _StoryCard = _interopRequireDefault(require("./StoryCard"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ var _default = _StoryCard.default;
13
+ exports.default = _default;
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _componentsBase = require("@telus-uds/components-base");
13
+
14
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
15
+
16
+ var _jsxRuntime = require("react/jsx-runtime");
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ 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); }
21
+
22
+ 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; }
23
+
24
+ const ExpandCollapseControl = /*#__PURE__*/_styledComponents.default.div.withConfig({
25
+ displayName: "ExpandCollapse__ExpandCollapseControl",
26
+ componentId: "components-web__sc-1l2mmq7-0"
27
+ })({
28
+ alignItems: 'center',
29
+ cursor: 'pointer',
30
+ display: 'flex',
31
+ flex: 1,
32
+ justifyContent: 'flex-start'
33
+ });
34
+
35
+ const ExpandCollapseIconContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
36
+ displayName: "ExpandCollapse__ExpandCollapseIconContainer",
37
+ componentId: "components-web__sc-1l2mmq7-1"
38
+ })(_ref => {
39
+ let {
40
+ tokens
41
+ } = _ref;
42
+ return {
43
+ alignItems: tokens.expandIconContainerAlignItems,
44
+ border: `${tokens.expandIconContainerBorder}px solid ${tokens.expandIconContainerBorderColor}`,
45
+ borderRadius: '50%',
46
+ display: 'flex',
47
+ height: tokens.expandIconContainerHeight,
48
+ justifyContent: tokens.expandIconContainerJustifyContent,
49
+ margin: `${tokens.expandIconContainerMarginX}px ${tokens.expandIconContainerMarginY}px`,
50
+ width: tokens.expandIconContainerWidth
51
+ };
52
+ });
53
+
54
+ const ExpandCollapseTitle = /*#__PURE__*/_styledComponents.default.h4.withConfig({
55
+ displayName: "ExpandCollapse__ExpandCollapseTitle",
56
+ componentId: "components-web__sc-1l2mmq7-2"
57
+ })(_ref2 => {
58
+ let {
59
+ tokens
60
+ } = _ref2;
61
+ return {
62
+ color: tokens.expandTitleColor,
63
+ fontFamily: `${tokens.listFontName}${tokens.listFontWeight}normal`,
64
+ fontSize: tokens.expandTitleFontSize,
65
+ lineHeight: tokens.expandTitleLineHeight,
66
+ margin: `${tokens.expandTitleMarginX}px ${tokens.expandTitleMarginY}px`
67
+ };
68
+ });
69
+
70
+ const ExpandCollapse = /*#__PURE__*/(0, _react.forwardRef)((_ref3, ref) => {
71
+ let {
72
+ children,
73
+ collapseTitle,
74
+ expandTitle = collapseTitle
75
+ } = _ref3;
76
+ const getTokens = (0, _componentsBase.useThemeTokensCallback)('TermsAndConditions', {}, {});
77
+ const {
78
+ expandBaseBorderWidth,
79
+ expandContentPaddingBottom,
80
+ expandContentPaddingLeft,
81
+ expandContentPaddingRight,
82
+ expandContentPaddingTop
83
+ } = getTokens();
84
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.ExpandCollapse, {
85
+ tokens: {
86
+ borderWidth: expandBaseBorderWidth
87
+ },
88
+ children: expandProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.ExpandCollapse.Panel, { ...expandProps,
89
+ panelId: "ExpandCollapsePanel",
90
+ controlTokens: {
91
+ icon: null
92
+ } // TODO refactor
93
+ // eslint-disable-next-line react/no-unstable-nested-components
94
+ ,
95
+ control: pressableState => {
96
+ const {
97
+ expanded
98
+ } = pressableState || {};
99
+ const {
100
+ icon
101
+ } = getTokens({
102
+ expanded
103
+ });
104
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(ExpandCollapseControl, {
105
+ onClick: event => expandProps.onToggle('ExpandCollapsePanel', event),
106
+ ref: ref,
107
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(ExpandCollapseIconContainer, {
108
+ tokens: getTokens(),
109
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Icon, {
110
+ icon: icon,
111
+ variant: {
112
+ size: 'small'
113
+ }
114
+ })
115
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ExpandCollapseTitle, {
116
+ tokens: getTokens(),
117
+ children: expanded ? expandTitle : collapseTitle
118
+ })]
119
+ });
120
+ },
121
+ tokens: {
122
+ contentPaddingBottom: expandContentPaddingBottom,
123
+ contentPaddingLeft: expandContentPaddingLeft,
124
+ contentPaddingRight: expandContentPaddingRight,
125
+ contentPaddingTop: expandContentPaddingTop
126
+ },
127
+ children: children
128
+ })
129
+ });
130
+ });
131
+ ExpandCollapse.displayName = 'ExpandCollapse';
132
+ ExpandCollapse.propTypes = {
133
+ children: _propTypes.default.node.isRequired,
134
+ collapseTitle: _propTypes.default.string.isRequired,
135
+ expandTitle: _propTypes.default.string
136
+ };
137
+ ExpandCollapse.defaultProps = {
138
+ expandTitle: undefined
139
+ };
140
+ var _default = ExpandCollapse;
141
+ exports.default = _default;
@@ -0,0 +1,221 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
13
+
14
+ var _componentsBase = require("@telus-uds/components-base");
15
+
16
+ var _ExpandCollapse = _interopRequireDefault(require("./ExpandCollapse"));
17
+
18
+ var _OrderedListBase = _interopRequireDefault(require("../OrderedList/OrderedListBase"));
19
+
20
+ var _utils = require("../utils");
21
+
22
+ var _dictionary = _interopRequireDefault(require("./dictionary"));
23
+
24
+ var _jsxRuntime = require("react/jsx-runtime");
25
+
26
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
+
28
+ 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); }
29
+
30
+ 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; }
31
+
32
+ const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
33
+
34
+ const ContentContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
35
+ displayName: "TermsAndConditions__ContentContainer",
36
+ componentId: "components-web__sc-1199epn-0"
37
+ })(_ref => {
38
+ let {
39
+ tokens
40
+ } = _ref;
41
+ return {
42
+ paddingBottom: tokens.contentPaddingBottom,
43
+ paddingLeft: tokens.contentPaddingLeft,
44
+ ...(0, _utils.media)().from('md').css({
45
+ paddingBottom: tokens.mdContentPaddingBottom,
46
+ paddingLeft: tokens.mdContentPaddingLeft
47
+ })
48
+ };
49
+ });
50
+
51
+ const Ordered = /*#__PURE__*/(0, _styledComponents.default)(_OrderedListBase.default).withConfig({
52
+ displayName: "TermsAndConditions__Ordered",
53
+ componentId: "components-web__sc-1199epn-1"
54
+ })(_ref2 => {
55
+ let {
56
+ tokens
57
+ } = _ref2;
58
+ return {
59
+ listStylePosition: 'outside',
60
+ padding: tokens.orderedPadding
61
+ };
62
+ });
63
+
64
+ const Unordered = /*#__PURE__*/_styledComponents.default.ul.withConfig({
65
+ displayName: "TermsAndConditions__Unordered",
66
+ componentId: "components-web__sc-1199epn-2"
67
+ })(_ref3 => {
68
+ let {
69
+ tokens
70
+ } = _ref3;
71
+ return {
72
+ listStyleType: 'none',
73
+ margin: 0,
74
+ padding: tokens.unorderedPadding
75
+ };
76
+ });
77
+
78
+ const ListItem = /*#__PURE__*/(0, _styledComponents.default)(_OrderedListBase.default.Item).withConfig({
79
+ displayName: "TermsAndConditions__ListItem",
80
+ componentId: "components-web__sc-1199epn-3"
81
+ })(_ref4 => {
82
+ let {
83
+ tokens
84
+ } = _ref4;
85
+ return {
86
+ display: 'list-item',
87
+ '&::marker': {
88
+ fontFamily: `${tokens.listFontName}${tokens.listFontWeight}normal`,
89
+ fontSize: tokens.listFontSize,
90
+ lineHeight: tokens.listLineHeight,
91
+ textAlign: 'end !important'
92
+ },
93
+ color: tokens.listColor,
94
+ fontFamily: `${tokens.listFontName}${tokens.listFontWeight}normal`,
95
+ fontSize: tokens.listFontSize,
96
+ lineHeight: tokens.listLineHeight,
97
+ marginBottom: tokens.listMarginBottom,
98
+ marginLeft: tokens.listMarginLeft,
99
+ wordBreak: 'break-word'
100
+ };
101
+ });
102
+
103
+ const NonIndexedContentTitle = /*#__PURE__*/_styledComponents.default.div.withConfig({
104
+ displayName: "TermsAndConditions__NonIndexedContentTitle",
105
+ componentId: "components-web__sc-1199epn-4"
106
+ })(_ref5 => {
107
+ let {
108
+ tokens
109
+ } = _ref5;
110
+ return {
111
+ color: tokens.titleColor,
112
+ fontSize: tokens.titleFontSize,
113
+ lineHeight: tokens.titleLineHeight,
114
+ paddingLeft: tokens.titlePaddingLeft
115
+ };
116
+ });
117
+ /**
118
+ * Use `TermsAndConditions` to display important legal content.
119
+ *
120
+ * ## Usage Criteria
121
+ *
122
+ * - Display before the page footer, except for call-to-action callback cards
123
+ * - Responsive display based on breakpoints
124
+ * - Use `copy` to set language, ‘en’ for English or ‘fr’ for French
125
+ */
126
+
127
+
128
+ const TermsAndConditions = /*#__PURE__*/(0, _react.forwardRef)((_ref6, ref) => {
129
+ let {
130
+ copy = 'en',
131
+ indexedContent,
132
+ nonIndexedContent,
133
+ tokens,
134
+ variant = {},
135
+ ...rest
136
+ } = _ref6;
137
+ const getCopy = (0, _componentsBase.useCopy)({
138
+ dictionary: _dictionary.default,
139
+ copy
140
+ });
141
+ const hasIndexedContent = indexedContent.length > 0;
142
+ const hasNonIndexedContent = nonIndexedContent.length > 0;
143
+ const themeTokens = (0, _componentsBase.useThemeTokens)('TermsAndConditions', tokens, variant);
144
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", { ...selectProps(rest),
145
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Divider, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandCollapse.default, {
146
+ collapseTitle: getCopy('headingView'),
147
+ expandTitle: getCopy('headingHide'),
148
+ ref: ref,
149
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(ContentContainer, {
150
+ tokens: themeTokens,
151
+ children: [hasIndexedContent && /*#__PURE__*/(0, _jsxRuntime.jsx)(Ordered, {
152
+ tokens: themeTokens,
153
+ children: indexedContent.map((contentItem, idx) =>
154
+ /*#__PURE__*/
155
+ // eslint-disable-next-line react/no-array-index-key
156
+ (0, _jsxRuntime.jsx)(ListItem, {
157
+ tokens: themeTokens,
158
+ children: (0, _utils.renderStructuredContent)(contentItem)
159
+ }, idx))
160
+ }), hasNonIndexedContent && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_componentsBase.Box, {
161
+ between: 3,
162
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(NonIndexedContentTitle, {
163
+ tokens: themeTokens,
164
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
165
+ block: true,
166
+ heading: true,
167
+ variant: {
168
+ size: 'h4'
169
+ },
170
+ children: getCopy('nonIndexedTitle')
171
+ })
172
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Unordered, {
173
+ tokens: themeTokens,
174
+ children: nonIndexedContent.map((contentItem, idx) =>
175
+ /*#__PURE__*/
176
+ // eslint-disable-next-line react/no-array-index-key
177
+ (0, _jsxRuntime.jsx)(ListItem, {
178
+ tokens: themeTokens,
179
+ children: (0, _utils.renderStructuredContent)(contentItem)
180
+ }, idx))
181
+ })]
182
+ })]
183
+ })
184
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Divider, {})]
185
+ });
186
+ });
187
+ TermsAndConditions.displayName = 'TermsAndConditions';
188
+ TermsAndConditions.propTypes = { ...selectedSystemPropTypes,
189
+
190
+ /**
191
+ * Use the `copy` prop to either select provided English or French copy by passing 'en' or 'fr' respectively.
192
+ *
193
+ * To provide your own, pass a JSON object with the keys `headingView`, `headingHide`, and `nonIndexedTitle`.
194
+ */
195
+ copy: _propTypes.default.oneOfType([_propTypes.default.oneOf(['en', 'fr']), _propTypes.default.shape({
196
+ headingView: _propTypes.default.string,
197
+ headingHide: _propTypes.default.string,
198
+ nonIndexedTitle: _propTypes.default.string
199
+ })]),
200
+
201
+ /**
202
+ * An array of nodes, strings, or a combination to be displayed in an ordered list.
203
+ *
204
+ * Each item in the array must have a corresponding superscript in the page.
205
+ */
206
+ indexedContent: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.string])),
207
+
208
+ /**
209
+ * An array of nodes, strings, or a combination to be displayed in an unordered list.
210
+ *
211
+ * nonIndexedContent do not have a corresponding superscript and instead apply to the page as a whole.
212
+ */
213
+ nonIndexedContent: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.string]))
214
+ };
215
+ TermsAndConditions.defaultProps = {
216
+ copy: 'en',
217
+ indexedContent: [],
218
+ nonIndexedContent: []
219
+ };
220
+ var _default = TermsAndConditions;
221
+ exports.default = _default;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _default = {
8
+ en: {
9
+ headingHide: 'Hide terms and conditions',
10
+ headingView: 'View terms and conditions',
11
+ nonIndexedTitle: 'The following applies to all terms and conditions above'
12
+ },
13
+ fr: {
14
+ headingHide: 'Masquer les modalités et conditions',
15
+ headingView: 'Voir les modalités et conditions',
16
+ nonIndexedTitle: 'Ce qui suit s’applique aux modalités et conditions ci-dessus'
17
+ }
18
+ };
19
+ exports.default = _default;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "default", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _TermsAndConditions.default;
10
+ }
11
+ });
12
+
13
+ var _TermsAndConditions = _interopRequireDefault(require("./TermsAndConditions"));
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }