@instructure/ui-tree-browser 10.16.1-snapshot-0 → 10.16.1-snapshot-1

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.
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = exports.TreeCollection = void 0;
9
- var _react = _interopRequireWildcard(require("react"));
8
+ var _react = require("react");
10
9
  var _testable = require("@instructure/ui-testable/lib/testable.js");
11
10
  var _emotion = require("@instructure/emotion");
12
11
  var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
@@ -14,6 +13,8 @@ var _TreeButton = require("../TreeButton");
14
13
  var _styles = _interopRequireDefault(require("./styles"));
15
14
  var _theme = _interopRequireDefault(require("./theme"));
16
15
  var _props = require("./props");
16
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
+ var _react2 = require("@emotion/react");
17
18
  var _dec, _dec2, _class, _TreeCollection;
18
19
  /*
19
20
  * The MIT License (MIT)
@@ -38,8 +39,6 @@ var _dec, _dec2, _class, _TreeCollection;
38
39
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
39
40
  * SOFTWARE.
40
41
  */
41
- /** @jsx jsx */
42
- /** @jsxFrag React.Fragment */
43
42
  /**
44
43
  ---
45
44
  parent: TreeBrowser
@@ -151,17 +150,19 @@ let TreeCollection = exports.TreeCollection = (_dec = (0, _emotion.withStyle)(_s
151
150
  compareFunc = _this$props7.compareFunc;
152
151
  let position = 1;
153
152
  const sortedChildren = this.sortChildren();
154
- return (0, _emotion.jsx)(_react.default.Fragment, null, renderBeforeItems && this.renderCollectionChildren(id, renderBeforeItems, position++, 'before'), !compareFunc && collections.map(collection => {
155
- return this.renderCollectionNode(collection, position++);
156
- }), !compareFunc && items.map(item => {
157
- return this.renderItemNode(item, position++);
158
- }), compareFunc && sortedChildren.map(child => {
159
- if (child.type === 'collection') {
160
- return this.renderCollectionNode(child, position++);
161
- } else {
162
- return this.renderItemNode(child, position++);
163
- }
164
- }), renderAfterItems && this.renderCollectionChildren(id, renderAfterItems, position++, 'after'));
153
+ return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
154
+ children: [renderBeforeItems && this.renderCollectionChildren(id, renderBeforeItems, position++, 'before'), !compareFunc && collections.map(collection => {
155
+ return this.renderCollectionNode(collection, position++);
156
+ }), !compareFunc && items.map(item => {
157
+ return this.renderItemNode(item, position++);
158
+ }), compareFunc && sortedChildren.map(child => {
159
+ if (child.type === 'collection') {
160
+ return this.renderCollectionNode(child, position++);
161
+ } else {
162
+ return this.renderItemNode(child, position++);
163
+ }
164
+ }), renderAfterItems && this.renderCollectionChildren(id, renderAfterItems, position++, 'after')]
165
+ });
165
166
  }
166
167
  renderCollectionChildren(collectionId, child, position, keyword) {
167
168
  const _this$props8 = this.props,
@@ -184,17 +185,16 @@ let TreeCollection = exports.TreeCollection = (_dec = (0, _emotion.withStyle)(_s
184
185
  focused: this.state.focused === `child_${key}`,
185
186
  level: this.itemsLevel
186
187
  });
187
- return (0, _emotion.jsx)("li", Object.assign({
188
+ return (0, _jsxRuntime.jsx)("li", {
188
189
  id: key
189
190
  /* eslint-disable-next-line jsx-a11y/role-has-required-aria-props */,
190
191
  role: "treeitem",
191
192
  css: styles === null || styles === void 0 ? void 0 : styles.item,
192
193
  tabIndex: -1,
193
- key: key,
194
194
  "aria-posinset": position,
195
195
  "aria-setsize": this.childCount,
196
- "aria-level": this.itemsLevel
197
- }, ariaSelected, {
196
+ "aria-level": this.itemsLevel,
197
+ ...ariaSelected,
198
198
  onClick: e => {
199
199
  if (typeof child.props.onClick === 'function') {
200
200
  child.props.onClick(e);
@@ -210,11 +210,13 @@ let TreeCollection = exports.TreeCollection = (_dec = (0, _emotion.withStyle)(_s
210
210
  onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e, itemHash);
211
211
  }
212
212
  },
213
- onBlur: e => this.handleBlur(e, itemHash)
214
- }), (0, _safeCloneElement.safeCloneElement)(child, itemProps));
213
+ onBlur: e => this.handleBlur(e, itemHash),
214
+ children: (0, _safeCloneElement.safeCloneElement)(child, itemProps)
215
+ }, key);
215
216
  }
