@olwiba/ui 0.0.33 → 0.0.35
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 +5 -1
- package/dist/index.js +23 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/app/AppShell.tsx +37 -5
- package/src/components/ThemeSwitchMinimal.tsx +6 -1
package/dist/index.d.ts
CHANGED
|
@@ -103,6 +103,10 @@ interface AppShellProps {
|
|
|
103
103
|
user?: AppShellUser;
|
|
104
104
|
/** Text shown in the top header bar */
|
|
105
105
|
pageTitle?: string;
|
|
106
|
+
/** Slot rendered at the start of the top header bar, after the sidebar trigger. */
|
|
107
|
+
headerStart?: ReactNode;
|
|
108
|
+
/** Slot rendered at the end of the top header bar. */
|
|
109
|
+
headerEnd?: ReactNode;
|
|
106
110
|
/** Override link rendering for SPA navigation. Defaults to a native <a>. */
|
|
107
111
|
renderLink?: AppShellRenderLink;
|
|
108
112
|
children?: ReactNode;
|
|
@@ -122,7 +126,7 @@ interface AppShellProps {
|
|
|
122
126
|
/** Which side the sidebar sits on. @default "left" */
|
|
123
127
|
side?: 'left' | 'right';
|
|
124
128
|
}
|
|
125
|
-
declare function AppShell({ brand, navItems, action, user, pageTitle, renderLink, collapsible, sidebarPosition, side, children, }?: AppShellProps): react_jsx_runtime.JSX.Element;
|
|
129
|
+
declare function AppShell({ brand, navItems, action, user, pageTitle, headerStart, headerEnd, renderLink, collapsible, sidebarPosition, side, children, }?: AppShellProps): react_jsx_runtime.JSX.Element;
|
|
126
130
|
|
|
127
131
|
interface AuthFormProps {
|
|
128
132
|
/** Controls form title, fields, and footer text. @default 'signin' */
|
package/dist/index.js
CHANGED
|
@@ -147,12 +147,13 @@ function ShellSidebar({
|
|
|
147
147
|
side,
|
|
148
148
|
sidebarPosition
|
|
149
149
|
}) {
|
|
150
|
+
const fallbackLogo = typeof brand.name === "string" ? brand.name.slice(0, 1).toUpperCase() : null;
|
|
150
151
|
return /* @__PURE__ */ jsxs(Sidebar, { side, collapsible, sidebarPosition, children: [
|
|
151
|
-
/* @__PURE__ */ jsx(SidebarHeader, { children: /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(SidebarMenuButton, { asChild: true, className: "data-[slot=sidebar-menu-button]:!p-1.5", children: renderLink({
|
|
152
|
+
/* @__PURE__ */ jsx(SidebarHeader, { children: /* @__PURE__ */ jsx(SidebarMenu, { children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(SidebarMenuButton, { asChild: true, tooltip: typeof brand.name === "string" ? brand.name : void 0, className: "data-[slot=sidebar-menu-button]:!p-1.5", children: renderLink({
|
|
152
153
|
href: brand.href ?? "#",
|
|
153
154
|
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
154
|
-
brand.logo,
|
|
155
|
-
/* @__PURE__ */ jsx("span", { className: "text-base font-semibold", children: brand.name })
|
|
155
|
+
brand.logo ?? /* @__PURE__ */ jsx("span", { className: "flex size-4 shrink-0 items-center justify-center text-sm font-semibold", children: fallbackLogo }),
|
|
156
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate text-base font-semibold group-data-[collapsible=icon]:hidden", children: brand.name })
|
|
156
157
|
] })
|
|
157
158
|
}) }) }) }) }),
|
|
158
159
|
/* @__PURE__ */ jsx(SidebarContent, { children: /* @__PURE__ */ jsx(SidebarGroup, { children: /* @__PURE__ */ jsxs(SidebarGroupContent, { className: "flex flex-col gap-2", children: [
|
|
@@ -193,11 +194,17 @@ function ShellSidebar({
|
|
|
193
194
|
/* @__PURE__ */ jsx(SidebarFooter, { children: /* @__PURE__ */ jsx(NavUser, { user }) })
|
|
194
195
|
] });
|
|
195
196
|
}
|
|
196
|
-
function ShellHeader({
|
|
197
|
+
function ShellHeader({
|
|
198
|
+
pageTitle,
|
|
199
|
+
headerStart,
|
|
200
|
+
headerEnd
|
|
201
|
+
}) {
|
|
197
202
|
return /* @__PURE__ */ jsx("header", { className: "flex h-12 shrink-0 items-center gap-2 border-b transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6", children: [
|
|
198
203
|
/* @__PURE__ */ jsx(SidebarTrigger, { className: "-ml-1" }),
|
|
204
|
+
headerStart && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", children: headerStart }),
|
|
199
205
|
/* @__PURE__ */ jsx(Separator, { orientation: "vertical", className: "mx-2 data-[orientation=vertical]:h-4" }),
|
|
200
|
-
/* @__PURE__ */ jsx("h1", { className: "text-base font-medium", children: pageTitle })
|
|
206
|
+
/* @__PURE__ */ jsx("h1", { className: "text-base font-medium", children: pageTitle }),
|
|
207
|
+
headerEnd && /* @__PURE__ */ jsx("div", { className: "ml-auto flex items-center gap-1", children: headerEnd })
|
|
201
208
|
] }) });
|
|
202
209
|
}
|
|
203
210
|
var defaultBrand = {
|
|
@@ -215,6 +222,8 @@ function AppShell({
|
|
|
215
222
|
action,
|
|
216
223
|
user = defaultUser,
|
|
217
224
|
pageTitle = "Dashboard",
|
|
225
|
+
headerStart,
|
|
226
|
+
headerEnd,
|
|
218
227
|
renderLink = defaultRenderLink,
|
|
219
228
|
collapsible = "icon",
|
|
220
229
|
sidebarPosition = "viewport",
|
|
@@ -242,7 +251,7 @@ function AppShell({
|
|
|
242
251
|
}
|
|
243
252
|
),
|
|
244
253
|
/* @__PURE__ */ jsxs(SidebarInset, { className: isContained ? void 0 : "overflow-y-auto", children: [
|
|
245
|
-
/* @__PURE__ */ jsx(ShellHeader, { pageTitle }),
|
|
254
|
+
/* @__PURE__ */ jsx(ShellHeader, { pageTitle, headerStart, headerEnd }),
|
|
246
255
|
children
|
|
247
256
|
] })
|
|
248
257
|
]
|
|
@@ -1273,7 +1282,14 @@ function ThemeSwitchMinimal() {
|
|
|
1273
1282
|
localStorage.setItem("theme", next);
|
|
1274
1283
|
document.documentElement.classList.toggle("dark", next === "dark");
|
|
1275
1284
|
};
|
|
1276
|
-
return /* @__PURE__ */ jsx(Button$1, { variant: "ghost", size: "icon", onClick: toggle, className: "size-8", "aria-label": "Toggle theme", children:
|
|
1285
|
+
return /* @__PURE__ */ jsx(Button$1, { variant: "ghost", size: "icon", onClick: toggle, className: "size-8", "aria-label": "Toggle theme", children: /* @__PURE__ */ jsx(
|
|
1286
|
+
"span",
|
|
1287
|
+
{
|
|
1288
|
+
className: "inline-flex size-4 items-center justify-center animate-in fade-in zoom-in-75 spin-in-90 duration-200 motion-reduce:animate-none",
|
|
1289
|
+
children: theme === "dark" ? /* @__PURE__ */ jsx(Sun, { className: "size-4" }) : /* @__PURE__ */ jsx(Moon, { className: "size-4" })
|
|
1290
|
+
},
|
|
1291
|
+
theme
|
|
1292
|
+
) });
|
|
1277
1293
|
}
|
|
1278
1294
|
var defaultRenderLink7 = ({ href, children, className }) => /* @__PURE__ */ jsx("a", { href, className, children });
|
|
1279
1295
|
function Navbar({
|