@carbon/ibm-products 1.55.2 → 1.57.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. package/css/index-full-carbon.css +640 -0
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +2 -2
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon.css +640 -0
  6. package/css/index-without-carbon.css.map +1 -1
  7. package/css/index-without-carbon.min.css +2 -2
  8. package/css/index-without-carbon.min.css.map +1 -1
  9. package/css/index.css +640 -0
  10. package/css/index.css.map +1 -1
  11. package/css/index.min.css +2 -2
  12. package/css/index.min.css.map +1 -1
  13. package/es/components/Carousel/Carousel.js +15 -5
  14. package/es/components/Coachmark/Coachmark.js +243 -0
  15. package/es/components/Coachmark/CoachmarkDragbar.js +137 -0
  16. package/es/components/Coachmark/CoachmarkHeader.js +88 -0
  17. package/es/components/Coachmark/CoachmarkOverlay.js +139 -0
  18. package/es/components/Coachmark/CoachmarkTagline.js +93 -0
  19. package/es/components/Coachmark/index.js +10 -0
  20. package/es/components/Coachmark/utils/constants.js +76 -0
  21. package/es/components/Coachmark/utils/context.js +5 -0
  22. package/es/components/Coachmark/utils/enums.js +40 -0
  23. package/es/components/Coachmark/utils/helpers.js +11 -0
  24. package/es/components/Coachmark/utils/hooks.js +54 -0
  25. package/es/components/CoachmarkBeacon/CoachmarkBeacon.js +90 -0
  26. package/es/components/CoachmarkBeacon/index.js +8 -0
  27. package/es/components/CoachmarkButton/CoachmarkButton.js +72 -0
  28. package/es/components/CoachmarkButton/index.js +8 -0
  29. package/es/components/CoachmarkFixed/CoachmarkFixed.js +201 -0
  30. package/es/components/CoachmarkFixed/index.js +8 -0
  31. package/es/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +86 -0
  32. package/es/components/CoachmarkOverlayElement/index.js +8 -0
  33. package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +175 -0
  34. package/es/components/CoachmarkOverlayElements/index.js +8 -0
  35. package/es/components/CoachmarkStack/CoachmarkStack.js +260 -0
  36. package/es/components/CoachmarkStack/CoachmarkStackHome.js +157 -0
  37. package/es/components/CoachmarkStack/index.js +8 -0
  38. package/es/components/Datagrid/Datagrid/Datagrid.js +12 -7
  39. package/es/components/Datagrid/Datagrid/DatagridContent.js +6 -3
  40. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +127 -7
  41. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +1 -23
  42. package/es/components/Datagrid/Datagrid/addons/stateReducer.js +111 -0
  43. package/es/components/Datagrid/useDatagrid.js +5 -2
  44. package/es/components/Datagrid/utils/getColTitle.js +25 -0
  45. package/es/components/NotificationsPanel/NotificationsPanel.js +3 -2
  46. package/es/components/index.js +7 -0
  47. package/es/global/js/hooks/useResizeObserver.js +19 -3
  48. package/es/global/js/package-settings.js +8 -1
  49. package/lib/components/Carousel/Carousel.js +15 -5
  50. package/lib/components/Coachmark/Coachmark.js +247 -0
  51. package/lib/components/Coachmark/CoachmarkDragbar.js +137 -0
  52. package/lib/components/Coachmark/CoachmarkHeader.js +85 -0
  53. package/lib/components/Coachmark/CoachmarkOverlay.js +139 -0
  54. package/lib/components/Coachmark/CoachmarkTagline.js +90 -0
  55. package/lib/components/Coachmark/index.js +38 -0
  56. package/lib/components/Coachmark/utils/constants.js +82 -0
  57. package/lib/components/Coachmark/utils/context.js +13 -0
  58. package/lib/components/Coachmark/utils/enums.js +49 -0
  59. package/lib/components/Coachmark/utils/helpers.js +17 -0
  60. package/lib/components/Coachmark/utils/hooks.js +60 -0
  61. package/lib/components/CoachmarkBeacon/CoachmarkBeacon.js +87 -0
  62. package/lib/components/CoachmarkBeacon/index.js +12 -0
  63. package/lib/components/CoachmarkButton/CoachmarkButton.js +69 -0
  64. package/lib/components/CoachmarkButton/index.js +12 -0
  65. package/lib/components/CoachmarkFixed/CoachmarkFixed.js +201 -0
  66. package/lib/components/CoachmarkFixed/index.js +12 -0
  67. package/lib/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +83 -0
  68. package/lib/components/CoachmarkOverlayElement/index.js +12 -0
  69. package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +176 -0
  70. package/lib/components/CoachmarkOverlayElements/index.js +12 -0
  71. package/lib/components/CoachmarkStack/CoachmarkStack.js +264 -0
  72. package/lib/components/CoachmarkStack/CoachmarkStackHome.js +160 -0
  73. package/lib/components/CoachmarkStack/index.js +12 -0
  74. package/lib/components/Datagrid/Datagrid/Datagrid.js +12 -7
  75. package/lib/components/Datagrid/Datagrid/DatagridContent.js +6 -3
  76. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +130 -7
  77. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +4 -26
  78. package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +122 -0
  79. package/lib/components/Datagrid/useDatagrid.js +5 -2
  80. package/lib/components/Datagrid/utils/getColTitle.js +32 -0
  81. package/lib/components/NotificationsPanel/NotificationsPanel.js +3 -2
  82. package/lib/components/index.js +49 -0
  83. package/lib/global/js/hooks/useResizeObserver.js +19 -3
  84. package/lib/global/js/package-settings.js +8 -1
  85. package/package.json +2 -2
  86. package/scss/components/Carousel/_carousel.scss +3 -0
  87. package/scss/components/Coachmark/_index.scss +11 -0
  88. package/scss/components/Coachmark/_storybook-styles.scss +20 -0
  89. package/scss/components/Coachmark/styles/_coachmark-dragbar.scss +74 -0
  90. package/scss/components/Coachmark/styles/_coachmark-header.scss +58 -0
  91. package/scss/components/Coachmark/styles/_coachmark-overlay.scss +327 -0
  92. package/scss/components/Coachmark/styles/_coachmark-tagline.scss +118 -0
  93. package/scss/components/CoachmarkBeacon/_coachmark-beacon.scss +166 -0
  94. package/scss/components/CoachmarkBeacon/_index.scss +8 -0
  95. package/scss/components/CoachmarkBeacon/_storybook-styles.scss +19 -0
  96. package/scss/components/CoachmarkButton/_coachmark-button.scss +34 -0
  97. package/scss/components/CoachmarkButton/_index.scss +8 -0
  98. package/scss/components/CoachmarkButton/_storybook-styles.scss +19 -0
  99. package/scss/components/CoachmarkFixed/_coachmark-fixed.scss +34 -0
  100. package/scss/components/CoachmarkFixed/_index.scss +8 -0
  101. package/scss/components/CoachmarkFixed/_storybook-styles.scss +10 -0
  102. package/scss/components/CoachmarkOverlayElement/_coachmark-overlay-element.scss +50 -0
  103. package/scss/components/CoachmarkOverlayElement/_index.scss +8 -0
  104. package/scss/components/CoachmarkOverlayElement/_storybook-styles.scss +19 -0
  105. package/scss/components/CoachmarkOverlayElements/_coachmark-overlay-elements.scss +40 -0
  106. package/scss/components/CoachmarkOverlayElements/_index.scss +8 -0
  107. package/scss/components/CoachmarkOverlayElements/_storybook-styles.scss +19 -0
  108. package/scss/components/CoachmarkStack/_coachmark-stack.scss +85 -0
  109. package/scss/components/CoachmarkStack/_index.scss +8 -0
  110. package/scss/components/CoachmarkStack/_storybook-styles.scss +10 -0
  111. package/scss/components/Datagrid/styles/_datagrid.scss +65 -0
  112. package/scss/components/_index.scss +7 -1
