@instructure/ui-tree-browser 8.11.2-snapshot.7 → 8.12.0

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.12.0](https://github.com/instructure/instructure-ui/compare/v8.11.1...v8.12.0) (2021-11-17)
7
+
8
+ **Note:** Version bump only for package @instructure/ui-tree-browser
9
+
6
10
  ## [8.11.1](https://github.com/instructure/instructure-ui/compare/v8.11.0...v8.11.1) (2021-10-19)
7
11
 
8
12
  **Note:** Version bump only for package @instructure/ui-tree-browser
@@ -128,6 +128,10 @@ let TreeBrowser = (_dec = withStyle(generateStyles, generateComponentTheme), _de
128
128
  (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
129
129
  }
130
130
 
131
+ get _root() {
132
+ return this.ref;
133
+ }
134
+
131
135
  get collections() {
132
136
  const _this$props4 = this.props,
133
137
  collections = _this$props4.collections,
@@ -185,7 +189,7 @@ let TreeBrowser = (_dec = withStyle(generateStyles, generateComponentTheme), _de
185
189
  }
186
190
 
187
191
  getNavigableNodes() {
188
- return Array.from(this._root.querySelectorAll('[role="treeitem"]'));
192
+ return Array.from(this.ref.querySelectorAll('[role="treeitem"]'));
189
193
  }
190
194
 
191
195
  moveFocus(delta) {
@@ -218,7 +222,7 @@ let TreeBrowser = (_dec = withStyle(generateStyles, generateComponentTheme), _de
218
222
  }
219
223
 
220
224
  handleLeftOrRightArrow(keyCode, node) {
221
- const ltr = !(this._root.parentElement.dir === 'rtl' || document.dir === 'rtl');
225
+ const ltr = !(this.ref.parentElement.dir === 'rtl' || document.dir === 'rtl');
222
226
 
223
227
  if (ltr && keyCode === keycode.codes.left || !ltr && keyCode == keycode.codes.right) {
224
228
  this.handleCloseOrPrevious(node);
@@ -312,8 +316,6 @@ let TreeBrowser = (_dec = withStyle(generateStyles, generateComponentTheme), _de
312
316
  role: "tree",
313
317
  onKeyDown: this.handleKeyDown,
314
318
  ref: el => {
315
- this._root = el; // TODO remove this and keep only 'ref' in V9
316
-
317
319
  this.ref = el;
318
320
  },
319
321
  "aria-label": this.props.treeLabel
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -127,6 +127,10 @@ let TreeBrowser = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
127
127
  (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
128
128
  }
129
129
 
130
+ get _root() {
131
+ return this.ref;
132
+ }
133
+
130
134
  get collections() {
131
135
  const _this$props4 = this.props,
132
136
  collections = _this$props4.collections,
@@ -184,7 +188,7 @@ let TreeBrowser = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
184
188
  }
185
189
 
186
190
  getNavigableNodes() {
187
- return Array.from(this._root.querySelectorAll('[role="treeitem"]'));
191
+ return Array.from(this.ref.querySelectorAll('[role="treeitem"]'));
188
192
  }
189
193
 
190
194
  moveFocus(delta) {
@@ -217,7 +221,7 @@ let TreeBrowser = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
217
221
  }
218
222
 
219
223
  handleLeftOrRightArrow(keyCode, node) {
220
- const ltr = !(this._root.parentElement.dir === 'rtl' || document.dir === 'rtl');
224
+ const ltr = !(this.ref.parentElement.dir === 'rtl' || document.dir === 'rtl');
221
225
 
222
226
  if (ltr && keyCode === _keycode.default.codes.left || !ltr && keyCode == _keycode.default.codes.right) {
223
227
  this.handleCloseOrPrevious(node);
@@ -311,8 +315,6 @@ let TreeBrowser = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
311
315
  role: "tree",
312
316
  onKeyDown: this.handleKeyDown,
313
317
  ref: el => {
314
- this._root = el; // TODO remove this and keep only 'ref' in V9
315
-
316
318
  this.ref = el;
317
319
  },
318
320
  "aria-label": this.props.treeLabel
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-tree-browser",
3
- "version": "8.11.2-snapshot.7+2681e145a",
3
+ "version": "8.12.0",
4
4
  "description": "A component for displaying a hierarchical view of information",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "type": "commonjs",
@@ -24,22 +24,22 @@
24
24
  },
25
25
  "license": "MIT",
26
26
  "devDependencies": {
27
- "@instructure/ui-babel-preset": "8.11.2-snapshot.7+2681e145a",
28
- "@instructure/ui-color-utils": "8.11.2-snapshot.7+2681e145a",
29
- "@instructure/ui-test-locator": "8.11.2-snapshot.7+2681e145a",
30
- "@instructure/ui-test-utils": "8.11.2-snapshot.7+2681e145a",
31
- "@instructure/ui-themes": "8.11.2-snapshot.7+2681e145a"
27
+ "@instructure/ui-babel-preset": "8.12.0",
28
+ "@instructure/ui-color-utils": "8.12.0",
29
+ "@instructure/ui-test-locator": "8.12.0",
30
+ "@instructure/ui-test-utils": "8.12.0",
31
+ "@instructure/ui-themes": "8.12.0"
32
32
  },
33
33
  "dependencies": {
34
34
  "@babel/runtime": "^7.13.10",
35
- "@instructure/emotion": "8.11.2-snapshot.7+2681e145a",
36
- "@instructure/shared-types": "8.11.2-snapshot.7+2681e145a",
37
- "@instructure/ui-icons": "8.11.2-snapshot.7+2681e145a",
38
- "@instructure/ui-img": "8.11.2-snapshot.7+2681e145a",
39
- "@instructure/ui-prop-types": "8.11.2-snapshot.7+2681e145a",
40
- "@instructure/ui-react-utils": "8.11.2-snapshot.7+2681e145a",
41
- "@instructure/ui-testable": "8.11.2-snapshot.7+2681e145a",
42
- "@instructure/ui-utils": "8.11.2-snapshot.7+2681e145a",
35
+ "@instructure/emotion": "8.12.0",
36
+ "@instructure/shared-types": "8.12.0",
37
+ "@instructure/ui-icons": "8.12.0",
38
+ "@instructure/ui-img": "8.12.0",
39
+ "@instructure/ui-prop-types": "8.12.0",
40
+ "@instructure/ui-react-utils": "8.12.0",
41
+ "@instructure/ui-testable": "8.12.0",
42
+ "@instructure/ui-utils": "8.12.0",
43
43
  "keycode": "^2",
44
44
  "prop-types": "^15"
45
45
  },
@@ -49,6 +49,5 @@
49
49
  "publishConfig": {
50
50
  "access": "public"
51
51
  },
52
- "sideEffects": false,
53
- "gitHead": "2681e145ad469e1396536d3e9eed75a19995eb8a"
52
+ "sideEffects": false
54
53
  }
@@ -98,6 +98,13 @@ class TreeBrowser extends Component<TreeBrowserProps> {
98
98
  componentDidUpdate() {
99
99
  this.props.makeStyles?.()
100
100
  }
101
+ get _root() {
102
+ console.warn(
103
+ '_root property is deprecated and will be removed in v9, please use ref instead'
104
+ )
105
+
106
+ return this.ref
107
+ }
101
108
 
102
109
  // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'e' implicitly has an 'any' type.
103
110
  handleCollectionClick = (e, collection, expand = true) => {
@@ -210,8 +217,7 @@ class TreeBrowser extends Component<TreeBrowserProps> {
210
217
  }
211
218
 
212
219
  getNavigableNodes() {
213
- // @ts-expect-error ts-migrate(2339) FIXME: Property '_root' does not exist on type 'TreeBrows... Remove this comment to see the full error message
214
- return Array.from(this._root.querySelectorAll('[role="treeitem"]'))
220
+ return Array.from(this.ref!.querySelectorAll('[role="treeitem"]'))
215
221
  }
216
222
 
217
223
  // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'delta' implicitly has an 'any' type.
@@ -219,7 +225,7 @@ class TreeBrowser extends Component<TreeBrowserProps> {
219
225
  const nodes = this.getNavigableNodes()
220
226
  // @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'.
221
227
  const closest = window.document.activeElement.closest('[role="treeitem"]')
222
- const active = nodes.indexOf(closest)
228
+ const active = nodes.indexOf(closest!)
223
229
  let next = active + delta
224
230
  if (next < 0) {
225
231
  next = 0
@@ -227,10 +233,8 @@ class TreeBrowser extends Component<TreeBrowserProps> {
227
233
  next = nodes.length - 1
228
234
  }
229
235
  nodes.forEach((n) => {
230
- // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
231
236
  n.setAttribute('tabindex', '-1')
232
237
  })
233
- // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
234
238
  nodes[next].setAttribute('tabindex', '0')
235
239
  // @ts-expect-error ts-migrate(2571) FIXME: Object is of type 'unknown'.
236
240
  nodes[next].focus()
@@ -249,8 +253,8 @@ class TreeBrowser extends Component<TreeBrowserProps> {
249
253
  // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'keyCode' implicitly has an 'any' type.
250
254
  handleLeftOrRightArrow(keyCode, node) {
251
255
  const ltr = !(
252
- // @ts-expect-error ts-migrate(2339) FIXME: Property '_root' does not exist on type 'TreeBrows... Remove this comment to see the full error message
253
- (this._root.parentElement.dir === 'rtl' || document.dir === 'rtl')
256
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'ref' is possibly null
257
+ (this.ref.parentElement.dir === 'rtl' || document.dir === 'rtl')
254
258
  )
255
259
  if (
256
260
  (ltr && keyCode === keycode.codes.left) ||
@@ -385,8 +389,6 @@ class TreeBrowser extends Component<TreeBrowserProps> {
385
389
  // @ts-expect-error ts-migrate(2322) FIXME: Type '(event: any, node: any) => void' is not assi... Remove this comment to see the full error message
386
390
  onKeyDown={this.handleKeyDown}
387
391
  ref={(el) => {
388
- // @ts-expect-error ts-migrate(2339) FIXME: Property '_root' does not exist on type 'TreeBrows... Remove this comment to see the full error message
389
- this._root = el // TODO remove this and keep only 'ref' in V9
390
392
  this.ref = el
391
393
  }}
392
394
  aria-label={this.props.treeLabel}
@@ -77,6 +77,7 @@ declare class TreeBrowser extends Component<TreeBrowserProps> {
77
77
  constructor(props: any);
78
78
  componentDidMount(): void;
79
79
  componentDidUpdate(): void;
80
+ get _root(): Element | null;
80
81
  handleCollectionClick: (e: any, collection: any, expand?: boolean) => void;
81
82
  handleItemClick: (e: any, item: any) => void;
82
83
  handleKeyDown: (event: any, node: any) => void;
@@ -85,7 +86,7 @@ declare class TreeBrowser extends Component<TreeBrowserProps> {
85
86
  getExpanded(state: any, props: any): any;
86
87
  expandOrCollapseNode(collection: any): void;
87
88
  handleSelection(id: any, type: any): void;
88
- getNavigableNodes(): unknown[];
89
+ getNavigableNodes(): Element[];
89
90
  moveFocus(delta: any): void;
90
91
  homeOrEnd(keyCode: any): void;
91
92
  handleLeftOrRightArrow(keyCode: any, node: any): void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/TreeBrowser/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AAEf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGjC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAIxE,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAIrC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAG/C;;;;GAIG;AACH,cAEM,WAAY,SAAQ,SAAS,CAAC,gBAAgB,CAAC;IACnD,MAAM,CAAC,QAAQ,CAAC,WAAW,iBAAgB;IAE3C,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;OAAY;IAE5B,MAAM,CAAC,YAAY;;;;;;;;;;;;;;MAmBlB;IAED,MAAM,CAAC,IAAI,kBAAW;IACtB,MAAM,CAAC,UAAU,wBAAiB;IAClC,MAAM,CAAC,MAAM,oBAAa;IAC1B,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;gBAGd,KAAK,KAAA;IAUjB,iBAAiB;IAGjB,kBAAkB;IAKlB,qBAAqB,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ELETED
@@ -1,27 +0,0 @@
1
- ---
2
- title: The MIT License (MIT)
3
- category: Getting Started
4
- order: 9
5
- ---
6
-
7
- # The MIT License (MIT)
8
-
9
- Copyright (c) 2015 Instructure, Inc.
10
-
11
- **Permission is hereby granted, free of charge, to any person obtaining a copy
12
- of this software and associated documentation files (the "Software"), to deal
13
- in the Software without restriction, including without limitation the rights
14
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
- copies of the Software, and to permit persons to whom the Software is
16
- furnished to do so, subject to the following conditions.**
17
-
18
- The above copyright notice and this permission notice shall be included in all
19
- copies or substantial portions of the Software.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
- SOFTWARE.