@alpic-ai/ui 1.170.0 → 1.171.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.
Files changed (37) hide show
  1. package/dist/components/alert.d.mts +1 -1
  2. package/dist/components/avatar.d.mts +1 -1
  3. package/dist/components/badge.d.mts +1 -1
  4. package/dist/components/bar-chart.mjs +1 -1
  5. package/dist/components/button.d.mts +2 -2
  6. package/dist/components/editable.d.mts +101 -0
  7. package/dist/components/editable.mjs +509 -0
  8. package/dist/components/form.d.mts +10 -8
  9. package/dist/components/form.mjs +18 -8
  10. package/dist/components/input.d.mts +3 -1
  11. package/dist/components/input.mjs +5 -3
  12. package/dist/components/sidebar.d.mts +1 -1
  13. package/dist/components/skeleton.d.mts +1 -1
  14. package/dist/components/spinner.d.mts +1 -1
  15. package/dist/components/status-dot.d.mts +1 -1
  16. package/dist/components/tabs.d.mts +1 -1
  17. package/dist/components/toggle-group.d.mts +1 -1
  18. package/dist/components/visually-hidden-input.d.mts +12 -0
  19. package/dist/components/visually-hidden-input.mjs +109 -0
  20. package/dist/hooks/use-as-ref.d.mts +5 -0
  21. package/dist/hooks/use-as-ref.mjs +12 -0
  22. package/dist/hooks/use-isomorphic-layout-effect.d.mts +5 -0
  23. package/dist/hooks/use-isomorphic-layout-effect.mjs +5 -0
  24. package/dist/hooks/use-lazy-ref.d.mts +6 -0
  25. package/dist/hooks/use-lazy-ref.mjs +9 -0
  26. package/dist/lib/compose-refs.mjs +23 -0
  27. package/package.json +8 -12
  28. package/src/components/bar-chart.tsx +1 -1
  29. package/src/components/editable.tsx +871 -0
  30. package/src/components/form.tsx +16 -6
  31. package/src/components/input.tsx +8 -0
  32. package/src/components/visually-hidden-input.tsx +148 -0
  33. package/src/hooks/use-as-ref.ts +15 -0
  34. package/src/hooks/use-isomorphic-layout-effect.ts +5 -0
  35. package/src/hooks/use-lazy-ref.ts +13 -0
  36. package/src/lib/compose-refs.ts +38 -0
  37. package/src/stories/input.stories.tsx +3 -0
@@ -5,7 +5,7 @@ import * as React$1 from "react";
5
5
  import { Slot } from "@radix-ui/react-slot";
6
6
  import { ControllerProps, FieldPath, FieldValues } from "react-hook-form";
7
7
  //#region src/components/form.d.ts