@@ -0,0 +1,264 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.CoachmarkStack = void 0;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
12
+ var _react = _interopRequireWildcard(require("react"));
13
+ var _reactDom = require("react-dom");
14
+ var _propTypes = _interopRequireDefault(require("prop-types"));
15
+ var _classnames = _interopRequireDefault(require("classnames"));
16
+ var _devtools = require("../../global/js/utils/devtools");
17
+ var _settings = require("../../settings");
18
+ var _CoachmarkOverlay = require("../Coachmark/CoachmarkOverlay");
19
+ var _CoachmarkStackHome = require("./CoachmarkStackHome");
20
+ var _CoachmarkTagline = require("../Coachmark/CoachmarkTagline");
21
+ var _context = require("../Coachmark/utils/context");
22
+ var _enums = require("../Coachmark/utils/enums");
23
+ var _excluded = ["children", "className", "onClose", "description", "media", "navLinkLabels", "portalTarget", "closeButtonLabel", "tagline", "theme", "title"];
24
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
+ 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; }
26
+ var blockClass = "".concat(_settings.pkg.prefix, "--coachmark-stack");
27
+ var elementBlockClass = "".concat(_settings.pkg.prefix, "--coachmark-stack-element");
28
+ var componentName = 'CoachmarkStack';
29
+ var defaults = {
30
+ onClose: function onClose() {},
31
+ // Pass through to CoachmarkStackHome
32
+ theme: 'light'
33
+ };
34
+
35
+ // NOTE
36
+ // The stack is limited to a depth of two Coachmarks:
37
+ // - a single parent CoachmarkStackHome
38
+ // - a single child Coachmark when stacked
39
+ // The parent will include links to all the children.
40
+ // No child Coachmark will include links to any other child Coachmarks.
41
+
42
+ /**
43
+ * Stacked coachmarks are used to call out specific functionality or concepts
44
+ * within the UI that may not be intuitive but are important for the
45
+ * user to gain understanding of the product's main value and discover new use cases.
46
+ * This variant allows the stacking of multiple coachmark overlays to be displayed by interacting with the tagline.
47
+ */
48
+ var CoachmarkStack = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
49
+ var _document$querySelect;
50
+ var children = _ref.children,
51
+ className = _ref.className,
52
+ _ref$onClose = _ref.onClose,
53
+ onClose = _ref$onClose === void 0 ? defaults.onClose : _ref$onClose,
54
+ description = _ref.description,
55
+ media = _ref.media,
56
+ navLinkLabels = _ref.navLinkLabels,
57
+ _ref$portalTarget = _ref.portalTarget,
58
+ portalTarget = _ref$portalTarget === void 0 ? defaults.portalTarget : _ref$portalTarget,
59
+ closeButtonLabel = _ref.closeButtonLabel,
60
+ tagline = _ref.tagline,
61
+ _ref$theme = _ref.theme,
62
+ theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
63
+ title = _ref.title,
64
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
65
+ var portalNode = portalTarget ? (_document$querySelect = document.querySelector(portalTarget)) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector('body') : document.querySelector('body');
66
+ var stackHomeRef = (0, _react.useRef)();
67
+ var stackedCoachmarkRefs = (0, _react.useRef)([]);
68
+ var _useState = (0, _react.useState)(false),
69
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
70
+ isOpen = _useState2[0],
71
+ setIsOpen = _useState2[1];
72
+ // selectedItemNumber -1 = parent close button was clicked, remove entire stack
73
+ // selectedItemNumber 0 = (default) the parent is visible, all children are hidden
74
+ // selectedItemNumber 1+ = a child is visible and stacked atop the parent
75
+ var _useState3 = (0, _react.useState)(0),
76
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
77
+ selectedItemNumber = _useState4[0],
78
+ setSelectedItemNumber = _useState4[1];
79
+ // // The parent height and width values to return to after unstacked
80
+ var _useState5 = (0, _react.useState)(null),
81
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
82
+ parentHeight = _useState6[0],
83
+ setParentHeight = _useState6[1];
84
+ // parent height = child height when stacked behind a child that is shorter
85
+ var childArray = _react.Children.toArray(children);
86
+ var mountedRef = (0, _react.useRef)();
87
+ // same value as CSS animation speed
88
+ var delayMs = 240;
89
+
90
+ // Unmount or unstack a child
91
+ var handleClickNavItem = function handleClickNavItem(itemNumber) {
92
+ setSelectedItemNumber(itemNumber);
93
+ };
94
+ var handleClose = function handleClose(isParentCloseButton) {
95
+ if (isParentCloseButton) {
96
+ // Trigger slide-out animation
97
+ setSelectedItemNumber(-1);
98
+
99
+ // Unmount after animation is complete
100
+ var timer = setTimeout(function () {
101
+ setIsOpen(false);
102
+ onClose();
103
+ }, delayMs);
104
+ return function () {
105
+ return clearTimeout(timer);
106
+ };
107
+ } else {
108
+ // Unstack child
109
+ setSelectedItemNumber(0);
110
+ }
111
+ };
112
+ var contextValue = {
113
+ buttonProps: {
114
+ 'aria-expanded': isOpen,
115
+ onClick: function onClick() {
116
+ setIsOpen(true);
117
+ },
118
+ // Compensate for accidental open/close on double-click.
119
+ // Only open on double-click.
120
+ onDoubleClick: function onDoubleClick() {
121
+ setIsOpen(true);
122
+ }
123
+ },
124
+ closeButtonProps: {
125
+ onClick: function onClick() {
126
+ return handleClose(false);
127
+ }
128
+ },
129
+ isOpen: isOpen
130
+ };
131
+ (0, _react.useEffect)(function () {
132
+ mountedRef.current = true;
133
+ return function () {
134
+ mountedRef.current = false;
135
+ };
136
+ }, []);
137
+ (0, _react.useEffect)(function () {
138
+ setTimeout(function () {
139
+ if (stackHomeRef.current) {
140
+ setParentHeight(stackHomeRef.current.clientHeight);
141
+ }
142
+ }, 0);
143
+ }, [stackHomeRef]);
144
+ (0, _react.useEffect)(function () {
145
+ var targetSelectedItem = selectedItemNumber - 1;
146
+ if (!parentHeight) {
147
+ return;
148
+ }
149
+ stackHomeRef.current.style.height = "".concat(parentHeight, "px");
150
+ if (!isOpen || targetSelectedItem < 0) {
151
+ return;
152
+ }
153
+ var targetHomeHeight = stackedCoachmarkRefs.current[targetSelectedItem].clientHeight;
154
+ stackHomeRef.current.style.height = "".concat(targetHomeHeight, "px");
155
+ }, [selectedItemNumber, isOpen, parentHeight]);
156
+ var wrappedChildren = _react.Children.map(childArray, function (child, idx) {
157
+ var mountedClass = mountedRef.current ? "".concat(elementBlockClass, "--is-mounted") : '';
158
+ return /*#__PURE__*/_react.default.createElement(_CoachmarkOverlay.CoachmarkOverlay, {
159
+ key: idx,
160
+ ref: function ref(_ref2) {
161
+ return stackedCoachmarkRefs.current[idx] = _ref2;
162
+ },
163
+ kind: _enums.COACHMARK_OVERLAY_KIND.STACKED,
164
+ onClose: function onClose() {
165
+ return handleClose(false);
166
+ },
167
+ theme: theme,
168
+ fixedIsVisible: false,
169
+ className: (0, _classnames.default)(elementBlockClass, mountedClass, idx === selectedItemNumber - 1 && "".concat(elementBlockClass, "--is-visible"), mountedRef.current && "".concat(elementBlockClass, "--is-mounted"))
170
+ }, child);
171
+ });
172
+ return /*#__PURE__*/_react.default.createElement(_context.CoachmarkContext.Provider, {
173
+ value: contextValue
174
+ }, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
175
+ className: (0, _classnames.default)(blockClass, "".concat(_settings.pkg.prefix, "--coachmark-overlay--stack"), className),
176
+ ref: ref
177
+ }, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement(_CoachmarkTagline.CoachmarkTagline, {
178
+ title: tagline,
179
+ onClose: onClose
180
+ }), /*#__PURE__*/_react.default.createElement(_CoachmarkStackHome.CoachmarkStackHome, {
181
+ ref: stackHomeRef,
182
+ className: (0, _classnames.default)("".concat(_settings.pkg.prefix, "--coachmark-overlay"), "".concat(_settings.pkg.prefix, "--coachmark-overlay__").concat(theme), elementBlockClass, selectedItemNumber > 0 && "".concat(elementBlockClass, "--is-stacked"), selectedItemNumber > 0 && "".concat(elementBlockClass, "--is-stacked__").concat(theme), isOpen && "".concat(elementBlockClass, "--is-visible"), mountedRef.current && "".concat(elementBlockClass, "--is-mounted")),
183
+ description: description,
184
+ media: media,
185
+ navLinkLabels: navLinkLabels,
186
+ onClickNavItem: handleClickNavItem,
187
+ onClose: function onClose() {
188
+ handleClose(true);
189
+ },
190
+ portalTarget: portalTarget,
191
+ closeButtonLabel: closeButtonLabel,
192
+ title: title
193
+ }), /*#__PURE__*/(0, _reactDom.createPortal)(wrappedChildren, portalNode)));
194
+ });
195
+
196
+ // Return a placeholder if not released and not enabled by feature flag
197
+ exports.CoachmarkStack = CoachmarkStack;
198
+ exports.CoachmarkStack = CoachmarkStack = _settings.pkg.checkComponentEnabled(CoachmarkStack, componentName);
199
+
200
+ // The display name of the component, used by React. Note that displayName
201
+ // is used in preference to relying on function.name.
202
+ CoachmarkStack.displayName = componentName;
203
+
204
+ // The types and DocGen commentary for the component props,
205
+ // in alphabetical order (for consistency).
206
+ // See https://www.npmjs.com/package/prop-types#usage.
207
+ CoachmarkStack.propTypes = {
208
+ /**
209
+ * CoachmarkStack should use a single CoachmarkOverlayElements component as a child.
210
+ */
211
+ children: _propTypes.default.node.isRequired,
212
+ /**
213
+ * Provide an optional class to be applied to the containing node.
214
+ */
215
+ className: _propTypes.default.string,
216
+ /**
217
+ * The label for the button that will close the Stack
218
+ */
219
+ closeButtonLabel: _propTypes.default.string,
220
+ // Pass through to CoachmarkStackHome
221
+ /**
222
+ * The description of the Coachmark.
223
+ */
224
+ description: _propTypes.default.node.isRequired,
225
+ /**
226
+ * The object describing an image in one of two shapes.
227
+ *
228
+ * If a single media element is required, use `{render}`.
229
+ *
230
+ * If a stepped animation is required, use `{filePaths}`.
231
+ *
232
+ * @see {@link MEDIA_PROP_TYPE}.
233
+ */
234
+ media: _propTypes.default.oneOfType([_propTypes.default.shape({
235
+ render: _propTypes.default.func
236
+ }), _propTypes.default.shape({
237
+ filePaths: _propTypes.default.arrayOf(_propTypes.default.string)
238
+ })]),
239
+ /**
240
+ * The labels used to link to the stackable Coachmarks.
241
+ */
242
+ navLinkLabels: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
243
+ /**
244
+ * Function to call when the CoachmarkStack closes.
245
+ */
246
+ onClose: _propTypes.default.func,
247
+ /**
248
+ * Where in the DOM to render the stack.
249
+ * The default is `document.body`.
250
+ */
251
+ portalTarget: _propTypes.default.string,
252
+ /**
253
+ * The tagline title which will be fixed to the bottom right of the window and will serve as the display trigger.
254
+ */
255
+ tagline: _propTypes.default.string.isRequired,
256
+ /**
257
+ * Determines the theme of the component.
258
+ */
259
+ theme: _propTypes.default.oneOf(['light', 'dark']),
260
+ /**
261
+ * The title of the Coachmark.
262
+ */
263
+ title: _propTypes.default.string.isRequired
264
+ };
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.CoachmarkStackHome = void 0;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+ var _react = _interopRequireWildcard(require("react"));
12
+ var _pconsole = _interopRequireDefault(require("../../global/js/utils/pconsole"));
13
+ var _propTypes = _interopRequireDefault(require("prop-types"));
14
+ var _classnames = _interopRequireDefault(require("classnames"));
15
+ var _iconsReact = require("@carbon/icons-react");
16
+ var _carbonComponentsReact = require("carbon-components-react");
17
+ var _devtools = require("../../global/js/utils/devtools");
18
+ var _settings = require("../../settings");
19
+ var _reactDom = require("react-dom");
20
+ var _CoachmarkHeader = require("../Coachmark/CoachmarkHeader");
21
+ var _SteppedAnimatedMedia = require("../SteppedAnimatedMedia");
22
+ var _excluded = ["className", "description", "media", "navLinkLabels", "onClickNavItem", "onClose", "portalTarget", "closeButtonLabel", "title"];
23
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
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
+ // Carbon and package components we use.
26
+ /* TODO: @import(s) of carbon components and other package components. */
27
+
28
+ // The block part of our conventional BEM class names (blockClass__E--M).
29
+ var blockClass = "".concat(_settings.pkg.prefix, "--coachmark-stacked-home");
30
+ var overlayClass = "".concat(_settings.pkg.prefix, "--coachmark-overlay");
31
+ var componentName = 'CoachmarkStackHome';
32
+
33
+ /**
34
+ * DO NOT USE. This component is for the exclusive use
35
+ * of other Novice to Pro components.
36
+ */
37
+ var CoachmarkStackHome = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
38
+ var _document$querySelect;
39
+ var className = _ref.className,
40
+ description = _ref.description,
41
+ media = _ref.media,
42
+ navLinkLabels = _ref.navLinkLabels,
43
+ onClickNavItem = _ref.onClickNavItem,
44
+ onClose = _ref.onClose,
45
+ portalTarget = _ref.portalTarget,
46
+ closeButtonLabel = _ref.closeButtonLabel,
47
+ title = _ref.title,
48
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
49
+ if (!navLinkLabels) {
50
+ return _pconsole.default.warn("".concat(componentName, " is a Novice to Pro internal component and is not intended for general use."));
51
+ }
52
+ var portalNode = portalTarget ? (_document$querySelect = document.querySelector(portalTarget)) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector('body') : document.querySelector('body');
53
+ return /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
54
+ className: (0, _classnames.default)(blockClass, className),
55
+ ref: ref,
56
+ role: "main"
57
+ }, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement(_CoachmarkHeader.CoachmarkHeader, {
58
+ onClose: onClose
59
+ }), /*#__PURE__*/_react.default.createElement("div", {
60
+ className: "".concat(overlayClass, "__body")
61
+ }, /*#__PURE__*/_react.default.createElement("div", {
62
+ className: "".concat(overlayClass, "-element")
63
+ }, !media && /*#__PURE__*/_react.default.createElement(_iconsReact.Idea20, {
64
+ className: "".concat(blockClass, "__icon-idea")
65
+ }), media && (media.render ? media.render() : /*#__PURE__*/_react.default.createElement(_SteppedAnimatedMedia.SteppedAnimatedMedia, {
66
+ className: "".concat(overlayClass, "__element-stepped-media"),
67
+ filePaths: media.filePaths,
68
+ playStep: 0
69
+ })), /*#__PURE__*/_react.default.createElement("div", {
70
+ className: "".concat(overlayClass, "-element__content")
71
+ }, title && /*#__PURE__*/_react.default.createElement("h2", {
72
+ className: "".concat(overlayClass, "-element__title")
73
+ }, title), description && /*#__PURE__*/_react.default.createElement("p", {
74
+ className: "".concat(overlayClass, "-element__body")
75
+ }, description)), /*#__PURE__*/_react.default.createElement("ul", {
76
+ className: "".concat(blockClass, "__nav-links")
77
+ }, navLinkLabels.map(function (label, index) {
78
+ return /*#__PURE__*/_react.default.createElement("li", {
79
+ key: index
80
+ }, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
81
+ kind: "ghost",
82
+ size: "sm",
83
+ onClick: function onClick() {
84
+ onClickNavItem(index + 1);
85
+ }
86
+ }, label));
87
+ })), closeButtonLabel && /*#__PURE__*/_react.default.createElement("div", {
88
+ className: "".concat(overlayClass, "__footer")
89
+ }, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
90
+ size: "sm",
91
+ onClick: onClose
92
+ }, closeButtonLabel))))), portalNode);
93
+ });
94
+
95
+ // Return a placeholder if not released and not enabled by feature flag
96
+ exports.CoachmarkStackHome = CoachmarkStackHome;
97
+ exports.CoachmarkStackHome = CoachmarkStackHome = _settings.pkg.checkComponentEnabled(CoachmarkStackHome, componentName);
98
+
99
+ // The display name of the component, used by React. Note that displayName
100
+ // is used in preference to relying on function.name.
101
+ CoachmarkStackHome.displayName = componentName;
102
+
103
+ // The types and DocGen commentary for the component props,
104
+ // in alphabetical order (for consistency).
105
+ // See https://www.npmjs.com/package/prop-types#usage.
106
+ CoachmarkStackHome.propTypes = {
107
+ /**
108
+ * Optional class name for this component.
109
+ */
110
+ className: _propTypes.default.string,
111
+ /**
112
+ * The label for the button that will close the stack
113
+ */
114
+ closeButtonLabel: _propTypes.default.string,
115
+ /**
116
+ * The description of the Coachmark.
117
+ */
118
+ description: _propTypes.default.node.isRequired,
119
+ /**
120
+ * The object describing an image in one of two shapes.
121
+ *
122
+ * If a single media element is required, use `{render}`.
123
+ *
124
+ * If a stepped animation is required, use `{filePaths}`.
125
+ *
126
+ * @see {@link MEDIA_PROP_TYPE}.
127
+ */
128
+ media: _propTypes.default.oneOfType([_propTypes.default.shape({
129
+ render: _propTypes.default.func
130
+ }), _propTypes.default.shape({
131
+ filePaths: _propTypes.default.arrayOf(_propTypes.default.string)
132
+ })]),
133
+ /**
134
+ * The labels used to link to the stackable Coachmarks.
135
+ */
136
+ navLinkLabels: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
137
+ /**
138
+ * For internal use only by CoachmarkStack and CoachmarkStackHome.
139
+ */
140
+ onClickNavItem: _propTypes.default.func.isRequired,
141
+ /**
142
+ * Function to call when the stack closes.
143
+ */
144
+ onClose: _propTypes.default.func.isRequired,
145
+ /**
146
+ * By default, the CoachmarkStackHome will be appended to the end of `document.body`.
147
+ * The CoachmarkStackHome will remain persistent as the user navigates the app until
148
+ * the user closes the CoachmarkStackHome.
149
+ *
150
+ * Alternatively, the app developer can tightly couple the CoachmarkStackHome to a DOM
151
+ * element or other component by specifying a CSS selector. The CoachmarkStackHome will
152
+ * remain visible as long as that element remains visible or mounted. When the
153
+ * element is hidden or component is unmounted, the CoachmarkStackHome will disappear.
154
+ */
155
+ portalTarget: _propTypes.default.string,
156
+ /**
157
+ * The title of the Coachmark.
158
+ */
159
+ title: _propTypes.default.string.isRequired
160
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "CoachmarkStack", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _CoachmarkStack.CoachmarkStack;
10
+ }
11
+ });
12
+ var _CoachmarkStack = require("./CoachmarkStack");
@@ -16,11 +16,12 @@ var _pconsole = _interopRequireDefault(require("../../../global/js/utils/pconsol
16
16
  var _InlineEditContext = require("./addons/InlineEdit/InlineEditContext");
17
17
  var _DatagridContent = require("./DatagridContent");
18
18
  var _FilterProvider = require("./addons/Filtering/FilterProvider");
19
- var _excluded = ["datagridState"];
19
+ var _excluded = ["datagridState", "title"];
20
20
  var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
21
21
  var componentName = 'Datagrid';
22
22
  var Datagrid = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
23
23
  var datagridState = _ref.datagridState,
24
+ title = _ref.title,
24
25
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
25
26
  if (!datagridState) {
26
27
  _pconsole.default.warn('Datagrid was not passed datagridState which is required to render this component.');
@@ -34,6 +35,10 @@ var Datagrid = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
34
35
  className = datagridState.className,
35
36
  filters = datagridState.state.filters;
36
37
  var rows = DatagridPagination && datagridState.page || datagridState.rows;
38
+ var props = {
39
+ title: title,
40
+ datagridState: datagridState
41
+ };
37
42
  return /*#__PURE__*/_react.default.createElement(_FilterProvider.FilterProvider, {
38
43
  filters: filters
39
44
  }, /*#__PURE__*/_react.default.createElement(_InlineEditContext.InlineEditProvider, null, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
@@ -42,11 +47,7 @@ var Datagrid = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
42
47
  className: (0, _classnames.default)(className, blockClass, withVirtualScroll ? "".concat(blockClass, "__datagridWrap") : "".concat(blockClass, "__datagridWrap-simple"), !isFetching && rows.length === 0 ? "".concat(blockClass, "__empty-state") : '')
43
48
  }, (0, _devtools.getDevtoolsProps)(componentName)), (filterProps === null || filterProps === void 0 ? void 0 : filterProps.variation) === 'panel' ? /*#__PURE__*/_react.default.createElement("div", {
44
49
  className: "".concat(blockClass, "__datagridWithPanel ").concat(blockClass, "__displayFlex ").concat(blockClass, "__leftPanel-position")
45
- }, /*#__PURE__*/_react.default.createElement(_DatagridContent.DatagridContent, {
46
- datagridState: datagridState
47
- })) : /*#__PURE__*/_react.default.createElement(_DatagridContent.DatagridContent, {
48
- datagridState: datagridState
49
- }))));
50
+ }, /*#__PURE__*/_react.default.createElement(_DatagridContent.DatagridContent, props)) : /*#__PURE__*/_react.default.createElement(_DatagridContent.DatagridContent, props))));
50
51
  });
