@instructure/ui-selectable 8.12.1-snapshot.7 → 8.13.1-snapshot.9

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,6 +3,10 @@
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.13.0](https://github.com/instructure/instructure-ui/compare/v8.12.0...v8.13.0) (2021-12-01)
7
+
8
+ **Note:** Version bump only for package @instructure/ui-selectable
9
+
6
10
  # [8.12.0](https://github.com/instructure/instructure-ui/compare/v8.11.1...v8.12.0) (2021-11-17)
7
11
 
8
12
  **Note:** Version bump only for package @instructure/ui-selectable
@@ -1,3 +1,10 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
+ const _excluded = ["onMouseDown", "onClick"],
3
+ _excluded2 = ["ref", "onKeyDown", "onKeyUp"],
4
+ _excluded3 = ["readOnly"],
5
+ _excluded4 = ["onMouseDown", "onClick"],
6
+ _excluded5 = ["id", "onMouseOver", "onClick"];
7
+
1
8
  /*
2
9
  * The MIT License (MIT)
3
10
  *
@@ -37,8 +44,8 @@ tags: autocomplete, typeahead, combobox, dropdown, search
37
44
  **/
38
45
 
39
46
  class Selectable extends Component {
40
- constructor(...args) {
41
- super(...args);
47
+ constructor() {
48
+ super(...arguments);
42
49
  this._id = this.props.id || uid('Selectable');
43
50
  this._listId = `${this._id}-list`;
44
51
  this._descriptionId = `${this._id}-description`;
@@ -166,6 +173,8 @@ class Selectable extends Component {
166
173
  }
167
174
 
168
175
  render() {
176
+ var _this = this;
177
+
169
178
  const _this$props3 = this.props,
170
179
  isShowingOptions = _this$props3.isShowingOptions,
171
180
  highlightedOptionId = _this$props3.highlightedOptionId,
@@ -177,15 +186,16 @@ class Selectable extends Component {
177
186
 
178
187
  if (typeof render === 'function') {
179
188
  return render({
180
- getRootProps: ({
181
- onMouseDown,
182
- onClick,
183
- ...rest
184
- } = {}) => {
189
+ getRootProps: function () {
190
+ let _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {},
191
+ onMouseDown = _ref.onMouseDown,
192
+ onClick = _ref.onClick,
193
+ rest = _objectWithoutProperties(_ref, _excluded);
194
+
185
195
  return {
186
- onClick: createChainedFunction(this.handleOpenClose, onClick),
196
+ onClick: createChainedFunction(_this.handleOpenClose, onClick),
187
197
  onMouseDown: createChainedFunction(event => {
188
- if (event.target !== this._trigger) {
198
+ if (event.target !== _this._trigger) {
189
199
  event.preventDefault(); // prevent trigger from losing focus
190
200
  }
191
201
  }, onMouseDown),
@@ -198,30 +208,32 @@ class Selectable extends Component {
198
208
  ...props
199
209
  };
200
210
  },
201
- getTriggerProps: ({
202
- ref,
203
- onKeyDown,
204
- onKeyUp,
205
- ...rest
206
- } = {}) => {
211
+ getTriggerProps: function () {
212
+ let _ref2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {},
213
+ ref = _ref2.ref,
214
+ onKeyDown = _ref2.onKeyDown,
215
+ onKeyUp = _ref2.onKeyUp,
216
+ rest = _objectWithoutProperties(_ref2, _excluded2);
217
+
207
218
  return {
208
- id: this._id,
209
- ref: createChainedFunction(ref, el => this._trigger = el),
219
+ id: _this._id,
220
+ ref: createChainedFunction(ref, el => _this._trigger = el),
210
221
  'aria-haspopup': 'listbox',
211
222
  'aria-expanded': isShowingOptions,
212
- 'aria-owns': isShowingOptions ? this._listId : null,
213
- 'aria-controls': isShowingOptions ? this._listId : null,
214
- 'aria-describedby': this._descriptionId,
223
+ 'aria-owns': isShowingOptions ? _this._listId : null,
224
+ 'aria-controls': isShowingOptions ? _this._listId : null,
225
+ 'aria-describedby': _this._descriptionId,
215
226
  'aria-activedescendant': isShowingOptions ? highlightedOptionId : null,
216
- onKeyDown: createChainedFunction(this.handleKeyDown, onKeyDown),
217
- onKeyUp: createChainedFunction(this.handleKeyUp, onKeyUp),
227
+ onKeyDown: createChainedFunction(_this.handleKeyDown, onKeyDown),
228
+ onKeyUp: createChainedFunction(_this.handleKeyUp, onKeyUp),
218
229
  ...rest
219
230
  };
220
231
  },
221
- getInputProps: ({
222
- readOnly,
223
- ...rest
224
- } = {}) => {
232
+ getInputProps: function () {
233
+ let _ref3 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {},
234
+ readOnly = _ref3.readOnly,
235
+ rest = _objectWithoutProperties(_ref3, _excluded3);
236
+
225
237
  return {
226
238
  role: 'combobox',
227
239
  'aria-autocomplete': readOnly ? 'none' : 'both',
@@ -230,13 +242,14 @@ class Selectable extends Component {
230
242
  ...rest
231
243
  };
232
244
  },
233
- getListProps: ({
234
- onMouseDown,
235
- onClick,
236
- ...rest
237
- } = {}) => {
245
+ getListProps: function () {
246
+ let _ref4 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {},
247
+ onMouseDown = _ref4.onMouseDown,
248
+ onClick = _ref4.onClick,
249
+ rest = _objectWithoutProperties(_ref4, _excluded4);
250
+
238
251
  return {
239
- id: this._listId,
252
+ id: _this._listId,
240
253
  role: 'listbox',
241
254
  onMouseDown: createChainedFunction(event => {
242
255
  event.preventDefault(); // prevent trigger from losing focus
@@ -250,17 +263,18 @@ class Selectable extends Component {
250
263
  ...rest
251
264
  };
252
265
  },
253
- getOptionProps: ({
254
- id,
255
- onMouseOver,
256
- onClick,
257
- ...rest
258
- } = {}) => {
266
+ getOptionProps: function () {
267
+ let _ref5 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {},
268
+ id = _ref5.id,
269
+ onMouseOver = _ref5.onMouseOver,
270
+ onClick = _ref5.onClick,
271
+ rest = _objectWithoutProperties(_ref5, _excluded5);
272
+
259
273
  error(Boolean(id), `[Selectable] Must provide id for each option via \`getOptionProps\`.`);
260
274
  return {
261
275
  id,
262
276
  role: 'option',
263
- 'aria-selected': this.isSelectedOption(id) ? 'true' : 'false',
277
+ 'aria-selected': _this.isSelectedOption(id) ? 'true' : 'false',
264
278
  onClick: createChainedFunction(event => {
265
279
  onRequestSelectOption === null || onRequestSelectOption === void 0 ? void 0 : onRequestSelectOption(event, {
266
280
  id
@@ -5,7 +5,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.Selectable = exports.default = void 0;
8
+ exports.default = exports.Selectable = void 0;
9
+
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
11
 
10
12
  var _react = require("react");
11
13
 
@@ -21,29 +23,11 @@ var _uid = require("@instructure/uid");
21
23
 
22
24
  var _props = require("./props");
23
25
 
24
- /*
25
- * The MIT License (MIT)
26
- *
27
- * Copyright (c) 2015 - present Instructure, Inc.
28
- *
29
- * Permission is hereby granted, free of charge, to any person obtaining a copy
30
- * of this software and associated documentation files (the "Software"), to deal
31
- * in the Software without restriction, including without limitation the rights
32
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
33
- * copies of the Software, and to permit persons to whom the Software is
34
- * furnished to do so, subject to the following conditions:
35
- *
36
- * The above copyright notice and this permission notice shall be included in all
37
- * copies or substantial portions of the Software.
38
- *
39
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
40
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
41
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
42
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
43
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
44
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
45
- * SOFTWARE.
46
- */
26
+ const _excluded = ["onMouseDown", "onClick"],
27
+ _excluded2 = ["ref", "onKeyDown", "onKeyUp"],
28
+ _excluded3 = ["readOnly"],
29
+ _excluded4 = ["onMouseDown", "onClick"],
30
+ _excluded5 = ["id", "onMouseOver", "onClick"];
47
31
 
48
32
  /**
49
33
  ---
@@ -53,8 +37,8 @@ tags: autocomplete, typeahead, combobox, dropdown, search
53
37
  @tsProps
54
38
  **/
55
39
  class Selectable extends _react.Component {
56
- constructor(...args) {
57
- super(...args);
40
+ constructor() {
41
+ super(...arguments);
58
42
  this._id = this.props.id || (0, _uid.uid)('Selectable');
59
43
  this._listId = `${this._id}-list`;
60
44
  this._descriptionId = `${this._id}-description`;
@@ -182,6 +166,8 @@ class Selectable extends _react.Component {
182
166
  }
183
167
 
184
168
  render() {
169
+ var _this = this;
170
+
185
171
  const _this$props3 = this.props,
186
172
  isShowingOptions = _this$props3.isShowingOptions,
187
173
  highlightedOptionId = _this$props3.highlightedOptionId,
@@ -193,15 +179,16 @@ class Selectable extends _react.Component {
193
179
 
194
180
  if (typeof render === 'function') {
195
181
  return render({
196
- getRootProps: ({
197
- onMouseDown,
198
- onClick,
199
- ...rest
200
- } = {}) => {
182
+ getRootProps: function () {
183
+ let _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {},
184
+ onMouseDown = _ref.onMouseDown,
185
+ onClick = _ref.onClick,
186
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
187
+
201
188
  return {
202
- onClick: (0, _createChainedFunction.createChainedFunction)(this.handleOpenClose, onClick),
189
+ onClick: (0, _createChainedFunction.createChainedFunction)(_this.handleOpenClose, onClick),
203
190
  onMouseDown: (0, _createChainedFunction.createChainedFunction)(event => {
204
- if (event.target !== this._trigger) {
191
+ if (event.target !== _this._trigger) {
205
192
  event.preventDefault(); // prevent trigger from losing focus
206
193
  }
207
194
  }, onMouseDown),
@@ -214,30 +201,32 @@ class Selectable extends _react.Component {
214
201
  ...props
215
202
  };
216
203
  },
217
- getTriggerProps: ({
218
- ref,
219
- onKeyDown,
220
- onKeyUp,
221
- ...rest
222
- } = {}) => {
204
+ getTriggerProps: function () {
205
+ let _ref2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {},
206
+ ref = _ref2.ref,
207
+ onKeyDown = _ref2.onKeyDown,
208
+ onKeyUp = _ref2.onKeyUp,
209
+ rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
210
+
223
211
  return {
224
- id: this._id,
225
- ref: (0, _createChainedFunction.createChainedFunction)(ref, el => this._trigger = el),
212
+ id: _this._id,
213
+ ref: (0, _createChainedFunction.createChainedFunction)(ref, el => _this._trigger = el),
226
214
  'aria-haspopup': 'listbox',
227
215
  'aria-expanded': isShowingOptions,
228
- 'aria-owns': isShowingOptions ? this._listId : null,
229
- 'aria-controls': isShowingOptions ? this._listId : null,
230
- 'aria-describedby': this._descriptionId,
216
+ 'aria-owns': isShowingOptions ? _this._listId : null,
217
+ 'aria-controls': isShowingOptions ? _this._listId : null,
218
+ 'aria-describedby': _this._descriptionId,
231
219
  'aria-activedescendant': isShowingOptions ? highlightedOptionId : null,
232
- onKeyDown: (0, _createChainedFunction.createChainedFunction)(this.handleKeyDown, onKeyDown),
233
- onKeyUp: (0, _createChainedFunction.createChainedFunction)(this.handleKeyUp, onKeyUp),
220
+ onKeyDown: (0, _createChainedFunction.createChainedFunction)(_this.handleKeyDown, onKeyDown),
221
+ onKeyUp: (0, _createChainedFunction.createChainedFunction)(_this.handleKeyUp, onKeyUp),
234
222
  ...rest
235
223
  };
236
224
  },
237
- getInputProps: ({
238
- readOnly,
239
- ...rest
240
- } = {}) => {
225
+ getInputProps: function () {
226
+ let _ref3 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {},
227
+ readOnly = _ref3.readOnly,
228
+ rest = (0, _objectWithoutProperties2.default)(_ref3, _excluded3);
229
+
241
230
  return {
242
231
  role: 'combobox',
243
232
  'aria-autocomplete': readOnly ? 'none' : 'both',
@@ -246,13 +235,14 @@ class Selectable extends _react.Component {
246
235
  ...rest
247
236
  };
248
237
  },
249
- getListProps: ({
250
- onMouseDown,
251
- onClick,
252
- ...rest
253
- } = {}) => {
238
+ getListProps: function () {
239
+ let _ref4 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {},
240
+ onMouseDown = _ref4.onMouseDown,
241
+ onClick = _ref4.onClick,
242
+ rest = (0, _objectWithoutProperties2.default)(_ref4, _excluded4);
243
+
254
244
  return {
255
- id: this._listId,
245
+ id: _this._listId,
256
246
  role: 'listbox',
257
247
  onMouseDown: (0, _createChainedFunction.createChainedFunction)(event => {
258
248
  event.preventDefault(); // prevent trigger from losing focus
@@ -266,17 +256,18 @@ class Selectable extends _react.Component {
266
256
  ...rest
267
257
  };
268
258
  },
269
- getOptionProps: ({
270
- id,
271
- onMouseOver,
272
- onClick,
273
- ...rest
274
- } = {}) => {
259
+ getOptionProps: function () {
260
+ let _ref5 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {},
261
+ id = _ref5.id,
262
+ onMouseOver = _ref5.onMouseOver,
263
+ onClick = _ref5.onClick,
264
+ rest = (0, _objectWithoutProperties2.default)(_ref5, _excluded5);
265
+
275
266
  (0, _console.logError)(Boolean(id), `[Selectable] Must provide id for each option via \`getOptionProps\`.`);
276
267
  return {
277
268
  id,
278
269
  role: 'option',
279
- 'aria-selected': this.isSelectedOption(id) ? 'true' : 'false',
270
+ 'aria-selected': _this.isSelectedOption(id) ? 'true' : 'false',
280
271
  onClick: (0, _createChainedFunction.createChainedFunction)(event => {
281
272
  onRequestSelectOption === null || onRequestSelectOption === void 0 ? void 0 : onRequestSelectOption(event, {
282
273
  id
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.allowedProps = exports.propTypes = void 0;
8
+ exports.propTypes = exports.allowedProps = void 0;
9
9
 
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-selectable",
3
- "version": "8.12.1-snapshot.7+1e7ac8219",
3
+ "version": "8.13.1-snapshot.9+f32ba918e",
4
4
  "description": "A UI component library made by Instructure Inc.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "type": "commonjs",
@@ -25,16 +25,16 @@
25
25
  },
26
26
  "license": "MIT",
27
27
  "devDependencies": {
28
- "@instructure/ui-babel-preset": "8.12.1-snapshot.7+1e7ac8219",
29
- "@instructure/ui-test-utils": "8.12.1-snapshot.7+1e7ac8219"
28
+ "@instructure/ui-babel-preset": "8.13.1-snapshot.9+f32ba918e",
29
+ "@instructure/ui-test-utils": "8.13.1-snapshot.9+f32ba918e"
30
30
  },
31
31
  "dependencies": {
32
32
  "@babel/runtime": "^7.13.10",
33
- "@instructure/console": "8.12.1-snapshot.7+1e7ac8219",
34
- "@instructure/ui-dom-utils": "8.12.1-snapshot.7+1e7ac8219",
35
- "@instructure/ui-testable": "8.12.1-snapshot.7+1e7ac8219",
36
- "@instructure/ui-utils": "8.12.1-snapshot.7+1e7ac8219",
37
- "@instructure/uid": "8.12.1-snapshot.7+1e7ac8219",
33
+ "@instructure/console": "8.13.1-snapshot.9+f32ba918e",
34
+ "@instructure/ui-dom-utils": "8.13.1-snapshot.9+f32ba918e",
35
+ "@instructure/ui-testable": "8.13.1-snapshot.9+f32ba918e",
36
+ "@instructure/ui-utils": "8.13.1-snapshot.9+f32ba918e",
37
+ "@instructure/uid": "8.13.1-snapshot.9+f32ba918e",
38
38
  "keycode": "^2",
39
39
  "prop-types": "^15"
40
40
  },
@@ -45,5 +45,5 @@
45
45
  "access": "public"
46
46
  },
47
47
  "sideEffects": false,
48
- "gitHead": "1e7ac821932a91fe9ef761c96f747c7ea1f3925a"
48
+ "gitHead": "f32ba918e4d3ce76c6ee95c856584d00a9d80958"
49
49
  }