@carbon/ibm-products 1.57.0 → 1.58.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. package/css/index-full-carbon.css +336 -900
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +3 -3
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon.css +336 -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 +336 -900
  10. package/css/index.css.map +1 -1
  11. package/css/index.min.css +3 -3
  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 +104 -0
  15. package/es/components/Checklist/ChecklistIcon.js +105 -0
  16. package/es/components/Checklist/index.js +8 -0
  17. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -0
  18. package/es/components/NonLinearReading/NonLinearReading.js +9 -4
  19. package/es/components/index.js +2 -1
  20. package/es/global/js/package-settings.js +1 -0
  21. package/lib/components/Checklist/Checklist.js +267 -0
  22. package/lib/components/Checklist/ChecklistChart.js +94 -0
  23. package/lib/components/Checklist/ChecklistIcon.js +92 -0
  24. package/lib/components/Checklist/index.js +12 -0
  25. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -0
  26. package/lib/components/NonLinearReading/NonLinearReading.js +8 -3
  27. package/lib/components/index.js +8 -1
  28. package/lib/global/js/package-settings.js +1 -0
  29. package/package.json +2 -2
  30. package/scss/components/Checklist/_checklist.scss +231 -0
  31. package/scss/components/Checklist/_index.scss +8 -0
  32. package/scss/components/Checklist/_storybook-styles.scss +13 -0
  33. package/scss/components/Datagrid/styles/_datagrid.scss +31 -5
  34. package/scss/components/NonLinearReading/_non-linear-reading.scss +76 -64
  35. package/scss/components/_index.scss +1 -0