216
217
  renderCollectionNode(collection, position) {
217
- return (0, _emotion.jsx)(TreeCollection, Object.assign({}, this.props, {
218
+ return (0, _react2.createElement)(TreeCollection, {
219
+ ...this.props,
218
220
  key: `c${position}`,
219
221
  id: collection.id,
220
222
  name: collection.name,
@@ -231,7 +233,7 @@ let TreeCollection = exports.TreeCollection = (_dec = (0, _emotion.withStyle)(_s
231
233
  isCollectionFlattened: false // only the root needs to be flattened
232
234
  ,
233
235
  compareFunc: collection.compareFunc
234
- }));
236
+ });
235
237
  }
236
238
  renderItemNode(item, position) {
237
239
  const _this$props9 = this.props,
@@ -258,8 +260,7 @@ let TreeCollection = exports.TreeCollection = (_dec = (0, _emotion.withStyle)(_s
258
260
  focused: this.state.focused === `item_${item.id}`,
259
261
  type: 'item'
260
262
  });
261
- return (0, _emotion.jsx)("li", Object.assign({
262
- key: `i${position}`,
263
+ return (0, _jsxRuntime.jsx)("li", {
263
264
  tabIndex: -1
264
265
  /* eslint-disable-next-line jsx-a11y/role-has-required-aria-props */,
265
266
  role: "treeitem",
@@ -271,8 +272,12 @@ let TreeCollection = exports.TreeCollection = (_dec = (0, _emotion.withStyle)(_s
271
272
  onClick: e => onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(e, itemHash),
272
273
  onKeyDown: e => onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e, itemHash),
273
274
  onFocus: e => this.handleFocus(e, itemHash),
274
- onBlur: e => this.handleBlur(e, itemHash)
275
- }, ariaSelected), (0, _emotion.jsx)(_TreeButton.TreeButton, itemProps));
275
+ onBlur: e => this.handleBlur(e, itemHash),
276
+ ...ariaSelected,
277
+ children: (0, _jsxRuntime.jsx)(_TreeButton.TreeButton, {
278
+ ...itemProps
279
+ })
280
+ }, `i${position}`);
276
281
  }
277
282
  getCommonButtonProps() {
278
283
  return {
@@ -313,7 +318,7 @@ let TreeCollection = exports.TreeCollection = (_dec = (0, _emotion.withStyle)(_s
313
318
  'aria-selected': void 0
314
319
  };
315
320
  if (this.props.selection) ariaSelected['aria-selected'] = this.props.selection === `collection_${id}`;
316
- return isCollectionFlattened ? this.renderChildren() : (0, _emotion.jsx)("li", Object.assign({
321
+ return isCollectionFlattened ? this.renderChildren() : (0, _jsxRuntime.jsxs)("li", {
317
322
  ref: el => {
318
323
  this.ref = el;
319
324
  },
@@ -335,12 +340,17 @@ let TreeCollection = exports.TreeCollection = (_dec = (0, _emotion.withStyle)(_s
335
340
  onBlur: e => this.handleBlur(e, {
336
341
  id: id,
337
342
  type: 'collection'
338
- })
339
- }, ariaSelected), (0, _emotion.jsx)(_TreeButton.TreeButton, collectionProps), expanded && this.childCount > 0 && (0, _emotion.jsx)("ul", {
340
- "aria-label": name,
341
- css: styles === null || styles === void 0 ? void 0 : styles.list,
342
- role: "group"
343
- }, this.renderChildren()));
343
+ }),
344
+ ...ariaSelected,
345
+ children: [(0, _jsxRuntime.jsx)(_TreeButton.TreeButton, {
346
+ ...collectionProps
347
+ }), expanded && this.childCount > 0 && (0, _jsxRuntime.jsx)("ul", {
348
+ "aria-label": name,
349
+ css: styles === null || styles === void 0 ? void 0 : styles.list,
350
+ role: "group",
351
+ children: this.renderChildren()
352
+ })]
353
+ });
344
354
  }
345
355
  }, _TreeCollection.displayName = "TreeCollection", _TreeCollection.componentId = 'TreeBrowser.Collection', _TreeCollection.allowedProps = _props.allowedProps, _TreeCollection.propTypes = _props.propTypes, _TreeCollection.defaultProps = {
346
356
  collections: [],
@@ -13,6 +13,7 @@ var _emotion = require("@instructure/emotion");
13
13
  var _styles = _interopRequireDefault(require("../TreeButton/styles"));
14
14
  var _theme = _interopRequireDefault(require("../TreeButton/theme"));
15
15
  var _props = require("./props");
16
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
16
17
  var _dec, _dec2, _class, _TreeNode;
17
18
  /*
18
19
  * The MIT License (MIT)
@@ -37,7 +38,6 @@ var _dec, _dec2, _class, _TreeNode;
37
38
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
38
39
  * SOFTWARE.
39
40
  */
40
- /** @jsx jsx */
41
41
  // Todo: merge TreeButton and TreeNode: TreeButton should be a special type of TreeNode
42
42
  /**
43
43
  ---
@@ -72,18 +72,20 @@ let TreeNode = exports.TreeNode = (_dec = (0, _emotion.withStyle)(_styles.defaul
72
72
  itemIcon = _this$props3.itemIcon,
73
73
  styles = _this$props3.styles;
74
74
  if (thumbnail) {
75
- return (0, _emotion.jsx)("div", {
76
- css: styles === null || styles === void 0 ? void 0 : styles.thumbnail
77
- }, (0, _emotion.jsx)(_Img.Img, {
78
- src: thumbnail,
79
- constrain: "cover",
80
- alt: ""
81
- }));
75
+ return (0, _jsxRuntime.jsx)("div", {
76
+ css: styles === null || styles === void 0 ? void 0 : styles.thumbnail,
77
+ children: (0, _jsxRuntime.jsx)(_Img.Img, {
78
+ src: thumbnail,
79
+ constrain: "cover",
80
+ alt: ""
81
+ })
82
+ });
82
83
  }
83
84
  if (itemIcon) {
84
- return (0, _emotion.jsx)("div", {
85
- css: styles === null || styles === void 0 ? void 0 : styles.icon
86
- }, (0, _callRenderProp.callRenderProp)(itemIcon));
85
+ return (0, _jsxRuntime.jsx)("div", {
86
+ css: styles === null || styles === void 0 ? void 0 : styles.icon,
87
+ children: (0, _callRenderProp.callRenderProp)(itemIcon)
88
+ });
87
89
  }
88
90
  return void 0;
89
91
  }
@@ -91,15 +93,18 @@ let TreeNode = exports.TreeNode = (_dec = (0, _emotion.withStyle)(_styles.defaul
91
93
  const _this$props4 = this.props,
92
94
  children = _this$props4.children,
93
95
  styles = _this$props4.styles;
94
- return (0, _emotion.jsx)("div", {
96
+ return (0, _jsxRuntime.jsx)("div", {
95
97
  ref: this.handleRef,
96
98
  tabIndex: -1,
97
- css: styles === null || styles === void 0 ? void 0 : styles.treeButton
98
- }, (0, _emotion.jsx)("span", {
99
- css: styles === null || styles === void 0 ? void 0 : styles.layout
100
- }, this.renderItemImage(), (0, _emotion.jsx)("span", {
101
- css: styles === null || styles === void 0 ? void 0 : styles.node
102
- }, children)));
99
+ css: styles === null || styles === void 0 ? void 0 : styles.treeButton,
100
+ children: (0, _jsxRuntime.jsxs)("span", {
101
+ css: styles === null || styles === void 0 ? void 0 : styles.layout,
102
+ children: [this.renderItemImage(), (0, _jsxRuntime.jsx)("span", {
103
+ css: styles === null || styles === void 0 ? void 0 : styles.node,
104
+ children: children
105
+ })]
106
+ })
107
+ });
103
108
  }
104
109
  }, _TreeNode.displayName = "TreeNode", _TreeNode.componentId = 'TreeBrowser.Node', _TreeNode.allowedProps = _props.allowedProps, _TreeNode.propTypes = _props.propTypes, _TreeNode.defaultProps = {
105
110
  size: 'medium',
@@ -19,6 +19,7 @@ var _TreeNode = require("./TreeNode");
19
19
  var _styles = _interopRequireDefault(require("./styles"));
20
20
  var _theme = _interopRequireDefault(require("./theme"));
21
21
  var _props = require("./props");
22
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
22
23
  var _dec, _dec2, _class, _TreeBrowser;
23
24
  /*
24
25
  * The MIT License (MIT)
@@ -43,7 +44,6 @@ var _dec, _dec2, _class, _TreeBrowser;
43
44
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
44
45
  * SOFTWARE.
45
46
  */
46
- /** @jsx jsx */
47
47
  /**
48
48
  ---
49
49
  category: components
@@ -265,9 +265,9 @@ let TreeBrowser = exports.TreeBrowser = (_dec = (0, _emotion.withStyle)(_styles.
265
265
  return expanded.findIndex(expanded => String(expanded) === String(id));
266
266
  }
267
267
  renderRoot() {
268
- return this.collections.sort(this.props.sortOrder).map((collection, i) => (0, _emotion.jsx)(_TreeCollection.TreeCollection, Object.assign({
269
- key: i
270
- }, (0, _pickProps.pickProps)((0, _omitProps.omitProps)(this.props), _TreeCollection.TreeCollection.allowedProps), this.getCollectionProps(collection), {
268
+ return this.collections.sort(this.props.sortOrder).map((collection, i) => (0, _jsxRuntime.jsx)(_TreeCollection.TreeCollection, {
269
+ ...(0, _pickProps.pickProps)((0, _omitProps.omitProps)(this.props), _TreeCollection.TreeCollection.allowedProps),
270
+ ...this.getCollectionProps(collection),
271
271
  selection: this.state.selection,
272
272
  onItemClick: this.handleItemClick,
273
273
  onCollectionClick: this.handleCollectionClick,
@@ -276,11 +276,11 @@ let TreeBrowser = exports.TreeBrowser = (_dec = (0, _emotion.withStyle)(_styles.
276
276
  level: 1,
277
277
  position: 1,
278
278
  renderContent: this.props.renderContent
279
- })));
279
+ }, i));
280
280
  }
281
281
  render() {
282
282
  const styles = this.props.styles;
283
- return (0, _emotion.jsx)("ul", {
283
+ return (0, _jsxRuntime.jsx)("ul", {
284
284
  css: styles === null || styles === void 0 ? void 0 : styles.treeBrowser,
285
285
  tabIndex: 0,
286
286
  role: "tree",
@@ -288,8 +288,9 @@ let TreeBrowser = exports.TreeBrowser = (_dec = (0, _emotion.withStyle)(_styles.
288
288
  ref: el => {
289
289
  this.ref = el;
290
290
  },
291
- "aria-label": this.props.treeLabel
292
- }, this.renderRoot());
291
+ "aria-label": this.props.treeLabel,
292
+ children: this.renderRoot()
293
+ });
293
294
  }
294
295
  }, _TreeBrowser.displayName = "TreeBrowser", _TreeBrowser.componentId = 'TreeBrowser', _TreeBrowser.allowedProps = _props.allowedProps, _TreeBrowser.propTypes = _props.propTypes, _TreeBrowser.defaultProps = {
295
296
  size: 'medium',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-tree-browser",
3
- "version": "10.16.1-snapshot-0",
3
+ "version": "10.16.1-snapshot-1",
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": "10.16.1-snapshot-0",
27
- "@instructure/ui-color-utils": "10.16.1-snapshot-0",
28
- "@instructure/ui-test-locator": "10.16.1-snapshot-0",
29
- "@instructure/ui-test-utils": "10.16.1-snapshot-0",
30
- "@instructure/ui-themes": "10.16.1-snapshot-0"
26
+ "@instructure/ui-babel-preset": "10.16.1-snapshot-1",
27
+ "@instructure/ui-color-utils": "10.16.1-snapshot-1",
28
+ "@instructure/ui-test-locator": "10.16.1-snapshot-1",
29
+ "@instructure/ui-test-utils": "10.16.1-snapshot-1",
30
+ "@instructure/ui-themes": "10.16.1-snapshot-1"
31
31
  },
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.26.0",
34
- "@instructure/emotion": "10.16.1-snapshot-0",
35
- "@instructure/shared-types": "10.16.1-snapshot-0",
36
- "@instructure/ui-icons": "10.16.1-snapshot-0",
37
- "@instructure/ui-img": "10.16.1-snapshot-0",
38
- "@instructure/ui-prop-types": "10.16.1-snapshot-0",
39
- "@instructure/ui-react-utils": "10.16.1-snapshot-0",
40
- "@instructure/ui-testable": "10.16.1-snapshot-0",
41
- "@instructure/ui-utils": "10.16.1-snapshot-0",
34
+ "@instructure/emotion": "10.16.1-snapshot-1",
35
+ "@instructure/shared-types": "10.16.1-snapshot-1",
36
+ "@instructure/ui-icons": "10.16.1-snapshot-1",
37
+ "@instructure/ui-img": "10.16.1-snapshot-1",
38
+ "@instructure/ui-prop-types": "10.16.1-snapshot-1",
39
+ "@instructure/ui-react-utils": "10.16.1-snapshot-1",
40
+ "@instructure/ui-testable": "10.16.1-snapshot-1",
41
+ "@instructure/ui-utils": "10.16.1-snapshot-1",
42
42
  "keycode": "^2",
43
43
  "prop-types": "^15.8.1"
44
44
  },
@@ -22,13 +22,12 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- /** @jsx jsx */
26
25
  import { Component } from 'react'
27
26
 
28
27
  import { testable } from '@instructure/ui-testable'
29
28
  import { Img } from '@instructure/ui-img'
30
29
  import { callRenderProp } from '@instructure/ui-react-utils'
31
- import { withStyle, jsx } from '@instructure/emotion'
30
+ import { withStyle } from '@instructure/emotion'
32
31
 
33
32
  import generateStyles from './styles'
34
33
  import generateComponentTheme from './theme'
@@ -22,12 +22,10 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- /** @jsx jsx */
26
- /** @jsxFrag React.Fragment */
27
- import React, { Component, ReactElement, SyntheticEvent } from 'react'
25
+ import { Component, ReactElement, SyntheticEvent } from 'react'
28
26
 
29
27
  import { testable } from '@instructure/ui-testable'
30
- import { withStyle, jsx } from '@instructure/emotion'
28
+ import { withStyle } from '@instructure/emotion'
31
29
  import { safeCloneElement } from '@instructure/ui-react-utils'
32
30
 
33
31
  import { TreeButton } from '../TreeButton'
@@ -22,13 +22,12 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- /** @jsx jsx */
26
25
  import { Component } from 'react'
27
26
 
28
27
  import { Img } from '@instructure/ui-img'
29
28
  import { callRenderProp } from '@instructure/ui-react-utils'
30
29
  import { testable } from '@instructure/ui-testable'
31
- import { withStyle, jsx } from '@instructure/emotion'
30
+ import { withStyle } from '@instructure/emotion'
32
31
 
33
32
  import generateStyles from '../TreeButton/styles'
34
33
  import generateComponentTheme from '../TreeButton/theme'
@@ -22,8 +22,6 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- /** @jsx jsx */
26
-
27
25
  import { Component, SyntheticEvent } from 'react'
28
26
  import keycode from 'keycode'
29
27
 
@@ -31,7 +29,7 @@ import { IconFolderLine, IconDocumentLine } from '@instructure/ui-icons'
31
29
 
32
30
  import { omitProps, pickProps } from '@instructure/ui-react-utils'
33
31
  import { testable } from '@instructure/ui-testable'
34
- import { withStyle, jsx } from '@instructure/emotion'
32
+ import { withStyle } from '@instructure/emotion'
35
33
 
36
34
  import { TreeCollection } from './TreeCollection'
37
35
  import { TreeButton } from './TreeButton'
@@ -31,7 +31,7 @@ import type {
31
31
  TreeBrowserTheme
32
32
  } from '@instructure/shared-types'
33
33
  import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
34
- import React, { ReactElement } from 'react'
34
+ import { ReactElement } from 'react'
35
35
  import type { TreeBrowserButtonProps } from './TreeButton/props'
36
36
  import { Renderable } from '@instructure/shared-types'
37
37