@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
package/lib/index.js
CHANGED
|
@@ -6,8 +6,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
var _exportNames = {
|
|
7
7
|
Badge: true,
|
|
8
8
|
OrderedList: true,
|
|
9
|
+
PreviewCard: true,
|
|
10
|
+
ResponsiveImage: true,
|
|
9
11
|
Ribbon: true,
|
|
10
|
-
|
|
12
|
+
DatePicker: true,
|
|
13
|
+
Paragraph: true,
|
|
14
|
+
Span: true,
|
|
15
|
+
ExpandCollapseMini: true,
|
|
16
|
+
Callout: true,
|
|
17
|
+
PriceLockup: true,
|
|
18
|
+
Footnote: true,
|
|
19
|
+
transformGradient: true,
|
|
20
|
+
Breadcrumbs: true
|
|
11
21
|
};
|
|
12
22
|
Object.defineProperty(exports, "Badge", {
|
|
13
23
|
enumerable: true,
|
|
@@ -15,18 +25,78 @@ Object.defineProperty(exports, "Badge", {
|
|
|
15
25
|
return _Badge.default;
|
|
16
26
|
}
|
|
17
27
|
});
|
|
28
|
+
Object.defineProperty(exports, "Breadcrumbs", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () {
|
|
31
|
+
return _Breadcrumbs.default;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports, "Callout", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () {
|
|
37
|
+
return _Callout.default;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(exports, "DatePicker", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () {
|
|
43
|
+
return _DatePicker.default;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(exports, "ExpandCollapseMini", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function () {
|
|
49
|
+
return _ExpandCollapseMini.default;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(exports, "Footnote", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function () {
|
|
55
|
+
return _Footnote.default;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
18
58
|
Object.defineProperty(exports, "OrderedList", {
|
|
19
59
|
enumerable: true,
|
|
20
60
|
get: function () {
|
|
21
61
|
return _OrderedList.default;
|
|
22
62
|
}
|
|
23
63
|
});
|
|
64
|
+
Object.defineProperty(exports, "Paragraph", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function () {
|
|
67
|
+
return _Paragraph.default;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
Object.defineProperty(exports, "PreviewCard", {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
get: function () {
|
|
73
|
+
return _PreviewCard.default;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(exports, "PriceLockup", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () {
|
|
79
|
+
return _PriceLockup.default;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
Object.defineProperty(exports, "ResponsiveImage", {
|
|
83
|
+
enumerable: true,
|
|
84
|
+
get: function () {
|
|
85
|
+
return _ResponsiveImage.default;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
24
88
|
Object.defineProperty(exports, "Ribbon", {
|
|
25
89
|
enumerable: true,
|
|
26
90
|
get: function () {
|
|
27
91
|
return _Ribbon.default;
|
|
28
92
|
}
|
|
29
93
|
});
|
|
94
|
+
Object.defineProperty(exports, "Span", {
|
|
95
|
+
enumerable: true,
|
|
96
|
+
get: function () {
|
|
97
|
+
return _Span.default;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
30
100
|
Object.defineProperty(exports, "transformGradient", {
|
|
31
101
|
enumerable: true,
|
|
32
102
|
get: function () {
|
|
@@ -38,10 +108,30 @@ var _Badge = _interopRequireDefault(require("./Badge"));
|
|
|
38
108
|
|
|
39
109
|
var _OrderedList = _interopRequireDefault(require("./OrderedList"));
|
|
40
110
|
|
|
111
|
+
var _PreviewCard = _interopRequireDefault(require("./PreviewCard"));
|
|
112
|
+
|
|
113
|
+
var _ResponsiveImage = _interopRequireDefault(require("./ResponsiveImage"));
|
|
114
|
+
|
|
41
115
|
var _Ribbon = _interopRequireDefault(require("./Ribbon"));
|
|
42
116
|
|
|
117
|
+
var _DatePicker = _interopRequireDefault(require("./DatePicker"));
|
|
118
|
+
|
|
119
|
+
var _Paragraph = _interopRequireDefault(require("./Paragraph"));
|
|
120
|
+
|
|
121
|
+
var _Span = _interopRequireDefault(require("./Span"));
|
|
122
|
+
|
|
123
|
+
var _ExpandCollapseMini = _interopRequireDefault(require("./ExpandCollapseMini"));
|
|
124
|
+
|
|
125
|
+
var _Callout = _interopRequireDefault(require("./Callout"));
|
|
126
|
+
|
|
127
|
+
var _PriceLockup = _interopRequireDefault(require("./PriceLockup"));
|
|
128
|
+
|
|
129
|
+
var _Footnote = _interopRequireDefault(require("./Footnote"));
|
|
130
|
+
|
|
43
131
|
var _utils = require("./utils");
|
|
44
132
|
|
|
133
|
+
var _Breadcrumbs = _interopRequireDefault(require("./Breadcrumbs"));
|
|
134
|
+
|
|
45
135
|
var _baseExports = require("./baseExports");
|
|
46
136
|
|
|
47
137
|
Object.keys(_baseExports).forEach(function (key) {
|
|
@@ -0,0 +1,121 @@
|
|
|
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 _ResponsiveImage = _interopRequireDefault(require("../../ResponsiveImage"));
|
|
15
|
+
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
const selectFullBleedContentProps = _ref => {
|
|
21
|
+
let {
|
|
22
|
+
alt,
|
|
23
|
+
height,
|
|
24
|
+
loading,
|
|
25
|
+
src,
|
|
26
|
+
width,
|
|
27
|
+
fallbackSrc = src,
|
|
28
|
+
lgSrc = src,
|
|
29
|
+
mdSrc = src,
|
|
30
|
+
smSrc = src,
|
|
31
|
+
xlSrc = src,
|
|
32
|
+
xsSrc = src
|
|
33
|
+
} = _ref;
|
|
34
|
+
return {
|
|
35
|
+
alt,
|
|
36
|
+
height,
|
|
37
|
+
loading,
|
|
38
|
+
src,
|
|
39
|
+
width,
|
|
40
|
+
fallbackSrc,
|
|
41
|
+
lgSrc,
|
|
42
|
+
mdSrc,
|
|
43
|
+
smSrc,
|
|
44
|
+
xlSrc,
|
|
45
|
+
xsSrc
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const FullBleedContentContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
50
|
+
displayName: "FullBleedContent__FullBleedContentContainer",
|
|
51
|
+
componentId: "components-web__sc-1130ea5-0"
|
|
52
|
+
})(_ref2 => {
|
|
53
|
+
let {
|
|
54
|
+
borderBottomLeftRadius,
|
|
55
|
+
borderBottomRightRadius,
|
|
56
|
+
borderTopLeftRadius,
|
|
57
|
+
borderTopRightRadius
|
|
58
|
+
} = _ref2;
|
|
59
|
+
return {
|
|
60
|
+
overflow: 'hidden',
|
|
61
|
+
borderBottomLeftRadius,
|
|
62
|
+
borderBottomRightRadius,
|
|
63
|
+
borderTopLeftRadius,
|
|
64
|
+
borderTopRightRadius
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
/**
|
|
68
|
+
* Full bleed content component can accept either a single source,
|
|
69
|
+
* a number of sources corresponding to the `ResponsiveImage` component API,
|
|
70
|
+
* or a custom component.
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
const FullBleedContent = _ref3 => {
|
|
75
|
+
let {
|
|
76
|
+
borderRadius,
|
|
77
|
+
content,
|
|
78
|
+
...rest
|
|
79
|
+
} = _ref3;
|
|
80
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(FullBleedContentContainer, { ...borderRadius,
|
|
81
|
+
children: content ?? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ResponsiveImage.default, { ...selectFullBleedContentProps(rest)
|
|
82
|
+
})
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
FullBleedContent.propTypes = {
|
|
87
|
+
/**
|
|
88
|
+
* Content border radius matching the edge values on the parent card.
|
|
89
|
+
*/
|
|
90
|
+
borderRadius: _propTypes.default.shape({
|
|
91
|
+
borderBottomLeftRadius: _propTypes.default.number,
|
|
92
|
+
borderBottomRightRadius: _propTypes.default.number,
|
|
93
|
+
borderTopLeftRadius: _propTypes.default.number,
|
|
94
|
+
borderTopRightRadius: _propTypes.default.number
|
|
95
|
+
}),
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Custom JSX to be used for rendering the content (defaults to `ResponsiveImage` receiving other props).
|
|
99
|
+
*/
|
|
100
|
+
content: _propTypes.default.node,
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Image source.
|
|
104
|
+
*/
|
|
105
|
+
src: _propTypes.default.string,
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Also accept props for `ResponsiveImage`...
|
|
109
|
+
*/
|
|
110
|
+
..._ResponsiveImage.default.propTypes,
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* ...but make the required ones optional.
|
|
114
|
+
*/
|
|
115
|
+
alt: _propTypes.default.string,
|
|
116
|
+
xsSrc: _propTypes.default.string,
|
|
117
|
+
smSrc: _propTypes.default.string,
|
|
118
|
+
fallbackSrc: _propTypes.default.string
|
|
119
|
+
};
|
|
120
|
+
var _default = FullBleedContent;
|
|
121
|
+
exports.default = _default;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Gets the border radius values for an item of content that goes right up to
|
|
10
|
+
* the edges of its container, to the top, bottom, left or right of other content.
|
|
11
|
+
*
|
|
12
|
+
* Gives the full bleed item the same border radius as the container on the corners
|
|
13
|
+
* that are flush with the corners of the container.
|
|
14
|
+
*
|
|
15
|
+
* @param {number} borderRadius
|
|
16
|
+
* @param {'top'|'bottom'|'left'|'right'} position
|
|
17
|
+
* @param {boolean} hasFooter
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
const getFullBleedBorderRadius = function (borderRadius, position) {
|
|
21
|
+
let hasFooter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
22
|
+
const innerBorderRadius = {
|
|
23
|
+
borderBottomLeftRadius: 0,
|
|
24
|
+
borderBottomRightRadius: 0,
|
|
25
|
+
borderTopLeftRadius: 0,
|
|
26
|
+
borderTopRightRadius: 0
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
if (position && position !== 'none') {
|
|
30
|
+
if (borderRadius) {
|
|
31
|
+
// Depending on the position of the image, we need to round some
|
|
32
|
+
// corners, but not the others
|
|
33
|
+
switch (position) {
|
|
34
|
+
case 'bottom':
|
|
35
|
+
if (!hasFooter) {
|
|
36
|
+
innerBorderRadius.borderBottomLeftRadius = borderRadius;
|
|
37
|
+
innerBorderRadius.borderBottomRightRadius = borderRadius;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
break;
|
|
41
|
+
|
|
42
|
+
case 'left':
|
|
43
|
+
if (!hasFooter) {
|
|
44
|
+
innerBorderRadius.borderBottomLeftRadius = borderRadius;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
innerBorderRadius.borderTopLeftRadius = borderRadius;
|
|
48
|
+
break;
|
|
49
|
+
|
|
50
|
+
case 'right':
|
|
51
|
+
if (!hasFooter) {
|
|
52
|
+
innerBorderRadius.borderBottomRightRadius = borderRadius;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
innerBorderRadius.borderTopRightRadius = borderRadius;
|
|
56
|
+
break;
|
|
57
|
+
|
|
58
|
+
case 'top':
|
|
59
|
+
innerBorderRadius.borderTopLeftRadius = borderRadius;
|
|
60
|
+
innerBorderRadius.borderTopRightRadius = borderRadius;
|
|
61
|
+
break;
|
|
62
|
+
|
|
63
|
+
default:
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return innerBorderRadius;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
var _default = getFullBleedBorderRadius;
|
|
73
|
+
exports.default = _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
Object.defineProperty(exports, "getFullBleedBorderRadius", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _getFullBleedBorderRadius.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "useFullBleedContentProps", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _useFullBleedContentProps.default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
var _FullBleedContent = _interopRequireDefault(require("./FullBleedContent"));
|
|
21
|
+
|
|
22
|
+
var _getFullBleedBorderRadius = _interopRequireDefault(require("./getFullBleedBorderRadius"));
|
|
23
|
+
|
|
24
|
+
var _useFullBleedContentProps = _interopRequireDefault(require("./useFullBleedContentProps"));
|
|
25
|
+
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
+
|
|
28
|
+
var _default = _FullBleedContent.default;
|
|
29
|
+
exports.default = _default;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _componentsBase = require("@telus-uds/components-base");
|
|
9
|
+
|
|
10
|
+
const getContentStackDirection = fullBleedContentPosition => {
|
|
11
|
+
switch (fullBleedContentPosition) {
|
|
12
|
+
case 'left':
|
|
13
|
+
return 'row-reverse';
|
|
14
|
+
|
|
15
|
+
case 'right':
|
|
16
|
+
return 'row';
|
|
17
|
+
|
|
18
|
+
case 'top':
|
|
19
|
+
return 'column-reverse';
|
|
20
|
+
|
|
21
|
+
default:
|
|
22
|
+
return 'column';
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const getContentStackAlign = fullBleedContentAlign => {
|
|
27
|
+
switch (fullBleedContentAlign) {
|
|
28
|
+
case 'center':
|
|
29
|
+
return 'center';
|
|
30
|
+
|
|
31
|
+
case 'end':
|
|
32
|
+
case 'flex-end':
|
|
33
|
+
return 'flex-end';
|
|
34
|
+
|
|
35
|
+
case 'start':
|
|
36
|
+
case 'flex-start':
|
|
37
|
+
return 'flex-start';
|
|
38
|
+
|
|
39
|
+
default:
|
|
40
|
+
return 'stretch';
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Resolves a set of `FullBleedContent` props into the variables a container needs to
|
|
45
|
+
* correctly position a `FullBleedContent` component for the current viewport.
|
|
46
|
+
*
|
|
47
|
+
* @param {object} [fullBleedContent] - a set of valid proptypes for FullBleedContent
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
const useFullBleedContentProps = fullBleedContent => {
|
|
53
|
+
const {
|
|
54
|
+
align: fullBleedContentAlignProp,
|
|
55
|
+
position: fullBleedContentPositionProp,
|
|
56
|
+
...fullBleedContentProps
|
|
57
|
+
} = fullBleedContent ?? {
|
|
58
|
+
position: 'none'
|
|
59
|
+
};
|
|
60
|
+
const fullBleedContentPosition = (0, _componentsBase.useResponsiveProp)(fullBleedContentPositionProp, 'none');
|
|
61
|
+
const contentStackDirection = getContentStackDirection(fullBleedContentPosition);
|
|
62
|
+
const fullBleedContentAlign = (0, _componentsBase.useResponsiveProp)(fullBleedContentAlignProp, 'stretch');
|
|
63
|
+
const contentStackAlign = getContentStackAlign(fullBleedContentAlign);
|
|
64
|
+
return {
|
|
65
|
+
contentStackAlign,
|
|
66
|
+
contentStackDirection,
|
|
67
|
+
fullBleedContentPosition,
|
|
68
|
+
fullBleedContentProps
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
var _default = useFullBleedContentProps;
|
|
73
|
+
exports.default = _default;
|
package/lib/utils/index.js
CHANGED
|
@@ -9,15 +9,47 @@ Object.defineProperty(exports, "htmlAttrs", {
|
|
|
9
9
|
return _htmlAttrs.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
+
Object.defineProperty(exports, "media", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _media.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "renderStructuredContent", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _renderStructuredContent.default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
12
24
|
Object.defineProperty(exports, "transformGradient", {
|
|
13
25
|
enumerable: true,
|
|
14
26
|
get: function () {
|
|
15
27
|
return _transforms.transformGradient;
|
|
16
28
|
}
|
|
17
29
|
});
|
|
30
|
+
Object.defineProperty(exports, "useTypographyTheme", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _useTypographyTheme.default;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "warn", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _logger.warn;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
18
42
|
|
|
19
43
|
var _transforms = require("./transforms");
|
|
20
44
|
|
|
45
|
+
var _useTypographyTheme = _interopRequireDefault(require("./useTypographyTheme"));
|
|
46
|
+
|
|
21
47
|
var _htmlAttrs = _interopRequireDefault(require("./htmlAttrs"));
|
|
22
48
|
|
|
49
|
+
var _logger = require("./logger");
|
|
50
|
+
|
|
51
|
+
var _media = _interopRequireDefault(require("./media"));
|
|
52
|
+
|
|
53
|
+
var _renderStructuredContent = _interopRequireDefault(require("./renderStructuredContent"));
|
|
54
|
+
|
|
23
55
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.warn = exports.deprecate = exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
const deprecate = (componentName, message) => {
|
|
9
|
+
if (process.env.NODE_ENV === 'production') {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
console.warn(`[Allium] [Deprecate] ${componentName}: ${message}`); // eslint-disable-line no-console
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
exports.deprecate = deprecate;
|
|
17
|
+
|
|
18
|
+
const warn = (componentName, message) => {
|
|
19
|
+
if (process.env.NODE_ENV === 'production') {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
console.warn(`[Allium] ${componentName}: ${message}`); // eslint-disable-line no-console
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
exports.warn = warn;
|
|
27
|
+
var _default = {
|
|
28
|
+
deprecate,
|
|
29
|
+
warn
|
|
30
|
+
};
|
|
31
|
+
exports.default = _default;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = media;
|
|
7
|
+
|
|
8
|
+
var _systemConstants = require("@telus-uds/system-constants");
|
|
9
|
+
|
|
10
|
+
function media() {
|
|
11
|
+
return {
|
|
12
|
+
query: {},
|
|
13
|
+
|
|
14
|
+
from(breakpoint) {
|
|
15
|
+
if (breakpoint !== _systemConstants.viewports.xs) {
|
|
16
|
+
this.query.minWidth = breakpoint;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return this;
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
until(breakpoint) {
|
|
23
|
+
this.query.maxWidth = breakpoint;
|
|
24
|
+
return this;
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
and(custom) {
|
|
28
|
+
this.query.and = custom;
|
|
29
|
+
return this;
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
css(style) {
|
|
33
|
+
const {
|
|
34
|
+
minWidth,
|
|
35
|
+
maxWidth,
|
|
36
|
+
and
|
|
37
|
+
} = this.query;
|
|
38
|
+
const min = minWidth ? `(min-width: ${_systemConstants.viewports.map.get(minWidth)}px)` : undefined;
|
|
39
|
+
const max = maxWidth ? `(max-width: ${_systemConstants.viewports.map.get(maxWidth) - 1}px)` : undefined;
|
|
40
|
+
|
|
41
|
+
if (typeof min !== 'undefined' || typeof max !== 'undefined' || typeof and !== 'undefined') {
|
|
42
|
+
const mediaQuery = `@media ${[min, max, and].filter(a => a).join(' and ')}`;
|
|
43
|
+
this.query = {};
|
|
44
|
+
return {
|
|
45
|
+
[mediaQuery]: { ...(typeof style === 'function' ? style() : style)
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return typeof style === 'function' ? style() : style;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
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 _componentsBase = require("@telus-uds/components-base");
|
|
11
|
+
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Takes a string content and marks up all the links in it by wrapping them
|
|
20
|
+
* in `Link` component.
|
|
21
|
+
*/
|
|
22
|
+
const generateLinks = content => {
|
|
23
|
+
const linkRegex = /<\s*a([^>]*)>(.*?)<\s*\/\s*a>/g;
|
|
24
|
+
const attributeRegex = /(\w+)\s*=\s*((["'])(.*?)\3|(?=\s|\/>))/g;
|
|
25
|
+
const parts = content.split(linkRegex);
|
|
26
|
+
|
|
27
|
+
if (parts.length === 1) {
|
|
28
|
+
return parts;
|
|
29
|
+
} // Start with first anchor text, attributes will be in the previous part
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
for (let i = 2; i < parts.length; i += 3) {
|
|
33
|
+
const o = {}; // Get attributes from previous part
|
|
34
|
+
|
|
35
|
+
const attributes = parts[i - 1].trim(); // Create object from attributes
|
|
36
|
+
|
|
37
|
+
const matchedAttributes = attributes.match(attributeRegex);
|
|
38
|
+
|
|
39
|
+
if (matchedAttributes) {
|
|
40
|
+
matchedAttributes.forEach(attribute => {
|
|
41
|
+
const split = attribute.split('=');
|
|
42
|
+
o[split[0]] = split[1].substr(1, split[1].length - 2);
|
|
43
|
+
});
|
|
44
|
+
} // Remove anchor attributes from parts
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
parts[i - 1] = undefined; // Replace anchor text with Link in parts
|
|
48
|
+
|
|
49
|
+
parts[i] = /*#__PURE__*/(0, _react.createElement)(_componentsBase.Link, { ...o,
|
|
50
|
+
key: i
|
|
51
|
+
}, parts[i]);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return parts;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Takes an array of strings and in each element replaces the breaks with `<br>` tags.
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
const generateBreaks = parts => {
|
|
62
|
+
const breakRegex = /<br\s?\/*>/g;
|
|
63
|
+
const partsWithBreaks = parts;
|
|
64
|
+
|
|
65
|
+
for (let i = 0; i < partsWithBreaks.length; i += 1) {
|
|
66
|
+
if (typeof partsWithBreaks[i] === 'string' && partsWithBreaks[i].search(breakRegex) !== -1) {
|
|
67
|
+
const toSplit = partsWithBreaks[i].split(breakRegex);
|
|
68
|
+
|
|
69
|
+
for (let x = 1; x < toSplit.length; x += 2) {
|
|
70
|
+
toSplit.splice(x, 0, /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}, `break-${i}-${x}`));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
partsWithBreaks[i] = toSplit;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return partsWithBreaks;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const renderStructuredContent = content => {
|
|
81
|
+
if (typeof content !== 'string') {
|
|
82
|
+
return content;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return generateBreaks(generateLinks(content));
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
var _default = renderStructuredContent;
|
|
89
|
+
exports.default = _default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _componentsBase = require("@telus-uds/components-base");
|
|
9
|
+
|
|
10
|
+
const useTypographyTheme = (variant, tokens) => {
|
|
11
|
+
const viewport = (0, _componentsBase.useViewport)();
|
|
12
|
+
const themeTokens = (0, _componentsBase.useThemeTokens)('Typography', tokens, variant, {
|
|
13
|
+
viewport
|
|
14
|
+
});
|
|
15
|
+
const {
|
|
16
|
+
themeOptions
|
|
17
|
+
} = (0, _componentsBase.useTheme)();
|
|
18
|
+
const {
|
|
19
|
+
fontSize,
|
|
20
|
+
lineHeight,
|
|
21
|
+
...rnStyles
|
|
22
|
+
} = (0, _componentsBase.applyTextStyles)({ ...themeTokens,
|
|
23
|
+
themeOptions
|
|
24
|
+
});
|
|
25
|
+
return { ...rnStyles,
|
|
26
|
+
fontSize: `${fontSize}px`,
|
|
27
|
+
lineHeight: `${lineHeight}px`
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
var _default = useTypographyTheme;
|
|
32
|
+
exports.default = _default;
|