@instructure/ui-tree-browser 8.17.1-snapshot.21 → 8.17.1-snapshot.30

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.
@@ -91,21 +91,17 @@ let TreeCollection = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
91
91
  }
92
92
 
93
93
  componentDidMount() {
94
- var _this$props$makeStyle, _this$props3;
95
-
96
- (_this$props$makeStyle = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props3);
94
+ this.props.makeStyles?.();
97
95
  }
98
96
 
99
97
  componentDidUpdate() {
100
- var _this$props$makeStyle2, _this$props4;
101
-
102
- (_this$props$makeStyle2 = (_this$props4 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props4);
98
+ this.props.makeStyles?.();
103
99
  }
104
100
 
105
101
  get itemsLevel() {
106
- const _this$props5 = this.props,
107
- level = _this$props5.level,
108
- isCollectionFlattened = _this$props5.isCollectionFlattened;
102
+ const _this$props3 = this.props,
103
+ level = _this$props3.level,
104
+ isCollectionFlattened = _this$props3.isCollectionFlattened;
109
105
  return isCollectionFlattened ? level : level + 1;
110
106
  }
111
107
 
@@ -124,12 +120,12 @@ let TreeCollection = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
124
120
  }
125
121
 
126
122
  renderChildren() {
127
- const _this$props6 = this.props,
128
- collections = _this$props6.collections,
129
- items = _this$props6.items,
130
- id = _this$props6.id,
131
- renderBeforeItems = _this$props6.renderBeforeItems,
132
- renderAfterItems = _this$props6.renderAfterItems;
123
+ const _this$props4 = this.props,
124
+ collections = _this$props4.collections,
125
+ items = _this$props4.items,
126
+ id = _this$props4.id,
127
+ renderBeforeItems = _this$props4.renderBeforeItems,
128
+ renderAfterItems = _this$props4.renderAfterItems;
133
129
  let position = 1;
134
130
  return (0, _emotion.jsx)(_react.default.Fragment, null, renderBeforeItems && this.renderCollectionChildren(id, renderBeforeItems, position++, 'before'), collections.map(collection => {
135
131
  return this.renderCollectionNode(collection, position++);
@@ -139,11 +135,11 @@ let TreeCollection = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
139
135
  }
140
136
 
141
137
  renderCollectionChildren(collectionId, child, position, keyword) {
142
- const _this$props7 = this.props,
143
- selection = _this$props7.selection,
144
- onKeyDown = _this$props7.onKeyDown,
145
- getItemProps = _this$props7.getItemProps,
146
- styles = _this$props7.styles;
138
+ const _this$props5 = this.props,
139
+ selection = _this$props5.selection,
140
+ onKeyDown = _this$props5.onKeyDown,
141
+ getItemProps = _this$props5.getItemProps,
142
+ styles = _this$props5.styles;
147
143
  const key = `${collectionId}_${keyword}`;
148
144
  const ariaSelected = {};
149
145
 
@@ -164,7 +160,7 @@ let TreeCollection = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
164
160
  return (0, _emotion.jsx)("li", Object.assign({
165
161
  id: key,
166
162
  role: "treeitem",
167
- css: styles === null || styles === void 0 ? void 0 : styles.item,
163
+ css: styles?.item,
168
164
  tabIndex: -1,
169
165
  key: key,
170
166
  "aria-posinset": position,
@@ -185,7 +181,7 @@ let TreeCollection = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
185
181
  if (typeof child.props.onKeyDown === 'function') {
186
182
  child.props.onKeyDown(e, n);
187
183
  } else {
188
- onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e, itemHash);
184
+ onKeyDown?.(e, itemHash);
189
185
  }
190
186
  },
191
187
  onBlur: e => this.handleBlur(e, itemHash)
@@ -213,12 +209,12 @@ let TreeCollection = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
213
209
  }
214
210
 
215
211
  renderItemNode(item, position) {
216
- const _this$props8 = this.props,
217
- selection = _this$props8.selection,
218
- onItemClick = _this$props8.onItemClick,
219
- onKeyDown = _this$props8.onKeyDown,
220
- getItemProps = _this$props8.getItemProps,
221
- styles = _this$props8.styles;
212
+ const _this$props6 = this.props,
213
+ selection = _this$props6.selection,
214
+ onItemClick = _this$props6.onItemClick,
215
+ onKeyDown = _this$props6.onKeyDown,
216
+ getItemProps = _this$props6.getItemProps,
217
+ styles = _this$props6.styles;
222
218
  const ariaSelected = {};
223
219
 
224
220
  if (selection) {
@@ -243,12 +239,12 @@ let TreeCollection = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
243
239
  tabIndex: -1,
244
240
  role: "treeitem",
245
241
  "aria-label": item.name,
246
- css: styles === null || styles === void 0 ? void 0 : styles.item,
242
+ css: styles?.item,
247
243
  "aria-level": this.itemsLevel,
248
244
  "aria-posinset": position,
249
245
  "aria-setsize": this.childCount,
250
- onClick: e => onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(e, itemHash),
251
- onKeyDown: e => onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e, itemHash),
246
+ onClick: e => onItemClick?.(e, itemHash),
247
+ onKeyDown: e => onKeyDown?.(e, itemHash),
252
248
  onFocus: e => this.handleFocus(e, itemHash),
253
249
  onBlur: e => this.handleBlur(e, itemHash)
254
250
  }, ariaSelected), (0, _emotion.jsx)(_TreeButton.TreeButton, itemProps));
@@ -268,17 +264,17 @@ let TreeCollection = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
268
264
  }
269
265
 
270
266
  render() {
271
- const _this$props9 = this.props,
272
- id = _this$props9.id,
273
- name = _this$props9.name,
274
- expanded = _this$props9.expanded,
275
- collectionIcon = _this$props9.collectionIcon,
276
- collectionIconExpanded = _this$props9.collectionIconExpanded,
277
- isCollectionFlattened = _this$props9.isCollectionFlattened,
278
- getCollectionProps = _this$props9.getCollectionProps,
279
- level = _this$props9.level,
280
- position = _this$props9.position,
281
- styles = _this$props9.styles;
267
+ const _this$props7 = this.props,
268
+ id = _this$props7.id,
269
+ name = _this$props7.name,
270
+ expanded = _this$props7.expanded,
271
+ collectionIcon = _this$props7.collectionIcon,
272
+ collectionIconExpanded = _this$props7.collectionIconExpanded,
273
+ isCollectionFlattened = _this$props7.isCollectionFlattened,
274
+ getCollectionProps = _this$props7.getCollectionProps,
275
+ level = _this$props7.level,
276
+ position = _this$props7.position,
277
+ styles = _this$props7.styles;
282
278
  const collectionProps = getCollectionProps({ ...this.getCommonButtonProps(),
283
279
  expanded: expanded,
284
280
  collectionIcon: collectionIcon,
@@ -295,7 +291,7 @@ let TreeCollection = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
295
291
  ref: el => {
296
292
  this.ref = el;
297
293
  },
298
- css: styles === null || styles === void 0 ? void 0 : styles.treeCollection,
294
+ css: styles?.treeCollection,
299
295
  tabIndex: -1,
300
296
  role: "treeitem",
301
297
  "aria-label": this.props.name,
@@ -315,7 +311,7 @@ let TreeCollection = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
315
311
  })
316
312
  }, ariaSelected), (0, _emotion.jsx)(_TreeButton.TreeButton, collectionProps), expanded && this.childCount > 0 && (0, _emotion.jsx)("ul", {
317
313
  "aria-label": name,
318
- css: styles === null || styles === void 0 ? void 0 : styles.list,
314
+ css: styles?.list,
319
315
  role: "group"
320
316
  }, this.renderChildren()));
