@carbon/ibm-products 1.56.0 → 1.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/css/index-full-carbon.css +392 -895
  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 +392 -895
  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 +392 -895
  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/Datagrid.js +12 -7
  18. package/es/components/Datagrid/Datagrid/DatagridContent.js +6 -3
  19. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +128 -7
  20. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +1 -23
  21. package/es/components/Datagrid/Datagrid/addons/stateReducer.js +111 -0
  22. package/es/components/Datagrid/useDatagrid.js +5 -2
  23. package/es/components/Datagrid/utils/getColTitle.js +25 -0
  24. package/es/components/NonLinearReading/NonLinearReading.js +9 -4
  25. package/es/components/index.js +2 -1
  26. package/es/global/js/hooks/useResizeObserver.js +19 -3
  27. package/es/global/js/package-settings.js +1 -0
  28. package/lib/components/Checklist/Checklist.js +267 -0
  29. package/lib/components/Checklist/ChecklistChart.js +94 -0
  30. package/lib/components/Checklist/ChecklistIcon.js +92 -0
  31. package/lib/components/Checklist/index.js +12 -0
  32. package/lib/components/Datagrid/Datagrid/Datagrid.js +12 -7
  33. package/lib/components/Datagrid/Datagrid/DatagridContent.js +6 -3
  34. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +131 -7
  35. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +4 -26
  36. package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +122 -0
  37. package/lib/components/Datagrid/useDatagrid.js +5 -2
  38. package/lib/components/Datagrid/utils/getColTitle.js +32 -0
  39. package/lib/components/NonLinearReading/NonLinearReading.js +8 -3
  40. package/lib/components/index.js +8 -1
  41. package/lib/global/js/hooks/useResizeObserver.js +19 -3
  42. package/lib/global/js/package-settings.js +1 -0
  43. package/package.json +2 -2
  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/Datagrid/styles/_datagrid.scss +91 -0
  48. package/scss/components/NonLinearReading/_non-linear-reading.scss +76 -64
  49. package/scss/components/_index.scss +1 -0
@@ -1,29 +1,104 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
4
  /**
4
- * Copyright IBM Corp. 2020, 2022
5
+ * Copyright IBM Corp. 2020, 2023
5
6
  *
6
7
  * This source code is licensed under the Apache-2.0 license found in the
7
8
  * LICENSE file in the root directory of this source tree.
8
9
  */
9
10
 
10
11
  // @flow
11
- import React from 'react';
12
+ import React, { useState, useEffect } from 'react';
12
13
  import cx from 'classnames';
13
14
  import { DataTable } from 'carbon-components-react';
15
+ import { px } from '@carbon/layout';
14
16
  import { selectionColumnId } from '../common-column-ids';
15
17
  import { pkg } from '../../../settings';
18
+ import { handleColumnResizeEndEvent, handleColumnResizeStartEvent, handleColumnResizingEvent } from './addons/stateReducer';
19
+ import getColTitle from '../utils/getColTitle';
16
20
  var blockClass = "".concat(pkg.prefix, "--datagrid");
21
+ var getAccessibilityProps = function getAccessibilityProps(header) {
22
+ var props = {};
23
+ var title = getColTitle(header);
24
+ if (title) {
25
+ props.title = title;
26
+ } else {
27
+ props['aria-hidden'] = true;
28
+ }
29
+ return props;
30
+ };
17
31
  var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
