@carbon/ibm-products 1.57.0 → 1.59.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. package/css/index-full-carbon.css +392 -944
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +4 -4
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon.css +346 -900
  6. package/css/index-without-carbon.css.map +1 -1
  7. package/css/index-without-carbon.min.css +3 -3
  8. package/css/index-without-carbon.min.css.map +1 -1
  9. package/css/index.css +390 -944
  10. package/css/index.css.map +1 -1
  11. package/css/index.min.css +4 -4
  12. package/css/index.min.css.map +1 -1
  13. package/es/components/Checklist/Checklist.js +277 -0
  14. package/es/components/Checklist/ChecklistChart.js +98 -0
  15. package/es/components/Checklist/ChecklistIcon.js +105 -0
  16. package/es/components/Checklist/index.js +8 -0
  17. package/es/components/CreateFullPage/CreateFullPage.js +25 -3
  18. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -0
  19. package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +34 -18
  20. package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +2 -37
  21. package/es/components/InlineTip/InlineTip.js +5 -1
  22. package/es/components/InlineTip/InlineTipButton.js +1 -8
  23. package/es/components/InlineTip/InlineTipLink.js +1 -8
  24. package/es/components/NonLinearReading/NonLinearReading.js +9 -4
  25. package/es/components/index.js +2 -1
  26. package/es/global/js/package-settings.js +1 -0
  27. package/es/global/js/utils/test-helper.js +2 -2
  28. package/lib/components/Checklist/Checklist.js +267 -0
  29. package/lib/components/Checklist/ChecklistChart.js +88 -0
  30. package/lib/components/Checklist/ChecklistIcon.js +92 -0
  31. package/lib/components/Checklist/index.js +12 -0
  32. package/lib/components/CreateFullPage/CreateFullPage.js +24 -2
  33. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -0
  34. package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +35 -19
  35. package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +2 -40
  36. package/lib/components/InlineTip/InlineTip.js +4 -0
  37. package/lib/components/InlineTip/InlineTipButton.js +2 -9
  38. package/lib/components/InlineTip/InlineTipLink.js +2 -9
  39. package/lib/components/NonLinearReading/NonLinearReading.js +8 -3
  40. package/lib/components/index.js +8 -1
  41. package/lib/global/js/package-settings.js +1 -0
  42. package/lib/global/js/utils/test-helper.js +2 -2
  43. package/package.json +10 -10
  44. package/scss/components/Checklist/_checklist.scss +231 -0
  45. package/scss/components/Checklist/_index.scss +8 -0
  46. package/scss/components/Checklist/_storybook-styles.scss +13 -0
  47. package/scss/components/ComboButton/_combo-button.scss +2 -1
  48. package/scss/components/Datagrid/styles/_datagrid.scss +31 -5
  49. package/scss/components/Datagrid/styles/addons/_RowSizeDropdown.scss +6 -1
  50. package/scss/components/NonLinearReading/_non-linear-reading.scss +76 -64
  51. package/scss/components/Toolbar/_toolbar.scss +6 -3
  52. package/scss/components/_index.scss +1 -0
