@telus-uds/components-web 1.2.0 → 1.4.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 (140) hide show
  1. package/CHANGELOG.md +34 -2
  2. package/lib/Breadcrumbs/Breadcrumbs.js +247 -0
  3. package/lib/Breadcrumbs/Item/Item.js +165 -0
  4. package/lib/Breadcrumbs/index.js +15 -0
  5. package/lib/Callout/Callout.js +121 -0
  6. package/lib/Callout/index.js +13 -0
  7. package/lib/DatePicker/CalendarContainer.js +221 -0
  8. package/lib/DatePicker/DatePicker.js +329 -0
  9. package/lib/DatePicker/dictionary.js +134 -0
  10. package/lib/DatePicker/index.js +13 -0
  11. package/lib/DatePicker/reactDatesCss.js +12 -0
  12. package/lib/ExpandCollapseMini/ExpandCollapseMini.js +75 -0
  13. package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +95 -0
  14. package/lib/ExpandCollapseMini/index.js +13 -0
  15. package/lib/Footnote/Footnote.js +571 -0
  16. package/lib/Footnote/FootnoteLink.js +149 -0
  17. package/lib/Footnote/dictionary.js +19 -0
  18. package/lib/Footnote/index.js +16 -0
  19. package/lib/OrderedList/Item.js +162 -0
  20. package/lib/OrderedList/ItemBase.js +42 -0
  21. package/lib/OrderedList/OrderedList.js +94 -0
  22. package/lib/OrderedList/OrderedListBase.js +68 -0
  23. package/lib/OrderedList/constants.js +9 -0
  24. package/lib/OrderedList/index.js +16 -0
  25. package/lib/PreviewCard/AuthorDate.js +64 -0
  26. package/lib/PreviewCard/PreviewCard.js +236 -0
  27. package/lib/PreviewCard/index.js +13 -0
  28. package/lib/PriceLockup/PriceLockup.js +237 -0
  29. package/lib/PriceLockup/index.js +13 -0
  30. package/lib/PriceLockup/tokens.js +131 -0
  31. package/lib/ResponsiveImage/ResponsiveImage.js +115 -0
  32. package/lib/ResponsiveImage/index.js +13 -0
  33. package/lib/Ribbon/Ribbon.js +0 -1
  34. package/lib/Span/Span.js +88 -0
  35. package/lib/Span/index.js +13 -0
  36. package/lib/index.js +91 -1
  37. package/lib/shared/FullBleedContent/FullBleedContent.js +121 -0
  38. package/lib/shared/FullBleedContent/getFullBleedBorderRadius.js +73 -0
  39. package/lib/shared/FullBleedContent/index.js +29 -0
  40. package/lib/shared/FullBleedContent/useFullBleedContentProps.js +73 -0
  41. package/lib/utils/index.js +32 -0
  42. package/lib/utils/logger.js +31 -0
  43. package/lib/utils/media.js +54 -0
  44. package/lib/utils/renderStructuredContent.js +89 -0
  45. package/lib/utils/useTypographyTheme.js +32 -0
  46. package/lib-module/Breadcrumbs/Breadcrumbs.js +228 -0
  47. package/lib-module/Breadcrumbs/Item/Item.js +141 -0
  48. package/lib-module/Breadcrumbs/index.js +1 -0
  49. package/lib-module/Callout/Callout.js +106 -0
  50. package/lib-module/Callout/index.js +2 -0
  51. package/lib-module/DatePicker/CalendarContainer.js +208 -0
  52. package/lib-module/DatePicker/DatePicker.js +302 -0
  53. package/lib-module/DatePicker/dictionary.js +127 -0
  54. package/lib-module/DatePicker/index.js +2 -0
  55. package/lib-module/DatePicker/reactDatesCss.js +3 -0
  56. package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +56 -0
  57. package/lib-module/ExpandCollapseMini/ExpandCollapseMiniControl.js +80 -0
  58. package/lib-module/ExpandCollapseMini/index.js +2 -0
  59. package/lib-module/Footnote/Footnote.js +541 -0
  60. package/lib-module/Footnote/FootnoteLink.js +130 -0
  61. package/lib-module/Footnote/dictionary.js +12 -0
  62. package/lib-module/Footnote/index.js +4 -0
  63. package/lib-module/OrderedList/Item.js +139 -0
  64. package/lib-module/OrderedList/ItemBase.js +28 -0
  65. package/lib-module/OrderedList/OrderedList.js +71 -0
  66. package/lib-module/OrderedList/OrderedListBase.js +48 -0
  67. package/lib-module/OrderedList/constants.js +2 -0
  68. package/lib-module/OrderedList/index.js +4 -0
  69. package/lib-module/PreviewCard/AuthorDate.js +53 -0
  70. package/lib-module/PreviewCard/PreviewCard.js +211 -0
  71. package/lib-module/PreviewCard/index.js +2 -0
  72. package/lib-module/PriceLockup/PriceLockup.js +213 -0
  73. package/lib-module/PriceLockup/index.js +2 -0
  74. package/lib-module/PriceLockup/tokens.js +120 -0
  75. package/lib-module/ResponsiveImage/ResponsiveImage.js +100 -0
  76. package/lib-module/ResponsiveImage/index.js +2 -0
  77. package/lib-module/Ribbon/Ribbon.js +1 -2
  78. package/lib-module/Span/Span.js +70 -0
  79. package/lib-module/Span/index.js +2 -0
  80. package/lib-module/index.js +10 -0
  81. package/lib-module/shared/FullBleedContent/FullBleedContent.js +106 -0
  82. package/lib-module/shared/FullBleedContent/getFullBleedBorderRadius.js +65 -0
  83. package/lib-module/shared/FullBleedContent/index.js +4 -0
  84. package/lib-module/shared/FullBleedContent/useFullBleedContentProps.js +65 -0
  85. package/lib-module/utils/index.js +5 -1
  86. package/lib-module/utils/logger.js +18 -0
  87. package/lib-module/utils/media.js +46 -0
  88. package/lib-module/utils/renderStructuredContent.js +77 -0
  89. package/lib-module/utils/useTypographyTheme.js +24 -0
  90. package/package.json +9 -4
  91. package/src/Breadcrumbs/Breadcrumbs.jsx +222 -0
  92. package/src/Breadcrumbs/Item/Item.jsx +127 -0
  93. package/src/Breadcrumbs/index.js +1 -0
  94. package/src/Callout/Callout.jsx +76 -0
  95. package/src/Callout/index.js +3 -0
  96. package/src/DatePicker/CalendarContainer.jsx +210 -0
  97. package/src/DatePicker/DatePicker.jsx +303 -0
  98. package/src/DatePicker/dictionary.js +92 -0
  99. package/src/DatePicker/index.js +3 -0
  100. package/src/DatePicker/reactDatesCss.js +892 -0
  101. package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +48 -0
  102. package/src/ExpandCollapseMini/ExpandCollapseMiniControl.jsx +67 -0
  103. package/src/ExpandCollapseMini/index.js +3 -0
  104. package/src/Footnote/Footnote.jsx +468 -0
  105. package/src/Footnote/FootnoteLink.jsx +120 -0
  106. package/src/Footnote/dictionary.js +12 -0
  107. package/src/Footnote/index.js +6 -0
  108. package/src/OrderedList/Item.jsx +121 -0
  109. package/src/OrderedList/ItemBase.jsx +18 -0
  110. package/src/OrderedList/OrderedList.jsx +61 -0
  111. package/src/OrderedList/OrderedListBase.jsx +38 -0
  112. package/src/OrderedList/constants.js +2 -0
  113. package/src/OrderedList/index.js +6 -0
  114. package/src/PreviewCard/AuthorDate.jsx +31 -0
  115. package/src/PreviewCard/PreviewCard.jsx +201 -0
  116. package/src/PreviewCard/index.js +3 -0
  117. package/src/PriceLockup/PriceLockup.jsx +210 -0
  118. package/src/PriceLockup/index.js +3 -0
  119. package/src/PriceLockup/tokens.js +58 -0
  120. package/src/ResponsiveImage/ResponsiveImage.jsx +77 -0
  121. package/src/ResponsiveImage/index.js +3 -0
  122. package/src/Ribbon/Ribbon.jsx +0 -1
  123. package/src/Span/Span.jsx +66 -0
  124. package/src/Span/index.js +3 -0
  125. package/src/index.js +10 -0
  126. package/src/shared/FullBleedContent/FullBleedContent.jsx +90 -0
  127. package/src/shared/FullBleedContent/getFullBleedBorderRadius.js +55 -0
  128. package/src/shared/FullBleedContent/index.js +6 -0
  129. package/src/shared/FullBleedContent/useFullBleedContentProps.js +63 -0
  130. package/src/utils/index.js +5 -1
  131. package/src/utils/logger.js +20 -0
  132. package/src/utils/media.js +40 -0
  133. package/src/utils/renderStructuredContent.jsx +73 -0
  134. package/src/utils/useTypographyTheme.js +14 -0
  135. package/types/Callout.d.ts +13 -0
  136. package/types/DatePicker.d.ts +21 -0
  137. package/types/Footnote.d.ts +21 -0
  138. package/types/FootnoteLink.d.ts +20 -0
  139. package/types/PriceLockup.d.ts +22 -0
  140. package/types/common.d.ts +14 -0
