@dxos/react-ui-form 0.8.4-main.937b3ca → 0.8.4-main.9be5663bfe

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.
Files changed (113) hide show
  1. package/README.md +0 -1
  2. package/dist/lib/browser/index.mjs +1003 -668
  3. package/dist/lib/browser/index.mjs.map +4 -4
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/node-esm/index.mjs +1003 -668
  6. package/dist/lib/node-esm/index.mjs.map +4 -4
  7. package/dist/lib/node-esm/meta.json +1 -1
  8. package/dist/types/src/components/FieldEditor/FieldEditor.d.ts +3 -3
  9. package/dist/types/src/components/FieldEditor/FieldEditor.d.ts.map +1 -1
  10. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts +62 -61
  11. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts.map +1 -1
  12. package/dist/types/src/components/Form/Form.d.ts +23 -18
  13. package/dist/types/src/components/Form/Form.d.ts.map +1 -1
  14. package/dist/types/src/components/Form/Form.stories.d.ts +68 -67
  15. package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
  16. package/dist/types/src/components/Form/FormField.d.ts +7 -1
  17. package/dist/types/src/components/Form/FormField.d.ts.map +1 -1
  18. package/dist/types/src/components/Form/FormFieldComponent.d.ts +0 -1
  19. package/dist/types/src/components/Form/FormFieldComponent.d.ts.map +1 -1
  20. package/dist/types/src/components/Form/FormFieldComponent.stories.d.ts +2 -2
  21. package/dist/types/src/components/Form/FormFieldComponent.stories.d.ts.map +1 -1
  22. package/dist/types/src/components/Form/FormFieldSet.d.ts +9 -10
  23. package/dist/types/src/components/Form/FormFieldSet.d.ts.map +1 -1
  24. package/dist/types/src/components/Form/fields/ArrayField.d.ts.map +1 -1
  25. package/dist/types/src/components/Form/fields/RefField.d.ts +8 -6
  26. package/dist/types/src/components/Form/fields/RefField.d.ts.map +1 -1
  27. package/dist/types/src/components/Form/fields/SelectOptionField.d.ts.map +1 -1
  28. package/dist/types/src/components/Form/fields/SelectOptionField.stories.d.ts +62 -61
  29. package/dist/types/src/components/Form/fields/SelectOptionField.stories.d.ts.map +1 -1
  30. package/dist/types/src/components/ObjectForm/ObjectForm.d.ts +9 -0
  31. package/dist/types/src/components/ObjectForm/ObjectForm.d.ts.map +1 -0
  32. package/dist/types/src/components/ObjectForm/index.d.ts +2 -0
  33. package/dist/types/src/components/ObjectForm/index.d.ts.map +1 -0
  34. package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts +10 -2
  35. package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts.map +1 -1
  36. package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts +62 -61
  37. package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts.map +1 -1
  38. package/dist/types/src/components/ObjectProperties/ObjectProperties.d.ts +9 -0
  39. package/dist/types/src/components/ObjectProperties/ObjectProperties.d.ts.map +1 -0
  40. package/dist/types/src/components/ObjectProperties/ObjectProperties.stories.d.ts +83 -0
  41. package/dist/types/src/components/ObjectProperties/ObjectProperties.stories.d.ts.map +1 -0
  42. package/dist/types/src/components/ObjectProperties/index.d.ts +2 -0
  43. package/dist/types/src/components/ObjectProperties/index.d.ts.map +1 -0
  44. package/dist/types/src/components/Settings/Settings.d.ts +35 -0
  45. package/dist/types/src/components/Settings/Settings.d.ts.map +1 -0
  46. package/dist/types/src/components/Settings/Settings.stories.d.ts +82 -0
  47. package/dist/types/src/components/Settings/Settings.stories.d.ts.map +1 -0
  48. package/dist/types/src/components/Settings/index.d.ts +2 -0
  49. package/dist/types/src/components/Settings/index.d.ts.map +1 -0
  50. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts +5 -5
  51. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
  52. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts +66 -64
  53. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
  54. package/dist/types/src/components/index.d.ts +3 -1
  55. package/dist/types/src/components/index.d.ts.map +1 -1
  56. package/dist/types/src/components/testing.d.ts.map +1 -1
  57. package/dist/types/src/hooks/useFormHandler.d.ts.map +1 -1
  58. package/dist/types/src/hooks/useKeyHandler.d.ts +2 -1
  59. package/dist/types/src/hooks/useKeyHandler.d.ts.map +1 -1
  60. package/dist/types/src/translations.d.ts +62 -61
  61. package/dist/types/src/translations.d.ts.map +1 -1
  62. package/dist/types/src/util/refs.d.ts +1 -0
  63. package/dist/types/src/util/refs.d.ts.map +1 -1
  64. package/dist/types/tsconfig.tsbuildinfo +1 -1
  65. package/package.json +37 -38
  66. package/src/components/FieldEditor/FieldEditor.stories.tsx +7 -8
  67. package/src/components/FieldEditor/FieldEditor.test.tsx +0 -1
  68. package/src/components/FieldEditor/FieldEditor.tsx +3 -4
  69. package/src/components/Form/AUDIT.md +17 -0
  70. package/src/components/Form/Form.stories.tsx +25 -26
  71. package/src/components/Form/Form.tsx +101 -66
  72. package/src/components/Form/FormField.tsx +32 -14
  73. package/src/components/Form/FormFieldComponent.stories.tsx +5 -5
  74. package/src/components/Form/FormFieldComponent.tsx +17 -20
  75. package/src/components/Form/FormFieldSet.tsx +126 -105
  76. package/src/components/Form/fields/ArrayField.tsx +11 -8
  77. package/src/components/Form/fields/GeoPointField.tsx +6 -6
  78. package/src/components/Form/fields/MarkdownField.tsx +1 -1
  79. package/src/components/Form/fields/RefField.tsx +37 -20
  80. package/src/components/Form/fields/SelectField.tsx +1 -1
  81. package/src/components/Form/fields/SelectOptionField.stories.tsx +2 -3
  82. package/src/components/Form/fields/SelectOptionField.tsx +9 -10
  83. package/src/components/Form/fields/TupleField.tsx +1 -1
  84. package/src/components/ObjectForm/ObjectForm.tsx +113 -0
  85. package/src/components/{ControlSection → ObjectForm}/index.ts +1 -1
  86. package/src/components/ObjectPicker/ObjectPicker.stories.tsx +13 -18
  87. package/src/components/ObjectPicker/ObjectPicker.tsx +71 -60
  88. package/src/components/ObjectProperties/ObjectProperties.stories.tsx +63 -0
  89. package/src/components/ObjectProperties/ObjectProperties.tsx +129 -0
  90. package/src/components/ObjectProperties/index.ts +5 -0
  91. package/src/components/Settings/Settings.stories.tsx +55 -0
  92. package/src/components/Settings/Settings.tsx +129 -0
  93. package/src/components/Settings/index.ts +5 -0
  94. package/src/components/ViewEditor/ViewEditor.stories.tsx +36 -33
  95. package/src/components/ViewEditor/ViewEditor.test.tsx +3 -7
  96. package/src/components/ViewEditor/ViewEditor.tsx +117 -85
  97. package/src/components/index.ts +3 -1
  98. package/src/components/testing.tsx +20 -8
  99. package/src/hooks/useFormHandler.ts +42 -18
  100. package/src/hooks/useKeyHandler.tsx +7 -7
  101. package/src/translations.ts +63 -63
  102. package/src/util/refs.ts +7 -3
  103. package/dist/types/src/components/ControlSection/ControlSection.d.ts +0 -23
  104. package/dist/types/src/components/ControlSection/ControlSection.d.ts.map +0 -1
  105. package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts +0 -87
  106. package/dist/types/src/components/ControlSection/ControlSection.stories.d.ts.map +0 -1
  107. package/dist/types/src/components/ControlSection/index.d.ts +0 -2
  108. package/dist/types/src/components/ControlSection/index.d.ts.map +0 -1
  109. package/dist/types/src/components/Form/Form-old.stories.d.ts +0 -131
  110. package/dist/types/src/components/Form/Form-old.stories.d.ts.map +0 -1
  111. package/src/components/ControlSection/ControlSection.stories.tsx +0 -38
  112. package/src/components/ControlSection/ControlSection.tsx +0 -153
  113. package/src/components/Form/Form-old.stories.tsx +0 -314
