@instructure/ui-drilldown 8.38.2-snapshot-5 → 8.38.2-snapshot-7

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