@instructure/ui-drilldown 11.7.9-snapshot-0 → 11.7.9-snapshot-2
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.
- package/CHANGELOG.md +1 -1
- package/lib/Drilldown/v1/index.js +35 -42
- package/lib/Drilldown/v2/index.js +31 -36
- package/package.json +19 -19
- package/tsconfig.build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [11.7.9-snapshot-
|
|
6
|
+
## [11.7.9-snapshot-2](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-snapshot-2) (2026-10-12)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-drilldown
|
|
9
9
|
|
|
@@ -7,21 +7,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.Drilldown = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _console = require("@instructure/console");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
14
|
-
var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
|
|
15
|
-
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
16
|
-
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
17
|
-
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
|
10
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
11
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
12
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
18
13
|
var _v11_ = require("@instructure/ui-view/v11_6");
|
|
19
14
|
var _v11_2 = require("@instructure/ui-options/v11_6");
|
|
20
15
|
var _v11_3 = require("@instructure/ui-popover/v11_6");
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/generated/IconArrowOpenEndSolid.js");
|
|
24
|
-
var _IconCheckSolid = require("@instructure/ui-icons/lib/generated/IconCheckSolid.js");
|
|
16
|
+
var _uiSelectable = require("@instructure/ui-selectable");
|
|
17
|
+
var _uiIcons = require("@instructure/ui-icons");
|
|
25
18
|
var _emotion = require("@instructure/emotion");
|
|
26
19
|
var _index = require("./DrilldownSeparator/index.js");
|
|
27
20
|
var _index2 = require("./DrilldownOption/index.js");
|
|
@@ -68,7 +61,7 @@ var _dec, _dec2, _class;
|
|
|
68
61
|
category: components
|
|
69
62
|
---
|
|
70
63
|
**/
|
|
71
|
-
let Drilldown = exports.Drilldown = (_dec = (0,
|
|
64
|
+
let Drilldown = exports.Drilldown = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = _dec2(_class = class Drilldown extends _react.Component {
|
|
72
65
|
static displayName = 'Drilldown';
|
|
73
66
|
static componentId = 'Drilldown';
|
|
74
67
|
static allowedProps = _props.allowedProps;
|
|
@@ -190,7 +183,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
190
183
|
};
|
|
191
184
|
this.pages.forEach(page => {
|
|
192
185
|
this.getChildrenArray(page.props.children).forEach(child => {
|
|
193
|
-
if ((0,
|
|
186
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_index3.DrilldownGroup])) {
|
|
194
187
|
const {
|
|
195
188
|
id: groupId,
|
|
196
189
|
selectableType,
|
|
@@ -200,7 +193,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
200
193
|
if (!selectableType || !Array.isArray(selectedOptions)) return;
|
|
201
194
|
const newGroupMap = new Map();
|
|
202
195
|
this.getChildrenArray(groupChildren)?.forEach(groupChild => {
|
|
203
|
-
if ((0,
|
|
196
|
+
if ((0, _uiReactUtils.matchComponentTypes)(groupChild, [_index2.DrilldownOption])) {
|
|
204
197
|
const {
|
|
205
198
|
id: optionId,
|
|
206
199
|
value: optionValue
|
|
@@ -211,7 +204,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
211
204
|
}
|
|
212
205
|
});
|
|
213
206
|
const currentGroupMapInState = this.state.selectedGroupOptionsMap[groupId] || new Map();
|
|
214
|
-
if (!(0,
|
|
207
|
+
if (!(0, _uiUtils.deepEqual)(this.getNormalizedMap(newGroupMap), this.getNormalizedMap(currentGroupMapInState))) {
|
|
215
208
|
nextSelectionMap[groupId] = newGroupMap;
|
|
216
209
|
shouldUpdateState = true;
|
|
217
210
|
}
|
|
@@ -352,7 +345,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
352
345
|
children
|
|
353
346
|
} = page.props;
|
|
354
347
|
this.getChildrenArray(children).forEach(child => {
|
|
355
|
-
if ((0,
|
|
348
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_index3.DrilldownGroup])) {
|
|
356
349
|
const {
|
|
357
350
|
id: groupId,
|
|
358
351
|
selectableType,
|
|
@@ -373,7 +366,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
373
366
|
}
|
|
374
367
|
}
|
|
375
368
|
this.getChildrenArray(groupChildren)?.forEach(groupChild => {
|
|
376
|
-
if ((0,
|
|
369
|
+
if ((0, _uiReactUtils.matchComponentTypes)(groupChild, [_index2.DrilldownOption])) {
|
|
377
370
|
const {
|
|
378
371
|
id: optionId,
|
|
379
372
|
value: optionValue,
|
|
@@ -429,8 +422,8 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
429
422
|
|
|
430
423
|
// Back navigation option
|
|
431
424
|
if (this.previousPage) {
|
|
432
|
-
const prevPageTitle = (0,
|
|
433
|
-
const backButtonLabel = (0,
|
|
425
|
+
const prevPageTitle = (0, _uiReactUtils.callRenderProp)(this.previousPage.renderTitle);
|
|
426
|
+
const backButtonLabel = (0, _uiReactUtils.callRenderProp)(renderBackButtonLabel, prevPageTitle);
|
|
434
427
|
headerChildren.push((0, _jsxRuntime.jsx)(_index2.DrilldownOption, {
|
|
435
428
|
id: this._headerBackId,
|
|
436
429
|
onOptionClick: this.handleBackButtonClick,
|
|
@@ -444,7 +437,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
444
437
|
|
|
445
438
|
// Header title
|
|
446
439
|
if (renderTitle) {
|
|
447
|
-
const title = (0,
|
|
440
|
+
const title = (0, _uiReactUtils.callRenderProp)(renderTitle);
|
|
448
441
|
if (title) {
|
|
449
442
|
headerChildren.push((0, _jsxRuntime.jsx)(_index2.DrilldownOption, {
|
|
450
443
|
id: this._headerTitleId,
|
|
@@ -461,7 +454,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
461
454
|
|
|
462
455
|
// Action label
|
|
463
456
|
if (renderActionLabel) {
|
|
464
|
-
const actionLabel = (0,
|
|
457
|
+
const actionLabel = (0, _uiReactUtils.callRenderProp)(renderActionLabel);
|
|
465
458
|
if (actionLabel) {
|
|
466
459
|
headerChildren.push((0, _jsxRuntime.jsx)(_index2.DrilldownOption, {
|
|
467
460
|
id: this._headerActionId,
|
|
@@ -538,9 +531,9 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
538
531
|
}
|
|
539
532
|
focused() {
|
|
540
533
|
if (this.shown) {
|
|
541
|
-
return (0,
|
|
534
|
+
return (0, _uiDomUtils.containsActiveElement)(this._drilldownRef);
|
|
542
535
|
} else {
|
|
543
|
-
return (0,
|
|
536
|
+
return (0, _uiDomUtils.containsActiveElement)(this._trigger);
|
|
544
537
|
}
|
|
545
538
|
}
|
|
546
539
|
focusOption(id) {
|
|
@@ -850,7 +843,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
850
843
|
trigger
|
|
851
844
|
} = this.props;
|
|
852
845
|
if (trigger && shown && this.currentPage) {
|
|
853
|
-
const actionLabel = (0,
|
|
846
|
+
const actionLabel = (0, _uiReactUtils.callRenderProp)(this.currentPage.renderActionLabel);
|
|
854
847
|
// Use action ID if exists, otherwise first non-action option's ID
|
|
855
848
|
const targetId = actionLabel ? this._headerActionId : this.getFirstOption()?.props.id;
|
|
856
849
|
setTimeout(() => {
|
|
@@ -876,11 +869,11 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
876
869
|
if (!child) return undefined;
|
|
877
870
|
|
|
878
871
|
// If it's a regular option, return it
|
|
879
|
-
if ((0,
|
|
872
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_index2.DrilldownOption])) {
|
|
880
873
|
return child;
|
|
881
874
|
}
|
|
882
875
|
// If it's a group, get its options
|
|
883
|
-
if ((0,
|
|
876
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [Drilldown.Group])) {
|
|
884
877
|
const groupOptions = _react.Children.toArray(child.props.children);
|
|
885
878
|
return groupOptions[0];
|
|
886
879
|
}
|
|
@@ -902,7 +895,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
902
895
|
/**
|
|
903
896
|
* --- RENDER GROUP ---
|
|
904
897
|
*/
|
|
905
|
-
if ((0,
|
|
898
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_index3.DrilldownGroup])) {
|
|
906
899
|
const isFirstChild = index === 0;
|
|
907
900
|
const isLastChild = index === pageChildren.length - 1;
|
|
908
901
|
const afterSeparator = lastItemWasSeparator;
|
|
@@ -916,7 +909,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
916
909
|
/**
|
|
917
910
|
* --- RENDER SEPARATOR ---
|
|
918
911
|
*/
|
|
919
|
-
} else if ((0,
|
|
912
|
+
} else if ((0, _uiReactUtils.matchComponentTypes)(child, [_index.DrilldownSeparator])) {
|
|
920
913
|
// if the last item was separator, we don't want to duplicate it
|
|
921
914
|
if (lastItemWasSeparator) {
|
|
922
915
|
return null;
|
|
@@ -927,7 +920,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
927
920
|
/**
|
|
928
921
|
* --- RENDER OPTION ---
|
|
929
922
|
*/
|
|
930
|
-
} else if ((0,
|
|
923
|
+
} else if ((0, _uiReactUtils.matchComponentTypes)(child, [_index2.DrilldownOption])) {
|
|
931
924
|
lastItemWasSeparator = false;
|
|
932
925
|
return this.renderOption(child, getOptionProps, getDisabledOptionProps);
|
|
933
926
|
} else {
|
|
@@ -987,7 +980,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
987
980
|
// Props passed to the Option.Item
|
|
988
981
|
let optionProps = {
|
|
989
982
|
// passthrough props
|
|
990
|
-
...(0,
|
|
983
|
+
...(0, _uiReactUtils.omitProps)(option.props, [..._index2.DrilldownOption.allowedProps, ..._v11_2.Options.Item.allowedProps]),
|
|
991
984
|
// props from selectable
|
|
992
985
|
...getOptionProps({
|
|
993
986
|
id,
|
|
@@ -1045,13 +1038,13 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1045
1038
|
// we set a few manually on Options.Item,
|
|
1046
1039
|
// the rest are passed directly
|
|
1047
1040
|
if (subPageId) {
|
|
1048
|
-
optionProps.renderAfterLabel = (0, _jsxRuntime.jsx)(
|
|
1041
|
+
optionProps.renderAfterLabel = (0, _jsxRuntime.jsx)(_uiIcons.IconArrowOpenEndSolid, {});
|
|
1049
1042
|
optionProps['aria-haspopup'] = true;
|
|
1050
1043
|
optionProps.role = customRole || 'menuitem';
|
|
1051
1044
|
(0, _console.warn)(!renderAfterLabel, `The prop "renderAfterLabel" is reserved on item with id: "${id}". When it has "subPageId" provided, a navigation arrow will render after the label.`);
|
|
1052
1045
|
}
|
|
1053
1046
|
if (id === this._headerBackId) {
|
|
1054
|
-
optionProps.renderBeforeLabel = (0, _jsxRuntime.jsx)(
|
|
1047
|
+
optionProps.renderBeforeLabel = (0, _jsxRuntime.jsx)(_uiIcons.IconArrowOpenStartSolid, {});
|
|
1055
1048
|
}
|
|
1056
1049
|
const isOptionControlled = typeof option.props.selected === 'boolean';
|
|
1057
1050
|
if ((groupProps?.selectableType || isOptionControlled) && groupProps) {
|
|
@@ -1061,7 +1054,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1061
1054
|
isSelected = Boolean(option.props.selected);
|
|
1062
1055
|
}
|
|
1063
1056
|
optionProps['aria-checked'] = isSelected;
|
|
1064
|
-
optionProps.renderBeforeLabel = (0, _jsxRuntime.jsx)(
|
|
1057
|
+
optionProps.renderBeforeLabel = (0, _jsxRuntime.jsx)(_uiIcons.IconCheckSolid, {
|
|
1065
1058
|
style: {
|
|
1066
1059
|
opacity: isSelected ? 1 : 0
|
|
1067
1060
|
}
|
|
@@ -1089,7 +1082,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1089
1082
|
optionProps.href = href;
|
|
1090
1083
|
}
|
|
1091
1084
|
}
|
|
1092
|
-
const optionLabel = (0,
|
|
1085
|
+
const optionLabel = (0, _uiReactUtils.callRenderProp)(children, {
|
|
1093
1086
|
id,
|
|
1094
1087
|
variant: optionProps.variant,
|
|
1095
1088
|
isSelected
|
|
@@ -1113,7 +1106,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1113
1106
|
if (typeof optionProps.renderAfterLabel === 'function' && !optionProps.renderAfterLabel?.prototype?.isReactComponent) {
|
|
1114
1107
|
optionProps.renderAfterLabel = optionProps.renderAfterLabel.bind(null, renderLabelProps);
|
|
1115
1108
|
}
|
|
1116
|
-
const labelInfo = renderLabelInfo && (0,
|
|
1109
|
+
const labelInfo = renderLabelInfo && (0, _uiReactUtils.callRenderProp)(renderLabelInfo, renderLabelProps);
|
|
1117
1110
|
const vAlignMap = {
|
|
1118
1111
|
start: 'flex-start',
|
|
1119
1112
|
center: 'center',
|
|
@@ -1182,9 +1175,9 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1182
1175
|
,
|
|
1183
1176
|
themeOverride: themeOverride,
|
|
1184
1177
|
children: this.getChildrenArray(children).map(child => {
|
|
1185
|
-
if ((0,
|
|
1178
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_index.DrilldownSeparator])) {
|
|
1186
1179
|
return this.renderSeparator(child);
|
|
1187
|
-
} else if ((0,
|
|
1180
|
+
} else if ((0, _uiReactUtils.matchComponentTypes)(child, [_index2.DrilldownOption])) {
|
|
1188
1181
|
return this.renderOption(child, getOptionProps, getDisabledOptionProps, group.props);
|
|
1189
1182
|
} else {
|
|
1190
1183
|
return null;
|
|
@@ -1217,7 +1210,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1217
1210
|
if (!this.currentPage) {
|
|
1218
1211
|
return null;
|
|
1219
1212
|
}
|
|
1220
|
-
return (0, _jsxRuntime.jsx)(
|
|
1213
|
+
return (0, _jsxRuntime.jsx)(_uiSelectable.Selectable, {
|
|
1221
1214
|
isShowingOptions: this.shown,
|
|
1222
1215
|
highlightedOptionId: this.state.highlightedOptionId,
|
|
1223
1216
|
selectedOptionId: this.selectedGroupOptionIdsArray,
|
|
@@ -1277,7 +1270,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1277
1270
|
onBlur: event => {
|
|
1278
1271
|
const target = event.currentTarget;
|
|
1279
1272
|
const related = event.relatedTarget;
|
|
1280
|
-
const containsRelated = (0,
|
|
1273
|
+
const containsRelated = (0, _uiDomUtils.contains)(target, related);
|
|
1281
1274
|
if (!related || related === this._drilldownRef || related !== target && !containsRelated) {
|
|
1282
1275
|
this.setState({
|
|
1283
1276
|
highlightedOptionId: undefined
|
|
@@ -1378,7 +1371,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1378
1371
|
offsetY: offsetY,
|
|
1379
1372
|
defaultFocusElement: () => {
|
|
1380
1373
|
if (!this.currentPage) return null;
|
|
1381
|
-
const actionLabel = (0,
|
|
1374
|
+
const actionLabel = (0, _uiReactUtils.callRenderProp)(this.currentPage.renderActionLabel);
|
|
1382
1375
|
// Use action ID if exists, otherwise first non-action option's ID
|
|
1383
1376
|
const targetId = actionLabel ? this._headerActionId : this.getFirstOption()?.props.id;
|
|
1384
1377
|
if (!targetId) return null;
|
|
@@ -1395,7 +1388,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1395
1388
|
popoverRef(el);
|
|
1396
1389
|
}
|
|
1397
1390
|
},
|
|
1398
|
-
renderTrigger: (0,
|
|
1391
|
+
renderTrigger: (0, _uiReactUtils.safeCloneElement)(trigger, {
|
|
1399
1392
|
ref: el => {
|
|
1400
1393
|
this._trigger = el;
|
|
1401
1394
|
},
|
|
@@ -7,18 +7,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.Drilldown = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _console = require("@instructure/console");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
14
|
-
var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
|
|
15
|
-
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
16
|
-
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
17
|
-
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
|
10
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
11
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
12
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
18
13
|
var _latest = require("@instructure/ui-view/latest");
|
|
19
14
|
var _latest2 = require("@instructure/ui-options/latest");
|
|
20
15
|
var _latest3 = require("@instructure/ui-popover/latest");
|
|
21
|
-
var
|
|
16
|
+
var _uiSelectable = require("@instructure/ui-selectable");
|
|
22
17
|
var _uiIcons = require("@instructure/ui-icons");
|
|
23
18
|
var _emotion = require("@instructure/emotion");
|
|
24
19
|
var _index = require("./DrilldownSeparator/index.js");
|
|
@@ -65,7 +60,7 @@ var _dec, _dec2, _class;
|
|
|
65
60
|
category: components
|
|
66
61
|
---
|
|
67
62
|
**/
|
|
68
|
-
let Drilldown = exports.Drilldown = (_dec = (0,
|
|
63
|
+
let Drilldown = exports.Drilldown = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emotion.withStyleNew)(_styles.default), _dec(_class = _dec2(_class = class Drilldown extends _react.Component {
|
|
69
64
|
static displayName = 'Drilldown';
|
|
70
65
|
static componentId = 'Drilldown';
|
|
71
66
|
static allowedProps = _props2.allowedProps;
|
|
@@ -187,7 +182,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
187
182
|
};
|
|
188
183
|
this.pages.forEach(page => {
|
|
189
184
|
this.getChildrenArray(page.props.children).forEach(child => {
|
|
190
|
-
if ((0,
|
|
185
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_index3.DrilldownGroup])) {
|
|
191
186
|
const {
|
|
192
187
|
id: groupId,
|
|
193
188
|
selectableType,
|
|
@@ -197,7 +192,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
197
192
|
if (!selectableType || !Array.isArray(selectedOptions)) return;
|
|
198
193
|
const newGroupMap = new Map();
|
|
199
194
|
this.getChildrenArray(groupChildren)?.forEach(groupChild => {
|
|
200
|
-
if ((0,
|
|
195
|
+
if ((0, _uiReactUtils.matchComponentTypes)(groupChild, [_index2.DrilldownOption])) {
|
|
201
196
|
const {
|
|
202
197
|
id: optionId,
|
|
203
198
|
value: optionValue
|
|
@@ -208,7 +203,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
208
203
|
}
|
|
209
204
|
});
|
|
210
205
|
const currentGroupMapInState = this.state.selectedGroupOptionsMap[groupId] || new Map();
|
|
211
|
-
if (!(0,
|
|
206
|
+
if (!(0, _uiUtils.deepEqual)(this.getNormalizedMap(newGroupMap), this.getNormalizedMap(currentGroupMapInState))) {
|
|
212
207
|
nextSelectionMap[groupId] = newGroupMap;
|
|
213
208
|
shouldUpdateState = true;
|
|
214
209
|
}
|
|
@@ -349,7 +344,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
349
344
|
children
|
|
350
345
|
} = page.props;
|
|
351
346
|
this.getChildrenArray(children).forEach(child => {
|
|
352
|
-
if ((0,
|
|
347
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_index3.DrilldownGroup])) {
|
|
353
348
|
const {
|
|
354
349
|
id: groupId,
|
|
355
350
|
selectableType,
|
|
@@ -370,7 +365,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
370
365
|
}
|
|
371
366
|
}
|
|
372
367
|
this.getChildrenArray(groupChildren)?.forEach(groupChild => {
|
|
373
|
-
if ((0,
|
|
368
|
+
if ((0, _uiReactUtils.matchComponentTypes)(groupChild, [_index2.DrilldownOption])) {
|
|
374
369
|
const {
|
|
375
370
|
id: optionId,
|
|
376
371
|
value: optionValue,
|
|
@@ -426,8 +421,8 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
426
421
|
|
|
427
422
|
// Back navigation option
|
|
428
423
|
if (this.previousPage) {
|
|
429
|
-
const prevPageTitle = (0,
|
|
430
|
-
const backButtonLabel = (0,
|
|
424
|
+
const prevPageTitle = (0, _uiReactUtils.callRenderProp)(this.previousPage.renderTitle);
|
|
425
|
+
const backButtonLabel = (0, _uiReactUtils.callRenderProp)(renderBackButtonLabel, prevPageTitle);
|
|
431
426
|
headerChildren.push((0, _jsxRuntime.jsx)(_index2.DrilldownOption, {
|
|
432
427
|
id: this._headerBackId,
|
|
433
428
|
onOptionClick: this.handleBackButtonClick,
|
|
@@ -441,7 +436,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
441
436
|
|
|
442
437
|
// Header title
|
|
443
438
|
if (renderTitle) {
|
|
444
|
-
const title = (0,
|
|
439
|
+
const title = (0, _uiReactUtils.callRenderProp)(renderTitle);
|
|
445
440
|
if (title) {
|
|
446
441
|
headerChildren.push((0, _jsxRuntime.jsx)(_index2.DrilldownOption, {
|
|
447
442
|
id: this._headerTitleId,
|
|
@@ -458,7 +453,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
458
453
|
|
|
459
454
|
// Action label
|
|
460
455
|
if (renderActionLabel) {
|
|
461
|
-
const actionLabel = (0,
|
|
456
|
+
const actionLabel = (0, _uiReactUtils.callRenderProp)(renderActionLabel);
|
|
462
457
|
if (actionLabel) {
|
|
463
458
|
headerChildren.push((0, _jsxRuntime.jsx)(_index2.DrilldownOption, {
|
|
464
459
|
id: this._headerActionId,
|
|
@@ -535,9 +530,9 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
535
530
|
}
|
|
536
531
|
focused() {
|
|
537
532
|
if (this.shown) {
|
|
538
|
-
return (0,
|
|
533
|
+
return (0, _uiDomUtils.containsActiveElement)(this._drilldownRef);
|
|
539
534
|
} else {
|
|
540
|
-
return (0,
|
|
535
|
+
return (0, _uiDomUtils.containsActiveElement)(this._trigger);
|
|
541
536
|
}
|
|
542
537
|
}
|
|
543
538
|
focusOption(id) {
|
|
@@ -847,7 +842,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
847
842
|
trigger
|
|
848
843
|
} = this.props;
|
|
849
844
|
if (trigger && shown && this.currentPage) {
|
|
850
|
-
const actionLabel = (0,
|
|
845
|
+
const actionLabel = (0, _uiReactUtils.callRenderProp)(this.currentPage.renderActionLabel);
|
|
851
846
|
// Use action ID if exists, otherwise first non-action option's ID
|
|
852
847
|
const targetId = actionLabel ? this._headerActionId : this.getFirstOption()?.props.id;
|
|
853
848
|
setTimeout(() => {
|
|
@@ -873,11 +868,11 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
873
868
|
if (!child) return undefined;
|
|
874
869
|
|
|
875
870
|
// If it's a regular option, return it
|
|
876
|
-
if ((0,
|
|
871
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_index2.DrilldownOption])) {
|
|
877
872
|
return child;
|
|
878
873
|
}
|
|
879
874
|
// If it's a group, get its options
|
|
880
|
-
if ((0,
|
|
875
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [Drilldown.Group])) {
|
|
881
876
|
const groupOptions = _react.Children.toArray(child.props.children);
|
|
882
877
|
return groupOptions[0];
|
|
883
878
|
}
|
|
@@ -899,7 +894,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
899
894
|
/**
|
|
900
895
|
* --- RENDER GROUP ---
|
|
901
896
|
*/
|
|
902
|
-
if ((0,
|
|
897
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_index3.DrilldownGroup])) {
|
|
903
898
|
const isFirstChild = index === 0;
|
|
904
899
|
const isLastChild = index === pageChildren.length - 1;
|
|
905
900
|
const afterSeparator = lastItemWasSeparator;
|
|
@@ -913,7 +908,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
913
908
|
/**
|
|
914
909
|
* --- RENDER SEPARATOR ---
|
|
915
910
|
*/
|
|
916
|
-
} else if ((0,
|
|
911
|
+
} else if ((0, _uiReactUtils.matchComponentTypes)(child, [_index.DrilldownSeparator])) {
|
|
917
912
|
// if the last item was separator, we don't want to duplicate it
|
|
918
913
|
if (lastItemWasSeparator) {
|
|
919
914
|
return null;
|
|
@@ -924,7 +919,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
924
919
|
/**
|
|
925
920
|
* --- RENDER OPTION ---
|
|
926
921
|
*/
|
|
927
|
-
} else if ((0,
|
|
922
|
+
} else if ((0, _uiReactUtils.matchComponentTypes)(child, [_index2.DrilldownOption])) {
|
|
928
923
|
lastItemWasSeparator = false;
|
|
929
924
|
return this.renderOption(child, getOptionProps, getDisabledOptionProps);
|
|
930
925
|
} else {
|
|
@@ -984,7 +979,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
984
979
|
// Props passed to the Option.Item
|
|
985
980
|
let optionProps = {
|
|
986
981
|
// passthrough props
|
|
987
|
-
...(0,
|
|
982
|
+
...(0, _uiReactUtils.omitProps)(option.props, [..._index2.DrilldownOption.allowedProps, ..._latest2.Options.Item.allowedProps]),
|
|
988
983
|
// props from selectable
|
|
989
984
|
...getOptionProps({
|
|
990
985
|
id,
|
|
@@ -1087,7 +1082,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1087
1082
|
optionProps.href = href;
|
|
1088
1083
|
}
|
|
1089
1084
|
}
|
|
1090
|
-
const optionLabel = (0,
|
|
1085
|
+
const optionLabel = (0, _uiReactUtils.callRenderProp)(children, {
|
|
1091
1086
|
id,
|
|
1092
1087
|
variant: optionProps.variant,
|
|
1093
1088
|
isSelected
|
|
@@ -1119,7 +1114,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1119
1114
|
return _fn(_props, itemProps);
|
|
1120
1115
|
};
|
|
1121
1116
|
}
|
|
1122
|
-
const labelInfo = renderLabelInfo && (0,
|
|
1117
|
+
const labelInfo = renderLabelInfo && (0, _uiReactUtils.callRenderProp)(renderLabelInfo, renderLabelProps);
|
|
1123
1118
|
const vAlignMap = {
|
|
1124
1119
|
start: 'flex-start',
|
|
1125
1120
|
center: 'center',
|
|
@@ -1188,9 +1183,9 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1188
1183
|
,
|
|
1189
1184
|
themeOverride: themeOverride,
|
|
1190
1185
|
children: this.getChildrenArray(children).map(child => {
|
|
1191
|
-
if ((0,
|
|
1186
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_index.DrilldownSeparator])) {
|
|
1192
1187
|
return this.renderSeparator(child);
|
|
1193
|
-
} else if ((0,
|
|
1188
|
+
} else if ((0, _uiReactUtils.matchComponentTypes)(child, [_index2.DrilldownOption])) {
|
|
1194
1189
|
return this.renderOption(child, getOptionProps, getDisabledOptionProps, group.props);
|
|
1195
1190
|
} else {
|
|
1196
1191
|
return null;
|
|
@@ -1223,7 +1218,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1223
1218
|
if (!this.currentPage) {
|
|
1224
1219
|
return null;
|
|
1225
1220
|
}
|
|
1226
|
-
return (0, _jsxRuntime.jsx)(
|
|
1221
|
+
return (0, _jsxRuntime.jsx)(_uiSelectable.Selectable, {
|
|
1227
1222
|
isShowingOptions: this.shown,
|
|
1228
1223
|
highlightedOptionId: this.state.highlightedOptionId,
|
|
1229
1224
|
selectedOptionId: this.selectedGroupOptionIdsArray,
|
|
@@ -1283,7 +1278,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1283
1278
|
onBlur: event => {
|
|
1284
1279
|
const target = event.currentTarget;
|
|
1285
1280
|
const related = event.relatedTarget;
|
|
1286
|
-
const containsRelated = (0,
|
|
1281
|
+
const containsRelated = (0, _uiDomUtils.contains)(target, related);
|
|
1287
1282
|
if (!related || related === this._drilldownRef || related !== target && !containsRelated) {
|
|
1288
1283
|
this.setState({
|
|
1289
1284
|
highlightedOptionId: undefined
|
|
@@ -1384,7 +1379,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1384
1379
|
offsetY: offsetY,
|
|
1385
1380
|
defaultFocusElement: () => {
|
|
1386
1381
|
if (!this.currentPage) return null;
|
|
1387
|
-
const actionLabel = (0,
|
|
1382
|
+
const actionLabel = (0, _uiReactUtils.callRenderProp)(this.currentPage.renderActionLabel);
|
|
1388
1383
|
// Use action ID if exists, otherwise first non-action option's ID
|
|
1389
1384
|
const targetId = actionLabel ? this._headerActionId : this.getFirstOption()?.props.id;
|
|
1390
1385
|
if (!targetId) return null;
|
|
@@ -1401,7 +1396,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1401
1396
|
popoverRef(el);
|
|
1402
1397
|
}
|
|
1403
1398
|
},
|
|
1404
|
-
renderTrigger: (0,
|
|
1399
|
+
renderTrigger: (0, _uiReactUtils.safeCloneElement)(trigger, {
|
|
1405
1400
|
ref: el => {
|
|
1406
1401
|
this._trigger = el;
|
|
1407
1402
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-drilldown",
|
|
3
|
-
"version": "11.7.9-snapshot-
|
|
3
|
+
"version": "11.7.9-snapshot-2",
|
|
4
4
|
"description": "A drilldown menu component",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -15,26 +15,26 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.29.7",
|
|
18
|
-
"@instructure/console": "11.7.9-snapshot-
|
|
19
|
-
"@instructure/emotion": "11.7.9-snapshot-
|
|
20
|
-
"@instructure/
|
|
21
|
-
"@instructure/
|
|
22
|
-
"@instructure/ui-icons": "11.7.9-snapshot-
|
|
23
|
-
"@instructure/ui-options": "11.7.9-snapshot-
|
|
24
|
-
"@instructure/ui-popover": "11.7.9-snapshot-
|
|
25
|
-
"@instructure/ui-position": "11.7.9-snapshot-
|
|
26
|
-
"@instructure/ui-react-utils": "11.7.9-snapshot-
|
|
27
|
-
"@instructure/ui-selectable": "11.7.9-snapshot-
|
|
28
|
-
"@instructure/ui-
|
|
29
|
-
"@instructure/ui-
|
|
30
|
-
"@instructure/ui-
|
|
18
|
+
"@instructure/console": "11.7.9-snapshot-2",
|
|
19
|
+
"@instructure/emotion": "11.7.9-snapshot-2",
|
|
20
|
+
"@instructure/shared-types": "11.7.9-snapshot-2",
|
|
21
|
+
"@instructure/ui-dom-utils": "11.7.9-snapshot-2",
|
|
22
|
+
"@instructure/ui-icons": "11.7.9-snapshot-2",
|
|
23
|
+
"@instructure/ui-options": "11.7.9-snapshot-2",
|
|
24
|
+
"@instructure/ui-popover": "11.7.9-snapshot-2",
|
|
25
|
+
"@instructure/ui-position": "11.7.9-snapshot-2",
|
|
26
|
+
"@instructure/ui-react-utils": "11.7.9-snapshot-2",
|
|
27
|
+
"@instructure/ui-selectable": "11.7.9-snapshot-2",
|
|
28
|
+
"@instructure/ui-themes": "11.7.9-snapshot-2",
|
|
29
|
+
"@instructure/ui-utils": "11.7.9-snapshot-2",
|
|
30
|
+
"@instructure/ui-view": "11.7.9-snapshot-2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"
|
|
34
|
-
"@instructure/ui-
|
|
35
|
-
"@instructure/ui-
|
|
36
|
-
"@instructure/ui-scripts": "11.7.9-snapshot-
|
|
37
|
-
"
|
|
33
|
+
"@instructure/ui-axe-check": "11.7.9-snapshot-2",
|
|
34
|
+
"@instructure/ui-babel-preset": "11.7.9-snapshot-2",
|
|
35
|
+
"@instructure/ui-color-utils": "11.7.9-snapshot-2",
|
|
36
|
+
"@instructure/ui-scripts": "11.7.9-snapshot-2",
|
|
37
|
+
"vitest": "^5.0.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": ">=18 <=19"
|