@instructure/ui-drilldown 10.13.0 → 10.13.1-pr-snapshot-1741357986437
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 +8 -0
- package/lib/Drilldown/DrilldownGroup/props.js +2 -2
- package/lib/Drilldown/DrilldownOption/__new-tests__/DrilldownOption.test.js +5 -5
- package/lib/Drilldown/DrilldownPage/props.js +2 -2
- package/lib/Drilldown/__new-tests__/Drilldown.test.js +7 -7
- package/lib/Drilldown/index.js +40 -47
- package/lib/Drilldown/props.js +8 -9
- package/package.json +21 -21
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
## [10.13.1-pr-snapshot-1741357986437](https://github.com/instructure/instructure-ui/compare/v10.13.0...v10.13.1-pr-snapshot-1741357986437) (2025-03-07)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-drilldown
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [10.13.0](https://github.com/instructure/instructure-ui/compare/v10.12.0...v10.13.0) (2025-03-06)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @instructure/ui-drilldown
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var
|
|
9
|
+
var _uiPropTypes = require("@instructure/ui-prop-types");
|
|
10
10
|
var _DrilldownOption = _interopRequireDefault(require("../DrilldownOption"));
|
|
11
11
|
var _DrilldownSeparator = _interopRequireDefault(require("../DrilldownSeparator"));
|
|
12
12
|
/*
|
|
@@ -35,7 +35,7 @@ var _DrilldownSeparator = _interopRequireDefault(require("../DrilldownSeparator"
|
|
|
35
35
|
|
|
36
36
|
const propTypes = exports.propTypes = {
|
|
37
37
|
id: _propTypes.default.string.isRequired,
|
|
38
|
-
children:
|
|
38
|
+
children: _uiPropTypes.Children.oneOf([_DrilldownOption.default, _DrilldownSeparator.default]),
|
|
39
39
|
renderGroupTitle: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
40
40
|
withoutSeparators: _propTypes.default.bool,
|
|
41
41
|
disabled: _propTypes.default.bool,
|
|
@@ -6,7 +6,7 @@ var _react2 = require("@testing-library/react");
|
|
|
6
6
|
var _vitest = require("vitest");
|
|
7
7
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
8
8
|
require("@testing-library/jest-dom");
|
|
9
|
-
var
|
|
9
|
+
var _uiIcons = require("@instructure/ui-icons");
|
|
10
10
|
var _index = require("../../index");
|
|
11
11
|
var _Drilldown, _Drilldown$Option, _Drilldown2, _Drilldown3, _Drilldown4, _Drilldown5, _Drilldown6, _Drilldown7, _Drilldown8, _Drilldown9, _Drilldown10, _Drilldown11, _Drilldown12, _Drilldown13, _Drilldown14, _Drilldown15, _Drilldown16, _IconCheckSolid, _Drilldown17, _Drilldown18, _IconCheckSolid2, _Drilldown19, _Drilldown20, _Drilldown21;
|
|
12
12
|
/*
|
|
@@ -355,7 +355,7 @@ describe('<Drilldown.Option />', () => {
|
|
|
355
355
|
id: "page0"
|
|
356
356
|
}, /*#__PURE__*/_react.default.createElement(_index.Drilldown.Option, {
|
|
357
357
|
id: "option1",
|
|
358
|
-
renderBeforeLabel: /*#__PURE__*/_react.default.createElement(
|
|
358
|
+
renderBeforeLabel: /*#__PURE__*/_react.default.createElement(_uiIcons.IconCheckSolid, null)
|
|
359
359
|
}, "Option"))))),
|
|
360
360
|
container = _render4.container;
|
|
361
361
|
const icon = container.querySelector('svg');
|
|
@@ -363,7 +363,7 @@ describe('<Drilldown.Option />', () => {
|
|
|
363
363
|
expect(icon).toHaveAttribute('name', 'IconCheck');
|
|
364
364
|
});
|
|
365
365
|
it('as function should have option props as params', async () => {
|
|
366
|
-
const beforeLabelFunction = _vitest.vi.fn(() => _IconCheckSolid || (_IconCheckSolid = /*#__PURE__*/_react.default.createElement(
|
|
366
|
+
const beforeLabelFunction = _vitest.vi.fn(() => _IconCheckSolid || (_IconCheckSolid = /*#__PURE__*/_react.default.createElement(_uiIcons.IconCheckSolid, null)));
|
|
367
367
|
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.Drilldown, {
|
|
368
368
|
rootPageId: "page0"
|
|
369
369
|
}, /*#__PURE__*/_react.default.createElement(_index.Drilldown.Page, {
|
|
@@ -404,7 +404,7 @@ describe('<Drilldown.Option />', () => {
|
|
|
404
404
|
id: "page0"
|
|
405
405
|
}, /*#__PURE__*/_react.default.createElement(_index.Drilldown.Option, {
|
|
406
406
|
id: "option1",
|
|
407
|
-
renderAfterLabel: /*#__PURE__*/_react.default.createElement(
|
|
407
|
+
renderAfterLabel: /*#__PURE__*/_react.default.createElement(_uiIcons.IconCheckSolid, null)
|
|
408
408
|
}, "Option"))))),
|
|
409
409
|
container = _render5.container;
|
|
410
410
|
const icon = container.querySelector('svg');
|
|
@@ -412,7 +412,7 @@ describe('<Drilldown.Option />', () => {
|
|
|
412
412
|
expect(icon).toHaveAttribute('name', 'IconCheck');
|
|
413
413
|
});
|
|
414
414
|
it('as function should have option props as params', async () => {
|
|
415
|
-
const beforeLabelFunction = _vitest.vi.fn(() => _IconCheckSolid2 || (_IconCheckSolid2 = /*#__PURE__*/_react.default.createElement(
|
|
415
|
+
const beforeLabelFunction = _vitest.vi.fn(() => _IconCheckSolid2 || (_IconCheckSolid2 = /*#__PURE__*/_react.default.createElement(_uiIcons.IconCheckSolid, null)));
|
|
416
416
|
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.Drilldown, {
|
|
417
417
|
rootPageId: "page0"
|
|
418
418
|
}, /*#__PURE__*/_react.default.createElement(_index.Drilldown.Page, {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var
|
|
9
|
+
var _uiPropTypes = require("@instructure/ui-prop-types");
|
|
10
10
|
var _DrilldownGroup = _interopRequireDefault(require("../DrilldownGroup"));
|
|
11
11
|
var _DrilldownOption = _interopRequireDefault(require("../DrilldownOption"));
|
|
12
12
|
var _DrilldownSeparator = _interopRequireDefault(require("../DrilldownSeparator"));
|
|
@@ -36,7 +36,7 @@ var _DrilldownSeparator = _interopRequireDefault(require("../DrilldownSeparator"
|
|
|
36
36
|
|
|
37
37
|
const propTypes = exports.propTypes = {
|
|
38
38
|
id: _propTypes.default.string.isRequired,
|
|
39
|
-
children:
|
|
39
|
+
children: _uiPropTypes.Children.oneOf([_DrilldownOption.default, _DrilldownSeparator.default, _DrilldownGroup.default]),
|
|
40
40
|
renderTitle: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
41
41
|
renderActionLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
42
42
|
renderBackButtonLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
@@ -7,8 +7,8 @@ var _vitest = require("vitest");
|
|
|
7
7
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
8
8
|
require("@testing-library/jest-dom");
|
|
9
9
|
var _generateA11yTests = require("@instructure/ui-scripts/lib/test/generateA11yTests");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
10
|
+
var _uiAxeCheck = require("@instructure/ui-axe-check");
|
|
11
|
+
var _uiIcons = require("@instructure/ui-icons");
|
|
12
12
|
var _index = require("../index");
|
|
13
13
|
var _Drilldown16 = _interopRequireDefault(require("../__examples__/Drilldown.examples"));
|
|
14
14
|
var _Drilldown, _Drilldown2, _Drilldown3, _Drilldown4, _Drilldown5, _Drilldown6, _Drilldown7, _Drilldown8, _Drilldown9, _Drilldown$Page, _button, _Drilldown$Page2, _button2, _Drilldown$Page3, _Drilldown$Page4, _button3, _Drilldown$Page5, _button4, _Drilldown$Page6, _Drilldown$Page7, _button5, _Drilldown$Page8, _button6, _Drilldown$Page9, _Drilldown10, _button7, _Drilldown$Page10, _Drilldown11, _button8, _Drilldown$Page11, _button9, _Drilldown$Page12, _button10, _Drilldown$Page13, _Drilldown12, _button11, _Drilldown$Page14, _Drilldown13, _button12, _Drilldown$Page15, _button13, _Drilldown$Page16, _button14, _Drilldown$Page17, _button15, _Drilldown$Page18, _button16, _Drilldown$Page19, _button17, _Drilldown$Page20, _button18, _Drilldown$Page21, _button19, _Drilldown$Page22, _Drilldown14, _Drilldown15;
|
|
@@ -745,10 +745,10 @@ describe('<Drilldown />', () => {
|
|
|
745
745
|
href: "/"
|
|
746
746
|
}, "Item6"), /*#__PURE__*/_react.default.createElement(_index.Drilldown.Option, {
|
|
747
747
|
id: "item07",
|
|
748
|
-
renderBeforeLabel: /*#__PURE__*/_react.default.createElement(
|
|
748
|
+
renderBeforeLabel: /*#__PURE__*/_react.default.createElement(_uiIcons.IconCheckSolid, null)
|
|
749
749
|
}, "Item7"), /*#__PURE__*/_react.default.createElement(_index.Drilldown.Option, {
|
|
750
750
|
id: "item08",
|
|
751
|
-
renderAfterLabel: /*#__PURE__*/_react.default.createElement(
|
|
751
|
+
renderAfterLabel: /*#__PURE__*/_react.default.createElement(_uiIcons.IconCheckSolid, null)
|
|
752
752
|
}, "Item8"), /*#__PURE__*/_react.default.createElement(_index.Drilldown.Separator, {
|
|
753
753
|
id: "sep1"
|
|
754
754
|
}), /*#__PURE__*/_react.default.createElement(_index.Drilldown.Group, {
|
|
@@ -781,7 +781,7 @@ describe('<Drilldown />', () => {
|
|
|
781
781
|
// axe-check is more strict now, and expects "list" role to have "listitem" children, but we use "role='none'" children. After discussing it with the A11y team, we agreed to ignore this error because the screen readers can read the component perfectly.
|
|
782
782
|
// TODO: try to remove this ignore if axe-check is updated and isn't this strict anymore
|
|
783
783
|
// https://dequeuniversity.com/rules/axe/4.6/aria-required-children?application=axeAPI
|
|
784
|
-
const axeCheck = await (0,
|
|
784
|
+
const axeCheck = await (0, _uiAxeCheck.runAxeCheck)(container, {
|
|
785
785
|
ignores: ['aria-required-children']
|
|
786
786
|
});
|
|
787
787
|
expect(axeCheck).toBe(true);
|
|
@@ -796,7 +796,7 @@ describe('<Drilldown />', () => {
|
|
|
796
796
|
id: "option0"
|
|
797
797
|
}, "Option 0"))))),
|
|
798
798
|
container = _render10.container;
|
|
799
|
-
const axeCheck = await (0,
|
|
799
|
+
const axeCheck = await (0, _uiAxeCheck.runAxeCheck)(container);
|
|
800
800
|
expect(axeCheck).toBe(true);
|
|
801
801
|
});
|
|
802
802
|
});
|
|
@@ -807,7 +807,7 @@ describe('<Drilldown />', () => {
|
|
|
807
807
|
}) => {
|
|
808
808
|
const _render11 = (0, _react2.render)(content),
|
|
809
809
|
container = _render11.container;
|
|
810
|
-
const axeCheck = await (0,
|
|
810
|
+
const axeCheck = await (0, _uiAxeCheck.runAxeCheck)(container, {
|
|
811
811
|
// axe-check is more strict now, and expects "list" role to have "listitem" children, but we use "role='none'" children. After discussing it with the A11y team, we agreed to ignore this error because the screen readers can read the component perfectly.
|
|
812
812
|
// TODO: try to remove this ignore if axe-check is updated and isn't this strict anymore
|
|
813
813
|
// https://dequeuniversity.com/rules/axe/4.6/aria-required-children?application=axeAPI
|
package/lib/Drilldown/index.js
CHANGED
|
@@ -9,21 +9,14 @@ exports.default = exports.Drilldown = void 0;
|
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _console = require("@instructure/console");
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var _View = require("@instructure/ui-view/lib/View");
|
|
21
|
-
var _Options = require("@instructure/ui-options/lib/Options");
|
|
22
|
-
var _Popover = require("@instructure/ui-popover/lib/Popover");
|
|
23
|
-
var _Selectable = require("@instructure/ui-selectable/lib/Selectable");
|
|
24
|
-
var _IconArrowOpenStartSolid = require("@instructure/ui-icons/lib/IconArrowOpenStartSolid.js");
|
|
25
|
-
var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/IconArrowOpenEndSolid.js");
|
|
26
|
-
var _IconCheckSolid = require("@instructure/ui-icons/lib/IconCheckSolid.js");
|
|
12
|
+
var _uiTestable = require("@instructure/ui-testable");
|
|
13
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
14
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
15
|
+
var _uiView = require("@instructure/ui-view");
|
|
16
|
+
var _uiOptions = require("@instructure/ui-options");
|
|
17
|
+
var _uiPopover = require("@instructure/ui-popover");
|
|
18
|
+
var _uiSelectable = require("@instructure/ui-selectable");
|
|
19
|
+
var _uiIcons = require("@instructure/ui-icons");
|
|
27
20
|
var _emotion = require("@instructure/emotion");
|
|
28
21
|
var _DrilldownSeparator = require("./DrilldownSeparator");
|
|
29
22
|
var _DrilldownOption = require("./DrilldownOption");
|
|
@@ -73,7 +66,7 @@ var _dec, _dec2, _dec3, _class, _Drilldown, _IconArrowOpenEndSoli, _IconArrowOpe
|
|
|
73
66
|
category: components
|
|
74
67
|
---
|
|
75
68
|
**/
|
|
76
|
-
let Drilldown = exports.Drilldown = (_dec = (0,
|
|
69
|
+
let Drilldown = exports.Drilldown = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec3 = (0, _uiTestable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_Drilldown = class Drilldown extends _react.Component {
|
|
77
70
|
constructor(props) {
|
|
78
71
|
super(props);
|
|
79
72
|
this._drilldownRef = null;
|
|
@@ -495,7 +488,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
495
488
|
this.pages.forEach(page => {
|
|
496
489
|
const children = page.props.children;
|
|
497
490
|
this.getChildrenArray(children).forEach(child => {
|
|
498
|
-
if ((0,
|
|
491
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_DrilldownGroup.DrilldownGroup])) {
|
|
499
492
|
var _this$getChildrenArra;
|
|
500
493
|
const _child$props = child.props,
|
|
501
494
|
groupId = _child$props.id,
|
|
@@ -515,7 +508,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
515
508
|
}
|
|
516
509
|
selectedGroupOptionsMap[groupId] = new Map();
|
|
517
510
|
(_this$getChildrenArra = this.getChildrenArray(groupChildren)) === null || _this$getChildrenArra === void 0 ? void 0 : _this$getChildrenArra.forEach(groupChild => {
|
|
518
|
-
if ((0,
|
|
511
|
+
if ((0, _uiReactUtils.matchComponentTypes)(groupChild, [_DrilldownOption.DrilldownOption])) {
|
|
519
512
|
const _groupChild$props = groupChild.props,
|
|
520
513
|
optionId = _groupChild$props.id,
|
|
521
514
|
optionValue = _groupChild$props.value,
|
|
@@ -557,8 +550,8 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
557
550
|
|
|
558
551
|
// Back navigation option
|
|
559
552
|
if (this.previousPage) {
|
|
560
|
-
const prevPageTitle = (0,
|
|
561
|
-
const backButtonLabel = (0,
|
|
553
|
+
const prevPageTitle = (0, _uiReactUtils.callRenderProp)(this.previousPage.renderTitle);
|
|
554
|
+
const backButtonLabel = (0, _uiReactUtils.callRenderProp)(renderBackButtonLabel, prevPageTitle);
|
|
562
555
|
headerChildren.push((0, _emotion.jsx)(_DrilldownOption.DrilldownOption, {
|
|
563
556
|
id: this._headerBackId,
|
|
564
557
|
onOptionClick: this.handleBackButtonClick
|
|
@@ -570,7 +563,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
570
563
|
|
|
571
564
|
// Header title
|
|
572
565
|
if (renderTitle) {
|
|
573
|
-
const title = (0,
|
|
566
|
+
const title = (0, _uiReactUtils.callRenderProp)(renderTitle);
|
|
574
567
|
if (title) {
|
|
575
568
|
headerChildren.push((0, _emotion.jsx)(_DrilldownOption.DrilldownOption, {
|
|
576
569
|
id: this._headerTitleId,
|
|
@@ -585,7 +578,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
585
578
|
|
|
586
579
|
// Action label
|
|
587
580
|
if (renderActionLabel) {
|
|
588
|
-
const actionLabel = (0,
|
|
581
|
+
const actionLabel = (0, _uiReactUtils.callRenderProp)(renderActionLabel);
|
|
589
582
|
if (actionLabel) {
|
|
590
583
|
headerChildren.push((0, _emotion.jsx)(_DrilldownOption.DrilldownOption, {
|
|
591
584
|
id: this._headerActionId,
|
|
@@ -644,9 +637,9 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
644
637
|
}
|
|
645
638
|
focused() {
|
|
646
639
|
if (this.shown) {
|
|
647
|
-
return (0,
|
|
640
|
+
return (0, _uiDomUtils.containsActiveElement)(this._drilldownRef);
|
|
648
641
|
} else {
|
|
649
|
-
return (0,
|
|
642
|
+
return (0, _uiDomUtils.containsActiveElement)(this._trigger);
|
|
650
643
|
}
|
|
651
644
|
}
|
|
652
645
|
focusOption(id) {
|
|
@@ -725,7 +718,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
725
718
|
/**
|
|
726
719
|
* --- RENDER GROUP ---
|
|
727
720
|
*/
|
|
728
|
-
if ((0,
|
|
721
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_DrilldownGroup.DrilldownGroup])) {
|
|
729
722
|
const isFirstChild = index === 0;
|
|
730
723
|
const isLastChild = index === pageChildren.length - 1;
|
|
731
724
|
const afterSeparator = lastItemWasSeparator;
|
|
@@ -739,7 +732,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
739
732
|
/**
|
|
740
733
|
* --- RENDER SEPARATOR ---
|
|
741
734
|
*/
|
|
742
|
-
} else if ((0,
|
|
735
|
+
} else if ((0, _uiReactUtils.matchComponentTypes)(child, [_DrilldownSeparator.DrilldownSeparator])) {
|
|
743
736
|
// if the last item was separator, we don't want to duplicate it
|
|
744
737
|
if (lastItemWasSeparator) {
|
|
745
738
|
return null;
|
|
@@ -750,7 +743,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
750
743
|
/**
|
|
751
744
|
* --- RENDER OPTION ---
|
|
752
745
|
*/
|
|
753
|
-
} else if ((0,
|
|
746
|
+
} else if ((0, _uiReactUtils.matchComponentTypes)(child, [_DrilldownOption.DrilldownOption])) {
|
|
754
747
|
lastItemWasSeparator = false;
|
|
755
748
|
return this.renderOption(child, getOptionProps, getDisabledOptionProps);
|
|
756
749
|
} else {
|
|
@@ -763,7 +756,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
763
756
|
id = _separator$props.id,
|
|
764
757
|
themeOverride = _separator$props.themeOverride,
|
|
765
758
|
props = (0, _objectWithoutProperties2.default)(_separator$props, _excluded3);
|
|
766
|
-
return (0, _emotion.jsx)(
|
|
759
|
+
return (0, _emotion.jsx)(_uiOptions.Options.Separator, Object.assign({}, props, {
|
|
767
760
|
id: id,
|
|
768
761
|
key: id,
|
|
769
762
|
role: "separator"
|
|
@@ -801,7 +794,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
801
794
|
// Props passed to the Option.Item
|
|
802
795
|
let optionProps = {
|
|
803
796
|
// passthrough props
|
|
804
|
-
...(0,
|
|
797
|
+
...(0, _uiReactUtils.omitProps)(option.props, [..._DrilldownOption.DrilldownOption.allowedProps, ..._uiOptions.Options.Item.allowedProps]),
|
|
805
798
|
// props from selectable
|
|
806
799
|
...getOptionProps({
|
|
807
800
|
id,
|
|
@@ -859,13 +852,13 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
859
852
|
// we set a few manually on Options.Item,
|
|
860
853
|
// the rest are passed directly
|
|
861
854
|
if (subPageId) {
|
|
862
|
-
optionProps.renderAfterLabel = _IconArrowOpenEndSoli || (_IconArrowOpenEndSoli = (0, _emotion.jsx)(
|
|
855
|
+
optionProps.renderAfterLabel = _IconArrowOpenEndSoli || (_IconArrowOpenEndSoli = (0, _emotion.jsx)(_uiIcons.IconArrowOpenEndSolid, null));
|
|
863
856
|
optionProps['aria-haspopup'] = true;
|
|
864
857
|
optionProps.role = customRole || 'button';
|
|
865
858
|
(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.`);
|
|
866
859
|
}
|
|
867
860
|
if (id === this._headerBackId) {
|
|
868
|
-
optionProps.renderBeforeLabel = _IconArrowOpenStartSo || (_IconArrowOpenStartSo = (0, _emotion.jsx)(
|
|
861
|
+
optionProps.renderBeforeLabel = _IconArrowOpenStartSo || (_IconArrowOpenStartSo = (0, _emotion.jsx)(_uiIcons.IconArrowOpenStartSolid, null));
|
|
869
862
|
}
|
|
870
863
|
const isOptionControlled = typeof option.props.selected === 'boolean';
|
|
871
864
|
if ((groupProps !== null && groupProps !== void 0 && groupProps.selectableType || isOptionControlled) && groupProps) {
|
|
@@ -876,7 +869,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
876
869
|
isSelected = Boolean(option.props.selected);
|
|
877
870
|
}
|
|
878
871
|
optionProps['aria-checked'] = isSelected;
|
|
879
|
-
optionProps.renderBeforeLabel = (0, _emotion.jsx)(
|
|
872
|
+
optionProps.renderBeforeLabel = (0, _emotion.jsx)(_uiIcons.IconCheckSolid, {
|
|
880
873
|
style: {
|
|
881
874
|
opacity: isSelected ? 1 : 0
|
|
882
875
|
}
|
|
@@ -907,7 +900,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
907
900
|
optionProps.href = href;
|
|
908
901
|
}
|
|
909
902
|
}
|
|
910
|
-
const optionLabel = (0,
|
|
903
|
+
const optionLabel = (0, _uiReactUtils.callRenderProp)(children, {
|
|
911
904
|
id,
|
|
912
905
|
variant: optionProps.variant,
|
|
913
906
|
isSelected
|
|
@@ -931,7 +924,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
931
924
|
if (typeof optionProps.renderAfterLabel === 'function' && !((_optionProps$renderAf = optionProps.renderAfterLabel) !== null && _optionProps$renderAf !== void 0 && (_optionProps$renderAf2 = _optionProps$renderAf.prototype) !== null && _optionProps$renderAf2 !== void 0 && _optionProps$renderAf2.isReactComponent)) {
|
|
932
925
|
optionProps.renderAfterLabel = optionProps.renderAfterLabel.bind(null, renderLabelProps);
|
|
933
926
|
}
|
|
934
|
-
const labelInfo = renderLabelInfo && (0,
|
|
927
|
+
const labelInfo = renderLabelInfo && (0, _uiReactUtils.callRenderProp)(renderLabelInfo, renderLabelProps);
|
|
935
928
|
const vAlignMap = {
|
|
936
929
|
start: 'flex-start',
|
|
937
930
|
center: 'center',
|
|
@@ -941,7 +934,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
941
934
|
const infoAriaId = `${id}__info`;
|
|
942
935
|
const labelledby = option.props['aria-labelledby'] || labelAriaId;
|
|
943
936
|
const describedby = option.props['aria-describedby'] || (labelInfo ? infoAriaId : void 0);
|
|
944
|
-
return (0, _emotion.jsx)(
|
|
937
|
+
return (0, _emotion.jsx)(_uiOptions.Options.Item, Object.assign({}, optionProps, {
|
|
945
938
|
key: id,
|
|
946
939
|
"aria-labelledby": labelledby,
|
|
947
940
|
"aria-describedby": describedby
|
|
@@ -978,12 +971,12 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
978
971
|
|
|
979
972
|
// add a separator above
|
|
980
973
|
if (needsFirstSeparator) {
|
|
981
|
-
groupChildren.push(_Options$Separator || (_Options$Separator = (0, _emotion.jsx)(
|
|
974
|
+
groupChildren.push(_Options$Separator || (_Options$Separator = (0, _emotion.jsx)(_uiOptions.Options.Separator, null)));
|
|
982
975
|
}
|
|
983
976
|
|
|
984
977
|
// create a sublist as a group
|
|
985
978
|
// (a wrapping list item will be created by Options)
|
|
986
|
-
groupChildren.push((0, _emotion.jsx)(
|
|
979
|
+
groupChildren.push((0, _emotion.jsx)(_uiOptions.Options, {
|
|
987
980
|
id: id,
|
|
988
981
|
key: id,
|
|
989
982
|
role: role,
|
|
@@ -994,9 +987,9 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
994
987
|
,
|
|
995
988
|
themeOverride: themeOverride
|
|
996
989
|
}, this.getChildrenArray(children).map(child => {
|
|
997
|
-
if ((0,
|
|
990
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_DrilldownSeparator.DrilldownSeparator])) {
|
|
998
991
|
return this.renderSeparator(child);
|
|
999
|
-
} else if ((0,
|
|
992
|
+
} else if ((0, _uiReactUtils.matchComponentTypes)(child, [_DrilldownOption.DrilldownOption])) {
|
|
1000
993
|
return this.renderOption(child, getOptionProps, getDisabledOptionProps, group.props);
|
|
1001
994
|
} else {
|
|
1002
995
|
return null;
|
|
@@ -1005,7 +998,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1005
998
|
|
|
1006
999
|
// add a separator below
|
|
1007
1000
|
if (needsLastSeparator) {
|
|
1008
|
-
groupChildren.push(_Options$Separator2 || (_Options$Separator2 = (0, _emotion.jsx)(
|
|
1001
|
+
groupChildren.push(_Options$Separator2 || (_Options$Separator2 = (0, _emotion.jsx)(_uiOptions.Options.Separator, null)));
|
|
1009
1002
|
}
|
|
1010
1003
|
return groupChildren;
|
|
1011
1004
|
}
|
|
@@ -1026,7 +1019,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1026
1019
|
if (!this.currentPage) {
|
|
1027
1020
|
return null;
|
|
1028
1021
|
}
|
|
1029
|
-
return (0, _emotion.jsx)(
|
|
1022
|
+
return (0, _emotion.jsx)(_uiSelectable.Selectable, {
|
|
1030
1023
|
isShowingOptions: this.shown,
|
|
1031
1024
|
highlightedOptionId: this.state.highlightedOptionId,
|
|
1032
1025
|
selectedOptionId: this.selectedGroupOptionIdsArray,
|
|
@@ -1056,7 +1049,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1056
1049
|
getListProps,
|
|
1057
1050
|
getOptionProps,
|
|
1058
1051
|
getDisabledOptionProps
|
|
1059
|
-
}) => (0, _emotion.jsx)(
|
|
1052
|
+
}) => (0, _emotion.jsx)(_uiView.View, Object.assign({
|
|
1060
1053
|
borderWidth: "small",
|
|
1061
1054
|
as: "div",
|
|
1062
1055
|
elementRef: this.handleDrilldownRef,
|
|
@@ -1080,7 +1073,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1080
1073
|
onBlur: event => {
|
|
1081
1074
|
const target = event.currentTarget;
|
|
1082
1075
|
const related = event.relatedTarget;
|
|
1083
|
-
const containsRelated = (0,
|
|
1076
|
+
const containsRelated = (0, _uiDomUtils.contains)(target, related);
|
|
1084
1077
|
if (!related || related === this._drilldownRef || related !== target && !containsRelated) {
|
|
1085
1078
|
this.setState({
|
|
1086
1079
|
highlightedOptionId: void 0
|
|
@@ -1092,7 +1085,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1092
1085
|
highlightedOptionId: void 0
|
|
1093
1086
|
});
|
|
1094
1087
|
}
|
|
1095
|
-
})), (0, _emotion.jsx)(
|
|
1088
|
+
})), (0, _emotion.jsx)(_uiView.View, {
|
|
1096
1089
|
as: "div",
|
|
1097
1090
|
overflowY: overflowY,
|
|
1098
1091
|
overflowX: overflowX,
|
|
@@ -1108,7 +1101,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1108
1101
|
elementRef: element => {
|
|
1109
1102
|
this._containerElement = element;
|
|
1110
1103
|
}
|
|
1111
|
-
}, (0, _emotion.jsx)(
|
|
1104
|
+
}, (0, _emotion.jsx)(_uiOptions.Options, Object.assign({}, getListProps(), {
|
|
1112
1105
|
role: "presentation",
|
|
1113
1106
|
as: as
|
|
1114
1107
|
}), this.renderList(getOptionProps, getDisabledOptionProps)))));
|
|
@@ -1135,7 +1128,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1135
1128
|
onMouseOver = _this$props6.onMouseOver,
|
|
1136
1129
|
offsetX = _this$props6.offsetX,
|
|
1137
1130
|
offsetY = _this$props6.offsetY;
|
|
1138
|
-
return trigger ? (0, _emotion.jsx)(
|
|
1131
|
+
return trigger ? (0, _emotion.jsx)(_uiPopover.Popover, {
|
|
1139
1132
|
isShowingContent: show,
|
|
1140
1133
|
defaultIsShowingContent: defaultShow,
|
|
1141
1134
|
shouldCloseOnDocumentClick: true,
|
|
@@ -1174,7 +1167,7 @@ let Drilldown = exports.Drilldown = (_dec = (0, _withDeterministicId.withDetermi
|
|
|
1174
1167
|
popoverRef(el);
|
|
1175
1168
|
}
|
|
1176
1169
|
},
|
|
1177
|
-
renderTrigger: (0,
|
|
1170
|
+
renderTrigger: (0, _uiReactUtils.safeCloneElement)(trigger, {
|
|
1178
1171
|
ref: el => {
|
|
1179
1172
|
this._trigger = el;
|
|
1180
1173
|
},
|
package/lib/Drilldown/props.js
CHANGED
|
@@ -6,9 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var _PositionPropTypes = require("@instructure/ui-position/lib/PositionPropTypes.js");
|
|
9
|
+
var _uiPropTypes = require("@instructure/ui-prop-types");
|
|
10
|
+
var _uiPosition = require("@instructure/ui-position");
|
|
12
11
|
var _DrilldownPage = require("./DrilldownPage");
|
|
13
12
|
/*
|
|
14
13
|
* The MIT License (MIT)
|
|
@@ -36,7 +35,7 @@ var _DrilldownPage = require("./DrilldownPage");
|
|
|
36
35
|
|
|
37
36
|
const propTypes = exports.propTypes = {
|
|
38
37
|
rootPageId: _propTypes.default.string.isRequired,
|
|
39
|
-
children:
|
|
38
|
+
children: _uiPropTypes.Children.oneOf([_DrilldownPage.DrilldownPage]),
|
|
40
39
|
id: _propTypes.default.string,
|
|
41
40
|
label: _propTypes.default.string,
|
|
42
41
|
disabled: _propTypes.default.bool,
|
|
@@ -54,19 +53,19 @@ const propTypes = exports.propTypes = {
|
|
|
54
53
|
maxHeight: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
55
54
|
maxWidth: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
56
55
|
trigger: _propTypes.default.node,
|
|
57
|
-
placement:
|
|
56
|
+
placement: _uiPosition.PositionPropTypes.placement,
|
|
58
57
|
defaultShow: _propTypes.default.bool,
|
|
59
|
-
show: (0,
|
|
58
|
+
show: (0, _uiPropTypes.controllable)(_propTypes.default.bool, 'onToggle', 'defaultShow'),
|
|
60
59
|
onToggle: _propTypes.default.func,
|
|
61
60
|
onSelect: _propTypes.default.func,
|
|
62
61
|
onDismiss: _propTypes.default.func,
|
|
63
62
|
onFocus: _propTypes.default.func,
|
|
64
63
|
onMouseOver: _propTypes.default.func,
|
|
65
64
|
popoverRef: _propTypes.default.func,
|
|
66
|
-
mountNode:
|
|
67
|
-
positionTarget:
|
|
65
|
+
mountNode: _uiPosition.PositionPropTypes.mountNode,
|
|
66
|
+
positionTarget: _uiPosition.PositionPropTypes.mountNode,
|
|
68
67
|
positionContainerDisplay: _propTypes.default.oneOf(['inline-block', 'block']),
|
|
69
|
-
constrain:
|
|
68
|
+
constrain: _uiPosition.PositionPropTypes.constrain,
|
|
70
69
|
shouldHideOnSelect: _propTypes.default.bool,
|
|
71
70
|
shouldContainFocus: _propTypes.default.bool,
|
|
72
71
|
shouldReturnFocus: _propTypes.default.bool,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-drilldown",
|
|
3
|
-
"version": "10.13.
|
|
3
|
+
"version": "10.13.1-pr-snapshot-1741357986437",
|
|
4
4
|
"description": "A drilldown menu component",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -24,29 +24,29 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.26.0",
|
|
27
|
-
"@instructure/console": "10.13.
|
|
28
|
-
"@instructure/emotion": "10.13.
|
|
29
|
-
"@instructure/shared-types": "10.13.
|
|
30
|
-
"@instructure/ui-dom-utils": "10.13.
|
|
31
|
-
"@instructure/ui-icons": "10.13.
|
|
32
|
-
"@instructure/ui-options": "10.13.
|
|
33
|
-
"@instructure/ui-popover": "10.13.
|
|
34
|
-
"@instructure/ui-position": "10.13.
|
|
35
|
-
"@instructure/ui-prop-types": "10.13.
|
|
36
|
-
"@instructure/ui-react-utils": "10.13.
|
|
37
|
-
"@instructure/ui-selectable": "10.13.
|
|
38
|
-
"@instructure/ui-testable": "10.13.
|
|
39
|
-
"@instructure/ui-utils": "10.13.
|
|
40
|
-
"@instructure/ui-view": "10.13.
|
|
27
|
+
"@instructure/console": "10.13.1-pr-snapshot-1741357986437",
|
|
28
|
+
"@instructure/emotion": "10.13.1-pr-snapshot-1741357986437",
|
|
29
|
+
"@instructure/shared-types": "10.13.1-pr-snapshot-1741357986437",
|
|
30
|
+
"@instructure/ui-dom-utils": "10.13.1-pr-snapshot-1741357986437",
|
|
31
|
+
"@instructure/ui-icons": "10.13.1-pr-snapshot-1741357986437",
|
|
32
|
+
"@instructure/ui-options": "10.13.1-pr-snapshot-1741357986437",
|
|
33
|
+
"@instructure/ui-popover": "10.13.1-pr-snapshot-1741357986437",
|
|
34
|
+
"@instructure/ui-position": "10.13.1-pr-snapshot-1741357986437",
|
|
35
|
+
"@instructure/ui-prop-types": "10.13.1-pr-snapshot-1741357986437",
|
|
36
|
+
"@instructure/ui-react-utils": "10.13.1-pr-snapshot-1741357986437",
|
|
37
|
+
"@instructure/ui-selectable": "10.13.1-pr-snapshot-1741357986437",
|
|
38
|
+
"@instructure/ui-testable": "10.13.1-pr-snapshot-1741357986437",
|
|
39
|
+
"@instructure/ui-utils": "10.13.1-pr-snapshot-1741357986437",
|
|
40
|
+
"@instructure/ui-view": "10.13.1-pr-snapshot-1741357986437",
|
|
41
41
|
"prop-types": "^15.8.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@instructure/ui-axe-check": "10.13.
|
|
45
|
-
"@instructure/ui-babel-preset": "10.13.
|
|
46
|
-
"@instructure/ui-color-utils": "10.13.
|
|
47
|
-
"@instructure/ui-scripts": "10.13.
|
|
48
|
-
"@instructure/ui-test-utils": "10.13.
|
|
49
|
-
"@instructure/ui-themes": "10.13.
|
|
44
|
+
"@instructure/ui-axe-check": "10.13.1-pr-snapshot-1741357986437",
|
|
45
|
+
"@instructure/ui-babel-preset": "10.13.1-pr-snapshot-1741357986437",
|
|
46
|
+
"@instructure/ui-color-utils": "10.13.1-pr-snapshot-1741357986437",
|
|
47
|
+
"@instructure/ui-scripts": "10.13.1-pr-snapshot-1741357986437",
|
|
48
|
+
"@instructure/ui-test-utils": "10.13.1-pr-snapshot-1741357986437",
|
|
49
|
+
"@instructure/ui-themes": "10.13.1-pr-snapshot-1741357986437",
|
|
50
50
|
"@testing-library/jest-dom": "^6.6.3",
|
|
51
51
|
"@testing-library/react": "^16.0.1",
|
|
52
52
|
"@testing-library/user-event": "^14.5.2",
|