@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.
Files changed (64) hide show
  1. package/CHANGELOG.md +25 -2
  2. package/lib/Image/Image.js +126 -0
  3. package/lib/Image/index.js +13 -0
  4. package/lib/Modal/Modal.js +142 -0
  5. package/lib/Modal/ModalContent.js +195 -0
  6. package/lib/Modal/index.js +13 -0
  7. package/lib/Paragraph/Paragraph.js +107 -0
  8. package/lib/Paragraph/index.js +13 -0
  9. package/lib/Table/Body.js +29 -0
  10. package/lib/Table/Cell.js +200 -0
  11. package/lib/Table/Header.js +39 -0
  12. package/lib/Table/Row.js +35 -0
  13. package/lib/Table/SubHeading.js +37 -0
  14. package/lib/Table/Table.js +121 -0
  15. package/lib/Table/index.js +28 -0
  16. package/lib/Toast/Toast.js +136 -0
  17. package/lib/Toast/index.js +13 -0
  18. package/lib/WaffleGrid/WaffleGrid.js +176 -0
  19. package/lib/WaffleGrid/index.js +13 -0
  20. package/lib/baseExports.js +0 -6
  21. package/lib/index.js +55 -1
  22. package/lib-module/Image/Image.js +108 -0
  23. package/lib-module/Image/index.js +2 -0
  24. package/lib-module/Modal/Modal.js +128 -0
  25. package/lib-module/Modal/ModalContent.js +174 -0
  26. package/lib-module/Modal/index.js +2 -0
  27. package/lib-module/Paragraph/Paragraph.js +89 -0
  28. package/lib-module/Paragraph/index.js +2 -0
  29. package/lib-module/Table/Body.js +17 -0
  30. package/lib-module/Table/Cell.js +176 -0
  31. package/lib-module/Table/Header.js +22 -0
  32. package/lib-module/Table/Row.js +19 -0
  33. package/lib-module/Table/SubHeading.js +20 -0
  34. package/lib-module/Table/Table.js +93 -0
  35. package/lib-module/Table/index.js +12 -0
  36. package/lib-module/Toast/Toast.js +117 -0
  37. package/lib-module/Toast/index.js +2 -0
  38. package/lib-module/WaffleGrid/WaffleGrid.js +155 -0
  39. package/lib-module/WaffleGrid/index.js +2 -0
  40. package/lib-module/baseExports.js +1 -1
  41. package/lib-module/index.js +6 -0
  42. package/package.json +4 -3
  43. package/src/Image/Image.jsx +95 -0
  44. package/src/Image/index.js +3 -0
  45. package/src/Modal/Modal.jsx +111 -0
  46. package/src/Modal/ModalContent.jsx +161 -0
  47. package/src/Modal/index.js +3 -0
  48. package/src/Paragraph/Paragraph.jsx +79 -0
  49. package/src/Paragraph/index.js +3 -0
  50. package/src/Table/Body.jsx +12 -0
  51. package/src/Table/Cell.jsx +148 -0
  52. package/src/Table/Header.jsx +17 -0
  53. package/src/Table/Row.jsx +18 -0
  54. package/src/Table/SubHeading.jsx +17 -0
  55. package/src/Table/Table.jsx +90 -0
  56. package/src/Table/index.js +14 -0
  57. package/src/Toast/Toast.jsx +151 -0
  58. package/src/Toast/index.js +3 -0
  59. package/src/WaffleGrid/WaffleGrid.jsx +137 -0
  60. package/src/WaffleGrid/index.js +3 -0
  61. package/src/baseExports.js +0 -1
  62. package/src/index.js +6 -0
  63. package/types/Cell.d.ts +13 -0
  64. package/types/Table.d.ts +12 -0
