@qualtrics/ui-react 2.23.0 → 2.23.1-alpha.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.
@@ -5,7 +5,7 @@ const Check = props => /*#__PURE__*/React__default.createElement("svg", _extends
5
5
  width: "16",
6
6
  height: "16",
7
7
  focusable: "false",
8
- "aria-hidden": "true",
8
+ role: "presentation",
9
9
  viewBox: "0 0 16 16",
10
10
  xmlns: "http://www.w3.org/2000/svg",
11
11
  "data-icontype": "Check"
@@ -11,11 +11,11 @@ const VisualCheckbox = _ref => {
11
11
  let {
12
12
  className,
13
13
  checked,
14
- disabled
14
+ disabled = false
15
15
  } = _ref;
16
16
  return /*#__PURE__*/React__default.createElement("span", {
17
17
  className: classNames(className, styles.checkbox),
18
- "aria-hidden": true
18
+ role: "presentation"
19
19
  }, /*#__PURE__*/React__default.createElement("div", {
20
20
  className: classNames(styles.input, {
21
21
  [styles.checked]: checked,
@@ -10,7 +10,8 @@ const Divider = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
10
10
  } = _ref;
11
11
  return /*#__PURE__*/React__default.createElement("hr", _extends({
12
12
  ref: ref,
13
- className: classNames(className, styles.divider)
13
+ className: classNames(className, styles.divider),
14
+ role: "presentation"
14
15
  }, rest));
15
16
  });
16
17
 
@@ -1,7 +1,7 @@
1
1
  import _extends from '@babel/runtime-corejs3/helpers/extends';
2
2
  import React__default from 'react';
3
3
  import classNames from 'classnames';
4
- import styles from './IconButton2.js';
4
+ import iconButtonStyles from './IconButton2.js';
5
5
  import '../Tooltip/index.js';
6
6
  import Tooltip from '../Tooltip/Tooltip.js';
7
7
 
@@ -20,8 +20,8 @@ const IconButton = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
20
20
  onKeyDown,
21
21
  ...rest
22
22
  } = _ref;
23
- const classes = classNames(className, styles.button, {
24
- [styles.disabled]: disabled
23
+ const classes = classNames(className, iconButtonStyles.button, {
24
+ [iconButtonStyles.disabled]: disabled
25
25
  });
26
26
  if (children.props.size) {
27
27
  // eslint-disable-next-line no-console
@@ -1,8 +1,8 @@
1
1
  import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
2
2
 
3
3
  var css_248z = "._X5ZnV{border-radius:4px;border:none;height:36px;width:36px;display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;padding:0;cursor:pointer;fill:#515559;background-color:transparent;transition:background .2s,color .2s}._X5ZnV:focus{outline:none}._X5ZnV:hover:not(._quipx){background-color:rgba(50,54,58,.08)}._X5ZnV:active:not(._quipx){background-color:rgba(50,54,58,.11);stroke-width:2}._X5ZnV._quipx{cursor:not-allowed;fill:rgba(81,85,89,.6)}._X5ZnV.focus-visible,._X5ZnV:focus-visible{outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
4
- var styles = {"button":"_X5ZnV","disabled":"_quipx"};
4
+ var iconButtonStyles = {"button":"_X5ZnV","disabled":"_quipx"};
5
5
  var stylesheet="._X5ZnV{border-radius:4px;border:none;height:36px;width:36px;display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;padding:0;cursor:pointer;fill:#515559;background-color:transparent;transition:background .2s,color .2s}._X5ZnV:focus{outline:none}._X5ZnV:hover:not(._quipx){background-color:rgba(50,54,58,.08)}._X5ZnV:active:not(._quipx){background-color:rgba(50,54,58,.11);stroke-width:2}._X5ZnV._quipx{cursor:not-allowed;fill:rgba(81,85,89,.6)}._X5ZnV.focus-visible,._X5ZnV:focus-visible{outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
6
6
  styleInject(css_248z);
7
7
 
8
- export { styles as default, stylesheet };
8
+ export { iconButtonStyles as default, stylesheet };
@@ -1,4 +1,4 @@
1
- import React__default, { useCallback } from 'react';
1
+ import React__default, { useMemo, useCallback } from 'react';
2
2
  import classNames from 'classnames';
3
3
  import styles from './LogicEditor2.js';
4
4
  import { LOGIC_TYPE_CONDITION, LOGIC_TYPE_SET, SET_VALUE_ANY, SET_VALUE_ALL } from './utils.js';
@@ -31,10 +31,10 @@ const ConditionSet = function ConditionSet(_ref) {
31
31
  readOnly,
32
32
  rootDataTestId
33
33
  } = useLogicEditorContext();
34
- const position = {
34
+ const position = useMemo(() => ({
35
35
  parent,
36
36
  index
37
- };
37
+ }), [parent, index]);
38
38
  const conditionRef = React__default.useRef(null);
39
39
  const lastConnectionRef = React__default.useRef();
40
40
  const lastItemRef = React__default.useRef();
@@ -63,12 +63,12 @@ const ConditionSet = function ConditionSet(_ref) {
63
63
  }
64
64
  useEventListener(window, 'resize', setupLastLine);
65
65
  React__default.useLayoutEffect(setupLastLine);
66
- const handleNewLogicItem = (item, newItemIndex) => () => {
66
+ const handleNewLogicItem = useCallback((item, newItemIndex) => {
67
67
  onNewLogicItem(item, {
68
68
  parent: position,
69
69
  index: newItemIndex
70
70
  });
71
- };
71
+ }, [position, onNewLogicItem]);
72
72
 
73
73
  /**
74
74
  * Returns a data-testid unique to the current position in the tree.
@@ -89,13 +89,12 @@ const ConditionSet = function ConditionSet(_ref) {
89
89
  }
90
90
  return getSubDataTestId(rootDataTestId, "".concat(prefix, "-").concat(indices.join('-')));
91
91
  }, [fixedSet, rootDataTestId]);
92
- function renderControls(itemType, itemPosition, itemIndex, itemLevel, numberOfSetItems, itemId) {
92
+ function renderControls(itemType, itemPosition, itemLevel, numberOfSetItems, itemId) {
93
93
  return /*#__PURE__*/React__default.createElement(Controls, {
94
94
  handleNewLogicItem: handleNewLogicItem,
95
- level: level,
96
95
  itemType: itemType,
97
- itemPosition: itemPosition,
98
- itemIndex: itemIndex,
96
+ parent: itemPosition.parent,
97
+ itemIndex: itemPosition.index,
99
98
  itemLevel: itemLevel,
100
99
  numberOfSetItems: numberOfSetItems,
101
100
  itemId: itemId,
@@ -131,7 +130,7 @@ const ConditionSet = function ConditionSet(_ref) {
131
130
  position: conditionPosition,
132
131
  condition: item,
133
132
  firstFocusableElementRef: fixedSet && firstFocusableElementRef && i === 0 ? firstFocusableElementRef : undefined,
134
- conditionControls: !readOnly ? renderControls(LOGIC_TYPE_CONDITION, conditionPosition, i + 1, level + 1, value.conditions.length, item.id) : undefined
133
+ conditionControls: !readOnly ? renderControls(LOGIC_TYPE_CONDITION, conditionPosition, level + 1, value.conditions.length, item.id) : undefined
135
134
  }));
136
135
  }
137
136
  if (item.logicType === LOGIC_TYPE_SET) {
@@ -173,7 +172,7 @@ const ConditionSet = function ConditionSet(_ref) {
173
172
  }), /*#__PURE__*/React__default.createElement(DropdownOption, {
174
173
  value: SET_VALUE_ALL,
175
174
  label: String(translations.all)
176
- }))), !readOnly && renderControls(LOGIC_TYPE_SET, position, index, level, value.conditions.length, value.id)), /*#__PURE__*/React__default.createElement("div", {
175
+ }))), !readOnly && renderControls(LOGIC_TYPE_SET, position, level, value.conditions.length, value.id)), /*#__PURE__*/React__default.createElement("div", {
177
176
  role: "group",
178
177
  ref: conditionRef
179
178
  }, renderSetChildren()));
