@exegia/corpora-ui 0.5.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 (71) hide show
  1. package/README.md +21 -0
  2. package/dist-lib/components/blocks/auth/auth-shell.d.ts +56 -0
  3. package/dist-lib/components/blocks/auth/code-auth-block.d.ts +22 -0
  4. package/dist-lib/components/blocks/auth/forgot-password-block.d.ts +15 -0
  5. package/dist-lib/components/blocks/auth/login-block.d.ts +25 -0
  6. package/dist-lib/components/blocks/auth/signup-block.d.ts +26 -0
  7. package/dist-lib/components/composed/password-input.d.ts +30 -0
  8. package/dist-lib/components/composed/social-providers.d.ts +22 -0
  9. package/dist-lib/components/docs/code-block.d.ts +4 -0
  10. package/dist-lib/components/docs/component-preview.d.ts +10 -0
  11. package/dist-lib/components/docs/demo-controls.d.ts +28 -0
  12. package/dist-lib/components/docs/props-table.d.ts +4 -0
  13. package/dist-lib/components/theme-provider.d.ts +15 -0
  14. package/dist-lib/components/ui/button.d.ts +28 -0
  15. package/dist-lib/components/ui/card.d.ts +16 -0
  16. package/dist-lib/components/ui/checkbox.d.ts +7 -0
  17. package/dist-lib/components/ui/field.d.ts +10 -0
  18. package/dist-lib/components/ui/frame.d.ts +7 -0
  19. package/dist-lib/components/ui/glasscn/glass-button.d.ts +6 -0
  20. package/dist-lib/components/ui/glasscn/liquid-glass.d.ts +31 -0
  21. package/dist-lib/components/ui/input-group.d.ts +13 -0
  22. package/dist-lib/components/ui/input.d.ts +9 -0
  23. package/dist-lib/components/ui/label.d.ts +11 -0
  24. package/dist-lib/components/ui/otp-field.d.ts +11 -0
  25. package/dist-lib/components/ui/separator.d.ts +4 -0
  26. package/dist-lib/components/ui/spinner.d.ts +3 -0
  27. package/dist-lib/components/ui/textarea.d.ts +8 -0
  28. package/dist-lib/index.d.ts +29 -0
  29. package/dist-lib/index.js +1617 -0
  30. package/dist-lib/index.js.map +1 -0
  31. package/dist-lib/lib/auth-accent.d.ts +33 -0
  32. package/dist-lib/lib/glass-variants.d.ts +6 -0
  33. package/dist-lib/lib/sound.d.ts +13 -0
  34. package/dist-lib/lib/utils.d.ts +2 -0
  35. package/dist-lib/lib/utils.test.d.ts +1 -0
  36. package/package.json +80 -0
  37. package/src/components/blocks/.gitkeep +0 -0
  38. package/src/components/blocks/auth/auth-shell.tsx +266 -0
  39. package/src/components/blocks/auth/code-auth-block.tsx +190 -0
  40. package/src/components/blocks/auth/forgot-password-block.tsx +123 -0
  41. package/src/components/blocks/auth/login-block.tsx +239 -0
  42. package/src/components/blocks/auth/signup-block.tsx +260 -0
  43. package/src/components/composed/.gitkeep +0 -0
  44. package/src/components/composed/password-input.tsx +179 -0
  45. package/src/components/composed/social-providers.tsx +89 -0
  46. package/src/components/docs/code-block.tsx +8 -0
  47. package/src/components/docs/component-preview.tsx +28 -0
  48. package/src/components/docs/demo-controls.tsx +118 -0
  49. package/src/components/docs/props-table.tsx +35 -0
  50. package/src/components/theme-provider.tsx +230 -0
  51. package/src/components/ui/button.tsx +199 -0
  52. package/src/components/ui/card.tsx +253 -0
  53. package/src/components/ui/checkbox.tsx +83 -0
  54. package/src/components/ui/field.tsx +89 -0
  55. package/src/components/ui/frame.tsx +87 -0
  56. package/src/components/ui/glasscn/glass-button.tsx +25 -0
  57. package/src/components/ui/glasscn/liquid-glass.tsx +276 -0
  58. package/src/components/ui/input-group.tsx +105 -0
  59. package/src/components/ui/input.tsx +70 -0
  60. package/src/components/ui/label.tsx +36 -0
  61. package/src/components/ui/otp-field.tsx +88 -0
  62. package/src/components/ui/separator.tsx +23 -0
  63. package/src/components/ui/spinner.tsx +17 -0
  64. package/src/components/ui/textarea.tsx +58 -0
  65. package/src/index.css +171 -0
  66. package/src/index.ts +37 -0
  67. package/src/lib/auth-accent.ts +49 -0
  68. package/src/lib/glass-variants.ts +57 -0
  69. package/src/lib/sound.ts +39 -0
  70. package/src/lib/utils.test.ts +22 -0
  71. package/src/lib/utils.ts +6 -0