8
- declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>({ children, watch, getValues, getFieldState, setError, clearErrors, setValue, setValues, trigger, formState, resetField, reset, resetDefaultValues, handleSubmit, unregister, control, register, setFocus, subscribe }: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React$1.JSX.Element;
8
+ declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>({ children, watch, getValues, getErrors, getFieldState, setError, clearErrors, setValue, setValues, trigger, formState, resetField, reset, resetDefaultValues, handleSubmit, unregister, control, register, setFocus, subscribe }: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React$1.JSX.Element;
9
9
  declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => React$1.JSX.Element;
10
10
  declare const useFormField: () => {
11
11
  invalid: boolean;
@@ -23,8 +23,9 @@ declare function FormItem({ className, ...props }: React$1.ComponentProps<"div">
23
23
  interface FormLabelProps extends React$1.ComponentProps<typeof Label> {
24
24
  required?: boolean;
25
25
  tooltip?: string;
26
+ marker?: React$1.ReactNode;
26
27
  }
27
- declare function FormLabel({ className, required, tooltip, children, ...props }: FormLabelProps): React$1.JSX.Element;
28
+ declare function FormLabel({ className, required, tooltip, marker, children, ...props }: FormLabelProps): React$1.JSX.Element;
28
29
  declare function FormControl({ ...props }: React$1.ComponentProps<typeof Slot>): React$1.JSX.Element;
29
30
  declare function FormDescription({ className, ...props }: React$1.ComponentProps<"p">): React$1.JSX.Element;
30
31
  declare function FormMessage({ className, ...props }: React$1.ComponentProps<"p">): React$1.JSX.Element | null;
@@ -42,11 +43,12 @@ interface FormFieldBaseProps<TFieldValues extends FieldValues, TName extends Fie
42
43
  label?: string;
43
44
  description?: string;
44
45
  tooltip?: string;
46
+ marker?: React$1.ReactNode;
45
47
  }
46
48
  interface InputFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> extends FormFieldBaseProps<TFieldValues, TName>, Omit<InputProps, "name" | "label"> {}
47
- declare function InputField<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>({ control, name, rules, required, label, description, tooltip, ...inputProps }: InputFieldProps<TFieldValues, TName>): React$1.JSX.Element;
49
+ declare function InputField<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>({ control, name, rules, required, label, description, tooltip, marker, ...inputProps }: InputFieldProps<TFieldValues, TName>): React$1.JSX.Element;
48
50
  interface TextareaFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> extends FormFieldBaseProps<TFieldValues, TName>, Omit<TextareaProps, "name" | "label"> {}
49
- declare function TextareaField<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>({ control, name, rules, required, label, description, tooltip, ...textareaProps }: TextareaFieldProps<TFieldValues, TName>): React$1.JSX.Element;
51
+ declare function TextareaField<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>({ control, name, rules, required, label, description, tooltip, marker, ...textareaProps }: TextareaFieldProps<TFieldValues, TName>): React$1.JSX.Element;
50
52
  interface SelectFieldOption {
51
53
  value: string;
52
54
  label: string;
@@ -56,16 +58,16 @@ interface SelectFieldProps<TFieldValues extends FieldValues, TName extends Field
56
58
  options: SelectFieldOption[];
57
59
  placeholder?: string;
58
60
  }
59
- declare function SelectField<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>({ control, name, rules, required, label, description, tooltip, options, placeholder }: SelectFieldProps<TFieldValues, TName>): React$1.JSX.Element;
61
+ declare function SelectField<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>({ control, name, rules, required, label, description, tooltip, marker, options, placeholder }: SelectFieldProps<TFieldValues, TName>): React$1.JSX.Element;
60
62
  interface RadioFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> extends FormFieldBaseProps<TFieldValues, TName> {
61
63
  options: SelectFieldOption[];
62
64
  }
63
- declare function RadioField<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>({ control, name, rules, required, label, description, tooltip, options }: RadioFieldProps<TFieldValues, TName>): React$1.JSX.Element;
65
+ declare function RadioField<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>({ control, name, rules, required, label, description, tooltip, marker, options }: RadioFieldProps<TFieldValues, TName>): React$1.JSX.Element;
64
66
  interface ChecklistFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> extends FormFieldBaseProps<TFieldValues, TName> {
65
67
  options: SelectFieldOption[];
66
68
  }
67
- declare function ChecklistField<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>({ control, name, rules, required, label, description, tooltip, options }: ChecklistFieldProps<TFieldValues, TName>): React$1.JSX.Element;
69
+ declare function ChecklistField<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>({ control, name, rules, required, label, description, tooltip, marker, options }: ChecklistFieldProps<TFieldValues, TName>): React$1.JSX.Element;
68
70
  interface CheckboxFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> extends Omit<FormFieldBaseProps<TFieldValues, TName>, "required"> {}
69
- declare function CheckboxField<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>({ control, name, rules, label, description, tooltip }: CheckboxFieldProps<TFieldValues, TName>): React$1.JSX.Element;
71
+ declare function CheckboxField<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>({ control, name, rules, label, description, tooltip, marker }: CheckboxFieldProps<TFieldValues, TName>): React$1.JSX.Element;
70
72
  //#endregion
71
73
  export { CheckboxField, ChecklistField, Form, FormControl, FormDescription, FormField, FormFields, FormHeader, FormItem, FormLabel, FormMessage, InputField, RadioField, SelectField, type SelectFieldOption, TextareaField, useFormField };
@@ -52,7 +52,7 @@ function FormItem({ className, ...props }) {
52
52
  })
53
53
  });