321
317
  }
@@ -40,12 +40,12 @@ const generateComponentTheme = theme => {
40
40
  typography = theme.typography,
41
41
  borders = theme.borders;
42
42
  const componentVariables = {
43
- fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
44
- baseSpacingSmall: spacing === null || spacing === void 0 ? void 0 : spacing.xSmall,
45
- baseSpacingMedium: spacing === null || spacing === void 0 ? void 0 : spacing.small,
43
+ fontFamily: typography?.fontFamily,
44
+ baseSpacingSmall: spacing?.xSmall,
45
+ baseSpacingMedium: spacing?.small,
46
46
  baseSpacingLarge: '1rem',
47
- borderWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
48
- borderColor: colors === null || colors === void 0 ? void 0 : colors.borderDark
47
+ borderWidth: borders?.widthSmall,
48
+ borderColor: colors?.borderDark
49
49
  };
50
50
  return { ...componentVariables
51
51
  };
@@ -51,28 +51,24 @@ let TreeNode = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
51
51
  }
52
52
 
53
53
  componentDidMount() {
54
- var _this$props$makeStyle, _this$props;
55
-
56
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
54
+ this.props.makeStyles?.();
57
55
  }
58
56
 
59
57
  componentDidUpdate() {
60
- var _this$props$makeStyle2, _this$props2;
61
-
62
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
58
+ this.props.makeStyles?.();
63
59
  }
