@instructure/ui-tree-browser 8.28.3-snapshot-10 → 8.28.3-snapshot-12
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 +1 -1
- package/package.json +14 -14
- package/src/TreeBrowser/README.md +81 -22
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.28.3-snapshot-
|
|
6
|
+
## [8.28.3-snapshot-12](https://github.com/instructure/instructure-ui/compare/v8.28.2...v8.28.3-snapshot-12) (2022-09-28)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-tree-browser
|
|
9
9
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-tree-browser",
|
|
3
|
-
"version": "8.28.3-snapshot-
|
|
3
|
+
"version": "8.28.3-snapshot-12",
|
|
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.28.3-snapshot-
|
|
27
|
-
"@instructure/ui-color-utils": "8.28.3-snapshot-
|
|
28
|
-
"@instructure/ui-test-locator": "8.28.3-snapshot-
|
|
29
|
-
"@instructure/ui-test-utils": "8.28.3-snapshot-
|
|
30
|
-
"@instructure/ui-themes": "8.28.3-snapshot-
|
|
26
|
+
"@instructure/ui-babel-preset": "8.28.3-snapshot-12",
|
|
27
|
+
"@instructure/ui-color-utils": "8.28.3-snapshot-12",
|
|
28
|
+
"@instructure/ui-test-locator": "8.28.3-snapshot-12",
|
|
29
|
+
"@instructure/ui-test-utils": "8.28.3-snapshot-12",
|
|
30
|
+
"@instructure/ui-themes": "8.28.3-snapshot-12"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.13.10",
|
|
34
|
-
"@instructure/emotion": "8.28.3-snapshot-
|
|
35
|
-
"@instructure/shared-types": "8.28.3-snapshot-
|
|
36
|
-
"@instructure/ui-icons": "8.28.3-snapshot-
|
|
37
|
-
"@instructure/ui-img": "8.28.3-snapshot-
|
|
38
|
-
"@instructure/ui-prop-types": "8.28.3-snapshot-
|
|
39
|
-
"@instructure/ui-react-utils": "8.28.3-snapshot-
|
|
40
|
-
"@instructure/ui-testable": "8.28.3-snapshot-
|
|
41
|
-
"@instructure/ui-utils": "8.28.3-snapshot-
|
|
34
|
+
"@instructure/emotion": "8.28.3-snapshot-12",
|
|
35
|
+
"@instructure/shared-types": "8.28.3-snapshot-12",
|
|
36
|
+
"@instructure/ui-icons": "8.28.3-snapshot-12",
|
|
37
|
+
"@instructure/ui-img": "8.28.3-snapshot-12",
|
|
38
|
+
"@instructure/ui-prop-types": "8.28.3-snapshot-12",
|
|
39
|
+
"@instructure/ui-react-utils": "8.28.3-snapshot-12",
|
|
40
|
+
"@instructure/ui-testable": "8.28.3-snapshot-12",
|
|
41
|
+
"@instructure/ui-utils": "8.28.3-snapshot-12",
|
|
42
42
|
"keycode": "^2",
|
|
43
43
|
"prop-types": "^15"
|
|
44
44
|
},
|
|
@@ -300,10 +300,11 @@ example: true
|
|
|
300
300
|
render: false
|
|
301
301
|
---
|
|
302
302
|
class Example extends React.Component {
|
|
303
|
-
constructor
|
|
303
|
+
constructor(props) {
|
|
304
304
|
super(props)
|
|
305
305
|
this.state = {
|
|
306
|
-
expanded: true
|
|
306
|
+
expanded: true,
|
|
307
|
+
hoveredLine: null
|
|
307
308
|
}
|
|
308
309
|
}
|
|
309
310
|
|
|
@@ -311,24 +312,76 @@ class Example extends React.Component {
|
|
|
311
312
|
const { expanded } = this.state
|
|
312
313
|
if (expanded) {
|
|
313
314
|
return (
|
|
314
|
-
<
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
315
|
+
<InstUISettingsProvider
|
|
316
|
+
theme={
|
|
317
|
+
this.state.hoveredLine === 'renderAfter'
|
|
318
|
+
? {
|
|
319
|
+
componentOverrides: {
|
|
320
|
+
View: {
|
|
321
|
+
focusColorInfo: 'white'
|
|
322
|
+
},
|
|
323
|
+
TextInput: {
|
|
324
|
+
focusOutlineColor: 'white'
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
: undefined
|
|
329
|
+
}
|
|
330
|
+
>
|
|
331
|
+
<View
|
|
332
|
+
as="div"
|
|
333
|
+
padding="xx-small"
|
|
334
|
+
onFocus={(e) => e.stopPropagation()}
|
|
335
|
+
onClick={(e) => e.stopPropagation()}
|
|
336
|
+
onMouseEnter={() => this.setState({ hoveredLine: 'renderAfter' })}
|
|
337
|
+
onMouseLeave={() => this.setState({ hoveredLine: 'null' })}
|
|
338
|
+
>
|
|
339
|
+
<TextInput
|
|
340
|
+
placeholder="Enter new group name"
|
|
341
|
+
display="inline-block"
|
|
342
|
+
width="12rem"
|
|
343
|
+
renderLabel=""
|
|
344
|
+
onKeyDown={(e) => {
|
|
345
|
+
e.stopPropagation()
|
|
346
|
+
}}
|
|
347
|
+
/>
|
|
348
|
+
<IconButton
|
|
349
|
+
screenReaderLabel="Cancel"
|
|
350
|
+
onClick={(e) => this.setExpand(e, !expanded)}
|
|
351
|
+
onKeyDown={(e) => {
|
|
352
|
+
if (e.code === 'Space' || e.code === 'Enter') {
|
|
353
|
+
e.preventDefault()
|
|
354
|
+
this.setExpand(e, !expanded)
|
|
355
|
+
}
|
|
356
|
+
}}
|
|
357
|
+
margin="0 0 0 small"
|
|
358
|
+
>
|
|
359
|
+
<IconXSolid />
|
|
360
|
+
</IconButton>
|
|
361
|
+
<IconButton
|
|
362
|
+
screenReaderLabel="Add new group"
|
|
363
|
+
onClick={(e) => this.setExpand(e, !expanded)}
|
|
364
|
+
onKeyDown={(e) => {
|
|
365
|
+
if (e.code === 'Space' || e.code === 'Enter') {
|
|
366
|
+
e.preventDefault()
|
|
367
|
+
this.setExpand(e, !expanded)
|
|
368
|
+
}
|
|
369
|
+
}}
|
|
370
|
+
margin="0 0 0 small"
|
|
371
|
+
>
|
|
372
|
+
<IconCheckSolid />
|
|
373
|
+
</IconButton>
|
|
374
|
+
</View>
|
|
375
|
+
</InstUISettingsProvider>
|
|
319
376
|
)
|
|
320
377
|
}
|
|
321
378
|
|
|
322
|
-
return
|
|
323
|
-
<View as="div">
|
|
324
|
-
Create New Group
|
|
325
|
-
</View>
|
|
326
|
-
)
|
|
379
|
+
return <View as="div">Create New Group</View>
|
|
327
380
|
}
|
|
328
381
|
|
|
329
382
|
setExpand = (e, expanded) => {
|
|
330
383
|
e.stopPropagation()
|
|
331
|
-
this.setState({expanded})
|
|
384
|
+
this.setState({ expanded })
|
|
332
385
|
this._node.focus()
|
|
333
386
|
}
|
|
334
387
|
|
|
@@ -336,9 +389,15 @@ class Example extends React.Component {
|
|
|
336
389
|
const { expanded } = this.state
|
|
337
390
|
return (
|
|
338
391
|
<TreeBrowser.Node
|
|
339
|
-
containerRef={(el) => this._node = el}
|
|
392
|
+
containerRef={(el) => (this._node = el)}
|
|
340
393
|
onClick={(e) => this.setExpand(e, !expanded)}
|
|
341
|
-
|
|
394
|
+
onKeyDown={(e) => {
|
|
395
|
+
if (e.code === 'Space' || e.code === 'Enter') {
|
|
396
|
+
e.preventDefault()
|
|
397
|
+
this.setExpand(e, !expanded)
|
|
398
|
+
}
|
|
399
|
+
}}
|
|
400
|
+
itemIcon={this.state.expanded ? '' : <IconPlusLine />}
|
|
342
401
|
size="large"
|
|
343
402
|
>
|
|
344
403
|
{this.renderInput()}
|
|
@@ -346,7 +405,7 @@ class Example extends React.Component {
|
|
|
346
405
|
)
|
|
347
406
|
}
|
|
348
407
|
|
|
349
|
-
render
|
|
408
|
+
render() {
|
|
350
409
|
return (
|
|
351
410
|
<TreeBrowser
|
|
352
411
|
selectionType="single"
|
|
@@ -355,21 +414,21 @@ class Example extends React.Component {
|
|
|
355
414
|
collections={{
|
|
356
415
|
1: {
|
|
357
416
|
id: 1,
|
|
358
|
-
name:
|
|
359
|
-
collections: [2]
|
|
417
|
+
name: 'Grade 1',
|
|
418
|
+
collections: [2]
|
|
360
419
|
},
|
|
361
420
|
2: {
|
|
362
421
|
id: 2,
|
|
363
|
-
name:
|
|
422
|
+
name: 'Math Outcomes',
|
|
364
423
|
collections: [],
|
|
365
424
|
items: [1, 2],
|
|
366
|
-
descriptor:
|
|
425
|
+
descriptor: '1 Group | 2 Outcomes',
|
|
367
426
|
renderAfterItems: this.renderNode()
|
|
368
427
|
}
|
|
369
428
|
}}
|
|
370
429
|
items={{
|
|
371
|
-
1: { id: 1, name:
|
|
372
|
-
2: { id: 2, name:
|
|
430
|
+
1: { id: 1, name: 'Can add' },
|
|
431
|
+
2: { id: 2, name: 'Can subtract' }
|
|
373
432
|
}}
|
|
374
433
|
showRootCollection={true}
|
|
375
434
|
rootId={1}
|