@pelatform/starter.shared 0.2.4 → 0.2.6

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 CHANGED
@@ -22,9 +22,10 @@ declare function Header({ children }: {
22
22
  children: ReactNode;
23
23
  }): react_jsx_runtime.JSX.Element;
24
24
  declare function HeaderLeft(): react_jsx_runtime.JSX.Element;
25
- declare function HeaderRight({ sidebar, button }: {
25
+ declare function HeaderRight({ sidebar, button, homeUrl, }: {
26
26
  sidebar?: ReactNode;
27
27
  button?: ReactNode;
28
+ homeUrl?: string;
28
29
  }): react_jsx_runtime.JSX.Element;
29
30
  declare function HeaderSidebarMobile({ children }: {
30
31
  children: ReactNode;
@@ -57,10 +58,11 @@ declare function SiteHeader({ menu, logo, }: {
57
58
  menu: NavItem[];
58
59
  logo?: ReactNode;
59
60
  }): react_jsx_runtime.JSX.Element;
60
- declare function SiteHeaderSecondary({ menu, logo, loginLink, }: {
61
+ declare function SiteHeaderSecondary({ menu, logo, loginHref, loginTarget, }: {
61
62
  menu: NavItem[];
62
63
  logo?: ReactNode;
63
- loginLink?: string;
64
+ loginHref?: string;
65
+ loginTarget?: "_self" | "_blank" | "_parent" | "_top";
64
66
  }): react_jsx_runtime.JSX.Element;
65
67
 
66
68
  type ToolbarItem = "darkmode" | "help" | "language" | "onboarding";
@@ -75,8 +77,9 @@ interface LayoutWrapperProps {
75
77
  sidebarHeader: ReactNode;
76
78
  sidebarMenu: ReactNode;
77
79
  logoHeader?: ReactNode;
80
+ homeUrl?: string;
78
81
  }
79
- declare function LayoutWrapper({ children, sidebarHeader, sidebarMenu, logoHeader, }: LayoutWrapperProps): react_jsx_runtime.JSX.Element;
82
+ declare function LayoutWrapper({ children, sidebarHeader, sidebarMenu, logoHeader, homeUrl, }: LayoutWrapperProps): react_jsx_runtime.JSX.Element;
80
83
 
81
84
  /**
82
85
  * Props for the ConfigProvider component
@@ -267,7 +270,8 @@ declare function SignedInHint({ linkHref }: {
267
270
  linkHref?: string;
268
271
  }): react_jsx_runtime.JSX.Element;
269
272
 
270
- declare function UserMenu({ hiddenSwitcher }: {
273
+ declare function UserMenu({ homeUrl, hiddenSwitcher, }: {
274
+ homeUrl?: string;
271
275
  hiddenSwitcher?: boolean;
272
276
  }): react_jsx_runtime.JSX.Element;
273
277
 
package/dist/index.js CHANGED
@@ -148,12 +148,12 @@ function ToolbarRSC({ show = DEFAULT_SHOW }) {
148
148
  import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
149
149
  function AuthLayout({
150
150
  children,
151
- logo = /* @__PURE__ */ jsx6(LogoWithName, {}),
151
+ logo = /* @__PURE__ */ jsx6(LogoWithHref, {}),
152
152
  disableFooter = false,
153
153
  signInHint = false,
154
154
  signInHref
155
155
  }) {
156
- const { app, path } = useConfig3();
156
+ const { path } = useConfig3();
157
157
  const pathname = usePathname();
158
158
  const t = useTranslations4();
159
159
  const footer = /* @__PURE__ */ jsxs4("p", { className: "px-20 py-4 text-center font-medium text-muted-foreground text-xs md:px-0", children: [
@@ -186,7 +186,6 @@ function AuthLayout({
186
186
  {
187
187
  className: "[&_.max-w-4xl]:max-w-sm [&_.max-w-4xl]:px-0",
188
188
  logo,
189
- logoHref: app.baseUrl,
190
189
  footer: disableFooter || pathname === path.auth.SIGN_OUT || pathname === path.auth.CALLBACK ? null : footer,
191
190
  children
192
191
  }
@@ -216,7 +215,14 @@ import {
216
215
  import { Fragment as Fragment2, useCallback, useEffect, useState } from "react";
217
216
  import Link4 from "next/link";
218
217
  import { useRouter as useRouter2 } from "next/navigation";
219
- import { LogOutIcon, PlusCircleIcon, SettingsIcon, ShieldIcon, UserStarIcon } from "lucide-react";
218
+ import {
219
+ HouseIcon,
220
+ LogOutIcon,
221
+ PlusCircleIcon,
222
+ SettingsIcon,
223
+ ShieldIcon,
224
+ UserStarIcon
225
+ } from "lucide-react";
220
226
  import { useTranslations as useTranslations7 } from "next-intl";
221
227
  import {
222
228
  useConfig as useConfig4,
@@ -511,7 +517,10 @@ function WorkspaceView({ className, classNames, isPending, size, workspace }) {
511
517
 
512
518
  // src/components/user-menu.tsx
513
519
  import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
514
- function UserMenu({ hiddenSwitcher = false }) {
520
+ function UserMenu({
521
+ homeUrl,
522
+ hiddenSwitcher = false
523
+ }) {
515
524
  const { features, path } = useConfig4();
516
525
  const router = useRouter2();
517
526
  const t = useTranslations7();
@@ -556,6 +565,10 @@ function UserMenu({ hiddenSwitcher = false }) {
556
565
  ] })
557
566
  ] }),
558
567
  /* @__PURE__ */ jsx9(DropdownMenuSeparator, {}),
568
+ homeUrl && /* @__PURE__ */ jsx9(DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ jsxs7(Link4, { href: homeUrl, target: "_blank", children: [
569
+ /* @__PURE__ */ jsx9(HouseIcon, {}),
570
+ /* @__PURE__ */ jsx9("span", { children: t("ui.navigation.home") })
571
+ ] }) }),
559
572
  /* @__PURE__ */ jsx9(DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ jsxs7(Link4, { href: path.account.SETTINGS, children: [
560
573
  /* @__PURE__ */ jsx9(SettingsIcon, {}),
561
574
  /* @__PURE__ */ jsx9("span", { children: t("ui.navigation.preferences") })
@@ -639,12 +652,16 @@ function HeaderLeft() {
639
652
  )
640
653
  ] }) });
641
654
  }
642
- function HeaderRight({ sidebar, button }) {
655
+ function HeaderRight({
656
+ sidebar,
657
+ button,
658
+ homeUrl
659
+ }) {
643
660
  const { isMobile } = useLayout();
644
661
  return /* @__PURE__ */ jsxs8("nav", { className: "flex items-center gap-1.5 lg:gap-2.5", children: [
645
662
  button,
646
663
  isMobile && sidebar,
647
- /* @__PURE__ */ jsx10(UserMenu, {})
664
+ /* @__PURE__ */ jsx10(UserMenu, { homeUrl })
648
665
  ] });
649
666
  }
650
667
  function HeaderSidebarMobile({ children }) {
@@ -690,7 +707,7 @@ function Sidebar({ children }) {
690
707
  if (isMobile) {
691
708
  return null;
692
709
  }
693
- return /* @__PURE__ */ jsxs9("aside", { className: "in-data-[sidebar-open=false]:-start-full fixed 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", children: [
710
+ return /* @__PURE__ */ jsxs9("aside", { className: "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", children: [
694
711
  children,
695
712
  /* @__PURE__ */ jsx11("div", {})
696
713
  ] });
@@ -899,10 +916,10 @@ import {
899
916
  SiteHeader as UISiteHeader
900
917
  } from "pelatform-ui/components";
901
918
  import { Button as Button4, Separator } from "pelatform-ui/default";
902
- import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
919
+ import { Fragment as Fragment5, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
903
920
  function SiteHeader({
904
921
  menu,
905
- logo = /* @__PURE__ */ jsx13(LogoWithHref, { href: "/home" })
922
+ logo = /* @__PURE__ */ jsx13(LogoWithHref, { href: "/" })
906
923
  }) {
907
924
  const { path } = useConfig6();
908
925
  const pathname = usePathname4();
@@ -951,8 +968,9 @@ function SiteHeader({
951
968
  }
952
969
  function SiteHeaderSecondary({
953
970
  menu,
954
- logo = /* @__PURE__ */ jsx13(LogoWithHref, { href: "/home" }),
955
- loginLink
971
+ logo = /* @__PURE__ */ jsx13(LogoWithHref, { href: "/" }),
972
+ loginHref,
973
+ loginTarget = "_self"
956
974
  }) {
957
975
  const pathname = usePathname4();
958
976
  const t = useTranslations10();
@@ -965,7 +983,6 @@ function SiteHeaderSecondary({
965
983
  /* @__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: [
966
984
  /* @__PURE__ */ jsx13(ModeSwitcher3, {}),
967
985
  /* @__PURE__ */ jsx13(LanguageSwitcher, {}),
968
- /* @__PURE__ */ jsx13(Separator, { orientation: "vertical", className: "mx-3 h-5 max-lg:hidden" }),
969
986
  /* @__PURE__ */ jsx13(MobileNav, { children: /* @__PURE__ */ jsxs11("div", { className: "flex flex-col space-y-3", children: [
970
987
  menu?.map(
971
988
  (item, navIndex) => item.href || item.children ? /* @__PURE__ */ jsx13(
@@ -980,9 +997,12 @@ function SiteHeaderSecondary({
980
997
  `nav-${navIndex}-${item.href}`
981
998
  ) : null
982
999
  ),
983
- loginLink && /* @__PURE__ */ jsx13("div", { className: "border-t pt-3", children: /* @__PURE__ */ jsx13(Button4, { variant: "secondary", size: "sm", className: "w-full", children: /* @__PURE__ */ jsx13(Link7, { href: loginLink, children: t("ui.navigation.signIn") }) }) })
1000
+ 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") }) }) })
984
1001
  ] }) }),
985
- loginLink && /* @__PURE__ */ jsx13(Button4, { variant: "secondary", size: "sm", className: "hidden md:flex", children: /* @__PURE__ */ jsx13(Link7, { href: loginLink, children: t("ui.navigation.signIn") }) })
1002
+ loginHref && /* @__PURE__ */ jsxs11(Fragment5, { children: [
1003
+ /* @__PURE__ */ jsx13(Separator, { orientation: "vertical", className: "mx-3 h-5 max-md:hidden" }),
1004
+ /* @__PURE__ */ jsx13(Button4, { variant: "secondary", size: "sm", className: "hidden md:flex", children: /* @__PURE__ */ jsx13(Link7, { href: loginHref, target: loginTarget, children: t("ui.navigation.signIn") }) })
1005
+ ] })
986
1006
  ] }) })
987
1007
  ] });
988
1008
  }
@@ -1053,21 +1073,28 @@ function LayoutProvider({
1053
1073
  }
1054
1074
 
1055
1075
  // src/components/layouts/wrapper.tsx
1056
- import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
1076
+ import { Fragment as Fragment6, jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
1057
1077
  function LayoutWrapper({
1058
1078
  children,
1059
1079
  sidebarHeader,
1060
1080
  sidebarMenu,
1061
- logoHeader
1081
+ logoHeader,
1082
+ homeUrl
1062
1083
  }) {
1063
- const sidebarContent = /* @__PURE__ */ jsxs12(Fragment5, { children: [
1084
+ const sidebarContent = /* @__PURE__ */ jsxs12(Fragment6, { children: [
1064
1085
  sidebarHeader,
1065
1086
  /* @__PURE__ */ jsx15(SidebarContent, { children: sidebarMenu })
1066
1087
  ] });
1067
1088
  return /* @__PURE__ */ jsxs12(LayoutProvider, { logoHeader, children: [
1068
1089
  /* @__PURE__ */ jsxs12(Header, { children: [
1069
1090
  /* @__PURE__ */ jsx15(HeaderLeft, {}),
1070
- /* @__PURE__ */ jsx15(HeaderRight, { sidebar: /* @__PURE__ */ jsx15(HeaderSidebarMobile, { children: sidebarContent }) })
1091
+ /* @__PURE__ */ jsx15(
1092
+ HeaderRight,
1093
+ {
1094
+ sidebar: /* @__PURE__ */ jsx15(HeaderSidebarMobile, { children: sidebarContent }),
1095
+ homeUrl
1096
+ }
1097
+ )
1071
1098
  ] }),
1072
1099
  /* @__PURE__ */ jsxs12("div", { className: "flex grow pt-(--header-height-mobile) lg:pt-(--header-height)", children: [
1073
1100
  /* @__PURE__ */ jsx15(Sidebar, { children: sidebarContent }),
@@ -1134,7 +1161,7 @@ function SharedProviders({
1134
1161
  import { useFormState } from "react-hook-form";
1135
1162
  import { cn as cn7 } from "pelatform-ui";
1136
1163
  import { Button as Button5, Card, CardContent, CardFooter, Skeleton as Skeleton4, Spinner } from "pelatform-ui/default";
1137
- import { Fragment as Fragment6, jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
1164
+ import { Fragment as Fragment7, jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
1138
1165
  function CardComponent({
1139
1166
  children,
1140
1167
  className,
@@ -1197,10 +1224,10 @@ function CardHeaderComponent({
1197
1224
  description,
1198
1225
  isPending
1199
1226
  }) {
1200
- return /* @__PURE__ */ jsx18("div", { className: cn7("flex flex-col space-y-2", className, classNames?.header), children: isPending ? /* @__PURE__ */ jsxs14(Fragment6, { children: [
1227
+ return /* @__PURE__ */ jsx18("div", { className: cn7("flex flex-col space-y-2", className, classNames?.header), children: isPending ? /* @__PURE__ */ jsxs14(Fragment7, { children: [
1201
1228
  /* @__PURE__ */ jsx18(Skeleton4, { className: cn7("h-7 w-1/3", classNames?.skeleton) }),
1202
1229
  description && /* @__PURE__ */ jsx18(Skeleton4, { className: cn7("h-5 w-2/3", classNames?.skeleton) })
1203
- ] }) : /* @__PURE__ */ jsxs14(Fragment6, { children: [
1230
+ ] }) : /* @__PURE__ */ jsxs14(Fragment7, { children: [
1204
1231
  /* @__PURE__ */ jsx18("h2", { className: cn7("font-medium text-xl", classNames?.title), children: title }),
1205
1232
  description && /* @__PURE__ */ jsx18("p", { className: cn7("text-muted-foreground text-sm", classNames?.description), children: description })
1206
1233
  ] }) });
@@ -1225,7 +1252,7 @@ function CardFooterComponent({
1225
1252
  className,
1226
1253
  classNames?.footer
1227
1254
  ),
1228
- children: isPending ? /* @__PURE__ */ jsxs14(Fragment6, { children: [
1255
+ children: isPending ? /* @__PURE__ */ jsxs14(Fragment7, { children: [
1229
1256
  instructions && /* @__PURE__ */ jsx18(
1230
1257
  Skeleton4,
1231
1258
  {
@@ -1241,7 +1268,7 @@ function CardFooterComponent({
1241
1268
  className: cn7("h-8 w-20 bg-muted-foreground/10 md:ms-auto", classNames?.skeleton)
1242
1269
  }
1243
1270
  )
1244
- ] }) : /* @__PURE__ */ jsxs14(Fragment6, { children: [
1271
+ ] }) : /* @__PURE__ */ jsxs14(Fragment7, { children: [
1245
1272
  instructions && /* @__PURE__ */ jsx18(
1246
1273
  "div",
1247
1274
  {
@@ -1496,7 +1523,7 @@ function EmptyState({
1496
1523
 
1497
1524
  // src/components/otp-input-group.tsx
1498
1525
  import { InputOTPGroup, InputOTPSeparator, InputOTPSlot } from "pelatform-ui/default";
1499
- import { Fragment as Fragment7, jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
1526
+ import { Fragment as Fragment8, jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
1500
1527
  function OTPInputGroup({ otpSeparators = 0 }) {
1501
1528
  if (otpSeparators === 0) {
1502
1529
  return /* @__PURE__ */ jsxs19(InputOTPGroup, { children: [
@@ -1509,7 +1536,7 @@ function OTPInputGroup({ otpSeparators = 0 }) {
1509
1536
  ] });
1510
1537
  }
1511
1538
  if (otpSeparators === 1) {
1512
- return /* @__PURE__ */ jsxs19(Fragment7, { children: [
1539
+ return /* @__PURE__ */ jsxs19(Fragment8, { children: [
1513
1540
  /* @__PURE__ */ jsxs19(InputOTPGroup, { children: [
1514
1541
  /* @__PURE__ */ jsx23(InputOTPSlot, { index: 0 }),
1515
1542
  /* @__PURE__ */ jsx23(InputOTPSlot, { index: 1 }),
@@ -1523,7 +1550,7 @@ function OTPInputGroup({ otpSeparators = 0 }) {
1523
1550
  ] })
1524
1551
  ] });
1525
1552
  }
1526
- return /* @__PURE__ */ jsxs19(Fragment7, { children: [
1553
+ return /* @__PURE__ */ jsxs19(Fragment8, { children: [
1527
1554
  /* @__PURE__ */ jsxs19(InputOTPGroup, { children: [
1528
1555
  /* @__PURE__ */ jsx23(InputOTPSlot, { index: 0 }),
1529
1556
  /* @__PURE__ */ jsx23(InputOTPSlot, { index: 1 })
@@ -1546,7 +1573,7 @@ import { useState as useState5 } from "react";
1546
1573
  import { EyeIcon, EyeOffIcon } from "lucide-react";
1547
1574
  import { cn as cn12 } from "pelatform-ui";
1548
1575
  import { Button as Button8, Input as Input2 } from "pelatform-ui/default";
1549
- import { Fragment as Fragment8, jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
1576
+ import { Fragment as Fragment9, jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
1550
1577
  function PasswordInput({
1551
1578
  className,
1552
1579
  variant,
@@ -1570,7 +1597,7 @@ function PasswordInput({
1570
1597
  }
1571
1598
  }
1572
1599
  ),
1573
- enableToggle && /* @__PURE__ */ jsxs20(Fragment8, { children: [
1600
+ enableToggle && /* @__PURE__ */ jsxs20(Fragment9, { children: [
1574
1601
  /* @__PURE__ */ jsx24(
1575
1602
  Button8,
1576
1603
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pelatform/starter.shared",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "A part of SaaS starter kit for Pelatform applications.",
5
5
  "author": "Pelatform",
6
6
  "license": "MIT",
@@ -37,13 +37,13 @@
37
37
  "devDependencies": {
38
38
  "@pelatform/starter.config": "0.2.1",
39
39
  "@pelatform/starter.hook": "0.2.1",
40
- "@pelatform/starter.utils": "0.2.3",
40
+ "@pelatform/starter.utils": "0.2.4",
41
41
  "@pelatform/tsconfig": "^0.1.3",
42
42
  "@types/react": "^19.2.7",
43
43
  "lucide-react": "^0.561.0",
44
44
  "next": "^16.0.10",
45
45
  "next-intl": "^4.6.0",
46
- "pelatform-ui": "^1.1.6",
46
+ "pelatform-ui": "^1.1.7",
47
47
  "react": "^19.2.3",
48
48
  "react-hook-form": "^7.68.0",
49
49
  "tsup": "^8.5.1"