@instructure/ui-drilldown 10.26.1 → 11.0.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.
- package/CHANGELOG.md +24 -1
- package/es/Drilldown/DrilldownGroup/index.js +2 -2
- package/es/Drilldown/DrilldownGroup/props.js +1 -18
- package/es/Drilldown/DrilldownOption/index.js +2 -2
- package/es/Drilldown/DrilldownOption/props.js +1 -24
- package/es/Drilldown/DrilldownPage/index.js +1 -2
- package/es/Drilldown/DrilldownPage/props.js +1 -17
- package/es/Drilldown/DrilldownSeparator/index.js +2 -2
- package/es/Drilldown/DrilldownSeparator/props.js +1 -6
- package/es/Drilldown/index.js +30 -18
- package/es/Drilldown/props.js +1 -46
- package/lib/Drilldown/DrilldownGroup/index.js +1 -1
- package/lib/Drilldown/DrilldownGroup/props.js +1 -19
- package/lib/Drilldown/DrilldownOption/index.js +1 -1
- package/lib/Drilldown/DrilldownOption/props.js +1 -25
- package/lib/Drilldown/DrilldownPage/index.js +0 -1
- package/lib/Drilldown/DrilldownPage/props.js +1 -18
- package/lib/Drilldown/DrilldownSeparator/index.js +1 -1
- package/lib/Drilldown/DrilldownSeparator/props.js +1 -7
- package/lib/Drilldown/index.js +29 -17
- package/lib/Drilldown/props.js +1 -48
- package/package.json +20 -23
- package/src/Drilldown/DrilldownGroup/index.tsx +1 -2
- package/src/Drilldown/DrilldownGroup/props.ts +1 -23
- package/src/Drilldown/DrilldownOption/index.tsx +1 -2
- package/src/Drilldown/DrilldownOption/props.ts +1 -28
- package/src/Drilldown/DrilldownPage/index.tsx +1 -2
- package/src/Drilldown/DrilldownPage/props.ts +2 -30
- package/src/Drilldown/DrilldownSeparator/index.tsx +1 -2
- package/src/Drilldown/DrilldownSeparator/props.ts +1 -10
- package/src/Drilldown/index.tsx +26 -18
- package/src/Drilldown/props.ts +1 -52
- package/tsconfig.build.json +0 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Drilldown/DrilldownGroup/index.d.ts +0 -18
- package/types/Drilldown/DrilldownGroup/index.d.ts.map +1 -1
- package/types/Drilldown/DrilldownGroup/props.d.ts +2 -3
- package/types/Drilldown/DrilldownGroup/props.d.ts.map +1 -1
- package/types/Drilldown/DrilldownOption/index.d.ts +0 -44
- package/types/Drilldown/DrilldownOption/index.d.ts.map +1 -1
- package/types/Drilldown/DrilldownOption/props.d.ts +2 -3
- package/types/Drilldown/DrilldownOption/props.d.ts.map +1 -1
- package/types/Drilldown/DrilldownPage/index.d.ts +0 -11
- package/types/Drilldown/DrilldownPage/index.d.ts.map +1 -1
- package/types/Drilldown/DrilldownPage/props.d.ts +2 -3
- package/types/Drilldown/DrilldownPage/props.d.ts.map +1 -1
- package/types/Drilldown/DrilldownSeparator/index.d.ts +0 -4
- package/types/Drilldown/DrilldownSeparator/index.d.ts.map +1 -1
- package/types/Drilldown/DrilldownSeparator/props.d.ts +2 -3
- package/types/Drilldown/DrilldownSeparator/props.d.ts.map +1 -1
- package/types/Drilldown/index.d.ts +0 -58
- package/types/Drilldown/index.d.ts.map +1 -1
- package/types/Drilldown/props.d.ts +2 -3
- package/types/Drilldown/props.d.ts.map +1 -1
package/lib/Drilldown/index.js
CHANGED
|
@@ -8,7 +8,6 @@ exports.default = exports.Drilldown = void 0;
|
|
|
8
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _console = require("@instructure/console");
|
|
11
|
-
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
12
11
|
var _contains = require("@instructure/ui-dom-utils/lib/contains.js");
|
|
13
12
|
var _containsActiveElement = require("@instructure/ui-dom-utils/lib/containsActiveElement.js");
|
|
14
13
|
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
@@ -36,7 +35,7 @@ var _react2 = require("@emotion/react");
|
|
|
36
35
|
const _excluded = ["groupProps"],
|
|
37
36
|
_excluded2 = ["groupProps"],
|
|
38
37
|
_excluded3 = ["id", "themeOverride"];
|
|
39
|
-
var _dec, _dec2,
|
|
38
|
+
var _dec, _dec2, _class, _Drilldown, _IconArrowOpenEndSoli, _IconArrowOpenStartSo, _Options$Separator, _Options$Separator2;
|
|
40
39
|
/*
|
|
41
40
|
* The MIT License (MIT)
|
|
42
41
|
*
|
|
@@ -72,7 +71,7 @@ var _dec, _dec2, _dec3, _class, _Drilldown, _IconArrowOpenEndSoli, _IconArrowOpe
|
|
|
72
71
|
category: components
|
|
73
72
|
---
|
|
74
73
|
**/
|
|
75
|
-
let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default),
|
|
74
|
+
let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = _dec2(_class = (_Drilldown = class Drilldown extends _react.Component {
|
|
76
75
|
constructor(props) {
|
|
77
76
|
super(props);
|
|
78
77
|
this._drilldownRef = null;
|
|
@@ -239,9 +238,6 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
239
238
|
}) => {
|
|
240
239
|
var _this$currentPage, _selectedOption$group;
|
|
241
240
|
const selectedOption = this.getPageChildById(id);
|
|
242
|
-
|
|
243
|
-
// TODO: this line can be removed when React 16 is no longer supported
|
|
244
|
-
event.persist();
|
|
245
241
|
if (!id || !selectedOption) {
|
|
246
242
|
event.preventDefault();
|
|
247
243
|
event.stopPropagation();
|
|
@@ -287,11 +283,19 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
287
283
|
if (groupProps !== null && groupProps !== void 0 && groupProps.selectableType) {
|
|
288
284
|
this.handleGroupOptionSelected(event, selectedOption);
|
|
289
285
|
} else {
|
|
286
|
+
// TODO workaround for react 19 default props
|
|
287
|
+
const optionWithDefaultProps = {
|
|
288
|
+
...selectedOptionChild,
|
|
289
|
+
props: {
|
|
290
|
+
...selectedOptionChild.props,
|
|
291
|
+
role: 'menuitem'
|
|
292
|
+
}
|
|
293
|
+
};
|
|
290
294
|
if (typeof onSelect === 'function') {
|
|
291
295
|
onSelect(event, {
|
|
292
296
|
value,
|
|
293
297
|
isSelected: true,
|
|
294
|
-
selectedOption:
|
|
298
|
+
selectedOption: optionWithDefaultProps,
|
|
295
299
|
drilldown: this
|
|
296
300
|
});
|
|
297
301
|
}
|
|
@@ -825,15 +829,20 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
825
829
|
id = _option$props.id,
|
|
826
830
|
children = _option$props.children,
|
|
827
831
|
href = _option$props.href,
|
|
828
|
-
as = _option$props.as,
|
|
829
|
-
|
|
832
|
+
_option$props$as = _option$props.as,
|
|
833
|
+
as = _option$props$as === void 0 ? 'li' : _option$props$as,
|
|
834
|
+
_option$props$role = _option$props.role,
|
|
835
|
+
role = _option$props$role === void 0 ? 'menuitem' : _option$props$role,
|
|
830
836
|
subPageId = _option$props.subPageId,
|
|
831
|
-
|
|
837
|
+
_option$props$disable = _option$props.disabled,
|
|
838
|
+
disabled = _option$props$disable === void 0 ? false : _option$props$disable,
|
|
832
839
|
renderLabelInfo = _option$props.renderLabelInfo,
|
|
833
840
|
renderBeforeLabel = _option$props.renderBeforeLabel,
|
|
834
841
|
renderAfterLabel = _option$props.renderAfterLabel,
|
|
835
|
-
|
|
836
|
-
|
|
842
|
+
_option$props$beforeL = _option$props.beforeLabelContentVAlign,
|
|
843
|
+
beforeLabelContentVAlign = _option$props$beforeL === void 0 ? 'start' : _option$props$beforeL,
|
|
844
|
+
_option$props$afterLa = _option$props.afterLabelContentVAlign,
|
|
845
|
+
afterLabelContentVAlign = _option$props$afterLa === void 0 ? 'start' : _option$props$afterLa,
|
|
837
846
|
description = _option$props.description,
|
|
838
847
|
descriptionRole = _option$props.descriptionRole,
|
|
839
848
|
elementRef = _option$props.elementRef,
|
|
@@ -1018,7 +1027,8 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1018
1027
|
children = _group$props.children,
|
|
1019
1028
|
renderGroupTitle = _group$props.renderGroupTitle,
|
|
1020
1029
|
themeOverride = _group$props.themeOverride,
|
|
1021
|
-
role = _group$props.role,
|
|
1030
|
+
_group$props$role = _group$props.role,
|
|
1031
|
+
role = _group$props$role === void 0 ? 'group' : _group$props$role,
|
|
1022
1032
|
as = _group$props.as,
|
|
1023
1033
|
elementRef = _group$props.elementRef;
|
|
1024
1034
|
if (!children) {
|
|
@@ -1028,7 +1038,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1028
1038
|
|
|
1029
1039
|
// add a separator above
|
|
1030
1040
|
if (needsFirstSeparator) {
|
|
1031
|
-
groupChildren.push(_Options$Separator || (_Options$Separator = (0, _jsxRuntime.jsx)(_Options.Options.Separator, {})));
|
|
1041
|
+
groupChildren.push(_Options$Separator || (_Options$Separator = (0, _jsxRuntime.jsx)(_Options.Options.Separator, {}, "drilldown-options-separator")));
|
|
1032
1042
|
}
|
|
1033
1043
|
|
|
1034
1044
|
// create a sublist as a group
|
|
@@ -1055,7 +1065,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1055
1065
|
|
|
1056
1066
|
// add a separator below
|
|
1057
1067
|
if (needsLastSeparator) {
|
|
1058
|
-
groupChildren.push(_Options$Separator2 || (_Options$Separator2 = (0, _jsxRuntime.jsx)(_Options.Options.Separator, {})));
|
|
1068
|
+
groupChildren.push(_Options$Separator2 || (_Options$Separator2 = (0, _jsxRuntime.jsx)(_Options.Options.Separator, {}, "drilldown-options-separator-2")));
|
|
1059
1069
|
}
|
|
1060
1070
|
return groupChildren;
|
|
1061
1071
|
}
|
|
@@ -1115,6 +1125,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1115
1125
|
borderWidth: 'small'
|
|
1116
1126
|
}),
|
|
1117
1127
|
as: "div",
|
|
1128
|
+
"data-cid": "Drilldown",
|
|
1118
1129
|
elementRef: this.handleDrilldownRef,
|
|
1119
1130
|
tabIndex: 0,
|
|
1120
1131
|
css: styles === null || styles === void 0 ? void 0 : styles.drilldown,
|
|
@@ -1202,6 +1213,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1202
1213
|
styles = _this$props7.styles;
|
|
1203
1214
|
const borderColor = styles === null || styles === void 0 ? void 0 : (_styles$drilldown = styles.drilldown) === null || _styles$drilldown === void 0 ? void 0 : _styles$drilldown.borderColor;
|
|
1204
1215
|
return trigger ? (0, _jsxRuntime.jsx)(_Popover.Popover, {
|
|
1216
|
+
"data-cid": "Drilldown",
|
|
1205
1217
|
themeOverride: {
|
|
1206
1218
|
// use here own theme's color
|
|
1207
1219
|
borderColor: borderColor
|
|
@@ -1266,7 +1278,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1266
1278
|
children: this.renderPage()
|
|
1267
1279
|
}) : this.renderPage();
|
|
1268
1280
|
}
|
|
1269
|
-
}, _Drilldown.displayName = "Drilldown", _Drilldown.componentId = 'Drilldown', _Drilldown.
|
|
1281
|
+
}, _Drilldown.displayName = "Drilldown", _Drilldown.componentId = 'Drilldown', _Drilldown.allowedProps = _props.allowedProps, _Drilldown.defaultProps = {
|
|
1270
1282
|
disabled: false,
|
|
1271
1283
|
rotateFocus: true,
|
|
1272
1284
|
as: 'ul',
|
|
@@ -1282,5 +1294,5 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1282
1294
|
offsetX: 0,
|
|
1283
1295
|
offsetY: 0,
|
|
1284
1296
|
shouldSetAriaExpanded: true
|
|
1285
|
-
}, _Drilldown.Group = _DrilldownGroup.DrilldownGroup, _Drilldown.Option = _DrilldownOption.DrilldownOption, _Drilldown.Page = _DrilldownPage.DrilldownPage, _Drilldown.Separator = _DrilldownSeparator.DrilldownSeparator, _Drilldown)) || _class) || _class)
|
|
1297
|
+
}, _Drilldown.Group = _DrilldownGroup.DrilldownGroup, _Drilldown.Option = _DrilldownOption.DrilldownOption, _Drilldown.Page = _DrilldownPage.DrilldownPage, _Drilldown.Separator = _DrilldownSeparator.DrilldownSeparator, _Drilldown)) || _class) || _class);
|
|
1286
1298
|
var _default = exports.default = Drilldown;
|
package/lib/Drilldown/props.js
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports.
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _Children = require("@instructure/ui-prop-types/lib/Children.js");
|
|
10
|
-
var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
|
|
11
|
-
var _PositionPropTypes = require("@instructure/ui-position/lib/PositionPropTypes.js");
|
|
12
|
-
var _DrilldownPage = require("./DrilldownPage");
|
|
6
|
+
exports.allowedProps = void 0;
|
|
13
7
|
/*
|
|
14
8
|
* The MIT License (MIT)
|
|
15
9
|
*
|
|
@@ -34,47 +28,6 @@ var _DrilldownPage = require("./DrilldownPage");
|
|
|
34
28
|
* SOFTWARE.
|
|
35
29
|
*/
|
|
36
30
|
|
|
37
|
-
const propTypes = exports.propTypes = {
|
|
38
|
-
rootPageId: _propTypes.default.string.isRequired,
|
|
39
|
-
children: _Children.Children.oneOf([_DrilldownPage.DrilldownPage]),
|
|
40
|
-
id: _propTypes.default.string,
|
|
41
|
-
label: _propTypes.default.string,
|
|
42
|
-
disabled: _propTypes.default.bool,
|
|
43
|
-
rotateFocus: _propTypes.default.bool,
|
|
44
|
-
as: _propTypes.default.elementType,
|
|
45
|
-
role: _propTypes.default.string,
|
|
46
|
-
elementRef: _propTypes.default.func,
|
|
47
|
-
drilldownRef: _propTypes.default.func,
|
|
48
|
-
overflowX: _propTypes.default.oneOf(['auto', 'hidden', 'visible']),
|
|
49
|
-
overflowY: _propTypes.default.oneOf(['auto', 'hidden', 'visible']),
|
|
50
|
-
height: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
51
|
-
width: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
52
|
-
minHeight: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
53
|
-
minWidth: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
54
|
-
maxHeight: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
55
|
-
maxWidth: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
56
|
-
trigger: _propTypes.default.node,
|
|
57
|
-
placement: _PositionPropTypes.PositionPropTypes.placement,
|
|
58
|
-
defaultShow: _propTypes.default.bool,
|
|
59
|
-
show: (0, _controllable.controllable)(_propTypes.default.bool, 'onToggle', 'defaultShow'),
|
|
60
|
-
onToggle: _propTypes.default.func,
|
|
61
|
-
onSelect: _propTypes.default.func,
|
|
62
|
-
onDismiss: _propTypes.default.func,
|
|
63
|
-
onFocus: _propTypes.default.func,
|
|
64
|
-
onMouseOver: _propTypes.default.func,
|
|
65
|
-
popoverRef: _propTypes.default.func,
|
|
66
|
-
mountNode: _PositionPropTypes.PositionPropTypes.mountNode,
|
|
67
|
-
positionTarget: _PositionPropTypes.PositionPropTypes.mountNode,
|
|
68
|
-
positionContainerDisplay: _propTypes.default.oneOf(['inline-block', 'block']),
|
|
69
|
-
constrain: _PositionPropTypes.PositionPropTypes.constrain,
|
|
70
|
-
shouldHideOnSelect: _propTypes.default.bool,
|
|
71
|
-
shouldContainFocus: _propTypes.default.bool,
|
|
72
|
-
shouldReturnFocus: _propTypes.default.bool,
|
|
73
|
-
withArrow: _propTypes.default.bool,
|
|
74
|
-
offsetX: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
75
|
-
offsetY: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
76
|
-
shouldSetAriaExpanded: _propTypes.default.bool
|
|
77
|
-
};
|
|
78
31
|
const allowedProps = exports.allowedProps = ['rootPageId', 'children', 'id', 'label', 'disabled', 'rotateFocus', 'as', 'role', 'overflowX', 'overflowY', 'height', 'width', 'minHeight', 'minWidth', 'maxHeight', 'maxWidth',
|
|
79
32
|
// Popover version props
|
|
80
33
|
'trigger', 'placement', 'defaultShow', 'show', 'onToggle', 'onSelect', 'onDismiss', 'onFocus', 'onMouseOver', 'elementRef', 'drilldownRef', 'popoverRef', 'mountNode', 'positionTarget', 'positionContainerDisplay', 'constrain', 'shouldHideOnSelect', 'shouldContainFocus', 'shouldReturnFocus', 'withArrow', 'offsetX', 'offsetY'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-drilldown",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0",
|
|
4
4
|
"description": "A drilldown menu component",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -24,35 +24,32 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.27.6",
|
|
27
|
-
"@instructure/console": "
|
|
28
|
-
"@instructure/emotion": "
|
|
29
|
-
"@instructure/shared-types": "
|
|
30
|
-
"@instructure/ui-dom-utils": "
|
|
31
|
-
"@instructure/ui-icons": "
|
|
32
|
-
"@instructure/ui-options": "
|
|
33
|
-
"@instructure/ui-popover": "
|
|
34
|
-
"@instructure/ui-position": "
|
|
35
|
-
"@instructure/ui-
|
|
36
|
-
"@instructure/ui-
|
|
37
|
-
"@instructure/ui-
|
|
38
|
-
"@instructure/ui-
|
|
39
|
-
"@instructure/ui-utils": "10.26.1",
|
|
40
|
-
"@instructure/ui-view": "10.26.1",
|
|
41
|
-
"prop-types": "^15.8.1"
|
|
27
|
+
"@instructure/console": "11.0.0",
|
|
28
|
+
"@instructure/emotion": "11.0.0",
|
|
29
|
+
"@instructure/shared-types": "11.0.0",
|
|
30
|
+
"@instructure/ui-dom-utils": "11.0.0",
|
|
31
|
+
"@instructure/ui-icons": "11.0.0",
|
|
32
|
+
"@instructure/ui-options": "11.0.0",
|
|
33
|
+
"@instructure/ui-popover": "11.0.0",
|
|
34
|
+
"@instructure/ui-position": "11.0.0",
|
|
35
|
+
"@instructure/ui-react-utils": "11.0.0",
|
|
36
|
+
"@instructure/ui-selectable": "11.0.0",
|
|
37
|
+
"@instructure/ui-utils": "11.0.0",
|
|
38
|
+
"@instructure/ui-view": "11.0.0"
|
|
42
39
|
},
|
|
43
40
|
"devDependencies": {
|
|
44
|
-
"@instructure/ui-axe-check": "
|
|
45
|
-
"@instructure/ui-babel-preset": "
|
|
46
|
-
"@instructure/ui-color-utils": "
|
|
47
|
-
"@instructure/ui-scripts": "
|
|
48
|
-
"@instructure/ui-themes": "
|
|
41
|
+
"@instructure/ui-axe-check": "11.0.0",
|
|
42
|
+
"@instructure/ui-babel-preset": "11.0.0",
|
|
43
|
+
"@instructure/ui-color-utils": "11.0.0",
|
|
44
|
+
"@instructure/ui-scripts": "11.0.0",
|
|
45
|
+
"@instructure/ui-themes": "11.0.0",
|
|
49
46
|
"@testing-library/jest-dom": "^6.6.3",
|
|
50
|
-
"@testing-library/react": "
|
|
47
|
+
"@testing-library/react": "15.0.7",
|
|
51
48
|
"@testing-library/user-event": "^14.6.1",
|
|
52
49
|
"vitest": "^3.2.2"
|
|
53
50
|
},
|
|
54
51
|
"peerDependencies": {
|
|
55
|
-
"react": ">=
|
|
52
|
+
"react": ">=18 <=19"
|
|
56
53
|
},
|
|
57
54
|
"publishConfig": {
|
|
58
55
|
"access": "public"
|
|
@@ -27,7 +27,7 @@ import { Component } from 'react'
|
|
|
27
27
|
import { withStyle } from '@instructure/emotion'
|
|
28
28
|
import { optionsThemeGenerator } from '@instructure/ui-options'
|
|
29
29
|
|
|
30
|
-
import {
|
|
30
|
+
import { allowedProps } from './props'
|
|
31
31
|
import type { DrilldownGroupProps } from './props'
|
|
32
32
|
import { isMac, isFirefox } from '@instructure/ui-utils'
|
|
33
33
|
|
|
@@ -44,7 +44,6 @@ id: Drilldown.Group
|
|
|
44
44
|
class DrilldownGroup extends Component<DrilldownGroupProps> {
|
|
45
45
|
static readonly componentId = 'Drilldown.Group'
|
|
46
46
|
|
|
47
|
-
static propTypes = propTypes
|
|
48
47
|
static allowedProps = allowedProps
|
|
49
48
|
static defaultProps = {
|
|
50
49
|
disabled: false,
|
|
@@ -23,16 +23,9 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
-
import PropTypes from 'prop-types'
|
|
27
|
-
|
|
28
|
-
import { Children } from '@instructure/ui-prop-types'
|
|
29
|
-
|
|
30
|
-
import DrilldownOption from '../DrilldownOption'
|
|
31
|
-
import DrilldownSeparator from '../DrilldownSeparator'
|
|
32
26
|
|
|
33
27
|
import type {
|
|
34
28
|
OtherHTMLAttributes,
|
|
35
|
-
PropValidators,
|
|
36
29
|
OptionsTheme,
|
|
37
30
|
AsElementType
|
|
38
31
|
} from '@instructure/shared-types'
|
|
@@ -116,21 +109,6 @@ type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
|
116
109
|
type DrilldownGroupProps = DrilldownGroupOwnProps &
|
|
117
110
|
WithStyleProps<OptionsTheme, null> &
|
|
118
111
|
OtherHTMLAttributes<DrilldownGroupOwnProps>
|
|
119
|
-
|
|
120
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
121
|
-
id: PropTypes.string.isRequired,
|
|
122
|
-
children: Children.oneOf([DrilldownOption, DrilldownSeparator]),
|
|
123
|
-
renderGroupTitle: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
124
|
-
withoutSeparators: PropTypes.bool,
|
|
125
|
-
disabled: PropTypes.bool,
|
|
126
|
-
role: PropTypes.string,
|
|
127
|
-
as: PropTypes.elementType,
|
|
128
|
-
elementRef: PropTypes.func,
|
|
129
|
-
selectableType: PropTypes.oneOf(['single', 'multiple']),
|
|
130
|
-
defaultSelected: PropTypes.array,
|
|
131
|
-
onSelect: PropTypes.func
|
|
132
|
-
}
|
|
133
|
-
|
|
134
112
|
const allowedProps: AllowedPropKeys = [
|
|
135
113
|
'id',
|
|
136
114
|
'children',
|
|
@@ -146,4 +124,4 @@ const allowedProps: AllowedPropKeys = [
|
|
|
146
124
|
]
|
|
147
125
|
|
|
148
126
|
export type { DrilldownGroupProps, GroupChildren }
|
|
149
|
-
export {
|
|
127
|
+
export { allowedProps }
|
|
@@ -27,7 +27,7 @@ import { Component } from 'react'
|
|
|
27
27
|
import { withStyle } from '@instructure/emotion'
|
|
28
28
|
import { optionsItemThemeGenerator } from '@instructure/ui-options'
|
|
29
29
|
|
|
30
|
-
import {
|
|
30
|
+
import { allowedProps } from './props'
|
|
31
31
|
import type { DrilldownOptionProps } from './props'
|
|
32
32
|
|
|
33
33
|
/**
|
|
@@ -43,7 +43,6 @@ id: Drilldown.Option
|
|
|
43
43
|
class DrilldownOption extends Component<DrilldownOptionProps> {
|
|
44
44
|
static readonly componentId = 'Drilldown.Option'
|
|
45
45
|
|
|
46
|
-
static propTypes = propTypes
|
|
47
46
|
static allowedProps = allowedProps
|
|
48
47
|
|
|
49
48
|
static defaultProps = {
|
|
@@ -23,11 +23,8 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
-
import PropTypes from 'prop-types'
|
|
27
|
-
|
|
28
26
|
import type {
|
|
29
27
|
OtherHTMLAttributes,
|
|
30
|
-
PropValidators,
|
|
31
28
|
OptionsItemTheme,
|
|
32
29
|
AsElementType
|
|
33
30
|
} from '@instructure/shared-types'
|
|
@@ -187,30 +184,6 @@ type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
|
187
184
|
type DrilldownOptionProps = DrilldownOptionOwnProps &
|
|
188
185
|
WithStyleProps<OptionsItemTheme, null> &
|
|
189
186
|
OtherHTMLAttributes<DrilldownOptionOwnProps>
|
|
190
|
-
|
|
191
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
192
|
-
id: PropTypes.string.isRequired,
|
|
193
|
-
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
194
|
-
subPageId: PropTypes.string,
|
|
195
|
-
disabled: PropTypes.bool,
|
|
196
|
-
selected: PropTypes.bool,
|
|
197
|
-
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
198
|
-
href: PropTypes.string,
|
|
199
|
-
as: PropTypes.elementType,
|
|
200
|
-
role: PropTypes.string,
|
|
201
|
-
renderLabelInfo: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
202
|
-
renderBeforeLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
203
|
-
renderAfterLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
204
|
-
beforeLabelContentVAlign: PropTypes.oneOf(['start', 'center', 'end']),
|
|
205
|
-
afterLabelContentVAlign: PropTypes.oneOf(['start', 'center', 'end']),
|
|
206
|
-
description: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
207
|
-
descriptionRole: PropTypes.string,
|
|
208
|
-
onOptionClick: PropTypes.func,
|
|
209
|
-
defaultSelected: PropTypes.bool,
|
|
210
|
-
elementRef: PropTypes.func,
|
|
211
|
-
shouldCloseOnClick: PropTypes.oneOf(['auto', 'always', 'never'])
|
|
212
|
-
}
|
|
213
|
-
|
|
214
187
|
const allowedProps: AllowedPropKeys = [
|
|
215
188
|
'id',
|
|
216
189
|
'children',
|
|
@@ -235,4 +208,4 @@ const allowedProps: AllowedPropKeys = [
|
|
|
235
208
|
]
|
|
236
209
|
|
|
237
210
|
export type { DrilldownOptionProps, DrilldownOptionValue }
|
|
238
|
-
export {
|
|
211
|
+
export { allowedProps }
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
import { Component } from 'react'
|
|
26
26
|
|
|
27
|
-
import {
|
|
27
|
+
import { allowedProps } from './props'
|
|
28
28
|
import type { DrilldownPageProps } from './props'
|
|
29
29
|
|
|
30
30
|
/**
|
|
@@ -37,7 +37,6 @@ id: Drilldown.Page
|
|
|
37
37
|
class DrilldownPage extends Component<DrilldownPageProps> {
|
|
38
38
|
static readonly componentId = 'Drilldown.Page'
|
|
39
39
|
|
|
40
|
-
static propTypes = propTypes
|
|
41
40
|
static allowedProps = allowedProps
|
|
42
41
|
static defaultProps = {
|
|
43
42
|
renderBackButtonLabel: 'Back',
|
|
@@ -23,18 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
-
import
|
|
27
|
-
|
|
28
|
-
import { Children } from '@instructure/ui-prop-types'
|
|
29
|
-
|
|
30
|
-
import type {
|
|
31
|
-
OtherHTMLAttributes,
|
|
32
|
-
PropValidators
|
|
33
|
-
} from '@instructure/shared-types'
|
|
34
|
-
|
|
35
|
-
import DrilldownGroup from '../DrilldownGroup'
|
|
36
|
-
import DrilldownOption from '../DrilldownOption'
|
|
37
|
-
import DrilldownSeparator from '../DrilldownSeparator'
|
|
26
|
+
import type { OtherHTMLAttributes } from '@instructure/shared-types'
|
|
38
27
|
|
|
39
28
|
import type { OptionChild, SeparatorChild, GroupChild } from '../props'
|
|
40
29
|
import { Renderable } from '@instructure/shared-types'
|
|
@@ -97,23 +86,6 @@ type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
|
97
86
|
|
|
98
87
|
type DrilldownPageProps = DrilldownPageOwnProps &
|
|
99
88
|
OtherHTMLAttributes<DrilldownPageOwnProps>
|
|
100
|
-
|
|
101
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
102
|
-
id: PropTypes.string.isRequired,
|
|
103
|
-
children: Children.oneOf([
|
|
104
|
-
DrilldownOption,
|
|
105
|
-
DrilldownSeparator,
|
|
106
|
-
DrilldownGroup
|
|
107
|
-
]),
|
|
108
|
-
renderTitle: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
109
|
-
renderActionLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
110
|
-
renderBackButtonLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
111
|
-
onHeaderActionClicked: PropTypes.func,
|
|
112
|
-
onBackButtonClicked: PropTypes.func,
|
|
113
|
-
withoutHeaderSeparator: PropTypes.bool,
|
|
114
|
-
disabled: PropTypes.bool
|
|
115
|
-
}
|
|
116
|
-
|
|
117
89
|
const allowedProps: AllowedPropKeys = [
|
|
118
90
|
'id',
|
|
119
91
|
'children',
|
|
@@ -127,4 +99,4 @@ const allowedProps: AllowedPropKeys = [
|
|
|
127
99
|
]
|
|
128
100
|
|
|
129
101
|
export type { DrilldownPageProps, PageChildren }
|
|
130
|
-
export {
|
|
102
|
+
export { allowedProps }
|
|
@@ -27,7 +27,7 @@ import { Component } from 'react'
|
|
|
27
27
|
import { withStyle } from '@instructure/emotion'
|
|
28
28
|
import { optionsSeparatorThemeGenerator } from '@instructure/ui-options'
|
|
29
29
|
|
|
30
|
-
import {
|
|
30
|
+
import { allowedProps } from './props'
|
|
31
31
|
import type { DrilldownSeparatorProps } from './props'
|
|
32
32
|
|
|
33
33
|
/**
|
|
@@ -43,7 +43,6 @@ id: Drilldown.Separator
|
|
|
43
43
|
class DrilldownSeparator extends Component<DrilldownSeparatorProps> {
|
|
44
44
|
static readonly componentId = 'Drilldown.Separator'
|
|
45
45
|
|
|
46
|
-
static propTypes = propTypes
|
|
47
46
|
static allowedProps = allowedProps
|
|
48
47
|
static defaultProps = {}
|
|
49
48
|
|
|
@@ -22,12 +22,9 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import PropTypes from 'prop-types'
|
|
26
|
-
|
|
27
25
|
import type {
|
|
28
26
|
OtherHTMLAttributes,
|
|
29
27
|
PickPropsWithExceptions,
|
|
30
|
-
PropValidators,
|
|
31
28
|
AsElementType,
|
|
32
29
|
OptionsSeparatorTheme
|
|
33
30
|
} from '@instructure/shared-types'
|
|
@@ -53,13 +50,7 @@ type DrilldownSeparatorProps =
|
|
|
53
50
|
DrilldownSeparatorOwnProps &
|
|
54
51
|
WithStyleProps<OptionsSeparatorTheme, null> &
|
|
55
52
|
OtherHTMLAttributes<DrilldownSeparatorOwnProps>
|
|
56
|
-
|
|
57
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
58
|
-
id: PropTypes.string.isRequired,
|
|
59
|
-
as: PropTypes.elementType
|
|
60
|
-
}
|
|
61
|
-
|
|
62
53
|
const allowedProps: AllowedPropKeys = ['id', 'as']
|
|
63
54
|
|
|
64
55
|
export type { DrilldownSeparatorProps }
|
|
65
|
-
export {
|
|
56
|
+
export { allowedProps }
|
package/src/Drilldown/index.tsx
CHANGED
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
import { Children, Component, ReactElement, ReactNode } from 'react'
|
|
26
26
|
|
|
27
27
|
import { warn, error } from '@instructure/console'
|
|
28
|
-
import { testable } from '@instructure/ui-testable'
|
|
29
28
|
import { contains, containsActiveElement } from '@instructure/ui-dom-utils'
|
|
30
29
|
import {
|
|
31
30
|
callRenderProp,
|
|
@@ -63,7 +62,7 @@ import type { DrilldownPageProps, PageChildren } from './DrilldownPage/props'
|
|
|
63
62
|
import generateStyle from './styles'
|
|
64
63
|
import generateComponentTheme from './theme'
|
|
65
64
|
|
|
66
|
-
import {
|
|
65
|
+
import { allowedProps, SelectedGroupOptionsMap } from './props'
|
|
67
66
|
|
|
68
67
|
import type {
|
|
69
68
|
DrilldownProps,
|
|
@@ -101,11 +100,9 @@ category: components
|
|
|
101
100
|
**/
|
|
102
101
|
@withDeterministicId()
|
|
103
102
|
@withStyle(generateStyle, generateComponentTheme)
|
|
104
|
-
@testable()
|
|
105
103
|
class Drilldown extends Component<DrilldownProps, DrilldownState> {
|
|
106
104
|
static readonly componentId = 'Drilldown'
|
|
107
105
|
|
|
108
|
-
static propTypes = propTypes
|
|
109
106
|
static allowedProps = allowedProps
|
|
110
107
|
static defaultProps = {
|
|
111
108
|
disabled: false,
|
|
@@ -784,9 +781,6 @@ class Drilldown extends Component<DrilldownProps, DrilldownState> {
|
|
|
784
781
|
) => {
|
|
785
782
|
const selectedOption = this.getPageChildById(id)
|
|
786
783
|
|
|
787
|
-
// TODO: this line can be removed when React 16 is no longer supported
|
|
788
|
-
event.persist()
|
|
789
|
-
|
|
790
784
|
if (!id || !selectedOption) {
|
|
791
785
|
event.preventDefault()
|
|
792
786
|
event.stopPropagation()
|
|
@@ -840,11 +834,16 @@ class Drilldown extends Component<DrilldownProps, DrilldownState> {
|
|
|
840
834
|
if (groupProps?.selectableType) {
|
|
841
835
|
this.handleGroupOptionSelected(event, selectedOption)
|
|
842
836
|
} else {
|
|
837
|
+
// TODO workaround for react 19 default props
|
|
838
|
+
const optionWithDefaultProps = {
|
|
839
|
+
...selectedOptionChild,
|
|
840
|
+
props: { ...selectedOptionChild.props, role: 'menuitem' }
|
|
841
|
+
}
|
|
843
842
|
if (typeof onSelect === 'function') {
|
|
844
843
|
onSelect(event, {
|
|
845
844
|
value,
|
|
846
845
|
isSelected: true,
|
|
847
|
-
selectedOption:
|
|
846
|
+
selectedOption: optionWithDefaultProps,
|
|
848
847
|
drilldown: this
|
|
849
848
|
})
|
|
850
849
|
}
|
|
@@ -1035,15 +1034,15 @@ class Drilldown extends Component<DrilldownProps, DrilldownState> {
|
|
|
1035
1034
|
id,
|
|
1036
1035
|
children,
|
|
1037
1036
|
href,
|
|
1038
|
-
as,
|
|
1039
|
-
role,
|
|
1037
|
+
as = 'li', // workaround after the react 19 upgrade, defaultProps doesn't work anymore
|
|
1038
|
+
role = 'menuitem', // workaround after the react 19 upgrade, defaultProps doesn't work anymore
|
|
1040
1039
|
subPageId,
|
|
1041
|
-
disabled,
|
|
1040
|
+
disabled = false, // workaround after the react 19 upgrade, defaultProps doesn't work anymore
|
|
1042
1041
|
renderLabelInfo,
|
|
1043
1042
|
renderBeforeLabel,
|
|
1044
1043
|
renderAfterLabel,
|
|
1045
|
-
beforeLabelContentVAlign,
|
|
1046
|
-
afterLabelContentVAlign,
|
|
1044
|
+
beforeLabelContentVAlign = 'start', // workaround after the react 19 upgrade, defaultProps doesn't work anymore
|
|
1045
|
+
afterLabelContentVAlign = 'start', // workaround after the react 19 upgrade, defaultProps doesn't work anymore
|
|
1047
1046
|
description,
|
|
1048
1047
|
descriptionRole,
|
|
1049
1048
|
elementRef,
|
|
@@ -1303,7 +1302,7 @@ class Drilldown extends Component<DrilldownProps, DrilldownState> {
|
|
|
1303
1302
|
children,
|
|
1304
1303
|
renderGroupTitle,
|
|
1305
1304
|
themeOverride,
|
|
1306
|
-
role,
|
|
1305
|
+
role = 'group', // react 19 defaultProps workaround
|
|
1307
1306
|
as,
|
|
1308
1307
|
elementRef
|
|
1309
1308
|
} = group.props
|
|
@@ -1319,7 +1318,9 @@ class Drilldown extends Component<DrilldownProps, DrilldownState> {
|
|
|
1319
1318
|
|
|
1320
1319
|
// add a separator above
|
|
1321
1320
|
if (needsFirstSeparator) {
|
|
1322
|
-
groupChildren.push(
|
|
1321
|
+
groupChildren.push(
|
|
1322
|
+
<Options.Separator key="drilldown-options-separator" />
|
|
1323
|
+
)
|
|
1323
1324
|
}
|
|
1324
1325
|
|
|
1325
1326
|
// create a sublist as a group
|
|
@@ -1358,7 +1359,9 @@ class Drilldown extends Component<DrilldownProps, DrilldownState> {
|
|
|
1358
1359
|
|
|
1359
1360
|
// add a separator below
|
|
1360
1361
|
if (needsLastSeparator) {
|
|
1361
|
-
groupChildren.push(
|
|
1362
|
+
groupChildren.push(
|
|
1363
|
+
<Options.Separator key="drilldown-options-separator-2" />
|
|
1364
|
+
)
|
|
1362
1365
|
}
|
|
1363
1366
|
|
|
1364
1367
|
return groupChildren
|
|
@@ -1420,6 +1423,7 @@ class Drilldown extends Component<DrilldownProps, DrilldownState> {
|
|
|
1420
1423
|
// (because it has an arrow)
|
|
1421
1424
|
{...(trigger ? {} : { borderWidth: 'small' })}
|
|
1422
1425
|
as="div"
|
|
1426
|
+
data-cid="Drilldown"
|
|
1423
1427
|
elementRef={this.handleDrilldownRef}
|
|
1424
1428
|
tabIndex={0}
|
|
1425
1429
|
css={styles?.drilldown}
|
|
@@ -1512,10 +1516,12 @@ class Drilldown extends Component<DrilldownProps, DrilldownState> {
|
|
|
1512
1516
|
shouldSetAriaExpanded,
|
|
1513
1517
|
styles
|
|
1514
1518
|
} = this.props
|
|
1519
|
+
|
|
1515
1520
|
const borderColor = (styles?.drilldown as { borderColor: string })
|
|
1516
1521
|
?.borderColor
|
|
1517
1522
|
return trigger ? (
|
|
1518
1523
|
<Popover
|
|
1524
|
+
data-cid="Drilldown"
|
|
1519
1525
|
themeOverride={{
|
|
1520
1526
|
// use here own theme's color
|
|
1521
1527
|
borderColor: borderColor
|
|
@@ -1576,9 +1582,11 @@ class Drilldown extends Component<DrilldownProps, DrilldownState> {
|
|
|
1576
1582
|
},
|
|
1577
1583
|
'aria-haspopup': this.props.role,
|
|
1578
1584
|
id: this._triggerId,
|
|
1579
|
-
disabled: !!(
|
|
1585
|
+
disabled: !!(
|
|
1586
|
+
(trigger as ReactElement<any>).props.disabled || disabled
|
|
1587
|
+
),
|
|
1580
1588
|
'aria-disabled':
|
|
1581
|
-
(trigger as ReactElement).props.disabled || disabled
|
|
1589
|
+
(trigger as ReactElement<any>).props.disabled || disabled
|
|
1582
1590
|
? 'true'
|
|
1583
1591
|
: undefined
|
|
1584
1592
|
})}
|