@svgrid/ui 0.3.3 → 0.4.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.
Files changed (88) hide show
  1. package/LICENSE +0 -25
  2. package/README.md +238 -74
  3. package/index.mjs +591 -591
  4. package/package.json +4 -4
  5. package/recipes/buttons/button-group.svelte +18 -18
  6. package/recipes/buttons/button.svelte +17 -17
  7. package/recipes/buttons/check-box.svelte +10 -10
  8. package/recipes/buttons/radio-group.svelte +18 -18
  9. package/recipes/buttons/rating.svelte +8 -8
  10. package/recipes/buttons/repeat-button.svelte +10 -10
  11. package/recipes/buttons/segmented.svelte +14 -0
  12. package/recipes/buttons/switch-button.svelte +12 -12
  13. package/recipes/buttons/toggle-button.svelte +8 -8
  14. package/recipes/date-time/calendar.svelte +15 -15
  15. package/recipes/date-time/date-range-input.svelte +15 -15
  16. package/recipes/date-time/date-time-picker.svelte +16 -16
  17. package/recipes/date-time/time-picker.svelte +15 -15
  18. package/recipes/feedback/alert.svelte +11 -11
  19. package/recipes/feedback/avatar-group.svelte +11 -11
  20. package/recipes/feedback/avatar.svelte +8 -8
  21. package/recipes/feedback/badge.svelte +8 -8
  22. package/recipes/feedback/carousel.svelte +10 -10
  23. package/recipes/feedback/chip.svelte +10 -10
  24. package/recipes/feedback/empty-state.svelte +8 -8
  25. package/recipes/feedback/loading-overlay.svelte +14 -0
  26. package/recipes/feedback/result.svelte +15 -0
  27. package/recipes/feedback/skeleton.svelte +8 -8
  28. package/recipes/feedback/spinner.svelte +8 -0
  29. package/recipes/feedback/timeline.svelte +10 -10
  30. package/recipes/inputs/color-input.svelte +8 -8
  31. package/recipes/inputs/duration-input.svelte +9 -9
  32. package/recipes/inputs/masked-input.svelte +14 -14
  33. package/recipes/inputs/number-input.svelte +17 -17
  34. package/recipes/inputs/otp-input.svelte +13 -13
  35. package/recipes/inputs/password-input.svelte +14 -14
  36. package/recipes/inputs/phone-input.svelte +8 -8
  37. package/recipes/inputs/tags-input.svelte +8 -8
  38. package/recipes/inputs/text-area.svelte +15 -15
  39. package/recipes/inputs/text-input.svelte +14 -14
  40. package/recipes/layout/accordion.svelte +17 -17
  41. package/recipes/layout/card.svelte +9 -9
  42. package/recipes/layout/collapsible.svelte +13 -0
  43. package/recipes/layout/display.svelte +15 -0
  44. package/recipes/layout/divider.svelte +9 -9
  45. package/recipes/layout/dock-layout.svelte +22 -22
  46. package/recipes/layout/dock-manager.svelte +24 -24
  47. package/recipes/layout/field.svelte +15 -15
  48. package/recipes/layout/file-upload.svelte +16 -16
  49. package/recipes/layout/form.svelte +14 -14
  50. package/recipes/layout/grid-chart.svelte +16 -16
  51. package/recipes/layout/layout.svelte +18 -0
  52. package/recipes/layout/scroll-area.svelte +10 -10
  53. package/recipes/layout/splitter.svelte +13 -13
  54. package/recipes/layout/tabs.svelte +17 -17
  55. package/recipes/layout/typography.svelte +17 -0
  56. package/recipes/navigation/breadcrumb.svelte +12 -12
  57. package/recipes/navigation/command.svelte +12 -12
  58. package/recipes/navigation/nav-pane.svelte +14 -14
  59. package/recipes/navigation/pagination.svelte +13 -13
  60. package/recipes/navigation/rich-text.svelte +8 -8
  61. package/recipes/navigation/stepper.svelte +13 -13
  62. package/recipes/navigation/tour.svelte +14 -14
  63. package/recipes/navigation/tree.svelte +14 -14
  64. package/recipes/overlays/context-menu.svelte +15 -15
  65. package/recipes/overlays/drawer.svelte +13 -13
  66. package/recipes/overlays/hover-card.svelte +15 -0
  67. package/recipes/overlays/menu.svelte +15 -15
  68. package/recipes/overlays/menubar.svelte +27 -0
  69. package/recipes/overlays/modal.svelte +13 -13
  70. package/recipes/overlays/popconfirm.svelte +18 -0
  71. package/recipes/overlays/popover.svelte +9 -9
  72. package/recipes/overlays/toaster.svelte +9 -9
  73. package/recipes/overlays/tooltip.svelte +8 -8
  74. package/recipes/range/circular-progress.svelte +9 -9
  75. package/recipes/range/gauge.svelte +16 -16
  76. package/recipes/range/progress.svelte +10 -10
  77. package/recipes/range/slider.svelte +19 -19
  78. package/recipes/range/sparkline.svelte +9 -9
  79. package/recipes/range/stat.svelte +9 -9
  80. package/recipes/registry.json +237 -4
  81. package/recipes/selection/auto-complete.svelte +10 -10
  82. package/recipes/selection/combo-box.svelte +13 -13
  83. package/recipes/selection/country-input.svelte +8 -8
  84. package/recipes/selection/drop-down-list.svelte +13 -13
  85. package/recipes/selection/grid-select.svelte +17 -17
  86. package/recipes/selection/list-box.svelte +13 -13
  87. package/recipes/selection/multi-select.svelte +13 -13
  88. package/recipes/selection/tree-select.svelte +15 -15
