@telus-uds/components-web 1.4.0 → 1.6.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 +25 -2
- package/lib/Image/Image.js +126 -0
- package/lib/Image/index.js +13 -0
- package/lib/Modal/Modal.js +142 -0
- package/lib/Modal/ModalContent.js +195 -0
- package/lib/Modal/index.js +13 -0
- package/lib/Paragraph/Paragraph.js +107 -0
- package/lib/Paragraph/index.js +13 -0
- package/lib/Table/Body.js +29 -0
- package/lib/Table/Cell.js +200 -0
- package/lib/Table/Header.js +39 -0
- package/lib/Table/Row.js +35 -0
- package/lib/Table/SubHeading.js +37 -0
- package/lib/Table/Table.js +121 -0
- package/lib/Table/index.js +28 -0
- package/lib/Toast/Toast.js +136 -0
- package/lib/Toast/index.js +13 -0
- package/lib/WaffleGrid/WaffleGrid.js +176 -0
- package/lib/WaffleGrid/index.js +13 -0
- package/lib/baseExports.js +0 -6
- package/lib/index.js +55 -1
- package/lib-module/Image/Image.js +108 -0
- package/lib-module/Image/index.js +2 -0
- package/lib-module/Modal/Modal.js +128 -0
- package/lib-module/Modal/ModalContent.js +174 -0
- package/lib-module/Modal/index.js +2 -0
- package/lib-module/Paragraph/Paragraph.js +89 -0
- package/lib-module/Paragraph/index.js +2 -0
- package/lib-module/Table/Body.js +17 -0
- package/lib-module/Table/Cell.js +176 -0
- package/lib-module/Table/Header.js +22 -0
- package/lib-module/Table/Row.js +19 -0
- package/lib-module/Table/SubHeading.js +20 -0
- package/lib-module/Table/Table.js +93 -0
- package/lib-module/Table/index.js +12 -0
- package/lib-module/Toast/Toast.js +117 -0
- package/lib-module/Toast/index.js +2 -0
- package/lib-module/WaffleGrid/WaffleGrid.js +155 -0
- package/lib-module/WaffleGrid/index.js +2 -0
- package/lib-module/baseExports.js +1 -1
- package/lib-module/index.js +6 -0
- package/package.json +4 -3
- package/src/Image/Image.jsx +95 -0
- package/src/Image/index.js +3 -0
- package/src/Modal/Modal.jsx +111 -0
- package/src/Modal/ModalContent.jsx +161 -0
- package/src/Modal/index.js +3 -0
- package/src/Paragraph/Paragraph.jsx +79 -0
- package/src/Paragraph/index.js +3 -0
- package/src/Table/Body.jsx +12 -0
- package/src/Table/Cell.jsx +148 -0
- package/src/Table/Header.jsx +17 -0
- package/src/Table/Row.jsx +18 -0
- package/src/Table/SubHeading.jsx +17 -0
- package/src/Table/Table.jsx +90 -0
- package/src/Table/index.js +14 -0
- package/src/Toast/Toast.jsx +151 -0
- package/src/Toast/index.js +3 -0
- package/src/WaffleGrid/WaffleGrid.jsx +137 -0
- package/src/WaffleGrid/index.js +3 -0
- package/src/baseExports.js +0 -1
- package/src/index.js +6 -0
- package/types/Cell.d.ts +13 -0
- package/types/Table.d.ts +12 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
+
|
|
14
|
+
var _componentsBase = require("@telus-uds/components-base");
|
|
15
|
+
|
|
16
|
+
var _OrderedListBase = _interopRequireDefault(require("../OrderedList/OrderedListBase"));
|
|
17
|
+
|
|
18
|
+
var _ItemBase = _interopRequireDefault(require("../OrderedList/ItemBase"));
|
|
19
|
+
|
|
20
|
+
var _Image = _interopRequireDefault(require("../Image"));
|
|
21
|
+
|
|
22
|
+
var _utils = require("../utils");
|
|
23
|
+
|
|
24
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
+
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
+
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
+
|
|
30
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
+
|
|
32
|
+
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
33
|
+
const DEFAULT_ROW_SIZE = {
|
|
34
|
+
sm: 2,
|
|
35
|
+
lg: 3,
|
|
36
|
+
xl: 6
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const row = (rowSize, rowBorderSize) => ({
|
|
40
|
+
flexBasis: `calc(100% / ${rowSize})`,
|
|
41
|
+
[`:not(:nth-of-type(${rowSize}n + 1))`]: {
|
|
42
|
+
borderLeftWidth: `${rowBorderSize}px`
|
|
43
|
+
},
|
|
44
|
+
[`:nth-of-type(n+${rowSize + 1})`]: {
|
|
45
|
+
borderTopWidth: `${rowBorderSize}px`
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const Container = /*#__PURE__*/(0, _styledComponents.default)(_OrderedListBase.default).withConfig({
|
|
50
|
+
displayName: "WaffleGrid__Container",
|
|
51
|
+
componentId: "components-web__sc-ec8g0a-0"
|
|
52
|
+
})({
|
|
53
|
+
display: 'flex',
|
|
54
|
+
flexDirection: 'row',
|
|
55
|
+
flexWrap: 'wrap',
|
|
56
|
+
justifyContent: 'flex-start'
|
|
57
|
+
});
|
|
58
|
+
const Item = /*#__PURE__*/(0, _styledComponents.default)(_ItemBase.default).withConfig({
|
|
59
|
+
displayName: "WaffleGrid__Item",
|
|
60
|
+
componentId: "components-web__sc-ec8g0a-1"
|
|
61
|
+
})(_ref => {
|
|
62
|
+
let {
|
|
63
|
+
rowSize,
|
|
64
|
+
itemPadding,
|
|
65
|
+
itemBorderColor,
|
|
66
|
+
rowBorderWidth
|
|
67
|
+
} = _ref;
|
|
68
|
+
return {
|
|
69
|
+
display: 'flex',
|
|
70
|
+
flexDirection: 'column',
|
|
71
|
+
flexGrow: 0,
|
|
72
|
+
flexShrink: 0,
|
|
73
|
+
padding: `${itemPadding}px`,
|
|
74
|
+
boxSizing: 'border-box',
|
|
75
|
+
borderStyle: 'solid',
|
|
76
|
+
borderColor: itemBorderColor,
|
|
77
|
+
borderWidth: 0,
|
|
78
|
+
'& > a': {
|
|
79
|
+
alignSelf: 'center'
|
|
80
|
+
},
|
|
81
|
+
...row(rowSize, rowBorderWidth)
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
const Center = /*#__PURE__*/(0, _styledComponents.default)('div').withConfig({
|
|
85
|
+
displayName: "WaffleGrid__Center",
|
|
86
|
+
componentId: "components-web__sc-ec8g0a-2"
|
|
87
|
+
})({
|
|
88
|
+
display: 'flex',
|
|
89
|
+
flexDirection: 'column',
|
|
90
|
+
alignItems: 'center',
|
|
91
|
+
textAlign: 'center'
|
|
92
|
+
});
|
|
93
|
+
/**
|
|
94
|
+
* The WaffleGrid is used to show items in a waffle like manner with borders surrounding the element
|
|
95
|
+
*/
|
|
96
|
+
|
|
97
|
+
const WaffleGrid = _ref2 => {
|
|
98
|
+
let {
|
|
99
|
+
items,
|
|
100
|
+
rowSize = DEFAULT_ROW_SIZE,
|
|
101
|
+
LinkRouter,
|
|
102
|
+
tokens,
|
|
103
|
+
variant,
|
|
104
|
+
linkRouterProps,
|
|
105
|
+
...rest
|
|
106
|
+
} = _ref2;
|
|
107
|
+
const themeTokens = (0, _componentsBase.useThemeTokens)('WaffleGrid', tokens, variant);
|
|
108
|
+
const currentRowSize = (0, _componentsBase.useResponsiveProp)(rowSize);
|
|
109
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Container, { ...selectProps(rest),
|
|
110
|
+
children: items.map(child => /*#__PURE__*/(0, _react.createElement)(Item, { ...themeTokens,
|
|
111
|
+
key: child.href,
|
|
112
|
+
rowSize: currentRowSize
|
|
113
|
+
}, /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Link, {
|
|
114
|
+
href: child.href,
|
|
115
|
+
variant: {
|
|
116
|
+
alternative: true
|
|
117
|
+
},
|
|
118
|
+
LinkRouter: child.LinkRouter || LinkRouter,
|
|
119
|
+
linkRouterProps: { ...linkRouterProps,
|
|
120
|
+
...child.linkRouterProps
|
|
121
|
+
},
|
|
122
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(Center, {
|
|
123
|
+
children: [typeof child.image === 'string' ?
|
|
124
|
+
/*#__PURE__*/
|
|
125
|
+
// Assuming that string passed is the image URL
|
|
126
|
+
(0, _jsxRuntime.jsx)(_Image.default, {
|
|
127
|
+
src: child.image,
|
|
128
|
+
alt: child.imageAltText,
|
|
129
|
+
width: 64,
|
|
130
|
+
height: 64
|
|
131
|
+
}) : // Otherwise it must be an arbitrary content, which we just display by itself
|
|
132
|
+
child.image, /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
133
|
+
children: child.text
|
|
134
|
+
})]
|
|
135
|
+
})
|
|
136
|
+
})))
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
WaffleGrid.propTypes = { ...selectedSystemPropTypes,
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* The image and the link to display. `items` should be an array of objects with the following keys:
|
|
144
|
+
*/
|
|
145
|
+
items: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
146
|
+
/**
|
|
147
|
+
* The src attribute for the HTML img element or custom JSX content to render instead
|
|
148
|
+
*/
|
|
149
|
+
image: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* The alt attribute for the HTML img element (note that this is ignored if a custom
|
|
153
|
+
* JSX content is used instead of an image URL)
|
|
154
|
+
*/
|
|
155
|
+
imageAltText: _propTypes.default.string,
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* The text displayed under the image
|
|
159
|
+
*/
|
|
160
|
+
text: _propTypes.default.string,
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Target URL
|
|
164
|
+
*/
|
|
165
|
+
href: _propTypes.default.string,
|
|
166
|
+
..._componentsBase.withLinkRouter.propTypes
|
|
167
|
+
})).isRequired,
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Row size, optionally depending on the viewport
|
|
171
|
+
*/
|
|
172
|
+
rowSize: _componentsBase.responsiveProps.getTypeOptionallyByViewport(_propTypes.default.number),
|
|
173
|
+
..._componentsBase.withLinkRouter.propTypes
|
|
174
|
+
};
|
|
175
|
+
var _default = WaffleGrid;
|
|
176
|
+
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 _WaffleGrid = _interopRequireDefault(require("./WaffleGrid"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = _WaffleGrid.default;
|
|
13
|
+
exports.default = _default;
|
package/lib/baseExports.js
CHANGED
|
@@ -147,12 +147,6 @@ Object.defineProperty(exports, "Link", {
|
|
|
147
147
|
return _componentsBase.Link;
|
|
148
148
|
}
|
|
149
149
|
});
|
|
150
|
-
Object.defineProperty(exports, "Modal", {
|
|
151
|
-
enumerable: true,
|
|
152
|
-
get: function () {
|
|
153
|
-
return _componentsBase.Modal;
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
150
|
Object.defineProperty(exports, "MultiSelectFilter", {
|
|
157
151
|
enumerable: true,
|
|
158
152
|
get: function () {
|
package/lib/index.js
CHANGED
|
@@ -5,18 +5,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
7
|
Badge: true,
|
|
8
|
+
Modal: true,
|
|
8
9
|
OrderedList: true,
|
|
9
10
|
PreviewCard: true,
|
|
10
11
|
ResponsiveImage: true,
|
|
11
12
|
Ribbon: true,
|
|
12
13
|
DatePicker: true,
|
|
14
|
+
Paragraph: true,
|
|
13
15
|
Span: true,
|
|
14
16
|
ExpandCollapseMini: true,
|
|
15
17
|
Callout: true,
|
|
16
18
|
PriceLockup: true,
|
|
17
19
|
Footnote: true,
|
|
18
20
|
transformGradient: true,
|
|
19
|
-
Breadcrumbs: true
|
|
21
|
+
Breadcrumbs: true,
|
|
22
|
+
Toast: true,
|
|
23
|
+
Table: true,
|
|
24
|
+
Image: true,
|
|
25
|
+
WaffleGrid: true
|
|
20
26
|
};
|
|
21
27
|
Object.defineProperty(exports, "Badge", {
|
|
22
28
|
enumerable: true,
|
|
@@ -54,12 +60,30 @@ Object.defineProperty(exports, "Footnote", {
|
|
|
54
60
|
return _Footnote.default;
|
|
55
61
|
}
|
|
56
62
|
});
|
|
63
|
+
Object.defineProperty(exports, "Image", {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
get: function () {
|
|
66
|
+
return _Image.default;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
Object.defineProperty(exports, "Modal", {
|
|
70
|
+
enumerable: true,
|
|
71
|
+
get: function () {
|
|
72
|
+
return _Modal.default;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
57
75
|
Object.defineProperty(exports, "OrderedList", {
|
|
58
76
|
enumerable: true,
|
|
59
77
|
get: function () {
|
|
60
78
|
return _OrderedList.default;
|
|
61
79
|
}
|
|
62
80
|
});
|
|
81
|
+
Object.defineProperty(exports, "Paragraph", {
|
|
82
|
+
enumerable: true,
|
|
83
|
+
get: function () {
|
|
84
|
+
return _Paragraph.default;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
63
87
|
Object.defineProperty(exports, "PreviewCard", {
|
|
64
88
|
enumerable: true,
|
|
65
89
|
get: function () {
|
|
@@ -90,6 +114,24 @@ Object.defineProperty(exports, "Span", {
|
|
|
90
114
|
return _Span.default;
|
|
91
115
|
}
|
|
92
116
|
});
|
|
117
|
+
Object.defineProperty(exports, "Table", {
|
|
118
|
+
enumerable: true,
|
|
119
|
+
get: function () {
|
|
120
|
+
return _Table.default;
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
Object.defineProperty(exports, "Toast", {
|
|
124
|
+
enumerable: true,
|
|
125
|
+
get: function () {
|
|
126
|
+
return _Toast.default;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
Object.defineProperty(exports, "WaffleGrid", {
|
|
130
|
+
enumerable: true,
|
|
131
|
+
get: function () {
|
|
132
|
+
return _WaffleGrid.default;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
93
135
|
Object.defineProperty(exports, "transformGradient", {
|
|
94
136
|
enumerable: true,
|
|
95
137
|
get: function () {
|
|
@@ -99,6 +141,8 @@ Object.defineProperty(exports, "transformGradient", {
|
|
|
99
141
|
|
|
100
142
|
var _Badge = _interopRequireDefault(require("./Badge"));
|
|
101
143
|
|
|
144
|
+
var _Modal = _interopRequireDefault(require("./Modal"));
|
|
145
|
+
|
|
102
146
|
var _OrderedList = _interopRequireDefault(require("./OrderedList"));
|
|
103
147
|
|
|
104
148
|
var _PreviewCard = _interopRequireDefault(require("./PreviewCard"));
|
|
@@ -109,6 +153,8 @@ var _Ribbon = _interopRequireDefault(require("./Ribbon"));
|
|
|
109
153
|
|
|
110
154
|
var _DatePicker = _interopRequireDefault(require("./DatePicker"));
|
|
111
155
|
|
|
156
|
+
var _Paragraph = _interopRequireDefault(require("./Paragraph"));
|
|
157
|
+
|
|
112
158
|
var _Span = _interopRequireDefault(require("./Span"));
|
|
113
159
|
|
|
114
160
|
var _ExpandCollapseMini = _interopRequireDefault(require("./ExpandCollapseMini"));
|
|
@@ -123,6 +169,14 @@ var _utils = require("./utils");
|
|
|
123
169
|
|
|
124
170
|
var _Breadcrumbs = _interopRequireDefault(require("./Breadcrumbs"));
|
|
125
171
|
|
|
172
|
+
var _Toast = _interopRequireDefault(require("./Toast"));
|
|
173
|
+
|
|
174
|
+
var _Table = _interopRequireDefault(require("./Table"));
|
|
175
|
+
|
|
176
|
+
var _Image = _interopRequireDefault(require("./Image"));
|
|
177
|
+
|
|
178
|
+
var _WaffleGrid = _interopRequireDefault(require("./WaffleGrid"));
|
|
179
|
+
|
|
126
180
|
var _baseExports = require("./baseExports");
|
|
127
181
|
|
|
128
182
|
Object.keys(_baseExports).forEach(function (key) {
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { selectSystemProps, useThemeTokens } from '@telus-uds/components-base';
|
|
5
|
+
import { htmlAttrs, warn } from '../utils';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
8
|
+
const StyledImage = /*#__PURE__*/styled.img.withConfig({
|
|
9
|
+
displayName: "Image__StyledImage",
|
|
10
|
+
componentId: "components-web__sc-blwu4l-0"
|
|
11
|
+
})({
|
|
12
|
+
height: 'auto',
|
|
13
|
+
maxWidth: '100%'
|
|
14
|
+
});
|
|
15
|
+
const StyledRoundedImage = /*#__PURE__*/styled(StyledImage).withConfig({
|
|
16
|
+
displayName: "Image__StyledRoundedImage",
|
|
17
|
+
componentId: "components-web__sc-blwu4l-1"
|
|
18
|
+
})(["border-radius:", "px;"], _ref => {
|
|
19
|
+
let {
|
|
20
|
+
borderRadius
|
|
21
|
+
} = _ref;
|
|
22
|
+
return borderRadius;
|
|
23
|
+
});
|
|
24
|
+
const StyledCircularImage = /*#__PURE__*/styled(StyledImage).withConfig({
|
|
25
|
+
displayName: "Image__StyledCircularImage",
|
|
26
|
+
componentId: "components-web__sc-blwu4l-2"
|
|
27
|
+
})({
|
|
28
|
+
borderRadius: '50%'
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const Image = _ref2 => {
|
|
32
|
+
let {
|
|
33
|
+
src,
|
|
34
|
+
width,
|
|
35
|
+
height,
|
|
36
|
+
alt,
|
|
37
|
+
rounded,
|
|
38
|
+
loading = 'eager',
|
|
39
|
+
tokens,
|
|
40
|
+
variant,
|
|
41
|
+
...rest
|
|
42
|
+
} = _ref2;
|
|
43
|
+
const {
|
|
44
|
+
borderRadius
|
|
45
|
+
} = useThemeTokens('Image', tokens, variant);
|
|
46
|
+
const isCircle = rounded === 'circle';
|
|
47
|
+
const isCorners = rounded === 'corners';
|
|
48
|
+
const isSquare = width === height;
|
|
49
|
+
|
|
50
|
+
if (isCircle && !isSquare) {
|
|
51
|
+
warn('Image', 'rounded="circle" is not supported for non-square images. Please provide a square image, otherwise the resulting shape will not be a circle.');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
let ImageComponent;
|
|
55
|
+
|
|
56
|
+
if (isCircle) {
|
|
57
|
+
ImageComponent = StyledCircularImage;
|
|
58
|
+
} else if (isCorners) {
|
|
59
|
+
ImageComponent = StyledRoundedImage;
|
|
60
|
+
} else {
|
|
61
|
+
ImageComponent = StyledImage;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return /*#__PURE__*/_jsx(ImageComponent, { ...selectProps(rest),
|
|
65
|
+
borderRadius: borderRadius,
|
|
66
|
+
src: src,
|
|
67
|
+
width: width,
|
|
68
|
+
height: height,
|
|
69
|
+
alt: alt,
|
|
70
|
+
loading: loading
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
Image.propTypes = { ...selectedSystemPropTypes,
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The src attribute for the HTML img element.
|
|
78
|
+
*/
|
|
79
|
+
src: PropTypes.string.isRequired,
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* 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.
|
|
83
|
+
*/
|
|
84
|
+
alt: PropTypes.string.isRequired,
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The image's width.
|
|
88
|
+
*/
|
|
89
|
+
width: PropTypes.number.isRequired,
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The image's height.
|
|
93
|
+
*/
|
|
94
|
+
height: PropTypes.number.isRequired,
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Loading strategy.
|
|
98
|
+
* @default 'eager'
|
|
99
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading
|
|
100
|
+
*/
|
|
101
|
+
loading: PropTypes.oneOf(['eager', 'lazy']),
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Make image render as a circle or with rounded corners.
|
|
105
|
+
*/
|
|
106
|
+
rounded: PropTypes.oneOf(['circle', 'corners'])
|
|
107
|
+
};
|
|
108
|
+
export default Image;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Modal as BaseModal } from '@telus-uds/components-base';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import ModalContent from './ModalContent';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
const Modal = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
isOpen,
|
|
10
|
+
onClose,
|
|
11
|
+
maxWidth,
|
|
12
|
+
onCancel = onClose,
|
|
13
|
+
onConfirm,
|
|
14
|
+
heading,
|
|
15
|
+
headingLevel,
|
|
16
|
+
subHeading,
|
|
17
|
+
subHeadingSize,
|
|
18
|
+
bodyText,
|
|
19
|
+
tokens,
|
|
20
|
+
variant = {},
|
|
21
|
+
confirmButtonText,
|
|
22
|
+
confirmButtonVariant,
|
|
23
|
+
cancelButtonText,
|
|
24
|
+
cancelButtonType,
|
|
25
|
+
...nonContentProps
|
|
26
|
+
} = _ref;
|
|
27
|
+
return /*#__PURE__*/_jsx(BaseModal, {
|
|
28
|
+
isOpen: isOpen,
|
|
29
|
+
onClose: onClose,
|
|
30
|
+
maxWidth: maxWidth,
|
|
31
|
+
...nonContentProps,
|
|
32
|
+
children: /*#__PURE__*/_jsx(ModalContent, {
|
|
33
|
+
tokens: tokens,
|
|
34
|
+
variant: variant,
|
|
35
|
+
onCancel: onCancel,
|
|
36
|
+
onConfirm: onConfirm,
|
|
37
|
+
heading: heading,
|
|
38
|
+
headingLevel: headingLevel,
|
|
39
|
+
subHeading: subHeading,
|
|
40
|
+
subHeadingSize: subHeadingSize,
|
|
41
|
+
bodyText: bodyText,
|
|
42
|
+
confirmButtonText: confirmButtonText,
|
|
43
|
+
confirmButtonVariant: confirmButtonVariant,
|
|
44
|
+
cancelButtonText: cancelButtonText,
|
|
45
|
+
cancelButtonType: cancelButtonType
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
Modal.propTypes = {
|
|
51
|
+
tokens: PropTypes.object,
|
|
52
|
+
variant: PropTypes.object,
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* If true, the modal overlay covers the page and the modal content is shown
|
|
56
|
+
*/
|
|
57
|
+
isOpen: PropTypes.bool,
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Function called on pressing the Modal close "x" button
|
|
61
|
+
*/
|
|
62
|
+
onClose: PropTypes.func,
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* If true, Modal is rendered with the 'maxWidth' appearance applied.
|
|
66
|
+
* Use this for wider content, such as content with long headers.
|
|
67
|
+
*/
|
|
68
|
+
maxWidth: PropTypes.bool,
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Heading text shown prominently with heading semantic tags.
|
|
72
|
+
*/
|
|
73
|
+
heading: PropTypes.string,
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Stylistic size and semantic level of the modal heading
|
|
77
|
+
*/
|
|
78
|
+
headingLevel: PropTypes.oneOf(['h3', 'h4']),
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Short content rendered below the heading. If there is long body content that is scrollable,
|
|
82
|
+
* the subHeading sits above the scrollable area.
|
|
83
|
+
*/
|
|
84
|
+
subHeading: PropTypes.string,
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Short content rendered below the heading. If there is long body content that is scrollable,
|
|
88
|
+
* the subHeading sits above the scrollable area.
|
|
89
|
+
*/
|
|
90
|
+
subHeadingSize: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* If the modal requires longer text, include it here. This text will become scrollable if it
|
|
94
|
+
* is too long for the allowed height of the modal.
|
|
95
|
+
*/
|
|
96
|
+
bodyText: PropTypes.string,
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Text for the button controlling the primary action of the modal.
|
|
100
|
+
*/
|
|
101
|
+
confirmButtonText: PropTypes.string,
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Button variant object to be passed through to Button to choose its visual style.
|
|
105
|
+
*/
|
|
106
|
+
confirmButtonVariant: PropTypes.object,
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Action on pressing the confirm button.
|
|
110
|
+
*/
|
|
111
|
+
onConfirm: PropTypes.func,
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Text for the optional cancel button provided if the user does not want to do the confirm action.
|
|
115
|
+
*/
|
|
116
|
+
cancelButtonText: PropTypes.string,
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Component to use for the cancel button (default: `TextButton`). Should accept similar props to `TextButton`.
|
|
120
|
+
*/
|
|
121
|
+
cancelButtonType: PropTypes.elementType,
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Action to perform on pressing the cancel button. Defaults to `onClose` action if undefined.
|
|
125
|
+
*/
|
|
126
|
+
onCancel: PropTypes.func
|
|
127
|
+
};
|
|
128
|
+
export default Modal;
|