@carbon/ibm-products 2.23.0 → 2.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. package/css/index-full-carbon.css +29484 -28211
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +1 -1
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +49 -10
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +1 -1
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +24418 -291
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +1 -1
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +17172 -13
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +1 -1
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/Card/Card.js +1 -2
  18. package/es/components/Card/CardHeader.js +2 -2
  19. package/es/components/Carousel/Carousel.js +5 -3
  20. package/es/components/Coachmark/Coachmark.js +255 -0
  21. package/es/components/Coachmark/CoachmarkDragbar.js +146 -0
  22. package/es/components/Coachmark/CoachmarkHeader.js +91 -0
  23. package/es/components/Coachmark/CoachmarkOverlay.js +235 -0
  24. package/es/components/Coachmark/CoachmarkTagline.js +97 -0
  25. package/es/components/Coachmark/index.js +10 -0
  26. package/es/components/Coachmark/utils/constants.js +76 -0
  27. package/es/components/Coachmark/utils/context.js +5 -0
  28. package/es/components/Coachmark/utils/enums.js +40 -0
  29. package/es/components/Coachmark/utils/helpers.js +11 -0
  30. package/es/components/Coachmark/utils/hooks.js +54 -0
  31. package/es/components/CoachmarkBeacon/CoachmarkBeacon.js +93 -0
  32. package/es/components/CoachmarkBeacon/index.js +8 -0
  33. package/es/components/CoachmarkButton/CoachmarkButton.js +90 -0
  34. package/es/components/CoachmarkButton/index.js +8 -0
  35. package/es/components/CoachmarkFixed/CoachmarkFixed.js +226 -0
  36. package/es/components/CoachmarkFixed/index.js +8 -0
  37. package/es/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +86 -0
  38. package/es/components/CoachmarkOverlayElement/index.js +8 -0
  39. package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +216 -0
  40. package/es/components/CoachmarkOverlayElements/index.js +8 -0
  41. package/es/components/CoachmarkStack/CoachmarkStack.js +283 -0
  42. package/es/components/CoachmarkStack/CoachmarkStackHome.js +192 -0
  43. package/es/components/CoachmarkStack/index.js +8 -0
  44. package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +4 -1
  45. package/es/components/Datagrid/Datagrid/DraggableElement.js +1 -1
  46. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +1 -1
  47. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +4 -1
  48. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +1 -1
  49. package/es/components/Datagrid/Datagrid.docs-page.js +2 -2
  50. package/es/components/Datagrid/useActionsColumn.js +16 -12
  51. package/es/components/Datagrid/useNestedRowExpander.js +2 -2
  52. package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +7 -2
  53. package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +8 -3
  54. package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +7 -2
  55. package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +7 -2
  56. package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +7 -2
  57. package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +7 -2
  58. package/es/components/EmptyStates/assets/ErrorIllustration.js +5 -5
  59. package/es/components/EmptyStates/assets/NoDataIllustration.js +5 -5
  60. package/es/components/EmptyStates/assets/NoTagsIllustration.js +5 -5
  61. package/es/components/EmptyStates/assets/NotFoundIllustration.js +5 -5
  62. package/es/components/EmptyStates/assets/NotificationsIllustration.js +5 -5
  63. package/es/components/EmptyStates/assets/UnauthorizedIllustration.js +5 -5
  64. package/es/components/InterstitialScreen/InterstitialScreen.js +427 -0
  65. package/es/components/InterstitialScreen/index.js +8 -0
  66. package/es/components/InterstitialScreenView/InterstitialScreenView.js +75 -0
  67. package/es/components/InterstitialScreenView/index.js +8 -0
  68. package/es/components/InterstitialScreenViewModule/InterstitialScreenViewModule.js +83 -0
  69. package/es/components/InterstitialScreenViewModule/index.js +8 -0
  70. package/es/components/PageHeader/PageHeaderUtils.js +2 -2
  71. package/es/components/SearchBar/SearchBar.js +227 -0
  72. package/es/components/SearchBar/index.js +8 -0
  73. package/es/components/index.js +12 -1
  74. package/es/global/js/package-settings.js +14 -0
  75. package/lib/components/Card/Card.js +3 -4
  76. package/lib/components/Card/CardHeader.js +2 -2
  77. package/lib/components/Carousel/Carousel.js +5 -3
  78. package/lib/components/Coachmark/Coachmark.js +264 -0
  79. package/lib/components/Coachmark/CoachmarkDragbar.js +151 -0
  80. package/lib/components/Coachmark/CoachmarkHeader.js +95 -0
  81. package/lib/components/Coachmark/CoachmarkOverlay.js +243 -0
  82. package/lib/components/Coachmark/CoachmarkTagline.js +101 -0
  83. package/lib/components/Coachmark/index.js +38 -0
  84. package/lib/components/Coachmark/utils/constants.js +81 -0
  85. package/lib/components/Coachmark/utils/context.js +11 -0
  86. package/lib/components/Coachmark/utils/enums.js +46 -0
  87. package/lib/components/Coachmark/utils/helpers.js +17 -0
  88. package/lib/components/Coachmark/utils/hooks.js +59 -0
  89. package/lib/components/CoachmarkBeacon/CoachmarkBeacon.js +97 -0
  90. package/lib/components/CoachmarkBeacon/index.js +12 -0
  91. package/lib/components/CoachmarkButton/CoachmarkButton.js +93 -0
  92. package/lib/components/CoachmarkButton/index.js +12 -0
  93. package/lib/components/CoachmarkFixed/CoachmarkFixed.js +232 -0
  94. package/lib/components/CoachmarkFixed/index.js +12 -0
  95. package/lib/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +90 -0
  96. package/lib/components/CoachmarkOverlayElement/index.js +12 -0
  97. package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +222 -0
  98. package/lib/components/CoachmarkOverlayElements/index.js +12 -0
  99. package/lib/components/CoachmarkStack/CoachmarkStack.js +288 -0
  100. package/lib/components/CoachmarkStack/CoachmarkStackHome.js +198 -0
  101. package/lib/components/CoachmarkStack/index.js +12 -0
  102. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +4 -1
  103. package/lib/components/Datagrid/Datagrid/DraggableElement.js +1 -1
  104. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +1 -1
  105. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +4 -1
  106. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +1 -1
  107. package/lib/components/Datagrid/Datagrid.docs-page.js +2 -2
  108. package/lib/components/Datagrid/useActionsColumn.js +15 -11
  109. package/lib/components/Datagrid/useNestedRowExpander.js +2 -2
  110. package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +7 -2
  111. package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +8 -3
  112. package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +7 -2
  113. package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +7 -2
  114. package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +7 -2
  115. package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +7 -2
  116. package/lib/components/EmptyStates/assets/ErrorIllustration.js +5 -5
  117. package/lib/components/EmptyStates/assets/NoDataIllustration.js +5 -5
  118. package/lib/components/EmptyStates/assets/NoTagsIllustration.js +5 -5
  119. package/lib/components/EmptyStates/assets/NotFoundIllustration.js +5 -5
  120. package/lib/components/EmptyStates/assets/NotificationsIllustration.js +5 -5
  121. package/lib/components/EmptyStates/assets/UnauthorizedIllustration.js +5 -5
  122. package/lib/components/InterstitialScreen/InterstitialScreen.js +434 -0
  123. package/lib/components/InterstitialScreen/index.js +12 -0
  124. package/lib/components/InterstitialScreenView/InterstitialScreenView.js +77 -0
  125. package/lib/components/InterstitialScreenView/index.js +12 -0
  126. package/lib/components/InterstitialScreenViewModule/InterstitialScreenViewModule.js +85 -0
  127. package/lib/components/InterstitialScreenViewModule/index.js +12 -0
  128. package/lib/components/PageHeader/PageHeaderUtils.js +2 -2
  129. package/lib/components/SearchBar/SearchBar.js +233 -0
  130. package/lib/components/SearchBar/index.js +12 -0
  131. package/lib/components/index.js +78 -1
  132. package/lib/global/js/package-settings.js +14 -0
  133. package/package.json +5 -5
  134. package/scss/components/Card/_card.scss +6 -5
  135. package/scss/components/Coachmark/_carbon-imports.scss +10 -0
  136. package/scss/components/Coachmark/_coachmark-dragbar.scss +27 -0
  137. package/scss/components/Coachmark/_coachmark-header.scss +20 -0
  138. package/scss/components/Coachmark/_coachmark-overlay.scss +431 -0
  139. package/scss/components/Coachmark/_coachmark-tagline.scss +140 -0
  140. package/scss/components/Coachmark/_coachmark.scss +30 -0
  141. package/scss/components/Coachmark/_index-with-carbon.scss +9 -0
  142. package/scss/components/Coachmark/_index.scss +8 -0
  143. package/scss/components/CoachmarkBeacon/_carbon-imports.scss +9 -0
  144. package/scss/components/CoachmarkBeacon/_coachmark-beacon.scss +166 -0
  145. package/scss/components/CoachmarkBeacon/_index-with-carbon.scss +9 -0
  146. package/scss/components/CoachmarkBeacon/_index.scss +8 -0
  147. package/scss/components/CoachmarkButton/_carbon-imports.scss +9 -0
  148. package/scss/components/CoachmarkButton/_coachmark-button.scss +25 -0
  149. package/scss/components/CoachmarkButton/_index-with-carbon.scss +9 -0
  150. package/scss/components/CoachmarkButton/_index.scss +8 -0
  151. package/scss/components/CoachmarkFixed/_carbon-imports.scss +9 -0
  152. package/scss/components/CoachmarkFixed/_coachmark-fixed.scss +25 -0
  153. package/scss/components/CoachmarkFixed/_index-with-carbon.scss +9 -0
  154. package/scss/components/CoachmarkFixed/_index.scss +8 -0
  155. package/scss/components/CoachmarkOverlayElement/_carbon-imports.scss +9 -0
  156. package/scss/components/CoachmarkOverlayElement/_coachmark-overlay-element.scss +52 -0
  157. package/scss/components/CoachmarkOverlayElement/_index-with-carbon.scss +9 -0
  158. package/scss/components/CoachmarkOverlayElement/_index.scss +8 -0
  159. package/scss/components/CoachmarkOverlayElements/_carbon-imports.scss +9 -0
  160. package/scss/components/CoachmarkOverlayElements/_coachmark-overlay-elements.scss +47 -0
  161. package/scss/components/CoachmarkOverlayElements/_index-with-carbon.scss +9 -0
  162. package/scss/components/CoachmarkOverlayElements/_index.scss +8 -0
  163. package/scss/components/CoachmarkStack/_carbon-imports.scss +9 -0
  164. package/scss/components/CoachmarkStack/_coachmark-stack.scss +95 -0
  165. package/scss/components/CoachmarkStack/_index-with-carbon.scss +9 -0
  166. package/scss/components/CoachmarkStack/_index.scss +8 -0
  167. package/scss/components/InterstitialScreen/_carbon-imports.scss +9 -0
  168. package/scss/components/InterstitialScreen/_index-with-carbon.scss +9 -0
  169. package/scss/components/InterstitialScreen/_index.scss +8 -0
  170. package/scss/components/InterstitialScreen/_interstitial-screen.scss +276 -0
  171. package/scss/components/InterstitialScreenView/_carbon-imports.scss +9 -0
  172. package/scss/components/InterstitialScreenView/_index-with-carbon.scss +9 -0
  173. package/scss/components/InterstitialScreenView/_index.scss +8 -0
  174. package/scss/components/InterstitialScreenView/_interstitial-screen-view.scss +25 -0
  175. package/scss/components/InterstitialScreenViewModule/_carbon-imports.scss +9 -0
  176. package/scss/components/InterstitialScreenViewModule/_index-with-carbon.scss +9 -0
  177. package/scss/components/InterstitialScreenViewModule/_index.scss +8 -0
  178. package/scss/components/InterstitialScreenViewModule/_interstitial-screen-view-module.scss +59 -0
  179. package/scss/components/PageHeader/_page-header.scss +0 -1
  180. package/scss/components/SearchBar/_carbon-imports.scss +9 -0
  181. package/scss/components/SearchBar/_index-with-carbon.scss +9 -0
  182. package/scss/components/SearchBar/_index.scss +8 -0
  183. package/scss/components/SearchBar/_search-bar.scss +26 -0
  184. package/scss/components/SidePanel/_side-panel.scss +12 -7
  185. package/scss/components/_index-with-carbon.scss +11 -0
  186. package/scss/components/_index.scss +11 -0
