@instructure/ui-drilldown 8.38.2-snapshot-4 → 8.38.2-snapshot-6

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 CHANGED
@@ -3,7 +3,7 @@
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
- ## [8.38.2-snapshot-4](https://github.com/instructure/instructure-ui/compare/v8.38.1...v8.38.2-snapshot-4) (2023-07-11)
6
+ ## [8.38.2-snapshot-6](https://github.com/instructure/instructure-ui/compare/v8.38.1...v8.38.2-snapshot-6) (2023-07-17)
7
7
 
8
8
  **Note:** Version bump only for package @instructure/ui-drilldown
9
9
 
@@ -35,89 +35,53 @@ import { PopoverLocator } from '@instructure/ui-popover/es/Popover/PopoverLocato
35
35
  import { Drilldown } from './index';
36
36
  const customMethods = {
37
37
  // return the wrapper Option.Items
38
- findAllOptions: async function () {
39
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
40
- args[_key] = arguments[_key];
41
- }
38
+ findAllOptions: async (...args) => {
42
39
  return await findAll('[class$=-optionItem__container]:not([role="presentation"])', ...args);
43
40
  },
44
- findAllOptionWrappers: async function () {
45
- return await OptionsItemLocator.findAll(...arguments);
41
+ findAllOptionWrappers: async (...args) => {
42
+ return await OptionsItemLocator.findAll(...args);
46
43
  },
47
- findOptionWrapperByOptionId: async function (_element, optionId) {
48
- for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
49
- args[_key2 - 2] = arguments[_key2];
50
- }
44
+ findOptionWrapperByOptionId: async (_element, optionId, ...args) => {
51
45
  return OptionsItemLocator.find(`:has(#${optionId})`, ...args);
52
46
  },
53
- findSizableContainer: async function () {
54
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
55
- args[_key3] = arguments[_key3];
56
- }
47
+ findSizableContainer: async (...args) => {
57
48
  return await find('[class$=-drilldown__container]', ...args);
58
49
  },
59
- findSelectableContainer: async function () {
60
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
61
- args[_key4] = arguments[_key4];
62
- }
50
+ findSelectableContainer: async (...args) => {
63
51
  return await find('[id^=Selectable_][id$=-list]', ...args);
64
52
  },
65
- findHeaderTitle: async function () {
66
- for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
67
- args[_key5] = arguments[_key5];
68
- }
53
+ findHeaderTitle: async (...args) => {
69
54
  return await find('[id^=DrilldownHeader-Title]', ...args);
70
55
  },
71
- findHeaderActionOption: async function () {
72
- for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
73
- args[_key6] = arguments[_key6];
74
- }
56
+ findHeaderActionOption: async (...args) => {
75
57
  return await find('[id^=DrilldownHeader-Action]', ...args);
76
58
  },
77
- findHeaderBackOption: async function () {
78
- for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
79
- args[_key7] = arguments[_key7];
80
- }
59
+ findHeaderBackOption: async (...args) => {
81
60
  return await find('[id^=DrilldownHeader-Back]', ...args);
82
61
  },
83
- findHeaderSeparator: async function () {
84
- for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
85
- args[_key8] = arguments[_key8];
86
- }
62
+ findHeaderSeparator: async (...args) => {
87
63
  return await find('[id^=DrilldownHeader-Separator]', ...args);
88
64
  },
89
- findAllSeparators: async function () {
90
- for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
91
- args[_key9] = arguments[_key9];
92
- }
65
+ findAllSeparators: async (...args) => {
93
66
  return await findAll('[class$=-separator]', ...args);
94
67
  },
95
- findAllGroupLabels: async function () {
96
- for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
97
- args[_key10] = arguments[_key10];
98
- }
68
+ findAllGroupLabels: async (...args) => {
99
69
  return await findAll('[class$=-options__label]', ...args);
100
70
  },
101
- findLabelInfo: async function () {
102
- for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
103
- args[_key11] = arguments[_key11];
104
- }
71
+ findLabelInfo: async (...args) => {
105
72
  return await find('[class$=-drilldown__optionLabelInfo]', ...args);
106
73
  },
107
- findDescription: async function () {
108
- for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
109
- args[_key12] = arguments[_key12];
110
- }
74
+ findDescription: async (...args) => {
111
75
  return await find('[class$=__description]', ...args);
112
76
  },
113
- findPopoverRoot: function () {
114
- return PopoverLocator.find(...arguments);
77
+ findPopoverRoot: (...args) => {
78
+ return PopoverLocator.find(...args);
115
79
  },
116
- findPopoverTrigger: function () {
117
- return PopoverLocator.findTrigger(...arguments);
80
+ findPopoverTrigger: (...args) => {
81
+ return PopoverLocator.findTrigger(...args);
118
82
  },
119
- findPopoverContent: function () {
120
- const _parseQueryArguments = parseQueryArguments(...arguments),
83
+ findPopoverContent: (...args) => {
84
+ const _parseQueryArguments = parseQueryArguments(...args),
121
85
  element = _parseQueryArguments.element,
122
86
  selector = _parseQueryArguments.selector,
123
87
  options = _parseQueryArguments.options;
@@ -118,9 +118,10 @@ let Drilldown = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
118
118
  this.reset();
119
119
  }
120
120
  };
121
- this.handleOptionHighlight = (_event, _ref) => {
122
- let id = _ref.id,
123
- direction = _ref.direction;
121
+ this.handleOptionHighlight = (_event, {
122
+ id,
123
+ direction
124
+ }) => {
124
125
  const rotateFocus = this.props.rotateFocus;
125
126
  const highlightedOptionId = this.state.highlightedOptionId;
126
127
 
@@ -202,28 +203,29 @@ let Drilldown = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
202
203
  }
203
204
 
204
205
  // If there is a previous page, goToPage will succeed and return the data
205
- const _ref2 = this.goToPage(this.previousPage.id),
206
- newPageId = _ref2.newPageId,
207
- prevPageId = _ref2.prevPageId;
206
+ const _ref = this.goToPage(this.previousPage.id),
207
+ newPageId = _ref.newPageId,
208
+ prevPageId = _ref.prevPageId;
208
209
  return {
209
210
  newPageId,
210
211
  prevPageId
211
212
  };
212
213
  };
213
214
  this.handleBackButtonClick = () => {
214
- const _ref3 = this.currentPage,
215
- onBackButtonClicked = _ref3.onBackButtonClicked;
215
+ const _ref2 = this.currentPage,
216
+ onBackButtonClicked = _ref2.onBackButtonClicked;
216
217
 
217
218
  // we only display the back button when there is a page to go back to
218
- const _ref4 = this.goToPreviousPage(),
219
- newPageId = _ref4.newPageId,
220
- prevPageId = _ref4.prevPageId;
219
+ const _ref3 = this.goToPreviousPage(),
220
+ newPageId = _ref3.newPageId,
221
+ prevPageId = _ref3.prevPageId;
221
222
  if (typeof onBackButtonClicked === 'function') {
222
223
  onBackButtonClicked(newPageId, prevPageId);
223
224
  }
224
225
  };
225
- this.handleOptionSelect = (event, _ref5) => {
226
- let id = _ref5.id;
226
+ this.handleOptionSelect = (event, {
227
+ id
228
+ }) => {
227
229
  const selectedOption = this.getPageChildById(id);
228
230
 
229
231
  // TODO: this line can be removed when React 16 is no longer supported
@@ -643,9 +645,9 @@ let Drilldown = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
643
645
  const _selectedOption$props = selectedOption.props,
644
646
  optionId = _selectedOption$props.id,
645
647
  value = _selectedOption$props.value;
646
- const _ref6 = selectedOption.groupProps,
647
- groupId = _ref6.id,
648
- selectableType = _ref6.selectableType;
648
+ const _ref4 = selectedOption.groupProps,
649
+ groupId = _ref4.id,
650
+ selectableType = _ref4.selectableType;
649
651
  let newState = new Map(oldState.selectedGroupOptionsMap[groupId]);
650
652
  if (selectableType === 'multiple' && Boolean((_oldState$selectedGro = oldState.selectedGroupOptionsMap[groupId]) === null || _oldState$selectedGro === void 0 ? void 0 : _oldState$selectedGro.has(optionId))) {
651
653
  // toggle off, if already selected
@@ -669,9 +671,9 @@ let Drilldown = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
669
671
  };
670
672
  }, () => {
671
673
  const value = selectedOption.props.value;
672
- const _ref7 = selectedOption.groupProps,
673
- groupId = _ref7.id,
674
- groupOnSelect = _ref7.onSelect;
674
+ const _ref5 = selectedOption.groupProps,
675
+ groupId = _ref5.id,
676
+ groupOnSelect = _ref5.onSelect;
675
677
  const onSelect = this.props.onSelect;
676
678
  const groupProps = selectedOption.groupProps,
677
679
  option = _objectWithoutProperties(selectedOption, _excluded2);
@@ -1027,67 +1029,71 @@ let Drilldown = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
1027
1029
  id: lastOptionId
1028
1030
  });
1029
1031
  }
1030
- }, _ref8 => {
1031
- let getTriggerProps = _ref8.getTriggerProps,
1032
- getListProps = _ref8.getListProps,
1033
- getOptionProps = _ref8.getOptionProps,
1034
- getDisabledOptionProps = _ref8.getDisabledOptionProps;
1035
- return jsx(View, Object.assign({
1036
- as: "div",
1037
- elementRef: this.handleDrilldownRef,
1038
- tabIndex: 0,
1039
- css: styles === null || styles === void 0 ? void 0 : styles.drilldown,
1040
- position: "relative",
1041
- borderRadius: "small",
1042
- width: width,
1043
- minWidth: maxWidth,
1044
- maxWidth: maxWidth,
1045
- role: role,
1046
- "aria-label": label,
1047
- "aria-labelledby": this.currentPageAriaLabel
1048
- }, getTriggerProps({
1049
- id: this._id,
1050
- // We need to override these aria attributes added by Selectable,
1051
- // since Drilldown is not a combobox and has no popup
1052
- 'aria-haspopup': false,
1053
- 'aria-expanded': void 0,
1054
- onKeyDown: this.handleKeyDown,
1055
- onBlur: event => {
1056
- const target = event.currentTarget;
1057
- const related = event.relatedTarget;
1058
- const containsRelated = contains(target, related);
1059
- if (!related || related === this._drilldownRef || related !== target && !containsRelated) {
1060
- this.setState({
1061
- highlightedOptionId: void 0
1062
- });
1063
- }
1064
- },
1065
- onMouseLeave: () => {
1032
+ }, ({
1033
+ // TODO: figure out what other Selectable props we need, if we want to add a Select version for drilldown:
1034
+ // getRootProps, - we probably don't need this
1035
+ // getLabelProps, - do we need label?
1036
+ // getDescriptionProps, - might be nice for assistiveText like in Select
1037
+ // getInputProps, - hidden input for a11y? role="combobox" might be needed
1038
+ getTriggerProps,
1039
+ getListProps,
1040
+ getOptionProps,
1041
+ getDisabledOptionProps
1042
+ }) => jsx(View, Object.assign({
1043
+ as: "div",
1044
+ elementRef: this.handleDrilldownRef,
1045
+ tabIndex: 0,
1046
+ css: styles === null || styles === void 0 ? void 0 : styles.drilldown,
1047
+ position: "relative",
1048
+ borderRadius: "small",
1049
+ width: width,
1050
+ minWidth: maxWidth,
1051
+ maxWidth: maxWidth,
1052
+ role: role,
1053
+ "aria-label": label,
1054
+ "aria-labelledby": this.currentPageAriaLabel
1055
+ }, getTriggerProps({
1056
+ id: this._id,
1057
+ // We need to override these aria attributes added by Selectable,
1058
+ // since Drilldown is not a combobox and has no popup
1059
+ 'aria-haspopup': false,
1060
+ 'aria-expanded': void 0,
1061
+ onKeyDown: this.handleKeyDown,
1062
+ onBlur: event => {
1063
+ const target = event.currentTarget;
1064
+ const related = event.relatedTarget;
1065
+ const containsRelated = contains(target, related);
1066
+ if (!related || related === this._drilldownRef || related !== target && !containsRelated) {
1066
1067
  this.setState({
1067
1068
  highlightedOptionId: void 0
1068
1069
  });
1069
1070
  }
1070
- })), jsx(View, {
1071
- as: "div",
1072
- overflowY: overflowY,
1073
- overflowX: overflowX,
1074
- height: height,
1075
- width: width,
1076
- minHeight: minHeight,
1077
- minWidth: minWidth,
1078
- maxHeight: maxHeight,
1079
- maxWidth: maxWidth,
1080
- css: styles === null || styles === void 0 ? void 0 : styles.container,
1081
- borderRadius: "small",
1082
- role: "presentation",
1083
- elementRef: element => {
1084
- this._containerElement = element;
1085
- }
1086
- }, jsx(Options, Object.assign({}, getListProps(), {
1087
- role: "presentation",
1088
- as: as
1089
- }), this.renderList(getOptionProps, getDisabledOptionProps))));
1090
- });
1071
+ },
1072
+ onMouseLeave: () => {
1073
+ this.setState({
1074
+ highlightedOptionId: void 0
1075
+ });
1076
+ }
1077
+ })), jsx(View, {
1078
+ as: "div",
1079
+ overflowY: overflowY,
1080
+ overflowX: overflowX,
1081
+ height: height,
1082
+ width: width,
1083
+ minHeight: minHeight,
1084
+ minWidth: minWidth,
1085
+ maxHeight: maxHeight,
1086
+ maxWidth: maxWidth,
1087
+ css: styles === null || styles === void 0 ? void 0 : styles.container,
1088
+ borderRadius: "small",
1089
+ role: "presentation",
1090
+ elementRef: element => {
1091
+ this._containerElement = element;
1092
+ }
1093
+ }, jsx(Options, Object.assign({}, getListProps(), {
1094
+ role: "presentation",
1095
+ as: as
1096
+ }), this.renderList(getOptionProps, getDisabledOptionProps)))));
1091
1097
  }
