@deftui/addons 0.2.3 → 0.2.4

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.
@@ -10,6 +10,12 @@ interface RHFFieldProps<Values extends FieldValues, Name extends FieldPath<Value
10
10
  label?: React.ReactNode;
11
11
  /** Supporting text referenced by the control's aria-describedby. */
12
12
  description?: React.ReactNode;
13
+ /**
14
+ * Associates the label with the control's ID via htmlFor.
15
+ *
16
+ * @default false
17
+ */
18
+ associateLabel?: boolean;
13
19
  /**
14
20
  * Injects id, aria-invalid, and aria-describedby into a single non-Fragment element returned by children.
15
21
  *
@@ -4,7 +4,7 @@ import { useController } from "react-hook-form";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  // src/react-hook-form/field.tsx
6
6
  function RHFField(props) {
7
- const { label, description, injectControlProps = true, children, ...controllerProps } = props;
7
+ const { label, associateLabel = false, description, injectControlProps = true, children, ...controllerProps } = props;
8
8
  const id = useId();
9
9
  const controller = useController(controllerProps);
10
10
  const hasError = Boolean(controller.fieldState.error?.message);
@@ -23,7 +23,7 @@ function RHFField(props) {
23
23
  "data-disabled": controller.field.disabled,
24
24
  children: [
25
25
  label != null && /* @__PURE__ */ jsx(Field.Label, {
26
- htmlFor: controlId,
26
+ htmlFor: associateLabel ? controlId : void 0,
27
27
  children: label
28
28
  }),
29
29
  control ? cloneElement(control, {
@@ -1,10 +1,11 @@
1
1
  import { OnValueChange, Options } from "./types.mjs";
2
2
  import { Combobox } from "@deftui/react";
3
3
  import { ComponentProps } from "react";
4
- type Props<V extends string> = {
4
+ type Props<V extends string> // oxfmt-ignore
5
+ = Omit<ComponentProps<typeof Combobox>, "items" | "children"> & Pick<ComponentProps<typeof Combobox.Input>, "size" | "placeholder" | "showClear" | "className"> & {
5
6
  options: Options<V>;
6
7
  emptyLabel?: string;
7
8
  onChange?: OnValueChange;
8
- } & Omit<ComponentProps<typeof Combobox>, "items" | "children"> & Pick<ComponentProps<typeof Combobox.Input>, "size" | "placeholder" | "showClear" | "className">;
9
+ };
9
10
  export declare function RHFCombobox<V extends string>(props: Props<V>): import("react").JSX.Element;
10
11
  export {};
@@ -1,9 +1,10 @@
1
1
  import { OnValueChange, Options } from "./types.mjs";
2
2
  import { Select } from "@deftui/react";
3
3
  import { ComponentProps } from "react";
4
- type Props<V extends string> = {
4
+ type Props<V extends string> // oxfmt-ignore
5
+ = Omit<ComponentProps<typeof Select>, "items" | "children"> & Pick<ComponentProps<typeof Select.Trigger>, "size" | "className"> & Pick<ComponentProps<typeof Select.Value>, "placeholder" | "className"> & {
5
6
  options: Options<V>;
6
7
  onChange?: OnValueChange;
7
- } & Omit<ComponentProps<typeof Select>, "items" | "children"> & Pick<ComponentProps<typeof Select.Trigger>, "size" | "className"> & Pick<ComponentProps<typeof Select.Value>, "placeholder" | "className">;
8
+ };
8
9
  export declare function RHFSelect<V extends string>(props: Props<V>): import("react").JSX.Element;
9
10
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deftui/addons",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
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.3",
43
+ "@deftui/react": "^0.2.4",
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.3",
52
+ "@deftui/react": "^0.2.4",
53
53
  "@tanstack/react-router": "^1.170.0",
54
54
  "react": "^19.0.0",
55
55
  "react-dom": "^19.0.0",