@@ -1,13 +1,13 @@
1
- <script lang="ts">
2
- // SvSplitter - two resizable panes with a draggable separator. Your copy, edit freely. Docs: https://www.svgrid.com/docs/help/ui-components/sv-splitter
3
- import { SvSplitter } from '@svgrid/grid'
4
-
5
- let fraction = $state(0.3)
6
- </script>
7
-
8
- <div style="height: 320px">
9
- <SvSplitter {fraction} onChange={(f) => (fraction = f)} ariaLabel="Sidebar width">
10
- {#snippet start()}<nav style="padding: 12px">Sidebar</nav>{/snippet}
11
- {#snippet end()}<main style="padding: 12px">Content</main>{/snippet}
12
- </SvSplitter>
13
- </div>
1
+ <script lang="ts">
2
+ // SvSplitter - two resizable panes with a draggable separator. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-splitter
3
+ import { SvSplitter } from '@svgrid/grid'
4
+
5
+ let fraction = $state(0.3)
6
+ </script>
7
+
8
+ <div style="height: 320px">
9
+ <SvSplitter {fraction} onChange={(f) => (fraction = f)} ariaLabel="Sidebar width">
10
+ {#snippet start()}<nav style="padding: 12px">Sidebar</nav>{/snippet}
11
+ {#snippet end()}<main style="padding: 12px">Content</main>{/snippet}
12
+ </SvSplitter>
13
+ </div>
@@ -1,17 +1,17 @@
1
- <script lang="ts">
2
- // SvTabs - WAI-ARIA tab strip with roving arrow-key nav. Your copy, edit freely. Docs: https://www.svgrid.com/docs/help/ui-components/sv-tabs
3
- import { SvTabs, type TabItem } from '@svgrid/grid'
4
-
5
- const tabs: TabItem[] = [
6
- { id: 'overview', label: 'Overview' },
7
- { id: 'activity', label: 'Activity' },
8
- { id: 'settings', label: 'Settings' },
9
- ]
10
- let tab = $state('overview')
11
- </script>
12
-
13
- <SvTabs {tabs} value={tab} onChange={(id) => (tab = id)} variant="line">
14
- {#snippet panel(active)}
15
- <p>Content for the {active} tab.</p>
16
- {/snippet}
17
- </SvTabs>
1
+ <script lang="ts">
2
+ // SvTabs - WAI-ARIA tab strip with roving arrow-key nav. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-tabs
3
+ import { SvTabs, type TabItem } from '@svgrid/grid'
4
+
5
+ const tabs: TabItem[] = [
6
+ { id: 'overview', label: 'Overview' },
7
+ { id: 'activity', label: 'Activity' },
8
+ { id: 'settings', label: 'Settings' },
9
+ ]
10
+ let tab = $state('overview')
11
+ </script>
12
+
13
+ <SvTabs {tabs} value={tab} onChange={(id) => (tab = id)} variant="line">
14
+ {#snippet panel(active)}
15
+ <p>Content for the {active} tab.</p>
16
+ {/snippet}
17
+ </SvTabs>
@@ -0,0 +1,17 @@
1
+ <script lang="ts">
2
+ // Typography primitives - SvTitle / SvText / SvAnchor / SvBlockquote / SvMark / SvList.
3
+ // Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-typography
4
+ import { SvTitle, SvText, SvAnchor, SvBlockquote, SvMark, SvList } from '@svgrid/grid'
5
+ </script>
6
+
7
+ <SvTitle order={1}>Dashboard</SvTitle>
8
+ <SvText tone="muted">Last synced 2 minutes ago.</SvText>
9
+
10
+ <SvText>
11
+ A <SvMark>highlighted</SvMark> phrase and an
12
+ <SvAnchor href="https://svelte.dev" external>external link</SvAnchor>.
13
+ </SvText>
14
+
15
+ <SvBlockquote cite="Ada Lovelace">The Analytical Engine weaves algebraic patterns.</SvBlockquote>
16
+
17
+ <SvList type="ordered" items={['Install', 'Import', 'Render']} />
@@ -1,12 +1,12 @@
1
- <script lang="ts">
2
- // SvBreadcrumb - a navigation trail to the current page. Your copy, edit freely. Docs: https://www.svgrid.com/docs/help/ui-components/sv-breadcrumb
3
- import { SvBreadcrumb } from '@svgrid/grid'
4
-
5
- const items = [
6
- { label: 'Home', href: '/' },
7
- { label: 'Orders', href: '/orders' },
8
- { label: '#1024' },
9
- ]
10
- </script>
11
-
12
- <SvBreadcrumb {items} separator="›" maxItems={4} />
1
+ <script lang="ts">
2
+ // SvBreadcrumb - a navigation trail to the current page. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-breadcrumb
3
+ import { SvBreadcrumb } from '@svgrid/grid'
4
+
5
+ const items = [
6
+ { label: 'Home', href: '/' },
7
+ { label: 'Orders', href: '/orders' },
8
+ { label: '#1024' },
9
+ ]
10
+ </script>
11
+
12
+ <SvBreadcrumb {items} separator="›" maxItems={4} />
@@ -1,12 +1,12 @@
1
- <script lang="ts">
2
- // SvCommand - a Cmd+K fuzzy command palette. Your copy, edit freely. Docs: https://www.svgrid.com/docs/help/ui-components/sv-command
3
- import { SvCommand, type CommandItem } from '@svgrid/grid'
4
-
5
- const commands: CommandItem[] = [
6
- { id: 'new', label: 'New record', group: 'Actions', shortcut: '⌘N', onRun: () => console.log('new') },
7
- { id: 'export', label: 'Export CSV', group: 'Actions', onRun: () => console.log('export') },
8
- ]
9
- </script>
10
-
11
- <!-- Cmd/Ctrl+K opens it -->
12
- <SvCommand {commands} onRun={(c) => console.log(c.id)} />
1
+ <script lang="ts">
2
+ // SvCommand - a Cmd+K fuzzy command palette. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-command
3
+ import { SvCommand, type CommandItem } from '@svgrid/grid'
4
+
5
+ const commands: CommandItem[] = [
6
+ { id: 'new', label: 'New record', group: 'Actions', shortcut: '⌘N', onRun: () => console.log('new') },
7
+ { id: 'export', label: 'Export CSV', group: 'Actions', onRun: () => console.log('export') },
8
+ ]
9
+ </script>
10
+
11
+ <!-- Cmd/Ctrl+K opens it -->
12
+ <SvCommand {commands} onRun={(c) => console.log(c.id)} />
@@ -1,14 +1,14 @@
1
- <script lang="ts">
2
- // SvNavPane - an Outlook-style app-shell navigation sidebar. Your copy, edit freely. Docs: https://www.svgrid.com/docs/help/ui-components/sv-nav-pane
3
- import { SvNavPane, type NavSection } from '@svgrid/grid'
4
-
5
- let value = $state<string | null>('inbox')
6
- const sections: NavSection[] = [
7
- { id: 'mail', label: 'Mail', items: [
8
- { id: 'inbox', label: 'Inbox', badge: 12 },
9
- { id: 'sent', label: 'Sent' },
10
- ] },
11
- ]
12
- </script>
13
-
14
- <SvNavPane {sections} bind:value onSelect={(id) => console.log(id)} />
1
+ <script lang="ts">
2
+ // SvNavPane - an Outlook-style app-shell navigation sidebar. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-nav-pane
3
+ import { SvNavPane, type NavSection } from '@svgrid/grid'
4
+
5
+ let value = $state<string | null>('inbox')
6
+ const sections: NavSection[] = [
7
+ { id: 'mail', label: 'Mail', items: [
8
+ { id: 'inbox', label: 'Inbox', badge: 12 },
9
+ { id: 'sent', label: 'Sent' },
10
+ ] },
11
+ ]
12
+ </script>
13
+
14
+ <SvNavPane {sections} bind:value onSelect={(id) => console.log(id)} />
@@ -1,13 +1,13 @@
1
- <script lang="ts">
2
- // SvPagination - a standalone pager with prev/next and page numbers. Your copy, edit freely. Docs: https://www.svgrid.com/docs/help/ui-components/sv-pagination
3
- import { SvPagination } from '@svgrid/grid'
4
-
5
- let page = $state(1)
6
- </script>
7
-
8
- <SvPagination
9
- {page}
10
- pageCount={20}
11
- showFirstLast
12
- onChange={(n) => (page = n)}
13
- />
1
+ <script lang="ts">
2
+ // SvPagination - a standalone pager with prev/next and page numbers. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-pagination
3
+ import { SvPagination } from '@svgrid/grid'
4
+
5
+ let page = $state(1)
6
+ </script>
7
+
8
+ <SvPagination
9
+ {page}
10
+ pageCount={20}
11
+ showFirstLast
12
+ onChange={(n) => (page = n)}
13
+ />
@@ -1,8 +1,8 @@
1
- <script lang="ts">
2
- // SvRichText - a lightweight WYSIWYG editor emitting HTML. Your copy, edit freely. Docs: https://www.svgrid.com/docs/help/ui-components/sv-rich-text
3
- import { SvRichText } from '@svgrid/grid'
4
-
5
- let html = $state('<p>Hello</p>')
6
- </script>
7
-
8
- <SvRichText bind:value={html} placeholder="Write something…" />
1
+ <script lang="ts">
2
+ // SvRichText - a lightweight WYSIWYG editor emitting HTML. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-rich-text
3
+ import { SvRichText } from '@svgrid/grid'
4
+
5
+ let html = $state('<p>Hello</p>')
6
+ </script>
7
+
8
+ <SvRichText bind:value={html} placeholder="Write something…" />
@@ -1,13 +1,13 @@
1
- <script lang="ts">
2
- // SvStepper - a progress stepper for wizards and multi-step forms. Your copy, edit freely. Docs: https://www.svgrid.com/docs/help/ui-components/sv-stepper
3
- import { SvStepper } from '@svgrid/grid'
4
-
5
- let current = $state(0)
6
- const steps = [
7
- { label: 'Cart' },
8
- { label: 'Shipping', description: 'Where to send it' },
9
- { label: 'Payment', optional: true },
10
- ]
11
- </script>
12
-
13
- <SvStepper {steps} {current} onChange={(n) => (current = n)} />
1
+ <script lang="ts">
2
+ // SvStepper - a progress stepper for wizards and multi-step forms. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-stepper
3
+ import { SvStepper } from '@svgrid/grid'
4
+
5
+ let current = $state(0)
6
+ const steps = [
7
+ { label: 'Cart' },
8
+ { label: 'Shipping', description: 'Where to send it' },
9
+ { label: 'Payment', optional: true },
10
+ ]
11
+ </script>
12
+
13
+ <SvStepper {steps} {current} onChange={(n) => (current = n)} />
@@ -1,14 +1,14 @@
1
- <script lang="ts">
2
- // SvTour - a guided, spotlighted product tour overlay. Your copy, edit freely. Docs: https://www.svgrid.com/docs/help/ui-components/sv-tour
3
- import { SvTour, SvButton } from '@svgrid/grid'
4
-
5
- let open = $state(false)
6
- const steps = [
7
- { target: '#new-btn', title: 'Create', content: 'Start a record here.' },
8
- { target: '.grid', title: 'Your data', content: 'It shows up in the grid.' },
9
- ]
10
- </script>
11
-
12
- <SvButton onclick={() => (open = true)}>Take the tour</SvButton>
13
-
14
- <SvTour bind:open {steps} />
1
+ <script lang="ts">
2
+ // SvTour - a guided, spotlighted product tour overlay. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-tour
3
+ import { SvTour, SvButton } from '@svgrid/grid'
4
+
5
+ let open = $state(false)
6
+ const steps = [
7
+ { target: '#new-btn', title: 'Create', content: 'Start a record here.' },
8
+ { target: '.grid', title: 'Your data', content: 'It shows up in the grid.' },
9
+ ]
10
+ </script>
11
+
12
+ <SvButton onclick={() => (open = true)}>Take the tour</SvButton>
13
+
14
+ <SvTour bind:open {steps} />
@@ -1,14 +1,14 @@
1
- <script lang="ts">
2
- // SvTree - a WAI-ARIA tree view with expand/select/checkboxes. Your copy, edit freely. Docs: https://www.svgrid.com/docs/help/ui-components/sv-tree
3
- import { SvTree, type SvTreeNode } from '@svgrid/grid'
4
-
5
- let selected = $state<string | null>(null)
6
- const nodes: SvTreeNode[] = [
7
- { id: 'src', label: 'src', children: [
8
- { id: 'app', label: 'App.svelte' },
9
- { id: 'main', label: 'main.ts' },
10
- ] },
11
- ]
12
- </script>
13
-
14
- <SvTree {nodes} {selected} onSelect={(id) => (selected = id)} />
1
+ <script lang="ts">
2
+ // SvTree - a WAI-ARIA tree view with expand/select/checkboxes. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-tree
3
+ import { SvTree, type SvTreeNode } from '@svgrid/grid'
4
+
5
+ let selected = $state<string | null>(null)
6
+ const nodes: SvTreeNode[] = [
7
+ { id: 'src', label: 'src', children: [
8
+ { id: 'app', label: 'App.svelte' },
9
+ { id: 'main', label: 'main.ts' },
10
+ ] },
11
+ ]
12
+ </script>
13
+
14
+ <SvTree {nodes} {selected} onSelect={(id) => (selected = id)} />
@@ -1,15 +1,15 @@
1
- <script lang="ts">
2
- // SvContextMenu - opens a menu at the pointer on right-click. Your copy, edit freely. Docs: https://www.svgrid.com/docs/help/ui-components/sv-context-menu
3
- import { SvContextMenu, type MenuItem } from '@svgrid/grid'
4
-
5
- const items: MenuItem[] = [
6
- { label: 'Copy', shortcut: 'Ctrl+C', onSelect: () => {} },
7
- { label: 'Duplicate', onSelect: () => {} },
8
- { separator: true },
9
- { label: 'Delete', onSelect: () => {} },
10
- ]
11
- </script>
12
-
13
- <SvContextMenu {items} onSelect={(i) => console.log(i.label)}>
14
- <div class="drop-zone">Right-click me</div>
15
- </SvContextMenu>
1
+ <script lang="ts">
2
+ // SvContextMenu - opens a menu at the pointer on right-click. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-context-menu
3
+ import { SvContextMenu, type MenuItem } from '@svgrid/grid'
4
+
5
+ const items: MenuItem[] = [
6
+ { label: 'Copy', shortcut: 'Ctrl+C', onSelect: () => {} },
7
+ { label: 'Duplicate', onSelect: () => {} },
8
+ { separator: true },
9
+ { label: 'Delete', onSelect: () => {} },
10
+ ]
11
+ </script>
12
+
13
+ <SvContextMenu {items} onSelect={(i) => console.log(i.label)}>
14
+ <div class="drop-zone">Right-click me</div>
15
+ </SvContextMenu>
@@ -1,13 +1,13 @@
1
- <script lang="ts">
2
- // SvDrawer - an edge-anchored side sheet with backdrop. Your copy, edit freely. Docs: https://www.svgrid.com/docs/help/ui-components/sv-drawer
3
- import { SvDrawer, SvButton } from '@svgrid/grid'
4
-
5
- let open = $state(false)
6
- </script>
7
-
8
- <SvButton onclick={() => (open = true)}>Filters</SvButton>
9
-
10
- <SvDrawer bind:open side="right" title="Filters">
11
- <p>Body content.</p>
12
- {#snippet footer()}<SvButton variant="primary" onclick={() => (open = false)}>Apply</SvButton>{/snippet}
13
- </SvDrawer>
1
+ <script lang="ts">
2
+ // SvDrawer - an edge-anchored side sheet with backdrop. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-drawer
3
+ import { SvDrawer, SvButton } from '@svgrid/grid'
4
+
5
+ let open = $state(false)
6
+ </script>
7
+
8
+ <SvButton onclick={() => (open = true)}>Filters</SvButton>
9
+
10
+ <SvDrawer bind:open side="right" title="Filters">
11
+ <p>Body content.</p>
12
+ {#snippet footer()}<SvButton variant="primary" onclick={() => (open = false)}>Apply</SvButton>{/snippet}
13
+ </SvDrawer>
@@ -0,0 +1,15 @@
1
+ <script lang="ts">
2
+ // SvHoverCard - a rich preview card that opens on hover. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-hover-card
3
+ import { SvHoverCard, SvAvatar } from '@svgrid/grid'
4
+ </script>
5
+
6
+ <SvHoverCard>
7
+ {#snippet anchor()}<a href="/u/ada">@ada</a>{/snippet}
8
+ <div style="display:flex; gap:12px; align-items:center">
9
+ <SvAvatar name="Ada Lovelace" />
10
+ <div>
11
+ <strong>Ada Lovelace</strong>
12
+ <div style="color:var(--sg-muted); font-size:12.5px">Analyst - first programmer</div>
13
+ </div>
14
+ </div>
15
+ </SvHoverCard>
@@ -1,15 +1,15 @@
1
- <script lang="ts">
2
- // SvMenu - a trigger-opened dropdown / actions menu. Your copy, edit freely. Docs: https://www.svgrid.com/docs/help/ui-components/sv-menu
3
- import { SvMenu, SvButton, type MenuItem } from '@svgrid/grid'
4
-
5
- const items: MenuItem[] = [
6
- { label: 'New', shortcut: 'Ctrl+N', onSelect: () => {} },
7
- { label: 'Duplicate', onSelect: () => {} },
8
- { separator: true },
9
- { label: 'Delete', onSelect: () => {} },
10
- ]
11
- </script>
12
-
13
- <SvMenu {items} onSelect={(i) => console.log(i.label)}>
14
- {#snippet anchor()}<SvButton>Actions</SvButton>{/snippet}
15
- </SvMenu>
1
+ <script lang="ts">
2
+ // SvMenu - a trigger-opened dropdown / actions menu. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-menu
3
+ import { SvMenu, SvButton, type MenuItem } from '@svgrid/grid'
4
+
5
+ const items: MenuItem[] = [
6
+ { label: 'New', shortcut: 'Ctrl+N', onSelect: () => {} },
7
+ { label: 'Duplicate', onSelect: () => {} },
8
+ { separator: true },
9
+ { label: 'Delete', onSelect: () => {} },
10
+ ]
11
+ </script>
12
+
13
+ <SvMenu {items} onSelect={(i) => console.log(i.label)}>
14
+ {#snippet anchor()}<SvButton>Actions</SvButton>{/snippet}
15
+ </SvMenu>
@@ -0,0 +1,27 @@
1
+ <script lang="ts">
2
+ // SvMenubar - an app-style row of dropdown menus. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-menubar
3
+ import { SvMenubar, type MenubarMenu, type MenuItem } from '@svgrid/grid'
4
+
5
+ const menus: MenubarMenu[] = [
6
+ { label: 'File', items: [
7
+ { label: 'New', shortcut: 'Ctrl+N', onSelect: () => {} },
8
+ { label: 'Open...', shortcut: 'Ctrl+O', onSelect: () => {} },
9
+ { separator: true },
10
+ { label: 'Export', children: [
11
+ { label: 'CSV', onSelect: () => {} },
12
+ { label: 'PDF', onSelect: () => {} },
13
+ ] },
14
+ ] },
15
+ { label: 'Edit', items: [
16
+ { label: 'Undo', shortcut: 'Ctrl+Z', onSelect: () => {} },
17
+ { label: 'Redo', shortcut: 'Ctrl+Y', onSelect: () => {} },
18
+ ] },
19
+ { label: 'View', items: [{ label: 'Zoom in', onSelect: () => {} }, { label: 'Zoom out', onSelect: () => {} }] },
20
+ ]
21
+
22
+ function onSelect(item: MenuItem) {
23
+ console.log('chose', item.label)
24
+ }
25
+ </script>
26
+
27
+ <SvMenubar {menus} {onSelect} />
@@ -1,13 +1,13 @@
1
- <script lang="ts">
2
- // SvModal - an accessible modal dialog with focus trap. Your copy, edit freely. Docs: https://www.svgrid.com/docs/help/ui-components/sv-modal
3
- import { SvModal, SvButton } from '@svgrid/grid'
4
-
5
- let open = $state(false)
6
- </script>
7
-
8
- <SvButton onclick={() => (open = true)}>Edit row</SvButton>
9
-
10
- <SvModal bind:open title="Edit row">
11
- <p>Body content.</p>
12
- {#snippet footer()}<SvButton variant="primary" onclick={() => (open = false)}>Save</SvButton>{/snippet}
13
- </SvModal>
1
+ <script lang="ts">
2
+ // SvModal - an accessible modal dialog with focus trap. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-modal
3
+ import { SvModal, SvButton } from '@svgrid/grid'
4
+
5
+ let open = $state(false)
6
+ </script>
7
+
8
+ <SvButton onclick={() => (open = true)}>Edit row</SvButton>
9
+
10
+ <SvModal bind:open title="Edit row">
11
+ <p>Body content.</p>
12
+ {#snippet footer()}<SvButton variant="primary" onclick={() => (open = false)}>Save</SvButton>{/snippet}
13
+ </SvModal>
@@ -0,0 +1,18 @@
1
+ <script lang="ts">
2
+ // SvPopconfirm - a quick confirm step in a popover. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-popconfirm
3
+ import { SvPopconfirm, SvButton } from '@svgrid/grid'
4
+
5
+ function remove() {
6
+ // ...delete the thing
7
+ }
8
+ </script>
9
+
10
+ <SvPopconfirm
11
+ title="Delete this row?"
12
+ description="This cannot be undone."
13
+ confirmLabel="Delete"
14
+ confirmVariant="danger"
15
+ onConfirm={remove}
16
+ >
17
+ {#snippet anchor()}<SvButton size="sm" variant="danger">Delete</SvButton>{/snippet}
18
+ </SvPopconfirm>
@@ -1,9 +1,9 @@
1
- <script lang="ts">
2
- // SvPopover - a floating panel anchored to a trigger. Your copy, edit freely. Docs: https://www.svgrid.com/docs/help/ui-components/sv-popover
3
- import { SvPopover, SvButton } from '@svgrid/grid'
4
- </script>
5
-
6
- <SvPopover>
7
- {#snippet anchor()}<SvButton>Open</SvButton>{/snippet}
8
- <p>Panel content, portalled out of any scroll container.</p>
9
- </SvPopover>
1
+ <script lang="ts">
2
+ // SvPopover - a floating panel anchored to a trigger. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-popover
3
+ import { SvPopover, SvButton } from '@svgrid/grid'
4
+ </script>
5
+
6
+ <SvPopover>
7
+ {#snippet anchor()}<SvButton>Open</SvButton>{/snippet}
8
+ <p>Panel content, portalled out of any scroll container.</p>
9
+ </SvPopover>
@@ -1,9 +1,9 @@
1
- <script lang="ts">
2
- // SvToaster - host that renders the shared toast queue. Your copy, edit freely. Docs: https://www.svgrid.com/docs/help/ui-components/sv-toaster
3
- import { SvToaster, SvButton, toast } from '@svgrid/grid'
4
- </script>
5
-
6
- <!-- Mount once, near the app root -->
7
- <SvToaster position="bottom-right" />
8
-
9
- <SvButton onclick={() => toast.success('Saved')}>Save</SvButton>
1
+ <script lang="ts">
2
+ // SvToaster - host that renders the shared toast queue. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-toaster
3
+ import { SvToaster, SvButton, toast } from '@svgrid/grid'
4
+ </script>
5
+
6
+ <!-- Mount once, near the app root -->
7
+ <SvToaster position="bottom-right" />
8
+
9
+ <SvButton onclick={() => toast.success('Saved')}>Save</SvButton>
@@ -1,8 +1,8 @@
1
- <script lang="ts">
2
- // SvTooltip - a hover and focus tooltip anchored to its child. Your copy, edit freely. Docs: https://www.svgrid.com/docs/help/ui-components/sv-tooltip
3
- import { SvTooltip, SvButton } from '@svgrid/grid'
4
- </script>
5
-
6
- <SvTooltip text="Delete row">
7
- <SvButton ariaLabel="Delete">🗑</SvButton>
8
- </SvTooltip>
1
+ <script lang="ts">
2
+ // SvTooltip - a hover and focus tooltip anchored to its child. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-tooltip
3
+ import { SvTooltip, SvButton } from '@svgrid/grid'
4
+ </script>
5
+
6
+ <SvTooltip text="Delete row">
7
+ <SvButton ariaLabel="Delete">🗑</SvButton>
8
+ </SvTooltip>
@@ -1,9 +1,9 @@
1
- <script lang="ts">
2
- // SvCircularProgress - ring progress indicator. Your copy, edit freely. Docs: https://www.svgrid.com/docs/help/ui-components/sv-circular-progress
3
- import { SvCircularProgress } from '@svgrid/grid'
4
-
5
- let value = $state(72)
6
- </script>
7
-
8
- <SvCircularProgress {value} size={72} thickness={7} showLabel />
9
- <SvCircularProgress indeterminate size={28} color="accent" />
1
+ <script lang="ts">
2
+ // SvCircularProgress - ring progress indicator. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-circular-progress
3
+ import { SvCircularProgress } from '@svgrid/grid'
4
+
5
+ let value = $state(72)
6
+ </script>
7
+
8
+ <SvCircularProgress {value} size={72} thickness={7} showLabel />
9
+ <SvCircularProgress indeterminate size={28} color="accent" />
@@ -1,16 +1,16 @@
1
- <script lang="ts">
2
- // SvGauge - radial arc gauge for a single KPI. Your copy, edit freely. Docs: https://www.svgrid.com/docs/help/ui-components/sv-gauge
3
- import { SvGauge } from '@svgrid/grid'
4
-
5
- let value = $state(72)
6
- </script>
7
-
8
- <SvGauge
9
- {value}
10
- unit="%"
11
- bands={[
12
- { from: 0, to: 60, color: '#16a34a' },
13
- { from: 60, to: 85, color: '#f59e0b' },
14
- { from: 85, to: 100, color: '#dc2626' },
15
- ]}
16
- />
1
+ <script lang="ts">
2
+ // SvGauge - radial arc gauge for a single KPI. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-gauge
3
+ import { SvGauge } from '@svgrid/grid'
4
+
5
+ let value = $state(72)
6
+ </script>
7
+
8
+ <SvGauge
9
+ {value}
10
+ unit="%"
11
+ bands={[
12
+ { from: 0, to: 60, color: '#16a34a' },
13
+ { from: 60, to: 85, color: '#f59e0b' },
14
+ { from: 85, to: 100, color: '#dc2626' },
15
+ ]}
16
+ />
@@ -1,10 +1,10 @@
1
- <script lang="ts">
2
- // SvProgress - linear determinate/indeterminate progress bar. Your copy, edit freely. Docs: https://www.svgrid.com/docs/help/ui-components/sv-progress
3
- import { SvProgress } from '@svgrid/grid'
4
-
5
- let value = $state(64)
6
- </script>
7
-
8
- <SvProgress {value} showLabel />
9
- <SvProgress value={30} color="warning" striped />
10
- <SvProgress indeterminate color="accent" />
1
+ <script lang="ts">
2
+ // SvProgress - linear determinate/indeterminate progress bar. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-progress
3
+ import { SvProgress } from '@svgrid/grid'
4
+
5
+ let value = $state(64)
6
+ </script>
7
+
8
+ <SvProgress {value} showLabel />
9
+ <SvProgress value={30} color="warning" striped />
10
+ <SvProgress indeterminate color="accent" />