@@ -0,0 +1,267 @@
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.Checklist = void 0;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
13
+ var _react = _interopRequireWildcard(require("react"));
14
+ var _propTypes = _interopRequireDefault(require("prop-types"));
15
+ var _classnames = _interopRequireDefault(require("classnames"));
16
+ var _devtools = require("../../global/js/utils/devtools");
17
+ var _uuidv = _interopRequireDefault(require("../../global/js/utils/uuidv4"));
18
+ var _settings = require("../../settings");
19
+ var _carbonComponentsReact = require("carbon-components-react");
20
+ var _iconsReact = require("@carbon/icons-react");
21
+ var _ChecklistIcon = require("./ChecklistIcon");
22
+ var _ChecklistChart = require("./ChecklistChart");
23
+ var _excluded = ["chartValue", "chartLabel", "checklistAriaLabel", "checklistToggleAriaLabel", "className", "onClickViewAll", "onToggle", "open", "showToggle", "taskLists", "theme", "title", "viewAllLabel"];
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
+ // The block part of our conventional BEM class names (blockClass__E--M).
27
+ var blockClass = "".concat(_settings.pkg.prefix, "--checklist");
28
+ var componentName = 'Checklist';
29
+
30
+ // NOTE: the component SCSS is not imported here: it is rolled up separately.
31
+
32
+ // Default values can be included here and then assigned to the prop params,
33
+ // e.g. prop = defaults.prop,
34
+ // This gathers default values together neatly and ensures non-primitive
35
+ // values are initialized early to avoid react making unnecessary re-renders.
36
+ // Note that default values are not required for props that are 'required',
37
+ // nor for props where the component can apply undefined values reasonably.
38
+ // Default values should be provided when the component needs to make a choice
39
+ // or assumption when a prop is not supplied.
40
+
41
+ // Default values for props
42
+ var defaults = {
43
+ checklistAriaLabel: 'Checklist',
44
+ checklistToggleAriaLabel: 'Checklist toggle',
45
+ onClickViewAll: function onClickViewAll() {},
46
+ onToggle: function onToggle() {},
47
+ open: true,
48
+ showToggle: true,
49
+ taskLists: [],
50
+ theme: 'light'
51
+ };
52
+
53
+ /**
54
+ * TODO: A description of the component.
55
+ */
56
+ var Checklist = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
57
+ var chartValue = _ref.chartValue,
58
+ chartLabel = _ref.chartLabel,
59
+ _ref$checklistAriaLab = _ref.checklistAriaLabel,
60
+ checklistAriaLabel = _ref$checklistAriaLab === void 0 ? defaults.checklistAriaLabel : _ref$checklistAriaLab,
61
+ _ref$checklistToggleA = _ref.checklistToggleAriaLabel,
62
+ checklistToggleAriaLabel = _ref$checklistToggleA === void 0 ? defaults.checklistToggleAriaLabel : _ref$checklistToggleA,
63
+ className = _ref.className,
64
+ _ref$onClickViewAll = _ref.onClickViewAll,
65
+ onClickViewAll = _ref$onClickViewAll === void 0 ? defaults.onClickViewAll : _ref$onClickViewAll,
66
+ _ref$onToggle = _ref.onToggle,
67
+ onToggle = _ref$onToggle === void 0 ? defaults.onToggle : _ref$onToggle,
68
+ _ref$open = _ref.open,
69
+ open = _ref$open === void 0 ? defaults.open : _ref$open,
70
+ _ref$showToggle = _ref.showToggle,
71
+ showToggle = _ref$showToggle === void 0 ? defaults.showToggle : _ref$showToggle,
72
+ _ref$taskLists = _ref.taskLists,
73
+ taskLists = _ref$taskLists === void 0 ? defaults.taskLists : _ref$taskLists,
74
+ _ref$theme = _ref.theme,
75
+ theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
76
+ title = _ref.title,
77
+ viewAllLabel = _ref.viewAllLabel,
78
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
79
+ var _useState = (0, _react.useState)(open),
80
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
81
+ isOpen = _useState2[0],
82
+ setIsOpen = _useState2[1];
83
+ var listContainerId = (0, _react.useRef)((0, _uuidv.default)()).current;
84
+ var chartLabelId = (0, _react.useRef)((0, _uuidv.default)()).current;
85
+
86
+ // Don't use this test: {chartValue && chartLabel && (render...)}.
87
+ // If `chartValue` is 0 (zero) - a valid value - then it will render 0 and skip the remaining statement.
88
+ // Use this test instead: {chartLabelAndValue && (render...)}.
89
+ // The ChecklistChart component will validate `chartValue`.
90
+ var chartLabelAndValue = typeof chartValue === 'number' && chartLabel;
91
+ var handleClickToggle = function handleClickToggle() {
92
+ setIsOpen(function (prevOpen) {
93
+ return !prevOpen;
94
+ });
95
+ };
96
+ var handleClickViewAll = function handleClickViewAll() {
97
+ onClickViewAll();
98
+ };
99
+
100
+ // If state changes, then trigger callback.
101
+ (0, _react.useEffect)(function () {
102
+ onToggle(isOpen);
103
+ }, [isOpen, onToggle]);
104
+
105
+ // If the "open" prop is changed after initialization,
106
+ // then update internal state.
107
+ (0, _react.useEffect)(function () {
108
+ setIsOpen(open);
109
+ }, [open]);
110
+ return /*#__PURE__*/_react.default.createElement("aside", (0, _extends2.default)({}, rest, {
111
+ "aria-label": checklistAriaLabel,
112
+ className: (0, _classnames.default)(blockClass,
113
+ // Apply the block class to the main HTML element
114
+ className, // Apply any supplied class names to the main HTML element.
115
+ // example: `${blockClass}__template-string-class-${kind}-n-${size}`,
116
+ (0, _defineProperty2.default)({}, "".concat(blockClass, "__closed"), !isOpen)),
117
+ ref: ref
118
+ }, (0, _devtools.getDevtoolsProps)(componentName)), (title || chartLabelAndValue) && /*#__PURE__*/_react.default.createElement("header", {
119
+ className: "".concat(blockClass, "__header")
120
+ }, chartLabelAndValue && /*#__PURE__*/_react.default.createElement(_ChecklistChart.ChecklistChart, {
121
+ ariaLabelledById: chartLabelId,
122
+ value: chartValue,
123
+ theme: theme
124
+ }), /*#__PURE__*/_react.default.createElement("div", {
125
+ className: "".concat(blockClass, "__titles")
126
+ }, title && /*#__PURE__*/_react.default.createElement("h2", {
127
+ className: "".concat(blockClass, "__title")
128
+ }, title), chartLabelAndValue && /*#__PURE__*/_react.default.createElement("h3", {
129
+ id: chartLabelId,
130
+ className: "".concat(blockClass, "__chart-label")
131
+ }, chartLabel)), showToggle && /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
132
+ "aria-controls": listContainerId,
133
+ "aria-expanded": isOpen,
134
+ "aria-label": checklistToggleAriaLabel,
135
+ className: "".concat(blockClass, "__toggle"),
136
+ kind: "ghost",
137
+ onClick: handleClickToggle,
138
+ size: "small"
139
+ }, /*#__PURE__*/_react.default.createElement(_iconsReact.ChevronUp16, {
140
+ className: (0, _classnames.default)("".concat(blockClass, "__chevron"))
141
+ }))), /*#__PURE__*/_react.default.createElement("div", {
142
+ id: listContainerId,
143
+ className: "".concat(blockClass, "__content-outer")
144
+ }, /*#__PURE__*/_react.default.createElement("div", {
145
+ className: "".concat(blockClass, "__content-inner")
146
+ }, /*#__PURE__*/_react.default.createElement("section", {
147
+ className: (0, _classnames.default)("".concat(blockClass, "__body"))
148
+ }, taskLists.map(function (list, index) {
149
+ return /*#__PURE__*/_react.default.createElement("div", {
150
+ className: "".concat(blockClass, "__list-group"),
151
+ key: "".concat(list.title, "-").concat(index)
152
+ }, list.title && /*#__PURE__*/_react.default.createElement("h3", {
153
+ title: list.title,
154
+ className: "".concat(blockClass, "__list-title")
155
+ }, list.title), /*#__PURE__*/_react.default.createElement("ol", {
156
+ className: "".concat(blockClass, "__list")
157
+ }, list.tasks.map(function (item, index) {
158
+ return /*#__PURE__*/_react.default.createElement("li", {
159
+ className: "".concat(blockClass, "__list-item"),
160
+ key: "".concat(item.label, "-").concat(index)
161
+ }, /*#__PURE__*/_react.default.createElement(_ChecklistIcon.ChecklistIcon, {
162
+ kind: item.kind
163
+ }), typeof item.onClick === 'function' ? /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
164
+ className: (0, _classnames.default)("".concat(blockClass, "__button"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__button--error"), item.kind === 'error')),
165
+ onClick: function onClick() {
166
+ item.onClick(item);
167
+ },
168
+ size: "small"
169
+ }, /*#__PURE__*/_react.default.createElement("div", {
170
+ title: item.label
171
+ }, item.label)) : /*#__PURE__*/_react.default.createElement("span", {
172
+ className: (0, _classnames.default)("".concat(blockClass, "__label"), "".concat(blockClass, "__label--").concat(item.kind)),
173
+ title: item.label
174
+ }, item.label));
175
+ })));
176
+ })), viewAllLabel && /*#__PURE__*/_react.default.createElement("footer", {
177
+ className: "".concat(blockClass, "__footer")
178
+ }, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
179
+ className: (0, _classnames.default)("".concat(blockClass, "__button"), "".concat(blockClass, "__view-all")),
180
+ onClick: handleClickViewAll,
181
+ size: "small"
182
+ }, /*#__PURE__*/_react.default.createElement("div", null, viewAllLabel))))));
183
+ });
184
+
185
+ // Return a placeholder if not released and not enabled by feature flag
186
+ exports.Checklist = Checklist;
187
+ exports.Checklist = Checklist = _settings.pkg.checkComponentEnabled(Checklist, componentName);
188
+
189
+ // The display name of the component, used by React. Note that displayName
190
+ // is used in preference to relying on function.name.
191
+ Checklist.displayName = componentName;
192
+
193
+ // The types and DocGen commentary for the component props,
194
+ // in alphabetical order (for consistency).
195
+ // See https://www.npmjs.com/package/prop-types#usage.
196
+ Checklist.propTypes = {
197
+ /**
198
+ * Define both `chartLabel` and `chartValue` to show the chart and its label together.
199
+ */
200
+ chartLabel: _propTypes.default.string,
201
+ /**
202
+ * A number between 0 and 1.
203
+ *
204
+ * Define both `chartLabel` and `chartValue` to show the chart and its label together.
205
+ */
206
+ chartValue: _propTypes.default.number,
207
+ /**
208
+ * Aria-label for the Checklist component.
209
+ */
210
+ checklistAriaLabel: _propTypes.default.string,
211
+ /**
212
+ * Aria-label for the Checklist's toggle component.
213
+ */
214
+ checklistToggleAriaLabel: _propTypes.default.string,
215
+ /**
216
+ * Provide an optional class to be applied to the containing node.
217
+ */
218
+ className: _propTypes.default.string,
219
+ /**
220
+ * Callback for the "View all" button. See also `viewAllLabel`.
221
+ */
222
+ onClickViewAll: _propTypes.default.func,
223
+ /**
224
+ * Optional callback for when the list is opened/closed.
225
+ */
226
+ onToggle: _propTypes.default.func,
227
+ /**
228
+ * Specifies whether the component is opened or closed.
229
+ * This can be set during initialization, or changed after being rendered.
230
+ */
231
+ open: _propTypes.default.bool,
232
+ /**
233
+ * Whether or not to show the open/close toggle.
234
+ */
235
+ showToggle: _propTypes.default.bool,
236
+ /**
237
+ * The task list can be broken down into sub-lists.
238
+ *
239
+ * Each sub-list can include an optional `title`.
240
+ *
241
+ * Each task must specify the appropriate icon (`kind`) and `label`.
242
+ *
243
+ * If any task has an `onClick` callback function defined,
244
+ * then the `label` will be rendered as a button,
245
+ * else the `label` will be rendered as plain text.
246
+ */
247
+ taskLists: _propTypes.default.arrayOf(_propTypes.default.shape({
248
+ title: _propTypes.default.string,
249
+ tasks: _propTypes.default.arrayOf(_propTypes.default.shape({
250
+ kind: _propTypes.default.oneOf(['unchecked', 'indeterminate', 'checked', 'disabled', 'error']).isRequired,
251
+ label: _propTypes.default.string.isRequired,
252
+ onClick: _propTypes.default.func
253
+ })).isRequired
254
+ })).isRequired,
255
+ /**
256
+ * Determines the theme of the component.
257
+ */
258
+ theme: _propTypes.default.oneOf(['light', 'dark']),
259
+ /**
260
+ * The title of the component.
261
+ */
262
+ title: _propTypes.default.string,
263
+ /**
264
+ * If defined, will show and enable the "View all (#)" button at the bottom of the list.
265
+ */
266
+ viewAllLabel: _propTypes.default.string
267
+ };
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.ChecklistChart = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _react = _interopRequireDefault(require("react"));
11
+ var _propTypes = _interopRequireDefault(require("prop-types"));
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
+ var _devtools = require("../../global/js/utils/devtools");
14
+ var _settings = require("../../settings");
15
+ var _clamp = _interopRequireDefault(require("lodash/clamp"));
16
+ var _excluded = ["className", "ariaLabelledById", "value", "theme"];
17
+ // Carbon and package components we use.
18
+ /* TODO: @import(s) of carbon components and other package components. */
19
+
20
+ // The block part of our conventional BEM class names (blockClass__E--M).
21
+ var blockClass = "".concat(_settings.pkg.prefix, "--checklist__chart");
22
+ var componentName = 'ChecklistChart';
23
+
24
+ // NOTE: the component SCSS is not imported here: it is rolled up separately.
25
+
26
+ // Default values can be included here and then assigned to the prop params,
27
+ // e.g. prop = defaults.prop,
28
+ // This gathers default values together neatly and ensures non-primitive
29
+ // values are initialized early to avoid react making unnecessary re-renders.
30
+ // Note that default values are not required for props that are 'required',
31
+ // nor for props where the component can apply undefined values reasonably.
32
+ // Default values should be provided when the component needs to make a choice
33
+ // or assumption when a prop is not supplied.
34
+
35
+ // Default values for props
36
+ var defaults = {
37
+ theme: 'light'
38
+ };
39
+
40
+ /**
41
+ * TODO: A description of the component.
42
+ */
43
+ var ChecklistChart = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
44
+ var className = _ref.className,
45
+ ariaLabelledById = _ref.ariaLabelledById,
46
+ value = _ref.value,
47
+ _ref$theme = _ref.theme,
48
+ theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
49
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
50
+ var numDegrees = (0, _clamp.default)(value * 360, 0, 360);
51
+ var circleColor = theme === 'light' ? '#c6c6c6' : '#525252'; // $gray-30, $gray-70
52
+ var progressColor = theme === 'light' ? '#6929c4' : '#A56EFF'; // $purple-70, $purple-50
53
+
54
+ return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
55
+ "aria-labelledby": ariaLabelledById,
56
+ className: (0, _classnames.default)(blockClass, className),
57
+ style: {
58
+ backgroundImage: "conic-gradient(".concat(progressColor, " ").concat(numDegrees, "deg, ").concat(circleColor, " ").concat(numDegrees, "deg 360deg)"),
59
+ borderRadius: '50%'
60
+ },
61
+ ref: ref,
62
+ role: "img"
63
+ }, (0, _devtools.getDevtoolsProps)(componentName)));
64
+ });
65
+
66
+ // Return a placeholder if not released and not enabled by feature flag
67
+ // ChecklistChart = pkg.checkComponentEnabled(ChecklistChart, componentName);
68
+
69
+ // The display name of the component, used by React. Note that displayName
70
+ // is used in preference to relying on function.name.
71
+ // ChecklistChart.displayName = componentName;
72
+
73
+ // The types and DocGen commentary for the component props,
74
+ // in alphabetical order (for consistency).
75
+ // See https://www.npmjs.com/package/prop-types#usage.
76
+ exports.ChecklistChart = ChecklistChart;
77
+ ChecklistChart.propTypes = {
78
+ /**
79
+ * Id of the parent's aria-label for accessibility.
80
+ */
81
+ ariaLabelledById: _propTypes.default.string.isRequired,
82
+ /**
83
+ * Optional class name for this component.
84
+ */
85
+ className: _propTypes.default.string,
86
+ /**
87
+ * Determines the theme of the component.
88
+ */
89
+ theme: _propTypes.default.oneOf(['light', 'dark']),
90
+ /**
91
+ * Number between 0 and 1.
92
+ */
93
+ value: _propTypes.default.number.isRequired
94
+ };
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.ChecklistIcon = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _react = _interopRequireDefault(require("react"));
11
+ var _propTypes = _interopRequireDefault(require("prop-types"));
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
+ var _devtools = require("../../global/js/utils/devtools");
14
+ var _settings = require("../../settings");
15
+ var _iconsReact = require("@carbon/icons-react");
16
+ var _excluded = ["className", "kind", "theme"];
17
+ // The block part of our conventional BEM class names (blockClass__E--M).
18
+ var blockClass = "".concat(_settings.pkg.prefix, "--checklist__icon");
19
+ var componentName = 'ChecklistIcon';
20
+
21
+ // NOTE: the component SCSS is not imported here: it is rolled up separately.
22
+
23
+ // Default values can be included here and then assigned to the prop params,
24
+ // e.g. prop = defaults.prop,
25
+ // This gathers default values together neatly and ensures non-primitive
26
+ // values are initialized early to avoid react making unnecessary re-renders.
27
+ // Note that default values are not required for props that are 'required',
28
+ // nor for props where the component can apply undefined values reasonably.
29
+ // Default values should be provided when the component needs to make a choice
30
+ // or assumption when a prop is not supplied.
31
+
32
+ // Default values for props
33
+ var defaults = {
34
+ theme: 'light'
35
+ };
36
+
37
+ /**
38
+ * TODO: A description of the component.
39
+ */
40
+ var ChecklistIcon = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
41
+ var className = _ref.className,
42
+ kind = _ref.kind,
43
+ _ref$theme = _ref.theme,
44
+ theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
45
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
46
+ var Icon;
47
+ switch (kind) {
48
+ case 'error':
49
+ Icon = _iconsReact.Warning16;
50
+ break;
51
+ case 'indeterminate':
52
+ Icon = _iconsReact.Incomplete16;
53
+ break;
54
+ case 'checked':
55
+ Icon = _iconsReact.CheckmarkOutline16;
56
+ break;
57
+ default:
58
+ // "unchecked" or "disabled"
59
+ Icon = _iconsReact.CircleDash16;
60
+ break;
61
+ }
62
+ return /*#__PURE__*/_react.default.createElement("span", (0, _extends2.default)({}, rest, {
63
+ className: (0, _classnames.default)(blockClass, className, "".concat(blockClass, "--").concat(kind), "".concat(blockClass, "__").concat(theme)),
64
+ ref: ref
65
+ }, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement(Icon, null));
66
+ });
67
+
68
+ // Return a placeholder if not released and not enabled by feature flag
69
+ // ChecklistIcon = pkg.checkComponentEnabled(ChecklistIcon, componentName);
70
+
71
+ // The display name of the component, used by React. Note that displayName
72
+ // is used in preference to relying on function.name.
73
+ // ChecklistIcon.displayName = componentName;
74
+
75
+ // The types and DocGen commentary for the component props,
76
+ // in alphabetical order (for consistency).
77
+ // See https://www.npmjs.com/package/prop-types#usage.
78
+ exports.ChecklistIcon = ChecklistIcon;
79
+ ChecklistIcon.propTypes = {
80
+ /**
81
+ * Provide an optional class to be applied to the containing node.
82
+ */
83
+ className: _propTypes.default.string,
84
+ /**
85
+ * The icon to be displayed.
86
+ */
87
+ kind: _propTypes.default.oneOf(['unchecked', 'indeterminate', 'checked', 'disabled', 'error']),
88
+ /**
89
+ * Determines the theme of the component.
90
+ */
91
+ theme: _propTypes.default.oneOf(['light', 'dark'])
92
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Checklist", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _Checklist.Checklist;
10
+ }
11
+ });
12
+ var _Checklist = require("./Checklist");
@@ -58,6 +58,7 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
58
58
  gridHeight = _ref.gridHeight;
