@makoai/app-sdk 2.19.0 → 2.21.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.
@@ -0,0 +1,27 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { cn } from "../menu/utils"
5
+ import { Separator as SeparatorPrimitive } from "radix-ui"
6
+
7
+ function Separator({
8
+ className,
9
+ orientation = "horizontal",
10
+ decorative = true,
11
+ ...props
12
+ }: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
13
+ return (
14
+ <SeparatorPrimitive.Root
15
+ data-slot="separator"
16
+ decorative={decorative}
17
+ orientation={orientation}
18
+ className={cn(
19
+ "shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
20
+ className
21
+ )}
22
+ {...props}
23
+ />
24
+ )
25
+ }
26
+
27
+ export { Separator }
@@ -0,0 +1,13 @@
1
+ import { cn } from "../menu/utils"
2
+
3
+ function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
4
+ return (
5
+ <div
6
+ data-slot="skeleton"
7
+ className={cn("animate-pulse rounded-md bg-accent", className)}
8
+ {...props}
9
+ />
10
+ )
11
+ }
12
+
13
+ export { Skeleton }
@@ -0,0 +1,90 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { cva, type VariantProps } from "class-variance-authority"
5
+ import { cn } from "../menu/utils"
6
+ import { Tabs as TabsPrimitive } from "radix-ui"
7
+
8
+ function Tabs({
9
+ className,
10
+ orientation = "horizontal",
11
+ ...props
12
+ }: React.ComponentProps<typeof TabsPrimitive.Root>) {
13
+ return (
14
+ <TabsPrimitive.Root
15
+ data-slot="tabs"
16
+ data-orientation={orientation}
17
+ orientation={orientation}
18
+ className={cn(
19
+ "group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",
20
+ className
21
+ )}
22
+ {...props}
23
+ />
24
+ )
25
+ }
26
+
27
+ const tabsListVariants = cva(
28
+ "group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none",
29
+ {
30
+ variants: {
31
+ variant: {
32
+ default: "bg-muted",
33
+ line: "gap-1 bg-transparent",
34
+ },
35
+ },
36
+ defaultVariants: {
37
+ variant: "default",
38
+ },
39
+ }
40
+ )
41
+
42
+ function TabsList({
43
+ className,
44
+ variant = "default",
45
+ ...props
46
+ }: React.ComponentProps<typeof TabsPrimitive.List> &
47
+ VariantProps<typeof tabsListVariants>) {
48
+ return (
49
+ <TabsPrimitive.List
50
+ data-slot="tabs-list"
51
+ data-variant={variant}
52
+ className={cn(tabsListVariants({ variant }), className)}
53
+ {...props}
54
+ />
55
+ )
56
+ }
57
+
58
+ function TabsTrigger({
59
+ className,
60
+ ...props
61
+ }: React.ComponentProps<typeof TabsPrimitive.Trigger>) {
62
+ return (
63
+ <TabsPrimitive.Trigger
64
+ data-slot="tabs-trigger"
65
+ className={cn(
66
+ "relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
67
+ "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent",
68
+ "data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:data-[state=active]:text-foreground",
69
+ "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",
70
+ className
71
+ )}
72
+ {...props}
73
+ />
74
+ )
75
+ }
76
+
77
+ function TabsContent({
78
+ className,
79
+ ...props
80
+ }: React.ComponentProps<typeof TabsPrimitive.Content>) {
81
+ return (
82
+ <TabsPrimitive.Content
83
+ data-slot="tabs-content"
84
+ className={cn("flex-1 outline-none", className)}
85
+ {...props}
86
+ />
87
+ )
88
+ }
89
+
90
+ export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants }
@@ -0,0 +1,56 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { cn } from "../menu/utils"
5
+ import { Tooltip as TooltipPrimitive } from "radix-ui"
6
+
7
+ function TooltipProvider({
8
+ delayDuration = 0,
9
+ ...props
10
+ }: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
11
+ return (
12
+ <TooltipPrimitive.Provider
13
+ data-slot="tooltip-provider"
14
+ delayDuration={delayDuration}
15
+ {...props}
16
+ />
17
+ )
18
+ }
19
+
20
+ function Tooltip({
21
+ ...props
22
+ }: React.ComponentProps<typeof TooltipPrimitive.Root>) {
23
+ return <TooltipPrimitive.Root data-slot="tooltip" {...props} />
24
+ }
25
+
26
+ function TooltipTrigger({
27
+ ...props
28
+ }: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
29
+ return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />
30
+ }
31
+
32
+ function TooltipContent({
33
+ className,
34
+ sideOffset = 0,
35
+ children,
36
+ ...props
37
+ }: React.ComponentProps<typeof TooltipPrimitive.Content>) {
38
+ return (
39
+ <TooltipPrimitive.Portal>
40
+ <TooltipPrimitive.Content
41
+ data-slot="tooltip-content"
42
+ sideOffset={sideOffset}
43
+ className={cn(
44
+ "z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 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-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
45
+ className
46
+ )}
47
+ {...props}
48
+ >
49
+ {children}
50
+ <TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" />
51
+ </TooltipPrimitive.Content>
52
+ </TooltipPrimitive.Portal>
53
+ )
54
+ }
55
+
56
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
package/index.d.ts CHANGED
@@ -432,3 +432,41 @@ export function hostShortcutFor(event: {
432
432
  altKey: boolean;
433
433
  shiftKey: boolean;
434
434
  }): "mod+k" | null;
