@react-fabric/form 1.0.0-beta.60 → 1.0.0-beta.61
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/cjs/builder/FileField.js +2 -2
- package/dist/cjs/builder/components/AddSchemaFields.js +2 -1
- package/dist/cjs/builder/components/SchemaArrayForm.js +3 -3
- package/dist/cjs/builder/components/SchemaField.js +2 -2
- package/dist/cjs/form/Form.js +5 -8
- package/dist/cjs/hooks/useFormBuilder.js +10 -3
- package/dist/cjs/input/ArrayInput.js +3 -3
- package/dist/cjs/input/AvatarInput.js +3 -3
- package/dist/cjs/input/Checkbox.js +2 -2
- package/dist/cjs/input/ColorInput.js +2 -2
- package/dist/cjs/input/File.js +1 -1
- package/dist/cjs/input/Password.js +1 -1
- package/dist/cjs/input/Radio.js +2 -2
- package/dist/cjs/input/Search.js +2 -3
- package/dist/cjs/internal/ErrorIcon.js +1 -1
- package/dist/cjs/internal/InputWrapper.js +3 -3
- package/dist/cjs/select/AutoComplete.js +1 -2
- package/dist/cjs/select/DualList.js +4 -4
- package/dist/cjs/select/List.js +4 -22
- package/dist/cjs/select/Select.js +8 -27
- package/dist/esm/builder/FileField.js +3 -3
- package/dist/esm/builder/components/AddSchemaFields.js +2 -1
- package/dist/esm/builder/components/SchemaArrayForm.js +4 -4
- package/dist/esm/builder/components/SchemaField.js +3 -3
- package/dist/esm/form/Form.js +5 -8
- package/dist/esm/hooks/useFormBuilder.js +10 -3
- package/dist/esm/input/ArrayInput.js +4 -4
- package/dist/esm/input/AvatarInput.js +4 -4
- package/dist/esm/input/Checkbox.js +3 -3
- package/dist/esm/input/ColorInput.js +3 -3
- package/dist/esm/input/File.js +2 -2
- package/dist/esm/input/Password.js +2 -2
- package/dist/esm/input/Radio.js +3 -3
- package/dist/esm/input/Search.js +3 -4
- package/dist/esm/internal/ErrorIcon.js +2 -2
- package/dist/esm/internal/InputWrapper.js +4 -4
- package/dist/esm/select/AutoComplete.js +2 -3
- package/dist/esm/select/DualList.js +5 -5
- package/dist/esm/select/List.js +4 -22
- package/dist/esm/select/Select.js +9 -28
- package/dist/types/form/Form.d.ts +6 -9
- package/dist/types/hooks/useFormBuilder.d.ts +6 -0
- package/dist/types/input/AvatarInput.d.ts +1 -1
- package/dist/types/select/DualList.d.ts +5 -6
- package/dist/types/select/Options.d.ts +1 -1
- package/dist/types/types/index.d.ts +7 -8
- package/package.json +5 -5
- package/src/builder/FileField.tsx +3 -9
- package/src/builder/components/AddSchemaFields.tsx +2 -1
- package/src/builder/components/SchemaArrayForm.tsx +4 -10
- package/src/builder/components/SchemaField.tsx +2 -3
- package/src/form/Form.tsx +10 -11
- package/src/hooks/useFormBuilder.tsx +12 -4
- package/src/input/ArrayInput.tsx +4 -10
- package/src/input/AvatarInput.tsx +5 -5
- package/src/input/Checkbox.tsx +6 -3
- package/src/input/ColorInput.tsx +3 -7
- package/src/input/File.tsx +2 -2
- package/src/input/Password.tsx +4 -2
- package/src/input/Radio.tsx +3 -3
- package/src/input/Search.tsx +3 -3
- package/src/internal/ErrorIcon.tsx +2 -2
- package/src/internal/InputWrapper.tsx +8 -4
- package/src/select/AutoComplete.tsx +2 -3
- package/src/select/DualList.tsx +14 -11
- package/src/select/List.tsx +1 -1
- package/src/select/Options.tsx +1 -1
- package/src/select/Select.tsx +6 -7
- package/src/types/index.ts +8 -7
package/src/select/DualList.tsx
CHANGED
|
@@ -28,11 +28,14 @@ import {
|
|
|
28
28
|
useDroppable,
|
|
29
29
|
} from "@dnd-kit/core";
|
|
30
30
|
import { restrictToHorizontalAxis } from "@dnd-kit/modifiers";
|
|
31
|
-
import { Button, ButtonGroup
|
|
32
|
-
import { type RefProp } from "@react-fabric/core/dist/types/types";
|
|
33
|
-
import { mergeRefs } from "@react-fabric/utilities";
|
|
31
|
+
import { Button, ButtonGroup } from "@react-fabric/core";
|
|
34
32
|
import {
|
|
33
|
+
type NestedKeys,
|
|
35
34
|
type ReactElement,
|
|
35
|
+
type RefProp,
|
|
36
|
+
} from "@react-fabric/core/dist/types/types";
|
|
37
|
+
import { mergeRefs } from "@react-fabric/utilities";
|
|
38
|
+
import {
|
|
36
39
|
useCallback,
|
|
37
40
|
useDeferredValue,
|
|
38
41
|
useEffect,
|
|
@@ -60,15 +63,15 @@ export interface DualListProps<T>
|
|
|
60
63
|
/**
|
|
61
64
|
* group by property name
|
|
62
65
|
*/
|
|
63
|
-
groupProperty?:
|
|
66
|
+
groupProperty?: NestedKeys<T>;
|
|
64
67
|
/**
|
|
65
68
|
* label property name
|
|
66
69
|
*/
|
|
67
|
-
labelProperty?:
|
|
70
|
+
labelProperty?: NestedKeys<T>;
|
|
68
71
|
/**
|
|
69
72
|
* value property name
|
|
70
73
|
*/
|
|
71
|
-
valueProperty?:
|
|
74
|
+
valueProperty?: NestedKeys<T>;
|
|
72
75
|
/**
|
|
73
76
|
* empty list display
|
|
74
77
|
*/
|
|
@@ -76,7 +79,7 @@ export interface DualListProps<T>
|
|
|
76
79
|
/**
|
|
77
80
|
* item renderer
|
|
78
81
|
*/
|
|
79
|
-
renderer?: (option: T) =>
|
|
82
|
+
renderer?: (option: T) => ReactElement;
|
|
80
83
|
/**
|
|
81
84
|
* change handler
|
|
82
85
|
*/
|
|
@@ -244,7 +247,7 @@ export const DualList = <T extends AnyObject = string>({
|
|
|
244
247
|
variant="link"
|
|
245
248
|
aria-label="scroll to top"
|
|
246
249
|
onClick={moveAllLeft}
|
|
247
|
-
icon={{ icon:
|
|
250
|
+
icon={{ icon: "icon-[mdi--chevron-double-left]", rtlFlip: true }}
|
|
248
251
|
disabled={!rightOptions.length}
|
|
249
252
|
/>
|
|
250
253
|
<Button
|
|
@@ -252,7 +255,7 @@ export const DualList = <T extends AnyObject = string>({
|
|
|
252
255
|
variant="link"
|
|
253
256
|
aria-label="scroll up"
|
|
254
257
|
onClick={moveRightSelected}
|
|
255
|
-
icon={{ icon:
|
|
258
|
+
icon={{ icon: "icon-[mdi--chevron-left]", rtlFlip: true }}
|
|
256
259
|
disabled={!rightSelected.length}
|
|
257
260
|
/>
|
|
258
261
|
<Button
|
|
@@ -260,7 +263,7 @@ export const DualList = <T extends AnyObject = string>({
|
|
|
260
263
|
variant="link"
|
|
261
264
|
aria-label="scroll down"
|
|
262
265
|
onClick={moveLeftSelected}
|
|
263
|
-
icon={{ icon:
|
|
266
|
+
icon={{ icon: "icon-[mdi--chevron-right]", rtlFlip: true }}
|
|
264
267
|
disabled={!leftSelected.length}
|
|
265
268
|
/>
|
|
266
269
|
<Button
|
|
@@ -268,7 +271,7 @@ export const DualList = <T extends AnyObject = string>({
|
|
|
268
271
|
variant="link"
|
|
269
272
|
aria-label="scroll to bottom"
|
|
270
273
|
onClick={moveAllRight}
|
|
271
|
-
icon={{ icon:
|
|
274
|
+
icon={{ icon: "icon-[mdi--chevron-double-right]", rtlFlip: true }}
|
|
272
275
|
disabled={!leftOptions.length}
|
|
273
276
|
/>
|
|
274
277
|
</ButtonGroup>
|
package/src/select/List.tsx
CHANGED
|
@@ -324,7 +324,7 @@ export const List = <T extends AnyObject = string>({
|
|
|
324
324
|
empty={emptyDisplay}
|
|
325
325
|
info={state.activeItem?.[infoProperty ?? "info"]}
|
|
326
326
|
>
|
|
327
|
-
{
|
|
327
|
+
{(item, label) => renderer?.(item) ?? label}
|
|
328
328
|
</Options>
|
|
329
329
|
</FloatingFocusManager>
|
|
330
330
|
</Wrapper>
|
package/src/select/Options.tsx
CHANGED
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import { EmptyContent } from "@react-fabric/core";
|
|
25
|
+
import { type ReactElement } from "@react-fabric/core/dist/types/types";
|
|
25
26
|
import classNames from "classnames";
|
|
26
|
-
import { type ReactElement } from "react";
|
|
27
27
|
import { Trans } from "react-i18next";
|
|
28
28
|
|
|
29
29
|
export const Options = ({
|
package/src/select/Select.tsx
CHANGED
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
useListNavigation,
|
|
36
36
|
useTypeahead,
|
|
37
37
|
} from "@floating-ui/react";
|
|
38
|
-
import { Chip,
|
|
38
|
+
import { Chip, Icon } from "@react-fabric/core";
|
|
39
39
|
import { isArray, isEmpty } from "@react-fabric/utilities";
|
|
40
40
|
import classNames from "classnames";
|
|
41
41
|
import { useCallback, useId, useLayoutEffect, useMemo } from "react";
|
|
@@ -249,7 +249,7 @@ export const Select = <T extends AnyObject = string>({
|
|
|
249
249
|
));
|
|
250
250
|
} else if (!isEmpty(state.value) && !state.query) {
|
|
251
251
|
return (
|
|
252
|
-
<span className="self-center pointer-events-none select-none">
|
|
252
|
+
<span className="self-center pointer-events-none select-none truncate leading-tight">
|
|
253
253
|
{renderer?.(state.value) ?? state.value[labelProperty] ?? state.value}
|
|
254
254
|
</span>
|
|
255
255
|
);
|
|
@@ -310,7 +310,7 @@ export const Select = <T extends AnyObject = string>({
|
|
|
310
310
|
className={classNames(
|
|
311
311
|
"appearance-none bg-transparent outline-none border-none ring-0 flex-1 peer",
|
|
312
312
|
disabled && "cursor-not-allowed pointer-events-none",
|
|
313
|
-
multiple
|
|
313
|
+
multiple ? "min-w-24" : "min-w-2",
|
|
314
314
|
)}
|
|
315
315
|
placeholder={isEmpty(state.value) ? placeholder : ""}
|
|
316
316
|
onChange={(evt) => handleQuery(evt.target.value)}
|
|
@@ -324,16 +324,15 @@ export const Select = <T extends AnyObject = string>({
|
|
|
324
324
|
disabled && "pointer-events-none",
|
|
325
325
|
)}
|
|
326
326
|
onClick={() => !disabled && openDropdown()}
|
|
327
|
-
icon=
|
|
327
|
+
icon="icon-[mdi--chevron-down]"
|
|
328
328
|
/>
|
|
329
329
|
)}
|
|
330
330
|
{state.loading && (
|
|
331
331
|
<Icon
|
|
332
|
-
animate="spin"
|
|
333
332
|
className={classNames(
|
|
334
333
|
"flex-content p-2 z-0 order-9 text-muted pointer-events-none",
|
|
335
334
|
)}
|
|
336
|
-
icon=
|
|
335
|
+
icon="icon-[svg-spinners--eclipse]"
|
|
337
336
|
/>
|
|
338
337
|
)}
|
|
339
338
|
{state.open && !state.loading && (
|
|
@@ -360,7 +359,7 @@ export const Select = <T extends AnyObject = string>({
|
|
|
360
359
|
empty={emptyDisplay}
|
|
361
360
|
info={state.activeItem?.[infoProperty ?? "info"]}
|
|
362
361
|
>
|
|
363
|
-
{
|
|
362
|
+
{(item, label) => renderer?.(item) ?? label}
|
|
364
363
|
</Options>
|
|
365
364
|
</FloatingFocusManager>
|
|
366
365
|
</FloatingPortal>
|
package/src/types/index.ts
CHANGED
|
@@ -22,10 +22,11 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import {
|
|
25
|
+
type NestedKeys,
|
|
26
|
+
type ReactElement,
|
|
25
27
|
type RefProp,
|
|
26
28
|
type TestProps,
|
|
27
29
|
} from "@react-fabric/core/dist/types/types";
|
|
28
|
-
import { type ReactElement } from "react";
|
|
29
30
|
|
|
30
31
|
export interface InputProps<V = string> extends TestProps {
|
|
31
32
|
/**
|
|
@@ -145,23 +146,23 @@ export interface BaseSelectProps<T extends AnyObject = string> {
|
|
|
145
146
|
/**
|
|
146
147
|
* group by property name
|
|
147
148
|
*/
|
|
148
|
-
groupProperty?:
|
|
149
|
+
groupProperty?: NestedKeys<T>;
|
|
149
150
|
/**
|
|
150
151
|
* label property name
|
|
151
152
|
*/
|
|
152
|
-
labelProperty?:
|
|
153
|
+
labelProperty?: NestedKeys<T>;
|
|
153
154
|
/**
|
|
154
155
|
* value property name
|
|
155
156
|
*/
|
|
156
|
-
valueProperty?:
|
|
157
|
+
valueProperty?: NestedKeys<T>;
|
|
157
158
|
/**
|
|
158
159
|
* value property name
|
|
159
160
|
*/
|
|
160
|
-
infoProperty?:
|
|
161
|
+
infoProperty?: NestedKeys<T>;
|
|
161
162
|
/**
|
|
162
163
|
* value property name
|
|
163
164
|
*/
|
|
164
|
-
sortProperty?:
|
|
165
|
+
sortProperty?: NestedKeys<T> | true;
|
|
165
166
|
/**
|
|
166
167
|
* searchable list
|
|
167
168
|
*/
|
|
@@ -185,7 +186,7 @@ export interface BaseSelectProps<T extends AnyObject = string> {
|
|
|
185
186
|
/**
|
|
186
187
|
* item renderer
|
|
187
188
|
*/
|
|
188
|
-
renderer?: (option: T) =>
|
|
189
|
+
renderer?: (option: T) => ReactElement;
|
|
189
190
|
/**
|
|
190
191
|
* item matcher
|
|
191
192
|
*/
|