@nocoo/basalt 2.1.8 → 2.2.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.
- package/ai/INTEGRATION.md +64 -28
- package/ai/RECIPES.md +46 -1
- package/ai/USAGE.md +2 -2
- package/ai/registry.json +56 -14
- package/dist/assets/brand-mark.js.map +1 -1
- package/dist/charts/area.js.map +1 -1
- package/dist/charts/bar.js.map +1 -1
- package/dist/charts/bullet.js.map +1 -1
- package/dist/charts/charts.js.map +1 -1
- package/dist/charts/config.js.map +1 -1
- package/dist/charts/custom-chart.js.map +1 -1
- package/dist/charts/date-navigation.js.map +1 -1
- package/dist/charts/donut.js.map +1 -1
- package/dist/charts/frame.js.map +1 -1
- package/dist/charts/funnel.js.map +1 -1
- package/dist/charts/gauge.js.map +1 -1
- package/dist/charts/grouped-bar.js.map +1 -1
- package/dist/charts/heatmap-calendar.js.map +1 -1
- package/dist/charts/heatmap-matrix.js.map +1 -1
- package/dist/charts/item-list.js.map +1 -1
- package/dist/charts/legend.js.map +1 -1
- package/dist/charts/line.js.map +1 -1
- package/dist/charts/palette.js.map +1 -1
- package/dist/charts/radar.js.map +1 -1
- package/dist/charts/sample.js.map +1 -1
- package/dist/charts/sankey.js.map +1 -1
- package/dist/charts/series.js.map +1 -1
- package/dist/charts/slot-bar.js.map +1 -1
- package/dist/charts/sparkline.js.map +1 -1
- package/dist/charts/stacked-bar.js.map +1 -1
- package/dist/charts/stat-card.js.map +1 -1
- package/dist/charts/timeline.js.map +1 -1
- package/dist/charts/timeseries.js.map +1 -1
- package/dist/charts/tooltip.js.map +1 -1
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/app-header.d.ts +5 -1
- package/dist/components/app-header.js +12 -4
- package/dist/components/app-header.js.map +1 -1
- package/dist/components/app-shell.d.ts +4 -1
- package/dist/components/app-shell.js +7 -4
- package/dist/components/app-shell.js.map +1 -1
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.js.map +1 -1
- package/dist/components/banner.js.map +1 -1
- package/dist/components/basalt-mark.js.map +1 -1
- package/dist/components/battery-meter.js.map +1 -1
- package/dist/components/breadcrumbs.js.map +1 -1
- package/dist/components/button.js.map +1 -1
- package/dist/components/chat-bubble.js.map +1 -1
- package/dist/components/chat-composer.js.map +1 -1
- package/dist/components/chat-header.js.map +1 -1
- package/dist/components/chat-inbox.js.map +1 -1
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/clipboard-text.js.map +1 -1
- package/dist/components/code.js.map +1 -1
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/command-palette.js.map +1 -1
- package/dist/components/confirm-dialog.d.ts +4 -1
- package/dist/components/confirm-dialog.js +20 -18
- package/dist/components/confirm-dialog.js.map +1 -1
- package/dist/components/context-menu.js.map +1 -1
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/delete-resource.js.map +1 -1
- package/dist/components/description-list.js.map +1 -1
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dock.js.map +1 -1
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/editable-nav-item.js.map +1 -1
- package/dist/components/empty.js.map +1 -1
- package/dist/components/fab.js.map +1 -1
- package/dist/components/field.js.map +1 -1
- package/dist/components/file-dropzone.js.map +1 -1
- package/dist/components/filter-bar.js.map +1 -1
- package/dist/components/flow.js.map +1 -1
- package/dist/components/grid.js.map +1 -1
- package/dist/components/hover-card.js.map +1 -1
- package/dist/components/icon-picker.js.map +1 -1
- package/dist/components/inline-editable.js.map +1 -1
- package/dist/components/input-area.js.map +1 -1
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/input.js.map +1 -1
- package/dist/components/label.js.map +1 -1
- package/dist/components/layer-card.js.map +1 -1
- package/dist/components/link.js.map +1 -1
- package/dist/components/loader.js.map +1 -1
- package/dist/components/loading-screen.js.map +1 -1
- package/dist/components/menu-bar.js.map +1 -1
- package/dist/components/meter.js.map +1 -1
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/navigation-menu.js.map +1 -1
- package/dist/components/overlay.js.map +1 -1
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/popover.js.map +1 -1
- package/dist/components/radio.js.map +1 -1
- package/dist/components/resource-list.js.map +1 -1
- package/dist/components/responsive-master-detail.js +5 -5
- package/dist/components/responsive-master-detail.js.map +1 -1
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/section-rule.js.map +1 -1
- package/dist/components/segment-control.js.map +1 -1
- package/dist/components/select.js.map +1 -1
- package/dist/components/sensitive-input.js.map +1 -1
- package/dist/components/separator.js.map +1 -1
- package/dist/components/sheet.js +1 -0
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/sidebar.d.ts +3 -1
- package/dist/components/sidebar.js +8 -5
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/skeleton-line.js.map +1 -1
- package/dist/components/slider.js.map +1 -1
- package/dist/components/stat-strip.js.map +1 -1
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table-of-contents.js.map +1 -1
- package/dist/components/table-pager.js.map +1 -1
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tag-badge.js.map +1 -1
- package/dist/components/tag-color-picker.js.map +1 -1
- package/dist/components/text.js.map +1 -1
- package/dist/components/theme-toggle.js.map +1 -1
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/toggle.js.map +1 -1
- package/dist/components/toolbar.js.map +1 -1
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/typeahead-field.js.map +1 -1
- package/dist/components/upload-queue.js.map +1 -1
- package/dist/providers/accent.js +1 -1
- package/dist/providers/accent.js.map +1 -1
- package/dist/providers/link.js.map +1 -1
- package/dist/providers/theme.js +1 -1
- package/dist/providers/theme.js.map +1 -1
- package/dist/styles/base.css +116 -0
- package/dist/styles/standalone.css +124 -3
- package/dist/utils/cn.js.map +1 -1
- package/dist/utils/control-surface.js.map +1 -1
- package/dist/utils/preference-store.js +1 -1
- package/dist/utils/preference-store.js.map +1 -1
- package/dist/utils/selection-indicator.js.map +1 -1
- package/dist/utils/use-checkable-group.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-header.js","names":[],"sources":["../../src/components/chat-header.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { BASALT_UI_CLASS } from \"../utils/control-surface\";\n\nexport interface ChatHeaderProps\n\textends Omit<HTMLAttributes<HTMLElement>, \"title\" | \"children\" | \"className\"> {\n\t/**\n\t * Conversation title.\n\t */\n\ttitle: ReactNode;\n\t/**\n\t * Secondary line under the title.\n\t */\n\tsubtitle?: ReactNode;\n\t/**\n\t * Leading mark, usually an icon.\n\t */\n\tleading?: ReactNode;\n\t/**\n\t * Trailing actions.\n\t */\n\tchildren?: ReactNode;\n\t/**\n\t * Optional class name applied to the header element.\n\t * Component inherits native header HTMLAttributes on the root element but does not forward ref.\n\t */\n\tclassName?: string;\n}\n\nexport function ChatHeader({\n\ttitle,\n\tsubtitle,\n\tleading,\n\tchildren,\n\tclassName,\n\t...props\n}: ChatHeaderProps) {\n\treturn (\n\t\t<header\n\t\t\tclassName={cn(\n\t\t\t\tBASALT_UI_CLASS,\n\t\t\t\t\"flex items-center justify-between gap-2 border-b border-basalt-border/50 px-3 py-2.5\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<div className=\"flex min-w-0 items-center gap-2\">\n\t\t\t\t{leading ? (\n\t\t\t\t\t<span className=\"flex h-8 w-8 items-center justify-center\">{leading}</span>\n\t\t\t\t) : null}\n\t\t\t\t<div className=\"min-w-0\">\n\t\t\t\t\t<p className=\"truncate text-sm font-semibold tracking-tight\">{title}</p>\n\t\t\t\t\t{subtitle ? (\n\t\t\t\t\t\t<p className=\"truncate text-[11px] text-basalt-muted-foreground\">{subtitle}</p>\n\t\t\t\t\t) : null}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{children ? <div className=\"flex items-center gap-1\">{children}</div> : null}\n\t\t</header>\n\t);\n}\n"],"mappings":";;;;;AA6BA,
|
|
1
|
+
{"version":3,"file":"chat-header.js","names":["ChatHeader","props","cn","BASALT_UI_CLASS","className","leading","title","subtitle","children"],"sources":["../../src/components/chat-header.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { BASALT_UI_CLASS } from \"../utils/control-surface\";\n\nexport interface ChatHeaderProps\n\textends Omit<HTMLAttributes<HTMLElement>, \"title\" | \"children\" | \"className\"> {\n\t/**\n\t * Conversation title.\n\t */\n\ttitle: ReactNode;\n\t/**\n\t * Secondary line under the title.\n\t */\n\tsubtitle?: ReactNode;\n\t/**\n\t * Leading mark, usually an icon.\n\t */\n\tleading?: ReactNode;\n\t/**\n\t * Trailing actions.\n\t */\n\tchildren?: ReactNode;\n\t/**\n\t * Optional class name applied to the header element.\n\t * Component inherits native header HTMLAttributes on the root element but does not forward ref.\n\t */\n\tclassName?: string;\n}\n\nexport function ChatHeader({\n\ttitle,\n\tsubtitle,\n\tleading,\n\tchildren,\n\tclassName,\n\t...props\n}: ChatHeaderProps) {\n\treturn (\n\t\t<header\n\t\t\tclassName={cn(\n\t\t\t\tBASALT_UI_CLASS,\n\t\t\t\t\"flex items-center justify-between gap-2 border-b border-basalt-border/50 px-3 py-2.5\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<div className=\"flex min-w-0 items-center gap-2\">\n\t\t\t\t{leading ? (\n\t\t\t\t\t<span className=\"flex h-8 w-8 items-center justify-center\">{leading}</span>\n\t\t\t\t) : null}\n\t\t\t\t<div className=\"min-w-0\">\n\t\t\t\t\t<p className=\"truncate text-sm font-semibold tracking-tight\">{title}</p>\n\t\t\t\t\t{subtitle ? (\n\t\t\t\t\t\t<p className=\"truncate text-[11px] text-basalt-muted-foreground\">{subtitle}</p>\n\t\t\t\t\t) : null}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{children ? <div className=\"flex items-center gap-1\">{children}</div> : null}\n\t\t</header>\n\t);\n}\n"],"mappings":";;;;;AA6BA,SAAgBA,EAAW,EAC1B,UACA,aACA,YACA,aACA,cACA,GAAGC,KACgB;CACnB,OACC,kBAAC,UAAD;EACC,WAAWC,EACVC,GACA,wFACAC,CACD;EACA,GAAIH;EANL,UAAA,CAQC,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACEI,IACA,kBAAC,QAAD;IAAM,WAAU;IAA4C,UAAAA;GAAc,CAAA,IACvE,MACJ,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACC,kBAAC,KAAD;KAAG,WAAU;KAAiD,UAAAC;IAAS,CAAA,GACtEC,IACA,kBAAC,KAAD;KAAG,WAAU;KAAqD,UAAAA;IAAY,CAAA,IAC3E,IACA;GACD,CAAA,CAAA;EACJ,CAAA,GAAAC,IAAW,kBAAC,OAAD;GAAK,WAAU;GAA2B;EAAc,CAAA,IAAI,IACjE;;AAEV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-inbox.js","names":[],"sources":["../../src/components/chat-inbox.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { Button } from \"./button\";\n\nexport interface ChatInboxItem {\n\t/** Stable id for selection. */\n\tid: string;\n\t/** Thread title. */\n\ttitle: string;\n\t/** Last-message preview. */\n\tpreview?: string;\n\t/** Timestamp label. */\n\ttime?: string;\n\t/** Optional leading mark. */\n\tleading?: ReactNode;\n}\n\nexport interface ChatInboxProps\n\textends Omit<HTMLAttributes<HTMLElement>, \"onSelect\" | \"className\"> {\n\t/**\n\t * Threads to list ({ id: string, title: string, preview?: string, time?: string, leading?: ReactNode }[]).\n\t */\n\titems: readonly ChatInboxItem[];\n\t/**\n\t * Selected thread id.\n\t */\n\tactiveId?: string;\n\t/**\n\t * Called when a thread is chosen.\n\t */\n\tonSelect: (id: string) => void;\n\t/**\n\t * Optional class name applied to the navigation element.\n\t * Component inherits native nav HTMLAttributes on the root element but does not forward ref.\n\t */\n\tclassName?: string;\n}\n\nexport function ChatInbox({ items, activeId, onSelect, className, ...props }: ChatInboxProps) {\n\treturn (\n\t\t<nav className={cn(\"flex min-h-0 flex-col gap-0.5 overflow-y-auto p-2\", className)} {...props}>\n\t\t\t{items.map((item) => {\n\t\t\t\tconst active = item.id === activeId;\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={item.id}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\taria-current={active ? \"true\" : undefined}\n\t\t\t\t\t\tonClick={() => onSelect(item.id)}\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\"h-auto w-full justify-start gap-2 rounded-basalt-md px-2 py-2 text-left\",\n\t\t\t\t\t\t\tactive ? \"bg-basalt-accent\" : \"\",\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{item.leading ? (\n\t\t\t\t\t\t\t<span className=\"flex h-8 w-8 shrink-0 items-center justify-center\">\n\t\t\t\t\t\t\t\t{item.leading}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t<span className=\"min-w-0 flex-1\">\n\t\t\t\t\t\t\t<span className=\"flex items-baseline justify-between gap-2\">\n\t\t\t\t\t\t\t\t<span className=\"truncate text-sm font-medium text-basalt-foreground\">\n\t\t\t\t\t\t\t\t\t{item.title}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t{item.time ? (\n\t\t\t\t\t\t\t\t\t<span className=\"shrink-0 text-[11px] text-basalt-muted-foreground\">\n\t\t\t\t\t\t\t\t\t\t{item.time}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t{item.preview ? (\n\t\t\t\t\t\t\t\t<span className=\"mt-0.5 block truncate text-xs text-basalt-muted-foreground\">\n\t\t\t\t\t\t\t\t\t{item.preview}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t})}\n\t\t</nav>\n\t);\n}\n"],"mappings":";;;;;AAsCA,
|
|
1
|
+
{"version":3,"file":"chat-inbox.js","names":["ChatInbox","props","cn","className","items","active","item","activeId","Button","onSelect"],"sources":["../../src/components/chat-inbox.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { Button } from \"./button\";\n\nexport interface ChatInboxItem {\n\t/** Stable id for selection. */\n\tid: string;\n\t/** Thread title. */\n\ttitle: string;\n\t/** Last-message preview. */\n\tpreview?: string;\n\t/** Timestamp label. */\n\ttime?: string;\n\t/** Optional leading mark. */\n\tleading?: ReactNode;\n}\n\nexport interface ChatInboxProps\n\textends Omit<HTMLAttributes<HTMLElement>, \"onSelect\" | \"className\"> {\n\t/**\n\t * Threads to list ({ id: string, title: string, preview?: string, time?: string, leading?: ReactNode }[]).\n\t */\n\titems: readonly ChatInboxItem[];\n\t/**\n\t * Selected thread id.\n\t */\n\tactiveId?: string;\n\t/**\n\t * Called when a thread is chosen.\n\t */\n\tonSelect: (id: string) => void;\n\t/**\n\t * Optional class name applied to the navigation element.\n\t * Component inherits native nav HTMLAttributes on the root element but does not forward ref.\n\t */\n\tclassName?: string;\n}\n\nexport function ChatInbox({ items, activeId, onSelect, className, ...props }: ChatInboxProps) {\n\treturn (\n\t\t<nav className={cn(\"flex min-h-0 flex-col gap-0.5 overflow-y-auto p-2\", className)} {...props}>\n\t\t\t{items.map((item) => {\n\t\t\t\tconst active = item.id === activeId;\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={item.id}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\taria-current={active ? \"true\" : undefined}\n\t\t\t\t\t\tonClick={() => onSelect(item.id)}\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\"h-auto w-full justify-start gap-2 rounded-basalt-md px-2 py-2 text-left\",\n\t\t\t\t\t\t\tactive ? \"bg-basalt-accent\" : \"\",\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{item.leading ? (\n\t\t\t\t\t\t\t<span className=\"flex h-8 w-8 shrink-0 items-center justify-center\">\n\t\t\t\t\t\t\t\t{item.leading}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t<span className=\"min-w-0 flex-1\">\n\t\t\t\t\t\t\t<span className=\"flex items-baseline justify-between gap-2\">\n\t\t\t\t\t\t\t\t<span className=\"truncate text-sm font-medium text-basalt-foreground\">\n\t\t\t\t\t\t\t\t\t{item.title}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t{item.time ? (\n\t\t\t\t\t\t\t\t\t<span className=\"shrink-0 text-[11px] text-basalt-muted-foreground\">\n\t\t\t\t\t\t\t\t\t\t{item.time}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t{item.preview ? (\n\t\t\t\t\t\t\t\t<span className=\"mt-0.5 block truncate text-xs text-basalt-muted-foreground\">\n\t\t\t\t\t\t\t\t\t{item.preview}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t})}\n\t\t</nav>\n\t);\n}\n"],"mappings":";;;;;AAsCA,SAAgBA,EAAU,EAAE,UAAO,aAAU,aAAU,cAAW,GAAGC,KAAyB;CAC7F,OACC,kBAAC,OAAD;EAAK,WAAWC,EAAG,qDAAqDC,CAAS;EAAG,GAAIF;EACtF,UAAAG,EAAM,KAAK,MAAS;GACpB,IAAMC,IAASC,EAAK,OAAOC;GAC3B,OACC,kBAACC,GAAD;IAEC,MAAK;IACL,SAAQ;IACR,gBAAcH,IAAS,SAAS,KAAA;IAChC,eAAeI,EAASH,EAAK,EAAE;IAC/B,WAAWJ,EACV,2EACAG,IAAS,qBAAqB,EAC/B;IATD,UAAA,CAWEC,EAAK,UACL,kBAAC,QAAD;KAAM,WAAU;KACd,UAAAA,EAAK;IACD,CAAA,IACH,MACJ,kBAAC,QAAD;KAAM,WAAU;KAAhB,UAAA,CACC,kBAAC,QAAD;MAAM,WAAU;MAAhB,UAAA,CACC,kBAAC,QAAD;OAAM,WAAU;OACd,UAAAA,EAAK;MACD,CAAA,GACLA,EAAK,OACL,kBAAC,QAAD;OAAM,WAAU;OACd,UAAAA,EAAK;MACD,CAAA,IACH,IACC;KACL,CAAA,GAAAA,EAAK,UACL,kBAAC,QAAD;MAAM,WAAU;MACd,UAAAA,EAAK;KACD,CAAA,IACH,IACC;IACC,CAAA,CAAA;GAhCF,GAAAA,EAAK,EAgCH;EAEV,CAAC;CACG,CAAA;AAEP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","names":[],"sources":["../../src/components/checkbox.tsx"],"sourcesContent":["import * as CheckboxPrimitive from \"@radix-ui/react-checkbox\";\nimport { Check, Minus } from \"lucide-react\";\nimport * as React from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { BASALT_UI_CLASS } from \"../utils/control-surface\";\nimport { useCheckableGroup } from \"../utils/use-checkable-group\";\nimport { FOCUS_RING } from \"./overlay\";\n\nexport type CheckboxSize = \"sm\" | \"default\";\n\nconst CHECKBOX_SIZE_CLASS: Record<CheckboxSize, string> = {\n\tsm: \"h-3 w-3\",\n\tdefault: \"h-4 w-4\",\n};\n\nconst CHECK_ICON_CLASS: Record<CheckboxSize, string> = {\n\tsm: \"hidden h-3 w-3 group-data-[state=checked]:block\",\n\tdefault: \"hidden h-4 w-4 group-data-[state=checked]:block\",\n};\n\nconst MINUS_ICON_CLASS: Record<CheckboxSize, string> = {\n\tsm: \"hidden h-2.5 w-2.5 group-data-[state=indeterminate]:block\",\n\tdefault: \"hidden h-3 w-3 group-data-[state=indeterminate]:block\",\n};\n\ntype CheckboxGroupContextValue = {\n\tvalue: string[];\n\tsetValue: (next: string[]) => void;\n\tdisabled: boolean;\n\tinvalid: boolean;\n};\n\nconst CheckboxGroupContext = React.createContext<CheckboxGroupContextValue | null>(null);\n\nfunction nextCheckboxGroupValue(current: string[], itemValue: string, checked: boolean): string[] {\n\tif (checked) {\n\t\treturn current.includes(itemValue) ? current : [...current, itemValue];\n\t}\n\treturn current.filter((entry) => entry !== itemValue);\n}\n\nexport type CheckboxProps = Omit<\n\tReact.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>,\n\t\"checked\"\n> & {\n\t/**\n\t * The controlled checked state of the checkbox.\n\t */\n\tchecked?: boolean | \"indeterminate\";\n\t/**\n\t * The visual size of the checkbox.\n\t * @default default\n\t */\n\tsize?: CheckboxSize;\n};\n\nexport type CheckboxGroupProps = Omit<\n\tReact.ComponentPropsWithoutRef<\"fieldset\">,\n\t\"onChange\" | \"defaultValue\" | \"disabled\"\n> & {\n\t/**\n\t * The controlled selected values.\n\t */\n\tvalue?: string[];\n\t/**\n\t * The initially selected values.\n\t */\n\tdefaultValue?: string[];\n\t/**\n\t * Called when the selected values change.\n\t */\n\tonValueChange?: (value: string[]) => void;\n\t/**\n\t * Marks the group invalid and shows alert copy.\n\t */\n\terror?: React.ReactNode;\n\t/**\n\t * Disable every item in the group.\n\t * @default false\n\t */\n\tdisabled?: boolean;\n};\n\nexport type CheckboxLegendProps = React.ComponentPropsWithoutRef<\"legend\">;\n\nexport type CheckboxItemProps = Omit<\n\tCheckboxProps,\n\t\"checked\" | \"defaultChecked\" | \"onCheckedChange\" | \"value\"\n> & {\n\t/**\n\t * The value stored in the group when this item is checked.\n\t */\n\tvalue: string;\n};\n\nconst CheckboxRoot = React.forwardRef<\n\tReact.ElementRef<typeof CheckboxPrimitive.Root>,\n\tCheckboxProps\n>(({ className, size = \"default\", ...props }, ref) => (\n\t<CheckboxPrimitive.Root\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\tBASALT_UI_CLASS,\n\t\t\t\"group peer shrink-0 rounded-[4px] border border-basalt-primary data-[state=checked]:bg-basalt-primary data-[state=checked]:text-basalt-primary-foreground data-[state=indeterminate]:bg-basalt-primary data-[state=indeterminate]:text-basalt-primary-foreground disabled:cursor-not-allowed disabled:opacity-50\",\n\t\t\tCHECKBOX_SIZE_CLASS[size],\n\t\t\tFOCUS_RING,\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t<CheckboxPrimitive.Indicator className=\"flex items-center justify-center text-current\">\n\t\t\t<Check className={CHECK_ICON_CLASS[size]} />\n\t\t\t<Minus className={MINUS_ICON_CLASS[size]} />\n\t\t</CheckboxPrimitive.Indicator>\n\t</CheckboxPrimitive.Root>\n));\nCheckboxRoot.displayName = CheckboxPrimitive.Root.displayName;\n\nconst CheckboxGroup = React.forwardRef<HTMLFieldSetElement, CheckboxGroupProps>(\n\t(\n\t\t{\n\t\t\tclassName,\n\t\t\tvalue,\n\t\t\tdefaultValue,\n\t\t\tonValueChange,\n\t\t\terror,\n\t\t\tdisabled = false,\n\t\t\tchildren,\n\t\t\t\"aria-describedby\": describedBy,\n\t\t\t\"aria-invalid\": ariaInvalid,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst group = useCheckableGroup({\n\t\t\tvalue,\n\t\t\tdefaultValue,\n\t\t\tonValueChange,\n\t\t\terror,\n\t\t\tdescribedBy,\n\t\t\tariaInvalid,\n\t\t\tform: props.form,\n\t\t\tref,\n\t\t});\n\t\treturn (\n\t\t\t<CheckboxGroupContext.Provider\n\t\t\t\tvalue={{ value: group.current, setValue: group.setValue, disabled, invalid: group.invalid }}\n\t\t\t>\n\t\t\t\t<fieldset\n\t\t\t\t\tref={group.setRefs}\n\t\t\t\t\t{...props}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\taria-invalid={group.ariaInvalid}\n\t\t\t\t\taria-describedby={group.mergedDescribedBy}\n\t\t\t\t\tclassName={cn(\"flex flex-col gap-2\", className)}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t\t{group.invalid ? (\n\t\t\t\t\t\t<p id={group.errorId} className=\"text-xs text-basalt-destructive\" role=\"alert\">\n\t\t\t\t\t\t\t{error}\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) : null}\n\t\t\t\t</fieldset>\n\t\t\t</CheckboxGroupContext.Provider>\n\t\t);\n\t},\n);\nCheckboxGroup.displayName = \"Checkbox.Group\";\n\nconst CheckboxLegend = React.forwardRef<HTMLLegendElement, CheckboxLegendProps>(\n\t({ className, ...props }, ref) => (\n\t\t<legend\n\t\t\tref={ref}\n\t\t\tclassName={cn(\"text-sm font-medium text-basalt-foreground\", className)}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nCheckboxLegend.displayName = \"Checkbox.Legend\";\n\nconst CheckboxItem = React.forwardRef<\n\tReact.ElementRef<typeof CheckboxPrimitive.Root>,\n\tCheckboxItemProps\n>(({ className, value, children, disabled, size, id, ...props }, ref) => {\n\tconst group = React.useContext(CheckboxGroupContext);\n\tconst grouped = group != null;\n\tconst generatedId = React.useId();\n\tconst controlId = id ?? generatedId;\n\tconst isChecked = grouped ? group.value.includes(value) : undefined;\n\tconst box = (\n\t\t<CheckboxRoot\n\t\t\tref={ref}\n\t\t\t{...props}\n\t\t\tid={controlId}\n\t\t\tvalue={value}\n\t\t\tsize={size}\n\t\t\tchecked={isChecked}\n\t\t\tdefaultChecked={grouped ? isChecked : undefined}\n\t\t\tdisabled={disabled || group?.disabled}\n\t\t\taria-invalid={group?.invalid || undefined}\n\t\t\tclassName={className}\n\t\t\tonCheckedChange={(next) => {\n\t\t\t\tif (grouped && typeof next === \"boolean\") {\n\t\t\t\t\tgroup.setValue(nextCheckboxGroupValue(group.value, value, next));\n\t\t\t\t}\n\t\t\t}}\n\t\t/>\n\t);\n\tif (children == null) {\n\t\treturn box;\n\t}\n\treturn (\n\t\t<label htmlFor={controlId} className=\"flex items-center gap-2 text-sm text-basalt-foreground\">\n\t\t\t{box}\n\t\t\t{children}\n\t\t</label>\n\t);\n});\nCheckboxItem.displayName = \"Checkbox.Item\";\n\nexport const Checkbox = Object.assign(CheckboxRoot, {\n\tGroup: CheckboxGroup,\n\tLegend: CheckboxLegend,\n\tItem: CheckboxItem,\n});\n"],"mappings":";;;;;;;;;;AAUA,
|
|
1
|
+
{"version":3,"file":"checkbox.js","names":["React","CheckboxPrimitive","CHECKBOX_SIZE_CLASS","CHECK_ICON_CLASS","MINUS_ICON_CLASS","CheckboxGroupContext","nextCheckboxGroupValue","checked","current","itemValue","entry","CheckboxRoot","props","cn","BASALT_UI_CLASS","size","FOCUS_RING","className","Check","Minus","CheckboxGroup","describedBy","ariaInvalid","group","useCheckableGroup","children","error","CheckboxLegend","CheckboxItem","grouped","generatedId","controlId","id","isChecked","value","box","disabled","next","Checkbox"],"sources":["../../src/components/checkbox.tsx"],"sourcesContent":["import * as CheckboxPrimitive from \"@radix-ui/react-checkbox\";\nimport { Check, Minus } from \"lucide-react\";\nimport * as React from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { BASALT_UI_CLASS } from \"../utils/control-surface\";\nimport { useCheckableGroup } from \"../utils/use-checkable-group\";\nimport { FOCUS_RING } from \"./overlay\";\n\nexport type CheckboxSize = \"sm\" | \"default\";\n\nconst CHECKBOX_SIZE_CLASS: Record<CheckboxSize, string> = {\n\tsm: \"h-3 w-3\",\n\tdefault: \"h-4 w-4\",\n};\n\nconst CHECK_ICON_CLASS: Record<CheckboxSize, string> = {\n\tsm: \"hidden h-3 w-3 group-data-[state=checked]:block\",\n\tdefault: \"hidden h-4 w-4 group-data-[state=checked]:block\",\n};\n\nconst MINUS_ICON_CLASS: Record<CheckboxSize, string> = {\n\tsm: \"hidden h-2.5 w-2.5 group-data-[state=indeterminate]:block\",\n\tdefault: \"hidden h-3 w-3 group-data-[state=indeterminate]:block\",\n};\n\ntype CheckboxGroupContextValue = {\n\tvalue: string[];\n\tsetValue: (next: string[]) => void;\n\tdisabled: boolean;\n\tinvalid: boolean;\n};\n\nconst CheckboxGroupContext = React.createContext<CheckboxGroupContextValue | null>(null);\n\nfunction nextCheckboxGroupValue(current: string[], itemValue: string, checked: boolean): string[] {\n\tif (checked) {\n\t\treturn current.includes(itemValue) ? current : [...current, itemValue];\n\t}\n\treturn current.filter((entry) => entry !== itemValue);\n}\n\nexport type CheckboxProps = Omit<\n\tReact.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>,\n\t\"checked\"\n> & {\n\t/**\n\t * The controlled checked state of the checkbox.\n\t */\n\tchecked?: boolean | \"indeterminate\";\n\t/**\n\t * The visual size of the checkbox.\n\t * @default default\n\t */\n\tsize?: CheckboxSize;\n};\n\nexport type CheckboxGroupProps = Omit<\n\tReact.ComponentPropsWithoutRef<\"fieldset\">,\n\t\"onChange\" | \"defaultValue\" | \"disabled\"\n> & {\n\t/**\n\t * The controlled selected values.\n\t */\n\tvalue?: string[];\n\t/**\n\t * The initially selected values.\n\t */\n\tdefaultValue?: string[];\n\t/**\n\t * Called when the selected values change.\n\t */\n\tonValueChange?: (value: string[]) => void;\n\t/**\n\t * Marks the group invalid and shows alert copy.\n\t */\n\terror?: React.ReactNode;\n\t/**\n\t * Disable every item in the group.\n\t * @default false\n\t */\n\tdisabled?: boolean;\n};\n\nexport type CheckboxLegendProps = React.ComponentPropsWithoutRef<\"legend\">;\n\nexport type CheckboxItemProps = Omit<\n\tCheckboxProps,\n\t\"checked\" | \"defaultChecked\" | \"onCheckedChange\" | \"value\"\n> & {\n\t/**\n\t * The value stored in the group when this item is checked.\n\t */\n\tvalue: string;\n};\n\nconst CheckboxRoot = React.forwardRef<\n\tReact.ElementRef<typeof CheckboxPrimitive.Root>,\n\tCheckboxProps\n>(({ className, size = \"default\", ...props }, ref) => (\n\t<CheckboxPrimitive.Root\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\tBASALT_UI_CLASS,\n\t\t\t\"group peer shrink-0 rounded-[4px] border border-basalt-primary data-[state=checked]:bg-basalt-primary data-[state=checked]:text-basalt-primary-foreground data-[state=indeterminate]:bg-basalt-primary data-[state=indeterminate]:text-basalt-primary-foreground disabled:cursor-not-allowed disabled:opacity-50\",\n\t\t\tCHECKBOX_SIZE_CLASS[size],\n\t\t\tFOCUS_RING,\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t<CheckboxPrimitive.Indicator className=\"flex items-center justify-center text-current\">\n\t\t\t<Check className={CHECK_ICON_CLASS[size]} />\n\t\t\t<Minus className={MINUS_ICON_CLASS[size]} />\n\t\t</CheckboxPrimitive.Indicator>\n\t</CheckboxPrimitive.Root>\n));\nCheckboxRoot.displayName = CheckboxPrimitive.Root.displayName;\n\nconst CheckboxGroup = React.forwardRef<HTMLFieldSetElement, CheckboxGroupProps>(\n\t(\n\t\t{\n\t\t\tclassName,\n\t\t\tvalue,\n\t\t\tdefaultValue,\n\t\t\tonValueChange,\n\t\t\terror,\n\t\t\tdisabled = false,\n\t\t\tchildren,\n\t\t\t\"aria-describedby\": describedBy,\n\t\t\t\"aria-invalid\": ariaInvalid,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst group = useCheckableGroup({\n\t\t\tvalue,\n\t\t\tdefaultValue,\n\t\t\tonValueChange,\n\t\t\terror,\n\t\t\tdescribedBy,\n\t\t\tariaInvalid,\n\t\t\tform: props.form,\n\t\t\tref,\n\t\t});\n\t\treturn (\n\t\t\t<CheckboxGroupContext.Provider\n\t\t\t\tvalue={{ value: group.current, setValue: group.setValue, disabled, invalid: group.invalid }}\n\t\t\t>\n\t\t\t\t<fieldset\n\t\t\t\t\tref={group.setRefs}\n\t\t\t\t\t{...props}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\taria-invalid={group.ariaInvalid}\n\t\t\t\t\taria-describedby={group.mergedDescribedBy}\n\t\t\t\t\tclassName={cn(\"flex flex-col gap-2\", className)}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t\t{group.invalid ? (\n\t\t\t\t\t\t<p id={group.errorId} className=\"text-xs text-basalt-destructive\" role=\"alert\">\n\t\t\t\t\t\t\t{error}\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) : null}\n\t\t\t\t</fieldset>\n\t\t\t</CheckboxGroupContext.Provider>\n\t\t);\n\t},\n);\nCheckboxGroup.displayName = \"Checkbox.Group\";\n\nconst CheckboxLegend = React.forwardRef<HTMLLegendElement, CheckboxLegendProps>(\n\t({ className, ...props }, ref) => (\n\t\t<legend\n\t\t\tref={ref}\n\t\t\tclassName={cn(\"text-sm font-medium text-basalt-foreground\", className)}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nCheckboxLegend.displayName = \"Checkbox.Legend\";\n\nconst CheckboxItem = React.forwardRef<\n\tReact.ElementRef<typeof CheckboxPrimitive.Root>,\n\tCheckboxItemProps\n>(({ className, value, children, disabled, size, id, ...props }, ref) => {\n\tconst group = React.useContext(CheckboxGroupContext);\n\tconst grouped = group != null;\n\tconst generatedId = React.useId();\n\tconst controlId = id ?? generatedId;\n\tconst isChecked = grouped ? group.value.includes(value) : undefined;\n\tconst box = (\n\t\t<CheckboxRoot\n\t\t\tref={ref}\n\t\t\t{...props}\n\t\t\tid={controlId}\n\t\t\tvalue={value}\n\t\t\tsize={size}\n\t\t\tchecked={isChecked}\n\t\t\tdefaultChecked={grouped ? isChecked : undefined}\n\t\t\tdisabled={disabled || group?.disabled}\n\t\t\taria-invalid={group?.invalid || undefined}\n\t\t\tclassName={className}\n\t\t\tonCheckedChange={(next) => {\n\t\t\t\tif (grouped && typeof next === \"boolean\") {\n\t\t\t\t\tgroup.setValue(nextCheckboxGroupValue(group.value, value, next));\n\t\t\t\t}\n\t\t\t}}\n\t\t/>\n\t);\n\tif (children == null) {\n\t\treturn box;\n\t}\n\treturn (\n\t\t<label htmlFor={controlId} className=\"flex items-center gap-2 text-sm text-basalt-foreground\">\n\t\t\t{box}\n\t\t\t{children}\n\t\t</label>\n\t);\n});\nCheckboxItem.displayName = \"Checkbox.Item\";\n\nexport const Checkbox = Object.assign(CheckboxRoot, {\n\tGroup: CheckboxGroup,\n\tLegend: CheckboxLegend,\n\tItem: CheckboxItem,\n});\n"],"mappings":";;;;;;;;;;AAUA,IAAME,IAAoD;CACzD,IAAI;CACJ,SAAS;AACV,GAEMC,IAAiD;CACtD,IAAI;CACJ,SAAS;AACV,GAEMC,IAAiD;CACtD,IAAI;CACJ,SAAS;AACV,GASMC,IAAuBL,EAAM,cAAgD,IAAI;AAEvF,SAASM,EAAuB,GAAmB,GAAmB,GAA4B;CAIjG,OAHIC,IACIC,EAAQ,SAASC,CAAS,IAAID,IAAU,CAAC,GAAGA,GAASC,CAAS,IAE/DD,EAAQ,QAAQ,MAAUE,MAAUD,CAAS;AACrD;AAwDA,IAAME,IAAeX,EAAM,YAGxB,EAAE,cAAW,UAAO,WAAW,GAAGY,KAAS,MAC7C,kBAACX,EAAkB,MAAnB;CACM;CACL,WAAWY,EACVC,GACA,oTACAZ,EAAoBa,IACpBC,GACAC,CACD;CACA,GAAIL;CAEJ,UAAA,kBAACX,EAAkB,WAAnB;EAA6B,WAAU;EAAvC,UAAA,CACC,kBAACiB,GAAD,EAAO,WAAWf,EAAiBY,GAAQ,CAAA,GAC3C,kBAACI,GAAD,EAAO,WAAWf,EAAiBW,GAAQ,CAAA,CACf;;AACN,CAAA,CACxB;AACD,EAAa,cAAcd,EAAkB,KAAK;AAElD,IAAMmB,IAAgBpB,EAAM,YAE1B,EACC,cACA,UACA,iBACA,kBACA,UACA,cAAW,IACX,aACA,oBAAoBqB,GACpB,gBAAgBC,GAChB,GAAGV,KAEJ,MACI;CACJ,IAAMW,IAAQC,EAAkB;EAC/B;EACA;EACA;EACA;EACA;EACA;EACA,MAAMZ,EAAM;EACZ;CACD,CAAC;CACD,OACC,kBAACP,EAAqB,UAAtB;EACC,OAAO;GAAE,OAAOkB,EAAM;GAAS,UAAUA,EAAM;GAAU;GAAU,SAASA,EAAM;EAAQ;EAE1F,UAAA,kBAAC,YAAD;GACC,KAAKA,EAAM;GACX,GAAIX;GACM;GACV,gBAAcW,EAAM;GACpB,oBAAkBA,EAAM;GACxB,WAAWV,EAAG,uBAAuBI,CAAS;GAN/C,UAAA,CAQEQ,GACAF,EAAM,UACN,kBAAC,KAAD;IAAG,IAAIA,EAAM;IAAS,WAAU;IAAkC,MAAK;IACrE,UAAAG;GACC,CAAA,IACA,IACK;;CACoB,CAAA;AAEjC,CACD;AACA,EAAc,cAAc;AAE5B,IAAMC,IAAiB3B,EAAM,YAC3B,EAAE,cAAW,GAAGY,KAAS,MACzB,kBAAC,UAAD;CACM;CACL,WAAWC,EAAG,8CAA8CI,CAAS;CACrE,GAAIL;AACJ,CAAA,CAEH;AACA,EAAe,cAAc;AAE7B,IAAMgB,IAAe5B,EAAM,YAGxB,EAAE,cAAW,UAAO,aAAU,aAAU,SAAM,OAAI,GAAGY,KAAS,MAAQ;CACxE,IAAMW,IAAQvB,EAAM,WAAWK,CAAoB,GAC7CwB,IAAUN,KAAS,MACnBO,IAAc9B,EAAM,MAAM,GAC1B+B,IAAYC,KAAMF,GAClBG,IAAYJ,IAAUN,EAAM,MAAM,SAASW,CAAK,IAAI,KAAA,GACpDC,IACL,kBAACxB,GAAD;EACM;EACL,GAAIC;EACJ,IAAImB;EACG;EACD;EACN,SAASE;EACT,gBAAgBJ,IAAUI,IAAY,KAAA;EACtC,UAAUG,KAAYb,GAAO;EAC7B,gBAAcA,GAAO,WAAW,KAAA;EACrB;EACX,kBAAkB,MAAS;GAC1B,AAAIM,KAAW,OAAOQ,KAAS,aAC9Bd,EAAM,SAASjB,EAAuBiB,EAAM,OAAOW,GAAOG,CAAI,CAAC;EAEjE;CACA,CAAA;CAKF,OAHIZ,KAAY,OACRU,IAGP,kBAAC,SAAD;EAAO,SAASJ;EAAW,WAAU;EAArC,UAAA,CACEI,GACAV,CACK;;AAET,CAAC;AACD,EAAa,cAAc;AAE3B,IAAaa,IAAW,OAAO,OAAO3B,GAAc;CACnD,OAAOS;CACP,QAAQO;CACR,MAAMC;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard-text.js","names":[],"sources":["../../src/components/clipboard-text.tsx"],"sourcesContent":["import { Check, Copy } from \"lucide-react\";\nimport { useState } from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { controlSurfaceClass } from \"../utils/control-surface\";\nimport { Button } from \"./button\";\n\nexport interface ClipboardTextProps {\n\t/**\n\t * Text string displayed in the inline code block and default text copied to the clipboard.\n\t */\n\ttext: string;\n\t/**\n\t * Optional alternate text string written to clipboard instead of `text`.\n\t * @default text\n\t */\n\tcopyText?: string;\n\t/**\n\t * Additional CSS classes applied to the root container.\n\t */\n\tclassName?: string;\n}\n\nexport function ClipboardText({ text, copyText, className }: ClipboardTextProps) {\n\tconst [copied, setCopied] = useState(false);\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"clipboard-text\"\n\t\t\tclassName={controlSurfaceClass(\n\t\t\t\tcn(\"inline-flex h-9 max-w-full items-stretch shadow-xs\", className),\n\t\t\t)}\n\t\t>\n\t\t\t<code className=\"flex h-full min-w-0 items-center truncate rounded-l-basalt-md bg-transparent px-4 font-mono text-sm text-basalt-foreground\">\n\t\t\t\t{text}\n\t\t\t</code>\n\t\t\t<Button\n\t\t\t\ttype=\"button\"\n\t\t\t\tsize=\"icon\"\n\t\t\t\tvariant=\"ghost\"\n\t\t\t\taria-label=\"Copy\"\n\t\t\t\tclassName=\"h-full min-h-0 w-9 shrink-0 rounded-none rounded-r-basalt-md border-0 border-l border-basalt-border shadow-none\"\n\t\t\t\tonClick={async () => {\n\t\t\t\t\tawait navigator.clipboard.writeText(copyText ?? text);\n\t\t\t\t\tsetCopied(true);\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{copied ? <Check /> : <Copy />}\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAsBA,
|
|
1
|
+
{"version":3,"file":"clipboard-text.js","names":["ClipboardText","copied","setCopied","useState","controlSurfaceClass","cn","className","text","Button","copyText","jsx","Check","Copy"],"sources":["../../src/components/clipboard-text.tsx"],"sourcesContent":["import { Check, Copy } from \"lucide-react\";\nimport { useState } from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { controlSurfaceClass } from \"../utils/control-surface\";\nimport { Button } from \"./button\";\n\nexport interface ClipboardTextProps {\n\t/**\n\t * Text string displayed in the inline code block and default text copied to the clipboard.\n\t */\n\ttext: string;\n\t/**\n\t * Optional alternate text string written to clipboard instead of `text`.\n\t * @default text\n\t */\n\tcopyText?: string;\n\t/**\n\t * Additional CSS classes applied to the root container.\n\t */\n\tclassName?: string;\n}\n\nexport function ClipboardText({ text, copyText, className }: ClipboardTextProps) {\n\tconst [copied, setCopied] = useState(false);\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"clipboard-text\"\n\t\t\tclassName={controlSurfaceClass(\n\t\t\t\tcn(\"inline-flex h-9 max-w-full items-stretch shadow-xs\", className),\n\t\t\t)}\n\t\t>\n\t\t\t<code className=\"flex h-full min-w-0 items-center truncate rounded-l-basalt-md bg-transparent px-4 font-mono text-sm text-basalt-foreground\">\n\t\t\t\t{text}\n\t\t\t</code>\n\t\t\t<Button\n\t\t\t\ttype=\"button\"\n\t\t\t\tsize=\"icon\"\n\t\t\t\tvariant=\"ghost\"\n\t\t\t\taria-label=\"Copy\"\n\t\t\t\tclassName=\"h-full min-h-0 w-9 shrink-0 rounded-none rounded-r-basalt-md border-0 border-l border-basalt-border shadow-none\"\n\t\t\t\tonClick={async () => {\n\t\t\t\t\tawait navigator.clipboard.writeText(copyText ?? text);\n\t\t\t\t\tsetCopied(true);\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{copied ? <Check /> : <Copy />}\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAsBA,SAAgBA,EAAc,EAAE,SAAM,aAAU,gBAAiC;CAChF,IAAM,CAACC,GAAQC,KAAaC,EAAS,EAAK;CAC1C,OACC,kBAAC,OAAD;EACC,aAAU;EACV,WAAWC,EACVC,EAAG,sDAAsDC,CAAS,CACnE;EAJD,UAAA,CAMC,kBAAC,QAAD;GAAM,WAAU;GACd,UAAAC;EACI,CAAA,GACN,kBAACC,GAAD;GACC,MAAK;GACL,MAAK;GACL,SAAQ;GACR,cAAW;GACX,WAAU;GACV,SAAS,YAAY;IAEpB,AADA,MAAM,UAAU,UAAU,UAAUC,KAAYF,CAAI,GACpDL,EAAU,EAAI;GACf;GAEC,UAASQ,EAATT,IAAUU,IAAYC,GAAb,CAAQ,CAAW;EACtB,CAAA,CACJ;;AAEP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.js","names":[],"sources":["../../src/components/code.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { controlSurfaceClass } from \"../utils/control-surface\";\n\nconst TOKEN =\n\t/(\\/\\/[^\\n]*)|(\"[^\"]*\"|'[^']*'|`[^`]*`)|\\b(import|from|export|default|async|await|function|return|const|let|var|type|interface|as|if|else|throw|new|typeof)\\b|(\\b\\d+\\b)|(<\\/?[A-Za-z][\\w.-]*)/g;\n\nfunction highlight(code: string): ReactNode[] {\n\tconst nodes: ReactNode[] = [];\n\tlet last = 0;\n\tlet key = 0;\n\tfor (const match of code.matchAll(TOKEN)) {\n\t\tconst index = match.index ?? 0;\n\t\tif (index > last) {\n\t\t\tnodes.push(code.slice(last, index));\n\t\t}\n\t\tconst className = match[1]\n\t\t\t? \"text-basalt-muted-foreground\"\n\t\t\t: match[2]\n\t\t\t\t? \"text-basalt-chart-5\"\n\t\t\t\t: match[4]\n\t\t\t\t\t? \"text-basalt-chart-4\"\n\t\t\t\t\t: \"text-basalt-primary\";\n\t\tnodes.push(\n\t\t\t<span key={key} className={className}>\n\t\t\t\t{match[0]}\n\t\t\t</span>,\n\t\t);\n\t\tkey += 1;\n\t\tlast = index + match[0].length;\n\t}\n\tif (last < code.length) {\n\t\tnodes.push(code.slice(last));\n\t}\n\treturn nodes;\n}\n\nexport type CodeProps = {\n\t/**\n\t * Additional classes for the inline code.\n\t */\n\tclassName?: string;\n};\n\nexport function Code({ className, ...props }: CodeProps & HTMLAttributes<HTMLElement>) {\n\treturn (\n\t\t<code\n\t\t\tclassName={cn(\n\t\t\t\t\"rounded-basalt-sm bg-basalt-secondary px-1.5 py-0.5 font-mono text-[13px] text-basalt-foreground\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport type CodeBlockProps = {\n\t/**\n\t * Additional classes for the block.\n\t */\n\tclassName?: string;\n};\n\nexport function CodeBlock({\n\tclassName,\n\t...props\n}: CodeBlockProps & HTMLAttributes<HTMLPreElement>) {\n\treturn (\n\t\t<pre\n\t\t\tclassName={controlSurfaceClass(\n\t\t\t\tcn(\"overflow-x-auto p-4 font-mono text-basalt-foreground\", className),\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport type CodeHighlightedProps = {\n\t/**\n\t * Source text to highlight.\n\t */\n\tcode: string;\n\t/**\n\t * Additional classes for the block.\n\t */\n\tclassName?: string;\n};\n\nexport function CodeHighlighted({\n\tcode,\n\tclassName,\n\t...props\n}: CodeHighlightedProps & HTMLAttributes<HTMLPreElement>) {\n\treturn (\n\t\t<pre\n\t\t\tclassName={controlSurfaceClass(cn(\"overflow-x-auto p-4 text-basalt-foreground\", className))}\n\t\t\t{...props}\n\t\t>\n\t\t\t<code className=\"font-mono leading-6\">{highlight(code)}</code>\n\t\t</pre>\n\t);\n}\n"],"mappings":";;;;;AAIA,
|
|
1
|
+
{"version":3,"file":"code.js","names":["TOKEN","highlight","nodes","last","key","match","code","index","className","Code","props","cn","CodeBlock","controlSurfaceClass","CodeHighlighted"],"sources":["../../src/components/code.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { controlSurfaceClass } from \"../utils/control-surface\";\n\nconst TOKEN =\n\t/(\\/\\/[^\\n]*)|(\"[^\"]*\"|'[^']*'|`[^`]*`)|\\b(import|from|export|default|async|await|function|return|const|let|var|type|interface|as|if|else|throw|new|typeof)\\b|(\\b\\d+\\b)|(<\\/?[A-Za-z][\\w.-]*)/g;\n\nfunction highlight(code: string): ReactNode[] {\n\tconst nodes: ReactNode[] = [];\n\tlet last = 0;\n\tlet key = 0;\n\tfor (const match of code.matchAll(TOKEN)) {\n\t\tconst index = match.index ?? 0;\n\t\tif (index > last) {\n\t\t\tnodes.push(code.slice(last, index));\n\t\t}\n\t\tconst className = match[1]\n\t\t\t? \"text-basalt-muted-foreground\"\n\t\t\t: match[2]\n\t\t\t\t? \"text-basalt-chart-5\"\n\t\t\t\t: match[4]\n\t\t\t\t\t? \"text-basalt-chart-4\"\n\t\t\t\t\t: \"text-basalt-primary\";\n\t\tnodes.push(\n\t\t\t<span key={key} className={className}>\n\t\t\t\t{match[0]}\n\t\t\t</span>,\n\t\t);\n\t\tkey += 1;\n\t\tlast = index + match[0].length;\n\t}\n\tif (last < code.length) {\n\t\tnodes.push(code.slice(last));\n\t}\n\treturn nodes;\n}\n\nexport type CodeProps = {\n\t/**\n\t * Additional classes for the inline code.\n\t */\n\tclassName?: string;\n};\n\nexport function Code({ className, ...props }: CodeProps & HTMLAttributes<HTMLElement>) {\n\treturn (\n\t\t<code\n\t\t\tclassName={cn(\n\t\t\t\t\"rounded-basalt-sm bg-basalt-secondary px-1.5 py-0.5 font-mono text-[13px] text-basalt-foreground\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport type CodeBlockProps = {\n\t/**\n\t * Additional classes for the block.\n\t */\n\tclassName?: string;\n};\n\nexport function CodeBlock({\n\tclassName,\n\t...props\n}: CodeBlockProps & HTMLAttributes<HTMLPreElement>) {\n\treturn (\n\t\t<pre\n\t\t\tclassName={controlSurfaceClass(\n\t\t\t\tcn(\"overflow-x-auto p-4 font-mono text-basalt-foreground\", className),\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport type CodeHighlightedProps = {\n\t/**\n\t * Source text to highlight.\n\t */\n\tcode: string;\n\t/**\n\t * Additional classes for the block.\n\t */\n\tclassName?: string;\n};\n\nexport function CodeHighlighted({\n\tcode,\n\tclassName,\n\t...props\n}: CodeHighlightedProps & HTMLAttributes<HTMLPreElement>) {\n\treturn (\n\t\t<pre\n\t\t\tclassName={controlSurfaceClass(cn(\"overflow-x-auto p-4 text-basalt-foreground\", className))}\n\t\t\t{...props}\n\t\t>\n\t\t\t<code className=\"font-mono leading-6\">{highlight(code)}</code>\n\t\t</pre>\n\t);\n}\n"],"mappings":";;;;;AAIA,IAAMA,IACL;AAED,SAASC,EAAU,GAA2B;CAC7C,IAAMC,IAAqB,CAAC,GACxBC,IAAO,GACPC,IAAM;CACV,KAAK,IAAMC,KAASC,EAAK,SAASN,CAAK,GAAG;EACzC,IAAMO,IAAQF,EAAM,SAAS;EAC7B,AAAIE,IAAQJ,KACXD,EAAM,KAAKI,EAAK,MAAMH,GAAMI,CAAK,CAAC;EAEnC,IAAMC,IAAYH,EAAM,KACrB,iCACAA,EAAM,KACL,wBACAA,EAAM,KACL,wBACA;EAOL,AANAH,EAAM,KACL,kBAAC,QAAD;GAA2B;GACzB,UAAAG,EAAM;EACF,GAFKD,CAEL,CACP,GACA,KAAO,GACP,IAAOG,IAAQF,EAAM,EAAE,CAAC;CACzB;CAIA,OAHIF,IAAOG,EAAK,UACfJ,EAAM,KAAKI,EAAK,MAAMH,CAAI,CAAC,GAErBD;AACR;AASA,SAAgBO,EAAK,EAAE,cAAW,GAAGC,KAAkD;CACtF,OACC,kBAAC,QAAD;EACC,WAAWC,EACV,oGACAH,CACD;EACA,GAAIE;CACJ,CAAA;AAEH;AASA,SAAgBE,EAAU,EACzB,cACA,GAAGF,KACgD;CACnD,OACC,kBAAC,OAAD;EACC,WAAWG,EACVF,EAAG,wDAAwDH,CAAS,CACrE;EACA,GAAIE;CACJ,CAAA;AAEH;AAaA,SAAgBI,EAAgB,EAC/B,SACA,cACA,GAAGJ,KACsD;CACzD,OACC,kBAAC,OAAD;EACC,WAAWG,EAAoBF,EAAG,8CAA8CH,CAAS,CAAC;EAC1F,GAAIE;EAEJ,UAAA,kBAAC,QAAD;GAAM,WAAU;GAAuB,UAAAT,EAAUK,CAAI;EAAQ,CAAA;CACzD,CAAA;AAEP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapsible.js","names":[],"sources":["../../src/components/collapsible.tsx"],"sourcesContent":["import * as CollapsiblePrimitive from \"@radix-ui/react-collapsible\";\nimport { ChevronDown } from \"lucide-react\";\nimport * as React from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { FOCUS_INSET, OVERLAY_MOTION } from \"./overlay\";\n\ntype RadixCollapsibleProps = React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Root>;\ntype RadixCollapsibleTriggerProps = React.ComponentPropsWithoutRef<\n\ttypeof CollapsiblePrimitive.CollapsibleTrigger\n>;\ntype RadixCollapsibleContentProps = React.ComponentPropsWithoutRef<\n\ttypeof CollapsiblePrimitive.CollapsibleContent\n>;\n\nexport interface CollapsibleProps\n\textends Omit<\n\t\tRadixCollapsibleProps,\n\t\t\"open\" | \"defaultOpen\" | \"onOpenChange\" | \"disabled\" | \"asChild\" | \"children\"\n\t> {\n\t/**\n\t * Collapsible structure elements, typically CollapsibleTrigger and CollapsibleContent.\n\t */\n\tchildren?: React.ReactNode;\n\t/**\n\t * The controlled open state of the collapsible.\n\t */\n\topen?: RadixCollapsibleProps[\"open\"];\n\t/**\n\t * The uncontrolled initial open state of the collapsible.\n\t * @default false\n\t */\n\tdefaultOpen?: RadixCollapsibleProps[\"defaultOpen\"];\n\t/**\n\t * Called when the open state changes.\n\t */\n\tonOpenChange?: RadixCollapsibleProps[\"onOpenChange\"];\n\t/**\n\t * When true, prevents the user from interacting with the collapsible.\n\t * @default false\n\t */\n\tdisabled?: RadixCollapsibleProps[\"disabled\"];\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * Note: Collapsible root is typed as React.FC and does not declare ref in its public Props;\n\t * forwards rest props and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixCollapsibleProps[\"asChild\"];\n}\n\nexport const Collapsible: React.FC<CollapsibleProps> = CollapsiblePrimitive.Root;\n\nexport interface CollapsibleTriggerProps\n\textends Omit<RadixCollapsibleTriggerProps, \"asChild\" | \"children\"> {\n\t/**\n\t * Content of the trigger button. When asChild is false, automatically renders\n\t * a text container span alongside an animated ChevronDown icon.\n\t */\n\tchildren?: React.ReactNode;\n\t/**\n\t * Change the default rendered button element to the child element, merging props and behavior.\n\t * When true, bypasses the default text span and ChevronDown icon wrapping.\n\t * CollapsibleTrigger forwards ref to HTMLButtonElement and inherits native button attributes.\n\t * @default false\n\t */\n\tasChild?: RadixCollapsibleTriggerProps[\"asChild\"];\n}\n\nexport const CollapsibleTrigger = React.forwardRef<\n\tReact.ElementRef<typeof CollapsiblePrimitive.CollapsibleTrigger>,\n\tCollapsibleTriggerProps\n>(({ className, children, asChild = false, ...props }, ref) => {\n\tif (asChild) {\n\t\treturn (\n\t\t\t<CollapsiblePrimitive.CollapsibleTrigger ref={ref} asChild className={className} {...props}>\n\t\t\t\t{children}\n\t\t\t</CollapsiblePrimitive.CollapsibleTrigger>\n\t\t);\n\t}\n\treturn (\n\t\t<CollapsiblePrimitive.CollapsibleTrigger\n\t\t\tref={ref}\n\t\t\tclassName={cn(\n\t\t\t\t\"m-0 inline-flex cursor-pointer items-center gap-1 border-none bg-transparent p-0 text-sm font-medium text-basalt-foreground shadow-none select-none\",\n\t\t\t\tFOCUS_INSET,\n\t\t\t\t\"[&_svg]:size-3 [&_svg]:shrink-0 [&_svg]:origin-center [&_svg]:transition-transform [&_svg]:duration-100 [&_svg]:ease-out\",\n\t\t\t\t\"data-[state=open]:[&_svg]:rotate-180\",\n\t\t\t\tOVERLAY_MOTION,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<span>{children}</span>\n\t\t\t<ChevronDown aria-hidden=\"true\" className={OVERLAY_MOTION} />\n\t\t</CollapsiblePrimitive.CollapsibleTrigger>\n\t);\n});\nCollapsibleTrigger.displayName = CollapsiblePrimitive.CollapsibleTrigger.displayName;\n\nexport interface CollapsibleContentProps\n\textends Omit<RadixCollapsibleContentProps, \"unstyled\" | \"forceMount\" | \"asChild\"> {\n\t/**\n\t * Render children without the default inset border container.\n\t * Note: When unstyled is false (default), children are wrapped in an inner inset border div.\n\t * When combined with asChild, asChild slots onto that inner div unless unstyled={true} is set.\n\t * @default false\n\t */\n\tunstyled?: boolean;\n\t/**\n\t * Used to force mounting when more control is needed. Useful when\n\t * controlling animation with React animation libraries.\n\t */\n\tforceMount?: RadixCollapsibleContentProps[\"forceMount\"];\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * Note: When unstyled is false, asChild operates within the inner inset div wrapper;\n\t * set unstyled={true} to slot directly onto the child element as the content/ref target.\n\t * CollapsibleContent forwards ref to HTMLDivElement and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixCollapsibleContentProps[\"asChild\"];\n}\n\nexport const CollapsibleContent = React.forwardRef<\n\tReact.ElementRef<typeof CollapsiblePrimitive.CollapsibleContent>,\n\tCollapsibleContentProps\n>(({ className, children, unstyled = false, ...props }, ref) => (\n\t<CollapsiblePrimitive.CollapsibleContent\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"overflow-hidden data-[state=closed]:animate-basalt-collapsible-up data-[state=open]:animate-basalt-collapsible-down\",\n\t\t\tOVERLAY_MOTION,\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t{unstyled ? (\n\t\t\tchildren\n\t\t) : (\n\t\t\t<div className=\"my-2 border-l-2 border-basalt-border py-1 pr-1 pl-4 text-sm text-basalt-foreground\">\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t)}\n\t</CollapsiblePrimitive.CollapsibleContent>\n));\nCollapsibleContent.displayName = CollapsiblePrimitive.CollapsibleContent.displayName;\n"],"mappings":";;;;;;;;AAkDA,
|
|
1
|
+
{"version":3,"file":"collapsible.js","names":["React","CollapsiblePrimitive","Collapsible","CollapsibleTrigger","props","asChild","cn","FOCUS_INSET","OVERLAY_MOTION","className","ChevronDown","CollapsibleContent","unstyled","children"],"sources":["../../src/components/collapsible.tsx"],"sourcesContent":["import * as CollapsiblePrimitive from \"@radix-ui/react-collapsible\";\nimport { ChevronDown } from \"lucide-react\";\nimport * as React from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { FOCUS_INSET, OVERLAY_MOTION } from \"./overlay\";\n\ntype RadixCollapsibleProps = React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Root>;\ntype RadixCollapsibleTriggerProps = React.ComponentPropsWithoutRef<\n\ttypeof CollapsiblePrimitive.CollapsibleTrigger\n>;\ntype RadixCollapsibleContentProps = React.ComponentPropsWithoutRef<\n\ttypeof CollapsiblePrimitive.CollapsibleContent\n>;\n\nexport interface CollapsibleProps\n\textends Omit<\n\t\tRadixCollapsibleProps,\n\t\t\"open\" | \"defaultOpen\" | \"onOpenChange\" | \"disabled\" | \"asChild\" | \"children\"\n\t> {\n\t/**\n\t * Collapsible structure elements, typically CollapsibleTrigger and CollapsibleContent.\n\t */\n\tchildren?: React.ReactNode;\n\t/**\n\t * The controlled open state of the collapsible.\n\t */\n\topen?: RadixCollapsibleProps[\"open\"];\n\t/**\n\t * The uncontrolled initial open state of the collapsible.\n\t * @default false\n\t */\n\tdefaultOpen?: RadixCollapsibleProps[\"defaultOpen\"];\n\t/**\n\t * Called when the open state changes.\n\t */\n\tonOpenChange?: RadixCollapsibleProps[\"onOpenChange\"];\n\t/**\n\t * When true, prevents the user from interacting with the collapsible.\n\t * @default false\n\t */\n\tdisabled?: RadixCollapsibleProps[\"disabled\"];\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * Note: Collapsible root is typed as React.FC and does not declare ref in its public Props;\n\t * forwards rest props and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixCollapsibleProps[\"asChild\"];\n}\n\nexport const Collapsible: React.FC<CollapsibleProps> = CollapsiblePrimitive.Root;\n\nexport interface CollapsibleTriggerProps\n\textends Omit<RadixCollapsibleTriggerProps, \"asChild\" | \"children\"> {\n\t/**\n\t * Content of the trigger button. When asChild is false, automatically renders\n\t * a text container span alongside an animated ChevronDown icon.\n\t */\n\tchildren?: React.ReactNode;\n\t/**\n\t * Change the default rendered button element to the child element, merging props and behavior.\n\t * When true, bypasses the default text span and ChevronDown icon wrapping.\n\t * CollapsibleTrigger forwards ref to HTMLButtonElement and inherits native button attributes.\n\t * @default false\n\t */\n\tasChild?: RadixCollapsibleTriggerProps[\"asChild\"];\n}\n\nexport const CollapsibleTrigger = React.forwardRef<\n\tReact.ElementRef<typeof CollapsiblePrimitive.CollapsibleTrigger>,\n\tCollapsibleTriggerProps\n>(({ className, children, asChild = false, ...props }, ref) => {\n\tif (asChild) {\n\t\treturn (\n\t\t\t<CollapsiblePrimitive.CollapsibleTrigger ref={ref} asChild className={className} {...props}>\n\t\t\t\t{children}\n\t\t\t</CollapsiblePrimitive.CollapsibleTrigger>\n\t\t);\n\t}\n\treturn (\n\t\t<CollapsiblePrimitive.CollapsibleTrigger\n\t\t\tref={ref}\n\t\t\tclassName={cn(\n\t\t\t\t\"m-0 inline-flex cursor-pointer items-center gap-1 border-none bg-transparent p-0 text-sm font-medium text-basalt-foreground shadow-none select-none\",\n\t\t\t\tFOCUS_INSET,\n\t\t\t\t\"[&_svg]:size-3 [&_svg]:shrink-0 [&_svg]:origin-center [&_svg]:transition-transform [&_svg]:duration-100 [&_svg]:ease-out\",\n\t\t\t\t\"data-[state=open]:[&_svg]:rotate-180\",\n\t\t\t\tOVERLAY_MOTION,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<span>{children}</span>\n\t\t\t<ChevronDown aria-hidden=\"true\" className={OVERLAY_MOTION} />\n\t\t</CollapsiblePrimitive.CollapsibleTrigger>\n\t);\n});\nCollapsibleTrigger.displayName = CollapsiblePrimitive.CollapsibleTrigger.displayName;\n\nexport interface CollapsibleContentProps\n\textends Omit<RadixCollapsibleContentProps, \"unstyled\" | \"forceMount\" | \"asChild\"> {\n\t/**\n\t * Render children without the default inset border container.\n\t * Note: When unstyled is false (default), children are wrapped in an inner inset border div.\n\t * When combined with asChild, asChild slots onto that inner div unless unstyled={true} is set.\n\t * @default false\n\t */\n\tunstyled?: boolean;\n\t/**\n\t * Used to force mounting when more control is needed. Useful when\n\t * controlling animation with React animation libraries.\n\t */\n\tforceMount?: RadixCollapsibleContentProps[\"forceMount\"];\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * Note: When unstyled is false, asChild operates within the inner inset div wrapper;\n\t * set unstyled={true} to slot directly onto the child element as the content/ref target.\n\t * CollapsibleContent forwards ref to HTMLDivElement and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixCollapsibleContentProps[\"asChild\"];\n}\n\nexport const CollapsibleContent = React.forwardRef<\n\tReact.ElementRef<typeof CollapsiblePrimitive.CollapsibleContent>,\n\tCollapsibleContentProps\n>(({ className, children, unstyled = false, ...props }, ref) => (\n\t<CollapsiblePrimitive.CollapsibleContent\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"overflow-hidden data-[state=closed]:animate-basalt-collapsible-up data-[state=open]:animate-basalt-collapsible-down\",\n\t\t\tOVERLAY_MOTION,\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t{unstyled ? (\n\t\t\tchildren\n\t\t) : (\n\t\t\t<div className=\"my-2 border-l-2 border-basalt-border py-1 pr-1 pl-4 text-sm text-basalt-foreground\">\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t)}\n\t</CollapsiblePrimitive.CollapsibleContent>\n));\nCollapsibleContent.displayName = CollapsiblePrimitive.CollapsibleContent.displayName;\n"],"mappings":";;;;;;;;AAkDA,IAAaE,IAA0CD,EAAqB,MAkB/DE,IAAqBH,EAAM,YAGrC,EAAE,cAAW,aAAU,aAAU,IAAO,GAAGI,KAAS,MAClDC,IAEF,kBAACJ,EAAqB,oBAAtB;CAA8C;CAAK,SAAA;CAAmB;CAAW,GAAIG;CACnF;AACuC,CAAA,IAI1C,kBAACH,EAAqB,oBAAtB;CACM;CACL,WAAWK,EACV,uJACAC,GACA,4HACA,wCACAC,GACAC,CACD;CACA,GAAIL;CAVL,UAAA,CAYC,kBAAC,QAAD,EAAO,YAAe,CAAA,GACtB,kBAACM,GAAD;EAAa,eAAY;EAAO,WAAWF;CAAiB,CAAA,CACpB;EAE1C;AACD,EAAmB,cAAcP,EAAqB,mBAAmB;AA0BzE,IAAaU,IAAqBX,EAAM,YAGrC,EAAE,cAAW,aAAU,cAAW,IAAO,GAAGI,KAAS,MACvD,kBAACH,EAAqB,oBAAtB;CACM;CACL,WAAWK,EACV,uHACAE,GACAC,CACD;CACA,GAAIL;CAEH,UAAAQ,IACAC,IAEA,kBAAC,OAAD;EAAK,WAAU;EACb;CACG,CAAA;AAEkC,CAAA,CACzC;AACD,EAAmB,cAAcZ,EAAqB,mBAAmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.js","names":[],"sources":["../../src/components/combobox.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef } from \"react\";\nimport type { InputSize } from \"./input\";\nimport { TypeaheadField, type TypeaheadItem } from \"./typeahead-field\";\n\nexport type ComboboxItem = TypeaheadItem;\n\nexport type ComboboxProps = Omit<\n\tComponentPropsWithoutRef<\"div\">,\n\t\"children\" | \"defaultValue\" | \"onChange\"\n> & {\n\t/**\n\t * Options shown in the list. Selection must match one of these values.\n\t */\n\titems: ComboboxItem[];\n\t/**\n\t * The controlled selected value.\n\t */\n\tvalue?: string;\n\t/**\n\t * The uncontrolled initial value.\n\t */\n\tdefaultValue?: string;\n\t/**\n\t * Called when the selected value changes.\n\t */\n\tonValueChange?: (value: string) => void;\n\t/**\n\t * Native form field name.\n\t */\n\tname?: string;\n\t/**\n\t * Placeholder shown when the field is empty.\n\t * @default Select…\n\t */\n\tplaceholder?: string;\n\t/**\n\t * Disable the field.\n\t * @default false\n\t */\n\tdisabled?: boolean;\n\t/**\n\t * Disable the field and mark it busy.\n\t * @default false\n\t */\n\tloading?: boolean;\n\t/**\n\t * The visual size of the field.\n\t * @default default\n\t */\n\tsize?: InputSize;\n};\n\nexport function Combobox({ placeholder = \"Select…\", ...rest }: ComboboxProps) {\n\treturn <TypeaheadField placeholder={placeholder} allowFreeform={false} {...rest} />;\n}\n"],"mappings":";;;;AAoDA,
|
|
1
|
+
{"version":3,"file":"combobox.js","names":["Combobox","rest","TypeaheadField"],"sources":["../../src/components/combobox.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef } from \"react\";\nimport type { InputSize } from \"./input\";\nimport { TypeaheadField, type TypeaheadItem } from \"./typeahead-field\";\n\nexport type ComboboxItem = TypeaheadItem;\n\nexport type ComboboxProps = Omit<\n\tComponentPropsWithoutRef<\"div\">,\n\t\"children\" | \"defaultValue\" | \"onChange\"\n> & {\n\t/**\n\t * Options shown in the list. Selection must match one of these values.\n\t */\n\titems: ComboboxItem[];\n\t/**\n\t * The controlled selected value.\n\t */\n\tvalue?: string;\n\t/**\n\t * The uncontrolled initial value.\n\t */\n\tdefaultValue?: string;\n\t/**\n\t * Called when the selected value changes.\n\t */\n\tonValueChange?: (value: string) => void;\n\t/**\n\t * Native form field name.\n\t */\n\tname?: string;\n\t/**\n\t * Placeholder shown when the field is empty.\n\t * @default Select…\n\t */\n\tplaceholder?: string;\n\t/**\n\t * Disable the field.\n\t * @default false\n\t */\n\tdisabled?: boolean;\n\t/**\n\t * Disable the field and mark it busy.\n\t * @default false\n\t */\n\tloading?: boolean;\n\t/**\n\t * The visual size of the field.\n\t * @default default\n\t */\n\tsize?: InputSize;\n};\n\nexport function Combobox({ placeholder = \"Select…\", ...rest }: ComboboxProps) {\n\treturn <TypeaheadField placeholder={placeholder} allowFreeform={false} {...rest} />;\n}\n"],"mappings":";;;;AAoDA,SAAgBA,EAAS,EAAE,iBAAc,WAAW,GAAGC,KAAuB;CAC7E,OAAO,kBAACC,GAAD;EAA6B;EAAa,eAAe;EAAO,GAAID;CAAO,CAAA;AACnF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-palette.js","names":[],"sources":["../../src/components/command-palette.tsx"],"sourcesContent":["import type * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport type { DialogProps } from \"@radix-ui/react-dialog\";\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport { Search } from \"lucide-react\";\nimport * as React from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { Dialog, DialogContent, DialogTitle, DialogTrigger } from \"./dialog\";\n\nconst Command = React.forwardRef<\n\tReact.ElementRef<typeof CommandPrimitive>,\n\tReact.ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(({ className, ...props }, ref) => (\n\t<CommandPrimitive\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"flex h-full w-full flex-col overflow-hidden rounded-basalt-md bg-basalt-popover text-basalt-popover-foreground\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nCommand.displayName = CommandPrimitive.displayName;\n\nexport interface CommandPaletteProps\n\textends Omit<DialogProps, \"open\" | \"defaultOpen\" | \"onOpenChange\" | \"children\" | \"modal\"> {\n\t/**\n\t * Command palette structure elements, including CommandPaletteTrigger and inner command items.\n\t * Note: Triggers must be direct children of CommandPalette (child.type === CommandPaletteTrigger)\n\t * to be separated from modal dialog content. Wrapping triggers in Fragments or HOCs will cause\n\t * them to be treated as modal content.\n\t */\n\tchildren?: React.ReactNode;\n\t/**\n\t * The controlled open state of the command palette dialog.\n\t */\n\topen?: boolean;\n\t/**\n\t * The uncontrolled initial open state of the command palette dialog.\n\t * @default false\n\t */\n\tdefaultOpen?: boolean;\n\t/**\n\t * Called when the open state changes.\n\t */\n\tonOpenChange?: (open: boolean) => void;\n\t/**\n\t * Filter items as the query changes.\n\t * @default true\n\t */\n\tshouldFilter?: boolean;\n\t/**\n\t * The modality of the dialog. When set to true, interaction with outside elements\n\t * will be disabled and only dialog content will be visible to screen readers.\n\t * @default true\n\t */\n\tmodal?: boolean;\n}\n\ntype RadixDialogTriggerProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;\n\nexport interface CommandPaletteTriggerProps extends Omit<RadixDialogTriggerProps, \"asChild\"> {\n\t/**\n\t * Change the default rendered button element to the child element, merging props and behavior.\n\t * CommandPaletteTrigger is an alias for DialogTrigger; forwards ref to HTMLButtonElement and inherits native button attributes.\n\t * @default false\n\t */\n\tasChild?: RadixDialogTriggerProps[\"asChild\"];\n}\n\nexport const CommandPaletteTrigger = DialogTrigger;\n\nexport function CommandPalette({ children, shouldFilter, ...props }: CommandPaletteProps) {\n\tconst kids = React.Children.toArray(children);\n\tconst triggers = kids.filter(\n\t\t(child) => React.isValidElement(child) && child.type === CommandPaletteTrigger,\n\t);\n\tconst content = kids.filter(\n\t\t(child) => !(React.isValidElement(child) && child.type === CommandPaletteTrigger),\n\t);\n\treturn (\n\t\t<Dialog {...props}>\n\t\t\t{triggers}\n\t\t\t<DialogContent\n\t\t\t\tsize=\"lg\"\n\t\t\t\taria-describedby={undefined}\n\t\t\t\tclassName=\"overflow-hidden bg-basalt-popover p-0 shadow-lg\"\n\t\t\t>\n\t\t\t\t<DialogTitle className=\"sr-only\">Command Palette</DialogTitle>\n\t\t\t\t<Command\n\t\t\t\t\tlabel=\"Command Palette\"\n\t\t\t\t\t{...(shouldFilter !== undefined && { shouldFilter })}\n\t\t\t\t\tclassName=\"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-basalt-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5\"\n\t\t\t\t>\n\t\t\t\t\t{content}\n\t\t\t\t</Command>\n\t\t\t</DialogContent>\n\t\t</Dialog>\n\t);\n}\n\ntype RadixCommandInputProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>;\n\nexport interface CommandInputProps\n\textends Omit<RadixCommandInputProps, \"value\" | \"onValueChange\" | \"asChild\"> {\n\t/**\n\t * Optional controlled state for the search input value.\n\t * Note: Underlying cmdk input excludes standard onChange/type props in favor of value/onValueChange.\n\t */\n\tvalue?: RadixCommandInputProps[\"value\"];\n\t/**\n\t * Event handler called when the search value changes.\n\t */\n\tonValueChange?: RadixCommandInputProps[\"onValueChange\"];\n\t/**\n\t * Change the default rendered input element to the child element, merging props and behavior.\n\t * CommandInput forwards ref to HTMLInputElement and inherits native input attributes (excluding onChange/type).\n\t * Note: When aria-label is omitted, defaults to placeholder if string, or \"Command Palette\".\n\t * @default false\n\t */\n\tasChild?: RadixCommandInputProps[\"asChild\"];\n}\n\nexport const CommandInput = React.forwardRef<\n\tReact.ElementRef<typeof CommandPrimitive.Input>,\n\tCommandInputProps\n>(({ className, ...props }, ref) => (\n\t<div className=\"flex items-center border-b border-basalt-border px-3\" cmdk-input-wrapper=\"\">\n\t\t<Search className=\"mr-2 size-4 shrink-0 opacity-50\" aria-hidden=\"true\" />\n\t\t<CommandPrimitive.Input\n\t\t\tref={ref}\n\t\t\tclassName={cn(\n\t\t\t\t\"flex h-11 w-full rounded-basalt-md bg-transparent py-3 text-sm outline-hidden ring-0 shadow-none placeholder:text-basalt-muted-foreground disabled:cursor-not-allowed disabled:opacity-50\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t\taria-label={\n\t\t\t\tprops[\"aria-label\"] ??\n\t\t\t\t(typeof props.placeholder === \"string\" ? props.placeholder : \"Command Palette\")\n\t\t\t}\n\t\t/>\n\t</div>\n));\nCommandInput.displayName = CommandPrimitive.Input.displayName;\n\ntype RadixCommandListProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>;\n\nexport interface CommandListProps extends Omit<RadixCommandListProps, \"label\" | \"asChild\"> {\n\t/**\n\t * Accessible label for this list of suggestions. Not shown visibly.\n\t * @default \"Suggestions\"\n\t */\n\tlabel?: RadixCommandListProps[\"label\"];\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * CommandList forwards ref to HTMLDivElement and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixCommandListProps[\"asChild\"];\n}\n\nexport const CommandList = React.forwardRef<\n\tReact.ElementRef<typeof CommandPrimitive.List>,\n\tCommandListProps\n>(({ className, ...props }, ref) => (\n\t<CommandPrimitive.List\n\t\tref={ref}\n\t\tclassName={cn(\"max-h-[300px] overflow-y-auto overflow-x-hidden\", className)}\n\t\t{...props}\n\t/>\n));\nCommandList.displayName = CommandPrimitive.List.displayName;\n\ntype RadixCommandEmptyProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>;\n\nexport interface CommandEmptyProps extends Omit<RadixCommandEmptyProps, \"asChild\"> {\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * CommandEmpty forwards ref to HTMLDivElement and inherits native div attributes.\n\t * Note: cmdk Empty does not support forceMount.\n\t * @default false\n\t */\n\tasChild?: RadixCommandEmptyProps[\"asChild\"];\n}\n\nexport const CommandEmpty = React.forwardRef<\n\tReact.ElementRef<typeof CommandPrimitive.Empty>,\n\tCommandEmptyProps\n>((props, ref) => (\n\t<CommandPrimitive.Empty\n\t\tref={ref}\n\t\tclassName=\"py-6 text-center text-sm text-basalt-muted-foreground\"\n\t\t{...props}\n\t/>\n));\nCommandEmpty.displayName = CommandPrimitive.Empty.displayName;\n\ntype RadixCommandGroupProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>;\n\nexport interface CommandGroupProps\n\textends Omit<RadixCommandGroupProps, \"heading\" | \"value\" | \"forceMount\" | \"asChild\"> {\n\t/**\n\t * Heading to render for this group of command items.\n\t */\n\theading?: RadixCommandGroupProps[\"heading\"];\n\t/**\n\t * Unique value identifying this group. If no heading is provided, value must be specified.\n\t */\n\tvalue?: RadixCommandGroupProps[\"value\"];\n\t/**\n\t * Whether this group is forcibly rendered regardless of filtering state.\n\t */\n\tforceMount?: RadixCommandGroupProps[\"forceMount\"];\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * CommandGroup forwards ref to HTMLDivElement and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixCommandGroupProps[\"asChild\"];\n}\n\nexport const CommandGroup = React.forwardRef<\n\tReact.ElementRef<typeof CommandPrimitive.Group>,\n\tCommandGroupProps\n>(({ className, ...props }, ref) => (\n\t<CommandPrimitive.Group\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"overflow-hidden p-1 text-basalt-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-basalt-muted-foreground\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nCommandGroup.displayName = CommandPrimitive.Group.displayName;\n\ntype RadixCommandSeparatorProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>;\n\nexport interface CommandSeparatorProps\n\textends Omit<RadixCommandSeparatorProps, \"alwaysRender\" | \"asChild\"> {\n\t/**\n\t * Whether this separator should always be rendered. Useful when automatic filtering is disabled.\n\t * When false (default), visible only when the search query is empty.\n\t */\n\talwaysRender?: RadixCommandSeparatorProps[\"alwaysRender\"];\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * CommandSeparator forwards ref to HTMLDivElement and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixCommandSeparatorProps[\"asChild\"];\n}\n\nexport const CommandSeparator = React.forwardRef<\n\tReact.ElementRef<typeof CommandPrimitive.Separator>,\n\tCommandSeparatorProps\n>(({ className, ...props }, ref) => (\n\t<CommandPrimitive.Separator\n\t\tref={ref}\n\t\tclassName={cn(\"-mx-1 h-px bg-basalt-border\", className)}\n\t\t{...props}\n\t/>\n));\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName;\n\ntype RadixCommandItemProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>;\n\nexport interface CommandItemProps\n\textends Omit<\n\t\tRadixCommandItemProps,\n\t\t\"disabled\" | \"onSelect\" | \"value\" | \"keywords\" | \"forceMount\" | \"asChild\"\n\t> {\n\t/**\n\t * Whether this item is currently disabled from selection.\n\t * @default false\n\t */\n\tdisabled?: RadixCommandItemProps[\"disabled\"];\n\t/**\n\t * Event handler called when this item is selected via click or keyboard.\n\t * Note: cmdk passes the item's resolved value string `(value: string) => void`,\n\t * not a standard DOM SelectEvent.\n\t */\n\tonSelect?: RadixCommandItemProps[\"onSelect\"];\n\t/**\n\t * Unique value identifying this item during filtering and selection.\n\t * Inferred from children/textContent if omitted.\n\t */\n\tvalue?: RadixCommandItemProps[\"value\"];\n\t/**\n\t * Optional additional keywords matched during filtering.\n\t */\n\tkeywords?: RadixCommandItemProps[\"keywords\"];\n\t/**\n\t * Whether this item is forcibly rendered regardless of query filtering.\n\t * Inherits forceMount from parent CommandGroup when omitted.\n\t */\n\tforceMount?: RadixCommandItemProps[\"forceMount\"];\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * CommandItem forwards ref to HTMLDivElement and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixCommandItemProps[\"asChild\"];\n}\n\nexport const CommandItem = React.forwardRef<\n\tReact.ElementRef<typeof CommandPrimitive.Item>,\n\tCommandItemProps\n>(({ className, ...props }, ref) => (\n\t<CommandPrimitive.Item\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"relative flex cursor-default items-center rounded-basalt-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-basalt-accent data-[selected=true]:text-basalt-accent-foreground data-[disabled=true]:opacity-50\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nCommandItem.displayName = CommandPrimitive.Item.displayName;\n\nexport interface CommandShortcutProps extends React.HTMLAttributes<HTMLSpanElement> {}\n\nexport function CommandShortcut({ className, ...props }: CommandShortcutProps) {\n\treturn (\n\t\t<span\n\t\t\tclassName={cn(\"ml-auto text-xs tracking-widest text-basalt-muted-foreground\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\nCommandShortcut.displayName = \"CommandShortcut\";\n"],"mappings":";;;;;;;;AAQA,IAAM,IAAU,EAAM,YAGnB,EAAE,cAAW,GAAG,KAAS,MAC3B,kBAAC,GAAD;CACM;CACL,WAAW,EACV,kHACA,CACD;CACA,GAAI;AACJ,CAAA,CACD;AACD,EAAQ,cAAc,EAAiB;AAgDvC,IAAa,IAAwB;AAErC,SAAgB,EAAe,EAAE,aAAU,iBAAc,GAAG,KAA8B;CACzF,IAAM,IAAO,EAAM,SAAS,QAAQ,CAAQ,GACtC,IAAW,EAAK,QACpB,MAAU,EAAM,eAAe,CAAK,KAAK,EAAM,SAAS,CAC1D,GACM,IAAU,EAAK,QACnB,MAAU,EAAE,EAAM,eAAe,CAAK,KAAK,EAAM,SAAS,EAC5D;CACA,OACC,kBAAC,GAAD;EAAQ,GAAI;EAAZ,UAAA,CACE,GACD,kBAAC,GAAD;GACC,MAAK;GACL,oBAAkB,KAAA;GAClB,WAAU;GAHX,UAAA,CAKC,kBAAC,GAAD;IAAa,WAAU;IAAU,UAAA;GAA4B,CAAA,GAC7D,kBAAC,GAAD;IACC,OAAM;IACN,GAAK,MAAiB,KAAA,KAAa,EAAE,gBAAa;IAClD,WAAU;IAET,UAAA;GACO,CAAA,CACK;EACR,CAAA,CAAA;;AAEV;AAwBA,IAAa,IAAe,EAAM,YAG/B,EAAE,cAAW,GAAG,KAAS,MAC3B,kBAAC,OAAD;CAAK,WAAU;CAAuD,sBAAmB;CAAzF,UAAA,CACC,kBAAC,GAAD;EAAQ,WAAU;EAAkC,eAAY;CAAQ,CAAA,GACxE,kBAAC,EAAiB,OAAlB;EACM;EACL,WAAW,EACV,6LACA,CACD;EACA,GAAI;EACJ,cACC,EAAM,kBACL,OAAO,EAAM,eAAgB,WAAW,EAAM,cAAc;CAE9D,CAAA,CACG;AACL,CAAA,CAAA;AACD,EAAa,cAAc,EAAiB,MAAM;AAkBlD,IAAa,IAAc,EAAM,YAG9B,EAAE,cAAW,GAAG,KAAS,MAC3B,kBAAC,EAAiB,MAAlB;CACM;CACL,WAAW,EAAG,mDAAmD,CAAS;CAC1E,GAAI;AACJ,CAAA,CACD;AACD,EAAY,cAAc,EAAiB,KAAK;AAchD,IAAa,IAAe,EAAM,YAG/B,GAAO,MACT,kBAAC,EAAiB,OAAlB;CACM;CACL,WAAU;CACV,GAAI;AACJ,CAAA,CACD;AACD,EAAa,cAAc,EAAiB,MAAM;AA0BlD,IAAa,IAAe,EAAM,YAG/B,EAAE,cAAW,GAAG,KAAS,MAC3B,kBAAC,EAAiB,OAAlB;CACM;CACL,WAAW,EACV,wOACA,CACD;CACA,GAAI;AACJ,CAAA,CACD;AACD,EAAa,cAAc,EAAiB,MAAM;AAmBlD,IAAa,IAAmB,EAAM,YAGnC,EAAE,cAAW,GAAG,KAAS,MAC3B,kBAAC,EAAiB,WAAlB;CACM;CACL,WAAW,EAAG,+BAA+B,CAAS;CACtD,GAAI;AACJ,CAAA,CACD;AACD,EAAiB,cAAc,EAAiB,UAAU;AA0C1D,IAAa,IAAc,EAAM,YAG9B,EAAE,cAAW,GAAG,KAAS,MAC3B,kBAAC,EAAiB,MAAlB;CACM;CACL,WAAW,EACV,gRACA,CACD;CACA,GAAI;AACJ,CAAA,CACD;AACD,EAAY,cAAc,EAAiB,KAAK;AAIhD,SAAgB,EAAgB,EAAE,cAAW,GAAG,KAA+B;CAC9E,OACC,kBAAC,QAAD;EACC,WAAW,EAAG,gEAAgE,CAAS;EACvF,GAAI;CACJ,CAAA;AAEH;AACA,EAAgB,cAAc"}
|
|
1
|
+
{"version":3,"file":"command-palette.js","names":["Command","CommandPrimitive","React","Command$1","props","Command","cn","className","CommandPaletteTrigger","DialogTrigger","CommandPalette","kids","children","triggers","child","content","Dialog","DialogContent","DialogTitle","shouldFilter","CommandInput","Search","CommandList","CommandEmpty","CommandGroup","CommandSeparator","CommandItem","CommandShortcut"],"sources":["../../src/components/command-palette.tsx"],"sourcesContent":["import type * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport type { DialogProps } from \"@radix-ui/react-dialog\";\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport { Search } from \"lucide-react\";\nimport * as React from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { Dialog, DialogContent, DialogTitle, DialogTrigger } from \"./dialog\";\n\nconst Command = React.forwardRef<\n\tReact.ElementRef<typeof CommandPrimitive>,\n\tReact.ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(({ className, ...props }, ref) => (\n\t<CommandPrimitive\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"flex h-full w-full flex-col overflow-hidden rounded-basalt-md bg-basalt-popover text-basalt-popover-foreground\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nCommand.displayName = CommandPrimitive.displayName;\n\nexport interface CommandPaletteProps\n\textends Omit<DialogProps, \"open\" | \"defaultOpen\" | \"onOpenChange\" | \"children\" | \"modal\"> {\n\t/**\n\t * Command palette structure elements, including CommandPaletteTrigger and inner command items.\n\t * Note: Triggers must be direct children of CommandPalette (child.type === CommandPaletteTrigger)\n\t * to be separated from modal dialog content. Wrapping triggers in Fragments or HOCs will cause\n\t * them to be treated as modal content.\n\t */\n\tchildren?: React.ReactNode;\n\t/**\n\t * The controlled open state of the command palette dialog.\n\t */\n\topen?: boolean;\n\t/**\n\t * The uncontrolled initial open state of the command palette dialog.\n\t * @default false\n\t */\n\tdefaultOpen?: boolean;\n\t/**\n\t * Called when the open state changes.\n\t */\n\tonOpenChange?: (open: boolean) => void;\n\t/**\n\t * Filter items as the query changes.\n\t * @default true\n\t */\n\tshouldFilter?: boolean;\n\t/**\n\t * The modality of the dialog. When set to true, interaction with outside elements\n\t * will be disabled and only dialog content will be visible to screen readers.\n\t * @default true\n\t */\n\tmodal?: boolean;\n}\n\ntype RadixDialogTriggerProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;\n\nexport interface CommandPaletteTriggerProps extends Omit<RadixDialogTriggerProps, \"asChild\"> {\n\t/**\n\t * Change the default rendered button element to the child element, merging props and behavior.\n\t * CommandPaletteTrigger is an alias for DialogTrigger; forwards ref to HTMLButtonElement and inherits native button attributes.\n\t * @default false\n\t */\n\tasChild?: RadixDialogTriggerProps[\"asChild\"];\n}\n\nexport const CommandPaletteTrigger = DialogTrigger;\n\nexport function CommandPalette({ children, shouldFilter, ...props }: CommandPaletteProps) {\n\tconst kids = React.Children.toArray(children);\n\tconst triggers = kids.filter(\n\t\t(child) => React.isValidElement(child) && child.type === CommandPaletteTrigger,\n\t);\n\tconst content = kids.filter(\n\t\t(child) => !(React.isValidElement(child) && child.type === CommandPaletteTrigger),\n\t);\n\treturn (\n\t\t<Dialog {...props}>\n\t\t\t{triggers}\n\t\t\t<DialogContent\n\t\t\t\tsize=\"lg\"\n\t\t\t\taria-describedby={undefined}\n\t\t\t\tclassName=\"overflow-hidden bg-basalt-popover p-0 shadow-lg\"\n\t\t\t>\n\t\t\t\t<DialogTitle className=\"sr-only\">Command Palette</DialogTitle>\n\t\t\t\t<Command\n\t\t\t\t\tlabel=\"Command Palette\"\n\t\t\t\t\t{...(shouldFilter !== undefined && { shouldFilter })}\n\t\t\t\t\tclassName=\"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-basalt-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5\"\n\t\t\t\t>\n\t\t\t\t\t{content}\n\t\t\t\t</Command>\n\t\t\t</DialogContent>\n\t\t</Dialog>\n\t);\n}\n\ntype RadixCommandInputProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>;\n\nexport interface CommandInputProps\n\textends Omit<RadixCommandInputProps, \"value\" | \"onValueChange\" | \"asChild\"> {\n\t/**\n\t * Optional controlled state for the search input value.\n\t * Note: Underlying cmdk input excludes standard onChange/type props in favor of value/onValueChange.\n\t */\n\tvalue?: RadixCommandInputProps[\"value\"];\n\t/**\n\t * Event handler called when the search value changes.\n\t */\n\tonValueChange?: RadixCommandInputProps[\"onValueChange\"];\n\t/**\n\t * Change the default rendered input element to the child element, merging props and behavior.\n\t * CommandInput forwards ref to HTMLInputElement and inherits native input attributes (excluding onChange/type).\n\t * Note: When aria-label is omitted, defaults to placeholder if string, or \"Command Palette\".\n\t * @default false\n\t */\n\tasChild?: RadixCommandInputProps[\"asChild\"];\n}\n\nexport const CommandInput = React.forwardRef<\n\tReact.ElementRef<typeof CommandPrimitive.Input>,\n\tCommandInputProps\n>(({ className, ...props }, ref) => (\n\t<div className=\"flex items-center border-b border-basalt-border px-3\" cmdk-input-wrapper=\"\">\n\t\t<Search className=\"mr-2 size-4 shrink-0 opacity-50\" aria-hidden=\"true\" />\n\t\t<CommandPrimitive.Input\n\t\t\tref={ref}\n\t\t\tclassName={cn(\n\t\t\t\t\"flex h-11 w-full rounded-basalt-md bg-transparent py-3 text-sm outline-hidden ring-0 shadow-none placeholder:text-basalt-muted-foreground disabled:cursor-not-allowed disabled:opacity-50\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t\taria-label={\n\t\t\t\tprops[\"aria-label\"] ??\n\t\t\t\t(typeof props.placeholder === \"string\" ? props.placeholder : \"Command Palette\")\n\t\t\t}\n\t\t/>\n\t</div>\n));\nCommandInput.displayName = CommandPrimitive.Input.displayName;\n\ntype RadixCommandListProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>;\n\nexport interface CommandListProps extends Omit<RadixCommandListProps, \"label\" | \"asChild\"> {\n\t/**\n\t * Accessible label for this list of suggestions. Not shown visibly.\n\t * @default \"Suggestions\"\n\t */\n\tlabel?: RadixCommandListProps[\"label\"];\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * CommandList forwards ref to HTMLDivElement and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixCommandListProps[\"asChild\"];\n}\n\nexport const CommandList = React.forwardRef<\n\tReact.ElementRef<typeof CommandPrimitive.List>,\n\tCommandListProps\n>(({ className, ...props }, ref) => (\n\t<CommandPrimitive.List\n\t\tref={ref}\n\t\tclassName={cn(\"max-h-[300px] overflow-y-auto overflow-x-hidden\", className)}\n\t\t{...props}\n\t/>\n));\nCommandList.displayName = CommandPrimitive.List.displayName;\n\ntype RadixCommandEmptyProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>;\n\nexport interface CommandEmptyProps extends Omit<RadixCommandEmptyProps, \"asChild\"> {\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * CommandEmpty forwards ref to HTMLDivElement and inherits native div attributes.\n\t * Note: cmdk Empty does not support forceMount.\n\t * @default false\n\t */\n\tasChild?: RadixCommandEmptyProps[\"asChild\"];\n}\n\nexport const CommandEmpty = React.forwardRef<\n\tReact.ElementRef<typeof CommandPrimitive.Empty>,\n\tCommandEmptyProps\n>((props, ref) => (\n\t<CommandPrimitive.Empty\n\t\tref={ref}\n\t\tclassName=\"py-6 text-center text-sm text-basalt-muted-foreground\"\n\t\t{...props}\n\t/>\n));\nCommandEmpty.displayName = CommandPrimitive.Empty.displayName;\n\ntype RadixCommandGroupProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>;\n\nexport interface CommandGroupProps\n\textends Omit<RadixCommandGroupProps, \"heading\" | \"value\" | \"forceMount\" | \"asChild\"> {\n\t/**\n\t * Heading to render for this group of command items.\n\t */\n\theading?: RadixCommandGroupProps[\"heading\"];\n\t/**\n\t * Unique value identifying this group. If no heading is provided, value must be specified.\n\t */\n\tvalue?: RadixCommandGroupProps[\"value\"];\n\t/**\n\t * Whether this group is forcibly rendered regardless of filtering state.\n\t */\n\tforceMount?: RadixCommandGroupProps[\"forceMount\"];\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * CommandGroup forwards ref to HTMLDivElement and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixCommandGroupProps[\"asChild\"];\n}\n\nexport const CommandGroup = React.forwardRef<\n\tReact.ElementRef<typeof CommandPrimitive.Group>,\n\tCommandGroupProps\n>(({ className, ...props }, ref) => (\n\t<CommandPrimitive.Group\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"overflow-hidden p-1 text-basalt-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-basalt-muted-foreground\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nCommandGroup.displayName = CommandPrimitive.Group.displayName;\n\ntype RadixCommandSeparatorProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>;\n\nexport interface CommandSeparatorProps\n\textends Omit<RadixCommandSeparatorProps, \"alwaysRender\" | \"asChild\"> {\n\t/**\n\t * Whether this separator should always be rendered. Useful when automatic filtering is disabled.\n\t * When false (default), visible only when the search query is empty.\n\t */\n\talwaysRender?: RadixCommandSeparatorProps[\"alwaysRender\"];\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * CommandSeparator forwards ref to HTMLDivElement and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixCommandSeparatorProps[\"asChild\"];\n}\n\nexport const CommandSeparator = React.forwardRef<\n\tReact.ElementRef<typeof CommandPrimitive.Separator>,\n\tCommandSeparatorProps\n>(({ className, ...props }, ref) => (\n\t<CommandPrimitive.Separator\n\t\tref={ref}\n\t\tclassName={cn(\"-mx-1 h-px bg-basalt-border\", className)}\n\t\t{...props}\n\t/>\n));\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName;\n\ntype RadixCommandItemProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>;\n\nexport interface CommandItemProps\n\textends Omit<\n\t\tRadixCommandItemProps,\n\t\t\"disabled\" | \"onSelect\" | \"value\" | \"keywords\" | \"forceMount\" | \"asChild\"\n\t> {\n\t/**\n\t * Whether this item is currently disabled from selection.\n\t * @default false\n\t */\n\tdisabled?: RadixCommandItemProps[\"disabled\"];\n\t/**\n\t * Event handler called when this item is selected via click or keyboard.\n\t * Note: cmdk passes the item's resolved value string `(value: string) => void`,\n\t * not a standard DOM SelectEvent.\n\t */\n\tonSelect?: RadixCommandItemProps[\"onSelect\"];\n\t/**\n\t * Unique value identifying this item during filtering and selection.\n\t * Inferred from children/textContent if omitted.\n\t */\n\tvalue?: RadixCommandItemProps[\"value\"];\n\t/**\n\t * Optional additional keywords matched during filtering.\n\t */\n\tkeywords?: RadixCommandItemProps[\"keywords\"];\n\t/**\n\t * Whether this item is forcibly rendered regardless of query filtering.\n\t * Inherits forceMount from parent CommandGroup when omitted.\n\t */\n\tforceMount?: RadixCommandItemProps[\"forceMount\"];\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * CommandItem forwards ref to HTMLDivElement and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixCommandItemProps[\"asChild\"];\n}\n\nexport const CommandItem = React.forwardRef<\n\tReact.ElementRef<typeof CommandPrimitive.Item>,\n\tCommandItemProps\n>(({ className, ...props }, ref) => (\n\t<CommandPrimitive.Item\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"relative flex cursor-default items-center rounded-basalt-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-basalt-accent data-[selected=true]:text-basalt-accent-foreground data-[disabled=true]:opacity-50\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nCommandItem.displayName = CommandPrimitive.Item.displayName;\n\nexport interface CommandShortcutProps extends React.HTMLAttributes<HTMLSpanElement> {}\n\nexport function CommandShortcut({ className, ...props }: CommandShortcutProps) {\n\treturn (\n\t\t<span\n\t\t\tclassName={cn(\"ml-auto text-xs tracking-widest text-basalt-muted-foreground\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\nCommandShortcut.displayName = \"CommandShortcut\";\n"],"mappings":";;;;;;;;AAQA,IAAMA,IAAUE,EAAM,YAGnB,EAAE,cAAW,GAAGE,KAAS,MAC3B,kBAACH,GAAD;CACM;CACL,WAAWK,EACV,kHACAC,CACD;CACA,GAAIH;AACJ,CAAA,CACD;AACD,EAAQ,cAAcH,EAAiB;AAgDvC,IAAaO,IAAwBC;AAErC,SAAgBC,EAAe,EAAE,aAAU,iBAAc,GAAGN,KAA8B;CACzF,IAAMO,IAAOT,EAAM,SAAS,QAAQU,CAAQ,GACtCC,IAAWF,EAAK,QACpB,MAAUT,EAAM,eAAeY,CAAK,KAAKA,EAAM,SAASN,CAC1D,GACMO,IAAUJ,EAAK,QACnB,MAAU,EAAET,EAAM,eAAeY,CAAK,KAAKA,EAAM,SAASN,EAC5D;CACA,OACC,kBAACQ,GAAD;EAAQ,GAAIZ;EAAZ,UAAA,CACES,GACD,kBAACI,GAAD;GACC,MAAK;GACL,oBAAkB,KAAA;GAClB,WAAU;GAHX,UAAA,CAKC,kBAACC,GAAD;IAAa,WAAU;IAAU,UAAA;GAA4B,CAAA,GAC7D,kBAAClB,GAAD;IACC,OAAM;IACN,GAAKmB,MAAiB,KAAA,KAAa,EAAE,gBAAa;IAClD,WAAU;IAET,UAAAJ;GACO,CAAA,CACK;EACR,CAAA,CAAA;;AAEV;AAwBA,IAAaK,IAAelB,EAAM,YAG/B,EAAE,cAAW,GAAGE,KAAS,MAC3B,kBAAC,OAAD;CAAK,WAAU;CAAuD,sBAAmB;CAAzF,UAAA,CACC,kBAACiB,GAAD;EAAQ,WAAU;EAAkC,eAAY;CAAQ,CAAA,GACxE,kBAACpB,EAAiB,OAAlB;EACM;EACL,WAAWK,EACV,6LACAC,CACD;EACA,GAAIH;EACJ,cACCA,EAAM,kBACL,OAAOA,EAAM,eAAgB,WAAWA,EAAM,cAAc;CAE9D,CAAA,CACG;AACL,CAAA,CAAA;AACD,EAAa,cAAcH,EAAiB,MAAM;AAkBlD,IAAaqB,IAAcpB,EAAM,YAG9B,EAAE,cAAW,GAAGE,KAAS,MAC3B,kBAACH,EAAiB,MAAlB;CACM;CACL,WAAWK,EAAG,mDAAmDC,CAAS;CAC1E,GAAIH;AACJ,CAAA,CACD;AACD,EAAY,cAAcH,EAAiB,KAAK;AAchD,IAAasB,IAAerB,EAAM,YAG/B,GAAO,MACT,kBAACD,EAAiB,OAAlB;CACM;CACL,WAAU;CACV,GAAIG;AACJ,CAAA,CACD;AACD,EAAa,cAAcH,EAAiB,MAAM;AA0BlD,IAAauB,IAAetB,EAAM,YAG/B,EAAE,cAAW,GAAGE,KAAS,MAC3B,kBAACH,EAAiB,OAAlB;CACM;CACL,WAAWK,EACV,wOACAC,CACD;CACA,GAAIH;AACJ,CAAA,CACD;AACD,EAAa,cAAcH,EAAiB,MAAM;AAmBlD,IAAawB,IAAmBvB,EAAM,YAGnC,EAAE,cAAW,GAAGE,KAAS,MAC3B,kBAACH,EAAiB,WAAlB;CACM;CACL,WAAWK,EAAG,+BAA+BC,CAAS;CACtD,GAAIH;AACJ,CAAA,CACD;AACD,EAAiB,cAAcH,EAAiB,UAAU;AA0C1D,IAAayB,IAAcxB,EAAM,YAG9B,EAAE,cAAW,GAAGE,KAAS,MAC3B,kBAACH,EAAiB,MAAlB;CACM;CACL,WAAWK,EACV,gRACAC,CACD;CACA,GAAIH;AACJ,CAAA,CACD;AACD,EAAY,cAAcH,EAAiB,KAAK;AAIhD,SAAgB0B,EAAgB,EAAE,cAAW,GAAGvB,KAA+B;CAC9E,OACC,kBAAC,QAAD;EACC,WAAWE,EAAG,gEAAgEC,CAAS;EACvF,GAAIH;CACJ,CAAA;AAEH;AACA,EAAgB,cAAc"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { type AlertDialogContentProps } from "./alert-dialog.js";
|
|
2
3
|
export type ConfirmDialogVariant = "default" | "destructive";
|
|
3
4
|
export interface ConfirmDialogProps {
|
|
4
5
|
/** Whether the confirmation dialog is shown. */
|
|
5
6
|
open: boolean;
|
|
6
7
|
/** Called when the dialog requests to open or close. */
|
|
7
8
|
onOpenChange: (open: boolean) => void;
|
|
9
|
+
/** Runs after the close focus trap releases. Prevent default to focus a replacement control. */
|
|
10
|
+
onCloseAutoFocus?: AlertDialogContentProps["onCloseAutoFocus"];
|
|
8
11
|
/** Called once when the user confirms. The dialog does not close itself; caller manages loading and asynchronous errors. */
|
|
9
12
|
onConfirm: () => void | Promise<void>;
|
|
10
13
|
/** The dialog title. */
|
|
@@ -52,5 +55,5 @@ export interface UseConfirmResult {
|
|
|
52
55
|
confirm: (options: UseConfirmOptions) => Promise<boolean>;
|
|
53
56
|
dialogProps: ConfirmDialogProps;
|
|
54
57
|
}
|
|
55
|
-
export declare function ConfirmDialog({ cancelLabel, confirmLabel, description, loading, onConfirm, onOpenChange, open, title, trigger, variant, }: ConfirmDialogProps): React.JSX.Element;
|
|
58
|
+
export declare function ConfirmDialog({ cancelLabel, confirmLabel, description, loading, onConfirm, onCloseAutoFocus, onOpenChange, open, title, trigger, variant, }: ConfirmDialogProps): React.JSX.Element;
|
|
56
59
|
export declare function useConfirm(): UseConfirmResult;
|
|
@@ -5,37 +5,39 @@ import * as c from "@radix-ui/react-alert-dialog";
|
|
|
5
5
|
import * as l from "react";
|
|
6
6
|
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/confirm-dialog.tsx
|
|
8
|
-
function f({ cancelLabel: f = "Cancel", confirmLabel: p = "Confirm", description: m, loading: h = !1, onConfirm: g,
|
|
9
|
-
let
|
|
10
|
-
|
|
8
|
+
function f({ cancelLabel: f = "Cancel", confirmLabel: p = "Confirm", description: m, loading: h = !1, onConfirm: g, onCloseAutoFocus: _, onOpenChange: v, open: y, title: b, trigger: x, variant: S = "default" }) {
|
|
9
|
+
let C = l.useRef(null), w = l.useRef(null), T = l.useRef(null), E = l.useRef(null), D = l.useCallback(() => {
|
|
10
|
+
C.current?.isConnected ? C.current.focus() : E.current?.isConnected && E.current.focus(), E.current = null;
|
|
11
11
|
}, []);
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
}, [v]), /* @__PURE__ */ d(t, {
|
|
15
|
-
open: v,
|
|
12
|
+
return /* @__PURE__ */ d(t, {
|
|
13
|
+
open: y,
|
|
16
14
|
onOpenChange: (e) => {
|
|
17
|
-
(!h || e) &&
|
|
15
|
+
(!h || e) && v(e);
|
|
18
16
|
},
|
|
19
|
-
children: [l.isValidElement(
|
|
20
|
-
ref:
|
|
17
|
+
children: [l.isValidElement(x) ? /* @__PURE__ */ u(s, {
|
|
18
|
+
ref: C,
|
|
21
19
|
asChild: !0,
|
|
22
|
-
children:
|
|
20
|
+
children: x
|
|
23
21
|
}) : null, /* @__PURE__ */ d(n, {
|
|
24
|
-
ref:
|
|
22
|
+
ref: w,
|
|
25
23
|
onOpenAutoFocus: (e) => {
|
|
26
|
-
if (e.preventDefault(), !E.current?.isConnected && document.activeElement instanceof HTMLElement && !
|
|
27
|
-
|
|
24
|
+
if (e.preventDefault(), !E.current?.isConnected && document.activeElement instanceof HTMLElement && !w.current?.contains(document.activeElement) && (E.current = document.activeElement), T.current && !T.current.disabled) {
|
|
25
|
+
T.current.focus();
|
|
28
26
|
return;
|
|
29
27
|
}
|
|
30
|
-
|
|
28
|
+
w.current?.focus();
|
|
31
29
|
},
|
|
32
30
|
onCloseAutoFocus: (e) => {
|
|
31
|
+
if (_?.(e), e.defaultPrevented) {
|
|
32
|
+
E.current = null;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
33
35
|
e.preventDefault(), D();
|
|
34
36
|
},
|
|
35
|
-
children: [/* @__PURE__ */ d(a, { children: [/* @__PURE__ */ u(o, { children:
|
|
37
|
+
children: [/* @__PURE__ */ d(a, { children: [/* @__PURE__ */ u(o, { children: b }), /* @__PURE__ */ u(r, { children: m })] }), /* @__PURE__ */ d(i, { children: [/* @__PURE__ */ u(c.Cancel, {
|
|
36
38
|
asChild: !0,
|
|
37
39
|
children: /* @__PURE__ */ u(e, {
|
|
38
|
-
ref:
|
|
40
|
+
ref: T,
|
|
39
41
|
disabled: h,
|
|
40
42
|
variant: "outline",
|
|
41
43
|
children: f
|
|
@@ -44,7 +46,7 @@ function f({ cancelLabel: f = "Cancel", confirmLabel: p = "Confirm", description
|
|
|
44
46
|
asChild: !0,
|
|
45
47
|
children: /* @__PURE__ */ u(e, {
|
|
46
48
|
loading: h,
|
|
47
|
-
variant:
|
|
49
|
+
variant: S,
|
|
48
50
|
onClick: (e) => {
|
|
49
51
|
e.preventDefault(), h || g();
|
|
50
52
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirm-dialog.js","names":[],"sources":["../../src/components/confirm-dialog.tsx"],"sourcesContent":["import * as AlertDialogPrimitive from \"@radix-ui/react-alert-dialog\";\nimport * as React from \"react\";\nimport {\n\tAlertDialog,\n\tAlertDialogContent,\n\tAlertDialogDescription,\n\tAlertDialogFooter,\n\tAlertDialogHeader,\n\tAlertDialogTitle,\n\tAlertDialogTrigger,\n} from \"./alert-dialog\";\nimport { Button } from \"./button\";\n\nexport type ConfirmDialogVariant = \"default\" | \"destructive\";\n\nexport interface ConfirmDialogProps {\n\t/** Whether the confirmation dialog is shown. */\n\topen: boolean;\n\t/** Called when the dialog requests to open or close. */\n\tonOpenChange: (open: boolean) => void;\n\t/** Called once when the user confirms. The dialog does not close itself; caller manages loading and asynchronous errors. */\n\tonConfirm: () => void | Promise<void>;\n\t/** The dialog title. */\n\ttitle: React.ReactNode;\n\t/** Supporting copy that describes the action. */\n\tdescription: React.ReactNode;\n\t/**\n\t * Label for the confirm button.\n\t * @default \"Confirm\"\n\t */\n\tconfirmLabel?: React.ReactNode;\n\t/**\n\t * Label for the cancel button.\n\t * @default \"Cancel\"\n\t */\n\tcancelLabel?: React.ReactNode;\n\t/**\n\t * Appearance of the confirm button.\n\t * @default \"default\"\n\t */\n\tvariant?: ConfirmDialogVariant;\n\t/**\n\t * Disable both actions and ignore close requests while work is pending.\n\t * @default false\n\t */\n\tloading?: boolean;\n\t/**\n\t * Control that opens the dialog. When set, closing restores focus to it.\n\t */\n\ttrigger?: React.ReactElement;\n}\n\nexport interface UseConfirmOptions {\n\t/** The dialog title. */\n\ttitle: React.ReactNode;\n\t/** Supporting copy that describes the action. */\n\tdescription: React.ReactNode;\n\t/** Label for the confirm button. */\n\tconfirmLabel?: React.ReactNode;\n\t/** Label for the cancel button. */\n\tcancelLabel?: React.ReactNode;\n\t/** Appearance of the confirm button. */\n\tvariant?: ConfirmDialogVariant;\n}\n\nexport interface UseConfirmResult {\n\tconfirm: (options: UseConfirmOptions) => Promise<boolean>;\n\tdialogProps: ConfirmDialogProps;\n}\n\nexport function ConfirmDialog({\n\tcancelLabel = \"Cancel\",\n\tconfirmLabel = \"Confirm\",\n\tdescription,\n\tloading = false,\n\tonConfirm,\n\tonOpenChange,\n\topen,\n\ttitle,\n\ttrigger,\n\tvariant = \"default\",\n}: ConfirmDialogProps) {\n\tconst triggerRef = React.useRef<HTMLButtonElement>(null);\n\tconst panelRef = React.useRef<HTMLDivElement>(null);\n\tconst cancelRef = React.useRef<HTMLButtonElement>(null);\n\tconst
|
|
1
|
+
{"version":3,"file":"confirm-dialog.js","names":["AlertDialogPrimitive","React","ConfirmDialog","triggerRef","panelRef","cancelRef","openerRef","restoreFocus","AlertDialog","next","onOpenChange","trigger","AlertDialogTrigger","AlertDialogContent","event","onCloseAutoFocus","AlertDialogHeader","AlertDialogTitle","title","AlertDialogDescription","description","AlertDialogFooter","Button","loading","cancelLabel","onConfirm","confirmLabel","useConfirm","open","setOpen","options","setOptions","resolverRef","settle","resolve","value"],"sources":["../../src/components/confirm-dialog.tsx"],"sourcesContent":["import * as AlertDialogPrimitive from \"@radix-ui/react-alert-dialog\";\nimport * as React from \"react\";\nimport {\n\tAlertDialog,\n\tAlertDialogContent,\n\ttype AlertDialogContentProps,\n\tAlertDialogDescription,\n\tAlertDialogFooter,\n\tAlertDialogHeader,\n\tAlertDialogTitle,\n\tAlertDialogTrigger,\n} from \"./alert-dialog\";\nimport { Button } from \"./button\";\n\nexport type ConfirmDialogVariant = \"default\" | \"destructive\";\n\nexport interface ConfirmDialogProps {\n\t/** Whether the confirmation dialog is shown. */\n\topen: boolean;\n\t/** Called when the dialog requests to open or close. */\n\tonOpenChange: (open: boolean) => void;\n\t/** Runs after the close focus trap releases. Prevent default to focus a replacement control. */\n\tonCloseAutoFocus?: AlertDialogContentProps[\"onCloseAutoFocus\"];\n\t/** Called once when the user confirms. The dialog does not close itself; caller manages loading and asynchronous errors. */\n\tonConfirm: () => void | Promise<void>;\n\t/** The dialog title. */\n\ttitle: React.ReactNode;\n\t/** Supporting copy that describes the action. */\n\tdescription: React.ReactNode;\n\t/**\n\t * Label for the confirm button.\n\t * @default \"Confirm\"\n\t */\n\tconfirmLabel?: React.ReactNode;\n\t/**\n\t * Label for the cancel button.\n\t * @default \"Cancel\"\n\t */\n\tcancelLabel?: React.ReactNode;\n\t/**\n\t * Appearance of the confirm button.\n\t * @default \"default\"\n\t */\n\tvariant?: ConfirmDialogVariant;\n\t/**\n\t * Disable both actions and ignore close requests while work is pending.\n\t * @default false\n\t */\n\tloading?: boolean;\n\t/**\n\t * Control that opens the dialog. When set, closing restores focus to it.\n\t */\n\ttrigger?: React.ReactElement;\n}\n\nexport interface UseConfirmOptions {\n\t/** The dialog title. */\n\ttitle: React.ReactNode;\n\t/** Supporting copy that describes the action. */\n\tdescription: React.ReactNode;\n\t/** Label for the confirm button. */\n\tconfirmLabel?: React.ReactNode;\n\t/** Label for the cancel button. */\n\tcancelLabel?: React.ReactNode;\n\t/** Appearance of the confirm button. */\n\tvariant?: ConfirmDialogVariant;\n}\n\nexport interface UseConfirmResult {\n\tconfirm: (options: UseConfirmOptions) => Promise<boolean>;\n\tdialogProps: ConfirmDialogProps;\n}\n\nexport function ConfirmDialog({\n\tcancelLabel = \"Cancel\",\n\tconfirmLabel = \"Confirm\",\n\tdescription,\n\tloading = false,\n\tonConfirm,\n\tonCloseAutoFocus,\n\tonOpenChange,\n\topen,\n\ttitle,\n\ttrigger,\n\tvariant = \"default\",\n}: ConfirmDialogProps) {\n\tconst triggerRef = React.useRef<HTMLButtonElement>(null);\n\tconst panelRef = React.useRef<HTMLDivElement>(null);\n\tconst cancelRef = React.useRef<HTMLButtonElement>(null);\n\tconst openerRef = React.useRef<HTMLElement | null>(null);\n\n\tconst restoreFocus = React.useCallback(() => {\n\t\tif (triggerRef.current?.isConnected) {\n\t\t\ttriggerRef.current.focus();\n\t\t} else if (openerRef.current?.isConnected) {\n\t\t\topenerRef.current.focus();\n\t\t}\n\t\topenerRef.current = null;\n\t}, []);\n\n\treturn (\n\t\t<AlertDialog\n\t\t\topen={open}\n\t\t\tonOpenChange={(next) => {\n\t\t\t\tif (loading && !next) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tonOpenChange(next);\n\t\t\t}}\n\t\t>\n\t\t\t{React.isValidElement(trigger) ? (\n\t\t\t\t<AlertDialogTrigger ref={triggerRef} asChild>\n\t\t\t\t\t{trigger}\n\t\t\t\t</AlertDialogTrigger>\n\t\t\t) : null}\n\t\t\t<AlertDialogContent\n\t\t\t\tref={panelRef}\n\t\t\t\tonOpenAutoFocus={(event) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tif (\n\t\t\t\t\t\t!openerRef.current?.isConnected &&\n\t\t\t\t\t\tdocument.activeElement instanceof HTMLElement &&\n\t\t\t\t\t\t!panelRef.current?.contains(document.activeElement)\n\t\t\t\t\t) {\n\t\t\t\t\t\topenerRef.current = document.activeElement;\n\t\t\t\t\t}\n\t\t\t\t\tif (cancelRef.current && !cancelRef.current.disabled) {\n\t\t\t\t\t\tcancelRef.current.focus();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tpanelRef.current?.focus();\n\t\t\t\t}}\n\t\t\t\tonCloseAutoFocus={(event) => {\n\t\t\t\t\tonCloseAutoFocus?.(event);\n\t\t\t\t\tif (event.defaultPrevented) {\n\t\t\t\t\t\topenerRef.current = null;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\trestoreFocus();\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<AlertDialogHeader>\n\t\t\t\t\t<AlertDialogTitle>{title}</AlertDialogTitle>\n\t\t\t\t\t<AlertDialogDescription>{description}</AlertDialogDescription>\n\t\t\t\t</AlertDialogHeader>\n\t\t\t\t<AlertDialogFooter>\n\t\t\t\t\t<AlertDialogPrimitive.Cancel asChild>\n\t\t\t\t\t\t<Button ref={cancelRef} disabled={loading} variant=\"outline\">\n\t\t\t\t\t\t\t{cancelLabel}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</AlertDialogPrimitive.Cancel>\n\t\t\t\t\t<AlertDialogPrimitive.Action asChild>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tloading={loading}\n\t\t\t\t\t\t\tvariant={variant}\n\t\t\t\t\t\t\tonClick={(event) => {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tif (!loading) {\n\t\t\t\t\t\t\t\t\tvoid onConfirm();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{confirmLabel}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</AlertDialogPrimitive.Action>\n\t\t\t\t</AlertDialogFooter>\n\t\t\t</AlertDialogContent>\n\t\t</AlertDialog>\n\t);\n}\n\nexport function useConfirm(): UseConfirmResult {\n\tconst [open, setOpen] = React.useState(false);\n\tconst [options, setOptions] = React.useState<UseConfirmOptions>({\n\t\ttitle: \"\",\n\t\tdescription: \"\",\n\t});\n\tconst resolverRef = React.useRef<((value: boolean) => void) | null>(null);\n\n\tconst settle = React.useCallback((value: boolean) => {\n\t\tconst resolve = resolverRef.current;\n\t\tresolverRef.current = null;\n\t\tresolve?.(value);\n\t}, []);\n\n\tReact.useEffect(() => {\n\t\treturn () => {\n\t\t\tsettle(false);\n\t\t};\n\t}, [settle]);\n\n\tconst confirm = React.useCallback(\n\t\t(next: UseConfirmOptions) => {\n\t\t\tsettle(false);\n\t\t\tsetOptions(next);\n\t\t\tsetOpen(true);\n\t\t\treturn new Promise<boolean>((resolve) => {\n\t\t\t\tresolverRef.current = resolve;\n\t\t\t});\n\t\t},\n\t\t[settle],\n\t);\n\n\treturn {\n\t\tconfirm,\n\t\tdialogProps: {\n\t\t\topen,\n\t\t\ttitle: options.title,\n\t\t\tdescription: options.description,\n\t\t\tconfirmLabel: options.confirmLabel,\n\t\t\tcancelLabel: options.cancelLabel,\n\t\t\tvariant: options.variant,\n\t\t\tonOpenChange: (next) => {\n\t\t\t\tsetOpen(next);\n\t\t\t\tif (!next) {\n\t\t\t\t\tsettle(false);\n\t\t\t\t}\n\t\t\t},\n\t\t\tonConfirm: () => {\n\t\t\t\tsettle(true);\n\t\t\t\tsetOpen(false);\n\t\t\t},\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;AAyEA,SAAgBE,EAAc,EAC7B,iBAAc,UACd,kBAAe,WACf,gBACA,aAAU,IACV,cACA,qBACA,iBACA,SACA,UACA,YACA,aAAU,aACY;CACtB,IAAMC,IAAaF,EAAM,OAA0B,IAAI,GACjDG,IAAWH,EAAM,OAAuB,IAAI,GAC5CI,IAAYJ,EAAM,OAA0B,IAAI,GAChDK,IAAYL,EAAM,OAA2B,IAAI,GAEjDM,IAAeN,EAAM,kBAAkB;EAM5C,AALIE,EAAW,SAAS,cACvBA,EAAW,QAAQ,MAAM,IACfG,EAAU,SAAS,eAC7BA,EAAU,QAAQ,MAAM,GAEzB,EAAU,UAAU;CACrB,GAAG,CAAC,CAAC;CAEL,OACC,kBAACE,GAAD;EACO;EACN,eAAe,MAAS;GACvB,CAAI,MAAYC,MAGhBC,EAAaD,CAAI;EAClB;EAPD,UAAA,CASER,EAAM,eAAeU,CAAO,IAC5B,kBAACC,GAAD;GAAoB,KAAKT;GAAY,SAAA;GACnC,UAAAQ;EACkB,CAAA,IACjB,MACJ,kBAACE,GAAD;GACC,KAAKT;GACL,kBAAkB,MAAU;IAS3B,IARAU,EAAM,eAAe,GAEpB,CAACR,EAAU,SAAS,eACpB,SAAS,yBAAyB,eAClC,CAACF,EAAS,SAAS,SAAS,SAAS,aAAa,MAElD,EAAU,UAAU,SAAS,gBAE1BC,EAAU,WAAW,CAACA,EAAU,QAAQ,UAAU;KACrD,EAAU,QAAQ,MAAM;KACxB;IACD;IACA,EAAS,SAAS,MAAM;GACzB;GACA,mBAAmB,MAAU;IAE5B,IADAU,IAAmBD,CAAK,GACpBA,EAAM,kBAAkB;KAC3B,EAAU,UAAU;KACpB;IACD;IAEA,AADAA,EAAM,eAAe,GACrBP,EAAa;GACd;GAzBD,UAAA,CA2BC,kBAACS,GAAD,EAAA,UAAA,CACC,kBAACC,GAAD,EAAA,UAAmBC,EAAwB,CAAA,GAC3C,kBAACC,GAAD,EAAA,UAAyBC,EAAoC,CAAA,CAC3C,EAAA,CAAA,GACnB,kBAACC,GAAD,EAAA,UAAA,CACC,kBAACrB,EAAqB,QAAtB;IAA6B,SAAA;IAC5B,UAAA,kBAACsB,GAAD;KAAQ,KAAKjB;KAAW,UAAUkB;KAAS,SAAQ;KACjD,UAAAC;IACM,CAAA;GACoB,CAAA,GAC7B,kBAACxB,EAAqB,QAAtB;IAA6B,SAAA;IAC5B,UAAA,kBAACsB,GAAD;KACU;KACA;KACT,UAAU,MAAU;MAEnB,AADAR,EAAM,eAAe,GAChBS,KACJE,EAAe;KAEjB;KAEC,UAAAC;IACM,CAAA;GACoB,CAAA,CACX,EAAA,CAAA,CACA;EACR,CAAA,CAAA;;AAEf;AAEA,SAAgBC,IAA+B;CAC9C,IAAM,CAACC,GAAMC,KAAW5B,EAAM,SAAS,EAAK,GACtC,CAAC6B,GAASC,KAAc9B,EAAM,SAA4B;EAC/D,OAAO;EACP,aAAa;CACd,CAAC,GACK+B,IAAc/B,EAAM,OAA0C,IAAI,GAElEgC,IAAShC,EAAM,aAAa,MAAmB;EACpD,IAAMiC,IAAUF,EAAY;EAE5B,AADA,EAAY,UAAU,MACtBE,IAAUC,CAAK;CAChB,GAAG,CAAC,CAAC;CAoBL,OAlBAlC,EAAM,sBACQ;EACZ,EAAO,EAAK;CACb,GACE,CAACgC,CAAM,CAAC,GAcJ;EACN,SAbehC,EAAM,aACpB,OACAgC,EAAO,EAAK,GACZF,EAAWtB,CAAI,GACfoB,EAAQ,EAAI,GACL,IAAI,SAAkB,MAAY;GACxC,EAAY,UAAUK;EACvB,CAAC,IAEF,CAACD,CAAM,CAIP;EACA,aAAa;GACZ;GACA,OAAOH,EAAQ;GACf,aAAaA,EAAQ;GACrB,cAAcA,EAAQ;GACtB,aAAaA,EAAQ;GACrB,SAASA,EAAQ;GACjB,eAAe,MAAS;IAEvB,AADAD,EAAQpB,CAAI,GACPA,KACJwB,EAAO,EAAK;GAEd;GACA,iBAAiB;IAEhB,AADAA,EAAO,EAAI,GACXJ,EAAQ,EAAK;GACd;EACD;CACD;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-menu.js","names":[],"sources":["../../src/components/context-menu.tsx"],"sourcesContent":["import * as ContextMenuPrimitive from \"@radix-ui/react-context-menu\";\nimport * as React from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { overlayItemClass, overlayPanelClass } from \"./overlay\";\n\ntype RadixContextMenuProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Root>;\ntype RadixContextMenuTriggerProps = React.ComponentPropsWithoutRef<\n\ttypeof ContextMenuPrimitive.Trigger\n>;\ntype RadixContextMenuContentProps = React.ComponentPropsWithoutRef<\n\ttypeof ContextMenuPrimitive.Content\n>;\ntype RadixContextMenuItemProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item>;\n\nexport interface ContextMenuProps\n\textends Omit<RadixContextMenuProps, \"open\" | \"onOpenChange\" | \"dir\" | \"modal\"> {\n\t/**\n\t * Controlled open state of the context menu.\n\t * When set to true before pointer trigger interaction, positions at the top-left of the viewport.\n\t */\n\topen?: RadixContextMenuProps[\"open\"];\n\t/**\n\t * Callback invoked when open state changes.\n\t */\n\tonOpenChange?: RadixContextMenuProps[\"onOpenChange\"];\n\t/**\n\t * The reading direction of the context menu.\n\t * @default \"ltr\"\n\t */\n\tdir?: RadixContextMenuProps[\"dir\"];\n\t/**\n\t * Whether the context menu is modal, preventing outside interactions.\n\t * @default true\n\t */\n\tmodal?: RadixContextMenuProps[\"modal\"];\n}\n\nexport const ContextMenu = ContextMenuPrimitive.Root;\n\nexport interface ContextMenuTriggerProps\n\textends Omit<RadixContextMenuTriggerProps, \"disabled\" | \"asChild\"> {\n\t/**\n\t * Disable the context menu trigger from opening on right-click.\n\t * @default false\n\t */\n\tdisabled?: RadixContextMenuTriggerProps[\"disabled\"];\n\t/**\n\t * Change the default rendered span element to the child element, merging props and behavior.\n\t * Trigger forwards ref to HTMLSpanElement and inherits native span attributes.\n\t * @default false\n\t */\n\tasChild?: RadixContextMenuTriggerProps[\"asChild\"];\n}\n\nexport const ContextMenuTrigger = ContextMenuPrimitive.Trigger;\n\nexport interface ContextMenuContentProps\n\textends Omit<\n\t\tRadixContextMenuContentProps,\n\t\t| \"loop\"\n\t\t| \"alignOffset\"\n\t\t| \"avoidCollisions\"\n\t\t| \"collisionBoundary\"\n\t\t| \"collisionPadding\"\n\t\t| \"arrowPadding\"\n\t\t| \"sticky\"\n\t\t| \"hideWhenDetached\"\n\t\t| \"forceMount\"\n\t\t| \"asChild\"\n\t\t| \"onCloseAutoFocus\"\n\t\t| \"onEscapeKeyDown\"\n\t\t| \"onPointerDownOutside\"\n\t\t| \"onFocusOutside\"\n\t\t| \"onInteractOutside\"\n\t> {\n\t/**\n\t * Whether keyboard navigation should loop around item boundaries.\n\t * @default false\n\t */\n\tloop?: RadixContextMenuContentProps[\"loop\"];\n\t/**\n\t * Offset in pixels from the start or end alignment position.\n\t * @default 0\n\t */\n\talignOffset?: RadixContextMenuContentProps[\"alignOffset\"];\n\t/**\n\t * Whether to reposition content to avoid viewport boundary collisions.\n\t * @default true\n\t */\n\tavoidCollisions?: RadixContextMenuContentProps[\"avoidCollisions\"];\n\t/**\n\t * Element or elements bounding boundary collision calculations.\n\t * @default []\n\t */\n\tcollisionBoundary?: RadixContextMenuContentProps[\"collisionBoundary\"];\n\t/**\n\t * Virtual padding from collision boundaries in pixels.\n\t * @default 0\n\t */\n\tcollisionPadding?: RadixContextMenuContentProps[\"collisionPadding\"];\n\t/**\n\t * Padding in pixels between popper arrow and floating panel edge.\n\t * @default 0\n\t */\n\tarrowPadding?: RadixContextMenuContentProps[\"arrowPadding\"];\n\t/**\n\t * Sticky positioning behavior along the align axis when overflowing.\n\t * @default \"partial\"\n\t */\n\tsticky?: RadixContextMenuContentProps[\"sticky\"];\n\t/**\n\t * Whether to hide content completely when trigger is fully occluded.\n\t * @default false\n\t */\n\thideWhenDetached?: RadixContextMenuContentProps[\"hideWhenDetached\"];\n\t/**\n\t * Force mounting content in DOM for external animation controls.\n\t * Note: Bare ContextMenuContent mounts directly without a built-in Portal wrapper.\n\t */\n\tforceMount?: true;\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * Content forwards ref to HTMLDivElement and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixContextMenuContentProps[\"asChild\"];\n\t/**\n\t * Callback fired when auto-focusing on close. Can be prevented.\n\t */\n\tonCloseAutoFocus?: RadixContextMenuContentProps[\"onCloseAutoFocus\"];\n\t/**\n\t * Callback fired when the Escape key is down on the dismissable layer. Can be prevented.\n\t */\n\tonEscapeKeyDown?: RadixContextMenuContentProps[\"onEscapeKeyDown\"];\n\t/**\n\t * Callback fired when a pointerdown event happens outside the bounds of the dismissable layer. Can be prevented.\n\t */\n\tonPointerDownOutside?: RadixContextMenuContentProps[\"onPointerDownOutside\"];\n\t/**\n\t * Callback fired when focus moves outside the bounds of the dismissable layer. Can be prevented.\n\t */\n\tonFocusOutside?: RadixContextMenuContentProps[\"onFocusOutside\"];\n\t/**\n\t * Callback fired when an interaction (pointerdown or focus) happens outside the bounds of the dismissable layer. Can be prevented.\n\t */\n\tonInteractOutside?: RadixContextMenuContentProps[\"onInteractOutside\"];\n}\n\nexport const ContextMenuContent = ContextMenuPrimitive.Content;\n\nexport interface ContextMenuItemProps\n\textends Omit<RadixContextMenuItemProps, \"disabled\" | \"onSelect\" | \"textValue\" | \"asChild\"> {\n\t/**\n\t * Disable the context menu item.\n\t * @default false\n\t */\n\tdisabled?: RadixContextMenuItemProps[\"disabled\"];\n\t/**\n\t * Event handler called when the context menu item is selected (via click or keyboard).\n\t */\n\tonSelect?: RadixContextMenuItemProps[\"onSelect\"];\n\t/**\n\t * Optional text used for typeahead navigation. By default typeahead uses item text content.\n\t */\n\ttextValue?: RadixContextMenuItemProps[\"textValue\"];\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * Item forwards ref to HTMLDivElement and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixContextMenuItemProps[\"asChild\"];\n}\n\nexport const ContextMenuItem = React.forwardRef<\n\tReact.ElementRef<typeof ContextMenuPrimitive.Item>,\n\tContextMenuItemProps\n>(({ className, ...props }, ref) => (\n\t<ContextMenuPrimitive.Item\n\t\tref={ref}\n\t\tclassName={overlayItemClass(\n\t\t\tcn(\n\t\t\t\t\"relative outline-hidden focus:bg-basalt-accent data-disabled:pointer-events-none data-disabled:opacity-50\",\n\t\t\t\tclassName,\n\t\t\t),\n\t\t)}\n\t\t{...props}\n\t/>\n));\nContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;\n\nexport interface ContextMenuPanelProps\n\textends Omit<ContextMenuContentProps, \"forceMount\">,\n\t\tPick<React.ComponentProps<typeof ContextMenuPrimitive.Content>, \"ref\"> {\n\t/**\n\t * Force mounting content in DOM for external animation controls.\n\t * When forceMount is true, the content remains mounted even when closed.\n\t * The caller is responsible for visibility transitions and unmounting after animation completes.\n\t * Note: Keeping modal content forceMounted may isolate background interactions until unmounted.\n\t */\n\tforceMount?: true;\n}\n\nexport function ContextMenuPanel({ className, ...props }: ContextMenuPanelProps) {\n\treturn (\n\t\t<ContextMenuPrimitive.Portal forceMount={props.forceMount}>\n\t\t\t<ContextMenuPrimitive.Content\n\t\t\t\tclassName={overlayPanelClass(cn(\"min-w-40\", className))}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</ContextMenuPrimitive.Portal>\n\t);\n}\n"],"mappings":";;;;;;;AAqCA,
|
|
1
|
+
{"version":3,"file":"context-menu.js","names":["React","ContextMenuPrimitive","ContextMenu","ContextMenuTrigger","ContextMenuContent","ContextMenuItem","props","overlayItemClass","cn","className","ContextMenuPanel","overlayPanelClass"],"sources":["../../src/components/context-menu.tsx"],"sourcesContent":["import * as ContextMenuPrimitive from \"@radix-ui/react-context-menu\";\nimport * as React from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { overlayItemClass, overlayPanelClass } from \"./overlay\";\n\ntype RadixContextMenuProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Root>;\ntype RadixContextMenuTriggerProps = React.ComponentPropsWithoutRef<\n\ttypeof ContextMenuPrimitive.Trigger\n>;\ntype RadixContextMenuContentProps = React.ComponentPropsWithoutRef<\n\ttypeof ContextMenuPrimitive.Content\n>;\ntype RadixContextMenuItemProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item>;\n\nexport interface ContextMenuProps\n\textends Omit<RadixContextMenuProps, \"open\" | \"onOpenChange\" | \"dir\" | \"modal\"> {\n\t/**\n\t * Controlled open state of the context menu.\n\t * When set to true before pointer trigger interaction, positions at the top-left of the viewport.\n\t */\n\topen?: RadixContextMenuProps[\"open\"];\n\t/**\n\t * Callback invoked when open state changes.\n\t */\n\tonOpenChange?: RadixContextMenuProps[\"onOpenChange\"];\n\t/**\n\t * The reading direction of the context menu.\n\t * @default \"ltr\"\n\t */\n\tdir?: RadixContextMenuProps[\"dir\"];\n\t/**\n\t * Whether the context menu is modal, preventing outside interactions.\n\t * @default true\n\t */\n\tmodal?: RadixContextMenuProps[\"modal\"];\n}\n\nexport const ContextMenu = ContextMenuPrimitive.Root;\n\nexport interface ContextMenuTriggerProps\n\textends Omit<RadixContextMenuTriggerProps, \"disabled\" | \"asChild\"> {\n\t/**\n\t * Disable the context menu trigger from opening on right-click.\n\t * @default false\n\t */\n\tdisabled?: RadixContextMenuTriggerProps[\"disabled\"];\n\t/**\n\t * Change the default rendered span element to the child element, merging props and behavior.\n\t * Trigger forwards ref to HTMLSpanElement and inherits native span attributes.\n\t * @default false\n\t */\n\tasChild?: RadixContextMenuTriggerProps[\"asChild\"];\n}\n\nexport const ContextMenuTrigger = ContextMenuPrimitive.Trigger;\n\nexport interface ContextMenuContentProps\n\textends Omit<\n\t\tRadixContextMenuContentProps,\n\t\t| \"loop\"\n\t\t| \"alignOffset\"\n\t\t| \"avoidCollisions\"\n\t\t| \"collisionBoundary\"\n\t\t| \"collisionPadding\"\n\t\t| \"arrowPadding\"\n\t\t| \"sticky\"\n\t\t| \"hideWhenDetached\"\n\t\t| \"forceMount\"\n\t\t| \"asChild\"\n\t\t| \"onCloseAutoFocus\"\n\t\t| \"onEscapeKeyDown\"\n\t\t| \"onPointerDownOutside\"\n\t\t| \"onFocusOutside\"\n\t\t| \"onInteractOutside\"\n\t> {\n\t/**\n\t * Whether keyboard navigation should loop around item boundaries.\n\t * @default false\n\t */\n\tloop?: RadixContextMenuContentProps[\"loop\"];\n\t/**\n\t * Offset in pixels from the start or end alignment position.\n\t * @default 0\n\t */\n\talignOffset?: RadixContextMenuContentProps[\"alignOffset\"];\n\t/**\n\t * Whether to reposition content to avoid viewport boundary collisions.\n\t * @default true\n\t */\n\tavoidCollisions?: RadixContextMenuContentProps[\"avoidCollisions\"];\n\t/**\n\t * Element or elements bounding boundary collision calculations.\n\t * @default []\n\t */\n\tcollisionBoundary?: RadixContextMenuContentProps[\"collisionBoundary\"];\n\t/**\n\t * Virtual padding from collision boundaries in pixels.\n\t * @default 0\n\t */\n\tcollisionPadding?: RadixContextMenuContentProps[\"collisionPadding\"];\n\t/**\n\t * Padding in pixels between popper arrow and floating panel edge.\n\t * @default 0\n\t */\n\tarrowPadding?: RadixContextMenuContentProps[\"arrowPadding\"];\n\t/**\n\t * Sticky positioning behavior along the align axis when overflowing.\n\t * @default \"partial\"\n\t */\n\tsticky?: RadixContextMenuContentProps[\"sticky\"];\n\t/**\n\t * Whether to hide content completely when trigger is fully occluded.\n\t * @default false\n\t */\n\thideWhenDetached?: RadixContextMenuContentProps[\"hideWhenDetached\"];\n\t/**\n\t * Force mounting content in DOM for external animation controls.\n\t * Note: Bare ContextMenuContent mounts directly without a built-in Portal wrapper.\n\t */\n\tforceMount?: true;\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * Content forwards ref to HTMLDivElement and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixContextMenuContentProps[\"asChild\"];\n\t/**\n\t * Callback fired when auto-focusing on close. Can be prevented.\n\t */\n\tonCloseAutoFocus?: RadixContextMenuContentProps[\"onCloseAutoFocus\"];\n\t/**\n\t * Callback fired when the Escape key is down on the dismissable layer. Can be prevented.\n\t */\n\tonEscapeKeyDown?: RadixContextMenuContentProps[\"onEscapeKeyDown\"];\n\t/**\n\t * Callback fired when a pointerdown event happens outside the bounds of the dismissable layer. Can be prevented.\n\t */\n\tonPointerDownOutside?: RadixContextMenuContentProps[\"onPointerDownOutside\"];\n\t/**\n\t * Callback fired when focus moves outside the bounds of the dismissable layer. Can be prevented.\n\t */\n\tonFocusOutside?: RadixContextMenuContentProps[\"onFocusOutside\"];\n\t/**\n\t * Callback fired when an interaction (pointerdown or focus) happens outside the bounds of the dismissable layer. Can be prevented.\n\t */\n\tonInteractOutside?: RadixContextMenuContentProps[\"onInteractOutside\"];\n}\n\nexport const ContextMenuContent = ContextMenuPrimitive.Content;\n\nexport interface ContextMenuItemProps\n\textends Omit<RadixContextMenuItemProps, \"disabled\" | \"onSelect\" | \"textValue\" | \"asChild\"> {\n\t/**\n\t * Disable the context menu item.\n\t * @default false\n\t */\n\tdisabled?: RadixContextMenuItemProps[\"disabled\"];\n\t/**\n\t * Event handler called when the context menu item is selected (via click or keyboard).\n\t */\n\tonSelect?: RadixContextMenuItemProps[\"onSelect\"];\n\t/**\n\t * Optional text used for typeahead navigation. By default typeahead uses item text content.\n\t */\n\ttextValue?: RadixContextMenuItemProps[\"textValue\"];\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * Item forwards ref to HTMLDivElement and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixContextMenuItemProps[\"asChild\"];\n}\n\nexport const ContextMenuItem = React.forwardRef<\n\tReact.ElementRef<typeof ContextMenuPrimitive.Item>,\n\tContextMenuItemProps\n>(({ className, ...props }, ref) => (\n\t<ContextMenuPrimitive.Item\n\t\tref={ref}\n\t\tclassName={overlayItemClass(\n\t\t\tcn(\n\t\t\t\t\"relative outline-hidden focus:bg-basalt-accent data-disabled:pointer-events-none data-disabled:opacity-50\",\n\t\t\t\tclassName,\n\t\t\t),\n\t\t)}\n\t\t{...props}\n\t/>\n));\nContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;\n\nexport interface ContextMenuPanelProps\n\textends Omit<ContextMenuContentProps, \"forceMount\">,\n\t\tPick<React.ComponentProps<typeof ContextMenuPrimitive.Content>, \"ref\"> {\n\t/**\n\t * Force mounting content in DOM for external animation controls.\n\t * When forceMount is true, the content remains mounted even when closed.\n\t * The caller is responsible for visibility transitions and unmounting after animation completes.\n\t * Note: Keeping modal content forceMounted may isolate background interactions until unmounted.\n\t */\n\tforceMount?: true;\n}\n\nexport function ContextMenuPanel({ className, ...props }: ContextMenuPanelProps) {\n\treturn (\n\t\t<ContextMenuPrimitive.Portal forceMount={props.forceMount}>\n\t\t\t<ContextMenuPrimitive.Content\n\t\t\t\tclassName={overlayPanelClass(cn(\"min-w-40\", className))}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</ContextMenuPrimitive.Portal>\n\t);\n}\n"],"mappings":";;;;;;;AAqCA,IAAaE,IAAcD,EAAqB,MAiBnCE,IAAqBF,EAAqB,SA8F1CG,IAAqBH,EAAqB,SAyB1CI,IAAkBL,EAAM,YAGlC,EAAE,cAAW,GAAGM,KAAS,MAC3B,kBAACL,EAAqB,MAAtB;CACM;CACL,WAAWM,EACVC,EACC,6GACAC,CACD,CACD;CACA,GAAIH;AACJ,CAAA,CACD;AACD,EAAgB,cAAcL,EAAqB,KAAK;AAcxD,SAAgBS,EAAiB,EAAE,cAAW,GAAGJ,KAAgC;CAChF,OACC,kBAACL,EAAqB,QAAtB;EAA6B,YAAYK,EAAM;EAC9C,UAAA,kBAACL,EAAqB,SAAtB;GACC,WAAWU,EAAkBH,EAAG,YAAYC,CAAS,CAAC;GACtD,GAAIH;EACJ,CAAA;CAC2B,CAAA;AAE/B"}
|