@nikala-ui/core 0.10.1 → 0.11.0-nightly.b01fa01
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/package.json +1 -1
- package/registry/banner.json +1 -1
- package/registry/bubble.json +18 -0
- package/registry/button-group.json +20 -0
- package/registry/button.json +1 -1
- package/registry/checkbox.json +4 -1
- package/registry/combobox.json +1 -1
- package/registry/command.json +3 -2
- package/registry/context-menu.json +1 -1
- package/registry/create-app-updater.json +13 -0
- package/registry/create-chat-scroll.json +13 -0
- package/registry/create-document-tabs.json +13 -0
- package/registry/create-drop-zone.json +13 -0
- package/registry/create-global-shortcut.json +13 -0
- package/registry/create-pagination.json +13 -0
- package/registry/create-tauri-window.json +13 -0
- package/registry/dialog.json +1 -1
- package/registry/dropdown-menu.json +3 -2
- package/registry/dropzone.json +21 -0
- package/registry/field.json +1 -1
- package/registry/footer.json +18 -0
- package/registry/forgot-password-01.json +28 -0
- package/registry/form-message.json +3 -2
- package/registry/hero-01.json +22 -0
- package/registry/icon-button.json +1 -1
- package/registry/index.json +432 -5
- package/registry/login-01.json +28 -0
- package/registry/marker.json +17 -0
- package/registry/marquee.json +17 -0
- package/registry/message.json +17 -0
- package/registry/navbar.json +19 -0
- package/registry/navigation-menu.json +22 -0
- package/registry/number-input.json +1 -1
- package/registry/otp-verification-01.json +26 -0
- package/registry/pagination.json +22 -0
- package/registry/popover.json +4 -1
- package/registry/rating.json +19 -0
- package/registry/register-01.json +31 -0
- package/registry/resizable.json +1 -1
- package/registry/review-card.json +23 -0
- package/registry/scroll-area.json +1 -1
- package/registry/select.json +3 -2
- package/registry/sheet.json +1 -1
- package/registry/sidebar.json +24 -0
- package/registry/spinner.json +1 -1
- package/registry/stat.json +19 -0
- package/registry/status.json +1 -1
- package/registry/switch.json +4 -1
- package/registry/table.json +17 -0
- package/registry/tabs.json +4 -1
- package/registry/theme-manager.json +4 -3
- package/registry/timeline.json +18 -0
- package/registry/titlebar-tabs.json +24 -0
- package/registry/titlebar.json +26 -0
- package/registry/toggle-group.json +21 -0
- package/registry/updater-modal.json +26 -0
- package/src/registry/blocks/forgot-password-01.tsx +141 -0
- package/src/registry/blocks/hero-01.tsx +28 -0
- package/src/registry/blocks/login-01.tsx +231 -0
- package/src/registry/blocks/otp-verification-01.tsx +170 -0
- package/src/registry/blocks/register-01.tsx +318 -0
- package/src/registry/components/ui/banner.tsx +0 -2
- package/src/registry/components/ui/bubble.tsx +142 -0
- package/src/registry/components/ui/button-group.tsx +42 -0
- package/src/registry/components/ui/button.tsx +1 -1
- package/src/registry/components/ui/checkbox.tsx +1 -1
- package/src/registry/components/ui/combobox.tsx +83 -18
- package/src/registry/components/ui/command.tsx +101 -105
- package/src/registry/components/ui/context-menu.tsx +67 -22
- package/src/registry/components/ui/dialog.tsx +42 -32
- package/src/registry/components/ui/dropdown-menu.tsx +69 -31
- package/src/registry/components/ui/dropzone.tsx +189 -0
- package/src/registry/components/ui/field.tsx +7 -3
- package/src/registry/components/ui/footer.tsx +247 -0
- package/src/registry/components/ui/form-message.tsx +2 -2
- package/src/registry/components/ui/icon-button.tsx +1 -1
- package/src/registry/components/ui/marker.tsx +102 -0
- package/src/registry/components/ui/marquee.tsx +118 -0
- package/src/registry/components/ui/message.tsx +168 -0
- package/src/registry/components/ui/navbar.tsx +375 -0
- package/src/registry/components/ui/navigation-menu.tsx +358 -0
- package/src/registry/components/ui/number-input.tsx +3 -3
- package/src/registry/components/ui/pagination.tsx +258 -0
- package/src/registry/components/ui/popover.tsx +1 -1
- package/src/registry/components/ui/rating.tsx +185 -0
- package/src/registry/components/ui/resizable.tsx +3 -1
- package/src/registry/components/ui/review-card.tsx +195 -0
- package/src/registry/components/ui/scroll-area.tsx +13 -3
- package/src/registry/components/ui/select.tsx +16 -19
- package/src/registry/components/ui/sheet.tsx +58 -53
- package/src/registry/components/ui/sidebar.tsx +692 -0
- package/src/registry/components/ui/spinner.tsx +1 -1
- package/src/registry/components/ui/stat.tsx +245 -0
- package/src/registry/components/ui/status.tsx +7 -5
- package/src/registry/components/ui/switch.tsx +1 -1
- package/src/registry/components/ui/table.tsx +160 -0
- package/src/registry/components/ui/tabs.tsx +1 -1
- package/src/registry/components/ui/theme-toggle.tsx +80 -79
- package/src/registry/components/ui/timeline.tsx +350 -0
- package/src/registry/components/ui/titlebar-tabs.tsx +412 -0
- package/src/registry/components/ui/titlebar.tsx +399 -0
- package/src/registry/components/ui/toggle-group.tsx +203 -0
- package/src/registry/components/ui/updater-modal.tsx +254 -0
- package/src/registry/index.ts +3 -3
- package/src/registry/metadata.ts +184 -5
- package/src/registry/providers/theme-transitions.ts +81 -50
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
useContext,
|
|
4
|
+
splitProps,
|
|
5
|
+
createSignal,
|
|
6
|
+
createEffect,
|
|
7
|
+
onMount,
|
|
8
|
+
onCleanup,
|
|
9
|
+
Show,
|
|
10
|
+
For,
|
|
11
|
+
type Component,
|
|
12
|
+
type JSX,
|
|
13
|
+
type ParentComponent,
|
|
14
|
+
type Accessor,
|
|
15
|
+
} from "solid-js";
|
|
16
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
17
|
+
import { Plus, X, Pin } from "lucide-solid";
|
|
18
|
+
import { Button } from "@/components/ui/button";
|
|
19
|
+
import { Tooltip, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip";
|
|
20
|
+
import {
|
|
21
|
+
type CreateDocumentTabsReturn,
|
|
22
|
+
type TabItem,
|
|
23
|
+
} from "@/hooks/create-document-tabs";
|
|
24
|
+
import { cn } from "@/lib/cn";
|
|
25
|
+
|
|
26
|
+
/* --- 1. Context & Variants --- */
|
|
27
|
+
|
|
28
|
+
export type TitlebarTabsVariant = "editor" | "chrome" | "pills";
|
|
29
|
+
|
|
30
|
+
interface TitlebarTabsContextValue {
|
|
31
|
+
value: Accessor<string | undefined>;
|
|
32
|
+
setValue: (value: string) => void;
|
|
33
|
+
variant: Accessor<TitlebarTabsVariant>;
|
|
34
|
+
manager?: CreateDocumentTabsReturn<any>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const TitlebarTabsContext = createContext<TitlebarTabsContextValue>();
|
|
38
|
+
|
|
39
|
+
export function useTitlebarTabs() {
|
|
40
|
+
const ctx = useContext(TitlebarTabsContext);
|
|
41
|
+
if (!ctx) {
|
|
42
|
+
throw new Error("useTitlebarTabs must be used within a <TitlebarTabs /> container");
|
|
43
|
+
}
|
|
44
|
+
return ctx;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const titlebarTabVariants = cva(
|
|
48
|
+
"group relative inline-flex items-center gap-1.5 px-3 text-xs font-medium select-none cursor-pointer transition-colors shrink-0 max-w-[180px] min-w-[80px]",
|
|
49
|
+
{
|
|
50
|
+
variants: {
|
|
51
|
+
variant: {
|
|
52
|
+
editor:
|
|
53
|
+
"h-full py-1 border-r border-border/40 border-t-2 border-t-transparent hover:bg-muted/40 data-[active=true]:bg-background data-[active=true]:border-t-primary data-[active=true]:text-foreground data-[active=false]:text-muted-foreground",
|
|
54
|
+
chrome:
|
|
55
|
+
"h-[calc(100%-2px)] py-1 rounded-t-lg border-t border-x border-transparent hover:bg-muted/60 data-[active=true]:border-border/70 data-[active=true]:bg-background data-[active=true]:text-foreground data-[active=true]:-mb-px data-[active=true]:shadow-xs data-[active=false]:text-muted-foreground",
|
|
56
|
+
pills:
|
|
57
|
+
"h-7 py-0.5 rounded-md mx-0.5 hover:bg-muted/50 data-[active=true]:bg-primary/10 data-[active=true]:text-primary data-[active=true]:font-semibold data-[active=false]:text-muted-foreground",
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
defaultVariants: {
|
|
61
|
+
variant: "editor",
|
|
62
|
+
},
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
/* --- 2. TitlebarTabs Root Container --- */
|
|
67
|
+
|
|
68
|
+
export interface TitlebarTabsProps extends JSX.HTMLAttributes<HTMLElement> {
|
|
69
|
+
/** Reactive tabs manager instance from createDocumentTabs(). */
|
|
70
|
+
manager?: CreateDocumentTabsReturn<any>;
|
|
71
|
+
/** Controlled active tab identifier value (when not using manager). */
|
|
72
|
+
value?: string;
|
|
73
|
+
/** Uncontrolled default active tab identifier value. */
|
|
74
|
+
defaultValue?: string;
|
|
75
|
+
/** Callback triggered when active tab changes. */
|
|
76
|
+
onValueChange?: (value: string) => void;
|
|
77
|
+
/** Callback triggered when the "+" add tab button is clicked. */
|
|
78
|
+
onAddTab?: () => void;
|
|
79
|
+
/** Visual chrome styling variant. */
|
|
80
|
+
variant?: TitlebarTabsVariant;
|
|
81
|
+
class?: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const TitlebarTabs: ParentComponent<TitlebarTabsProps> = (props) => {
|
|
85
|
+
const [local, rest] = splitProps(props, [
|
|
86
|
+
"manager",
|
|
87
|
+
"value",
|
|
88
|
+
"defaultValue",
|
|
89
|
+
"onValueChange",
|
|
90
|
+
"onAddTab",
|
|
91
|
+
"variant",
|
|
92
|
+
"class",
|
|
93
|
+
"children",
|
|
94
|
+
]);
|
|
95
|
+
|
|
96
|
+
let scrollContainerRef: HTMLDivElement | undefined;
|
|
97
|
+
|
|
98
|
+
const [internalValue, setInternalValue] = createSignal(local.defaultValue || local.value);
|
|
99
|
+
|
|
100
|
+
const activeValue = () => {
|
|
101
|
+
if (local.manager) return local.manager.activeTabId();
|
|
102
|
+
return local.value !== undefined ? local.value : internalValue();
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const variant = () => local.variant || "editor";
|
|
106
|
+
|
|
107
|
+
const setValue = (val: string) => {
|
|
108
|
+
if (local.manager) {
|
|
109
|
+
local.manager.setActiveTab(val);
|
|
110
|
+
} else {
|
|
111
|
+
setInternalValue(val);
|
|
112
|
+
local.onValueChange?.(val);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// Mouse wheel horizontal scroll listener (converts vertical wheel deltaY to horizontal scroll)
|
|
117
|
+
onMount(() => {
|
|
118
|
+
if (!scrollContainerRef) return;
|
|
119
|
+
|
|
120
|
+
const handleWheel = (e: WheelEvent) => {
|
|
121
|
+
if (e.deltaY !== 0) {
|
|
122
|
+
e.preventDefault();
|
|
123
|
+
scrollContainerRef!.scrollLeft += e.deltaY;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
scrollContainerRef.addEventListener("wheel", handleWheel, { passive: false });
|
|
128
|
+
onCleanup(() => {
|
|
129
|
+
scrollContainerRef?.removeEventListener("wheel", handleWheel);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// Auto-scroll to end when tabs are added
|
|
134
|
+
createEffect(() => {
|
|
135
|
+
if (local.manager?.count() && scrollContainerRef) {
|
|
136
|
+
scrollContainerRef.scrollTo({
|
|
137
|
+
left: scrollContainerRef.scrollWidth,
|
|
138
|
+
behavior: "smooth",
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
const contextValue: TitlebarTabsContextValue = {
|
|
144
|
+
value: activeValue,
|
|
145
|
+
setValue,
|
|
146
|
+
variant,
|
|
147
|
+
manager: local.manager,
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<TitlebarTabsContext.Provider value={contextValue}>
|
|
152
|
+
<nav
|
|
153
|
+
aria-label="Window Tabs"
|
|
154
|
+
data-no-drag
|
|
155
|
+
data-tauri-drag-region="false"
|
|
156
|
+
style={"-webkit-app-region: no-drag; app-region: no-drag;" as any}
|
|
157
|
+
class={cn(
|
|
158
|
+
"flex flex-1 h-full overflow-hidden z-10 min-w-0 pointer-events-auto [app-region:no-drag] [-webkit-app-region:no-drag]",
|
|
159
|
+
variant() === "chrome" ? "items-end" : "items-center",
|
|
160
|
+
local.class
|
|
161
|
+
)}
|
|
162
|
+
{...rest}
|
|
163
|
+
>
|
|
164
|
+
<Show
|
|
165
|
+
when={local.children}
|
|
166
|
+
fallback={
|
|
167
|
+
/* Automatic Declarative Mode: Tab List with Mouse Wheel Scroll + Anchored Add Button */
|
|
168
|
+
<>
|
|
169
|
+
<div
|
|
170
|
+
ref={scrollContainerRef}
|
|
171
|
+
class={cn(
|
|
172
|
+
"flex h-full overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] gap-0 items-center min-w-0 flex-1 scroll-smooth",
|
|
173
|
+
variant() === "chrome" && "items-end pt-1.5"
|
|
174
|
+
)}
|
|
175
|
+
>
|
|
176
|
+
<Show when={local.manager}>
|
|
177
|
+
<For each={local.manager!.tabs()}>
|
|
178
|
+
{(tab) => <TitlebarTab tab={tab} />}
|
|
179
|
+
</For>
|
|
180
|
+
</Show>
|
|
181
|
+
</div>
|
|
182
|
+
|
|
183
|
+
{/* Anchored Add Tab Button (Always visible outside scroll container) */}
|
|
184
|
+
<Show when={local.onAddTab}>
|
|
185
|
+
<div class={cn("shrink-0 px-1 z-20 flex items-center", variant() === "chrome" ? "mb-1" : "my-auto")}>
|
|
186
|
+
<TitlebarTabAddButton onClick={local.onAddTab} />
|
|
187
|
+
</div>
|
|
188
|
+
</Show>
|
|
189
|
+
</>
|
|
190
|
+
}
|
|
191
|
+
>
|
|
192
|
+
{local.children}
|
|
193
|
+
</Show>
|
|
194
|
+
</nav>
|
|
195
|
+
</TitlebarTabsContext.Provider>
|
|
196
|
+
);
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
/* --- 3. TitlebarTabList --- */
|
|
200
|
+
|
|
201
|
+
export interface TitlebarTabListProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
202
|
+
class?: string;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export const TitlebarTabList: ParentComponent<TitlebarTabListProps> = (props) => {
|
|
206
|
+
const [local, rest] = splitProps(props, ["class", "children"]);
|
|
207
|
+
const ctx = useTitlebarTabs();
|
|
208
|
+
let listRef: HTMLDivElement | undefined;
|
|
209
|
+
|
|
210
|
+
onMount(() => {
|
|
211
|
+
if (!listRef) return;
|
|
212
|
+
const handleWheel = (e: WheelEvent) => {
|
|
213
|
+
if (e.deltaY !== 0) {
|
|
214
|
+
e.preventDefault();
|
|
215
|
+
listRef!.scrollLeft += e.deltaY;
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
listRef.addEventListener("wheel", handleWheel, { passive: false });
|
|
219
|
+
onCleanup(() => listRef?.removeEventListener("wheel", handleWheel));
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
return (
|
|
223
|
+
<div
|
|
224
|
+
ref={listRef}
|
|
225
|
+
data-no-drag
|
|
226
|
+
class={cn(
|
|
227
|
+
"flex h-full overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] gap-0 items-center min-w-0 flex-1 scroll-smooth",
|
|
228
|
+
ctx.variant() === "chrome" && "items-end pt-1.5",
|
|
229
|
+
local.class
|
|
230
|
+
)}
|
|
231
|
+
{...rest}
|
|
232
|
+
>
|
|
233
|
+
{local.children}
|
|
234
|
+
</div>
|
|
235
|
+
);
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
/* --- 4. TitlebarTab Individual Item --- */
|
|
239
|
+
|
|
240
|
+
export interface TitlebarTabProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "onClose"> {
|
|
241
|
+
/** Tab data object from createDocumentTabs(). Automatically wires all properties. */
|
|
242
|
+
tab?: TabItem<any>;
|
|
243
|
+
value?: string;
|
|
244
|
+
isDirty?: boolean;
|
|
245
|
+
isPinned?: boolean;
|
|
246
|
+
closable?: boolean;
|
|
247
|
+
onClose?: (e: MouseEvent) => void;
|
|
248
|
+
class?: string;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export const TitlebarTab: ParentComponent<TitlebarTabProps> = (props) => {
|
|
252
|
+
const [local, rest] = splitProps(props, [
|
|
253
|
+
"tab",
|
|
254
|
+
"value",
|
|
255
|
+
"isDirty",
|
|
256
|
+
"isPinned",
|
|
257
|
+
"closable",
|
|
258
|
+
"onClose",
|
|
259
|
+
"class",
|
|
260
|
+
"children",
|
|
261
|
+
"onClick",
|
|
262
|
+
"onKeyDown",
|
|
263
|
+
]);
|
|
264
|
+
|
|
265
|
+
const ctx = useTitlebarTabs();
|
|
266
|
+
let tabRef: HTMLDivElement | undefined;
|
|
267
|
+
|
|
268
|
+
const tabId = () => local.tab?.id || local.value || "";
|
|
269
|
+
const isPinned = () => local.tab?.isPinned ?? local.isPinned ?? false;
|
|
270
|
+
const isDirty = () => local.tab?.isDirty ?? local.isDirty ?? false;
|
|
271
|
+
const closable = () => local.tab?.closable ?? local.closable ?? true;
|
|
272
|
+
const title = () => local.tab?.title || "";
|
|
273
|
+
const IconComp = () => local.tab?.icon;
|
|
274
|
+
|
|
275
|
+
const isActive = () => ctx.value() === tabId();
|
|
276
|
+
|
|
277
|
+
// Scroll active tab into view when selected safely
|
|
278
|
+
createEffect(() => {
|
|
279
|
+
if (typeof window !== "undefined" && isActive() && tabRef) {
|
|
280
|
+
try {
|
|
281
|
+
tabRef.scrollIntoView({
|
|
282
|
+
behavior: "smooth",
|
|
283
|
+
block: "nearest",
|
|
284
|
+
inline: "nearest",
|
|
285
|
+
});
|
|
286
|
+
} catch {
|
|
287
|
+
// Safe fallback in SSR or testing environments
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
const handleClick = (e: MouseEvent) => {
|
|
293
|
+
ctx.setValue(tabId());
|
|
294
|
+
if (typeof local.onClick === "function") {
|
|
295
|
+
(local.onClick as any)(e);
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
const handleKeyDown = (e: KeyboardEvent) => {
|
|
300
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
301
|
+
e.preventDefault();
|
|
302
|
+
ctx.setValue(tabId());
|
|
303
|
+
}
|
|
304
|
+
if (typeof (local as any).onKeyDown === "function") {
|
|
305
|
+
((local as any).onKeyDown)(e);
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
const handleClose = (e: MouseEvent) => {
|
|
310
|
+
e.stopPropagation();
|
|
311
|
+
if (local.onClose) {
|
|
312
|
+
local.onClose(e);
|
|
313
|
+
} else if (ctx.manager) {
|
|
314
|
+
ctx.manager.closeTab(tabId());
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
return (
|
|
319
|
+
<div
|
|
320
|
+
ref={tabRef}
|
|
321
|
+
role="tab"
|
|
322
|
+
tabindex="0"
|
|
323
|
+
aria-selected={isActive()}
|
|
324
|
+
data-no-drag
|
|
325
|
+
data-active={isActive() ? "true" : "false"}
|
|
326
|
+
onClick={handleClick}
|
|
327
|
+
onKeyDown={handleKeyDown}
|
|
328
|
+
class={cn(
|
|
329
|
+
titlebarTabVariants({ variant: ctx.variant() }),
|
|
330
|
+
isPinned() && "min-w-fit px-2 max-w-fit",
|
|
331
|
+
"cursor-pointer outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
332
|
+
local.class
|
|
333
|
+
)}
|
|
334
|
+
{...rest}
|
|
335
|
+
>
|
|
336
|
+
{/* Tab Icon & Title Slot */}
|
|
337
|
+
<span class="flex items-center gap-1.5 truncate flex-1 pointer-events-none">
|
|
338
|
+
<Show when={IconComp()}>
|
|
339
|
+
{(() => {
|
|
340
|
+
const Comp = IconComp()!;
|
|
341
|
+
return <Comp class="size-3.5 shrink-0 text-primary" />;
|
|
342
|
+
})()}
|
|
343
|
+
</Show>
|
|
344
|
+
<Show when={local.children} fallback={<span class="truncate">{title()}</span>}>
|
|
345
|
+
{local.children}
|
|
346
|
+
</Show>
|
|
347
|
+
</span>
|
|
348
|
+
|
|
349
|
+
{/* Pinned Tab Badge */}
|
|
350
|
+
<Show when={isPinned()}>
|
|
351
|
+
<Pin class="size-2.5 text-muted-foreground rotate-45 shrink-0" />
|
|
352
|
+
</Show>
|
|
353
|
+
|
|
354
|
+
{/* Close Button / Dirty Dot Indicator using Nikala UI Button */}
|
|
355
|
+
<Show when={!isPinned() && closable()}>
|
|
356
|
+
<Tooltip>
|
|
357
|
+
<TooltipTrigger
|
|
358
|
+
as={Button}
|
|
359
|
+
variant="ghost"
|
|
360
|
+
size="icon"
|
|
361
|
+
onClick={handleClose}
|
|
362
|
+
aria-label={`Close ${tabId()} tab`}
|
|
363
|
+
class="size-4 p-0 rounded-xs text-muted-foreground hover:bg-muted hover:text-foreground shrink-0 ml-0.5 cursor-pointer"
|
|
364
|
+
>
|
|
365
|
+
<Show
|
|
366
|
+
when={isDirty()}
|
|
367
|
+
fallback={<X class="size-3 opacity-60 hover:opacity-100" />}
|
|
368
|
+
>
|
|
369
|
+
<span class="size-1.5 rounded-full bg-primary group-hover:hidden" />
|
|
370
|
+
<X class="size-3 hidden group-hover:block" />
|
|
371
|
+
</Show>
|
|
372
|
+
</TooltipTrigger>
|
|
373
|
+
<TooltipContent class="text-[10px] py-1 px-2">
|
|
374
|
+
Close tab (Ctrl+W)
|
|
375
|
+
</TooltipContent>
|
|
376
|
+
</Tooltip>
|
|
377
|
+
</Show>
|
|
378
|
+
</div>
|
|
379
|
+
);
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
/* --- 5. TitlebarTabAddButton using Nikala UI Button & Tooltip --- */
|
|
383
|
+
|
|
384
|
+
export interface TitlebarTabAddButtonProps extends JSX.HTMLAttributes<HTMLButtonElement> {
|
|
385
|
+
class?: string;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export const TitlebarTabAddButton: Component<TitlebarTabAddButtonProps> = (props) => {
|
|
389
|
+
const [local, rest] = splitProps(props, ["class"]);
|
|
390
|
+
|
|
391
|
+
return (
|
|
392
|
+
<Tooltip>
|
|
393
|
+
<TooltipTrigger
|
|
394
|
+
as={Button}
|
|
395
|
+
variant="ghost"
|
|
396
|
+
size="icon"
|
|
397
|
+
data-no-drag
|
|
398
|
+
aria-label="Add new tab"
|
|
399
|
+
class={cn(
|
|
400
|
+
"size-6 rounded-md text-muted-foreground hover:bg-muted/80 hover:text-foreground cursor-pointer shrink-0",
|
|
401
|
+
local.class
|
|
402
|
+
)}
|
|
403
|
+
{...rest}
|
|
404
|
+
>
|
|
405
|
+
<Plus class="size-3.5" />
|
|
406
|
+
</TooltipTrigger>
|
|
407
|
+
<TooltipContent class="text-[10px] py-1 px-2">
|
|
408
|
+
New tab (Ctrl+T)
|
|
409
|
+
</TooltipContent>
|
|
410
|
+
</Tooltip>
|
|
411
|
+
);
|
|
412
|
+
};
|