@svgrid/ui 0.3.4 → 2.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.
- package/LICENSE +0 -25
- package/README.md +238 -218
- package/index.mjs +591 -591
- package/package.json +4 -4
- package/recipes/buttons/button-group.svelte +18 -18
- package/recipes/buttons/button.svelte +17 -17
- package/recipes/buttons/check-box.svelte +10 -10
- package/recipes/buttons/radio-group.svelte +18 -18
- package/recipes/buttons/rating.svelte +8 -8
- package/recipes/buttons/repeat-button.svelte +10 -10
- package/recipes/buttons/segmented.svelte +14 -0
- package/recipes/buttons/switch-button.svelte +12 -12
- package/recipes/buttons/toggle-button.svelte +8 -8
- package/recipes/date-time/calendar.svelte +15 -15
- package/recipes/date-time/date-range-input.svelte +15 -15
- package/recipes/date-time/date-time-picker.svelte +16 -16
- package/recipes/date-time/time-picker.svelte +15 -15
- package/recipes/feedback/alert.svelte +11 -11
- package/recipes/feedback/avatar-group.svelte +11 -11
- package/recipes/feedback/avatar.svelte +8 -8
- package/recipes/feedback/badge.svelte +8 -8
- package/recipes/feedback/carousel.svelte +10 -10
- package/recipes/feedback/chip.svelte +10 -10
- package/recipes/feedback/empty-state.svelte +8 -8
- package/recipes/feedback/loading-overlay.svelte +14 -0
- package/recipes/feedback/result.svelte +15 -0
- package/recipes/feedback/skeleton.svelte +8 -8
- package/recipes/feedback/spinner.svelte +8 -0
- package/recipes/feedback/timeline.svelte +10 -10
- package/recipes/inputs/color-input.svelte +8 -8
- package/recipes/inputs/duration-input.svelte +9 -9
- package/recipes/inputs/masked-input.svelte +14 -14
- package/recipes/inputs/number-input.svelte +17 -17
- package/recipes/inputs/otp-input.svelte +13 -13
- package/recipes/inputs/password-input.svelte +14 -14
- package/recipes/inputs/phone-input.svelte +8 -8
- package/recipes/inputs/tags-input.svelte +8 -8
- package/recipes/inputs/text-area.svelte +15 -15
- package/recipes/inputs/text-input.svelte +14 -14
- package/recipes/layout/accordion.svelte +17 -17
- package/recipes/layout/card.svelte +9 -9
- package/recipes/layout/collapsible.svelte +13 -0
- package/recipes/layout/display.svelte +15 -0
- package/recipes/layout/divider.svelte +9 -9
- package/recipes/layout/dock-layout.svelte +22 -22
- package/recipes/layout/dock-manager.svelte +24 -24
- package/recipes/layout/field.svelte +15 -15
- package/recipes/layout/file-upload.svelte +16 -16
- package/recipes/layout/form.svelte +14 -14
- package/recipes/layout/grid-chart.svelte +16 -16
- package/recipes/layout/layout.svelte +18 -0
- package/recipes/layout/scroll-area.svelte +10 -10
- package/recipes/layout/splitter.svelte +13 -13
- package/recipes/layout/tabs.svelte +17 -17
- package/recipes/layout/typography.svelte +17 -0
- package/recipes/navigation/breadcrumb.svelte +12 -12
- package/recipes/navigation/command.svelte +12 -12
- package/recipes/navigation/nav-pane.svelte +14 -14
- package/recipes/navigation/pagination.svelte +13 -13
- package/recipes/navigation/rich-text.svelte +8 -8
- package/recipes/navigation/stepper.svelte +13 -13
- package/recipes/navigation/tour.svelte +14 -14
- package/recipes/navigation/tree.svelte +14 -14
- package/recipes/overlays/context-menu.svelte +15 -15
- package/recipes/overlays/drawer.svelte +13 -13
- package/recipes/overlays/hover-card.svelte +15 -0
- package/recipes/overlays/menu.svelte +15 -15
- package/recipes/overlays/menubar.svelte +27 -0
- package/recipes/overlays/modal.svelte +13 -13
- package/recipes/overlays/popconfirm.svelte +18 -0
- package/recipes/overlays/popover.svelte +9 -9
- package/recipes/overlays/toaster.svelte +9 -9
- package/recipes/overlays/tooltip.svelte +8 -8
- package/recipes/range/circular-progress.svelte +9 -9
- package/recipes/range/gauge.svelte +16 -16
- package/recipes/range/progress.svelte +10 -10
- package/recipes/range/slider.svelte +19 -19
- package/recipes/range/sparkline.svelte +9 -9
- package/recipes/range/stat.svelte +9 -9
- package/recipes/registry.json +237 -4
- package/recipes/selection/auto-complete.svelte +10 -10
- package/recipes/selection/combo-box.svelte +13 -13
- package/recipes/selection/country-input.svelte +8 -8
- package/recipes/selection/drop-down-list.svelte +13 -13
- package/recipes/selection/grid-select.svelte +17 -17
- package/recipes/selection/list-box.svelte +13 -13
- package/recipes/selection/multi-select.svelte +13 -13
- package/recipes/selection/tree-select.svelte +15 -15
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// SvColorInput - color swatch with a hex field, native picker and presets. Your copy, edit freely. Docs: https://
|
|
3
|
-
import { SvColorInput } from '@svgrid/grid'
|
|
4
|
-
|
|
5
|
-
let color = $state('#3b82f6')
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<SvColorInput label="Brand color" value={color} onChange={(hex) => (color = hex)} />
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// SvColorInput - color swatch with a hex field, native picker and presets. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-color-input
|
|
3
|
+
import { SvColorInput } from '@svgrid/grid'
|
|
4
|
+
|
|
5
|
+
let color = $state('#3b82f6')
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<SvColorInput label="Brand color" value={color} onChange={(hex) => (color = hex)} />
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// SvDurationInput - minute-valued field that accepts 1h 30m, 1:30 or 90. Your copy, edit freely. Docs: https://
|
|
3
|
-
import { SvDurationInput } from '@svgrid/grid'
|
|
4
|
-
|
|
5
|
-
let minutes = $state<number | null>(90)
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<SvDurationInput label="Task estimate" bind:value={minutes} style="units" />
|
|
9
|
-
<p>Stored as {minutes} minutes</p>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// SvDurationInput - minute-valued field that accepts 1h 30m, 1:30 or 90. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-duration-input
|
|
3
|
+
import { SvDurationInput } from '@svgrid/grid'
|
|
4
|
+
|
|
5
|
+
let minutes = $state<number | null>(90)
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<SvDurationInput label="Task estimate" bind:value={minutes} style="units" />
|
|
9
|
+
<p>Stored as {minutes} minutes</p>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// SvMaskedInput - pattern-masked text that formats as you type. Your copy, edit freely. Docs: https://
|
|
3
|
-
import { SvMaskedInput } from '@svgrid/grid'
|
|
4
|
-
|
|
5
|
-
let card = $state('')
|
|
6
|
-
let complete = $state(false)
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<SvMaskedInput
|
|
10
|
-
label="Card number"
|
|
11
|
-
mask="#### #### #### ####"
|
|
12
|
-
value={card}
|
|
13
|
-
onChange={(masked, raw, done) => { card = masked; complete = done }}
|
|
14
|
-
/>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// SvMaskedInput - pattern-masked text that formats as you type. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-masked-input
|
|
3
|
+
import { SvMaskedInput } from '@svgrid/grid'
|
|
4
|
+
|
|
5
|
+
let card = $state('')
|
|
6
|
+
let complete = $state(false)
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<SvMaskedInput
|
|
10
|
+
label="Card number"
|
|
11
|
+
mask="#### #### #### ####"
|
|
12
|
+
value={card}
|
|
13
|
+
onChange={(masked, raw, done) => { card = masked; complete = done }}
|
|
14
|
+
/>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// SvNumberInput - numeric field with min/max/step, grouping and prefix/suffix. Your copy, edit freely. Docs: https://
|
|
3
|
-
import { SvNumberInput } from '@svgrid/grid'
|
|
4
|
-
|
|
5
|
-
let price = $state<number | null>(1299.5)
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<SvNumberInput
|
|
9
|
-
label="Price"
|
|
10
|
-
value={price}
|
|
11
|
-
onChange={(v) => (price = v)}
|
|
12
|
-
min={0}
|
|
13
|
-
step={0.5}
|
|
14
|
-
precision={2}
|
|
15
|
-
grouping
|
|
16
|
-
prefix="$"
|
|
17
|
-
/>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// SvNumberInput - numeric field with min/max/step, grouping and prefix/suffix. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-number-input
|
|
3
|
+
import { SvNumberInput } from '@svgrid/grid'
|
|
4
|
+
|
|
5
|
+
let price = $state<number | null>(1299.5)
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<SvNumberInput
|
|
9
|
+
label="Price"
|
|
10
|
+
value={price}
|
|
11
|
+
onChange={(v) => (price = v)}
|
|
12
|
+
min={0}
|
|
13
|
+
step={0.5}
|
|
14
|
+
precision={2}
|
|
15
|
+
grouping
|
|
16
|
+
prefix="$"
|
|
17
|
+
/>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// SvOtpInput - segmented one-time-code / PIN entry that auto-advances. Your copy, edit freely. Docs: https://
|
|
3
|
-
import { SvOtpInput } from '@svgrid/grid'
|
|
4
|
-
|
|
5
|
-
let code = $state('')
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<SvOtpInput
|
|
9
|
-
label="Verification code"
|
|
10
|
-
length={6}
|
|
11
|
-
bind:value={code}
|
|
12
|
-
onComplete={(v) => console.log('verify', v)}
|
|
13
|
-
/>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// SvOtpInput - segmented one-time-code / PIN entry that auto-advances. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-otp-input
|
|
3
|
+
import { SvOtpInput } from '@svgrid/grid'
|
|
4
|
+
|
|
5
|
+
let code = $state('')
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<SvOtpInput
|
|
9
|
+
label="Verification code"
|
|
10
|
+
length={6}
|
|
11
|
+
bind:value={code}
|
|
12
|
+
onComplete={(v) => console.log('verify', v)}
|
|
13
|
+
/>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// SvPasswordInput - password field with a reveal toggle and strength meter. Your copy, edit freely. Docs: https://
|
|
3
|
-
import { SvPasswordInput } from '@svgrid/grid'
|
|
4
|
-
|
|
5
|
-
let pw = $state('')
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<SvPasswordInput
|
|
9
|
-
label="Password"
|
|
10
|
-
value={pw}
|
|
11
|
-
onChange={(v) => (pw = v)}
|
|
12
|
-
showStrength
|
|
13
|
-
autocomplete="new-password"
|
|
14
|
-
/>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// SvPasswordInput - password field with a reveal toggle and strength meter. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-password-input
|
|
3
|
+
import { SvPasswordInput } from '@svgrid/grid'
|
|
4
|
+
|
|
5
|
+
let pw = $state('')
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<SvPasswordInput
|
|
9
|
+
label="Password"
|
|
10
|
+
value={pw}
|
|
11
|
+
onChange={(v) => (pw = v)}
|
|
12
|
+
showStrength
|
|
13
|
+
autocomplete="new-password"
|
|
14
|
+
/>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// SvPhoneInput - country dial-code selector plus a national number field. Your copy, edit freely. Docs: https://
|
|
3
|
-
import { SvPhoneInput } from '@svgrid/grid'
|
|
4
|
-
|
|
5
|
-
let phone = $state('')
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<SvPhoneInput label="Mobile" country="US" value={phone} onChange={(v) => (phone = v)} />
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// SvPhoneInput - country dial-code selector plus a national number field. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-phone-input
|
|
3
|
+
import { SvPhoneInput } from '@svgrid/grid'
|
|
4
|
+
|
|
5
|
+
let phone = $state('')
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<SvPhoneInput label="Mobile" country="US" value={phone} onChange={(v) => (phone = v)} />
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// SvTagsInput - editable token / chips input backed by a string[]. Your copy, edit freely. Docs: https://
|
|
3
|
-
import { SvTagsInput } from '@svgrid/grid'
|
|
4
|
-
|
|
5
|
-
let skills = $state(['Svelte', 'TypeScript'])
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<SvTagsInput label="Skills" value={skills} onChange={(t) => (skills = t)} placeholder="Add a skill" />
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// SvTagsInput - editable token / chips input backed by a string[]. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-tags-input
|
|
3
|
+
import { SvTagsInput } from '@svgrid/grid'
|
|
4
|
+
|
|
5
|
+
let skills = $state(['Svelte', 'TypeScript'])
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<SvTagsInput label="Skills" value={skills} onChange={(t) => (skills = t)} placeholder="Add a skill" />
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// SvTextArea - multi-line text field with auto-grow and a character counter. Your copy, edit freely. Docs: https://
|
|
3
|
-
import { SvTextArea } from '@svgrid/grid'
|
|
4
|
-
|
|
5
|
-
let notes = $state('')
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<SvTextArea
|
|
9
|
-
label="Notes"
|
|
10
|
-
placeholder="Anything the team should know…"
|
|
11
|
-
bind:value={notes}
|
|
12
|
-
autoGrow
|
|
13
|
-
maxlength={280}
|
|
14
|
-
showCount
|
|
15
|
-
/>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// SvTextArea - multi-line text field with auto-grow and a character counter. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-text-area
|
|
3
|
+
import { SvTextArea } from '@svgrid/grid'
|
|
4
|
+
|
|
5
|
+
let notes = $state('')
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<SvTextArea
|
|
9
|
+
label="Notes"
|
|
10
|
+
placeholder="Anything the team should know…"
|
|
11
|
+
bind:value={notes}
|
|
12
|
+
autoGrow
|
|
13
|
+
maxlength={280}
|
|
14
|
+
showCount
|
|
15
|
+
/>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// SvTextInput - single-line text field for the whole editor kit. Your copy, edit freely. Docs: https://
|
|
3
|
-
import { SvTextInput } from '@svgrid/grid'
|
|
4
|
-
|
|
5
|
-
let email = $state('')
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<SvTextInput
|
|
9
|
-
label="Work email"
|
|
10
|
-
type="email"
|
|
11
|
-
placeholder="you@company.com"
|
|
12
|
-
bind:value={email}
|
|
13
|
-
clearable
|
|
14
|
-
/>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// SvTextInput - single-line text field for the whole editor kit. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-text-input
|
|
3
|
+
import { SvTextInput } from '@svgrid/grid'
|
|
4
|
+
|
|
5
|
+
let email = $state('')
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<SvTextInput
|
|
9
|
+
label="Work email"
|
|
10
|
+
type="email"
|
|
11
|
+
placeholder="you@company.com"
|
|
12
|
+
bind:value={email}
|
|
13
|
+
clearable
|
|
14
|
+
/>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// SvAccordion - collapsible WAI-ARIA sections, single or multi expand. Your copy, edit freely. Docs: https://
|
|
3
|
-
import { SvAccordion, type AccordionItem } from '@svgrid/grid'
|
|
4
|
-
|
|
5
|
-
const items: AccordionItem[] = [
|
|
6
|
-
{ id: 'ship', label: 'Shipping' },
|
|
7
|
-
{ id: 'pay', label: 'Payment' },
|
|
8
|
-
{ id: 'gift', label: 'Gift options' },
|
|
9
|
-
]
|
|
10
|
-
let expanded = $state(['ship'])
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<SvAccordion {items} {expanded} onChange={(ids) => (expanded = ids)}>
|
|
14
|
-
{#snippet panel(item)}
|
|
15
|
-
<p>Details for {item.label}.</p>
|
|
16
|
-
{/snippet}
|
|
17
|
-
</SvAccordion>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// SvAccordion - collapsible WAI-ARIA sections, single or multi expand. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-accordion
|
|
3
|
+
import { SvAccordion, type AccordionItem } from '@svgrid/grid'
|
|
4
|
+
|
|
5
|
+
const items: AccordionItem[] = [
|
|
6
|
+
{ id: 'ship', label: 'Shipping' },
|
|
7
|
+
{ id: 'pay', label: 'Payment' },
|
|
8
|
+
{ id: 'gift', label: 'Gift options' },
|
|
9
|
+
]
|
|
10
|
+
let expanded = $state(['ship'])
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<SvAccordion {items} {expanded} onChange={(ids) => (expanded = ids)}>
|
|
14
|
+
{#snippet panel(item)}
|
|
15
|
+
<p>Details for {item.label}.</p>
|
|
16
|
+
{/snippet}
|
|
17
|
+
</SvAccordion>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// SvCard - themed surface with header, body and footer. Your copy, edit freely. Docs: https://
|
|
3
|
-
import { SvCard } from '@svgrid/grid'
|
|
4
|
-
</script>
|
|
5
|
-
|
|
6
|
-
<SvCard title="Revenue" subtitle="Last 30 days">
|
|
7
|
-
<p>$42,180</p>
|
|
8
|
-
{#snippet footer()}<a href="/reports">View report</a>{/snippet}
|
|
9
|
-
</SvCard>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// SvCard - themed surface with header, body and footer. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-card
|
|
3
|
+
import { SvCard } from '@svgrid/grid'
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<SvCard title="Revenue" subtitle="Last 30 days">
|
|
7
|
+
<p>$42,180</p>
|
|
8
|
+
{#snippet footer()}<a href="/reports">View report</a>{/snippet}
|
|
9
|
+
</SvCard>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// SvCollapsible - a single animated show/hide section. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-collapsible
|
|
3
|
+
import { SvCollapsible } from '@svgrid/grid'
|
|
4
|
+
let advanced = $state(false)
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<SvCollapsible title="Shipping details" open>
|
|
8
|
+
<p>Standard delivery, 3-5 business days. Tracking sent on dispatch.</p>
|
|
9
|
+
</SvCollapsible>
|
|
10
|
+
|
|
11
|
+
<SvCollapsible title="Advanced options" bind:open={advanced}>
|
|
12
|
+
<label><input type="checkbox" /> Signature on delivery</label>
|
|
13
|
+
</SvCollapsible>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// Display primitives - SvKbd / SvCode / SvAspectRatio / SvVisuallyHidden.
|
|
3
|
+
// Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-display-primitives
|
|
4
|
+
import { SvKbd, SvCode, SvAspectRatio, SvVisuallyHidden } from '@svgrid/grid'
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<p>Open the palette with <SvKbd keys={['Ctrl', 'K']} />.</p>
|
|
8
|
+
|
|
9
|
+
<p>Install with <SvCode>npm i @svgrid/grid</SvCode>.</p>
|
|
10
|
+
|
|
11
|
+
<SvAspectRatio ratio={16 / 9}>
|
|
12
|
+
<img src="/cover.jpg" alt="" />
|
|
13
|
+
</SvAspectRatio>
|
|
14
|
+
|
|
15
|
+
<button>★<SvVisuallyHidden>Add to favourites</SvVisuallyHidden></button>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// SvDivider - themed separator line, horizontal or vertical, with optional label. Your copy, edit freely. Docs: https://
|
|
3
|
-
import { SvDivider } from '@svgrid/grid'
|
|
4
|
-
</script>
|
|
5
|
-
|
|
6
|
-
<p>Above</p>
|
|
7
|
-
<SvDivider />
|
|
8
|
-
<SvDivider label="OR" />
|
|
9
|
-
<p>Below</p>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// SvDivider - themed separator line, horizontal or vertical, with optional label. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-divider
|
|
3
|
+
import { SvDivider } from '@svgrid/grid'
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<p>Above</p>
|
|
7
|
+
<SvDivider />
|
|
8
|
+
<SvDivider label="OR" />
|
|
9
|
+
<p>Below</p>
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// SvDockLayout - nested resizable splits + tabbed leaves with drag-to-dock. Your copy, edit freely. Docs: https://
|
|
3
|
-
import { SvDockLayout, dockGroup, dockTabs, dockPane, type DockNode } from '@svgrid/grid'
|
|
4
|
-
|
|
5
|
-
let layout = $state<DockNode>(
|
|
6
|
-
dockGroup('row', [
|
|
7
|
-
dockTabs([dockPane('explorer', 'Explorer')]),
|
|
8
|
-
dockGroup('column', [
|
|
9
|
-
dockTabs([dockPane('editor', 'index.ts'), dockPane('readme', 'README.md')]),
|
|
10
|
-
dockTabs([dockPane('terminal', 'Terminal')]),
|
|
11
|
-
], [0.7, 0.3]),
|
|
12
|
-
], [0.25, 0.75]),
|
|
13
|
-
)
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<div style="height: 480px">
|
|
17
|
-
<SvDockLayout bind:layout>
|
|
18
|
-
{#snippet pane(p)}
|
|
19
|
-
<div style="padding: 12px">{p.title}</div>
|
|
20
|
-
{/snippet}
|
|
21
|
-
</SvDockLayout>
|
|
22
|
-
</div>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// SvDockLayout - nested resizable splits + tabbed leaves with drag-to-dock. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-dock-layout
|
|
3
|
+
import { SvDockLayout, dockGroup, dockTabs, dockPane, type DockNode } from '@svgrid/grid'
|
|
4
|
+
|
|
5
|
+
let layout = $state<DockNode>(
|
|
6
|
+
dockGroup('row', [
|
|
7
|
+
dockTabs([dockPane('explorer', 'Explorer')]),
|
|
8
|
+
dockGroup('column', [
|
|
9
|
+
dockTabs([dockPane('editor', 'index.ts'), dockPane('readme', 'README.md')]),
|
|
10
|
+
dockTabs([dockPane('terminal', 'Terminal')]),
|
|
11
|
+
], [0.7, 0.3]),
|
|
12
|
+
], [0.25, 0.75]),
|
|
13
|
+
)
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<div style="height: 480px">
|
|
17
|
+
<SvDockLayout bind:layout>
|
|
18
|
+
{#snippet pane(p)}
|
|
19
|
+
<div style="padding: 12px">{p.title}</div>
|
|
20
|
+
{/snippet}
|
|
21
|
+
</SvDockLayout>
|
|
22
|
+
</div>
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// SvDockManager - docking with floating windows, reorder and auto-hide. Your copy, edit freely. Docs: https://
|
|
3
|
-
import { SvDockManager, dockGroup, dockTabs, dockPane, type DockManagerState } from '@svgrid/grid'
|
|
4
|
-
|
|
5
|
-
let workspace = $state<DockManagerState>({
|
|
6
|
-
main: dockGroup('row', [
|
|
7
|
-
dockTabs([dockPane('explorer', 'Explorer')]),
|
|
8
|
-
dockGroup('column', [
|
|
9
|
-
dockTabs([dockPane('editor', 'index.ts'), dockPane('readme', 'README.md')]),
|
|
10
|
-
dockTabs([dockPane('terminal', 'Terminal')]),
|
|
11
|
-
], [0.7, 0.3]),
|
|
12
|
-
], [0.22, 0.78]),
|
|
13
|
-
floating: [],
|
|
14
|
-
autoHide: [],
|
|
15
|
-
})
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<div style="height: 520px">
|
|
19
|
-
<SvDockManager bind:workspace>
|
|
20
|
-
{#snippet pane(p)}
|
|
21
|
-
<div style="padding: 12px">{p.title}</div>
|
|
22
|
-
{/snippet}
|
|
23
|
-
</SvDockManager>
|
|
24
|
-
</div>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// SvDockManager - docking with floating windows, reorder and auto-hide. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-dock-manager
|
|
3
|
+
import { SvDockManager, dockGroup, dockTabs, dockPane, type DockManagerState } from '@svgrid/grid'
|
|
4
|
+
|
|
5
|
+
let workspace = $state<DockManagerState>({
|
|
6
|
+
main: dockGroup('row', [
|
|
7
|
+
dockTabs([dockPane('explorer', 'Explorer')]),
|
|
8
|
+
dockGroup('column', [
|
|
9
|
+
dockTabs([dockPane('editor', 'index.ts'), dockPane('readme', 'README.md')]),
|
|
10
|
+
dockTabs([dockPane('terminal', 'Terminal')]),
|
|
11
|
+
], [0.7, 0.3]),
|
|
12
|
+
], [0.22, 0.78]),
|
|
13
|
+
floating: [],
|
|
14
|
+
autoHide: [],
|
|
15
|
+
})
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<div style="height: 520px">
|
|
19
|
+
<SvDockManager bind:workspace>
|
|
20
|
+
{#snippet pane(p)}
|
|
21
|
+
<div style="padding: 12px">{p.title}</div>
|
|
22
|
+
{/snippet}
|
|
23
|
+
</SvDockManager>
|
|
24
|
+
</div>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// SvField - shared label / hint / error chrome for any control. Your copy, edit freely. Docs: https://
|
|
3
|
-
import { SvField } from '@svgrid/grid'
|
|
4
|
-
|
|
5
|
-
let role = $state('')
|
|
6
|
-
const err = $derived(role ? undefined : 'Pick a role')
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<SvField id="role" label="Role" hint="Sets the default permissions" error={err} required block>
|
|
10
|
-
<select id="role" bind:value={role}>
|
|
11
|
-
<option value="">Choose...</option>
|
|
12
|
-
<option value="admin">Admin</option>
|
|
13
|
-
<option value="member">Member</option>
|
|
14
|
-
</select>
|
|
15
|
-
</SvField>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// SvField - shared label / hint / error chrome for any control. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-field
|
|
3
|
+
import { SvField } from '@svgrid/grid'
|
|
4
|
+
|
|
5
|
+
let role = $state('')
|
|
6
|
+
const err = $derived(role ? undefined : 'Pick a role')
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<SvField id="role" label="Role" hint="Sets the default permissions" error={err} required block>
|
|
10
|
+
<select id="role" bind:value={role}>
|
|
11
|
+
<option value="">Choose...</option>
|
|
12
|
+
<option value="admin">Admin</option>
|
|
13
|
+
<option value="member">Member</option>
|
|
14
|
+
</select>
|
|
15
|
+
</SvField>
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// SvFileUpload - drag-and-drop file field with accept / size / count validation. Your copy, edit freely. Docs: https://
|
|
3
|
-
import { SvFileUpload, type FileRejection } from '@svgrid/grid'
|
|
4
|
-
|
|
5
|
-
let files = $state<File[]>([])
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<SvFileUpload
|
|
9
|
-
{files}
|
|
10
|
-
label="Attachments"
|
|
11
|
-
accept="image/*,.pdf"
|
|
12
|
-
multiple
|
|
13
|
-
maxSize={5 * 1024 * 1024}
|
|
14
|
-
onChange={(f) => (files = f)}
|
|
15
|
-
onReject={(r: FileRejection[]) => console.warn(r)}
|
|
16
|
-
/>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// SvFileUpload - drag-and-drop file field with accept / size / count validation. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-file-upload
|
|
3
|
+
import { SvFileUpload, type FileRejection } from '@svgrid/grid'
|
|
4
|
+
|
|
5
|
+
let files = $state<File[]>([])
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<SvFileUpload
|
|
9
|
+
{files}
|
|
10
|
+
label="Attachments"
|
|
11
|
+
accept="image/*,.pdf"
|
|
12
|
+
multiple
|
|
13
|
+
maxSize={5 * 1024 * 1024}
|
|
14
|
+
onChange={(f) => (files = f)}
|
|
15
|
+
onReject={(r: FileRejection[]) => console.warn(r)}
|
|
16
|
+
/>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// SvForm - schema-driven form from a FormField[] with validation. Your copy, edit freely. Docs: https://
|
|
3
|
-
import { SvForm, type FormField } from '@svgrid/grid'
|
|
4
|
-
|
|
5
|
-
const fields: FormField[] = [
|
|
6
|
-
{ name: 'name', label: 'Full name', required: true },
|
|
7
|
-
{ name: 'email', label: 'Email', type: 'email', required: true },
|
|
8
|
-
{ name: 'plan', label: 'Plan', type: 'select',
|
|
9
|
-
options: [{ value: 'free', label: 'Free' }, { value: 'pro', label: 'Pro' }] },
|
|
10
|
-
{ name: 'agree', label: 'I accept the terms', type: 'checkbox' },
|
|
11
|
-
]
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<SvForm {fields} columns={2} onSubmit={(values) => console.log(values)} />
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// SvForm - schema-driven form from a FormField[] with validation. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-form
|
|
3
|
+
import { SvForm, type FormField } from '@svgrid/grid'
|
|
4
|
+
|
|
5
|
+
const fields: FormField[] = [
|
|
6
|
+
{ name: 'name', label: 'Full name', required: true },
|
|
7
|
+
{ name: 'email', label: 'Email', type: 'email', required: true },
|
|
8
|
+
{ name: 'plan', label: 'Plan', type: 'select',
|
|
9
|
+
options: [{ value: 'free', label: 'Free' }, { value: 'pro', label: 'Pro' }] },
|
|
10
|
+
{ name: 'agree', label: 'I accept the terms', type: 'checkbox' },
|
|
11
|
+
]
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<SvForm {fields} columns={2} onSubmit={(values) => console.log(values)} />
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// SvGridChart - inline-SVG chart from a ChartSpec, no charting dependency. Your copy, edit freely. Docs: https://
|
|
3
|
-
import { SvGridChart, rowsToChartSpec, type ChartSpec } from '@svgrid/grid'
|
|
4
|
-
|
|
5
|
-
const rows = [
|
|
6
|
-
{ region: 'North', revenue: 4200 },
|
|
7
|
-
{ region: 'South', revenue: 3100 },
|
|
8
|
-
{ region: 'East', revenue: 5300 },
|
|
9
|
-
{ region: 'West', revenue: 2800 },
|
|
10
|
-
]
|
|
11
|
-
const spec = $derived<ChartSpec>(
|
|
12
|
-
rowsToChartSpec(rows, { type: 'bar', category: 'region', value: 'revenue', reduce: 'sum' }),
|
|
13
|
-
)
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<SvGridChart {spec} formatValue={(v) => '$' + v.toLocaleString()} />
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// SvGridChart - inline-SVG chart from a ChartSpec, no charting dependency. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-grid-chart
|
|
3
|
+
import { SvGridChart, rowsToChartSpec, type ChartSpec } from '@svgrid/grid'
|
|
4
|
+
|
|
5
|
+
const rows = [
|
|
6
|
+
{ region: 'North', revenue: 4200 },
|
|
7
|
+
{ region: 'South', revenue: 3100 },
|
|
8
|
+
{ region: 'East', revenue: 5300 },
|
|
9
|
+
{ region: 'West', revenue: 2800 },
|
|
10
|
+
]
|
|
11
|
+
const spec = $derived<ChartSpec>(
|
|
12
|
+
rowsToChartSpec(rows, { type: 'bar', category: 'region', value: 'revenue', reduce: 'sum' }),
|
|
13
|
+
)
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<SvGridChart {spec} formatValue={(v) => '$' + v.toLocaleString()} />
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// Layout primitives - SvStack (column), SvGroup (row), SvSimpleGrid (responsive grid).
|
|
3
|
+
// Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-layout-primitives
|
|
4
|
+
import { SvStack, SvGroup, SvSimpleGrid, SvCard } from '@svgrid/grid'
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<SvStack gap={16}>
|
|
8
|
+
<SvGroup gap={8} justify="between">
|
|
9
|
+
<strong>Team</strong>
|
|
10
|
+
<button>Invite</button>
|
|
11
|
+
</SvGroup>
|
|
12
|
+
|
|
13
|
+
<SvSimpleGrid minChildWidth={180} gap={12}>
|
|
14
|
+
<SvCard>One</SvCard>
|
|
15
|
+
<SvCard>Two</SvCard>
|
|
16
|
+
<SvCard>Three</SvCard>
|
|
17
|
+
</SvSimpleGrid>
|
|
18
|
+
</SvStack>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// SvScrollArea - scroll container with the kit's themed scrollbars. Your copy, edit freely. Docs: https://
|
|
3
|
-
import { SvScrollArea } from '@svgrid/grid'
|
|
4
|
-
|
|
5
|
-
const rows = Array.from({ length: 40 }, (_, i) => `Item ${i + 1}`)
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<SvScrollArea maxHeight="240px">
|
|
9
|
-
{#each rows as row}<div style="padding: 6px 12px">{row}</div>{/each}
|
|
10
|
-
</SvScrollArea>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// SvScrollArea - scroll container with the kit's themed scrollbars. Your copy, edit freely. Docs: https://svgrid.com/docs/help/ui-components/sv-scroll-area
|
|
3
|
+
import { SvScrollArea } from '@svgrid/grid'
|
|
4
|
+
|
|
5
|
+
const rows = Array.from({ length: 40 }, (_, i) => `Item ${i + 1}`)
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<SvScrollArea maxHeight="240px">
|
|
9
|
+
{#each rows as row}<div style="padding: 6px 12px">{row}</div>{/each}
|
|
10
|
+
</SvScrollArea>
|