54
54
  }
55
- function FormLabel({ className, required, tooltip, children, ...props }) {
55
+ function FormLabel({ className, required, tooltip, marker, children, ...props }) {
56
56
  const { error, formItemId } = useFormField();
57
57
  return /* @__PURE__ */ jsxs("div", {
58
58
  className: "flex items-center gap-0.5",
@@ -73,7 +73,11 @@ function FormLabel({ className, required, tooltip, children, ...props }) {
73
73
  tooltip && /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
74
74
  asChild: true,
75
75
  children: /* @__PURE__ */ jsx(Info, { className: "size-4 text-quaternary-foreground" })
76
- }), /* @__PURE__ */ jsx(TooltipContent, { children: tooltip })] })
76
+ }), /* @__PURE__ */ jsx(TooltipContent, { children: tooltip })] }),
77
+ marker && /* @__PURE__ */ jsx("span", {
78
+ className: "ml-1 flex items-center",
79
+ children: marker
80
+ })
77
81
  ]
78
82
  });
79
83
  }
@@ -127,7 +131,7 @@ function FormFields({ className, ...props }) {
127
131
  ...props
128
132
  });
129
133
  }
130
- function InputField({ control, name, rules, required, label, description, tooltip, ...inputProps }) {
134
+ function InputField({ control, name, rules, required, label, description, tooltip, marker, ...inputProps }) {
131
135
  return /* @__PURE__ */ jsx(FormField, {
132
136
  control,
133
137
  name,
@@ -136,6 +140,7 @@ function InputField({ control, name, rules, required, label, description, toolti
136
140
  label && /* @__PURE__ */ jsx(FormLabel, {
137
141
  required,
138
142
  tooltip,
143
+ marker,
139
144
  children: label
140
145
  }),
141
146
  description && /* @__PURE__ */ jsx(FormDescription, { children: description }),
@@ -147,7 +152,7 @@ function InputField({ control, name, rules, required, label, description, toolti
147
152
  ] })
148
153
  });
149
154
  }
150
- function TextareaField({ control, name, rules, required, label, description, tooltip, ...textareaProps }) {
155
+ function TextareaField({ control, name, rules, required, label, description, tooltip, marker, ...textareaProps }) {
151
156
  return /* @__PURE__ */ jsx(FormField, {
152
157
  control,
153
158
  name,
@@ -156,6 +161,7 @@ function TextareaField({ control, name, rules, required, label, description, too
156
161
  label && /* @__PURE__ */ jsx(FormLabel, {
157
162
  required,
158
163
  tooltip,
164
+ marker,
159
165
  children: label
160
166
  }),
161
167
  description && /* @__PURE__ */ jsx(FormDescription, { children: description }),
@@ -167,7 +173,7 @@ function TextareaField({ control, name, rules, required, label, description, too
167
173
  ] })
168
174
  });
169
175
  }
170
- function SelectField({ control, name, rules, required, label, description, tooltip, options, placeholder }) {
176
+ function SelectField({ control, name, rules, required, label, description, tooltip, marker, options, placeholder }) {
171
177
  return /* @__PURE__ */ jsx(FormField, {
172
178
  control,
173
179
  name,
@@ -176,6 +182,7 @@ function SelectField({ control, name, rules, required, label, description, toolt
176
182
  label && /* @__PURE__ */ jsx(FormLabel, {
177
183
  required,
178
184
  tooltip,
185
+ marker,
179
186
  children: label
180
187
  }),
181
188
  description && /* @__PURE__ */ jsx(FormDescription, { children: description }),
@@ -192,7 +199,7 @@ function SelectField({ control, name, rules, required, label, description, toolt
192
199
  ] })
193
200
  });
194
201
  }
195
- function RadioField({ control, name, rules, required, label, description, tooltip, options }) {
202
+ function RadioField({ control, name, rules, required, label, description, tooltip, marker, options }) {
196
203
  return /* @__PURE__ */ jsx(FormField, {
197
204
  control,
198
205
  name,
@@ -201,6 +208,7 @@ function RadioField({ control, name, rules, required, label, description, toolti
201
208
  label && /* @__PURE__ */ jsx(FormLabel, {
202
209
  required,
203
210
  tooltip,
211
+ marker,
204
212
  children: label
205
213
  }),
206
214
  description && /* @__PURE__ */ jsx(FormDescription, { children: description }),
@@ -228,7 +236,7 @@ function RadioField({ control, name, rules, required, label, description, toolti
228
236
  ] })
229
237
  });
230
238
  }
231
- function ChecklistField({ control, name, rules, required, label, description, tooltip, options }) {
239
+ function ChecklistField({ control, name, rules, required, label, description, tooltip, marker, options }) {
232
240
  return /* @__PURE__ */ jsx(FormField, {
233
241
  control,
234
242
  name,
@@ -243,6 +251,7 @@ function ChecklistField({ control, name, rules, required, label, description, to
243
251
  label && /* @__PURE__ */ jsx(FormLabel, {
244
252
  required,
245
253
  tooltip,
254
+ marker,
246
255
  children: label
247
256
  }),
248
257
  description && /* @__PURE__ */ jsx(FormDescription, { children: description }),
@@ -272,7 +281,7 @@ function ChecklistField({ control, name, rules, required, label, description, to
272
281
  }
273
282
  });
274
283
  }
275
- function CheckboxField({ control, name, rules, label, description, tooltip }) {
284
+ function CheckboxField({ control, name, rules, label, description, tooltip, marker }) {
276
285
  return /* @__PURE__ */ jsx(FormField, {
277
286
  control,
278
287
  name,
@@ -288,6 +297,7 @@ function CheckboxField({ control, name, rules, label, description, tooltip }) {
288
297
  onBlur: field.onBlur
289
298
  }) }), label && /* @__PURE__ */ jsx(FormLabel, {
290
299
  tooltip,
300
+ marker,
291
301
  className: "font-normal max-md:-ml-2 max-md:min-h-11 max-md:flex-1 max-md:items-start max-md:pl-2",
292
302
  children: label
293
303
  })]
@@ -9,7 +9,9 @@ interface InputProps extends Omit<React$1.ComponentProps<"input">, "size"> {
9
9
  leadingText?: string;
10
10
  leadingIcon?: React$1.ReactNode;
11
11
  size?: "sm" | "md";
12
+ sensitive?: boolean;
13
+ show?: boolean;
12
14
  }
13
- declare function Input({ className, id, label, required, hint, error, tooltip, leadingText, leadingIcon, size, ...props }: InputProps): React$1.JSX.Element;
15
+ declare function Input({ className, id, label, required, hint, error, tooltip, leadingText, leadingIcon, size, sensitive, show, ...props }: InputProps): React$1.JSX.Element;
14
16
  //#endregion
15
17
  export { Input, type InputProps };
@@ -22,7 +22,7 @@ const inputSizeStyles = {
22
22
  leadingIcon: "pl-2.5 [&_svg]:size-5"
23
23
  }
24
24
  };
25
- function Input({ className, id, label, required, hint, error, tooltip, leadingText, leadingIcon, size = "md", ...props }) {
25
+ function Input({ className, id, label, required, hint, error, tooltip, leadingText, leadingIcon, size = "md", sensitive = false, show = false, ...props }) {
26
26
  const generatedId = React$1.useId();
27
27
  const fieldId = id ?? generatedId;
28
28
  const hasAddons = leadingText || leadingIcon;
@@ -39,11 +39,13 @@ function Input({ className, id, label, required, hint, error, tooltip, leadingTe
39
39
  "disabled:bg-disabled disabled:text-disabled-foreground",
40
40
  "aria-invalid:border-border-error",
41
41
  error && "border-border-error"
42
- ], hasAddons && "flex-1 min-h-0", className),
42
+ ], hasAddons && "flex-1 min-h-0", sensitive && !show && "[-webkit-text-security:disc]", className),
43
43
  required,
44
44
  "aria-invalid": error ? true : void 0,
45
45
  "aria-describedby": fieldId && (hint || error) ? `${fieldId}-description` : void 0,
46
- ...props
46
+ ...props,
47
+ autoComplete: sensitive ? "off" : props.autoComplete,
48
+ spellCheck: sensitive ? false : props.spellCheck
47
49
  });
48
50
  const wrappedInput = hasAddons ? /* @__PURE__ */ jsxs("div", {
49
51
  className: cn("flex items-center w-full overflow-hidden", sizes.wrapper, "bg-background border border-border rounded-md", "transition-colors", "has-[input:focus-visible]:border-ring has-[input:focus-visible]:border-2", "has-[input:disabled]:bg-disabled has-[input:disabled]:text-disabled-foreground has-[input:disabled]:cursor-not-allowed", error && "border-border-error"),
@@ -46,7 +46,7 @@ declare function SidebarMenu({ className, ...props }: React$1.ComponentProps<"ul
46
46
  declare function SidebarMenuItem({ className, ...props }: React$1.ComponentProps<"li">): React$1.JSX.Element;
47
47
  declare const sidebarMenuButtonVariants: (props?: ({
48
48
  variant?: "default" | "outline" | null | undefined;
49
- size?: "default" | "sm" | "lg" | null | undefined;
49
+ size?: "sm" | "lg" | "default" | null | undefined;
50
50
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
51
51
  declare function SidebarMenuButton({ asChild, isActive, variant, size, tooltip, className, ...props }: React$1.ComponentProps<"button"> & {
52
52
  asChild?: boolean;
@@ -1,7 +1,7 @@
1
1
  import { VariantProps } from "class-variance-authority";
2
2
  //#region src/components/skeleton.d.ts
3
3
  declare const skeletonVariants: (props?: ({
4
- shape?: "circle" | "rectangle" | null | undefined;
4
+ shape?: "rectangle" | "circle" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
6
  interface SkeletonProps extends React.ComponentProps<"div">, VariantProps<typeof skeletonVariants> {}
7
7
  declare function Skeleton({ className, shape, ...props }: SkeletonProps): import("react").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { VariantProps } from "class-variance-authority";
2
2
  //#region src/components/spinner.d.ts
3
3
  declare const spinnerVariants: (props?: ({
4
- variant?: "secondary" | "primary" | null | undefined;
4
+ variant?: "primary" | "secondary" | null | undefined;
5
5
  size?: "sm" | "lg" | "md" | "xl" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  interface SpinnerProps extends Omit<React.ComponentProps<"svg">, "children">, VariantProps<typeof spinnerVariants> {}
@@ -1,7 +1,7 @@
1
1
  import { VariantProps } from "class-variance-authority";
2
2
  //#region src/components/status-dot.d.ts
3
3
  declare const statusDotVariants: (props?: ({
4
- variant?: "destructive" | "warning" | "success" | "muted" | null | undefined;
4
+ variant?: "destructive" | "success" | "warning" | "muted" | null | undefined;
5
5
  pulse?: boolean | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  interface StatusDotProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof statusDotVariants> {}
@@ -3,7 +3,7 @@ import * as React$1 from "react";
3
3
  import * as TabsPrimitive from "@radix-ui/react-tabs";
4
4
  //#region src/components/tabs.d.ts
5
5
  declare const tabsTriggerVariants: (props?: ({
6
- variant?: "default" | "pill" | "line" | null | undefined;
6
+ variant?: "default" | "line" | "pill" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  declare function Tabs({ className, orientation, ...props }: React$1.ComponentProps<typeof TabsPrimitive.Root>): React$1.JSX.Element;
9
9
  declare const tabsListVariants: (props?: ({
@@ -4,7 +4,7 @@ import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
4
4
  //#region src/components/toggle-group.d.ts
5
5
  declare const toggleGroupItemVariants: (props?: ({
6
6
  variant?: "default" | "outline" | null | undefined;
7
- size?: "default" | "sm" | null | undefined;
7
+ size?: "sm" | "default" | null | undefined;
8
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
9
  type ToggleGroupContextValue = VariantProps<typeof toggleGroupItemVariants>;
10
10
  declare function ToggleGroup({ className, variant, size, children, ...props }: React$1.ComponentProps<typeof ToggleGroupPrimitive.Root> & ToggleGroupContextValue): React$1.JSX.Element;
@@ -0,0 +1,12 @@
1
+ import * as React$1 from "react";
2
+ //#region src/components/visually-hidden-input.d.ts
3
+ type InputValue = string[] | string;
4
+ interface VisuallyHiddenInputProps<T = InputValue> extends Omit<React$1.InputHTMLAttributes<HTMLInputElement>, "value" | "checked" | "onReset"> {
5
+ value?: T;
6
+ checked?: boolean;
7
+ control: HTMLElement | null;
8
+ bubbles?: boolean;
9
+ }
10
+ declare function VisuallyHiddenInput<T = InputValue>(props: VisuallyHiddenInputProps<T>): React$1.JSX.Element;
11
+ //#endregion
12
+ export { VisuallyHiddenInput };
@@ -0,0 +1,109 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import * as React$1 from "react";
4
+ //#region src/components/visually-hidden-input.tsx
5
+ function VisuallyHiddenInput(props) {
6
+ const { control, value, checked, bubbles = true, type = "hidden", style, ...inputProps } = props;
7
+ const isCheckInput = React$1.useMemo(() => type === "checkbox" || type === "radio" || type === "switch", [type]);
8
+ const inputRef = React$1.useRef(null);
9
+ const prevValueRef = React$1.useRef({
10
+ value: isCheckInput ? checked : value,
11
+ previous: isCheckInput ? checked : value
12
+ });
13
+ const prevValue = React$1.useMemo(() => {
14
+ const currentValue = isCheckInput ? checked : value;
15
+ if (prevValueRef.current.value !== currentValue) {
16
+ prevValueRef.current.previous = prevValueRef.current.value;
17
+ prevValueRef.current.value = currentValue;
18
+ }
19
+ return prevValueRef.current.previous;
20
+ }, [
21
+ isCheckInput,
22
+ value,
23
+ checked
24
+ ]);
25
+ const [controlSize, setControlSize] = React$1.useState({});
26
+ React$1.useLayoutEffect(() => {
27
+ if (!control) {
28
+ setControlSize({});
29
+ return;
30
+ }
31
+ setControlSize({
32
+ width: control.offsetWidth,
33
+ height: control.offsetHeight
34
+ });
35
+ if (typeof window === "undefined") return;
36
+ const resizeObserver = new ResizeObserver((entries) => {
37
+ if (!Array.isArray(entries) || !entries.length) return;
38
+ const entry = entries[0];
39
+ if (!entry) return;
40
+ let width;
41
+ let height;
42
+ if ("borderBoxSize" in entry) {
43
+ const borderSizeEntry = entry.borderBoxSize;
44
+ const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
45
+ width = borderSize.inlineSize;
46
+ height = borderSize.blockSize;
47
+ } else {
48
+ width = control.offsetWidth;
49
+ height = control.offsetHeight;
50
+ }
51
+ setControlSize({
52
+ width,
53
+ height
54
+ });
55
+ });
56
+ resizeObserver.observe(control, { box: "border-box" });
57
+ return () => {
58
+ resizeObserver.disconnect();
59
+ };
60
+ }, [control]);
61
+ React$1.useEffect(() => {
62
+ const input = inputRef.current;
63
+ if (!input) return;
64
+ const inputProto = window.HTMLInputElement.prototype;
65
+ const propertyKey = isCheckInput ? "checked" : "value";
66
+ const eventType = isCheckInput ? "click" : "input";
67
+ const currentValue = isCheckInput ? checked : value;
68
+ const serializedCurrentValue = isCheckInput ? checked : typeof value === "object" && value !== null ? JSON.stringify(value) : value;
69
+ const setter = Object.getOwnPropertyDescriptor(inputProto, propertyKey)?.set;
70
+ if (prevValue !== currentValue && setter) {
71
+ const event = new Event(eventType, { bubbles });
72
+ setter.call(input, serializedCurrentValue);
73
+ input.dispatchEvent(event);
74
+ }
75
+ }, [
76
+ prevValue,
77
+ value,
78
+ checked,
79
+ bubbles,
80
+ isCheckInput
81
+ ]);
82
+ const composedStyle = React$1.useMemo(() => {
83
+ return {
84
+ ...style,
85
+ ...controlSize.width !== void 0 && controlSize.height !== void 0 ? controlSize : {},
86
+ border: 0,
87
+ clip: "rect(0 0 0 0)",
88
+ clipPath: "inset(50%)",
89
+ height: "1px",
90
+ margin: "-1px",
91
+ overflow: "hidden",
92
+ padding: 0,
93
+ position: "absolute",
94
+ whiteSpace: "nowrap",
95
+ width: "1px"
96
+ };
97
+ }, [style, controlSize]);
98
+ return /* @__PURE__ */ jsx("input", {
99
+ type,
100
+ ...inputProps,
101
+ ref: inputRef,
102
+ "aria-hidden": isCheckInput,
103
+ tabIndex: -1,
104
+ defaultChecked: isCheckInput ? checked : void 0,
105
+ style: composedStyle
106
+ });
107
+ }
108
+ //#endregion
109
+ export { VisuallyHiddenInput };
@@ -0,0 +1,5 @@
1
+ import * as React$1 from "react";
2
+ //#region src/hooks/use-as-ref.d.ts
3
+ declare function useAsRef<T>(props: T): React$1.RefObject<T>;
4
+ //#endregion
5
+ export { useAsRef };
@@ -0,0 +1,12 @@
1
+ import { useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect.mjs";
2
+ import * as React$1 from "react";
3
+ //#region src/hooks/use-as-ref.ts
4
+ function useAsRef(props) {
5
+ const ref = React$1.useRef(props);
6
+ useIsomorphicLayoutEffect(() => {
7
+ ref.current = props;
8
+ });
9
+ return ref;
10
+ }
11
+ //#endregion
12
+ export { useAsRef };
@@ -0,0 +1,5 @@
1
+ import * as React$1 from "react";
2
+ //#region src/hooks/use-isomorphic-layout-effect.d.ts
3
+ declare const useIsomorphicLayoutEffect: typeof React$1.useEffect;
4
+ //#endregion
5
+ export { useIsomorphicLayoutEffect };
@@ -0,0 +1,5 @@
1
+ import * as React$1 from "react";
2
+ //#region src/hooks/use-isomorphic-layout-effect.ts
3
+ const useIsomorphicLayoutEffect = typeof window !== "undefined" ? React$1.useLayoutEffect : React$1.useEffect;
4
+ //#endregion
5
+ export { useIsomorphicLayoutEffect };
@@ -0,0 +1,6 @@
1
+ //#region src/hooks/use-lazy-ref.d.ts
2
+ declare function useLazyRef<T>(fn: () => T): {
3
+ current: T;
4
+ };
5
+ //#endregion
6
+ export { useLazyRef };
@@ -0,0 +1,9 @@
1
+ import * as React$1 from "react";
2
+ //#region src/hooks/use-lazy-ref.ts
3
+ function useLazyRef(fn) {
4
+ const ref = React$1.useRef(null);
5
+ if (ref.current === null) ref.current = { current: fn() };
6
+ return ref.current;
7
+ }
8
+ //#endregion
9
+ export { useLazyRef };
@@ -0,0 +1,23 @@
1
+ import * as React$1 from "react";
2
+ //#region src/lib/compose-refs.ts
3
+ function setRef(ref, value) {
4
+ if (typeof ref === "function") return ref(value);
5
+ if (ref !== null && ref !== void 0) ref.current = value;
6
+ }
7
+ function composeRefs(...refs) {
8
+ return (node) => {
9
+ const cleanups = refs.map((ref) => setRef(ref, node));
10
+ if (!cleanups.some((cleanup) => typeof cleanup === "function")) return;
11
+ return () => {
12
+ cleanups.forEach((cleanup, index) => {
13
+ if (typeof cleanup === "function") cleanup();
14
+ else setRef(refs[index], null);
15
+ });
16
+ };
17
+ };
18
+ }
19
+ function useComposedRefs(...refs) {
20
+ return React$1.useCallback(composeRefs(...refs), refs);
21
+ }
22
+ //#endregion
23
+ export { composeRefs, useComposedRefs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alpic-ai/ui",
3
- "version": "1.170.0",
3
+ "version": "1.171.0",
4
4
  "description": "Alpic design system — shared UI components",
5
5
  "type": "module",
6
6
  "exports": {
@@ -12,13 +12,9 @@
12
12
  "types": "./dist/hooks/*.d.mts",
13
13
  "default": "./dist/hooks/*.mjs"
14
14
  },
15
- "./lib/cn": {
16
- "types": "./dist/lib/cn.d.mts",
17
- "default": "./dist/lib/cn.mjs"
18
- },
19
- "./lib/chart-palette": {
20
- "types": "./dist/lib/chart-palette.d.mts",
21
- "default": "./dist/lib/chart-palette.mjs"
15
+ "./lib/*": {
16
+ "types": "./dist/lib/*.d.mts",
17
+ "default": "./dist/lib/*.mjs"
22
18
  },
23
19
  "./theme": "./src/styles/tokens.css"
24
20
  },
@@ -63,11 +59,11 @@
63
59
  "@ladle/react": "^5.1.1",
64
60
  "@tailwindcss/postcss": "^4.3.3",
65
61
  "@types/react": "19.2.18",
66
- "@types/react-dom": "19.2.4",
67
- "lucide-react": "^1.30.0",
68
- "react-hook-form": "^7.85.0",
62
+ "@types/react-dom": "19.2.5",
63
+ "lucide-react": "^1.37.0",
64
+ "react-hook-form": "^7.86.0",
69
65
  "shx": "^0.4.0",
70
- "sonner": "^2.0.7",
66
+ "sonner": "^2.0.8",
71
67
  "tailwindcss": "^4.3.3",
72
68
  "tsdown": "^0.22.14",
73
69
  "tw-animate-css": "^1.4.0",
@@ -166,7 +166,7 @@ function BarChart({
166
166
  className,
167
167
  )}
168
168
  >
169
- <div className="w-full" style={{ height }}>
169
+ <div className={cn("w-full", bare && !loading && !isEmpty && "border-border border-b")} style={{ height }}>
170
170
  {loading ? (
171
171
  <Skeleton className="h-full w-full rounded-lg" />
172
172
  ) : isEmpty ? (