@alpic-ai/ui 0.0.0-staging.gfabea7f → 0.0.0-staging.gfcc71e5

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 (60) 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/bar-list.mjs +1 -2
  6. package/dist/components/breadcrumb.mjs +1 -1
  7. package/dist/components/button.d.mts +2 -2
  8. package/dist/components/button.mjs +5 -4
  9. package/dist/components/dialog.mjs +1 -1
  10. package/dist/components/dropdown-menu.mjs +1 -0
  11. package/dist/components/editable.d.mts +101 -0
  12. package/dist/components/editable.mjs +509 -0
  13. package/dist/components/form.d.mts +10 -8
  14. package/dist/components/form.mjs +23 -12
  15. package/dist/components/heatmap-chart.mjs +1 -1
  16. package/dist/components/input.d.mts +3 -1
  17. package/dist/components/input.mjs +23 -20
  18. package/dist/components/scroll-area.mjs +1 -1
  19. package/dist/components/select.mjs +1 -1
  20. package/dist/components/sidebar.mjs +1 -1
  21. package/dist/components/skeleton.d.mts +1 -1
  22. package/dist/components/spinner.d.mts +1 -1
  23. package/dist/components/status-dot.d.mts +1 -1
  24. package/dist/components/switch.mjs +1 -1
  25. package/dist/components/table.mjs +2 -2
  26. package/dist/components/tabs.d.mts +1 -1
  27. package/dist/components/tabs.mjs +3 -3
  28. package/dist/components/textarea.mjs +10 -9
  29. package/dist/components/toggle-group.mjs +2 -2
  30. package/dist/components/visually-hidden-input.d.mts +12 -0
  31. package/dist/components/visually-hidden-input.mjs +109 -0
  32. package/dist/hooks/use-as-ref.d.mts +5 -0
  33. package/dist/hooks/use-as-ref.mjs +12 -0
  34. package/dist/hooks/use-isomorphic-layout-effect.d.mts +5 -0
  35. package/dist/hooks/use-isomorphic-layout-effect.mjs +5 -0
  36. package/dist/hooks/use-lazy-ref.d.mts +6 -0
  37. package/dist/hooks/use-lazy-ref.mjs +9 -0
  38. package/dist/hooks/use-mobile.mjs +1 -2
  39. package/dist/lib/compose-refs.mjs +23 -0
  40. package/package.json +8 -12
  41. package/src/components/bar-chart.tsx +1 -1
  42. package/src/components/breadcrumb.tsx +1 -0
  43. package/src/components/button.tsx +5 -4
  44. package/src/components/dialog.tsx +1 -0
  45. package/src/components/dropdown-menu.tsx +1 -0
  46. package/src/components/editable.tsx +871 -0
  47. package/src/components/form.tsx +28 -9
  48. package/src/components/input.tsx +8 -0
  49. package/src/components/scroll-area.tsx +1 -1
  50. package/src/components/select.tsx +1 -0
  51. package/src/components/switch.tsx +1 -0
  52. package/src/components/table.tsx +2 -2
  53. package/src/components/tabs.tsx +3 -4
  54. package/src/components/toggle-group.tsx +2 -2
  55. package/src/components/visually-hidden-input.tsx +148 -0
  56. package/src/hooks/use-as-ref.ts +15 -0
  57. package/src/hooks/use-isomorphic-layout-effect.ts +5 -0
  58. package/src/hooks/use-lazy-ref.ts +13 -0
  59. package/src/lib/compose-refs.ts +38 -0
  60. package/src/stories/input.stories.tsx +3 -0
@@ -2,7 +2,7 @@ import { VariantProps } from "class-variance-authority";
2
2
  import * as React$1 from "react";
3
3
  //#region src/components/alert.d.ts
