@deftui/addons 0.2.0 → 0.2.1
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/form.d.mts +6 -0
- package/dist/form.mjs +7 -1
- package/dist/react-hook-form/widgets/combobox.d.mts +9 -0
- package/dist/react-hook-form/widgets/combobox.mjs +21 -0
- package/dist/react-hook-form/widgets/select.d.mts +8 -0
- package/dist/react-hook-form/widgets/select.mjs +20 -0
- package/dist/react-hook-form/widgets/types.d.mts +5 -0
- package/package.json +3 -3
package/dist/form.d.mts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { RHFField } from "./react-hook-form/field.mjs";
|
|
2
2
|
import { RHFForm } from "./react-hook-form/form.mjs";
|
|
3
|
+
import { RHFCombobox } from "./react-hook-form/widgets/combobox.mjs";
|
|
4
|
+
import { RHFSelect } from "./react-hook-form/widgets/select.mjs";
|
|
3
5
|
export declare const RHF: {
|
|
4
6
|
/** A Base UI form with a default grid layout; submission stays controlled by the caller. */
|
|
5
7
|
Form: typeof RHFForm;
|
|
6
8
|
/** Wraps `useController` with label, description, error, and control-prop forwarding. */
|
|
7
9
|
Field: typeof RHFField;
|
|
10
|
+
/** One-liner component for Select, used under {@link RHF.Field}. */
|
|
11
|
+
Select: typeof RHFSelect;
|
|
12
|
+
/** One-liner component for Combobox, used under {@link RHF.Field}. */
|
|
13
|
+
Combobox: typeof RHFCombobox;
|
|
8
14
|
};
|
package/dist/form.mjs
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { RHFField } from "./react-hook-form/field.mjs";
|
|
2
2
|
import { RHFForm } from "./react-hook-form/form.mjs";
|
|
3
|
+
import { RHFCombobox } from "./react-hook-form/widgets/combobox.mjs";
|
|
4
|
+
import { RHFSelect } from "./react-hook-form/widgets/select.mjs";
|
|
3
5
|
// src/react-hook-form/index.ts
|
|
4
6
|
const RHF = {
|
|
5
7
|
/** A Base UI form with a default grid layout; submission stays controlled by the caller. */
|
|
6
8
|
Form: RHFForm,
|
|
7
9
|
/** Wraps `useController` with label, description, error, and control-prop forwarding. */
|
|
8
|
-
Field: RHFField
|
|
10
|
+
Field: RHFField,
|
|
11
|
+
/** One-liner component for Select, used under {@link RHF.Field}. */
|
|
12
|
+
Select: RHFSelect,
|
|
13
|
+
/** One-liner component for Combobox, used under {@link RHF.Field}. */
|
|
14
|
+
Combobox: RHFCombobox
|
|
9
15
|
};
|
|
10
16
|
export { RHF };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Options } from "./types.mjs";
|
|
2
|
+
import { Combobox } from "@deftui/react";
|
|
3
|
+
import { ComponentProps } from "react";
|
|
4
|
+
type Props<V extends string> = {
|
|
5
|
+
options: Options<V>;
|
|
6
|
+
emptyLabel?: string;
|
|
7
|
+
} & Omit<ComponentProps<typeof Combobox>, "items" | "children"> & Pick<ComponentProps<typeof Combobox.Input>, "size" | "placeholder" | "showClear" | "className">;
|
|
8
|
+
export declare function RHFCombobox<V extends string>(props: Props<V>): import("react").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Combobox } from "@deftui/react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
// src/react-hook-form/widgets/combobox.tsx
|
|
4
|
+
function RHFCombobox(props) {
|
|
5
|
+
const { options, size, placeholder, showClear, className, emptyLabel, ...rootProps } = props;
|
|
6
|
+
return /* @__PURE__ */ jsxs(Combobox, {
|
|
7
|
+
...rootProps,
|
|
8
|
+
items: options,
|
|
9
|
+
children: [/* @__PURE__ */ jsx(Combobox.Input, {
|
|
10
|
+
size,
|
|
11
|
+
placeholder,
|
|
12
|
+
showClear,
|
|
13
|
+
className
|
|
14
|
+
}), /* @__PURE__ */ jsxs(Combobox.Content, { children: [/* @__PURE__ */ jsx(Combobox.Empty, { children: emptyLabel }), /* @__PURE__ */ jsx(Combobox.List, { children: options.map((option) => /* @__PURE__ */ jsx(Combobox.Item, {
|
|
15
|
+
value: option.value,
|
|
16
|
+
disabled: option.disabled,
|
|
17
|
+
children: option.label
|
|
18
|
+
}, option.value)) })] })]
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export { RHFCombobox };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Options } from "./types.mjs";
|
|
2
|
+
import { Select } from "@deftui/react";
|
|
3
|
+
import { ComponentProps } from "react";
|
|
4
|
+
type Props<V extends string> = {
|
|
5
|
+
options: Options<V>;
|
|
6
|
+
} & Omit<ComponentProps<typeof Select>, "items" | "children"> & Pick<ComponentProps<typeof Select.Trigger>, "size" | "className"> & Pick<ComponentProps<typeof Select.Value>, "placeholder" | "className">;
|
|
7
|
+
export declare function RHFSelect<V extends string>(props: Props<V>): import("react").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Select } from "@deftui/react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
// src/react-hook-form/widgets/select.tsx
|
|
4
|
+
function RHFSelect(props) {
|
|
5
|
+
const { options, size, placeholder, className, ...rootProps } = props;
|
|
6
|
+
return /* @__PURE__ */ jsxs(Select, {
|
|
7
|
+
...rootProps,
|
|
8
|
+
items: options,
|
|
9
|
+
children: [/* @__PURE__ */ jsx(Select.Trigger, {
|
|
10
|
+
size,
|
|
11
|
+
className,
|
|
12
|
+
children: /* @__PURE__ */ jsx(Select.Value, { placeholder })
|
|
13
|
+
}), /* @__PURE__ */ jsx(Select.Content, { children: options.map((option) => /* @__PURE__ */ jsx(Select.Item, {
|
|
14
|
+
value: option.value,
|
|
15
|
+
disabled: option.disabled,
|
|
16
|
+
children: option.label
|
|
17
|
+
}, option.value)) })]
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export { RHFSelect };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deftui/addons",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/KiriRainCat/deftui.git",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"fix": "vp check --fix"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@deftui/react": "^0.2.
|
|
43
|
+
"@deftui/react": "^0.2.1",
|
|
44
44
|
"@tanstack/react-router": "^1.170.46",
|
|
45
45
|
"@types/react": "^19.3.0",
|
|
46
46
|
"@types/react-dom": "^19.3.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"vite-plus": "catalog:"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@deftui/react": "^0.2.
|
|
52
|
+
"@deftui/react": "^0.2.1",
|
|
53
53
|
"@tanstack/react-router": "^1.170.0",
|
|
54
54
|
"react": "^19.0.0",
|
|
55
55
|
"react-dom": "^19.0.0",
|