@dxos/react-ui-form 0.8.4-main.74a063c4e0 → 0.8.4-main.765dc60934

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 (134) hide show
  1. package/LICENSE +102 -5
  2. package/dist/lib/browser/index.mjs +873 -446
  3. package/dist/lib/browser/index.mjs.map +4 -4
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/translations.mjs +82 -0
  6. package/dist/lib/browser/translations.mjs.map +7 -0
  7. package/dist/lib/node-esm/index.mjs +873 -446
  8. package/dist/lib/node-esm/index.mjs.map +4 -4
  9. package/dist/lib/node-esm/meta.json +1 -1
  10. package/dist/lib/node-esm/translations.mjs +84 -0
  11. package/dist/lib/node-esm/translations.mjs.map +7 -0
  12. package/dist/types/src/components/FieldEditor/FieldEditor.d.ts.map +1 -1
  13. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts +63 -61
  14. package/dist/types/src/components/FieldEditor/FieldEditor.stories.d.ts.map +1 -1
  15. package/dist/types/src/components/Form/Form.d.ts +34 -12
  16. package/dist/types/src/components/Form/Form.d.ts.map +1 -1
  17. package/dist/types/src/components/Form/Form.stories.d.ts +73 -71
  18. package/dist/types/src/components/Form/Form.stories.d.ts.map +1 -1
  19. package/dist/types/src/components/Form/FormField.d.ts +5 -5
  20. package/dist/types/src/components/Form/FormField.d.ts.map +1 -1
  21. package/dist/types/src/components/Form/FormFieldComponent.d.ts +8 -6
  22. package/dist/types/src/components/Form/FormFieldComponent.d.ts.map +1 -1
  23. package/dist/types/src/components/Form/FormFieldComponent.stories.d.ts.map +1 -1
  24. package/dist/types/src/components/Form/FormFieldSet.d.ts +5 -8
  25. package/dist/types/src/components/Form/FormFieldSet.d.ts.map +1 -1
  26. package/dist/types/src/components/Form/fields/ArrayField.d.ts +4 -4
  27. package/dist/types/src/components/Form/fields/ArrayField.d.ts.map +1 -1
  28. package/dist/types/src/components/Form/fields/BooleanField.d.ts.map +1 -1
  29. package/dist/types/src/components/Form/fields/GeoPointField.d.ts.map +1 -1
  30. package/dist/types/src/components/Form/fields/MarkdownField.d.ts +8 -1
  31. package/dist/types/src/components/Form/fields/MarkdownField.d.ts.map +1 -1
  32. package/dist/types/src/components/Form/fields/MarkdownField.stories.d.ts +84 -0
  33. package/dist/types/src/components/Form/fields/MarkdownField.stories.d.ts.map +1 -0
  34. package/dist/types/src/components/Form/fields/NumberField.d.ts.map +1 -1
  35. package/dist/types/src/components/Form/fields/RefField.d.ts +10 -4
  36. package/dist/types/src/components/Form/fields/RefField.d.ts.map +1 -1
  37. package/dist/types/src/components/Form/fields/SelectField.d.ts.map +1 -1
  38. package/dist/types/src/components/Form/fields/SelectOptionField.d.ts.map +1 -1
  39. package/dist/types/src/components/Form/fields/SelectOptionField.stories.d.ts +63 -61
  40. package/dist/types/src/components/Form/fields/SelectOptionField.stories.d.ts.map +1 -1
  41. package/dist/types/src/components/Form/fields/TextAreaField.d.ts.map +1 -1
  42. package/dist/types/src/components/Form/fields/TextField.d.ts +1 -1
  43. package/dist/types/src/components/Form/fields/TextField.d.ts.map +1 -1
  44. package/dist/types/src/components/Form/fields/TupleField.d.ts.map +1 -1
  45. package/dist/types/src/components/ObjectForm/ObjectForm.d.ts +9 -0
  46. package/dist/types/src/components/ObjectForm/ObjectForm.d.ts.map +1 -0
  47. package/dist/types/src/components/ObjectForm/index.d.ts +2 -0
  48. package/dist/types/src/components/ObjectForm/index.d.ts.map +1 -0
  49. package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts +17 -3
  50. package/dist/types/src/components/ObjectPicker/ObjectPicker.d.ts.map +1 -1
  51. package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts +63 -61
  52. package/dist/types/src/components/ObjectPicker/ObjectPicker.stories.d.ts.map +1 -1
  53. package/dist/types/src/components/ObjectProperties/ObjectProperties.d.ts +9 -0
  54. package/dist/types/src/components/ObjectProperties/ObjectProperties.d.ts.map +1 -0
  55. package/dist/types/src/components/ObjectProperties/ObjectProperties.stories.d.ts +127 -0
  56. package/dist/types/src/components/ObjectProperties/ObjectProperties.stories.d.ts.map +1 -0
  57. package/dist/types/src/components/ObjectProperties/ObjectProperties.test.d.ts +2 -0
  58. package/dist/types/src/components/ObjectProperties/ObjectProperties.test.d.ts.map +1 -0
  59. package/dist/types/src/components/ObjectProperties/index.d.ts +2 -0
  60. package/dist/types/src/components/ObjectProperties/index.d.ts.map +1 -0
  61. package/dist/types/src/components/Settings/Settings.d.ts +24 -12
  62. package/dist/types/src/components/Settings/Settings.d.ts.map +1 -1
  63. package/dist/types/src/components/Settings/Settings.stories.d.ts +64 -61
  64. package/dist/types/src/components/Settings/Settings.stories.d.ts.map +1 -1
  65. package/dist/types/src/components/Settings/SettingsFieldSet.d.ts +43 -0
  66. package/dist/types/src/components/Settings/SettingsFieldSet.d.ts.map +1 -0
  67. package/dist/types/src/components/Settings/SettingsItem.d.ts +16 -0
  68. package/dist/types/src/components/Settings/SettingsItem.d.ts.map +1 -0
  69. package/dist/types/src/components/Settings/SettingsSelectField.d.ts +18 -0
  70. package/dist/types/src/components/Settings/SettingsSelectField.d.ts.map +1 -0
  71. package/dist/types/src/components/Settings/index.d.ts +2 -0
  72. package/dist/types/src/components/Settings/index.d.ts.map +1 -1
  73. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts +3 -4
  74. package/dist/types/src/components/ViewEditor/ViewEditor.d.ts.map +1 -1
  75. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts +63 -61
  76. package/dist/types/src/components/ViewEditor/ViewEditor.stories.d.ts.map +1 -1
  77. package/dist/types/src/components/index.d.ts +2 -0
  78. package/dist/types/src/components/index.d.ts.map +1 -1
  79. package/dist/types/src/components/testing.d.ts +4 -4
  80. package/dist/types/src/components/testing.d.ts.map +1 -1
  81. package/dist/types/src/hooks/useFormHandler.d.ts.map +1 -1
  82. package/dist/types/src/hooks/useKeyHandler.d.ts.map +1 -1
  83. package/dist/types/src/index.d.ts +0 -2
  84. package/dist/types/src/index.d.ts.map +1 -1
  85. package/dist/types/src/translations.d.ts +63 -61
  86. package/dist/types/src/translations.d.ts.map +1 -1
  87. package/dist/types/src/util/field-type.d.ts +19 -0
  88. package/dist/types/src/util/field-type.d.ts.map +1 -0
  89. package/dist/types/src/util/field.d.ts.map +1 -1
  90. package/dist/types/src/util/formatting.d.ts.map +1 -1
  91. package/dist/types/src/util/index.d.ts +1 -0
  92. package/dist/types/src/util/index.d.ts.map +1 -1
  93. package/dist/types/src/util/properties.d.ts.map +1 -1
  94. package/dist/types/src/util/refs.d.ts.map +1 -1
  95. package/dist/types/tsconfig.tsbuildinfo +1 -1
  96. package/package.json +40 -38
  97. package/src/components/FieldEditor/FieldEditor.stories.tsx +2 -1
  98. package/src/components/FieldEditor/FieldEditor.tsx +3 -2
  99. package/src/components/Form/Form.stories.tsx +9 -19
  100. package/src/components/Form/Form.tsx +59 -7
  101. package/src/components/Form/FormField.tsx +12 -10
  102. package/src/components/Form/FormFieldComponent.tsx +6 -3
  103. package/src/components/Form/FormFieldSet.tsx +47 -31
  104. package/src/components/Form/fields/ArrayField.tsx +7 -6
  105. package/src/components/Form/fields/GeoPointField.tsx +3 -2
  106. package/src/components/Form/fields/MarkdownField.stories.tsx +206 -0
  107. package/src/components/Form/fields/MarkdownField.tsx +135 -45
  108. package/src/components/Form/fields/RefField.tsx +61 -30
  109. package/src/components/Form/fields/SelectOptionField.stories.tsx +8 -5
  110. package/src/components/Form/fields/SelectOptionField.tsx +6 -5
  111. package/src/components/Form/fields/TextField.tsx +2 -2
  112. package/src/components/ObjectForm/ObjectForm.tsx +114 -0
  113. package/src/components/ObjectForm/index.ts +5 -0
  114. package/src/components/ObjectPicker/ObjectPicker.stories.tsx +9 -6
  115. package/src/components/ObjectPicker/ObjectPicker.tsx +28 -12
  116. package/src/components/ObjectProperties/ObjectProperties.stories.tsx +362 -0
  117. package/src/components/ObjectProperties/ObjectProperties.test.tsx +101 -0
  118. package/src/components/ObjectProperties/ObjectProperties.tsx +141 -0
  119. package/src/components/ObjectProperties/index.ts +5 -0
  120. package/src/components/Settings/AUDIT.md +52 -0
  121. package/src/components/Settings/Settings.stories.tsx +50 -1
  122. package/src/components/Settings/Settings.tsx +7 -56
  123. package/src/components/Settings/SettingsFieldSet.tsx +257 -0
  124. package/src/components/Settings/SettingsItem.tsx +58 -0
  125. package/src/components/Settings/SettingsSelectField.tsx +59 -0
  126. package/src/components/Settings/index.ts +2 -0
  127. package/src/components/ViewEditor/ViewEditor.stories.tsx +10 -10
  128. package/src/components/ViewEditor/ViewEditor.tsx +19 -26
  129. package/src/components/index.ts +2 -0
  130. package/src/components/testing.tsx +20 -21
  131. package/src/index.ts +0 -4
  132. package/src/translations.ts +7 -3
  133. package/src/util/field-type.ts +60 -0
  134. package/src/util/index.ts +1 -0