1092
1098
  render() {
1093
1099
  // clear temporary option store
@@ -1115,8 +1121,9 @@ let Drilldown = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
1115
1121
  isShowingContent: show,
1116
1122
  defaultIsShowingContent: defaultShow,
1117
1123
  shouldCloseOnDocumentClick: true,
1118
- onHideContent: (event, _ref9) => {
1119
- let documentClick = _ref9.documentClick;
1124
+ onHideContent: (event, {
1125
+ documentClick
1126
+ }) => {
1120
1127
  if (typeof onDismiss === 'function') {
1121
1128
  onDismiss(event, documentClick);
1122
1129
  }
@@ -38,89 +38,53 @@ var _index = require("./index");
38
38
  /* eslint-enable no-restricted-imports */
39
39
  const customMethods = {
40
40
  // return the wrapper Option.Items
41
- findAllOptions: async function () {
42
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
43
- args[_key] = arguments[_key];
44
- }
41
+ findAllOptions: async (...args) => {
45
42
  return await (0, _uiTestUtils.findAll)('[class$=-optionItem__container]:not([role="presentation"])', ...args);
46
43
  },
47
- findAllOptionWrappers: async function () {
48
- return await _OptionsItemLocator.OptionsItemLocator.findAll(...arguments);
44
+ findAllOptionWrappers: async (...args) => {
45
+ return await _OptionsItemLocator.OptionsItemLocator.findAll(...args);
49
46
  },
50
- findOptionWrapperByOptionId: async function (_element, optionId) {
51
- for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
52
- args[_key2 - 2] = arguments[_key2];
53
- }
47
+ findOptionWrapperByOptionId: async (_element, optionId, ...args) => {
54
48
  return _OptionsItemLocator.OptionsItemLocator.find(`:has(#${optionId})`, ...args);
55
49
  },
56
- findSizableContainer: async function () {
57
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
58
- args[_key3] = arguments[_key3];
59
- }
50
+ findSizableContainer: async (...args) => {
60
51
  return await (0, _uiTestUtils.find)('[class$=-drilldown__container]', ...args);
61
52
  },
62
- findSelectableContainer: async function () {
63
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
64
- args[_key4] = arguments[_key4];
65
- }
53
+ findSelectableContainer: async (...args) => {
66
54
  return await (0, _uiTestUtils.find)('[id^=Selectable_][id$=-list]', ...args);
67
55
  },
68
- findHeaderTitle: async function () {
69
- for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
70
- args[_key5] = arguments[_key5];
71
- }
56
+ findHeaderTitle: async (...args) => {
72
57
  return await (0, _uiTestUtils.find)('[id^=DrilldownHeader-Title]', ...args);
73
58
  },
74
- findHeaderActionOption: async function () {
75
- for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
76
- args[_key6] = arguments[_key6];
77
- }
59
+ findHeaderActionOption: async (...args) => {
78
60
  return await (0, _uiTestUtils.find)('[id^=DrilldownHeader-Action]', ...args);
79
61
  },
80
- findHeaderBackOption: async function () {
81
- for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
82
- args[_key7] = arguments[_key7];
83
- }
62
+ findHeaderBackOption: async (...args) => {
84
63
  return await (0, _uiTestUtils.find)('[id^=DrilldownHeader-Back]', ...args);
85
64
  },
86
- findHeaderSeparator: async function () {
87
- for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
88
- args[_key8] = arguments[_key8];
89
- }
65
+ findHeaderSeparator: async (...args) => {
90
66
  return await (0, _uiTestUtils.find)('[id^=DrilldownHeader-Separator]', ...args);
91
67
  },
92
- findAllSeparators: async function () {
93
- for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
94
- args[_key9] = arguments[_key9];
95
- }
68
+ findAllSeparators: async (...args) => {
96
69
  return await (0, _uiTestUtils.findAll)('[class$=-separator]', ...args);
97
70
  },
98
- findAllGroupLabels: async function () {
99
- for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
100
- args[_key10] = arguments[_key10];
101
- }
71
+ findAllGroupLabels: async (...args) => {
102
72
  return await (0, _uiTestUtils.findAll)('[class$=-options__label]', ...args);
103
73
  },
104
- findLabelInfo: async function () {
105
- for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
106
- args[_key11] = arguments[_key11];
107
- }
74
+ findLabelInfo: async (...args) => {
108
75
  return await (0, _uiTestUtils.find)('[class$=-drilldown__optionLabelInfo]', ...args);
109
76
  },
110
- findDescription: async function () {
111
- for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
112
- args[_key12] = arguments[_key12];
113
- }
77
+ findDescription: async (...args) => {
114
78
  return await (0, _uiTestUtils.find)('[class$=__description]', ...args);
115
79
  },
116
- findPopoverRoot: function () {
117
- return _PopoverLocator.PopoverLocator.find(...arguments);
80
+ findPopoverRoot: (...args) => {
81
+ return _PopoverLocator.PopoverLocator.find(...args);
118
82
  },
119
- findPopoverTrigger: function () {
120
- return _PopoverLocator.PopoverLocator.findTrigger(...arguments);
83
+ findPopoverTrigger: (...args) => {
84
+ return _PopoverLocator.PopoverLocator.findTrigger(...args);
121
85
  },
122
- findPopoverContent: function () {
123
- const _parseQueryArguments = (0, _uiTestUtils.parseQueryArguments)(...arguments),
86
+ findPopoverContent: (...args) => {
87
+ const _parseQueryArguments = (0, _uiTestUtils.parseQueryArguments)(...args),
124
88
  element = _parseQueryArguments.element,
125
89
  selector = _parseQueryArguments.selector,
126
90
  options = _parseQueryArguments.options;