@@ -1,8 +1,8 @@
1
- import React__default from 'react';
1
+ import React__default, { useMemo } from 'react';
2
2
  import classNames from 'classnames';
3
3
  import styles from './LogicEditor2.js';
4
4
  import '../../icons/index.es.js';
5
- import { LOGIC_TYPE_CONDITION, newCondition, LOGIC_TYPE_SET, newConditionSet } from './utils.js';
5
+ import { LOGIC_TYPE_CONDITION, LOGIC_TYPE_SET, newCondition, newConditionSet } from './utils.js';
6
6
  import '../NewMenu/index.js';
7
7
  import '../IconButton/index.js';
8
8
  import { useLogicEditorContext } from './LogicEditorContext.js';
@@ -17,9 +17,8 @@ import RemoveItemIcon from '../../icons/components/RemoveItemIcon.js';
17
17
  const Controls = function Controls(_ref) {
18
18
  let {
19
19
  handleNewLogicItem,
20
- level,
21
20
  itemType,
22
- itemPosition,
21
+ parent,
23
22
  itemIndex,
24
23
  itemLevel,
25
24
  itemId,
@@ -35,11 +34,14 @@ const Controls = function Controls(_ref) {
35
34
  maxConditions,
36
35
  controlsRef
37
36
  } = useLogicEditorContext();
38
- return /*#__PURE__*/React__default.createElement("div", {
39
- className: classNames({
40
- [styles.conditionControlsContainer]: itemType === LOGIC_TYPE_CONDITION
41
- })
42
- }, /*#__PURE__*/React__default.createElement(Menu, {
37
+ const canAddNewSet = useMemo(() => {
38
+ // If "insert condition set below" is clicked on a logic item's control, it's added at the same level.
39
+ // If "insert condition set below" is clicked on a logic set's control, it's added a level deeper.
40
+ const levelOfNewSet = itemType === LOGIC_TYPE_CONDITION ? itemLevel : itemLevel + 1;
41
+ return !fixedSet && levelOfNewSet <= maxNestedSets;
42
+ }, [fixedSet, itemLevel, maxNestedSets, itemType]);
43
+ const indexOfNewItem = useMemo(() => itemType === LOGIC_TYPE_SET ? 0 : itemIndex + 1, [itemType, itemIndex]);
44
+ const menu = useMemo(() => /*#__PURE__*/React__default.createElement(Menu, {
43
45
  anchor: /*#__PURE__*/React__default.createElement(IconButton, {
44
46
  "aria-label": translations.conditionActions,
45
47
  className: styles.controls,
@@ -54,14 +56,14 @@ const Controls = function Controls(_ref) {
54
56
  }
55
57
  }, !(fixedSet && maxConditions && numberOfSetItems >= maxConditions) && /*#__PURE__*/React__default.createElement(MenuItem, {
56
58
  value: "add-condition",
57
- onSelect: handleNewLogicItem(newCondition(), itemType === LOGIC_TYPE_SET ? 0 : itemIndex)
59
+ onSelect: () => handleNewLogicItem(newCondition(), indexOfNewItem)
58
60
  }, /*#__PURE__*/React__default.createElement(AddItemIcon, {
59
61
  "aria-hidden": "true"
60
62
  }), /*#__PURE__*/React__default.createElement("span", {
61
63
  className: styles.controlMenuItem
62
- }, translations.insertConditionBelow)), !fixedSet && level < maxNestedSets && /*#__PURE__*/React__default.createElement(MenuItem, {
64
+ }, translations.insertConditionBelow)), canAddNewSet && /*#__PURE__*/React__default.createElement(MenuItem, {
63
65
  value: "add-set",
64
- onSelect: handleNewLogicItem(newConditionSet(defaultSetValue), itemType === LOGIC_TYPE_SET ? 0 : itemIndex)
66
+ onSelect: () => handleNewLogicItem(newConditionSet(defaultSetValue), indexOfNewItem)
65
67
  }, /*#__PURE__*/React__default.createElement(FilterIcon, {
66
68
  "aria-hidden": "true"
67
69
  }), /*#__PURE__*/React__default.createElement("span", {
@@ -69,7 +71,10 @@ const Controls = function Controls(_ref) {
69
71
  }, translations.insertSetBelow)), (fixedSet && numberOfSetItems > 1 || !fixedSet && itemLevel > 0) && /*#__PURE__*/React__default.createElement(MenuItem, {
70
72
  value: "delete",
71
73
  onSelect: e => {
72
- onDelete(itemPosition);
74
+ onDelete({
75
+ parent,
76
+ index: itemIndex
77
+ });
73
78
  // We want to move focus to the previous control
74
79
  // item when this one is deleted, so we need to
75
80
  // prevent Menu's default focus behavior
@@ -79,7 +84,16 @@ const Controls = function Controls(_ref) {
79
84
  "aria-hidden": "true"
80
85
  }), /*#__PURE__*/React__default.createElement("span", {
81
86
  className: styles.controlMenuItem
82
- }, translations.delete))));
87
+ }, translations.delete))), [
88
+ // context
89
+ translations, fixedSet, onDelete, defaultSetValue, maxConditions, controlsRef,
90
+ // props
91
+ handleNewLogicItem, parent, itemIndex, itemLevel, itemId, numberOfSetItems, dataTestId, canAddNewSet, indexOfNewItem]);
92
+ return /*#__PURE__*/React__default.createElement("div", {
93
+ className: classNames({
94
+ [styles.conditionControlsContainer]: itemType === LOGIC_TYPE_CONDITION
95
+ })
96
+ }, menu);
83
97
  };
84
98
 
85
99
  export { Controls as default };
@@ -1,5 +1,5 @@
1
1
  import _extends from '@babel/runtime-corejs3/helpers/extends';
2
- import React__default, { useRef } from 'react';
2
+ import React__default, { useMemo, useState, useCallback, useRef } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import styles from './LogicEditor2.js';
5
5
  import ConditionSet from './ConditionSet.js';
@@ -26,63 +26,74 @@ const LogicEditor = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
26
26
  const {
27
27
  translate
28
28
  } = useTranslation();
29
- const translations = {
29
+ const translations = useMemo(() => ({
30
30
  any: translate('logicEditor.any'),
31
31
  all: translate('logicEditor.all'),
32
32
  insertConditionBelow: translate('logicEditor.insertConditionBelow'),
33
33
  insertSetBelow: translate('logicEditor.insertSetBelow'),
34
34
  delete: translate('logicEditor.delete'),
35
35
  conditionActions: translate('logicEditor.conditionActions')
36
- };
37
- const [state, setState] = React__default.useState(constructValidDefaultState({
36
+ }), [translate]);
37
+ const [state, setState] = useState(constructValidDefaultState({
38
38
  defaultValue,
39
39
  defaultSetValue,
40
40
  fixedSet,
41
41
  maxNestedSets
42
42
  }));
43
43
  const classes = classNames(className, styles.editor);
44
- function update(newState) {
45
- setState(newState);
46
- onChange === null || onChange === void 0 ? void 0 : onChange(newState);
47
- }
48
- const handleNewLogicItem = (item, position) => {
49
- const newState = shallowCopy(state);
50
- const parent = getParentSet(newState, position);
51
- parent.conditions.splice(position.index, 0, item);
52
- update(newState);
53
- };
44
+ const update = useCallback(setStateCallback => {
45
+ setState(prevState => {
46
+ const newState = setStateCallback(prevState);
47
+ onChange === null || onChange === void 0 ? void 0 : onChange(newState);
48
+ return newState;
49
+ });
50
+ }, [onChange]);
51
+ const handleNewLogicItem = useCallback((item, position) => {
52
+ update(prevState => {
53
+ const newState = shallowCopy(prevState);
54
+ const parent = getParentSet(newState, position);
55
+ parent.conditions.splice(position.index, 0, item);
56
+ return newState;
57
+ });
58
+ }, [update]);
54
59
  const handleSetChange = (newSetValue, position) => {
55
- const rootState = shallowCopy(state);
56
- const parent = getParentSet(rootState, position);
57
- if (!position.parent) {
58
- // root set
59
- parent.value = newSetValue;
60
- } else {
61
- parent.conditions[position.index].value = newSetValue;
62
- }
63
- update(rootState);
60
+ update(prevState => {
61
+ const rootState = shallowCopy(prevState);
62
+ const parent = getParentSet(rootState, position);
63
+ if (!position.parent) {
64
+ // root set
65
+ parent.value = newSetValue;
66
+ } else {
67
+ parent.conditions[position.index].value = newSetValue;
68
+ }
69
+ return rootState;
70
+ });
64
71
  };
65
72
  const handleConditionChange = (newCondition, position) => {
66
- const newState = shallowCopy(state);
67
- const parent = getParentSet(newState, position);
68
- parent.conditions[position.index] = newCondition;
69
- update(newState);
73
+ update(prevState => {
74
+ const newState = shallowCopy(prevState);
75
+ const parent = getParentSet(newState, position);
76
+ parent.conditions[position.index] = newCondition;
77
+ return newState;
78
+ });
70
79
  };
71
80
  const controlsRef = useRef({});
72
- const handleDelete = position => {
73
- let previousItemId = getPreviousItemId(state, position);
74
- const newState = shallowCopy(state);
75
- const parent = getParentSet(newState, position);
76
- parent.conditions.splice(position.index, 1);
81
+ const handleDelete = useCallback(position => {
82
+ update(prevState => {
83
+ let previousItemId = getPreviousItemId(prevState, position);
84
+ const newState = shallowCopy(prevState);
85
+ const parent = getParentSet(newState, position);
86
+ parent.conditions.splice(position.index, 1);
77
87
 
78
- // If the last condition in a set was deleted, also delete the set.
79
- if (parent.conditions.length === 0) {
80
- previousItemId = getPreviousItemId(newState, position.parent);
81
- getParentSet(newState, position.parent).conditions.splice(position.parent.index, 1);
82
- }
83
- controlsRef.current[previousItemId].focus();
84
- update(newState);
85
- };
88
+ // If the last condition in a set was deleted, also delete the set.
89
+ if (parent.conditions.length === 0) {
90
+ previousItemId = getPreviousItemId(newState, position.parent);
91
+ getParentSet(newState, position.parent).conditions.splice(position.parent.index, 1);
92
+ }
93
+ controlsRef.current[previousItemId].focus();
94
+ return newState;
95
+ });
96
+ }, [update, controlsRef]);
86
97
  return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
87
98
  role: "group",
88
99
  className: classes,
@@ -178,7 +178,8 @@ const Tooltip = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
178
178
  // Allows the user to press the `Escape` key to close the flyout even if the anchor element is not focused
179
179
  // handle in capture so that it runs before modal or popover event handlers
180
180
  useEventListener(document, 'keydown', handleKeyDown, {
181
- isCaptureEvent: true
181
+ isCaptureEvent: true,
182
+ isDisabled: !isInDOM
182
183
  });
183
184
  useEventListener(anchorRef, 'mouseenter', handleMouseEnter);
184
185
  useEventListener(anchorRef, 'mouseleave', handleMouseLeave);
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./__shared/cjs/index-10d6f3f3.js');
5
+ var index = require('./__shared/cjs/index-cf860ea0.js');
6
6
  require('react');
7
7
  require('classnames');
8
8
  require('./__shared/cjs/index-7f78e01b.js');
@@ -79,7 +79,15 @@ const AdvancedTable = _ref => {
79
79
  // and the internal row transforms cause infinite state updates using a standard default assignment
80
80
  const stableDefaultArray = useMemo(() => [], []);
81
81
  const rowsProp = rowsPropExternal !== null && rowsPropExternal !== void 0 ? rowsPropExternal : stableDefaultArray;
82
- const [rows, setRows] = useState();
82
+ const rows = useMemo(() => {
83
+ let filteredRows = [];
84
+ rowsProp.forEach((row, i) => {
85
+ filteredRows = filteredRows.concat(mapExternalRowToInternalRows(row, rowsProp.length + 1, i + 1) // add 1 to account for table header
86
+ );
87
+ });
88
+
89
+ return filteredRows;
90
+ }, [rowsProp]);
83
91
  const rowActionsColumnConfigId = useId();
84
92
  let rowActionsColumnConfig;
85
93
  const columnConfigs = useMemo(() => [...externalColumnConfigs],
@@ -227,8 +235,6 @@ const AdvancedTable = _ref => {
227
235
  const [dropTarget, setDropTarget] = useState('');
228
236
  const [dropTargetSide, setDropTargetSide] = useState();
229
237
  const [lastToggledRowId, setLastToggledRowId] = useState('');
230
- // Enables disabling row hover styles when hovering on the checkbox. Needed since a CSS parent selector doesn't exist.
231
- const [isCheckboxHovered, setIsCheckboxHovered] = useState(false);
232
238
 
233
239
  // Enables using Set.prototype.has() vs Array.prototype.includes() for better performance at scale
234
240
  const [checkedRowIdsSet, setCheckedRowIdsSet] = useState(new Set(checkedRowIds));
@@ -238,38 +244,6 @@ const AdvancedTable = _ref => {
238
244
  selectedSortOption,
239
245
  setCurrentPage
240
246
  });
241
- const mapExternalRowToInternalRows = useCallback(function (row, depthSize, depthIndex, parentId) {
242
- let depth = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
243
- let mappedRows = [];
244
- const hasChildRows = !!row.childRows && row.childRows.length > 0;
245
- mappedRows.push({
246
- id: row.id,
247
- data: row.data,
248
- hasChildRows,
249
- parentId,
250
- depth,
251
- depthSize,
252
- depthIndex,
253
- isExpanded: row.isExpanded,
254
- rowProps: row.unsafe_rowProps,
255
- rowPropReference: row
256
- });
257
- if (row.isExpanded && row.childRows !== undefined && hasChildRows) {
258
- row.childRows.forEach((child, i) => {
259
- mappedRows = mappedRows.concat(mapExternalRowToInternalRows(child, row.childRows !== undefined ? row.childRows.length : 0, i, row.id, depth + 1));
260
- });
261
- }
262
- return mappedRows;
263
- }, []);
264
- useEffect(() => {
265
- let filteredRows = [];
266
- rowsProp.forEach((row, i) => {
267
- filteredRows = filteredRows.concat(mapExternalRowToInternalRows(row, rowsProp.length + 1, i + 1) // add 1 to account for table header
268
- );
269
- });
270
-
271
- setRows(filteredRows);
272
- }, [rowsProp, mapExternalRowToInternalRows]);
273
247
  useEffect(() => {
274
248
  setCheckedRowIdsSet(new Set(checkedRowIds));
275
249
  }, [checkedRowIds]);
@@ -565,8 +539,7 @@ const AdvancedTable = _ref => {
565
539
  e.stopPropagation(); // prevent onRowSelect
566
540
  e.preventDefault();
567
541
  updateExpandedRowIds(rowIndex);
568
- },
569
- onFocus: onRowFocus(rowIndex, minColumnIndex)
542
+ }
570
543
  });
571
544
  const getExpandableRowsSpacer = function (width, inHeader) {
572
545
  let children = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
@@ -576,7 +549,8 @@ const AdvancedTable = _ref => {
576
549
  }),
577
550
  style: {
578
551
  width
579
- }
552
+ },
553
+ role: "presentation"
580
554
  }, children);
581
555
  };
