@pixpilot/formily-shadcn 1.1.0 → 1.3.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/components/Checkbox.d.cts +2 -2
- package/dist/components/Column.d.cts +2 -2
- package/dist/components/DatePicker.d.cts +3 -3
- package/dist/components/Form.d.ts +2 -2
- package/dist/components/FormGrid.d.cts +2 -2
- package/dist/components/FormGrid.d.ts +2 -2
- package/dist/components/IconPicker.d.cts +3 -3
- package/dist/components/IconPicker.d.ts +3 -3
- package/dist/components/IconToggle.d.cts +2 -2
- package/dist/components/IconToggle.d.ts +2 -2
- package/dist/components/Input.d.cts +3 -3
- package/dist/components/Input.d.ts +3 -3
- package/dist/components/Switch.d.cts +2 -2
- package/dist/components/TagsInputInline.d.cts +2 -2
- package/dist/components/TagsInputInline.d.ts +3 -3
- package/dist/components/Textarea.d.cts +2 -2
- package/dist/components/Textarea.d.ts +2 -2
- package/dist/components/ToggleButton.d.cts +2 -2
- package/dist/components/ToggleButton.d.ts +3 -3
- package/dist/components/ToggleGroup.cjs +13 -40
- package/dist/components/ToggleGroup.d.cts +8 -6
- package/dist/components/ToggleGroup.d.ts +8 -6
- package/dist/components/ToggleGroup.js +15 -41
- package/dist/components/file-upload/FileUpload.d.cts +8 -8
- package/dist/components/file-upload/FileUploadInline.d.cts +8 -8
- package/dist/components/schema-field/schema-field-basics.d.ts +303 -303
- package/dist/components/schema-field/schema-field-extended.d.cts +9 -9
- package/dist/components/schema-field/schema-field-extended.d.ts +633 -633
- package/dist/components/schema-field/schema-field.d.ts +412 -412
- package/dist/components/slider/Slider.d.cts +3 -3
- package/dist/components/slider/SliderInput.d.ts +3 -3
- package/dist/components/slider/SliderSelect.d.cts +3 -3
- package/dist/components/slider/SliderSelect.d.ts +3 -3
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react1 from "react";
|
|
2
2
|
import * as _radix_ui_react_checkbox0 from "@radix-ui/react-checkbox";
|
|
3
3
|
|
|
4
4
|
//#region src/components/Checkbox.d.ts
|
|
@@ -6,6 +6,6 @@ import * as _radix_ui_react_checkbox0 from "@radix-ui/react-checkbox";
|
|
|
6
6
|
* Formily-connected Checkbox component
|
|
7
7
|
* Maps Formily field checked state to shadcn Checkbox
|
|
8
8
|
*/
|
|
9
|
-
declare const Checkbox:
|
|
9
|
+
declare const Checkbox: react1.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_checkbox0.CheckboxProps & react1.RefAttributes<HTMLButtonElement>>, "ref"> & react1.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Checkbox };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/Column.d.ts
|
|
5
5
|
interface IColumnProps {
|
|
@@ -36,6 +36,6 @@ interface IColumnProps {
|
|
|
36
36
|
declare function Column({
|
|
37
37
|
className,
|
|
38
38
|
children
|
|
39
|
-
}: IColumnProps):
|
|
39
|
+
}: IColumnProps): react_jsx_runtime1.JSX.Element;
|
|
40
40
|
//#endregion
|
|
41
41
|
export { Column };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react0 from "react";
|
|
2
2
|
import { DatePickerProps } from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/DatePicker.d.ts
|
|
5
|
-
declare const DatePicker:
|
|
5
|
+
declare const DatePicker: react0.ForwardRefExoticComponent<Partial<{
|
|
6
6
|
value?: Date;
|
|
7
7
|
onChange?: (date: Date | undefined) => void;
|
|
8
8
|
placeholder?: string;
|
|
9
|
-
} & Omit<DatePickerProps, "onSelect" | "selected" | "mode">> &
|
|
9
|
+
} & Omit<DatePickerProps, "onSelect" | "selected" | "mode">> & react0.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { DatePicker };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FormContextStates } from "./context/form-context.js";
|
|
2
2
|
import "./context/index.js";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
5
5
|
import { Form } from "@formily/core";
|
|
6
6
|
|
|
7
7
|
//#region src/components/Form.d.ts
|
|
@@ -25,6 +25,6 @@ declare function Form$1({
|
|
|
25
25
|
onAutoSubmit,
|
|
26
26
|
layout,
|
|
27
27
|
settings
|
|
28
|
-
}: IFormProps):
|
|
28
|
+
}: IFormProps): react_jsx_runtime1.JSX.Element;
|
|
29
29
|
//#endregion
|
|
30
30
|
export { Form$1 as Form };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/FormGrid.d.ts
|
|
5
5
|
interface IFormGridProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
@@ -7,6 +7,6 @@ declare function FormGrid({
|
|
|
7
7
|
className,
|
|
8
8
|
children,
|
|
9
9
|
...rest
|
|
10
|
-
}: IFormGridProps):
|
|
10
|
+
}: IFormGridProps): react_jsx_runtime0.JSX.Element;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { FormGrid };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/FormGrid.d.ts
|
|
5
5
|
interface IFormGridProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
@@ -7,6 +7,6 @@ declare function FormGrid({
|
|
|
7
7
|
className,
|
|
8
8
|
children,
|
|
9
9
|
...rest
|
|
10
|
-
}: IFormGridProps):
|
|
10
|
+
}: IFormGridProps): react_jsx_runtime0.JSX.Element;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { FormGrid };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react4 from "react";
|
|
2
2
|
import { IconPickerProps, IconProviderProps } from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/IconPicker.d.ts
|
|
@@ -8,8 +8,8 @@ import { IconPickerProps, IconProviderProps } from "@pixpilot/shadcn-ui";
|
|
|
8
8
|
* Automatically connects to Formily field state
|
|
9
9
|
* Supports both static and async icon providers
|
|
10
10
|
*/
|
|
11
|
-
declare const IconPicker:
|
|
11
|
+
declare const IconPicker: react4.ForwardRefExoticComponent<Partial<Omit<IconPickerProps, "providers"> & {
|
|
12
12
|
providers?: IconProviderProps[];
|
|
13
|
-
}> &
|
|
13
|
+
}> & react4.RefAttributes<unknown>>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { IconPicker };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react8 from "react";
|
|
2
2
|
import { IconPickerProps, IconProviderProps } from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/IconPicker.d.ts
|
|
@@ -8,8 +8,8 @@ import { IconPickerProps, IconProviderProps } from "@pixpilot/shadcn-ui";
|
|
|
8
8
|
* Automatically connects to Formily field state
|
|
9
9
|
* Supports both static and async icon providers
|
|
10
10
|
*/
|
|
11
|
-
declare const IconPicker$1:
|
|
11
|
+
declare const IconPicker$1: react8.ForwardRefExoticComponent<Partial<Omit<IconPickerProps, "providers"> & {
|
|
12
12
|
providers?: IconProviderProps[];
|
|
13
|
-
}> &
|
|
13
|
+
}> & react8.RefAttributes<unknown>>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { IconPicker$1 as IconPicker };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react6 from "react";
|
|
2
2
|
import * as _pixpilot_shadcn_ui0 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/IconToggle.d.ts
|
|
@@ -6,6 +6,6 @@ import * as _pixpilot_shadcn_ui0 from "@pixpilot/shadcn-ui";
|
|
|
6
6
|
* Formily-connected IconToggle component
|
|
7
7
|
* Toggle button with customizable icons for boolean values
|
|
8
8
|
*/
|
|
9
|
-
declare const IconToggle:
|
|
9
|
+
declare const IconToggle: react6.ForwardRefExoticComponent<Omit<Partial<Omit<_pixpilot_shadcn_ui0.IconToggleProps, "ref"> & react6.RefAttributes<HTMLButtonElement>>, "ref"> & react6.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { IconToggle };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react10 from "react";
|
|
2
2
|
import * as _pixpilot_shadcn_ui0 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/IconToggle.d.ts
|
|
@@ -6,6 +6,6 @@ import * as _pixpilot_shadcn_ui0 from "@pixpilot/shadcn-ui";
|
|
|
6
6
|
* Formily-connected IconToggle component
|
|
7
7
|
* Toggle button with customizable icons for boolean values
|
|
8
8
|
*/
|
|
9
|
-
declare const IconToggle$1:
|
|
9
|
+
declare const IconToggle$1: react10.ForwardRefExoticComponent<Omit<Partial<Omit<_pixpilot_shadcn_ui0.IconToggleProps, "ref"> & react10.RefAttributes<HTMLButtonElement>>, "ref"> & react10.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { IconToggle$1 as IconToggle };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react9 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/components/Input.d.ts
|
|
4
4
|
|
|
@@ -6,12 +6,12 @@ import * as react7 from "react";
|
|
|
6
6
|
* Formily-connected Input component
|
|
7
7
|
* Automatically connects shadcn Input to Formily field state
|
|
8
8
|
*/
|
|
9
|
-
declare const Input:
|
|
9
|
+
declare const Input: react9.ForwardRefExoticComponent<Omit<Partial<react9.ClassAttributes<HTMLInputElement> & react9.InputHTMLAttributes<HTMLInputElement> & {
|
|
10
10
|
prefix?: React.ReactNode;
|
|
11
11
|
suffix?: React.ReactNode;
|
|
12
12
|
groupClassName?: string;
|
|
13
13
|
prefixClassName?: string;
|
|
14
14
|
suffixClassName?: string;
|
|
15
|
-
}>, "ref"> &
|
|
15
|
+
}>, "ref"> & react9.RefAttributes<unknown>>;
|
|
16
16
|
//#endregion
|
|
17
17
|
export { Input };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react4 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/components/Input.d.ts
|
|
4
4
|
|
|
@@ -6,12 +6,12 @@ import * as react9 from "react";
|
|
|
6
6
|
* Formily-connected Input component
|
|
7
7
|
* Automatically connects shadcn Input to Formily field state
|
|
8
8
|
*/
|
|
9
|
-
declare const Input:
|
|
9
|
+
declare const Input: react4.ForwardRefExoticComponent<Omit<Partial<react4.ClassAttributes<HTMLInputElement> & react4.InputHTMLAttributes<HTMLInputElement> & {
|
|
10
10
|
prefix?: React.ReactNode;
|
|
11
11
|
suffix?: React.ReactNode;
|
|
12
12
|
groupClassName?: string;
|
|
13
13
|
prefixClassName?: string;
|
|
14
14
|
suffixClassName?: string;
|
|
15
|
-
}>, "ref"> &
|
|
15
|
+
}>, "ref"> & react4.RefAttributes<unknown>>;
|
|
16
16
|
//#endregion
|
|
17
17
|
export { Input };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react21 from "react";
|
|
2
2
|
import * as _radix_ui_react_switch0 from "@radix-ui/react-switch";
|
|
3
3
|
|
|
4
4
|
//#region src/components/Switch.d.ts
|
|
@@ -6,6 +6,6 @@ import * as _radix_ui_react_switch0 from "@radix-ui/react-switch";
|
|
|
6
6
|
* Formily-connected Switch component
|
|
7
7
|
* Toggle switch for boolean values
|
|
8
8
|
*/
|
|
9
|
-
declare const Switch:
|
|
9
|
+
declare const Switch: react21.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_switch0.SwitchProps & react21.RefAttributes<HTMLButtonElement>>, "ref"> & react21.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Switch };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react19 from "react";
|
|
2
2
|
import * as _pixpilot_shadcn_ui1 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/TagsInputInline.d.ts
|
|
@@ -10,6 +10,6 @@ import * as _pixpilot_shadcn_ui1 from "@pixpilot/shadcn-ui";
|
|
|
10
10
|
* Based on DiceUI's tags-input for inline tag editing with keyboard navigation
|
|
11
11
|
* and validation support.
|
|
12
12
|
*/
|
|
13
|
-
declare const TagsInputInLine:
|
|
13
|
+
declare const TagsInputInLine: react19.ForwardRefExoticComponent<Partial<_pixpilot_shadcn_ui1.TagsInputProps> & react19.RefAttributes<unknown>>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { TagsInputInLine };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
1
|
+
import * as react29 from "react";
|
|
2
|
+
import * as _pixpilot_shadcn_ui2 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/TagsInputInline.d.ts
|
|
5
5
|
|
|
@@ -10,6 +10,6 @@ import * as _pixpilot_shadcn_ui1 from "@pixpilot/shadcn-ui";
|
|
|
10
10
|
* Based on DiceUI's tags-input for inline tag editing with keyboard navigation
|
|
11
11
|
* and validation support.
|
|
12
12
|
*/
|
|
13
|
-
declare const TagsInputInLine:
|
|
13
|
+
declare const TagsInputInLine: react29.ForwardRefExoticComponent<Partial<_pixpilot_shadcn_ui2.TagsInputProps> & react29.RefAttributes<unknown>>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { TagsInputInLine };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react27 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/components/Textarea.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Formily-connected Textarea component
|
|
6
6
|
*/
|
|
7
|
-
declare const Textarea:
|
|
7
|
+
declare const Textarea: react27.ForwardRefExoticComponent<Omit<Partial<react27.ClassAttributes<HTMLTextAreaElement> & react27.TextareaHTMLAttributes<HTMLTextAreaElement>>, "ref"> & react27.RefAttributes<unknown>>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { Textarea };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react22 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/components/Textarea.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Formily-connected Textarea component
|
|
6
6
|
*/
|
|
7
|
-
declare const Textarea:
|
|
7
|
+
declare const Textarea: react22.ForwardRefExoticComponent<Omit<Partial<react22.ClassAttributes<HTMLTextAreaElement> & react22.TextareaHTMLAttributes<HTMLTextAreaElement>>, "ref"> & react22.RefAttributes<unknown>>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { Textarea };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react24 from "react";
|
|
2
2
|
import * as _pixpilot_shadcn_ui2 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/ToggleButton.d.ts
|
|
@@ -6,6 +6,6 @@ import * as _pixpilot_shadcn_ui2 from "@pixpilot/shadcn-ui";
|
|
|
6
6
|
* Formily-connected IconToggle component
|
|
7
7
|
* Toggle button with customizable icons for boolean values
|
|
8
8
|
*/
|
|
9
|
-
declare const ToggleButton:
|
|
9
|
+
declare const ToggleButton: react24.ForwardRefExoticComponent<Omit<Partial<Omit<_pixpilot_shadcn_ui2.ToggleButtonProps, "ref"> & react24.RefAttributes<HTMLButtonElement>>, "ref"> & react24.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { ToggleButton };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
1
|
+
import * as react26 from "react";
|
|
2
|
+
import * as _pixpilot_shadcn_ui1 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/ToggleButton.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Formily-connected IconToggle component
|
|
7
7
|
* Toggle button with customizable icons for boolean values
|
|
8
8
|
*/
|
|
9
|
-
declare const ToggleButton$1:
|
|
9
|
+
declare const ToggleButton$1: react26.ForwardRefExoticComponent<Omit<Partial<Omit<_pixpilot_shadcn_ui1.ToggleButtonProps, "ref"> & react26.RefAttributes<HTMLButtonElement>>, "ref"> & react26.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { ToggleButton$1 as ToggleButton };
|
|
@@ -31,41 +31,19 @@ function coerceOptions(options) {
|
|
|
31
31
|
};
|
|
32
32
|
}).filter((v) => v !== null);
|
|
33
33
|
}
|
|
34
|
-
function ToggleGroupBase({
|
|
34
|
+
function ToggleGroupBase({ options, value, defaultValue, onValueChange, allowEmptySelection = false, variant = "outline", size, fullWidth = true, slots, ref,...props }) {
|
|
35
|
+
const valueString = value === void 0 ? void 0 : String(value);
|
|
36
|
+
const defaultValueString = defaultValue === void 0 ? void 0 : String(defaultValue);
|
|
35
37
|
const valueByString = react.useMemo(() => {
|
|
36
38
|
const map = /* @__PURE__ */ new Map();
|
|
37
39
|
for (const option of options) map.set(String(option.value), option.value);
|
|
38
40
|
return map;
|
|
39
41
|
}, [options]);
|
|
40
|
-
const items = options.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn_ui.ToggleGroupItem, {
|
|
41
|
-
value: String(option.value),
|
|
42
|
-
"aria-label": String(option.value),
|
|
43
|
-
disabled: option.disabled,
|
|
44
|
-
className: buttonClassName,
|
|
45
|
-
children: option.label
|
|
46
|
-
}, String(option.value)));
|
|
47
|
-
if (type === "multiple") {
|
|
48
|
-
const multiValue = Array.isArray(value) ? value.map(String) : [];
|
|
49
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn_ui.ToggleGroup, {
|
|
50
|
-
...props,
|
|
51
|
-
ref,
|
|
52
|
-
type: "multiple",
|
|
53
|
-
value: multiValue,
|
|
54
|
-
variant: toVariant(variant),
|
|
55
|
-
size: toSize(size),
|
|
56
|
-
onValueChange: (nextValues) => {
|
|
57
|
-
const mappedValues = nextValues.map((v) => valueByString.get(v) ?? v);
|
|
58
|
-
onValueChange?.(mappedValues);
|
|
59
|
-
},
|
|
60
|
-
children: items
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
const valueString = value === void 0 || Array.isArray(value) ? void 0 : String(value);
|
|
64
|
-
const defaultValueString = defaultValue === void 0 || Array.isArray(defaultValue) ? void 0 : String(defaultValue);
|
|
65
42
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn_ui.ToggleGroup, {
|
|
43
|
+
type: "single",
|
|
66
44
|
...props,
|
|
45
|
+
className: (0, __pixpilot_shadcn_ui.cn)({ "w-full": fullWidth }, props.className),
|
|
67
46
|
ref,
|
|
68
|
-
type: "single",
|
|
69
47
|
value: valueString,
|
|
70
48
|
defaultValue: defaultValueString,
|
|
71
49
|
variant: toVariant(variant),
|
|
@@ -78,7 +56,14 @@ function ToggleGroupBase({ type = "single", options, value, defaultValue, onValu
|
|
|
78
56
|
}
|
|
79
57
|
onValueChange?.(valueByString.get(nextValue) ?? nextValue);
|
|
80
58
|
},
|
|
81
|
-
children:
|
|
59
|
+
children: options.map((option) => /* @__PURE__ */ (0, react.createElement)(__pixpilot_shadcn_ui.ToggleGroupItem, {
|
|
60
|
+
...slots?.item,
|
|
61
|
+
key: String(option.value),
|
|
62
|
+
value: String(option.value),
|
|
63
|
+
"aria-label": String(option.value),
|
|
64
|
+
disabled: option.disabled,
|
|
65
|
+
className: (0, __pixpilot_shadcn_ui.cn)({ "flex-1": fullWidth }, slots?.item?.className)
|
|
66
|
+
}, option.label))
|
|
82
67
|
});
|
|
83
68
|
}
|
|
84
69
|
/**
|
|
@@ -116,22 +101,10 @@ const ToggleGroup = (0, __formily_react.connect)(ToggleGroupBase, (0, __formily_
|
|
|
116
101
|
}, (props, field) => {
|
|
117
102
|
const toggleGroupProps = props;
|
|
118
103
|
const fieldValue = field.value;
|
|
119
|
-
const isMultiple = props.type === "multiple";
|
|
120
104
|
const resolvedOptions = coerceOptions(require_resolve_field_options.resolveFieldOptions({
|
|
121
105
|
field,
|
|
122
106
|
options: props.options
|
|
123
107
|
}));
|
|
124
|
-
if (isMultiple) {
|
|
125
|
-
const value$1 = Array.isArray(fieldValue) ? fieldValue.filter(isToggleGroupValue) : [];
|
|
126
|
-
return {
|
|
127
|
-
...toggleGroupProps,
|
|
128
|
-
options: resolvedOptions,
|
|
129
|
-
value: value$1,
|
|
130
|
-
onValueChange: (nextValue) => {
|
|
131
|
-
field.onInput(nextValue).catch(() => {});
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
108
|
const value = isToggleGroupValue(fieldValue) ? fieldValue : void 0;
|
|
136
109
|
return {
|
|
137
110
|
...toggleGroupProps,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React$1 from "react";
|
|
2
|
-
import { ToggleGroupProps } from "@pixpilot/shadcn-ui";
|
|
2
|
+
import { ToggleGroupItemProps, ToggleGroupProps } from "@pixpilot/shadcn-ui";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/components/ToggleGroup.d.ts
|
|
@@ -12,16 +12,18 @@ interface ToggleGroupOption {
|
|
|
12
12
|
disabled?: boolean;
|
|
13
13
|
}
|
|
14
14
|
interface ToggleGroupBaseProps extends Omit<ToggleGroupProps, 'type' | 'value' | 'defaultValue' | 'onValueChange' | 'children' | 'variant' | 'size'> {
|
|
15
|
-
type?: 'single' | 'multiple';
|
|
16
15
|
options: readonly ToggleGroupOption[];
|
|
17
|
-
value?: ToggleGroupValue
|
|
18
|
-
defaultValue?: ToggleGroupValue
|
|
19
|
-
onValueChange?: (
|
|
16
|
+
value?: ToggleGroupValue;
|
|
17
|
+
defaultValue?: ToggleGroupValue;
|
|
18
|
+
onValueChange?: (value: ToggleGroupValue | undefined) => void;
|
|
20
19
|
allowEmptySelection?: boolean;
|
|
21
20
|
variant?: ToggleGroupVariant;
|
|
22
21
|
size?: ToggleGroupSize;
|
|
23
|
-
|
|
22
|
+
slots: {
|
|
23
|
+
item?: ToggleGroupItemProps;
|
|
24
|
+
};
|
|
24
25
|
ref?: React$1.Ref<HTMLDivElement>;
|
|
26
|
+
fullWidth?: boolean;
|
|
25
27
|
}
|
|
26
28
|
/**
|
|
27
29
|
* ToggleGroup component for single selection from a set of options.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React$1 from "react";
|
|
2
|
-
import { ToggleGroupProps } from "@pixpilot/shadcn-ui";
|
|
2
|
+
import { ToggleGroupItemProps, ToggleGroupProps } from "@pixpilot/shadcn-ui";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/components/ToggleGroup.d.ts
|
|
@@ -12,16 +12,18 @@ interface ToggleGroupOption {
|
|
|
12
12
|
disabled?: boolean;
|
|
13
13
|
}
|
|
14
14
|
interface ToggleGroupBaseProps extends Omit<ToggleGroupProps, 'type' | 'value' | 'defaultValue' | 'onValueChange' | 'children' | 'variant' | 'size'> {
|
|
15
|
-
type?: 'single' | 'multiple';
|
|
16
15
|
options: readonly ToggleGroupOption[];
|
|
17
|
-
value?: ToggleGroupValue
|
|
18
|
-
defaultValue?: ToggleGroupValue
|
|
19
|
-
onValueChange?: (
|
|
16
|
+
value?: ToggleGroupValue;
|
|
17
|
+
defaultValue?: ToggleGroupValue;
|
|
18
|
+
onValueChange?: (value: ToggleGroupValue | undefined) => void;
|
|
20
19
|
allowEmptySelection?: boolean;
|
|
21
20
|
variant?: ToggleGroupVariant;
|
|
22
21
|
size?: ToggleGroupSize;
|
|
23
|
-
|
|
22
|
+
slots: {
|
|
23
|
+
item?: ToggleGroupItemProps;
|
|
24
|
+
};
|
|
24
25
|
ref?: React$1.Ref<HTMLDivElement>;
|
|
26
|
+
fullWidth?: boolean;
|
|
25
27
|
}
|
|
26
28
|
/**
|
|
27
29
|
* ToggleGroup component for single selection from a set of options.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { resolveFieldOptions } from "../utils/resolve-field-options.js";
|
|
2
2
|
import { connect, mapProps } from "@formily/react";
|
|
3
3
|
import * as React$1 from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { createElement } from "react";
|
|
5
|
+
import { ToggleGroup, ToggleGroupItem, cn } from "@pixpilot/shadcn-ui";
|
|
5
6
|
import { jsx } from "react/jsx-runtime";
|
|
6
7
|
|
|
7
8
|
//#region src/components/ToggleGroup.tsx
|
|
@@ -26,41 +27,19 @@ function coerceOptions(options) {
|
|
|
26
27
|
};
|
|
27
28
|
}).filter((v) => v !== null);
|
|
28
29
|
}
|
|
29
|
-
function ToggleGroupBase({
|
|
30
|
+
function ToggleGroupBase({ options, value, defaultValue, onValueChange, allowEmptySelection = false, variant = "outline", size, fullWidth = true, slots, ref,...props }) {
|
|
31
|
+
const valueString = value === void 0 ? void 0 : String(value);
|
|
32
|
+
const defaultValueString = defaultValue === void 0 ? void 0 : String(defaultValue);
|
|
30
33
|
const valueByString = React$1.useMemo(() => {
|
|
31
34
|
const map = /* @__PURE__ */ new Map();
|
|
32
35
|
for (const option of options) map.set(String(option.value), option.value);
|
|
33
36
|
return map;
|
|
34
37
|
}, [options]);
|
|
35
|
-
const items = options.map((option) => /* @__PURE__ */ jsx(ToggleGroupItem, {
|
|
36
|
-
value: String(option.value),
|
|
37
|
-
"aria-label": String(option.value),
|
|
38
|
-
disabled: option.disabled,
|
|
39
|
-
className: buttonClassName,
|
|
40
|
-
children: option.label
|
|
41
|
-
}, String(option.value)));
|
|
42
|
-
if (type === "multiple") {
|
|
43
|
-
const multiValue = Array.isArray(value) ? value.map(String) : [];
|
|
44
|
-
return /* @__PURE__ */ jsx(ToggleGroup, {
|
|
45
|
-
...props,
|
|
46
|
-
ref,
|
|
47
|
-
type: "multiple",
|
|
48
|
-
value: multiValue,
|
|
49
|
-
variant: toVariant(variant),
|
|
50
|
-
size: toSize(size),
|
|
51
|
-
onValueChange: (nextValues) => {
|
|
52
|
-
const mappedValues = nextValues.map((v) => valueByString.get(v) ?? v);
|
|
53
|
-
onValueChange?.(mappedValues);
|
|
54
|
-
},
|
|
55
|
-
children: items
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
const valueString = value === void 0 || Array.isArray(value) ? void 0 : String(value);
|
|
59
|
-
const defaultValueString = defaultValue === void 0 || Array.isArray(defaultValue) ? void 0 : String(defaultValue);
|
|
60
38
|
return /* @__PURE__ */ jsx(ToggleGroup, {
|
|
39
|
+
type: "single",
|
|
61
40
|
...props,
|
|
41
|
+
className: cn({ "w-full": fullWidth }, props.className),
|
|
62
42
|
ref,
|
|
63
|
-
type: "single",
|
|
64
43
|
value: valueString,
|
|
65
44
|
defaultValue: defaultValueString,
|
|
66
45
|
variant: toVariant(variant),
|
|
@@ -73,7 +52,14 @@ function ToggleGroupBase({ type = "single", options, value, defaultValue, onValu
|
|
|
73
52
|
}
|
|
74
53
|
onValueChange?.(valueByString.get(nextValue) ?? nextValue);
|
|
75
54
|
},
|
|
76
|
-
children:
|
|
55
|
+
children: options.map((option) => /* @__PURE__ */ createElement(ToggleGroupItem, {
|
|
56
|
+
...slots?.item,
|
|
57
|
+
key: String(option.value),
|
|
58
|
+
value: String(option.value),
|
|
59
|
+
"aria-label": String(option.value),
|
|
60
|
+
disabled: option.disabled,
|
|
61
|
+
className: cn({ "flex-1": fullWidth }, slots?.item?.className)
|
|
62
|
+
}, option.label))
|
|
77
63
|
});
|
|
78
64
|
}
|
|
79
65
|
/**
|
|
@@ -111,22 +97,10 @@ const ToggleGroup$1 = connect(ToggleGroupBase, mapProps({
|
|
|
111
97
|
}, (props, field) => {
|
|
112
98
|
const toggleGroupProps = props;
|
|
113
99
|
const fieldValue = field.value;
|
|
114
|
-
const isMultiple = props.type === "multiple";
|
|
115
100
|
const resolvedOptions = coerceOptions(resolveFieldOptions({
|
|
116
101
|
field,
|
|
117
102
|
options: props.options
|
|
118
103
|
}));
|
|
119
|
-
if (isMultiple) {
|
|
120
|
-
const value$1 = Array.isArray(fieldValue) ? fieldValue.filter(isToggleGroupValue) : [];
|
|
121
|
-
return {
|
|
122
|
-
...toggleGroupProps,
|
|
123
|
-
options: resolvedOptions,
|
|
124
|
-
value: value$1,
|
|
125
|
-
onValueChange: (nextValue) => {
|
|
126
|
-
field.onInput(nextValue).catch(() => {});
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
104
|
const value = isToggleGroupValue(fieldValue) ? fieldValue : void 0;
|
|
131
105
|
return {
|
|
132
106
|
...toggleGroupProps,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _pixpilot_shadcn_ui13 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/file-upload/FileUpload.d.ts
|
|
5
5
|
|
|
@@ -7,14 +7,14 @@ import * as _pixpilot_shadcn_ui3 from "@pixpilot/shadcn-ui";
|
|
|
7
7
|
* Formily-connected FileUploadInline component
|
|
8
8
|
* Automatically connects shadcn FileUploadInline to Formily field state
|
|
9
9
|
*/
|
|
10
|
-
declare const FileUpload: React.ForwardRefExoticComponent<(Omit<Partial<
|
|
10
|
+
declare const FileUpload: React.ForwardRefExoticComponent<(Omit<Partial<_pixpilot_shadcn_ui13.FileUploadInlineBaseProps & _pixpilot_shadcn_ui13.FileUploadRootPropsBaseProps & {
|
|
11
11
|
multiple: true;
|
|
12
|
-
value?:
|
|
13
|
-
onChange?:
|
|
14
|
-
} &
|
|
12
|
+
value?: _pixpilot_shadcn_ui13.FileMetadata[];
|
|
13
|
+
onChange?: _pixpilot_shadcn_ui13.OnChangeMultipleFiles;
|
|
14
|
+
} & _pixpilot_shadcn_ui13.FileUploadBaseProps>, "ref"> | Omit<Partial<_pixpilot_shadcn_ui13.FileUploadInlineBaseProps & _pixpilot_shadcn_ui13.FileUploadRootPropsBaseProps & {
|
|
15
15
|
multiple?: false;
|
|
16
|
-
value?:
|
|
17
|
-
onChange?:
|
|
18
|
-
} &
|
|
16
|
+
value?: _pixpilot_shadcn_ui13.FileMetadata | null;
|
|
17
|
+
onChange?: _pixpilot_shadcn_ui13.OnChangeSingleFile;
|
|
18
|
+
} & _pixpilot_shadcn_ui13.FileUploadBaseProps>, "ref">) & React.RefAttributes<unknown>>;
|
|
19
19
|
//#endregion
|
|
20
20
|
export { FileUpload };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _pixpilot_shadcn_ui3 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/file-upload/FileUploadInline.d.ts
|
|
5
5
|
|
|
@@ -7,14 +7,14 @@ import * as _pixpilot_shadcn_ui13 from "@pixpilot/shadcn-ui";
|
|
|
7
7
|
* Formily-connected FileUploadInline component
|
|
8
8
|
* Automatically connects shadcn FileUploadInline to Formily field state
|
|
9
9
|
*/
|
|
10
|
-
declare const FileUploadInline: React.ForwardRefExoticComponent<(Omit<Partial<
|
|
10
|
+
declare const FileUploadInline: React.ForwardRefExoticComponent<(Omit<Partial<_pixpilot_shadcn_ui3.FileUploadInlineBaseProps & _pixpilot_shadcn_ui3.FileUploadRootPropsBaseProps & {
|
|
11
11
|
multiple: true;
|
|
12
|
-
value?:
|
|
13
|
-
onChange?:
|
|
14
|
-
} &
|
|
12
|
+
value?: _pixpilot_shadcn_ui3.FileMetadata[];
|
|
13
|
+
onChange?: _pixpilot_shadcn_ui3.OnChangeMultipleFiles;
|
|
14
|
+
} & _pixpilot_shadcn_ui3.FileUploadBaseProps>, "ref"> | Omit<Partial<_pixpilot_shadcn_ui3.FileUploadInlineBaseProps & _pixpilot_shadcn_ui3.FileUploadRootPropsBaseProps & {
|
|
15
15
|
multiple?: false;
|
|
16
|
-
value?:
|
|
17
|
-
onChange?:
|
|
18
|
-
} &
|
|
16
|
+
value?: _pixpilot_shadcn_ui3.FileMetadata | null;
|
|
17
|
+
onChange?: _pixpilot_shadcn_ui3.OnChangeSingleFile;
|
|
18
|
+
} & _pixpilot_shadcn_ui3.FileUploadBaseProps>, "ref">) & React.RefAttributes<unknown>>;
|
|
19
19
|
//#endregion
|
|
20
20
|
export { FileUploadInline };
|