@telus-uds/components-web 1.5.0 → 1.6.1
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 +26 -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/PreviewCard/PreviewCard.js +5 -1
- 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 +46 -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/PreviewCard/PreviewCard.js +5 -1
- 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 +5 -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/PreviewCard/PreviewCard.jsx +5 -1
- 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 +5 -0
- package/types/Cell.d.ts +13 -0
- package/types/Table.d.ts +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,36 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-web
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 19 Apr 2023 18:43:18 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.6.1
|
|
8
|
+
|
|
9
|
+
Wed, 19 Apr 2023 18:43:18 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Update default token to Preview Card (carlos.jeronimo@telus.com)
|
|
14
|
+
- Bump @telus-uds/components-base to v1.35.0
|
|
15
|
+
- Bump @telus-uds/system-theme-tokens to v2.20.0
|
|
16
|
+
|
|
17
|
+
## 1.6.0
|
|
18
|
+
|
|
19
|
+
Wed, 19 Apr 2023 11:32:31 GMT
|
|
20
|
+
|
|
21
|
+
### Minor changes
|
|
22
|
+
|
|
23
|
+
- add Modal (kyle.king2@telus.com)
|
|
24
|
+
- moved Image to components-web from ds-allium (kyle.king2@telus.com)
|
|
25
|
+
- moved WaffleGrid from ds-allium to components-web (kyle.king2@telus.com)
|
|
26
|
+
- Toast multi-brand (samuraix221@hotmail.com)
|
|
27
|
+
- Added Table (wlsdud194@hotmail.com)
|
|
28
|
+
- Bump @telus-uds/components-base to v1.34.2
|
|
29
|
+
- Bump @telus-uds/system-theme-tokens to v2.19.0
|
|
30
|
+
|
|
7
31
|
## 1.5.0
|
|
8
32
|
|
|
9
|
-
Tue, 18 Apr 2023 11:
|
|
33
|
+
Tue, 18 Apr 2023 11:48:05 GMT
|
|
10
34
|
|
|
11
35
|
### Minor changes
|
|
12
36
|
|
|
@@ -0,0 +1,126 @@
|
|
|
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 StyledImage = /*#__PURE__*/_styledComponents.default.img.withConfig({
|
|
25
|
+
displayName: "Image__StyledImage",
|
|
26
|
+
componentId: "components-web__sc-blwu4l-0"
|
|
27
|
+
})({
|
|
28
|
+
height: 'auto',
|
|
29
|
+
maxWidth: '100%'
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const StyledRoundedImage = /*#__PURE__*/(0, _styledComponents.default)(StyledImage).withConfig({
|
|
33
|
+
displayName: "Image__StyledRoundedImage",
|
|
34
|
+
componentId: "components-web__sc-blwu4l-1"
|
|
35
|
+
})(["border-radius:", "px;"], _ref => {
|
|
36
|
+
let {
|
|
37
|
+
borderRadius
|
|
38
|
+
} = _ref;
|
|
39
|
+
return borderRadius;
|
|
40
|
+
});
|
|
41
|
+
const StyledCircularImage = /*#__PURE__*/(0, _styledComponents.default)(StyledImage).withConfig({
|
|
42
|
+
displayName: "Image__StyledCircularImage",
|
|
43
|
+
componentId: "components-web__sc-blwu4l-2"
|
|
44
|
+
})({
|
|
45
|
+
borderRadius: '50%'
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const Image = _ref2 => {
|
|
49
|
+
let {
|
|
50
|
+
src,
|
|
51
|
+
width,
|
|
52
|
+
height,
|
|
53
|
+
alt,
|
|
54
|
+
rounded,
|
|
55
|
+
loading = 'eager',
|
|
56
|
+
tokens,
|
|
57
|
+
variant,
|
|
58
|
+
...rest
|
|
59
|
+
} = _ref2;
|
|
60
|
+
const {
|
|
61
|
+
borderRadius
|
|
62
|
+
} = (0, _componentsBase.useThemeTokens)('Image', tokens, variant);
|
|
63
|
+
const isCircle = rounded === 'circle';
|
|
64
|
+
const isCorners = rounded === 'corners';
|
|
65
|
+
const isSquare = width === height;
|
|
66
|
+
|
|
67
|
+
if (isCircle && !isSquare) {
|
|
68
|
+
(0, _utils.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.');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
let ImageComponent;
|
|
72
|
+
|
|
73
|
+
if (isCircle) {
|
|
74
|
+
ImageComponent = StyledCircularImage;
|
|
75
|
+
} else if (isCorners) {
|
|
76
|
+
ImageComponent = StyledRoundedImage;
|
|
77
|
+
} else {
|
|
78
|
+
ImageComponent = StyledImage;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ImageComponent, { ...selectProps(rest),
|
|
82
|
+
borderRadius: borderRadius,
|
|
83
|
+
src: src,
|
|
84
|
+
width: width,
|
|
85
|
+
height: height,
|
|
86
|
+
alt: alt,
|
|
87
|
+
loading: loading
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
Image.propTypes = { ...selectedSystemPropTypes,
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The src attribute for the HTML img element.
|
|
95
|
+
*/
|
|
96
|
+
src: _propTypes.default.string.isRequired,
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* 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.
|
|
100
|
+
*/
|
|
101
|
+
alt: _propTypes.default.string.isRequired,
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The image's width.
|
|
105
|
+
*/
|
|
106
|
+
width: _propTypes.default.number.isRequired,
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The image's height.
|
|
110
|
+
*/
|
|
111
|
+
height: _propTypes.default.number.isRequired,
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Loading strategy.
|
|
115
|
+
* @default 'eager'
|
|
116
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading
|
|
117
|
+
*/
|
|
118
|
+
loading: _propTypes.default.oneOf(['eager', 'lazy']),
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Make image render as a circle or with rounded corners.
|
|
122
|
+
*/
|
|
123
|
+
rounded: _propTypes.default.oneOf(['circle', 'corners'])
|
|
124
|
+
};
|
|
125
|
+
var _default = Image;
|
|
126
|
+
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 _Image = _interopRequireDefault(require("./Image"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = _Image.default;
|
|
13
|
+
exports.default = _default;
|
|
@@ -0,0 +1,142 @@
|
|
|
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 _componentsBase = require("@telus-uds/components-base");
|
|
11
|
+
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
14
|
+
var _ModalContent = _interopRequireDefault(require("./ModalContent"));
|
|
15
|
+
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
const Modal = _ref => {
|
|
21
|
+
let {
|
|
22
|
+
isOpen,
|
|
23
|
+
onClose,
|
|
24
|
+
maxWidth,
|
|
25
|
+
onCancel = onClose,
|
|
26
|
+
onConfirm,
|
|
27
|
+
heading,
|
|
28
|
+
headingLevel,
|
|
29
|
+
subHeading,
|
|
30
|
+
subHeadingSize,
|
|
31
|
+
bodyText,
|
|
32
|
+
tokens,
|
|
33
|
+
variant = {},
|
|
34
|
+
confirmButtonText,
|
|
35
|
+
confirmButtonVariant,
|
|
36
|
+
cancelButtonText,
|
|
37
|
+
cancelButtonType,
|
|
38
|
+
...nonContentProps
|
|
39
|
+
} = _ref;
|
|
40
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Modal, {
|
|
41
|
+
isOpen: isOpen,
|
|
42
|
+
onClose: onClose,
|
|
43
|
+
maxWidth: maxWidth,
|
|
44
|
+
...nonContentProps,
|
|
45
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ModalContent.default, {
|
|
46
|
+
tokens: tokens,
|
|
47
|
+
variant: variant,
|
|
48
|
+
onCancel: onCancel,
|
|
49
|
+
onConfirm: onConfirm,
|
|
50
|
+
heading: heading,
|
|
51
|
+
headingLevel: headingLevel,
|
|
52
|
+
subHeading: subHeading,
|
|
53
|
+
subHeadingSize: subHeadingSize,
|
|
54
|
+
bodyText: bodyText,
|
|
55
|
+
confirmButtonText: confirmButtonText,
|
|
56
|
+
confirmButtonVariant: confirmButtonVariant,
|
|
57
|
+
cancelButtonText: cancelButtonText,
|
|
58
|
+
cancelButtonType: cancelButtonType
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
Modal.propTypes = {
|
|
64
|
+
tokens: _propTypes.default.object,
|
|
65
|
+
variant: _propTypes.default.object,
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* If true, the modal overlay covers the page and the modal content is shown
|
|
69
|
+
*/
|
|
70
|
+
isOpen: _propTypes.default.bool,
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Function called on pressing the Modal close "x" button
|
|
74
|
+
*/
|
|
75
|
+
onClose: _propTypes.default.func,
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* If true, Modal is rendered with the 'maxWidth' appearance applied.
|
|
79
|
+
* Use this for wider content, such as content with long headers.
|
|
80
|
+
*/
|
|
81
|
+
maxWidth: _propTypes.default.bool,
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Heading text shown prominently with heading semantic tags.
|
|
85
|
+
*/
|
|
86
|
+
heading: _propTypes.default.string,
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Stylistic size and semantic level of the modal heading
|
|
90
|
+
*/
|
|
91
|
+
headingLevel: _propTypes.default.oneOf(['h3', 'h4']),
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Short content rendered below the heading. If there is long body content that is scrollable,
|
|
95
|
+
* the subHeading sits above the scrollable area.
|
|
96
|
+
*/
|
|
97
|
+
subHeading: _propTypes.default.string,
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Short content rendered below the heading. If there is long body content that is scrollable,
|
|
101
|
+
* the subHeading sits above the scrollable area.
|
|
102
|
+
*/
|
|
103
|
+
subHeadingSize: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* If the modal requires longer text, include it here. This text will become scrollable if it
|
|
107
|
+
* is too long for the allowed height of the modal.
|
|
108
|
+
*/
|
|
109
|
+
bodyText: _propTypes.default.string,
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Text for the button controlling the primary action of the modal.
|
|
113
|
+
*/
|
|
114
|
+
confirmButtonText: _propTypes.default.string,
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Button variant object to be passed through to Button to choose its visual style.
|
|
118
|
+
*/
|
|
119
|
+
confirmButtonVariant: _propTypes.default.object,
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Action on pressing the confirm button.
|
|
123
|
+
*/
|
|
124
|
+
onConfirm: _propTypes.default.func,
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Text for the optional cancel button provided if the user does not want to do the confirm action.
|
|
128
|
+
*/
|
|
129
|
+
cancelButtonText: _propTypes.default.string,
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Component to use for the cancel button (default: `TextButton`). Should accept similar props to `TextButton`.
|
|
133
|
+
*/
|
|
134
|
+
cancelButtonType: _propTypes.default.elementType,
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Action to perform on pressing the cancel button. Defaults to `onClose` action if undefined.
|
|
138
|
+
*/
|
|
139
|
+
onCancel: _propTypes.default.func
|
|
140
|
+
};
|
|
141
|
+
var _default = Modal;
|
|
142
|
+
exports.default = _default;
|
|
@@ -0,0 +1,195 @@
|
|
|
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 _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
+
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
/* eslint-disable react/jsx-filename-extension */
|
|
25
|
+
const StyledModalContent = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
26
|
+
displayName: "ModalContent__StyledModalContent",
|
|
27
|
+
componentId: "components-web__sc-k40cwb-0"
|
|
28
|
+
})(["display:flex;flex-direction:column;min-height:100%;"]);
|
|
29
|
+
|
|
30
|
+
const StyledHeading = /*#__PURE__*/_styledComponents.default.header.withConfig({
|
|
31
|
+
displayName: "ModalContent__StyledHeading",
|
|
32
|
+
componentId: "components-web__sc-k40cwb-1"
|
|
33
|
+
})(["display:flex;flex-direction:column;padding-right:", "px;"], _ref => {
|
|
34
|
+
let {
|
|
35
|
+
paddingRight
|
|
36
|
+
} = _ref;
|
|
37
|
+
return paddingRight;
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const StyledSubHeading = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
41
|
+
displayName: "ModalContent__StyledSubHeading",
|
|
42
|
+
componentId: "components-web__sc-k40cwb-2"
|
|
43
|
+
})(["margin-top:", "px;"], _ref2 => {
|
|
44
|
+
let {
|
|
45
|
+
marginTop
|
|
46
|
+
} = _ref2;
|
|
47
|
+
return marginTop;
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const StyledFooter = /*#__PURE__*/_styledComponents.default.footer.withConfig({
|
|
51
|
+
displayName: "ModalContent__StyledFooter",
|
|
52
|
+
componentId: "components-web__sc-k40cwb-3"
|
|
53
|
+
})(_ref3 => {
|
|
54
|
+
let {
|
|
55
|
+
hasBorder,
|
|
56
|
+
viewport,
|
|
57
|
+
paddingLeft,
|
|
58
|
+
paddingRight,
|
|
59
|
+
paddingTop,
|
|
60
|
+
marginLeft,
|
|
61
|
+
marginRight,
|
|
62
|
+
borderColor,
|
|
63
|
+
gap
|
|
64
|
+
} = _ref3;
|
|
65
|
+
return {
|
|
66
|
+
display: 'flex',
|
|
67
|
+
flexDirection: viewport === 'xs' || viewport === 'sm' ? 'column' : 'row',
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
gap: `${gap}px`,
|
|
70
|
+
marginLeft: `calc(-1 * ${marginLeft}px)`,
|
|
71
|
+
marginRight: `calc(-1 * ${marginRight}px)`,
|
|
72
|
+
paddingLeft: `${paddingLeft}px`,
|
|
73
|
+
paddingRight: `${paddingRight}px`,
|
|
74
|
+
paddingTop: `${paddingTop}px`,
|
|
75
|
+
borderTop: hasBorder ? `1px solid ${borderColor}` : 'none'
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const ModalContent = _ref4 => {
|
|
80
|
+
let {
|
|
81
|
+
heading,
|
|
82
|
+
headingLevel = 'h3',
|
|
83
|
+
subHeading,
|
|
84
|
+
subHeadingSize = 'medium',
|
|
85
|
+
bodyText,
|
|
86
|
+
confirmButtonText,
|
|
87
|
+
confirmButtonVariant = {
|
|
88
|
+
priority: 'high'
|
|
89
|
+
},
|
|
90
|
+
onConfirm,
|
|
91
|
+
tokens,
|
|
92
|
+
variant,
|
|
93
|
+
cancelButtonText,
|
|
94
|
+
cancelButtonType: CancelButton = _componentsBase.TextButton,
|
|
95
|
+
onCancel
|
|
96
|
+
} = _ref4;
|
|
97
|
+
const {
|
|
98
|
+
headingColor,
|
|
99
|
+
cancelButtonColor,
|
|
100
|
+
...themeTokens
|
|
101
|
+
} = (0, _componentsBase.useThemeTokens)('Modal', tokens, variant);
|
|
102
|
+
const [scrollContainerHeight, setScrollContainerHeight] = (0, _react.useState)(0);
|
|
103
|
+
const [scrollContentHeight, setScrollContentHeight] = (0, _react.useState)(0);
|
|
104
|
+
const viewport = (0, _componentsBase.useViewport)();
|
|
105
|
+
|
|
106
|
+
const handleContainerLayout = _ref5 => {
|
|
107
|
+
let {
|
|
108
|
+
nativeEvent: {
|
|
109
|
+
layout: {
|
|
110
|
+
height
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
} = _ref5;
|
|
114
|
+
return setScrollContainerHeight(height);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const onContentSizeChange = (_, height) => setScrollContentHeight(height);
|
|
118
|
+
|
|
119
|
+
const isContentOverflowing = scrollContentHeight > scrollContainerHeight;
|
|
120
|
+
const hasConfirmButton = confirmButtonText !== undefined && onConfirm !== undefined;
|
|
121
|
+
const hasCancelButton = cancelButtonText !== undefined && onCancel !== undefined;
|
|
122
|
+
const hasHeadingSection = Boolean(heading || subHeading);
|
|
123
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledModalContent, {
|
|
124
|
+
children: [hasHeadingSection && /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledHeading, {
|
|
125
|
+
paddingRight: themeTokens.headingPaddingRight,
|
|
126
|
+
children: [heading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
127
|
+
variant: {
|
|
128
|
+
size: headingLevel
|
|
129
|
+
},
|
|
130
|
+
tokens: {
|
|
131
|
+
color: headingColor
|
|
132
|
+
},
|
|
133
|
+
heading: headingLevel,
|
|
134
|
+
children: heading
|
|
135
|
+
}), subHeading && /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledSubHeading, {
|
|
136
|
+
marginTop: themeTokens.subHeadingMarginTop,
|
|
137
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
138
|
+
variant: {
|
|
139
|
+
size: subHeadingSize
|
|
140
|
+
},
|
|
141
|
+
children: subHeading
|
|
142
|
+
})
|
|
143
|
+
}), Boolean(bodyText && hasHeadingSection) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Spacer, {
|
|
144
|
+
space: 3
|
|
145
|
+
})]
|
|
146
|
+
}), bodyText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Box, {
|
|
147
|
+
scroll: {
|
|
148
|
+
onContentSizeChange,
|
|
149
|
+
showsVerticalScrollIndicator: true
|
|
150
|
+
},
|
|
151
|
+
onLayout: handleContainerLayout,
|
|
152
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
153
|
+
children: bodyText
|
|
154
|
+
})
|
|
155
|
+
}), (hasConfirmButton || hasCancelButton) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledFooter, { ...themeTokens,
|
|
156
|
+
hasBorder: isContentOverflowing,
|
|
157
|
+
viewport: viewport,
|
|
158
|
+
children: [hasConfirmButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Button, {
|
|
159
|
+
variant: confirmButtonVariant,
|
|
160
|
+
tokens: {
|
|
161
|
+
width: viewport === 'xs' || viewport === 'sm' ? '100%' : undefined
|
|
162
|
+
},
|
|
163
|
+
onPress: onConfirm,
|
|
164
|
+
children: confirmButtonText
|
|
165
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
166
|
+
children: hasCancelButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(CancelButton, {
|
|
167
|
+
tokens: {
|
|
168
|
+
color: cancelButtonColor
|
|
169
|
+
},
|
|
170
|
+
onPress: onCancel,
|
|
171
|
+
children: cancelButtonText
|
|
172
|
+
})
|
|
173
|
+
})]
|
|
174
|
+
})]
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
ModalContent.propTypes = {
|
|
179
|
+
tokens: _propTypes.default.object,
|
|
180
|
+
variant: _propTypes.default.object,
|
|
181
|
+
heading: _propTypes.default.string,
|
|
182
|
+
headingLevel: _propTypes.default.oneOf(['h3', 'h4']),
|
|
183
|
+
subHeading: _propTypes.default.string,
|
|
184
|
+
subHeadingSize: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
185
|
+
bodyText: _propTypes.default.string,
|
|
186
|
+
confirmButtonText: _propTypes.default.string,
|
|
187
|
+
confirmButtonVariant: _propTypes.default.object,
|
|
188
|
+
onConfirm: _propTypes.default.func,
|
|
189
|
+
cancelButtonText: _propTypes.default.string,
|
|
190
|
+
cancelButtonType: _propTypes.default.elementType,
|
|
191
|
+
// TODO: figure out a way of passing an icon to the TextButton
|
|
192
|
+
onCancel: _propTypes.default.func
|
|
193
|
+
};
|
|
194
|
+
var _default = ModalContent;
|
|
195
|
+
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 _Modal = _interopRequireDefault(require("./Modal"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = _Modal.default;
|
|
13
|
+
exports.default = _default;
|
|
@@ -60,7 +60,11 @@ const FullBleedOffsetInner = /*#__PURE__*/_styledComponents.default.div.withConf
|
|
|
60
60
|
|
|
61
61
|
const defaultTokens = {
|
|
62
62
|
minWidth: 0,
|
|
63
|
-
shadow: null
|
|
63
|
+
shadow: null,
|
|
64
|
+
contentAlignItems: 'stretch',
|
|
65
|
+
contentJustifyContent: 'flex-start',
|
|
66
|
+
contentFlexGrow: 0,
|
|
67
|
+
contentFlexShrink: 0
|
|
64
68
|
};
|
|
65
69
|
/**
|
|
66
70
|
* Showcase and guide users to another page, with a preview containing title and a footer.
|
|
@@ -0,0 +1,29 @@
|
|
|
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 _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
const Body = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
children
|
|
19
|
+
} = _ref;
|
|
20
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("tbody", {
|
|
21
|
+
children: children
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
Body.propTypes = {
|
|
26
|
+
children: _propTypes.default.node
|
|
27
|
+
};
|
|
28
|
+
var _default = Body;
|
|
29
|
+
exports.default = _default;
|