@alepha/ui 0.25.0 → 0.25.1

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 (33) hide show
  1. package/package.json +4 -5
  2. package/src/components/control-select/__tests__/control-select-deselect.browser.spec.tsx +126 -0
  3. package/src/components/control-select/control-select.tsx +68 -13
  4. package/src/components/ui/alert-dialog.tsx +1 -1
  5. package/src/components/ui/avatar.tsx +2 -0
  6. package/src/components/ui/breadcrumb.tsx +1 -1
  7. package/src/components/ui/calendar.tsx +11 -6
  8. package/src/components/ui/card.tsx +5 -5
  9. package/src/components/ui/carousel.tsx +4 -4
  10. package/src/components/ui/chart.tsx +2 -0
  11. package/src/components/ui/collapsible.tsx +2 -0
  12. package/src/components/ui/combobox.tsx +3 -1
  13. package/src/components/ui/context-menu.tsx +3 -3
  14. package/src/components/ui/dialog.tsx +6 -1
  15. package/src/components/ui/direction.tsx +2 -0
  16. package/src/components/ui/drawer.tsx +134 -37
  17. package/src/components/ui/dropdown-menu.tsx +5 -3
  18. package/src/components/ui/empty.tsx +4 -1
  19. package/src/components/ui/input-otp.tsx +2 -0
  20. package/src/components/ui/menubar.tsx +2 -2
  21. package/src/components/ui/pagination.tsx +2 -2
  22. package/src/components/ui/popover.tsx +2 -0
  23. package/src/components/ui/radio-group.tsx +2 -0
  24. package/src/components/ui/scroll-area.tsx +2 -0
  25. package/src/components/ui/select.tsx +1 -1
  26. package/src/components/ui/separator.tsx +2 -0
  27. package/src/components/ui/sheet.tsx +4 -1
  28. package/src/components/ui/sidebar.tsx +1 -1
  29. package/src/components/ui/spinner.tsx +1 -0
  30. package/src/components/ui/switch.tsx +2 -0
  31. package/src/components/ui/tabs.tsx +2 -0
  32. package/src/components/ui/toggle-group.tsx +2 -0
  33. package/src/components/ui/tooltip.tsx +2 -0
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "tailwind"
11
11
  ],
12
12
  "author": "Feunard",
13
- "version": "0.25.0",
13
+ "version": "0.25.1",
14
14
  "type": "module",
15
15
  "engines": {
16
16
  "node": ">=22.0.0"
@@ -57,11 +57,10 @@
57
57
  "shadcn": "^4.16.1",
58
58
  "sonner": "^2.0.7",
59
59
  "tailwind-merge": "^3.6.0",
60
- "tw-animate-css": "^1.4.0",
61
- "vaul": "^1.1.2"
60
+ "tw-animate-css": "^1.4.0"
62
61
  },