435
+
436
+ // ---------------------------------------------------------------------------
437
+ // Times and dates (2.21): instants in the viewer's zone, day buckets unshifted
438
+ // ---------------------------------------------------------------------------
439
+
440
+ /** A time value an app may hold: a Date, epoch ms, epoch µs (bigint), an ISO string, or a zone-less "YYYY-MM-DD[ hh:mm[:ss]]" read as UTC. */
441
+ export type TimeValue = Date | number | bigint | string | null | undefined;
442
+
443
+ /** Any time value as a Date; null when empty or unparsable. A zone-less string is UTC (DuckDB runs in UTC). */
444
+ export function toInstant(value: TimeValue): Date | null;
445
+
446
+ /** The UTC calendar day, "YYYY-MM-DD": the key for URL state, joins and maps. Null when unparsable. */
447
+ export function toDayKey(value: TimeValue): string | null;
448
+
449
+ export interface FormatTimeOptions {
450
+ /** "auto" (default): the date only when it is not today in the viewer's zone. */
451
+ date?: boolean | "auto";
452
+ seconds?: boolean;
453
+ /** Append the zone's short name ("CET"). Default true. */
454
+ zoneName?: boolean;
455
+ locale?: string;
456
+ /** The viewer's zone by default. Set it only for tests or an explicit "as seen from" view. */
457
+ timeZone?: string;
458
+ now?: Date;
459
+ }
460
+ /** An instant in the viewer's zone with its zone label: "14:05 CET", "18 Nov, 14:05 CET". "—" for null. */
461
+ export function formatTime(value: TimeValue, opts?: FormatTimeOptions): string;
462
+
463
+ export interface FormatDateOptions {
464
+ /** "auto" (default): the year only when it is not the current year. */
465
+ year?: boolean | "auto";
466
+ weekday?: false | "short" | "long";
467
+ month?: "short" | "long" | "numeric";
468
+ locale?: string;
469
+ now?: Date;
470
+ }
471
+ /** A calendar day printed with no zone shift: "18 Nov 2026". "—" for null. */
472
+ export function formatDate(value: TimeValue, opts?: FormatDateOptions): string;
package/index.js CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  readBytes,
9
9
  readProgressStream,
10
10
  } from "./progress.js";
