asterui 0.12.14 → 0.12.15

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.
@@ -2,17 +2,37 @@ import { default as React } from 'react';
2
2
  export interface AutocompleteOption {
3
3
  value: string;
4
4
  label: string;
5
+ disabled?: boolean;
5
6
  }
6
- export interface AutocompleteProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
7
+ export interface AutocompleteProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'onSelect'> {
7
8
  value?: string;
8
9
  defaultValue?: string;
9
10
  onChange?: (value: string) => void;
11
+ onSelect?: (value: string, option: AutocompleteOption) => void;
12
+ onSearch?: (value: string) => void;
10
13
  options: AutocompleteOption[] | string[];
11
14
  placeholder?: string;
12
15
  disabled?: boolean;
13
- size?: 'xs' | 'sm' | 'md' | 'lg';
16
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
17
+ color?: 'neutral' | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error';
18
+ /** Validation status */
19
+ status?: 'error' | 'warning';
14
20
  allowCustomValue?: boolean;
15
21
  filterOption?: (option: AutocompleteOption, inputValue: string) => boolean;
16
22
  notFoundContent?: React.ReactNode;
23
+ /** Show clear button when input has value */
24
+ allowClear?: boolean | {
25
+ clearIcon?: React.ReactNode;
26
+ };
27
+ /** Callback when clear button is clicked */
28
+ onClear?: () => void;
29
+ /** Controlled open state */
30
+ open?: boolean;
31
+ /** Default open state */
32
+ defaultOpen?: boolean;
33
+ /** Callback when open state changes */
34
+ onOpenChange?: (open: boolean) => void;
35
+ /** Activate first option by default */
36
+ defaultActiveFirstOption?: boolean;
17
37
  }
18
38
  export declare const Autocomplete: React.FC<AutocompleteProps>;
@@ -1,19 +1,24 @@
1
1
  import { default as React } from 'react';