32
+ // Used to measure the height of the table and uses that value
33
+ // to display a vertical line to indicate the column you are resizing
34
+ useEffect(function () {
35
+ var tableId = datagridState.tableId;
36
+ if (tableId) {
37
+ var gridElement = document.querySelector("#".concat(tableId));
38
+ var tableElement = gridElement.querySelector('table');
39
+ var headerRowElement = document.querySelector("#".concat(tableId, " .").concat(blockClass, "__head"));
40
+ var hasHorizontalScrollbar = tableElement.scrollWidth > tableElement.clientWidth;
41
+ var scrollBuffer = hasHorizontalScrollbar ? 18 : 2;
42
+ var tableToolbar = gridElement.querySelector(".".concat(blockClass, "__table-toolbar"));
43
+ var tableToolbarHeight = (tableToolbar === null || tableToolbar === void 0 ? void 0 : tableToolbar.offsetHeight) || 0;
44
+ var setCustomValues = function setCustomValues(_ref) {
45
+ var _ref$rowHeight = _ref.rowHeight,
46
+ rowHeight = _ref$rowHeight === void 0 ? 48 : _ref$rowHeight,
47
+ gridHeight = _ref.gridHeight;
48
+ headerRowElement.style.setProperty("--".concat(blockClass, "--row-height"), px(rowHeight));
49
+ headerRowElement.style.setProperty("--".concat(blockClass, "--grid-height"), px(gridHeight - scrollBuffer - tableToolbarHeight));
50
+ headerRowElement.style.setProperty("--".concat(blockClass, "--header-height"), px(headerRowElement.offsetHeight));
51
+ };
52
+ setCustomValues({
53
+ gridHeight: gridElement.offsetHeight,
54
+ rowHeight: headerRowElement.clientHeight
55
+ });
56
+ }
57
+ }, [datagridState.rowSize, datagridState.tableId, datagridState]);
58
+ var _useState = useState(2),
59
+ _useState2 = _slicedToArray(_useState, 1),
60
+ incrementAmount = _useState2[0];
61
+ var getClientXPosition = function getClientXPosition(event) {
62
+ var isTouchEvent = false;
63
+ if (event.type === 'touchstart') {
64
+ // Do not respond to multiple touches (e.g. 2 or 3 fingers)
65
+ if (event.touches && event.touches.length > 1) {
66
+ return;
67
+ }
68
+ isTouchEvent = true;
69
+ }
70
+ var clientX = isTouchEvent ? Math.round(event.touches[0].clientX) : event.clientX;
71
+ var closestHeader = event.target.closest('th');
72
+ var closestHeaderCoords = closestHeader.getBoundingClientRect();
73
+ var headerOffset = closestHeaderCoords.left;
74
+ var offsetValue = clientX - headerOffset;
75
+ return offsetValue;
76
+ };
77
+ useEffect(function () {
78
+ var isResizing = datagridState.state.isResizing;
79
+ if (isResizing) {
80
+ var onColResizeEnd = datagridState.onColResizeEnd;
81
+ document.addEventListener('mouseup', function () {
82
+ handleColumnResizeEndEvent(datagridState.dispatch, onColResizeEnd, isResizing);
83
+ document.activeElement.blur();
84
+ });
85
+ }
86
+ return function () {
87
+ document.removeEventListener('mouseup', function () {
88
+ return handleColumnResizeEndEvent(datagridState.dispatch);
89
+ });
90
+ };
91
+ // eslint-disable-next-line react-hooks/exhaustive-deps
92
+ }, [datagridState.state.isResizing]);
18
93
  return /*#__PURE__*/React.createElement(TableRow, _extends({}, headerGroup.getHeaderGroupProps({
19
94
  role: false
20
95
  }), {
21
96
  className: cx("".concat(blockClass, "__head"), headerGroup.getHeaderGroupProps().className),
22
97
  ref: headRef
23
- }), datagridState.headers.filter(function (_ref) {
24
- var isVisible = _ref.isVisible;
98
+ }), datagridState.headers.filter(function (_ref2) {
99
+ var isVisible = _ref2.isVisible;
25
100
  return isVisible;
26
- }).map(function (header) {
101
+ }).map(function (header, index) {
27
102
  var _cx;
28
103
  if (header.id === selectionColumnId) {
29
104
  // render directly without the wrapper TableHeader
@@ -31,13 +106,59 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
31
106
  key: header.id
32
107
  });
33
108
  }
109
+ var _ref3 = header || 50,
110
+ minWidth = _ref3.minWidth;
111
+ var visibleColumns = datagridState.visibleColumns,
112
+ state = datagridState.state,
113
+ dispatch = datagridState.dispatch,
114
+ onColResizeEnd = datagridState.onColResizeEnd;
115
+ var columnResizing = state.columnResizing,
116
+ isResizing = state.isResizing;
117
+ var columnWidths = columnResizing.columnWidths;
118
+ var originalCol = visibleColumns[index];
34
119
  return /*#__PURE__*/React.createElement(TableHeader, _extends({}, header.getHeaderProps({
35
120
  role: false
36
121
  }), {
37
122
  className: cx((_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__resizableColumn"), header.getResizerProps), _defineProperty(_cx, "".concat(blockClass, "__isResizing"), header.isResizing), _defineProperty(_cx, "".concat(blockClass, "__sortableColumn"), datagridState.isTableSortable), _defineProperty(_cx, "".concat(blockClass, "__isSorted"), header.isSorted), _cx), header.getHeaderProps().className),
38
123
  key: header.id
39
- }), header.render('Header'), header.getResizerProps && /*#__PURE__*/React.createElement("div", _extends({}, header.getResizerProps(), {
40
- className: "".concat(blockClass, "__resizer")
124
+ }, getAccessibilityProps(header)), header.render('Header'), header.getResizerProps && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("input", _extends({}, header.getResizerProps(), {
125
+ onMouseMove: function onMouseMove(event) {
126
+ if (isResizing) {
127
+ var newWidth = getClientXPosition(event);
128
+ // Sets a min width for resizing so at least one character from the column header is visible
129
+ if (newWidth >= 50) {
130
+ handleColumnResizingEvent(dispatch, header, newWidth);
131
+ }
132
+ }
133
+ },
134
+ onMouseDown: function onMouseDown() {
135
+ return handleColumnResizeStartEvent(dispatch, header.id);
136
+ },
137
+ onKeyDown: function onKeyDown(event) {
138
+ var key = event.key;
139
+ if (key === 'ArrowLeft' || key === 'ArrowRight') {
140
+ var currentColumnWidth = columnWidths[header.id] || (datagridState.isTableSortable && originalCol.width < 90 ? 90 : originalCol.width);
141
+ if (key === 'ArrowLeft') {
142
+ if (currentColumnWidth - incrementAmount > Math.max(minWidth, 50)) {
143
+ var newWidth = currentColumnWidth - incrementAmount;
144
+ handleColumnResizingEvent(dispatch, header, newWidth, true);
145
+ }
146
+ }
147
+ if (key === 'ArrowRight') {
148
+ var _newWidth = currentColumnWidth + incrementAmount;
149
+ handleColumnResizingEvent(dispatch, header, _newWidth, true);
150
+ }
151
+ }
152
+ },
153
+ onKeyUp: function onKeyUp() {
154
+ return handleColumnResizeEndEvent(dispatch, onColResizeEnd, header.id);
155
+ },
156
+ className: cx("".concat(blockClass, "__col-resizer-range")),
157
+ type: "range",
158
+ defaultValue: originalCol.width,
159
+ "aria-label": "Resize column"
160
+ })), /*#__PURE__*/React.createElement("span", {
161
+ className: "".concat(blockClass, "__col-resize-indicator")
41
162
  })));
42
163
  }));