@@ -0,0 +1,227 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
+ var _excluded = ["className", "clearButtonLabelText", "hideScopesLabel", "labelText", "onChange", "onSubmit", "placeHolderText", "scopes", "scopesTypeLabel", "scopeToString", "selectedScopes", "sortItems", "submitLabel", "translateWithId", "value"];
6
+ /**
7
+ * Copyright IBM Corp. 2024, 2024
8
+ *
9
+ * This source code is licensed under the Apache-2.0 license found in the
10
+ * LICENSE file in the root directory of this source tree.
11
+ */
12
+
13
+ // Import portions of React that are needed.
14
+ import React, { useEffect, useState } from 'react';
15
+
16
+ // Other standard imports.
17
+ import PropTypes from 'prop-types';
18
+ import cx from 'classnames';
19
+ import { getDevtoolsProps } from '../../global/js/utils/devtools';
20
+ import { pkg } from '../../settings';
21
+
22
+ // Carbon and package components we use.
23
+ import { Search, Button, MultiSelect } from '@carbon/react';
24
+
25
+ // The block part of our conventional BEM class names (blockClass__E--M).
26
+ var blockClass = "".concat(pkg.prefix, "--search-bar");
27
+ var componentName = 'SearchBar';
28
+
29
+ // NOTE: the component SCSS is not imported here: it is rolled up separately.
30
+
31
+ // Default values for props
32
+ var defaults = {
33
+ onSubmit: function onSubmit() {},
34
+ onChange: function onChange() {},
35
+ scopes: [],
36
+ selectedScopes: [],
37
+ hideScopesLabel: true
38
+ };
39
+
40
+ /**
41
+ * Search bar with input field and search button
42
+ */
43
+ export var SearchBar = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
44
+ var className = _ref.className,
45
+ clearButtonLabelText = _ref.clearButtonLabelText,
46
+ _ref$hideScopesLabel = _ref.hideScopesLabel,
47
+ hideScopesLabel = _ref$hideScopesLabel === void 0 ? defaults.hideScopesLabel : _ref$hideScopesLabel,
48
+ labelText = _ref.labelText,
49
+ _ref$onChange = _ref.onChange,
50
+ onChange = _ref$onChange === void 0 ? defaults.onChange : _ref$onChange,
51
+ _ref$onSubmit = _ref.onSubmit,
52
+ onSubmit = _ref$onSubmit === void 0 ? defaults.onSubmit : _ref$onSubmit,
53
+ placeHolderText = _ref.placeHolderText,
54
+ _ref$scopes = _ref.scopes,
55
+ scopes = _ref$scopes === void 0 ? defaults.scopes : _ref$scopes,
56
+ scopesTypeLabel = _ref.scopesTypeLabel,
57
+ scopeToString = _ref.scopeToString,
58
+ _ref$selectedScopes = _ref.selectedScopes,
59
+ selectedScopes = _ref$selectedScopes === void 0 ? defaults.selectedScopes : _ref$selectedScopes,
60
+ sortItems = _ref.sortItems,
61
+ submitLabel = _ref.submitLabel,
62
+ translateWithId = _ref.translateWithId,
63
+ value = _ref.value,
64
+ rest = _objectWithoutProperties(_ref, _excluded);
65
+ var _useState = useState(value || ''),
66
+ _useState2 = _slicedToArray(_useState, 2),
67
+ text = _useState2[0],
68
+ setText = _useState2[1];
69
+ var _useState3 = useState(selectedScopes || []),
70
+ _useState4 = _slicedToArray(_useState3, 2),
71
+ _selectedScopes = _useState4[0],
72
+ setSelectedScopes = _useState4[1];
73
+ var _useState5 = useState(false),
74
+ _useState6 = _slicedToArray(_useState5, 2),
75
+ isInputDirty = _useState6[0],
76
+ setIsInputDirty = _useState6[1];
77
+ useEffect(function () {
78
+ if (!text || !text.length) {
79
+ setIsInputDirty(false);
80
+ } else {
81
+ setIsInputDirty(true);
82
+ }
83
+ }, [text]);
84
+ /**
85
+ * Handler for form submit that calls onSubmit prop.
86
+ * @param {Event} event Submit event generated.
87
+ */
88
+ var handleSubmit = function handleSubmit(event) {
89
+ event.preventDefault();
90
+ var eventObject = {
91
+ value: text
92
+ };
93
+ if (scopes.length > 0) {
94
+ eventObject.selectedScopes = _selectedScopes;
95
+ }
96
+ onSubmit(eventObject);
97
+ };
98
+
99
+ /**
100
+ * Handler for when scope selection changes that calls onChangeProp.
101
+ * @param {{selectedItems: Array<any>}} {selectedItems} Object containing array of selected items.
102
+ */
103
+ var handleSearchScopeChange = function handleSearchScopeChange(_ref2) {
104
+ var selectedItems = _ref2.selectedItems;
105
+ setSelectedScopes(selectedItems);
106
+ onChange({
107
+ selectedScopes: selectedItems,
108
+ value: text
109
+ });
110
+ };
111
+
112
+ /**
113
+ * Handler for search input changes that calls onChange prop.
114
+ * @param {KeyboardEvent} event Event object from input change.
115
+ */
116
+ var handleInputChange = function handleInputChange(event) {
117
+ var value = event.target.value;
118
+ var eventObject = {
119
+ value: value
120
+ };
121
+ if (scopes.length > 0) {
122
+ eventObject.selectedScopes = selectedScopes;
123
+ }
124
+ setText(value);
125
+ onChange(eventObject);
126
+ };
127
+ return /*#__PURE__*/React.createElement("form", _extends({}, rest, {
128
+ ref: ref
129
+ }, getDevtoolsProps(componentName), {
130
+ className: cx(blockClass, className, _defineProperty({}, "".concat(blockClass, "--hide-scopes-label"), hideScopesLabel)),
131
+ onSubmit: handleSubmit
132
+ }), scopes !== null && scopes !== void 0 && scopes.length ? /*#__PURE__*/React.createElement(MultiSelect, {
133
+ id: "".concat(blockClass, "__multi-select"),
134
+ name: "search-scopes",
135
+ className: "".concat(blockClass, "__scopes"),
136
+ label: scopesTypeLabel,
137
+ onChange: handleSearchScopeChange,
138
+ initialSelectedItems: selectedScopes,
139
+ items: scopes,
140
+ itemToString: scopeToString,
141
+ translateWithId: translateWithId,
142
+ sortItems: sortItems,
143
+ size: "lg"
144
+ }) : null, /*#__PURE__*/React.createElement(Search, {
145
+ className: "".concat(blockClass, "__input"),
146
+ closeButtonLabelText: clearButtonLabelText,
147
+ labelText: labelText || '',
148
+ name: "search-input",
149
+ onChange: handleInputChange,
150
+ placeholder: placeHolderText,
151
+ value: text,
152
+ size: "lg"
153
+ }), /*#__PURE__*/React.createElement(Button, {
154
+ name: "search-submit",
155
+ kind: "primary",
156
+ type: "submit",
157
+ className: "".concat(blockClass, "__submit"),
158
+ disabled: !isInputDirty
159
+ }, submitLabel));
160
+ });
161
+
162
+ // Return a placeholder if not released and not enabled by feature flag
163
+ SearchBar = pkg.checkComponentEnabled(SearchBar, componentName);
164
+
165
+ // The display name of the component, used by React. Note that displayName
166
+ // is used in preference to relying on function.name.
167
+ SearchBar.displayName = componentName;
168
+ var conditionalScopePropValidator = function conditionalScopePropValidator(props, propName, componentName) {
169
+ if (props.scopes && props.scopes.length > 0 && !props[propName]) {
170
+ return new Error("Required `".concat(propName, "` when `scopes` prop type is supplied to `").concat(componentName, "`. Validation failed."));
171
+ }
172
+ for (var _len = arguments.length, rest = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
173
+ rest[_key - 3] = arguments[_key];
174
+ }
175
+ return PropTypes.string.apply(PropTypes, [props, propName, componentName].concat(rest));
176
+ };
177
+
178
+ // The types and DocGen commentary for the component props,
179
+ // in alphabetical order (for consistency).
180
+ // See https://www.npmjs.com/package/prop-types#usage.
181
+ SearchBar.propTypes = {
182
+ /** @type {string} Optional additional class name. */
183
+ className: PropTypes.string,
184
+ /** @type {string} The label text for the search text input. */
185
+ clearButtonLabelText: PropTypes.string.isRequired,
186
+ /**
187
+ * Whether or not the scopes MultiSelect label is visually hidden.
188
+ */
189
+ hideScopesLabel: PropTypes.bool,
190
+ /** @type {string} The label text for the search text input. */
191
+ labelText: PropTypes.string,
192
+ /** @type {Function} Function handler for when the user changes their query search. */
193
+ onChange: PropTypes.func,
194
+ /** @type {Function} Function handler for when the user submits a search. */
195
+ onSubmit: PropTypes.func,
196
+ /** @type {string} Placeholder text to be displayed in the search input. */
197
+ placeHolderText: PropTypes.string.isRequired,
198
+ /** @type {Function} Function to get the text for each scope to display in dropdown. */
199
+ scopeToString: PropTypes.func,
200
+ /** @type {Array<any>} Array of allowed search scopes. */
201
+ scopes: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object])),
202
+ /** @type {string} The name text for the search scope type. */
203
+ // eslint-disable-next-line react/require-default-props
204
+ scopesTypeLabel: conditionalScopePropValidator,
205
+ /** @type {Array<any> Array of initially selected search scopes. */
206
+ selectedScopes: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object])),
207
+ /**
208
+ * Optional custom sorting algorithm for an array of scope items.
209
+ * By default, scope items are sorted in ascending alphabetical order,
210
+ * with "selected" items moved to the start of the scope items array.
211
+ */
212
+ sortItems: PropTypes.func,
213
+ // eslint-disable-line react/require-default-props
214
+
215
+ /** @type {string} The label text for the search submit button. */
216
+ submitLabel: PropTypes.string.isRequired,
217
+ /**
218
+ * Provide accessible label text for the scopes MultiSelect.
219
+ */
220
+ titleText: PropTypes.string,
221
+ /** @type {func} Callback function for translating MultiSelect's child ListBoxMenuIcon SVG title. */
222
+ translateWithId: PropTypes.func,
223
+ // eslint-disable-line react/require-default-props
224
+
225
+ /** @type {string} Search query value. */
226
+ value: PropTypes.string
227
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright IBM Corp. 2024, 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ export { SearchBar } from './SearchBar';
@@ -43,7 +43,18 @@ export { EditTearsheetNarrow } from './EditTearsheetNarrow';
43
43
  export { EditFullPage } from './EditFullPage';