2
2
  type BaseButtonProps = {
3
- type?: 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error' | 'neutral' | 'ghost' | 'link';
3
+ /** Button color */
4
+ color?: 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error' | 'neutral';
5
+ /** Button style variant */
6
+ variant?: 'solid' | 'outline' | 'dash' | 'soft' | 'ghost' | 'link';
7
+ /** Button size */
4
8
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
5
- outline?: boolean;
6
- dash?: boolean;
7
- soft?: boolean;
9
+ /** Active/pressed visual state */
8
10
  active?: boolean;
11
+ /** Show loading spinner and disable button */
9
12
  loading?: boolean;
13
+ /** Button shape */
10
14
  shape?: 'square' | 'circle' | 'wide' | 'block' | 'round';
15
+ /** Disable click animation */
11
16
  noAnimation?: boolean;
12
17
  /** Icon element to display */
13
18
  icon?: React.ReactNode;
14
19
  /** Position of the icon */
15
20
  iconPosition?: 'start' | 'end';
16
- /** Applies error/danger styling (shorthand for type="error") */
21
+ /** Applies error/danger styling (shorthand for color="error") */
17
22
  danger?: boolean;
18
23
  /** Toggle button pressed state (sets aria-pressed) */
19
24
  pressed?: boolean;
@@ -3,11 +3,21 @@ import { UseFormReturn, FieldValues, SubmitHandler, UseFormProps, FieldArrayPath
3
3
  export interface FormProps<TFieldValues extends FieldValues = FieldValues> extends Omit<React.FormHTMLAttributes<HTMLFormElement>, 'onSubmit'> {
4
4
  form?: UseFormReturn<TFieldValues>;
5
5
  onFinish?: SubmitHandler<TFieldValues>;
6
+ /** Called when form validation fails */
7
+ onFinishFailed?: (errorInfo: {
8
+ values: TFieldValues;
9
+ errorFields: Array<{
10
+ name: string;
11
+ errors: string[];
12
+ }>;
13
+ }) => void;
6
14
  initialValues?: UseFormProps<TFieldValues>['defaultValues'];
7
15
  layout?: 'vertical' | 'horizontal' | 'inline';
8
16
  /** Label width in pixels for horizontal layout (default: 80) */
9
17
  labelWidth?: number;
10
18
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
19
+ /** Disable all form fields */
20
+ disabled?: boolean;
11
21
  children: React.ReactNode;
12
22
  }
13
23
  export interface FormRule {
@@ -62,7 +72,7 @@ export interface FormListProps<TFieldValues extends FieldValues = FieldValues> {
62
72
  move: (from: number, to: number) => void;
63
73
  }) => React.ReactNode;
64
74
  }
65
- declare function FormRoot<TFieldValues extends FieldValues = FieldValues>({ form: externalForm, onFinish, initialValues, layout, labelWidth, size, children, className, noValidate, ...props }: FormProps<TFieldValues>): import("react/jsx-runtime").JSX.Element;
75
+ declare function FormRoot<TFieldValues extends FieldValues = FieldValues>({ form: externalForm, onFinish, onFinishFailed, initialValues, layout, labelWidth, size, disabled, children, className, noValidate, ...props }: FormProps<TFieldValues>): import("react/jsx-runtime").JSX.Element;
66
76
  declare function FormItem({ name, label, help, required, rules, valuePropName, inline, className, children, tooltip, extra, hasFeedback, dependencies, validateTrigger, initialValue, hidden, }: FormItemProps): import("react/jsx-runtime").JSX.Element;
67
77
  declare function FormList<TFieldValues extends FieldValues = FieldValues>({ name, children, }: FormListProps<TFieldValues>): import("react/jsx-runtime").JSX.Element;
68
78
  export declare function useFormInstance<TFieldValues extends FieldValues = FieldValues>(): UseFormReturn<TFieldValues, any, TFieldValues> & {
@@ -1,21 +1,29 @@
1
1
  import { default as React } from 'react';
2
2
  export interface RatingProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
3
- children: React.ReactNode;
3
+ children?: React.ReactNode;
4
4
  value?: number;
5
5
  defaultValue?: number;
6
6
  onChange?: (value: number) => void;
7
+ onHoverChange?: (value: number) => void;
8
+ count?: number;
7
9
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
8
- readOnly?: boolean;
10
+ gap?: 'none' | 'xs' | 'sm' | 'md' | 'lg';
11
+ color?: string;
12
+ mask?: 'star' | 'star-2' | 'heart';
13
+ allowClear?: boolean;
14
+ allowHalf?: boolean;
15
+ disabled?: boolean;
9
16
  }
10
17
  export interface RatingItemProps {
11
18
  value: number;
12
19
  mask?: 'star' | 'star-2' | 'heart';
13
20
  color?: string;
14
21
  hidden?: boolean;
22
+ half?: 'first' | 'second';
15
23
  className?: string;
16
24
  }
17
- declare function RatingRoot({ children, value, defaultValue, onChange, size, readOnly, className, ...rest }: RatingProps): import("react/jsx-runtime").JSX.Element;
18
- declare function RatingItem({ value, mask, color, hidden, className }: RatingItemProps): import("react/jsx-runtime").JSX.Element;
25
+ declare function RatingRoot({ children, value, defaultValue, onChange, onHoverChange, count, size, gap, color, mask, allowClear, allowHalf, disabled, className, ...rest }: RatingProps): import("react/jsx-runtime").JSX.Element;
26
+ declare function RatingItem({ value, mask, color, hidden, half, className }: RatingItemProps): import("react/jsx-runtime").JSX.Element;
19
27
  export declare const Rating: typeof RatingRoot & {
20
28
  Item: typeof RatingItem;
21
29
  };
package/dist/index34.js CHANGED
@@ -1,7 +1,7 @@
1
- import { jsx as t, jsxs as L } from "react/jsx-runtime";
2
- import { createContext as ae, useId as J, useEffect as H, useRef as K, isValidElement as U, cloneElement as ie, useContext as le } from "react";
3
- import { useForm as Y, useFieldArray as ce, useWatch as ue, Controller as me } from "react-hook-form";
4
- const P = ae(void 0), M = {
1
+ import { jsx as t, jsxs as j } from "react/jsx-runtime";
2
+ import { createContext as ie, useId as H, useEffect as U, useRef as Y, isValidElement as G, cloneElement as le, useContext as ce } from "react";
3
+ import { useForm as Q, useFieldArray as ue, useWatch as de, Controller as me } from "react-hook-form";
4
+ const T = ie(void 0), W = {
5
5
  email: {
6
6
  value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
7
7
  message: "Please enter a valid email address"
@@ -15,209 +15,223 @@ const P = ae(void 0), M = {
15
15
  message: "Please enter a valid number"
16
16
  }
17
17
  };
18
- function z() {
19
- const r = le(P);
18
+ function Z() {
19
+ const r = ce(T);
20
20
  if (!r)
21
21
  throw new Error("Form compound components must be used within Form");
22
22
  return r;
23
23
  }
24
- function de({
24
+ function fe({
25
25
  form: r,
26
26
  onFinish: o,
27
- initialValues: s,
28
- layout: u = "vertical",
29
- labelWidth: m = 60,
30
- size: y,
31
- children: h,
32
- className: l = "",
33
- noValidate: i = !0,
34
- ...g
27
+ onFinishFailed: s,
28
+ initialValues: u,
29
+ layout: f = "vertical",
30
+ labelWidth: k = 60,
31
+ size: h,
32
+ disabled: d = !1,
33
+ children: l,
34
+ className: g = "",
35
+ noValidate: p = !0,
36
+ ...y
35
37
  }) {
36
- const p = Y({
37
- defaultValues: s
38
- }), v = r || p, c = ($) => {
39
- $.preventDefault(), o && v.handleSubmit(o)($);
38
+ const i = Q({
39
+ defaultValues: u
40
+ }), v = r || i, I = async (c) => {
41
+ if (c.preventDefault(), await v.trigger())
42
+ o && o(v.getValues());
43
+ else if (s) {
44
+ const P = v.formState.errors, E = [], z = (R, L = "") => {
45
+ for (const $ in R) {
46
+ const m = L ? `${L}.${$}` : $, b = R[$];
47
+ b?.message ? E.push({ name: m, errors: [b.message] }) : typeof b == "object" && b !== null && z(b, m);
48
+ }
49
+ };
50
+ z(P), s({ values: v.getValues(), errorFields: E });
51
+ }
52
+ }, M = (c) => {
53
+ c.preventDefault(), v.reset(u);
40
54
  };
41
- return /* @__PURE__ */ t(P.Provider, { value: { form: v, layout: u, labelWidth: m, size: y }, children: /* @__PURE__ */ t("form", { onSubmit: c, className: l, noValidate: i, ...g, children: h }) });
55
+ return /* @__PURE__ */ t(T.Provider, { value: { form: v, layout: f, labelWidth: k, size: h, disabled: d }, children: /* @__PURE__ */ t("form", { onSubmit: I, onReset: M, className: g, noValidate: p, ...y, children: l }) });
42
56
  }
43
- function fe({
57
+ function he({
44
58
  name: r,
45
59
  label: o,
46
60
  help: s,
47
61
  required: u = !1,
48
- rules: m,
49
- valuePropName: y = "value",
62
+ rules: f,
63
+ valuePropName: k = "value",
50
64
  inline: h = !1,
51
- className: l = "",
52
- children: i,
65
+ className: d = "",
66
+ children: l,
53
67
  tooltip: g,
54
68
  extra: p,
55
- hasFeedback: v = !1,
56
- dependencies: c,
57
- validateTrigger: $ = "onChange",
58
- initialValue: B,
59
- hidden: S = !1
69
+ hasFeedback: y = !1,
70
+ dependencies: i,
71
+ validateTrigger: v = "onChange",
72
+ initialValue: I,
73
+ hidden: M = !1
60
74
  }) {
61
- const { form: d, size: R, listName: q, layout: W, labelWidth: G } = z(), T = J(), C = J();
75
+ const { form: c, size: q, listName: P, layout: E, labelWidth: z, disabled: R } = Z(), L = H(), $ = H();
62
76
  if (!r)
63
- return /* @__PURE__ */ t("div", { className: `form-control ${h ? "w-auto" : "w-full"} ${l}`, style: S ? { display: "none" } : void 0, children: i });
64
- let f;
65
- Array.isArray(r) ? f = (q ? [q, ...r] : r).join(".") : f = r, H(() => {
66
- B !== void 0 && d.getValues(f) === void 0 && d.setValue(f, B);
77
+ return /* @__PURE__ */ t("div", { className: `form-control ${h ? "w-auto" : "w-full"} ${d}`, style: M ? { display: "none" } : void 0, children: l });
78
+ let m;
79
+ Array.isArray(r) ? m = (P ? [P, ...r] : r).join(".") : m = r, U(() => {
80
+ I !== void 0 && c.getValues(m) === void 0 && c.setValue(m, I);
67
81
  }, []);
68
- const j = ue({
69
- control: d.control,
70
- name: c,
71
- disabled: !c || c.length === 0
72
- }), Z = K(d);
73
- Z.current = d;
74
- const E = K(void 0);
75
- H(() => {
76
- if (!c || c.length === 0) return;
77
- if (E.current === void 0) {
78
- E.current = JSON.stringify(j);
82
+ const b = de({
83
+ control: c.control,
84
+ name: i,
85
+ disabled: !i || i.length === 0
86
+ }), O = Y(c);
87
+ O.current = c;
88
+ const B = Y(void 0);
89
+ U(() => {
90
+ if (!i || i.length === 0) return;
91
+ if (B.current === void 0) {
92
+ B.current = JSON.stringify(b);
79
93
  return;
80
94
  }
81
- const e = JSON.stringify(j);
82
- E.current !== e && (E.current = e, Z.current.trigger(f));
83
- }, [j, c, f]);
84
- const w = ((e) => {
95
+ const e = JSON.stringify(b);
96
+ B.current !== e && (B.current = e, O.current.trigger(m));
97
+ }, [b, i, m]);
98
+ const A = ((e) => {
85
99
  const n = e.split(".");
86
- let a = d.formState.errors;
87
- for (const V of n) {
100
+ let a = c.formState.errors;
101
+ for (const C of n) {
88
102
  if (!a) break;
89
- a = a[V];
103
+ a = a[C];
90
104
  }
91
105
  return a;
92
- })(f), N = w?.message, Q = m ? Array.isArray(m) ? m : [m] : [], k = {}, A = [], I = [];
93
- u && (k.required = "This field is required");
94
- for (const e of Q) {
95
- if (e.required && (k.required = typeof e.required == "string" ? e.required : e.message || "This field is required"), e.type && M[e.type] && A.push({
96
- pattern: M[e.type].value,
97
- message: e.message || M[e.type].message
106
+ })(m), V = A?.message, X = f ? Array.isArray(f) ? f : [f] : [], w = {}, S = [], D = [];
107
+ u && (w.required = "This field is required");
108
+ for (const e of X) {
109
+ if (e.required && (w.required = typeof e.required == "string" ? e.required : e.message || "This field is required"), e.type && W[e.type] && S.push({
110
+ pattern: W[e.type].value,
111
+ message: e.message || W[e.type].message
98
112
  }), e.min !== void 0) {
99
113
  const n = typeof e.min == "object" ? e.min.value : e.min, a = typeof e.min == "object" ? e.min.message : e.message || `Minimum length is ${n} characters`;
100
- k.minLength = { value: n, message: a };
114
+ w.minLength = { value: n, message: a };
101
115
  }
102
116
  if (e.max !== void 0) {
103
117
  const n = typeof e.max == "object" ? e.max.value : e.max, a = typeof e.max == "object" ? e.max.message : e.message || `Maximum length is ${n} characters`;
104
- k.maxLength = { value: n, message: a };
118
+ w.maxLength = { value: n, message: a };
105
119
  }
106
120
  if (e.pattern) {
107
121
  const n = e.pattern instanceof RegExp ? e.pattern : e.pattern.value, a = e.pattern instanceof RegExp ? e.message || "Invalid format" : e.pattern.message;
108
- A.push({ pattern: n, message: a });
122
+ S.push({ pattern: n, message: a });
109
123
  }
110
- e.validate && I.push(e.validate);
124
+ e.validate && D.push(e.validate);
111
125
  }
112
- (A.length > 0 || I.length > 0) && (k.validate = async (e) => {
113
- if (!e && !k.required) return !0;
114
- for (const { pattern: n, message: a } of A)
126
+ (S.length > 0 || D.length > 0) && (w.validate = async (e) => {
127
+ if (!e && !w.required) return !0;
128
+ for (const { pattern: n, message: a } of S)
115
129
  if (e && !n.test(e))
116
130
  return a;
117
- for (const n of I) {
131
+ for (const n of D) {
118
132
  const a = await n(e);
119
133
  if (a !== !0)
120
134
  return a;
121
135
  }
122
136
  return !0;
123
137
  });
124
- const D = Array.isArray($) ? $ : [$], O = D.includes("onChange"), X = D.includes("onBlur"), ee = ({ hasError: e, isValidating: n }) => n ? /* @__PURE__ */ t("span", { className: "loading loading-spinner loading-xs text-base-content/50" }) : e ? /* @__PURE__ */ t("svg", { className: "w-4 h-4 text-error", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) : /* @__PURE__ */ t("svg", { className: "w-4 h-4 text-success", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }), te = () => /* @__PURE__ */ t("div", { className: "tooltip tooltip-top ml-1", "data-tip": g, children: /* @__PURE__ */ t("svg", { className: "w-4 h-4 text-base-content/50 cursor-help", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }) });
138
+ const _ = Array.isArray(v) ? v : [v], J = _.includes("onChange"), ee = _.includes("onBlur"), te = ({ hasError: e, isValidating: n }) => n ? /* @__PURE__ */ t("span", { className: "loading loading-spinner loading-xs text-base-content/50" }) : e ? /* @__PURE__ */ t("svg", { className: "w-4 h-4 text-error", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) : /* @__PURE__ */ t("svg", { className: "w-4 h-4 text-success", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }), re = () => /* @__PURE__ */ t("div", { className: "tooltip tooltip-top ml-1", "data-tip": g, children: /* @__PURE__ */ t("svg", { className: "w-4 h-4 text-base-content/50 cursor-help", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }) });
125
139
  return /* @__PURE__ */ t(
126
140
  me,
127
141
  {
128
- name: f,
129
- control: d.control,
130
- rules: k,
142
+ name: m,
143
+ control: c.control,
144
+ rules: w,
131
145
  render: ({ field: e, fieldState: n }) => {
132
- const { value: a, onChange: V, onBlur: re, ref: se } = e, oe = n.isTouched && d.formState.isValidating, x = {
133
- id: T,
134
- ref: se,
135
- "aria-invalid": w ? !0 : void 0,
136
- "aria-describedby": w ? C : void 0
146
+ const { value: a, onChange: C, onBlur: se, ref: oe } = e, ne = n.isTouched && c.formState.isValidating, x = {
147
+ id: L,
148
+ ref: oe,
149
+ "aria-invalid": A ? !0 : void 0,
150
+ "aria-describedby": A ? $ : void 0
137
151
  };
138
152
  x.onBlur = () => {
139
- re(), X && d.trigger(f);
140
- }, y === "checked" ? (x.checked = a, x.onChange = (F) => {
141
- V(F.target.checked), O && d.trigger(f);
153
+ se(), ee && c.trigger(m);
154
+ }, k === "checked" ? (x.checked = a, x.onChange = (F) => {
155
+ C(F.target.checked), J && c.trigger(m);
142
156
  }) : (x.value = a || "", x.onChange = (F) => {
143
- F && F.target !== void 0 ? V(F.target.value) : V(F), O && d.trigger(f);
144
- }), R && U(i) && (i.props.size || (x.size = R)), w && (x.color = "error", x["aria-invalid"] = !0);
145
- const ne = U(i) ? ie(i, x) : i, b = W === "horizontal", _ = W === "inline";
146
- return /* @__PURE__ */ L("div", { className: `form-control ${h ? "w-auto" : "w-full"} ${b ? "mb-4" : ""} ${_ ? "inline-flex mr-4" : ""} ${l}`, style: S ? { display: "none" } : void 0, children: [
147
- /* @__PURE__ */ L("div", { className: b ? "flex items-center gap-4" : "", children: [
157
+ F && F.target !== void 0 ? C(F.target.value) : C(F), J && c.trigger(m);
158
+ }), q && G(l) && (l.props.size || (x.size = q)), A && (x.color = "error", x["aria-invalid"] = !0), R && (x.disabled = !0);
159
+ const ae = G(l) ? le(l, x) : l, N = E === "horizontal", K = E === "inline";
160
+ return /* @__PURE__ */ j("div", { className: `form-control ${h ? "w-auto" : "w-full"} ${N ? "mb-4" : ""} ${K ? "inline-flex mr-4" : ""} ${d}`, style: M ? { display: "none" } : void 0, children: [
161
+ /* @__PURE__ */ j("div", { className: N ? "flex items-center gap-4" : "", children: [
148
162
  o && /* @__PURE__ */ t(
149
163
  "label",
150
164
  {
151
- htmlFor: T,
152
- className: `label ${b ? "flex-shrink-0 justify-end py-0" : ""} ${!b && !_ ? "pb-1" : ""}`,
153
- style: b ? { width: G } : void 0,
154
- children: /* @__PURE__ */ L("span", { className: "label-text flex items-center", children: [
165
+ htmlFor: L,
166
+ className: `label ${N ? "flex-shrink-0 justify-end py-0" : ""} ${!N && !K ? "pb-1" : ""}`,
167
+ style: N ? { width: z } : void 0,
168
+ children: /* @__PURE__ */ j("span", { className: "label-text flex items-center", children: [
155
169
  o,
156
170
  u && /* @__PURE__ */ t("span", { className: "text-error ml-1", children: "*" }),
157
- g && /* @__PURE__ */ t(te, {})
171
+ g && /* @__PURE__ */ t(re, {})
158
172
  ] })
159
173
  }
160
174
  ),
161
- /* @__PURE__ */ L("div", { className: `${b ? "flex-1" : ""} ${v ? "relative" : ""}`, children: [
162
- ne,
163
- v && n.isTouched && /* @__PURE__ */ t("span", { className: "absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ t(ee, { hasError: !!w, isValidating: oe }) })
175
+ /* @__PURE__ */ j("div", { className: `${N ? "flex-1" : ""} ${y ? "relative" : ""}`, children: [
176
+ ae,
177
+ y && n.isTouched && /* @__PURE__ */ t("span", { className: "absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ t(te, { hasError: !!A, isValidating: ne }) })
164
178
  ] })
165
179
  ] }),
166
- !b && !h && /* @__PURE__ */ t("p", { id: C, className: `validator-hint ${N ? "!visible text-error" : ""} min-h-[1.25rem]`, role: N ? "alert" : void 0, children: N || s && /* @__PURE__ */ t("span", { className: "text-base-content/70", children: s }) || " " }),
167
- b && (N || s) && /* @__PURE__ */ t("p", { id: C, className: `validator-hint ${N ? "!visible text-error" : ""} min-h-[1.25rem]`, role: N ? "alert" : void 0, children: N || s && /* @__PURE__ */ t("span", { className: "text-base-content/70", children: s }) }),
180
+ !N && !h && /* @__PURE__ */ t("p", { id: $, className: `validator-hint ${V ? "!visible text-error" : ""} min-h-[1.25rem]`, role: V ? "alert" : void 0, children: V || s && /* @__PURE__ */ t("span", { className: "text-base-content/70", children: s }) || " " }),
181
+ N && (V || s) && /* @__PURE__ */ t("p", { id: $, className: `validator-hint ${V ? "!visible text-error" : ""} min-h-[1.25rem]`, role: V ? "alert" : void 0, children: V || s && /* @__PURE__ */ t("span", { className: "text-base-content/70", children: s }) }),
168
182
  p && /* @__PURE__ */ t("div", { className: "text-sm text-base-content/60 mt-1", children: p })
169
183
  ] });
170
184
  }
171
185
  }
172
186
  );
173
187
  }
174
- function he({
188
+ function ge({
175
189
  name: r,
176
190
  children: o
177
191
  }) {
178
- const { form: s, layout: u, size: m } = z(), { fields: y, append: h, remove: l, move: i } = ce({
192
+ const { form: s, layout: u, size: f, disabled: k } = Z(), { fields: h, append: d, remove: l, move: g } = ue({
179
193
  control: s.control,
180
194
  name: r
181
- }), g = y.map((p, v) => ({
182
- ...p,
183
- name: v
195
+ }), p = h.map((y, i) => ({
196
+ ...y,
197
+ name: i
184
198
  }));
185
- return /* @__PURE__ */ t(P.Provider, { value: { form: s, layout: u, size: m, listName: r }, children: o(g, {
186
- add: h,
199
+ return /* @__PURE__ */ t(T.Provider, { value: { form: s, layout: u, size: f, listName: r, disabled: k }, children: o(p, {
200
+ add: d,
187
201
  remove: l,
188
- move: i
202
+ move: g
189
203
  }) });
190
204
  }
191
- function ge() {
192
- const r = Y(), o = r;
205
+ function pe() {
206
+ const r = Q(), o = r;
193
207
  return o.setFieldValue = r.setValue, o.getFieldValue = (s) => r.getValues(s), o.getFieldsValue = r.getValues, o.setFieldsValue = (s) => {
194
208
  Object.keys(s).forEach((u) => {
195
209
  r.setValue(u, s[u]);
196
210
  });
197
211
  }, o.validateFields = r.trigger, o.resetFields = r.reset, o.isFieldTouched = (s) => !!r.formState.touchedFields[s], o.getFieldError = (s) => r.formState.errors[s]?.message, o;
198
212
  }
199
- function pe({ fields: r, className: o = "" }) {
200
- const { form: s } = z(), { errors: u } = s.formState, m = (l, i = "") => {
213
+ function ve({ fields: r, className: o = "" }) {
214
+ const { form: s } = Z(), { errors: u } = s.formState, f = (d, l = "") => {
201
215
  const g = [];
202
- for (const p in l) {
203
- const v = i ? `${i}.${p}` : p, c = l[p];
204
- c?.message ? g.push({ field: v, message: c.message }) : typeof c == "object" && c !== null && g.push(...m(c, v));
216
+ for (const p in d) {
217
+ const y = l ? `${l}.${p}` : p, i = d[p];
218
+ i?.message ? g.push({ field: y, message: i.message }) : typeof i == "object" && i !== null && g.push(...f(i, y));
205
219
  }
206
220
  return g;
207
- }, y = m(u), h = r ? y.filter((l) => r.includes(l.field)) : y;
208
- return h.length === 0 ? null : /* @__PURE__ */ t("ul", { className: `text-error text-sm space-y-1 ${o}`, role: "alert", children: h.map((l, i) => /* @__PURE__ */ L("li", { className: "flex items-start gap-2", children: [
221
+ }, k = f(u), h = r ? k.filter((d) => r.includes(d.field)) : k;
222
+ return h.length === 0 ? null : /* @__PURE__ */ t("ul", { className: `text-error text-sm space-y-1 ${o}`, role: "alert", children: h.map((d, l) => /* @__PURE__ */ j("li", { className: "flex items-start gap-2", children: [
209
223
  /* @__PURE__ */ t("svg", { className: "w-4 h-4 mt-0.5 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
210
- /* @__PURE__ */ t("span", { children: l.message })
211
- ] }, `${l.field}-${i}`)) });
224
+ /* @__PURE__ */ t("span", { children: d.message })
225
+ ] }, `${d.field}-${l}`)) });
212
226
  }
213
- const Ne = Object.assign(de, {
214
- Item: fe,
215
- List: he,
216
- ErrorList: pe,
217
- useForm: ge
227
+ const Ne = Object.assign(fe, {
228
+ Item: he,
229
+ List: ge,
230
+ ErrorList: ve,
231
+ useForm: pe
218
232
  });
219
233
  export {
220
234
  Ne as Form,
221
- ge as useFormInstance
235
+ pe as useFormInstance
222
236
  };
223
237
  //# sourceMappingURL=index34.js.map