@@ -0,0 +1,139 @@
1
+ import React, { forwardRef } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styled from 'styled-components';
4
+ import { applyTextStyles, getTokensPropType, selectSystemProps, StackView, Typography, useTheme, useThemeTokens, wrapStringsInText } from '@telus-uds/components-base';
5
+ import ItemBase from './ItemBase';
6
+ import { htmlAttrs } from '../utils';
7
+ import { OL_COUNTER_NAME } from './constants';
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ import { jsxs as _jsxs } from "react/jsx-runtime";
10
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
11
+
12
+ const selectItemTextStyles = (_ref, themeOptions) => {
13
+ let {
14
+ itemFontWeight,
15
+ itemFontSize,
16
+ itemLineHeight,
17
+ itemFontName,
18
+ itemColor
19
+ } = _ref;
20
+ return applyTextStyles({
21
+ fontWeight: itemFontWeight,
22
+ fontSize: itemFontSize,
23
+ fontName: itemFontName,
24
+ color: itemColor,
25
+ themeOptions,
26
+ lineHeight: itemLineHeight
27
+ });
28
+ };
29
+
30
+ const StyledItemBase = /*#__PURE__*/styled(ItemBase).withConfig({
31
+ displayName: "Item__StyledItemBase",
32
+ componentId: "components-web__sc-7jzwcq-0"
33
+ })(_ref2 => {
34
+ let {
35
+ interItemMargin,
36
+ itemBulletContainerWidth,
37
+ itemBulletContainerAlign,
38
+ itemFontWeight,
39
+ itemFontSize,
40
+ itemFontName,
41
+ itemLineHeight,
42
+ themeOptions,
43
+ listGutter,
44
+ itemColor
45
+ } = _ref2;
46
+ return {
47
+ counterIncrement: OL_COUNTER_NAME,
48
+ '::before': {
49
+ content: `counter(${OL_COUNTER_NAME})'.'`,
50
+ display: 'inline-flex',
51
+ color: itemColor,
52
+ width: itemBulletContainerWidth,
53
+ paddingRight: listGutter,
54
+ textAlign: itemBulletContainerAlign,
55
+ ...applyTextStyles({
56
+ fontWeight: itemFontWeight,
57
+ fontSize: itemFontSize,
58
+ fontName: itemFontName,
59
+ themeOptions
60
+ }),
61
+ lineHeight: `${itemLineHeight * itemFontSize}px`
62
+ },
63
+ ':not(:last-child)': {
64
+ marginBottom: interItemMargin
65
+ }
66
+ };
67
+ });
68
+ const ItemContent = /*#__PURE__*/styled.div.withConfig({
69
+ displayName: "Item__ItemContent",
70
+ componentId: "components-web__sc-7jzwcq-1"
71
+ })({
72
+ flex: 1
73
+ });
74
+ const Item = /*#__PURE__*/forwardRef((_ref3, ref) => {
75
+ let {
76
+ children,
77
+ counterName,
78
+ title,
79
+ tokens,
80
+ variant,
81
+ ...rest
82
+ } = _ref3;
83
+ // We are reusing some tokens from the list component here in order to provide a unified
84
+ // experience
85
+ const themeTokens = useThemeTokens('OrderedList', tokens, variant);
86
+ const headingTokens = title && {
87
+ lineHeight: themeTokens.itemLineHeight,
88
+ fontSize: themeTokens.itemFontSize,
89
+ color: themeTokens.itemColor,
90
+ fontName: themeTokens.headerFontName,
91
+ fontWeight: themeTokens.headerFontWeight
92
+ };
93
+ const {
94
+ themeOptions
95
+ } = useTheme();
96
+ const itemContent = wrapStringsInText(children, {
97
+ style: selectItemTextStyles(themeTokens, themeOptions)
98
+ });
99
+ return /*#__PURE__*/_jsx(StyledItemBase, {
100
+ ref: ref,
101
+ themeOptions: themeOptions,
102
+ ...themeTokens,
103
+ ...selectProps(rest),
104
+ children: title ? /*#__PURE__*/_jsxs(StackView, {
105
+ tokens: {
106
+ flexShrink: 1
107
+ },
108
+ space: 0,
109
+ children: [/*#__PURE__*/_jsx(Typography, {
110
+ variant: {
111
+ size: 'h4'
112
+ },
113
+ tokens: headingTokens,
114
+ children: title
115
+ }), /*#__PURE__*/_jsx(ItemContent, { ...themeTokens,
116
+ children: itemContent
117
+ })]
118
+ }) : itemContent
119
+ });
120
+ });
121
+ Item.displayName = 'OrderedListItem';
122
+ Item.propTypes = { ...selectedSystemPropTypes,
123
+
124
+ /**
125
+ * Item content
126
+ */
127
+ children: PropTypes.node.isRequired,
128
+ title: PropTypes.string,
129
+
130
+ /**
131
+ * Item tokens
132
+ */
133
+ tokens: getTokensPropType('List')
134
+ };
135
+ Item.defaultProps = {
136
+ title: undefined,
137
+ tokens: {}
138
+ };
139
+ export default Item;
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styled from 'styled-components';
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const StyledItem = /*#__PURE__*/styled.li.withConfig({
6
+ displayName: "ItemBase__StyledItem",
7
+ componentId: "components-web__sc-o0oiv5-0"
8
+ })({
9
+ display: 'flex'
10
+ });
11
+
12
+ const Item = _ref => {
13
+ let {
14
+ children,
15
+ ...rest
16
+ } = _ref;
17
+ return /*#__PURE__*/_jsx(StyledItem, { ...rest,
18
+ children: children
19
+ });
20
+ };
21
+
22
+ Item.propTypes = {
23
+ /**
24
+ * Item content
25
+ */
26
+ children: PropTypes.node.isRequired
27
+ };
28
+ export default Item;
@@ -0,0 +1,71 @@
1
+ import React, { forwardRef } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styled from 'styled-components';
4
+ import { selectSystemProps } from '@telus-uds/components-base';
5
+ import { htmlAttrs } from '../utils';
6
+ import OrderedListBase from './OrderedListBase';
7
+ import Item from './Item';
8
+ import { OL_COUNTER_NAME } from './constants';
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
11
+ const StyledOrderedListBase = /*#__PURE__*/styled(OrderedListBase).withConfig({
12
+ displayName: "OrderedList__StyledOrderedListBase",
13
+ componentId: "components-web__sc-t5az8z-0"
14
+ })(_ref => {
15
+ let {
16
+ start
17
+ } = _ref;
18
+ return {
19
+ // Using CSS counters here to have better control over the number styling
20
+ listStyle: 'none',
21
+ counterReset: `${OL_COUNTER_NAME} ${start - 1}`
22
+ };
23
+ });
24
+ /**
25
+ * Themed semantic ordered list.
26
+ */
27
+
28
+ const OrderedList = /*#__PURE__*/forwardRef((_ref2, ref) => {
29
+ let {
30
+ children,
31
+ start,
32
+ variant,
33
+ ...rest
34
+ } = _ref2;
35
+ // Pass any variants "OrderedList" receives down to the individual list items.
36
+ const childrenWithParentVariants = variant ? children.map(child => {
37
+ var _child$props;
38
+
39
+ const existingChildVariants = ((_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.variant) ?? {};
40
+ return { ...child,
41
+ props: { ...child.props,
42
+ variant: { ...existingChildVariants,
43
+ ...variant
44
+ }
45
+ }
46
+ };
47
+ }) : children;
48
+ return /*#__PURE__*/_jsx(StyledOrderedListBase, { ...selectProps(rest),
49
+ ref: ref,
50
+ start: start,
51
+ children: childrenWithParentVariants
52
+ });
53
+ });
54
+ OrderedList.displayName = 'OrderedList';
55
+ OrderedList.propTypes = { ...selectedSystemPropTypes,
56
+
57
+ /**
58
+ * A list of ordered items wrapped in `OrderedList.Item`.
59
+ */
60
+ children: PropTypes.node.isRequired,
61
+
62
+ /**
63
+ * The position to start the list with.
64
+ */
65
+ start: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
66
+ };
67
+ OrderedList.defaultProps = {
68
+ start: 1
69
+ };
70
+ OrderedList.Item = Item;
71
+ export default OrderedList;
@@ -0,0 +1,48 @@
1
+ import React, { forwardRef } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styled from 'styled-components';
4
+ import ItemBase from './ItemBase';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ const StyledList = /*#__PURE__*/styled.ol.withConfig({
7
+ displayName: "OrderedListBase__StyledList",
8
+ componentId: "components-web__sc-4m9lgj-0"
9
+ })({
10
+ display: 'flex',
11
+ flexDirection: 'column',
12
+ listStylePosition: 'inside',
13
+ margin: 0,
14
+ padding: 0
15
+ });
16
+ /**
17
+ * Semantic ordered list.
18
+ */
19
+
20
+ const OrderedListBase = /*#__PURE__*/forwardRef((_ref, ref) => {
21
+ let {
22
+ children,
23
+ start,
24
+ ...rest
25
+ } = _ref;
26
+ return /*#__PURE__*/_jsx(StyledList, { ...rest,
27
+ ref: ref,
28
+ start: start,
29
+ children: children
30
+ });
31
+ });
32
+ OrderedListBase.displayName = 'OrderedList';
33
+ OrderedListBase.propTypes = {
34
+ /**
35
+ * A list of ordered items wrapped in `OrderedListBase.Item`.
36
+ */
37
+ children: PropTypes.node.isRequired,
38
+
39
+ /**
40
+ * The position to start the list with.
41
+ */
42
+ start: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
43
+ };
44
+ OrderedListBase.defaultProps = {
45
+ start: 1
46
+ };
47
+ OrderedListBase.Item = ItemBase;
48
+ export default OrderedListBase;
@@ -0,0 +1,2 @@
1
+ // eslint-disable-next-line import/prefer-default-export
2
+ export const OL_COUNTER_NAME = 'allium-ordered-list-counter';
@@ -0,0 +1,4 @@
1
+ import OrderedList from './OrderedList';
2
+ import Item from './Item';
3
+ OrderedList.Item = Item;
4
+ export default OrderedList;
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { StackWrap, Typography, useThemeTokens } from '@telus-uds/components-base';
4
+ /**
5
+ * A footer for PreviewCard that composes author and date in a standard way
6
+ *
7
+ * @TODO
8
+ * Add same locale-based date formatting as StoryCard when ready.
9
+ * Get locale based on decision of https://github.com/telus/universal-design-system/issues/715
10
+ */
11
+
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { jsxs as _jsxs } from "react/jsx-runtime";
14
+
15
+ const AuthorDate = _ref => {
16
+ let {
17
+ author,
18
+ date
19
+ } = _ref;
20
+ const {
21
+ separatorColor: color
22
+ } = useThemeTokens('PreviewCard', {}, {});
23
+ return /*#__PURE__*/_jsxs(StackWrap, {
24
+ space: 2,
25
+ children: [/*#__PURE__*/_jsx(Typography, {
26
+ variant: {
27
+ size: 'small',
28
+ colour: 'secondary'
29
+ },
30
+ children: author
31
+ }), /*#__PURE__*/_jsx(Typography, {
32
+ variant: {
33
+ size: 'small'
34
+ },
35
+ tokens: {
36
+ color
37
+ },
38
+ children: "\xB7"
39
+ }), /*#__PURE__*/_jsx(Typography, {
40
+ variant: {
41
+ size: 'small',
42
+ colour: 'secondary'
43
+ },
44
+ children: date
45
+ })]
46
+ });
47
+ };
48
+
49
+ AuthorDate.propTypes = {
50
+ author: PropTypes.string.isRequired,
51
+ date: PropTypes.string.isRequired
52
+ };
53
+ export default AuthorDate;
@@ -0,0 +1,211 @@
1
+ /* eslint-disable react/require-default-props */
2
+ import React, { forwardRef } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import omit from 'lodash.omit';
5
+ import { Box, getThemeTokens, hrefAttrsProp, PressableCardBase, selectSystemProps, Spacer, StackView, Typography, a11yProps, focusHandlerProps, viewProps, withLinkRouter, useTheme } from '@telus-uds/components-base';
6
+ import styled from 'styled-components';
7
+ import FullBleedContent, { getFullBleedBorderRadius, useFullBleedContentProps } from '../shared/FullBleedContent';
8
+ import AuthorDate from './AuthorDate'; // Passes React Native-oriented system props through UDS PressableCardBase
9
+
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { Fragment as _Fragment } from "react/jsx-runtime";
12
+ import { jsxs as _jsxs } from "react/jsx-runtime";
13
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, viewProps]); // Stop changes to the card's inner border width causing the size and
14
+ // apparent position of the full bleed image to change.
15
+
16
+ const FullBleedOffsetOuter = /*#__PURE__*/styled.div.withConfig({
17
+ displayName: "PreviewCard__FullBleedOffsetOuter",
18
+ componentId: "components-web__sc-1yfz4de-0"
19
+ })(_ref => {
20
+ let {
21
+ borderOffset
22
+ } = _ref;
23
+ return {
24
+ overflow: 'hidden',
25
+ marginTop: borderOffset * 2
26
+ };
27
+ });
28
+ const FullBleedOffsetInner = /*#__PURE__*/styled.div.withConfig({
29
+ displayName: "PreviewCard__FullBleedOffsetInner",
30
+ componentId: "components-web__sc-1yfz4de-1"
31
+ })(_ref2 => {
32
+ let {
33
+ borderOffset
34
+ } = _ref2;
35
+ return {
36
+ position: 'relative',
37
+ margin: 0 - borderOffset
38
+ };
39
+ });
40
+ const defaultTokens = {
41
+ minWidth: 0,
42
+ shadow: null
43
+ };
44
+ /**
45
+ * Showcase and guide users to another page, with a preview containing title and a footer.
46
+ * Whole card is interactive, width expands based on column or container.
47
+ *
48
+ * - Use `tag` to show category of content
49
+ * - Use `title` to show title of the story
50
+ * - Use `footer` to show text such as the author / date
51
+ * - Use `href` to set the target URL
52
+ * - Use `fullBleedContent` to set the thumbnail image
53
+ */
54
+
55
+ const PreviewCard = /*#__PURE__*/forwardRef((_ref3, ref) => {
56
+ let {
57
+ tag,
58
+ title,
59
+ footer,
60
+ fullBleedImage,
61
+ fullBleedContent = fullBleedImage,
62
+ onPress,
63
+ href,
64
+ ...rest
65
+ } = _ref3;
66
+ const {
67
+ fullBleedContentPosition,
68
+ contentStackDirection,
69
+ fullBleedContentProps
70
+ } = useFullBleedContentProps({ ...fullBleedContent,
71
+ position: 'bottom'
72
+ });
73
+ const {
74
+ components: {
75
+ PreviewCard: theme
76
+ }
77
+ } = useTheme();
78
+
79
+ const getPressableCardTokens = cardState => ({ ...omit(getThemeTokens(theme, {}, {}, cardState), 'separatorColor'),
80
+ ...defaultTokens
81
+ });
82
+
83
+ const {
84
+ hrefAttrs,
85
+ rest: unusedRest
86
+ } = hrefAttrsProp.bundle(rest);
87
+ return /*#__PURE__*/_jsx(PressableCardBase, {
88
+ onPress: onPress,
89
+ href: href,
90
+ hrefAttrs: hrefAttrs,
91
+ tokens: getPressableCardTokens,
92
+ ref: ref,
93
+ ...selectProps(unusedRest),
94
+ children: cardState => {
95
+ const {
96
+ borderRadius,
97
+ borderWidth
98
+ } = getPressableCardTokens(cardState); // Stop content jumping around as border size changes
99
+
100
+ const borderOffset = borderWidth - theme.tokens.borderWidth;
101
+ const fullBleedBorderRadius = getFullBleedBorderRadius(borderRadius + borderOffset, fullBleedContentPosition);
102
+ return /*#__PURE__*/_jsxs(StackView, {
103
+ direction: contentStackDirection,
104
+ tokens: {
105
+ justifyContent: 'space-between',
106
+ flexGrow: 1
107
+ },
108
+ children: [/*#__PURE__*/_jsxs(Box, {
109
+ horizontal: {
110
+ xs: 4,
111
+ lg: 5,
112
+ options: {
113
+ subtract: borderOffset
114
+ }
115
+ },
116
+ vertical: {
117
+ xs: 5,
118
+ lg: 7,
119
+ options: {
120
+ subtract: borderOffset
121
+ }
122
+ },
123
+ children: [Boolean(tag) && /*#__PURE__*/_jsxs(_Fragment, {
124
+ children: [/*#__PURE__*/_jsx(Typography, {
125
+ variant: {
126
+ size: 'eyebrow',
127
+ colour: 'secondary'
128
+ },
129
+ children: tag
130
+ }), /*#__PURE__*/_jsx(Spacer, {
131
+ space: 2
132
+ })]
133
+ }), /*#__PURE__*/_jsx(Typography, {
134
+ variant: {
135
+ size: 'h4',
136
+ colour: 'secondary'
137
+ },
138
+ children: title
139
+ }), Boolean(footer) && /*#__PURE__*/_jsxs(_Fragment, {
140
+ children: [/*#__PURE__*/_jsx(Spacer, {
141
+ space: 2
142
+ }), typeof footer === 'string' ? /*#__PURE__*/_jsx(Typography, {
143
+ variant: {
144
+ size: 'small',
145
+ colour: 'secondary'
146
+ },
147
+ children: footer
148
+ }) : footer]
149
+ })]
150
+ }), Boolean(fullBleedContentProps.src || fullBleedContentProps.content) && /*#__PURE__*/_jsx(FullBleedOffsetOuter, {
151
+ borderOffset: borderOffset,
152
+ children: /*#__PURE__*/_jsx(FullBleedOffsetInner, {
153
+ borderOffset: borderOffset,
154
+ children: /*#__PURE__*/_jsx(FullBleedContent, {
155
+ borderRadius: fullBleedBorderRadius,
156
+ ...fullBleedContentProps
157
+ })
158
+ })
159
+ })]
160
+ });
161
+ }
162
+ });
163
+ });
164
+ PreviewCard.displayName = 'PreviewCard'; // Provide standard author/date footer as a preset with the export
165
+
166
+ PreviewCard.AuthorDate = AuthorDate;
167
+ PreviewCard.propTypes = { ...selectedSystemPropTypes,
168
+
169
+ /**
170
+ * The URL of the story to be navigated to. Note that `Video` component does not play well when used within
171
+ * a `PreviewCard` with `href` prop set (the volume and progress sliders can be clicked but are not draggable).
172
+ * Please use `onPress` prop instead `href` to organize navigation in cases like this.
173
+ *
174
+ * @see https://github.com/telus/allium-design-system/issues/6
175
+ */
176
+ href: PropTypes.string,
177
+
178
+ /**
179
+ * Optional function to be called on press e.g. for within-page navigation.
180
+ */
181
+ onPress: PropTypes.func,
182
+
183
+ /**
184
+ * Text stating the category of the content.
185
+ */
186
+ tag: PropTypes.string,
187
+
188
+ /**
189
+ * Section containing additional information, such as author and date.
190
+ * Use `<PreviewCard.AuthorDate author={...} date={...} />` here for author and date.
191
+ */
192
+ footer: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
193
+
194
+ /**
195
+ * Text stating the title or headline of the story.
196
+ */
197
+ title: PropTypes.string.isRequired,
198
+
199
+ /**
200
+ * Full bleed image to be placed on the card, deprecated in favor of `fullBleedContent`.
201
+ *
202
+ * @deprecated
203
+ */
204
+ fullBleedImage: PropTypes.exact(FullBleedContent.propTypes || {}),
205
+
206
+ /**
207
+ * Full bleed content to be placed on the card.
208
+ */
209
+ fullBleedContent: PropTypes.exact(FullBleedContent.propTypes || {})
210
+ };
211
+ export default withLinkRouter(PreviewCard);
@@ -0,0 +1,2 @@
1
+ import PreviewCard from './PreviewCard';
2
+ export default PreviewCard;