59
59
  headerRowElement.style.setProperty("--".concat(blockClass, "--row-height"), (0, _layout.px)(rowHeight));
60
60
  headerRowElement.style.setProperty("--".concat(blockClass, "--grid-height"), (0, _layout.px)(gridHeight - scrollBuffer - tableToolbarHeight));
61
+ headerRowElement.style.setProperty("--".concat(blockClass, "--header-height"), (0, _layout.px)(headerRowElement.offsetHeight));
61
62
  };
62
63
  setCustomValues({
63
64
  gridHeight: gridElement.offsetHeight,
@@ -14,6 +14,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
14
14
  var _classnames = _interopRequireDefault(require("classnames"));
15
15
  var _iconsReact = require("@carbon/icons-react");
16
16
  var _devtools = require("../../global/js/utils/devtools");
17
+ var _uuidv = _interopRequireDefault(require("../../global/js/utils/uuidv4"));
17
18
  var _settings = require("../../settings");
18
19
  var _excluded = ["children", "className", "definition", "theme"];
19
20
  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); }
@@ -43,6 +44,7 @@ var NonLinearReading = /*#__PURE__*/_react.default.forwardRef(function (_ref, re
43
44
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
44
45
  isOpen = _useState2[0],
45
46
  setOpen = _useState2[1];
47
+ var contentId = (0, _react.useRef)((0, _uuidv.default)()).current;
46
48
  var handleToggle = function handleToggle() {
47
49
  setOpen(function (prevState) {
48
50
  return !prevState;
@@ -54,12 +56,15 @@ var NonLinearReading = /*#__PURE__*/_react.default.forwardRef(function (_ref, re
54
56
  role: "main"
55
57
  }, (0, _devtools.getDevtoolsProps)(componentName)), ' ', /*#__PURE__*/_react.default.createElement("button", {
56
58
  type: "button",
59
+ "aria-controls": contentId,
57
60
  "aria-expanded": isOpen,
58
61
  className: (0, _classnames.default)("".concat(blockClass, "__keyword"), [isOpen ? ["".concat(blockClass, "__keyword-open")] : ["".concat(blockClass, "__keyword-closed")]]),
59
62
  onClick: handleToggle
60
- }, children, /*#__PURE__*/_react.default.createElement(_iconsReact.ChevronDown16, null)), ' ', isOpen && /*#__PURE__*/_react.default.createElement("span", {
61
- className: "".concat(blockClass, "__body")
62
- }, definition), ' ');
63
+ }, children, /*#__PURE__*/_react.default.createElement(_iconsReact.ChevronDown16, null)), ' ', /*#__PURE__*/_react.default.createElement("span", {
64
+ id: contentId,
65
+ className: "".concat(blockClass, "__body"),
66
+ hidden: !isOpen
67
+ }, isOpen && definition), ' ');
63
68
  });