@@ -10,79 +10,79 @@ export const translations = [
10
10
  {
11
11
  'en-US': {
12
12
  [translationKey]: {
13
- 'fields label': 'Fields',
14
- 'hidden fields label': 'Hidden Fields',
15
- 'empty readonly ref field label': '(none)',
13
+ 'fields.label': 'Fields',
14
+ 'hidden-fields.label': 'Hidden Fields',
15
+ 'empty-readonly-ref-field.label': '(none)',
16
16
 
17
- // TODO(burdon): Standardize field/property.
18
- 'add property button label': 'Add property',
19
- 'field property label': 'Property',
20
- 'field property placeholder': 'Property name',
21
- 'field format label': 'Type',
22
- 'field path label': 'Field path',
23
- 'add field': 'Add field',
24
- 'delete field': 'Delete field',
25
- 'field limit reached': 'Maximum number of fields reached',
26
- 'boolean input true value': 'Yes',
27
- 'boolean input false value': 'No',
28
- 'show field label': 'Show field',
29
- 'hide field label': 'Hide field',
30
- 'delete field label': 'Delete field',
31
- 'ref field combobox input placeholder': 'Search…',
32
- 'ref field placeholder_one': 'Select…',
33
- 'ref field placeholder_other': 'Select items…',
17
+ 'add-property-button.label': 'Add property',
18
+ 'field-property.label': 'Property',
19
+ 'field-property.placeholder': 'Property name',
20
+ 'field-format.label': 'Type',
21
+ 'field-path.label': 'Field path',
22
+ 'add-field.button': 'Add field',
23
+ 'boolean-input-true.value': 'Yes',
24
+ 'boolean-input-false.value': 'No',
25
+ 'show-field.label': 'Show field',
26
+ 'hide-field.label': 'Hide field',
27
+ 'delete-field.label': 'Delete field',
28
+ 'ref-field-combobox-input.placeholder': 'Search…',
29
+ 'ref-field.placeholder': 'Select…',
30
+ 'ref-field.placeholder_one': 'Select…',
31
+ 'ref-field.placeholder_other': 'Select items…',
32
+ 'create-option.label': 'Create',
33
+ 'add-tag.label': 'Add tag',
34
34
 
35
- 'example placeholder': 'Example',
36
- 'latitude placeholder': 'Latitude (e.g., 40.7128)',
37
- 'longitude placeholder': 'Longitude (e.g., -74.0060)',
35
+ 'example.placeholder': 'Example',
36
+ 'latitude.placeholder': 'Latitude (e.g., 40.7128)',
37
+ 'longitude.placeholder': 'Longitude (e.g., -74.0060)',
38
38
 
39
- 'cancel button label': 'Cancel',
40
- 'save button label': 'Save',
39
+ 'cancel-button.label': 'Cancel',
40
+ 'save-button.label': 'Save',
41
41
 
42
- // FormatEnum
43
- 'format boolean': 'Boolean',
44
- 'format currency': 'Currency',
45
- 'format date': 'Date',
46
- 'format date-time': 'DateTime',
47
- 'format did': 'DID',
48
- 'format duration': 'Duration',
49
- 'format dxn': 'DXN',
50
- 'format email': 'Email',
51
- 'format formula': 'Formula',
52
- 'format hostname': 'Hostname',
53
- 'format integer': 'Integer',
54
- 'format json': 'JSON',
55
- 'format lnglat': 'Geopoint',
56
- 'format markdown': 'Markdown',
57
- 'format percent': 'Percent',
58
- 'format ref': 'Reference',
59
- 'format regex': 'RegExp',
60
- 'format string': 'String',
61
- 'format single-select': 'Select',
62
- 'format multi-select': 'Multi-select',
63
- 'format text': 'Long text',
64
- 'format time': 'Time',
65
- 'format timestamp': 'Timestamp',
66
- 'format user': 'User',
67
- 'format number': 'Number',
68
- 'format uri': 'URI',
69
- 'format url': 'URL',
70
- 'format uuid': 'UUID',
42
+ // TypeFormat
43
+ 'format.boolean.label': 'Boolean',
44
+ 'format.currency.label': 'Currency',
45
+ 'format.date.label': 'Date',
46
+ 'format.date-time.label': 'DateTime',
47
+ 'format.did.label': 'DID',
48
+ 'format.duration.label': 'Duration',
49
+ 'format.dxn.label': 'DXN',
50
+ 'format.email.label': 'Email',
51
+ 'format.formula.label': 'Formula',
52
+ 'format.hostname.label': 'Hostname',
53
+ 'format.integer.label': 'Integer',
54
+ 'format.json.label': 'JSON',
55
+ 'format.lnglat.label': 'Geopoint',
56
+ 'format.markdown.label': 'Markdown',
57
+ 'format.percent.label': 'Percent',
58
+ 'format.ref.label': 'Reference',
59
+ 'format.regex.label': 'RegExp',
60
+ 'format.string.label': 'String',
61
+ 'format.single-select.label': 'Select',
62
+ 'format.multi-select.label': 'Multi-select',
63
+ 'format.text.label': 'Long text',
64
+ 'format.time.label': 'Time',
65
+ 'format.timestamp.label': 'Timestamp',
66
+ 'format.user.label': 'User',
67
+ 'format.number.label': 'Number',
68
+ 'format.uri.label': 'URI',
69
+ 'format.url.label': 'URL',
70
+ 'format.uuid.label': 'UUID',
71
71
 
72
72
  // GeoPointField.
73
- 'latitude label': 'Latitude',
74
- 'longitude label': 'Longitude',
73
+ 'latitude.label': 'Latitude',
74
+ 'longitude.label': 'Longitude',
75
75
 
76
76
  // SelectOptionsField.
77
- 'select option label': 'Label',
78
- 'select option label placeholder': 'Option label',
79
- 'select option color': 'Color',
80
- 'select option delete': 'Delete',
81
- 'select option add': 'Add option',
77
+ 'select-option.label': 'Label',
78
+ 'select-option-label.placeholder': 'Option label',
79
+ 'select-option-delete.button': 'Delete',
80
+ 'select-option-add.button': 'Add option',
82
81
 
83
82
  // System schema message.
84
- 'system schema title': 'System type',
85
- 'system schema description': 'System type: cannot add or remove fields.',
83
+ 'system-schema.title': 'System type',
84
+ 'system-schema.description': 'System type: cannot add or remove fields.',
85
+ 'remove.button': 'Remove',
86
86
  },
87
87
  },
88
88
  },
package/src/util/refs.ts CHANGED
@@ -5,11 +5,13 @@
5
5
  import type * as SchemaAST from 'effect/SchemaAST';
6
6
 
7
7
  import { Ref } from '@dxos/echo';
8
- import { getArrayElementType, isArrayType } from '@dxos/effect';
8
+ import { type ReferenceAnnotationValue, ReferenceAnnotationId } from '@dxos/echo/internal';
9
+ import { findAnnotation, getArrayElementType, isArrayType } from '@dxos/effect';
9
10
 
10
11
  type RefProps = {
11
12
  ast: SchemaAST.AST;
12
13
  isArray: boolean;
14
+ typename?: string;
13
15
  };
14
16
 
15
17
  export const getRefProps = (ast: SchemaAST.AST): RefProps | undefined => {
@@ -18,14 +20,16 @@ export const getRefProps = (ast: SchemaAST.AST): RefProps | undefined => {
18
20
  const elementType = getArrayElementType(ast);
19
21
  if (elementType) {
20
22
  if (Ref.isRefType(elementType)) {
21
- return { ast: elementType, isArray: true };
23
+ const typename = findAnnotation<ReferenceAnnotationValue>(elementType, ReferenceAnnotationId)?.typename;
24
+ return { ast: elementType, isArray: true, typename };
22
25
  }
23
26
  }
24
27
  }
25
28
 
26
29
  // Direct reference.
27
30
  if (Ref.isRefType(ast)) {
28
- return { ast, isArray: false };
31
+ const typename = findAnnotation<ReferenceAnnotationValue>(ast, ReferenceAnnotationId)?.typename;
32
+ return { ast, isArray: false, typename };
29
33
  }
30
34
 
31
35
  return undefined;
@@ -1,23 +0,0 @@
1
- import React, { type ComponentPropsWithoutRef, type PropsWithChildren } from 'react';
2
- import { type ButtonProps, type Label, type ThemedClassName } from '@dxos/react-ui';
3
- export type ControlPageParams = ThemedClassName<ComponentPropsWithoutRef<'div'>>;
4
- export declare const ControlPage: ({ children, classNames, ...props }: ControlPageParams) => React.JSX.Element;
5
- export type ControlSectionProps = PropsWithChildren<{
6
- title: Label;
7
- description?: Label;
8
- }>;
9
- export declare const ControlSection: ({ title, description, children }: ControlSectionProps) => React.JSX.Element;
10
- export declare const ControlSectionHeading: ({ title, description }: Omit<ControlSectionProps, "children">) => React.JSX.Element;
11
- export declare const ControlGroupButton: ({ classNames, ...props }: ButtonProps) => React.JSX.Element;
12
- export type ControlGroupProps = ThemedClassName<PropsWithChildren>;
13
- export declare const ControlGroup: ({ children, classNames }: ControlGroupProps) => React.JSX.Element;
14
- export declare const ControlFrame: ({ children }: ControlGroupProps) => React.JSX.Element;
15
- export declare const controlItemClasses: string;
16
- export type ControlItemProps = PropsWithChildren<{
17
- title: Label;
18
- description?: Label;
19
- }>;
20
- export declare const ControlItem: ({ title, description, children }: ControlItemProps) => React.JSX.Element;
21
- export declare const ControlItemInput: ({ title, description, children }: ControlItemProps) => React.JSX.Element;
22
- export declare const ControlFrameItem: ({ title, description, children }: ControlItemProps) => React.JSX.Element;
23
- //# sourceMappingURL=ControlSection.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ControlSection.d.ts","sourceRoot":"","sources":["../../../../../src/components/ControlSection/ControlSection.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,KAAK,wBAAwB,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAErF,OAAO,EAEL,KAAK,WAAW,EAEhB,KAAK,KAAK,EACV,KAAK,eAAe,EAGrB,MAAM,gBAAgB,CAAC;AAMxB,MAAM,MAAM,iBAAiB,GAAG,eAAe,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAC;AAEjF,eAAO,MAAM,WAAW,GAAI,oCAAoC,iBAAiB,sBAQhF,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;IAClD,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,CAAC,EAAE,KAAK,CAAC;CACrB,CAAC,CAAC;AAEH,eAAO,MAAM,cAAc,GAAI,kCAAkC,mBAAmB,sBAOnF,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,wBAAwB,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,sBAYlG,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,0BAA0B,WAAW,sBAEvE,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,eAAe,CAAC,iBAAiB,CAAC,CAAC;AAEnE,eAAO,MAAM,YAAY,GAAI,0BAA0B,iBAAiB,sBAWvE,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,cAAc,iBAAiB,sBAU3D,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAK7B,CAAC;AAKH,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;IAC/C,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,CAAC,EAAE,KAAK,CAAC;CACrB,CAAC,CAAC;AAEH,eAAO,MAAM,WAAW,GAAI,kCAAkC,gBAAgB,sBAY7E,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,kCAAkC,gBAAgB,sBAoBlF,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,kCAAkC,gBAAgB,sBAUlF,CAAC"}
@@ -1,87 +0,0 @@
1
- import { type StoryObj } from '@storybook/react-vite';
2
- import React from 'react';
3
- declare const meta: {
4
- title: string;
5
- component: ({ title, description, children }: import("./ControlSection").ControlSectionProps) => React.JSX.Element;
6
- render: (args: {
7
- title: import("@dxos/ui-types").Label;
8
- description?: import("@dxos/ui-types").Label;
9
- } & {
10
- children?: React.ReactNode | undefined;
11
- }) => React.JSX.Element;
12
- decorators: import("@storybook/react").Decorator[];
13
- parameters: {
14
- layout: string;
15
- translations: [{
16
- readonly 'en-US': {
17
- readonly "@dxos/react-ui-form": {
18
- readonly 'fields label': "Fields";
19
- readonly 'hidden fields label': "Hidden Fields";
20
- readonly 'empty readonly ref field label': "(none)";
21
- readonly 'add property button label': "Add property";
22
- readonly 'field property label': "Property";
23
- readonly 'field property placeholder': "Property name";
24
- readonly 'field format label': "Type";
25
- readonly 'field path label': "Field path";
26
- readonly 'add field': "Add field";
27
- readonly 'delete field': "Delete field";
28
- readonly 'field limit reached': "Maximum number of fields reached";
29
- readonly 'boolean input true value': "Yes";
30
- readonly 'boolean input false value': "No";
31
- readonly 'show field label': "Show field";
32
- readonly 'hide field label': "Hide field";
33
- readonly 'delete field label': "Delete field";
34
- readonly 'ref field combobox input placeholder': "Search…";
35
- readonly 'ref field placeholder_one': "Select…";
36
- readonly 'ref field placeholder_other': "Select items…";
37
- readonly 'example placeholder': "Example";
38
- readonly 'latitude placeholder': "Latitude (e.g., 40.7128)";
39
- readonly 'longitude placeholder': "Longitude (e.g., -74.0060)";
40
- readonly 'cancel button label': "Cancel";
41
- readonly 'save button label': "Save";
42
- readonly 'format boolean': "Boolean";
43
- readonly 'format currency': "Currency";
44
- readonly 'format date': "Date";
45
- readonly 'format date-time': "DateTime";
46
- readonly 'format did': "DID";
47
- readonly 'format duration': "Duration";
48
- readonly 'format dxn': "DXN";
49
- readonly 'format email': "Email";
50
- readonly 'format formula': "Formula";
51
- readonly 'format hostname': "Hostname";
52
- readonly 'format integer': "Integer";
53
- readonly 'format json': "JSON";
54
- readonly 'format lnglat': "Geopoint";
55
- readonly 'format markdown': "Markdown";
56
- readonly 'format percent': "Percent";
57
- readonly 'format ref': "Reference";
58
- readonly 'format regex': "RegExp";
59
- readonly 'format string': "String";
60
- readonly 'format single-select': "Select";
61
- readonly 'format multi-select': "Multi-select";
62
- readonly 'format text': "Long text";
63
- readonly 'format time': "Time";
64
- readonly 'format timestamp': "Timestamp";
65
- readonly 'format user': "User";
66
- readonly 'format number': "Number";
67
- readonly 'format uri': "URI";
68
- readonly 'format url': "URL";
69
- readonly 'format uuid': "UUID";
70
- readonly 'latitude label': "Latitude";
71
- readonly 'longitude label': "Longitude";
72
- readonly 'select option label': "Label";
73
- readonly 'select option label placeholder': "Option label";
74
- readonly 'select option color': "Color";
75
- readonly 'select option delete': "Delete";
76
- readonly 'select option add': "Add option";
77
- readonly 'system schema title': "System type";
78
- readonly 'system schema description': "System type: cannot add or remove fields.";
79
- };
80
- };
81
- }];
82
- };
83
- };
84
- export default meta;
85
- type Story = StoryObj<typeof meta>;
86
- export declare const Default: Story;
87
- //# sourceMappingURL=ControlSection.stories.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ControlSection.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/ControlSection/ControlSection.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAa6B,CAAC;AAExC,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './ControlSection';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ControlSection/index.ts"],"names":[],"mappings":"AAIA,cAAc,kBAAkB,CAAC"}
@@ -1,131 +0,0 @@
1
- import { type StoryObj } from '@storybook/react-vite';
2
- import * as Schema from 'effect/Schema';
3
- import React from 'react';
4
- import { type AnyProperties } from '@dxos/echo/internal';
5
- import { type FormRootProps } from './Form';
6
- type StoryProps<T extends AnyProperties> = {
7
- debug?: boolean;
8
- schema: Schema.Schema.AnyNoContext;
9
- } & FormRootProps<T>;
10
- declare const meta: {
11
- title: string;
12
- component: any;
13
- render: <T extends AnyProperties = any>({ debug, schema, values: valuesProp, ...props }: StoryProps<T>) => React.JSX.Element;
14
- decorators: import("@storybook/react").Decorator[];
15
- parameters: {
16
- layout: string;
17
- translations: [{
18
- readonly 'en-US': {
19
- readonly "@dxos/react-ui-form": {
20
- readonly 'fields label': "Fields";
21
- readonly 'hidden fields label': "Hidden Fields";
22
- readonly 'empty readonly ref field label': "(none)";
23
- readonly 'add property button label': "Add property";
24
- readonly 'field property label': "Property";
25
- readonly 'field property placeholder': "Property name";
26
- readonly 'field format label': "Type";
27
- readonly 'field path label': "Field path";
28
- readonly 'add field': "Add field";
29
- readonly 'delete field': "Delete field";
30
- readonly 'field limit reached': "Maximum number of fields reached";
31
- readonly 'boolean input true value': "Yes";
32
- readonly 'boolean input false value': "No";
33
- readonly 'show field label': "Show field";
34
- readonly 'hide field label': "Hide field";
35
- readonly 'delete field label': "Delete field";
36
- readonly 'ref field combobox input placeholder': "Search…";
37
- readonly 'ref field placeholder_one': "Select…";
38
- readonly 'ref field placeholder_other': "Select items…";
39
- readonly 'example placeholder': "Example";
40
- readonly 'latitude placeholder': "Latitude (e.g., 40.7128)";
41
- readonly 'longitude placeholder': "Longitude (e.g., -74.0060)";
42
- readonly 'cancel button label': "Cancel";
43
- readonly 'save button label': "Save";
44
- readonly 'format boolean': "Boolean";
45
- readonly 'format currency': "Currency";
46
- readonly 'format date': "Date";
47
- readonly 'format date-time': "DateTime";
48
- readonly 'format did': "DID";
49
- readonly 'format duration': "Duration";
50
- readonly 'format dxn': "DXN";
51
- readonly 'format email': "Email";
52
- readonly 'format formula': "Formula";
53
- readonly 'format hostname': "Hostname";
54
- readonly 'format integer': "Integer";
55
- readonly 'format json': "JSON";
56
- readonly 'format lnglat': "Geopoint";
57
- readonly 'format markdown': "Markdown";
58
- readonly 'format percent': "Percent";
59
- readonly 'format ref': "Reference";
60
- readonly 'format regex': "RegExp";
61
- readonly 'format string': "String";
62
- readonly 'format single-select': "Select";
63
- readonly 'format multi-select': "Multi-select";
64
- readonly 'format text': "Long text";
65
- readonly 'format time': "Time";
66
- readonly 'format timestamp': "Timestamp";
67
- readonly 'format user': "User";
68
- readonly 'format number': "Number";
69
- readonly 'format uri': "URI";
70
- readonly 'format url': "URL";
71
- readonly 'format uuid': "UUID";
72
- readonly 'latitude label': "Latitude";
73
- readonly 'longitude label': "Longitude";
74
- readonly 'select option label': "Label";
75
- readonly 'select option label placeholder': "Option label";
76
- readonly 'select option color': "Color";
77
- readonly 'select option delete': "Delete";
78
- readonly 'select option add': "Add option";
79
- readonly 'system schema title': "System type";
80
- readonly 'system schema description': "System type: cannot add or remove fields.";
81
- };
82
- };
83
- }];
84
- };
85
- argTypes: {
86
- readonly: {
87
- control: "boolean";
88
- description: string;
89
- };
90
- };
91
- };
92
- export default meta;
93
- type Story = StoryObj<typeof meta>;
94
- export declare const Default: Story;
95
- export declare const Organization: Story;
96
- export declare const OrganizationAutoSave: Story;
97
- export declare const Person: Story;
98
- declare const ShapeSchema: Schema.mutable<Schema.Struct<{
99
- shape: Schema.optional<Schema.Union<[Schema.Struct<{
100
- type: Schema.Literal<["circle"]>;
101
- radius: Schema.optional<Schema.SchemaClass<number, number, never>>;
102
- }>, Schema.Struct<{
103
- type: Schema.Literal<["square"]>;
104
- size: Schema.optional<Schema.refine<number, typeof Schema.Number>>;
105
- }>]>>;
106
- }>>;
107
- type ShapeSchema = Schema.Schema.Type<typeof ShapeSchema>;
108
- export declare const DiscriminatedShape: StoryObj<StoryProps<ShapeSchema>>;
109
- declare const ArraysSchema: Schema.mutable<Schema.Struct<{
110
- names: Schema.Array$<Schema.filter<typeof Schema.String>>;
111
- addresses: Schema.Array$<Schema.Struct<{
112
- street: Schema.optional<Schema.SchemaClass<string, string, never>>;
113
- city: Schema.optional<Schema.SchemaClass<string, string, never>>;
114
- zip: Schema.optional<Schema.refine<string, typeof Schema.String>>;
115
- location: Schema.optional<Schema.Tuple<[Schema.filter<Schema.transform<Schema.SchemaClass<number, number, never>, Schema.filter<Schema.SchemaClass<number, number, never>>>>, Schema.filter<Schema.transform<Schema.SchemaClass<number, number, never>, Schema.filter<Schema.SchemaClass<number, number, never>>>>, Schema.Element<typeof Schema.Number, "?">]>>;
116
- }>>;
117
- }>>;
118
- type ArraysSchema = Schema.Schema.Type<typeof ArraysSchema>;
119
- export declare const Arrays: StoryObj<StoryProps<ArraysSchema>>;
120
- declare const TupleSchema: Schema.mutable<Schema.Struct<{
121
- tuple: Schema.Tuple<[typeof Schema.Number, typeof Schema.String, typeof Schema.Boolean]>;
122
- geopoint: Schema.Tuple<[Schema.filter<Schema.transform<Schema.SchemaClass<number, number, never>, Schema.filter<Schema.SchemaClass<number, number, never>>>>, Schema.filter<Schema.transform<Schema.SchemaClass<number, number, never>, Schema.filter<Schema.SchemaClass<number, number, never>>>>, Schema.Element<typeof Schema.Number, "?">]>;
123
- }>>;
124
- type TupleSchema = Schema.Schema.Type<typeof TupleSchema>;
125
- export declare const Tuple: StoryObj<StoryProps<TupleSchema>>;
126
- declare const ColorSchema: Schema.mutable<Schema.Struct<{
127
- color: Schema.Union<[Schema.Literal<["red"]>, Schema.Literal<["green"]>, Schema.Literal<["blue"]>]>;
128
- }>>;
129
- type ColorType = Schema.Schema.Type<typeof ColorSchema>;
130
- export declare const Enum: StoryObj<StoryProps<ColorType>>;
131
- //# sourceMappingURL=Form-old.stories.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Form-old.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Form/Form-old.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAgC,MAAM,OAAO,CAAC;AAGrD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AASzD,OAAO,EAAQ,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAIlD,KAAK,UAAU,CAAC,CAAC,SAAS,aAAa,IAAI;IACzC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;CACpC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;AAuErB,QAAA,MAAM,IAAI;;eAEgB,GAAG;aAvEP,CAAC,SAAS,aAAa,yDAK1C,UAAU,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+EiB,CAAC;AAElC,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAYrB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAU1B,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,KAWlC,CAAC;AAKF,eAAO,MAAM,MAAM,EAAE,KAQpB,CAAC;AAMF,QAAA,MAAM,WAAW;;;;;;;;GAaM,CAAC;AAExB,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC,CAAC;AAE1D,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,CAuBhE,CAAC;AAMF,QAAA,MAAM,YAAY;;;;;;;;GAGK,CAAC;AAExB,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,YAAY,CAAC,CAAC;AAE5D,eAAO,MAAM,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,YAAY,CAAC,CAUrD,CAAC;AAOF,QAAA,MAAM,WAAW;;;GAGM,CAAC;AAExB,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC,CAAC;AAE1D,eAAO,MAAM,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,CAUnD,CAAC;AAMF,QAAA,MAAM,WAAW;;GAIM,CAAC;AAExB,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC,CAAC;AAExD,eAAO,MAAM,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAShD,CAAC"}
@@ -1,38 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import { type Meta, type StoryObj } from '@storybook/react-vite';
6
- import React from 'react';
7
-
8
- import { withTheme } from '@dxos/react-ui/testing';
9
-
10
- import { translations } from '../../translations';
11
-
12
- import { ControlPage, ControlSection } from './ControlSection';
13
-
14
- const meta = {
15
- title: 'ui/react-ui-form/ControlSection',
16
- component: ControlSection,
17
- render: (args) => (
18
- <ControlPage classNames='is-[40rem]'>
19
- <ControlSection {...args} />
20
- </ControlPage>
21
- ),
22
- decorators: [withTheme],
23
- parameters: {
24
- layout: 'centered',
25
- translations,
26
- },
27
- } satisfies Meta<typeof ControlSection>;
28
-
29
- export default meta;
30
-
31
- type Story = StoryObj<typeof meta>;
32
-
33
- export const Default: Story = {
34
- args: {
35
- title: 'Control Section',
36
- description: 'This is a control section',
37
- },
38
- };
@@ -1,153 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import React, { type ComponentPropsWithoutRef, type PropsWithChildren } from 'react';
6
-
7
- import {
8
- Button,
9
- type ButtonProps,
10
- Input,
11
- type Label,
12
- type ThemedClassName,
13
- toLocalizedString,
14
- useTranslation,
15
- } from '@dxos/react-ui';
16
- import { Layout } from '@dxos/react-ui-mosaic';
17
- import { mx } from '@dxos/ui-theme';
18
-
19
- import { translationKey } from '../../translations';
20
-
21
- export type ControlPageParams = ThemedClassName<ComponentPropsWithoutRef<'div'>>;
22
-
23
- export const ControlPage = ({ children, classNames, ...props }: ControlPageParams) => {
24
- return (
25
- <Layout.Container scrollable classNames='[--control-spacing:var(--dx-trimMd)]'>
26
- <div role='none' className={mx('pli-cardSpacingInline pbe-trimMd', classNames)} {...props}>
27
- {children}
28
- </div>
29
- </Layout.Container>
30
- );
31
- };
32
-
33
- export type ControlSectionProps = PropsWithChildren<{
34
- title: Label;
35
- description?: Label;
36
- }>;
37
-
38
- export const ControlSection = ({ title, description, children }: ControlSectionProps) => {
39
- return (
40
- <>
41
- <ControlSectionHeading title={title} description={description} />
42
- {children}
43
- </>
44
- );
45
- };
46
-
47
- export const ControlSectionHeading = ({ title, description }: Omit<ControlSectionProps, 'children'>) => {
48
- const { t } = useTranslation(translationKey);
49
- return (
50
- <>
51
- <h2 className='pli-trimMd container-max-width text-xl mbs-trimMd mbe-trimMd'>{toLocalizedString(title, t)}</h2>
52
- {description && (
53
- <p className='pli-trimMd mlb-trimMd container-max-width text-description'>
54
- {toLocalizedString(description, t)}
55
- </p>
56
- )}
57
- </>
58
- );
59
- };
60
-
61
- export const ControlGroupButton = ({ classNames, ...props }: ButtonProps) => {
62
- return <Button {...props} classNames={['md:col-span-2', classNames]} />;
63
- };
64
-
65
- export type ControlGroupProps = ThemedClassName<PropsWithChildren>;
66
-
67
- export const ControlGroup = ({ children, classNames }: ControlGroupProps) => (
68
- <div
69
- role='none'
70
- className={mx(
71
- 'group container-max-width grid grid-cols-1 md:grid-cols-[1fr_min-content] gap-trimMd',
72
- '[--control-spacing:0px] [&_input]:justify-self-end [&_button]:justify-self-end',
73
- classNames,
74
- )}
75
- >
76
- {children}
77
- </div>
78
- );
79
-
80
- export const ControlFrame = ({ children }: ControlGroupProps) => (
81
- <div
82
- role='none'
83
- className={mx(
84
- 'container-max-width grid grid-cols-1 md:grid-cols-[1fr_1fr] gap-trimSm md:gap-trimMd p-trimMd',
85
- 'border border-separator rounded-md',
86
- )}
87
- >
88
- {children}
89
- </div>
90
- );
91
-
92
- export const controlItemClasses = mx([
93
- 'container-max-width grid md:col-span-2 grid-cols-subgrid gap-trimSm items-center',
94
- // TODO(burdon): Use grid gap consistently or apply margins consistently?
95
- 'mlb-[--control-spacing] *:first:!mbs-0 *:last:!mbe-0 pli-trimMd plb-trimMd',
96
- 'border border-separator rounded-md',
97
- ]);
98
-
99
- const controlItemTitleClasses = 'mbe-0 text-lg text-baseText font-normal';
100
- const controlItemDescriptionClasses = 'mlb-trimSm md:mbe-0 text-base text-description';
101
-
102
- export type ControlItemProps = PropsWithChildren<{
103
- title: Label;
104
- description?: Label;
105
- }>;
106
-
107
- export const ControlItem = ({ title, description, children }: ControlItemProps) => {
108
- const { t } = useTranslation(translationKey);
109
-
110
- return (
111
- <div className={controlItemClasses}>
112
- <div role='none'>
113
- <h3 className={controlItemTitleClasses}>{toLocalizedString(title, t)}</h3>
114
- {description && <p className={controlItemDescriptionClasses}>{toLocalizedString(description, t)}</p>}
115
- </div>
116
- {children}
117
- </div>
118
- );
119
- };
120
-
121
- export const ControlItemInput = ({ title, description, children }: ControlItemProps) => {
122
- const { t } = useTranslation(translationKey);
123
-
124
- return (
125
- <Input.Root>
126
- <div className={controlItemClasses}>
127
- <div role='none'>
128
- <Input.Label classNames={controlItemTitleClasses}>{toLocalizedString(title, t)}</Input.Label>
129
- {description && (
130
- <Input.DescriptionAndValidation>
131
- <Input.Description classNames={controlItemDescriptionClasses}>
132
- {toLocalizedString(description, t)}
133
- </Input.Description>
134
- </Input.DescriptionAndValidation>
135
- )}
136
- </div>
137
- {children}
138
- </div>
139
- </Input.Root>
140
- );
141
- };
142
-
143
- export const ControlFrameItem = ({ title, description, children }: ControlItemProps) => {
144
- const { t } = useTranslation(translationKey);
145
-
146
- return (
147
- <div role='group' className='min-is-0'>
148
- <h3 className='text-lg mbe-2'>{toLocalizedString(title, t)}</h3>
149
- {description && <p className='mlb-trimSm md:mbe-0 text-description'>{toLocalizedString(description, t)}</p>}
150
- {children}
151
- </div>
152
- );
153
- };