@dxos/react-ui-list 0.8.2-main.12df754 → 0.8.2-main.2f9c567

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.
@@ -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: S.is(TestItemSchema),
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: S.is(TestItemSchema),
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 { S } from '@dxos/echo-schema';
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 = S.Struct({
9
- id: S.String,
10
- name: S.String,
10
+ export const TestItemSchema = Schema.Struct({
11
+ id: ObjectId,
12
+ name: Schema.String,
11
13
  });
12
14
 
13
- export type TestItemType = S.Schema.Type<typeof TestItemSchema>;
15
+ export type TestItemType = Schema.Schema.Type<typeof TestItemSchema>;
14
16
 
15
- export const TestList = S.Struct({
16
- items: S.mutable(S.Array(TestItemSchema)),
17
+ export const TestList = Schema.Struct({
18
+ items: Schema.mutable(Schema.Array(TestItemSchema)),
17
19
  });
18
20
 
19
- export type TestList = S.Schema.Type<typeof 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(
@@ -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 = S.Struct({
37
- id: S.String,
38
- path: S.Array(S.String),
39
- item: S.Any,
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 = S.Schema.Type<typeof TreeDataSchema>;
42
+ export type TreeData = Schema.Schema.Type<typeof TreeDataSchema>;
43
43
 
44
- export const isTreeData = (data: unknown): data is TreeData => S.is(TreeDataSchema)(data);
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 { S } from '@dxos/echo-schema';
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 = S.Struct({
21
- id: S.String,
22
- name: S.String,
23
- icon: S.optional(S.String),
24
- items: S.mutable(S.Array(S.suspend((): S.Schema<TestItem> => TestItemSchema))),
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 => ({