acai-ui-library 0.1.20 → 0.1.22
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/app-launcher.cjs +231 -0
- package/dist/components/app-launcher.cjs.map +1 -0
- package/dist/components/app-launcher.d.cts +24 -0
- package/dist/components/app-launcher.d.ts +24 -0
- package/dist/components/app-launcher.js +197 -0
- package/dist/components/app-launcher.js.map +1 -0
- package/dist/components/button.d.cts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/calendar.cjs +16 -6
- package/dist/components/calendar.cjs.map +1 -1
- package/dist/components/calendar.js +18 -8
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/card.d.cts +1 -1
- package/dist/components/card.d.ts +1 -1
- package/dist/components/command.d.cts +7 -7
- package/dist/components/command.d.ts +7 -7
- package/dist/components/date-picker.cjs +20 -8
- package/dist/components/date-picker.cjs.map +1 -1
- package/dist/components/date-picker.js +26 -14
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/date-time-picker.cjs +16 -6
- package/dist/components/date-time-picker.cjs.map +1 -1
- package/dist/components/date-time-picker.js +31 -21
- package/dist/components/date-time-picker.js.map +1 -1
- package/dist/components/help-widget/app-id-typecheck.cjs +34 -0
- package/dist/components/help-widget/app-id-typecheck.cjs.map +1 -0
- package/dist/components/help-widget/app-id-typecheck.d.cts +17 -0
- package/dist/components/help-widget/app-id-typecheck.d.ts +17 -0
- package/dist/components/help-widget/app-id-typecheck.js +8 -0
- package/dist/components/help-widget/app-id-typecheck.js.map +1 -0
- package/dist/components/help-widget/consent-dialog.cjs +276 -0
- package/dist/components/help-widget/consent-dialog.cjs.map +1 -0
- package/dist/components/help-widget/consent-dialog.d.cts +17 -0
- package/dist/components/help-widget/consent-dialog.d.ts +17 -0
- package/dist/components/help-widget/consent-dialog.js +239 -0
- package/dist/components/help-widget/consent-dialog.js.map +1 -0
- package/dist/components/help-widget/help-session-banner.cjs +85 -0
- package/dist/components/help-widget/help-session-banner.cjs.map +1 -0
- package/dist/components/help-widget/help-session-banner.d.cts +17 -0
- package/dist/components/help-widget/help-session-banner.d.ts +17 -0
- package/dist/components/help-widget/help-session-banner.js +50 -0
- package/dist/components/help-widget/help-session-banner.js.map +1 -0
- package/dist/components/help-widget/help-widget.cjs +503 -0
- package/dist/components/help-widget/help-widget.cjs.map +1 -0
- package/dist/components/help-widget/help-widget.d.cts +32 -0
- package/dist/components/help-widget/help-widget.d.ts +32 -0
- package/dist/components/help-widget/help-widget.js +468 -0
- package/dist/components/help-widget/help-widget.js.map +1 -0
- package/dist/components/help-widget/highlight-overlay.cjs +84 -0
- package/dist/components/help-widget/highlight-overlay.cjs.map +1 -0
- package/dist/components/help-widget/highlight-overlay.d.cts +24 -0
- package/dist/components/help-widget/highlight-overlay.d.ts +24 -0
- package/dist/components/help-widget/highlight-overlay.js +49 -0
- package/dist/components/help-widget/highlight-overlay.js.map +1 -0
- package/dist/components/help-widget/use-help-session.cjs +85 -0
- package/dist/components/help-widget/use-help-session.cjs.map +1 -0
- package/dist/components/help-widget/use-help-session.d.cts +46 -0
- package/dist/components/help-widget/use-help-session.d.ts +46 -0
- package/dist/components/help-widget/use-help-session.js +50 -0
- package/dist/components/help-widget/use-help-session.js.map +1 -0
- package/dist/components/input-otp.d.cts +2 -2
- package/dist/components/input-otp.d.ts +2 -2
- package/dist/components/resizable.d.cts +1 -1
- package/dist/components/resizable.d.ts +1 -1
- package/dist/index.cjs +583 -83
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +618 -127
- package/dist/index.js.map +1 -1
- package/dist/lib/app-ids.cjs +58 -0
- package/dist/lib/app-ids.cjs.map +1 -0
- package/dist/lib/app-ids.d.cts +12 -0
- package/dist/lib/app-ids.d.ts +12 -0
- package/dist/lib/app-ids.js +32 -0
- package/dist/lib/app-ids.js.map +1 -0
- package/dist/lib/mask-snapshot.cjs +66 -0
- package/dist/lib/mask-snapshot.cjs.map +1 -0
- package/dist/lib/mask-snapshot.d.cts +16 -0
- package/dist/lib/mask-snapshot.d.ts +16 -0
- package/dist/lib/mask-snapshot.js +41 -0
- package/dist/lib/mask-snapshot.js.map +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/components/app-launcher.tsx
|
|
32
|
+
var app_launcher_exports = {};
|
|
33
|
+
__export(app_launcher_exports, {
|
|
34
|
+
AppLauncher: () => AppLauncher
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(app_launcher_exports);
|
|
37
|
+
var React2 = __toESM(require("react"), 1);
|
|
38
|
+
var import_lucide_react = require("lucide-react");
|
|
39
|
+
|
|
40
|
+
// src/components/popover.tsx
|
|
41
|
+
var React = __toESM(require("react"), 1);
|
|
42
|
+
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"), 1);
|
|
43
|
+
|
|
44
|
+
// src/lib/utils.ts
|
|
45
|
+
var import_clsx = require("clsx");
|
|
46
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
47
|
+
function cn(...inputs) {
|
|
48
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// src/components/popover.tsx
|
|
52
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
53
|
+
var Popover = PopoverPrimitive.Root;
|
|
54
|
+
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
55
|
+
var PopoverContent = React.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
56
|
+
PopoverPrimitive.Content,
|
|
57
|
+
{
|
|
58
|
+
ref,
|
|
59
|
+
align,
|
|
60
|
+
sideOffset,
|
|
61
|
+
className: cn(
|
|
62
|
+
"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
63
|
+
className
|
|
64
|
+
),
|
|
65
|
+
...props
|
|
66
|
+
}
|
|
67
|
+
) }));
|
|
68
|
+
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
69
|
+
|
|
70
|
+
// src/components/app-launcher.tsx
|
|
71
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
72
|
+
function loadPinnedIds(storageKey) {
|
|
73
|
+
if (typeof window === "undefined") return [];
|
|
74
|
+
try {
|
|
75
|
+
return JSON.parse(localStorage.getItem(storageKey) ?? "[]");
|
|
76
|
+
} catch {
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
var DefaultTrigger = React2.forwardRef(
|
|
81
|
+
({ active }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
82
|
+
"button",
|
|
83
|
+
{
|
|
84
|
+
ref,
|
|
85
|
+
type: "button",
|
|
86
|
+
"aria-label": "Apps",
|
|
87
|
+
className: cn(
|
|
88
|
+
"flex size-9 items-center justify-center rounded-md transition-colors",
|
|
89
|
+
active ? "bg-muted text-foreground" : "text-muted-foreground hover:bg-muted/70 hover:text-foreground"
|
|
90
|
+
),
|
|
91
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.LayoutGrid, { className: "size-[18px]" })
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
);
|
|
95
|
+
DefaultTrigger.displayName = "AppLauncherDefaultTrigger";
|
|
96
|
+
function AppTile({
|
|
97
|
+
app,
|
|
98
|
+
pinned,
|
|
99
|
+
pinningEnabled,
|
|
100
|
+
onLaunch,
|
|
101
|
+
onTogglePin
|
|
102
|
+
}) {
|
|
103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
104
|
+
"button",
|
|
105
|
+
{
|
|
106
|
+
type: "button",
|
|
107
|
+
onClick: () => onLaunch(app),
|
|
108
|
+
className: "group relative flex flex-col items-center gap-2 rounded-xl p-2.5 text-center outline-none transition-colors duration-150 hover:bg-muted/60 focus-visible:bg-muted/60",
|
|
109
|
+
children: [
|
|
110
|
+
pinningEnabled && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
111
|
+
"span",
|
|
112
|
+
{
|
|
113
|
+
role: "button",
|
|
114
|
+
tabIndex: 0,
|
|
115
|
+
"aria-label": pinned ? "Unpin app" : "Pin app",
|
|
116
|
+
onClick: (e) => {
|
|
117
|
+
e.stopPropagation();
|
|
118
|
+
onTogglePin(app.id);
|
|
119
|
+
},
|
|
120
|
+
onKeyDown: (e) => {
|
|
121
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
122
|
+
e.stopPropagation();
|
|
123
|
+
e.preventDefault();
|
|
124
|
+
onTogglePin(app.id);
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
className: cn(
|
|
128
|
+
"absolute right-1 top-1 z-10 flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground transition-opacity",
|
|
129
|
+
pinned ? "text-primary opacity-100" : "opacity-0 hover:text-foreground group-hover:opacity-100"
|
|
130
|
+
),
|
|
131
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.Pin, { className: cn("size-3", pinned && "fill-current") })
|
|
132
|
+
}
|
|
133
|
+
),
|
|
134
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "relative flex h-12 w-12 items-center justify-center rounded-2xl bg-muted/50 shadow-sm ring-1 ring-border/60 transition-transform duration-150 group-hover:scale-[1.06] group-hover:shadow-md", children: app.iconUrl ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("img", { src: app.iconUrl, alt: "", className: "h-full w-full rounded-2xl object-contain p-2" }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "flex h-full w-full items-center justify-center rounded-2xl text-sm font-semibold text-primary", children: app.displayName.slice(0, 1).toUpperCase() }) }),
|
|
135
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "line-clamp-2 text-[11px] font-medium leading-tight text-foreground", children: app.displayName })
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
var AppLauncher = React2.forwardRef(
|
|
141
|
+
({
|
|
142
|
+
apps,
|
|
143
|
+
isLoading = false,
|
|
144
|
+
onLaunch,
|
|
145
|
+
title = "Apps",
|
|
146
|
+
emptyLabel = "No apps available",
|
|
147
|
+
pinStorageKey,
|
|
148
|
+
maxPins = 4,
|
|
149
|
+
trigger,
|
|
150
|
+
open,
|
|
151
|
+
onOpenChange,
|
|
152
|
+
className
|
|
153
|
+
}, ref) => {
|
|
154
|
+
const [internalOpen, setInternalOpen] = React2.useState(false);
|
|
155
|
+
const isOpen = open ?? internalOpen;
|
|
156
|
+
const setOpen = onOpenChange ?? setInternalOpen;
|
|
157
|
+
const [pinnedIds, setPinnedIds] = React2.useState([]);
|
|
158
|
+
React2.useEffect(() => {
|
|
159
|
+
if (pinStorageKey) setPinnedIds(loadPinnedIds(pinStorageKey));
|
|
160
|
+
}, [pinStorageKey]);
|
|
161
|
+
const togglePin = (id) => {
|
|
162
|
+
if (!pinStorageKey) return;
|
|
163
|
+
setPinnedIds((prev) => {
|
|
164
|
+
const next = prev.includes(id) ? prev.filter((p) => p !== id) : [...prev, id].slice(-maxPins);
|
|
165
|
+
localStorage.setItem(pinStorageKey, JSON.stringify(next));
|
|
166
|
+
return next;
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
const handleLaunch = (app) => {
|
|
170
|
+
onLaunch(app);
|
|
171
|
+
setOpen(false);
|
|
172
|
+
};
|
|
173
|
+
const pinningEnabled = !!pinStorageKey;
|
|
174
|
+
const pinnedApps = pinningEnabled ? pinnedIds.map((id) => apps.find((a) => a.id === id)).filter((a) => !!a) : [];
|
|
175
|
+
const restApps = pinningEnabled ? apps.filter((a) => !pinnedIds.includes(a.id)) : apps;
|
|
176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Popover, { open: isOpen, onOpenChange: setOpen, children: [
|
|
177
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PopoverTrigger, { asChild: true, children: trigger ?? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DefaultTrigger, { ref, active: isOpen }) }),
|
|
178
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
179
|
+
PopoverContent,
|
|
180
|
+
{
|
|
181
|
+
align: "end",
|
|
182
|
+
sideOffset: 10,
|
|
183
|
+
className: cn("w-[22rem] border-none bg-transparent p-0 shadow-none", className),
|
|
184
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "overflow-hidden rounded-2xl border border-border/60 bg-card shadow-2xl shadow-black/10 ring-1 ring-border/50 dark:shadow-black/40", children: [
|
|
185
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center justify-between px-4 pb-3 pt-4", children: [
|
|
186
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "text-[13px] font-semibold tracking-tight text-foreground", children: title }),
|
|
187
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "text-[11px] font-medium text-muted-foreground", children: apps.length > 0 ? apps.length : "" })
|
|
188
|
+
] }),
|
|
189
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "max-h-96 overflow-y-auto px-2 pb-3", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "grid grid-cols-4 gap-1 p-1", children: Array.from({ length: 8 }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex flex-col items-center gap-2 rounded-xl p-2.5", children: [
|
|
190
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "h-12 w-12 animate-pulse rounded-2xl bg-muted/60" }),
|
|
191
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "h-2.5 w-10 animate-pulse rounded-full bg-muted/60" })
|
|
192
|
+
] }, i)) }) : apps.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "py-10 text-center text-sm text-muted-foreground", children: emptyLabel }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
193
|
+
pinnedApps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
194
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "px-1 pb-1.5 pt-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground", children: "Pinned" }),
|
|
195
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "grid grid-cols-4 gap-1", children: pinnedApps.map((app) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
196
|
+
AppTile,
|
|
197
|
+
{
|
|
198
|
+
app,
|
|
199
|
+
pinned: true,
|
|
200
|
+
pinningEnabled,
|
|
201
|
+
onLaunch: handleLaunch,
|
|
202
|
+
onTogglePin: togglePin
|
|
203
|
+
},
|
|
204
|
+
app.id
|
|
205
|
+
)) }),
|
|
206
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "my-2 border-t border-border/60" })
|
|
207
|
+
] }),
|
|
208
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "grid grid-cols-4 gap-1", children: restApps.map((app) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
209
|
+
AppTile,
|
|
210
|
+
{
|
|
211
|
+
app,
|
|
212
|
+
pinned: false,
|
|
213
|
+
pinningEnabled,
|
|
214
|
+
onLaunch: handleLaunch,
|
|
215
|
+
onTogglePin: togglePin
|
|
216
|
+
},
|
|
217
|
+
app.id
|
|
218
|
+
)) })
|
|
219
|
+
] }) })
|
|
220
|
+
] })
|
|
221
|
+
}
|
|
222
|
+
)
|
|
223
|
+
] });
|
|
224
|
+
}
|
|
225
|
+
);
|
|
226
|
+
AppLauncher.displayName = "AppLauncher";
|
|
227
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
228
|
+
0 && (module.exports = {
|
|
229
|
+
AppLauncher
|
|
230
|
+
});
|
|
231
|
+
//# sourceMappingURL=app-launcher.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/app-launcher.tsx","../../src/components/popover.tsx","../../src/lib/utils.ts"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { LayoutGrid, Pin } from \"lucide-react\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\"\nimport { cn } from \"../lib/utils\"\n\nexport interface AppLauncherApp {\n id: string\n displayName: string\n iconUrl?: string | null\n}\n\nexport interface AppLauncherProps {\n apps: AppLauncherApp[]\n isLoading?: boolean\n onLaunch: (app: AppLauncherApp) => void\n title?: string\n emptyLabel?: string\n /** Enables the pinned-apps row, persisted to localStorage under this key. Omit to disable pinning. */\n pinStorageKey?: string\n maxPins?: number\n trigger?: React.ReactNode\n open?: boolean\n onOpenChange?: (open: boolean) => void\n className?: string\n}\n\nfunction loadPinnedIds(storageKey: string): string[] {\n if (typeof window === \"undefined\") return []\n try {\n return JSON.parse(localStorage.getItem(storageKey) ?? \"[]\")\n } catch {\n return []\n }\n}\n\nconst DefaultTrigger = React.forwardRef<HTMLButtonElement, { active?: boolean }>(\n ({ active }, ref) => (\n <button\n ref={ref}\n type=\"button\"\n aria-label=\"Apps\"\n className={cn(\n \"flex size-9 items-center justify-center rounded-md transition-colors\",\n active\n ? \"bg-muted text-foreground\"\n : \"text-muted-foreground hover:bg-muted/70 hover:text-foreground\"\n )}\n >\n <LayoutGrid className=\"size-[18px]\" />\n </button>\n )\n)\nDefaultTrigger.displayName = \"AppLauncherDefaultTrigger\"\n\nfunction AppTile({\n app,\n pinned,\n pinningEnabled,\n onLaunch,\n onTogglePin,\n}: {\n app: AppLauncherApp\n pinned: boolean\n pinningEnabled: boolean\n onLaunch: (app: AppLauncherApp) => void\n onTogglePin: (id: string) => void\n}) {\n return (\n <button\n type=\"button\"\n onClick={() => onLaunch(app)}\n className=\"group relative flex flex-col items-center gap-2 rounded-xl p-2.5 text-center outline-none transition-colors duration-150 hover:bg-muted/60 focus-visible:bg-muted/60\"\n >\n {pinningEnabled && (\n <span\n role=\"button\"\n tabIndex={0}\n aria-label={pinned ? \"Unpin app\" : \"Pin app\"}\n onClick={(e) => {\n e.stopPropagation()\n onTogglePin(app.id)\n }}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.stopPropagation()\n e.preventDefault()\n onTogglePin(app.id)\n }\n }}\n className={cn(\n \"absolute right-1 top-1 z-10 flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground transition-opacity\",\n pinned ? \"text-primary opacity-100\" : \"opacity-0 hover:text-foreground group-hover:opacity-100\"\n )}\n >\n <Pin className={cn(\"size-3\", pinned && \"fill-current\")} />\n </span>\n )}\n\n <span className=\"relative flex h-12 w-12 items-center justify-center rounded-2xl bg-muted/50 shadow-sm ring-1 ring-border/60 transition-transform duration-150 group-hover:scale-[1.06] group-hover:shadow-md\">\n {app.iconUrl ? (\n <img src={app.iconUrl} alt=\"\" className=\"h-full w-full rounded-2xl object-contain p-2\" />\n ) : (\n <span className=\"flex h-full w-full items-center justify-center rounded-2xl text-sm font-semibold text-primary\">\n {app.displayName.slice(0, 1).toUpperCase()}\n </span>\n )}\n </span>\n <span className=\"line-clamp-2 text-[11px] font-medium leading-tight text-foreground\">\n {app.displayName}\n </span>\n </button>\n )\n}\n\nconst AppLauncher = React.forwardRef<HTMLButtonElement, AppLauncherProps>(\n (\n {\n apps,\n isLoading = false,\n onLaunch,\n title = \"Apps\",\n emptyLabel = \"No apps available\",\n pinStorageKey,\n maxPins = 4,\n trigger,\n open,\n onOpenChange,\n className,\n },\n ref\n ) => {\n const [internalOpen, setInternalOpen] = React.useState(false)\n const isOpen = open ?? internalOpen\n const setOpen = onOpenChange ?? setInternalOpen\n\n const [pinnedIds, setPinnedIds] = React.useState<string[]>([])\n React.useEffect(() => {\n if (pinStorageKey) setPinnedIds(loadPinnedIds(pinStorageKey))\n }, [pinStorageKey])\n\n const togglePin = (id: string) => {\n if (!pinStorageKey) return\n setPinnedIds((prev) => {\n const next = prev.includes(id) ? prev.filter((p) => p !== id) : [...prev, id].slice(-maxPins)\n localStorage.setItem(pinStorageKey, JSON.stringify(next))\n return next\n })\n }\n\n const handleLaunch = (app: AppLauncherApp) => {\n onLaunch(app)\n setOpen(false)\n }\n\n const pinningEnabled = !!pinStorageKey\n const pinnedApps = pinningEnabled\n ? pinnedIds.map((id) => apps.find((a) => a.id === id)).filter((a): a is AppLauncherApp => !!a)\n : []\n const restApps = pinningEnabled ? apps.filter((a) => !pinnedIds.includes(a.id)) : apps\n\n return (\n <Popover open={isOpen} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n {trigger ?? <DefaultTrigger ref={ref} active={isOpen} />}\n </PopoverTrigger>\n <PopoverContent\n align=\"end\"\n sideOffset={10}\n className={cn(\"w-[22rem] border-none bg-transparent p-0 shadow-none\", className)}\n >\n <div className=\"overflow-hidden rounded-2xl border border-border/60 bg-card shadow-2xl shadow-black/10 ring-1 ring-border/50 dark:shadow-black/40\">\n <div className=\"flex items-center justify-between px-4 pb-3 pt-4\">\n <span className=\"text-[13px] font-semibold tracking-tight text-foreground\">{title}</span>\n <span className=\"text-[11px] font-medium text-muted-foreground\">\n {apps.length > 0 ? apps.length : \"\"}\n </span>\n </div>\n\n <div className=\"max-h-96 overflow-y-auto px-2 pb-3\">\n {isLoading ? (\n <div className=\"grid grid-cols-4 gap-1 p-1\">\n {Array.from({ length: 8 }).map((_, i) => (\n <div key={i} className=\"flex flex-col items-center gap-2 rounded-xl p-2.5\">\n <div className=\"h-12 w-12 animate-pulse rounded-2xl bg-muted/60\" />\n <div className=\"h-2.5 w-10 animate-pulse rounded-full bg-muted/60\" />\n </div>\n ))}\n </div>\n ) : apps.length === 0 ? (\n <p className=\"py-10 text-center text-sm text-muted-foreground\">{emptyLabel}</p>\n ) : (\n <>\n {pinnedApps.length > 0 && (\n <>\n <div className=\"px-1 pb-1.5 pt-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground\">\n Pinned\n </div>\n <div className=\"grid grid-cols-4 gap-1\">\n {pinnedApps.map((app) => (\n <AppTile\n key={app.id}\n app={app}\n pinned\n pinningEnabled={pinningEnabled}\n onLaunch={handleLaunch}\n onTogglePin={togglePin}\n />\n ))}\n </div>\n <div className=\"my-2 border-t border-border/60\" />\n </>\n )}\n <div className=\"grid grid-cols-4 gap-1\">\n {restApps.map((app) => (\n <AppTile\n key={app.id}\n app={app}\n pinned={false}\n pinningEnabled={pinningEnabled}\n onLaunch={handleLaunch}\n onTogglePin={togglePin}\n />\n ))}\n </div>\n </>\n )}\n </div>\n </div>\n </PopoverContent>\n </Popover>\n )\n }\n)\nAppLauncher.displayName = \"AppLauncher\"\n\nexport { AppLauncher }\n","import * as React from \"react\"\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\"\nimport { cn } from \"../lib/utils\"\n\nconst Popover = PopoverPrimitive.Root\nconst PopoverTrigger = PopoverPrimitive.Trigger\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(({ className, align = \"center\", sideOffset = 4, ...props }, ref) => (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n))\nPopoverContent.displayName = PopoverPrimitive.Content.displayName\n\nexport { Popover, PopoverTrigger, PopoverContent }\n","import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,SAAuB;AACvB,0BAAgC;;;ACHhC,YAAuB;AACvB,uBAAkC;;;ACDlC,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ADOI;AARJ,IAAM,UAA2B;AACjC,IAAM,iBAAkC;AAExC,IAAM,iBAAuB,iBAG3B,CAAC,EAAE,WAAW,QAAQ,UAAU,aAAa,GAAG,GAAG,MAAM,GAAG,QAC5D,4CAAkB,yBAAjB,EACC;AAAA,EAAkB;AAAA,EAAjB;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,IACC,GAAG;AAAA;AACN,GACF,CACD;AACD,eAAe,cAA+B,yBAAQ;;;AD0BhD,IAAAC,sBAAA;AAtBN,SAAS,cAAc,YAA8B;AACnD,MAAI,OAAO,WAAW,YAAa,QAAO,CAAC;AAC3C,MAAI;AACF,WAAO,KAAK,MAAM,aAAa,QAAQ,UAAU,KAAK,IAAI;AAAA,EAC5D,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AACF;AAEA,IAAM,iBAAuB;AAAA,EAC3B,CAAC,EAAE,OAAO,GAAG,QACX;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,MAAK;AAAA,MACL,cAAW;AAAA,MACX,WAAW;AAAA,QACT;AAAA,QACA,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ppLauncherApp {
|
|
4
|
+
id: string;
|
|
5
|
+
displayName: string;
|
|
6
|
+
iconUrl?: string | null;
|
|
7
|
+
}
|
|
8
|
+
interface AppLauncherProps {
|
|
9
|
+
apps: AppLauncherApp[];
|
|
10
|
+
isLoading?: boolean;
|
|
11
|
+
onLaunch: (app: AppLauncherApp) => void;
|
|
12
|
+
title?: string;
|
|
13
|
+
emptyLabel?: string;
|
|
14
|
+
/** Enables the pinned-apps row, persisted to localStorage under this key. Omit to disable pinning. */
|
|
15
|
+
pinStorageKey?: string;
|
|
16
|
+
maxPins?: number;
|
|
17
|
+
trigger?: React.ReactNode;
|
|
18
|
+
open?: boolean;
|
|
19
|
+
onOpenChange?: (open: boolean) => void;
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
declare const AppLauncher: React.ForwardRefExoticComponent<AppLauncherProps & React.RefAttributes<HTMLButtonElement>>;
|
|
23
|
+
|
|
24
|
+
export { AppLauncher, type AppLauncherApp, type AppLauncherProps };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
interface AppLauncherApp {
|
|
4
|
+
id: string;
|
|
5
|
+
displayName: string;
|
|
6
|
+
iconUrl?: string | null;
|
|
7
|
+
}
|
|
8
|
+
interface AppLauncherProps {
|
|
9
|
+
apps: AppLauncherApp[];
|
|
10
|
+
isLoading?: boolean;
|
|
11
|
+
onLaunch: (app: AppLauncherApp) => void;
|
|
12
|
+
title?: string;
|
|
13
|
+
emptyLabel?: string;
|
|
14
|
+
/** Enables the pinned-apps row, persisted to localStorage under this key. Omit to disable pinning. */
|
|
15
|
+
pinStorageKey?: string;
|
|
16
|
+
maxPins?: number;
|
|
17
|
+
trigger?: React.ReactNode;
|
|
18
|
+
open?: boolean;
|
|
19
|
+
onOpenChange?: (open: boolean) => void;
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
declare const AppLauncher: React.ForwardRefExoticComponent<AppLauncherProps & React.RefAttributes<HTMLButtonElement>>;
|
|
23
|
+
|
|
24
|
+
export { AppLauncher, type AppLauncherApp, type AppLauncherProps };
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/components/app-launcher.tsx
|
|
4
|
+
import * as React2 from "react";
|
|
5
|
+
import { LayoutGrid, Pin } from "lucide-react";
|
|
6
|
+
|
|
7
|
+
// src/components/popover.tsx
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
10
|
+
|
|
11
|
+
// src/lib/utils.ts
|
|
12
|
+
import { clsx } from "clsx";
|
|
13
|
+
import { twMerge } from "tailwind-merge";
|
|
14
|
+
function cn(...inputs) {
|
|
15
|
+
return twMerge(clsx(inputs));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// src/components/popover.tsx
|
|
19
|
+
import { jsx } from "react/jsx-runtime";
|
|
20
|
+
var Popover = PopoverPrimitive.Root;
|
|
21
|
+
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
22
|
+
var PopoverContent = React.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
23
|
+
PopoverPrimitive.Content,
|
|
24
|
+
{
|
|
25
|
+
ref,
|
|
26
|
+
align,
|
|
27
|
+
sideOffset,
|
|
28
|
+
className: cn(
|
|
29
|
+
"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
30
|
+
className
|
|
31
|
+
),
|
|
32
|
+
...props
|
|
33
|
+
}
|
|
34
|
+
) }));
|
|
35
|
+
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
36
|
+
|
|
37
|
+
// src/components/app-launcher.tsx
|
|
38
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
39
|
+
function loadPinnedIds(storageKey) {
|
|
40
|
+
if (typeof window === "undefined") return [];
|
|
41
|
+
try {
|
|
42
|
+
return JSON.parse(localStorage.getItem(storageKey) ?? "[]");
|
|
43
|
+
} catch {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
var DefaultTrigger = React2.forwardRef(
|
|
48
|
+
({ active }, ref) => /* @__PURE__ */ jsx2(
|
|
49
|
+
"button",
|
|
50
|
+
{
|
|
51
|
+
ref,
|
|
52
|
+
type: "button",
|
|
53
|
+
"aria-label": "Apps",
|
|
54
|
+
className: cn(
|
|
55
|
+
"flex size-9 items-center justify-center rounded-md transition-colors",
|
|
56
|
+
active ? "bg-muted text-foreground" : "text-muted-foreground hover:bg-muted/70 hover:text-foreground"
|
|
57
|
+
),
|
|
58
|
+
children: /* @__PURE__ */ jsx2(LayoutGrid, { className: "size-[18px]" })
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
);
|
|
62
|
+
DefaultTrigger.displayName = "AppLauncherDefaultTrigger";
|
|
63
|
+
function AppTile({
|
|
64
|
+
app,
|
|
65
|
+
pinned,
|
|
66
|
+
pinningEnabled,
|
|
67
|
+
onLaunch,
|
|
68
|
+
onTogglePin
|
|
69
|
+
}) {
|
|
70
|
+
return /* @__PURE__ */ jsxs(
|
|
71
|
+
"button",
|
|
72
|
+
{
|
|
73
|
+
type: "button",
|
|
74
|
+
onClick: () => onLaunch(app),
|
|
75
|
+
className: "group relative flex flex-col items-center gap-2 rounded-xl p-2.5 text-center outline-none transition-colors duration-150 hover:bg-muted/60 focus-visible:bg-muted/60",
|
|
76
|
+
children: [
|
|
77
|
+
pinningEnabled && /* @__PURE__ */ jsx2(
|
|
78
|
+
"span",
|
|
79
|
+
{
|
|
80
|
+
role: "button",
|
|
81
|
+
tabIndex: 0,
|
|
82
|
+
"aria-label": pinned ? "Unpin app" : "Pin app",
|
|
83
|
+
onClick: (e) => {
|
|
84
|
+
e.stopPropagation();
|
|
85
|
+
onTogglePin(app.id);
|
|
86
|
+
},
|
|
87
|
+
onKeyDown: (e) => {
|
|
88
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
89
|
+
e.stopPropagation();
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
onTogglePin(app.id);
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
className: cn(
|
|
95
|
+
"absolute right-1 top-1 z-10 flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground transition-opacity",
|
|
96
|
+
pinned ? "text-primary opacity-100" : "opacity-0 hover:text-foreground group-hover:opacity-100"
|
|
97
|
+
),
|
|
98
|
+
children: /* @__PURE__ */ jsx2(Pin, { className: cn("size-3", pinned && "fill-current") })
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
/* @__PURE__ */ jsx2("span", { className: "relative flex h-12 w-12 items-center justify-center rounded-2xl bg-muted/50 shadow-sm ring-1 ring-border/60 transition-transform duration-150 group-hover:scale-[1.06] group-hover:shadow-md", children: app.iconUrl ? /* @__PURE__ */ jsx2("img", { src: app.iconUrl, alt: "", className: "h-full w-full rounded-2xl object-contain p-2" }) : /* @__PURE__ */ jsx2("span", { className: "flex h-full w-full items-center justify-center rounded-2xl text-sm font-semibold text-primary", children: app.displayName.slice(0, 1).toUpperCase() }) }),
|
|
102
|
+
/* @__PURE__ */ jsx2("span", { className: "line-clamp-2 text-[11px] font-medium leading-tight text-foreground", children: app.displayName })
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
var AppLauncher = React2.forwardRef(
|
|
108
|
+
({
|
|
109
|
+
apps,
|
|
110
|
+
isLoading = false,
|
|
111
|
+
onLaunch,
|
|
112
|
+
title = "Apps",
|
|
113
|
+
emptyLabel = "No apps available",
|
|
114
|
+
pinStorageKey,
|
|
115
|
+
maxPins = 4,
|
|
116
|
+
trigger,
|
|
117
|
+
open,
|
|
118
|
+
onOpenChange,
|
|
119
|
+
className
|
|
120
|
+
}, ref) => {
|
|
121
|
+
const [internalOpen, setInternalOpen] = React2.useState(false);
|
|
122
|
+
const isOpen = open ?? internalOpen;
|
|
123
|
+
const setOpen = onOpenChange ?? setInternalOpen;
|
|
124
|
+
const [pinnedIds, setPinnedIds] = React2.useState([]);
|
|
125
|
+
React2.useEffect(() => {
|
|
126
|
+
if (pinStorageKey) setPinnedIds(loadPinnedIds(pinStorageKey));
|
|
127
|
+
}, [pinStorageKey]);
|
|
128
|
+
const togglePin = (id) => {
|
|
129
|
+
if (!pinStorageKey) return;
|
|
130
|
+
setPinnedIds((prev) => {
|
|
131
|
+
const next = prev.includes(id) ? prev.filter((p) => p !== id) : [...prev, id].slice(-maxPins);
|
|
132
|
+
localStorage.setItem(pinStorageKey, JSON.stringify(next));
|
|
133
|
+
return next;
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
const handleLaunch = (app) => {
|
|
137
|
+
onLaunch(app);
|
|
138
|
+
setOpen(false);
|
|
139
|
+
};
|
|
140
|
+
const pinningEnabled = !!pinStorageKey;
|
|
141
|
+
const pinnedApps = pinningEnabled ? pinnedIds.map((id) => apps.find((a) => a.id === id)).filter((a) => !!a) : [];
|
|
142
|
+
const restApps = pinningEnabled ? apps.filter((a) => !pinnedIds.includes(a.id)) : apps;
|
|
143
|
+
return /* @__PURE__ */ jsxs(Popover, { open: isOpen, onOpenChange: setOpen, children: [
|
|
144
|
+
/* @__PURE__ */ jsx2(PopoverTrigger, { asChild: true, children: trigger ?? /* @__PURE__ */ jsx2(DefaultTrigger, { ref, active: isOpen }) }),
|
|
145
|
+
/* @__PURE__ */ jsx2(
|
|
146
|
+
PopoverContent,
|
|
147
|
+
{
|
|
148
|
+
align: "end",
|
|
149
|
+
sideOffset: 10,
|
|
150
|
+
className: cn("w-[22rem] border-none bg-transparent p-0 shadow-none", className),
|
|
151
|
+
children: /* @__PURE__ */ jsxs("div", { className: "overflow-hidden rounded-2xl border border-border/60 bg-card shadow-2xl shadow-black/10 ring-1 ring-border/50 dark:shadow-black/40", children: [
|
|
152
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 pb-3 pt-4", children: [
|
|
153
|
+
/* @__PURE__ */ jsx2("span", { className: "text-[13px] font-semibold tracking-tight text-foreground", children: title }),
|
|
154
|
+
/* @__PURE__ */ jsx2("span", { className: "text-[11px] font-medium text-muted-foreground", children: apps.length > 0 ? apps.length : "" })
|
|
155
|
+
] }),
|
|
156
|
+
/* @__PURE__ */ jsx2("div", { className: "max-h-96 overflow-y-auto px-2 pb-3", children: isLoading ? /* @__PURE__ */ jsx2("div", { className: "grid grid-cols-4 gap-1 p-1", children: Array.from({ length: 8 }).map((_, i) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2 rounded-xl p-2.5", children: [
|
|
157
|
+
/* @__PURE__ */ jsx2("div", { className: "h-12 w-12 animate-pulse rounded-2xl bg-muted/60" }),
|
|
158
|
+
/* @__PURE__ */ jsx2("div", { className: "h-2.5 w-10 animate-pulse rounded-full bg-muted/60" })
|
|
159
|
+
] }, i)) }) : apps.length === 0 ? /* @__PURE__ */ jsx2("p", { className: "py-10 text-center text-sm text-muted-foreground", children: emptyLabel }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
160
|
+
pinnedApps.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
161
|
+
/* @__PURE__ */ jsx2("div", { className: "px-1 pb-1.5 pt-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground", children: "Pinned" }),
|
|
162
|
+
/* @__PURE__ */ jsx2("div", { className: "grid grid-cols-4 gap-1", children: pinnedApps.map((app) => /* @__PURE__ */ jsx2(
|
|
163
|
+
AppTile,
|
|
164
|
+
{
|
|
165
|
+
app,
|
|
166
|
+
pinned: true,
|
|
167
|
+
pinningEnabled,
|
|
168
|
+
onLaunch: handleLaunch,
|
|
169
|
+
onTogglePin: togglePin
|
|
170
|
+
},
|
|
171
|
+
app.id
|
|
172
|
+
)) }),
|
|
173
|
+
/* @__PURE__ */ jsx2("div", { className: "my-2 border-t border-border/60" })
|
|
174
|
+
] }),
|
|
175
|
+
/* @__PURE__ */ jsx2("div", { className: "grid grid-cols-4 gap-1", children: restApps.map((app) => /* @__PURE__ */ jsx2(
|
|
176
|
+
AppTile,
|
|
177
|
+
{
|
|
178
|
+
app,
|
|
179
|
+
pinned: false,
|
|
180
|
+
pinningEnabled,
|
|
181
|
+
onLaunch: handleLaunch,
|
|
182
|
+
onTogglePin: togglePin
|
|
183
|
+
},
|
|
184
|
+
app.id
|
|
185
|
+
)) })
|
|
186
|
+
] }) })
|
|
187
|
+
] })
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
] });
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
AppLauncher.displayName = "AppLauncher";
|
|
194
|
+
export {
|
|
195
|
+
AppLauncher
|
|
196
|
+
};
|
|
197
|
+
//# sourceMappingURL=app-launcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/app-launcher.tsx","../../src/components/popover.tsx","../../src/lib/utils.ts"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { LayoutGrid, Pin } from \"lucide-react\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\"\nimport { cn } from \"../lib/utils\"\n\nexport interface AppLauncherApp {\n id: string\n displayName: string\n iconUrl?: string | null\n}\n\nexport interface AppLauncherProps {\n apps: AppLauncherApp[]\n isLoading?: boolean\n onLaunch: (app: AppLauncherApp) => void\n title?: string\n emptyLabel?: string\n /** Enables the pinned-apps row, persisted to localStorage under this key. Omit to disable pinning. */\n pinStorageKey?: string\n maxPins?: number\n trigger?: React.ReactNode\n open?: boolean\n onOpenChange?: (open: boolean) => void\n className?: string\n}\n\nfunction loadPinnedIds(storageKey: string): string[] {\n if (typeof window === \"undefined\") return []\n try {\n return JSON.parse(localStorage.getItem(storageKey) ?? \"[]\")\n } catch {\n return []\n }\n}\n\nconst DefaultTrigger = React.forwardRef<HTMLButtonElement, { active?: boolean }>(\n ({ active }, ref) => (\n <button\n ref={ref}\n type=\"button\"\n aria-label=\"Apps\"\n className={cn(\n \"flex size-9 items-center justify-center rounded-md transition-colors\",\n active\n ? \"bg-muted text-foreground\"\n : \"text-muted-foreground hover:bg-muted/70 hover:text-foreground\"\n )}\n >\n <LayoutGrid className=\"size-[18px]\" />\n </button>\n )\n)\nDefaultTrigger.displayName = \"AppLauncherDefaultTrigger\"\n\nfunction AppTile({\n app,\n pinned,\n pinningEnabled,\n onLaunch,\n onTogglePin,\n}: {\n app: AppLauncherApp\n pinned: boolean\n pinningEnabled: boolean\n onLaunch: (app: AppLauncherApp) => void\n onTogglePin: (id: string) => void\n}) {\n return (\n <button\n type=\"button\"\n onClick={() => onLaunch(app)}\n className=\"group relative flex flex-col items-center gap-2 rounded-xl p-2.5 text-center outline-none transition-colors duration-150 hover:bg-muted/60 focus-visible:bg-muted/60\"\n >\n {pinningEnabled && (\n <span\n role=\"button\"\n tabIndex={0}\n aria-label={pinned ? \"Unpin app\" : \"Pin app\"}\n onClick={(e) => {\n e.stopPropagation()\n onTogglePin(app.id)\n }}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.stopPropagation()\n e.preventDefault()\n onTogglePin(app.id)\n }\n }}\n className={cn(\n \"absolute right-1 top-1 z-10 flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground transition-opacity\",\n pinned ? \"text-primary opacity-100\" : \"opacity-0 hover:text-foreground group-hover:opacity-100\"\n )}\n >\n <Pin className={cn(\"size-3\", pinned && \"fill-current\")} />\n </span>\n )}\n\n <span className=\"relative flex h-12 w-12 items-center justify-center rounded-2xl bg-muted/50 shadow-sm ring-1 ring-border/60 transition-transform duration-150 group-hover:scale-[1.06] group-hover:shadow-md\">\n {app.iconUrl ? (\n <img src={app.iconUrl} alt=\"\" className=\"h-full w-full rounded-2xl object-contain p-2\" />\n ) : (\n <span className=\"flex h-full w-full items-center justify-center rounded-2xl text-sm font-semibold text-primary\">\n {app.displayName.slice(0, 1).toUpperCase()}\n </span>\n )}\n </span>\n <span className=\"line-clamp-2 text-[11px] font-medium leading-tight text-foreground\">\n {app.displayName}\n </span>\n </button>\n )\n}\n\nconst AppLauncher = React.forwardRef<HTMLButtonElement, AppLauncherProps>(\n (\n {\n apps,\n isLoading = false,\n onLaunch,\n title = \"Apps\",\n emptyLabel = \"No apps available\",\n pinStorageKey,\n maxPins = 4,\n trigger,\n open,\n onOpenChange,\n className,\n },\n ref\n ) => {\n const [internalOpen, setInternalOpen] = React.useState(false)\n const isOpen = open ?? internalOpen\n const setOpen = onOpenChange ?? setInternalOpen\n\n const [pinnedIds, setPinnedIds] = React.useState<string[]>([])\n React.useEffect(() => {\n if (pinStorageKey) setPinnedIds(loadPinnedIds(pinStorageKey))\n }, [pinStorageKey])\n\n const togglePin = (id: string) => {\n if (!pinStorageKey) return\n setPinnedIds((prev) => {\n const next = prev.includes(id) ? prev.filter((p) => p !== id) : [...prev, id].slice(-maxPins)\n localStorage.setItem(pinStorageKey, JSON.stringify(next))\n return next\n })\n }\n\n const handleLaunch = (app: AppLauncherApp) => {\n onLaunch(app)\n setOpen(false)\n }\n\n const pinningEnabled = !!pinStorageKey\n const pinnedApps = pinningEnabled\n ? pinnedIds.map((id) => apps.find((a) => a.id === id)).filter((a): a is AppLauncherApp => !!a)\n : []\n const restApps = pinningEnabled ? apps.filter((a) => !pinnedIds.includes(a.id)) : apps\n\n return (\n <Popover open={isOpen} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n {trigger ?? <DefaultTrigger ref={ref} active={isOpen} />}\n </PopoverTrigger>\n <PopoverContent\n align=\"end\"\n sideOffset={10}\n className={cn(\"w-[22rem] border-none bg-transparent p-0 shadow-none\", className)}\n >\n <div className=\"overflow-hidden rounded-2xl border border-border/60 bg-card shadow-2xl shadow-black/10 ring-1 ring-border/50 dark:shadow-black/40\">\n <div className=\"flex items-center justify-between px-4 pb-3 pt-4\">\n <span className=\"text-[13px] font-semibold tracking-tight text-foreground\">{title}</span>\n <span className=\"text-[11px] font-medium text-muted-foreground\">\n {apps.length > 0 ? apps.length : \"\"}\n </span>\n </div>\n\n <div className=\"max-h-96 overflow-y-auto px-2 pb-3\">\n {isLoading ? (\n <div className=\"grid grid-cols-4 gap-1 p-1\">\n {Array.from({ length: 8 }).map((_, i) => (\n <div key={i} className=\"flex flex-col items-center gap-2 rounded-xl p-2.5\">\n <div className=\"h-12 w-12 animate-pulse rounded-2xl bg-muted/60\" />\n <div className=\"h-2.5 w-10 animate-pulse rounded-full bg-muted/60\" />\n </div>\n ))}\n </div>\n ) : apps.length === 0 ? (\n <p className=\"py-10 text-center text-sm text-muted-foreground\">{emptyLabel}</p>\n ) : (\n <>\n {pinnedApps.length > 0 && (\n <>\n <div className=\"px-1 pb-1.5 pt-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground\">\n Pinned\n </div>\n <div className=\"grid grid-cols-4 gap-1\">\n {pinnedApps.map((app) => (\n <AppTile\n key={app.id}\n app={app}\n pinned\n pinningEnabled={pinningEnabled}\n onLaunch={handleLaunch}\n onTogglePin={togglePin}\n />\n ))}\n </div>\n <div className=\"my-2 border-t border-border/60\" />\n </>\n )}\n <div className=\"grid grid-cols-4 gap-1\">\n {restApps.map((app) => (\n <AppTile\n key={app.id}\n app={app}\n pinned={false}\n pinningEnabled={pinningEnabled}\n onLaunch={handleLaunch}\n onTogglePin={togglePin}\n />\n ))}\n </div>\n </>\n )}\n </div>\n </div>\n </PopoverContent>\n </Popover>\n )\n }\n)\nAppLauncher.displayName = \"AppLauncher\"\n\nexport { AppLauncher }\n","import * as React from \"react\"\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\"\nimport { cn } from \"../lib/utils\"\n\nconst Popover = PopoverPrimitive.Root\nconst PopoverTrigger = PopoverPrimitive.Trigger\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>\n>(({ className, align = \"center\", sideOffset = 4, ...props }, ref) => (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n))\nPopoverContent.displayName = PopoverPrimitive.Content.displayName\n\nexport { Popover, PopoverTrigger, PopoverContent }\n","import { type ClassValue, clsx } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n"],"mappings":";;;AAEA,YAAYA,YAAW;AACvB,SAAS,YAAY,WAAW;;;ACHhC,YAAY,WAAW;AACvB,YAAY,sBAAsB;;;ACDlC,SAA0B,YAAY;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ADOI;AARJ,IAAM,UAA2B;AACjC,IAAM,iBAAkC;AAExC,IAAM,iBAAuB,iBAG3B,CAAC,EAAE,WAAW,QAAQ,UAAU,aAAa,GAAG,GAAG,MAAM,GAAG,QAC5D,oBAAkB,yBAAjB,EACC;AAAA,EAAkB;AAAA,EAAjB;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,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AU,0BACZ,qBAAW,IAAI,CAAC,QACf,gBAAAA;AAAA,kBAAC;AAAA;AAAA,oBAEC;AAAA,oBACA,QAAM;AAAA,oBACN;AAAA,oBACA,UAAU;AAAA,oBACV,aAAa;AAAA;AAAA,kBALR,IAAI;AAAA,gBAMX,CACD,GACH;AAAA,gBACA,gBAAAA,KAAC,SAAI,WAAU,kCAAiC;AAAA,iBAClD;AAAA,cAEF,gBAAAA,KAAC,SAAI,WAAU,0BACZ,mBAAS,IAAI,CAAC,QACb,gBAAAA;AAAA,gBAAC;AAAA;AAAA,kBAEC;AAAA,kBACA,QAAQ;AAAA,kBACR;AAAA,kBACA,UAAU;AAAA,kBACV,aAAa;AAAA;AAAA,gBALR,IAAI;AAAA,cAMX,CACD,GACH;AAAA,eACF,GAEJ;AAAA,aACF;AAAA;AAAA,MACF;AAAA,OACF;AAAA,EAEJ;AACF;AACA,YAAY,cAAc;","names":["React","jsx"]}
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "default" | "
|
|
6
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | "success" | null | undefined;
|
|
7
7
|
size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-sm" | null | undefined;
|
|
8
8
|
shape?: "default" | "rounded" | "pill" | "square" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "default" | "
|
|
6
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | "success" | null | undefined;
|
|
7
7
|
size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-sm" | null | undefined;
|
|
8
8
|
shape?: "default" | "rounded" | "pill" | "square" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
@@ -35,6 +35,12 @@ function cn(...inputs) {
|
|
|
35
35
|
|
|
36
36
|
// src/components/calendar.tsx
|
|
37
37
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
+
function CalendarSelect({ children, ...selectProps }) {
|
|
39
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
40
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("select", { ...selectProps, children }),
|
|
41
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronDown, { "aria-hidden": "true", className: "pointer-events-none absolute end-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground" })
|
|
42
|
+
] });
|
|
43
|
+
}
|
|
38
44
|
var DEFAULT_YEARS_BACK = 10;
|
|
39
45
|
var DEFAULT_YEARS_FORWARD = 10;
|
|
40
46
|
function Calendar({
|
|
@@ -57,16 +63,16 @@ function Calendar({
|
|
|
57
63
|
showOutsideDays,
|
|
58
64
|
className: cn("w-[260px] rounded-lg p-3", className),
|
|
59
65
|
classNames: {
|
|
60
|
-
months: "flex flex-col",
|
|
66
|
+
months: "relative flex flex-col",
|
|
61
67
|
month: "space-y-3",
|
|
62
68
|
month_caption: "relative flex h-8 items-center justify-center",
|
|
63
69
|
caption_label: "text-sm font-medium hidden",
|
|
64
|
-
nav: "flex items-center",
|
|
70
|
+
nav: "absolute inset-x-0 top-0 flex h-8 items-center",
|
|
65
71
|
button_previous: cn(
|
|
66
|
-
"absolute start-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors cursor-pointer border-none"
|
|
72
|
+
"absolute start-0 top-1/2 -translate-y-1/2 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors cursor-pointer border-none"
|
|
67
73
|
),
|
|
68
74
|
button_next: cn(
|
|
69
|
-
"absolute end-0 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors cursor-pointer border-none"
|
|
75
|
+
"absolute end-0 top-1/2 -translate-y-1/2 inline-flex size-7 items-center justify-center rounded-md bg-transparent p-0 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors cursor-pointer border-none"
|
|
70
76
|
),
|
|
71
77
|
month_grid: "w-full border-collapse",
|
|
72
78
|
weekdays: "flex w-full",
|
|
@@ -83,13 +89,17 @@ function Calendar({
|
|
|
83
89
|
disabled: "[&>button]:text-muted-foreground [&>button]:opacity-40 [&>button]:cursor-default",
|
|
84
90
|
range_middle: "[&>button]:bg-accent [&>button]:text-accent-foreground [&>button]:rounded-none",
|
|
85
91
|
range_start: "[&>button]:rounded-e-none",
|
|
86
|
-
|
|
87
|
-
|
|
92
|
+
dropdown_root: "relative",
|
|
93
|
+
dropdowns: "flex items-center gap-1.5 justify-center",
|
|
94
|
+
dropdown: "h-7 appearance-none rounded-md border border-input bg-background ps-2 pe-6 text-xs font-medium text-foreground cursor-pointer outline-none accent-primary focus:border-ring focus:ring-[2px] focus:ring-ring/20 [&>option:checked]:bg-primary [&>option:checked]:text-primary-foreground [&>option]:py-1",
|
|
95
|
+
months_dropdown: "w-[104px]",
|
|
96
|
+
years_dropdown: "w-[72px]",
|
|
88
97
|
hidden: "invisible",
|
|
89
98
|
...classNames
|
|
90
99
|
},
|
|
91
100
|
captionLayout,
|
|
92
101
|
components: {
|
|
102
|
+
Select: CalendarSelect,
|
|
93
103
|
Chevron: ({ orientation }) => {
|
|
94
104
|
const Icon = orientation === "left" ? import_lucide_react.ChevronLeft : import_lucide_react.ChevronRight;
|
|
95
105
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { className: "size-4" });
|