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