582
556
  const getCellProps = (columnConfig, columnIndex, data, rowIndex, rowId, depth) => {
@@ -618,6 +592,8 @@ const AdvancedTable = _ref => {
618
592
  backend: HTML5Backend
619
593
  }, /*#__PURE__*/React__default.createElement("div", {
620
594
  className: styles.advancedTable,
595
+ ref: tableRef
596
+ }, /*#__PURE__*/React__default.createElement("div", {
621
597
  role: hasExpandableRows ? 'treegrid' : 'grid',
622
598
  "aria-multiselectable": hasExpandableRows && hasCheckboxColumn ? true : undefined,
623
599
  "aria-rowcount": rows ? rows.length + 1 : 0,
@@ -625,8 +601,7 @@ const AdvancedTable = _ref => {
625
601
  "aria-labelledby": ariaLabelledBy,
626
602
  "aria-label": ariaLabel,
627
603
  "aria-describedby": ariaDescribedBy,
628
- "data-testid": dataTestId,
629
- ref: tableRef
604
+ "data-testid": dataTestId
630
605
  }, dragSource && !disableUserPinnableColumns && !disableUserReorderableColumns ? /*#__PURE__*/React__default.createElement(AdvancedTableDragPreview, {
631
606
  tableRef: tableRef,
632
607
  columnHeaderRefs: cellRefs.current[-1]
@@ -663,7 +638,6 @@ const AdvancedTable = _ref => {
663
638
  state: checkedRowIds.length === totalRowsCountWithExpansion ? 'true' : checkedRowIds.length === 0 ? 'false' : 'mixed',
664
639
  isRowFocused: headerRowIndex === focusedRowIndex,
665
640
  onClick: handleColumnHeaderCheckboxToggle,
666
- onFocus: onRowFocus(headerRowIndex, minColumnIndex),
667
641
  variant: "header"
668
642
  }), hasExpandableRows && pinnedColumnConfigs.length ? getExpandableRowsSpacer("".concat(widthBufferWidth, "px"), true) : undefined, pinnedColumnConfigs.map((columnConfigs, i) => {
669
643
  const props = getColumnHeaderProps(columnConfigs, i, true);
@@ -682,11 +656,10 @@ const AdvancedTable = _ref => {
682
656
  depth = 0,
683
657
  depthSize,
684
658
  depthIndex,
685
- rowPropReference,
686
659
  parentId,
687
- rowProps
660
+ rowProps,
661
+ hasChildRows
688
662
  } = row;
689
- const hasChildRows = rowPropReference.childRows && rowPropReference.childRows.length > 0;
690
663
  const paginatedRowIndex = getPaginatedRowIndex(rowIndex);
691
664
  const onSelect = e => {
692
665
  e.preventDefault(); // stops event from triggering on new target when focus is changed during onSelect
@@ -706,12 +679,12 @@ const AdvancedTable = _ref => {
706
679
  "aria-rowindex": hasExpandableRows ? undefined : paginatedRowIndex + 2 // aria-rowindex is one-indexed + the column headers row is the first row in the table
707
680
  ,
708
681
 
682
+ "aria-expanded": hasChildRows ? !!isExpanded : undefined,
709
683
  "data-testid": dataTestId && rowId ? "".concat(dataTestId, "-row-").concat(rowId) : undefined,
710
684
  hasOnRowSelect: hasOnRowSelect,
711
685
  isFocusable: hasFocusableRows,
712
686
  isFocused: paginatedRowIndex === focusedRowIndex && minColumnIndex === focusedColumnIndex,
713
687
  isSelected: selectedRowId === rowId,
714
- isCheckboxHovered: isCheckboxHovered,
715
688
  onKeyDown: onRowKeyDown,
716
689
  onFocus: onRowFocus(paginatedRowIndex, minColumnIndex),
717
690
  onClick: e => onSelect(e),
@@ -735,10 +708,7 @@ const AdvancedTable = _ref => {
735
708
  } else {
736
709
  singleUpdateCheckedRowIds(paginatedRowIndex);
737
710
  }
738
- },
739
- onMouseEnter: () => setIsCheckboxHovered(true),
740
- onMouseLeave: () => setIsCheckboxHovered(false),
741
- onFocus: onRowFocus(paginatedRowIndex, minColumnIndex)
711
+ }
742
712
  }), hasExpandableRows && pinnedColumnConfigs.length ? getExpandableRowsSpacer("".concat(widthBufferWidth * (depth + 1), "px"), false, hasChildRows ? getAdvancedTableRowExpandButton(rowId, isExpanded, rowIndex) : undefined) : undefined, pinnedColumnConfigs.map((c, i) => {
743
713
  const props = getCellProps(c, i, data, paginatedRowIndex, rowId, depth);
744
714
  return /*#__PURE__*/React__default.createElement(AdvancedTableCell, _extends({}, props, {
@@ -755,7 +725,7 @@ const AdvancedTable = _ref => {
755
725
  "aria-colindex": i + 1 // aria-colindex is one-indexed
756
726
  }));
757
727
  }));
758
- })), rowsPerPage ? /*#__PURE__*/React__default.createElement(AdvancedTablePagination, {
728
+ }))), rowsPerPage ? /*#__PURE__*/React__default.createElement(AdvancedTablePagination, {
759
729
  rowsPerPage: rowsPerPage,
760
730
  onPageChange: onPageChange,
761
731
  ariaLabel: paginationAriaLabel,
@@ -916,5 +886,28 @@ function useFocusState(_ref8) {
916
886
  cellRefs
917
887
  };
918
888
  }
889
+ function mapExternalRowToInternalRows(row, depthSize, depthIndex, parentId) {
890
+ let depth = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
891
+ let mappedRows = [];
892
+ const hasChildRows = !!row.childRows && row.childRows.length > 0;
893
+ mappedRows.push({
894
+ id: row.id,
895
+ data: row.data,
896
+ hasChildRows,
897
+ parentId,
898
+ depth,
899
+ depthSize,
900
+ depthIndex,
901
+ isExpanded: row.isExpanded,
902
+ rowProps: row.unsafe_rowProps,
903
+ rowPropReference: row
904
+ });
905
+ if (row.isExpanded && row.childRows !== undefined && hasChildRows) {
906
+ row.childRows.forEach((child, i) => {
907
+ mappedRows = mappedRows.concat(mapExternalRowToInternalRows(child, row.childRows !== undefined ? row.childRows.length : 0, i, row.id, depth + 1));
908
+ });
909
+ }
910
+ return mappedRows;
911
+ }
919
912
 
920
913
  export { AdvancedTable };