11
+ export { formatDate, formatTime, toDayKey, toInstant } from "./time.js";
11
12
  export {
12
13
  BINDING_PHASES,
13
14
  BINDING_PHASE_LABELS,
@@ -37,7 +38,7 @@ import {
37
38
  * in a page (or this export) says which SDK a deployed app actually runs.
38
39
  * Kept in step with package.json by snapshot.test.mjs.
39
40
  */
40
- export const SDK_VERSION = "2.19.0";
41
+ export const SDK_VERSION = "2.21.0";
41
42
  if (typeof window !== "undefined") {
42
43
  try {
43
44
  window.__MAKO_APP_SDK__ = SDK_VERSION;
package/lint.js ADDED
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env node
2
+ // mako-app-lint (2.21): the 2 app rules a reviewer kept repeating.
3
+ //
4
+ // utc-display getUTC*, timeZone: "UTC" or toISOString().slice in display
5
+ // code. Instants show in the viewer's zone (formatTime), day
6
+ // buckets unshifted (formatDate), keys come from toDayKey.
7
+ // local-shadcn src/components/ui/<name>.tsx where @makoai/app-sdk ships
8
+ // that component (/components, /menu). Import it instead.
9
+ //
10
+ // Usage: npx mako-app-lint [app dir …] [--warn]. Exit 1 on findings unless
11
+ // --warn. A line ending in `// mako-lint-ignore utc-display` is skipped (a
12
+ // date key the helpers cannot build, with the reason on the line above).
13
+ import { existsSync, readdirSync, readFileSync, realpathSync, statSync } from "node:fs";
14
+ import path from "node:path";
15
+ import { fileURLToPath } from "node:url";
16
+
17
+ export const SDK_COMPONENTS = [
18
+ "badge", "button", "card", "checkbox", "dialog", "dropdown-menu",
19
+ "input", "popover", "separator", "skeleton", "tabs", "tooltip",
20
+ ];
21
+
22
+ const UTC_DISPLAY = /\.getUTC(?:FullYear|Month|Date|Day|Hours|Minutes|Seconds)\(|timeZone:\s*["']UTC["']|toISOString\(\)\s*\.\s*(?:slice|substring|substr)\(/;
23
+
24
+ function walk(dir, out = []) {
25
+ if (!existsSync(dir)) return out;
26
+ for (const name of readdirSync(dir)) {
27
+ if (name === "node_modules" || name === "dist" || name.startsWith(".")) continue;
28
+ const p = path.join(dir, name);
29
+ if (statSync(p).isDirectory()) walk(p, out);
30
+ else if (/\.(m?[jt]sx?)$/.test(name) && !/\.test\./.test(name)) out.push(p);
31
+ }
32
+ return out;
33
+ }
34
+
35
+ /** Findings for one app folder: { file, line, rule, message }. */
36
+ export function lintApp(appDir) {
37
+ const findings = [];
38
+ const src = path.join(appDir, "src");
39
+ for (const file of walk(src)) {
40
+ const rel = path.relative(appDir, file);
41
+ const ui = /^src[\\/]components[\\/]ui[\\/]([a-z-]+)\.tsx$/.exec(rel);
42
+ if (ui && SDK_COMPONENTS.includes(ui[1])) {
43
+ const from = ["dropdown-menu", "checkbox"].includes(ui[1]) ? "@makoai/app-sdk/menu" : "@makoai/app-sdk/components";
44
+ findings.push({ file: rel, line: 1, rule: "local-shadcn", message: `the SDK ships ${ui[1]}: import it from "${from}" and delete this copy` });
45
+ }
46
+ readFileSync(file, "utf8")
47
+ .split("\n")
48
+ .forEach((text, i) => {
49
+ if (!UTC_DISPLAY.test(text) || /mako-lint-ignore utc-display/.test(text)) return;
50
+ findings.push({
51
+ file: rel,
52
+ line: i + 1,
53
+ rule: "utc-display",
54
+ message: "UTC in display code: formatTime(instant) for times, formatDate(day) for day buckets, toDayKey(value) for keys",
55
+ });
56
+ });
57
+ }
58
+ return findings;
59
+ }
60
+
61
+ function main(argv) {
62
+ const warn = argv.includes("--warn");
63
+ const dirs = argv.filter(a => !a.startsWith("--"));
64
+ let total = 0;
65
+ for (const dir of dirs.length ? dirs : ["."]) {
66
+ for (const f of lintApp(path.resolve(dir))) {
67
+ total++;
68
+ console.log(`${path.join(dir, f.file)}:${f.line} ${f.rule} ${f.message}`);
69
+ }
70
+ }
71
+ if (total) console.log(`\n${total} finding${total === 1 ? "" : "s"}`);
72
+ return total && !warn ? 1 : 0;
73
+ }
74
+
75
+ // Installed bins run through a symlink (node_modules/.bin, pnpm's .pnpm
76
+ // store); import.meta.url is resolved and argv[1] is not, so compare real paths.
77
+ if (process.argv[1] && realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url))) process.exit(main(process.argv.slice(2)));
@@ -0,0 +1,36 @@
1
+ import { CheckIcon, MinusIcon } from "lucide-react";
2
+ import { Checkbox as CheckboxPrimitive } from "radix-ui";
3
+ import type * as React from "react";
4
+ import { cn } from "./utils";
5
+
6
+ /**
7
+ * shadcn's Checkbox, with the indeterminate state: a white tick when checked,
8
+ * a white dash when indeterminate, both on the brand colour; an empty box
9
+ * when unchecked. The one checkbox style of the app.
10
+ */
11
+ function Checkbox({ className, checked, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
12
+ return (
13
+ <CheckboxPrimitive.Root
14
+ data-slot="checkbox"
15
+ checked={checked}
16
+ className={cn(
17
+ "peer size-4 shrink-0 rounded-[4px] border border-input bg-background shadow-xs outline-none transition-shadow",
18
+ "focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50",
19
+ "data-[state=checked]:border-[var(--brand)] data-[state=checked]:bg-[var(--brand)]",
20
+ "data-[state=indeterminate]:border-[var(--brand)] data-[state=indeterminate]:bg-[var(--brand)]",
21
+ className,
22
+ )}
23
+ {...props}
24
+ >
25
+ <CheckboxPrimitive.Indicator data-slot="checkbox-indicator" className="flex items-center justify-center">
26
+ {checked === "indeterminate" ? (
27
+ <MinusIcon className="size-3.5 text-white" strokeWidth={3} />
28
+ ) : (
29
+ <CheckIcon className="size-3.5 text-white" strokeWidth={3} />
30
+ )}
31
+ </CheckboxPrimitive.Indicator>
32
+ </CheckboxPrimitive.Root>
33
+ );
34
+ }
35
+
36
+ export { Checkbox };
@@ -0,0 +1,205 @@
1
+ import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
2
+ import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
3
+ import type * as React from "react";
4
+ import { cn } from "./utils";
5
+
6
+ function DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
7
+ return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />;
8
+ }
9
+
10
+ function DropdownMenuPortal({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
11
+ return <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />;
12
+ }
13
+
14
+ function DropdownMenuTrigger({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
15
+ return <DropdownMenuPrimitive.Trigger data-slot="dropdown-menu-trigger" {...props} />;
16
+ }
17
+
18
+ function DropdownMenuContent({ className, sideOffset = 4, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
19
+ return (
20
+ <DropdownMenuPrimitive.Portal>
21
+ <DropdownMenuPrimitive.Content
22
+ data-slot="dropdown-menu-content"
23
+ sideOffset={sideOffset}
24
+ className={cn(
25
+ "z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
26
+ className,
27
+ )}
28
+ {...props}
29
+ />
30
+ </DropdownMenuPrimitive.Portal>
31
+ );
32
+ }
33
+
34
+ function DropdownMenuGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
35
+ return <DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />;
36
+ }
37
+
38
+ function DropdownMenuItem({
39
+ className,
40
+ inset,
41
+ variant = "default",
42
+ ...props
43
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
44
+ inset?: boolean;
45
+ variant?: "default" | "destructive";
46
+ }) {
47
+ return (
48
+ <DropdownMenuPrimitive.Item
49
+ data-slot="dropdown-menu-item"
50
+ data-inset={inset}
51
+ data-variant={variant}
52
+ className={cn(
53
+ "relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!",
54
+ className,
55
+ )}
56
+ {...props}
57
+ />
58
+ );
59
+ }
60
+
61
+ function DropdownMenuCheckboxItem({
62
+ className,
63
+ children,
64
+ checked,
65
+ ...props
66
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
67
+ return (
68
+ <DropdownMenuPrimitive.CheckboxItem
69
+ data-slot="dropdown-menu-checkbox-item"
70
+ className={cn(
71
+ "relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
72
+ className,
73
+ )}
74
+ checked={checked}
75
+ {...props}
76
+ >
77
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
78
+ <DropdownMenuPrimitive.ItemIndicator>
79
+ <CheckIcon className="size-4" />
80
+ </DropdownMenuPrimitive.ItemIndicator>
81
+ </span>
82
+ {children}
83
+ </DropdownMenuPrimitive.CheckboxItem>
84
+ );
85
+ }
86
+
87
+ function DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
88
+ return <DropdownMenuPrimitive.RadioGroup data-slot="dropdown-menu-radio-group" {...props} />;
89
+ }
90
+
91
+ function DropdownMenuRadioItem({ className, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
92
+ return (
93
+ <DropdownMenuPrimitive.RadioItem
94
+ data-slot="dropdown-menu-radio-item"
95
+ className={cn(
96
+ "relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
97
+ className,
98
+ )}
99
+ {...props}
100
+ >
101
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
102
+ <DropdownMenuPrimitive.ItemIndicator>
103
+ <CircleIcon className="size-2 fill-current" />
104
+ </DropdownMenuPrimitive.ItemIndicator>
105
+ </span>
106
+ {children}
107
+ </DropdownMenuPrimitive.RadioItem>
108
+ );
109
+ }
110
+
111
+ function DropdownMenuLabel({
112
+ className,
113
+ inset,
114
+ ...props
115
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
116
+ inset?: boolean;
117
+ }) {
118
+ return (
119
+ <DropdownMenuPrimitive.Label
120
+ data-slot="dropdown-menu-label"
121
+ data-inset={inset}
122
+ className={cn("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className)}
123
+ {...props}
124
+ />
125
+ );
126
+ }
127
+
128
+ function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
129
+ return (
130
+ <DropdownMenuPrimitive.Separator
131
+ data-slot="dropdown-menu-separator"
132
+ className={cn("-mx-1 my-1 h-px bg-border", className)}
133
+ {...props}
134
+ />
135
+ );
136
+ }
137
+
138
+ function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"span">) {
139
+ return (
140
+ <span
141
+ data-slot="dropdown-menu-shortcut"
142
+ className={cn("ml-auto text-xs tracking-widest text-muted-foreground", className)}
143
+ {...props}
144
+ />
145
+ );
146
+ }
147
+
148
+ function DropdownMenuSub({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
149
+ return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />;
150
+ }
151
+
152
+ function DropdownMenuSubTrigger({
153
+ className,
154
+ inset,
155
+ children,
156
+ ...props
157
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
158
+ inset?: boolean;
159
+ }) {
160
+ return (
161
+ <DropdownMenuPrimitive.SubTrigger
162
+ data-slot="dropdown-menu-sub-trigger"
163
+ data-inset={inset}
164
+ className={cn(
165
+ "flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
166
+ className,
167
+ )}
168
+ {...props}
169
+ >
170
+ {children}
171
+ <ChevronRightIcon className="ml-auto size-4" />
172
+ </DropdownMenuPrimitive.SubTrigger>
173
+ );
174
+ }
175
+
176
+ function DropdownMenuSubContent({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
177
+ return (
178
+ <DropdownMenuPrimitive.SubContent
179
+ data-slot="dropdown-menu-sub-content"
180
+ className={cn(
181
+ "z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
182
+ className,
183
+ )}
184
+ {...props}
185
+ />
186
+ );
187
+ }
188
+
189
+ export {
190
+ DropdownMenu,
191
+ DropdownMenuCheckboxItem,
192
+ DropdownMenuContent,
193
+ DropdownMenuGroup,
194
+ DropdownMenuItem,
195
+ DropdownMenuLabel,
196
+ DropdownMenuPortal,
197
+ DropdownMenuRadioGroup,
198
+ DropdownMenuRadioItem,
199
+ DropdownMenuSeparator,
200
+ DropdownMenuShortcut,
201
+ DropdownMenuSub,
202
+ DropdownMenuSubContent,
203
+ DropdownMenuSubTrigger,
204
+ DropdownMenuTrigger,
205
+ };