@talelk/newui-templates 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/templates/AppShell.tsx +46 -35
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@talelk/newui-templates",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The three page templates: AppShell, PaneLayout and AuthLayout.",
|
|
6
6
|
"exports": {
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"src"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@talelk/newui-atoms": "1.0.
|
|
18
|
-
"@talelk/newui-molecules": "
|
|
19
|
-
"@talelk/newui-organisms": "
|
|
17
|
+
"@talelk/newui-atoms": "1.0.1",
|
|
18
|
+
"@talelk/newui-molecules": "2.0.0",
|
|
19
|
+
"@talelk/newui-organisms": "2.0.0"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"solid-js": "^1.9.0"
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Button,
|
|
3
|
-
createMediaQuery,
|
|
4
|
-
UIProvider,
|
|
5
|
-
useUI,
|
|
6
|
-
} from '@talelk/newui-atoms'
|
|
1
|
+
import { createMediaQuery, UIProvider, useUI } from '@talelk/newui-atoms'
|
|
7
2
|
import { closeDialog, showDialog } from '@talelk/newui-atoms/internal'
|
|
8
3
|
import { type BreadcrumbItem, Breadcrumbs } from '@talelk/newui-molecules'
|
|
9
4
|
import { AppSidebar, type AppSidebarGroup } from '@talelk/newui-organisms'
|
|
@@ -41,6 +36,10 @@ export interface AppShellProps {
|
|
|
41
36
|
navigation?: AppSidebarGroup[]
|
|
42
37
|
/** Advanced navigation content, rendered inside the same sidebar. */
|
|
43
38
|
navigationContent?: JSX.Element | (() => JSX.Element)
|
|
39
|
+
/** Global utilities pinned above Settings while the sidebar is expanded. */
|
|
40
|
+
utilities?: JSX.Element
|
|
41
|
+
/** Compact icon form of `utilities`, shown while the sidebar is collapsed. */
|
|
42
|
+
utilitiesCollapsed?: JSX.Element
|
|
44
43
|
/** Settings action pinned to the bottom of the sidebar. */
|
|
45
44
|
settings?: JSX.Element
|
|
46
45
|
/** User/account control pinned below settings. */
|
|
@@ -116,6 +115,8 @@ export function AppShell(props: AppShellProps): JSX.Element {
|
|
|
116
115
|
search: props.sidebarSearch,
|
|
117
116
|
groups: props.navigation,
|
|
118
117
|
children: props.navigationContent,
|
|
118
|
+
utilities: props.utilities,
|
|
119
|
+
utilitiesCollapsed: props.utilitiesCollapsed,
|
|
119
120
|
settings: props.settings,
|
|
120
121
|
account: props.account,
|
|
121
122
|
accountCollapsed: props.accountCollapsed,
|
|
@@ -159,7 +160,7 @@ export function AppShell(props: AppShellProps): JSX.Element {
|
|
|
159
160
|
aria-haspopup="dialog"
|
|
160
161
|
aria-expanded={drawerOpen()}
|
|
161
162
|
onClick={openDrawer}
|
|
162
|
-
class="grid size-
|
|
163
|
+
class="grid size-10 shrink-0 place-items-center rounded-3 hover:bg-surface-gray-2 focus-visible:focus-ring"
|
|
163
164
|
>
|
|
164
165
|
<span aria-hidden="true" class="lucide-menu size-4" />
|
|
165
166
|
</button>
|
|
@@ -180,24 +181,26 @@ export function AppShell(props: AppShellProps): JSX.Element {
|
|
|
180
181
|
<a href="#app-shell-content" class="sr-only focus:not-sr-only">
|
|
181
182
|
Skip to workspace
|
|
182
183
|
</a>
|
|
183
|
-
<div class="mx-auto flex w-full max-w-[1440px] flex-col gap-
|
|
184
|
-
<div class="flex flex-
|
|
185
|
-
<
|
|
186
|
-
<
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
<
|
|
190
|
-
|
|
191
|
-
<
|
|
192
|
-
|
|
193
|
-
|
|
184
|
+
<div class="mx-auto flex w-full max-w-[1440px] flex-col gap-4 p-page-gutter-compact pb-8 md:p-page-gutter">
|
|
185
|
+
<div class="flex flex-col gap-2">
|
|
186
|
+
<Show when={props.breadcrumbs}>
|
|
187
|
+
{(items) => <Breadcrumbs items={items()} />}
|
|
188
|
+
</Show>
|
|
189
|
+
<div class="flex flex-wrap items-start justify-between gap-4">
|
|
190
|
+
<div class="min-w-0">
|
|
191
|
+
<h1 class="mt-1 text-heading">{props.title}</h1>
|
|
192
|
+
<Show when={props.description}>
|
|
193
|
+
<p class="mt-1 max-w-2xl text-ink-gray-7">
|
|
194
|
+
{props.description}
|
|
195
|
+
</p>
|
|
196
|
+
</Show>
|
|
197
|
+
</div>
|
|
198
|
+
<Show when={props.actions}>
|
|
199
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
200
|
+
{props.actions}
|
|
201
|
+
</div>
|
|
194
202
|
</Show>
|
|
195
203
|
</div>
|
|
196
|
-
<Show when={props.actions}>
|
|
197
|
-
<div class="flex flex-wrap items-center gap-2">
|
|
198
|
-
{props.actions}
|
|
199
|
-
</div>
|
|
200
|
-
</Show>
|
|
201
204
|
</div>
|
|
202
205
|
{props.children}
|
|
203
206
|
<Show when={props.footer}>{props.footer}</Show>
|
|
@@ -219,21 +222,29 @@ export function AppShell(props: AppShellProps): JSX.Element {
|
|
|
219
222
|
const control = target.closest('a, button, [data-navigates]')
|
|
220
223
|
if (control && !control.closest('[data-keep-drawer]')) closeDrawer()
|
|
221
224
|
}}
|
|
222
|
-
class="open:flex m-0 h-dvh max-h-none w-72 max-w-[calc(100vw-2rem)] flex-col overflow-
|
|
225
|
+
class="open:flex m-0 h-dvh max-h-none w-72 max-w-[calc(100vw-2rem)] flex-col overflow-hidden border-e border-outline-gray-1 bg-surface-gray-1 p-0 text-ink-gray-9 shadow-xl backdrop:bg-black-overlay-200"
|
|
223
226
|
>
|
|
224
|
-
<div class="flex shrink-0 justify-
|
|
225
|
-
<
|
|
226
|
-
|
|
227
|
-
|
|
227
|
+
<div class="flex h-10 shrink-0 items-center justify-between border-b border-outline-gray-1 ps-3 pe-2">
|
|
228
|
+
<span class="text-xs font-medium text-ink-gray-7">Navigation</span>
|
|
229
|
+
<button
|
|
230
|
+
type="button"
|
|
231
|
+
aria-label="Close navigation"
|
|
232
|
+
onClick={closeDrawer}
|
|
233
|
+
class="grid size-10 shrink-0 place-items-center rounded-control text-ink-gray-6 transition-colors hover:bg-surface-gray-2 hover:text-ink-gray-9 focus-visible:focus-ring motion-reduce:transition-none"
|
|
234
|
+
>
|
|
235
|
+
<span aria-hidden="true" class="lucide-x size-4" />
|
|
236
|
+
</button>
|
|
228
237
|
</div>
|
|
229
238
|
<UIProvider dir={ui?.dir()} portalTarget={drawerPortal}>
|
|
230
|
-
<
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
239
|
+
<div class="flex min-h-0 flex-1 flex-col">
|
|
240
|
+
<AppSidebar
|
|
241
|
+
{...sidebarProps()}
|
|
242
|
+
width="100%"
|
|
243
|
+
collapsedWidth="100%"
|
|
244
|
+
collapsed={false}
|
|
245
|
+
collapsible={false}
|
|
246
|
+
/>
|
|
247
|
+
</div>
|
|
237
248
|
</UIProvider>
|
|
238
249
|
</dialog>
|
|
239
250
|
</div>
|