63
62
  "peerDependencies": {
64
- "alepha": "0.25.0",
63
+ "alepha": "0.25.1",
65
64
  "react": "*",
66
65
  "react-dom": "*",
67
66
  "recharts": "^3",
@@ -77,7 +76,7 @@
77
76
  "@testing-library/dom": "^10.4.1",
78
77
  "@testing-library/react": "^16.3.2",
79
78
  "@types/react": "^19.2.18",
80
- "alepha": "0.25.0",
79
+ "alepha": "0.25.1",
81
80
  "react": "^19.2.8",
82
81
  "react-dom": "^19.2.8",
83
82
  "typescript": "^7.0.2"
@@ -0,0 +1,126 @@
1
+ import { fireEvent, render, waitFor } from "@testing-library/react";
2
+ import { Alepha, z } from "alepha";
3
+ import { AlephaLogger } from "alepha/logger";
4
+ import { AlephaContext } from "alepha/react";
5
+ import { type BaseInputField, useFieldValue, useForm } from "alepha/react/form";
6
+ import { AlephaReactI18n } from "alepha/react/i18n";
7
+ import type { ReactNode } from "react";
8
+ import { describe, expect, it } from "vitest";
9
+ import { ControlSelect } from "../control-select.tsx";
10
+
11
+ /**
12
+ * Base UI's single-select `Combobox` re-selects on every item press — it never
13
+ * emits `null` — so a searchable select had no way back to the empty state once
14
+ * a value was picked. The native-`Select` render path has always been able to
15
+ * (its `clearable` row), which made the gap invisible until a field crossed the
16
+ * option count that switches it to the combobox.
17
+ */
18
+ describe("ControlSelect combobox deselection", () => {
19
+ const mount = (alepha: Alepha, ui: ReactNode) =>
20
+ render(
21
+ <AlephaContext.Provider value={alepha}>{ui}</AlephaContext.Provider>,
22
+ );
23
+
24
+ const start = async () => {
25
+ const alepha = Alepha.create().with(AlephaLogger).with(AlephaReactI18n);
26
+ await alepha.start();
27
+ return alepha;
28
+ };
29
+
30
+ const Probe = (props: {
31
+ required?: boolean;
32
+ clearable?: boolean;
33
+ clearLabel?: string;
34
+ }) => {
35
+ const form = useForm({
36
+ schema: z.object(
37
+ props.required
38
+ ? { tag: z.text() }
39
+ : { tag: z.text().optional() as never },
40
+ ),
41
+ handler: () => {},
42
+ });
43
+ return (
44
+ <>
45
+ <ControlSelect
46
+ input={form.input.tag}
47
+ label="Tag"
48
+ combobox
49
+ clearable={props.clearable}
50
+ clearLabel={props.clearLabel}
51
+ items={["docs", "react"]}
52
+ />
53
+ <Reporter input={form.input.tag} />
54
+ </>
55
+ );
56
+ };
57
+
58
+ /**
59
+ * Renders the bound value so the assertions read the form state rather than
60
+ * the trigger's label, which falls back to the placeholder and would pass for
61
+ * the wrong reason.
62
+ */
63
+ const Reporter = (props: { input: BaseInputField }) => {
64
+ const [value] = useFieldValue(props.input);
65
+ return (
66
+ <span data-testid="value">
67
+ {value === undefined ? "∅" : String(value)}
68
+ </span>
69
+ );
70
+ };
71
+
72
+ const openPopup = (ui: ReturnType<typeof render>) => {
73
+ fireEvent.keyDown(ui.getByRole("combobox"), { key: "ArrowDown" });
74
+ };
75
+
76
+ it("offers the clearable row so a filter can go back to 'All …'", async () => {
77
+ const alepha = await start();
78
+ const ui = mount(alepha, <Probe clearable clearLabel="All zones" />);
79
+
80
+ openPopup(ui);
81
+ fireEvent.click(await ui.findByRole("option", { name: "docs" }));
82
+ await waitFor(() => {
83
+ expect(ui.getByTestId("value").textContent).toBe("docs");
84
+ });
85
+
86
+ openPopup(ui);
87
+ fireEvent.click(await ui.findByRole("option", { name: "All zones" }));
88
+ await waitFor(() => {
89
+ expect(ui.getByTestId("value").textContent).toBe("∅");
90
+ });
91
+ });
92
+
93
+ it("clears an optional field when the selected row is pressed again", async () => {
94
+ const alepha = await start();
95
+ const ui = mount(alepha, <Probe />);
96
+
97
+ openPopup(ui);
98
+ fireEvent.click(await ui.findByRole("option", { name: "docs" }));
99
+ await waitFor(() => {
100
+ expect(ui.getByTestId("value").textContent).toBe("docs");
101
+ });
102
+
103
+ openPopup(ui);
104
+ fireEvent.click(await ui.findByRole("option", { name: "docs" }));
105
+ await waitFor(() => {
106
+ expect(ui.getByTestId("value").textContent).toBe("∅");
107
+ });
108
+ });
109
+
110
+ it("keeps the value on a required field", async () => {
111
+ const alepha = await start();
112
+ const ui = mount(alepha, <Probe required />);
113
+
114
+ openPopup(ui);
115
+ fireEvent.click(await ui.findByRole("option", { name: "docs" }));
116
+ await waitFor(() => {
117
+ expect(ui.getByTestId("value").textContent).toBe("docs");
118
+ });
119
+
120
+ openPopup(ui);
121
+ fireEvent.click(await ui.findByRole("option", { name: "docs" }));
122
+ await waitFor(() => {
123
+ expect(ui.getByTestId("value").textContent).toBe("docs");
124
+ });
125
+ });
126
+ });
@@ -286,6 +286,9 @@ export function ControlSelect(props: ControlSelectProps) {
286
286
  );
287
287
  }
288
288
 
289
+ const clearLabel =
290
+ props.clearLabel ?? tr("controlSelect.none", { default: "None" });
291
+
289
292
  // Async loader, multi-select, explicit combobox, or many items → Combobox
