@olwiba/ui 0.0.34 → 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 +3 -1
- package/dist/index.js +13 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/app/AppShell.tsx +29 -5
package/dist/index.d.ts
CHANGED
|
@@ -105,6 +105,8 @@ interface AppShellProps {
|
|
|
105
105
|
pageTitle?: string;
|
|
106
106
|
/** Slot rendered at the start of the top header bar, after the sidebar trigger. */
|
|
107
107
|
headerStart?: ReactNode;
|
|
108
|
+
/** Slot rendered at the end of the top header bar. */
|
|
109
|
+
headerEnd?: ReactNode;
|
|
108
110
|
/** Override link rendering for SPA navigation. Defaults to a native <a>. */
|
|
109
111
|
renderLink?: AppShellRenderLink;
|
|
110
112
|
children?: ReactNode;
|
|
@@ -124,7 +126,7 @@ interface AppShellProps {
|
|
|
124
126
|
/** Which side the sidebar sits on. @default "left" */
|
|
125
127
|
side?: 'left' | 'right';
|
|
126
128
|
}
|
|
127
|
-
declare function AppShell({ brand, navItems, action, user, pageTitle, headerStart, 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;
|
|
128
130
|
|
|
129
131
|
interface AuthFormProps {
|
|
130
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,12 +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" }),
|
|
199
204
|
headerStart && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", children: headerStart }),
|
|
200
205
|
/* @__PURE__ */ jsx(Separator, { orientation: "vertical", className: "mx-2 data-[orientation=vertical]:h-4" }),
|
|
201
|
-
/* @__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 })
|
|
202
208
|
] }) });
|
|
203
209
|
}
|
|
204
210
|
var defaultBrand = {
|
|
@@ -217,6 +223,7 @@ function AppShell({
|
|
|
217
223
|
user = defaultUser,
|
|
218
224
|
pageTitle = "Dashboard",
|
|
219
225
|
headerStart,
|
|
226
|
+
headerEnd,
|
|
220
227
|
renderLink = defaultRenderLink,
|
|
221
228
|
collapsible = "icon",
|
|
222
229
|
sidebarPosition = "viewport",
|
|
@@ -244,7 +251,7 @@ function AppShell({
|
|
|
244
251
|
}
|
|
245
252
|
),
|
|
246
253
|
/* @__PURE__ */ jsxs(SidebarInset, { className: isContained ? void 0 : "overflow-y-auto", children: [
|
|
247
|
-
/* @__PURE__ */ jsx(ShellHeader, { pageTitle, headerStart }),
|
|
254
|
+
/* @__PURE__ */ jsx(ShellHeader, { pageTitle, headerStart, headerEnd }),
|
|
248
255
|
children
|
|
249
256
|
] })
|
|
250
257
|
]
|