44
44
  export { EditUpdateCards } from './EditUpdateCards';
45
45
  export { Checklist } from './Checklist';
46
+ export { Coachmark } from './Coachmark';
47
+ export { CoachmarkBeacon } from './CoachmarkBeacon';
48
+ export { CoachmarkButton } from './CoachmarkButton';
49
+ export { CoachmarkFixed } from './CoachmarkFixed';
50
+ export { CoachmarkOverlayElement } from './CoachmarkOverlayElement';
51
+ export { CoachmarkOverlayElements } from './CoachmarkOverlayElements';
52
+ export { CoachmarkStack } from './CoachmarkStack';
46
53
  export { Guidebanner, GuidebannerElement, GuidebannerElementButton, GuidebannerElementLink } from './Guidebanner';
47
54
  export { InlineTip, InlineTipButton, InlineTipLink } from './InlineTip';
48
55
  export { NonLinearReading } from './NonLinearReading';
49
- export { DelimitedList } from './DelimitedList';
56
+ export { InterstitialScreen } from './InterstitialScreen';
57
+ export { InterstitialScreenView } from './InterstitialScreenView';
58
+ export { InterstitialScreenViewModule } from './InterstitialScreenViewModule';
59
+ export { DelimitedList } from './DelimitedList';
60
+ export { SearchBar } from './SearchBar';
@@ -69,7 +69,18 @@ var defaults = {
69
69
  EditTearsheetNarrow: false,
70
70
  EditFullPage: false,
71
71
  EditUpdateCards: false,
72
+ /* new component flags here - comment used by generate CLI */
73
+
74
+ // Novice to pro components not yet reviewed and released:
75
+ Coachmark: false,
76
+ CoachmarkBeacon: false,
77
+ CoachmarkButton: false,
78
+ CoachmarkFixed: false,
79
+ CoachmarkOverlayElement: false,
80
+ CoachmarkOverlayElements: false,
81
+ CoachmarkStack: false,
72
82
  DelimitedList: false,
83
+ SearchBar: false,
73
84
  /* new component flags here - comment used by generate CLI */
74
85
 
75
86
  // Novice to pro components not yet reviewed and released:
@@ -81,6 +92,9 @@ var defaults = {
81
92
  InlineTip: false,
82
93
  InlineTipButton: false,
83
94
  InlineTipLink: false,
95
+ InterstitialScreen: false,
96
+ InterstitialScreenView: false,
97
+ InterstitialScreenViewModule: false,
84
98
  NonLinearReading: false
85
99
  },
86
100
  // feature level flags
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof3 = require("@babel/runtime/helpers/typeof");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.Card = void 0;
9
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
10
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
12
11
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
@@ -26,7 +25,7 @@ var _excluded = ["actionIcons", "actionsPlacement", "children", "className", "cl
26
25
  // LICENSE file in the root directory of this source tree.
27
26
  //
28
27
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
29
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
28
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
30
29
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
31
30
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
32
31
  var componentName = 'Card';
@@ -169,7 +168,7 @@ var Card = exports.Card = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
169
168
  var clickable = hasClickEvent && !productive || hasClickEvent && productive && clickZone === 'one';
170
169
  var cardProps = _objectSpread(_objectSpread({}, rest), {}, {
171
170
  ref: ref,
172
- className: (0, _classnames.default)(blockClass, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(blockClass, "__productive"), productive), "".concat(blockClass, "__clickable"), clickable), "".concat(blockClass, "__media-left"), mediaPosition === 'left'), "".concat(blockClass, "--has-slug"), clickable && slug === true || (0, _typeof2.default)(slug) === 'object'), className)
171
+ className: (0, _classnames.default)(blockClass, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(blockClass, "__productive"), productive), "".concat(blockClass, "__clickable"), clickable), "".concat(blockClass, "__media-left"), mediaPosition === 'left'), "".concat(blockClass, "--has-slug"), !!slug), className)
173
172
  }, clickable && clickableProps);
