@dxos/react-ui-list 0.8.2-main.12df754 → 0.8.2-main.30e4dbb
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/dist/lib/browser/index.mjs +6 -6
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +6 -6
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +6 -6
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Accordion/AccordionItem.d.ts.map +1 -1
- package/dist/types/src/components/Accordion/AccordionRoot.d.ts.map +1 -1
- package/dist/types/src/components/List/ListItem.d.ts.map +1 -1
- package/dist/types/src/components/List/ListRoot.d.ts.map +1 -1
- package/dist/types/src/components/List/testing.d.ts +10 -10
- package/dist/types/src/components/List/testing.d.ts.map +1 -1
- package/dist/types/src/components/Tree/Tree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/TreeItem.d.ts +6 -6
- package/dist/types/src/components/Tree/TreeItem.d.ts.map +1 -1
- package/dist/types/src/components/Tree/helpers.d.ts.map +1 -1
- package/dist/types/src/components/Tree/testing.d.ts +6 -6
- package/dist/types/src/components/Tree/testing.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -17
- package/src/components/Accordion/Accordion.stories.tsx +2 -2
- package/src/components/List/List.stories.tsx +3 -3
- package/src/components/List/testing.ts +10 -8
- package/src/components/Tree/Tree.stories.tsx +1 -1
- package/src/components/Tree/TreeItem.tsx +7 -7
- package/src/components/Tree/testing.ts +7 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-list",
|
|
3
|
-
"version": "0.8.2-main.
|
|
3
|
+
"version": "0.8.2-main.30e4dbb",
|
|
4
4
|
"description": "A list component.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -28,36 +28,36 @@
|
|
|
28
28
|
"@preact/signals-core": "^1.6.0",
|
|
29
29
|
"@radix-ui/react-accordion": "1.2.3",
|
|
30
30
|
"@radix-ui/react-context": "1.1.1",
|
|
31
|
-
"@dxos/
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/log": "0.8.2-main.
|
|
35
|
-
"@dxos/react-ui-
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/react-ui-
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/util": "0.8.2-main.
|
|
31
|
+
"@dxos/debug": "0.8.2-main.30e4dbb",
|
|
32
|
+
"@dxos/echo-schema": "0.8.2-main.30e4dbb",
|
|
33
|
+
"@dxos/invariant": "0.8.2-main.30e4dbb",
|
|
34
|
+
"@dxos/log": "0.8.2-main.30e4dbb",
|
|
35
|
+
"@dxos/react-ui-attention": "0.8.2-main.30e4dbb",
|
|
36
|
+
"@dxos/react-ui-text-tooltip": "0.8.2-main.30e4dbb",
|
|
37
|
+
"@dxos/react-ui-types": "0.8.2-main.30e4dbb",
|
|
38
|
+
"@dxos/live-object": "0.8.2-main.30e4dbb",
|
|
39
|
+
"@dxos/util": "0.8.2-main.30e4dbb"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@phosphor-icons/react": "^2.1.5",
|
|
43
43
|
"@types/react": "~18.2.0",
|
|
44
44
|
"@types/react-dom": "~18.2.0",
|
|
45
|
-
"effect": "3.
|
|
45
|
+
"effect": "3.14.21",
|
|
46
46
|
"react": "~18.2.0",
|
|
47
47
|
"react-dom": "~18.2.0",
|
|
48
48
|
"vite": "5.4.7",
|
|
49
|
-
"@dxos/random": "0.8.2-main.
|
|
50
|
-
"@dxos/react-ui": "0.8.2-main.
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
49
|
+
"@dxos/random": "0.8.2-main.30e4dbb",
|
|
50
|
+
"@dxos/react-ui": "0.8.2-main.30e4dbb",
|
|
51
|
+
"@dxos/storybook-utils": "0.8.2-main.30e4dbb",
|
|
52
|
+
"@dxos/react-ui-theme": "0.8.2-main.30e4dbb"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@phosphor-icons/react": "^2.1.5",
|
|
56
56
|
"effect": "3.13.3",
|
|
57
57
|
"react": "~18.2.0",
|
|
58
58
|
"react-dom": "~18.2.0",
|
|
59
|
-
"@dxos/react-ui
|
|
60
|
-
"@dxos/react-ui": "0.8.2-main.
|
|
59
|
+
"@dxos/react-ui": "0.8.2-main.30e4dbb",
|
|
60
|
+
"@dxos/react-ui-theme": "0.8.2-main.30e4dbb"
|
|
61
61
|
},
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|
|
@@ -26,9 +26,9 @@ const DefaultStory = () => {
|
|
|
26
26
|
return (
|
|
27
27
|
<Accordion.Root<TestItem> items={items} classNames='w-[40rem]'>
|
|
28
28
|
{({ items }) => (
|
|
29
|
-
<div className='flex flex-col w-full border-y border-
|
|
29
|
+
<div className='flex flex-col w-full border-y border-separator divide-y divide-separator'>
|
|
30
30
|
{items.map((item) => (
|
|
31
|
-
<Accordion.Item key={item.id} item={item} classNames='border-x border-
|
|
31
|
+
<Accordion.Item key={item.id} item={item} classNames='border-x border-separator'>
|
|
32
32
|
<Accordion.ItemHeader>{item.name}</Accordion.ItemHeader>
|
|
33
33
|
<Accordion.ItemBody>
|
|
34
34
|
<p>{item.text}</p>
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
7
|
import { type Meta, type StoryObj } from '@storybook/react';
|
|
8
|
+
import { Schema } from 'effect';
|
|
8
9
|
import React from 'react';
|
|
9
10
|
|
|
10
|
-
import { S } from '@dxos/echo-schema';
|
|
11
11
|
import { live } from '@dxos/live-object';
|
|
12
12
|
import { ghostHover, mx } from '@dxos/react-ui-theme';
|
|
13
13
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
@@ -102,7 +102,7 @@ export const Default: StoryObj<ListRootProps<TestItemType>> = {
|
|
|
102
102
|
render: DefaultStory,
|
|
103
103
|
args: {
|
|
104
104
|
items: list.items,
|
|
105
|
-
isItem:
|
|
105
|
+
isItem: Schema.is(TestItemSchema),
|
|
106
106
|
},
|
|
107
107
|
};
|
|
108
108
|
|
|
@@ -110,6 +110,6 @@ export const Simple: StoryObj<ListRootProps<TestItemType>> = {
|
|
|
110
110
|
render: SimpleStory,
|
|
111
111
|
args: {
|
|
112
112
|
items: list.items,
|
|
113
|
-
isItem:
|
|
113
|
+
isItem: Schema.is(TestItemSchema),
|
|
114
114
|
},
|
|
115
115
|
};
|
|
@@ -2,21 +2,23 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Schema } from 'effect';
|
|
6
|
+
|
|
7
|
+
import { ObjectId } from '@dxos/echo-schema';
|
|
6
8
|
import { faker } from '@dxos/random';
|
|
7
9
|
|
|
8
|
-
export const TestItemSchema =
|
|
9
|
-
id:
|
|
10
|
-
name:
|
|
10
|
+
export const TestItemSchema = Schema.Struct({
|
|
11
|
+
id: ObjectId,
|
|
12
|
+
name: Schema.String,
|
|
11
13
|
});
|
|
12
14
|
|
|
13
|
-
export type TestItemType =
|
|
15
|
+
export type TestItemType = Schema.Schema.Type<typeof TestItemSchema>;
|
|
14
16
|
|
|
15
|
-
export const TestList =
|
|
16
|
-
items:
|
|
17
|
+
export const TestList = Schema.Struct({
|
|
18
|
+
items: Schema.mutable(Schema.Array(TestItemSchema)),
|
|
17
19
|
});
|
|
18
20
|
|
|
19
|
-
export type TestList =
|
|
21
|
+
export type TestList = Schema.Schema.Type<typeof TestList>;
|
|
20
22
|
|
|
21
23
|
export const createList = (n = 10): TestList => ({
|
|
22
24
|
items: faker.helpers.multiple(
|
|
@@ -27,7 +27,7 @@ const state = new Map<string, Live<{ open: boolean; current: boolean }>>();
|
|
|
27
27
|
const meta: Meta<typeof Tree> = {
|
|
28
28
|
title: 'ui/react-ui-list/Tree',
|
|
29
29
|
component: Tree,
|
|
30
|
-
decorators: [withTheme, withLayout(
|
|
30
|
+
decorators: [withTheme, withLayout()],
|
|
31
31
|
render: (args) => {
|
|
32
32
|
useEffect(() => {
|
|
33
33
|
return monitorForElements({
|
|
@@ -10,9 +10,9 @@ import {
|
|
|
10
10
|
type Instruction,
|
|
11
11
|
type ItemMode,
|
|
12
12
|
} from '@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item';
|
|
13
|
+
import { Schema } from 'effect';
|
|
13
14
|
import React, { memo, useCallback, useEffect, useMemo, useRef, useState, type FC, type KeyboardEvent } from 'react';
|
|
14
15
|
|
|
15
|
-
import { S } from '@dxos/echo-schema';
|
|
16
16
|
import { invariant } from '@dxos/invariant';
|
|
17
17
|
import { Treegrid, TreeItem as NaturalTreeItem } from '@dxos/react-ui';
|
|
18
18
|
import {
|
|
@@ -33,15 +33,15 @@ type TreeItemState = 'idle' | 'dragging' | 'preview' | 'parent-of-instruction';
|
|
|
33
33
|
const hoverableDescriptionIcons =
|
|
34
34
|
'[--icons-color:inherit] hover-hover:[--icons-color:var(--description-text)] hover-hover:hover:[--icons-color:inherit] focus-within:[--icons-color:inherit]';
|
|
35
35
|
|
|
36
|
-
export const TreeDataSchema =
|
|
37
|
-
id:
|
|
38
|
-
path:
|
|
39
|
-
item:
|
|
36
|
+
export const TreeDataSchema = Schema.Struct({
|
|
37
|
+
id: Schema.String,
|
|
38
|
+
path: Schema.Array(Schema.String),
|
|
39
|
+
item: Schema.Any,
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
export type TreeData =
|
|
42
|
+
export type TreeData = Schema.Schema.Type<typeof TreeDataSchema>;
|
|
43
43
|
|
|
44
|
-
export const isTreeData = (data: unknown): data is TreeData =>
|
|
44
|
+
export const isTreeData = (data: unknown): data is TreeData => Schema.is(TreeDataSchema)(data);
|
|
45
45
|
|
|
46
46
|
export type TreeItemProps<T = any> = {
|
|
47
47
|
item: T;
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Instruction } from '@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item';
|
|
6
|
+
import { Schema } from 'effect';
|
|
6
7
|
|
|
7
|
-
import {
|
|
8
|
+
import { ObjectId } from '@dxos/echo-schema';
|
|
8
9
|
import { log } from '@dxos/log';
|
|
9
10
|
import { faker } from '@dxos/random';
|
|
10
11
|
|
|
@@ -17,11 +18,11 @@ export type TestItem = {
|
|
|
17
18
|
items: TestItem[];
|
|
18
19
|
};
|
|
19
20
|
|
|
20
|
-
export const TestItemSchema =
|
|
21
|
-
id:
|
|
22
|
-
name:
|
|
23
|
-
icon:
|
|
24
|
-
items:
|
|
21
|
+
export const TestItemSchema = Schema.Struct({
|
|
22
|
+
id: ObjectId,
|
|
23
|
+
name: Schema.String,
|
|
24
|
+
icon: Schema.optional(Schema.String),
|
|
25
|
+
items: Schema.mutable(Schema.Array(Schema.suspend((): Schema.Schema<TestItem> => TestItemSchema))),
|
|
25
26
|
});
|
|
26
27
|
|
|
27
28
|
export const createTree = (n = 4, d = 4): TestItem => ({
|