@bzync/rui 0.0.3
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/LICENSE +15 -0
- package/README.md +115 -0
- package/dist/autocomplete-CaysJRpk.cjs +1 -0
- package/dist/autocomplete-CfbfpcO4.js +453 -0
- package/dist/calendar-Bnld4G59.cjs +1 -0
- package/dist/calendar-CdICOROs.js +573 -0
- package/dist/charts-CxEy2c3M.js +1248 -0
- package/dist/charts-UDqS1BH1.cjs +1 -0
- package/dist/cn-BdjraxxU.cjs +1 -0
- package/dist/cn-DpgY2leY.js +1736 -0
- package/dist/component-styles-Ce56hn9T.js +16 -0
- package/dist/component-styles-TkZ7v6Ef.cjs +1 -0
- package/dist/components/accordion.cjs +1 -0
- package/dist/components/accordion.d.ts +22 -0
- package/dist/components/accordion.js +122 -0
- package/dist/components/alert.cjs +1 -0
- package/dist/components/alert.d.ts +13 -0
- package/dist/components/alert.js +165 -0
- package/dist/components/auth-backdrop.cjs +1 -0
- package/dist/components/auth-backdrop.d.ts +7 -0
- package/dist/components/auth-backdrop.js +10 -0
- package/dist/components/autocomplete/dropdown.d.ts +21 -0
- package/dist/components/autocomplete/icons.d.ts +8 -0
- package/dist/components/autocomplete/multi-trigger.d.ts +25 -0
- package/dist/components/autocomplete/single-trigger.d.ts +21 -0
- package/dist/components/autocomplete/types.d.ts +34 -0
- package/dist/components/autocomplete.cjs +1 -0
- package/dist/components/autocomplete.d.ts +5 -0
- package/dist/components/autocomplete.js +3 -0
- package/dist/components/avatar.cjs +1 -0
- package/dist/components/avatar.d.ts +17 -0
- package/dist/components/avatar.js +56 -0
- package/dist/components/badge.cjs +1 -0
- package/dist/components/badge.d.ts +12 -0
- package/dist/components/badge.js +32 -0
- package/dist/components/billing-interval-toggle.cjs +1 -0
- package/dist/components/billing-interval-toggle.d.ts +18 -0
- package/dist/components/billing-interval-toggle.js +39 -0
- package/dist/components/breadcrumb.cjs +1 -0
- package/dist/components/breadcrumb.d.ts +11 -0
- package/dist/components/breadcrumb.js +52 -0
- package/dist/components/button.cjs +1 -0
- package/dist/components/button.d.ts +17 -0
- package/dist/components/button.js +90 -0
- package/dist/components/calendar/month-view.d.ts +17 -0
- package/dist/components/calendar/types.d.ts +54 -0
- package/dist/components/calendar/week-view.d.ts +17 -0
- package/dist/components/calendar.cjs +1 -0
- package/dist/components/calendar.d.ts +3 -0
- package/dist/components/calendar.js +3 -0
- package/dist/components/callout.cjs +1 -0
- package/dist/components/callout.d.ts +9 -0
- package/dist/components/callout.js +131 -0
- package/dist/components/card.cjs +1 -0
- package/dist/components/card.d.ts +17 -0
- package/dist/components/card.js +59 -0
- package/dist/components/charts/bar-chart.d.ts +16 -0
- package/dist/components/charts/donut-chart.d.ts +10 -0
- package/dist/components/charts/funnel-chart.d.ts +8 -0
- package/dist/components/charts/gantt-chart.d.ts +15 -0
- package/dist/components/charts/heatmap-chart.d.ts +10 -0
- package/dist/components/charts/index.d.ts +11 -0
- package/dist/components/charts/line-chart.d.ts +16 -0
- package/dist/components/charts/multi-line-chart.d.ts +18 -0
- package/dist/components/charts/radar-chart.d.ts +13 -0
- package/dist/components/charts/scatter-chart.d.ts +24 -0
- package/dist/components/charts/shared.d.ts +15 -0
- package/dist/components/charts/waterfall-chart.d.ts +14 -0
- package/dist/components/charts.cjs +1 -0
- package/dist/components/charts.d.ts +2 -0
- package/dist/components/charts.js +2 -0
- package/dist/components/checkbox.cjs +1 -0
- package/dist/components/checkbox.d.ts +9 -0
- package/dist/components/checkbox.js +135 -0
- package/dist/components/code.cjs +7 -0
- package/dist/components/code.d.ts +23 -0
- package/dist/components/code.js +276 -0
- package/dist/components/command.cjs +1 -0
- package/dist/components/command.d.ts +29 -0
- package/dist/components/command.js +208 -0
- package/dist/components/confirm-dialog.cjs +1 -0
- package/dist/components/confirm-dialog.d.ts +14 -0
- package/dist/components/confirm-dialog.js +69 -0
- package/dist/components/copy-button.cjs +1 -0
- package/dist/components/copy-button.d.ts +8 -0
- package/dist/components/copy-button.js +87 -0
- package/dist/components/datatable/pagination-footer.d.ts +10 -0
- package/dist/components/datatable/rows-dropdown.d.ts +5 -0
- package/dist/components/datatable/skeleton-row.d.ts +3 -0
- package/dist/components/datatable/sort-icon.d.ts +4 -0
- package/dist/components/datatable/types.d.ts +30 -0
- package/dist/components/datatable.cjs +1 -0
- package/dist/components/datatable.d.ts +9 -0
- package/dist/components/datatable.js +3 -0
- package/dist/components/datepicker.cjs +1 -0
- package/dist/components/datepicker.d.ts +14 -0
- package/dist/components/datepicker.js +267 -0
- package/dist/components/drawer.cjs +1 -0
- package/dist/components/drawer.d.ts +18 -0
- package/dist/components/drawer.js +3 -0
- package/dist/components/dropdown-menu.cjs +1 -0
- package/dist/components/dropdown-menu.d.ts +26 -0
- package/dist/components/dropdown-menu.js +122 -0
- package/dist/components/empty-state.cjs +1 -0
- package/dist/components/empty-state.d.ts +10 -0
- package/dist/components/empty-state.js +68 -0
- package/dist/components/error-state.cjs +1 -0
- package/dist/components/error-state.d.ts +10 -0
- package/dist/components/error-state.js +80 -0
- package/dist/components/file-upload.cjs +1 -0
- package/dist/components/file-upload.d.ts +10 -0
- package/dist/components/file-upload.js +173 -0
- package/dist/components/form-field.cjs +1 -0
- package/dist/components/form-field.d.ts +10 -0
- package/dist/components/form-field.js +36 -0
- package/dist/components/info-button.cjs +1 -0
- package/dist/components/info-button.d.ts +4 -0
- package/dist/components/info-button.js +32 -0
- package/dist/components/input.cjs +1 -0
- package/dist/components/input.d.ts +19 -0
- package/dist/components/input.js +117 -0
- package/dist/components/kbd.cjs +1 -0
- package/dist/components/kbd.d.ts +6 -0
- package/dist/components/kbd.js +16 -0
- package/dist/components/label.cjs +1 -0
- package/dist/components/label.d.ts +6 -0
- package/dist/components/label.js +31 -0
- package/dist/components/layout.cjs +1 -0
- package/dist/components/layout.d.ts +51 -0
- package/dist/components/layout.js +117 -0
- package/dist/components/link.cjs +1 -0
- package/dist/components/link.d.ts +9 -0
- package/dist/components/link.js +48 -0
- package/dist/components/list.cjs +1 -0
- package/dist/components/list.d.ts +13 -0
- package/dist/components/list.js +46 -0
- package/dist/components/modal.cjs +1 -0
- package/dist/components/modal.d.ts +31 -0
- package/dist/components/modal.js +219 -0
- package/dist/components/navigation.cjs +1 -0
- package/dist/components/navigation.d.ts +42 -0
- package/dist/components/navigation.js +127 -0
- package/dist/components/number-input.cjs +1 -0
- package/dist/components/number-input.d.ts +16 -0
- package/dist/components/number-input.js +142 -0
- package/dist/components/otp-input.cjs +1 -0
- package/dist/components/otp-input.d.ts +13 -0
- package/dist/components/otp-input.js +71 -0
- package/dist/components/pagination.cjs +1 -0
- package/dist/components/pagination.d.ts +8 -0
- package/dist/components/pagination.js +77 -0
- package/dist/components/popover.cjs +1 -0
- package/dist/components/popover.d.ts +16 -0
- package/dist/components/popover.js +115 -0
- package/dist/components/progressbar.cjs +1 -0
- package/dist/components/progressbar.d.ts +15 -0
- package/dist/components/progressbar.js +108 -0
- package/dist/components/radio.cjs +1 -0
- package/dist/components/radio.d.ts +22 -0
- package/dist/components/radio.js +96 -0
- package/dist/components/richtext.cjs +1 -0
- package/dist/components/richtext.d.ts +10 -0
- package/dist/components/richtext.js +370 -0
- package/dist/components/select/option-list.d.ts +16 -0
- package/dist/components/select/select-multi.d.ts +2 -0
- package/dist/components/select/select-single.d.ts +2 -0
- package/dist/components/select/types.d.ts +54 -0
- package/dist/components/select/utils.d.ts +10 -0
- package/dist/components/select.cjs +1 -0
- package/dist/components/select.d.ts +3 -0
- package/dist/components/select.js +2 -0
- package/dist/components/seo.cjs +1 -0
- package/dist/components/seo.d.ts +45 -0
- package/dist/components/seo.js +64 -0
- package/dist/components/separator.cjs +1 -0
- package/dist/components/separator.d.ts +6 -0
- package/dist/components/separator.js +25 -0
- package/dist/components/skeleton.cjs +1 -0
- package/dist/components/skeleton.d.ts +37 -0
- package/dist/components/skeleton.js +146 -0
- package/dist/components/slider.cjs +1 -0
- package/dist/components/slider.d.ts +12 -0
- package/dist/components/slider.js +72 -0
- package/dist/components/snackbar.cjs +1 -0
- package/dist/components/snackbar.d.ts +35 -0
- package/dist/components/snackbar.js +220 -0
- package/dist/components/spinner.cjs +1 -0
- package/dist/components/spinner.d.ts +7 -0
- package/dist/components/spinner.js +31 -0
- package/dist/components/stat.cjs +1 -0
- package/dist/components/stat.d.ts +18 -0
- package/dist/components/stat.js +90 -0
- package/dist/components/status-dot.cjs +1 -0
- package/dist/components/status-dot.d.ts +10 -0
- package/dist/components/status-dot.js +29 -0
- package/dist/components/stepper.cjs +1 -0
- package/dist/components/stepper.d.ts +11 -0
- package/dist/components/stepper.js +67 -0
- package/dist/components/switch.cjs +1 -0
- package/dist/components/switch.d.ts +8 -0
- package/dist/components/switch.js +79 -0
- package/dist/components/table.cjs +1 -0
- package/dist/components/table.d.ts +12 -0
- package/dist/components/table.js +54 -0
- package/dist/components/tabs.cjs +1 -0
- package/dist/components/tabs.d.ts +22 -0
- package/dist/components/tabs.js +120 -0
- package/dist/components/tag.cjs +1 -0
- package/dist/components/tag.d.ts +12 -0
- package/dist/components/tag.js +58 -0
- package/dist/components/terminal/fs.d.ts +10 -0
- package/dist/components/terminal/shell-commands-sim.d.ts +5 -0
- package/dist/components/terminal/shell-commands.d.ts +16 -0
- package/dist/components/terminal/shell-run.d.ts +11 -0
- package/dist/components/terminal/terminal-block.d.ts +13 -0
- package/dist/components/terminal/terminal-emulator.d.ts +10 -0
- package/dist/components/terminal/types.d.ts +35 -0
- package/dist/components/terminal.cjs +1 -0
- package/dist/components/terminal.d.ts +2 -0
- package/dist/components/terminal.js +2 -0
- package/dist/components/textarea.cjs +1 -0
- package/dist/components/textarea.d.ts +13 -0
- package/dist/components/textarea.js +54 -0
- package/dist/components/theme-provider.cjs +1 -0
- package/dist/components/theme-provider.d.ts +89 -0
- package/dist/components/theme-provider.js +93 -0
- package/dist/components/theme-toggle.cjs +1 -0
- package/dist/components/theme-toggle.d.ts +9 -0
- package/dist/components/theme-toggle.js +4 -0
- package/dist/components/timeline.cjs +1 -0
- package/dist/components/timeline.d.ts +14 -0
- package/dist/components/timeline.js +54 -0
- package/dist/components/tooltip.cjs +1 -0
- package/dist/components/tooltip.d.ts +11 -0
- package/dist/components/tooltip.js +84 -0
- package/dist/components/tree.cjs +1 -0
- package/dist/components/tree.d.ts +16 -0
- package/dist/components/tree.js +92 -0
- package/dist/createLucideIcon-DDY8HuQR.js +42 -0
- package/dist/createLucideIcon-b_X_3fj-.cjs +1 -0
- package/dist/datatable-BB3v__r5.cjs +1 -0
- package/dist/datatable-DlBhUhuO.js +316 -0
- package/dist/drawer-Cbuh6qdL.cjs +1 -0
- package/dist/drawer-CqkVZT9Y.js +189 -0
- package/dist/focus-Dk1YWVPN.js +42 -0
- package/dist/focus-DmG6Ge7X.cjs +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.js +215 -0
- package/dist/lib/cn.d.ts +2 -0
- package/dist/lib/component-styles.d.ts +10 -0
- package/dist/select-Ch5fp1GT.js +461 -0
- package/dist/select-q0YCMhBP.cjs +1 -0
- package/dist/styles.css +3 -0
- package/dist/terminal-BOR2cFi1.js +1060 -0
- package/dist/terminal-CpraMs50.cjs +77 -0
- package/dist/theme-toggle-CnoiorKV.js +71 -0
- package/dist/theme-toggle-Dp1-24zH.cjs +1 -0
- package/dist/use-event-callback-DGkfO_uu.js +10 -0
- package/dist/use-event-callback-Du9_9eAi.cjs +1 -0
- package/dist/utils-CQ8pvCtk.js +72 -0
- package/dist/utils-DOFJTw8o.cjs +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface HeatmapChartProps {
|
|
2
|
+
data: number[][];
|
|
3
|
+
rowLabels?: string[];
|
|
4
|
+
colLabels?: string[];
|
|
5
|
+
color?: string;
|
|
6
|
+
cellSize?: number;
|
|
7
|
+
className?: string;
|
|
8
|
+
formatValue?: (v: number) => string;
|
|
9
|
+
}
|
|
10
|
+
export declare function HeatmapChart({ data, rowLabels, colLabels, color, cellSize, className, formatValue, }: HeatmapChartProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type { ChartDataPoint } from './shared';
|
|
2
|
+
export * from './bar-chart';
|
|
3
|
+
export * from './line-chart';
|
|
4
|
+
export * from './multi-line-chart';
|
|
5
|
+
export * from './donut-chart';
|
|
6
|
+
export * from './scatter-chart';
|
|
7
|
+
export * from './gantt-chart';
|
|
8
|
+
export * from './heatmap-chart';
|
|
9
|
+
export * from './radar-chart';
|
|
10
|
+
export * from './funnel-chart';
|
|
11
|
+
export * from './waterfall-chart';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ChartDataPoint } from './shared';
|
|
2
|
+
export interface LineChartProps {
|
|
3
|
+
data: ChartDataPoint[];
|
|
4
|
+
height?: number;
|
|
5
|
+
color?: string;
|
|
6
|
+
area?: boolean;
|
|
7
|
+
dots?: boolean;
|
|
8
|
+
gridLines?: number;
|
|
9
|
+
className?: string;
|
|
10
|
+
formatValue?: (v: number) => string;
|
|
11
|
+
smooth?: boolean;
|
|
12
|
+
showXLabels?: boolean;
|
|
13
|
+
/** Max number of x-axis labels to show before thinning them out evenly. Default 8. */
|
|
14
|
+
maxLabels?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare function LineChart({ data, height, color, area, dots, gridLines, className, formatValue, smooth, showXLabels, maxLabels, }: LineChartProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface MultiLineSeries {
|
|
2
|
+
label: string;
|
|
3
|
+
color?: string;
|
|
4
|
+
data: number[];
|
|
5
|
+
}
|
|
6
|
+
export interface MultiLineChartProps {
|
|
7
|
+
labels: string[];
|
|
8
|
+
series: MultiLineSeries[];
|
|
9
|
+
height?: number;
|
|
10
|
+
area?: boolean;
|
|
11
|
+
dots?: boolean;
|
|
12
|
+
gridLines?: number;
|
|
13
|
+
className?: string;
|
|
14
|
+
formatValue?: (v: number) => string;
|
|
15
|
+
/** Max number of x-axis labels to show before thinning them out evenly. Default 8. */
|
|
16
|
+
maxLabels?: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function MultiLineChart({ labels, series, height, area, dots, gridLines, className, formatValue, maxLabels, }: MultiLineChartProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface RadarSeries {
|
|
2
|
+
label: string;
|
|
3
|
+
color?: string;
|
|
4
|
+
data: number[];
|
|
5
|
+
}
|
|
6
|
+
export interface RadarChartProps {
|
|
7
|
+
axes: string[];
|
|
8
|
+
series: RadarSeries[];
|
|
9
|
+
size?: number;
|
|
10
|
+
gridLines?: number;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function RadarChart({ axes, series, size, gridLines, className, }: RadarChartProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface ScatterPoint {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
/** Dot radius multiplier (0.5–2). Default 1. */
|
|
5
|
+
r?: number;
|
|
6
|
+
label?: string;
|
|
7
|
+
color?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ScatterSeries {
|
|
10
|
+
label: string;
|
|
11
|
+
color?: string;
|
|
12
|
+
data: ScatterPoint[];
|
|
13
|
+
}
|
|
14
|
+
export interface ScatterChartProps {
|
|
15
|
+
series: ScatterSeries[];
|
|
16
|
+
height?: number;
|
|
17
|
+
xLabel?: string;
|
|
18
|
+
yLabel?: string;
|
|
19
|
+
gridLines?: number;
|
|
20
|
+
className?: string;
|
|
21
|
+
formatX?: (v: number) => string;
|
|
22
|
+
formatY?: (v: number) => string;
|
|
23
|
+
}
|
|
24
|
+
export declare function ScatterChart({ series, height, xLabel, gridLines, className, formatX, formatY, }: ScatterChartProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface ChartDataPoint {
|
|
3
|
+
label: string;
|
|
4
|
+
value: number;
|
|
5
|
+
color?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface TooltipState {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
content: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare function visibleLabelAt(n: number, max: number): (i: number) => boolean;
|
|
13
|
+
export declare function ChartTooltip({ tooltip }: {
|
|
14
|
+
tooltip: TooltipState | null;
|
|
15
|
+
}): import('react').ReactPortal | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface WaterfallItem {
|
|
2
|
+
label: string;
|
|
3
|
+
value: number;
|
|
4
|
+
/** If true, renders as a full summary bar from zero. */
|
|
5
|
+
total?: boolean;
|
|
6
|
+
color?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface WaterfallChartProps {
|
|
9
|
+
data: WaterfallItem[];
|
|
10
|
+
height?: number;
|
|
11
|
+
className?: string;
|
|
12
|
+
formatValue?: (v: number) => string;
|
|
13
|
+
}
|
|
14
|
+
export declare function WaterfallChart({ data, height, className, formatValue, }: WaterfallChartProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../charts-UDqS1BH1.cjs");exports.BarChart=e.u,exports.DonutChart=e.s,exports.FunnelChart=e.n,exports.GanttChart=e.a,exports.HeatmapChart=e.i,exports.LineChart=e.l,exports.MultiLineChart=e.c,exports.RadarChart=e.r,exports.ScatterChart=e.o,exports.WaterfallChart=e.t;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "../charts-CxEy2c3M.js";
|
|
2
|
+
export { l as BarChart, s as DonutChart, i as FunnelChart, e as GanttChart, n as HeatmapChart, r as LineChart, t as MultiLineChart, o as RadarChart, a as ScatterChart, c as WaterfallChart };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-BdjraxxU.cjs");require("../component-styles-TkZ7v6Ef.cjs");let t=require("framer-motion"),n=require("react"),r=require("react/jsx-runtime");var i={sm:{box:`w-3.5 h-3.5 rounded`,check:10,label:`text-xs`,desc:`text-[10px]`},md:{box:`w-4 h-4 rounded-[4px]`,check:11,label:`text-sm`,desc:`text-xs`},lg:{box:`w-5 h-5 rounded-md`,check:13,label:`text-sm`,desc:`text-xs`}},a=(0,n.forwardRef)(({className:a,label:o,description:s,size:c=`md`,checked:l,defaultChecked:u,indeterminate:d=!1,onChange:f,disabled:p,error:m,id:h,...g},_)=>{let[v,y]=(0,n.useState)(l===void 0?u??!1:l);(0,n.useEffect)(()=>{l!==void 0&&y(l)},[l]);let b=(0,n.useId)(),x=h??b,S=`${x}-message`,C=(0,n.useRef)(null),w=i[c],T=v||d;return(0,n.useEffect)(()=>{C.current&&(C.current.indeterminate=d)},[d]),(0,r.jsxs)(`div`,{className:e.t(`flex flex-col gap-1`,a),children:[(0,r.jsxs)(`label`,{htmlFor:x,className:e.t(`flex items-start gap-2.5 cursor-pointer`,p&&`cursor-not-allowed opacity-50`),children:[(0,r.jsxs)(`div`,{className:e.t(`relative mt-0.5 shrink-0`,w.box),children:[(0,r.jsx)(`input`,{ref:e=>{C.current=e,typeof _==`function`?_(e):_&&(_.current=e)},type:`checkbox`,id:x,className:`peer absolute inset-0 z-10 h-full w-full cursor-pointer opacity-0 disabled:cursor-not-allowed`,"aria-invalid":m?!0:void 0,"aria-describedby":m||s?S:void 0,"aria-checked":d?`mixed`:v,checked:v,disabled:p,onChange:e=>{l===void 0&&y(e.target.checked),f?.(e)},...g}),(0,r.jsx)(`div`,{className:e.t(`w-full h-full border-2 flex items-center justify-center transition-colors duration-[120ms] peer-focus-visible:ring-2 peer-focus-visible:ring-focus-ring/35 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-bg`,w.box,T?`bg-accent-600 border-accent-600 dark:bg-accent-500 dark:border-accent-500`:m?`bg-transparent border-red-500/50`:`bg-transparent border-black/25 dark:border-white/25`),children:(0,r.jsx)(t.AnimatePresence,{mode:`wait`,children:d?(0,r.jsx)(t.motion.svg,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:{duration:.1},width:w.check,height:w.check,viewBox:`0 0 14 14`,fill:`none`,stroke:`white`,strokeWidth:`2.5`,strokeLinecap:`round`,children:(0,r.jsx)(`path`,{d:`M3 7h8`})},`minus`):v?(0,r.jsx)(t.motion.svg,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:{type:`spring`,stiffness:600,damping:30},width:w.check,height:w.check,viewBox:`0 0 14 14`,fill:`none`,stroke:`white`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,r.jsx)(`path`,{d:`M2.5 7l3 3 6-6`})},`check`):null})})]}),(o||s)&&(0,r.jsxs)(`div`,{className:`min-w-0`,children:[o&&(0,r.jsx)(`p`,{className:e.t(`font-medium text-foreground leading-snug`,w.label),children:o}),s&&(0,r.jsx)(`p`,{id:m?void 0:S,className:e.t(`mt-0.5 text-muted-foreground`,w.desc),children:s})]})]}),m&&(0,r.jsx)(`p`,{id:S,"aria-live":`polite`,className:e.t(`text-xs leading-5 text-destructive`,`ml-[26px]`),children:m})]})});a.displayName=`Checkbox`,exports.Checkbox=a;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from 'react';
|
|
2
|
+
export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size"> {
|
|
3
|
+
label?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
size?: "sm" | "md" | "lg";
|
|
6
|
+
indeterminate?: boolean;
|
|
7
|
+
error?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const Checkbox: import('react').ForwardRefExoticComponent<CheckboxProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as e } from "../cn-DpgY2leY.js";
|
|
3
|
+
import "../component-styles-Ce56hn9T.js";
|
|
4
|
+
import { AnimatePresence as t, motion as n } from "framer-motion";
|
|
5
|
+
import { forwardRef as r, useEffect as i, useId as a, useRef as o, useState as s } from "react";
|
|
6
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/checkbox.tsx
|
|
8
|
+
var u = {
|
|
9
|
+
sm: {
|
|
10
|
+
box: "w-3.5 h-3.5 rounded",
|
|
11
|
+
check: 10,
|
|
12
|
+
label: "text-xs",
|
|
13
|
+
desc: "text-[10px]"
|
|
14
|
+
},
|
|
15
|
+
md: {
|
|
16
|
+
box: "w-4 h-4 rounded-[4px]",
|
|
17
|
+
check: 11,
|
|
18
|
+
label: "text-sm",
|
|
19
|
+
desc: "text-xs"
|
|
20
|
+
},
|
|
21
|
+
lg: {
|
|
22
|
+
box: "w-5 h-5 rounded-md",
|
|
23
|
+
check: 13,
|
|
24
|
+
label: "text-sm",
|
|
25
|
+
desc: "text-xs"
|
|
26
|
+
}
|
|
27
|
+
}, d = r(({ className: r, label: d, description: f, size: p = "md", checked: m, defaultChecked: h, indeterminate: g = !1, onChange: _, disabled: v, error: y, id: b, ...x }, S) => {
|
|
28
|
+
let [C, w] = s(m === void 0 ? h ?? !1 : m);
|
|
29
|
+
i(() => {
|
|
30
|
+
m !== void 0 && w(m);
|
|
31
|
+
}, [m]);
|
|
32
|
+
let T = a(), E = b ?? T, D = `${E}-message`, O = o(null), k = u[p], A = C || g;
|
|
33
|
+
return i(() => {
|
|
34
|
+
O.current && (O.current.indeterminate = g);
|
|
35
|
+
}, [g]), /* @__PURE__ */ l("div", {
|
|
36
|
+
className: e("flex flex-col gap-1", r),
|
|
37
|
+
children: [/* @__PURE__ */ l("label", {
|
|
38
|
+
htmlFor: E,
|
|
39
|
+
className: e("flex items-start gap-2.5 cursor-pointer", v && "cursor-not-allowed opacity-50"),
|
|
40
|
+
children: [/* @__PURE__ */ l("div", {
|
|
41
|
+
className: e("relative mt-0.5 shrink-0", k.box),
|
|
42
|
+
children: [/* @__PURE__ */ c("input", {
|
|
43
|
+
ref: (e) => {
|
|
44
|
+
O.current = e, typeof S == "function" ? S(e) : S && (S.current = e);
|
|
45
|
+
},
|
|
46
|
+
type: "checkbox",
|
|
47
|
+
id: E,
|
|
48
|
+
className: "peer absolute inset-0 z-10 h-full w-full cursor-pointer opacity-0 disabled:cursor-not-allowed",
|
|
49
|
+
"aria-invalid": y ? !0 : void 0,
|
|
50
|
+
"aria-describedby": y || f ? D : void 0,
|
|
51
|
+
"aria-checked": g ? "mixed" : C,
|
|
52
|
+
checked: C,
|
|
53
|
+
disabled: v,
|
|
54
|
+
onChange: (e) => {
|
|
55
|
+
m === void 0 && w(e.target.checked), _?.(e);
|
|
56
|
+
},
|
|
57
|
+
...x
|
|
58
|
+
}), /* @__PURE__ */ c("div", {
|
|
59
|
+
className: e("w-full h-full border-2 flex items-center justify-center transition-colors duration-[120ms] peer-focus-visible:ring-2 peer-focus-visible:ring-focus-ring/35 peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-bg", k.box, A ? "bg-accent-600 border-accent-600 dark:bg-accent-500 dark:border-accent-500" : y ? "bg-transparent border-red-500/50" : "bg-transparent border-black/25 dark:border-white/25"),
|
|
60
|
+
children: /* @__PURE__ */ c(t, {
|
|
61
|
+
mode: "wait",
|
|
62
|
+
children: g ? /* @__PURE__ */ c(n.svg, {
|
|
63
|
+
initial: {
|
|
64
|
+
scale: 0,
|
|
65
|
+
opacity: 0
|
|
66
|
+
},
|
|
67
|
+
animate: {
|
|
68
|
+
scale: 1,
|
|
69
|
+
opacity: 1
|
|
70
|
+
},
|
|
71
|
+
exit: {
|
|
72
|
+
scale: 0,
|
|
73
|
+
opacity: 0
|
|
74
|
+
},
|
|
75
|
+
transition: { duration: .1 },
|
|
76
|
+
width: k.check,
|
|
77
|
+
height: k.check,
|
|
78
|
+
viewBox: "0 0 14 14",
|
|
79
|
+
fill: "none",
|
|
80
|
+
stroke: "white",
|
|
81
|
+
strokeWidth: "2.5",
|
|
82
|
+
strokeLinecap: "round",
|
|
83
|
+
children: /* @__PURE__ */ c("path", { d: "M3 7h8" })
|
|
84
|
+
}, "minus") : C ? /* @__PURE__ */ c(n.svg, {
|
|
85
|
+
initial: {
|
|
86
|
+
scale: 0,
|
|
87
|
+
opacity: 0
|
|
88
|
+
},
|
|
89
|
+
animate: {
|
|
90
|
+
scale: 1,
|
|
91
|
+
opacity: 1
|
|
92
|
+
},
|
|
93
|
+
exit: {
|
|
94
|
+
scale: 0,
|
|
95
|
+
opacity: 0
|
|
96
|
+
},
|
|
97
|
+
transition: {
|
|
98
|
+
type: "spring",
|
|
99
|
+
stiffness: 600,
|
|
100
|
+
damping: 30
|
|
101
|
+
},
|
|
102
|
+
width: k.check,
|
|
103
|
+
height: k.check,
|
|
104
|
+
viewBox: "0 0 14 14",
|
|
105
|
+
fill: "none",
|
|
106
|
+
stroke: "white",
|
|
107
|
+
strokeWidth: "2.5",
|
|
108
|
+
strokeLinecap: "round",
|
|
109
|
+
strokeLinejoin: "round",
|
|
110
|
+
children: /* @__PURE__ */ c("path", { d: "M2.5 7l3 3 6-6" })
|
|
111
|
+
}, "check") : null
|
|
112
|
+
})
|
|
113
|
+
})]
|
|
114
|
+
}), (d || f) && /* @__PURE__ */ l("div", {
|
|
115
|
+
className: "min-w-0",
|
|
116
|
+
children: [d && /* @__PURE__ */ c("p", {
|
|
117
|
+
className: e("font-medium text-foreground leading-snug", k.label),
|
|
118
|
+
children: d
|
|
119
|
+
}), f && /* @__PURE__ */ c("p", {
|
|
120
|
+
id: y ? void 0 : D,
|
|
121
|
+
className: e("mt-0.5 text-muted-foreground", k.desc),
|
|
122
|
+
children: f
|
|
123
|
+
})]
|
|
124
|
+
})]
|
|
125
|
+
}), y && /* @__PURE__ */ c("p", {
|
|
126
|
+
id: D,
|
|
127
|
+
"aria-live": "polite",
|
|
128
|
+
className: e("text-xs leading-5 text-destructive", "ml-[26px]"),
|
|
129
|
+
children: y
|
|
130
|
+
})]
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
d.displayName = "Checkbox";
|
|
134
|
+
//#endregion
|
|
135
|
+
export { d as Checkbox };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-BdjraxxU.cjs");let t=require("react"),n=require("react/jsx-runtime");var r={js:`const.let.var.function.return.if.else.for.while.class.import.export.default.from.async.await.new.typeof.instanceof.true.false.null.undefined.throw.try.catch.finally.switch.case.break.continue.extends.super.this.of.in.delete.void`.split(`.`),python:`def.return.if.else.elif.for.while.class.import.from.as.with.try.except.finally.raise.pass.break.continue.and.or.not.in.is.True.False.None.lambda.yield.global.nonlocal.del.print.async.await`.split(`.`),bash:[`if`,`then`,`else`,`elif`,`fi`,`for`,`do`,`done`,`while`,`case`,`esac`,`in`,`function`,`return`,`exit`,`echo`,`export`,`source`,`local`,`readonly`],sql:`SELECT.FROM.WHERE.AND.OR.NOT.INSERT.INTO.VALUES.UPDATE.SET.DELETE.CREATE.TABLE.DROP.ALTER.INDEX.JOIN.INNER.LEFT.RIGHT.ON.GROUP.BY.ORDER.HAVING.LIMIT.OFFSET.AS.DISTINCT.COUNT.SUM.AVG.MAX.MIN.NULL.IS.IN.LIKE.BETWEEN.EXISTS`.split(`.`)};r.ts=r.js,r.tsx=r.js,r.jsx=r.js,r.json=[];function i(e,t){let n=new Set(r[t.toLowerCase()]??r.js),i=[],a=0;for(;a<e.length;){if(t===`bash`&&e[a]===`#`||e.slice(a,a+2)===`//`&&t!==`bash`){let t=e.indexOf(`
|
|
2
|
+
`,a),n=t===-1?e.slice(a):e.slice(a,t);i.push({type:`comment`,value:n}),a+=n.length;continue}if(e.slice(a,a+2)===`/*`){let t=e.indexOf(`*/`,a+2),n=t===-1?e.slice(a):e.slice(a,t+2);i.push({type:`comment`,value:n}),a+=n.length;continue}if(e[a]===`#`&&(t===`python`||t===`sql`)){let t=e.indexOf(`
|
|
3
|
+
`,a),n=t===-1?e.slice(a):e.slice(a,t);i.push({type:`comment`,value:n}),a+=n.length;continue}if(e[a]===`"`||e[a]===`'`||e[a]==="`"){let t=e[a],n=a+1;for(;n<e.length;){if(e[n]===`\\`&&n+1<e.length){n+=2;continue}if(e[n]===t){n++;break}n++}i.push({type:`string`,value:e.slice(a,n)}),a=n;continue}if(/[0-9]/.test(e[a])||e[a]===`.`&&/[0-9]/.test(e[a+1]??``)){let t=a;for(;t<e.length&&/[0-9._xXa-fA-F]/.test(e[t]);)t++;i.push({type:`number`,value:e.slice(a,t)}),a=t;continue}if(/[a-zA-Z_$]/.test(e[a])){let t=a;for(;t<e.length&&/[a-zA-Z0-9_$]/.test(e[t]);)t++;let r=e.slice(a,t);i.push({type:n.has(r)?`keyword`:`plain`,value:r}),a=t;continue}if(/[=<>!&|+\-*/%^~?:,;.()[\]{}]/.test(e[a])){i.push({type:`operator`,value:e[a]}),a++;continue}i.push({type:`plain`,value:e[a]}),a++}return i}var a={keyword:`text-violet-500 dark:text-violet-400`,string:`text-emerald-600 dark:text-emerald-400`,comment:`text-slate-400 dark:text-slate-500 italic`,number:`text-amber-600 dark:text-amber-400`,operator:`text-slate-500 dark:text-slate-400`,builtin:`text-sky-500 dark:text-sky-400`,plain:`text-slate-800 dark:text-slate-200`};function o({code:r,language:o=`js`,filename:s,showLineNumbers:c=!1,className:l}){let[u,d]=(0,t.useState)(!1),f=r.replace(/^\n/,``).replace(/\n$/,``),p=f.split(`
|
|
4
|
+
`);async function m(){let e=!1;try{if(!navigator.clipboard?.writeText)throw Error(`Clipboard API unavailable`);await navigator.clipboard.writeText(f),e=!0}catch{let t=document.createElement(`textarea`);t.value=f,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),e=document.execCommand(`copy`),t.remove()}e&&(d(!0),window.setTimeout(()=>d(!1),1500))}return(0,n.jsxs)(`div`,{className:e.t(`group relative rounded-xl overflow-hidden border border-black/10 dark:border-white/10 bg-slate-50 dark:bg-[#0d1117]`,l),children:[(0,n.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2.5 border-b border-black/[0.07] dark:border-white/[0.07] bg-black/3 dark:bg-white/3`,children:[(0,n.jsx)(`div`,{className:`flex items-center gap-2`,children:s&&(0,n.jsx)(`span`,{className:`text-xs font-mono text-slate-500 dark:text-slate-400`,children:s})}),(0,n.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!s&&(0,n.jsx)(`span`,{className:`text-xs font-mono text-slate-400 dark:text-slate-500 uppercase`,children:o}),(0,n.jsx)(`button`,{type:`button`,onClick:m,"aria-label":u?`Copied code`:`Copy code`,className:`h-6 px-2 flex items-center gap-1 rounded text-xs text-slate-500 dark:text-slate-400 hover:text-gray-900 dark:hover:text-white hover:bg-black/6 dark:hover:bg-white/8 transition-colors`,children:u?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,n.jsx)(`path`,{d:`M20 6 9 17l-5-5`})}),`Copied`]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(`svg`,{width:`11`,height:`11`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,n.jsx)(`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}),(0,n.jsx)(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})]}),`Copy`]})})]})]}),(0,n.jsx)(`div`,{className:`overflow-x-auto`,children:(0,n.jsx)(`table`,{className:`w-full border-collapse text-sm font-mono leading-6`,children:(0,n.jsx)(`tbody`,{children:p.map((e,t)=>(0,n.jsxs)(`tr`,{className:`hover:bg-black/3 dark:hover:bg-white/3`,children:[c&&(0,n.jsx)(`td`,{className:`select-none w-10 pr-4 pl-4 text-right text-slate-400 dark:text-slate-600 border-r border-black/6 dark:border-white/6`,children:t+1}),(0,n.jsx)(`td`,{className:`px-4 py-0 whitespace-pre`,children:i(e,o).map((e,t)=>(0,n.jsx)(`span`,{className:a[e.type],children:e.value},t))})]},t))})})})]})}function s({children:t,className:r}){return(0,n.jsx)(`code`,{className:e.t(`font-mono text-[0.85em] px-1.5 py-0.5 rounded-md bg-black/6 dark:bg-white/8 border border-black/[0.07] dark:border-white/[0.07] text-slate-700 dark:text-slate-300`,r),children:t})}function c({value:r,onChange:i,language:a=`js`,placeholder:o=`// Start typing…`,minRows:s=6,maxRows:c=24,readOnly:l=!1,className:u}){let d=(0,t.useRef)(null),f=Math.min(c,Math.max(s,r.split(`
|
|
5
|
+
`).length));function p(e){let t=e.currentTarget,{selectionStart:n,selectionEnd:a}=t;if(e.key===`Tab`){e.preventDefault();let o=r.slice(0,n)+` `+r.slice(a);i?.(o),requestAnimationFrame(()=>{t.selectionStart=t.selectionEnd=n+2})}if(e.key===`Enter`){let o=r.lastIndexOf(`
|
|
6
|
+
`,n-1)+1,s=r.slice(o).match(/^(\s*)/)?.[1]??``;e.preventDefault();let c=r.slice(0,n)+`
|
|
7
|
+
`+s+r.slice(a);i?.(c),requestAnimationFrame(()=>{t.selectionStart=t.selectionEnd=n+1+s.length})}let o={"(":`)`,"[":`]`,"{":`}`,'"':`"`,"'":`'`,"`":"`"};if(o[e.key]&&n===a){e.preventDefault();let s=r.slice(0,n)+e.key+o[e.key]+r.slice(a);i?.(s),requestAnimationFrame(()=>{t.selectionStart=t.selectionEnd=n+1})}}return(0,n.jsxs)(`div`,{className:e.t(`relative rounded-xl overflow-hidden border border-black/10 dark:border-white/10 bg-slate-50 dark:bg-[#0d1117]`,u),children:[(0,n.jsx)(`div`,{className:`flex items-center gap-1.5 px-4 py-2.5 border-b border-black/[0.07] dark:border-white/[0.07] bg-black/3 dark:bg-white/3`,children:(0,n.jsx)(`span`,{className:`text-xs font-mono text-slate-400 dark:text-slate-500 uppercase`,children:a})}),(0,n.jsxs)(`div`,{className:`relative flex`,children:[(0,n.jsx)(`div`,{className:`select-none shrink-0 py-3 px-3 text-right text-sm font-mono leading-6 text-slate-400 dark:text-slate-600 border-r border-black/6 dark:border-white/6 bg-black/2 dark:bg-black/20`,"aria-hidden":!0,children:Array.from({length:f},(e,t)=>(0,n.jsx)(`div`,{children:t+1},t))}),(0,n.jsx)(`textarea`,{ref:d,value:r,onChange:e=>i?.(e.target.value),onKeyDown:p,readOnly:l,placeholder:o,spellCheck:!1,rows:f,className:`flex-1 py-3 px-4 text-sm font-mono leading-6 bg-transparent text-slate-800 dark:text-slate-200 placeholder:text-slate-400 dark:placeholder:text-slate-600 focus:outline-none resize-none`})]})]})}exports.CodeBlock=o,exports.CodeEditor=c,exports.InlineCode=s;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface CodeBlockProps {
|
|
2
|
+
code: string;
|
|
3
|
+
language?: string;
|
|
4
|
+
filename?: string;
|
|
5
|
+
showLineNumbers?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function CodeBlock({ code, language, filename, showLineNumbers, className }: CodeBlockProps): import("react").JSX.Element;
|
|
9
|
+
export declare function InlineCode({ children, className }: {
|
|
10
|
+
children: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
13
|
+
export interface CodeEditorProps {
|
|
14
|
+
value: string;
|
|
15
|
+
onChange?: (value: string) => void;
|
|
16
|
+
language?: string;
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
minRows?: number;
|
|
19
|
+
maxRows?: number;
|
|
20
|
+
readOnly?: boolean;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function CodeEditor({ value, onChange, language, placeholder, minRows, maxRows, readOnly, className, }: CodeEditorProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as e } from "../cn-DpgY2leY.js";
|
|
3
|
+
import { useRef as t, useState as n } from "react";
|
|
4
|
+
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/code.tsx
|
|
6
|
+
var o = {
|
|
7
|
+
js: /* @__PURE__ */ "const.let.var.function.return.if.else.for.while.class.import.export.default.from.async.await.new.typeof.instanceof.true.false.null.undefined.throw.try.catch.finally.switch.case.break.continue.extends.super.this.of.in.delete.void".split("."),
|
|
8
|
+
python: /* @__PURE__ */ "def.return.if.else.elif.for.while.class.import.from.as.with.try.except.finally.raise.pass.break.continue.and.or.not.in.is.True.False.None.lambda.yield.global.nonlocal.del.print.async.await".split("."),
|
|
9
|
+
bash: [
|
|
10
|
+
"if",
|
|
11
|
+
"then",
|
|
12
|
+
"else",
|
|
13
|
+
"elif",
|
|
14
|
+
"fi",
|
|
15
|
+
"for",
|
|
16
|
+
"do",
|
|
17
|
+
"done",
|
|
18
|
+
"while",
|
|
19
|
+
"case",
|
|
20
|
+
"esac",
|
|
21
|
+
"in",
|
|
22
|
+
"function",
|
|
23
|
+
"return",
|
|
24
|
+
"exit",
|
|
25
|
+
"echo",
|
|
26
|
+
"export",
|
|
27
|
+
"source",
|
|
28
|
+
"local",
|
|
29
|
+
"readonly"
|
|
30
|
+
],
|
|
31
|
+
sql: /* @__PURE__ */ "SELECT.FROM.WHERE.AND.OR.NOT.INSERT.INTO.VALUES.UPDATE.SET.DELETE.CREATE.TABLE.DROP.ALTER.INDEX.JOIN.INNER.LEFT.RIGHT.ON.GROUP.BY.ORDER.HAVING.LIMIT.OFFSET.AS.DISTINCT.COUNT.SUM.AVG.MAX.MIN.NULL.IS.IN.LIKE.BETWEEN.EXISTS".split(".")
|
|
32
|
+
};
|
|
33
|
+
o.ts = o.js, o.tsx = o.js, o.jsx = o.js, o.json = [];
|
|
34
|
+
function s(e, t) {
|
|
35
|
+
let n = new Set(o[t.toLowerCase()] ?? o.js), r = [], i = 0;
|
|
36
|
+
for (; i < e.length;) {
|
|
37
|
+
if (t === "bash" && e[i] === "#" || e.slice(i, i + 2) === "//" && t !== "bash") {
|
|
38
|
+
let t = e.indexOf("\n", i), n = t === -1 ? e.slice(i) : e.slice(i, t);
|
|
39
|
+
r.push({
|
|
40
|
+
type: "comment",
|
|
41
|
+
value: n
|
|
42
|
+
}), i += n.length;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (e.slice(i, i + 2) === "/*") {
|
|
46
|
+
let t = e.indexOf("*/", i + 2), n = t === -1 ? e.slice(i) : e.slice(i, t + 2);
|
|
47
|
+
r.push({
|
|
48
|
+
type: "comment",
|
|
49
|
+
value: n
|
|
50
|
+
}), i += n.length;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (e[i] === "#" && (t === "python" || t === "sql")) {
|
|
54
|
+
let t = e.indexOf("\n", i), n = t === -1 ? e.slice(i) : e.slice(i, t);
|
|
55
|
+
r.push({
|
|
56
|
+
type: "comment",
|
|
57
|
+
value: n
|
|
58
|
+
}), i += n.length;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (e[i] === "\"" || e[i] === "'" || e[i] === "`") {
|
|
62
|
+
let t = e[i], n = i + 1;
|
|
63
|
+
for (; n < e.length;) {
|
|
64
|
+
if (e[n] === "\\" && n + 1 < e.length) {
|
|
65
|
+
n += 2;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (e[n] === t) {
|
|
69
|
+
n++;
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
n++;
|
|
73
|
+
}
|
|
74
|
+
r.push({
|
|
75
|
+
type: "string",
|
|
76
|
+
value: e.slice(i, n)
|
|
77
|
+
}), i = n;
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (/[0-9]/.test(e[i]) || e[i] === "." && /[0-9]/.test(e[i + 1] ?? "")) {
|
|
81
|
+
let t = i;
|
|
82
|
+
for (; t < e.length && /[0-9._xXa-fA-F]/.test(e[t]);) t++;
|
|
83
|
+
r.push({
|
|
84
|
+
type: "number",
|
|
85
|
+
value: e.slice(i, t)
|
|
86
|
+
}), i = t;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (/[a-zA-Z_$]/.test(e[i])) {
|
|
90
|
+
let t = i;
|
|
91
|
+
for (; t < e.length && /[a-zA-Z0-9_$]/.test(e[t]);) t++;
|
|
92
|
+
let a = e.slice(i, t);
|
|
93
|
+
r.push({
|
|
94
|
+
type: n.has(a) ? "keyword" : "plain",
|
|
95
|
+
value: a
|
|
96
|
+
}), i = t;
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
if (/[=<>!&|+\-*/%^~?:,;.()[\]{}]/.test(e[i])) {
|
|
100
|
+
r.push({
|
|
101
|
+
type: "operator",
|
|
102
|
+
value: e[i]
|
|
103
|
+
}), i++;
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
r.push({
|
|
107
|
+
type: "plain",
|
|
108
|
+
value: e[i]
|
|
109
|
+
}), i++;
|
|
110
|
+
}
|
|
111
|
+
return r;
|
|
112
|
+
}
|
|
113
|
+
var c = {
|
|
114
|
+
keyword: "text-violet-500 dark:text-violet-400",
|
|
115
|
+
string: "text-emerald-600 dark:text-emerald-400",
|
|
116
|
+
comment: "text-slate-400 dark:text-slate-500 italic",
|
|
117
|
+
number: "text-amber-600 dark:text-amber-400",
|
|
118
|
+
operator: "text-slate-500 dark:text-slate-400",
|
|
119
|
+
builtin: "text-sky-500 dark:text-sky-400",
|
|
120
|
+
plain: "text-slate-800 dark:text-slate-200"
|
|
121
|
+
};
|
|
122
|
+
function l({ code: t, language: o = "js", filename: l, showLineNumbers: u = !1, className: d }) {
|
|
123
|
+
let [f, p] = n(!1), m = t.replace(/^\n/, "").replace(/\n$/, ""), h = m.split("\n");
|
|
124
|
+
async function g() {
|
|
125
|
+
let e = !1;
|
|
126
|
+
try {
|
|
127
|
+
if (!navigator.clipboard?.writeText) throw Error("Clipboard API unavailable");
|
|
128
|
+
await navigator.clipboard.writeText(m), e = !0;
|
|
129
|
+
} catch {
|
|
130
|
+
let t = document.createElement("textarea");
|
|
131
|
+
t.value = m, t.setAttribute("readonly", ""), t.style.position = "fixed", t.style.opacity = "0", document.body.appendChild(t), t.select(), e = document.execCommand("copy"), t.remove();
|
|
132
|
+
}
|
|
133
|
+
e && (p(!0), window.setTimeout(() => p(!1), 1500));
|
|
134
|
+
}
|
|
135
|
+
return /* @__PURE__ */ a("div", {
|
|
136
|
+
className: e("group relative rounded-xl overflow-hidden border border-black/10 dark:border-white/10 bg-slate-50 dark:bg-[#0d1117]", d),
|
|
137
|
+
children: [/* @__PURE__ */ a("div", {
|
|
138
|
+
className: "flex items-center justify-between px-4 py-2.5 border-b border-black/[0.07] dark:border-white/[0.07] bg-black/3 dark:bg-white/3",
|
|
139
|
+
children: [/* @__PURE__ */ i("div", {
|
|
140
|
+
className: "flex items-center gap-2",
|
|
141
|
+
children: l && /* @__PURE__ */ i("span", {
|
|
142
|
+
className: "text-xs font-mono text-slate-500 dark:text-slate-400",
|
|
143
|
+
children: l
|
|
144
|
+
})
|
|
145
|
+
}), /* @__PURE__ */ a("div", {
|
|
146
|
+
className: "flex items-center gap-2",
|
|
147
|
+
children: [!l && /* @__PURE__ */ i("span", {
|
|
148
|
+
className: "text-xs font-mono text-slate-400 dark:text-slate-500 uppercase",
|
|
149
|
+
children: o
|
|
150
|
+
}), /* @__PURE__ */ i("button", {
|
|
151
|
+
type: "button",
|
|
152
|
+
onClick: g,
|
|
153
|
+
"aria-label": f ? "Copied code" : "Copy code",
|
|
154
|
+
className: "h-6 px-2 flex items-center gap-1 rounded text-xs text-slate-500 dark:text-slate-400 hover:text-gray-900 dark:hover:text-white hover:bg-black/6 dark:hover:bg-white/8 transition-colors",
|
|
155
|
+
children: f ? /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ i("svg", {
|
|
156
|
+
width: "11",
|
|
157
|
+
height: "11",
|
|
158
|
+
viewBox: "0 0 24 24",
|
|
159
|
+
fill: "none",
|
|
160
|
+
stroke: "currentColor",
|
|
161
|
+
strokeWidth: "2.5",
|
|
162
|
+
strokeLinecap: "round",
|
|
163
|
+
strokeLinejoin: "round",
|
|
164
|
+
children: /* @__PURE__ */ i("path", { d: "M20 6 9 17l-5-5" })
|
|
165
|
+
}), "Copied"] }) : /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ a("svg", {
|
|
166
|
+
width: "11",
|
|
167
|
+
height: "11",
|
|
168
|
+
viewBox: "0 0 24 24",
|
|
169
|
+
fill: "none",
|
|
170
|
+
stroke: "currentColor",
|
|
171
|
+
strokeWidth: "2",
|
|
172
|
+
strokeLinecap: "round",
|
|
173
|
+
strokeLinejoin: "round",
|
|
174
|
+
children: [/* @__PURE__ */ i("rect", {
|
|
175
|
+
width: "14",
|
|
176
|
+
height: "14",
|
|
177
|
+
x: "8",
|
|
178
|
+
y: "8",
|
|
179
|
+
rx: "2",
|
|
180
|
+
ry: "2"
|
|
181
|
+
}), /* @__PURE__ */ i("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })]
|
|
182
|
+
}), "Copy"] })
|
|
183
|
+
})]
|
|
184
|
+
})]
|
|
185
|
+
}), /* @__PURE__ */ i("div", {
|
|
186
|
+
className: "overflow-x-auto",
|
|
187
|
+
children: /* @__PURE__ */ i("table", {
|
|
188
|
+
className: "w-full border-collapse text-sm font-mono leading-6",
|
|
189
|
+
children: /* @__PURE__ */ i("tbody", { children: h.map((e, t) => /* @__PURE__ */ a("tr", {
|
|
190
|
+
className: "hover:bg-black/3 dark:hover:bg-white/3",
|
|
191
|
+
children: [u && /* @__PURE__ */ i("td", {
|
|
192
|
+
className: "select-none w-10 pr-4 pl-4 text-right text-slate-400 dark:text-slate-600 border-r border-black/6 dark:border-white/6",
|
|
193
|
+
children: t + 1
|
|
194
|
+
}), /* @__PURE__ */ i("td", {
|
|
195
|
+
className: "px-4 py-0 whitespace-pre",
|
|
196
|
+
children: s(e, o).map((e, t) => /* @__PURE__ */ i("span", {
|
|
197
|
+
className: c[e.type],
|
|
198
|
+
children: e.value
|
|
199
|
+
}, t))
|
|
200
|
+
})]
|
|
201
|
+
}, t)) })
|
|
202
|
+
})
|
|
203
|
+
})]
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
function u({ children: t, className: n }) {
|
|
207
|
+
return /* @__PURE__ */ i("code", {
|
|
208
|
+
className: e("font-mono text-[0.85em] px-1.5 py-0.5 rounded-md bg-black/6 dark:bg-white/8 border border-black/[0.07] dark:border-white/[0.07] text-slate-700 dark:text-slate-300", n),
|
|
209
|
+
children: t
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
function d({ value: n, onChange: r, language: o = "js", placeholder: s = "// Start typing…", minRows: c = 6, maxRows: l = 24, readOnly: u = !1, className: d }) {
|
|
213
|
+
let f = t(null), p = Math.min(l, Math.max(c, n.split("\n").length));
|
|
214
|
+
function m(e) {
|
|
215
|
+
let t = e.currentTarget, { selectionStart: i, selectionEnd: a } = t;
|
|
216
|
+
if (e.key === "Tab") {
|
|
217
|
+
e.preventDefault();
|
|
218
|
+
let o = n.slice(0, i) + " " + n.slice(a);
|
|
219
|
+
r?.(o), requestAnimationFrame(() => {
|
|
220
|
+
t.selectionStart = t.selectionEnd = i + 2;
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
if (e.key === "Enter") {
|
|
224
|
+
let o = n.lastIndexOf("\n", i - 1) + 1, s = n.slice(o).match(/^(\s*)/)?.[1] ?? "";
|
|
225
|
+
e.preventDefault();
|
|
226
|
+
let c = n.slice(0, i) + "\n" + s + n.slice(a);
|
|
227
|
+
r?.(c), requestAnimationFrame(() => {
|
|
228
|
+
t.selectionStart = t.selectionEnd = i + 1 + s.length;
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
let o = {
|
|
232
|
+
"(": ")",
|
|
233
|
+
"[": "]",
|
|
234
|
+
"{": "}",
|
|
235
|
+
"\"": "\"",
|
|
236
|
+
"'": "'",
|
|
237
|
+
"`": "`"
|
|
238
|
+
};
|
|
239
|
+
if (o[e.key] && i === a) {
|
|
240
|
+
e.preventDefault();
|
|
241
|
+
let s = n.slice(0, i) + e.key + o[e.key] + n.slice(a);
|
|
242
|
+
r?.(s), requestAnimationFrame(() => {
|
|
243
|
+
t.selectionStart = t.selectionEnd = i + 1;
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return /* @__PURE__ */ a("div", {
|
|
248
|
+
className: e("relative rounded-xl overflow-hidden border border-black/10 dark:border-white/10 bg-slate-50 dark:bg-[#0d1117]", d),
|
|
249
|
+
children: [/* @__PURE__ */ i("div", {
|
|
250
|
+
className: "flex items-center gap-1.5 px-4 py-2.5 border-b border-black/[0.07] dark:border-white/[0.07] bg-black/3 dark:bg-white/3",
|
|
251
|
+
children: /* @__PURE__ */ i("span", {
|
|
252
|
+
className: "text-xs font-mono text-slate-400 dark:text-slate-500 uppercase",
|
|
253
|
+
children: o
|
|
254
|
+
})
|
|
255
|
+
}), /* @__PURE__ */ a("div", {
|
|
256
|
+
className: "relative flex",
|
|
257
|
+
children: [/* @__PURE__ */ i("div", {
|
|
258
|
+
className: "select-none shrink-0 py-3 px-3 text-right text-sm font-mono leading-6 text-slate-400 dark:text-slate-600 border-r border-black/6 dark:border-white/6 bg-black/2 dark:bg-black/20",
|
|
259
|
+
"aria-hidden": !0,
|
|
260
|
+
children: Array.from({ length: p }, (e, t) => /* @__PURE__ */ i("div", { children: t + 1 }, t))
|
|
261
|
+
}), /* @__PURE__ */ i("textarea", {
|
|
262
|
+
ref: f,
|
|
263
|
+
value: n,
|
|
264
|
+
onChange: (e) => r?.(e.target.value),
|
|
265
|
+
onKeyDown: m,
|
|
266
|
+
readOnly: u,
|
|
267
|
+
placeholder: s,
|
|
268
|
+
spellCheck: !1,
|
|
269
|
+
rows: p,
|
|
270
|
+
className: "flex-1 py-3 px-4 text-sm font-mono leading-6 bg-transparent text-slate-800 dark:text-slate-200 placeholder:text-slate-400 dark:placeholder:text-slate-600 focus:outline-none resize-none"
|
|
271
|
+
})]
|
|
272
|
+
})]
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
//#endregion
|
|
276
|
+
export { l as CodeBlock, d as CodeEditor, u as InlineCode };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../cn-BdjraxxU.cjs");require("../component-styles-TkZ7v6Ef.cjs");const t=require("../focus-DmG6Ge7X.cjs");let n=require("framer-motion"),r=require("react"),i=require("react/jsx-runtime");var a=(0,r.createContext)(null);function o(){let e=(0,r.useContext)(a);if(!e)throw Error(`useCommand must be inside <CommandProvider>`);return e}function s({children:e,shortcut:t=`k`}){let[n,o]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{function e(e){(e.metaKey||e.ctrlKey)&&e.key===t&&(e.preventDefault(),o(e=>!e))}return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[t]),(0,i.jsx)(a.Provider,{value:{open:n,setOpen:o},children:e})}function c({items:a,placeholder:s=`Search commands…`,emptyText:c=`No results found.`,ariaLabel:l=`Command palette`}){let{open:u,setOpen:d}=o(),[f,p]=(0,r.useState)(``),[m,h]=(0,r.useState)(0),g=(0,r.useRef)(null),_=(0,r.useRef)(null),v=(0,r.useRef)(null),y=(0,r.useId)();(0,r.useEffect)(()=>{if(!u)return;let e=document.activeElement instanceof HTMLElement?document.activeElement:null,n=document.body.style.overflow,r=window.setTimeout(()=>g.current?.focus(),0),i=e=>{if(e.key===`Escape`){e.preventDefault(),d(!1);return}if(e.key!==`Tab`||!v.current)return;let n=t.t(v.current);if(n.length===0){e.preventDefault(),v.current.focus();return}let r=n[0],i=n[n.length-1];e.shiftKey&&document.activeElement===r?(e.preventDefault(),i.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),r.focus())};return p(``),h(0),document.body.style.overflow=`hidden`,document.addEventListener(`keydown`,i),()=>{window.clearTimeout(r),document.body.style.overflow=n,document.removeEventListener(`keydown`,i),e?.focus()}},[u,d]);let b=(0,r.useMemo)(()=>{if(!f)return a;let e=f.toLowerCase();return a.filter(t=>t.label.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e)||t.keywords?.some(t=>t.toLowerCase().includes(e)))},[f,a]),x=(0,r.useMemo)(()=>{let e=new Map;for(let t of b){let n=t.group??``;e.has(n)||e.set(n,[]),e.get(n).push(t)}return e},[b]),S=(0,r.useMemo)(()=>Array.from(x.values()).flat(),[x]);function C(e){e.key===`ArrowDown`?(e.preventDefault(),h(e=>Math.min(e+1,Math.max(S.length-1,0)))):e.key===`ArrowUp`?(e.preventDefault(),h(e=>Math.max(e-1,0))):e.key===`Enter`?(e.preventDefault(),S[m]?.onSelect(),d(!1)):e.key===`Escape`&&d(!1)}(0,r.useEffect)(()=>{_.current&&_.current.querySelector(`[data-active="true"]`)?.scrollIntoView({block:`nearest`})},[m]);let w=0;return(0,i.jsx)(n.AnimatePresence,{children:u&&(0,i.jsxs)(`div`,{className:`fixed inset-0 z-[200] flex items-start justify-center pt-[15vh] p-4`,children:[(0,i.jsx)(n.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:`absolute inset-0 bg-overlay`,onClick:()=>d(!1),"aria-hidden":`true`}),(0,i.jsxs)(n.motion.div,{ref:v,tabIndex:-1,role:`dialog`,"aria-modal":`true`,"aria-label":l,initial:{opacity:0,scale:.96,y:-8},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.96,y:-8},transition:{type:`spring`,stiffness:400,damping:30},className:`relative w-full max-w-lg overflow-hidden rounded-[var(--radius-xl)] border border-border bg-surface-raised shadow-overlay`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border px-4`,children:[(0,i.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`text-slate-400 shrink-0`,children:[(0,i.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,i.jsx)(`path`,{d:`m21 21-4.35-4.35`})]}),(0,i.jsx)(`input`,{ref:g,type:`search`,role:`combobox`,"aria-label":l,"aria-autocomplete":`list`,"aria-expanded":`true`,"aria-controls":y,"aria-activedescendant":S[m]?`${y}-option-${m}`:void 0,value:f,onChange:e=>{p(e.target.value),h(0)},onKeyDown:C,placeholder:s,className:`min-w-0 flex-1 bg-transparent py-3.5 text-sm text-foreground outline-none placeholder:text-muted-foreground`}),(0,i.jsx)(`kbd`,{className:`shrink-0 rounded-[var(--radius-sm)] border border-border-strong bg-surface-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground`,children:`ESC`})]}),(0,i.jsx)(`div`,{id:y,ref:_,role:`listbox`,"aria-label":`Commands`,className:`max-h-80 overflow-y-auto py-1.5`,children:b.length===0?(0,i.jsx)(`p`,{className:`py-10 text-center text-sm text-muted-foreground`,children:c}):Array.from(x.entries()).map(([t,n])=>(0,i.jsxs)(`div`,{role:`group`,"aria-label":t||void 0,children:[t&&(0,i.jsx)(`p`,{className:`px-4 py-1 text-[10px] font-semibold text-slate-500 uppercase tracking-widest`,children:t}),n.map(t=>{let n=w++,r=n===m;return(0,i.jsxs)(`button`,{id:`${y}-option-${n}`,type:`button`,role:`option`,"aria-selected":r,"data-active":r,onClick:()=>{t.onSelect(),d(!1)},onMouseEnter:()=>h(n),className:e.t(`flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring/35 focus-visible:ring-offset-2 focus-visible:ring-offset-bg`,r?`bg-surface-muted`:`hover:bg-surface-muted/70`),children:[t.icon&&(0,i.jsx)(`span`,{className:`shrink-0 text-slate-500 dark:text-slate-400 w-5 flex items-center justify-center`,children:t.icon}),(0,i.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,i.jsx)(`p`,{className:`truncate text-sm text-foreground`,children:t.label}),t.description&&(0,i.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:t.description})]}),t.shortcut&&(0,i.jsx)(`div`,{className:`flex items-center gap-0.5 shrink-0`,children:t.shortcut.map((e,t)=>(0,i.jsx)(`kbd`,{className:`rounded-[var(--radius-sm)] border border-border bg-surface-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground`,children:e},t))})]},t.id)})]},t))})]})]})})}exports.CommandPalette=c,exports.CommandProvider=s,exports.useCommand=o;
|