174
173
  return cardProps;
175
174
  };
@@ -70,9 +70,9 @@ var CardHeader = exports.CardHeader = function CardHeader(_ref) {
70
70
  }));
71
71
  var normalizedSlug;
72
72
  if (slug) {
73
- if (inClickableCard) {
73
+ if (inClickableCard || typeof slug === 'boolean') {
74
74
  normalizedSlug = hollowSlugIcon;
75
- } else if (typeof slug !== 'boolean') {
75
+ } else {
76
76
  normalizedSlug = /*#__PURE__*/_react.default.cloneElement(slug, {
77
77
  size: label && title || title && titleSize === 'large' ? 'sm' : 'xs'
78
78
  });
@@ -203,9 +203,11 @@ var Carousel = exports.Carousel = /*#__PURE__*/_react.default.forwardRef(functio
203
203
  (0, _react.useEffect)(function () {
204
204
  function handleWheel(event) {
205
205
  // update the scroll position
206
- event.stopPropagation();
207
- event.preventDefault();
208
- event.cancelBubble = false;
206
+ if (event.shiftKey) {
207
+ event.stopPropagation();
208
+ event.preventDefault();
209
+ event.cancelBubble = false;
210
+ }
209
211
  }
210
212
  var scrollDiv = scrollRef.current;
211
213
  if (scrollDiv) {
@@ -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.Coachmark = 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 _classnames = _interopRequireDefault(require("classnames"));
14
+ var _propTypes = _interopRequireWildcard(require("prop-types"));
15
+ var _reactDom = require("react-dom");
16
+ var _CoachmarkOverlay = require("./CoachmarkOverlay");
17
+ var _context = require("./utils/context");
18
+ var _enums = require("./utils/enums");
19
+ var _hooks = require("./utils/hooks");
20
+ var _devtools = require("../../global/js/utils/devtools");
21
+ var _settings = require("../../settings");
22
+ var _lodash = require("lodash");
23
+ var _excluded = ["align", "children", "className", "onClose", "overlayClassName", "overlayKind", "overlayRef", "portalTarget", "positionTune", "target", "theme"];
24
+ /**
25
+ * Copyright IBM Corp. 2023, 2024
26
+ *
27
+ * This source code is licensed under the Apache-2.0 license found in the
28
+ * LICENSE file in the root directory of this source tree.
29
+ */
30
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
31
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
32
+ // The block part of our conventional BEM class names (blockClass__E--M).
33
+ var blockClass = "".concat(_settings.pkg.prefix, "--coachmark");
34
+ var overlayBlockClass = "".concat(blockClass, "-overlay");
35
+ var componentName = 'Coachmark';
36
+ var defaults = {
37
+ align: 'bottom',
38
+ onClose: function onClose() {},
39
+ overlayKind: 'tooltip',
40
+ theme: 'light'
41
+ };
42
+
43
+ /**
44
+ * Coachmarks are used to call out specific functionality or concepts
45
+ * within the UI that may not be intuitive but are important for the
46
+ * user to gain understanding of the product's main value and discover new use cases.
47
+ */
48
+
49
+ var Coachmark = exports.Coachmark = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
50
+ var _document$querySelect;
51
+ var _ref$align = _ref.align,
52
+ align = _ref$align === void 0 ? defaults.align : _ref$align,
53
+ children = _ref.children,
54
+ className = _ref.className,
55
+ _ref$onClose = _ref.onClose,
56
+ onClose = _ref$onClose === void 0 ? defaults.onClose : _ref$onClose,
57
+ overlayClassName = _ref.overlayClassName,
58
+ _ref$overlayKind = _ref.overlayKind,
59
+ overlayKind = _ref$overlayKind === void 0 ? defaults.overlayKind : _ref$overlayKind,
60
+ overlayRef = _ref.overlayRef,
61
+ portalTarget = _ref.portalTarget,
62
+ positionTune = _ref.positionTune,
63
+ target = _ref.target,
64
+ _ref$theme = _ref.theme,
65
+ theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
66
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
67
+ var isBeacon = overlayKind === _enums.COACHMARK_OVERLAY_KIND.TOOLTIP;
68
+ var isStacked = overlayKind === _enums.COACHMARK_OVERLAY_KIND.STACKED;
69
+ var portalNode = portalTarget ? (_document$querySelect = document.querySelector(portalTarget)) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector('body') : document.querySelector('body');
70
+ var _useState = (0, _react.useState)(isStacked),
71
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
72
+ isOpen = _useState2[0],
73
+ setIsOpen = _useState2[1];
74
+ var _useState3 = (0, _react.useState)(false),
75
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
76
+ shouldResetPosition = _useState4[0],
77
+ setShouldResetPosition = _useState4[1];
78
+ var _useState5 = (0, _react.useState)(),
79
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
80
+ targetRect = _useState6[0],
81
+ setTargetRect = _useState6[1];
82
+ var _useState7 = (0, _react.useState)({
83
+ x: 0,
84
+ y: 0
85
+ }),
86
+ _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
87
+ targetOffset = _useState8[0],
88
+ setTargetOffset = _useState8[1];
89
+ var overlayBackupRef = (0, _react.useRef)();
90
+ var backupRef = (0, _react.useRef)();
91
+ var _coachmarkRef = ref || backupRef;
92
+ var _overlayRef = overlayRef || overlayBackupRef;
93
+ var closeOverlay = function closeOverlay() {
94
+ setIsOpen(false);
95
+ };
96
+ var handleClose = (0, _react.useCallback)(function () {
97
+ if (isStacked) {
98
+ // If stacked, do not unmount,
99
+ // only call its ("parent") onClose method.
100
+ onClose();
101
+ } else {
102
+ setIsOpen(false);
103
+ onClose();
104
+ }
105
+ }, [isStacked, onClose]);
106
+ var escFunction = (0, _react.useCallback)(function (event) {
107
+ if (event.key === 'Escape') {
108
+ handleClose();
109
+ }
110
+ }, [handleClose]);
111
+ (0, _react.useEffect)(function () {
112
+ document.addEventListener('keydown', escFunction, false);
113
+ return function () {
114
+ document.removeEventListener('keydown', escFunction, false);
115
+ };
116
+ }, [escFunction]);
117
+ var handleTargetClick = function handleTargetClick(e) {
118
+ setTargetRect(e.target.getBoundingClientRect());
119
+ setTargetOffset({
120
+ x: e.target.offsetLeft,
121
+ y: e.target.offsetTop
122
+ });
123
+ if (isBeacon) {
124
+ // toggle open/closed for beacons
125
+ setIsOpen(function (prevIsOpen) {
126
+ return !prevIsOpen;
127
+ });
128
+ } else {
129
+ // reset position for all other kinds
130
+ setIsOpen(false);
131
+ setShouldResetPosition(true);
132
+ }
133
+ };
134
+ var contextValue = {
135
+ buttonProps: {
136
+ 'aria-expanded': isOpen,
137
+ tabIndex: 0,
138
+ onClick: handleTargetClick,
139
+ // Compensate for accidental open/close on double-click.
140
+ // Only open on double-click.
141
+ onDoubleClick: handleTargetClick
142
+ },
143
+ closeButtonProps: {
144
+ onClick: handleClose
145
+ },
146
+ targetRect: targetRect,
147
+ targetOffset: targetOffset,
148
+ align: align,
149
+ positionTune: positionTune
150
+ };
151
+ var handleResize = (0, _lodash.throttle)(function () {
152
+ closeOverlay();
153
+ }, 2000);
154
+
155
+ // instead of toggling on/off,
156
+ // keep open and reset to original position
157
+ (0, _react.useEffect)(function () {
158
+ if (shouldResetPosition) {
159
+ setShouldResetPosition(false);
160
+ setIsOpen(true);
161
+ }
162
+ }, [shouldResetPosition]);
163
+
164
+ // On unmount:
165
+ // - DO NOT "Close()" the coachmark.
166
+ // - This triggers a "signal" to close it forever.
167
+ // - "Closing" should only ever be a user-triggered event.
168
+ // - DO "hide" the coachmark.
169
+ // - The app is doing the action for the user.
170
+ // - The user will have the opportunity to open it again.
171
+ (0, _react.useEffect)(function () {
172
+ return function () {
173
+ return setIsOpen(false);
174
+ };
175
+ }, []);
176
+ (0, _hooks.useClickOutsideElement)(_coachmarkRef, _overlayRef, overlayKind, closeOverlay);
177
+ (0, _hooks.useWindowEvent)('resize', handleResize);
178
+ return /*#__PURE__*/_react.default.createElement(_context.CoachmarkContext.Provider, {
179
+ value: contextValue
180
+ }, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
181
+ className: (0, _classnames.default)(blockClass, "".concat(blockClass, "__").concat(theme), className),
182
+ ref: _coachmarkRef
183
+ }, rest, (0, _devtools.getDevtoolsProps)(componentName)), target, isOpen && /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/_react.default.createElement(_CoachmarkOverlay.CoachmarkOverlay, {
184
+ ref: _overlayRef,
185
+ fixedIsVisible: false,
186
+ kind: overlayKind,
187
+ onClose: handleClose,
188
+ theme: theme,
189
+ className: (0, _classnames.default)(overlayClassName, "".concat(overlayBlockClass, "--is-visible"))
190
+ }, children), portalNode)));
191
+ });
192
+
193
+ // Return a placeholder if not released and not enabled by feature flag
194
+ exports.Coachmark = Coachmark = _settings.pkg.checkComponentEnabled(Coachmark, componentName);
195
+
196
+ // The display name of the component, used by React. Note that displayName
197
+ // is used in preference to relying on function.name.
198
+ Coachmark.displayName = componentName;
199
+
200
+ // The types and DocGen commentary for the component props,
201
+ // in alphabetical order (for consistency).
202
+ // See https://www.npmjs.com/package/prop-types#usage.
203
+ Coachmark.propTypes = {
204
+ /**
205
+ * Where to render the Coachmark relative to its target.
206
+ * Applies only to Floating and Tooltip Coachmarks.
207
+ * @see COACHMARK_ALIGNMENT
208
+ */
209
+ align: _propTypes.default.oneOf(['bottom', 'bottom-left', 'bottom-right', 'left', 'left-top', 'left-bottom', 'right', 'right-top', 'right-bottom', 'top', 'top-left', 'top-right']),
210
+ /**
211
+ * Coachmark should use a single CoachmarkOverlayElements component as a child.
212
+ * @see CoachmarkOverlayElements
213
+ */
214
+ children: _propTypes.default.node.isRequired,
215
+ /**
216
+ * Optional class name for this component.
217
+ */
218
+ className: _propTypes.default.string,
219
+ /**
220
+ * Function to call when the Coachmark closes.
221
+ */
222
+ onClose: _propTypes.default.func,
223
+ /**
224
+ * Optional class name for the Coachmark Overlay component.
225
+ */
226
+ overlayClassName: _propTypes.default.string,
227
+ /**
228
+ * What kind or style of Coachmark to render.
229
+ */
230
+ overlayKind: _propTypes.default.oneOf(['tooltip', 'floating', 'stacked']),
231
+ overlayRef: _propTypes.default.oneOfType([
232
+ // Either a function
233
+ _propTypes.default.func,
234
+ // Or the instance of a DOM native element (see the note about SSR)
235
+ _propTypes.default.shape({
236
+ current: _propTypes.default.instanceOf(_propTypes.Component)
237
+ })]),
238
+ /**
239
+ * By default, the Coachmark will be appended to the end of `document.body`.
240
+ * The Coachmark will remain persistent as the user navigates the app until
241
+ * the user closes the Coachmark.
242
+ *
243
+ * Alternatively, the app developer can tightly couple the Coachmark to a DOM
244
+ * element or other component by specifying a CSS selector. The Coachmark will
245
+ * remain visible as long as that element remains visible or mounted. When the
246
+ * element is hidden or component is unmounted, the Coachmark will disappear.
247
+ */
248
+ portalTarget: _propTypes.default.string,
249
+ /**
250
+ * Fine tune the position of the target in pixels. Applies only to Beacons.
251
+ */
252
+ positionTune: _propTypes.default.shape({
253
+ x: _propTypes.default.number,
254
+ y: _propTypes.default.number
255
+ }),
256
+ /**
257
+ * The optional button or beacon that the user will click to show the Coachmark.
258
+ */
259
+ target: _propTypes.default.node,
260
+ /**
261
+ * Determines the theme of the component.
262
+ */
263
+ theme: _propTypes.default.oneOf(['light', 'dark'])
264
+ };