64
69
 
65
70
  // Return a placeholder if not released and not enabled by feature flag
@@ -21,6 +21,12 @@ Object.defineProperty(exports, "Cascade", {
21
21
  return _Cascade.Cascade;
22
22
  }
23
23
  });
24
+ Object.defineProperty(exports, "Checklist", {
25
+ enumerable: true,
26
+ get: function get() {
27
+ return _Checklist.Checklist;
28
+ }
29
+ });
24
30
  Object.defineProperty(exports, "Coachmark", {
25
31
  enumerable: true,
26
32
  get: function get() {
@@ -579,4 +585,5 @@ var _CoachmarkButton = require("./CoachmarkButton");
579
585
  var _CoachmarkOverlayElements = require("./CoachmarkOverlayElements");
580
586
  var _CoachmarkOverlayElement = require("./CoachmarkOverlayElement");
581
587
  var _CoachmarkStack = require("./CoachmarkStack");
582
- var _InlineTip = require("./InlineTip");
588
+ var _InlineTip = require("./InlineTip");
589
+ var _Checklist = require("./Checklist");
@@ -75,6 +75,7 @@ var defaults = {
75
75
  InlineTip: false,
76
76
  Guidebanner: false,
77
77
  NonLinearReading: false,
78
+ Checklist: false,
78
79
  Coachmark: false,
79
80
  CoachmarkBeacon: false,
80
81
  CoachmarkButton: false,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/ibm-products",
3
3
  "description": "Carbon for IBM Products",
4
- "version": "1.57.0",
4
+ "version": "1.58.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -96,5 +96,5 @@
96
96
  "react": "^16.8.6 || ^17.0.1",
97
97
  "react-dom": "^16.8.6 || ^17.0.1"
98
98
  },
99
- "gitHead": "1d221bb1501e276983498e37ed58599c841fa202"
99
+ "gitHead": "ffa0060023f47e9a1dedcfa78fd4279db1c932e4"
100
100
  }