@@ -9,9 +9,10 @@ import { PublicKey } from '@dxos/keys';
9
9
  import { type ChromaticPalette, IconButton, Input, Tag, useTranslation } from '@dxos/react-ui';
10
10
  import { List } from '@dxos/react-ui-list';
11
11
  import { HuePicker } from '@dxos/react-ui-pickers';
12
- import { hues, osTranslations, subtleHover } from '@dxos/ui-theme';
12
+ import { hues, osTranslations } from '@dxos/ui-theme';
13
+
14
+ import { translationKey } from '#translations';
13
15
 
14
- import { translationKey } from '../../../translations';
15
16
  import { type FormFieldComponentProps, FormFieldLabel } from '../FormFieldComponent';
16
17
 
17
18
  export const SelectOptionField = ({
@@ -119,7 +120,7 @@ export const SelectOptionField = ({
119
120
  return (
120
121
  <Input.Root validationValence={status}>
121
122
  <FormFieldLabel error={error} readonly={readonly} label={label} />
122
- <div role='none'>
123
+ <div>
123
124
  {options && (
124
125
  <List.Root
125
126
  items={options}
@@ -134,7 +135,7 @@ export const SelectOptionField = ({
134
135
  <List.Item
135
136
  role='button'
136
137
  item={item}
137
- classNames={[subtleHover, 'flex flex-col cursor-pointer rounded-xs']}
138
+ classNames='flex flex-col cursor-pointer rounded-xs dx-hover'
138
139
  aria-expanded={selected === item.id}
139
140
  >
140
141
  <div className='flex items-center'>
@@ -146,7 +147,7 @@ export const SelectOptionField = ({
146
147
  <IconButton
147
148
  iconOnly
148
149
  variant='ghost'
149
- label={t(selected === item.id ? 'collapse label' : 'expand label', { ns: osTranslations })}
150
+ label={t(selected === item.id ? 'collapse.label' : 'expand.label', { ns: osTranslations })}
150
151
  icon={selected === item.id ? 'ph--caret-down--regular' : 'ph--caret-right--regular'}
151
152
  onClick={() => handleClick(item.id)}
152
153
  />
@@ -12,8 +12,8 @@ export const TextField = ({
12
12
  type,
13
13
  readonly,
14
14
  placeholder,
15
- onValueChange,
16
15
  onBlur,
16
+ onValueChange,
17
17
  ...props
18
18
  }: FormFieldComponentProps<string>) => {
19
19
  const handleChange = useCallback<NonNullable<TextInputProps['onChange']>>(
@@ -29,8 +29,8 @@ export const TextField = ({
29
29
  disabled={!!readonly}
30
30
  placeholder={placeholder}
31
31
  value={value}
32
- onChange={handleChange}
33
32
  onBlur={onBlur}
33
+ onChange={handleChange}
34
34
  />
35
35
  )}
36
36
  </FormFieldWrapper>
@@ -0,0 +1,114 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Schema from 'effect/Schema';
6
+ import React, { useCallback, useMemo } from 'react';
7
+
8
+ import { DXN, Obj, Ref, Tag, Type } from '@dxos/echo';
9
+ import { type JsonPath, splitJsonPath } from '@dxos/echo/internal';
10
+ import { invariant } from '@dxos/invariant';
11
+ import { HuePicker } from '@dxos/react-ui-pickers';
12
+ import { isNonNullable } from '@dxos/util';
13
+
14
+ import { translationKey } from '#translations';
15
+
16
+ import { Form, type FormFieldMap, omitId } from '../Form';
17
+
18
+ export type ObjectFormProps = {
19
+ schema: Schema.Schema.AnyNoContext;
20
+ object: Obj.Unknown;
21
+ };
22
+
23
+ const createFieldMap: FormFieldMap = {
24
+ hue: ({ type, label, layout, getValue, onValueChange }) => {
25
+ const handleChange = useCallback((nextHue: string) => onValueChange(type, nextHue), [onValueChange, type]);
26
+ const handleReset = useCallback(() => onValueChange(type, undefined), [onValueChange, type]);
27
+ return (
28
+ <>
29
+ {layout !== 'inline' && <Form.Label label={label} />}
30
+ <HuePicker value={getValue()} onChange={handleChange} onReset={handleReset} />
31
+ </>
32
+ );
33
+ },
34
+ };
35
+
36
+ export const ObjectForm = ({ object, schema }: ObjectFormProps) => {
37
+ const db = Obj.getDatabase(object);
38
+ const meta = Obj.getMeta(object);
39
+ const tags = (meta.tags ?? []).map((tag) => db?.makeRef(DXN.parse(tag))).filter(isNonNullable);
40
+ const values = useMemo(() => ({ tags, ...object }), [object, tags]);
41
+ const formSchema = useMemo(
42
+ () =>
43
+ omitId(
44
+ Schema.Struct({
45
+ tags: Schema.Array(Ref.Ref(Tag.Tag)).pipe(Schema.optional),
46
+ }).pipe(Schema.extend(schema)),
47
+ ),
48
+ [schema],
49
+ );
50
+
51
+ const handleCreate = useCallback((schema: Type.AnyEntity, values: any) => {
52
+ invariant(db);
53
+ invariant(Type.isObjectSchema(schema));
54
+ const newObject = db.add(Obj.make(schema, values));
55
+ if (Obj.instanceOf(Tag.Tag, newObject)) {
56
+ Obj.update(object, (object) => {
57
+ Obj.getMeta(object).tags = [...(Obj.getMeta(object).tags ?? []), Obj.getDXN(newObject).toString()];
58
+ });
59
+ }
60
+ }, []);
61
+
62
+ // TODO(wittjosiah): Use FormRootProps type.
63
+ const handleChange = useCallback(
64
+ ({ tags, ...values }: any, { isValid, changed }: { isValid: boolean; changed: Record<JsonPath, boolean> }) => {
65
+ if (!isValid) {
66
+ return;
67
+ }
68
+
69
+ const changedPaths = Object.keys(changed).filter((path) => changed[path as JsonPath]) as JsonPath[];
70
+
71
+ // Handle tags separately using Obj.update.
72
+ const hasTagsChange = changedPaths.some((path) => splitJsonPath(path)[0] === 'tags');
73
+ if (hasTagsChange) {
74
+ Obj.update(object, (object) => {
75
+ Obj.getMeta(object).tags = tags?.map((tag: Ref.Ref<Tag.Tag>) => tag.dxn.toString()) ?? [];
76
+ });
77
+ }
78
+
79
+ // Handle other property changes.
80
+ const nonTagPaths = changedPaths.filter((path) => splitJsonPath(path)[0] !== 'tags');
81
+ if (nonTagPaths.length > 0) {
82
+ Obj.update(object, () => {
83
+ for (const path of nonTagPaths) {
84
+ const parts = splitJsonPath(path);
85
+ const value = Obj.getValue(values, parts);
86
+ Obj.setValue(object, parts, value);
87
+ }
88
+ });
89
+ }
90
+ },
91
+ [object],
92
+ );
93
+
94
+ return (
95
+ <Form.Root
96
+ schema={formSchema}
97
+ defaultValues={values}
98
+ createTypename={Type.getTypename(Tag.Tag)}
99
+ createOptionIcon='ph--plus--regular'
100
+ createOptionLabel={['add-tag.label', { ns: translationKey }]}
101
+ createInitialValuePath='label'
102
+ createFieldMap={createFieldMap}
103
+ db={db}
104
+ onValuesChanged={handleChange}
105
+ onCreate={handleCreate}
106
+ >
107
+ <Form.Viewport>
108
+ <Form.Content>
109
+ <Form.FieldSet />
110
+ </Form.Content>
111
+ </Form.Viewport>
112
+ </Form.Root>
113
+ );
114
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * from './ObjectForm';
@@ -7,16 +7,17 @@ import * as Schema from 'effect/Schema';
7
7
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
8
8
  import { expect, fn, userEvent, within } from 'storybook/test';
9
9
 
10
- import { Obj } from '@dxos/echo';
10
+ import { Filter, Obj } from '@dxos/echo';
11
11
  import { random } from '@dxos/random';
12
- import { Filter, useQuery } from '@dxos/react-client/echo';
12
+ import { useQuery } from '@dxos/react-client/echo';
13
13
  import { useClientStory, withClientProvider } from '@dxos/react-client/testing';
14
14
  import { Button } from '@dxos/react-ui';
15
15
  import { withTheme } from '@dxos/react-ui/testing';
16
16
  import { Person } from '@dxos/types';
17
17
  import { osTranslations } from '@dxos/ui-theme';
18
18
 
19
- import { translations } from '../../translations';
19
+ import { translations } from '#translations';
20
+
20
21
  import { ObjectPicker } from './ObjectPicker';
21
22
 
22
23
  random.seed(1);
@@ -47,7 +48,7 @@ const DefaultStory = () => {
47
48
  }
48
49
  }, [space]);
49
50
 
50
- // Get all objects in the space (similar to BoardContainer)
51
+ // Get all objects in the space (similar to BoardArticle)
51
52
  const allObjects = useQuery(space?.db, Filter.everything());
52
53
 
53
54
  // Map objects to options format expected by ObjectPicker
@@ -64,7 +65,9 @@ const DefaultStory = () => {
64
65
  const handleCreateCallback = useCallback(
65
66
  (values: any) => {
66
67
  console.log('[on create]', values);
67
- if (!space) return;
68
+ if (!space) {
69
+ return;
70
+ }
68
71
  const newPerson = space.db.add(Obj.make(Person.Person, values));
69
72
  mockHandleCreate(values);
70
73
  return newPerson;
@@ -73,7 +76,7 @@ const DefaultStory = () => {
73
76
  );
74
77
 
75
78
  return (
76
- <div role='none' className='w-96'>
79
+ <div className='w-96'>
77
80
  <ObjectPicker.Root open={isOpen} onOpenChange={setIsOpen}>
78
81
  <ObjectPicker.Trigger asChild>
79
82
  <Button variant='primary' data-testid='trigger' classNames='w-full'>
@@ -6,9 +6,11 @@ import type * as Schema from 'effect/Schema';
6
6
  import React, { type KeyboardEvent, forwardRef, useCallback, useState } from 'react';
7
7
 
8
8
  import { type Palette, Popover, type ThemedClassName, useTranslation } from '@dxos/react-ui';
9
- import { Combobox, useSearchListInput, useSearchListResults } from '@dxos/react-ui-search';
9
+ import { Combobox } from '@dxos/react-ui-list';
10
+ import { useSearchListResults } from '@dxos/react-ui-search';
11
+
12
+ import { translationKey } from '#translations';
10
13
 
11
- import { translationKey } from '../../translations';
12
14
  import { Form } from '../Form';
13
15
  import { type FormFieldMap } from '../Form/FormFieldComponent';
14
16
 
@@ -26,7 +28,14 @@ export type ObjectPickerContentProps = ThemedClassName<{
26
28
  createSchema?: Schema.Schema.AnyNoContext;
27
29
  createInitialValuePath?: string;
28
30
  createFieldMap?: FormFieldMap;
29
- onCreate?: (values: any) => void;
31
+ /**
32
+ * Persist a newly-created object given the form values. May be async (e.g.
33
+ * to write to a database). The Promise is awaited before the inline create
34
+ * form is collapsed back to the picker list, so consumers can complete
35
+ * follow-up work (assign the new ref to a parent slot, close the popover)
36
+ * before the picker UI re-renders.
37
+ */
38
+ onCreate?: (values: any) => unknown | Promise<unknown>;
30
39
  onSelect: (id: string) => void;
31
40
  }>;
32
41
 
@@ -50,13 +59,13 @@ const ObjectPickerContent = forwardRef<HTMLDivElement, ObjectPickerContentProps>
50
59
  const [showForm, setShowForm] = useState(false);
51
60
  const [formInitialValue, setFormInitialValue] = useState<string>('');
52
61
 
53
- const { results, handleSearch } = useSearchListResults({
62
+ const { results, query, handleSearch } = useSearchListResults({
54
63
  items: options,
55
64
  });
56
65
 
57
66
  const handleFormSave = useCallback(
58
- (values: any) => {
59
- onCreate?.(values);
67
+ async (values: any) => {
68
+ await onCreate?.(values);
60
69
  setShowForm(false);
61
70
  setFormInitialValue('');
62
71
  },
@@ -91,7 +100,7 @@ const ObjectPickerContent = forwardRef<HTMLDivElement, ObjectPickerContentProps>
91
100
 
92
101
  if (showForm && createSchema) {
93
102
  return (
94
- <Combobox.Content {...props} onSearch={handleSearch} onKeyDownCapture={handleKeyDown} ref={forwardedRef}>
103
+ <Combobox.Content {...props} onKeyDownCapture={handleKeyDown} ref={forwardedRef}>
95
104
  <Popover.Viewport>
96
105
  <Form.Root
97
106
  testId='create-referenced-object-form'
@@ -115,8 +124,13 @@ const ObjectPickerContent = forwardRef<HTMLDivElement, ObjectPickerContentProps>
115
124
  }
116
125
 
117
126
  return (
118
- <Combobox.Content {...props} onSearch={handleSearch} onKeyDownCapture={handleKeyDown} ref={forwardedRef}>
119
- <Combobox.Input placeholder={t('ref-field-combobox-input.placeholder')} autoFocus />
127
+ <Combobox.Content {...props} onKeyDownCapture={handleKeyDown} ref={forwardedRef}>
128
+ <Combobox.Input
129
+ placeholder={t('ref-field-combobox-input.placeholder')}
130
+ autoFocus
131
+ value={query}
132
+ onValueChange={handleSearch}
133
+ />
120
134
  <Combobox.List>
121
135
  {results.map((option) => (
122
136
  <Combobox.Item
@@ -130,10 +144,11 @@ const ObjectPickerContent = forwardRef<HTMLDivElement, ObjectPickerContentProps>
130
144
  ))}
131
145
  {createSchema && onCreate && (
132
146
  <CreateItem
147
+ query={query}
133
148
  createOptionLabel={createOptionLabel}
134
149
  createOptionIcon={createOptionIcon ?? 'ph--plus--regular'}
135
- onCreateItemSelect={(query: string) => {
136
- setFormInitialValue(query);
150
+ onCreateItemSelect={(currentQuery: string) => {
151
+ setFormInitialValue(currentQuery);
137
152
  setShowForm(true);
138
153
  }}
139
154
  />
@@ -146,16 +161,17 @@ const ObjectPickerContent = forwardRef<HTMLDivElement, ObjectPickerContentProps>
146
161
  );
147
162
 
148
163
  const CreateItem = ({
164
+ query,
149
165
  createOptionLabel,
150
166
  createOptionIcon,
151
167
  onCreateItemSelect,
152
168
  }: {
169
+ query: string;
153
170
  createOptionLabel?: [string, { ns: string }];
154
171
  createOptionIcon: string;
155
172
  onCreateItemSelect: (query: string) => void;
156
173
  }) => {
157
174
  const { t } = useTranslation(translationKey);
158
- const { query } = useSearchListInput();
159
175
 
160
176
  const label = createOptionLabel
161
177
  ? t(createOptionLabel[0], { ns: createOptionLabel[1].ns, text: query })