@handled-ai/design-system 0.9.28 → 0.10.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/dist/components/badge.d.ts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/compliance-badge.d.ts +10 -0
- package/dist/components/compliance-badge.js +95 -0
- package/dist/components/compliance-badge.js.map +1 -0
- package/dist/components/contact-chip.d.ts +12 -0
- package/dist/components/contact-chip.js +98 -0
- package/dist/components/contact-chip.js.map +1 -0
- package/dist/components/empty-state.d.ts +11 -0
- package/dist/components/empty-state.js +46 -0
- package/dist/components/empty-state.js.map +1 -0
- package/dist/components/filter-chip.d.ts +9 -0
- package/dist/components/filter-chip.js +67 -0
- package/dist/components/filter-chip.js.map +1 -0
- package/dist/components/inline-banner.d.ts +10 -0
- package/dist/components/inline-banner.js +97 -0
- package/dist/components/inline-banner.js.map +1 -0
- package/dist/components/kbd-hint.d.ts +5 -0
- package/dist/components/kbd-hint.js +51 -0
- package/dist/components/kbd-hint.js.map +1 -0
- package/dist/components/rich-text-toolbar.d.ts +9 -0
- package/dist/components/rich-text-toolbar.js +103 -0
- package/dist/components/rich-text-toolbar.js.map +1 -0
- package/dist/components/step-timeline.d.ts +19 -0
- package/dist/components/step-timeline.js +134 -0
- package/dist/components/step-timeline.js.map +1 -0
- package/dist/components/sticky-action-bar.d.ts +10 -0
- package/dist/components/sticky-action-bar.js +56 -0
- package/dist/components/sticky-action-bar.js.map +1 -0
- package/dist/components/switch.d.ts +6 -0
- package/dist/components/switch.js +66 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/tabs.d.ts +1 -1
- package/dist/components/variable-autocomplete.d.ts +21 -0
- package/dist/components/variable-autocomplete.js +171 -0
- package/dist/components/variable-autocomplete.js.map +1 -0
- package/dist/index.d.ts +12 -1
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/src/components/__tests__/compliance-badge.test.tsx +88 -0
- package/src/components/__tests__/contact-chip.test.tsx +88 -0
- package/src/components/__tests__/empty-state.test.tsx +76 -0
- package/src/components/__tests__/filter-chip.test.tsx +73 -0
- package/src/components/__tests__/inline-banner.test.tsx +110 -0
- package/src/components/__tests__/kbd-hint.test.tsx +29 -0
- package/src/components/__tests__/rich-text-toolbar.test.tsx +92 -0
- package/src/components/__tests__/step-timeline.test.tsx +174 -0
- package/src/components/__tests__/sticky-action-bar.test.tsx +52 -0
- package/src/components/__tests__/switch.test.tsx +39 -0
- package/src/components/__tests__/variable-autocomplete.test.tsx +155 -0
- package/src/components/compliance-badge.tsx +68 -0
- package/src/components/contact-chip.tsx +68 -0
- package/src/components/empty-state.tsx +37 -0
- package/src/components/filter-chip.tsx +37 -0
- package/src/components/inline-banner.tsx +69 -0
- package/src/components/kbd-hint.tsx +21 -0
- package/src/components/rich-text-toolbar.tsx +90 -0
- package/src/components/step-timeline.tsx +149 -0
- package/src/components/sticky-action-bar.tsx +36 -0
- package/src/components/switch.tsx +29 -0
- package/src/components/variable-autocomplete.tsx +178 -0
- package/src/index.ts +12 -1
- package/src/styles/globals.css +60 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
"use client";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __defProps = Object.defineProperties;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
36
|
+
import { Undo2, Redo2, Bold, Italic, Underline, AlignLeft, List, Trash2, ChevronDown } from "lucide-react";
|
|
37
|
+
import { cn } from "../lib/utils.js";
|
|
38
|
+
function ToolbarButton({
|
|
39
|
+
action,
|
|
40
|
+
icon: Icon,
|
|
41
|
+
label,
|
|
42
|
+
extraClassName,
|
|
43
|
+
onAction
|
|
44
|
+
}) {
|
|
45
|
+
return /* @__PURE__ */ jsx(
|
|
46
|
+
"button",
|
|
47
|
+
{
|
|
48
|
+
type: "button",
|
|
49
|
+
"data-slot": "rich-text-toolbar-button",
|
|
50
|
+
onClick: () => onAction == null ? void 0 : onAction(action),
|
|
51
|
+
"aria-label": label,
|
|
52
|
+
className: cn("p-1.5 rounded hover:bg-muted/50 cursor-pointer text-muted-foreground", extraClassName),
|
|
53
|
+
children: /* @__PURE__ */ jsx(Icon, { size: 14 })
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
function RichTextToolbar(_a) {
|
|
58
|
+
var _b = _a, { onAction, className } = _b, rest = __objRest(_b, ["onAction", "className"]);
|
|
59
|
+
return /* @__PURE__ */ jsxs(
|
|
60
|
+
"div",
|
|
61
|
+
__spreadProps(__spreadValues({
|
|
62
|
+
"data-slot": "rich-text-toolbar",
|
|
63
|
+
role: "toolbar",
|
|
64
|
+
"aria-label": "Rich text formatting",
|
|
65
|
+
className: cn("px-3 py-1.5 flex items-center justify-between", className)
|
|
66
|
+
}, rest), {
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5", children: [
|
|
69
|
+
/* @__PURE__ */ jsx(ToolbarButton, { action: "undo", icon: Undo2, label: "Undo", onAction }),
|
|
70
|
+
/* @__PURE__ */ jsx(ToolbarButton, { action: "redo", icon: Redo2, label: "Redo", onAction }),
|
|
71
|
+
/* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-border mx-1", "aria-hidden": "true" }),
|
|
72
|
+
/* @__PURE__ */ jsxs(
|
|
73
|
+
"button",
|
|
74
|
+
{
|
|
75
|
+
type: "button",
|
|
76
|
+
"data-slot": "rich-text-toolbar-button",
|
|
77
|
+
onClick: () => onAction == null ? void 0 : onAction("font"),
|
|
78
|
+
"aria-label": "Font family",
|
|
79
|
+
"aria-haspopup": "true",
|
|
80
|
+
className: "text-[11px] text-muted-foreground px-1.5 py-0.5 rounded hover:bg-muted/50 cursor-pointer flex items-center gap-1",
|
|
81
|
+
children: [
|
|
82
|
+
"Sans Serif",
|
|
83
|
+
/* @__PURE__ */ jsx(ChevronDown, { size: 10 })
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-border mx-1", "aria-hidden": "true" }),
|
|
88
|
+
/* @__PURE__ */ jsx(ToolbarButton, { action: "bold", icon: Bold, label: "Bold", onAction }),
|
|
89
|
+
/* @__PURE__ */ jsx(ToolbarButton, { action: "italic", icon: Italic, label: "Italic", onAction }),
|
|
90
|
+
/* @__PURE__ */ jsx(ToolbarButton, { action: "underline", icon: Underline, label: "Underline", onAction }),
|
|
91
|
+
/* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-border mx-1", "aria-hidden": "true" }),
|
|
92
|
+
/* @__PURE__ */ jsx(ToolbarButton, { action: "align", icon: AlignLeft, label: "Align left", onAction }),
|
|
93
|
+
/* @__PURE__ */ jsx(ToolbarButton, { action: "list", icon: List, label: "List", onAction })
|
|
94
|
+
] }),
|
|
95
|
+
/* @__PURE__ */ jsx(ToolbarButton, { action: "delete", icon: Trash2, label: "Delete", extraClassName: "hover:text-destructive", onAction })
|
|
96
|
+
]
|
|
97
|
+
})
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
RichTextToolbar
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=rich-text-toolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/rich-text-toolbar.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport type { LucideIcon } from \"lucide-react\"\nimport { Undo2, Redo2, Bold, Italic, Underline, AlignLeft, List, Trash2, ChevronDown } from \"lucide-react\"\n\nimport { cn } from \"../lib/utils\"\n\ntype RichTextAction =\n | \"undo\" | \"redo\"\n | \"font\"\n | \"bold\" | \"italic\" | \"underline\"\n | \"align\" | \"list\"\n | \"delete\"\n\ninterface RichTextToolbarProps extends React.HTMLAttributes<HTMLDivElement> {\n onAction?: (action: RichTextAction) => void\n}\n\nfunction ToolbarButton({\n action,\n icon: Icon,\n label,\n extraClassName,\n onAction,\n}: {\n action: RichTextAction\n icon: LucideIcon\n label: string\n extraClassName?: string\n onAction?: (action: RichTextAction) => void\n}) {\n return (\n <button\n type=\"button\"\n data-slot=\"rich-text-toolbar-button\"\n onClick={() => onAction?.(action)}\n aria-label={label}\n className={cn(\"p-1.5 rounded hover:bg-muted/50 cursor-pointer text-muted-foreground\", extraClassName)}\n >\n <Icon size={14} />\n </button>\n )\n}\n\nfunction RichTextToolbar({ onAction, className, ...rest }: RichTextToolbarProps) {\n return (\n <div\n data-slot=\"rich-text-toolbar\"\n role=\"toolbar\"\n aria-label=\"Rich text formatting\"\n className={cn(\"px-3 py-1.5 flex items-center justify-between\", className)}\n {...rest}\n >\n <div className=\"flex items-center gap-0.5\">\n <ToolbarButton action=\"undo\" icon={Undo2} label=\"Undo\" onAction={onAction} />\n <ToolbarButton action=\"redo\" icon={Redo2} label=\"Redo\" onAction={onAction} />\n\n <div className=\"w-px h-4 bg-border mx-1\" aria-hidden=\"true\" />\n\n <button\n type=\"button\"\n data-slot=\"rich-text-toolbar-button\"\n onClick={() => onAction?.(\"font\")}\n aria-label=\"Font family\"\n aria-haspopup=\"true\"\n className=\"text-[11px] text-muted-foreground px-1.5 py-0.5 rounded hover:bg-muted/50 cursor-pointer flex items-center gap-1\"\n >\n Sans Serif\n <ChevronDown size={10} />\n </button>\n\n <div className=\"w-px h-4 bg-border mx-1\" aria-hidden=\"true\" />\n\n <ToolbarButton action=\"bold\" icon={Bold} label=\"Bold\" onAction={onAction} />\n <ToolbarButton action=\"italic\" icon={Italic} label=\"Italic\" onAction={onAction} />\n <ToolbarButton action=\"underline\" icon={Underline} label=\"Underline\" onAction={onAction} />\n\n <div className=\"w-px h-4 bg-border mx-1\" aria-hidden=\"true\" />\n\n <ToolbarButton action=\"align\" icon={AlignLeft} label=\"Align left\" onAction={onAction} />\n <ToolbarButton action=\"list\" icon={List} label=\"List\" onAction={onAction} />\n </div>\n\n <ToolbarButton action=\"delete\" icon={Trash2} label=\"Delete\" extraClassName=\"hover:text-destructive\" onAction={onAction} />\n </div>\n )\n}\n\nexport { RichTextToolbar, type RichTextToolbarProps, type RichTextAction }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCM,cAoBE,YApBF;AApCN,SAAS,OAAO,OAAO,MAAM,QAAQ,WAAW,WAAW,MAAM,QAAQ,mBAAmB;AAE5F,SAAS,UAAU;AAanB,SAAS,cAAc;AAAA,EACrB;AAAA,EACA,MAAM;AAAA,EACN;AAAA,EACA;AAAA,EACA;AACF,GAMG;AACD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,aAAU;AAAA,MACV,SAAS,MAAM,qCAAW;AAAA,MAC1B,cAAY;AAAA,MACZ,WAAW,GAAG,wEAAwE,cAAc;AAAA,MAEpG,8BAAC,QAAK,MAAM,IAAI;AAAA;AAAA,EAClB;AAEJ;AAEA,SAAS,gBAAgB,IAAwD;AAAxD,eAAE,YAAU,UA7CrC,IA6CyB,IAA0B,iBAA1B,IAA0B,CAAxB,YAAU;AACnC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,MAAK;AAAA,MACL,cAAW;AAAA,MACX,WAAW,GAAG,iDAAiD,SAAS;AAAA,OACpE,OALL;AAAA,MAOC;AAAA,6BAAC,SAAI,WAAU,6BACb;AAAA,8BAAC,iBAAc,QAAO,QAAO,MAAM,OAAO,OAAM,QAAO,UAAoB;AAAA,UAC3E,oBAAC,iBAAc,QAAO,QAAO,MAAM,OAAO,OAAM,QAAO,UAAoB;AAAA,UAE3E,oBAAC,SAAI,WAAU,2BAA0B,eAAY,QAAO;AAAA,UAE5D;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,aAAU;AAAA,cACV,SAAS,MAAM,qCAAW;AAAA,cAC1B,cAAW;AAAA,cACX,iBAAc;AAAA,cACd,WAAU;AAAA,cACX;AAAA;AAAA,gBAEC,oBAAC,eAAY,MAAM,IAAI;AAAA;AAAA;AAAA,UACzB;AAAA,UAEA,oBAAC,SAAI,WAAU,2BAA0B,eAAY,QAAO;AAAA,UAE5D,oBAAC,iBAAc,QAAO,QAAO,MAAM,MAAM,OAAM,QAAO,UAAoB;AAAA,UAC1E,oBAAC,iBAAc,QAAO,UAAS,MAAM,QAAQ,OAAM,UAAS,UAAoB;AAAA,UAChF,oBAAC,iBAAc,QAAO,aAAY,MAAM,WAAW,OAAM,aAAY,UAAoB;AAAA,UAEzF,oBAAC,SAAI,WAAU,2BAA0B,eAAY,QAAO;AAAA,UAE5D,oBAAC,iBAAc,QAAO,SAAQ,MAAM,WAAW,OAAM,cAAa,UAAoB;AAAA,UACtF,oBAAC,iBAAc,QAAO,QAAO,MAAM,MAAM,OAAM,QAAO,UAAoB;AAAA,WAC5E;AAAA,QAEA,oBAAC,iBAAc,QAAO,UAAS,MAAM,QAAQ,OAAM,UAAS,gBAAe,0BAAyB,UAAoB;AAAA;AAAA;AAAA,EAC1H;AAEJ;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type StepType = "email" | "call" | "task" | "wait" | (string & {});
|
|
4
|
+
interface TimelineStep {
|
|
5
|
+
id: string;
|
|
6
|
+
type: StepType;
|
|
7
|
+
label: string;
|
|
8
|
+
}
|
|
9
|
+
interface StepTimelineProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
steps: TimelineStep[];
|
|
11
|
+
expandedStepId?: string;
|
|
12
|
+
onStepClick?: (stepId: string) => void;
|
|
13
|
+
onInsert?: (index: number) => void;
|
|
14
|
+
renderStepBody?: (step: TimelineStep) => React.ReactNode;
|
|
15
|
+
renderStepAccessory?: (step: TimelineStep) => React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
declare function StepTimeline({ steps, expandedStepId, onStepClick, onInsert, renderStepBody, renderStepAccessory, className, ...rest }: StepTimelineProps): React.JSX.Element;
|
|
18
|
+
|
|
19
|
+
export { StepTimeline, type StepTimelineProps, type StepType, type TimelineStep };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
"use client";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __defProps = Object.defineProperties;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
36
|
+
import * as React from "react";
|
|
37
|
+
import { Mail, Phone, CheckSquare, Clock, Circle, ChevronUp, ChevronDown } from "lucide-react";
|
|
38
|
+
import { cn } from "../lib/utils.js";
|
|
39
|
+
const stepTypeConfig = {
|
|
40
|
+
email: { icon: Mail, classes: "bg-blue-500/10 text-blue-600" },
|
|
41
|
+
call: { icon: Phone, classes: "bg-emerald-500/10 text-emerald-600" },
|
|
42
|
+
task: { icon: CheckSquare, classes: "bg-purple-500/10 text-purple-600" },
|
|
43
|
+
wait: { icon: Clock, classes: "bg-muted text-muted-foreground" }
|
|
44
|
+
};
|
|
45
|
+
const defaultStepConfig = { icon: Circle, classes: "bg-muted text-muted-foreground" };
|
|
46
|
+
function StepTimeline(_a) {
|
|
47
|
+
var _b = _a, {
|
|
48
|
+
steps,
|
|
49
|
+
expandedStepId,
|
|
50
|
+
onStepClick,
|
|
51
|
+
onInsert,
|
|
52
|
+
renderStepBody,
|
|
53
|
+
renderStepAccessory,
|
|
54
|
+
className
|
|
55
|
+
} = _b, rest = __objRest(_b, [
|
|
56
|
+
"steps",
|
|
57
|
+
"expandedStepId",
|
|
58
|
+
"onStepClick",
|
|
59
|
+
"onInsert",
|
|
60
|
+
"renderStepBody",
|
|
61
|
+
"renderStepAccessory",
|
|
62
|
+
"className"
|
|
63
|
+
]);
|
|
64
|
+
return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({ "data-slot": "step-timeline", className: cn("relative ml-5", className) }, rest), { children: [
|
|
65
|
+
/* @__PURE__ */ jsx("div", { className: "absolute left-0 top-0 bottom-0 border-l-2 border-border" }),
|
|
66
|
+
steps.map((step, index) => {
|
|
67
|
+
var _a2;
|
|
68
|
+
const expanded = step.id === expandedStepId;
|
|
69
|
+
const config = (_a2 = stepTypeConfig[step.type]) != null ? _a2 : defaultStepConfig;
|
|
70
|
+
const TypeIcon = config.icon;
|
|
71
|
+
const isInteractive = !!(onStepClick || renderStepBody);
|
|
72
|
+
const bodyId = `step-timeline-body-${step.id}`;
|
|
73
|
+
const headerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
74
|
+
/* @__PURE__ */ jsx("div", { className: cn("w-8 h-8 rounded-full flex items-center justify-center shrink-0", config.classes), children: /* @__PURE__ */ jsx(TypeIcon, { size: 16 }) }),
|
|
75
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col min-w-0", children: [
|
|
76
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium text-muted-foreground uppercase tracking-wider", children: step.type }),
|
|
77
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: step.label })
|
|
78
|
+
] })
|
|
79
|
+
] });
|
|
80
|
+
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
81
|
+
index > 0 && onInsert && /* @__PURE__ */ jsx("div", { className: "relative pl-8 py-1", children: /* @__PURE__ */ jsx(
|
|
82
|
+
"button",
|
|
83
|
+
{
|
|
84
|
+
type: "button",
|
|
85
|
+
"data-slot": "step-timeline-insert",
|
|
86
|
+
onClick: () => onInsert(index),
|
|
87
|
+
className: "border border-dashed border-border/50 rounded-lg py-2 text-center text-xs text-muted-foreground/50 hover:text-muted-foreground hover:border-border cursor-pointer transition-colors w-full",
|
|
88
|
+
children: "+ Add Step"
|
|
89
|
+
}
|
|
90
|
+
) }),
|
|
91
|
+
/* @__PURE__ */ jsxs("div", { "data-slot": "step-timeline-step", className: "relative pl-8 py-2", children: [
|
|
92
|
+
/* @__PURE__ */ jsx("div", { className: "absolute left-0 top-1/2 -translate-x-1/2 -translate-y-1/2 w-3 h-3 rounded-full border-2 border-border bg-background z-10" }),
|
|
93
|
+
/* @__PURE__ */ jsxs("div", { "data-slot": "step-timeline-card", className: "border border-border rounded-lg overflow-hidden", children: [
|
|
94
|
+
isInteractive ? /* @__PURE__ */ jsxs("div", { className: "flex items-center w-full px-4 py-3 gap-3", children: [
|
|
95
|
+
/* @__PURE__ */ jsx(
|
|
96
|
+
"button",
|
|
97
|
+
{
|
|
98
|
+
type: "button",
|
|
99
|
+
"aria-expanded": expanded,
|
|
100
|
+
"aria-controls": bodyId,
|
|
101
|
+
onClick: () => onStepClick == null ? void 0 : onStepClick(step.id),
|
|
102
|
+
className: "flex items-center gap-3 flex-1 min-w-0 cursor-pointer hover:opacity-80 transition-opacity text-left",
|
|
103
|
+
children: headerContent
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
/* @__PURE__ */ jsxs("div", { className: "ml-auto flex items-center gap-2 shrink-0", children: [
|
|
107
|
+
renderStepAccessory && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: renderStepAccessory(step) }),
|
|
108
|
+
/* @__PURE__ */ jsx("div", { className: "shrink-0 text-muted-foreground", children: expanded ? /* @__PURE__ */ jsx(ChevronUp, { size: 16 }) : /* @__PURE__ */ jsx(ChevronDown, { size: 16 }) })
|
|
109
|
+
] })
|
|
110
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "w-full px-4 py-3 flex items-center gap-3", children: [
|
|
111
|
+
headerContent,
|
|
112
|
+
renderStepAccessory && /* @__PURE__ */ jsx("div", { className: "ml-auto shrink-0", children: renderStepAccessory(step) })
|
|
113
|
+
] }),
|
|
114
|
+
expanded && renderStepBody && /* @__PURE__ */ jsx("div", { id: bodyId, "data-slot": "step-timeline-body", children: renderStepBody(step) })
|
|
115
|
+
] })
|
|
116
|
+
] })
|
|
117
|
+
] }, step.id);
|
|
118
|
+
}),
|
|
119
|
+
onInsert && /* @__PURE__ */ jsx("div", { className: "relative pl-8 py-1", children: /* @__PURE__ */ jsx(
|
|
120
|
+
"button",
|
|
121
|
+
{
|
|
122
|
+
type: "button",
|
|
123
|
+
"data-slot": "step-timeline-insert",
|
|
124
|
+
onClick: () => onInsert(steps.length),
|
|
125
|
+
className: "border border-dashed border-border/50 rounded-lg py-2 text-center text-xs text-muted-foreground/50 hover:text-muted-foreground hover:border-border cursor-pointer transition-colors w-full",
|
|
126
|
+
children: "+ Add Step"
|
|
127
|
+
}
|
|
128
|
+
) })
|
|
129
|
+
] }));
|
|
130
|
+
}
|
|
131
|
+
export {
|
|
132
|
+
StepTimeline
|
|
133
|
+
};
|
|
134
|
+
//# sourceMappingURL=step-timeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/step-timeline.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport type { LucideIcon } from \"lucide-react\"\nimport { Mail, Phone, CheckSquare, Clock, Circle, ChevronUp, ChevronDown } from \"lucide-react\"\n\nimport { cn } from \"../lib/utils\"\n\ntype StepType = \"email\" | \"call\" | \"task\" | \"wait\" | (string & {})\n\ninterface TimelineStep {\n id: string\n type: StepType\n label: string\n}\n\ninterface StepTimelineProps extends React.HTMLAttributes<HTMLDivElement> {\n steps: TimelineStep[]\n expandedStepId?: string\n onStepClick?: (stepId: string) => void\n onInsert?: (index: number) => void\n renderStepBody?: (step: TimelineStep) => React.ReactNode\n renderStepAccessory?: (step: TimelineStep) => React.ReactNode\n}\n\nconst stepTypeConfig: Record<string, { icon: LucideIcon; classes: string }> = {\n email: { icon: Mail, classes: \"bg-blue-500/10 text-blue-600\" },\n call: { icon: Phone, classes: \"bg-emerald-500/10 text-emerald-600\" },\n task: { icon: CheckSquare, classes: \"bg-purple-500/10 text-purple-600\" },\n wait: { icon: Clock, classes: \"bg-muted text-muted-foreground\" },\n}\n\nconst defaultStepConfig: { icon: LucideIcon; classes: string } = { icon: Circle, classes: \"bg-muted text-muted-foreground\" }\n\nfunction StepTimeline({\n steps,\n expandedStepId,\n onStepClick,\n onInsert,\n renderStepBody,\n renderStepAccessory,\n className,\n ...rest\n}: StepTimelineProps) {\n return (\n <div data-slot=\"step-timeline\" className={cn(\"relative ml-5\", className)} {...rest}>\n <div className=\"absolute left-0 top-0 bottom-0 border-l-2 border-border\" />\n\n {steps.map((step, index) => {\n const expanded = step.id === expandedStepId\n const config = stepTypeConfig[step.type] ?? defaultStepConfig\n const TypeIcon = config.icon\n const isInteractive = !!(onStepClick || renderStepBody)\n const bodyId = `step-timeline-body-${step.id}`\n\n const headerContent = (\n <>\n <div className={cn(\"w-8 h-8 rounded-full flex items-center justify-center shrink-0\", config.classes)}>\n <TypeIcon size={16} />\n </div>\n <div className=\"flex flex-col min-w-0\">\n <span className=\"text-[11px] font-medium text-muted-foreground uppercase tracking-wider\">\n {step.type}\n </span>\n <span className=\"text-sm font-medium\">{step.label}</span>\n </div>\n </>\n )\n\n return (\n <React.Fragment key={step.id}>\n {index > 0 && onInsert && (\n <div className=\"relative pl-8 py-1\">\n <button\n type=\"button\"\n data-slot=\"step-timeline-insert\"\n onClick={() => onInsert(index)}\n className=\"border border-dashed border-border/50 rounded-lg py-2 text-center text-xs text-muted-foreground/50 hover:text-muted-foreground hover:border-border cursor-pointer transition-colors w-full\"\n >\n + Add Step\n </button>\n </div>\n )}\n\n <div data-slot=\"step-timeline-step\" className=\"relative pl-8 py-2\">\n <div className=\"absolute left-0 top-1/2 -translate-x-1/2 -translate-y-1/2 w-3 h-3 rounded-full border-2 border-border bg-background z-10\" />\n\n <div data-slot=\"step-timeline-card\" className=\"border border-border rounded-lg overflow-hidden\">\n {isInteractive ? (\n <div className=\"flex items-center w-full px-4 py-3 gap-3\">\n <button\n type=\"button\"\n aria-expanded={expanded}\n aria-controls={bodyId}\n onClick={() => onStepClick?.(step.id)}\n className=\"flex items-center gap-3 flex-1 min-w-0 cursor-pointer hover:opacity-80 transition-opacity text-left\"\n >\n {headerContent}\n </button>\n <div className=\"ml-auto flex items-center gap-2 shrink-0\">\n {renderStepAccessory && (\n <div className=\"shrink-0\">\n {renderStepAccessory(step)}\n </div>\n )}\n <div className=\"shrink-0 text-muted-foreground\">\n {expanded ? <ChevronUp size={16} /> : <ChevronDown size={16} />}\n </div>\n </div>\n </div>\n ) : (\n <div className=\"w-full px-4 py-3 flex items-center gap-3\">\n {headerContent}\n {renderStepAccessory && (\n <div className=\"ml-auto shrink-0\">\n {renderStepAccessory(step)}\n </div>\n )}\n </div>\n )}\n\n {expanded && renderStepBody && (\n <div id={bodyId} data-slot=\"step-timeline-body\">\n {renderStepBody(step)}\n </div>\n )}\n </div>\n </div>\n </React.Fragment>\n )\n })}\n\n {onInsert && (\n <div className=\"relative pl-8 py-1\">\n <button\n type=\"button\"\n data-slot=\"step-timeline-insert\"\n onClick={() => onInsert(steps.length)}\n className=\"border border-dashed border-border/50 rounded-lg py-2 text-center text-xs text-muted-foreground/50 hover:text-muted-foreground hover:border-border cursor-pointer transition-colors w-full\"\n >\n + Add Step\n </button>\n </div>\n )}\n </div>\n )\n}\n\nexport { StepTimeline, type StepTimelineProps, type TimelineStep, type StepType }\n"],"mappings":"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","names":["_a"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
interface StickyActionBarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
left?: React.ReactNode;
|
|
5
|
+
right?: React.ReactNode;
|
|
6
|
+
bordered?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare function StickyActionBar({ left, right, bordered, className, ...rest }: StickyActionBarProps): React.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { StickyActionBar, type StickyActionBarProps };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
33
|
+
import { cn } from "../lib/utils.js";
|
|
34
|
+
function StickyActionBar(_a) {
|
|
35
|
+
var _b = _a, { left, right, bordered = true, className } = _b, rest = __objRest(_b, ["left", "right", "bordered", "className"]);
|
|
36
|
+
return /* @__PURE__ */ jsxs(
|
|
37
|
+
"div",
|
|
38
|
+
__spreadProps(__spreadValues({
|
|
39
|
+
"data-slot": "sticky-action-bar",
|
|
40
|
+
className: cn(
|
|
41
|
+
"flex items-center justify-between sticky bottom-0 bg-background",
|
|
42
|
+
bordered && "pt-3 border-t border-border/50",
|
|
43
|
+
className
|
|
44
|
+
)
|
|
45
|
+
}, rest), {
|
|
46
|
+
children: [
|
|
47
|
+
left && /* @__PURE__ */ jsx("div", { "data-slot": "sticky-action-bar-left", className: "flex items-center gap-1", children: left }),
|
|
48
|
+
right && /* @__PURE__ */ jsx("div", { "data-slot": "sticky-action-bar-right", className: "ml-auto flex items-center gap-2", children: right })
|
|
49
|
+
]
|
|
50
|
+
})
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
StickyActionBar
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=sticky-action-bar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/sticky-action-bar.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { cn } from \"../lib/utils\"\n\ninterface StickyActionBarProps extends React.HTMLAttributes<HTMLDivElement> {\n left?: React.ReactNode\n right?: React.ReactNode\n bordered?: boolean\n}\n\nfunction StickyActionBar({ left, right, bordered = true, className, ...rest }: StickyActionBarProps) {\n return (\n <div\n data-slot=\"sticky-action-bar\"\n className={cn(\n \"flex items-center justify-between sticky bottom-0 bg-background\",\n bordered && \"pt-3 border-t border-border/50\",\n className\n )}\n {...rest}\n >\n {left && (\n <div data-slot=\"sticky-action-bar-left\" className=\"flex items-center gap-1\">\n {left}\n </div>\n )}\n {right && (\n <div data-slot=\"sticky-action-bar-right\" className=\"ml-auto flex items-center gap-2\">\n {right}\n </div>\n )}\n </div>\n )\n}\n\nexport { StickyActionBar, type StickyActionBarProps }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYI,SAUI,KAVJ;AAVJ,SAAS,UAAU;AAQnB,SAAS,gBAAgB,IAA4E;AAA5E,eAAE,QAAM,OAAO,WAAW,MAAM,UAVzD,IAUyB,IAA8C,iBAA9C,IAA8C,CAA5C,QAAM,SAAO,YAAiB;AACvD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAW;AAAA,QACT;AAAA,QACA,YAAY;AAAA,QACZ;AAAA,MACF;AAAA,OACI,OAPL;AAAA,MASE;AAAA,gBACC,oBAAC,SAAI,aAAU,0BAAyB,WAAU,2BAC/C,gBACH;AAAA,QAED,SACC,oBAAC,SAAI,aAAU,2BAA0B,WAAU,mCAChD,iBACH;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
"use client";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __defProps = Object.defineProperties;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
import { jsx } from "react/jsx-runtime";
|
|
36
|
+
import { Switch as SwitchPrimitive } from "radix-ui";
|
|
37
|
+
import { cn } from "../lib/utils.js";
|
|
38
|
+
function Switch(_a) {
|
|
39
|
+
var _b = _a, {
|
|
40
|
+
className
|
|
41
|
+
} = _b, props = __objRest(_b, [
|
|
42
|
+
"className"
|
|
43
|
+
]);
|
|
44
|
+
return /* @__PURE__ */ jsx(
|
|
45
|
+
SwitchPrimitive.Root,
|
|
46
|
+
__spreadProps(__spreadValues({
|
|
47
|
+
"data-slot": "switch",
|
|
48
|
+
className: cn(
|
|
49
|
+
"peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-xs transition-colors focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-switch-background",
|
|
50
|
+
className
|
|
51
|
+
)
|
|
52
|
+
}, props), {
|
|
53
|
+
children: /* @__PURE__ */ jsx(
|
|
54
|
+
SwitchPrimitive.Thumb,
|
|
55
|
+
{
|
|
56
|
+
"data-slot": "switch-thumb",
|
|
57
|
+
className: "pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
})
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
Switch
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=switch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/switch.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { Switch as SwitchPrimitive } from \"radix-ui\"\n\nimport { cn } from \"../lib/utils\"\n\nfunction Switch({\n className,\n ...props\n}: React.ComponentProps<typeof SwitchPrimitive.Root>) {\n return (\n <SwitchPrimitive.Root\n data-slot=\"switch\"\n className={cn(\n \"peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-xs transition-colors focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-switch-background\",\n className\n )}\n {...props}\n >\n <SwitchPrimitive.Thumb\n data-slot=\"switch-thumb\"\n className=\"pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0\"\n />\n </SwitchPrimitive.Root>\n )\n}\n\nexport { Switch }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBM;AAjBN,SAAS,UAAU,uBAAuB;AAE1C,SAAS,UAAU;AAEnB,SAAS,OAAO,IAGsC;AAHtC,eACd;AAAA;AAAA,EARF,IAOgB,IAEX,kBAFW,IAEX;AAAA,IADH;AAAA;AAGA,SACE;AAAA,IAAC,gBAAgB;AAAA,IAAhB;AAAA,MACC,aAAU;AAAA,MACV,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,OACI,QANL;AAAA,MAQC;AAAA,QAAC,gBAAgB;AAAA,QAAhB;AAAA,UACC,aAAU;AAAA,UACV,WAAU;AAAA;AAAA,MACZ;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -5,7 +5,7 @@ import { Tabs as Tabs$1 } from 'radix-ui';
|
|
|
5
5
|
|
|
6
6
|
declare function Tabs({ className, orientation, ...props }: React.ComponentProps<typeof Tabs$1.Root>): React.JSX.Element;
|
|
7
7
|
declare const tabsListVariants: (props?: ({
|
|
8
|
-
variant?: "
|
|
8
|
+
variant?: "line" | "default" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
10
|
declare function TabsList({ className, variant, ...props }: React.ComponentProps<typeof Tabs$1.List> & VariantProps<typeof tabsListVariants>): React.JSX.Element;
|
|
11
11
|
declare function TabsTrigger({ className, ...props }: React.ComponentProps<typeof Tabs$1.Trigger>): React.JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
interface VariableDef {
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
source?: string;
|
|
7
|
+
}
|
|
8
|
+
interface VariableGroup {
|
|
9
|
+
label: string;
|
|
10
|
+
variables: VariableDef[];
|
|
11
|
+
}
|
|
12
|
+
interface VariableAutocompleteProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onSelect"> {
|
|
13
|
+
groups: VariableGroup[];
|
|
14
|
+
filter?: string;
|
|
15
|
+
onSelect: (variable: VariableDef) => void;
|
|
16
|
+
onClose: () => void;
|
|
17
|
+
maxResults?: number;
|
|
18
|
+
}
|
|
19
|
+
declare function VariableAutocomplete({ groups, filter, onSelect, onClose, maxResults, className, ...rest }: VariableAutocompleteProps): React.JSX.Element | null;
|
|
20
|
+
|
|
21
|
+
export { VariableAutocomplete, type VariableAutocompleteProps, type VariableDef, type VariableGroup };
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
"use client";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __defProps = Object.defineProperties;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
36
|
+
import * as React from "react";
|
|
37
|
+
import { cn } from "../lib/utils.js";
|
|
38
|
+
function VariableAutocomplete(_a) {
|
|
39
|
+
var _b = _a, {
|
|
40
|
+
groups,
|
|
41
|
+
filter = "",
|
|
42
|
+
onSelect,
|
|
43
|
+
onClose,
|
|
44
|
+
maxResults = 10,
|
|
45
|
+
className
|
|
46
|
+
} = _b, rest = __objRest(_b, [
|
|
47
|
+
"groups",
|
|
48
|
+
"filter",
|
|
49
|
+
"onSelect",
|
|
50
|
+
"onClose",
|
|
51
|
+
"maxResults",
|
|
52
|
+
"className"
|
|
53
|
+
]);
|
|
54
|
+
const containerRef = React.useRef(null);
|
|
55
|
+
const [activeIndex, setActiveIndex] = React.useState(-1);
|
|
56
|
+
const filteredGroups = React.useMemo(
|
|
57
|
+
() => groups.map((group) => __spreadProps(__spreadValues({}, group), {
|
|
58
|
+
variables: group.variables.filter(
|
|
59
|
+
(v) => v.name.toLowerCase().startsWith(filter.toLowerCase())
|
|
60
|
+
)
|
|
61
|
+
})).filter((group) => group.variables.length > 0),
|
|
62
|
+
[groups, filter]
|
|
63
|
+
);
|
|
64
|
+
const allFiltered = React.useMemo(() => {
|
|
65
|
+
const result = [];
|
|
66
|
+
for (const group of filteredGroups) {
|
|
67
|
+
for (const variable of group.variables) {
|
|
68
|
+
if (result.length >= maxResults) break;
|
|
69
|
+
result.push({ group, variable });
|
|
70
|
+
}
|
|
71
|
+
if (result.length >= maxResults) break;
|
|
72
|
+
}
|
|
73
|
+
return result;
|
|
74
|
+
}, [filteredGroups, maxResults]);
|
|
75
|
+
React.useEffect(() => {
|
|
76
|
+
setActiveIndex(-1);
|
|
77
|
+
}, [filter]);
|
|
78
|
+
React.useEffect(() => {
|
|
79
|
+
function handleMouseDown(e) {
|
|
80
|
+
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
81
|
+
onClose();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function handleKeyDown(e) {
|
|
85
|
+
if (e.key === "Escape") {
|
|
86
|
+
onClose();
|
|
87
|
+
}
|
|
88
|
+
if (e.key === "ArrowDown") {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
setActiveIndex((prev) => prev < allFiltered.length - 1 ? prev + 1 : 0);
|
|
91
|
+
}
|
|
92
|
+
if (e.key === "ArrowUp") {
|
|
93
|
+
e.preventDefault();
|
|
94
|
+
setActiveIndex((prev) => prev > 0 ? prev - 1 : allFiltered.length - 1);
|
|
95
|
+
}
|
|
96
|
+
if (e.key === "Enter" && activeIndex >= 0 && activeIndex < allFiltered.length) {
|
|
97
|
+
e.preventDefault();
|
|
98
|
+
onSelect(allFiltered[activeIndex].variable);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
document.addEventListener("mousedown", handleMouseDown);
|
|
102
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
103
|
+
return () => {
|
|
104
|
+
document.removeEventListener("mousedown", handleMouseDown);
|
|
105
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
106
|
+
};
|
|
107
|
+
}, [onClose, onSelect, allFiltered, activeIndex]);
|
|
108
|
+
if (allFiltered.length === 0) {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
const groupsToRender = [];
|
|
112
|
+
let flatIndex = 0;
|
|
113
|
+
for (const group of filteredGroups) {
|
|
114
|
+
const items = [];
|
|
115
|
+
for (const variable of group.variables) {
|
|
116
|
+
if (flatIndex >= maxResults) break;
|
|
117
|
+
items.push({ variable, flatIndex });
|
|
118
|
+
flatIndex++;
|
|
119
|
+
}
|
|
120
|
+
if (items.length > 0) {
|
|
121
|
+
groupsToRender.push({ label: group.label, items });
|
|
122
|
+
}
|
|
123
|
+
if (flatIndex >= maxResults) break;
|
|
124
|
+
}
|
|
125
|
+
return /* @__PURE__ */ jsxs(
|
|
126
|
+
"div",
|
|
127
|
+
__spreadProps(__spreadValues({
|
|
128
|
+
ref: containerRef,
|
|
129
|
+
"data-slot": "variable-autocomplete",
|
|
130
|
+
className: cn(
|
|
131
|
+
"absolute z-50 bg-popover border border-border rounded-lg shadow-lg w-64 overflow-hidden",
|
|
132
|
+
className
|
|
133
|
+
)
|
|
134
|
+
}, rest), {
|
|
135
|
+
children: [
|
|
136
|
+
/* @__PURE__ */ jsx("div", { "data-slot": "variable-autocomplete-header", className: "px-3 py-1.5 border-b border-border", children: /* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium text-muted-foreground uppercase tracking-wider", children: "Insert variable" }) }),
|
|
137
|
+
/* @__PURE__ */ jsx("div", { role: "listbox", "aria-label": "Variables", className: "overflow-y-auto", style: { maxHeight: "312px" }, children: groupsToRender.map((group) => /* @__PURE__ */ jsxs("div", { role: "group", "aria-label": group.label, children: [
|
|
138
|
+
/* @__PURE__ */ jsx("div", { "data-slot": "variable-autocomplete-group-label", className: "px-3 py-1 text-[10px] font-medium text-muted-foreground/60 uppercase tracking-wider", children: group.label }),
|
|
139
|
+
group.items.map(({ variable, flatIndex: idx }) => /* @__PURE__ */ jsxs(
|
|
140
|
+
"button",
|
|
141
|
+
{
|
|
142
|
+
type: "button",
|
|
143
|
+
role: "option",
|
|
144
|
+
"aria-selected": idx === activeIndex,
|
|
145
|
+
"data-slot": "variable-autocomplete-item",
|
|
146
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
147
|
+
onClick: () => onSelect(variable),
|
|
148
|
+
onMouseEnter: () => setActiveIndex(idx),
|
|
149
|
+
className: cn(
|
|
150
|
+
"w-full text-left px-3 py-2 cursor-pointer transition-colors flex items-start justify-between gap-2",
|
|
151
|
+
idx === activeIndex ? "bg-muted/50" : "hover:bg-muted/30"
|
|
152
|
+
),
|
|
153
|
+
children: [
|
|
154
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
155
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs font-mono text-blue-600", children: `{{${variable.name}}}` }),
|
|
156
|
+
variable.description && /* @__PURE__ */ jsx("div", { className: "text-[10px] text-muted-foreground", children: variable.description })
|
|
157
|
+
] }),
|
|
158
|
+
variable.source && /* @__PURE__ */ jsx("span", { className: "text-[9px] px-1.5 py-0.5 rounded bg-muted/30 text-muted-foreground shrink-0 mt-0.5 capitalize", children: variable.source })
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
`${group.label}:${variable.name}`
|
|
162
|
+
))
|
|
163
|
+
] }, group.label)) })
|
|
164
|
+
]
|
|
165
|
+
})
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
export {
|
|
169
|
+
VariableAutocomplete
|
|
170
|
+
};
|
|
171
|
+
//# sourceMappingURL=variable-autocomplete.js.map
|