@urbicon-ui/design-content 6.1.8
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/README.md +54 -0
- package/content/auth/components/account-settings/llm.txt +33 -0
- package/content/auth/components/forgot-password-page/llm.txt +25 -0
- package/content/auth/components/invitation-manager/llm.txt +28 -0
- package/content/auth/components/login-page/llm.txt +34 -0
- package/content/auth/components/notification-badge/llm.txt +21 -0
- package/content/auth/components/notification-center/llm.txt +33 -0
- package/content/auth/components/notification-listener/llm.txt +24 -0
- package/content/auth/components/passkey-manager/llm.txt +27 -0
- package/content/auth/components/push-permission-prompt/llm.txt +32 -0
- package/content/auth/components/register-page/llm.txt +35 -0
- package/content/auth/components/reset-password-page/llm.txt +26 -0
- package/content/auth/components/session-manager/llm.txt +32 -0
- package/content/auth/components/two-factor-manager/llm.txt +40 -0
- package/content/auth/components/verify-email-page/llm.txt +25 -0
- package/content/blocks/components/area-chart/llm.txt +46 -0
- package/content/blocks/components/bar-chart/llm.txt +44 -0
- package/content/blocks/components/calendar/llm.txt +105 -0
- package/content/blocks/components/chart-frame/llm.txt +38 -0
- package/content/blocks/components/command-palette/llm.txt +60 -0
- package/content/blocks/components/composition-bar/llm.txt +69 -0
- package/content/blocks/components/currency-input/llm.txt +65 -0
- package/content/blocks/components/date-picker/llm.txt +90 -0
- package/content/blocks/components/donut-chart/llm.txt +45 -0
- package/content/blocks/components/empty-state/llm.txt +43 -0
- package/content/blocks/components/file-upload/llm.txt +76 -0
- package/content/blocks/components/guide/llm.txt +49 -0
- package/content/blocks/components/guide-article/llm.txt +30 -0
- package/content/blocks/components/guide-beacon/llm.txt +38 -0
- package/content/blocks/components/guide-hint/llm.txt +41 -0
- package/content/blocks/components/guide-marker/llm.txt +36 -0
- package/content/blocks/components/guide-mention/llm.txt +31 -0
- package/content/blocks/components/guide-panel/llm.txt +42 -0
- package/content/blocks/components/guide-provider/llm.txt +31 -0
- package/content/blocks/components/line-chart/llm.txt +45 -0
- package/content/blocks/components/locale-switcher/llm.txt +44 -0
- package/content/blocks/components/planner/llm.txt +68 -0
- package/content/blocks/components/sankey/llm.txt +72 -0
- package/content/blocks/components/sidebar-layout/llm.txt +87 -0
- package/content/blocks/components/sparkline/llm.txt +33 -0
- package/content/blocks/components/theme-switcher/llm.txt +40 -0
- package/content/blocks/primitives/accordion/llm.txt +57 -0
- package/content/blocks/primitives/alert/llm.txt +54 -0
- package/content/blocks/primitives/avatar/llm.txt +61 -0
- package/content/blocks/primitives/badge/llm.txt +60 -0
- package/content/blocks/primitives/breadcrumb/llm.txt +47 -0
- package/content/blocks/primitives/button/llm.txt +80 -0
- package/content/blocks/primitives/button-group/llm.txt +65 -0
- package/content/blocks/primitives/card/llm.txt +68 -0
- package/content/blocks/primitives/checkbox/llm.txt +61 -0
- package/content/blocks/primitives/collapsible/llm.txt +66 -0
- package/content/blocks/primitives/combobox/llm.txt +86 -0
- package/content/blocks/primitives/confirm-dialog/llm.txt +47 -0
- package/content/blocks/primitives/dialog/llm.txt +59 -0
- package/content/blocks/primitives/drawer/llm.txt +54 -0
- package/content/blocks/primitives/form-field/llm.txt +43 -0
- package/content/blocks/primitives/input/llm.txt +73 -0
- package/content/blocks/primitives/menu/llm.txt +81 -0
- package/content/blocks/primitives/pagination/llm.txt +68 -0
- package/content/blocks/primitives/popover/llm.txt +72 -0
- package/content/blocks/primitives/progress/llm.txt +55 -0
- package/content/blocks/primitives/radio-group/llm.txt +53 -0
- package/content/blocks/primitives/segment-group/llm.txt +51 -0
- package/content/blocks/primitives/select/llm.txt +130 -0
- package/content/blocks/primitives/separator/llm.txt +45 -0
- package/content/blocks/primitives/sidebar/llm.txt +79 -0
- package/content/blocks/primitives/skeleton/llm.txt +54 -0
- package/content/blocks/primitives/slider/llm.txt +82 -0
- package/content/blocks/primitives/spinner/llm.txt +46 -0
- package/content/blocks/primitives/stepper/llm.txt +60 -0
- package/content/blocks/primitives/tab/llm.txt +72 -0
- package/content/blocks/primitives/textarea/llm.txt +61 -0
- package/content/blocks/primitives/toast/llm.txt +45 -0
- package/content/blocks/primitives/toggle/llm.txt +62 -0
- package/content/blocks/primitives/toolbar/llm.txt +60 -0
- package/content/blocks/primitives/tooltip/llm.txt +54 -0
- package/content/component-catalog.json +5010 -0
- package/content/design-system/patterns/dashboard.md +55 -0
- package/content/design-system/patterns/form-page.md +69 -0
- package/content/design-system/patterns/onboarding-guide.md +50 -0
- package/content/design-system/patterns/planning-board.md +46 -0
- package/content/design-system/patterns/settings-page.md +48 -0
- package/content/design-system/patterns/tab-navigation.md +136 -0
- package/content/design-system/principles.md +260 -0
- package/content/docs/components/api-reference/llm.txt +32 -0
- package/content/docs/components/code-example/llm.txt +44 -0
- package/content/docs/components/code-panel/llm.txt +26 -0
- package/content/docs/components/docs-layout/llm.txt +61 -0
- package/content/docs/components/info-card/llm.txt +31 -0
- package/content/docs/components/playground-configurator/llm.txt +49 -0
- package/content/docs/components/section/llm.txt +46 -0
- package/content/docs/components/table-of-contents/llm.txt +48 -0
- package/content/docs/components/types-reference/llm.txt +38 -0
- package/content/guides/llms-full-template.md +1019 -0
- package/content/icons.json +4834 -0
- package/content/meta.json +5 -0
- package/content/table/table/llm.txt +110 -0
- package/content/verbs/adopt.md +33 -0
- package/content/verbs/audit.md +29 -0
- package/content/verbs/compose.md +38 -0
- package/content/verbs/critique.md +27 -0
- package/content/verbs/fix.md +29 -0
- package/content/verbs/migrate.md +30 -0
- package/content/verbs/onboard.md +33 -0
- package/content/verbs/polish.md +25 -0
- package/content/verbs/redesign.md +29 -0
- package/content/verbs/retheme.md +29 -0
- package/package.json +45 -0
- package/src/content-loader.test.ts +78 -0
- package/src/content-loader.ts +97 -0
- package/src/index.ts +23 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
## Guide
|
|
5
|
+
The guided-tour renderer — the deliberately opt-in, intrusive Guide surface
|
|
6
|
+
(§6, low priority). Renders the active tour the controller drives (`startTour`/`next`/`prev`/
|
|
7
|
+
`skip`/`finish`): a spotlight that dims everything but a cut-out hole over the current step's
|
|
8
|
+
target (the one *subtractive* Guide treatment, D5) plus an anchored bubble with the step
|
|
9
|
+
title, body, dot progress, and Back / Next / Skip controls. Mount once inside `GuideProvider`;
|
|
10
|
+
it renders nothing until a tour starts. Top-layer (native popover), so it clears app stacking
|
|
11
|
+
contexts; it steps aside (pauses) when a foreign modal stacks above it. A step with no `target`
|
|
12
|
+
renders centered over a full scrim. Renders inert without a `GuideProvider`.
|
|
13
|
+
|
|
14
|
+
**Import:** `import { Guide } from '@urbicon-ui/blocks';`
|
|
15
|
+
|
|
16
|
+
### Examples
|
|
17
|
+
```svelte
|
|
18
|
+
<script>
|
|
19
|
+
import { GuideProvider, Guide, GuideController } from '@urbicon-ui/blocks';
|
|
20
|
+
const guide = new GuideController();
|
|
21
|
+
const tour = {
|
|
22
|
+
id: 'welcome',
|
|
23
|
+
steps: [
|
|
24
|
+
{ target: 'save-button', title: 'Save', body: 'Persist your changes here.' },
|
|
25
|
+
{ target: 'filter-control', title: 'Filter', body: 'Narrow the list.', interactive: true }
|
|
26
|
+
]
|
|
27
|
+
};
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<GuideProvider controller={guide}>
|
|
31
|
+
<Guide />
|
|
32
|
+
<button onclick={() => guide.startTour(tour)}>Take the tour</button>
|
|
33
|
+
</GuideProvider>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Api
|
|
37
|
+
| Prop | Type | Required | Default | Description |
|
|
38
|
+
| --- | --- | :---: | --- | --- |
|
|
39
|
+
| arrow | `boolean` | no | true | Render the bubble's pointer arrow on anchored steps. |
|
|
40
|
+
| class | `string` | no | | Additional classes on the bubble. |
|
|
41
|
+
| padding | `number` | no | 8 | Padding in px between the step target and the spotlight hole edge. Also frames the additive highlight ring the engine paints on the target. |
|
|
42
|
+
| placement | `Placement` | no | 'bottom' | Preferred bubble placement when a step omits its own `placement`. |
|
|
43
|
+
| preset | `string` | no | | Apply a named preset registered via `<BlocksProvider presets={{ Guide: {...} }}>`. |
|
|
44
|
+
| radius | `number` | no | | Spotlight hole corner radius in px. When omitted, it follows the target's own border-radius (plus `padding`), clamped to the hole size. Set a number to force it. |
|
|
45
|
+
| slotClasses | `Partial<Record<'container' | 'scrim' | 'bubble' | 'arrow' | 'title' | 'body' | 'progress' | 'dots' | 'dot' | 'dotActive' | 'stepText' | 'footer' | 'spacer' | 'skip' | 'prev' | 'next', string>>` | no | | Per-slot class overrides. |
|
|
46
|
+
| unstyled | `boolean` | no | false | Strip all default styles. |
|
|
47
|
+
|
|
48
|
+
### Slots (slotClasses keys)
|
|
49
|
+
`container`, `scrim`, `bubble`, `arrow`, `title`, `body`, `progress`, `dots`, `dot`, `dotActive`, `stepText`, `footer`, `spacer`, `skip`, `prev`, `next`
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
## GuideArticle
|
|
5
|
+
A single help article inside a `GuidePanel`. Registers itself in the panel's
|
|
6
|
+
list (by `title`) and renders its content only when it is the active article
|
|
7
|
+
(`controller.activeArticle === id`). Use `GuideMention` inside to link back to UI elements.
|
|
8
|
+
|
|
9
|
+
**Import:** `import { GuideArticle } from '@urbicon-ui/blocks';`
|
|
10
|
+
|
|
11
|
+
### Examples
|
|
12
|
+
```svelte
|
|
13
|
+
<GuideArticle id="seats" title="Seats & billing">
|
|
14
|
+
<p>Each <GuideMention for="seat-count">seat</GuideMention> is one team member.</p>
|
|
15
|
+
</GuideArticle>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Api
|
|
19
|
+
| Prop | Type | Required | Default | Description |
|
|
20
|
+
| --- | --- | :---: | --- | --- |
|
|
21
|
+
| id | `string` | yes | | Unique article id — referenced by `GuideMarker` and `openPanel(id)`. |
|
|
22
|
+
| title | `string` | yes | | Title shown in the panel list and header. |
|
|
23
|
+
| children | `Snippet` | no | | Content to render inside the GuideArticle component |
|
|
24
|
+
| class | `string` | no | | Additional classes on the article root. |
|
|
25
|
+
| preset | `string` | no | | Apply a named preset registered via `<BlocksProvider presets={{ GuideArticle: {...} }}>`. |
|
|
26
|
+
| slotClasses | `Partial<Record<'article', string>>` | no | | Per-slot class overrides. |
|
|
27
|
+
| unstyled | `boolean` | no | false | Strip all default styles. |
|
|
28
|
+
|
|
29
|
+
### Slots (slotClasses keys)
|
|
30
|
+
`article`
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
## GuideBeacon
|
|
5
|
+
A waiting, pulsing hotspot that invites the user into an opt-in guided tour (§6.3)
|
|
6
|
+
— the gentlest tour entry point, the opposite of an auto-starting tour. A real `<button>` the
|
|
7
|
+
consumer positions (inline, or absolutely over a feature corner); on activation it starts the
|
|
8
|
+
given `tour` and/or calls `onActivate`. Hides itself once that tour has been seen. The pulse
|
|
9
|
+
halts under `prefers-reduced-motion` (static dot). Renders inert without a `GuideProvider`.
|
|
10
|
+
|
|
11
|
+
**Import:** `import { GuideBeacon } from '@urbicon-ui/blocks';`
|
|
12
|
+
|
|
13
|
+
### Examples
|
|
14
|
+
```svelte
|
|
15
|
+
<span class="relative">
|
|
16
|
+
New feature
|
|
17
|
+
<GuideBeacon class="absolute -right-3 -top-1" {tour} />
|
|
18
|
+
</span>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Variants
|
|
22
|
+
- size: md, sm (default: md)
|
|
23
|
+
|
|
24
|
+
### Api
|
|
25
|
+
| Prop | Type | Required | Default | Description |
|
|
26
|
+
| --- | --- | :---: | --- | --- |
|
|
27
|
+
| class | `string` | no | | Additional classes on the beacon button (use for absolute positioning over a target). |
|
|
28
|
+
| label | `string` | no | i18n `guide.startTour` | Accessible label for the button. |
|
|
29
|
+
| onActivate | `() => void` | no | | Called on activation (click / Enter / Space), after `tour` is started when both are set. |
|
|
30
|
+
| once | `boolean` | no | true | Hide the beacon once its `tour` has been seen (and while that tour is running). Needs `tour`. |
|
|
31
|
+
| preset | `string` | no | | Apply a named preset registered via `<BlocksProvider presets={{ GuideBeacon: {...} }}>`. |
|
|
32
|
+
| size | `GuideBeaconVariants['size']` | no | 'md' | Visual size of the hotspot. |
|
|
33
|
+
| slotClasses | `Partial<Record<'beacon' | 'ping' | 'dot', string>>` | no | | Per-slot class overrides. |
|
|
34
|
+
| tour | `GuideTour` | no | | The tour to start when the beacon is activated. When set, the beacon also hides itself once the tour has been seen (subject to `once`). Omit to drive everything from `onActivate`. |
|
|
35
|
+
| unstyled | `boolean` | no | false | Strip all default styles. |
|
|
36
|
+
|
|
37
|
+
### Slots (slotClasses keys)
|
|
38
|
+
`beacon`, `ping`, `dot`
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
## GuideHint
|
|
5
|
+
A contextual, non-blocking hint anchored to a `data-guide` element via
|
|
6
|
+
`floating.ts` (flip/shift/arrow), rendered in the native popover top-layer. Waits at the
|
|
7
|
+
right element rather than interrupting: shows on mount (or when `open` for `trigger="manual"`),
|
|
8
|
+
persists "seen" so it appears once (`once`), and steps aside while a foreign modal or guided
|
|
9
|
+
tour is open. Dismissable; announces itself via `aria-live`. Renders inert without a provider.
|
|
10
|
+
|
|
11
|
+
**Import:** `import { GuideHint } from '@urbicon-ui/blocks';`
|
|
12
|
+
|
|
13
|
+
### Examples
|
|
14
|
+
```svelte
|
|
15
|
+
<button data-guide="export">Export</button>
|
|
16
|
+
|
|
17
|
+
<GuideHint for="export" title="New: scheduled exports">
|
|
18
|
+
You can now export on a schedule from here.
|
|
19
|
+
</GuideHint>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Api
|
|
23
|
+
| Prop | Type | Required | Default | Description |
|
|
24
|
+
| --- | --- | :---: | --- | --- |
|
|
25
|
+
| for | `string` | yes | | `data-guide` id of the element to anchor to. Required — a hint with no anchor has nothing to point at. |
|
|
26
|
+
| arrow | `boolean` | no | true | Render the pointer arrow. |
|
|
27
|
+
| children | `Snippet` | no | | Content to render inside the GuideHint component |
|
|
28
|
+
| class | `string` | no | | Additional classes on the hint root. |
|
|
29
|
+
| once | `boolean` | no | true | When dismissed, persist a "seen" flag (via the controller's StorageAdapter) so the hint does not reappear on later mounts. Mirrors the tour's "mark seen on end" rule — a hint shown but never dismissed may show again. Set `false` to always show. |
|
|
30
|
+
| onDismiss | `() => void` | no | | Called when the hint is dismissed (close button or Escape). |
|
|
31
|
+
| open | `boolean` | no | false | Manual visibility for `trigger="manual"` (the on-route / on-condition strategy). Ignored for `trigger="mount"`. Re-raising it to `true` after a dismiss re-surfaces the hint (subject to `once`). |
|
|
32
|
+
| placement | `Placement` | no | 'bottom' | Preferred placement relative to the target. |
|
|
33
|
+
| preset | `string` | no | | Apply a named preset registered via `<BlocksProvider presets={{ GuideHint: {...} }}>`. |
|
|
34
|
+
| seenId | `string` | no | the `for` id | Persistence key for the "seen once" state, decoupled from the anchor (this is *not* a DOM id — the popover gets none). Override only to track two hints on one element independently, or to keep a stable key across a renamed anchor. |
|
|
35
|
+
| slotClasses | `Partial<Record<'hint' | 'title' | 'body' | 'dismiss' | 'arrow', string>>` | no | | Per-slot class overrides. |
|
|
36
|
+
| title | `string` | no | | Optional bold heading above the body. |
|
|
37
|
+
| trigger | `'mount' | 'manual'` | no | 'mount' | When the hint may appear: `'mount'` shows it as soon as it mounts; `'manual'` waits for `open` to become `true` (the consumer's route/condition logic). |
|
|
38
|
+
| unstyled | `boolean` | no | false | Strip all default styles. |
|
|
39
|
+
|
|
40
|
+
### Slots (slotClasses keys)
|
|
41
|
+
`hint`, `title`, `body`, `dismiss`, `arrow`
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
## GuideMarker
|
|
5
|
+
Direction A of the bidirectional link (UI → Guide): a discreet "ⓘ" trigger
|
|
6
|
+
that sits on a UI element and opens the `GuidePanel` at the matching article. A real
|
|
7
|
+
`<button>` with `aria-controls`/`aria-expanded` — deliberately *not* a status `Badge`
|
|
8
|
+
(which is a non-interactive label, not a trigger). Renders inert without a `GuideProvider`,
|
|
9
|
+
or when the topic's direction excludes UI→Guide (`'to-ui'`).
|
|
10
|
+
|
|
11
|
+
**Import:** `import { GuideMarker } from '@urbicon-ui/blocks';`
|
|
12
|
+
|
|
13
|
+
### Examples
|
|
14
|
+
```svelte
|
|
15
|
+
<h3>Billing <GuideMarker for="billing" article="billing-help" /></h3>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Variants
|
|
19
|
+
- size: md, sm (default: md)
|
|
20
|
+
|
|
21
|
+
### Api
|
|
22
|
+
| Prop | Type | Required | Default | Description |
|
|
23
|
+
| --- | --- | :---: | --- | --- |
|
|
24
|
+
| article | `string` | no | | Article to open in the panel. Overrides the topic meta's `article`; falls back to `for`. |
|
|
25
|
+
| children | `Snippet` | no | | Custom trigger content, replacing the default "ⓘ" icon. |
|
|
26
|
+
| class | `string` | no | | Additional classes on the marker button. |
|
|
27
|
+
| direction | `GuideDirection` | no | the topic's `direction`, or `'both'` | Override the topic's link direction. The marker is live unless this resolves to `'to-ui'`. |
|
|
28
|
+
| for | `string` | no | | `data-guide` topic id this marker explains. Resolves the article (from topic meta) and the link direction. Optional (unlike `GuideMention.for`) because `article` can stand alone — supply one of the two. With neither, the marker opens the panel index. |
|
|
29
|
+
| label | `string` | no | i18n `guide.infoAbout` (with the topic's label) or `guide.info` | Accessible label for the icon button. |
|
|
30
|
+
| preset | `string` | no | | Apply a named preset registered via `<BlocksProvider presets={{ GuideMarker: {...} }}>`. |
|
|
31
|
+
| size | `GuideMarkerVariants['size']` | no | 'md' | Size variant that controls dimensions and spacing of the GuideMarker |
|
|
32
|
+
| slotClasses | `Partial<Record<'marker' | 'icon', string>>` | no | | Per-slot class overrides. |
|
|
33
|
+
| unstyled | `boolean` | no | false | Strip all default styles. |
|
|
34
|
+
|
|
35
|
+
### Slots (slotClasses keys)
|
|
36
|
+
`marker`, `icon`
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
## GuideMention
|
|
5
|
+
Direction B of the bidirectional link (Guide → UI): an inline reference inside a
|
|
6
|
+
`GuideArticle` that highlights the matching UI element on hover *and* focus (keyboard parity).
|
|
7
|
+
Additive `outline` ring, no scrim, no layout shift (D5); clicking also scrolls the element into
|
|
8
|
+
view (reduced-motion-aware). A real `<button>`; degrades to plain inline text without a
|
|
9
|
+
`GuideProvider` or when the topic's direction excludes Guide→UI (`'to-guide'`).
|
|
10
|
+
|
|
11
|
+
**Import:** `import { GuideMention } from '@urbicon-ui/blocks';`
|
|
12
|
+
|
|
13
|
+
### Examples
|
|
14
|
+
```svelte
|
|
15
|
+
<p>Click the <GuideMention for="save-button">Save button</GuideMention> to persist.</p>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Api
|
|
19
|
+
| Prop | Type | Required | Default | Description |
|
|
20
|
+
| --- | --- | :---: | --- | --- |
|
|
21
|
+
| for | `string` | yes | | `data-guide` id of the UI element to highlight. Required (unlike `GuideMarker.for`): a mention with no target has nothing to highlight. |
|
|
22
|
+
| children | `Snippet` | no | | Content to render inside the GuideMention component |
|
|
23
|
+
| class | `string` | no | | Additional classes on the mention. |
|
|
24
|
+
| direction | `GuideDirection` | no | the topic's `direction`, or `'both'` | Override the topic's link direction. The mention is interactive unless this resolves to `'to-guide'`. |
|
|
25
|
+
| preset | `string` | no | | Apply a named preset registered via `<BlocksProvider presets={{ GuideMention: {...} }}>`. |
|
|
26
|
+
| scroll | `boolean` | no | true | Scroll the target into view on click (reduced-motion-aware). |
|
|
27
|
+
| slotClasses | `Partial<Record<'mention', string>>` | no | | Per-slot class overrides. |
|
|
28
|
+
| unstyled | `boolean` | no | false | Strip all default styles. |
|
|
29
|
+
|
|
30
|
+
### Slots (slotClasses keys)
|
|
31
|
+
`mention`
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
## GuidePanel
|
|
5
|
+
Non-modal help panel for the Guide system. Slides in (default from the right)
|
|
6
|
+
without a backdrop or focus trap, so the app stays interactive behind it — this is what lets
|
|
7
|
+
a `GuideMention` highlight a UI element while the panel is open (D1). Visibility is driven by
|
|
8
|
+
the controller (`openPanel`/`closePanel`), not a local prop. Place `GuideArticle` children
|
|
9
|
+
inside: the panel shows a list of them, or the active article's content with a back button.
|
|
10
|
+
|
|
11
|
+
**Import:** `import { GuidePanel } from '@urbicon-ui/blocks';`
|
|
12
|
+
|
|
13
|
+
### Examples
|
|
14
|
+
```svelte
|
|
15
|
+
<GuidePanel title="Help">
|
|
16
|
+
<GuideArticle id="saving" title="Saving your work">
|
|
17
|
+
<p>Use the Save button to persist your changes.</p>
|
|
18
|
+
</GuideArticle>
|
|
19
|
+
</GuidePanel>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Variants
|
|
23
|
+
- size: lg, md, sm (default: md)
|
|
24
|
+
- placement: left, right (default: right)
|
|
25
|
+
|
|
26
|
+
### Api
|
|
27
|
+
| Prop | Type | Required | Default | Description |
|
|
28
|
+
| --- | --- | :---: | --- | --- |
|
|
29
|
+
| children | `Snippet` | no | | `GuideArticle` children and any custom content. |
|
|
30
|
+
| class | `string` | no | | Additional classes on the panel root. |
|
|
31
|
+
| closeOnEscape | `boolean` | no | true | Close the panel when Escape is pressed. |
|
|
32
|
+
| footer | `Snippet` | no | | Optional footer content. |
|
|
33
|
+
| id | `string` | no | auto-generated (`guide-panel-<id>`) | Stable DOM id for the panel root. `GuideMarker`s reference it via `aria-controls`. |
|
|
34
|
+
| placement | `GuidePanelVariants['placement']` | no | 'right' | Side the panel docks to. |
|
|
35
|
+
| preset | `string` | no | | Apply a named preset registered via `<BlocksProvider presets={{ GuidePanel: {...} }}>`. |
|
|
36
|
+
| size | `GuidePanelVariants['size']` | no | 'md' | Size variant that controls dimensions and spacing of the GuidePanel |
|
|
37
|
+
| slotClasses | `Partial<Record<'panel' | 'header' | 'backButton' | 'title' | 'closeButton' | 'body' | 'list' | 'listItem' | 'footer', string>>` | no | | Per-slot class overrides. |
|
|
38
|
+
| title | `string` | no | i18n `guide.openHelp` | Heading shown when no article is open. |
|
|
39
|
+
| unstyled | `boolean` | no | false | Strip all default styles. |
|
|
40
|
+
|
|
41
|
+
### Slots (slotClasses keys)
|
|
42
|
+
`panel`, `header`, `backButton`, `title`, `closeButton`, `body`, `list`, `listItem`, `footer`
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
## GuideProvider
|
|
5
|
+
Root provider for the Guide help system. Instantiates a `GuideController`
|
|
6
|
+
and shares it via context with all Guide surfaces (Panel, Marker, Mention, Hint, Tour).
|
|
7
|
+
Place once near the app root. The context is optional — a surface used without a provider
|
|
8
|
+
renders inert rather than throwing.
|
|
9
|
+
|
|
10
|
+
**Import:** `import { GuideProvider } from '@urbicon-ui/blocks';`
|
|
11
|
+
|
|
12
|
+
### Examples
|
|
13
|
+
```svelte
|
|
14
|
+
<script>
|
|
15
|
+
import { GuideProvider, GuideController } from '@urbicon-ui/blocks';
|
|
16
|
+
const guide = new GuideController();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<GuideProvider controller={guide}>
|
|
20
|
+
<App />
|
|
21
|
+
</GuideProvider>
|
|
22
|
+
|
|
23
|
+
<button onclick={() => guide.startTour(welcomeTour)}>Take the tour</button>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Api
|
|
27
|
+
| Prop | Type | Required | Default | Description |
|
|
28
|
+
| --- | --- | :---: | --- | --- |
|
|
29
|
+
| children | `Snippet` | yes | | App subtree wired to the Guide context. |
|
|
30
|
+
| controller | `GuideController` | no | | Supply a pre-created `GuideController` for programmatic access from outside the provider (start tours, open the panel, query `hasSeen`). When omitted, the provider creates one internally and shares it via context. When supplied, `storage` is ignored. |
|
|
31
|
+
| storage | `GuideStorageAdapter` | no | localStorage-backed adapter | Persistence adapter for "seen" state (tours/hints). |
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
## LineChart
|
|
5
|
+
Line chart for trends over an ordered category axis. One path
|
|
6
|
+
per series on the design-token palette; zero-dependency SVG, responsive,
|
|
7
|
+
dark-mode aware, with optional points, gridlines, legend, and a screen-
|
|
8
|
+
reader data-table fallback.
|
|
9
|
+
|
|
10
|
+
**Import:** `import { LineChart } from '@urbicon-ui/blocks';`
|
|
11
|
+
|
|
12
|
+
### Examples
|
|
13
|
+
```svelte
|
|
14
|
+
<LineChart
|
|
15
|
+
data={[
|
|
16
|
+
{ label: 'Mon', values: [12] },
|
|
17
|
+
{ label: 'Tue', values: [18] },
|
|
18
|
+
{ label: 'Wed', values: [9] }
|
|
19
|
+
]}
|
|
20
|
+
/>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Api
|
|
24
|
+
| Prop | Type | Required | Default | Description |
|
|
25
|
+
| --- | --- | :---: | --- | --- |
|
|
26
|
+
| data | `CartesianDatum[]` | yes | | Ordered categories with per-series values. |
|
|
27
|
+
| ...HTMLAttributes<HTMLElement> | `HTMLAttributes` | no | | HTML attributes (excluding: 'children') |
|
|
28
|
+
| ariaLabel | `string` | no | | Accessible label; a summary is generated when omitted. |
|
|
29
|
+
| class | `string` | no | | Extra classes merged onto the wrapper. |
|
|
30
|
+
| formatValue | `(value: number) => string` | no | | Format values for axis labels, tooltips, and the data table. |
|
|
31
|
+
| height | `number` | no | 240 | Height property for the LineChart component |
|
|
32
|
+
| includeZero | `boolean` | no | false | Start the value axis at zero instead of framing the data range. |
|
|
33
|
+
| locale | `string` | no | | BCP-47 locale for the default number formatter. |
|
|
34
|
+
| margin | `ChartMargin` | no | | Plot margins; merged over the defaults. |
|
|
35
|
+
| preset | `string` | no | | Apply a named preset registered on `<BlocksProvider>`. |
|
|
36
|
+
| series | `ChartSeries[]` | no | | Series metadata (labels + colors); defaults to one per value column. |
|
|
37
|
+
| showGrid | `boolean` | no | true | Render horizontal gridlines. |
|
|
38
|
+
| showLegend | `boolean` | no | true | Show the series legend (only renders with >1 series). |
|
|
39
|
+
| showPoints | `boolean` | no | true | Render a dot at each data point. |
|
|
40
|
+
| slotClasses | `ChartSlotClasses` | no | | Per-slot class overrides. |
|
|
41
|
+
| unstyled | `boolean` | no | | Remove all default tv classes. |
|
|
42
|
+
| width | `number` | no | | Fixed width in px; omit for responsive width. |
|
|
43
|
+
|
|
44
|
+
Inherited from:
|
|
45
|
+
- Omit<HTMLAttributes<HTMLElement>, 'children'> (omit-pattern)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
## LocaleSwitcher
|
|
5
|
+
Convenience wrapper around Select to switch UI locales.
|
|
6
|
+
Single-select only — locale is always exactly one value. Options, value,
|
|
7
|
+
form integration, multi-select, and null-option are all owned internally
|
|
8
|
+
and intentionally not forwarded to the underlying Select.
|
|
9
|
+
|
|
10
|
+
**Import:** `import { LocaleSwitcher } from '@urbicon-ui/blocks';`
|
|
11
|
+
|
|
12
|
+
### Examples
|
|
13
|
+
```svelte
|
|
14
|
+
<LocaleSwitcher />
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```svelte
|
|
18
|
+
<LocaleSwitcher showFlag variant="filled" size="sm" />
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Api
|
|
22
|
+
| Prop | Type | Required | Default | Description |
|
|
23
|
+
| --- | --- | :---: | --- | --- |
|
|
24
|
+
| locales | `Locale[]` | no | | Restrict the displayed locales. Defaults to all locales registered in i18n. |
|
|
25
|
+
| onLocaleChange | `(locale: Locale) => void` | no | | Called after the locale has been changed successfully. |
|
|
26
|
+
| showFlag | `boolean` | no | true | Show flag emoji alongside locale name. |
|
|
27
|
+
|
|
28
|
+
Inherited from:
|
|
29
|
+
- Omit<
|
|
30
|
+
SelectSingleProps<string>,
|
|
31
|
+
// Owned by LocaleSwitcher's internal options/value pipeline:
|
|
32
|
+
| 'options'
|
|
33
|
+
| 'groups'
|
|
34
|
+
| 'value'
|
|
35
|
+
| 'onValueChange'
|
|
36
|
+
| 'multiple'
|
|
37
|
+
| 'multiPlaceholder'
|
|
38
|
+
| 'nullOption'
|
|
39
|
+
| 'closeOnSelect'
|
|
40
|
+
| 'name'
|
|
41
|
+
| 'label'
|
|
42
|
+
| 'helper'
|
|
43
|
+
| 'error'
|
|
44
|
+
> (omit-pattern)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
## Planner
|
|
5
|
+
Date-indexed planning board — a week, month or custom-range grid
|
|
6
|
+
whose cells hold YOUR domain content (meals, shifts, bookings, content slots)
|
|
7
|
+
via a generic `cell` snippet. Buckets `items` by calendar day, then handles
|
|
8
|
+
navigation, ISO week numbers, keyboard a11y and a responsive column→stack
|
|
9
|
+
layout. For timed appointments, multi-day spans or recurrence use `Calendar`
|
|
10
|
+
instead.
|
|
11
|
+
|
|
12
|
+
**Import:** `import { Planner } from '@urbicon-ui/blocks';`
|
|
13
|
+
|
|
14
|
+
### Examples
|
|
15
|
+
```svelte
|
|
16
|
+
<Planner view="week" items={entries} getDate={(e) => e.date}
|
|
17
|
+
sort={(a, b) => MEAL_ORDER[a.mealType] - MEAL_ORDER[b.mealType]}
|
|
18
|
+
bind:value={referenceDate} onNavigate={(_, range) => loadWeek(range.start)}>
|
|
19
|
+
{#snippet cell({ items, isoDate })}
|
|
20
|
+
{#each items as entry (entry.id)}
|
|
21
|
+
<MealCard {entry} />
|
|
22
|
+
{/each}
|
|
23
|
+
<Button variant="ghost" size="sm" onclick={() => openAdd(isoDate)}>Add meal</Button>
|
|
24
|
+
{/snippet}
|
|
25
|
+
</Planner>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Variants
|
|
29
|
+
- variant: bordered, default, ghost (default: default)
|
|
30
|
+
- size: lg, md, sm (default: md)
|
|
31
|
+
|
|
32
|
+
### Api
|
|
33
|
+
| Prop | Type | Required | Default | Description |
|
|
34
|
+
| --- | --- | :---: | --- | --- |
|
|
35
|
+
| getDate | `(item: T) => Date | string` | yes | | Map an item to its calendar day. Return a `Date`, or a local date string (`'2026-06-16'`) taken verbatim — never UTC-parsed, so a plain date never shifts across timezones. A date-*time* string is bucketed by its written date part too; if your value is a UTC instant whose local day matters (`'…T23:00:00Z'`), return `new Date(value)` so the local timezone applies. Required. |
|
|
36
|
+
| ...HTMLAttributes<HTMLDivElement> | `HTMLAttributes` | no | | HTML attributes (excluding: 'children') |
|
|
37
|
+
| ...PlannerVariants | `VariantProps` | no | | Styling variants from PlannerVariants |
|
|
38
|
+
| animated | `boolean` | no | true | Slide-transition the grid on navigate (respects reduced-motion). |
|
|
39
|
+
| cell | `Snippet<[PlannerCellContext<T>]>` | no | | Render a day's content — the core of the API. Receives bucketed `items: T[]`. Called for **every** day, including empty ones (`items: []`) — unless an `empty` snippet is given, which then handles empty days instead. Put an "add" affordance here to keep it available on empty days. |
|
|
40
|
+
| class | `string` | no | | Extra classes merged onto the root element. |
|
|
41
|
+
| dayHeader | `Snippet<[PlannerDayContext]>` | no | | Customise each weekday/column header. |
|
|
42
|
+
| disabled | `boolean` | no | false | Disable navigation and selection. |
|
|
43
|
+
| empty | `Snippet<[PlannerCellContext<T>]>` | no | | Placeholder rendered **instead of** `cell` for days with no items. Omit it to let `cell` render empty days too. |
|
|
44
|
+
| header | `Snippet<[PlannerHeaderContext]>` | no | | Replace the default toolbar (prev/next/today/title/week). |
|
|
45
|
+
| highlightToday | `boolean` | no | true | Visually mark today's cell. |
|
|
46
|
+
| highlightWeekend | `boolean` | no | false | Tint Saturday/Sunday cells. |
|
|
47
|
+
| items | `T[]` | no | | The items to lay out. Each is bucketed onto a day via . |
|
|
48
|
+
| locale | `string` | no | 'de-DE' | BCP 47 locale for the title and weekday names. |
|
|
49
|
+
| onDateSelect | `(date: Date) => void` | no | | Fires when a day cell is activated (click / Enter / Space). |
|
|
50
|
+
| onNavigate | `(date: Date, range: PlannerRange) => void` | no | | Fires after navigation. Receives the new reference date and visible range — load data here. |
|
|
51
|
+
| preset | `string` | no | | Apply a named preset registered via `<BlocksProvider presets={{ Planner: {...} }}>`. |
|
|
52
|
+
| rangeEnd | `Date` | no | | End of the window for `view="range"`. |
|
|
53
|
+
| rangeStart | `Date` | no | | Start of the window for `view="range"`. |
|
|
54
|
+
| selectedDate | `Date` | no | | The active highlighted day. Supports `bind:selectedDate`. |
|
|
55
|
+
| showWeekNumber | `boolean` | no | false | Show the ISO week-number column on the left. |
|
|
56
|
+
| size | `'sm' | 'md' | 'lg'` | no | 'md' | Density of the grid and header. |
|
|
57
|
+
| slotClasses | `Partial<Record<PlannerSlotName, string>>` | no | | Per-slot class overrides merged with tv() styles. |
|
|
58
|
+
| sort | `(a: T, b: T) => number` | no | | Comparator for items within a day cell (e.g. by meal type or start label). |
|
|
59
|
+
| swipeable | `boolean` | no | true | Enable horizontal swipe-to-navigate on touch. |
|
|
60
|
+
| unstyled | `boolean` | no | false | Remove all default tv() classes — only user-provided classes apply. |
|
|
61
|
+
| value | `Date` | no | today | Reference date the view is anchored on. Supports `bind:value`. |
|
|
62
|
+
| variant | `'default' | 'bordered' | 'ghost'` | no | 'default' | Visual style variant for the Planner component |
|
|
63
|
+
| view | `PlannerView` | no | 'week' | View property for the Planner component |
|
|
64
|
+
| weekStartsOn | `0 | 1 | 2 | 3 | 4 | 5 | 6` | no | 1 | First day of the week (0=Sun … 6=Sat). |
|
|
65
|
+
|
|
66
|
+
Inherited from:
|
|
67
|
+
- Omit<PlannerVariants, 'view'> (omit-pattern)
|
|
68
|
+
- Omit<HTMLAttributes<HTMLDivElement>, 'children'> (omit-pattern)
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
## Sankey
|
|
5
|
+
Flow diagram (Sankey) for visualizing multi-stage data or value
|
|
6
|
+
pipelines. Nodes are split into layers; paths are rendered as cubic Bezier
|
|
7
|
+
curves with value-proportional width. The layout algorithm is embedded (no
|
|
8
|
+
d3-sankey dependency, ISC license attributed).
|
|
9
|
+
|
|
10
|
+
Hovering/focusing a node or path highlights the connected paths and
|
|
11
|
+
neighboring nodes. A ResizeObserver adapts the width responsively. An
|
|
12
|
+
sr-only table provides a screen-reader fallback with source/target/value.
|
|
13
|
+
|
|
14
|
+
**Import:** `import { Sankey } from '@urbicon-ui/blocks';`
|
|
15
|
+
|
|
16
|
+
### Examples
|
|
17
|
+
```svelte
|
|
18
|
+
<Sankey
|
|
19
|
+
nodes={[
|
|
20
|
+
{ id: 'gas', label: 'Gas', intent: 'primary' },
|
|
21
|
+
{ id: 'pot', label: 'Pool', intent: 'neutral' },
|
|
22
|
+
{ id: 'heat', label: 'Heating', intent: 'success' }
|
|
23
|
+
]}
|
|
24
|
+
links={[
|
|
25
|
+
{ source: 'gas', target: 'pot', value: 220609 },
|
|
26
|
+
{ source: 'pot', target: 'heat', value: 220609 }
|
|
27
|
+
]}
|
|
28
|
+
formatValue={(v) => formatCurrency(v)}
|
|
29
|
+
height={400}
|
|
30
|
+
/>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Variants
|
|
34
|
+
- intent: danger, neutral, primary, secondary, success, warning (default: neutral)
|
|
35
|
+
|
|
36
|
+
### Api
|
|
37
|
+
| Prop | Type | Required | Default | Description |
|
|
38
|
+
| --- | --- | :---: | --- | --- |
|
|
39
|
+
| links | `SankeyLink[]` | yes | | Links property for the Sankey component |
|
|
40
|
+
| nodes | `SankeyNode[]` | yes | | Nodes property for the Sankey component |
|
|
41
|
+
| ...HTMLAttributes<HTMLDivElement> | `HTMLAttributes` | no | | HTML attributes (excluding: 'children') |
|
|
42
|
+
| ...SankeyVariants | `VariantProps` | no | | Styling variants from SankeyVariants |
|
|
43
|
+
| class | `string` | no | | Extra classes merged onto the wrapper. |
|
|
44
|
+
| defaultOpacity | `number` | no | 0.45 | Default stroke opacity of paths without hover. |
|
|
45
|
+
| dimmedOpacity | `number` | no | 0.25 | Hover opacity of the non-focused paths. |
|
|
46
|
+
| formatPercent | `(percent: number) => string` | no | | Format function for percentages (tooltip). |
|
|
47
|
+
| formatValue | `(value: number) => string` | no | | Format function for values (tooltip + sr-only table). |
|
|
48
|
+
| height | `number | 'auto'` | no | 400 | Height of the diagram. Accepts a fixed pixel number or `'auto'`. `'auto'` scales with the node count: roughly `nodes.length × (12 + nodePadding)`, clamped to `[280, 800]`. Useful when the number of nodes varies at runtime and a fixed pixel value would be too small or too large. |
|
|
49
|
+
| highlightedOpacity | `number` | no | 0.7 | Stroke opacity of the highlighted paths. |
|
|
50
|
+
| highlightOnHover | `boolean` | no | true | Hover highlight (paths + connected nodes). |
|
|
51
|
+
| intent | `SankeyIntent` | no | 'neutral' | Default intent for nodes without their own `intent`. |
|
|
52
|
+
| iterations | `number` | no | 6 | Number of relaxation iterations in the layout. |
|
|
53
|
+
| linkContent | `Snippet<[link: SankeyLaidOutLinkWithMeta]>` | no | | Custom snippet for path rendering (instead of the default cubic Bezier). |
|
|
54
|
+
| nodeAlign | `'left' | 'right' | 'center' | 'justify'` | no | 'justify' | NodeAlign property for the Sankey component |
|
|
55
|
+
| nodeContent | `Snippet<[node: SankeyLaidOutNodeWithMeta]>` | no | | Custom snippet for node content (inside the SVG, instead of the label). |
|
|
56
|
+
| nodePadding | `number` | no | 16 | Vertical gap between nodes within a layer. |
|
|
57
|
+
| nodeWidth | `number` | no | 24 | Pixel width of a node. |
|
|
58
|
+
| onLinkClick | `(link: SankeyLaidOutLinkWithMeta) => void` | no | | Click callback for a path. |
|
|
59
|
+
| onNodeClick | `(node: SankeyLaidOutNodeWithMeta) => void` | no | | Click callback for a node. |
|
|
60
|
+
| preset | `string` | no | | Preset property for the Sankey component |
|
|
61
|
+
| showValues | `boolean` | no | false | Persistently display values next to node labels (instead of only in the hover tooltip). Useful for print, PDF attachments, static screenshots, or tenant- and client-facing statements where hovering is not possible. Uses `formatValue` for formatting. |
|
|
62
|
+
| slotClasses | `Partial<Record<'wrapper' | 'svg' | 'node' | 'nodeRect' | 'nodeLabel' | 'nodeValue' | 'link' | 'tooltip' | 'tooltipLabel' | 'tooltipDetail', string>>` | no | | Per-slot class overrides. |
|
|
63
|
+
| tooltip | `Snippet<[datum: SankeyLaidOutNodeWithMeta | SankeyLaidOutLinkWithMeta, kind: 'node' | 'link']>` | no | | Custom tooltip content for node or path. |
|
|
64
|
+
| unstyled | `boolean` | no | | Remove default classes. |
|
|
65
|
+
| width | `number` | no | | Optional fixed width. Default: derived from the container via ResizeObserver. Set a value only if you need SSR-stable layouts and are willing to give up responsiveness. |
|
|
66
|
+
|
|
67
|
+
Inherited from:
|
|
68
|
+
- Omit<SankeyVariants, never> (omit-pattern)
|
|
69
|
+
- Omit<HTMLAttributes<HTMLDivElement>, 'children'> (omit-pattern)
|
|
70
|
+
|
|
71
|
+
### Slots (slotClasses keys)
|
|
72
|
+
`wrapper`, `svg`, `node`, `nodeRect`, `nodeLabel`, `nodeValue`, `link`, `tooltip`, `tooltipLabel`, `tooltipDetail`
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
## SidebarLayout
|
|
5
|
+
App-shell layout that wires a `<Sidebar>` to a main content
|
|
6
|
+
region and an optional mobile header. Use this whenever you want a
|
|
7
|
+
permanent sidebar on desktop with a hamburger overlay on mobile — it
|
|
8
|
+
resolves the CSS-variable scoping so the main content offset works without
|
|
9
|
+
boilerplate.
|
|
10
|
+
|
|
11
|
+
The component renders the sidebar internally; consumers configure it via
|
|
12
|
+
`sidebarHeader`, `sidebar`, and `sidebarFooter` snippets and bind `open`
|
|
13
|
+
for the mobile overlay (or for collapsible mode at all viewports).
|
|
14
|
+
|
|
15
|
+
For non-shell sidebars (right-side detail panels, drawers inside a page),
|
|
16
|
+
keep using the `<Sidebar>` primitive directly.
|
|
17
|
+
|
|
18
|
+
**Import:** `import { SidebarLayout } from '@urbicon-ui/blocks';`
|
|
19
|
+
|
|
20
|
+
### Examples
|
|
21
|
+
```svelte
|
|
22
|
+
<script>
|
|
23
|
+
import { SidebarLayout, Button, MenuIcon } from '@urbicon-ui/blocks';
|
|
24
|
+
let sidebarOpen = $state(false);
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<SidebarLayout bind:open={sidebarOpen} sidebarWidth="16rem">
|
|
28
|
+
{#snippet sidebarHeader()}
|
|
29
|
+
<a href="/" class="font-semibold">My App</a>
|
|
30
|
+
{/snippet}
|
|
31
|
+
|
|
32
|
+
{#snippet sidebar()}
|
|
33
|
+
<nav class="flex flex-col gap-1 p-3">
|
|
34
|
+
<a href="/dashboard">Dashboard</a>
|
|
35
|
+
<a href="/settings">Settings</a>
|
|
36
|
+
</nav>
|
|
37
|
+
{/snippet}
|
|
38
|
+
|
|
39
|
+
{#snippet mobileHeader({ openSidebar })}
|
|
40
|
+
<Button variant="ghost" size="sm" onclick={openSidebar} aria-label="Open menu">
|
|
41
|
+
<MenuIcon />
|
|
42
|
+
</Button>
|
|
43
|
+
<span class="font-semibold">My App</span>
|
|
44
|
+
{/snippet}
|
|
45
|
+
|
|
46
|
+
<h1>Page content</h1>
|
|
47
|
+
</SidebarLayout>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```svelte
|
|
51
|
+
<SidebarLayout bind:open={sidebarOpen} mode="collapsible" sidebarWidth="16rem">
|
|
52
|
+
{#snippet sidebarHeader()}<span class="font-semibold">App</span>{/snippet}
|
|
53
|
+
{#snippet sidebar()}<nav class="p-3"><!-- … --></nav>{/snippet}
|
|
54
|
+
|
|
55
|
+
<Button onclick={() => (sidebarOpen = !sidebarOpen)}>Toggle</Button>
|
|
56
|
+
<!-- main content -->
|
|
57
|
+
</SidebarLayout>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Variants
|
|
61
|
+
- contentMaxWidth: 2xl, lg, md, none, sm, xl (default: xl)
|
|
62
|
+
- side: left, right (default: left)
|
|
63
|
+
|
|
64
|
+
### Api
|
|
65
|
+
| Prop | Type | Required | Default | Description |
|
|
66
|
+
| --- | --- | :---: | --- | --- |
|
|
67
|
+
| ...HTMLAttributes<HTMLDivElement> | `HTMLAttributes` | no | | HTML attributes (excluding: 'children') |
|
|
68
|
+
| children | `Snippet` | no | | Page content rendered inside the centered main column. |
|
|
69
|
+
| class | `string` | no | | Additional CSS classes applied to the root wrapper. |
|
|
70
|
+
| closeOnBackdropClick | `boolean` | no | true | Close the mobile sidebar overlay when clicking the backdrop. |
|
|
71
|
+
| closeOnEscape | `boolean` | no | true | Close the mobile sidebar overlay when pressing Escape. |
|
|
72
|
+
| contentMaxWidth | `SidebarLayoutVariants['contentMaxWidth']` | no | 'xl' | Maximum width of the centered content column. |
|
|
73
|
+
| mobileHeader | `Snippet<[MobileHeaderContext]>` | no | | Mobile header bar, hidden on desktop in `responsive` mode. Receives a helper to open the sidebar so a hamburger button needs no extra wiring. If omitted, no mobile header is rendered. |
|
|
74
|
+
| mode | `'responsive' | 'collapsible'` | no | 'responsive' | Sidebar mode. - `responsive` (default): permanent on desktop (≥1024px), slide-in overlay on mobile. - `collapsible`: toggleable at all viewports — width animation on desktop, overlay on mobile. |
|
|
75
|
+
| onOpenChange | `(open: boolean) => void` | no | | Fires when the sidebar open state changes. |
|
|
76
|
+
| open | `boolean` | no | false | Sidebar visibility. In `responsive` mode this only affects the mobile overlay. In `collapsible` mode it controls visibility at all viewports. Supports `bind:open`. |
|
|
77
|
+
| preset | `string` | no | | Apply a named preset registered via `<BlocksProvider presets={{ SidebarLayout: {...} }}>`. Use this to share a branded shell look across the app instead of repeating class overrides. |
|
|
78
|
+
| side | `SidebarLayoutVariants['side']` | no | 'left' | Which edge the sidebar attaches to. |
|
|
79
|
+
| sidebar | `Snippet` | no | | Sidebar main content — typically a `<nav>`. |
|
|
80
|
+
| sidebarFooter | `Snippet` | no | | Sidebar footer (below the scrollable nav). |
|
|
81
|
+
| sidebarHeader | `Snippet` | no | | Sidebar header (above the scrollable nav). |
|
|
82
|
+
| sidebarWidth | `string` | no | '16rem' | Sidebar panel width. Single source of truth — the layout exposes it as `--sidebar-width` (constant) and `--sidebar-effective-width` (animates to `0` when collapsed) on the layout root, so the main content offset stays in sync automatically. |
|
|
83
|
+
| slotClasses | `Partial<Record<SidebarLayoutSlot, string>>` | no | | Per-slot class overrides. `sidebar*` slots are forwarded to the embedded `<Sidebar>` component (mapped to its `slotClasses.panel`/`header`/...). |
|
|
84
|
+
| unstyled | `boolean` | no | | Strip all default styles. Combine with `slotClasses` for a custom layout. |
|
|
85
|
+
|
|
86
|
+
Inherited from:
|
|
87
|
+
- Omit<HTMLAttributes<HTMLDivElement>, 'children'> (omit-pattern)
|