@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.
- package/CHANGELOG.md +34 -2
- package/lib/Breadcrumbs/Breadcrumbs.js +247 -0
- package/lib/Breadcrumbs/Item/Item.js +165 -0
- package/lib/Breadcrumbs/index.js +15 -0
- package/lib/Callout/Callout.js +121 -0
- package/lib/Callout/index.js +13 -0
- package/lib/DatePicker/CalendarContainer.js +221 -0
- package/lib/DatePicker/DatePicker.js +329 -0
- package/lib/DatePicker/dictionary.js +134 -0
- package/lib/DatePicker/index.js +13 -0
- package/lib/DatePicker/reactDatesCss.js +12 -0
- package/lib/ExpandCollapseMini/ExpandCollapseMini.js +75 -0
- package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +95 -0
- package/lib/ExpandCollapseMini/index.js +13 -0
- package/lib/Footnote/Footnote.js +571 -0
- package/lib/Footnote/FootnoteLink.js +149 -0
- package/lib/Footnote/dictionary.js +19 -0
- package/lib/Footnote/index.js +16 -0
- package/lib/OrderedList/Item.js +162 -0
- package/lib/OrderedList/ItemBase.js +42 -0
- package/lib/OrderedList/OrderedList.js +94 -0
- package/lib/OrderedList/OrderedListBase.js +68 -0
- package/lib/OrderedList/constants.js +9 -0
- package/lib/OrderedList/index.js +16 -0
- package/lib/PreviewCard/AuthorDate.js +64 -0
- package/lib/PreviewCard/PreviewCard.js +236 -0
- package/lib/PreviewCard/index.js +13 -0
- package/lib/PriceLockup/PriceLockup.js +237 -0
- package/lib/PriceLockup/index.js +13 -0
- package/lib/PriceLockup/tokens.js +131 -0
- package/lib/ResponsiveImage/ResponsiveImage.js +115 -0
- package/lib/ResponsiveImage/index.js +13 -0
- package/lib/Ribbon/Ribbon.js +0 -1
- package/lib/Span/Span.js +88 -0
- package/lib/Span/index.js +13 -0
- package/lib/index.js +91 -1
- package/lib/shared/FullBleedContent/FullBleedContent.js +121 -0
- package/lib/shared/FullBleedContent/getFullBleedBorderRadius.js +73 -0
- package/lib/shared/FullBleedContent/index.js +29 -0
- package/lib/shared/FullBleedContent/useFullBleedContentProps.js +73 -0
- package/lib/utils/index.js +32 -0
- package/lib/utils/logger.js +31 -0
- package/lib/utils/media.js +54 -0
- package/lib/utils/renderStructuredContent.js +89 -0
- package/lib/utils/useTypographyTheme.js +32 -0
- package/lib-module/Breadcrumbs/Breadcrumbs.js +228 -0
- package/lib-module/Breadcrumbs/Item/Item.js +141 -0
- package/lib-module/Breadcrumbs/index.js +1 -0
- package/lib-module/Callout/Callout.js +106 -0
- package/lib-module/Callout/index.js +2 -0
- package/lib-module/DatePicker/CalendarContainer.js +208 -0
- package/lib-module/DatePicker/DatePicker.js +302 -0
- package/lib-module/DatePicker/dictionary.js +127 -0
- package/lib-module/DatePicker/index.js +2 -0
- package/lib-module/DatePicker/reactDatesCss.js +3 -0
- package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +56 -0
- package/lib-module/ExpandCollapseMini/ExpandCollapseMiniControl.js +80 -0
- package/lib-module/ExpandCollapseMini/index.js +2 -0
- package/lib-module/Footnote/Footnote.js +541 -0
- package/lib-module/Footnote/FootnoteLink.js +130 -0
- package/lib-module/Footnote/dictionary.js +12 -0
- package/lib-module/Footnote/index.js +4 -0
- package/lib-module/OrderedList/Item.js +139 -0
- package/lib-module/OrderedList/ItemBase.js +28 -0
- package/lib-module/OrderedList/OrderedList.js +71 -0
- package/lib-module/OrderedList/OrderedListBase.js +48 -0
- package/lib-module/OrderedList/constants.js +2 -0
- package/lib-module/OrderedList/index.js +4 -0
- package/lib-module/PreviewCard/AuthorDate.js +53 -0
- package/lib-module/PreviewCard/PreviewCard.js +211 -0
- package/lib-module/PreviewCard/index.js +2 -0
- package/lib-module/PriceLockup/PriceLockup.js +213 -0
- package/lib-module/PriceLockup/index.js +2 -0
- package/lib-module/PriceLockup/tokens.js +120 -0
- package/lib-module/ResponsiveImage/ResponsiveImage.js +100 -0
- package/lib-module/ResponsiveImage/index.js +2 -0
- package/lib-module/Ribbon/Ribbon.js +1 -2
- package/lib-module/Span/Span.js +70 -0
- package/lib-module/Span/index.js +2 -0
- package/lib-module/index.js +10 -0
- package/lib-module/shared/FullBleedContent/FullBleedContent.js +106 -0
- package/lib-module/shared/FullBleedContent/getFullBleedBorderRadius.js +65 -0
- package/lib-module/shared/FullBleedContent/index.js +4 -0
- package/lib-module/shared/FullBleedContent/useFullBleedContentProps.js +65 -0
- package/lib-module/utils/index.js +5 -1
- package/lib-module/utils/logger.js +18 -0
- package/lib-module/utils/media.js +46 -0
- package/lib-module/utils/renderStructuredContent.js +77 -0
- package/lib-module/utils/useTypographyTheme.js +24 -0
- package/package.json +9 -4
- package/src/Breadcrumbs/Breadcrumbs.jsx +222 -0
- package/src/Breadcrumbs/Item/Item.jsx +127 -0
- package/src/Breadcrumbs/index.js +1 -0
- package/src/Callout/Callout.jsx +76 -0
- package/src/Callout/index.js +3 -0
- package/src/DatePicker/CalendarContainer.jsx +210 -0
- package/src/DatePicker/DatePicker.jsx +303 -0
- package/src/DatePicker/dictionary.js +92 -0
- package/src/DatePicker/index.js +3 -0
- package/src/DatePicker/reactDatesCss.js +892 -0
- package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +48 -0
- package/src/ExpandCollapseMini/ExpandCollapseMiniControl.jsx +67 -0
- package/src/ExpandCollapseMini/index.js +3 -0
- package/src/Footnote/Footnote.jsx +468 -0
- package/src/Footnote/FootnoteLink.jsx +120 -0
- package/src/Footnote/dictionary.js +12 -0
- package/src/Footnote/index.js +6 -0
- package/src/OrderedList/Item.jsx +121 -0
- package/src/OrderedList/ItemBase.jsx +18 -0
- package/src/OrderedList/OrderedList.jsx +61 -0
- package/src/OrderedList/OrderedListBase.jsx +38 -0
- package/src/OrderedList/constants.js +2 -0
- package/src/OrderedList/index.js +6 -0
- package/src/PreviewCard/AuthorDate.jsx +31 -0
- package/src/PreviewCard/PreviewCard.jsx +201 -0
- package/src/PreviewCard/index.js +3 -0
- package/src/PriceLockup/PriceLockup.jsx +210 -0
- package/src/PriceLockup/index.js +3 -0
- package/src/PriceLockup/tokens.js +58 -0
- package/src/ResponsiveImage/ResponsiveImage.jsx +77 -0
- package/src/ResponsiveImage/index.js +3 -0
- package/src/Ribbon/Ribbon.jsx +0 -1
- package/src/Span/Span.jsx +66 -0
- package/src/Span/index.js +3 -0
- package/src/index.js +10 -0
- package/src/shared/FullBleedContent/FullBleedContent.jsx +90 -0
- package/src/shared/FullBleedContent/getFullBleedBorderRadius.js +55 -0
- package/src/shared/FullBleedContent/index.js +6 -0
- package/src/shared/FullBleedContent/useFullBleedContentProps.js +63 -0
- package/src/utils/index.js +5 -1
- package/src/utils/logger.js +20 -0
- package/src/utils/media.js +40 -0
- package/src/utils/renderStructuredContent.jsx +73 -0
- package/src/utils/useTypographyTheme.js +14 -0
- package/types/Callout.d.ts +13 -0
- package/types/DatePicker.d.ts +21 -0
- package/types/Footnote.d.ts +21 -0
- package/types/FootnoteLink.d.ts +20 -0
- package/types/PriceLockup.d.ts +22 -0
- package/types/common.d.ts +14 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { A11yText, Divider, selectSystemProps, Typography, useThemeTokens } from '@telus-uds/components-base';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import FootnoteLink from '../Footnote/FootnoteLink';
|
|
6
|
+
import typographyTokens from './tokens';
|
|
7
|
+
import { htmlAttrs, warn } from '../utils';
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
10
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
12
|
+
const PriceLockupContainer = /*#__PURE__*/styled.div.withConfig({
|
|
13
|
+
displayName: "PriceLockup__PriceLockupContainer",
|
|
14
|
+
componentId: "components-web__sc-1x6duay-0"
|
|
15
|
+
})(["display:flex;flex-direction:column;width:fit-content;"]);
|
|
16
|
+
const PriceContainer = /*#__PURE__*/styled.div.withConfig({
|
|
17
|
+
displayName: "PriceLockup__PriceContainer",
|
|
18
|
+
componentId: "components-web__sc-1x6duay-1"
|
|
19
|
+
})(["display:flex;margin-bottom:", ";"], _ref => {
|
|
20
|
+
let {
|
|
21
|
+
priceMarginBottom
|
|
22
|
+
} = _ref;
|
|
23
|
+
return priceMarginBottom;
|
|
24
|
+
});
|
|
25
|
+
const FootnoteContainer = /*#__PURE__*/styled.div.withConfig({
|
|
26
|
+
displayName: "PriceLockup__FootnoteContainer",
|
|
27
|
+
componentId: "components-web__sc-1x6duay-2"
|
|
28
|
+
})(["display:flex;margin-top:", ";gap:", ";"], _ref2 => {
|
|
29
|
+
let {
|
|
30
|
+
footnoteMarginTop
|
|
31
|
+
} = _ref2;
|
|
32
|
+
return footnoteMarginTop;
|
|
33
|
+
}, _ref3 => {
|
|
34
|
+
let {
|
|
35
|
+
footnoteGap
|
|
36
|
+
} = _ref3;
|
|
37
|
+
return footnoteGap;
|
|
38
|
+
});
|
|
39
|
+
const BottomTextContainer = /*#__PURE__*/styled.div.withConfig({
|
|
40
|
+
displayName: "PriceLockup__BottomTextContainer",
|
|
41
|
+
componentId: "components-web__sc-1x6duay-3"
|
|
42
|
+
})(["margin-top:", ";"], _ref4 => {
|
|
43
|
+
let {
|
|
44
|
+
bottomTextMarginTop
|
|
45
|
+
} = _ref4;
|
|
46
|
+
return bottomTextMarginTop;
|
|
47
|
+
});
|
|
48
|
+
const BottomLinksContainer = /*#__PURE__*/styled.div.withConfig({
|
|
49
|
+
displayName: "PriceLockup__BottomLinksContainer",
|
|
50
|
+
componentId: "components-web__sc-1x6duay-4"
|
|
51
|
+
})(["align-self:center;margin-left:", ";"], _ref5 => {
|
|
52
|
+
let {
|
|
53
|
+
bottomLinksMarginLeft
|
|
54
|
+
} = _ref5;
|
|
55
|
+
return bottomLinksMarginLeft;
|
|
56
|
+
});
|
|
57
|
+
const TopTextContainer = /*#__PURE__*/styled.div.withConfig({
|
|
58
|
+
displayName: "PriceLockup__TopTextContainer",
|
|
59
|
+
componentId: "components-web__sc-1x6duay-5"
|
|
60
|
+
})(["margin-bottom:", ";"], _ref6 => {
|
|
61
|
+
let {
|
|
62
|
+
topTextMarginBottom
|
|
63
|
+
} = _ref6;
|
|
64
|
+
return topTextMarginBottom;
|
|
65
|
+
});
|
|
66
|
+
const RateTextContainer = /*#__PURE__*/styled.div.withConfig({
|
|
67
|
+
displayName: "PriceLockup__RateTextContainer",
|
|
68
|
+
componentId: "components-web__sc-1x6duay-6"
|
|
69
|
+
})(["align-self:flex-end;"]);
|
|
70
|
+
const StrikeThroughContainer = /*#__PURE__*/styled.div.withConfig({
|
|
71
|
+
displayName: "PriceLockup__StrikeThroughContainer",
|
|
72
|
+
componentId: "components-web__sc-1x6duay-7"
|
|
73
|
+
})(["display:flex;position:relative;align-items:center;::before{content:'';width:100%;height:", ";background:", ";position:absolute;}"], _ref7 => {
|
|
74
|
+
let {
|
|
75
|
+
strikeThroughHeight
|
|
76
|
+
} = _ref7;
|
|
77
|
+
return strikeThroughHeight;
|
|
78
|
+
}, _ref8 => {
|
|
79
|
+
let {
|
|
80
|
+
strikeThroughBackground
|
|
81
|
+
} = _ref8;
|
|
82
|
+
return strikeThroughBackground;
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const PriceLockup = _ref9 => {
|
|
86
|
+
let {
|
|
87
|
+
size = 'medium',
|
|
88
|
+
signDirection = 'left',
|
|
89
|
+
footnoteLinks = [],
|
|
90
|
+
topText,
|
|
91
|
+
price,
|
|
92
|
+
currencySymbol = '$',
|
|
93
|
+
rateText,
|
|
94
|
+
bottomText,
|
|
95
|
+
onClickFootnote,
|
|
96
|
+
strikeThrough,
|
|
97
|
+
a11yText,
|
|
98
|
+
tokens: priceLockupTokens,
|
|
99
|
+
variant = {},
|
|
100
|
+
...rest
|
|
101
|
+
} = _ref9;
|
|
102
|
+
const {
|
|
103
|
+
footnoteMarginTop,
|
|
104
|
+
footnoteGap,
|
|
105
|
+
bottomTextMarginTop,
|
|
106
|
+
priceMarginBottom,
|
|
107
|
+
bottomLinksMarginLeft,
|
|
108
|
+
topTextMarginBottom,
|
|
109
|
+
strikeThroughHeight,
|
|
110
|
+
strikeThroughBackground,
|
|
111
|
+
fontColor,
|
|
112
|
+
dividerColor
|
|
113
|
+
} = useThemeTokens('PriceLockup', priceLockupTokens, variant);
|
|
114
|
+
const priceString = String(price);
|
|
115
|
+
const lastDotPosition = priceString.lastIndexOf('.');
|
|
116
|
+
const lastCommaPosition = priceString.lastIndexOf(',');
|
|
117
|
+
const [separator, separatorPosition] = lastDotPosition > lastCommaPosition ? ['.', lastDotPosition] : [',', lastCommaPosition]; // If the separator is at the fourth character from the end of the string or more, it's most probably
|
|
118
|
+
// a part of the amount, and the cents are not included in the price string
|
|
119
|
+
|
|
120
|
+
const hasCents = separatorPosition !== -1 && separatorPosition >= priceString.length - 3;
|
|
121
|
+
const amount = hasCents ? priceString.substring(0, separatorPosition) : priceString;
|
|
122
|
+
const cents = hasCents ? priceString.substring(separatorPosition + 1) : null;
|
|
123
|
+
const color = strikeThrough ? strikeThroughBackground : fontColor;
|
|
124
|
+
|
|
125
|
+
const renderTypography = (value, tokens) => /*#__PURE__*/_jsx(Typography, {
|
|
126
|
+
tokens: { ...tokens,
|
|
127
|
+
color
|
|
128
|
+
},
|
|
129
|
+
children: value
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
const renderCurrencySymbol = () => renderTypography(`${currencySymbol}`, typographyTokens.dollarSign[size]);
|
|
133
|
+
|
|
134
|
+
const renderFootnoteLinks = () => footnoteLinks && footnoteLinks.length > 0 ? /*#__PURE__*/_jsx(FootnoteLink, {
|
|
135
|
+
number: footnoteLinks,
|
|
136
|
+
onClick: onClickFootnote
|
|
137
|
+
}) : null;
|
|
138
|
+
|
|
139
|
+
const renderAmount = () => {
|
|
140
|
+
const amountComponent = renderTypography(amount, typographyTokens.amount[size]);
|
|
141
|
+
|
|
142
|
+
if (strikeThrough) {
|
|
143
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
144
|
+
children: [/*#__PURE__*/_jsx(A11yText, {
|
|
145
|
+
text: a11yText
|
|
146
|
+
}), /*#__PURE__*/_jsx(StrikeThroughContainer, {
|
|
147
|
+
strikeThroughHeight: `${strikeThroughHeight}px`,
|
|
148
|
+
strikeThroughBackground: strikeThroughBackground,
|
|
149
|
+
children: amountComponent
|
|
150
|
+
})]
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return amountComponent;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const renderPrice = () => /*#__PURE__*/_jsxs(_Fragment, {
|
|
158
|
+
children: [/*#__PURE__*/_jsxs(PriceContainer, {
|
|
159
|
+
priceMarginBottom: `${priceMarginBottom}px`,
|
|
160
|
+
children: [signDirection === 'left' && renderCurrencySymbol(), renderAmount(), cents && renderTypography(`${separator}${cents}`, typographyTokens.cents[size]), signDirection === 'right' && /*#__PURE__*/_jsxs(_Fragment, {
|
|
161
|
+
children: ["\xA0", renderCurrencySymbol()]
|
|
162
|
+
}), rateText && /*#__PURE__*/_jsx(RateTextContainer, {
|
|
163
|
+
children: renderTypography(rateText, typographyTokens.rate[size])
|
|
164
|
+
}), !bottomText && footnoteLinks.length <= 3 && /*#__PURE__*/_jsx(BottomLinksContainer, {
|
|
165
|
+
bottomLinksMarginLeft: `${bottomLinksMarginLeft}px`,
|
|
166
|
+
children: renderFootnoteLinks()
|
|
167
|
+
})]
|
|
168
|
+
}), !bottomText && footnoteLinks.length > 3 && renderFootnoteLinks()]
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
const renderFootnoteContent = () => /*#__PURE__*/_jsxs(_Fragment, {
|
|
172
|
+
children: [/*#__PURE__*/_jsxs(FootnoteContainer, {
|
|
173
|
+
footnoteMarginTop: `${footnoteMarginTop}px`,
|
|
174
|
+
footnoteGap: `${footnoteGap}px`,
|
|
175
|
+
children: [/*#__PURE__*/_jsx(BottomTextContainer, {
|
|
176
|
+
bottomTextMarginTop: `${bottomTextMarginTop}px`,
|
|
177
|
+
children: renderTypography(bottomText, typographyTokens.bottomText[size])
|
|
178
|
+
}), footnoteLinks.length <= 3 && renderFootnoteLinks()]
|
|
179
|
+
}), footnoteLinks.length > 3 && renderFootnoteLinks()]
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
if (strikeThrough && !a11yText) {
|
|
183
|
+
warn('PriceLockup', 'a11yText must be provided with strikethrough pricing');
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return /*#__PURE__*/_jsxs(PriceLockupContainer, { ...selectProps(rest),
|
|
187
|
+
children: [topText && /*#__PURE__*/_jsx(TopTextContainer, {
|
|
188
|
+
topTextMarginBottom: `${topTextMarginBottom}px`,
|
|
189
|
+
children: renderTypography(topText, typographyTokens.topText[size])
|
|
190
|
+
}), renderPrice(), bottomText && /*#__PURE__*/_jsx(Divider, {
|
|
191
|
+
testID: "price-lockup-divider",
|
|
192
|
+
role: "separator",
|
|
193
|
+
tokens: {
|
|
194
|
+
color: dividerColor
|
|
195
|
+
}
|
|
196
|
+
}), bottomText && renderFootnoteContent()]
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
PriceLockup.propTypes = { ...selectedSystemPropTypes,
|
|
201
|
+
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
202
|
+
currencySymbol: PropTypes.string,
|
|
203
|
+
topText: PropTypes.string,
|
|
204
|
+
price: PropTypes.string.isRequired,
|
|
205
|
+
rateText: PropTypes.string,
|
|
206
|
+
bottomText: PropTypes.string,
|
|
207
|
+
signDirection: PropTypes.oneOf(['right', 'left']),
|
|
208
|
+
footnoteLinks: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),
|
|
209
|
+
onClickFootnote: PropTypes.func,
|
|
210
|
+
strikeThrough: PropTypes.bool,
|
|
211
|
+
a11yText: PropTypes.string
|
|
212
|
+
};
|
|
213
|
+
export default PriceLockup;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import palette from '@telus-uds/palette-allium/build/rn/palette';
|
|
2
|
+
const {
|
|
3
|
+
fontSize: {
|
|
4
|
+
size14,
|
|
5
|
+
size16,
|
|
6
|
+
size20,
|
|
7
|
+
size28,
|
|
8
|
+
size36,
|
|
9
|
+
size40,
|
|
10
|
+
size64
|
|
11
|
+
},
|
|
12
|
+
lineHeight: {
|
|
13
|
+
ratio1to1,
|
|
14
|
+
ratio10to7,
|
|
15
|
+
ratio3to2,
|
|
16
|
+
ratio8to5,
|
|
17
|
+
ratio5to4,
|
|
18
|
+
ratio6to5,
|
|
19
|
+
ratio9to8,
|
|
20
|
+
ratio4to3,
|
|
21
|
+
ratio8to7
|
|
22
|
+
},
|
|
23
|
+
letterSpacing: {
|
|
24
|
+
condensed
|
|
25
|
+
}
|
|
26
|
+
} = palette;
|
|
27
|
+
const typographyTokens = {
|
|
28
|
+
topText: {
|
|
29
|
+
small: {
|
|
30
|
+
fontSize: size14,
|
|
31
|
+
lineHeight: ratio10to7
|
|
32
|
+
},
|
|
33
|
+
medium: {
|
|
34
|
+
fontSize: size16,
|
|
35
|
+
lineHeight: ratio3to2
|
|
36
|
+
},
|
|
37
|
+
large: {
|
|
38
|
+
fontSize: size20,
|
|
39
|
+
lineHeight: ratio8to5
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
dollarSign: {
|
|
43
|
+
small: {
|
|
44
|
+
fontSize: size16,
|
|
45
|
+
lineHeight: ratio5to4
|
|
46
|
+
},
|
|
47
|
+
medium: {
|
|
48
|
+
fontSize: size20,
|
|
49
|
+
lineHeight: ratio6to5
|
|
50
|
+
},
|
|
51
|
+
large: {
|
|
52
|
+
fontSize: size36,
|
|
53
|
+
lineHeight: ratio9to8
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
// TODO - fontWeight should have its own const on palette
|
|
57
|
+
amount: {
|
|
58
|
+
small: {
|
|
59
|
+
fontSize: size28,
|
|
60
|
+
lineHeight: ratio1to1,
|
|
61
|
+
letterSpacing: condensed,
|
|
62
|
+
fontWeight: '300'
|
|
63
|
+
},
|
|
64
|
+
medium: {
|
|
65
|
+
fontSize: size40,
|
|
66
|
+
lineHeight: ratio1to1,
|
|
67
|
+
letterSpacing: condensed,
|
|
68
|
+
fontWeight: '300'
|
|
69
|
+
},
|
|
70
|
+
large: {
|
|
71
|
+
fontSize: size64,
|
|
72
|
+
lineHeight: ratio1to1,
|
|
73
|
+
letterSpacing: condensed,
|
|
74
|
+
fontWeight: '300'
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
cents: {
|
|
78
|
+
small: {
|
|
79
|
+
fontSize: size16,
|
|
80
|
+
lineHeight: ratio4to3
|
|
81
|
+
},
|
|
82
|
+
medium: {
|
|
83
|
+
fontSize: size20,
|
|
84
|
+
lineHeight: ratio6to5
|
|
85
|
+
},
|
|
86
|
+
large: {
|
|
87
|
+
fontSize: size36,
|
|
88
|
+
lineHeight: ratio9to8
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
rate: {
|
|
92
|
+
small: {
|
|
93
|
+
fontSize: size14,
|
|
94
|
+
lineHeight: ratio8to7
|
|
95
|
+
},
|
|
96
|
+
medium: {
|
|
97
|
+
fontSize: size16,
|
|
98
|
+
lineHeight: ratio5to4
|
|
99
|
+
},
|
|
100
|
+
large: {
|
|
101
|
+
fontSize: size20,
|
|
102
|
+
lineHeight: ratio8to5
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
bottomText: {
|
|
106
|
+
small: {
|
|
107
|
+
fontSize: size14,
|
|
108
|
+
lineHeight: ratio10to7
|
|
109
|
+
},
|
|
110
|
+
medium: {
|
|
111
|
+
fontSize: size16,
|
|
112
|
+
lineHeight: ratio3to2
|
|
113
|
+
},
|
|
114
|
+
large: {
|
|
115
|
+
fontSize: size20,
|
|
116
|
+
lineHeight: ratio8to5
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
export default typographyTokens;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { selectSystemProps } from '@telus-uds/components-base';
|
|
4
|
+
import { viewports } from '@telus-uds/system-constants';
|
|
5
|
+
import { htmlAttrs } from '../utils';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
9
|
+
const staticStyles = {
|
|
10
|
+
image: {
|
|
11
|
+
display: 'block',
|
|
12
|
+
width: '100%'
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Provide different image sources for different screen sizes.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const ResponsiveImage = _ref => {
|
|
20
|
+
let {
|
|
21
|
+
xsSrc,
|
|
22
|
+
smSrc,
|
|
23
|
+
mdSrc,
|
|
24
|
+
lgSrc,
|
|
25
|
+
xlSrc,
|
|
26
|
+
fallbackSrc,
|
|
27
|
+
alt,
|
|
28
|
+
loading = 'eager',
|
|
29
|
+
...rest
|
|
30
|
+
} = _ref;
|
|
31
|
+
return /*#__PURE__*/_jsxs("picture", { ...selectProps(rest),
|
|
32
|
+
children: [/*#__PURE__*/_jsx("source", {
|
|
33
|
+
srcSet: xlSrc,
|
|
34
|
+
media: `(min-width: ${viewports.map.get(viewports.xl)}px)`
|
|
35
|
+
}), /*#__PURE__*/_jsx("source", {
|
|
36
|
+
srcSet: lgSrc,
|
|
37
|
+
media: `(min-width: ${viewports.map.get(viewports.lg)}px)`
|
|
38
|
+
}), /*#__PURE__*/_jsx("source", {
|
|
39
|
+
srcSet: mdSrc,
|
|
40
|
+
media: `(min-width: ${viewports.map.get(viewports.md)}px)`
|
|
41
|
+
}), /*#__PURE__*/_jsx("source", {
|
|
42
|
+
srcSet: smSrc,
|
|
43
|
+
media: `(min-width: ${viewports.map.get(viewports.sm)}px)`
|
|
44
|
+
}), /*#__PURE__*/_jsx("source", {
|
|
45
|
+
srcSet: xsSrc,
|
|
46
|
+
media: `(max-width: ${viewports.map.get(viewports.sm) - 1}px)`
|
|
47
|
+
}), /*#__PURE__*/_jsx("img", {
|
|
48
|
+
src: fallbackSrc,
|
|
49
|
+
alt: alt,
|
|
50
|
+
style: staticStyles.image,
|
|
51
|
+
loading: loading
|
|
52
|
+
})]
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
ResponsiveImage.propTypes = { ...selectedSystemPropTypes,
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The src attribute used for screen widths up to 575px
|
|
60
|
+
*/
|
|
61
|
+
xsSrc: PropTypes.string.isRequired,
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The src attribute used for screen widths greater than 576px
|
|
65
|
+
*/
|
|
66
|
+
smSrc: PropTypes.string.isRequired,
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The src attribute used for screen widths greater than 768px
|
|
70
|
+
*/
|
|
71
|
+
mdSrc: PropTypes.string,
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The src attribute used for screen widths greater than 992px
|
|
75
|
+
*/
|
|
76
|
+
lgSrc: PropTypes.string,
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The src attribute used for screen widths greater than 1200px
|
|
80
|
+
*/
|
|
81
|
+
xlSrc: PropTypes.string,
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The src attribute used for browsers that don't support responsive images (InternetExplorer)
|
|
85
|
+
*/
|
|
86
|
+
fallbackSrc: PropTypes.string.isRequired,
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The alt attribute for the HTML img element. Setting this attribute to an empty string (alt="") indicates that this image is not a key part of the content, and that non-visual browsers may omit it from rendering.
|
|
90
|
+
*/
|
|
91
|
+
alt: PropTypes.string.isRequired,
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Loading strategy.
|
|
95
|
+
* @default 'eager'
|
|
96
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading
|
|
97
|
+
*/
|
|
98
|
+
loading: PropTypes.oneOf(['eager', 'lazy'])
|
|
99
|
+
};
|
|
100
|
+
export default ResponsiveImage;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { selectSystemProps, Typography, useThemeTokens } from '@telus-uds/components-base';
|
|
4
|
-
|
|
3
|
+
import { selectSystemProps, Typography, useThemeTokens } from '@telus-uds/components-base';
|
|
5
4
|
import styled from 'styled-components';
|
|
6
5
|
import { htmlAttrs } from '../utils';
|
|
7
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React 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, useTypographyTheme } from '../utils';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
8
|
+
const StyledSpan = /*#__PURE__*/styled.span.withConfig({
|
|
9
|
+
displayName: "Span__StyledSpan",
|
|
10
|
+
componentId: "components-web__sc-o7sihn-0"
|
|
11
|
+
})(["", "};"], _ref => {
|
|
12
|
+
let {
|
|
13
|
+
flex
|
|
14
|
+
} = _ref;
|
|
15
|
+
return flex ? 'display: inline-flex' : '';
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Text as an HTML ```<span>``` element.
|
|
19
|
+
*
|
|
20
|
+
* Span may be used in cases where an inline span or direct access to HTML attributes is required.
|
|
21
|
+
* In most cases, `Typography` should be used for text, or Paragraph for body text.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const Span = _ref2 => {
|
|
25
|
+
let {
|
|
26
|
+
children,
|
|
27
|
+
variant,
|
|
28
|
+
tokens,
|
|
29
|
+
testID,
|
|
30
|
+
flex,
|
|
31
|
+
...rest
|
|
32
|
+
} = _ref2;
|
|
33
|
+
const style = useTypographyTheme(variant, tokens);
|
|
34
|
+
return /*#__PURE__*/_jsx(StyledSpan, {
|
|
35
|
+
"data-testid": testID,
|
|
36
|
+
flex: flex,
|
|
37
|
+
style: style,
|
|
38
|
+
...selectProps(rest),
|
|
39
|
+
children: children
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
Span.propTypes = { ...selectedSystemPropTypes,
|
|
44
|
+
children: PropTypes.node.isRequired,
|
|
45
|
+
testID: PropTypes.string,
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Sets display to inline-flex so that children are laid out using the flex model.
|
|
49
|
+
* Use this if the span contains children that expect to be inside a flex container.
|
|
50
|
+
*/
|
|
51
|
+
flex: PropTypes.bool,
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Span takes the same tokens overrides as Typography
|
|
55
|
+
*/
|
|
56
|
+
tokens: PropTypes.oneOf([PropTypes.object, PropTypes.func]),
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Span can take any of Typography's theme variants
|
|
60
|
+
*/
|
|
61
|
+
variant: PropTypes.exact({
|
|
62
|
+
bold: PropTypes.bool,
|
|
63
|
+
colour: PropTypes.oneOf(['secondary', 'tertiary']),
|
|
64
|
+
compact: PropTypes.bool,
|
|
65
|
+
inverse: PropTypes.bool,
|
|
66
|
+
size: PropTypes.oneOf(['micro', 'small', 'large', 'eyebrow', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'display1', 'display2']),
|
|
67
|
+
weight: PropTypes.oneOf(['semibold', 'bold'])
|
|
68
|
+
})
|
|
69
|
+
};
|
|
70
|
+
export default Span;
|
package/lib-module/index.js
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
export { default as Badge } from './Badge';
|
|
2
|
+
export { default as OrderedList } from './OrderedList';
|
|
3
|
+
export { default as PreviewCard } from './PreviewCard';
|
|
4
|
+
export { default as ResponsiveImage } from './ResponsiveImage';
|
|
2
5
|
export { default as Ribbon } from './Ribbon';
|
|
6
|
+
export { default as DatePicker } from './DatePicker';
|
|
7
|
+
export { default as Span } from './Span';
|
|
8
|
+
export { default as ExpandCollapseMini } from './ExpandCollapseMini';
|
|
9
|
+
export { default as Callout } from './Callout';
|
|
10
|
+
export { default as PriceLockup } from './PriceLockup';
|
|
11
|
+
export { default as Footnote } from './Footnote';
|
|
3
12
|
export { transformGradient } from './utils';
|
|
13
|
+
export { default as Breadcrumbs } from './Breadcrumbs';
|
|
4
14
|
export * from './baseExports';
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import ResponsiveImage from '../../ResponsiveImage';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
const selectFullBleedContentProps = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
alt,
|
|
10
|
+
height,
|
|
11
|
+
loading,
|
|
12
|
+
src,
|
|
13
|
+
width,
|
|
14
|
+
fallbackSrc = src,
|
|
15
|
+
lgSrc = src,
|
|
16
|
+
mdSrc = src,
|
|
17
|
+
smSrc = src,
|
|
18
|
+
xlSrc = src,
|
|
19
|
+
xsSrc = src
|
|
20
|
+
} = _ref;
|
|
21
|
+
return {
|
|
22
|
+
alt,
|
|
23
|
+
height,
|
|
24
|
+
loading,
|
|
25
|
+
src,
|
|
26
|
+
width,
|
|
27
|
+
fallbackSrc,
|
|
28
|
+
lgSrc,
|
|
29
|
+
mdSrc,
|
|
30
|
+
smSrc,
|
|
31
|
+
xlSrc,
|
|
32
|
+
xsSrc
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const FullBleedContentContainer = /*#__PURE__*/styled.div.withConfig({
|
|
37
|
+
displayName: "FullBleedContent__FullBleedContentContainer",
|
|
38
|
+
componentId: "components-web__sc-1130ea5-0"
|
|
39
|
+
})(_ref2 => {
|
|
40
|
+
let {
|
|
41
|
+
borderBottomLeftRadius,
|
|
42
|
+
borderBottomRightRadius,
|
|
43
|
+
borderTopLeftRadius,
|
|
44
|
+
borderTopRightRadius
|
|
45
|
+
} = _ref2;
|
|
46
|
+
return {
|
|
47
|
+
overflow: 'hidden',
|
|
48
|
+
borderBottomLeftRadius,
|
|
49
|
+
borderBottomRightRadius,
|
|
50
|
+
borderTopLeftRadius,
|
|
51
|
+
borderTopRightRadius
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* Full bleed content component can accept either a single source,
|
|
56
|
+
* a number of sources corresponding to the `ResponsiveImage` component API,
|
|
57
|
+
* or a custom component.
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
const FullBleedContent = _ref3 => {
|
|
61
|
+
let {
|
|
62
|
+
borderRadius,
|
|
63
|
+
content,
|
|
64
|
+
...rest
|
|
65
|
+
} = _ref3;
|
|
66
|
+
return /*#__PURE__*/_jsx(FullBleedContentContainer, { ...borderRadius,
|
|
67
|
+
children: content ?? /*#__PURE__*/_jsx(ResponsiveImage, { ...selectFullBleedContentProps(rest)
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
FullBleedContent.propTypes = {
|
|
73
|
+
/**
|
|
74
|
+
* Content border radius matching the edge values on the parent card.
|
|
75
|
+
*/
|
|
76
|
+
borderRadius: PropTypes.shape({
|
|
77
|
+
borderBottomLeftRadius: PropTypes.number,
|
|
78
|
+
borderBottomRightRadius: PropTypes.number,
|
|
79
|
+
borderTopLeftRadius: PropTypes.number,
|
|
80
|
+
borderTopRightRadius: PropTypes.number
|
|
81
|
+
}),
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Custom JSX to be used for rendering the content (defaults to `ResponsiveImage` receiving other props).
|
|
85
|
+
*/
|
|
86
|
+
content: PropTypes.node,
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Image source.
|
|
90
|
+
*/
|
|
91
|
+
src: PropTypes.string,
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Also accept props for `ResponsiveImage`...
|
|
95
|
+
*/
|
|
96
|
+
...ResponsiveImage.propTypes,
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* ...but make the required ones optional.
|
|
100
|
+
*/
|
|
101
|
+
alt: PropTypes.string,
|
|
102
|
+
xsSrc: PropTypes.string,
|
|
103
|
+
smSrc: PropTypes.string,
|
|
104
|
+
fallbackSrc: PropTypes.string
|
|
105
|
+
};
|
|
106
|
+
export default FullBleedContent;
|