4
4
  declare const alertVariants: (props?: ({
5
- variant?: "default" | "destructive" | "warning" | "success" | null | undefined;
5
+ variant?: "default" | "destructive" | "success" | "warning" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  interface AlertProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps<typeof alertVariants> {}
8
8
  declare function Alert({ className, variant, ...props }: AlertProps): React$1.JSX.Element;
@@ -3,7 +3,7 @@ import * as React$1 from "react";
3
3
  import * as AvatarPrimitive from "@radix-ui/react-avatar";
4
4
  //#region src/components/avatar.d.ts
5
5
  declare const avatarVariants: (props?: ({
6
- size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
6
+ size?: "sm" | "md" | "lg" | "xs" | "xl" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  type AvatarSize = NonNullable<VariantProps<typeof avatarVariants>["size"]>;
9
9
  type AvatarStatus = "online";
@@ -1,7 +1,7 @@
1
1
  import { VariantProps } from "class-variance-authority";
2
2
  //#region src/components/badge.d.ts
3
3
  declare const badgeVariants: (props?: ({
4
- variant?: "warning" | "success" | "secondary" | "primary" | "error" | null | undefined;
4
+ variant?: "success" | "warning" | "primary" | "secondary" | "error" | null | undefined;
5
5
  size?: "sm" | "md" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  interface BadgeProps extends React.ComponentProps<"span">, VariantProps<typeof badgeVariants> {}
@@ -89,7 +89,7 @@ function BarChart({ data, index, series, variant = "stacked", legend = false, le
89
89
  "data-slot": "bar-chart",
90
90
  className: cn("flex w-full flex-col gap-3", "[&_.recharts-surface]:outline-none [&_.recharts-wrapper]:outline-none", className),
91
91
  children: [/* @__PURE__ */ jsx("div", {
92
- className: "w-full",
92
+ className: cn("w-full", bare && !loading && !isEmpty && "border-border border-b"),
93
93
  style: { height },
94
94
  children: loading ? /* @__PURE__ */ jsx(Skeleton, { className: "h-full w-full rounded-lg" }) : isEmpty ? /* @__PURE__ */ jsx("div", {
95
95
  className: "flex h-full items-center justify-center rounded-lg border border-border border-dashed font-mono text-quaternary-foreground text-text-xs",
@@ -19,7 +19,6 @@ const SECONDARY_BADGE_VARIANT = {
19
19
  };
20
20
  const PLACEHOLDER_HEIGHT = 168;
21
21
  const RAMP_CEILING = .8;
22
- const SEMANTIC_FLOOR = .62;
23
22
  const IN_FILL_SHADOW = "0 1px 2px rgb(0 0 0 / 0.28)";
24
23
  const ROW_INTERACTIVE_CLASS = "rounded-md text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-card";
25
24
  function BarList({ data, index, dataKey = "value", secondaryKey, secondaryVariantKey, titleKey, maxItems, palette, semantic, loading = false, valueFormatter = (value) => value.toLocaleString("en-US"), labelFormatter, className }) {
@@ -39,7 +38,7 @@ function BarList({ data, index, dataKey = "value", secondaryKey, secondaryVarian
39
38
  const capped = maxItems ? mapped.slice(0, maxItems) : mapped;
40
39
  return capped.map((row, rank) => {
41
40
  const rankFraction = capped.length > 1 ? rank / (capped.length - 1) : 0;
42
- const accentWeight = Math.round((1 - rankFraction * (1 - SEMANTIC_FLOOR)) * 100);
41
+ const accentWeight = Math.round((1 - rankFraction * .38) * 100);
43
42
  return {
44
43
  ...row,
45
44
  color: accent ? `color-mix(in oklab, ${accent} ${accentWeight}%, white)` : rampColor(paletteName, rankFraction * RAMP_CEILING)
@@ -29,7 +29,7 @@ function BreadcrumbItem({ className, ...props }) {
29
29
  function BreadcrumbLink({ asChild, className, ...props }) {
30
30
  return /* @__PURE__ */ jsx(asChild ? Slot : "a", {
31
31
  "data-slot": "breadcrumb-link",
32
- className: cn("type-text-sm font-medium text-subtle-foreground transition-colors [@media(hover:hover)]:hover:text-muted-foreground", className),
32
+ className: cn("type-text-sm font-medium text-subtle-foreground transition-colors [@media(hover:hover)]:hover:text-muted-foreground", "inline-flex items-center max-md:min-h-11", className),
33
33
  ...props
34
34
  });
35
35
  }
@@ -2,8 +2,8 @@ import { VariantProps } from "class-variance-authority";
2
2
  import * as React$1 from "react";
3
3
  //#region src/components/button.d.ts
4
4
  declare const buttonVariants: (props?: ({
5
- variant?: "destructive" | "secondary" | "primary" | "tertiary" | "link" | "link-muted" | "cta" | null | undefined;
6
- size?: "default" | "icon" | "icon-rounded" | "pill" | null | undefined;
5
+ variant?: "destructive" | "link" | "primary" | "secondary" | "tertiary" | "link-muted" | "cta" | null | undefined;
6
+ size?: "default" | "pill" | "icon" | "icon-rounded" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  interface ButtonProps extends React$1.ComponentProps<"button">, VariantProps<typeof buttonVariants> {
9
9
  asChild?: boolean;
@@ -8,6 +8,7 @@ import { Slot, Slottable } from "@radix-ui/react-slot";
8
8
  const buttonVariants = cva([
9
9
  "inline-flex items-center justify-center gap-1 whitespace-nowrap",
10
10
  "h-8 px-2 rounded-md",
11
+ "max-md:min-h-11",
11
12
  "font-medium",
12
13
  "transition-colors",
13
14
  "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
@@ -24,13 +25,13 @@ const buttonVariants = cva([
24
25
  "focus-visible:bg-background"
25
26
  ].join(" "),
26
27
  link: [
27
- "h-auto px-0 rounded-xs underline-offset-4",
28
+ "h-auto max-md:min-h-0 px-0 rounded-xs underline-offset-4",
28
29
  "text-link",
29
30
  "[@media(hover:hover)]:hover:underline",
30
31
  "focus-visible:bg-background"
31
32
  ].join(" "),
32
33
  "link-muted": [
33
- "h-auto px-0 rounded-xs underline-offset-4",
34
+ "h-auto max-md:min-h-0 px-0 rounded-xs underline-offset-4",
34
35
  "text-link-muted",
35
36
  "[@media(hover:hover)]:hover:underline",
36
37
  "focus-visible:bg-background"
@@ -46,8 +47,8 @@ const buttonVariants = cva([
46
47
  },
47
48
  size: {
48
49
  default: "type-text-sm",
49
- icon: "size-8 p-0 type-text-sm",
50
- "icon-rounded": "size-8 p-0 rounded-full type-text-sm",
50
+ icon: "size-8 max-md:min-w-11 p-0 type-text-sm",
51
+ "icon-rounded": "size-8 max-md:min-w-11 p-0 rounded-full type-text-sm",
51
52
  pill: "h-7 px-3 rounded-full type-text-xs"
52
53
  }
53
54
  },
@@ -52,7 +52,7 @@ function DialogContent({ className, children, size, showCloseButton = true, ...p
52
52
  ...props,
53
53
  children: [children, showCloseButton && /* @__PURE__ */ jsxs(DialogPrimitive.Close, {
54
54
  "data-slot": "dialog-close",
55
- className: cn("absolute top-3 right-4 flex size-8 items-center justify-center rounded-md", "text-subtle-foreground transition-colors", "[@media(hover:hover)]:hover:text-foreground", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none", "disabled:pointer-events-none"),
55
+ className: cn("absolute top-3 right-4 flex size-8 items-center justify-center rounded-md", "max-md:before:absolute max-md:before:top-1/2 max-md:before:left-1/2 max-md:before:size-11 max-md:before:-translate-x-1/2 max-md:before:-translate-y-1/2 max-md:before:content-['']", "text-subtle-foreground transition-colors", "[@media(hover:hover)]:hover:text-foreground", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none", "disabled:pointer-events-none"),
56
56
  children: [/* @__PURE__ */ jsx(XIcon, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
57
57
  className: "sr-only",
58
58
  children: "Close"
@@ -39,6 +39,7 @@ function DropdownMenuGroup({ ...props }) {
39
39
  }
40
40
  const dropdownMenuItemVariants = cva([
41
41
  "relative flex cursor-default items-center gap-2 rounded-sm px-2.5 py-2 outline-hidden select-none",
42
+ "max-md:min-h-11",
42
43
  "type-text-sm font-semibold",
43
44
  "mx-1.5 my-px",
44
45
  "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
@@ -0,0 +1,101 @@
1
+ import * as React$1 from "react";
2
+ //#region src/components/editable.d.ts
3
+ type Direction = "ltr" | "rtl";
4
+ interface DivProps extends React$1.ComponentProps<"div"> {
5
+ asChild?: boolean;
6
+ }
7
+ interface StoreState {
8
+ value: string;
9
+ editing: boolean;
10
+ }
11
+ interface Store {
12
+ subscribe: (callback: () => void) => () => void;
13
+ getState: () => StoreState;
14
+ setState: <K extends keyof StoreState>(key: K, value: StoreState[K]) => void;
15
+ notify: () => void;
16
+ }
17
+ declare function useStore<T>(selector: (state: StoreState) => T, ogStore?: Store | null): T;
18
+ interface EditableContextValue {
19
+ rootId: string;
20
+ inputId: string;
21
+ labelId: string;
22
+ defaultValue: string;
23
+ onCancel: () => void;
24
+ onEdit: () => void;
25
+ onSubmit: (value: string) => void;
26
+ onEnterKeyDown?: (event: KeyboardEvent) => void;
27
+ onEscapeKeyDown?: (event: KeyboardEvent) => void;
28
+ dir?: Direction;
29
+ maxLength?: number;
30
+ placeholder?: string;
31
+ triggerMode: "click" | "dblclick" | "focus";
32
+ autosize: boolean;
33
+ multiline: boolean;
34
+ disabled?: boolean;
35
+ readOnly?: boolean;
36
+ required?: boolean;
37
+ invalid?: boolean;
38
+ }
39
+ interface EditableProps extends Omit<DivProps, "onSubmit"> {
40
+ id?: string;
41
+ defaultValue?: string;
42
+ value?: string;
43
+ onValueChange?: (value: string) => void;
44
+ defaultEditing?: boolean;
45
+ editing?: boolean;
46
+ onEditingChange?: (editing: boolean) => void;
47
+ onCancel?: () => void;
48
+ onEdit?: () => void;
49
+ onSubmit?: (value: string) => void;
50
+ onEscapeKeyDown?: (event: KeyboardEvent) => void;
51
+ onEnterKeyDown?: (event: KeyboardEvent) => void;
52
+ dir?: Direction;
53
+ maxLength?: number;
54
+ name?: string;
55
+ placeholder?: string;
56
+ triggerMode?: EditableContextValue["triggerMode"];
57
+ autosize?: boolean;
58
+ multiline?: boolean;
59
+ disabled?: boolean;
60
+ readOnly?: boolean;
61
+ required?: boolean;
62
+ invalid?: boolean;
63
+ }
64
+ declare function Editable(props: EditableProps): React$1.JSX.Element;
65
+ interface EditableLabelProps extends React$1.ComponentProps<"label"> {
66
+ asChild?: boolean;
67
+ }
68
+ declare function EditableLabel(props: EditableLabelProps): React$1.JSX.Element;
69
+ interface EditableAreaProps extends React$1.ComponentProps<"div"> {
70
+ asChild?: boolean;
71
+ }
72
+ declare function EditableArea(props: EditableAreaProps): React$1.JSX.Element;
73
+ interface EditablePreviewProps extends React$1.ComponentProps<"div"> {
74
+ asChild?: boolean;
75
+ }
76
+ declare function EditablePreview(props: EditablePreviewProps): React$1.JSX.Element | null;
77
+ interface EditableInputProps extends React$1.ComponentProps<"input"> {
78
+ asChild?: boolean;
79
+ maxLength?: number;
80
+ }
81
+ declare function EditableInput(props: EditableInputProps): React$1.JSX.Element | null;
82
+ interface EditableTriggerProps extends React$1.ComponentProps<"button"> {
83
+ asChild?: boolean;
84
+ forceMount?: boolean;
85
+ }
86
+ declare function EditableTrigger(props: EditableTriggerProps): React$1.JSX.Element | null;
87
+ interface EditableToolbarProps extends React$1.ComponentProps<"div"> {
88
+ asChild?: boolean;
89
+ orientation?: "horizontal" | "vertical";
90
+ }
91
+ declare function EditableToolbar(props: EditableToolbarProps): React$1.JSX.Element;
92
+ interface EditableCancelProps extends React$1.ComponentProps<"button"> {
93
+ asChild?: boolean;
94
+ }
95
+ declare function EditableCancel(props: EditableCancelProps): React$1.JSX.Element | null;
96
+ interface EditableSubmitProps extends React$1.ComponentProps<"button"> {
97
+ asChild?: boolean;
98
+ }
99
+ declare function EditableSubmit(props: EditableSubmitProps): React$1.JSX.Element | null;
100
+ //#endregion
101
+ export { Editable, EditableArea, EditableCancel, EditableInput, EditableLabel, EditablePreview, type EditableProps, EditableSubmit, EditableToolbar, EditableTrigger, useStore as useEditable };