@instructure/ui-drilldown 8.38.2-snapshot-5 → 8.38.2-snapshot-7
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/es/Drilldown/DrilldownLocator.js +20 -56
- package/es/Drilldown/index.js +85 -78
- package/lib/Drilldown/DrilldownLocator.js +20 -56
- package/lib/Drilldown/index.js +85 -78
- package/package.json +21 -21
- package/src/Drilldown/index.tsx +2 -2
- package/tsconfig.build.tsbuildinfo +1 -1
package/lib/Drilldown/index.js
CHANGED
|
@@ -131,9 +131,10 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
|
|
|
131
131
|
this.reset();
|
|
132
132
|
}
|
|
133
133
|
};
|
|
134
|
-
this.handleOptionHighlight = (_event,
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
this.handleOptionHighlight = (_event, {
|
|
135
|
+
id,
|
|
136
|
+
direction
|
|
137
|
+
}) => {
|
|
137
138
|
const rotateFocus = this.props.rotateFocus;
|
|
138
139
|
const highlightedOptionId = this.state.highlightedOptionId;
|
|
139
140
|
|
|
@@ -215,28 +216,29 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
|
|
|
215
216
|
}
|
|
216
217
|
|
|
217
218
|
// If there is a previous page, goToPage will succeed and return the data
|
|
218
|
-
const
|
|
219
|
-
newPageId =
|
|
220
|
-
prevPageId =
|
|
219
|
+
const _ref = this.goToPage(this.previousPage.id),
|
|
220
|
+
newPageId = _ref.newPageId,
|
|
221
|
+
prevPageId = _ref.prevPageId;
|
|
221
222
|
return {
|
|
222
223
|
newPageId,
|
|
223
224
|
prevPageId
|
|
224
225
|
};
|
|
225
226
|
};
|
|
226
227
|
this.handleBackButtonClick = () => {
|
|
227
|
-
const
|
|
228
|
-
onBackButtonClicked =
|
|
228
|
+
const _ref2 = this.currentPage,
|
|
229
|
+
onBackButtonClicked = _ref2.onBackButtonClicked;
|
|
229
230
|
|
|
230
231
|
// we only display the back button when there is a page to go back to
|
|
231
|
-
const
|
|
232
|
-
newPageId =
|
|
233
|
-
prevPageId =
|
|
232
|
+
const _ref3 = this.goToPreviousPage(),
|
|
233
|
+
newPageId = _ref3.newPageId,
|
|
234
|
+
prevPageId = _ref3.prevPageId;
|
|
234
235
|
if (typeof onBackButtonClicked === 'function') {
|
|
235
236
|
onBackButtonClicked(newPageId, prevPageId);
|
|
236
237
|
}
|
|
237
238
|
};
|
|
238
|
-
this.handleOptionSelect = (event,
|
|
239
|
-
|
|
239
|
+
this.handleOptionSelect = (event, {
|
|
240
|
+
id
|
|
241
|
+
}) => {
|
|
240
242
|
const selectedOption = this.getPageChildById(id);
|
|
241
243
|
|
|
242
244
|
// TODO: this line can be removed when React 16 is no longer supported
|
|
@@ -656,9 +658,9 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
|
|
|
656
658
|
const _selectedOption$props = selectedOption.props,
|
|
657
659
|
optionId = _selectedOption$props.id,
|
|
658
660
|
value = _selectedOption$props.value;
|
|
659
|
-
const
|
|
660
|
-
groupId =
|
|
661
|
-
selectableType =
|
|
661
|
+
const _ref4 = selectedOption.groupProps,
|
|
662
|
+
groupId = _ref4.id,
|
|
663
|
+
selectableType = _ref4.selectableType;
|
|
662
664
|
let newState = new Map(oldState.selectedGroupOptionsMap[groupId]);
|
|
663
665
|
if (selectableType === 'multiple' && Boolean((_oldState$selectedGro = oldState.selectedGroupOptionsMap[groupId]) === null || _oldState$selectedGro === void 0 ? void 0 : _oldState$selectedGro.has(optionId))) {
|
|
664
666
|
// toggle off, if already selected
|
|
@@ -682,9 +684,9 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
|
|
|
682
684
|
};
|
|
683
685
|
}, () => {
|
|
684
686
|
const value = selectedOption.props.value;
|
|
685
|
-
const
|
|
686
|
-
groupId =
|
|
687
|
-
groupOnSelect =
|
|
687
|
+
const _ref5 = selectedOption.groupProps,
|
|
688
|
+
groupId = _ref5.id,
|
|
689
|
+
groupOnSelect = _ref5.onSelect;
|
|
688
690
|
const onSelect = this.props.onSelect;
|
|
689
691
|
const groupProps = selectedOption.groupProps,
|
|
690
692
|
option = (0, _objectWithoutProperties2.default)(selectedOption, _excluded2);
|
|
@@ -1040,67 +1042,71 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
|
|
|
1040
1042
|
id: lastOptionId
|
|
1041
1043
|
});
|
|
1042
1044
|
}
|
|
1043
|
-
},
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
onMouseLeave: () => {
|
|
1045
|
+
}, ({
|
|
1046
|
+
// TODO: figure out what other Selectable props we need, if we want to add a Select version for drilldown:
|
|
1047
|
+
// getRootProps, - we probably don't need this
|
|
1048
|
+
// getLabelProps, - do we need label?
|
|
1049
|
+
// getDescriptionProps, - might be nice for assistiveText like in Select
|
|
1050
|
+
// getInputProps, - hidden input for a11y? role="combobox" might be needed
|
|
1051
|
+
getTriggerProps,
|
|
1052
|
+
getListProps,
|
|
1053
|
+
getOptionProps,
|
|
1054
|
+
getDisabledOptionProps
|
|
1055
|
+
}) => (0, _emotion.jsx)(_View.View, Object.assign({
|
|
1056
|
+
as: "div",
|
|
1057
|
+
elementRef: this.handleDrilldownRef,
|
|
1058
|
+
tabIndex: 0,
|
|
1059
|
+
css: styles === null || styles === void 0 ? void 0 : styles.drilldown,
|
|
1060
|
+
position: "relative",
|
|
1061
|
+
borderRadius: "small",
|
|
1062
|
+
width: width,
|
|
1063
|
+
minWidth: maxWidth,
|
|
1064
|
+
maxWidth: maxWidth,
|
|
1065
|
+
role: role,
|
|
1066
|
+
"aria-label": label,
|
|
1067
|
+
"aria-labelledby": this.currentPageAriaLabel
|
|
1068
|
+
}, getTriggerProps({
|
|
1069
|
+
id: this._id,
|
|
1070
|
+
// We need to override these aria attributes added by Selectable,
|
|
1071
|
+
// since Drilldown is not a combobox and has no popup
|
|
1072
|
+
'aria-haspopup': false,
|
|
1073
|
+
'aria-expanded': void 0,
|
|
1074
|
+
onKeyDown: this.handleKeyDown,
|
|
1075
|
+
onBlur: event => {
|
|
1076
|
+
const target = event.currentTarget;
|
|
1077
|
+
const related = event.relatedTarget;
|
|
1078
|
+
const containsRelated = (0, _contains.contains)(target, related);
|
|
1079
|
+
if (!related || related === this._drilldownRef || related !== target && !containsRelated) {
|
|
1079
1080
|
this.setState({
|
|
1080
1081
|
highlightedOptionId: void 0
|
|
1081
1082
|
});
|
|
1082
1083
|
}
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1084
|
+
},
|
|
1085
|
+
onMouseLeave: () => {
|
|
1086
|
+
this.setState({
|
|
1087
|
+
highlightedOptionId: void 0
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
})), (0, _emotion.jsx)(_View.View, {
|
|
1091
|
+
as: "div",
|
|
1092
|
+
overflowY: overflowY,
|
|
1093
|
+
overflowX: overflowX,
|
|
1094
|
+
height: height,
|
|
1095
|
+
width: width,
|
|
1096
|
+
minHeight: minHeight,
|
|
1097
|
+
minWidth: minWidth,
|
|
1098
|
+
maxHeight: maxHeight,
|
|
1099
|
+
maxWidth: maxWidth,
|
|
1100
|
+
css: styles === null || styles === void 0 ? void 0 : styles.container,
|
|
1101
|
+
borderRadius: "small",
|
|
1102
|
+
role: "presentation",
|
|
1103
|
+
elementRef: element => {
|
|
1104
|
+
this._containerElement = element;
|
|
1105
|
+
}
|
|
1106
|
+
}, (0, _emotion.jsx)(_Options.Options, Object.assign({}, getListProps(), {
|
|
1107
|
+
role: "presentation",
|
|
1108
|
+
as: as
|
|
1109
|
+
}), this.renderList(getOptionProps, getDisabledOptionProps)))));
|
|
1104
1110
|
}
|
|
1105
1111
|
render() {
|
|
1106
1112
|
// clear temporary option store
|
|
@@ -1128,8 +1134,9 @@ let Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 =
|
|
|
1128
1134
|
isShowingContent: show,
|
|
1129
1135
|
defaultIsShowingContent: defaultShow,
|
|
1130
1136
|
shouldCloseOnDocumentClick: true,
|
|
1131
|
-
onHideContent: (event,
|
|
1132
|
-
|
|
1137
|
+
onHideContent: (event, {
|
|
1138
|
+
documentClick
|
|
1139
|
+
}) => {
|
|
1133
1140
|
if (typeof onDismiss === 'function') {
|
|
1134
1141
|
onDismiss(event, documentClick);
|
|
1135
1142
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-drilldown",
|
|
3
|
-
"version": "8.38.2-snapshot-
|
|
3
|
+
"version": "8.38.2-snapshot-7",
|
|
4
4
|
"description": "A drilldown menu component",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,29 +23,29 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@babel/runtime": "^7.22.
|
|
27
|
-
"@instructure/console": "8.38.2-snapshot-
|
|
28
|
-
"@instructure/emotion": "8.38.2-snapshot-
|
|
29
|
-
"@instructure/shared-types": "8.38.2-snapshot-
|
|
30
|
-
"@instructure/ui-dom-utils": "8.38.2-snapshot-
|
|
31
|
-
"@instructure/ui-icons": "8.38.2-snapshot-
|
|
32
|
-
"@instructure/ui-options": "8.38.2-snapshot-
|
|
33
|
-
"@instructure/ui-popover": "8.38.2-snapshot-
|
|
34
|
-
"@instructure/ui-position": "8.38.2-snapshot-
|
|
35
|
-
"@instructure/ui-prop-types": "8.38.2-snapshot-
|
|
36
|
-
"@instructure/ui-react-utils": "8.38.2-snapshot-
|
|
37
|
-
"@instructure/ui-selectable": "8.38.2-snapshot-
|
|
38
|
-
"@instructure/ui-testable": "8.38.2-snapshot-
|
|
39
|
-
"@instructure/ui-utils": "8.38.2-snapshot-
|
|
40
|
-
"@instructure/ui-view": "8.38.2-snapshot-
|
|
26
|
+
"@babel/runtime": "^7.22.6",
|
|
27
|
+
"@instructure/console": "8.38.2-snapshot-7",
|
|
28
|
+
"@instructure/emotion": "8.38.2-snapshot-7",
|
|
29
|
+
"@instructure/shared-types": "8.38.2-snapshot-7",
|
|
30
|
+
"@instructure/ui-dom-utils": "8.38.2-snapshot-7",
|
|
31
|
+
"@instructure/ui-icons": "8.38.2-snapshot-7",
|
|
32
|
+
"@instructure/ui-options": "8.38.2-snapshot-7",
|
|
33
|
+
"@instructure/ui-popover": "8.38.2-snapshot-7",
|
|
34
|
+
"@instructure/ui-position": "8.38.2-snapshot-7",
|
|
35
|
+
"@instructure/ui-prop-types": "8.38.2-snapshot-7",
|
|
36
|
+
"@instructure/ui-react-utils": "8.38.2-snapshot-7",
|
|
37
|
+
"@instructure/ui-selectable": "8.38.2-snapshot-7",
|
|
38
|
+
"@instructure/ui-testable": "8.38.2-snapshot-7",
|
|
39
|
+
"@instructure/ui-utils": "8.38.2-snapshot-7",
|
|
40
|
+
"@instructure/ui-view": "8.38.2-snapshot-7",
|
|
41
41
|
"prop-types": "^15.8.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@instructure/ui-babel-preset": "8.38.2-snapshot-
|
|
45
|
-
"@instructure/ui-color-utils": "8.38.2-snapshot-
|
|
46
|
-
"@instructure/ui-test-locator": "8.38.2-snapshot-
|
|
47
|
-
"@instructure/ui-test-utils": "8.38.2-snapshot-
|
|
48
|
-
"@instructure/ui-themes": "8.38.2-snapshot-
|
|
44
|
+
"@instructure/ui-babel-preset": "8.38.2-snapshot-7",
|
|
45
|
+
"@instructure/ui-color-utils": "8.38.2-snapshot-7",
|
|
46
|
+
"@instructure/ui-test-locator": "8.38.2-snapshot-7",
|
|
47
|
+
"@instructure/ui-test-utils": "8.38.2-snapshot-7",
|
|
48
|
+
"@instructure/ui-themes": "8.38.2-snapshot-7"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"react": ">=16.8 <=18"
|
package/src/Drilldown/index.tsx
CHANGED
|
@@ -1191,7 +1191,7 @@ class Drilldown extends Component<DrilldownProps, DrilldownState> {
|
|
|
1191
1191
|
!optionProps.renderBeforeLabel?.prototype?.isReactComponent
|
|
1192
1192
|
) {
|
|
1193
1193
|
optionProps.renderBeforeLabel = (
|
|
1194
|
-
optionProps.renderBeforeLabel as () => ReactNode
|
|
1194
|
+
optionProps.renderBeforeLabel as (args: any) => ReactNode
|
|
1195
1195
|
).bind(null, renderLabelProps)
|
|
1196
1196
|
}
|
|
1197
1197
|
if (
|
|
@@ -1199,7 +1199,7 @@ class Drilldown extends Component<DrilldownProps, DrilldownState> {
|
|
|
1199
1199
|
!optionProps.renderAfterLabel?.prototype?.isReactComponent
|
|
1200
1200
|
) {
|
|
1201
1201
|
optionProps.renderAfterLabel = (
|
|
1202
|
-
optionProps.renderAfterLabel as () => ReactNode
|
|
1202
|
+
optionProps.renderAfterLabel as (args: any) => ReactNode
|
|
1203
1203
|
).bind(null, renderLabelProps)
|
|
1204
1204
|
}
|
|
1205
1205
|
|