@@ -0,0 +1,277 @@
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 = ["chartValue", "chartLabel", "checklistAriaLabel", "checklistToggleAriaLabel", "className", "onClickViewAll", "onToggle", "open", "showToggle", "taskLists", "theme", "title", "viewAllLabel"];
6
+ /**
7
+ * Copyright IBM Corp. 2023, 2023
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
+ /**
14
+ * TODO: Breakdown titles, icons, clickable items into sub-components
15
+ * See
16
+ * ModifiedTabs (ModifiedTabLabelNew, ModifiedTabLabelWithClose)
17
+ * PageHeader (PageHeaderTitle, PageHeaderUtils)
18
+ */
19
+
20
+ // Import portions of React that are needed.
21
+ import React, { useEffect, useRef, useState } from 'react';
22
+
23
+ // Other standard imports.
24
+ import PropTypes from 'prop-types';
25
+ import cx from 'classnames';
26
+ import { getDevtoolsProps } from '../../global/js/utils/devtools';
27
+ import uuidv4 from '../../global/js/utils/uuidv4';
28
+ import { pkg /*, carbon */ } from '../../settings';
29
+
30
+ // Carbon and package components we use.
31
+ /* TODO: @import(s) of carbon components and other package components. */
32
+ import { Button } from 'carbon-components-react';
33
+ import { ChevronUp16 } from '@carbon/icons-react';
34
+ import { ChecklistIcon } from './ChecklistIcon';
35
+ import { ChecklistChart } from './ChecklistChart';
36
+
37
+ // The block part of our conventional BEM class names (blockClass__E--M).
38
+ var blockClass = "".concat(pkg.prefix, "--checklist");
39
+ var componentName = 'Checklist';
40
+
41
+ // NOTE: the component SCSS is not imported here: it is rolled up separately.
42
+
43
+ // Default values can be included here and then assigned to the prop params,
44
+ // e.g. prop = defaults.prop,
45
+ // This gathers default values together neatly and ensures non-primitive
46
+ // values are initialized early to avoid react making unnecessary re-renders.
47
+ // Note that default values are not required for props that are 'required',
48
+ // nor for props where the component can apply undefined values reasonably.
49
+ // Default values should be provided when the component needs to make a choice
50
+ // or assumption when a prop is not supplied.
51
+
52
+ // Default values for props
53
+ var defaults = {
54
+ checklistAriaLabel: 'Checklist',
55
+ checklistToggleAriaLabel: 'Checklist toggle',
56
+ onClickViewAll: function onClickViewAll() {},
57
+ onToggle: function onToggle() {},
58
+ open: true,
59
+ showToggle: true,
60
+ taskLists: [],
61
+ theme: 'light'
62
+ };
63
+
64
+ /**
65
+ * TODO: A description of the component.
66
+ */
67
+ export var Checklist = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
68
+ var chartValue = _ref.chartValue,
69
+ chartLabel = _ref.chartLabel,
70
+ _ref$checklistAriaLab = _ref.checklistAriaLabel,
71
+ checklistAriaLabel = _ref$checklistAriaLab === void 0 ? defaults.checklistAriaLabel : _ref$checklistAriaLab,
72
+ _ref$checklistToggleA = _ref.checklistToggleAriaLabel,
73
+ checklistToggleAriaLabel = _ref$checklistToggleA === void 0 ? defaults.checklistToggleAriaLabel : _ref$checklistToggleA,
74
+ className = _ref.className,
75
+ _ref$onClickViewAll = _ref.onClickViewAll,
76
+ onClickViewAll = _ref$onClickViewAll === void 0 ? defaults.onClickViewAll : _ref$onClickViewAll,
77
+ _ref$onToggle = _ref.onToggle,
78
+ onToggle = _ref$onToggle === void 0 ? defaults.onToggle : _ref$onToggle,
79
+ _ref$open = _ref.open,
80
+ open = _ref$open === void 0 ? defaults.open : _ref$open,
81
+ _ref$showToggle = _ref.showToggle,
82
+ showToggle = _ref$showToggle === void 0 ? defaults.showToggle : _ref$showToggle,
83
+ _ref$taskLists = _ref.taskLists,
84
+ taskLists = _ref$taskLists === void 0 ? defaults.taskLists : _ref$taskLists,
85
+ _ref$theme = _ref.theme,
86
+ theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
87
+ title = _ref.title,
88
+ viewAllLabel = _ref.viewAllLabel,
89
+ rest = _objectWithoutProperties(_ref, _excluded);
90
+ var _useState = useState(open),
91
+ _useState2 = _slicedToArray(_useState, 2),
92
+ isOpen = _useState2[0],
93
+ setIsOpen = _useState2[1];
94
+ var listContainerId = useRef(uuidv4()).current;
95
+ var chartLabelId = useRef(uuidv4()).current;
96
+
97
+ // Don't use this test: {chartValue && chartLabel && (render...)}.
98
+ // If `chartValue` is 0 (zero) - a valid value - then it will render 0 and skip the remaining statement.
99
+ // Use this test instead: {chartLabelAndValue && (render...)}.
100
+ // The ChecklistChart component will validate `chartValue`.
101
+ var chartLabelAndValue = typeof chartValue === 'number' && chartLabel;
102
+ var handleClickToggle = function handleClickToggle() {
103
+ setIsOpen(function (prevOpen) {
104
+ return !prevOpen;
105
+ });
106
+ };
107
+ var handleClickViewAll = function handleClickViewAll() {
108
+ onClickViewAll();
109
+ };
110
+
111
+ // If state changes, then trigger callback.
112
+ useEffect(function () {
113
+ onToggle(isOpen);
114
+ }, [isOpen, onToggle]);
115
+
116
+ // If the "open" prop is changed after initialization,
117
+ // then update internal state.
118
+ useEffect(function () {
119
+ setIsOpen(open);
120
+ }, [open]);
121
+ return /*#__PURE__*/React.createElement("aside", _extends({}, rest, {
122
+ "aria-label": checklistAriaLabel,
123
+ className: cx(blockClass,
124
+ // Apply the block class to the main HTML element
125
+ className, // Apply any supplied class names to the main HTML element.
126
+ // example: `${blockClass}__template-string-class-${kind}-n-${size}`,
127
+ _defineProperty({}, "".concat(blockClass, "__closed"), !isOpen)),
128
+ ref: ref
129
+ }, getDevtoolsProps(componentName)), (title || chartLabelAndValue) && /*#__PURE__*/React.createElement("header", {
130
+ className: "".concat(blockClass, "__header")
131
+ }, chartLabelAndValue && /*#__PURE__*/React.createElement(ChecklistChart, {
132
+ "aria-labelledby": chartLabelId,
133
+ theme: theme,
134
+ value: chartValue
135
+ }), /*#__PURE__*/React.createElement("div", {
136
+ className: "".concat(blockClass, "__titles")
137
+ }, title && /*#__PURE__*/React.createElement("h2", {
138
+ className: "".concat(blockClass, "__title")
139
+ }, title), chartLabelAndValue && /*#__PURE__*/React.createElement("h3", {
140
+ id: chartLabelId,
141
+ className: "".concat(blockClass, "__chart-label")
142
+ }, chartLabel)), showToggle && /*#__PURE__*/React.createElement(Button, {
143
+ "aria-controls": listContainerId,
144
+ "aria-expanded": isOpen,
145
+ "aria-label": checklistToggleAriaLabel,
146
+ className: "".concat(blockClass, "__toggle"),
147
+ kind: "ghost",
148
+ onClick: handleClickToggle,
149
+ size: "small"
150
+ }, /*#__PURE__*/React.createElement(ChevronUp16, {
151
+ className: cx("".concat(blockClass, "__chevron"))
152
+ }))), /*#__PURE__*/React.createElement("div", {
153
+ id: listContainerId,
154
+ className: "".concat(blockClass, "__content-outer")
155
+ }, /*#__PURE__*/React.createElement("div", {
156
+ className: "".concat(blockClass, "__content-inner")
157
+ }, /*#__PURE__*/React.createElement("section", {
158
+ className: cx("".concat(blockClass, "__body"))
159
+ }, taskLists.map(function (list, index) {
160
+ return /*#__PURE__*/React.createElement("div", {
161
+ className: "".concat(blockClass, "__list-group"),
162
+ key: "".concat(list.title, "-").concat(index)
163
+ }, list.title && /*#__PURE__*/React.createElement("h3", {
164
+ title: list.title,
165
+ className: "".concat(blockClass, "__list-title")
166
+ }, list.title), /*#__PURE__*/React.createElement("ol", {
167
+ className: "".concat(blockClass, "__list")
168
+ }, list.tasks.map(function (item, index) {
169
+ return /*#__PURE__*/React.createElement("li", {
170
+ className: "".concat(blockClass, "__list-item"),
171
+ key: "".concat(item.label, "-").concat(index)
172
+ }, /*#__PURE__*/React.createElement(ChecklistIcon, {
173
+ kind: item.kind
174
+ }), typeof item.onClick === 'function' ? /*#__PURE__*/React.createElement(Button, {
175
+ className: cx("".concat(blockClass, "__button"), _defineProperty({}, "".concat(blockClass, "__button--error"), item.kind === 'error')),
176
+ onClick: function onClick() {
177
+ item.onClick(item);
178
+ },
179
+ size: "small"
180
+ }, /*#__PURE__*/React.createElement("div", {
181
+ title: item.label
182
+ }, item.label)) : /*#__PURE__*/React.createElement("span", {
183
+ className: cx("".concat(blockClass, "__label"), "".concat(blockClass, "__label--").concat(item.kind)),
184
+ title: item.label
185
+ }, item.label));
186
+ })));
187
+ })), viewAllLabel && /*#__PURE__*/React.createElement("footer", {
188
+ className: "".concat(blockClass, "__footer")
189
+ }, /*#__PURE__*/React.createElement(Button, {
190
+ className: cx("".concat(blockClass, "__button"), "".concat(blockClass, "__view-all")),
191
+ onClick: handleClickViewAll,
192
+ size: "small"
193
+ }, /*#__PURE__*/React.createElement("div", null, viewAllLabel))))));
194
+ });
195
+
196
+ // Return a placeholder if not released and not enabled by feature flag
197
+ Checklist = pkg.checkComponentEnabled(Checklist, componentName);
198
+
199
+ // The display name of the component, used by React. Note that displayName
200
+ // is used in preference to relying on function.name.
201
+ Checklist.displayName = componentName;
202
+
203
+ // The types and DocGen commentary for the component props,
204
+ // in alphabetical order (for consistency).
205
+ // See https://www.npmjs.com/package/prop-types#usage.
206
+ Checklist.propTypes = {
207
+ /**
208
+ * Define both `chartLabel` and `chartValue` to show the chart and its label together.
209
+ */
210
+ chartLabel: PropTypes.string,
211
+ /**
212
+ * A number between 0 and 1.
213
+ *
214
+ * Define both `chartLabel` and `chartValue` to show the chart and its label together.
215
+ */
216
+ chartValue: PropTypes.number,
217
+ /**
218
+ * Aria-label for the Checklist component.
219
+ */
220
+ checklistAriaLabel: PropTypes.string,
221
+ /**
222
+ * Aria-label for the Checklist's toggle component.
223
+ */
224
+ checklistToggleAriaLabel: PropTypes.string,
225
+ /**
226
+ * Provide an optional class to be applied to the containing node.
227
+ */
228
+ className: PropTypes.string,
229
+ /**
230
+ * Callback for the "View all" button. See also `viewAllLabel`.
231
+ */
232
+ onClickViewAll: PropTypes.func,
233
+ /**
234
+ * Optional callback for when the list is opened/closed.
235
+ */
236
+ onToggle: PropTypes.func,
237
+ /**
238
+ * Specifies whether the component is opened or closed.
239
+ * This can be set during initialization, or changed after being rendered.
240
+ */
241
+ open: PropTypes.bool,
242
+ /**
243
+ * Whether or not to show the open/close toggle.
244
+ */
245
+ showToggle: PropTypes.bool,
246
+ /**
247
+ * The task list can be broken down into sub-lists.
248
+ *
249
+ * Each sub-list can include an optional `title`.
250
+ *
251
+ * Each task must specify the appropriate icon (`kind`) and `label`.
252
+ *
253
+ * If any task has an `onClick` callback function defined,
254
+ * then the `label` will be rendered as a button,
255
+ * else the `label` will be rendered as plain text.
256
+ */
257
+ taskLists: PropTypes.arrayOf(PropTypes.shape({
258
+ title: PropTypes.string,
259
+ tasks: PropTypes.arrayOf(PropTypes.shape({
260
+ kind: PropTypes.oneOf(['unchecked', 'indeterminate', 'checked', 'disabled', 'error']).isRequired,
261
+ label: PropTypes.string.isRequired,
262
+ onClick: PropTypes.func
263
+ })).isRequired
264
+ })).isRequired,
265
+ /**
266
+ * Determines the theme of the component.
267
+ */
268
+ theme: PropTypes.oneOf(['light', 'dark']),
269
+ /**
270
+ * The title of the component.
271
+ */
272
+ title: PropTypes.string,
273
+ /**
274
+ * If defined, will show and enable the "View all (#)" button at the bottom of the list.
275
+ */
276
+ viewAllLabel: PropTypes.string
277
+ };
@@ -0,0 +1,98 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["className", "value", "theme"];
4
+ /**
5
+ * Copyright IBM Corp. 2023, 2023
6
+ *
7
+ * This source code is licensed under the Apache-2.0 license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+
11
+ /**
12
+ * TODO: Breakdown titles, icons, clickable items into sub-components
13
+ * See
14
+ * ModifiedTabs (ModifiedTabLabelNew, ModifiedTabLabelWithClose)
15
+ * PageHeader (PageHeaderTitle, PageHeaderUtils)
16
+ */
17
+
18
+ // Import portions of React that are needed.
19
+ import React from 'react';
20
+
21
+ // Other standard imports.
22
+ import PropTypes from 'prop-types';
23
+ import cx from 'classnames';
24
+ import { getDevtoolsProps } from '../../global/js/utils/devtools';
25
+ import { pkg /*, carbon */ } from '../../settings';
26
+ import clamp from 'lodash/clamp';
27
+
28
+ // Carbon and package components we use.
29
+ /* TODO: @import(s) of carbon components and other package components. */
30
+
31
+ // The block part of our conventional BEM class names (blockClass__E--M).
32
+ var blockClass = "".concat(pkg.prefix, "--checklist__chart");
33
+ var componentName = 'ChecklistChart';
34
+
35
+ // NOTE: the component SCSS is not imported here: it is rolled up separately.
36
+
37
+ // Default values can be included here and then assigned to the prop params,
38
+ // e.g. prop = defaults.prop,
39
+ // This gathers default values together neatly and ensures non-primitive
40
+ // values are initialized early to avoid react making unnecessary re-renders.
41
+ // Note that default values are not required for props that are 'required',
42
+ // nor for props where the component can apply undefined values reasonably.
43
+ // Default values should be provided when the component needs to make a choice
44
+ // or assumption when a prop is not supplied.
45
+
46
+ // Default values for props
47
+ var defaults = {
48
+ theme: 'light'
49
+ };
50
+
51
+ /**
52
+ * TODO: A description of the component.
53
+ */
54
+ export var ChecklistChart = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
55
+ var className = _ref.className,
56
+ value = _ref.value,
57
+ _ref$theme = _ref.theme,
58
+ theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
59
+ rest = _objectWithoutProperties(_ref, _excluded);
60
+ var numDegrees = clamp(value * 360, 0, 360);
61
+ var circleColor = theme === 'light' ? '#c6c6c6' : '#525252'; // $gray-30, $gray-70
62
+ var progressColor = theme === 'light' ? '#6929c4' : '#A56EFF'; // $purple-70, $purple-50
63
+
64
+ return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
65
+ className: cx(blockClass, className),
66
+ style: {
67
+ backgroundImage: "conic-gradient(".concat(progressColor, " ").concat(numDegrees, "deg, ").concat(circleColor, " ").concat(numDegrees, "deg 360deg)"),
68
+ borderRadius: '50%'
69
+ },
70
+ ref: ref,
71
+ role: "img"
72
+ }, getDevtoolsProps(componentName)));
73
+ });
74
+
75
+ // Return a placeholder if not released and not enabled by feature flag
76
+ // ChecklistChart = pkg.checkComponentEnabled(ChecklistChart, componentName);
77
+
78
+ // The display name of the component, used by React. Note that displayName
79
+ // is used in preference to relying on function.name.
80
+ // ChecklistChart.displayName = componentName;
81
+
82
+ // The types and DocGen commentary for the component props,
83
+ // in alphabetical order (for consistency).
84
+ // See https://www.npmjs.com/package/prop-types#usage.
85
+ ChecklistChart.propTypes = {
86
+ /**
87
+ * Optional class name for this component.
88
+ */
89
+ className: PropTypes.string,
90
+ /**
91
+ * Determines the theme of the component.
92
+ */
93
+ theme: PropTypes.oneOf(['light', 'dark']),
94
+ /**
95
+ * Number between 0 and 1.
96
+ */
97
+ value: PropTypes.number.isRequired
98
+ };
@@ -0,0 +1,105 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["className", "kind", "theme"];
4
+ /**
5
+ * Copyright IBM Corp. 2023, 2023
6
+ *
7
+ * This source code is licensed under the Apache-2.0 license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+
11
+ /**
12
+ * TODO: Breakdown titles, icons, clickable items into sub-components
13
+ * See
14
+ * ModifiedTabs (ModifiedTabLabelNew, ModifiedTabLabelWithClose)
15
+ * PageHeader (PageHeaderTitle, PageHeaderUtils)
16
+ */
17
+
18
+ // Import portions of React that are needed.
19
+ import React from 'react';
20
+
21
+ // Other standard imports.
22
+ import PropTypes from 'prop-types';
23
+ import cx from 'classnames';
24
+ import { getDevtoolsProps } from '../../global/js/utils/devtools';
25
+ import { pkg /*, carbon */ } from '../../settings';
26
+
27
+ // Carbon and package components we use.
28
+ /* TODO: @import(s) of carbon components and other package components. */
29
+ import { CheckmarkOutline16, CircleDash16, Incomplete16, Warning16 } from '@carbon/icons-react';
30
+
31
+ // The block part of our conventional BEM class names (blockClass__E--M).
32
+ var blockClass = "".concat(pkg.prefix, "--checklist__icon");
33
+ var componentName = 'ChecklistIcon';
34
+
35
+ // NOTE: the component SCSS is not imported here: it is rolled up separately.
36
+
37
+ // Default values can be included here and then assigned to the prop params,
38
+ // e.g. prop = defaults.prop,
39
+ // This gathers default values together neatly and ensures non-primitive
40
+ // values are initialized early to avoid react making unnecessary re-renders.
41
+ // Note that default values are not required for props that are 'required',
42
+ // nor for props where the component can apply undefined values reasonably.
43
+ // Default values should be provided when the component needs to make a choice
44
+ // or assumption when a prop is not supplied.
45
+
46
+ // Default values for props
47
+ var defaults = {
48
+ theme: 'light'
49
+ };
50
+
51
+ /**
52
+ * TODO: A description of the component.
53
+ */
54
+ export var ChecklistIcon = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
55
+ var className = _ref.className,
56
+ kind = _ref.kind,
57
+ _ref$theme = _ref.theme,
58
+ theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
59
+ rest = _objectWithoutProperties(_ref, _excluded);
60
+ var Icon;
61
+ switch (kind) {
62
+ case 'error':
63
+ Icon = Warning16;
64
+ break;
65
+ case 'indeterminate':
66
+ Icon = Incomplete16;
67
+ break;
68
+ case 'checked':
69
+ Icon = CheckmarkOutline16;
70
+ break;
71
+ default:
72
+ // "unchecked" or "disabled"
73
+ Icon = CircleDash16;
74
+ break;
75
+ }
76
+ return /*#__PURE__*/React.createElement("span", _extends({}, rest, {
77
+ className: cx(blockClass, className, "".concat(blockClass, "--").concat(kind), "".concat(blockClass, "__").concat(theme)),
78
+ ref: ref
79
+ }, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(Icon, null));
80
+ });
81
+
82
+ // Return a placeholder if not released and not enabled by feature flag
83
+ // ChecklistIcon = pkg.checkComponentEnabled(ChecklistIcon, componentName);
84
+
85
+ // The display name of the component, used by React. Note that displayName
86
+ // is used in preference to relying on function.name.
87
+ // ChecklistIcon.displayName = componentName;
88
+
89
+ // The types and DocGen commentary for the component props,
90
+ // in alphabetical order (for consistency).
91
+ // See https://www.npmjs.com/package/prop-types#usage.
92
+ ChecklistIcon.propTypes = {
93
+ /**
94
+ * Provide an optional class to be applied to the containing node.
95
+ */
96
+ className: PropTypes.string,
97
+ /**
98
+ * The icon to be displayed.
99
+ */
100
+ kind: PropTypes.oneOf(['unchecked', 'indeterminate', 'checked', 'disabled', 'error']),
101
+ /**
102
+ * Determines the theme of the component.
103
+ */
104
+ theme: PropTypes.oneOf(['light', 'dark'])
105
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright IBM Corp. 2023, 2023
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 { Checklist } from './Checklist';
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["backButtonText", "cancelButtonText", "children", "className", "modalDangerButtonText", "modalDescription", "modalSecondaryButtonText", "modalTitle", "nextButtonText", "onClose", "onRequestSubmit", "firstFocusElement", "submitButtonText", "title"];
4
+ var _excluded = ["backButtonText", "cancelButtonText", "children", "className", "initialStep", "modalDangerButtonText", "modalDescription", "modalSecondaryButtonText", "modalTitle", "nextButtonText", "onClose", "onRequestSubmit", "firstFocusElement", "submitButtonText", "title"];
5
5
  /**
6
6
  * Copyright IBM Corp. 2021, 2023
7
7
  *
@@ -22,8 +22,9 @@ import { pkg } from '../../settings';
22
22
  import { Grid, ModalFooter, ComposedModal, ModalHeader, ModalBody, Button, Form } from 'carbon-components-react';
23
23
  import { CreateInfluencer } from '../CreateInfluencer';
24
24
  import { ActionSet } from '../ActionSet';
25
- import { usePreviousValue, useValidCreateStepCount, useCreateComponentFocus, useCreateComponentStepChange } from '../../global/js/hooks';
25
+ import { usePreviousValue, useValidCreateStepCount, useResetCreateComponent, useCreateComponentFocus, useCreateComponentStepChange } from '../../global/js/hooks';
26
26
  import { lastIndexInArray } from '../../global/js/utils/lastIndexInArray';
27
+ import { getNumberOfHiddenSteps } from '../../global/js/utils/getNumberOfHiddenSteps';
27
28
  var blockClass = "".concat(pkg.prefix, "--create-full-page");
28
29
  var componentName = 'CreateFullPage';
29
30
 
@@ -40,6 +41,7 @@ export var CreateFullPage = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
40
41
  cancelButtonText = _ref.cancelButtonText,
41
42
  children = _ref.children,
42
43
  className = _ref.className,
44
+ initialStep = _ref.initialStep,
43
45
  modalDangerButtonText = _ref.modalDangerButtonText,
44
46
  modalDescription = _ref.modalDescription,
45
47
  modalSecondaryButtonText = _ref.modalSecondaryButtonText,
@@ -110,7 +112,11 @@ export var CreateFullPage = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
110
112
  if (lastItem !== lastIncludedStep) {
111
113
  setLastIncludedStep(lastItem);
112
114
  }
113
- }, [stepData, firstIncludedStep, lastIncludedStep]);
115
+ if (open && initialStep) {
116
+ var numberOfHiddenSteps = getNumberOfHiddenSteps(stepData, initialStep);
117
+ setCurrentStep(Number(initialStep + numberOfHiddenSteps));
118
+ }
119
+ }, [stepData, firstIncludedStep, lastIncludedStep, initialStep]);
114
120
  useCreateComponentFocus({
115
121
  previousState: previousState,
116
122
  currentStep: currentStep,
@@ -119,6 +125,16 @@ export var CreateFullPage = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
119
125
  firstFocusElement: firstFocusElement
120
126
  });
121
127
  useValidCreateStepCount(stepData.length, componentName);
128
+ useResetCreateComponent({
129
+ firstIncludedStep: firstIncludedStep,
130
+ previousState: previousState,
131
+ open: open,
132
+ setCurrentStep: setCurrentStep,
133
+ stepData: stepData,
134
+ initialStep: initialStep,
135
+ totalSteps: stepData === null || stepData === void 0 ? void 0 : stepData.length,
136
+ componentName: componentName
137
+ });
122
138
  useCreateComponentStepChange({
123
139
  firstIncludedStep: firstIncludedStep,
124
140
  lastIncludedStep: lastIncludedStep,
@@ -242,6 +258,12 @@ CreateFullPage.propTypes = {
242
258
  * Specifies elements to focus on first on render.
243
259
  */
244
260
  firstFocusElement: PropTypes.string,
261
+ /**
262
+ * This can be used to open the component to a step other than the first step.
263
+ * For example, a create flow was previously in progress, data was saved, and
264
+ * is now being completed.
265
+ */
266
+ initialStep: PropTypes.number,
245
267
  /**
246
268
  * The primary 'danger' button text in the modal
247
269
  */
@@ -47,6 +47,7 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
47
47
  gridHeight = _ref.gridHeight;
48
48
  headerRowElement.style.setProperty("--".concat(blockClass, "--row-height"), px(rowHeight));
49
49
  headerRowElement.style.setProperty("--".concat(blockClass, "--grid-height"), px(gridHeight - scrollBuffer - tableToolbarHeight));
50
+ headerRowElement.style.setProperty("--".concat(blockClass, "--header-height"), px(headerRowElement.offsetHeight));
50
51
  };
