@dxos/react-ui-form 0.9.1-main.c7dcc2e112 → 0.10.0
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 +1883 -1539
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +1883 -1539
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/annotations.d.ts +47 -0
- package/dist/types/src/annotations.d.ts.map +1 -0
- package/dist/types/src/components/FieldEditor/FieldEditor.d.ts.map +1 -1
- package/dist/types/src/components/Form/Form.d.ts +12 -4
- package/dist/types/src/components/Form/Form.d.ts.map +1 -1
- package/dist/types/src/components/Form/Form.stories.d.ts +46 -65
- package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
- package/dist/types/src/components/Form/Form.theme.d.ts +252 -0
- package/dist/types/src/components/Form/Form.theme.d.ts.map +1 -0
- package/dist/types/src/components/Form/Form.theme.test.d.ts +2 -0
- package/dist/types/src/components/Form/Form.theme.test.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormControls.d.ts +17 -8
- package/dist/types/src/components/Form/FormControls.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormField/FormField.d.ts +16 -2
- package/dist/types/src/components/Form/FormField/FormField.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormField/FormFieldHeader.d.ts +27 -0
- package/dist/types/src/components/Form/FormField/FormFieldHeader.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/FormRow.d.ts +85 -0
- package/dist/types/src/components/Form/FormField/FormRow.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/{FormFieldWrapper.stories.d.ts → FormRow.stories.d.ts} +4 -1
- package/dist/types/src/components/Form/FormField/FormRow.stories.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/ArrayField/ArrayField.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormField/fields/ArrayField/ArrayField.stories.d.ts +1 -0
- package/dist/types/src/components/Form/FormField/fields/ArrayField/ArrayField.stories.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormField/fields/AsyncSelectField/AsyncSelectField.d.ts +12 -0
- package/dist/types/src/components/Form/FormField/fields/AsyncSelectField/AsyncSelectField.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/AsyncSelectField/index.d.ts +2 -0
- package/dist/types/src/components/Form/FormField/fields/AsyncSelectField/index.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/AutofillField/AutofillField.d.ts +12 -0
- package/dist/types/src/components/Form/FormField/fields/AutofillField/AutofillField.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/AutofillField/index.d.ts +2 -0
- package/dist/types/src/components/Form/FormField/fields/AutofillField/index.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/BooleanField/BooleanField.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormField/fields/ComboboxField/ComboboxField.d.ts +12 -0
- package/dist/types/src/components/Form/FormField/fields/ComboboxField/ComboboxField.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/ComboboxField/index.d.ts +2 -0
- package/dist/types/src/components/Form/FormField/fields/ComboboxField/index.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/GeoPointField/GeoPointField.d.ts +1 -1
- package/dist/types/src/components/Form/FormField/fields/GeoPointField/GeoPointField.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormField/fields/MarkdownField/MarkdownField.d.ts +1 -1
- package/dist/types/src/components/Form/FormField/fields/MarkdownField/MarkdownField.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormField/fields/NumberField/NumberField.d.ts +11 -0
- package/dist/types/src/components/Form/FormField/fields/NumberField/NumberField.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormField/fields/NumberField/NumberField.test.d.ts +2 -0
- package/dist/types/src/components/Form/FormField/fields/NumberField/NumberField.test.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/PasswordField/PasswordField.d.ts +4 -0
- package/dist/types/src/components/Form/FormField/fields/PasswordField/PasswordField.d.ts.map +1 -0
- package/dist/types/src/components/{Settings/Settings.stories.d.ts → Form/FormField/fields/PasswordField/PasswordField.stories.d.ts} +1 -2
- package/dist/types/src/components/Form/FormField/fields/PasswordField/PasswordField.stories.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/PasswordField/index.d.ts +2 -0
- package/dist/types/src/components/Form/FormField/fields/PasswordField/index.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormField/fields/RefField/InlineRefField.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormField/fields/RefField/RefField.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormField/fields/SelectField/SelectField.d.ts +18 -2
- package/dist/types/src/components/Form/FormField/fields/SelectField/SelectField.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormField/fields/index.d.ts +4 -0
- package/dist/types/src/components/Form/FormField/fields/index.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormField/index.d.ts +4 -3
- package/dist/types/src/components/Form/FormField/index.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormField/presentation.d.ts +22 -0
- package/dist/types/src/components/Form/FormField/presentation.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormFieldSet/FormFieldSet.d.ts +8 -5
- package/dist/types/src/components/Form/FormFieldSet/FormFieldSet.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormFieldSet/FormFieldSetContainer.d.ts +22 -0
- package/dist/types/src/components/Form/FormFieldSet/FormFieldSetContainer.d.ts.map +1 -0
- package/dist/types/src/components/Form/FormFieldSet/index.d.ts +1 -0
- package/dist/types/src/components/Form/FormFieldSet/index.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormLayout/FormLayout.d.ts +2 -0
- package/dist/types/src/components/Form/FormLayout/FormLayout.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormLayout/FormLayout.stories.d.ts +5 -5
- package/dist/types/src/components/Form/FormLayout/FormLayout.stories.d.ts.map +1 -1
- package/dist/types/src/components/Form/FormLayout/index.d.ts +1 -1
- package/dist/types/src/components/Form/FormLayout/index.d.ts.map +1 -1
- package/dist/types/src/components/Form/meta-tags.d.ts +1 -12
- package/dist/types/src/components/Form/meta-tags.d.ts.map +1 -1
- package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts.map +1 -1
- package/dist/types/src/components/ObjectProperties/ObjectProperties.d.ts +2 -1
- package/dist/types/src/components/ObjectProperties/ObjectProperties.d.ts.map +1 -1
- package/dist/types/src/components/RefEditor/RefEditor.stories.d.ts +2 -2
- package/dist/types/src/components/RefEditor/RefEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
- package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts +2 -2
- package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useAsyncFieldEffect.d.ts +24 -0
- package/dist/types/src/hooks/useAsyncFieldEffect.d.ts.map +1 -0
- package/dist/types/src/hooks/useFormContext.d.ts +8 -3
- package/dist/types/src/hooks/useFormContext.d.ts.map +1 -1
- package/dist/types/src/hooks/useFormHandler.d.ts +8 -2
- package/dist/types/src/hooks/useFormHandler.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/testing/TestLayout.d.ts +1 -1
- package/dist/types/src/testing/TestLayout.d.ts.map +1 -1
- package/dist/types/src/testing/schema.d.ts +13 -16
- package/dist/types/src/testing/schema.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +50 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +0 -1
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/omit.d.ts +1 -1
- package/dist/types/src/util/omit.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +41 -40
- package/src/annotations.ts +63 -0
- package/src/components/FieldEditor/FieldEditor.tsx +5 -2
- package/src/components/Form/DESIGN.md +24 -0
- package/src/components/Form/Form.stories.tsx +257 -13
- package/src/components/Form/Form.theme.test.ts +33 -0
- package/src/components/Form/Form.theme.ts +86 -0
- package/src/components/Form/Form.tsx +15 -9
- package/src/components/Form/FormControls.tsx +94 -37
- package/src/components/Form/FormField/FormField.tsx +83 -32
- package/src/components/Form/FormField/FormFieldHeader.tsx +68 -0
- package/src/components/Form/FormField/{FormFieldWrapper.stories.tsx → FormRow.stories.tsx} +34 -9
- package/src/components/Form/FormField/FormRow.tsx +298 -0
- package/src/components/Form/FormField/fields/ArrayField/ArrayField.stories.tsx +25 -9
- package/src/components/Form/FormField/fields/ArrayField/ArrayField.tsx +83 -24
- package/src/components/Form/FormField/fields/AsyncSelectField/AsyncSelectField.tsx +59 -0
- package/src/components/Form/FormField/fields/AsyncSelectField/index.ts +5 -0
- package/src/components/Form/FormField/fields/AutofillField/AutofillField.tsx +67 -0
- package/src/components/Form/FormField/fields/AutofillField/index.ts +5 -0
- package/src/components/Form/FormField/fields/BooleanField/BooleanField.tsx +5 -6
- package/src/components/Form/FormField/fields/ComboboxField/ComboboxField.tsx +104 -0
- package/src/components/Form/FormField/fields/ComboboxField/index.ts +5 -0
- package/src/components/Form/FormField/fields/DateField/DateField.tsx +9 -9
- package/src/components/Form/FormField/fields/GeoPointField/GeoPointField.tsx +17 -20
- package/src/components/Form/FormField/fields/MarkdownField/MarkdownField.stories.tsx +2 -2
- package/src/components/Form/FormField/fields/MarkdownField/MarkdownField.tsx +39 -40
- package/src/components/Form/FormField/fields/NumberField/NumberField.test.ts +29 -0
- package/src/components/Form/FormField/fields/NumberField/NumberField.tsx +60 -21
- package/src/components/Form/FormField/fields/PasswordField/PasswordField.stories.tsx +53 -0
- package/src/components/Form/FormField/fields/PasswordField/PasswordField.tsx +41 -0
- package/src/components/Form/FormField/fields/PasswordField/index.ts +5 -0
- package/src/components/Form/FormField/fields/RefField/InlineRefField.tsx +16 -10
- package/src/components/Form/FormField/fields/RefField/RefField.test.ts +8 -0
- package/src/components/Form/FormField/fields/RefField/RefField.tsx +50 -23
- package/src/components/Form/FormField/fields/SelectField/SelectField.tsx +104 -47
- package/src/components/Form/FormField/fields/SelectOptionField/SelectOptionField.tsx +3 -3
- package/src/components/Form/FormField/fields/TextAreaField/TextAreaField.tsx +3 -3
- package/src/components/Form/FormField/fields/TextField/TextField.tsx +3 -3
- package/src/components/Form/FormField/fields/TupleField/TupleField.tsx +1 -1
- package/src/components/Form/FormField/fields/index.ts +4 -0
- package/src/components/Form/FormField/index.ts +5 -3
- package/src/components/Form/FormField/presentation.tsx +32 -0
- package/src/components/Form/FormFieldSet/FormFieldSet.tsx +49 -70
- package/src/components/Form/FormFieldSet/FormFieldSetContainer.tsx +93 -0
- package/src/components/Form/FormFieldSet/index.ts +1 -0
- package/src/components/Form/FormLayout/FormLayout.stories.tsx +7 -5
- package/src/components/Form/FormLayout/FormLayout.tsx +24 -14
- package/src/components/Form/FormLayout/index.ts +1 -1
- package/src/components/Form/meta-tags.test.ts +1 -1
- package/src/components/ObjectForm/ObjectForm.tsx +2 -2
- package/src/components/ObjectPicker/ObjectPicker.tsx +1 -0
- package/src/components/ObjectProperties/ObjectProperties.stories.tsx +1 -1
- package/src/components/ObjectProperties/ObjectProperties.tsx +12 -8
- package/src/components/RefEditor/RefEditor.stories.tsx +2 -2
- package/src/components/RefEditor/RefEditor.tsx +1 -1
- package/src/components/ViewEditor/ViewEditor.stories.tsx +2 -2
- package/src/components/ViewEditor/ViewEditor.test.tsx +8 -2
- package/src/components/ViewEditor/ViewEditor.tsx +3 -3
- package/src/components/index.ts +0 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useAsyncFieldEffect.ts +81 -0
- package/src/hooks/useFormContext.ts +6 -3
- package/src/hooks/useFormHandler.ts +11 -6
- package/src/index.ts +1 -0
- package/src/testing/TestLayout.tsx +15 -12
- package/src/testing/schema.ts +43 -43
- package/src/types.ts +53 -1
- package/src/util/index.ts +0 -1
- package/src/util/omit.ts +25 -11
- package/src/util/properties.test.ts +110 -28
- package/src/util/refs.ts +1 -1
- package/dist/types/src/components/Form/FormField/FieldHeader.d.ts +0 -19
- package/dist/types/src/components/Form/FormField/FieldHeader.d.ts.map +0 -1
- package/dist/types/src/components/Form/FormField/FormFieldWrapper.d.ts +0 -47
- package/dist/types/src/components/Form/FormField/FormFieldWrapper.d.ts.map +0 -1
- package/dist/types/src/components/Form/FormField/FormFieldWrapper.stories.d.ts.map +0 -1
- package/dist/types/src/components/Settings/Settings.d.ts +0 -51
- package/dist/types/src/components/Settings/Settings.d.ts.map +0 -1
- package/dist/types/src/components/Settings/Settings.stories.d.ts.map +0 -1
- package/dist/types/src/components/Settings/SettingsFieldSet.d.ts +0 -43
- package/dist/types/src/components/Settings/SettingsFieldSet.d.ts.map +0 -1
- package/dist/types/src/components/Settings/SettingsItem.d.ts +0 -16
- package/dist/types/src/components/Settings/SettingsItem.d.ts.map +0 -1
- package/dist/types/src/components/Settings/SettingsSelectField.d.ts +0 -18
- package/dist/types/src/components/Settings/SettingsSelectField.d.ts.map +0 -1
- package/dist/types/src/components/Settings/index.d.ts +0 -4
- package/dist/types/src/components/Settings/index.d.ts.map +0 -1
- package/dist/types/src/util/field-type.d.ts +0 -19
- package/dist/types/src/util/field-type.d.ts.map +0 -1
- package/src/components/Form/FormField/FieldHeader.tsx +0 -36
- package/src/components/Form/FormField/FormFieldWrapper.tsx +0 -179
- package/src/components/Settings/AUDIT.md +0 -51
- package/src/components/Settings/Settings.stories.tsx +0 -104
- package/src/components/Settings/Settings.tsx +0 -81
- package/src/components/Settings/SettingsFieldSet.tsx +0 -257
- package/src/components/Settings/SettingsItem.tsx +0 -58
- package/src/components/Settings/SettingsSelectField.tsx +0 -59
- package/src/components/Settings/index.ts +0 -7
- package/src/util/field-type.ts +0 -60
|
@@ -2,22 +2,27 @@
|
|
|
2
2
|
// Copyright 2026 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
5
6
|
import * as Schema from 'effect/Schema';
|
|
6
7
|
import * as SchemaAST from 'effect/SchemaAST';
|
|
7
8
|
import { describe, test } from 'vitest';
|
|
8
9
|
|
|
9
|
-
import {
|
|
10
|
+
import { Annotation, DXN, JsonSchema, Type } from '@dxos/echo';
|
|
10
11
|
import { Format } from '@dxos/echo/Format';
|
|
11
12
|
import { SchemaEx } from '@dxos/effect';
|
|
12
13
|
|
|
14
|
+
import { AutofillAnnotation, OptionsLookupAnnotation, autofill, optionsLookup } from '../annotations';
|
|
15
|
+
import { omitId } from './omit';
|
|
13
16
|
import { getFormProperties, getRootFormProperties } from './properties';
|
|
14
17
|
|
|
15
18
|
describe('getFormProperties', () => {
|
|
16
19
|
test('filters out keyword fields annotated FormInputAnnotation.set(false)', ({ expect }) => {
|
|
17
|
-
const TestSchema =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
const TestSchema = Type.makeObject(DXN.make('org.dxos.test.keywordHidden', '0.1.0'))(
|
|
21
|
+
Schema.Struct({
|
|
22
|
+
name: Schema.optional(Schema.String),
|
|
23
|
+
hidden: Schema.String.pipe(Annotation.FormInputAnnotation.set(false)),
|
|
24
|
+
}),
|
|
25
|
+
);
|
|
21
26
|
|
|
22
27
|
const names = getFormProperties(Type.getSchema(TestSchema).ast).map((prop) => prop.name);
|
|
23
28
|
expect(names).toContain('name');
|
|
@@ -28,10 +33,12 @@ describe('getFormProperties', () => {
|
|
|
28
33
|
// Regression: JsonSchema fields are a Schema.Struct; encodedBoundAST strips
|
|
29
34
|
// annotations from non-keyword inner types, which previously bypassed the
|
|
30
35
|
// form-input filter (e.g., Routine.input).
|
|
31
|
-
const TestSchema =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
const TestSchema = Type.makeObject(DXN.make('org.dxos.test.structHidden', '0.1.0'))(
|
|
37
|
+
Schema.Struct({
|
|
38
|
+
name: Schema.optional(Schema.String),
|
|
39
|
+
schema: JsonSchema.JsonSchema.pipe(Annotation.FormInputAnnotation.set(false)),
|
|
40
|
+
}),
|
|
41
|
+
);
|
|
35
42
|
|
|
36
43
|
const names = getFormProperties(Type.getSchema(TestSchema).ast).map((prop) => prop.name);
|
|
37
44
|
expect(names).toContain('name');
|
|
@@ -39,10 +46,12 @@ describe('getFormProperties', () => {
|
|
|
39
46
|
});
|
|
40
47
|
|
|
41
48
|
test('filters out array fields annotated FormInputAnnotation.set(false)', ({ expect }) => {
|
|
42
|
-
const TestSchema =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
const TestSchema = Type.makeObject(DXN.make('org.dxos.test.arrayHidden', '0.1.0'))(
|
|
50
|
+
Schema.Struct({
|
|
51
|
+
name: Schema.optional(Schema.String),
|
|
52
|
+
context: Schema.Array(Schema.Any).pipe(Annotation.FormInputAnnotation.set(false)),
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
46
55
|
|
|
47
56
|
const names = getFormProperties(Type.getSchema(TestSchema).ast).map((prop) => prop.name);
|
|
48
57
|
expect(names).toContain('name');
|
|
@@ -54,10 +63,12 @@ describe('getFormProperties', () => {
|
|
|
54
63
|
// annotation lives on the inner `T`. Without unwrapping, the filter would
|
|
55
64
|
// miss the annotation and the hidden field would render. Covers the
|
|
56
65
|
// conventional pattern `Schema.X.pipe(FormInputAnnotation.set(false), Schema.optional)`.
|
|
57
|
-
const TestSchema =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
66
|
+
const TestSchema = Type.makeObject(DXN.make('org.dxos.test.optionalHidden', '0.1.0'))(
|
|
67
|
+
Schema.Struct({
|
|
68
|
+
name: Schema.optional(Schema.String),
|
|
69
|
+
userId: Schema.String.pipe(Annotation.FormInputAnnotation.set(false), Schema.optional),
|
|
70
|
+
}),
|
|
71
|
+
);
|
|
61
72
|
|
|
62
73
|
const names = getFormProperties(Type.getSchema(TestSchema).ast).map((prop) => prop.name);
|
|
63
74
|
expect(names).toContain('name');
|
|
@@ -75,12 +86,14 @@ describe('getFormProperties', () => {
|
|
|
75
86
|
geometry: Schema.Array(Format.GeoPoint).pipe(Annotation.FormInputAnnotation.set(false)),
|
|
76
87
|
});
|
|
77
88
|
const Route = Schema.Struct({ legs: Schema.Array(Leg) });
|
|
78
|
-
const TestSchema =
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
89
|
+
const TestSchema = Type.makeObject(DXN.make('org.dxos.test.nestedHidden', '0.1.0'))(
|
|
90
|
+
Schema.Struct({
|
|
91
|
+
details: Schema.Union(
|
|
92
|
+
Schema.TaggedStruct('road', { routes: Schema.optional(Schema.Array(Route)) }),
|
|
93
|
+
Schema.TaggedStruct('other', { note: Schema.optional(Schema.String) }),
|
|
94
|
+
),
|
|
95
|
+
}),
|
|
96
|
+
);
|
|
84
97
|
|
|
85
98
|
// Drill as the form does: getFormProperties at each level, descending via the property type
|
|
86
99
|
// (array element / type literal) returned by the previous level.
|
|
@@ -110,12 +123,14 @@ describe('getFormProperties', () => {
|
|
|
110
123
|
test('preserves annotation when chained with .annotations()', ({ expect }) => {
|
|
111
124
|
// Regression: `.pipe(FormInputAnnotation.set(false)).annotations({...})` must
|
|
112
125
|
// not lose the form-input annotation.
|
|
113
|
-
const TestSchema =
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
126
|
+
const TestSchema = Type.makeObject(DXN.make('org.dxos.test.chainedHidden', '0.1.0'))(
|
|
127
|
+
Schema.Struct({
|
|
128
|
+
name: Schema.optional(Schema.String),
|
|
129
|
+
hidden: JsonSchema.JsonSchema.pipe(Annotation.FormInputAnnotation.set(false)).annotations({
|
|
130
|
+
description: 'Hidden field',
|
|
131
|
+
}),
|
|
117
132
|
}),
|
|
118
|
-
|
|
133
|
+
);
|
|
119
134
|
|
|
120
135
|
const names = getFormProperties(Type.getSchema(TestSchema).ast).map((prop) => prop.name);
|
|
121
136
|
expect(names).toContain('name');
|
|
@@ -150,4 +165,71 @@ describe('getRootFormProperties', () => {
|
|
|
150
165
|
test('falls back to the discriminator alone when no value selects a member', ({ expect }) => {
|
|
151
166
|
expect(getRootFormProperties(Union.ast, {}).map((prop) => prop.name)).toEqual(['kind']);
|
|
152
167
|
});
|
|
168
|
+
|
|
169
|
+
describe('magazine-shaped union (base struct + spread + piped dynamic annotations + Format.URL)', () => {
|
|
170
|
+
const StandardSiteBase = Schema.Struct({
|
|
171
|
+
type: Schema.Literal('standard-site'),
|
|
172
|
+
handle: Schema.String,
|
|
173
|
+
publication: Schema.String,
|
|
174
|
+
name: Schema.optional(Schema.String),
|
|
175
|
+
});
|
|
176
|
+
type StandardSiteValues = Schema.Schema.Type<typeof StandardSiteBase>;
|
|
177
|
+
const StandardSite = Schema.Struct({
|
|
178
|
+
...StandardSiteBase.fields,
|
|
179
|
+
handle: StandardSiteBase.fields.handle.pipe(
|
|
180
|
+
OptionsLookupAnnotation.set(
|
|
181
|
+
optionsLookup<StandardSiteValues>()(['handle'], () => Effect.succeed([]), { combobox: true }),
|
|
182
|
+
),
|
|
183
|
+
),
|
|
184
|
+
publication: StandardSiteBase.fields.publication.pipe(
|
|
185
|
+
OptionsLookupAnnotation.set(optionsLookup<StandardSiteValues>()(['handle'], () => Effect.succeed([]))),
|
|
186
|
+
),
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
const RssBase = Schema.Struct({
|
|
190
|
+
type: Schema.Literal('rss'),
|
|
191
|
+
url: Format.URL,
|
|
192
|
+
name: Schema.optional(Schema.String),
|
|
193
|
+
});
|
|
194
|
+
type RssValues = Schema.Schema.Type<typeof RssBase>;
|
|
195
|
+
const Rss = Schema.Struct({
|
|
196
|
+
...RssBase.fields,
|
|
197
|
+
name: Schema.optional(
|
|
198
|
+
Schema.String.pipe(AutofillAnnotation.set(autofill<RssValues>()(['url'], () => Effect.succeed(undefined)))),
|
|
199
|
+
),
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
const CreateUnion = Schema.Union(StandardSite, Rss);
|
|
203
|
+
|
|
204
|
+
test('expands to the standard-site member fields', ({ expect }) => {
|
|
205
|
+
expect(getRootFormProperties(CreateUnion.ast, { type: 'standard-site' }).map((prop) => prop.name)).toEqual([
|
|
206
|
+
'type',
|
|
207
|
+
'handle',
|
|
208
|
+
'publication',
|
|
209
|
+
'name',
|
|
210
|
+
]);
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
test('expands to the rss member fields', ({ expect }) => {
|
|
214
|
+
expect(getRootFormProperties(CreateUnion.ast, { type: 'rss' }).map((prop) => prop.name)).toEqual([
|
|
215
|
+
'type',
|
|
216
|
+
'url',
|
|
217
|
+
'name',
|
|
218
|
+
]);
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
test('shows only the discriminator before a type is selected', ({ expect }) => {
|
|
222
|
+
expect(getRootFormProperties(CreateUnion.ast, {}).map((prop) => prop.name)).toEqual(['type']);
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
test('survives omitId (applied by CreateObjectPanel) — union discriminant must be preserved', ({ expect }) => {
|
|
226
|
+
const omitted = omitId(CreateUnion);
|
|
227
|
+
expect(getRootFormProperties(omitted.ast, { type: 'standard-site' }).map((prop) => prop.name)).toEqual([
|
|
228
|
+
'type',
|
|
229
|
+
'handle',
|
|
230
|
+
'publication',
|
|
231
|
+
'name',
|
|
232
|
+
]);
|
|
233
|
+
});
|
|
234
|
+
});
|
|
153
235
|
});
|
package/src/util/refs.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import type * as SchemaAST from 'effect/SchemaAST';
|
|
6
6
|
|
|
7
7
|
import { Ref } from '@dxos/echo';
|
|
8
|
-
import { type ReferenceAnnotationValue
|
|
8
|
+
import { ReferenceAnnotationId, type ReferenceAnnotationValue } from '@dxos/echo/Annotation';
|
|
9
9
|
import { SchemaEx } from '@dxos/effect';
|
|
10
10
|
|
|
11
11
|
type RefProps = {
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export type FieldHeaderProps = {
|
|
3
|
-
label: string;
|
|
4
|
-
/** JSON path forwarded to the label as field metadata. */
|
|
5
|
-
path?: string;
|
|
6
|
-
readonly?: boolean;
|
|
7
|
-
/** Trailing inline add affordance; omit to hide it. */
|
|
8
|
-
add?: {
|
|
9
|
-
icon?: string;
|
|
10
|
-
label: string;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
onClick: () => void;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Header row for an array/list field: a label with an optional inline add button.
|
|
17
|
-
*/
|
|
18
|
-
export declare const FieldHeader: ({ label, path, readonly, add }: FieldHeaderProps) => React.JSX.Element;
|
|
19
|
-
//# sourceMappingURL=FieldHeader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FieldHeader.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/FormField/FieldHeader.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uDAAuD;IACvD,GAAG,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;CACjF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,mCAAoC,gBAAgB,sBAc3E,CAAC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React, { Component, type PropsWithChildren, type ReactNode } from 'react';
|
|
2
|
-
import { ThemedClassName } from '@dxos/react-ui';
|
|
3
|
-
import { type FormFieldRendererProps } from '#types';
|
|
4
|
-
export type FormFieldLabelProps = ThemedClassName<{
|
|
5
|
-
/** Render a plain `<span>` instead of an input-associated `Input.Label`, for labels used outside an `Input.Root` (e.g. section/group headers). */
|
|
6
|
-
standalone?: boolean;
|
|
7
|
-
error?: string;
|
|
8
|
-
/**
|
|
9
|
-
* JSON path of the field this label describes (e.g. `runtime.client.storage.persistent`).
|
|
10
|
-
* Field metadata; accepted by callers but not currently rendered.
|
|
11
|
-
*/
|
|
12
|
-
path?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Trailing button rendered at the end of the label row (third grid column).
|
|
15
|
-
* Used by nested-object field sets to surface a collapse toggle.
|
|
16
|
-
*/
|
|
17
|
-
button?: ReactNode;
|
|
18
|
-
onClick?: () => void;
|
|
19
|
-
} & Pick<FormFieldRendererProps, 'label' | 'readonly'>>;
|
|
20
|
-
export declare function FormFieldLabel({ classNames, label, error, readonly, standalone, button, onClick }: FormFieldLabelProps): React.JSX.Element;
|
|
21
|
-
export declare namespace FormFieldLabel {
|
|
22
|
-
var displayName: string;
|
|
23
|
-
}
|
|
24
|
-
export type FormFieldWrapperProps<T = any> = Pick<FormFieldRendererProps, 'readonly' | 'label' | 'layout' | 'getStatus' | 'getValue' | 'jsonPath' | 'format'> & {
|
|
25
|
-
children?: (props: {
|
|
26
|
-
value: T;
|
|
27
|
-
}) => ReactNode;
|
|
28
|
-
};
|
|
29
|
-
export declare const FormFieldWrapper: <T>(props: FormFieldWrapperProps<T>) => React.JSX.Element | null;
|
|
30
|
-
type FormFieldErrorState = {
|
|
31
|
-
error: Error | undefined;
|
|
32
|
-
};
|
|
33
|
-
type FormFieldErrorBoundaryProps = PropsWithChildren<{
|
|
34
|
-
path?: (string | number)[];
|
|
35
|
-
}>;
|
|
36
|
-
export declare class FormFieldErrorBoundary extends Component<FormFieldErrorBoundaryProps, FormFieldErrorState> {
|
|
37
|
-
static getDerivedStateFromError(error: Error): {
|
|
38
|
-
error: Error;
|
|
39
|
-
};
|
|
40
|
-
state: {
|
|
41
|
-
error: undefined;
|
|
42
|
-
};
|
|
43
|
-
componentDidUpdate(prevProps: FormFieldErrorBoundaryProps): void;
|
|
44
|
-
render(): string | number | bigint | boolean | React.JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | React.ReactPortal | null | undefined> | null | undefined;
|
|
45
|
-
private resetError;
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=FormFieldWrapper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormFieldWrapper.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/FormField/FormFieldWrapper.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGjF,OAAO,EAA+B,eAAe,EAAW,MAAM,gBAAgB,CAAC;AAGvF,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAMrD,MAAM,MAAM,mBAAmB,GAAG,eAAe,CAC/C;IACE,kJAAkJ;IAClJ,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,GAAG,IAAI,CAAC,sBAAsB,EAAE,OAAO,GAAG,UAAU,CAAC,CACvD,CAAC;uCAE6B,EAC7B,UAAU,EACV,KAAK,EACL,KAAK,EACL,QAAQ,EACR,UAAU,EACV,MAAM,EACN,OAAO,EACR,EAAE,mBAAmB;;;;AAsDtB,MAAM,MAAM,qBAAqB,CAAC,CAAC,GAAG,GAAG,IAAI,IAAI,CAC/C,sBAAsB,EACtB,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,CACnF,GAAG;IACF,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,CAAC,CAAA;KAAE,KAAK,SAAS,CAAC;CAC/C,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAU,qBAAqB,CAAC,CAAC,CAAC,6BA8BnE,CAAC;AAMF,KAAK,mBAAmB,GAAG;IACzB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;CAC1B,CAAC;AAEF,KAAK,2BAA2B,GAAG,iBAAiB,CAAC;IACnD,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;CAC5B,CAAC,CAAC;AAEH,qBAAa,sBAAuB,SAAQ,SAAS,CAAC,2BAA2B,EAAE,mBAAmB,CAAC;IACrG,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG;QAAE,KAAK,EAAE,KAAK,CAAA;KAAE,CAE9D;IAEQ,KAAK;QAAK,KAAK;MAAc;IAE7B,kBAAkB,CAAC,SAAS,EAAE,2BAA2B,QAIjE;IAEQ,MAAM,wRAWd;IAED,OAAO,CAAC,UAAU;CAGnB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FormFieldWrapper.stories.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Form/FormField/FormFieldWrapper.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAwC,MAAM,OAAO,CAAC;AAK7D,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAKrD,QAAA,MAAM,YAAY,qEAOf,sBAAsB,CAAC,MAAM,CAAC,sBA0BhC,CAAC;AAEF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,YAAY,CAOnC,CAAC;eAEa,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAQrB,CAAC"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import React, { type PropsWithChildren } from 'react';
|
|
2
|
-
import { type Label, type ThemedClassName } from '@dxos/react-ui';
|
|
3
|
-
type SettingsRootProps = ThemedClassName<PropsWithChildren>;
|
|
4
|
-
declare function SettingsRoot({ children, classNames }: SettingsRootProps): React.JSX.Element;
|
|
5
|
-
declare namespace SettingsRoot {
|
|
6
|
-
var displayName: string;
|
|
7
|
-
}
|
|
8
|
-
type SettingsSectionProps = PropsWithChildren<{
|
|
9
|
-
title: Label;
|
|
10
|
-
description?: Label;
|
|
11
|
-
}>;
|
|
12
|
-
declare function SettingsSection({ title, description, children }: SettingsSectionProps): React.JSX.Element;
|
|
13
|
-
declare namespace SettingsSection {
|
|
14
|
-
var displayName: string;
|
|
15
|
-
}
|
|
16
|
-
export declare const Settings: {
|
|
17
|
-
Root: {
|
|
18
|
-
({ children, classNames }: SettingsRootProps): React.JSX.Element;
|
|
19
|
-
displayName: string;
|
|
20
|
-
};
|
|
21
|
-
Viewport: React.ForwardRefExoticComponent<Omit<{}, "className"> & {
|
|
22
|
-
classNames?: import("@dxos/ui-types").ClassNameValue;
|
|
23
|
-
} & Pick<React.HTMLAttributes<Element>, "children" | "className" | "role" | "style"> & React.RefAttributes<HTMLDivElement>>;
|
|
24
|
-
Section: {
|
|
25
|
-
({ title, description, children }: SettingsSectionProps): React.JSX.Element;
|
|
26
|
-
displayName: string;
|
|
27
|
-
};
|
|
28
|
-
Panel: {
|
|
29
|
-
({ classNames, children }: Omit<{
|
|
30
|
-
children?: React.ReactNode | undefined;
|
|
31
|
-
}, "className"> & {
|
|
32
|
-
classNames?: import("@dxos/ui-types").ClassNameValue;
|
|
33
|
-
}): React.JSX.Element;
|
|
34
|
-
displayName: string;
|
|
35
|
-
};
|
|
36
|
-
Item: {
|
|
37
|
-
({ title, description, children }: {
|
|
38
|
-
title: Label;
|
|
39
|
-
description?: Label;
|
|
40
|
-
} & {
|
|
41
|
-
children?: React.ReactNode | undefined;
|
|
42
|
-
}): React.JSX.Element;
|
|
43
|
-
displayName: string;
|
|
44
|
-
};
|
|
45
|
-
FieldSet: {
|
|
46
|
-
<T extends Record<string, any>>({ schema, values, onValuesChanged, readonly, fieldMap, visible, sort, pathPrefix, }: import("./SettingsFieldSet").SettingsFieldSetProps<T>): React.JSX.Element;
|
|
47
|
-
displayName: string;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
export {};
|
|
51
|
-
//# sourceMappingURL=Settings.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.d.ts","sourceRoot":"","sources":["../../../../../src/components/Settings/Settings.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAE,KAAK,KAAK,EAAc,KAAK,eAAe,EAAqC,MAAM,gBAAgB,CAAC;AAiBjH,KAAK,iBAAiB,GAAG,eAAe,CAAC,iBAAiB,CAAC,CAAC;8BAEtC,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,iBAAiB;;;;AA0BjE,KAAK,oBAAoB,GAAG,iBAAiB,CAAC;IAC5C,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,CAAC,EAAE,KAAK,CAAC;CACrB,CAAC,CAAC;iCAEsB,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,oBAAoB;;;;AAiB/E,eAAO,MAAM,QAAQ;IACnB,IAAI;mCAjD0C,iBAAiB;;;IAkD/D,QAAQ;;;IACR,OAAO;2CApBkD,oBAAoB;;;IAqB7E,KAAK;;;;;;;;IACL,IAAI;;;;;;;;;IACJ,QAAQ;;;;CACT,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Settings/Settings.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAoC1B,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQM,CAAC;eAEF,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AA6CjC,eAAO,MAAM,QAAQ,EAAE,KAEtB,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import * as SchemaAST from 'effect/SchemaAST';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
/**
|
|
4
|
-
* Props for a custom field renderer.
|
|
5
|
-
* The renderer provides the control only; SettingsItem wrapper is handled by FieldSet.
|
|
6
|
-
*/
|
|
7
|
-
export type SettingsFieldProps<T = any> = {
|
|
8
|
-
value: T;
|
|
9
|
-
onChange: (value: T) => void;
|
|
10
|
-
readonly?: boolean;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Map of property names to either a custom field renderer or a nested field map for struct fields.
|
|
14
|
-
* When a value type `T` is provided, the map shape is checked against the schema's value type.
|
|
15
|
-
*/
|
|
16
|
-
export type SettingsFieldMap<T extends Record<string, any> = Record<string, any>> = {
|
|
17
|
-
[K in keyof T]?: NonNullable<T[K]> extends Record<string, any> ? SettingsFieldMap<NonNullable<T[K]>> : React.FC<SettingsFieldProps<T[K]>>;
|
|
18
|
-
};
|
|
19
|
-
export type SettingsFieldSetProps<T extends Record<string, any> = Record<string, any>> = {
|
|
20
|
-
/** Effect Schema for the settings object. */
|
|
21
|
-
schema: {
|
|
22
|
-
ast: SchemaAST.AST;
|
|
23
|
-
};
|
|
24
|
-
/** Current settings values. */
|
|
25
|
-
values: T;
|
|
26
|
-
/** Callback when any value changes. Receives a new complete object. */
|
|
27
|
-
onValuesChanged?: (values: T) => void;
|
|
28
|
-
/** When true, all controls are disabled. */
|
|
29
|
-
readonly?: boolean;
|
|
30
|
-
/** Map of property names to custom field renderers. Nested objects map to struct sub-fields. */
|
|
31
|
-
fieldMap?: SettingsFieldMap<T>;
|
|
32
|
-
/** Control field visibility. Receives the dotted path (e.g. `'modelDefaults.edge'`) at every level. */
|
|
33
|
-
visible?: (path: string, values: T) => boolean;
|
|
34
|
-
/** Override the order of fields. Fields not listed are appended in schema order. Applied per scope. */
|
|
35
|
-
sort?: string[];
|
|
36
|
-
/** Internal: dot-path prefix used by recursive struct rendering. */
|
|
37
|
-
pathPrefix?: string;
|
|
38
|
-
};
|
|
39
|
-
export declare function SettingsFieldSet<T extends Record<string, any>>({ schema, values, onValuesChanged, readonly, fieldMap, visible, sort, pathPrefix }: SettingsFieldSetProps<T>): React.JSX.Element;
|
|
40
|
-
export declare namespace SettingsFieldSet {
|
|
41
|
-
var displayName: string;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=SettingsFieldSet.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsFieldSet.d.ts","sourceRoot":"","sources":["../../../../../src/components/Settings/SettingsFieldSet.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAC;AAE9C,OAAO,KAA+B,MAAM,OAAO,CAAC;AAYpD;;;GAGG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,GAAG,GAAG,IAAI;IACxC,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI;KACjF,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC1D,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACnC,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI;IACvF,6CAA6C;IAC7C,MAAM,EAAE;QAAE,GAAG,EAAE,SAAS,CAAC,GAAG,CAAA;KAAE,CAAC;IAE/B,+BAA+B;IAC/B,MAAM,EAAE,CAAC,CAAC;IAEV,uEAAuE;IACvE,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;IAEtC,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,gGAAgG;IAChG,QAAQ,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAE/B,uGAAuG;IACvG,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC;IAE/C,uGAAuG;IACvG,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;yCAM+B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EAC9D,MAAM,EACN,MAAM,EACN,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,UAAe,EAChB,EAAE,qBAAqB,CAAC,CAAC,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React, { type PropsWithChildren } from 'react';
|
|
2
|
-
import { type Label, type ThemedClassName } from '@dxos/react-ui';
|
|
3
|
-
type SettingsPanelProps = ThemedClassName<PropsWithChildren>;
|
|
4
|
-
export declare function SettingsPanel({ classNames, children }: SettingsPanelProps): React.JSX.Element;
|
|
5
|
-
export declare namespace SettingsPanel {
|
|
6
|
-
var displayName: string;
|
|
7
|
-
}
|
|
8
|
-
type SettingsItemProps = PropsWithChildren<{
|
|
9
|
-
title: Label;
|
|
10
|
-
description?: Label;
|
|
11
|
-
}>;
|
|
12
|
-
export declare function SettingsItem({ title, description, children }: SettingsItemProps): React.JSX.Element;
|
|
13
|
-
export declare namespace SettingsItem {
|
|
14
|
-
var displayName: string;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=SettingsItem.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/Settings/SettingsItem.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAS,KAAK,KAAK,EAAE,KAAK,eAAe,EAAqC,MAAM,gBAAgB,CAAC;AAY5G,KAAK,kBAAkB,GAAG,eAAe,CAAC,iBAAiB,CAAC,CAAC;sCAE/B,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,kBAAkB;;;;AAY1E,KAAK,iBAAiB,GAAG,iBAAiB,CAAC;IACzC,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,CAAC,EAAE,KAAK,CAAC;CACrB,CAAC,CAAC;qCAE0B,EAAE,KAAK,EAAE,WAAgB,EAAE,QAAQ,EAAE,EAAE,iBAAiB"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type SettingsFieldProps } from './SettingsFieldSet';
|
|
3
|
-
export type SelectFieldOption = {
|
|
4
|
-
value: string;
|
|
5
|
-
label?: string;
|
|
6
|
-
};
|
|
7
|
-
export type CreateSelectFieldOptions = {
|
|
8
|
-
/** Options to display. Strings are used as both value and label. */
|
|
9
|
-
options: ReadonlyArray<string | SelectFieldOption>;
|
|
10
|
-
/** Label for the sentinel option that maps to `undefined`. Defaults to `'Default'`. Pass `null` to omit. */
|
|
11
|
-
defaultLabel?: string | null;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Factory for a `SettingsFieldSet` `fieldMap` entry that renders a Select control
|
|
15
|
-
* over a fixed list of options, with an optional sentinel for `undefined`.
|
|
16
|
-
*/
|
|
17
|
-
export declare const createSelectField: ({ options, defaultLabel, }: CreateSelectFieldOptions) => React.FC<SettingsFieldProps<string | undefined>>;
|
|
18
|
-
//# sourceMappingURL=SettingsSelectField.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsSelectField.d.ts","sourceRoot":"","sources":["../../../../../src/components/Settings/SettingsSelectField.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,oEAAoE;IACpE,OAAO,EAAE,aAAa,CAAC,MAAM,GAAG,iBAAiB,CAAC,CAAC;IACnD,4GAA4G;IAC5G,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,+BAG3B,wBAAwB,KAAG,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAAC,MAAM,GAAG,SAAS,CAAC,CA6B5E,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export * from './Settings';
|
|
2
|
-
export { type SettingsFieldMap, type SettingsFieldProps, type SettingsFieldSetProps } from './SettingsFieldSet';
|
|
3
|
-
export { createSelectField, type CreateSelectFieldOptions, type SelectFieldOption } from './SettingsSelectField';
|
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Settings/index.ts"],"names":[],"mappings":"AAIA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,kBAAkB,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChH,OAAO,EAAE,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as SchemaAST from 'effect/SchemaAST';
|
|
2
|
-
/**
|
|
3
|
-
* Detected field type for a schema property.
|
|
4
|
-
*/
|
|
5
|
-
export type SettingsFieldType = 'boolean' | 'string' | 'number' | 'select' | 'struct';
|
|
6
|
-
export type SelectOption = {
|
|
7
|
-
value: string | number;
|
|
8
|
-
label?: string;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Detect the field type from an Effect Schema AST node.
|
|
12
|
-
*/
|
|
13
|
-
export declare const detectFieldType: (ast: SchemaAST.AST) => SettingsFieldType | undefined;
|
|
14
|
-
/**
|
|
15
|
-
* Extract select options from a literal union AST node.
|
|
16
|
-
* Reads title annotations from individual literals for labels.
|
|
17
|
-
*/
|
|
18
|
-
export declare const getSelectOptionsFromAst: (ast: SchemaAST.AST) => SelectOption[] | undefined;
|
|
19
|
-
//# sourceMappingURL=field-type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"field-type.d.ts","sourceRoot":"","sources":["../../../../src/util/field-type.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAC;AAI9C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEtF,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,QAAS,SAAS,CAAC,GAAG,KAAG,iBAAiB,GAAG,SAkBxE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,QAAS,SAAS,CAAC,GAAG,KAAG,YAAY,EAAE,GAAG,SAc7E,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2026 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { CompactIconButton } from './FormField';
|
|
8
|
-
import { FormFieldLabel } from './FormFieldWrapper';
|
|
9
|
-
|
|
10
|
-
export type FieldHeaderProps = {
|
|
11
|
-
label: string;
|
|
12
|
-
/** JSON path forwarded to the label as field metadata. */
|
|
13
|
-
path?: string;
|
|
14
|
-
readonly?: boolean;
|
|
15
|
-
/** Trailing inline add affordance; omit to hide it. */
|
|
16
|
-
add?: { icon?: string; label: string; disabled?: boolean; onClick: () => void };
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Header row for an array/list field: a label with an optional inline add button.
|
|
21
|
-
*/
|
|
22
|
-
export const FieldHeader = ({ label, path, readonly, add }: FieldHeaderProps) => (
|
|
23
|
-
<div className='flex items-center gap-2'>
|
|
24
|
-
<div className='flex-1 min-w-0'>
|
|
25
|
-
<FormFieldLabel readonly={readonly} label={label} path={path} standalone />
|
|
26
|
-
</div>
|
|
27
|
-
{!readonly && add && (
|
|
28
|
-
<CompactIconButton
|
|
29
|
-
disabled={add.disabled}
|
|
30
|
-
icon={add.icon ?? 'ph--plus--regular'}
|
|
31
|
-
label={add.label}
|
|
32
|
-
onClick={add.onClick}
|
|
33
|
-
/>
|
|
34
|
-
)}
|
|
35
|
-
</div>
|
|
36
|
-
);
|