@@ -0,0 +1,117 @@
1
+ var _withLinkRouter$propT, _withLinkRouter$propT2;
2
+
3
+ import React from 'react';
4
+ import PropTypes from 'prop-types';
5
+ import { ChevronLink, selectSystemProps, useThemeTokens, Typography, withLinkRouter } from '@telus-uds/components-base';
6
+ import styled, { keyframes, css } from 'styled-components';
7
+ import { htmlAttrs } from '../utils';
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ import { jsxs as _jsxs } from "react/jsx-runtime";
10
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
11
+
12
+ const transform = property => (from, to) => keyframes(["from{", ":", ";}to{", ":", ";}"], property, from, property, to);
13
+
14
+ const slideDown = property => function (from, to) {
15
+ let end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : to;
16
+ return keyframes(["0%{", ":", ";}99%{", ":", ";}100%{", ":", ";}"], property, from, property, to, property, end);
17
+ };
18
+
19
+ const animation = props => css(["", " 1s ease-in-out 2s forwards,", " 1s ease-in-out 2s forwards,", " 1s ease-in-out 2s forwards,", " 1s ease-in-out 3.2s forwards;& *{animation:", " 1s ease-in-out 3s forwards;}& > a div{animation:", " 1s ease-in-out 3s forwards;}& > a svg{animation:", " 1s ease-in-out 3s forwards;}"], slideDown('height')(`${props.animationHeightBefore}px`, `${props.animationHeightAfter}px`, 'auto'), transform('padding-bottom')(`${props.animationPaddingBottomBefore}px`, `${props.animationPaddingBottomAfter}px`), transform('padding-top')(`${props.animationPaddingTopBefore}px`, `${props.animationPaddingTopAfter}px`), transform('background')(props.animationBackgroundColorBefore, props.animationBackgroundColorAfter), transform('color')(props.animationColorBefore, props.animationColorAfter), transform('color')(props.animationDivColorBefore, props.animationDivColorAfter), transform('fill')(props.animationFillColorBefore, props.animationFillColorAfter));
20
+
21
+ const ToastContainer = /*#__PURE__*/styled.div.withConfig({
22
+ displayName: "Toast__ToastContainer",
23
+ componentId: "components-web__sc-p78jdh-0"
24
+ })(["display:flex;justify-content:center;background:", ";gap:", ";height:0;overflow:hidden;animation:", ";"], _ref => {
25
+ let {
26
+ containerBackgroundColor
27
+ } = _ref;
28
+ return containerBackgroundColor;
29
+ }, _ref2 => {
30
+ let {
31
+ containerGap
32
+ } = _ref2;
33
+ return containerGap;
34
+ }, animation);
35
+
36
+ const Toast = _ref3 => {
37
+ let {
38
+ toast,
39
+ copy,
40
+ headline,
41
+ link,
42
+ tokens,
43
+ variant = {},
44
+ ...rest
45
+ } = _ref3;
46
+ const {
47
+ containerBackgroundColor,
48
+ containerGap,
49
+ animationHeightBefore,
50
+ animationHeightAfter,
51
+ animationPaddingBottomBefore,
52
+ animationPaddingBottomAfter,
53
+ animationPaddingTopBefore,
54
+ animationPaddingTopAfter,
55
+ animationBackgroundColorBefore,
56
+ animationBackgroundColorAfter,
57
+ animationColorBefore,
58
+ animationColorAfter,
59
+ animationFillColorBefore,
60
+ animationFillColorAfter
61
+ } = useThemeTokens('Toast', tokens, variant);
62
+
63
+ if (!toast) {
64
+ return null;
65
+ }
66
+
67
+ return /*#__PURE__*/_jsxs(ToastContainer, {
68
+ containerBackgroundColor: containerBackgroundColor,
69
+ containerGap: containerGap,
70
+ animationHeightBefore: animationHeightBefore,
71
+ animationHeightAfter: animationHeightAfter,
72
+ animationPaddingBottomBefore: animationPaddingBottomBefore,
73
+ animationPaddingBottomAfter: animationPaddingBottomAfter,
74
+ animationPaddingTopBefore: animationPaddingTopBefore,
75
+ animationPaddingTopAfter: animationPaddingTopAfter,
76
+ animationBackgroundColorBefore: animationBackgroundColorBefore,
77
+ animationBackgroundColorAfter: animationBackgroundColorAfter,
78
+ animationColorBefore: animationColorBefore,
79
+ animationColorAfter: animationColorAfter,
80
+ animationFillColorBefore: animationFillColorBefore,
81
+ animationFillColorAfter: animationFillColorAfter,
82
+ ...selectProps(rest),
83
+ children: [headline && /*#__PURE__*/_jsx(Typography, {
84
+ variant: {
85
+ bold: true,
86
+ inverse: true
87
+ },
88
+ children: headline
89
+ }), /*#__PURE__*/_jsx(Typography, {
90
+ variant: {
91
+ inverse: true
92
+ },
93
+ children: copy
94
+ }), link && /*#__PURE__*/_jsx(ChevronLink, {
95
+ variant: {
96
+ inverse: true
97
+ },
98
+ href: link.href,
99
+ LinkRouter: link.LinkRouter,
100
+ linkRouterProps: link.linkRouterProps,
101
+ children: link.text
102
+ })]
103
+ });
104
+ };
105
+
106
+ Toast.propTypes = { ...selectedSystemPropTypes,
107
+ toast: PropTypes.bool,
108
+ copy: PropTypes.string.isRequired,
109
+ headline: PropTypes.string,
110
+ link: PropTypes.shape({
111
+ href: PropTypes.string.isRequired,
112
+ text: PropTypes.string.isRequired,
113
+ LinkRouter: (_withLinkRouter$propT = withLinkRouter.propTypes) === null || _withLinkRouter$propT === void 0 ? void 0 : _withLinkRouter$propT.LinkRouter,
114
+ linkRouterProps: (_withLinkRouter$propT2 = withLinkRouter.propTypes) === null || _withLinkRouter$propT2 === void 0 ? void 0 : _withLinkRouter$propT2.linkRouterProps
115
+ })
116
+ };
117
+ export default Toast;
@@ -0,0 +1,2 @@
1
+ import Toast from './Toast';
2
+ export default Toast;
@@ -0,0 +1,155 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styled from 'styled-components';
4
+ import { Link, responsiveProps, selectSystemProps, useResponsiveProp, useThemeTokens, withLinkRouter } from '@telus-uds/components-base';
5
+ import OrderedListBase from '../OrderedList/OrderedListBase';
6
+ import ItemBase from '../OrderedList/ItemBase';
7
+ import Image from '../Image';
8
+ import { htmlAttrs } from '../utils';
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
+ import { createElement as _createElement } from "react";
12
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
13
+ const DEFAULT_ROW_SIZE = {
14
+ sm: 2,
15
+ lg: 3,
16
+ xl: 6
17
+ };
18
+
19
+ const row = (rowSize, rowBorderSize) => ({
20
+ flexBasis: `calc(100% / ${rowSize})`,
21
+ [`:not(:nth-of-type(${rowSize}n + 1))`]: {
22
+ borderLeftWidth: `${rowBorderSize}px`
23
+ },
24
+ [`:nth-of-type(n+${rowSize + 1})`]: {
25
+ borderTopWidth: `${rowBorderSize}px`
26
+ }
27
+ });
28
+
29
+ const Container = /*#__PURE__*/styled(OrderedListBase).withConfig({
30
+ displayName: "WaffleGrid__Container",
31
+ componentId: "components-web__sc-ec8g0a-0"
32
+ })({
33
+ display: 'flex',
34
+ flexDirection: 'row',
35
+ flexWrap: 'wrap',
36
+ justifyContent: 'flex-start'
37
+ });
38
+ const Item = /*#__PURE__*/styled(ItemBase).withConfig({
39
+ displayName: "WaffleGrid__Item",
40
+ componentId: "components-web__sc-ec8g0a-1"
41
+ })(_ref => {
42
+ let {
43
+ rowSize,
44
+ itemPadding,
45
+ itemBorderColor,
46
+ rowBorderWidth
47
+ } = _ref;
48
+ return {
49
+ display: 'flex',
50
+ flexDirection: 'column',
51
+ flexGrow: 0,
52
+ flexShrink: 0,
53
+ padding: `${itemPadding}px`,
54
+ boxSizing: 'border-box',
55
+ borderStyle: 'solid',
56
+ borderColor: itemBorderColor,
57
+ borderWidth: 0,
58
+ '& > a': {
59
+ alignSelf: 'center'
60
+ },
61
+ ...row(rowSize, rowBorderWidth)
62
+ };
63
+ });
64
+ const Center = /*#__PURE__*/styled('div').withConfig({
65
+ displayName: "WaffleGrid__Center",
66
+ componentId: "components-web__sc-ec8g0a-2"
67
+ })({
68
+ display: 'flex',
69
+ flexDirection: 'column',
70
+ alignItems: 'center',
71
+ textAlign: 'center'
72
+ });
73
+ /**
74
+ * The WaffleGrid is used to show items in a waffle like manner with borders surrounding the element
75
+ */
76
+
77
+ const WaffleGrid = _ref2 => {
78
+ let {
79
+ items,
80
+ rowSize = DEFAULT_ROW_SIZE,
81
+ LinkRouter,
82
+ tokens,
83
+ variant,
84
+ linkRouterProps,
85
+ ...rest
86
+ } = _ref2;
87
+ const themeTokens = useThemeTokens('WaffleGrid', tokens, variant);
88
+ const currentRowSize = useResponsiveProp(rowSize);
89
+ return /*#__PURE__*/_jsx(Container, { ...selectProps(rest),
90
+ children: items.map(child => /*#__PURE__*/_createElement(Item, { ...themeTokens,
91
+ key: child.href,
92
+ rowSize: currentRowSize
93
+ }, /*#__PURE__*/_jsx(Link, {
94
+ href: child.href,
95
+ variant: {
96
+ alternative: true
97
+ },
98
+ LinkRouter: child.LinkRouter || LinkRouter,
99
+ linkRouterProps: { ...linkRouterProps,
100
+ ...child.linkRouterProps
101
+ },
102
+ children: /*#__PURE__*/_jsxs(Center, {
103
+ children: [typeof child.image === 'string' ?
104
+ /*#__PURE__*/
105
+ // Assuming that string passed is the image URL
106
+ _jsx(Image, {
107
+ src: child.image,
108
+ alt: child.imageAltText,
109
+ width: 64,
110
+ height: 64
111
+ }) : // Otherwise it must be an arbitrary content, which we just display by itself
112
+ child.image, /*#__PURE__*/_jsx("span", {
113
+ children: child.text
114
+ })]
115
+ })
116
+ })))
117
+ });
118
+ };
119
+
120
+ WaffleGrid.propTypes = { ...selectedSystemPropTypes,
121
+
122
+ /**
123
+ * The image and the link to display. `items` should be an array of objects with the following keys:
124
+ */
125
+ items: PropTypes.arrayOf(PropTypes.shape({
126
+ /**
127
+ * The src attribute for the HTML img element or custom JSX content to render instead
128
+ */
129
+ image: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
130
+
131
+ /**
132
+ * The alt attribute for the HTML img element (note that this is ignored if a custom
133
+ * JSX content is used instead of an image URL)
134
+ */
135
+ imageAltText: PropTypes.string,
136
+
137
+ /**
138
+ * The text displayed under the image
139
+ */
140
+ text: PropTypes.string,
141
+
142
+ /**
143
+ * Target URL
144
+ */
145
+ href: PropTypes.string,
146
+ ...withLinkRouter.propTypes
147
+ })).isRequired,
148
+
149
+ /**
150
+ * Row size, optionally depending on the viewport
151
+ */
152
+ rowSize: responsiveProps.getTypeOptionallyByViewport(PropTypes.number),
153
+ ...withLinkRouter.propTypes
154
+ };
155
+ export default WaffleGrid;
@@ -0,0 +1,2 @@
1
+ import WaffleGrid from './WaffleGrid';
2
+ export default WaffleGrid;
@@ -5,7 +5,7 @@ export {
5
5
  /**
6
6
  * Most base components should be re-exported as-is.
7
7
  */
8
- A11yText, ActivityIndicator, Box, Button, BaseProvider, A11yInfoProvider, ViewportProvider, ThemeProvider, ButtonDropdown, ButtonGroup, ButtonLink, Carousel, Card, CarouselTabs, Checkbox, CheckboxGroup, ChevronLink, Divider, ExpandCollapse, Feedback, FlexGrid, Icon, IconButton, InputLabel, InputSupports, Link, Modal, MultiSelectFilter, Notification, Pagination, QuickLinks, QuickLinksFeature, Radio, RadioGroup, RadioCard, RadioCardGroup, Responsive, Search, Select, SideNav, Skeleton, SkipLink, Spacer, StackView, StackWrap, StepTracker, Tabs, Tags, TextButton, TextArea, TextInput, Timeline, ToggleSwitch, ToggleSwitchGroup, TooltipButton, Tooltip, Typography,
8
+ A11yText, ActivityIndicator, Box, Button, BaseProvider, A11yInfoProvider, ViewportProvider, ThemeProvider, ButtonDropdown, ButtonGroup, ButtonLink, Carousel, Card, CarouselTabs, Checkbox, CheckboxGroup, ChevronLink, Divider, ExpandCollapse, Feedback, FlexGrid, Icon, IconButton, InputLabel, InputSupports, Link, MultiSelectFilter, Notification, Pagination, QuickLinks, QuickLinksFeature, Radio, RadioGroup, RadioCard, RadioCardGroup, Responsive, Search, Select, SideNav, Skeleton, SkipLink, Spacer, StackView, StackWrap, StepTracker, Tabs, Tags, TextButton, TextArea, TextInput, Timeline, ToggleSwitch, ToggleSwitchGroup, TooltipButton, Tooltip, Typography,
9
9
  /*
10
10
  * Most utilities exported from @telus-uds/components-base are for building systems, not apps.
11
11
  * Re-export only those utilities with a stable API and known use cases within apps / pages.
@@ -1,9 +1,11 @@
1
1
  export { default as Badge } from './Badge';
2
+ export { default as Modal } from './Modal';
2
3
  export { default as OrderedList } from './OrderedList';
3
4
  export { default as PreviewCard } from './PreviewCard';
4
5
  export { default as ResponsiveImage } from './ResponsiveImage';
5
6
  export { default as Ribbon } from './Ribbon';
6
7
  export { default as DatePicker } from './DatePicker';
8
+ export { default as Paragraph } from './Paragraph';
7
9
  export { default as Span } from './Span';
8
10
  export { default as ExpandCollapseMini } from './ExpandCollapseMini';
9
11
  export { default as Callout } from './Callout';
@@ -11,4 +13,8 @@ export { default as PriceLockup } from './PriceLockup';
11
13
  export { default as Footnote } from './Footnote';
12
14
  export { transformGradient } from './utils';
13
15
  export { default as Breadcrumbs } from './Breadcrumbs';
16
+ export { default as Toast } from './Toast';
17
+ export { default as Table } from './Table';
18
+ export { default as Image } from './Image';
19
+ export { default as WaffleGrid } from './WaffleGrid';
14
20
  export * from './baseExports';
package/package.json CHANGED
@@ -5,13 +5,14 @@
5
5
  ],
6
6
  "dependencies": {
7
7
  "@gorhom/portal": "^1.0.14",
8
- "@telus-uds/components-base": "1.34.0",
8
+ "@telus-uds/components-base": "1.34.2",
9
9
  "@telus-uds/system-constants": "^1.2.0",
10
10
  "react-dates": "^21.8.0",
11
11
  "react-moment-proptypes": "^1.8.1",
12
- "@telus-uds/system-theme-tokens": "^2.18.0",
12
+ "@telus-uds/system-theme-tokens": "^2.19.0",
13
13
  "prop-types": "^15.7.2",
14
14
  "lodash.omit": "^4.5.0",
15
+ "lodash.throttle": "^4.1.1",
15
16
  "react-helmet-async": "^1.3.0"
16
17
  },
17
18
  "description": "UDS mult-brand web components",
@@ -58,5 +59,5 @@
58
59
  "skip": true
59
60
  },
60
61
  "types": "types/index.d.ts",
61
- "version": "1.4.0"
62
+ "version": "1.6.0"
62
63
  }
@@ -0,0 +1,95 @@
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
+
7
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
8
+
9
+ const StyledImage = styled.img({
10
+ height: 'auto',
11
+ maxWidth: '100%'
12
+ })
13
+ const StyledRoundedImage = styled(StyledImage)`
14
+ border-radius: ${({ borderRadius }) => borderRadius}px;
15
+ `
16
+ const StyledCircularImage = styled(StyledImage)({
17
+ borderRadius: '50%'
18
+ })
19
+
20
+ const Image = ({
21
+ src,
22
+ width,
23
+ height,
24
+ alt,
25
+ rounded,
26
+ loading = 'eager',
27
+ tokens,
28
+ variant,
29
+ ...rest
30
+ }) => {
31
+ const { borderRadius } = useThemeTokens('Image', tokens, variant)
32
+ const isCircle = rounded === 'circle'
33
+ const isCorners = rounded === 'corners'
34
+ const isSquare = width === height
35
+
36
+ if (isCircle && !isSquare) {
37
+ warn(
38
+ 'Image',
39
+ 'rounded="circle" is not supported for non-square images. Please provide a square image, otherwise the resulting shape will not be a circle.'
40
+ )
41
+ }
42
+
43
+ let ImageComponent
44
+ if (isCircle) {
45
+ ImageComponent = StyledCircularImage
46
+ } else if (isCorners) {
47
+ ImageComponent = StyledRoundedImage
48
+ } else {
49
+ ImageComponent = StyledImage
50
+ }
51
+
52
+ return (
53
+ <ImageComponent
54
+ {...selectProps(rest)}
55
+ borderRadius={borderRadius}
56
+ src={src}
57
+ width={width}
58
+ height={height}
59
+ alt={alt}
60
+ loading={loading}
61
+ />
62
+ )
63
+ }
64
+
65
+ Image.propTypes = {
66
+ ...selectedSystemPropTypes,
67
+ /**
68
+ * The src attribute for the HTML img element.
69
+ */
70
+ src: PropTypes.string.isRequired,
71
+ /**
72
+ * 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.
73
+ */
74
+ alt: PropTypes.string.isRequired,
75
+ /**
76
+ * The image's width.
77
+ */
78
+ width: PropTypes.number.isRequired,
79
+ /**
80
+ * The image's height.
81
+ */
82
+ height: PropTypes.number.isRequired,
83
+ /**
84
+ * Loading strategy.
85
+ * @default 'eager'
86
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading
87
+ */
88
+ loading: PropTypes.oneOf(['eager', 'lazy']),
89
+ /**
90
+ * Make image render as a circle or with rounded corners.
91
+ */
92
+ rounded: PropTypes.oneOf(['circle', 'corners'])
93
+ }
94
+
95
+ export default Image
@@ -0,0 +1,3 @@
1
+ import Image from './Image'
2
+
3
+ export default Image
@@ -0,0 +1,111 @@
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
+
6
+ const Modal = ({
7
+ isOpen,
8
+ onClose,
9
+ maxWidth,
10
+ onCancel = onClose,
11
+ onConfirm,
12
+ heading,
13
+ headingLevel,
14
+ subHeading,
15
+ subHeadingSize,
16
+ bodyText,
17
+ tokens,
18
+ variant = {},
19
+ confirmButtonText,
20
+ confirmButtonVariant,
21
+ cancelButtonText,
22
+ cancelButtonType,
23
+ ...nonContentProps
24
+ }) => {
25
+ return (
26
+ <BaseModal isOpen={isOpen} onClose={onClose} maxWidth={maxWidth} {...nonContentProps}>
27
+ <ModalContent
28
+ tokens={tokens}
29
+ variant={variant}
30
+ onCancel={onCancel}
31
+ onConfirm={onConfirm}
32
+ heading={heading}
33
+ headingLevel={headingLevel}
34
+ subHeading={subHeading}
35
+ subHeadingSize={subHeadingSize}
36
+ bodyText={bodyText}
37
+ confirmButtonText={confirmButtonText}
38
+ confirmButtonVariant={confirmButtonVariant}
39
+ cancelButtonText={cancelButtonText}
40
+ cancelButtonType={cancelButtonType}
41
+ />
42
+ </BaseModal>
43
+ )
44
+ }
45
+
46
+ Modal.propTypes = {
47
+ tokens: PropTypes.object,
48
+ variant: PropTypes.object,
49
+ /**
50
+ * If true, the modal overlay covers the page and the modal content is shown
51
+ */
52
+ isOpen: PropTypes.bool,
53
+ /**
54
+ * Function called on pressing the Modal close "x" button
55
+ */
56
+ onClose: PropTypes.func,
57
+ /**
58
+ * If true, Modal is rendered with the 'maxWidth' appearance applied.
59
+ * Use this for wider content, such as content with long headers.
60
+ */
61
+ maxWidth: PropTypes.bool,
62
+ /**
63
+ * Heading text shown prominently with heading semantic tags.
64
+ */
65
+ heading: PropTypes.string,
66
+ /**
67
+ * Stylistic size and semantic level of the modal heading
68
+ */
69
+ headingLevel: PropTypes.oneOf(['h3', 'h4']),
70
+ /**
71
+ * Short content rendered below the heading. If there is long body content that is scrollable,
72
+ * the subHeading sits above the scrollable area.
73
+ */
74
+ subHeading: PropTypes.string,
75
+ /**
76
+ * Short content rendered below the heading. If there is long body content that is scrollable,
77
+ * the subHeading sits above the scrollable area.
78
+ */
79
+ subHeadingSize: PropTypes.oneOf(['small', 'medium', 'large']),
80
+ /**
81
+ * If the modal requires longer text, include it here. This text will become scrollable if it
82
+ * is too long for the allowed height of the modal.
83
+ */
84
+ bodyText: PropTypes.string,
85
+ /**
86
+ * Text for the button controlling the primary action of the modal.
87
+ */
88
+ confirmButtonText: PropTypes.string,
89
+ /**
90
+ * Button variant object to be passed through to Button to choose its visual style.
91
+ */
92
+ confirmButtonVariant: PropTypes.object,
93
+ /**
94
+ * Action on pressing the confirm button.
95
+ */
96
+ onConfirm: PropTypes.func,
97
+ /**
98
+ * Text for the optional cancel button provided if the user does not want to do the confirm action.
99
+ */
100
+ cancelButtonText: PropTypes.string,
101
+ /**
102
+ * Component to use for the cancel button (default: `TextButton`). Should accept similar props to `TextButton`.
103
+ */
104
+ cancelButtonType: PropTypes.elementType,
105
+ /**
106
+ * Action to perform on pressing the cancel button. Defaults to `onClose` action if undefined.
107
+ */
108
+ onCancel: PropTypes.func
109
+ }
110
+
111
+ export default Modal