51
52
  setCustomValues({
52
53
  gridHeight: gridElement.offsetHeight,
@@ -10,42 +10,58 @@ var _excluded = ["legendText"];
10
10
  * LICENSE file in the root directory of this source tree.
11
11
  */
12
12
 
13
- import * as React from 'react';
13
+ import React, { useRef, useState } from 'react';
14
14
  import PropTypes from 'prop-types';
15
15
  import { Settings16 } from '@carbon/icons-react';
16
16
  import { Button } from 'carbon-components-react';
17
17
  import cx from 'classnames';
18
18
  import RowSizeRadioGroup from './RowSizeRadioGroup';
19
19
  import { pkg } from '../../../../../settings';
20
- var blockClass = "".concat(pkg.prefix, "--datagrid");
20
+ var blockClass = "".concat(pkg.prefix, "--datagrid__row-size");
21
21
  var RowSizeDropdown = function RowSizeDropdown(_ref) {
22
22
  var _ref$legendText = _ref.legendText,
23
23
  legendText = _ref$legendText === void 0 ? 'Row height' : _ref$legendText,
24
24
  props = _objectWithoutProperties(_ref, _excluded);
25
- var buttonRef = React.useRef({});
26
- var _React$useState = React.useState(false),
27
- _React$useState2 = _slicedToArray(_React$useState, 2),
28
- isOpen = _React$useState2[0],
29
- setIsOpen = _React$useState2[1];
30
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
25
+ var buttonRef = useRef(null);
26
+ var _useState = useState(false),
27
+ _useState2 = _slicedToArray(_useState, 2),
28
+ isOpen = _useState2[0],
29
+ setIsOpen = _useState2[1];
30
+ var onCloseHandler = function onCloseHandler() {
31
+ setIsOpen(false);
32
+ };
33
+ var onBlurHandler = function onBlurHandler(e) {
34
+ if (!e.currentTarget.contains(e.relatedTarget)) {
35
+ onCloseHandler();
36
+ }
37
+ };
38
+ var onClickHandler = function onClickHandler() {
39
+ setIsOpen(!isOpen);
40
+ };
41
+ var onKeyHandler = function onKeyHandler(e) {
42
+ if (e.key === 'Escape') {
43
+ onCloseHandler();
44
+ }
45
+ };
46
+ return /*#__PURE__*/React.createElement("div", {
47
+ tabIndex: -1,
48
+ className: blockClass,
49
+ role: "presentation",
50
+ onBlur: onBlurHandler,
51
+ onKeyDown: onKeyHandler
52
+ }, /*#__PURE__*/React.createElement(Button, {
53
+ tabIndex: 0,
31
54
  hasIconOnly: true,
32
55
  ref: buttonRef,
33
56
  kind: "ghost",
34
57
  tooltipPosition: "bottom",
35
58
  renderIcon: Settings16,
36
- onClick: function onClick() {
37
- return setIsOpen(function (prevOpen) {
38
- return !prevOpen;
39
- });
40
- },
41
59
  iconDescription: legendText,
42
- className: cx("".concat(blockClass, "__row-size-button"), _defineProperty({}, "".concat(blockClass, "__row-size-button--open"), isOpen))
60
+ className: cx("".concat(blockClass, "-button"), _defineProperty({}, "".concat(blockClass, "-button--open"), isOpen)),
61
+ onClick: onClickHandler
43
62
  }), isOpen && /*#__PURE__*/React.createElement(RowSizeRadioGroup, _extends({}, props, {
44
63
  legendText: legendText,
45
- buttonRef: buttonRef,
46
- hideRadioGroup: function hideRadioGroup() {
47
- setIsOpen(false);
48
- }
64
+ buttonRef: buttonRef
49
65
  })));
50
66
  };
51
67
  RowSizeDropdown.propTypes = {