64
60
 
65
61
  renderItemImage() {
66
62
  var _Img;
67
63
 
68
- const _this$props3 = this.props,
69
- thumbnail = _this$props3.thumbnail,
70
- itemIcon = _this$props3.itemIcon,
71
- styles = _this$props3.styles;
64
+ const _this$props = this.props,
65
+ thumbnail = _this$props.thumbnail,
66
+ itemIcon = _this$props.itemIcon,
67
+ styles = _this$props.styles;
72
68
 
73
69
  if (thumbnail) {
74
70
  return (0, _emotion.jsx)("div", {
75
- css: styles === null || styles === void 0 ? void 0 : styles.thumbnail
71
+ css: styles?.thumbnail
76
72
  }, _Img || (_Img = (0, _emotion.jsx)(_Img2.Img, {
77
73
  src: thumbnail,
78
74
  constrain: "cover",
@@ -82,7 +78,7 @@ let TreeNode = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
82
78
 
83
79
  if (itemIcon) {
84
80
  return (0, _emotion.jsx)("div", {
85
- css: styles === null || styles === void 0 ? void 0 : styles.icon
81
+ css: styles?.icon
86
82
  }, (0, _callRenderProp.callRenderProp)(itemIcon));
87
83
  }
88
84
 
@@ -90,17 +86,17 @@ let TreeNode = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
90
86
  }
91
87
 
92
88
  render() {
93
- const _this$props4 = this.props,
94
- children = _this$props4.children,
95
- styles = _this$props4.styles;
89
+ const _this$props2 = this.props,
90
+ children = _this$props2.children,
91
+ styles = _this$props2.styles;
96
92
  return (0, _emotion.jsx)("div", {
97
93
  ref: this.handleRef,
98
94
  tabIndex: -1,
99
- css: styles === null || styles === void 0 ? void 0 : styles.treeButton
95
+ css: styles?.treeButton
100
96
  }, (0, _emotion.jsx)("span", {
101
- css: styles === null || styles === void 0 ? void 0 : styles.layout
97
+ css: styles?.layout
102
98
  }, this.renderItemImage(), (0, _emotion.jsx)("span", {
103
- css: styles === null || styles === void 0 ? void 0 : styles.node
99
+ css: styles?.node
104
100
  }, children)));
105
101
  }
106
102
 
@@ -56,16 +56,14 @@ let TreeBrowser = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
56
56
  e.stopPropagation();
57
57
  const onCollectionClick = _this.props.onCollectionClick;
58
58
  if (expand) _this.expandOrCollapseNode(collection);
59
- onCollectionClick === null || onCollectionClick === void 0 ? void 0 : onCollectionClick(collection.id, collection); // TODO: this should pass the event as the first arg
59
+ onCollectionClick?.(collection.id, collection); // TODO: this should pass the event as the first arg
60
60
 
61
61
  _this.handleSelection(collection.id, 'collection');
62
62
  };
63
63
 
64
64
  this.handleItemClick = (e, item) => {
65
- var _this$props$onItemCli, _this$props;
66
-
67
65
  e.stopPropagation();
68
- (_this$props$onItemCli = (_this$props = this.props).onItemClick) === null || _this$props$onItemCli === void 0 ? void 0 : _this$props$onItemCli.call(_this$props, item);
66
+ this.props.onItemClick?.(item);
69
67
  this.handleSelection(item.id, 'item');
70
68
  };
71
69
 
@@ -106,9 +104,9 @@ let TreeBrowser = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
106
104
  };
107
105
 
108
106
  this.getIsFlattened = collection => {
109
- const _this$props2 = this.props,
110
- rootId = _this$props2.rootId,
111
- showRootCollection = _this$props2.showRootCollection;
107
+ const _this$props = this.props,
108
+ rootId = _this$props.rootId,
109
+ showRootCollection = _this$props.showRootCollection;
112
110
  return !showRootCollection && typeof rootId !== 'undefined' && collection.id === rootId;
113
111
  };
114
112
 
@@ -125,15 +123,11 @@ let TreeBrowser = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
125
123
  }
126
124
 
127
125
  componentDidMount() {
128
- var _this$props$makeStyle, _this$props3;
129
-
130
- (_this$props$makeStyle = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props3);
126
+ this.props.makeStyles?.();
131
127
  }
132
128
 
133
129
  componentDidUpdate() {
134
- var _this$props$makeStyle2, _this$props4;
135
-
136
- (_this$props$makeStyle2 = (_this$props4 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props4);
130
+ this.props.makeStyles?.();
137
131
  }
138
132
 
139
133
  get _root() {
@@ -141,9 +135,9 @@ let TreeBrowser = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
141
135
  }
142
136
 
143
137
  get collections() {
144
- const _this$props5 = this.props,
145
- collections = _this$props5.collections,
146
- rootId = _this$props5.rootId;
138
+ const _this$props2 = this.props,
139
+ collections = _this$props2.collections,
140
+ rootId = _this$props2.rootId;
147
141
 
148
142
  if (typeof rootId !== 'undefined') {
149
143
  return [collections[rootId]];
@@ -161,9 +155,7 @@ let TreeBrowser = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
161
155
  }
162
156
 
163
157
  expandOrCollapseNode(collection) {
164
- var _this$props$onCollect, _this$props6;
165
-
166
- (_this$props$onCollect = (_this$props6 = this.props).onCollectionToggle) === null || _this$props$onCollect === void 0 ? void 0 : _this$props$onCollect.call(_this$props6, collection);
158
+ this.props.onCollectionToggle?.(collection);
167
159
 
168
160
  if (typeof this.props.expanded === 'undefined') {
169
161
  this.setState((state, props) => {
@@ -321,7 +313,7 @@ let TreeBrowser = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
321
313
  render() {
322
314
  const styles = this.props.styles;
323
315
  return (0, _emotion.jsx)("ul", {
324
- css: styles === null || styles === void 0 ? void 0 : styles.treeBrowser,
316
+ css: styles?.treeBrowser,
325
317
  tabIndex: 0,
326
318
  role: "tree",
327
319
  onKeyDown: this.handleKeyDown,
@@ -38,10 +38,10 @@ const generateComponentTheme = theme => {
38
38
  const colors = theme.colors,
39
39
  borders = theme.borders;
40
40
  const componentVariables = {
41
- borderRadius: borders === null || borders === void 0 ? void 0 : borders.radiusMedium,
42
- focusOutlineWidth: borders === null || borders === void 0 ? void 0 : borders.widthMedium,
43
- focusOutlineColor: colors === null || colors === void 0 ? void 0 : colors.borderBrand,
44
- focusOutlineStyle: borders === null || borders === void 0 ? void 0 : borders.style
41
+ borderRadius: borders?.radiusMedium,
42
+ focusOutlineWidth: borders?.widthMedium,
43
+ focusOutlineColor: colors?.borderBrand,
44
+ focusOutlineStyle: borders?.style
45
45
  };
46
46
  return { ...componentVariables
47
47
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-tree-browser",
3
- "version": "8.17.1-snapshot.21+79d490548",
3
+ "version": "8.17.1-snapshot.30+cb1322c25",
4
4
  "description": "A component for displaying a hierarchical view of information",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -23,22 +23,22 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@instructure/ui-babel-preset": "8.17.1-snapshot.21+79d490548",
27
- "@instructure/ui-color-utils": "8.17.1-snapshot.21+79d490548",
28
- "@instructure/ui-test-locator": "8.17.1-snapshot.21+79d490548",
29
- "@instructure/ui-test-utils": "8.17.1-snapshot.21+79d490548",
30
- "@instructure/ui-themes": "8.17.1-snapshot.21+79d490548"
26
+ "@instructure/ui-babel-preset": "8.17.1-snapshot.30+cb1322c25",
27
+ "@instructure/ui-color-utils": "8.17.1-snapshot.30+cb1322c25",
28
+ "@instructure/ui-test-locator": "8.17.1-snapshot.30+cb1322c25",
29
+ "@instructure/ui-test-utils": "8.17.1-snapshot.30+cb1322c25",
30
+ "@instructure/ui-themes": "8.17.1-snapshot.30+cb1322c25"
31
31
  },
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.13.10",
34
- "@instructure/emotion": "8.17.1-snapshot.21+79d490548",
35
- "@instructure/shared-types": "8.17.1-snapshot.21+79d490548",
36
- "@instructure/ui-icons": "8.17.1-snapshot.21+79d490548",
37
- "@instructure/ui-img": "8.17.1-snapshot.21+79d490548",
38
- "@instructure/ui-prop-types": "8.17.1-snapshot.21+79d490548",
39
- "@instructure/ui-react-utils": "8.17.1-snapshot.21+79d490548",
40
- "@instructure/ui-testable": "8.17.1-snapshot.21+79d490548",
41
- "@instructure/ui-utils": "8.17.1-snapshot.21+79d490548",
34
+ "@instructure/emotion": "8.17.1-snapshot.30+cb1322c25",
35
+ "@instructure/shared-types": "8.17.1-snapshot.30+cb1322c25",
36
+ "@instructure/ui-icons": "8.17.1-snapshot.30+cb1322c25",
37
+ "@instructure/ui-img": "8.17.1-snapshot.30+cb1322c25",
38
+ "@instructure/ui-prop-types": "8.17.1-snapshot.30+cb1322c25",
39
+ "@instructure/ui-react-utils": "8.17.1-snapshot.30+cb1322c25",
40
+ "@instructure/ui-testable": "8.17.1-snapshot.30+cb1322c25",
41
+ "@instructure/ui-utils": "8.17.1-snapshot.30+cb1322c25",
42
42
  "keycode": "^2",
43
43
  "prop-types": "^15"
44
44
  },
@@ -49,5 +49,5 @@
49
49
  "access": "public"
50
50
  },
51
51
  "sideEffects": false,
52
- "gitHead": "79d490548a0736feb2a7232bf5918857317b178b"
52
+ "gitHead": "cb1322c25257139750149d7a817f1fb32571c1ed"
53
53
  }