@@ -0,0 +1,199 @@
1
+ "use client";
2
+
3
+ import { mergeProps } from "@base-ui/react/merge-props";
4
+ import { useRender } from "@base-ui/react/use-render";
5
+ import { cva, type VariantProps } from "class-variance-authority";
6
+ import type * as React from "react";
7
+ import { cn } from "@/lib/utils";
8
+ import { Spinner } from "@/components/ui/spinner";
9
+ import { LiquidGlass } from "@/components/ui/glasscn/liquid-glass";
10
+ import {
11
+ type FrostGlassVariant,
12
+ glassVariantStyles,
13
+ liquidRefractStyles,
14
+ } from "@/lib/glass-variants";
15
+
16
+ export const buttonVariants = cva(
17
+ "relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-lg border font-medium text-base outline-none transition-[scale,box-shadow,width,height,background-color,border-color] [transition-duration:150ms,150ms,300ms,300ms,150ms,150ms] ease-smooth-out active:scale-97 data-pressed:scale-97 motion-reduce:transition-none motion-reduce:active:scale-100 motion-reduce:data-pressed:scale-100 [&_svg]:transition-transform [&_svg]:duration-150 [&_svg]:ease-smooth-out motion-reduce:[&_svg]:transition-none before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 data-loading:select-none sm:text-sm [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:-mx-0.5 [&_svg]:shrink-0",
18
+ {
19
+ compoundVariants: [
20
+ {
21
+ // `link` is inline text, not a control surface: drop the button box so
22
+ // it sits with the surrounding copy instead of riding high in a 32/36px
23
+ // flex box. Both the bare and `sm:` heights have to be reset —
24
+ // tailwind-merge keeps modifier-prefixed classes in a separate group,
25
+ // so a call-site `h-auto` alone still loses to `sm:h-8`. border-0 makes
26
+ // the inline box exactly one line-height so it doesn't grow the line.
27
+ //
28
+ // align-middle is the alignment that holds: an inline-flex box exposes
29
+ // the baseline of its *first* flex item, which here is the always-
30
+ // mounted loading indicator rather than the label, so plain baseline
31
+ // alignment leaves the text ~3px high. `items-baseline` fixes that but
32
+ // then hangs icons 3px above the label. Centering the box lands within
33
+ // ~1px in every state without touching the loading-morph machinery.
34
+ //
35
+ // Icon sizes are excluded; they keep their square hit area.
36
+ class: "h-auto border-0 px-0 align-middle sm:h-auto",
37
+ size: ["xs", "sm", "default", "lg", "xl"],
38
+ variant: "link",
39
+ },
40
+ ],
41
+ defaultVariants: {
42
+ size: "default",
43
+ variant: "default",
44
+ },
45
+ variants: {
46
+ size: {
47
+ default: "h-9 px-[calc(--spacing(3)-1px)] sm:h-8",
48
+ icon: "size-9 sm:size-8",
49
+ "icon-lg": "size-10 sm:size-9",
50
+ "icon-sm": "size-8 sm:size-7",
51
+ "icon-xl":
52
+ "size-11 sm:size-10 [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5",
53
+ "icon-xs":
54
+ "size-7 rounded-md before:rounded-[calc(var(--radius-md)-1px)] sm:size-6 not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-4 sm:not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-3.5",
55
+ lg: "h-10 px-[calc(--spacing(3.5)-1px)] sm:h-9",
56
+ sm: "h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:h-7",
57
+ xl: "h-11 px-[calc(--spacing(4)-1px)] text-lg sm:h-10 sm:text-base [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5",
58
+ xs: "h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-sm before:rounded-[calc(var(--radius-md)-1px)] sm:h-6 sm:text-xs [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5",
59
+ },
60
+ variant: {
61
+ default:
62
+ "not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-primary bg-primary text-primary-foreground shadow-primary/24 shadow-xs hover:bg-primary/90 data-pressed:bg-primary/90 *:data-[slot=button-loading-indicator]:text-primary-foreground [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none",
63
+ destructive:
64
+ "not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-destructive bg-destructive text-white shadow-destructive/24 shadow-xs hover:bg-destructive/90 data-pressed:bg-destructive/90 *:data-[slot=button-loading-indicator]:text-white [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none",
65
+ "destructive-outline":
66
+ "border-input bg-popover not-dark:bg-clip-padding text-destructive-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] hover:border-destructive/32 hover:bg-destructive/4 data-pressed:border-destructive/32 data-pressed:bg-destructive/4 *:data-[slot=button-loading-indicator]:text-foreground dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none",
67
+ ghost:
68
+ "border-transparent text-foreground hover:bg-accent data-pressed:bg-accent *:data-[slot=button-loading-indicator]:text-foreground",
69
+ // Base for the glass treatment. The finish itself (blur, tint, bevel)
70
+ // comes from glassVariantStyles keyed by the `glassVariant` prop,
71
+ // which is only accepted when variant is "glass".
72
+ glass:
73
+ "border-transparent text-foreground *:data-[slot=button-loading-indicator]:text-foreground",
74
+ link: "border-transparent text-foreground underline-offset-4 hover:underline data-pressed:underline *:data-[slot=button-loading-indicator]:text-foreground",
75
+ outline:
76
+ "border-input bg-popover not-dark:bg-clip-padding text-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] hover:bg-accent/50 data-pressed:bg-accent/50 *:data-[slot=button-loading-indicator]:text-foreground dark:bg-input/32 dark:data-pressed:bg-input/64 dark:hover:bg-input/64 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none",
77
+ secondary:
78
+ "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/90 data-pressed:bg-secondary/90 *:data-[slot=button-loading-indicator]:text-secondary-foreground [:active,[data-pressed]]:bg-secondary/80",
79
+ },
80
+ },
81
+ },
82
+ );
83
+
84
+ type ButtonVariant = VariantProps<typeof buttonVariants>["variant"];
85
+
86
+ interface ButtonBaseProps extends useRender.ComponentProps<"button"> {
87
+ size?: VariantProps<typeof buttonVariants>["size"];
88
+ loading?: boolean;
89
+ /**
90
+ * Emit cuelume press/release attributes. Inert unless the app opts into
91
+ * interaction sound by calling `bindSounds()` once.
92
+ */
93
+ sound?: boolean;
94
+ }
95
+
96
+ export type ButtonProps = ButtonBaseProps &
97
+ (
98
+ | {
99
+ variant: "glass";
100
+ /** Glass finish. Only available when `variant` is "glass". */
101
+ glassVariant?: FrostGlassVariant;
102
+ }
103
+ | {
104
+ variant?: Exclude<ButtonVariant, "glass">;
105
+ glassVariant?: never;
106
+ }
107
+ );
108
+
109
+ export function Button({
110
+ className,
111
+ variant,
112
+ size,
113
+ render,
114
+ children,
115
+ loading = false,
116
+ disabled: disabledProp,
117
+ glassVariant,
118
+ sound = true,
119
+ ...props
120
+ }: ButtonProps): React.ReactElement {
121
+ const isDisabled: boolean = Boolean(loading || disabledProp);
122
+ const typeValue: React.ButtonHTMLAttributes<HTMLButtonElement>["type"] =
123
+ render ? undefined : "button";
124
+
125
+ const resolvedGlassVariant: FrostGlassVariant | undefined =
126
+ variant === "glass" ? (glassVariant ?? "liquid-refract") : undefined;
127
+ const isLiquidRefract = resolvedGlassVariant === "liquid-refract";
128
+
129
+ // Icon-only sizes overlay the spinner on top of the (hidden) icon; text
130
+ // sizes keep the label visible and show the spinner inline before it.
131
+ const isIconSize = (size ?? "default").startsWith("icon");
132
+
133
+ const defaultProps = {
134
+ children: (
135
+ <>
136
+ {!isIconSize && (
137
+ // Always mounted so the button width morphs as the slot collapses
138
+ // and expands; the closed state cancels the flex gap (which varies
139
+ // per size) with a matching negative margin.
140
+ <span
141
+ aria-hidden={loading ? undefined : true}
142
+ data-slot="button-loading-indicator"
143
+ className={cn(
144
+ "pointer-events-none inline-flex shrink-0 items-center overflow-hidden transition-[max-width,margin-inline-start,opacity,filter] duration-300 ease-smooth-out motion-reduce:transition-none",
145
+ loading
146
+ ? "max-w-6"
147
+ : cn(
148
+ "max-w-0 opacity-0 blur-[2px]",
149
+ size === "xs" ? "-ms-1" : size === "sm" ? "-ms-1.5" : "-ms-2",
150
+ ),
151
+ )}
152
+ >
153
+ <Spinner className={loading ? undefined : "animate-none"} />
154
+ </span>
155
+ )}
156
+ {children}
157
+ {loading && isIconSize && (
158
+ <Spinner
159
+ className="pointer-events-none absolute"
160
+ data-slot="button-loading-indicator"
161
+ />
162
+ )}
163
+ </>
164
+ ),
165
+ className: cn(
166
+ buttonVariants({ size, variant }),
167
+ // Label + icon buttons: icons do a gentle scale bump on hover. The
168
+ // class-based :not() skips the spinner (animate-spin / animate-none).
169
+ !isIconSize &&
170
+ "hover:[&_svg:not([class*='animate-'])]:scale-110 motion-reduce:hover:[&_svg]:scale-100",
171
+ loading && isIconSize && "data-loading:text-transparent",
172
+ resolvedGlassVariant && glassVariantStyles[resolvedGlassVariant],
173
+ isLiquidRefract && liquidRefractStyles,
174
+ className,
175
+ ),
176
+ "aria-disabled": loading || undefined,
177
+ "data-cuelume-press": sound ? "" : undefined,
178
+ "data-cuelume-release": sound ? "" : undefined,
179
+ "data-loading": loading ? "" : undefined,
180
+ "data-glass-variant": resolvedGlassVariant,
181
+ "data-slot": "button",
182
+ disabled: isDisabled,
183
+ type: typeValue,
184
+ };
185
+
186
+ const element = useRender({
187
+ defaultTagName: "button",
188
+ props: mergeProps<"button">(defaultProps, props),
189
+ render,
190
+ });
191
+
192
+ // liquid-refract delegates the finish to the LiquidGlass wrapper, which
193
+ // renders the SVG-displacement backdrop behind an unstyled button.
194
+ if (isLiquidRefract) {
195
+ return <LiquidGlass>{element}</LiquidGlass>;
196
+ }
197
+
198
+ return element;
199
+ }
@@ -0,0 +1,253 @@
1
+ "use client";
2
+
3
+ import { mergeProps } from "@base-ui/react/merge-props";
4
+ import { useRender } from "@base-ui/react/use-render";
5
+ import type React from "react";
6
+ import { cn } from "@/lib/utils";
7
+
8
+ export function Card({
9
+ className,
10
+ render,
11
+ ...props
12
+ }: useRender.ComponentProps<"div">): React.ReactElement {
13
+ const defaultProps = {
14
+ className: cn(
15
+ "relative flex flex-col rounded-2xl border bg-card not-dark:bg-clip-padding text-card-foreground shadow-xs/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
16
+ className,
17
+ ),
18
+ "data-slot": "card",
19
+ };
20
+
21
+ return useRender({
22
+ defaultTagName: "div",
23
+ props: mergeProps<"div">(defaultProps, props),
24
+ render,
25
+ });
26
+ }
27
+
28
+ export function CardFrame({
29
+ className,
30
+ render,
31
+ ...props
32
+ }: useRender.ComponentProps<"div">): React.ReactElement {
33
+ const defaultProps = {
34
+ className: cn(
35
+ "relative flex flex-col rounded-2xl border bg-card not-dark:bg-clip-padding text-card-foreground shadow-xs/5 [--clip-bottom:-1rem] [--clip-top:-1rem] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:bg-muted/72 before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=table-container]:overflow-hidden *:data-[slot=card]:-m-px *:data-[slot=table-container]:-m-px *:data-[slot=table-container]:w-[calc(100%+2px)] *:not-first:data-[slot=card]:rounded-t-xl *:not-last:data-[slot=card]:rounded-b-xl *:data-[slot=card]:bg-clip-padding *:data-[slot=card]:shadow-none *:data-[slot=card]:before:hidden *:not-first:data-[slot=card]:before:rounded-t-[calc(var(--radius-xl)-1px)] *:not-last:data-[slot=card]:before:rounded-b-[calc(var(--radius-xl)-1px)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)] *:data-[slot=card]:[clip-path:inset(var(--clip-top)_1px_var(--clip-bottom)_1px_round_calc(var(--radius-2xl)-1px))] *:data-[slot=card]:last:[--clip-bottom:1px] *:data-[slot=card]:first:[--clip-top:1px]",
36
+ className,
37
+ ),
38
+ "data-slot": "card-frame",
39
+ };
40
+
41
+ return useRender({
42
+ defaultTagName: "div",
43
+ props: mergeProps<"div">(defaultProps, props),
44
+ render,
45
+ });
46
+ }
47
+
48
+ export function CardFrameHeader({
49
+ className,
50
+ render,
51
+ ...props
52
+ }: useRender.ComponentProps<"div">): React.ReactElement {
53
+ const defaultProps = {
54
+ className: cn(
55
+ "relative flex grid auto-rows-min grid-rows-[auto_auto] flex-col items-start gap-x-4 px-6 py-4 has-data-[slot=card-frame-action]:grid-cols-[1fr_auto]",
56
+ className,
57
+ ),
58
+ "data-slot": "card-frame-header",
59
+ };
60
+
61
+ return useRender({
62
+ defaultTagName: "div",
63
+ props: mergeProps<"div">(defaultProps, props),
64
+ render,
65
+ });
66
+ }
67
+
68
+ export function CardFrameTitle({
69
+ className,
70
+ render,
71
+ ...props
72
+ }: useRender.ComponentProps<"div">): React.ReactElement {
73
+ const defaultProps = {
74
+ className: cn("self-center font-semibold text-sm", className),
75
+ "data-slot": "card-frame-title",
76
+ };
77
+
78
+ return useRender({
79
+ defaultTagName: "div",
80
+ props: mergeProps<"div">(defaultProps, props),
81
+ render,
82
+ });
83
+ }
84
+
85
+ export function CardFrameDescription({
86
+ className,
87
+ render,
88
+ ...props
89
+ }: useRender.ComponentProps<"div">): React.ReactElement {
90
+ const defaultProps = {
91
+ className: cn("self-center text-muted-foreground text-sm", className),
92
+ "data-slot": "card-frame-description",
93
+ };
94
+
95
+ return useRender({
96
+ defaultTagName: "div",
97
+ props: mergeProps<"div">(defaultProps, props),
98
+ render,
99
+ });
100
+ }
101
+
102
+ export function CardFrameAction({
103
+ className,
104
+ render,
105
+ ...props
106
+ }: useRender.ComponentProps<"div">): React.ReactElement {
107
+ const defaultProps = {
108
+ className: cn(
109
+ "col-start-2 nth-3:row-span-2 nth-3:row-start-1 inline-flex self-center justify-self-end",
110
+ className,
111
+ ),
112
+ "data-slot": "card-frame-action",
113
+ };
114
+
115
+ return useRender({
116
+ defaultTagName: "div",
117
+ props: mergeProps<"div">(defaultProps, props),
118
+ render,
119
+ });
120
+ }
121
+
122
+ export function CardFrameFooter({
123
+ className,
124
+ render,
125
+ ...props
126
+ }: useRender.ComponentProps<"div">): React.ReactElement {
127
+ const defaultProps = {
128
+ className: cn("px-6 py-4", className),
129
+ "data-slot": "card-frame-footer",
130
+ };
131
+
132
+ return useRender({
133
+ defaultTagName: "div",
134
+ props: mergeProps<"div">(defaultProps, props),
135
+ render,
136
+ });
137
+ }
138
+
139
+ export function CardHeader({
140
+ className,
141
+ render,
142
+ ...props
143
+ }: useRender.ComponentProps<"div">): React.ReactElement {
144
+ const defaultProps = {
145
+ className: cn(
146
+ "grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 p-6 in-[[data-slot=card]:has(>[data-slot=card-panel])]:pb-4 has-data-[slot=card-action]:grid-cols-[1fr_auto]",
147
+ className,
148
+ ),
149
+ "data-slot": "card-header",
150
+ };
151
+
152
+ return useRender({
153
+ defaultTagName: "div",
154
+ props: mergeProps<"div">(defaultProps, props),
155
+ render,
156
+ });
157
+ }
158
+
159
+ export function CardTitle({
160
+ className,
161
+ render,
162
+ ...props
163
+ }: useRender.ComponentProps<"div">): React.ReactElement {
164
+ const defaultProps = {
165
+ className: cn("font-heading font-semibold text-lg leading-none", className),
166
+ "data-slot": "card-title",
167
+ };
168
+
169
+ return useRender({
170
+ defaultTagName: "div",
171
+ props: mergeProps<"div">(defaultProps, props),
172
+ render,
173
+ });
174
+ }
175
+
176
+ export function CardDescription({
177
+ className,
178
+ render,
179
+ ...props
180
+ }: useRender.ComponentProps<"div">): React.ReactElement {
181
+ const defaultProps = {
182
+ className: cn("text-muted-foreground text-sm", className),
183
+ "data-slot": "card-description",
184
+ };
185
+
186
+ return useRender({
187
+ defaultTagName: "div",
188
+ props: mergeProps<"div">(defaultProps, props),
189
+ render,
190
+ });
191
+ }
192
+
193
+ export function CardAction({
194
+ className,
195
+ render,
196
+ ...props
197
+ }: useRender.ComponentProps<"div">): React.ReactElement {
198
+ const defaultProps = {
199
+ className: cn(
200
+ "col-start-2 row-span-2 row-start-1 inline-flex self-start justify-self-end",
201
+ className,
202
+ ),
203
+ "data-slot": "card-action",
204
+ };
205
+
206
+ return useRender({
207
+ defaultTagName: "div",
208
+ props: mergeProps<"div">(defaultProps, props),
209
+ render,
210
+ });
211
+ }
212
+
213
+ export function CardPanel({
214
+ className,
215
+ render,
216
+ ...props
217
+ }: useRender.ComponentProps<"div">): React.ReactElement {
218
+ const defaultProps = {
219
+ className: cn(
220
+ "flex-1 p-6 in-[[data-slot=card]:has(>[data-slot=card-header]:not(.border-b))]:pt-0 in-[[data-slot=card]:has(>[data-slot=card-footer]:not(.border-t))]:pb-0",
221
+ className,
222
+ ),
223
+ "data-slot": "card-panel",
224
+ };
225
+
226
+ return useRender({
227
+ defaultTagName: "div",
228
+ props: mergeProps<"div">(defaultProps, props),
229
+ render,
230
+ });
231
+ }
232
+
233
+ export function CardFooter({
234
+ className,
235
+ render,
236
+ ...props
237
+ }: useRender.ComponentProps<"div">): React.ReactElement {
238
+ const defaultProps = {
239
+ className: cn(
240
+ "flex items-center p-6 in-[[data-slot=card]:has(>[data-slot=card-panel])]:pt-4",
241
+ className,
242
+ ),
243
+ "data-slot": "card-footer",
244
+ };
245
+
246
+ return useRender({
247
+ defaultTagName: "div",
248
+ props: mergeProps<"div">(defaultProps, props),
249
+ render,
250
+ });
251
+ }
252
+
253
+ export { CardPanel as CardContent };
@@ -0,0 +1,83 @@
1
+ "use client";
2
+
3
+ import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";
4
+ import type React from "react";
5
+ import { playCue } from "@/lib/sound";
6
+ import { cn } from "@/lib/utils";
7
+
8
+ export function Checkbox({
9
+ className,
10
+ sound = true,
11
+ onCheckedChange,
12
+ ...props
13
+ }: CheckboxPrimitive.Root.Props & {
14
+ /** Play the cuelume toggle cue on check/uncheck. Silent until bindSounds(). */
15
+ sound?: boolean;
16
+ }): React.ReactElement {
17
+ return (
18
+ <CheckboxPrimitive.Root
19
+ // Cued off the state change rather than data-cuelume-toggle: Base UI
20
+ // renders the native input as a *sibling* of this root, so a click on an
21
+ // associated <label> never bubbles through an element carrying the
22
+ // attribute and would toggle silently. This fires once for box clicks,
23
+ // label clicks and keyboard Space alike, and not for programmatic changes.
24
+ onCheckedChange={(checked, eventDetails) => {
25
+ if (sound) playCue("toggle");
26
+ onCheckedChange?.(checked, eventDetails);
27
+ }}
28
+ className={cn(
29
+ "relative inline-flex size-4.5 shrink-0 cursor-pointer items-center justify-center rounded-[.25rem] border border-input bg-background not-dark:bg-clip-padding shadow-xs/5 outline-none ring-ring transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[3px] not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-background aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/48 data-disabled:cursor-not-allowed data-disabled:opacity-64 sm:size-4 dark:not-data-checked:bg-input/32 dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] [[data-disabled],[data-checked],[aria-invalid]]:shadow-none",
30
+ className,
31
+ )}
32
+ data-slot="checkbox"
33
+ {...props}
34
+ >
35
+ <CheckboxPrimitive.Indicator
36
+ className="absolute -inset-px flex items-center justify-center rounded-[.25rem] text-primary-foreground data-unchecked:hidden data-checked:bg-primary data-indeterminate:text-foreground"
37
+ data-slot="checkbox-indicator"
38
+ render={(
39
+ props: React.ComponentProps<"span">,
40
+ state: CheckboxPrimitive.Indicator.State,
41
+ ) => (
42
+ <span {...props}>
43
+ {state.indeterminate ? (
44
+ <svg
45
+ aria-hidden="true"
46
+ className="size-3.5 sm:size-3"
47
+ fill="none"
48
+ height="24"
49
+ stroke="currentColor"
50
+ strokeLinecap="round"
51
+ strokeLinejoin="round"
52
+ strokeWidth="3"
53
+ viewBox="0 0 24 24"
54
+ width="24"
55
+ xmlns="http://www.w3.org/2000/svg"
56
+ >
57
+ <path d="M5.252 12h13.496" />
58
+ </svg>
59
+ ) : (
60
+ <svg
61
+ aria-hidden="true"
62
+ className="size-3.5 sm:size-3"
63
+ fill="none"
64
+ height="24"
65
+ stroke="currentColor"
66
+ strokeLinecap="round"
67
+ strokeLinejoin="round"
68
+ strokeWidth="3"
69
+ viewBox="0 0 24 24"
70
+ width="24"
71
+ xmlns="http://www.w3.org/2000/svg"
72
+ >
73
+ <path d="M5.252 12.7 10.2 18.63 18.748 5.37" />
74
+ </svg>
75
+ )}
76
+ </span>
77
+ )}
78
+ />
79
+ </CheckboxPrimitive.Root>
80
+ );
81
+ }
82
+
83
+ export { CheckboxPrimitive };
@@ -0,0 +1,89 @@
1
+ "use client";
2
+
3
+ import { Field as FieldPrimitive } from "@base-ui/react/field";
4
+ import type React from "react";
5
+ import { cn } from "@/lib/utils";
6
+
7
+ export function Field({
8
+ className,
9
+ ...props
10
+ }: FieldPrimitive.Root.Props): React.ReactElement {
11
+ return (
12
+ <FieldPrimitive.Root
13
+ className={cn("flex flex-col items-start gap-2", className)}
14
+ data-slot="field"
15
+ {...props}
16
+ />
17
+ );
18
+ }
19
+
20
+ export function FieldLabel({
21
+ className,
22
+ ...props
23
+ }: FieldPrimitive.Label.Props): React.ReactElement {
24
+ return (
25
+ <FieldPrimitive.Label
26
+ className={cn(
27
+ "inline-flex cursor-pointer items-center gap-2 font-medium text-base/4 text-foreground data-disabled:cursor-not-allowed data-disabled:opacity-64 sm:text-xs/3.5 ml-3",
28
+ className,
29
+ )}
30
+ data-slot="field-label"
31
+ {...props}
32
+ />
33
+ );
34
+ }
35
+
36
+ export function FieldItem({
37
+ className,
38
+ ...props
39
+ }: FieldPrimitive.Item.Props): React.ReactElement {
40
+ return (
41
+ <FieldPrimitive.Item
42
+ className={cn("flex", className)}
43
+ data-slot="field-item"
44
+ {...props}
45
+ />
46
+ );
47
+ }
48
+
49
+ export function FieldDescription({
50
+ className,
51
+ ...props
52
+ }: FieldPrimitive.Description.Props): React.ReactElement {
53
+ return (
54
+ <FieldPrimitive.Description
55
+ // Entrance morph when conditionally shown: height tweens from 0 via
56
+ // interpolate-size (set on :root) plus a fade/blur rise. Removal is
57
+ // unmount-instant; wrap in AnimatePresence when an exit is needed.
58
+ className={cn(
59
+ "overflow-hidden text-muted-foreground text-xs transition-[height,opacity,filter,translate] duration-300 ease-smooth-out starting:h-0 starting:translate-y-1 starting:opacity-0 starting:blur-[2px] motion-reduce:transition-none",
60
+ className,
61
+ )}
62
+ data-slot="field-description"
63
+ {...props}
64
+ />
65
+ );
66
+ }
67
+
68
+ export function FieldError({
69
+ className,
70
+ ...props
71
+ }: FieldPrimitive.Error.Props): React.ReactElement {
72
+ return (
73
+ <FieldPrimitive.Error
74
+ className={cn(
75
+ "overflow-hidden text-destructive-foreground text-xs transition-[height,opacity,filter,translate] duration-300 ease-smooth-out starting:h-0 starting:translate-y-1 starting:opacity-0 starting:blur-[2px] motion-reduce:transition-none",
76
+ className,
77
+ )}
78
+ data-slot="field-error"
79
+ {...props}
80
+ />
81
+ );
82
+ }
83
+
84
+ export const FieldControl: typeof FieldPrimitive.Control =
85
+ FieldPrimitive.Control;
86
+ export const FieldValidity: typeof FieldPrimitive.Validity =
87
+ FieldPrimitive.Validity;
88
+
89
+ export { FieldPrimitive };