43
164
  };
@@ -11,6 +11,7 @@ import { Checkbox } from 'carbon-components-react';
11
11
  import { isColumnVisible } from './common';
12
12
  import DraggableElement from '../../DraggableElement';
13
13
  import { pkg } from '../../../../../settings';
14
+ import getColTitle from '../../../utils/getColTitle';
14
15
  var blockClass = "".concat(pkg.prefix, "--datagrid");
15
16
  export var DraggableItemsList = function DraggableItemsList(_ref) {
16
17
  var columns = _ref.columns,
@@ -22,29 +23,6 @@ export var DraggableItemsList = function DraggableItemsList(_ref) {
22
23
  setAriaRegionText = _ref.setAriaRegionText,
23
24
  setColumnsObject = _ref.setColumnsObject,
24
25
  setFocusIndex = _ref.setFocusIndex;
25
- // This function recursively looks for the nested header element until we can find the key which contains the title.
26
- // This can happen if multiple hooks are used together that manipulate the rendering of the column
27
- // header, such as `useColumnCenterAlign` and `useSortableColumns`.
28
- var getNestedTitle = function getNestedTitle(component) {
29
- if (component && !component.key) {
30
- return getNestedTitle(component.children);
31
- }
32
- if (component && component.key && typeof component.key === 'string') {
33
- return component.key;
34
- }
35
- };
36
- var getColTitle = function getColTitle(col) {
37
- if (!col) {
38
- return;
39
- }
40
- var checkTitle = function checkTitle() {
41
- if (col.Header().props.children.props && col.Header().props.children.props.title) {
42
- return col.Header().props.children.props.title;
43
- }
44
- return getNestedTitle(col.Header().props.children.props);
45
- };
46
- return typeof (col === null || col === void 0 ? void 0 : col.Header) === 'function' ? checkTitle() : col.Header.props.title;
47
- };
48
26
  return /*#__PURE__*/React.createElement(React.Fragment, null, columns
49
27
  // hide the columns without Header, e.g the sticky actions, spacer
50
28
  .filter(function (colDef) {
@@ -0,0 +1,111 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
+ /**
6
+ * Copyright IBM Corp. 2023, 2023
7
+ *
8
+ * This source code is licensed under the Apache-2.0 license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */
11
+
12
+ var COLUMN_RESIZE_START = 'columnStartResizing';
13
+ var COLUMN_RESIZING = 'columnResizing';
14
+ var COLUMN_RESIZE_END = 'columnDoneResizing';
15
+ var INIT = 'init';
16
+ export var handleColumnResizeStartEvent = function handleColumnResizeStartEvent(dispatch, headerId) {
17
+ dispatch({
18
+ type: COLUMN_RESIZE_START,
19
+ payload: {
20
+ headerId: headerId
21
+ }
22
+ });
23
+ };
24
+ export var handleColumnResizeEndEvent = function handleColumnResizeEndEvent(dispatch, onColResizeEnd, headerId) {
25
+ dispatch({
26
+ type: COLUMN_RESIZE_END,
27
+ payload: {
28
+ onColResizeEnd: onColResizeEnd,
29
+ headerId: headerId
30
+ }
31
+ });
32
+ };
33
+ export var handleColumnResizingEvent = function handleColumnResizingEvent(dispatch, header, newWidth, isKeyEvent) {
34
+ if (isKeyEvent) {
35
+ dispatch({
36
+ type: COLUMN_RESIZE_START,
37
+ payload: {
38
+ newWidth: newWidth,
39
+ headerId: header.id,
40
+ defaultWidth: header.originalWidth
41
+ }
42
+ });
43
+ }
44
+ dispatch({
45
+ type: COLUMN_RESIZING,
46
+ payload: {
47
+ newWidth: newWidth,
48
+ headerId: header.id,
49
+ defaultWidth: header.originalWidth
50
+ }
51
+ });
52
+ };
53
+ export var stateReducer = function stateReducer(newState, action) {
54
+ switch (action.type) {
55
+ case INIT:
56
+ {
57
+ return _objectSpread(_objectSpread({}, newState), {}, {
58
+ isResizing: false
59
+ });
60
+ }
61
+ case COLUMN_RESIZE_START:
62
+ {
63
+ var headerId = action.payload.headerId;
64
+ return _objectSpread(_objectSpread({}, newState), {}, {
65
+ isResizing: headerId
66
+ });
67
+ }
68
+ case COLUMN_RESIZING:
69
+ {
70
+ var _ref = action.payload || {},
71
+ _headerId = _ref.headerId,
72
+ newWidth = _ref.newWidth,
73
+ defaultWidth = _ref.defaultWidth;
74
+ var newColumnWidth = {};
75
+ if (typeof _headerId === 'undefined') {
76
+ return _objectSpread({}, newState);
77
+ }
78
+ newColumnWidth[_headerId] = newWidth;
79
+ var cleanedWidths = Object.fromEntries(Object.entries(newState.columnResizing.columnWidths).filter(function (_ref2) {
80
+ var _ref3 = _slicedToArray(_ref2, 2),
81
+ _ = _ref3[0],
82
+ value = _ref3[1];
83
+ return !isNaN(value);
84
+ }));
85
+ return _objectSpread(_objectSpread({}, newState), {}, {
86
+ isResizing: _headerId,
87
+ columnResizing: _objectSpread(_objectSpread({}, newState.columnResizing), {}, {
88
+ columnWidth: defaultWidth,
89
+ columnWidths: _objectSpread(_objectSpread({}, cleanedWidths), newColumnWidth),
90
+ headerIdWidths: [_headerId, newWidth]
91
+ })
92
+ });
93
+ }
94
+ case COLUMN_RESIZE_END:
95
+ {
96
+ var _action$payload = action.payload,
97
+ onColResizeEnd = _action$payload.onColResizeEnd,
98
+ _headerId2 = _action$payload.headerId;
99
+ var currentColumn = {};
100
+ currentColumn[_headerId2] = newState.columnResizing.columnWidths[_headerId2];
101
+ var allChangedColumns = newState.columnResizing.columnWidths;
102
+ var isResizing = newState.isResizing;
103
+ if (isResizing) {
104
+ onColResizeEnd === null || onColResizeEnd === void 0 ? void 0 : onColResizeEnd(currentColumn, allChangedColumns);
105
+ }
106
+ return _objectSpread(_objectSpread({}, newState), {}, {
107
+ isResizing: false
108
+ });
109
+ }
110
+ }
111
+ };
@@ -19,6 +19,7 @@ import useRowSize from './useRowSize';
19
19
  import useHeaderRow from './Datagrid/DatagridHeaderRow';
20
20
  import useFlexResize from './useFlexResize';
21
21
  import useFloatingScroll from './useFloatingScroll';
22
+ import { stateReducer } from './Datagrid/addons/stateReducer';
22
23
  var useDatagrid = function useDatagrid(params) {
23
24
  var defaultPlugins = [useFlexLayout, useHeaderRow, useSkeletonRows, useResizeColumns, useRowRenderer, useDefaultStringRenderer, useRowSize, useFilters, useGlobalFilter, useSortBy, useExpanded];
24
25
  var defaultEndPlugins = [usePagination, useRowSelect, useFlexResize, useFloatingScroll];
@@ -29,9 +30,11 @@ var useDatagrid = function useDatagrid(params) {
29
30
  for (var _len = arguments.length, plugins = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
30
31
  plugins[_key - 1] = arguments[_key];
31
32
  }
32
- var tableState = useTable.apply(void 0, [_objectSpread({
33
+ var tableState = useTable.apply(void 0, [_objectSpread(_objectSpread({
33
34
  tableId: tableId
34
- }, params)].concat(defaultPlugins, plugins, defaultEndPlugins, _toConsumableArray(clientEndPlugins)));
35
+ }, params), {}, {
36
+ stateReducer: stateReducer
37
+ })].concat(defaultPlugins, plugins, defaultEndPlugins, _toConsumableArray(clientEndPlugins)));
35
38
  return tableState;
36
39
  };
37
40
  export default useDatagrid;
@@ -0,0 +1,25 @@
1
+ // This function recursively looks for the nested header element until we can find the key which contains the title.
2
+ // This can happen if multiple hooks are used together that manipulate the rendering of the column
3
+ // header, such as `useColumnCenterAlign` and `useSortableColumns`.
4
+ var getNestedTitle = function getNestedTitle(component) {
5
+ if (component && !component.key) {
6
+ return getNestedTitle(component.children);
7
+ }
8
+ if (component && component.key && typeof component.key === 'string') {
9
+ return component.key;
10
+ }
11
+ };
12
+ var getColTitle = function getColTitle(col) {
13
+ var _col$Header, _col$Header$props;
14
+ if (!col) {
15
+ return;
16
+ }
17
+ var checkTitle = function checkTitle() {
18
+ if (col.Header().props.children.props && col.Header().props.children.props.title) {
19
+ return col.Header().props.children.props.title;
20
+ }
21
+ return getNestedTitle(col.Header().props.children.props);
22
+ };
23
+ return typeof (col === null || col === void 0 ? void 0 : col.Header) === 'function' ? checkTitle() : col === null || col === void 0 ? void 0 : (_col$Header = col.Header) === null || _col$Header === void 0 ? void 0 : (_col$Header$props = _col$Header.props) === null || _col$Header$props === void 0 ? void 0 : _col$Header$props.title;
24
+ };
25
+ export default getColTitle;
@@ -9,11 +9,12 @@ var _excluded = ["children", "className", "definition", "theme"];
9
9
  * LICENSE file in the root directory of this source tree.
10
10
  */
11
11
 
12
- import React, { useState } from 'react';
12
+ import React, { useRef, useState } from 'react';
13
13
  import PropTypes from 'prop-types';
14
14
  import cx from 'classnames';
15
15
  import { ChevronDown16 } from '@carbon/icons-react';
16
16
  import { getDevtoolsProps } from '../../global/js/utils/devtools';
17
+ import uuidv4 from '../../global/js/utils/uuidv4';
17
18
  import { pkg } from '../../settings';
18
19
 
19
20
  // The block part of our conventional BEM class names (blockClass__E--M).
@@ -41,6 +42,7 @@ export var NonLinearReading = /*#__PURE__*/React.forwardRef(function (_ref, ref)
41
42
  _useState2 = _slicedToArray(_useState, 2),
42
43
  isOpen = _useState2[0],
43
44
  setOpen = _useState2[1];
45
+ var contentId = useRef(uuidv4()).current;
44
46
  var handleToggle = function handleToggle() {
45
47
  setOpen(function (prevState) {
46
48
  return !prevState;
@@ -52,12 +54,15 @@ export var NonLinearReading = /*#__PURE__*/React.forwardRef(function (_ref, ref)
52
54
  role: "main"
53
55
  }, getDevtoolsProps(componentName)), ' ', /*#__PURE__*/React.createElement("button", {
54
56
  type: "button",
57
+ "aria-controls": contentId,
55
58
  "aria-expanded": isOpen,
56
59
  className: cx("".concat(blockClass, "__keyword"), [isOpen ? ["".concat(blockClass, "__keyword-open")] : ["".concat(blockClass, "__keyword-closed")]]),
57
60
  onClick: handleToggle
58
- }, children, /*#__PURE__*/React.createElement(ChevronDown16, null)), ' ', isOpen && /*#__PURE__*/React.createElement("span", {
59
- className: "".concat(blockClass, "__body")
60
- }, definition), ' ');
61
+ }, children, /*#__PURE__*/React.createElement(ChevronDown16, null)), ' ', /*#__PURE__*/React.createElement("span", {
62
+ id: contentId,
63
+ className: "".concat(blockClass, "__body"),
64
+ hidden: !isOpen
65
+ }, isOpen && definition), ' ');
61
66
  });
62
67
 
63
68
  // Return a placeholder if not released and not enabled by feature flag
@@ -53,4 +53,5 @@ export { CoachmarkButton } from './CoachmarkButton';
53
53
  export { CoachmarkOverlayElements } from './CoachmarkOverlayElements';
54
54
  export { CoachmarkOverlayElement } from './CoachmarkOverlayElement';
55
55
  export { CoachmarkStack } from './CoachmarkStack';
56
- export { InlineTip } from './InlineTip';
56
+ export { InlineTip } from './InlineTip';
57
+ export { Checklist } from './Checklist';
@@ -7,22 +7,38 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
7
7
  */
8
8
  import { useRef, useState, useLayoutEffect, useEffect } from 'react';
9
9
  export var useResizeObserver = function useResizeObserver(ref, callback) {
10
- var _useState = useState(0),
10
+ var _useState = useState(-1),
11
11
  _useState2 = _slicedToArray(_useState, 2),
12
12
  width = _useState2[0],
13
13
  setWidth = _useState2[1];
14
- var _useState3 = useState(0),
14
+ var _useState3 = useState(-1),
15
15
  _useState4 = _slicedToArray(_useState3, 2),
16
16
  height = _useState4[0],
17
17
  setHeight = _useState4[1];
18
18
  var entriesToHandle = useRef(null);
19
19
  var cb = useRef(callback);
20
20
  useEffect(function () {
21
- // ref for callback removes it as dependency fro useLayoutEffect
21
+ // ref for callback removes it as dependency from useLayoutEffect
22
22
  // This significantly reduces repeated calls if a function is redefined on every
23
23
  // render
24
24
  cb.current = callback;
25
25
  }, [callback]);
26
+ useEffect(function () {
27
+ var getInitialSize = function getInitialSize() {
28
+ if (ref.current) {
29
+ var _ref$current, _ref$current2;
30
+ var refComputedStyle = window.getComputedStyle(ref.current);
31
+ var initialWidth = (((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.offsetWidth) || 0) - (parseFloat((refComputedStyle === null || refComputedStyle === void 0 ? void 0 : refComputedStyle.paddingLeft) || 0), parseFloat((refComputedStyle === null || refComputedStyle === void 0 ? void 0 : refComputedStyle.paddingRight) || 0));
32
+ var initialHeight = (((_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.offsetHeight) || 0) - (parseFloat((refComputedStyle === null || refComputedStyle === void 0 ? void 0 : refComputedStyle.paddingTop) || 0), parseFloat((refComputedStyle === null || refComputedStyle === void 0 ? void 0 : refComputedStyle.paddingLeft) || 0));
33
+ setWidth(initialWidth);
34
+ setHeight(initialHeight);
35
+ }
36
+ };
37
+ if (!(ref !== null && ref !== void 0 && ref.current) || width >= 0 && height >= 0) {
38
+ return;
39
+ }
40
+ getInitialSize();
41
+ }, [width, height, ref]);
26
42
  useLayoutEffect(function () {
27
43
  if (!(ref !== null && ref !== void 0 && ref.current)) {
28
44
  return;
@@ -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,