@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,200 @@
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 = _interopRequireWildcard(require("styled-components"));
13
+
14
+ var _componentsBase = require("@telus-uds/components-base");
15
+
16
+ var _Table = require("./Table");
17
+
18
+ var _jsxRuntime = require("react/jsx-runtime");
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
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
+
26
+ const stickyStyles = /*#__PURE__*/(0, _styledComponents.css)(["position:sticky;left:0;z-index:2;clip-path:inset(0 -8px 0 0);&::before{content:'';box-shadow:", ";position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;}"], _ref => {
27
+ let {
28
+ cellStickyShadow
29
+ } = _ref;
30
+ return cellStickyShadow;
31
+ });
32
+ const sharedStyles = /*#__PURE__*/(0, _styledComponents.css)(["", ""], _ref2 => {
33
+ let {
34
+ isSticky,
35
+ cellBoxShadowColor,
36
+ align,
37
+ cellPaddingTop,
38
+ cellPaddingRight,
39
+ cellPaddingBottom,
40
+ cellPaddingLeft
41
+ } = _ref2;
42
+ return (0, _styledComponents.css)(["", ";box-shadow:inset 0 -1px 0 ", ";text-align:", ";padding:", "px ", "px ", "px ", "px;"], isSticky ? stickyStyles : undefined, cellBoxShadowColor, align, cellPaddingTop, cellPaddingRight, cellPaddingBottom, cellPaddingLeft);
43
+ });
44
+
45
+ const StyledHeading = /*#__PURE__*/_styledComponents.default.th.withConfig({
46
+ displayName: "Cell__StyledHeading",
47
+ componentId: "components-web__sc-ltgfic-0"
48
+ })(["", ";", ""], sharedStyles, _ref3 => {
49
+ let {
50
+ cellHeadingBackground,
51
+ cellHeadingBoxShadowColor
52
+ } = _ref3;
53
+ return `
54
+ background-color: ${cellHeadingBackground};
55
+ box-shadow: inset 0 1px 0 ${cellHeadingBoxShadowColor}, inset 0 -1px 0 ${cellHeadingBoxShadowColor};`;
56
+ });
57
+
58
+ const StyledSubHeading = /*#__PURE__*/_styledComponents.default.th.withConfig({
59
+ displayName: "Cell__StyledSubHeading",
60
+ componentId: "components-web__sc-ltgfic-1"
61
+ })(["", ";background-color:", ";"], sharedStyles, _ref4 => {
62
+ let {
63
+ cellSubheadingBackground
64
+ } = _ref4;
65
+ return cellSubheadingBackground;
66
+ });
67
+
68
+ const StyledCell = /*#__PURE__*/_styledComponents.default.td.withConfig({
69
+ displayName: "Cell__StyledCell",
70
+ componentId: "components-web__sc-ltgfic-2"
71
+ })(["", ";background-color:", ";"], sharedStyles, _ref5 => {
72
+ let {
73
+ cellBackground
74
+ } = _ref5;
75
+ return cellBackground;
76
+ });
77
+
78
+ const StyledRowHeading = /*#__PURE__*/_styledComponents.default.th.withConfig({
79
+ displayName: "Cell__StyledRowHeading",
80
+ componentId: "components-web__sc-ltgfic-3"
81
+ })(["", ";background-color:", ";"], sharedStyles, _ref6 => {
82
+ let {
83
+ cellRowHeadingBackground
84
+ } = _ref6;
85
+ return cellRowHeadingBackground;
86
+ });
87
+
88
+ const Cell = _ref7 => {
89
+ let {
90
+ children,
91
+ type = 'default',
92
+ isFirstInRow,
93
+ align = 'left'
94
+ } = _ref7;
95
+ const {
96
+ text,
97
+ isScrollable: isTableScrollable,
98
+ variant,
99
+ tokens
100
+ } = (0, _Table.useTableContext)();
101
+ const {
102
+ cellHeadingBackground,
103
+ cellHeadingBoxShadowColor,
104
+ cellBoxShadowColor,
105
+ cellSubheadingBackground,
106
+ cellBackground,
107
+ cellRowHeadingBackground,
108
+ cellStickyShadow,
109
+ cellPaddingTop,
110
+ cellPaddingRight,
111
+ cellPaddingLeft,
112
+ cellPaddingBottom
113
+ } = (0, _componentsBase.useThemeTokens)('Table', tokens, variant);
114
+ const sharedProps = {
115
+ align,
116
+ isSticky: isTableScrollable && isFirstInRow,
117
+ cellStickyShadow,
118
+ cellPaddingTop,
119
+ cellPaddingRight,
120
+ cellPaddingLeft,
121
+ cellPaddingBottom,
122
+ cellBoxShadowColor
123
+ };
124
+
125
+ switch (type) {
126
+ case 'heading':
127
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledHeading, {
128
+ scope: "col",
129
+ cellHeadingBackground: cellHeadingBackground,
130
+ cellHeadingBoxShadowColor: cellHeadingBoxShadowColor,
131
+ ...sharedProps,
132
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
133
+ variant: {
134
+ size: 'h4'
135
+ },
136
+ children: children
137
+ })
138
+ });
139
+
140
+ case 'subHeading':
141
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledSubHeading, {
142
+ scope: "col",
143
+ cellSubheadingBackground: cellSubheadingBackground,
144
+ ...sharedProps,
145
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
146
+ variant: {
147
+ size: 'h5'
148
+ },
149
+ children: children
150
+ })
151
+ });
152
+
153
+ case 'rowHeading':
154
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledRowHeading, {
155
+ scope: "row",
156
+ cellRowHeadingBackground: cellRowHeadingBackground,
157
+ ...sharedProps,
158
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
159
+ variant: {
160
+ size: text === 'small' ? 'h5' : 'h4'
161
+ },
162
+ children: children
163
+ })
164
+ });
165
+
166
+ default:
167
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledCell, {
168
+ cellBackground: cellBackground,
169
+ ...sharedProps,
170
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
171
+ variant: {
172
+ size: text
173
+ },
174
+ children: children
175
+ })
176
+ });
177
+ }
178
+ };
179
+
180
+ Cell.propTypes = {
181
+ children: _propTypes.default.node,
182
+
183
+ /**
184
+ * Defines the visual styles of a cell, and whether it should be a `td` or `th` element
185
+ */
186
+ type: _propTypes.default.oneOf(['default', 'heading', 'subHeading', 'rowHeading']),
187
+
188
+ /**
189
+ * @ignore
190
+ * Used internally for making the first column sticky
191
+ */
192
+ isFirstInRow: _propTypes.default.bool,
193
+
194
+ /**
195
+ * Defines the text alignment within the cell
196
+ */
197
+ align: _propTypes.default.oneOf(['left', 'center', 'right'])
198
+ };
199
+ var _default = Cell;
200
+ exports.default = _default;
@@ -0,0 +1,39 @@
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 _Row = _interopRequireDefault(require("./Row"));
13
+
14
+ var _jsxRuntime = require("react/jsx-runtime");
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ 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); }
19
+
20
+ 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; }
21
+
22
+ const Header = _ref => {
23
+ let {
24
+ children
25
+ } = _ref;
26
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("thead", {
27
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Row.default, {
28
+ children: _react.default.Children.map(children, child => /*#__PURE__*/(0, _react.cloneElement)(child, {
29
+ type: 'heading'
30
+ }))
31
+ })
32
+ });
33
+ };
34
+
35
+ Header.propTypes = {
36
+ children: _propTypes.default.node
37
+ };
38
+ var _default = Header;
39
+ exports.default = _default;
@@ -0,0 +1,35 @@
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 _jsxRuntime = require("react/jsx-runtime");
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ 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); }
17
+
18
+ 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; }
19
+
20
+ const Row = _ref => {
21
+ let {
22
+ children
23
+ } = _ref;
24
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("tr", {
25
+ children: _react.default.Children.map(children, (child, index) => /*#__PURE__*/(0, _react.cloneElement)(child, {
26
+ isFirstInRow: index === 0
27
+ }))
28
+ });
29
+ };
30
+
31
+ Row.propTypes = {
32
+ children: _propTypes.default.node
33
+ };
34
+ var _default = Row;
35
+ exports.default = _default;
@@ -0,0 +1,37 @@
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 _Row = _interopRequireDefault(require("./Row"));
13
+
14
+ var _jsxRuntime = require("react/jsx-runtime");
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ 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); }
19
+
20
+ 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; }
21
+
22
+ const Header = _ref => {
23
+ let {
24
+ children
25
+ } = _ref;
26
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Row.default, {
27
+ children: _react.default.Children.map(children, child => /*#__PURE__*/(0, _react.cloneElement)(child, {
28
+ type: 'subHeading'
29
+ }))
30
+ });
31
+ };
32
+
33
+ Header.propTypes = {
34
+ children: _propTypes.default.node
35
+ };
36
+ var _default = Header;
37
+ exports.default = _default;
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useTableContext = 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 _lodash = _interopRequireDefault(require("lodash.throttle"));
17
+
18
+ var _utils = require("../utils");
19
+
20
+ var _jsxRuntime = require("react/jsx-runtime");
21
+
22
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
+
24
+ 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); }
25
+
26
+ 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; }
27
+
28
+ const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
29
+
30
+ const StyledContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
31
+ displayName: "Table__StyledContainer",
32
+ componentId: "components-web__sc-10d9q3m-0"
33
+ })(["overflow:auto;padding-bottom:", ";"], props => props.isScrollable ? props.tablePaddingBottom : 0);
34
+
35
+ const StyledTable = /*#__PURE__*/_styledComponents.default.table.withConfig({
36
+ displayName: "Table__StyledTable",
37
+ componentId: "components-web__sc-10d9q3m-1"
38
+ })(["margin:0;padding:0;"]);
39
+
40
+ const TableContext = /*#__PURE__*/_react.default.createContext({});
41
+
42
+ const useTableContext = () => (0, _react.useContext)(TableContext);
43
+ /**
44
+ * Use `Table` to display tabular data.
45
+ *
46
+ * - Takes an optional `spacing` variant (compact)
47
+ * - Available in 2 text styles (medium, small)
48
+ * - When `Table` exceeds viewport, the first column becomes sticky, enabling horizontal scrolling
49
+ * - Right-align prices and numbers that display decimal points
50
+ *
51
+ * ### Building up a `Table`
52
+ * - Use `Table.Header` and `Table.Body` as direct children of `Table`
53
+ * - Use `Table.SubHeading` to render an intermediate data heading row
54
+ * - Use `Table.Row` and `Table.Cell` to build up the tabular data
55
+ * - Use `Cell`'s `type` prop to visually mark it as a row heading (`type="rowHeading"`)
56
+ */
57
+
58
+
59
+ exports.useTableContext = useTableContext;
60
+
61
+ const Table = _ref => {
62
+ let {
63
+ children,
64
+ text = 'medium',
65
+ tokens,
66
+ variant,
67
+ ...rest
68
+ } = _ref;
69
+ const {
70
+ tablePaddingBottom
71
+ } = (0, _componentsBase.useThemeTokens)('Table', tokens, variant);
72
+ const containerRef = (0, _react.useRef)();
73
+ const tableRef = (0, _react.useRef)();
74
+ const [containerWidth, setContainerWidth] = (0, _react.useState)(0);
75
+ const [tableWidth, setTableWidth] = (0, _react.useState)(0);
76
+ (0, _componentsBase.useSafeLayoutEffect)(() => {
77
+ const updateDimensions = () => {
78
+ setContainerWidth(containerRef.current.clientWidth);
79
+ setTableWidth(tableRef.current.clientWidth);
80
+ };
81
+
82
+ const throttledUpdateDimensions = (0, _lodash.default)(updateDimensions, 100, {
83
+ leading: false
84
+ });
85
+ updateDimensions(); // a pretty naive way of repeating the measurement after the fonts are loaded
86
+
87
+ window.addEventListener('load', updateDimensions);
88
+ window.addEventListener('resize', throttledUpdateDimensions);
89
+ return () => {
90
+ window.removeEventListener('load', updateDimensions);
91
+ window.removeEventListener('resize', throttledUpdateDimensions);
92
+ };
93
+ }, []);
94
+ const isScrollable = tableWidth > containerWidth;
95
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledContainer, {
96
+ ref: containerRef,
97
+ isScrollable: isScrollable,
98
+ tablePaddingBottom: `${tablePaddingBottom}px`,
99
+ ...selectProps(rest),
100
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(TableContext.Provider, {
101
+ value: {
102
+ text,
103
+ isScrollable,
104
+ tokens,
105
+ variant
106
+ },
107
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledTable, {
108
+ cellSpacing: 0,
109
+ ref: tableRef,
110
+ children: children
111
+ })
112
+ })
113
+ });
114
+ };
115
+
116
+ Table.propTypes = { ...selectedSystemPropTypes,
117
+ children: _propTypes.default.node,
118
+ text: _propTypes.default.oneOf(['medium', 'small'])
119
+ };
120
+ var _default = Table;
121
+ exports.default = _default;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _Table = _interopRequireDefault(require("./Table"));
9
+
10
+ var _Header = _interopRequireDefault(require("./Header"));
11
+
12
+ var _Body = _interopRequireDefault(require("./Body"));
13
+
14
+ var _Row = _interopRequireDefault(require("./Row"));
15
+
16
+ var _SubHeading = _interopRequireDefault(require("./SubHeading"));
17
+
18
+ var _Cell = _interopRequireDefault(require("./Cell"));
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
22
+ _Table.default.Header = _Header.default;
23
+ _Table.default.Body = _Body.default;
24
+ _Table.default.Row = _Row.default;
25
+ _Table.default.SubHeading = _SubHeading.default;
26
+ _Table.default.Cell = _Cell.default;
27
+ var _default = _Table.default;
28
+ exports.default = _default;
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _componentsBase = require("@telus-uds/components-base");
13
+
14
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
15
+
16
+ var _utils = require("../utils");
17
+
18
+ var _jsxRuntime = require("react/jsx-runtime");
19
+
20
+ var _withLinkRouter$propT, _withLinkRouter$propT2;
21
+
22
+ 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); }
23
+
24
+ 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; }
25
+
26
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
+
28
+ const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
29
+
30
+ const transform = property => (from, to) => (0, _styledComponents.keyframes)(["from{", ":", ";}to{", ":", ";}"], property, from, property, to);
31
+
32
+ const slideDown = property => function (from, to) {
33
+ let end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : to;
34
+ return (0, _styledComponents.keyframes)(["0%{", ":", ";}99%{", ":", ";}100%{", ":", ";}"], property, from, property, to, property, end);
35
+ };
36
+
37
+ const animation = props => (0, _styledComponents.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));
38
+
39
+ const ToastContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
40
+ displayName: "Toast__ToastContainer",
41
+ componentId: "components-web__sc-p78jdh-0"
42
+ })(["display:flex;justify-content:center;background:", ";gap:", ";height:0;overflow:hidden;animation:", ";"], _ref => {
43
+ let {
44
+ containerBackgroundColor
45
+ } = _ref;
46
+ return containerBackgroundColor;
47
+ }, _ref2 => {
48
+ let {
49
+ containerGap
50
+ } = _ref2;
51
+ return containerGap;
52
+ }, animation);
53
+
54
+ const Toast = _ref3 => {
55
+ let {
56
+ toast,
57
+ copy,
58
+ headline,
59
+ link,
60
+ tokens,
61
+ variant = {},
62
+ ...rest
63
+ } = _ref3;
64
+ const {
65
+ containerBackgroundColor,
66
+ containerGap,
67
+ animationHeightBefore,
68
+ animationHeightAfter,
69
+ animationPaddingBottomBefore,
70
+ animationPaddingBottomAfter,
71
+ animationPaddingTopBefore,
72
+ animationPaddingTopAfter,
73
+ animationBackgroundColorBefore,
74
+ animationBackgroundColorAfter,
75
+ animationColorBefore,
76
+ animationColorAfter,
77
+ animationFillColorBefore,
78
+ animationFillColorAfter
79
+ } = (0, _componentsBase.useThemeTokens)('Toast', tokens, variant);
80
+
81
+ if (!toast) {
82
+ return null;
83
+ }
84
+
85
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(ToastContainer, {
86
+ containerBackgroundColor: containerBackgroundColor,
87
+ containerGap: containerGap,
88
+ animationHeightBefore: animationHeightBefore,
89
+ animationHeightAfter: animationHeightAfter,
90
+ animationPaddingBottomBefore: animationPaddingBottomBefore,
91
+ animationPaddingBottomAfter: animationPaddingBottomAfter,
92
+ animationPaddingTopBefore: animationPaddingTopBefore,
93
+ animationPaddingTopAfter: animationPaddingTopAfter,
94
+ animationBackgroundColorBefore: animationBackgroundColorBefore,
95
+ animationBackgroundColorAfter: animationBackgroundColorAfter,
96
+ animationColorBefore: animationColorBefore,
97
+ animationColorAfter: animationColorAfter,
98
+ animationFillColorBefore: animationFillColorBefore,
99
+ animationFillColorAfter: animationFillColorAfter,
100
+ ...selectProps(rest),
101
+ children: [headline && /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
102
+ variant: {
103
+ bold: true,
104
+ inverse: true
105
+ },
106
+ children: headline
107
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
108
+ variant: {
109
+ inverse: true
110
+ },
111
+ children: copy
112
+ }), link && /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.ChevronLink, {
113
+ variant: {
114
+ inverse: true
115
+ },
116
+ href: link.href,
117
+ LinkRouter: link.LinkRouter,
118
+ linkRouterProps: link.linkRouterProps,
119
+ children: link.text
120
+ })]
121
+ });
122
+ };
123
+
124
+ Toast.propTypes = { ...selectedSystemPropTypes,
125
+ toast: _propTypes.default.bool,
126
+ copy: _propTypes.default.string.isRequired,
127
+ headline: _propTypes.default.string,
128
+ link: _propTypes.default.shape({
129
+ href: _propTypes.default.string.isRequired,
130
+ text: _propTypes.default.string.isRequired,
131
+ LinkRouter: (_withLinkRouter$propT = _componentsBase.withLinkRouter.propTypes) === null || _withLinkRouter$propT === void 0 ? void 0 : _withLinkRouter$propT.LinkRouter,
132
+ linkRouterProps: (_withLinkRouter$propT2 = _componentsBase.withLinkRouter.propTypes) === null || _withLinkRouter$propT2 === void 0 ? void 0 : _withLinkRouter$propT2.linkRouterProps
133
+ })
134
+ };
135
+ var _default = Toast;
136
+ 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 _Toast = _interopRequireDefault(require("./Toast"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ var _default = _Toast.default;
13
+ exports.default = _default;