290
293
  if (isArray || props.combobox || mode === "long" || data.length > 20) {
291
294
  return (
@@ -308,20 +311,24 @@ export function ControlSelect(props: ControlSelectProps) {
308
311
  onSearch={mode === "long" ? search.run : undefined}
309
312
  createNewEntry={props.createNewEntry}
310
313
  icon={props.icon}
311
- placeholder={
312
- props.clearable
313
- ? (props.clearLabel ??
314
- tr("controlSelect.none", { default: "None" }))
315
- : undefined
316
- }
314
+ // `clearable` used to reach this path as a placeholder and nothing
315
+ // else, so a filter chip that had switched to the combobox (>20
316
+ // options) could be set but never put back to "All …".
317
+ clearable={props.clearable}
318
+ clearLabel={clearLabel}
319
+ // An optional field must also be able to go back to empty without a
320
+ // dedicated row: Base UI never emits `null`, so re-pressing the
321
+ // selected row deselects (see `handleSingle`). A required field keeps
322
+ // its value — clearing it would only produce a validation error the
323
+ // user cannot see yet.
324
+ deselectable={props.clearable || !meta.required}
325
+ placeholder={props.clearable ? clearLabel : undefined}
317
326
  />
318
327
  </FormField>
319
328
  );
320
329
  }
321
330
 
322
331
  // Infer / short — native Select
323
- const clearLabel =
324
- props.clearLabel ?? tr("controlSelect.none", { default: "None" });
325
332
  const labelFor = (raw: string) => {
326
333
  const found = data.find((o) => optValue(o) === raw);
327
334
  return found ? optLabel(found) : raw;
@@ -414,6 +421,20 @@ interface ComboboxProps {
414
421
  * empty placeholder. Defaults to "Select…".
415
422
  */
416
423
  placeholder?: string;
424
+ /**
425
+ * Prepend a row that resets the field to `undefined` — the combobox
426
+ * equivalent of the native `Select`'s clear row.
427
+ */
428
+ clearable?: boolean;
429
+ /**
430
+ * Label of the `clearable` row (e.g. "All zones").
431
+ */
432
+ clearLabel?: string;
433
+ /**
434
+ * Allow the single-select value to be unset by pressing the row that is
435
+ * already selected. Set for optional (and `clearable`) fields only.
436
+ */
437
+ deselectable?: boolean;
417
438
  }
418
439
 
419
440
  /**
@@ -433,6 +454,10 @@ interface ComboOption {
433
454
  * Marks the synthetic "create new" row injected by `createNewEntry`.
434
455
  */
435
456
  create?: boolean;
457
+ /**
458
+ * Marks the synthetic "clear" row injected by `clearable`.
459
+ */
460
+ clear?: boolean;
436
461
  /**
437
462
  * The raw query that produced a `create` row (used as the new entry's label).
438
463
  */
@@ -514,9 +539,26 @@ function Combobox(props: ComboboxProps) {
514
539
  })()
515
540
  : undefined;
516
541
 
517
- const items: ComboOption[] = createOption
518
- ? [...filtered, createOption]
519
- : filtered;
542
+ // The synthetic "no selection" row — "All zones", "All tags", "None". Only
543
+ // meaningful for a single select: the multi path clears by removing chips.
544
+ const clearRow: ComboOption | undefined =
545
+ props.clearable && !props.multi
546
+ ? {
547
+ value: CLEAR_VALUE,
548
+ label:
549
+ props.clearLabel ?? tr("controlSelect.none", { default: "None" }),
550
+ clear: true,
551
+ }
552
+ : undefined;
553
+ // Filtered on its own label like any other row, so searching "zone" doesn't
554
+ // leave "All zones" stranded at the top of a list it doesn't match.
555
+ const showClear = clearRow && clearRow.label.toLowerCase().includes(q);
556
+
557
+ const items: ComboOption[] = [
558
+ ...(showClear && clearRow ? [clearRow] : []),
559
+ ...filtered,
560
+ ...(createOption ? [createOption] : []),
561
+ ];
520
562
 
521
563
  // Reconstruct option objects for the controlled value. Base UI matches them
522
564
  // back to list items via `isItemEqualToValue` (by `value`), so identity
@@ -531,7 +573,9 @@ function Combobox(props: ComboboxProps) {
531
573
  ? selected.map(toValueObject)
532
574
  : selected[0]
533
575
  ? toValueObject(selected[0])
534
- : null;
576
+ : // Empty + clearable reads as "the clear row is what's selected", so it
577
+ // carries the check mark — same as the native `Select` path.
578
+ (clearRow ?? null);
535
579
 
536
580
  const remember = (o: ComboOption) => {
537
581
  if (o.create) labelCache.current.set(o.value, o.query ?? o.value);
@@ -539,8 +583,19 @@ function Combobox(props: ComboboxProps) {
539
583
  };
540
584
 
541
585
  const handleSingle = (o: ComboOption | null) => {
542
- if (!o) {
586
+ if (!o || o.clear) {
587
+ props.onChange(undefined);
588
+ setQuery("");
589
+ return;
590
+ }
591
+ // Base UI's single-select `Combobox` re-selects on every item press — its
592
+ // `handleSelection` calls `setSelectedValue(itemValue)` unconditionally and
593
+ // never emits `null` — so pressing the checked row was a no-op and an
594
+ // optional field had no way back to empty. Toggle it off here, the way the
595
+ // multi path already does via its chips.
596
+ if (props.deselectable && !o.create && selected[0] === o.value) {
543
597
  props.onChange(undefined);
598
+ setQuery("");
544
599
  return;
545
600
  }
546
601
  remember(o);
@@ -116,7 +116,7 @@ function AlertDialogTitle({
116
116
  <AlertDialogPrimitive.Title
117
117
  data-slot="alert-dialog-title"
118
118
  className={cn(
119
- "text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",
119
+ "cn-font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",
120
120
  className,
121
121
  )}
122
122
  {...props}
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { cn } from "@alepha/ui/lib/utils";
2
4
  import { Avatar as AvatarPrimitive } from "@base-ui/react/avatar";
3
5
  import type * as React from "react";
@@ -84,7 +84,7 @@ function BreadcrumbSeparator({
84
84
  className={cn("[&>svg]:size-3.5", className)}
85
85
  {...props}
86
86
  >
87
- {children ?? <ChevronRightIcon />}
87
+ {children ?? <ChevronRightIcon className="cn-rtl-flip" />}
88
88
  </li>
89
89
  );
90
90
  }
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { Button, buttonVariants } from "@alepha/ui/components/ui/button";
2
4
  import { cn } from "@alepha/ui/lib/utils";
3
5
  import { useI18n } from "alepha/react/i18n";
@@ -84,7 +86,7 @@ function Calendar({
84
86
  defaultClassNames.dropdowns,
85
87
  ),
86
88
  dropdown_root: cn(
87
- "relative rounded-(--cell-radius)",
89
+ "cn-calendar-dropdown-root relative rounded-(--cell-radius)",
88
90
  defaultClassNames.dropdown_root,
89
91
  ),
90
92
  dropdown: cn(
@@ -94,11 +96,11 @@ function Calendar({
94
96
  caption_label: cn(
95
97
  "font-medium select-none",
96
98
  captionLayout === "label"
97
- ? "text-sm"
98
- : "flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
99
+ ? "cn-calendar-caption text-sm"
100
+ : "cn-calendar-caption-label flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
99
101
  defaultClassNames.caption_label,
100
102
  ),
101
- month_grid: "w-full border-collapse",
103
+ month_grid: cn("w-full border-collapse", defaultClassNames.month_grid),
102
104
  weekdays: cn("flex", defaultClassNames.weekdays),
103
105
  weekday: cn(
104
106
  "flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none",
@@ -158,14 +160,17 @@ function Calendar({
158
160
  Chevron: ({ className, orientation, ...props }) => {
159
161
  if (orientation === "left") {
160
162
  return (
161
- <ChevronLeftIcon className={cn("size-4", className)} {...props} />
163
+ <ChevronLeftIcon
164
+ className={cn("cn-rtl-flip size-4", className)}
165
+ {...props}
166
+ />
162
167
  );
163
168
  }
164
169
 
165
170
  if (orientation === "right") {
166
171
  return (
167
172
  <ChevronRightIcon
168
- className={cn("size-4", className)}
173
+ className={cn("cn-rtl-flip size-4", className)}
169
174
  {...props}
170
175
  />
171
176
  );
@@ -11,7 +11,7 @@ function Card({
11
11
  data-slot="card"
12
12
  data-size={size}
13
13
  className={cn(
14
- "group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
14
+ "group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
15
15
  className,
16
16
  )}
17
17
  {...props}
@@ -24,7 +24,7 @@ function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
24
24
  <div
25
25
  data-slot="card-header"
26
26
  className={cn(
27
- "group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",
27
+ "group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",
28
28
  className,
29
29
  )}
30
30
  {...props}
@@ -37,7 +37,7 @@ function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
37
37
  <div
38
38
  data-slot="card-title"
39
39
  className={cn(
40
- "text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",
40
+ "cn-font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",
41
41
  className,
42
42
  )}
43
43
  {...props}
@@ -72,7 +72,7 @@ function CardContent({ className, ...props }: React.ComponentProps<"div">) {
72
72
  return (
73
73
  <div
74
74
  data-slot="card-content"
75
- className={cn("px-4 group-data-[size=sm]/card:px-3", className)}
75
+ className={cn("px-(--card-spacing)", className)}
76
76
  {...props}
77
77
  />
78
78
  );
@@ -83,7 +83,7 @@ function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
83
83
  <div
84
84
  data-slot="card-footer"
85
85
  className={cn(
86
- "flex items-center rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/card:p-3",
86
+ "flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)",
87
87
  className,
88
88
  )}
89
89
  {...props}
@@ -186,7 +186,7 @@ function CarouselPrevious({
186
186
  className={cn(
187
187
  "absolute touch-manipulation rounded-full",
188
188
  orientation === "horizontal"
189
- ? "top-1/2 -left-12 -translate-y-1/2"
189
+ ? "inset-y-0 -left-12 my-auto"
190
190
  : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
191
191
  className,
192
192
  )}
@@ -194,7 +194,7 @@ function CarouselPrevious({
194
194
  onClick={scrollPrev}
195
195
  {...props}
196
196
  >
197
- <ChevronLeftIcon />
197
+ <ChevronLeftIcon className="cn-rtl-flip" />
198
198
  <span className="sr-only">Previous slide</span>
199
199
  </Button>
200
200
  );
@@ -216,7 +216,7 @@ function CarouselNext({
216
216
  className={cn(
217
217
  "absolute touch-manipulation rounded-full",
218
218
  orientation === "horizontal"
219
- ? "top-1/2 -right-12 -translate-y-1/2"
219
+ ? "inset-y-0 -right-12 my-auto"
220
220
  : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
221
221
  className,
222
222
  )}
@@ -224,7 +224,7 @@ function CarouselNext({
224
224
  onClick={scrollNext}
225
225
  {...props}
226
226
  >
227
- <ChevronRightIcon />
227
+ <ChevronRightIcon className="cn-rtl-flip" />
228
228
  <span className="sr-only">Next slide</span>
229
229
  </Button>
230
230
  );
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { cn } from "@alepha/ui/lib/utils";
2
4
  import * as React from "react";
3
5
  import type { TooltipValueType } from "recharts";
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
2
4
 
3
5
  function Collapsible({ ...props }: CollapsiblePrimitive.Root.Props) {
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { Button } from "@alepha/ui/components/ui/button";
2
4
  import {
3
5
  InputGroup,
@@ -109,7 +111,7 @@ function ComboboxContent({
109
111
  data-slot="combobox-content"
110
112
  data-chips={!!anchor}
111
113
  className={cn(
112
- "group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
114
+ "cn-menu-target cn-menu-translucent group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
113
115
  className,
114
116
  )}
115
117
  {...props}
@@ -52,7 +52,7 @@ function ContextMenuContent({
52
52
  <ContextMenuPrimitive.Popup
53
53
  data-slot="context-menu-content"
54
54
  className={cn(
55
- "z-50 max-h-(--available-height) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
55
+ "cn-menu-target cn-menu-translucent z-50 max-h-(--available-height) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
56
56
  className,
57
57
  )}
58
58
  {...props}
@@ -136,7 +136,7 @@ function ContextMenuSubTrigger({
136
136
  {...props}
137
137
  >
138
138
  {children}
139
- <ChevronRightIcon className="ml-auto" />
139
+ <ChevronRightIcon className="cn-rtl-flip ml-auto" />
140
140
  </ContextMenuPrimitive.SubmenuTrigger>
141
141
  );
142
142
  }
@@ -147,7 +147,7 @@ function ContextMenuSubContent({
147
147
  return (
148
148
  <ContextMenuContent
149
149
  data-slot="context-menu-sub-content"
150
- className="shadow-lg"
150
+ className="cn-menu-target cn-menu-translucent shadow-lg"
151
151
  side="right"
152
152
  {...props}
153
153
  />
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { Button } from "@alepha/ui/components/ui/button";
2
4
  import { cn } from "@alepha/ui/lib/utils";
3
5
  import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
@@ -117,7 +119,10 @@ function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) {
117
119
  return (
118
120
  <DialogPrimitive.Title
119
121
  data-slot="dialog-title"
120
- className={cn("text-base leading-none font-medium", className)}
122
+ className={cn(
123
+ "cn-font-heading text-base leading-none font-medium",
124
+ className,
125
+ )}
121
126
  {...props}
122
127
  />
123
128
  );
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  export {
2
4
  DirectionProvider,
3
5
  useDirection,
@@ -1,42 +1,94 @@
1
1
  "use client";
2
2
 
3
3
  import { cn } from "@alepha/ui/lib/utils";
4
- import type * as React from "react";
5
- import { Drawer as DrawerPrimitive } from "vaul";
4
+ import { Drawer as DrawerPrimitive } from "@base-ui/react/drawer";
5
+ import * as React from "react";
6
+
7
+ type DrawerContextProps = {
8
+ hasSnapPoints: boolean;
9
+ modal: DrawerPrimitive.Root.Props["modal"];
10
+ showSwipeHandle: boolean;
11
+ swipeDirection: NonNullable<DrawerPrimitive.Root.Props["swipeDirection"]>;
12
+ };
13
+
14
+ const DrawerContext = React.createContext<DrawerContextProps | null>(null);
15
+
16
+ function useDrawer() {
17
+ const context = React.useContext(DrawerContext);
18
+
19
+ if (!context) {
20
+ throw new Error("useDrawer must be used within a Drawer.");
21
+ }
22
+
23
+ return context;
24
+ }
6
25
 
7
26
  function Drawer({
27
+ modal = true,
28
+ showSwipeHandle = false,
29
+ snapPoints,
30
+ swipeDirection = "down",
8
31
  ...props
9
- }: React.ComponentProps<typeof DrawerPrimitive.Root>) {
10
- return <DrawerPrimitive.Root data-slot="drawer" {...props} />;
32
+ }: DrawerPrimitive.Root.Props & {
33
+ showSwipeHandle?: boolean;
34
+ }) {
35
+ const hasSnapPoints = snapPoints != null && snapPoints.length > 0;
36
+ const contextValue = React.useMemo(
37
+ () => ({ hasSnapPoints, modal, showSwipeHandle, swipeDirection }),
38
+ [hasSnapPoints, modal, showSwipeHandle, swipeDirection],
39
+ );
40
+
41
+ return (
42
+ <DrawerContext.Provider value={contextValue}>
43
+ <DrawerPrimitive.Root
44
+ data-slot="drawer"
45
+ modal={modal}
46
+ snapPoints={snapPoints}
47
+ swipeDirection={swipeDirection}
48
+ {...props}
49
+ />
50
+ </DrawerContext.Provider>
51
+ );
11
52
  }
12
53
 
13
- function DrawerTrigger({
14
- ...props
15
- }: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
54
+ function DrawerTrigger({ ...props }: DrawerPrimitive.Trigger.Props) {
16
55
  return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />;
17
56
  }
18
57
 
19
- function DrawerPortal({
20
- ...props
21
- }: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
58
+ function DrawerPortal({ ...props }: DrawerPrimitive.Portal.Props) {
22
59
  return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />;
23
60
  }
24
61
 
25
- function DrawerClose({
26
- ...props
27
- }: React.ComponentProps<typeof DrawerPrimitive.Close>) {
62
+ function DrawerClose({ ...props }: DrawerPrimitive.Close.Props) {
28
63
  return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />;
29
64
  }
30
65
 
31
66
  function DrawerOverlay({
32
67
  className,
33
68
  ...props
34
- }: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {
69
+ }: DrawerPrimitive.Backdrop.Props) {
35
70
  return (
36
- <DrawerPrimitive.Overlay
71
+ <DrawerPrimitive.Backdrop
37
72
  data-slot="drawer-overlay"
38
73
  className={cn(
39
- "fixed inset-0 z-50 bg-black/10 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
74
+ "fixed inset-0 z-50 min-h-dvh bg-black/10 opacity-[max(var(--drawer-overlay-min-opacity,0),calc(1-var(--drawer-swipe-progress)))] transition-opacity duration-450 ease-[cubic-bezier(0.32,0.72,0,1)] select-none data-ending-style:pointer-events-none data-ending-style:opacity-0 data-ending-style:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-snap-points:[--drawer-overlay-min-opacity:0.5] data-starting-style:opacity-0 data-swiping:duration-0 supports-backdrop-filter:backdrop-blur-xs supports-[-webkit-touch-callout:none]:absolute",
75
+ className,
76
+ )}
77
+ {...props}
78
+ />
79
+ );
80
+ }
81
+
82
+ function DrawerSwipeHandle({
83
+ className,
84
+ ...props
85
+ }: React.ComponentProps<"div">) {
86
+ return (
87
+ <div
88
+ data-slot="drawer-swipe-handle"
89
+ aria-hidden="true"
90
+ className={cn(
91
+ "relative z-10 flex shrink-0 cursor-grab transition-opacity duration-200 group-data-nested-drawer-open/drawer-popup:opacity-0 group-data-nested-drawer-swiping/drawer-popup:opacity-100 group-data-[swipe-axis=x]/drawer-popup:h-full group-data-[swipe-axis=x]/drawer-popup:w-3 group-data-[swipe-axis=x]/drawer-popup:items-center group-data-[swipe-axis=y]/drawer-popup:h-3 group-data-[swipe-axis=y]/drawer-popup:w-full group-data-[swipe-axis=y]/drawer-popup:justify-center group-data-[swipe-direction=down]/drawer-popup:items-end group-data-[swipe-direction=left]/drawer-popup:order-last group-data-[swipe-direction=left]/drawer-popup:justify-start group-data-[swipe-direction=right]/drawer-popup:justify-end group-data-[swipe-direction=up]/drawer-popup:order-last group-data-[swipe-direction=up]/drawer-popup:items-start after:block after:shrink-0 after:rounded-full after:bg-muted group-data-[swipe-axis=x]/drawer-popup:after:h-24 group-data-[swipe-axis=x]/drawer-popup:after:w-1 group-data-[swipe-axis=y]/drawer-popup:after:h-1 group-data-[swipe-axis=y]/drawer-popup:after:w-24 active:cursor-grabbing",
40
92
  className,
41
93
  )}
42
94
  {...props}
@@ -48,21 +100,65 @@ function DrawerContent({
48
100
  className,
49
101
  children,
50
102
  ...props
51
- }: React.ComponentProps<typeof DrawerPrimitive.Content>) {
103
+ }: DrawerPrimitive.Popup.Props) {
104
+ const { hasSnapPoints, modal, showSwipeHandle, swipeDirection } = useDrawer();
105
+ const swipeAxis =
106
+ swipeDirection === "down" || swipeDirection === "up" ? "y" : "x";
107
+
52
108
  return (
53
109
  <DrawerPortal data-slot="drawer-portal">
54
- <DrawerOverlay />
55
- <DrawerPrimitive.Content
56
- data-slot="drawer-content"
57
- className={cn(
58
- "group/drawer-content fixed z-50 flex h-auto flex-col bg-popover text-sm text-popover-foreground data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-xl data-[vaul-drawer-direction=bottom]:border-t data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:rounded-r-xl data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:rounded-l-xl data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-xl data-[vaul-drawer-direction=top]:border-b data-[vaul-drawer-direction=left]:sm:max-w-sm data-[vaul-drawer-direction=right]:sm:max-w-sm",
59
- className,
60
- )}
61
- {...props}
110
+ {modal === true && (
111
+ <DrawerOverlay data-snap-points={hasSnapPoints ? "" : undefined} />
112
+ )}
113
+ <DrawerPrimitive.Viewport
114
+ data-slot="drawer-viewport"
115
+ data-modal={modal}
116
+ className="pointer-events-none fixed inset-0 z-50 select-none data-[modal=true]:pointer-events-auto"
62
117
  >
63
- <div className="mx-auto mt-4 hidden h-1 w-[100px] shrink-0 rounded-full bg-muted group-data-[vaul-drawer-direction=bottom]/drawer-content:block" />
64
- {children}
65
- </DrawerPrimitive.Content>
118
+ <DrawerPrimitive.Popup
119
+ data-slot="drawer-popup"
120
+ data-swipe-axis={swipeAxis}
121
+ data-snap-points={hasSnapPoints ? "" : undefined}
122
+ className={cn(
123
+ // Base.
124
+ "group/drawer-popup pointer-events-auto fixed z-50 m-(--drawer-inset,0px) flex h-(--drawer-content-height) max-h-(--drawer-content-max-height,none) min-h-0 w-(--drawer-content-width,auto) transform-[translate3d(var(--translate-x,0px),var(--translate-y,0px),0)_scale(var(--stack-scale))] flex-col bg-popover text-sm text-popover-foreground transition-[transform,height,opacity,filter] duration-450 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-transform outline-none select-none [interpolate-size:allow-keywords] data-[swipe-direction=down]:rounded-t-xl data-[swipe-direction=down]:border-t data-[swipe-direction=left]:rounded-r-xl data-[swipe-direction=left]:border-r data-[swipe-direction=right]:rounded-l-xl data-[swipe-direction=right]:border-l data-[swipe-direction=up]:rounded-b-xl data-[swipe-direction=up]:border-b",
125
+ // Nested.
126
+ "data-nested-drawer-open:overflow-hidden data-nested-drawer-open:brightness-95",
127
+ // Bleed.
128
+ "after:pointer-events-none after:absolute after:bg-(--drawer-bleed-background,var(--color-popover)) data-[swipe-axis=x]:after:inset-y-0 data-[swipe-axis=x]:after:w-(--bleed) data-[swipe-axis=y]:after:inset-x-0 data-[swipe-axis=y]:after:h-(--bleed) data-[swipe-direction=down]:after:top-full data-[swipe-direction=left]:after:right-full data-[swipe-direction=right]:after:left-full data-[swipe-direction=up]:after:bottom-full",
129
+ // Sizing.
130
+ "[--drawer-content-height:var(--drawer-height,auto)] data-[swipe-axis=x]:[--drawer-content-width:75%] data-[swipe-axis=y]:[--drawer-content-max-height:calc(100dvh-6rem)] data-[swipe-axis=y]:data-snap-points:[--drawer-content-height:100dvh] data-[swipe-axis=x]:sm:[--drawer-content-width:24rem]",
131
+ // Stack.
132
+ "[--bleed:3rem] [--peek:1rem] [--stack-height:var(--drawer-frontmost-height,var(--drawer-height,0px))] [--stack-peek-offset:max(0px,calc((var(--nested-drawers)-var(--stack-progress))*var(--peek)))] [--stack-progress:clamp(0,var(--drawer-swipe-progress),1)] [--stack-scale-base:max(0,calc(1-(var(--nested-drawers)*var(--stack-step))))] [--stack-scale:clamp(0,calc(var(--stack-scale-base)+(var(--stack-step)*var(--stack-progress))),1)] [--stack-shrink:calc(1-var(--stack-scale))] [--stack-step:0.05]",
133
+ // Transitions.
134
+ "data-ending-style:transform-(--closed-transform) data-ending-style:opacity-[0.9999] data-ending-style:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-nested-drawer-swiping:duration-0 data-ending-style:data-nested-drawer-swiping:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-starting-style:transform-(--closed-transform) data-swiping:duration-0 data-ending-style:data-swiping:duration-[calc(var(--drawer-swipe-strength)*400ms)]",
135
+ // Axis: y.
136
+ "data-[swipe-axis=y]:inset-x-0 data-[swipe-axis=y]:data-nested-drawer-open:h-(--stack-height)",
137
+ // Axis: x.
138
+ "data-[swipe-axis=x]:inset-y-0 data-[swipe-axis=x]:flex-row",
139
+ // Direction: down.
140
+ "data-[swipe-direction=down]:bottom-0 data-[swipe-direction=down]:origin-bottom data-[swipe-direction=down]:[--closed-transform:translate3d(0,calc(100%+var(--drawer-inset,0px)+2px),0)] data-[swipe-direction=down]:[--translate-y:calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y)-var(--stack-peek-offset)-(var(--stack-shrink)*var(--stack-height)))]",
141
+ // Direction: up.
142
+ "data-[swipe-direction=up]:top-0 data-[swipe-direction=up]:origin-top data-[swipe-direction=up]:[--closed-transform:translate3d(0,calc(-100%-var(--drawer-inset,0px)-2px),0)] data-[swipe-direction=up]:[--translate-y:calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y)+var(--stack-peek-offset)+(var(--stack-shrink)*var(--stack-height)))]",
143
+ // Direction: left.
144
+ "data-[swipe-direction=left]:left-0 data-[swipe-direction=left]:origin-left data-[swipe-direction=left]:[--closed-transform:translate3d(calc(-100%-var(--drawer-inset,0px)-2px),0,0)] data-[swipe-direction=left]:[--translate-x:calc(var(--drawer-swipe-movement-x)+var(--stack-peek-offset)+(var(--stack-shrink)*100%))]",
145
+ // Direction: right.
146
+ "data-[swipe-direction=right]:right-0 data-[swipe-direction=right]:origin-right data-[swipe-direction=right]:[--closed-transform:translate3d(calc(100%+var(--drawer-inset,0px)+2px),0,0)] data-[swipe-direction=right]:[--translate-x:calc(var(--drawer-swipe-movement-x)-var(--stack-peek-offset)-(var(--stack-shrink)*100%))]",
147
+ className,
148
+ )}
149
+ {...props}
150
+ >
151
+ {showSwipeHandle && <DrawerSwipeHandle />}
152
+ <DrawerPrimitive.Content
153
+ data-slot="drawer-content"
154
+ className={cn(
155
+ "flex min-h-0 flex-1 flex-col overflow-hidden overscroll-contain rounded-[inherit] transition-opacity duration-300 ease-[cubic-bezier(0.45,1.005,0,1.005)] select-text group-data-nested-drawer-open/drawer-popup:opacity-0 group-data-nested-drawer-swiping/drawer-popup:opacity-100 group-data-swiping/drawer-popup:select-none",
156
+ )}
157
+ >
158
+ {children}
159
+ </DrawerPrimitive.Content>
160
+ </DrawerPrimitive.Popup>
161
+ </DrawerPrimitive.Viewport>
66
162
  </DrawerPortal>
67
163
  );
68
164
  }
@@ -72,7 +168,7 @@ function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
72
168
  <div
73
169
  data-slot="drawer-header"
74
170
  className={cn(
75
- "flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-0.5 md:text-left",
171
+ "flex shrink-0 flex-col gap-0.5 p-4 pb-0 group-data-[swipe-axis=y]/drawer-popup:text-center md:gap-0.5 md:text-left",
76
172
  className,
77
173
  )}
78
174
  {...props}
@@ -84,20 +180,20 @@ function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
84
180
  return (
85
181
  <div
86
182
  data-slot="drawer-footer"
87
- className={cn("mt-auto flex flex-col gap-2 p-4", className)}
183
+ className={cn("mt-auto flex shrink-0 flex-col gap-2 p-4 pt-0", className)}
88
184
  {...props}
89
185
  />
90
186
  );
91
187
  }
92
188
 
93
- function DrawerTitle({
94
- className,
95
- ...props
96
- }: React.ComponentProps<typeof DrawerPrimitive.Title>) {
189
+ function DrawerTitle({ className, ...props }: DrawerPrimitive.Title.Props) {
97
190
  return (
98
191
  <DrawerPrimitive.Title
99
192
  data-slot="drawer-title"
100
- className={cn("text-base font-medium text-foreground", className)}
193
+ className={cn(
194
+ "cn-font-heading text-base font-medium text-foreground",
195
+ className,
196
+ )}
101
197
  {...props}
102
198
  />
103
199
  );
@@ -106,11 +202,11 @@ function DrawerTitle({
106
202
  function DrawerDescription({
107
203
  className,
108
204
  ...props
109
- }: React.ComponentProps<typeof DrawerPrimitive.Description>) {
205
+ }: DrawerPrimitive.Description.Props) {
110
206
  return (
111
207
  <DrawerPrimitive.Description
112
208
  data-slot="drawer-description"
113
- className={cn("text-sm text-muted-foreground", className)}
209
+ className={cn("text-sm text-balance text-muted-foreground", className)}
114
210
  {...props}
115
211
  />
116
212
  );
@@ -125,6 +221,7 @@ export {
125
221
  DrawerHeader,
126
222
  DrawerOverlay,
127
223
  DrawerPortal,
224
+ DrawerSwipeHandle,
128
225
  DrawerTitle,
129
226
  DrawerTrigger,
130
227
  };
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { cn } from "@alepha/ui/lib/utils";
2
4
  import { Menu as MenuPrimitive } from "@base-ui/react/menu";
3
5
  import { CheckIcon, ChevronRightIcon } from "lucide-react";
@@ -39,7 +41,7 @@ function DropdownMenuContent({
39
41
  <MenuPrimitive.Popup
40
42
  data-slot="dropdown-menu-content"
41
43
  className={cn(
42
- "z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",
44
+ "cn-menu-target cn-menu-translucent z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",
43
45
  className,
44
46
  )}
45
47
  {...props}
@@ -119,7 +121,7 @@ function DropdownMenuSubTrigger({
119
121
  {...props}
120
122
  >
121
123
  {children}
122
- <ChevronRightIcon className="ml-auto" />
124
+ <ChevronRightIcon className="cn-rtl-flip ml-auto" />
123
125
  </MenuPrimitive.SubmenuTrigger>
124
126
  );
125
127
  }
@@ -136,7 +138,7 @@ function DropdownMenuSubContent({
136
138
  <DropdownMenuContent
137
139
  data-slot="dropdown-menu-sub-content"
138
140
  className={cn(
139
- "w-auto min-w-[96px] rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
141
+ "cn-menu-target cn-menu-translucent w-auto min-w-[96px] rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
140
142
  className,
141
143
  )}
142
144
  align={align}
@@ -58,7 +58,10 @@ function EmptyTitle({ className, ...props }: React.ComponentProps<"div">) {
58
58
  return (
59
59
  <div
60
60
  data-slot="empty-title"
61
- className={cn("text-sm font-medium tracking-tight", className)}
61
+ className={cn(
62
+ "cn-font-heading text-sm font-medium tracking-tight",
63
+ className,
64
+ )}
62
65
  {...props}
63
66
  />
64
67
  );
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { cn } from "@alepha/ui/lib/utils";
2
4
  import { OTPInput, OTPInputContext } from "input-otp";
3
5
  import { MinusIcon } from "lucide-react";
@@ -80,7 +80,7 @@ function MenubarContent({
80
80
  alignOffset={alignOffset}
81
81
  sideOffset={sideOffset}
82
82
  className={cn(
83
- "min-w-36 rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95",
83
+ "cn-menu-target cn-menu-translucent min-w-36 rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95",
84
84
  className,
85
85
  )}
86
86
  {...props}
@@ -255,7 +255,7 @@ function MenubarSubContent({
255
255
  <DropdownMenuSubContent
256
256
  data-slot="menubar-sub-content"
257
257
  className={cn(
258
- "min-w-32 rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
258
+ "cn-menu-target cn-menu-translucent min-w-32 rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
259
259
  className,
260
260
  )}
261
261
  {...props}
@@ -78,7 +78,7 @@ function PaginationPrevious({
78
78
  className={cn("pl-1.5!", className)}
79
79
  {...props}
80
80
  >
81
- <ChevronLeftIcon data-icon="inline-start" />
81
+ <ChevronLeftIcon data-icon="inline-start" className="cn-rtl-flip" />
82
82
  <span className="hidden sm:block">{text}</span>
83
83
  </PaginationLink>
84
84
  );
@@ -97,7 +97,7 @@ function PaginationNext({
97
97
  {...props}
98
98
  >
99
99
  <span className="hidden sm:block">{text}</span>
100
- <ChevronRightIcon data-icon="inline-end" />
100
+ <ChevronRightIcon data-icon="inline-end" className="cn-rtl-flip" />
101
101
  </PaginationLink>
102
102
  );
103
103
  }
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { cn } from "@alepha/ui/lib/utils";
2
4
  import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
3
5
  import type * as React from "react";
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { cn } from "@alepha/ui/lib/utils";
2
4
  import { Radio as RadioPrimitive } from "@base-ui/react/radio";
3
5
  import { RadioGroup as RadioGroupPrimitive } from "@base-ui/react/radio-group";
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { cn } from "@alepha/ui/lib/utils";
2
4
  import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area";
3
5
 
@@ -83,7 +83,7 @@ function SelectContent({
83
83
  data-slot="select-content"
84
84
  data-align-trigger={alignItemWithTrigger}
85
85
  className={cn(
86
- "relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
86
+ "cn-menu-target cn-menu-translucent relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
87
87
  className,
88
88
  )}
89
89
  {...props}
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { cn } from "@alepha/ui/lib/utils";
2
4
  import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
3
5
 
@@ -102,7 +102,10 @@ function SheetTitle({ className, ...props }: SheetPrimitive.Title.Props) {
102
102
  return (
103
103
  <SheetPrimitive.Title
104
104
  data-slot="sheet-title"
105
- className={cn("text-base font-medium text-foreground", className)}
105
+ className={cn(
106
+ "cn-font-heading text-base font-medium text-foreground",
107
+ className,
108
+ )}
106
109
  {...props}
107
110
  />
108
111
  );
@@ -271,7 +271,7 @@ function SidebarTrigger({
271
271
  }}
272
272
  {...props}
273
273
  >
274
- <PanelLeftIcon />
274
+ <PanelLeftIcon className="cn-rtl-flip" />
275
275
  <span className="sr-only">Toggle Sidebar</span>
276
276
  </Button>
277
277
  );
@@ -4,6 +4,7 @@ import { Loader2Icon } from "lucide-react";
4
4
  function Spinner({ className, ...props }: React.ComponentProps<"svg">) {
5
5
  return (
6
6
  <Loader2Icon
7
+ data-slot="spinner"
7
8
  role="status"
8
9
  aria-label="Loading"
9
10
  className={cn("size-4 animate-spin", className)}
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { cn } from "@alepha/ui/lib/utils";
2
4
  import { Switch as SwitchPrimitive } from "@base-ui/react/switch";
3
5
 
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { cn } from "@alepha/ui/lib/utils";
2
4
  import { Tabs as TabsPrimitive } from "@base-ui/react/tabs";
3
5
  import { cva, type VariantProps } from "class-variance-authority";
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { toggleVariants } from "@alepha/ui/components/ui/toggle";
2
4
  import { cn } from "@alepha/ui/lib/utils";
3
5
  import { Toggle as TogglePrimitive } from "@base-ui/react/toggle";
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import { cn } from "@alepha/ui/lib/utils";
2
4
  import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
3
5