@telus-uds/components-web 1.3.0 → 1.5.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 +32 -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/Paragraph/Paragraph.js +107 -0
- package/lib/Paragraph/index.js +13 -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/Paragraph/Paragraph.js +89 -0
- package/lib-module/Paragraph/index.js +2 -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 -5
- 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/Paragraph/Paragraph.jsx +79 -0
- package/src/Paragraph/index.js +3 -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,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(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 _FootnoteLink = _interopRequireDefault(require("../Footnote/FootnoteLink"));
|
|
17
|
+
|
|
18
|
+
var _tokens = _interopRequireDefault(require("./tokens"));
|
|
19
|
+
|
|
20
|
+
var _utils = require("../utils");
|
|
21
|
+
|
|
22
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
|
|
26
|
+
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
27
|
+
|
|
28
|
+
const PriceLockupContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
29
|
+
displayName: "PriceLockup__PriceLockupContainer",
|
|
30
|
+
componentId: "components-web__sc-1x6duay-0"
|
|
31
|
+
})(["display:flex;flex-direction:column;width:fit-content;"]);
|
|
32
|
+
|
|
33
|
+
const PriceContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
34
|
+
displayName: "PriceLockup__PriceContainer",
|
|
35
|
+
componentId: "components-web__sc-1x6duay-1"
|
|
36
|
+
})(["display:flex;margin-bottom:", ";"], _ref => {
|
|
37
|
+
let {
|
|
38
|
+
priceMarginBottom
|
|
39
|
+
} = _ref;
|
|
40
|
+
return priceMarginBottom;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const FootnoteContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
44
|
+
displayName: "PriceLockup__FootnoteContainer",
|
|
45
|
+
componentId: "components-web__sc-1x6duay-2"
|
|
46
|
+
})(["display:flex;margin-top:", ";gap:", ";"], _ref2 => {
|
|
47
|
+
let {
|
|
48
|
+
footnoteMarginTop
|
|
49
|
+
} = _ref2;
|
|
50
|
+
return footnoteMarginTop;
|
|
51
|
+
}, _ref3 => {
|
|
52
|
+
let {
|
|
53
|
+
footnoteGap
|
|
54
|
+
} = _ref3;
|
|
55
|
+
return footnoteGap;
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const BottomTextContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
59
|
+
displayName: "PriceLockup__BottomTextContainer",
|
|
60
|
+
componentId: "components-web__sc-1x6duay-3"
|
|
61
|
+
})(["margin-top:", ";"], _ref4 => {
|
|
62
|
+
let {
|
|
63
|
+
bottomTextMarginTop
|
|
64
|
+
} = _ref4;
|
|
65
|
+
return bottomTextMarginTop;
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const BottomLinksContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
69
|
+
displayName: "PriceLockup__BottomLinksContainer",
|
|
70
|
+
componentId: "components-web__sc-1x6duay-4"
|
|
71
|
+
})(["align-self:center;margin-left:", ";"], _ref5 => {
|
|
72
|
+
let {
|
|
73
|
+
bottomLinksMarginLeft
|
|
74
|
+
} = _ref5;
|
|
75
|
+
return bottomLinksMarginLeft;
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const TopTextContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
79
|
+
displayName: "PriceLockup__TopTextContainer",
|
|
80
|
+
componentId: "components-web__sc-1x6duay-5"
|
|
81
|
+
})(["margin-bottom:", ";"], _ref6 => {
|
|
82
|
+
let {
|
|
83
|
+
topTextMarginBottom
|
|
84
|
+
} = _ref6;
|
|
85
|
+
return topTextMarginBottom;
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const RateTextContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
89
|
+
displayName: "PriceLockup__RateTextContainer",
|
|
90
|
+
componentId: "components-web__sc-1x6duay-6"
|
|
91
|
+
})(["align-self:flex-end;"]);
|
|
92
|
+
|
|
93
|
+
const StrikeThroughContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
94
|
+
displayName: "PriceLockup__StrikeThroughContainer",
|
|
95
|
+
componentId: "components-web__sc-1x6duay-7"
|
|
96
|
+
})(["display:flex;position:relative;align-items:center;::before{content:'';width:100%;height:", ";background:", ";position:absolute;}"], _ref7 => {
|
|
97
|
+
let {
|
|
98
|
+
strikeThroughHeight
|
|
99
|
+
} = _ref7;
|
|
100
|
+
return strikeThroughHeight;
|
|
101
|
+
}, _ref8 => {
|
|
102
|
+
let {
|
|
103
|
+
strikeThroughBackground
|
|
104
|
+
} = _ref8;
|
|
105
|
+
return strikeThroughBackground;
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
const PriceLockup = _ref9 => {
|
|
109
|
+
let {
|
|
110
|
+
size = 'medium',
|
|
111
|
+
signDirection = 'left',
|
|
112
|
+
footnoteLinks = [],
|
|
113
|
+
topText,
|
|
114
|
+
price,
|
|
115
|
+
currencySymbol = '$',
|
|
116
|
+
rateText,
|
|
117
|
+
bottomText,
|
|
118
|
+
onClickFootnote,
|
|
119
|
+
strikeThrough,
|
|
120
|
+
a11yText,
|
|
121
|
+
tokens: priceLockupTokens,
|
|
122
|
+
variant = {},
|
|
123
|
+
...rest
|
|
124
|
+
} = _ref9;
|
|
125
|
+
const {
|
|
126
|
+
footnoteMarginTop,
|
|
127
|
+
footnoteGap,
|
|
128
|
+
bottomTextMarginTop,
|
|
129
|
+
priceMarginBottom,
|
|
130
|
+
bottomLinksMarginLeft,
|
|
131
|
+
topTextMarginBottom,
|
|
132
|
+
strikeThroughHeight,
|
|
133
|
+
strikeThroughBackground,
|
|
134
|
+
fontColor,
|
|
135
|
+
dividerColor
|
|
136
|
+
} = (0, _componentsBase.useThemeTokens)('PriceLockup', priceLockupTokens, variant);
|
|
137
|
+
const priceString = String(price);
|
|
138
|
+
const lastDotPosition = priceString.lastIndexOf('.');
|
|
139
|
+
const lastCommaPosition = priceString.lastIndexOf(',');
|
|
140
|
+
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
|
|
141
|
+
// a part of the amount, and the cents are not included in the price string
|
|
142
|
+
|
|
143
|
+
const hasCents = separatorPosition !== -1 && separatorPosition >= priceString.length - 3;
|
|
144
|
+
const amount = hasCents ? priceString.substring(0, separatorPosition) : priceString;
|
|
145
|
+
const cents = hasCents ? priceString.substring(separatorPosition + 1) : null;
|
|
146
|
+
const color = strikeThrough ? strikeThroughBackground : fontColor;
|
|
147
|
+
|
|
148
|
+
const renderTypography = (value, tokens) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
149
|
+
tokens: { ...tokens,
|
|
150
|
+
color
|
|
151
|
+
},
|
|
152
|
+
children: value
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
const renderCurrencySymbol = () => renderTypography(`${currencySymbol}`, _tokens.default.dollarSign[size]);
|
|
156
|
+
|
|
157
|
+
const renderFootnoteLinks = () => footnoteLinks && footnoteLinks.length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_FootnoteLink.default, {
|
|
158
|
+
number: footnoteLinks,
|
|
159
|
+
onClick: onClickFootnote
|
|
160
|
+
}) : null;
|
|
161
|
+
|
|
162
|
+
const renderAmount = () => {
|
|
163
|
+
const amountComponent = renderTypography(amount, _tokens.default.amount[size]);
|
|
164
|
+
|
|
165
|
+
if (strikeThrough) {
|
|
166
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
167
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.A11yText, {
|
|
168
|
+
text: a11yText
|
|
169
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StrikeThroughContainer, {
|
|
170
|
+
strikeThroughHeight: `${strikeThroughHeight}px`,
|
|
171
|
+
strikeThroughBackground: strikeThroughBackground,
|
|
172
|
+
children: amountComponent
|
|
173
|
+
})]
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return amountComponent;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const renderPrice = () => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
181
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(PriceContainer, {
|
|
182
|
+
priceMarginBottom: `${priceMarginBottom}px`,
|
|
183
|
+
children: [signDirection === 'left' && renderCurrencySymbol(), renderAmount(), cents && renderTypography(`${separator}${cents}`, _tokens.default.cents[size]), signDirection === 'right' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
184
|
+
children: ["\xA0", renderCurrencySymbol()]
|
|
185
|
+
}), rateText && /*#__PURE__*/(0, _jsxRuntime.jsx)(RateTextContainer, {
|
|
186
|
+
children: renderTypography(rateText, _tokens.default.rate[size])
|
|
187
|
+
}), !bottomText && footnoteLinks.length <= 3 && /*#__PURE__*/(0, _jsxRuntime.jsx)(BottomLinksContainer, {
|
|
188
|
+
bottomLinksMarginLeft: `${bottomLinksMarginLeft}px`,
|
|
189
|
+
children: renderFootnoteLinks()
|
|
190
|
+
})]
|
|
191
|
+
}), !bottomText && footnoteLinks.length > 3 && renderFootnoteLinks()]
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
const renderFootnoteContent = () => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
195
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(FootnoteContainer, {
|
|
196
|
+
footnoteMarginTop: `${footnoteMarginTop}px`,
|
|
197
|
+
footnoteGap: `${footnoteGap}px`,
|
|
198
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(BottomTextContainer, {
|
|
199
|
+
bottomTextMarginTop: `${bottomTextMarginTop}px`,
|
|
200
|
+
children: renderTypography(bottomText, _tokens.default.bottomText[size])
|
|
201
|
+
}), footnoteLinks.length <= 3 && renderFootnoteLinks()]
|
|
202
|
+
}), footnoteLinks.length > 3 && renderFootnoteLinks()]
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
if (strikeThrough && !a11yText) {
|
|
206
|
+
(0, _utils.warn)('PriceLockup', 'a11yText must be provided with strikethrough pricing');
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(PriceLockupContainer, { ...selectProps(rest),
|
|
210
|
+
children: [topText && /*#__PURE__*/(0, _jsxRuntime.jsx)(TopTextContainer, {
|
|
211
|
+
topTextMarginBottom: `${topTextMarginBottom}px`,
|
|
212
|
+
children: renderTypography(topText, _tokens.default.topText[size])
|
|
213
|
+
}), renderPrice(), bottomText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Divider, {
|
|
214
|
+
testID: "price-lockup-divider",
|
|
215
|
+
role: "separator",
|
|
216
|
+
tokens: {
|
|
217
|
+
color: dividerColor
|
|
218
|
+
}
|
|
219
|
+
}), bottomText && renderFootnoteContent()]
|
|
220
|
+
});
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
PriceLockup.propTypes = { ...selectedSystemPropTypes,
|
|
224
|
+
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
225
|
+
currencySymbol: _propTypes.default.string,
|
|
226
|
+
topText: _propTypes.default.string,
|
|
227
|
+
price: _propTypes.default.string.isRequired,
|
|
228
|
+
rateText: _propTypes.default.string,
|
|
229
|
+
bottomText: _propTypes.default.string,
|
|
230
|
+
signDirection: _propTypes.default.oneOf(['right', 'left']),
|
|
231
|
+
footnoteLinks: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])),
|
|
232
|
+
onClickFootnote: _propTypes.default.func,
|
|
233
|
+
strikeThrough: _propTypes.default.bool,
|
|
234
|
+
a11yText: _propTypes.default.string
|
|
235
|
+
};
|
|
236
|
+
var _default = PriceLockup;
|
|
237
|
+
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 _PriceLockup = _interopRequireDefault(require("./PriceLockup"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = _PriceLockup.default;
|
|
13
|
+
exports.default = _default;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _palette = _interopRequireDefault(require("@telus-uds/palette-allium/build/rn/palette"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
fontSize: {
|
|
14
|
+
size14,
|
|
15
|
+
size16,
|
|
16
|
+
size20,
|
|
17
|
+
size28,
|
|
18
|
+
size36,
|
|
19
|
+
size40,
|
|
20
|
+
size64
|
|
21
|
+
},
|
|
22
|
+
lineHeight: {
|
|
23
|
+
ratio1to1,
|
|
24
|
+
ratio10to7,
|
|
25
|
+
ratio3to2,
|
|
26
|
+
ratio8to5,
|
|
27
|
+
ratio5to4,
|
|
28
|
+
ratio6to5,
|
|
29
|
+
ratio9to8,
|
|
30
|
+
ratio4to3,
|
|
31
|
+
ratio8to7
|
|
32
|
+
},
|
|
33
|
+
letterSpacing: {
|
|
34
|
+
condensed
|
|
35
|
+
}
|
|
36
|
+
} = _palette.default;
|
|
37
|
+
const typographyTokens = {
|
|
38
|
+
topText: {
|
|
39
|
+
small: {
|
|
40
|
+
fontSize: size14,
|
|
41
|
+
lineHeight: ratio10to7
|
|
42
|
+
},
|
|
43
|
+
medium: {
|
|
44
|
+
fontSize: size16,
|
|
45
|
+
lineHeight: ratio3to2
|
|
46
|
+
},
|
|
47
|
+
large: {
|
|
48
|
+
fontSize: size20,
|
|
49
|
+
lineHeight: ratio8to5
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
dollarSign: {
|
|
53
|
+
small: {
|
|
54
|
+
fontSize: size16,
|
|
55
|
+
lineHeight: ratio5to4
|
|
56
|
+
},
|
|
57
|
+
medium: {
|
|
58
|
+
fontSize: size20,
|
|
59
|
+
lineHeight: ratio6to5
|
|
60
|
+
},
|
|
61
|
+
large: {
|
|
62
|
+
fontSize: size36,
|
|
63
|
+
lineHeight: ratio9to8
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
// TODO - fontWeight should have its own const on palette
|
|
67
|
+
amount: {
|
|
68
|
+
small: {
|
|
69
|
+
fontSize: size28,
|
|
70
|
+
lineHeight: ratio1to1,
|
|
71
|
+
letterSpacing: condensed,
|
|
72
|
+
fontWeight: '300'
|
|
73
|
+
},
|
|
74
|
+
medium: {
|
|
75
|
+
fontSize: size40,
|
|
76
|
+
lineHeight: ratio1to1,
|
|
77
|
+
letterSpacing: condensed,
|
|
78
|
+
fontWeight: '300'
|
|
79
|
+
},
|
|
80
|
+
large: {
|
|
81
|
+
fontSize: size64,
|
|
82
|
+
lineHeight: ratio1to1,
|
|
83
|
+
letterSpacing: condensed,
|
|
84
|
+
fontWeight: '300'
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
cents: {
|
|
88
|
+
small: {
|
|
89
|
+
fontSize: size16,
|
|
90
|
+
lineHeight: ratio4to3
|
|
91
|
+
},
|
|
92
|
+
medium: {
|
|
93
|
+
fontSize: size20,
|
|
94
|
+
lineHeight: ratio6to5
|
|
95
|
+
},
|
|
96
|
+
large: {
|
|
97
|
+
fontSize: size36,
|
|
98
|
+
lineHeight: ratio9to8
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
rate: {
|
|
102
|
+
small: {
|
|
103
|
+
fontSize: size14,
|
|
104
|
+
lineHeight: ratio8to7
|
|
105
|
+
},
|
|
106
|
+
medium: {
|
|
107
|
+
fontSize: size16,
|
|
108
|
+
lineHeight: ratio5to4
|
|
109
|
+
},
|
|
110
|
+
large: {
|
|
111
|
+
fontSize: size20,
|
|
112
|
+
lineHeight: ratio8to5
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
bottomText: {
|
|
116
|
+
small: {
|
|
117
|
+
fontSize: size14,
|
|
118
|
+
lineHeight: ratio10to7
|
|
119
|
+
},
|
|
120
|
+
medium: {
|
|
121
|
+
fontSize: size16,
|
|
122
|
+
lineHeight: ratio3to2
|
|
123
|
+
},
|
|
124
|
+
large: {
|
|
125
|
+
fontSize: size20,
|
|
126
|
+
lineHeight: ratio8to5
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
var _default = typographyTokens;
|
|
131
|
+
exports.default = _default;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _componentsBase = require("@telus-uds/components-base");
|
|
13
|
+
|
|
14
|
+
var _systemConstants = require("@telus-uds/system-constants");
|
|
15
|
+
|
|
16
|
+
var _utils = require("../utils");
|
|
17
|
+
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
23
|
+
const staticStyles = {
|
|
24
|
+
image: {
|
|
25
|
+
display: 'block',
|
|
26
|
+
width: '100%'
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Provide different image sources for different screen sizes.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
const ResponsiveImage = _ref => {
|
|
34
|
+
let {
|
|
35
|
+
xsSrc,
|
|
36
|
+
smSrc,
|
|
37
|
+
mdSrc,
|
|
38
|
+
lgSrc,
|
|
39
|
+
xlSrc,
|
|
40
|
+
fallbackSrc,
|
|
41
|
+
alt,
|
|
42
|
+
loading = 'eager',
|
|
43
|
+
...rest
|
|
44
|
+
} = _ref;
|
|
45
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("picture", { ...selectProps(rest),
|
|
46
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("source", {
|
|
47
|
+
srcSet: xlSrc,
|
|
48
|
+
media: `(min-width: ${_systemConstants.viewports.map.get(_systemConstants.viewports.xl)}px)`
|
|
49
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("source", {
|
|
50
|
+
srcSet: lgSrc,
|
|
51
|
+
media: `(min-width: ${_systemConstants.viewports.map.get(_systemConstants.viewports.lg)}px)`
|
|
52
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("source", {
|
|
53
|
+
srcSet: mdSrc,
|
|
54
|
+
media: `(min-width: ${_systemConstants.viewports.map.get(_systemConstants.viewports.md)}px)`
|
|
55
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("source", {
|
|
56
|
+
srcSet: smSrc,
|
|
57
|
+
media: `(min-width: ${_systemConstants.viewports.map.get(_systemConstants.viewports.sm)}px)`
|
|
58
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("source", {
|
|
59
|
+
srcSet: xsSrc,
|
|
60
|
+
media: `(max-width: ${_systemConstants.viewports.map.get(_systemConstants.viewports.sm) - 1}px)`
|
|
61
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
62
|
+
src: fallbackSrc,
|
|
63
|
+
alt: alt,
|
|
64
|
+
style: staticStyles.image,
|
|
65
|
+
loading: loading
|
|
66
|
+
})]
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
ResponsiveImage.propTypes = { ...selectedSystemPropTypes,
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The src attribute used for screen widths up to 575px
|
|
74
|
+
*/
|
|
75
|
+
xsSrc: _propTypes.default.string.isRequired,
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The src attribute used for screen widths greater than 576px
|
|
79
|
+
*/
|
|
80
|
+
smSrc: _propTypes.default.string.isRequired,
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The src attribute used for screen widths greater than 768px
|
|
84
|
+
*/
|
|
85
|
+
mdSrc: _propTypes.default.string,
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The src attribute used for screen widths greater than 992px
|
|
89
|
+
*/
|
|
90
|
+
lgSrc: _propTypes.default.string,
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The src attribute used for screen widths greater than 1200px
|
|
94
|
+
*/
|
|
95
|
+
xlSrc: _propTypes.default.string,
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The src attribute used for browsers that don't support responsive images (InternetExplorer)
|
|
99
|
+
*/
|
|
100
|
+
fallbackSrc: _propTypes.default.string.isRequired,
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* 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.
|
|
104
|
+
*/
|
|
105
|
+
alt: _propTypes.default.string.isRequired,
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Loading strategy.
|
|
109
|
+
* @default 'eager'
|
|
110
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading
|
|
111
|
+
*/
|
|
112
|
+
loading: _propTypes.default.oneOf(['eager', 'lazy'])
|
|
113
|
+
};
|
|
114
|
+
var _default = ResponsiveImage;
|
|
115
|
+
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 _ResponsiveImage = _interopRequireDefault(require("./ResponsiveImage"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = _ResponsiveImage.default;
|
|
13
|
+
exports.default = _default;
|
package/lib/Ribbon/Ribbon.js
CHANGED
|
@@ -19,7 +19,6 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
22
|
-
// import palette from '@telus-uds/palette-allium/build/web/palette'
|
|
23
22
|
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
24
23
|
|
|
25
24
|
const RibbonWrapper = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
package/lib/Span/Span.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(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 _utils = require("../utils");
|
|
17
|
+
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
23
|
+
|
|
24
|
+
const StyledSpan = /*#__PURE__*/_styledComponents.default.span.withConfig({
|
|
25
|
+
displayName: "Span__StyledSpan",
|
|
26
|
+
componentId: "components-web__sc-o7sihn-0"
|
|
27
|
+
})(["", "};"], _ref => {
|
|
28
|
+
let {
|
|
29
|
+
flex
|
|
30
|
+
} = _ref;
|
|
31
|
+
return flex ? 'display: inline-flex' : '';
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Text as an HTML ```<span>``` element.
|
|
35
|
+
*
|
|
36
|
+
* Span may be used in cases where an inline span or direct access to HTML attributes is required.
|
|
37
|
+
* In most cases, `Typography` should be used for text, or Paragraph for body text.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
const Span = _ref2 => {
|
|
42
|
+
let {
|
|
43
|
+
children,
|
|
44
|
+
variant,
|
|
45
|
+
tokens,
|
|
46
|
+
testID,
|
|
47
|
+
flex,
|
|
48
|
+
...rest
|
|
49
|
+
} = _ref2;
|
|
50
|
+
const style = (0, _utils.useTypographyTheme)(variant, tokens);
|
|
51
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledSpan, {
|
|
52
|
+
"data-testid": testID,
|
|
53
|
+
flex: flex,
|
|
54
|
+
style: style,
|
|
55
|
+
...selectProps(rest),
|
|
56
|
+
children: children
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
Span.propTypes = { ...selectedSystemPropTypes,
|
|
61
|
+
children: _propTypes.default.node.isRequired,
|
|
62
|
+
testID: _propTypes.default.string,
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Sets display to inline-flex so that children are laid out using the flex model.
|
|
66
|
+
* Use this if the span contains children that expect to be inside a flex container.
|
|
67
|
+
*/
|
|
68
|
+
flex: _propTypes.default.bool,
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Span takes the same tokens overrides as Typography
|
|
72
|
+
*/
|
|
73
|
+
tokens: _propTypes.default.oneOf([_propTypes.default.object, _propTypes.default.func]),
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Span can take any of Typography's theme variants
|
|
77
|
+
*/
|
|
78
|
+
variant: _propTypes.default.exact({
|
|
79
|
+
bold: _propTypes.default.bool,
|
|
80
|
+
colour: _propTypes.default.oneOf(['secondary', 'tertiary']),
|
|
81
|
+
compact: _propTypes.default.bool,
|
|
82
|
+
inverse: _propTypes.default.bool,
|
|
83
|
+
size: _propTypes.default.oneOf(['micro', 'small', 'large', 'eyebrow', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'display1', 'display2']),
|
|
84
|
+
weight: _propTypes.default.oneOf(['semibold', 'bold'])
|
|
85
|
+
})
|
|
86
|
+
};
|
|
87
|
+
var _default = Span;
|
|
88
|
+
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 _Span = _interopRequireDefault(require("./Span"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = _Span.default;
|
|
13
|
+
exports.default = _default;
|