@pelatform/starter.shared 0.2.15 → 0.2.17
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/index.d.ts +62 -22
- package/dist/index.js +510 -228
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import Link3 from "next/link";
|
|
|
5
5
|
import { usePathname } from "next/navigation";
|
|
6
6
|
import { useTranslations as useTranslations4 } from "next-intl";
|
|
7
7
|
import { useConfig as useConfig3 } from "@pelatform/starter.hook";
|
|
8
|
+
import { cn as cn3 } from "pelatform-ui";
|
|
8
9
|
import { LayoutBlank } from "pelatform-ui/components";
|
|
9
10
|
|
|
10
11
|
// src/components/logo.tsx
|
|
@@ -52,11 +53,11 @@ import { useTranslations as useTranslations2 } from "next-intl";
|
|
|
52
53
|
import { useSession as useSession2 } from "@pelatform/starter.hook";
|
|
53
54
|
import { ScreenLoader } from "pelatform-ui/components";
|
|
54
55
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
55
|
-
function LayoutLoader({ children }) {
|
|
56
|
+
function LayoutLoader({ children, className }) {
|
|
56
57
|
const t = useTranslations2();
|
|
57
58
|
const { isPending } = useSession2();
|
|
58
59
|
if (isPending) {
|
|
59
|
-
return /* @__PURE__ */ jsx3(ScreenLoader, { loadingText: t("common.status.loading") });
|
|
60
|
+
return /* @__PURE__ */ jsx3(ScreenLoader, { className, loadingText: t("common.status.loading") });
|
|
60
61
|
}
|
|
61
62
|
return children;
|
|
62
63
|
}
|
|
@@ -148,6 +149,7 @@ function ToolbarRSC({ show = DEFAULT_SHOW }) {
|
|
|
148
149
|
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
149
150
|
function AuthLayout({
|
|
150
151
|
children,
|
|
152
|
+
className,
|
|
151
153
|
logo = /* @__PURE__ */ jsx6(LogoWithHref, {}),
|
|
152
154
|
disableFooter = false,
|
|
153
155
|
signInHint = false,
|
|
@@ -184,7 +186,7 @@ function AuthLayout({
|
|
|
184
186
|
/* @__PURE__ */ jsx6(
|
|
185
187
|
LayoutBlank,
|
|
186
188
|
{
|
|
187
|
-
className: "[&_.max-w-4xl]:max-w-sm [&_.max-w-4xl]:px-0",
|
|
189
|
+
className: cn3("[&_.max-w-4xl]:max-w-sm [&_.max-w-4xl]:px-0", className),
|
|
188
190
|
logo,
|
|
189
191
|
footer: disableFooter || pathname === path.auth.SIGN_OUT || pathname === path.auth.CALLBACK ? null : footer,
|
|
190
192
|
children
|
|
@@ -200,6 +202,7 @@ import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
|
200
202
|
import { usePathname as usePathname2 } from "next/navigation";
|
|
201
203
|
import { MenuIcon, PanelRightIcon } from "lucide-react";
|
|
202
204
|
import { useLayout } from "@pelatform/starter.hook";
|
|
205
|
+
import { cn as cn6 } from "pelatform-ui";
|
|
203
206
|
import {
|
|
204
207
|
Button as Button2,
|
|
205
208
|
Sheet,
|
|
@@ -215,7 +218,14 @@ import {
|
|
|
215
218
|
import { Fragment as Fragment2, useCallback, useEffect, useState } from "react";
|
|
216
219
|
import Link4 from "next/link";
|
|
217
220
|
import { useRouter as useRouter2 } from "next/navigation";
|
|
218
|
-
import {
|
|
221
|
+
import {
|
|
222
|
+
HouseIcon,
|
|
223
|
+
LogOutIcon,
|
|
224
|
+
PlusCircleIcon,
|
|
225
|
+
SettingsIcon,
|
|
226
|
+
ShieldIcon,
|
|
227
|
+
UserStarIcon
|
|
228
|
+
} from "lucide-react";
|
|
219
229
|
import { useTranslations as useTranslations7 } from "next-intl";
|
|
220
230
|
import {
|
|
221
231
|
useConfig as useConfig4,
|
|
@@ -238,13 +248,13 @@ import {
|
|
|
238
248
|
// src/components/view.tsx
|
|
239
249
|
import { KeyRoundIcon } from "lucide-react";
|
|
240
250
|
import { useLocale as useLocale2, useTranslations as useTranslations6 } from "next-intl";
|
|
241
|
-
import { cn as
|
|
251
|
+
import { cn as cn5, formatDate, getUserName as getUserName2 } from "pelatform-ui";
|
|
242
252
|
import { Skeleton as Skeleton2 } from "pelatform-ui/default";
|
|
243
253
|
|
|
244
254
|
// src/components/avatar.tsx
|
|
245
255
|
import { BuildingIcon, UserRoundIcon } from "lucide-react";
|
|
246
256
|
import { useTranslations as useTranslations5 } from "next-intl";
|
|
247
|
-
import { cn as
|
|
257
|
+
import { cn as cn4, getSizeAvatar, getUserName } from "pelatform-ui";
|
|
248
258
|
import { getInitials } from "pelatform-ui/components";
|
|
249
259
|
import { Avatar, AvatarFallback, AvatarImage, Skeleton } from "pelatform-ui/default";
|
|
250
260
|
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
@@ -264,7 +274,7 @@ function UserAvatar({
|
|
|
264
274
|
return /* @__PURE__ */ jsx7(
|
|
265
275
|
Skeleton,
|
|
266
276
|
{
|
|
267
|
-
className:
|
|
277
|
+
className: cn4(
|
|
268
278
|
"shrink-0 rounded-full",
|
|
269
279
|
getSizeAvatar(size),
|
|
270
280
|
className,
|
|
@@ -277,7 +287,7 @@ function UserAvatar({
|
|
|
277
287
|
return /* @__PURE__ */ jsxs5(
|
|
278
288
|
Avatar,
|
|
279
289
|
{
|
|
280
|
-
className:
|
|
290
|
+
className: cn4("rounded-full bg-accent", getSizeAvatar(size), className, classNames?.base),
|
|
281
291
|
...props,
|
|
282
292
|
children: [
|
|
283
293
|
/* @__PURE__ */ jsx7(
|
|
@@ -291,9 +301,9 @@ function UserAvatar({
|
|
|
291
301
|
/* @__PURE__ */ jsx7(
|
|
292
302
|
AvatarFallback,
|
|
293
303
|
{
|
|
294
|
-
className:
|
|
304
|
+
className: cn4("text-foreground uppercase", classNames?.fallback),
|
|
295
305
|
delayMs: src ? 600 : void 0,
|
|
296
|
-
children: getInitials(name, 2) || /* @__PURE__ */ jsx7(UserRoundIcon, { className:
|
|
306
|
+
children: getInitials(name, 2) || /* @__PURE__ */ jsx7(UserRoundIcon, { className: cn4("size-[50%]", classNames?.fallbackIcon) })
|
|
297
307
|
}
|
|
298
308
|
)
|
|
299
309
|
]
|
|
@@ -316,7 +326,7 @@ function WorkspaceLogo({
|
|
|
316
326
|
return /* @__PURE__ */ jsx7(
|
|
317
327
|
Skeleton,
|
|
318
328
|
{
|
|
319
|
-
className:
|
|
329
|
+
className: cn4(
|
|
320
330
|
"shrink-0 rounded-full",
|
|
321
331
|
getSizeAvatar(size),
|
|
322
332
|
className,
|
|
@@ -329,7 +339,7 @@ function WorkspaceLogo({
|
|
|
329
339
|
return /* @__PURE__ */ jsxs5(
|
|
330
340
|
Avatar,
|
|
331
341
|
{
|
|
332
|
-
className:
|
|
342
|
+
className: cn4("rounded-full bg-accent", getSizeAvatar(size), className, classNames?.base),
|
|
333
343
|
...props,
|
|
334
344
|
children: [
|
|
335
345
|
/* @__PURE__ */ jsx7(
|
|
@@ -343,9 +353,9 @@ function WorkspaceLogo({
|
|
|
343
353
|
/* @__PURE__ */ jsx7(
|
|
344
354
|
AvatarFallback,
|
|
345
355
|
{
|
|
346
|
-
className:
|
|
356
|
+
className: cn4("text-foreground", classNames?.fallback),
|
|
347
357
|
delayMs: src ? 600 : void 0,
|
|
348
|
-
children: /* @__PURE__ */ jsx7(BuildingIcon, { className:
|
|
358
|
+
children: /* @__PURE__ */ jsx7(BuildingIcon, { className: cn4("size-[50%]", classNames?.fallbackIcon) })
|
|
349
359
|
}
|
|
350
360
|
)
|
|
351
361
|
]
|
|
@@ -357,22 +367,22 @@ function WorkspaceLogo({
|
|
|
357
367
|
import { Fragment, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
358
368
|
function UserView({ className, classNames, isPending, size, user }) {
|
|
359
369
|
const t = useTranslations6();
|
|
360
|
-
return /* @__PURE__ */ jsxs6("div", { className:
|
|
370
|
+
return /* @__PURE__ */ jsxs6("div", { className: cn5("flex items-center gap-2", className, classNames?.base), children: [
|
|
361
371
|
/* @__PURE__ */ jsx8(
|
|
362
372
|
UserAvatar,
|
|
363
373
|
{
|
|
364
|
-
className:
|
|
374
|
+
className: cn5(size !== "sm" && "my-0.5"),
|
|
365
375
|
classNames: classNames?.avatar,
|
|
366
376
|
isPending,
|
|
367
377
|
size,
|
|
368
378
|
user
|
|
369
379
|
}
|
|
370
380
|
),
|
|
371
|
-
/* @__PURE__ */ jsx8("div", { className:
|
|
381
|
+
/* @__PURE__ */ jsx8("div", { className: cn5("grid flex-1 text-start leading-tight", classNames?.content), children: isPending ? /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
372
382
|
/* @__PURE__ */ jsx8(
|
|
373
383
|
Skeleton2,
|
|
374
384
|
{
|
|
375
|
-
className:
|
|
385
|
+
className: cn5(
|
|
376
386
|
"max-w-full",
|
|
377
387
|
size === "lg" ? "h-4.5 w-32" : "h-3.5 w-24",
|
|
378
388
|
classNames?.title,
|
|
@@ -383,7 +393,7 @@ function UserView({ className, classNames, isPending, size, user }) {
|
|
|
383
393
|
size !== "sm" && /* @__PURE__ */ jsx8(
|
|
384
394
|
Skeleton2,
|
|
385
395
|
{
|
|
386
|
-
className:
|
|
396
|
+
className: cn5(
|
|
387
397
|
"mt-1.5 max-w-full",
|
|
388
398
|
size === "lg" ? "h-3.5 w-40" : "h-3 w-32",
|
|
389
399
|
classNames?.subtitle,
|
|
@@ -395,7 +405,7 @@ function UserView({ className, classNames, isPending, size, user }) {
|
|
|
395
405
|
/* @__PURE__ */ jsx8(
|
|
396
406
|
"span",
|
|
397
407
|
{
|
|
398
|
-
className:
|
|
408
|
+
className: cn5(
|
|
399
409
|
"truncate font-semibold",
|
|
400
410
|
size === "lg" ? "text-base" : "text-sm",
|
|
401
411
|
classNames?.title
|
|
@@ -406,7 +416,7 @@ function UserView({ className, classNames, isPending, size, user }) {
|
|
|
406
416
|
!user?.isAnonymous && size !== "sm" && (user?.name || user?.username) && /* @__PURE__ */ jsx8(
|
|
407
417
|
"span",
|
|
408
418
|
{
|
|
409
|
-
className:
|
|
419
|
+
className: cn5(
|
|
410
420
|
"truncate opacity-70",
|
|
411
421
|
size === "lg" ? "text-sm" : "text-xs",
|
|
412
422
|
classNames?.subtitle
|
|
@@ -431,8 +441,8 @@ function ApiKeyView({ className, classNames, apiKey }) {
|
|
|
431
441
|
);
|
|
432
442
|
return `${t("common.time.expires")} ${expiresDate}`;
|
|
433
443
|
};
|
|
434
|
-
return /* @__PURE__ */ jsxs6("div", { className:
|
|
435
|
-
/* @__PURE__ */ jsx8(KeyRoundIcon, { className:
|
|
444
|
+
return /* @__PURE__ */ jsxs6("div", { className: cn5("flex items-center gap-3 truncate", className, classNames?.base), children: [
|
|
445
|
+
/* @__PURE__ */ jsx8(KeyRoundIcon, { className: cn5("size-4 shrink-0", classNames?.icon) }),
|
|
436
446
|
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col truncate text-start", children: [
|
|
437
447
|
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
|
|
438
448
|
/* @__PURE__ */ jsx8("span", { className: "truncate font-semibold text-sm", children: apiKey.name }),
|
|
@@ -447,22 +457,22 @@ function ApiKeyView({ className, classNames, apiKey }) {
|
|
|
447
457
|
}
|
|
448
458
|
function WorkspaceView({ className, classNames, isPending, size, workspace }) {
|
|
449
459
|
const t = useTranslations6();
|
|
450
|
-
return /* @__PURE__ */ jsxs6("div", { className:
|
|
460
|
+
return /* @__PURE__ */ jsxs6("div", { className: cn5("flex items-center gap-2 truncate", className, classNames?.base), children: [
|
|
451
461
|
/* @__PURE__ */ jsx8(
|
|
452
462
|
WorkspaceLogo,
|
|
453
463
|
{
|
|
454
|
-
className:
|
|
464
|
+
className: cn5(size !== "sm" && "my-0.5"),
|
|
455
465
|
classNames: classNames?.avatar,
|
|
456
466
|
isPending,
|
|
457
467
|
workspace,
|
|
458
468
|
size
|
|
459
469
|
}
|
|
460
470
|
),
|
|
461
|
-
/* @__PURE__ */ jsx8("div", { className:
|
|
471
|
+
/* @__PURE__ */ jsx8("div", { className: cn5("flex flex-col truncate text-start leading-tight", classNames?.content), children: isPending ? /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
462
472
|
/* @__PURE__ */ jsx8(
|
|
463
473
|
Skeleton2,
|
|
464
474
|
{
|
|
465
|
-
className:
|
|
475
|
+
className: cn5(
|
|
466
476
|
"max-w-full",
|
|
467
477
|
size === "lg" ? "h-4.5 w-32" : "h-3.5 w-24",
|
|
468
478
|
classNames?.title,
|
|
@@ -473,7 +483,7 @@ function WorkspaceView({ className, classNames, isPending, size, workspace }) {
|
|
|
473
483
|
size !== "sm" && /* @__PURE__ */ jsx8(
|
|
474
484
|
Skeleton2,
|
|
475
485
|
{
|
|
476
|
-
className:
|
|
486
|
+
className: cn5(
|
|
477
487
|
"mt-1.5 max-w-full",
|
|
478
488
|
size === "lg" ? "h-3.5 w-24" : "h-3 w-16",
|
|
479
489
|
classNames?.subtitle,
|
|
@@ -485,7 +495,7 @@ function WorkspaceView({ className, classNames, isPending, size, workspace }) {
|
|
|
485
495
|
/* @__PURE__ */ jsx8(
|
|
486
496
|
"span",
|
|
487
497
|
{
|
|
488
|
-
className:
|
|
498
|
+
className: cn5(
|
|
489
499
|
"truncate font-semibold",
|
|
490
500
|
size === "lg" ? "text-base" : "text-sm",
|
|
491
501
|
classNames?.title
|
|
@@ -496,7 +506,7 @@ function WorkspaceView({ className, classNames, isPending, size, workspace }) {
|
|
|
496
506
|
size !== "sm" && workspace?.slug && /* @__PURE__ */ jsx8(
|
|
497
507
|
"span",
|
|
498
508
|
{
|
|
499
|
-
className:
|
|
509
|
+
className: cn5(
|
|
500
510
|
"truncate opacity-70",
|
|
501
511
|
size === "lg" ? "text-sm" : "text-xs",
|
|
502
512
|
classNames?.subtitle
|
|
@@ -512,7 +522,13 @@ function WorkspaceView({ className, classNames, isPending, size, workspace }) {
|
|
|
512
522
|
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
513
523
|
function UserMenu({
|
|
514
524
|
homeUrl,
|
|
515
|
-
|
|
525
|
+
disableSettings = false,
|
|
526
|
+
disableSecurity = false,
|
|
527
|
+
disableAdminMenu = true,
|
|
528
|
+
hiddenSwitcher = false,
|
|
529
|
+
side = "bottom",
|
|
530
|
+
align = "end",
|
|
531
|
+
sideOffset = 11
|
|
516
532
|
}) {
|
|
517
533
|
const { auth, features, path } = useConfig4();
|
|
518
534
|
const router = useRouter2();
|
|
@@ -553,7 +569,7 @@ function UserMenu({
|
|
|
553
569
|
const userRole = user?.role || "user";
|
|
554
570
|
return /* @__PURE__ */ jsxs7(DropdownMenu, { children: [
|
|
555
571
|
/* @__PURE__ */ jsx9(DropdownMenuTrigger, { className: "focus:outline-none focus:ring-0", children: isPending ? /* @__PURE__ */ jsx9(Skeleton3, { className: "size-8 shrink-0 rounded-full" }) : /* @__PURE__ */ jsx9(UserAvatar2, { className: "size-8", indicator: true, src: userAvatar, alt: userName }) }),
|
|
556
|
-
/* @__PURE__ */ jsxs7(DropdownMenuContent, { className: "w-56", side
|
|
572
|
+
/* @__PURE__ */ jsxs7(DropdownMenuContent, { className: "w-56", side, align, sideOffset, children: [
|
|
557
573
|
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-3 px-3 py-2", children: [
|
|
558
574
|
/* @__PURE__ */ jsx9(UserAvatar2, { src: userAvatar, alt: userName }),
|
|
559
575
|
/* @__PURE__ */ jsxs7("div", { className: "flex min-w-0 flex-1 flex-col items-start", children: [
|
|
@@ -567,14 +583,18 @@ function UserMenu({
|
|
|
567
583
|
/* @__PURE__ */ jsx9(HouseIcon, {}),
|
|
568
584
|
/* @__PURE__ */ jsx9("span", { children: t("ui.navigation.home") })
|
|
569
585
|
] }) }),
|
|
570
|
-
/* @__PURE__ */ jsx9(DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ jsxs7(Link4, { href: path.account.SETTINGS, children: [
|
|
586
|
+
!disableSettings && /* @__PURE__ */ jsx9(DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ jsxs7(Link4, { href: path.account.SETTINGS, children: [
|
|
571
587
|
/* @__PURE__ */ jsx9(SettingsIcon, {}),
|
|
572
588
|
/* @__PURE__ */ jsx9("span", { children: t("ui.navigation.preferences") })
|
|
573
589
|
] }) }),
|
|
574
|
-
/* @__PURE__ */ jsx9(DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ jsxs7(Link4, { href: path.account.SECURITY, children: [
|
|
590
|
+
!disableSecurity && /* @__PURE__ */ jsx9(DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ jsxs7(Link4, { href: path.account.SECURITY, children: [
|
|
575
591
|
/* @__PURE__ */ jsx9(ShieldIcon, {}),
|
|
576
592
|
/* @__PURE__ */ jsx9("span", { children: t("ui.navigation.security") })
|
|
577
593
|
] }) }),
|
|
594
|
+
!disableAdminMenu && "admin" === userRole && /* @__PURE__ */ jsx9(DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ jsxs7(Link4, { href: path.admin.OVERVIEW, children: [
|
|
595
|
+
/* @__PURE__ */ jsx9(UserStarIcon, {}),
|
|
596
|
+
/* @__PURE__ */ jsx9("span", { children: "Admin Dashboard" })
|
|
597
|
+
] }) }),
|
|
578
598
|
!hiddenSwitcher && /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
579
599
|
/* @__PURE__ */ jsx9(DropdownMenuSeparator, {}),
|
|
580
600
|
/* @__PURE__ */ jsx9(
|
|
@@ -627,12 +647,34 @@ function UserMenu({
|
|
|
627
647
|
|
|
628
648
|
// src/components/layouts/header.tsx
|
|
629
649
|
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
630
|
-
function Header({ children }) {
|
|
631
|
-
|
|
650
|
+
function Header({ children, className }) {
|
|
651
|
+
const { version } = useLayout();
|
|
652
|
+
if (version === "v2") {
|
|
653
|
+
return /* @__PURE__ */ jsx10(
|
|
654
|
+
"header",
|
|
655
|
+
{
|
|
656
|
+
className: cn6(
|
|
657
|
+
"fixed start-0 end-0 top-0 z-50 flex h-(--header-height-mobile) shrink-0 items-center bg-background/95 pe-[var(--removed-body-scroll-bar-size,0px)] backdrop-blur-sm transition-[start,end] duration-300 supports-backdrop-filter:bg-muted",
|
|
658
|
+
className
|
|
659
|
+
),
|
|
660
|
+
children: /* @__PURE__ */ jsx10("div", { className: "@container flex grow items-stretch justify-between gap-2.5 pe-5", children })
|
|
661
|
+
}
|
|
662
|
+
);
|
|
663
|
+
}
|
|
664
|
+
return /* @__PURE__ */ jsx10(
|
|
665
|
+
"header",
|
|
666
|
+
{
|
|
667
|
+
className: cn6(
|
|
668
|
+
"fixed start-0 end-0 top-0 z-10 flex h-(--header-height-mobile) shrink-0 items-stretch border-border border-b bg-background/95 pe-(--removed-body-scroll-bar-size,0px) backdrop-blur-sm supports-backdrop-filter:bg-background/60 lg:h-(--header-height)",
|
|
669
|
+
className
|
|
670
|
+
),
|
|
671
|
+
children: /* @__PURE__ */ jsx10("div", { className: "@container flex grow items-stretch justify-between gap-2.5 pe-5", children })
|
|
672
|
+
}
|
|
673
|
+
);
|
|
632
674
|
}
|
|
633
|
-
function HeaderLeft() {
|
|
675
|
+
function HeaderLeft({ className }) {
|
|
634
676
|
const { logoHeader, sidebarToggle } = useLayout();
|
|
635
|
-
return /* @__PURE__ */ jsx10("div", { className: "flex items-center gap-2 px-5 lg:w-(--sidebar-width)", children: /* @__PURE__ */ jsxs8("div", { className: "flex w-full items-center justify-between", children: [
|
|
677
|
+
return /* @__PURE__ */ jsx10("div", { className: cn6("flex items-center gap-2 px-5 lg:w-(--sidebar-width)", className), children: /* @__PURE__ */ jsxs8("div", { className: "flex w-full items-center justify-between", children: [
|
|
636
678
|
logoHeader,
|
|
637
679
|
/* @__PURE__ */ jsx10(
|
|
638
680
|
Button2,
|
|
@@ -647,18 +689,22 @@ function HeaderLeft() {
|
|
|
647
689
|
] }) });
|
|
648
690
|
}
|
|
649
691
|
function HeaderRight({
|
|
692
|
+
className,
|
|
650
693
|
sidebar,
|
|
651
694
|
button,
|
|
652
695
|
homeUrl
|
|
653
696
|
}) {
|
|
654
697
|
const { isMobile } = useLayout();
|
|
655
|
-
return /* @__PURE__ */ jsxs8("nav", { className: "flex items-center gap-1.5 lg:gap-2.5", children: [
|
|
698
|
+
return /* @__PURE__ */ jsxs8("nav", { className: cn6("flex items-center gap-1.5 lg:gap-2.5", className), children: [
|
|
656
699
|
button,
|
|
657
700
|
isMobile && sidebar,
|
|
658
701
|
/* @__PURE__ */ jsx10(UserMenu, { homeUrl })
|
|
659
702
|
] });
|
|
660
703
|
}
|
|
661
|
-
function HeaderSidebarMobile({
|
|
704
|
+
function HeaderSidebarMobile({
|
|
705
|
+
children,
|
|
706
|
+
className
|
|
707
|
+
}) {
|
|
662
708
|
const pathname = usePathname2();
|
|
663
709
|
const [isSheetOpen, setIsSheetOpen] = useState2(false);
|
|
664
710
|
useEffect2(() => {
|
|
@@ -666,13 +712,21 @@ function HeaderSidebarMobile({ children }) {
|
|
|
666
712
|
}, [pathname]);
|
|
667
713
|
return /* @__PURE__ */ jsxs8(Sheet, { open: isSheetOpen, onOpenChange: setIsSheetOpen, children: [
|
|
668
714
|
/* @__PURE__ */ jsx10(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsx10(Button2, { variant: "ghost", mode: "icon", size: "icon", children: /* @__PURE__ */ jsx10(MenuIcon, { className: "size-4" }) }) }),
|
|
669
|
-
/* @__PURE__ */ jsxs8(
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
715
|
+
/* @__PURE__ */ jsxs8(
|
|
716
|
+
SheetContent,
|
|
717
|
+
{
|
|
718
|
+
className: cn6("w-(--sidebar-width) gap-0 p-0", className),
|
|
719
|
+
side: "left",
|
|
720
|
+
close: false,
|
|
721
|
+
children: [
|
|
722
|
+
/* @__PURE__ */ jsxs8(SheetHeader, { className: "hidden space-y-0 p-0", children: [
|
|
723
|
+
/* @__PURE__ */ jsx10(SheetTitle, { className: "sr-only", children: "Navigation menu" }),
|
|
724
|
+
/* @__PURE__ */ jsx10(SheetDescription, { className: "sr-only", children: "NavigatSheet Description" })
|
|
725
|
+
] }),
|
|
726
|
+
/* @__PURE__ */ jsx10(SheetBody, { className: "flex grow flex-col p-0", children })
|
|
727
|
+
]
|
|
728
|
+
}
|
|
729
|
+
)
|
|
676
730
|
] });
|
|
677
731
|
}
|
|
678
732
|
|
|
@@ -682,6 +736,7 @@ import Link5 from "next/link";
|
|
|
682
736
|
import { usePathname as usePathname3 } from "next/navigation";
|
|
683
737
|
import { useLocale as useLocale3, useTranslations as useTranslations8 } from "next-intl";
|
|
684
738
|
import { useLayout as useLayout2 } from "@pelatform/starter.hook";
|
|
739
|
+
import { cn as cn7 } from "pelatform-ui";
|
|
685
740
|
import { BackLink } from "pelatform-ui/components";
|
|
686
741
|
import {
|
|
687
742
|
AccordionMenu,
|
|
@@ -696,28 +751,85 @@ import {
|
|
|
696
751
|
ScrollArea
|
|
697
752
|
} from "pelatform-ui/default";
|
|
698
753
|
import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
699
|
-
function Sidebar({ children }) {
|
|
700
|
-
const { isMobile } = useLayout2();
|
|
754
|
+
function Sidebar({ children, className }) {
|
|
755
|
+
const { isMobile, logoHeader, version } = useLayout2();
|
|
701
756
|
if (isMobile) {
|
|
702
757
|
return null;
|
|
703
758
|
}
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
759
|
+
if (version === "v2") {
|
|
760
|
+
return /* @__PURE__ */ jsx11(
|
|
761
|
+
"aside",
|
|
762
|
+
{
|
|
763
|
+
className: cn7(
|
|
764
|
+
"fixed start-2.5 top-2.5 bottom-2.5 z-20 flex in-data-[sidebar-open=false]:w-(--sidebar-width-collapsed) w-(--sidebar-width) shrink-0 items-stretch overflow-hidden rounded-xl border border-input bg-background transition-all duration-300",
|
|
765
|
+
className
|
|
766
|
+
),
|
|
767
|
+
children: /* @__PURE__ */ jsxs9("div", { className: "w-(--sidebar-width) shrink-0 grow transition-all duration-300", children: [
|
|
768
|
+
/* @__PURE__ */ jsx11("div", { className: "flex h-14 shrink-0 items-center justify-center px-2.5 lg:h-15", children: logoHeader }),
|
|
769
|
+
children
|
|
770
|
+
] })
|
|
771
|
+
}
|
|
772
|
+
);
|
|
773
|
+
}
|
|
774
|
+
return /* @__PURE__ */ jsxs9(
|
|
775
|
+
"aside",
|
|
776
|
+
{
|
|
777
|
+
className: cn7(
|
|
778
|
+
"fixed in-data-[sidebar-open=false]:-start-full start-0 top-(--header-height) bottom-0 flex w-(--sidebar-width) shrink-0 flex-col items-stretch border-border border-e transition-all duration-300",
|
|
779
|
+
className
|
|
780
|
+
),
|
|
781
|
+
children: [
|
|
782
|
+
children,
|
|
783
|
+
/* @__PURE__ */ jsx11("div", {})
|
|
784
|
+
]
|
|
785
|
+
}
|
|
786
|
+
);
|
|
708
787
|
}
|
|
709
788
|
function SidebarHeaderBack({
|
|
789
|
+
className,
|
|
710
790
|
linkHref = "/",
|
|
711
791
|
admin = false,
|
|
712
792
|
text
|
|
713
793
|
}) {
|
|
714
794
|
const t = useTranslations8();
|
|
715
|
-
return /* @__PURE__ */ jsx11(
|
|
795
|
+
return /* @__PURE__ */ jsx11(
|
|
796
|
+
"div",
|
|
797
|
+
{
|
|
798
|
+
className: cn7(
|
|
799
|
+
"flex h-14 shrink-0 items-center gap-2 border-border border-b px-2.5 lg:h-15",
|
|
800
|
+
className
|
|
801
|
+
),
|
|
802
|
+
children: /* @__PURE__ */ jsx11(BackLink, { Link: Link5, href: linkHref, children: text ?? (admin ? t("common.actions.back") : t("ui.navigation.settings")) })
|
|
803
|
+
}
|
|
804
|
+
);
|
|
716
805
|
}
|
|
717
|
-
function SidebarContent({
|
|
718
|
-
|
|
806
|
+
function SidebarContent({
|
|
807
|
+
children,
|
|
808
|
+
className
|
|
809
|
+
}) {
|
|
810
|
+
const { isMobile, version } = useLayout2();
|
|
811
|
+
if (version === "v2") {
|
|
812
|
+
return /* @__PURE__ */ jsx11(
|
|
813
|
+
ScrollArea,
|
|
814
|
+
{
|
|
815
|
+
className: cn7(
|
|
816
|
+
isMobile ? "my-2 h-[calc(100vh-5.5rem)] grow" : "my-2 h-[calc(100vh-1rem)] w-full shrink-0 lg:my-4 lg:h-[calc(100vh-14.7rem)]",
|
|
817
|
+
className
|
|
818
|
+
),
|
|
819
|
+
children
|
|
820
|
+
}
|
|
821
|
+
);
|
|
822
|
+
}
|
|
823
|
+
return /* @__PURE__ */ jsx11(
|
|
824
|
+
ScrollArea,
|
|
825
|
+
{
|
|
826
|
+
className: cn7("my-2 h-[calc(100vh-5.5rem)] grow lg:my-4 lg:h-[calc(100vh-4rem)]", className),
|
|
827
|
+
children
|
|
828
|
+
}
|
|
829
|
+
);
|
|
719
830
|
}
|
|
720
831
|
function SidebarContentMenu({
|
|
832
|
+
className,
|
|
721
833
|
menu,
|
|
722
834
|
type = "default"
|
|
723
835
|
}) {
|
|
@@ -766,7 +878,7 @@ function SidebarContentMenu({
|
|
|
766
878
|
defaultValue: "menu-trigger",
|
|
767
879
|
matchPath,
|
|
768
880
|
collapsible: true,
|
|
769
|
-
className: "space-y-7.5 px-2.5",
|
|
881
|
+
className: cn7("space-y-7.5 px-2.5", className),
|
|
770
882
|
classNames: {
|
|
771
883
|
item: "h-8.5 px-2.5 text-sm font-normal text-foreground hover:text-primary data-[selected=true]:bg-muted data-[selected=true]:text-foreground [&[data-selected=true]_svg]:opacity-100",
|
|
772
884
|
subTrigger: "text-xs font-normal text-muted-foreground hover:bg-transparent",
|
|
@@ -817,7 +929,7 @@ function SidebarContentMenu({
|
|
|
817
929
|
type: "multiple",
|
|
818
930
|
selectedValue: pathname,
|
|
819
931
|
matchPath,
|
|
820
|
-
className: "space-y-7.5 px-2.5",
|
|
932
|
+
className: cn7("space-y-7.5 px-2.5", className),
|
|
821
933
|
classNames: {
|
|
822
934
|
label: "text-xs font-normal text-muted-foreground mb-2",
|
|
823
935
|
item: "h-8.5 px-2.5 text-sm font-normal text-foreground hover:text-primary data-[selected=true]:bg-muted data-[selected=true]:font-medium data-[selected=true]:text-foreground [&[data-selected=true]_svg]:opacity-100",
|
|
@@ -860,41 +972,72 @@ function SidebarContentMenu({
|
|
|
860
972
|
}
|
|
861
973
|
);
|
|
862
974
|
}
|
|
975
|
+
function SidebarFooter({
|
|
976
|
+
children,
|
|
977
|
+
className,
|
|
978
|
+
side = "top",
|
|
979
|
+
align = "start",
|
|
980
|
+
sideOffset = 10,
|
|
981
|
+
...props
|
|
982
|
+
}) {
|
|
983
|
+
return /* @__PURE__ */ jsxs9(
|
|
984
|
+
"div",
|
|
985
|
+
{
|
|
986
|
+
className: cn7(
|
|
987
|
+
"flex h-14 shrink-0 items-center gap-2 border-border border-t px-2.5 lg:h-15",
|
|
988
|
+
className
|
|
989
|
+
),
|
|
990
|
+
children: [
|
|
991
|
+
/* @__PURE__ */ jsx11(UserMenu, { side, align, sideOffset, ...props }),
|
|
992
|
+
children
|
|
993
|
+
]
|
|
994
|
+
}
|
|
995
|
+
);
|
|
996
|
+
}
|
|
863
997
|
|
|
864
998
|
// src/components/layouts/site-footer.tsx
|
|
865
999
|
import Link6 from "next/link";
|
|
866
1000
|
import { useTranslations as useTranslations9 } from "next-intl";
|
|
867
1001
|
import { useConfig as useConfig5 } from "@pelatform/starter.hook";
|
|
868
|
-
import { cn as
|
|
1002
|
+
import { cn as cn8 } from "pelatform-ui";
|
|
869
1003
|
import { SiteFooter as UISiteFooter } from "pelatform-ui/components";
|
|
870
1004
|
import { Button as Button3 } from "pelatform-ui/default";
|
|
871
1005
|
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
872
|
-
function SiteFooter({
|
|
1006
|
+
function SiteFooter({
|
|
1007
|
+
className,
|
|
1008
|
+
disableProjectBy = false
|
|
1009
|
+
}) {
|
|
873
1010
|
const { app } = useConfig5();
|
|
874
1011
|
const t = useTranslations9();
|
|
875
|
-
return /* @__PURE__ */ jsxs10(
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
(
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
1012
|
+
return /* @__PURE__ */ jsxs10(
|
|
1013
|
+
UISiteFooter,
|
|
1014
|
+
{
|
|
1015
|
+
className: cn8("*:gap-2! *:py-0!", disableProjectBy ? "*:justify-center!" : "", className),
|
|
1016
|
+
children: [
|
|
1017
|
+
/* @__PURE__ */ jsxs10("div", { className: "text-balance text-center text-muted-foreground text-sm leading-loose md:text-left", children: [
|
|
1018
|
+
"\xA9 ",
|
|
1019
|
+
(/* @__PURE__ */ new Date()).getFullYear(),
|
|
1020
|
+
" ",
|
|
1021
|
+
app.name,
|
|
1022
|
+
". ",
|
|
1023
|
+
t("ui.common.copyright")
|
|
1024
|
+
] }),
|
|
1025
|
+
!disableProjectBy && /* @__PURE__ */ jsx12("div", { className: "flex items-center gap-2.5 text-balance text-sm leading-loose", children: /* @__PURE__ */ jsxs10("div", { className: "inline-flex items-center gap-1", children: [
|
|
1026
|
+
/* @__PURE__ */ jsx12("span", { className: "text-muted-foreground", children: t("ui.common.projectBy") }),
|
|
1027
|
+
" ",
|
|
1028
|
+
/* @__PURE__ */ jsx12(Button3, { mode: "link", underline: "dashed", children: /* @__PURE__ */ jsx12(
|
|
1029
|
+
Link6,
|
|
1030
|
+
{
|
|
1031
|
+
href: "https://pelatform.com",
|
|
1032
|
+
target: "_blank",
|
|
1033
|
+
className: "font-medium text-foreground",
|
|
1034
|
+
children: "Pelatform"
|
|
1035
|
+
}
|
|
1036
|
+
) })
|
|
1037
|
+
] }) })
|
|
1038
|
+
]
|
|
1039
|
+
}
|
|
1040
|
+
);
|
|
898
1041
|
}
|
|
899
1042
|
|
|
900
1043
|
// src/components/layouts/site-header.tsx
|
|
@@ -903,6 +1046,7 @@ import Link7 from "next/link";
|
|
|
903
1046
|
import { usePathname as usePathname4, useRouter as useRouter3 } from "next/navigation";
|
|
904
1047
|
import { useTranslations as useTranslations10 } from "next-intl";
|
|
905
1048
|
import { useConfig as useConfig6, useSession as useSession4 } from "@pelatform/starter.hook";
|
|
1049
|
+
import { cn as cn9 } from "pelatform-ui";
|
|
906
1050
|
import {
|
|
907
1051
|
MainNav,
|
|
908
1052
|
MobileNav,
|
|
@@ -913,6 +1057,7 @@ import {
|
|
|
913
1057
|
import { Button as Button4, Separator } from "pelatform-ui/default";
|
|
914
1058
|
import { Fragment as Fragment5, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
915
1059
|
function SiteHeader({
|
|
1060
|
+
className,
|
|
916
1061
|
menu,
|
|
917
1062
|
logo = /* @__PURE__ */ jsx13(LogoWithHref, { href: "/" })
|
|
918
1063
|
}) {
|
|
@@ -923,45 +1068,52 @@ function SiteHeader({
|
|
|
923
1068
|
const { isPending, session, user } = useSession4();
|
|
924
1069
|
const [, setMobileNavOpen] = useState3(false);
|
|
925
1070
|
const isAuthenticated = !isPending && session && user;
|
|
926
|
-
return /* @__PURE__ */ jsxs11(
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
1071
|
+
return /* @__PURE__ */ jsxs11(
|
|
1072
|
+
UISiteHeader,
|
|
1073
|
+
{
|
|
1074
|
+
className: cn9("backdrop-blur-none supports-backdrop-filter:bg-background", className),
|
|
1075
|
+
children: [
|
|
1076
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-4.5", children: [
|
|
1077
|
+
logo,
|
|
1078
|
+
/* @__PURE__ */ jsx13(MainNav, { Link: Link7, pathname, items: menu })
|
|
1079
|
+
] }),
|
|
1080
|
+
/* @__PURE__ */ jsx13("div", { className: "flex items-center justify-end gap-3", children: /* @__PURE__ */ jsxs11("nav", { className: "flex items-center gap-0 md:gap-1", children: [
|
|
1081
|
+
/* @__PURE__ */ jsx13(ModeSwitcher3, {}),
|
|
1082
|
+
/* @__PURE__ */ jsx13(LanguageSwitcher, {}),
|
|
1083
|
+
/* @__PURE__ */ jsx13(Separator, { orientation: "vertical", className: "mx-3 h-5 max-lg:hidden" }),
|
|
1084
|
+
/* @__PURE__ */ jsx13(MobileNav, { children: /* @__PURE__ */ jsxs11("div", { className: "flex flex-col space-y-3", children: [
|
|
1085
|
+
menu?.map(
|
|
1086
|
+
(item, navIndex) => item.href || item.children ? /* @__PURE__ */ jsx13(
|
|
1087
|
+
MobileNavItemRenderer,
|
|
1088
|
+
{
|
|
1089
|
+
item,
|
|
1090
|
+
Link: Link7,
|
|
1091
|
+
pathname,
|
|
1092
|
+
level: 1,
|
|
1093
|
+
onOpenChange: setMobileNavOpen
|
|
1094
|
+
},
|
|
1095
|
+
`nav-${navIndex}-${item.href}`
|
|
1096
|
+
) : null
|
|
1097
|
+
),
|
|
1098
|
+
/* @__PURE__ */ jsx13("div", { className: "border-t pt-3", children: isAuthenticated ? /* @__PURE__ */ jsx13(
|
|
1099
|
+
Button4,
|
|
1100
|
+
{
|
|
1101
|
+
variant: "outline",
|
|
1102
|
+
size: "sm",
|
|
1103
|
+
className: "w-full",
|
|
1104
|
+
onClick: () => router.push(path.auth.SIGN_OUT),
|
|
1105
|
+
children: t("ui.navigation.signOut")
|
|
1106
|
+
}
|
|
1107
|
+
) : /* @__PURE__ */ jsx13(Button4, { variant: "secondary", size: "sm", className: "w-full", children: /* @__PURE__ */ jsx13(Link7, { href: path.auth.SIGN_IN, children: t("ui.navigation.signIn") }) }) })
|
|
1108
|
+
] }) }),
|
|
1109
|
+
isAuthenticated ? /* @__PURE__ */ jsx13(UserMenu, { hiddenSwitcher: true }) : /* @__PURE__ */ jsx13(Button4, { variant: "secondary", size: "sm", className: "hidden md:flex", children: /* @__PURE__ */ jsx13(Link7, { href: path.auth.SIGN_IN, children: t("ui.navigation.signIn") }) })
|
|
1110
|
+
] }) })
|
|
1111
|
+
]
|
|
1112
|
+
}
|
|
1113
|
+
);
|
|
963
1114
|
}
|
|
964
1115
|
function SiteHeaderSecondary({
|
|
1116
|
+
className,
|
|
965
1117
|
menu,
|
|
966
1118
|
logo = /* @__PURE__ */ jsx13(LogoWithHref, { href: "/" }),
|
|
967
1119
|
loginHref,
|
|
@@ -970,84 +1122,112 @@ function SiteHeaderSecondary({
|
|
|
970
1122
|
const pathname = usePathname4();
|
|
971
1123
|
const t = useTranslations10();
|
|
972
1124
|
const [, setMobileNavOpen] = useState3(false);
|
|
973
|
-
return /* @__PURE__ */ jsxs11(
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1125
|
+
return /* @__PURE__ */ jsxs11(
|
|
1126
|
+
UISiteHeader,
|
|
1127
|
+
{
|
|
1128
|
+
className: cn9("backdrop-blur-none supports-backdrop-filter:bg-background", className),
|
|
1129
|
+
children: [
|
|
1130
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-4.5", children: [
|
|
1131
|
+
logo,
|
|
1132
|
+
/* @__PURE__ */ jsx13(MainNav, { Link: Link7, pathname, items: menu })
|
|
1133
|
+
] }),
|
|
1134
|
+
/* @__PURE__ */ jsx13("div", { className: "flex items-center justify-end gap-3", children: /* @__PURE__ */ jsxs11("nav", { className: "flex items-center gap-0 md:gap-1", children: [
|
|
1135
|
+
/* @__PURE__ */ jsx13(ModeSwitcher3, {}),
|
|
1136
|
+
/* @__PURE__ */ jsx13(LanguageSwitcher, {}),
|
|
1137
|
+
/* @__PURE__ */ jsx13(MobileNav, { children: /* @__PURE__ */ jsxs11("div", { className: "flex flex-col space-y-3", children: [
|
|
1138
|
+
menu?.map(
|
|
1139
|
+
(item, navIndex) => item.href || item.children ? /* @__PURE__ */ jsx13(
|
|
1140
|
+
MobileNavItemRenderer,
|
|
1141
|
+
{
|
|
1142
|
+
item,
|
|
1143
|
+
Link: Link7,
|
|
1144
|
+
pathname,
|
|
1145
|
+
level: 1,
|
|
1146
|
+
onOpenChange: setMobileNavOpen
|
|
1147
|
+
},
|
|
1148
|
+
`nav-${navIndex}-${item.href}`
|
|
1149
|
+
) : null
|
|
1150
|
+
),
|
|
1151
|
+
loginHref && /* @__PURE__ */ jsx13("div", { className: "border-t pt-3", children: /* @__PURE__ */ jsx13(Button4, { variant: "secondary", size: "sm", className: "w-full", children: /* @__PURE__ */ jsx13(Link7, { href: loginHref, target: loginTarget, children: t("ui.navigation.signIn") }) }) })
|
|
1152
|
+
] }) }),
|
|
1153
|
+
loginHref && /* @__PURE__ */ jsxs11(Fragment5, { children: [
|
|
1154
|
+
/* @__PURE__ */ jsx13(Separator, { orientation: "vertical", className: "mx-3 h-5 max-md:hidden" }),
|
|
1155
|
+
/* @__PURE__ */ jsx13(Button4, { variant: "secondary", size: "sm", className: "hidden md:flex", children: /* @__PURE__ */ jsx13(Link7, { href: loginHref, target: loginTarget, children: t("ui.navigation.signIn") }) })
|
|
1156
|
+
] })
|
|
1157
|
+
] }) })
|
|
1158
|
+
]
|
|
1159
|
+
}
|
|
1160
|
+
);
|
|
1003
1161
|
}
|
|
1004
1162
|
|
|
1005
1163
|
// src/components/layouts/wrapper.tsx
|
|
1164
|
+
import { useEffect as useEffect4, useState as useState5 } from "react";
|
|
1006
1165
|
import Link8 from "next/link";
|
|
1007
1166
|
import { RocketIcon } from "lucide-react";
|
|
1008
|
-
import { useSession as useSession5 } from "@pelatform/starter.hook";
|
|
1167
|
+
import { useLayout as useLayout3, useSession as useSession5 } from "@pelatform/starter.hook";
|
|
1168
|
+
import { cn as cn11 } from "pelatform-ui";
|
|
1009
1169
|
import { Button as Button5 } from "pelatform-ui/default";
|
|
1010
1170
|
|
|
1011
1171
|
// src/components/providers/layout.tsx
|
|
1012
|
-
import { useEffect as useEffect3, useState as useState4 } from "react";
|
|
1172
|
+
import { useEffect as useEffect3, useMemo as useMemo2, useState as useState4 } from "react";
|
|
1013
1173
|
import { LayoutContext } from "@pelatform/starter.hook";
|
|
1014
|
-
import { cn as
|
|
1174
|
+
import { cn as cn10 } from "pelatform-ui";
|
|
1175
|
+
import { TooltipProvider } from "pelatform-ui/default";
|
|
1015
1176
|
import { useIsMobile } from "pelatform-ui/hooks";
|
|
1016
1177
|
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1017
1178
|
var SIDEBAR_WIDTH = "240px";
|
|
1018
1179
|
var HEADER_HEIGHT = "54px";
|
|
1019
1180
|
var SIDEBAR_WIDTH_MOBILE = "240px";
|
|
1020
1181
|
var HEADER_HEIGHT_MOBILE = "54px";
|
|
1182
|
+
var SIDEBAR_WIDTH_V2 = "255px";
|
|
1183
|
+
var HEADER_HEIGHT_V2 = "60px";
|
|
1184
|
+
var SIDEBAR_WIDTH_MOBILE_V2 = "60px";
|
|
1185
|
+
var HEADER_HEIGHT_MOBILE_V2 = "60px";
|
|
1021
1186
|
function LayoutProvider({
|
|
1022
1187
|
children,
|
|
1023
1188
|
style: customStyle,
|
|
1024
1189
|
bodyClassName = "",
|
|
1025
1190
|
className = "",
|
|
1026
|
-
logoHeader = /* @__PURE__ */ jsx14(LogoWithHref, {})
|
|
1191
|
+
logoHeader = /* @__PURE__ */ jsx14(LogoWithHref, {}),
|
|
1192
|
+
version = "v1"
|
|
1027
1193
|
}) {
|
|
1028
1194
|
const isMobile = useIsMobile();
|
|
1029
1195
|
const [isSidebarOpen, setIsSidebarOpen] = useState4(true);
|
|
1030
|
-
const
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1196
|
+
const cssVariables = useMemo2(
|
|
1197
|
+
() => ({
|
|
1198
|
+
"--sidebar-width": version === "v1" ? SIDEBAR_WIDTH : SIDEBAR_WIDTH_V2,
|
|
1199
|
+
"--header-height": version === "v1" ? HEADER_HEIGHT : HEADER_HEIGHT_V2,
|
|
1200
|
+
"--sidebar-width-mobile": version === "v1" ? SIDEBAR_WIDTH_MOBILE : SIDEBAR_WIDTH_MOBILE_V2,
|
|
1201
|
+
"--header-height-mobile": version === "v1" ? HEADER_HEIGHT_MOBILE : HEADER_HEIGHT_MOBILE_V2,
|
|
1202
|
+
...customStyle || {}
|
|
1203
|
+
}),
|
|
1204
|
+
[version, customStyle]
|
|
1205
|
+
);
|
|
1206
|
+
const style = useMemo2(
|
|
1207
|
+
() => ({
|
|
1208
|
+
...cssVariables
|
|
1209
|
+
}),
|
|
1210
|
+
[cssVariables]
|
|
1211
|
+
);
|
|
1040
1212
|
const sidebarToggle = () => setIsSidebarOpen((open) => !open);
|
|
1041
1213
|
useEffect3(() => {
|
|
1214
|
+
const html = document.documentElement;
|
|
1215
|
+
const body = document.body;
|
|
1216
|
+
const originalHtmlStyle = html.style.cssText;
|
|
1217
|
+
const originalBodyClasses = body.className;
|
|
1218
|
+
Object.entries(cssVariables).forEach(([prop, val]) => {
|
|
1219
|
+
html.style.setProperty(prop, val);
|
|
1220
|
+
});
|
|
1042
1221
|
if (bodyClassName) {
|
|
1043
|
-
|
|
1044
|
-
const existingClasses = body.className;
|
|
1045
|
-
body.className = `${existingClasses} ${bodyClassName}`.trim();
|
|
1046
|
-
return () => {
|
|
1047
|
-
body.className = existingClasses;
|
|
1048
|
-
};
|
|
1222
|
+
body.className = `${originalBodyClasses} ${bodyClassName}`.trim();
|
|
1049
1223
|
}
|
|
1050
|
-
|
|
1224
|
+
body.setAttribute("data-sidebar-open", isSidebarOpen.toString());
|
|
1225
|
+
return () => {
|
|
1226
|
+
html.style.cssText = originalHtmlStyle;
|
|
1227
|
+
body.className = originalBodyClasses;
|
|
1228
|
+
body.removeAttribute("data-sidebar-open");
|
|
1229
|
+
};
|
|
1230
|
+
}, [cssVariables, bodyClassName, isSidebarOpen]);
|
|
1051
1231
|
return /* @__PURE__ */ jsx14(
|
|
1052
1232
|
LayoutContext.Provider,
|
|
1053
1233
|
{
|
|
@@ -1057,16 +1237,17 @@ function LayoutProvider({
|
|
|
1057
1237
|
isMobile,
|
|
1058
1238
|
isSidebarOpen,
|
|
1059
1239
|
sidebarToggle,
|
|
1060
|
-
logoHeader
|
|
1240
|
+
logoHeader,
|
|
1241
|
+
version
|
|
1061
1242
|
},
|
|
1062
1243
|
children: /* @__PURE__ */ jsx14(
|
|
1063
1244
|
"div",
|
|
1064
1245
|
{
|
|
1065
1246
|
"data-slot": "layout-wrapper",
|
|
1066
|
-
className:
|
|
1247
|
+
className: cn10("flex grow", className),
|
|
1067
1248
|
"data-sidebar-open": isSidebarOpen,
|
|
1068
1249
|
style,
|
|
1069
|
-
children
|
|
1250
|
+
children: /* @__PURE__ */ jsx14(TooltipProvider, { delayDuration: 0, children })
|
|
1070
1251
|
}
|
|
1071
1252
|
)
|
|
1072
1253
|
}
|
|
@@ -1077,42 +1258,142 @@ function LayoutProvider({
|
|
|
1077
1258
|
import { Fragment as Fragment6, jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1078
1259
|
function LayoutWrapper({
|
|
1079
1260
|
children,
|
|
1261
|
+
classNames,
|
|
1262
|
+
logoHeader,
|
|
1263
|
+
version = "v1",
|
|
1264
|
+
...props
|
|
1265
|
+
}) {
|
|
1266
|
+
const isVersionV1 = version === "v1";
|
|
1267
|
+
return /* @__PURE__ */ jsx15(
|
|
1268
|
+
LayoutProvider,
|
|
1269
|
+
{
|
|
1270
|
+
logoHeader,
|
|
1271
|
+
version,
|
|
1272
|
+
bodyClassName: cn11(isVersionV1 ? "" : "bg-muted!", classNames?.body),
|
|
1273
|
+
className: classNames?.layout,
|
|
1274
|
+
children: isVersionV1 ? /* @__PURE__ */ jsx15(ContentWrapper, { classNames, ...props, children }) : /* @__PURE__ */ jsx15(ContentWrapperV2, { classNames, ...props, children })
|
|
1275
|
+
}
|
|
1276
|
+
);
|
|
1277
|
+
}
|
|
1278
|
+
function ContentWrapper({
|
|
1279
|
+
children,
|
|
1280
|
+
classNames,
|
|
1080
1281
|
sidebarHeader,
|
|
1081
1282
|
sidebarMenu,
|
|
1082
|
-
logoHeader,
|
|
1083
1283
|
homeUrl,
|
|
1084
1284
|
studioUrl
|
|
1085
1285
|
}) {
|
|
1086
1286
|
const { user } = useSession5();
|
|
1087
1287
|
const sidebarContent = /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
1088
1288
|
sidebarHeader,
|
|
1089
|
-
/* @__PURE__ */ jsx15(SidebarContent, { children: sidebarMenu })
|
|
1289
|
+
/* @__PURE__ */ jsx15(SidebarContent, { className: classNames?.sidebarContent, children: sidebarMenu })
|
|
1090
1290
|
] });
|
|
1091
|
-
const studioButton = /* @__PURE__ */ jsx15(Button5, { variant: "ghost", asChild: true, children: /* @__PURE__ */ jsxs12(Link8, { href: studioUrl || "#", target: "_blank", children: [
|
|
1291
|
+
const studioButton = /* @__PURE__ */ jsx15(Button5, { variant: "ghost", asChild: true, className: classNames?.studioButton, children: /* @__PURE__ */ jsxs12(Link8, { href: studioUrl || "#", target: "_blank", children: [
|
|
1092
1292
|
/* @__PURE__ */ jsx15(RocketIcon, {}),
|
|
1093
1293
|
" Studio"
|
|
1094
1294
|
] }) });
|
|
1095
|
-
return /* @__PURE__ */ jsxs12(
|
|
1096
|
-
/* @__PURE__ */ jsxs12(Header, { children: [
|
|
1097
|
-
/* @__PURE__ */ jsx15(HeaderLeft, {}),
|
|
1295
|
+
return /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
1296
|
+
/* @__PURE__ */ jsxs12(Header, { className: classNames?.header, children: [
|
|
1297
|
+
/* @__PURE__ */ jsx15(HeaderLeft, { className: classNames?.headerLeft }),
|
|
1098
1298
|
/* @__PURE__ */ jsx15(
|
|
1099
1299
|
HeaderRight,
|
|
1100
1300
|
{
|
|
1301
|
+
className: classNames?.headerRight,
|
|
1101
1302
|
sidebar: /* @__PURE__ */ jsx15(HeaderSidebarMobile, { children: sidebarContent }),
|
|
1102
1303
|
button: studioUrl && user?.role === "admin" ? studioButton : null,
|
|
1103
1304
|
homeUrl
|
|
1104
1305
|
}
|
|
1105
1306
|
)
|
|
1106
1307
|
] }),
|
|
1107
|
-
/* @__PURE__ */ jsxs12(
|
|
1108
|
-
|
|
1109
|
-
|
|
1308
|
+
/* @__PURE__ */ jsxs12(
|
|
1309
|
+
"div",
|
|
1310
|
+
{
|
|
1311
|
+
className: cn11(
|
|
1312
|
+
"flex grow pt-(--header-height-mobile) lg:pt-(--header-height)",
|
|
1313
|
+
classNames?.wrapper
|
|
1314
|
+
),
|
|
1315
|
+
children: [
|
|
1316
|
+
/* @__PURE__ */ jsx15(Sidebar, { className: classNames?.sidebar, children: sidebarContent }),
|
|
1317
|
+
/* @__PURE__ */ jsx15(
|
|
1318
|
+
"main",
|
|
1319
|
+
{
|
|
1320
|
+
className: cn11(
|
|
1321
|
+
"grow transition-all duration-300 lg:in-data-[sidebar-open=false]:ps-0 lg:ps-(--sidebar-width)",
|
|
1322
|
+
classNames?.content
|
|
1323
|
+
),
|
|
1324
|
+
children
|
|
1325
|
+
}
|
|
1326
|
+
)
|
|
1327
|
+
]
|
|
1328
|
+
}
|
|
1329
|
+
)
|
|
1330
|
+
] });
|
|
1331
|
+
}
|
|
1332
|
+
function ContentWrapperV2({
|
|
1333
|
+
children,
|
|
1334
|
+
classNames,
|
|
1335
|
+
sidebarHeader,
|
|
1336
|
+
sidebarMenu,
|
|
1337
|
+
sidebarFooter,
|
|
1338
|
+
homeUrl,
|
|
1339
|
+
studioUrl
|
|
1340
|
+
}) {
|
|
1341
|
+
const { isMobile } = useLayout3();
|
|
1342
|
+
const { user } = useSession5();
|
|
1343
|
+
const [enableTransitions, setEnableTransitions] = useState5(false);
|
|
1344
|
+
useEffect4(() => {
|
|
1345
|
+
const id = requestAnimationFrame(() => setEnableTransitions(true));
|
|
1346
|
+
return () => cancelAnimationFrame(id);
|
|
1347
|
+
}, []);
|
|
1348
|
+
const sidebarContent = /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
1349
|
+
sidebarHeader,
|
|
1350
|
+
/* @__PURE__ */ jsx15(SidebarContent, { className: classNames?.sidebarContent, children: sidebarMenu }),
|
|
1351
|
+
!isMobile && sidebarFooter
|
|
1352
|
+
] });
|
|
1353
|
+
const studioButton = /* @__PURE__ */ jsx15(
|
|
1354
|
+
Button5,
|
|
1355
|
+
{
|
|
1356
|
+
variant: "mono",
|
|
1357
|
+
size: "sm",
|
|
1358
|
+
className: cn11("rounded-full", classNames?.studioButton),
|
|
1359
|
+
asChild: true,
|
|
1360
|
+
children: /* @__PURE__ */ jsxs12(Link8, { href: studioUrl || "#", target: "_blank", children: [
|
|
1361
|
+
/* @__PURE__ */ jsx15(RocketIcon, {}),
|
|
1362
|
+
" Studio"
|
|
1363
|
+
] })
|
|
1364
|
+
}
|
|
1365
|
+
);
|
|
1366
|
+
return /* @__PURE__ */ jsxs12("div", { className: cn11("flex h-screen w-full [&_.container-fluid]:px-5", classNames?.wrapper), children: [
|
|
1367
|
+
/* @__PURE__ */ jsx15(Sidebar, { className: classNames?.sidebar, children: sidebarContent }),
|
|
1368
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex w-full min-w-0 flex-1 flex-col pt-(--header-height-mobile) lg:pt-0", children: [
|
|
1369
|
+
isMobile && /* @__PURE__ */ jsxs12(Header, { className: classNames?.header, children: [
|
|
1370
|
+
/* @__PURE__ */ jsx15(HeaderLeft, { className: classNames?.headerLeft }),
|
|
1371
|
+
/* @__PURE__ */ jsx15(
|
|
1372
|
+
HeaderRight,
|
|
1373
|
+
{
|
|
1374
|
+
className: classNames?.headerRight,
|
|
1375
|
+
sidebar: /* @__PURE__ */ jsx15(HeaderSidebarMobile, { children: sidebarContent }),
|
|
1376
|
+
button: studioUrl && user?.role === "admin" ? studioButton : null,
|
|
1377
|
+
homeUrl
|
|
1378
|
+
}
|
|
1379
|
+
)
|
|
1380
|
+
] }),
|
|
1381
|
+
/* @__PURE__ */ jsx15("div", { className: "mx-5 flex grow py-2.5 lg:mx-2.5", children: /* @__PURE__ */ jsx15(
|
|
1382
|
+
"div",
|
|
1383
|
+
{
|
|
1384
|
+
className: cn11(
|
|
1385
|
+
"grow overflow-y-auto rounded-xl border border-input bg-background shadow-xs duration-300 lg:in-data-[sidebar-open=true]:ms-[calc(var(--sidebar-width)+0.6rem)] lg:ms-[calc(var(--sidebar-width-collapsed)+0.6rem)]",
|
|
1386
|
+
enableTransitions ? "transition-all duration-300" : "transition-none"
|
|
1387
|
+
),
|
|
1388
|
+
children: /* @__PURE__ */ jsx15("main", { className: cn11("grow", classNames?.content), children })
|
|
1389
|
+
}
|
|
1390
|
+
) })
|
|
1110
1391
|
] })
|
|
1111
1392
|
] });
|
|
1112
1393
|
}
|
|
1113
1394
|
|
|
1114
1395
|
// src/components/providers/config.tsx
|
|
1115
|
-
import { useMemo as
|
|
1396
|
+
import { useMemo as useMemo3 } from "react";
|
|
1116
1397
|
import { defaultConfig, mergeConfig } from "@pelatform/starter.config";
|
|
1117
1398
|
import {
|
|
1118
1399
|
ConfigContext,
|
|
@@ -1128,7 +1409,7 @@ function ConfigProvider({
|
|
|
1128
1409
|
workspaceLogo: workspaceLogoProp,
|
|
1129
1410
|
...props
|
|
1130
1411
|
}) {
|
|
1131
|
-
const mergedConfig =
|
|
1412
|
+
const mergedConfig = useMemo3(() => {
|
|
1132
1413
|
return mergeConfig(defaultConfig, configProp);
|
|
1133
1414
|
}, [configProp]);
|
|
1134
1415
|
const config = mergedConfig;
|
|
@@ -1137,7 +1418,7 @@ function ConfigProvider({
|
|
|
1137
1418
|
extension: "png",
|
|
1138
1419
|
size: 128
|
|
1139
1420
|
};
|
|
1140
|
-
const userAvatar =
|
|
1421
|
+
const userAvatar = useMemo3(() => {
|
|
1141
1422
|
if (!userAvatarProp) {
|
|
1142
1423
|
return {
|
|
1143
1424
|
extension: DEFAULT_IMAGE_OPTIONS.extension,
|
|
@@ -1151,7 +1432,7 @@ function ConfigProvider({
|
|
|
1151
1432
|
size: userAvatarProp.size || (userAvatarProp.upload ? 256 : DEFAULT_IMAGE_OPTIONS.size)
|
|
1152
1433
|
};
|
|
1153
1434
|
}, [userAvatarProp]);
|
|
1154
|
-
const workspaceLogo =
|
|
1435
|
+
const workspaceLogo = useMemo3(() => {
|
|
1155
1436
|
if (!workspaceLogoProp) {
|
|
1156
1437
|
return {
|
|
1157
1438
|
extension: DEFAULT_IMAGE_OPTIONS.extension,
|
|
@@ -1194,7 +1475,7 @@ import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
|
|
1194
1475
|
import { NextIntlClientProvider } from "next-intl";
|
|
1195
1476
|
import { useConfig as useConfig7 } from "@pelatform/starter.hook";
|
|
1196
1477
|
import { QueryProvider, ThemeProvider } from "pelatform-ui/components";
|
|
1197
|
-
import { Toaster as Sonner } from "pelatform-ui/default";
|
|
1478
|
+
import { Toaster as Sonner, TooltipProvider as TooltipProvider2 } from "pelatform-ui/default";
|
|
1198
1479
|
import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1199
1480
|
function SharedProviders({
|
|
1200
1481
|
children,
|
|
@@ -1205,16 +1486,16 @@ function SharedProviders({
|
|
|
1205
1486
|
}) {
|
|
1206
1487
|
const config = useConfig7();
|
|
1207
1488
|
return /* @__PURE__ */ jsxs13(QueryProvider, { children: [
|
|
1208
|
-
/* @__PURE__ */ jsx17(ThemeProvider, { defaultTheme: config.ui.defaultTheme, children: /* @__PURE__ */ jsx17(NextIntlClientProvider, { locale, messages, timeZone, children: /* @__PURE__ */ jsxs13(Suspense2, { children: [
|
|
1489
|
+
/* @__PURE__ */ jsx17(ThemeProvider, { defaultTheme: config.ui.defaultTheme, children: /* @__PURE__ */ jsx17(TooltipProvider2, { children: /* @__PURE__ */ jsx17(NextIntlClientProvider, { locale, messages, timeZone, children: /* @__PURE__ */ jsxs13(Suspense2, { children: [
|
|
1209
1490
|
children,
|
|
1210
1491
|
/* @__PURE__ */ jsx17(Sonner, { position: sonnerPosition })
|
|
1211
|
-
] }) }) }),
|
|
1492
|
+
] }) }) }) }),
|
|
1212
1493
|
/* @__PURE__ */ jsx17(ReactQueryDevtools, { initialIsOpen: false })
|
|
1213
1494
|
] });
|
|
1214
1495
|
}
|
|
1215
1496
|
|
|
1216
1497
|
// src/components/utils/card.tsx
|
|
1217
|
-
import { cn as
|
|
1498
|
+
import { cn as cn12 } from "pelatform-ui";
|
|
1218
1499
|
import { Button as Button6, Card, CardContent, CardFooter, Skeleton as Skeleton4, Spinner } from "pelatform-ui/default";
|
|
1219
1500
|
import { Fragment as Fragment7, jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1220
1501
|
function CardComponent({
|
|
@@ -1235,7 +1516,7 @@ function CardComponent({
|
|
|
1235
1516
|
return /* @__PURE__ */ jsxs14(
|
|
1236
1517
|
Card,
|
|
1237
1518
|
{
|
|
1238
|
-
className:
|
|
1519
|
+
className: cn12(
|
|
1239
1520
|
"w-full overflow-hidden",
|
|
1240
1521
|
isDestructive && "border-destructive/70",
|
|
1241
1522
|
className,
|
|
@@ -1243,7 +1524,7 @@ function CardComponent({
|
|
|
1243
1524
|
),
|
|
1244
1525
|
...props,
|
|
1245
1526
|
children: [
|
|
1246
|
-
/* @__PURE__ */ jsxs14(CardContent, { className:
|
|
1527
|
+
/* @__PURE__ */ jsxs14(CardContent, { className: cn12("space-y-6 p-5 sm:p-10", classNames?.content), children: [
|
|
1247
1528
|
/* @__PURE__ */ jsx18(
|
|
1248
1529
|
CardHeaderComponent,
|
|
1249
1530
|
{
|
|
@@ -1279,12 +1560,12 @@ function CardHeaderComponent({
|
|
|
1279
1560
|
description,
|
|
1280
1561
|
isPending
|
|
1281
1562
|
}) {
|
|
1282
|
-
return /* @__PURE__ */ jsx18("div", { className:
|
|
1283
|
-
/* @__PURE__ */ jsx18(Skeleton4, { className:
|
|
1284
|
-
description && /* @__PURE__ */ jsx18(Skeleton4, { className:
|
|
1563
|
+
return /* @__PURE__ */ jsx18("div", { className: cn12("flex flex-col space-y-2", className, classNames?.header), children: isPending ? /* @__PURE__ */ jsxs14(Fragment7, { children: [
|
|
1564
|
+
/* @__PURE__ */ jsx18(Skeleton4, { className: cn12("h-7 w-1/3", classNames?.skeleton) }),
|
|
1565
|
+
description && /* @__PURE__ */ jsx18(Skeleton4, { className: cn12("h-5 w-2/3", classNames?.skeleton) })
|
|
1285
1566
|
] }) : /* @__PURE__ */ jsxs14(Fragment7, { children: [
|
|
1286
|
-
/* @__PURE__ */ jsx18("h2", { className:
|
|
1287
|
-
description && /* @__PURE__ */ jsx18("p", { className:
|
|
1567
|
+
/* @__PURE__ */ jsx18("h2", { className: cn12("font-medium text-xl", classNames?.title), children: title }),
|
|
1568
|
+
description && /* @__PURE__ */ jsx18("p", { className: cn12("text-muted-foreground text-sm", classNames?.description), children: description })
|
|
1288
1569
|
] }) });
|
|
1289
1570
|
}
|
|
1290
1571
|
function CardFooterComponent({
|
|
@@ -1301,7 +1582,7 @@ function CardFooterComponent({
|
|
|
1301
1582
|
return /* @__PURE__ */ jsx18(
|
|
1302
1583
|
CardFooter,
|
|
1303
1584
|
{
|
|
1304
|
-
className:
|
|
1585
|
+
className: cn12(
|
|
1305
1586
|
"flex items-center justify-between space-x-4 bg-muted p-3 sm:px-10",
|
|
1306
1587
|
isDestructive && "border-destructive/70",
|
|
1307
1588
|
className,
|
|
@@ -1311,7 +1592,7 @@ function CardFooterComponent({
|
|
|
1311
1592
|
instructions && /* @__PURE__ */ jsx18(
|
|
1312
1593
|
Skeleton4,
|
|
1313
1594
|
{
|
|
1314
|
-
className:
|
|
1595
|
+
className: cn12(
|
|
1315
1596
|
"h-4 w-48 max-w-full bg-muted-foreground/10 md:h-5 md:w-60",
|
|
1316
1597
|
classNames?.skeleton
|
|
1317
1598
|
)
|
|
@@ -1320,14 +1601,14 @@ function CardFooterComponent({
|
|
|
1320
1601
|
actionLabel && /* @__PURE__ */ jsx18(
|
|
1321
1602
|
Skeleton4,
|
|
1322
1603
|
{
|
|
1323
|
-
className:
|
|
1604
|
+
className: cn12("h-8 w-20 bg-muted-foreground/10 md:ms-auto", classNames?.skeleton)
|
|
1324
1605
|
}
|
|
1325
1606
|
)
|
|
1326
1607
|
] }) : /* @__PURE__ */ jsxs14(Fragment7, { children: [
|
|
1327
1608
|
instructions && /* @__PURE__ */ jsx18(
|
|
1328
1609
|
"div",
|
|
1329
1610
|
{
|
|
1330
|
-
className:
|
|
1611
|
+
className: cn12("text-muted-foreground text-xs md:text-sm", classNames?.instructions),
|
|
1331
1612
|
children: instructions
|
|
1332
1613
|
}
|
|
1333
1614
|
),
|
|
@@ -1361,7 +1642,7 @@ function CardActionComponent({
|
|
|
1361
1642
|
type: onClick ? "button" : "submit",
|
|
1362
1643
|
variant: isDestructive ? "destructive" : "primary",
|
|
1363
1644
|
size: "sm",
|
|
1364
|
-
className:
|
|
1645
|
+
className: cn12(
|
|
1365
1646
|
"ms-auto",
|
|
1366
1647
|
isSubmitting || disabled ? "pointer-events-auto! cursor-not-allowed" : "",
|
|
1367
1648
|
classNames?.button,
|
|
@@ -1380,7 +1661,7 @@ function CardActionComponent({
|
|
|
1380
1661
|
|
|
1381
1662
|
// src/components/utils/dialog.tsx
|
|
1382
1663
|
import { useTranslations as useTranslations11 } from "next-intl";
|
|
1383
|
-
import { cn as
|
|
1664
|
+
import { cn as cn13 } from "pelatform-ui";
|
|
1384
1665
|
import {
|
|
1385
1666
|
Button as Button7,
|
|
1386
1667
|
Dialog,
|
|
@@ -1408,13 +1689,13 @@ function DialogComponent({
|
|
|
1408
1689
|
DialogContent,
|
|
1409
1690
|
{
|
|
1410
1691
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
1411
|
-
className:
|
|
1692
|
+
className: cn13("bg-muted sm:max-w-md", classNames?.dialog?.content),
|
|
1412
1693
|
showCloseButton,
|
|
1413
1694
|
children: [
|
|
1414
1695
|
/* @__PURE__ */ jsxs15(
|
|
1415
1696
|
DialogHeader,
|
|
1416
1697
|
{
|
|
1417
|
-
className:
|
|
1698
|
+
className: cn13(
|
|
1418
1699
|
"-ms-6 -me-6 -mt-6 space-y-2 rounded-t-lg bg-background p-6",
|
|
1419
1700
|
classNames?.header
|
|
1420
1701
|
),
|
|
@@ -1448,13 +1729,13 @@ function DialogFooterComponent({
|
|
|
1448
1729
|
button
|
|
1449
1730
|
}) {
|
|
1450
1731
|
const t = useTranslations11();
|
|
1451
|
-
return /* @__PURE__ */ jsxs15(DialogFooter, { className:
|
|
1732
|
+
return /* @__PURE__ */ jsxs15(DialogFooter, { className: cn13(className, classNames?.dialog?.footer), children: [
|
|
1452
1733
|
cancelButton && /* @__PURE__ */ jsx19(
|
|
1453
1734
|
Button7,
|
|
1454
1735
|
{
|
|
1455
1736
|
type: "button",
|
|
1456
1737
|
variant: "ghost",
|
|
1457
|
-
className:
|
|
1738
|
+
className: cn13(classNames?.button),
|
|
1458
1739
|
onClick: () => onOpenChange?.(false),
|
|
1459
1740
|
disabled: cancelButtonDisabled,
|
|
1460
1741
|
children: t("common.actions.cancel")
|
|
@@ -1465,22 +1746,22 @@ function DialogFooterComponent({
|
|
|
1465
1746
|
}
|
|
1466
1747
|
|
|
1467
1748
|
// src/components/utils/skeleton.tsx
|
|
1468
|
-
import { cn as
|
|
1749
|
+
import { cn as cn14 } from "pelatform-ui";
|
|
1469
1750
|
import { Card as Card2, Skeleton as Skeleton5 } from "pelatform-ui/default";
|
|
1470
1751
|
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1471
1752
|
function SkeletonViewComponent({ classNames }) {
|
|
1472
|
-
return /* @__PURE__ */ jsxs16(Card2, { className:
|
|
1753
|
+
return /* @__PURE__ */ jsxs16(Card2, { className: cn14("flex-row items-center gap-3 px-4 py-3", classNames?.cell), children: [
|
|
1473
1754
|
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2", children: [
|
|
1474
|
-
/* @__PURE__ */ jsx20(Skeleton5, { className:
|
|
1475
|
-
/* @__PURE__ */ jsx20("div", { children: /* @__PURE__ */ jsx20(Skeleton5, { className:
|
|
1755
|
+
/* @__PURE__ */ jsx20(Skeleton5, { className: cn14("size-5 rounded-full", classNames?.skeleton) }),
|
|
1756
|
+
/* @__PURE__ */ jsx20("div", { children: /* @__PURE__ */ jsx20(Skeleton5, { className: cn14("h-4 w-32", classNames?.skeleton) }) })
|
|
1476
1757
|
] }),
|
|
1477
|
-
/* @__PURE__ */ jsx20(Skeleton5, { className:
|
|
1758
|
+
/* @__PURE__ */ jsx20(Skeleton5, { className: cn14("ms-auto size-8 w-16", classNames?.skeleton) })
|
|
1478
1759
|
] });
|
|
1479
1760
|
}
|
|
1480
1761
|
function SkeletonInputComponent({ classNames }) {
|
|
1481
1762
|
return /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-1.5", children: [
|
|
1482
|
-
/* @__PURE__ */ jsx20(Skeleton5, { className:
|
|
1483
|
-
/* @__PURE__ */ jsx20(Skeleton5, { className:
|
|
1763
|
+
/* @__PURE__ */ jsx20(Skeleton5, { className: cn14("h-4 w-32", classNames?.skeleton) }),
|
|
1764
|
+
/* @__PURE__ */ jsx20(Skeleton5, { className: cn14("h-9 w-full", classNames?.skeleton) })
|
|
1484
1765
|
] });
|
|
1485
1766
|
}
|
|
1486
1767
|
|
|
@@ -1488,14 +1769,14 @@ function SkeletonInputComponent({ classNames }) {
|
|
|
1488
1769
|
import { useRef } from "react";
|
|
1489
1770
|
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
1490
1771
|
import { useTranslations as useTranslations12 } from "next-intl";
|
|
1491
|
-
import { cn as
|
|
1772
|
+
import { cn as cn15 } from "pelatform-ui";
|
|
1492
1773
|
import {
|
|
1493
1774
|
Button as Button8,
|
|
1494
1775
|
Input,
|
|
1495
1776
|
Skeleton as Skeleton6,
|
|
1496
1777
|
Tooltip,
|
|
1497
1778
|
TooltipContent,
|
|
1498
|
-
TooltipProvider,
|
|
1779
|
+
TooltipProvider as TooltipProvider3,
|
|
1499
1780
|
TooltipTrigger
|
|
1500
1781
|
} from "pelatform-ui/default";
|
|
1501
1782
|
import { useCopyToClipboard } from "pelatform-ui/hooks";
|
|
@@ -1526,17 +1807,17 @@ function DisplayIdCard({
|
|
|
1526
1807
|
description,
|
|
1527
1808
|
isPending,
|
|
1528
1809
|
...props,
|
|
1529
|
-
children: isPending ? /* @__PURE__ */ jsx21(Skeleton6, { className:
|
|
1810
|
+
children: isPending ? /* @__PURE__ */ jsx21(Skeleton6, { className: cn15("h-11.5 w-full max-w-md", classNames?.skeleton) }) : /* @__PURE__ */ jsxs17(
|
|
1530
1811
|
"div",
|
|
1531
1812
|
{
|
|
1532
|
-
className:
|
|
1813
|
+
className: cn15(
|
|
1533
1814
|
"flex w-full max-w-md items-center justify-between rounded-md border p-2",
|
|
1534
1815
|
classNames?.grid
|
|
1535
1816
|
),
|
|
1536
1817
|
children: [
|
|
1537
1818
|
/* @__PURE__ */ jsx21(Input, { value: id, ref: inputRef, disabled: true, className: "border-none! bg-transparent!" }),
|
|
1538
|
-
/* @__PURE__ */ jsx21(
|
|
1539
|
-
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(Button8, { variant: "dim", onClick: handleCopy, disabled: copied, children: copied ? /* @__PURE__ */ jsx21(CheckIcon, { className:
|
|
1819
|
+
/* @__PURE__ */ jsx21(TooltipProvider3, { delayDuration: 0, children: /* @__PURE__ */ jsxs17(Tooltip, { children: [
|
|
1820
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(Button8, { variant: "dim", onClick: handleCopy, disabled: copied, children: copied ? /* @__PURE__ */ jsx21(CheckIcon, { className: cn15("stroke-green-600", classNames?.icon) }) : /* @__PURE__ */ jsx21(CopyIcon, { className: classNames?.icon }) }) }),
|
|
1540
1821
|
/* @__PURE__ */ jsx21(TooltipContent, { className: "px-2 py-1 text-xs", children: t("common.actions.copy") })
|
|
1541
1822
|
] }) })
|
|
1542
1823
|
]
|
|
@@ -1549,7 +1830,7 @@ function DisplayIdCard({
|
|
|
1549
1830
|
// src/components/empty-state.tsx
|
|
1550
1831
|
import Link9 from "next/link";
|
|
1551
1832
|
import { useTranslations as useTranslations13 } from "next-intl";
|
|
1552
|
-
import { cn as
|
|
1833
|
+
import { cn as cn16 } from "pelatform-ui";
|
|
1553
1834
|
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1554
1835
|
function EmptyState({
|
|
1555
1836
|
className,
|
|
@@ -1561,7 +1842,7 @@ function EmptyState({
|
|
|
1561
1842
|
children
|
|
1562
1843
|
}) {
|
|
1563
1844
|
const t = useTranslations13();
|
|
1564
|
-
return /* @__PURE__ */ jsxs18("div", { className:
|
|
1845
|
+
return /* @__PURE__ */ jsxs18("div", { className: cn16("flex flex-col items-center justify-center gap-y-4", className), children: [
|
|
1565
1846
|
Icon && /* @__PURE__ */ jsx22("div", { className: "flex size-14 items-center justify-center rounded-2xl border bg-muted", children: /* @__PURE__ */ jsx22(Icon, { className: "size-6 text-foreground" }) }),
|
|
1566
1847
|
/* @__PURE__ */ jsx22("p", { className: "text-center font-medium text-base text-foreground", children: title }),
|
|
1567
1848
|
description && /* @__PURE__ */ jsxs18("p", { className: "max-w-sm text-balance text-center text-muted-foreground text-sm", children: [
|
|
@@ -1631,9 +1912,9 @@ function OTPInputGroup({ otpSeparators = 0 }) {
|
|
|
1631
1912
|
}
|
|
1632
1913
|
|
|
1633
1914
|
// src/components/password-input.tsx
|
|
1634
|
-
import { useState as
|
|
1915
|
+
import { useState as useState6 } from "react";
|
|
1635
1916
|
import { EyeIcon, EyeOffIcon } from "lucide-react";
|
|
1636
|
-
import { cn as
|
|
1917
|
+
import { cn as cn17 } from "pelatform-ui";
|
|
1637
1918
|
import { Button as Button9, Input as Input2 } from "pelatform-ui/default";
|
|
1638
1919
|
import { Fragment as Fragment9, jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1639
1920
|
function PasswordInput({
|
|
@@ -1643,15 +1924,15 @@ function PasswordInput({
|
|
|
1643
1924
|
onChange,
|
|
1644
1925
|
...props
|
|
1645
1926
|
}) {
|
|
1646
|
-
const [disabled, setDisabled] =
|
|
1647
|
-
const [isVisible, setIsVisible] =
|
|
1927
|
+
const [disabled, setDisabled] = useState6(true);
|
|
1928
|
+
const [isVisible, setIsVisible] = useState6(false);
|
|
1648
1929
|
return /* @__PURE__ */ jsxs20("div", { className: "relative", children: [
|
|
1649
1930
|
/* @__PURE__ */ jsx24(
|
|
1650
1931
|
Input2,
|
|
1651
1932
|
{
|
|
1652
1933
|
type: isVisible && enableToggle ? "text" : "password",
|
|
1653
1934
|
variant,
|
|
1654
|
-
className:
|
|
1935
|
+
className: cn17(enableToggle && "pe-10", className),
|
|
1655
1936
|
...props,
|
|
1656
1937
|
onChange: (event) => {
|
|
1657
1938
|
setDisabled(!event.target.value);
|
|
@@ -1827,6 +2108,7 @@ export {
|
|
|
1827
2108
|
Sidebar,
|
|
1828
2109
|
SidebarContent,
|
|
1829
2110
|
SidebarContentMenu,
|
|
2111
|
+
SidebarFooter,
|
|
1830
2112
|
SidebarHeaderBack,
|
|
1831
2113
|
SignedInHint,
|
|
1832
2114
|
SiteFooter,
|