51
52
 
52
53
  // Return a placeholder if not released and not enabled by feature flag
@@ -60,5 +61,9 @@ Datagrid.propTypes = {
60
61
  /**
61
62
  * The data grid state, much of it being supplied by the useDatagrid hook
62
63
  */
63
- datagridState: _propTypes.default.object.isRequired
64
+ datagridState: _propTypes.default.object.isRequired,
65
+ /**
66
+ * Table title
67
+ */
68
+ title: _propTypes.default.string
64
69
  };
@@ -40,7 +40,8 @@ var TableContainer = _carbonComponentsReact.DataTable.TableContainer,
40
40
  var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
41
41
  var DatagridContent = function DatagridContent(_ref) {
42
42
  var _cx4;
43
- var datagridState = _ref.datagridState;
43
+ var datagridState = _ref.datagridState,
44
+ title = _ref.title;
44
45
  var _useContext = (0, _react.useContext)(_InlineEditContext.InlineEditContext),
45
46
  inlineEditState = _useContext.state,
46
47
  dispatch = _useContext.dispatch;
@@ -108,7 +109,8 @@ var DatagridContent = function DatagridContent(_ref) {
108
109
  } : null,
109
110
  onFocus: withInlineEdit ? function () {
110
111
  return (0, _handleGridFocus.handleGridFocus)(inlineEditState, dispatch);
111
- } : null
112
+ } : null,
113
+ title: title
112
114
  }), !withVirtualScroll ? /*#__PURE__*/_react.default.createElement(_DatagridHead.default, datagridState) : null, /*#__PURE__*/_react.default.createElement(_DatagridBody.default, (0, _extends2.default)({}, datagridState, {
113
115
  rows: rows
114
116
  })));
@@ -191,5 +193,6 @@ DatagridContent.propTypes = {
191
193
  setAllFilters: _propTypes.default.func,
192
194
  getFilterProps: _propTypes.default.func,
193
195
  state: _propTypes.default.object
194
- })
196
+ }),
197
+ title: _propTypes.default.string
195
198
  };