@nqmcreative/ui 0.1.1 → 0.2.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/README.md +89 -34
- package/cli/index.mjs +67 -30
- package/dist/core/calendar.d.ts +3 -0
- package/dist/core/calendar.js +36 -0
- package/dist/core/dialog.svelte.d.ts +14 -0
- package/dist/core/dialog.svelte.js +23 -0
- package/dist/core/files.d.ts +35 -0
- package/dist/core/files.js +62 -0
- package/dist/core/index.d.ts +37 -0
- package/dist/core/index.js +35 -0
- package/dist/core/list.svelte.d.ts +41 -0
- package/dist/core/list.svelte.js +77 -0
- package/dist/core/number.d.ts +7 -0
- package/dist/core/number.js +17 -0
- package/dist/core/pagination.d.ts +6 -0
- package/dist/core/pagination.js +21 -0
- package/dist/core/password.d.ts +8 -0
- package/dist/core/password.js +23 -0
- package/dist/core/table.d.ts +22 -0
- package/dist/core/table.js +41 -0
- package/dist/core/theme.svelte.d.ts +16 -0
- package/dist/core/theme.svelte.js +34 -0
- package/dist/core/trigger.d.ts +35 -0
- package/dist/core/trigger.js +77 -0
- package/dist/index.d.ts +11 -103
- package/dist/index.js +11 -75
- package/dist/{components → styles/matte}/AccordionItem.svelte +1 -1
- package/dist/{components → styles/matte}/AccordionItem.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Alert.svelte +8 -2
- package/dist/{components → styles/matte}/Alert.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Avatar.svelte +1 -1
- package/dist/{components → styles/matte}/Avatar.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Badge.svelte +8 -3
- package/dist/{components → styles/matte}/Badge.svelte.d.ts +1 -3
- package/dist/{components → styles/matte}/Breadcrumb.svelte +2 -2
- package/dist/{components → styles/matte}/Breadcrumb.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Button.svelte +1 -1
- package/dist/{components → styles/matte}/Button.svelte.d.ts +1 -1
- package/dist/styles/matte/CTASection.svelte +76 -0
- package/dist/styles/matte/CTASection.svelte.d.ts +18 -0
- package/dist/{components → styles/matte}/Calendar.svelte +7 -17
- package/dist/{components → styles/matte}/Calendar.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Card.svelte +1 -1
- package/dist/{components → styles/matte}/Card.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Checkbox.svelte +1 -1
- package/dist/{components → styles/matte}/Checkbox.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/CheckboxGroup.svelte +1 -1
- package/dist/{components → styles/matte}/CheckboxGroup.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Combobox.svelte +31 -42
- package/dist/{components → styles/matte}/Combobox.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/CommandPalette.svelte +26 -41
- package/dist/{components → styles/matte}/CommandPalette.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/ConfirmDialog.svelte +2 -2
- package/dist/{components → styles/matte}/ConfirmDialog.svelte.d.ts +2 -2
- package/dist/{components → styles/matte}/ContextMenu.svelte +5 -7
- package/dist/{components → styles/matte}/DatePicker.svelte +7 -11
- package/dist/{components → styles/matte}/DatePicker.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Drawer.svelte +4 -7
- package/dist/{components → styles/matte}/Dropdown.svelte +18 -36
- package/dist/{components → styles/matte}/Dropdown.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Dropzone.svelte +11 -43
- package/dist/{components → styles/matte}/Dropzone.svelte.d.ts +2 -5
- package/dist/{components → styles/matte}/EmptyState.svelte +1 -1
- package/dist/{components → styles/matte}/EmptyState.svelte.d.ts +1 -1
- package/dist/styles/matte/FeatureCard.svelte +58 -0
- package/dist/styles/matte/FeatureCard.svelte.d.ts +16 -0
- package/dist/styles/matte/FeatureGrid.svelte +62 -0
- package/dist/styles/matte/FeatureGrid.svelte.d.ts +16 -0
- package/dist/{components → styles/matte}/Footer.svelte +1 -1
- package/dist/{components → styles/matte}/Footer.svelte.d.ts +1 -1
- package/dist/styles/matte/HeroSection.svelte +80 -0
- package/dist/styles/matte/HeroSection.svelte.d.ts +21 -0
- package/dist/{components → styles/matte}/Input.svelte +1 -1
- package/dist/{components → styles/matte}/Input.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Link.svelte +1 -1
- package/dist/{components → styles/matte}/Link.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/LocaleProvider.svelte +1 -1
- package/dist/{components → styles/matte}/LocaleProvider.svelte.d.ts +1 -1
- package/dist/styles/matte/LogoCloud.svelte +61 -0
- package/dist/styles/matte/LogoCloud.svelte.d.ts +19 -0
- package/dist/{components → styles/matte}/MenuItem.svelte +1 -1
- package/dist/{components → styles/matte}/MenuItem.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Modal.svelte +4 -7
- package/dist/{components → styles/matte}/MultiSelect.svelte +18 -37
- package/dist/{components → styles/matte}/MultiSelect.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Navbar.svelte +2 -2
- package/dist/{components → styles/matte}/Navbar.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/NumberInput.svelte +4 -8
- package/dist/{components → styles/matte}/NumberInput.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Pagination.svelte +4 -15
- package/dist/{components → styles/matte}/Pagination.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/PasswordInput.svelte +4 -13
- package/dist/{components → styles/matte}/PasswordInput.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Popover.svelte +16 -41
- package/dist/{components → styles/matte}/Popover.svelte.d.ts +1 -1
- package/dist/styles/matte/PricingCard.svelte +107 -0
- package/dist/styles/matte/PricingCard.svelte.d.ts +25 -0
- package/dist/{components → styles/matte}/Progress.svelte +3 -2
- package/dist/{components → styles/matte}/Progress.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Radio.svelte +1 -1
- package/dist/{components → styles/matte}/Radio.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/RadioGroup.svelte +1 -1
- package/dist/{components → styles/matte}/RadioGroup.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/SegmentedControl.svelte +1 -1
- package/dist/{components → styles/matte}/SegmentedControl.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Select.svelte +1 -1
- package/dist/{components → styles/matte}/Select.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Sidebar.svelte +2 -2
- package/dist/{components → styles/matte}/Sidebar.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Slider.svelte +3 -2
- package/dist/{components → styles/matte}/Slider.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Spinner.svelte +2 -2
- package/dist/{components → styles/matte}/Spinner.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Stat.svelte +1 -1
- package/dist/{components → styles/matte}/Stat.svelte.d.ts +1 -1
- package/dist/styles/matte/StatsBand.svelte +57 -0
- package/dist/styles/matte/StatsBand.svelte.d.ts +20 -0
- package/dist/{components → styles/matte}/Steps.svelte +1 -1
- package/dist/{components → styles/matte}/Steps.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Switch.svelte +1 -1
- package/dist/{components → styles/matte}/Switch.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/Table.svelte +6 -28
- package/dist/{components → styles/matte}/Table.svelte.d.ts +2 -6
- package/dist/{components → styles/matte}/Tabs.svelte +8 -1
- package/dist/{components → styles/matte}/Tabs.svelte.d.ts +1 -1
- package/dist/styles/matte/Testimonial.svelte +67 -0
- package/dist/styles/matte/Testimonial.svelte.d.ts +19 -0
- package/dist/{components → styles/matte}/Textarea.svelte +1 -1
- package/dist/{components → styles/matte}/Textarea.svelte.d.ts +1 -1
- package/dist/{components → styles/matte}/ThemeToggle.svelte +14 -27
- package/dist/{components → styles/matte}/ThemeToggle.svelte.d.ts +2 -6
- package/dist/{components → styles/matte}/Toaster.svelte +4 -4
- package/dist/styles/matte/index.d.ts +109 -0
- package/dist/styles/matte/index.js +83 -0
- package/dist/styles/paper/Accordion.svelte +17 -0
- package/dist/styles/paper/Accordion.svelte.d.ts +8 -0
- package/dist/styles/paper/AccordionItem.svelte +46 -0
- package/dist/styles/paper/AccordionItem.svelte.d.ts +14 -0
- package/dist/styles/paper/Alert.svelte +99 -0
- package/dist/styles/paper/Alert.svelte.d.ts +18 -0
- package/dist/styles/paper/Avatar.svelte +60 -0
- package/dist/styles/paper/Avatar.svelte.d.ts +16 -0
- package/dist/styles/paper/AvatarGroup.svelte +17 -0
- package/dist/styles/paper/AvatarGroup.svelte.d.ts +8 -0
- package/dist/styles/paper/Badge.svelte +58 -0
- package/dist/styles/paper/Badge.svelte.d.ts +16 -0
- package/dist/styles/paper/Breadcrumb.svelte +49 -0
- package/dist/styles/paper/Breadcrumb.svelte.d.ts +14 -0
- package/dist/styles/paper/Button.svelte +96 -0
- package/dist/styles/paper/Button.svelte.d.ts +21 -0
- package/dist/styles/paper/CTASection.svelte +76 -0
- package/dist/styles/paper/CTASection.svelte.d.ts +18 -0
- package/dist/styles/paper/Calendar.svelte +202 -0
- package/dist/styles/paper/Calendar.svelte.d.ts +22 -0
- package/dist/styles/paper/Card.svelte +78 -0
- package/dist/styles/paper/Card.svelte.d.ts +21 -0
- package/dist/styles/paper/Checkbox.svelte +75 -0
- package/dist/styles/paper/Checkbox.svelte.d.ts +15 -0
- package/dist/styles/paper/CheckboxGroup.svelte +111 -0
- package/dist/styles/paper/CheckboxGroup.svelte.d.ts +30 -0
- package/dist/styles/paper/Combobox.svelte +266 -0
- package/dist/styles/paper/Combobox.svelte.d.ts +29 -0
- package/dist/styles/paper/CommandPalette.svelte +209 -0
- package/dist/styles/paper/CommandPalette.svelte.d.ts +32 -0
- package/dist/styles/paper/ConfirmDialog.svelte +97 -0
- package/dist/styles/paper/ConfirmDialog.svelte.d.ts +22 -0
- package/dist/styles/paper/ContextMenu.svelte +88 -0
- package/dist/styles/paper/ContextMenu.svelte.d.ts +15 -0
- package/dist/styles/paper/DatePicker.svelte +192 -0
- package/dist/styles/paper/DatePicker.svelte.d.ts +23 -0
- package/dist/styles/paper/Divider.svelte +30 -0
- package/dist/styles/paper/Divider.svelte.d.ts +10 -0
- package/dist/styles/paper/Drawer.svelte +165 -0
- package/dist/styles/paper/Drawer.svelte.d.ts +20 -0
- package/dist/styles/paper/Dropdown.svelte +94 -0
- package/dist/styles/paper/Dropdown.svelte.d.ts +23 -0
- package/dist/styles/paper/Dropzone.svelte +210 -0
- package/dist/styles/paper/Dropzone.svelte.d.ts +29 -0
- package/dist/styles/paper/EmptyState.svelte +71 -0
- package/dist/styles/paper/EmptyState.svelte.d.ts +18 -0
- package/dist/styles/paper/FeatureCard.svelte +58 -0
- package/dist/styles/paper/FeatureCard.svelte.d.ts +16 -0
- package/dist/styles/paper/FeatureGrid.svelte +62 -0
- package/dist/styles/paper/FeatureGrid.svelte.d.ts +16 -0
- package/dist/styles/paper/Field.svelte +42 -0
- package/dist/styles/paper/Field.svelte.d.ts +16 -0
- package/dist/styles/paper/Footer.svelte +91 -0
- package/dist/styles/paper/Footer.svelte.d.ts +25 -0
- package/dist/styles/paper/HeroSection.svelte +86 -0
- package/dist/styles/paper/HeroSection.svelte.d.ts +21 -0
- package/dist/styles/paper/Input.svelte +60 -0
- package/dist/styles/paper/Input.svelte.d.ts +18 -0
- package/dist/styles/paper/InputGroup.svelte +20 -0
- package/dist/styles/paper/InputGroup.svelte.d.ts +11 -0
- package/dist/styles/paper/Kbd.svelte +17 -0
- package/dist/styles/paper/Kbd.svelte.d.ts +8 -0
- package/dist/styles/paper/Label.svelte +16 -0
- package/dist/styles/paper/Label.svelte.d.ts +9 -0
- package/dist/styles/paper/Link.svelte +44 -0
- package/dist/styles/paper/Link.svelte.d.ts +16 -0
- package/dist/styles/paper/LocaleProvider.svelte +24 -0
- package/dist/styles/paper/LocaleProvider.svelte.d.ts +10 -0
- package/dist/styles/paper/LogoCloud.svelte +61 -0
- package/dist/styles/paper/LogoCloud.svelte.d.ts +19 -0
- package/dist/styles/paper/MenuItem.svelte +64 -0
- package/dist/styles/paper/MenuItem.svelte.d.ts +18 -0
- package/dist/styles/paper/MenuSeparator.svelte +22 -0
- package/dist/styles/paper/MenuSeparator.svelte.d.ts +8 -0
- package/dist/styles/paper/Modal.svelte +118 -0
- package/dist/styles/paper/Modal.svelte.d.ts +21 -0
- package/dist/styles/paper/MultiSelect.svelte +287 -0
- package/dist/styles/paper/MultiSelect.svelte.d.ts +31 -0
- package/dist/styles/paper/Navbar.svelte +201 -0
- package/dist/styles/paper/Navbar.svelte.d.ts +33 -0
- package/dist/styles/paper/NumberInput.svelte +96 -0
- package/dist/styles/paper/NumberInput.svelte.d.ts +15 -0
- package/dist/styles/paper/Pagination.svelte +83 -0
- package/dist/styles/paper/Pagination.svelte.d.ts +15 -0
- package/dist/styles/paper/PasswordInput.svelte +100 -0
- package/dist/styles/paper/PasswordInput.svelte.d.ts +12 -0
- package/dist/styles/paper/Popover.svelte +89 -0
- package/dist/styles/paper/Popover.svelte.d.ts +19 -0
- package/dist/styles/paper/PricingCard.svelte +108 -0
- package/dist/styles/paper/PricingCard.svelte.d.ts +25 -0
- package/dist/styles/paper/Progress.svelte +59 -0
- package/dist/styles/paper/Progress.svelte.d.ts +17 -0
- package/dist/styles/paper/Radio.svelte +55 -0
- package/dist/styles/paper/Radio.svelte.d.ts +15 -0
- package/dist/styles/paper/RadioGroup.svelte +95 -0
- package/dist/styles/paper/RadioGroup.svelte.d.ts +27 -0
- package/dist/styles/paper/SegmentedControl.svelte +88 -0
- package/dist/styles/paper/SegmentedControl.svelte.d.ts +25 -0
- package/dist/styles/paper/Select.svelte +61 -0
- package/dist/styles/paper/Select.svelte.d.ts +20 -0
- package/dist/styles/paper/Sidebar.svelte +206 -0
- package/dist/styles/paper/Sidebar.svelte.d.ts +36 -0
- package/dist/styles/paper/Skeleton.svelte +46 -0
- package/dist/styles/paper/Skeleton.svelte.d.ts +13 -0
- package/dist/styles/paper/Slider.svelte +80 -0
- package/dist/styles/paper/Slider.svelte.d.ts +19 -0
- package/dist/styles/paper/Spinner.svelte +34 -0
- package/dist/styles/paper/Spinner.svelte.d.ts +13 -0
- package/dist/styles/paper/Stat.svelte +51 -0
- package/dist/styles/paper/Stat.svelte.d.ts +16 -0
- package/dist/styles/paper/StatsBand.svelte +63 -0
- package/dist/styles/paper/StatsBand.svelte.d.ts +20 -0
- package/dist/styles/paper/Steps.svelte +141 -0
- package/dist/styles/paper/Steps.svelte.d.ts +24 -0
- package/dist/styles/paper/Switch.svelte +64 -0
- package/dist/styles/paper/Switch.svelte.d.ts +14 -0
- package/dist/styles/paper/Table.svelte +217 -0
- package/dist/styles/paper/Table.svelte.d.ts +66 -0
- package/dist/styles/paper/Tabs.svelte +102 -0
- package/dist/styles/paper/Tabs.svelte.d.ts +23 -0
- package/dist/styles/paper/Testimonial.svelte +64 -0
- package/dist/styles/paper/Testimonial.svelte.d.ts +19 -0
- package/dist/styles/paper/Textarea.svelte +54 -0
- package/dist/styles/paper/Textarea.svelte.d.ts +12 -0
- package/dist/styles/paper/ThemeToggle.svelte +130 -0
- package/dist/styles/paper/ThemeToggle.svelte.d.ts +16 -0
- package/dist/styles/paper/Toaster.svelte +132 -0
- package/dist/styles/paper/Toaster.svelte.d.ts +8 -0
- package/dist/styles/paper/Tooltip.svelte +33 -0
- package/dist/styles/paper/Tooltip.svelte.d.ts +12 -0
- package/dist/styles/paper/fonts.css +46 -0
- package/dist/styles/paper/index.d.ts +109 -0
- package/dist/styles/paper/index.js +83 -0
- package/dist/styles/paper/theme.css +222 -0
- package/package.json +531 -201
- package/registry.json +658 -339
- /package/dist/{actions → core/actions}/anchor.d.ts +0 -0
- /package/dist/{actions → core/actions}/anchor.js +0 -0
- /package/dist/{actions → core/actions}/dismissable.d.ts +0 -0
- /package/dist/{actions → core/actions}/dismissable.js +0 -0
- /package/dist/{date.d.ts → core/date.d.ts} +0 -0
- /package/dist/{date.js → core/date.js} +0 -0
- /package/dist/{locale.svelte.d.ts → core/locale.svelte.d.ts} +0 -0
- /package/dist/{locale.svelte.js → core/locale.svelte.js} +0 -0
- /package/dist/{toast.svelte.d.ts → core/toast.svelte.d.ts} +0 -0
- /package/dist/{toast.svelte.js → core/toast.svelte.js} +0 -0
- /package/dist/{tones.d.ts → core/tones.d.ts} +0 -0
- /package/dist/{tones.js → core/tones.js} +0 -0
- /package/dist/{components → styles/matte}/Accordion.svelte +0 -0
- /package/dist/{components → styles/matte}/Accordion.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/AvatarGroup.svelte +0 -0
- /package/dist/{components → styles/matte}/AvatarGroup.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/ContextMenu.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/Divider.svelte +0 -0
- /package/dist/{components → styles/matte}/Divider.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/Drawer.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/Field.svelte +0 -0
- /package/dist/{components → styles/matte}/Field.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/InputGroup.svelte +0 -0
- /package/dist/{components → styles/matte}/InputGroup.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/Kbd.svelte +0 -0
- /package/dist/{components → styles/matte}/Kbd.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/Label.svelte +0 -0
- /package/dist/{components → styles/matte}/Label.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/MenuSeparator.svelte +0 -0
- /package/dist/{components → styles/matte}/MenuSeparator.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/Modal.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/Skeleton.svelte +0 -0
- /package/dist/{components → styles/matte}/Skeleton.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/Toaster.svelte.d.ts +0 -0
- /package/dist/{components → styles/matte}/Tooltip.svelte +0 -0
- /package/dist/{components → styles/matte}/Tooltip.svelte.d.ts +0 -0
- /package/dist/{fonts.css → styles/matte/fonts.css} +0 -0
- /package/dist/{theme.css → styles/matte/theme.css} +0 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
import { toneBorder, toneSoft, toneSolid, type Tone } from '../../core/tones.js';
|
|
5
|
+
|
|
6
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
name: string;
|
|
8
|
+
/** Already formatted — the component does not do currency. */
|
|
9
|
+
price: string;
|
|
10
|
+
/** `/ month`, `per seat`, whatever follows the figure. */
|
|
11
|
+
period?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
/** One line each. Rendered with a tick. */
|
|
14
|
+
features?: string[];
|
|
15
|
+
/** Pill in the top corner, e.g. "Most popular". */
|
|
16
|
+
badge?: string;
|
|
17
|
+
/** Ring, lift and a tinted header — for the plan you want chosen. */
|
|
18
|
+
featured?: boolean;
|
|
19
|
+
tone?: Tone;
|
|
20
|
+
/** The button. */
|
|
21
|
+
action?: Snippet;
|
|
22
|
+
/** Extra content under the feature list. */
|
|
23
|
+
children?: Snippet;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let {
|
|
27
|
+
name,
|
|
28
|
+
price,
|
|
29
|
+
period,
|
|
30
|
+
description,
|
|
31
|
+
features = [],
|
|
32
|
+
badge,
|
|
33
|
+
featured = false,
|
|
34
|
+
tone = 'brand',
|
|
35
|
+
action,
|
|
36
|
+
class: className = '',
|
|
37
|
+
children,
|
|
38
|
+
...rest
|
|
39
|
+
}: Props = $props();
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<div
|
|
43
|
+
class="flex flex-col rounded-xl bg-bg {featured
|
|
44
|
+
? `border-2 shadow-lg ${toneBorder[tone]}`
|
|
45
|
+
: 'border border-hairline shadow-xs'} {className}"
|
|
46
|
+
{...rest}
|
|
47
|
+
>
|
|
48
|
+
<div class="flex flex-col gap-4 p-6">
|
|
49
|
+
<div class="flex items-start justify-between gap-3">
|
|
50
|
+
<h3 class="font-heading text-base font-semibold text-text">{name}</h3>
|
|
51
|
+
{#if badge}
|
|
52
|
+
<span
|
|
53
|
+
class="shrink-0 rounded-full px-2.5 py-0.5 font-sans text-[11px] font-medium {featured
|
|
54
|
+
? toneSolid[tone]
|
|
55
|
+
: toneSoft[tone]}"
|
|
56
|
+
>
|
|
57
|
+
{badge}
|
|
58
|
+
</span>
|
|
59
|
+
{/if}
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div class="flex items-baseline gap-1.5">
|
|
63
|
+
<span class="font-heading text-4xl font-semibold tracking-tight text-text tabular-nums">
|
|
64
|
+
{price}
|
|
65
|
+
</span>
|
|
66
|
+
{#if period}
|
|
67
|
+
<span class="font-sans text-sm text-text-muted">{period}</span>
|
|
68
|
+
{/if}
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
{#if description}
|
|
72
|
+
<p class="font-sans text-sm leading-relaxed text-text-secondary">{description}</p>
|
|
73
|
+
{/if}
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
{#if features.length}
|
|
77
|
+
<ul class="flex flex-1 flex-col gap-3 border-t border-hairline p-6">
|
|
78
|
+
{#each features as feature (feature)}
|
|
79
|
+
<li class="flex items-start gap-3 font-sans text-sm text-text-secondary">
|
|
80
|
+
<span
|
|
81
|
+
class="mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full {toneSoft[
|
|
82
|
+
tone
|
|
83
|
+
]}"
|
|
84
|
+
>
|
|
85
|
+
<svg class="size-2.5" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
86
|
+
<path
|
|
87
|
+
d="m3 8 3.2 3.2L13 4.4"
|
|
88
|
+
stroke="currentColor"
|
|
89
|
+
stroke-width="2.4"
|
|
90
|
+
stroke-linecap="round"
|
|
91
|
+
stroke-linejoin="round"
|
|
92
|
+
/>
|
|
93
|
+
</svg>
|
|
94
|
+
</span>
|
|
95
|
+
<span class="leading-snug">{feature}</span>
|
|
96
|
+
</li>
|
|
97
|
+
{/each}
|
|
98
|
+
</ul>
|
|
99
|
+
{/if}
|
|
100
|
+
|
|
101
|
+
{#if children}
|
|
102
|
+
<div class="px-6 pb-2">{@render children()}</div>
|
|
103
|
+
{/if}
|
|
104
|
+
|
|
105
|
+
{#if action}
|
|
106
|
+
<div class="p-6 pt-2">{@render action()}</div>
|
|
107
|
+
{/if}
|
|
108
|
+
</div>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { type Tone } from '../../core/tones.js';
|
|
4
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
name: string;
|
|
6
|
+
/** Already formatted — the component does not do currency. */
|
|
7
|
+
price: string;
|
|
8
|
+
/** `/ month`, `per seat`, whatever follows the figure. */
|
|
9
|
+
period?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
/** One line each. Rendered with a tick. */
|
|
12
|
+
features?: string[];
|
|
13
|
+
/** Pill in the top corner, e.g. "Most popular". */
|
|
14
|
+
badge?: string;
|
|
15
|
+
/** Ring, lift and a tinted header — for the plan you want chosen. */
|
|
16
|
+
featured?: boolean;
|
|
17
|
+
tone?: Tone;
|
|
18
|
+
/** The button. */
|
|
19
|
+
action?: Snippet;
|
|
20
|
+
/** Extra content under the feature list. */
|
|
21
|
+
children?: Snippet;
|
|
22
|
+
}
|
|
23
|
+
declare const PricingCard: import("svelte").Component<Props, {}, "">;
|
|
24
|
+
type PricingCard = ReturnType<typeof PricingCard>;
|
|
25
|
+
export default PricingCard;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { toneFill, type Tone } from '../../core/tones.js';
|
|
4
|
+
import { percentOf } from '../../core/number.js';
|
|
5
|
+
|
|
6
|
+
export type ProgressSize = 'sm' | 'md' | 'lg';
|
|
7
|
+
|
|
8
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
value?: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
tone?: Tone;
|
|
12
|
+
size?: ProgressSize;
|
|
13
|
+
label?: string;
|
|
14
|
+
/** Prints the percentage on the right of the label row. */
|
|
15
|
+
showValue?: boolean;
|
|
16
|
+
/** Ignores `value` and runs a looping sweep. */
|
|
17
|
+
indeterminate?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let {
|
|
21
|
+
value = 0,
|
|
22
|
+
max = 100,
|
|
23
|
+
tone = 'brand',
|
|
24
|
+
size = 'md',
|
|
25
|
+
label,
|
|
26
|
+
showValue = false,
|
|
27
|
+
indeterminate = false,
|
|
28
|
+
class: className = '',
|
|
29
|
+
...rest
|
|
30
|
+
}: Props = $props();
|
|
31
|
+
|
|
32
|
+
const sizes: Record<ProgressSize, string> = { sm: 'h-1.5', md: 'h-2', lg: 'h-3' };
|
|
33
|
+
const pct = $derived(percentOf(value, 0, max));
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<div class="flex w-full flex-col gap-2 {className}" {...rest}>
|
|
37
|
+
{#if label || showValue}
|
|
38
|
+
<div class="flex items-baseline justify-between gap-4 font-sans text-sm">
|
|
39
|
+
{#if label}<span class="text-text-secondary">{label}</span>{/if}
|
|
40
|
+
{#if showValue}
|
|
41
|
+
<span class="text-xs font-medium text-text-muted tabular-nums">{Math.round(pct)}%</span>
|
|
42
|
+
{/if}
|
|
43
|
+
</div>
|
|
44
|
+
{/if}
|
|
45
|
+
<div
|
|
46
|
+
role="progressbar"
|
|
47
|
+
aria-valuenow={indeterminate ? undefined : Math.round(pct)}
|
|
48
|
+
aria-valuemin={0}
|
|
49
|
+
aria-valuemax={100}
|
|
50
|
+
aria-label={label}
|
|
51
|
+
class="w-full overflow-hidden rounded-full bg-bg-inset {sizes[size]}"
|
|
52
|
+
>
|
|
53
|
+
<div
|
|
54
|
+
class="h-full rounded-full transition-[width] duration-300 ease-brand {toneFill[tone]}
|
|
55
|
+
{indeterminate ? 'w-1/3 animate-pulse' : ''}"
|
|
56
|
+
style={indeterminate ? undefined : `width:${pct}%`}
|
|
57
|
+
></div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import { type Tone } from '../../core/tones.js';
|
|
3
|
+
export type ProgressSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
value?: number;
|
|
6
|
+
max?: number;
|
|
7
|
+
tone?: Tone;
|
|
8
|
+
size?: ProgressSize;
|
|
9
|
+
label?: string;
|
|
10
|
+
/** Prints the percentage on the right of the label row. */
|
|
11
|
+
showValue?: boolean;
|
|
12
|
+
/** Ignores `value` and runs a looping sweep. */
|
|
13
|
+
indeterminate?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare const Progress: import("svelte").Component<Props, {}, "">;
|
|
16
|
+
type Progress = ReturnType<typeof Progress>;
|
|
17
|
+
export default Progress;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
4
|
+
import { peerFocusRing, tonePeerChecked, tonePeerFocus, type Tone } from '../../core/tones.js';
|
|
5
|
+
|
|
6
|
+
interface Props extends Omit<HTMLInputAttributes, 'type' | 'size'> {
|
|
7
|
+
/** Bind the same variable across a set of radios. */
|
|
8
|
+
group?: string;
|
|
9
|
+
value: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
tone?: Tone;
|
|
13
|
+
children?: Snippet;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let {
|
|
17
|
+
group = $bindable(''),
|
|
18
|
+
value,
|
|
19
|
+
label,
|
|
20
|
+
description,
|
|
21
|
+
tone = 'brand',
|
|
22
|
+
disabled = false,
|
|
23
|
+
class: className = '',
|
|
24
|
+
children,
|
|
25
|
+
...rest
|
|
26
|
+
}: Props = $props();
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<label
|
|
30
|
+
class="group inline-flex items-start gap-2.5 font-sans text-sm
|
|
31
|
+
{disabled ? 'pointer-events-none opacity-50' : 'cursor-pointer'} {className}"
|
|
32
|
+
>
|
|
33
|
+
<input type="radio" bind:group {value} {disabled} class="peer sr-only" {...rest} />
|
|
34
|
+
<span
|
|
35
|
+
class="mt-0.5 flex size-[18px] shrink-0 items-center justify-center rounded-full border border-hairline-strong bg-bg shadow-xs transition-colors duration-150 ease-brand-out
|
|
36
|
+
{tonePeerChecked[tone]} {peerFocusRing} {tonePeerFocus[tone]}"
|
|
37
|
+
aria-hidden="true"
|
|
38
|
+
>
|
|
39
|
+
<span
|
|
40
|
+
class="size-1.5 rounded-full bg-text-inverse opacity-0 transition-opacity duration-150 group-has-[:checked]:opacity-100"
|
|
41
|
+
></span>
|
|
42
|
+
</span>
|
|
43
|
+
{#if label || description || children}
|
|
44
|
+
<span class="flex flex-col gap-0.5">
|
|
45
|
+
{#if children}
|
|
46
|
+
{@render children()}
|
|
47
|
+
{:else if label}
|
|
48
|
+
<span class="leading-snug text-text">{label}</span>
|
|
49
|
+
{/if}
|
|
50
|
+
{#if description}
|
|
51
|
+
<span class="text-[13px] leading-snug text-text-muted">{description}</span>
|
|
52
|
+
{/if}
|
|
53
|
+
</span>
|
|
54
|
+
{/if}
|
|
55
|
+
</label>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
|
+
import { type Tone } from '../../core/tones.js';
|
|
4
|
+
interface Props extends Omit<HTMLInputAttributes, 'type' | 'size'> {
|
|
5
|
+
/** Bind the same variable across a set of radios. */
|
|
6
|
+
group?: string;
|
|
7
|
+
value: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
tone?: Tone;
|
|
11
|
+
children?: Snippet;
|
|
12
|
+
}
|
|
13
|
+
declare const Radio: import("svelte").Component<Props, {}, "group">;
|
|
14
|
+
type Radio = ReturnType<typeof Radio>;
|
|
15
|
+
export default Radio;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLFieldsetAttributes } from 'svelte/elements';
|
|
4
|
+
import Radio from './Radio.svelte';
|
|
5
|
+
import { toneBorder, toneSurface, type Tone } from '../../core/tones.js';
|
|
6
|
+
|
|
7
|
+
export interface RadioOption {
|
|
8
|
+
value: string;
|
|
9
|
+
label: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface Props extends HTMLFieldsetAttributes {
|
|
15
|
+
/** Bindable — the selected option's `value`. */
|
|
16
|
+
value?: string;
|
|
17
|
+
options?: RadioOption[];
|
|
18
|
+
legend?: string;
|
|
19
|
+
hint?: string;
|
|
20
|
+
error?: string;
|
|
21
|
+
required?: boolean;
|
|
22
|
+
tone?: Tone;
|
|
23
|
+
orientation?: 'vertical' | 'horizontal';
|
|
24
|
+
/** Wraps each option in a bordered, clickable card. */
|
|
25
|
+
boxed?: boolean;
|
|
26
|
+
/** Pass your own `Radio`s instead of `options`. */
|
|
27
|
+
children?: Snippet;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
let {
|
|
31
|
+
value = $bindable(''),
|
|
32
|
+
options,
|
|
33
|
+
legend,
|
|
34
|
+
hint,
|
|
35
|
+
error,
|
|
36
|
+
required = false,
|
|
37
|
+
tone = 'brand',
|
|
38
|
+
orientation = 'vertical',
|
|
39
|
+
boxed = false,
|
|
40
|
+
class: className = '',
|
|
41
|
+
children,
|
|
42
|
+
...rest
|
|
43
|
+
}: Props = $props();
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<fieldset class="flex flex-col gap-3 border-0 p-0 {className}" {...rest}>
|
|
47
|
+
{#if legend}
|
|
48
|
+
<legend class="mb-1 font-sans text-sm font-medium text-text">
|
|
49
|
+
{legend}
|
|
50
|
+
{#if required}<span class="ml-0.5 text-danger" aria-hidden="true">*</span>{/if}
|
|
51
|
+
</legend>
|
|
52
|
+
{/if}
|
|
53
|
+
|
|
54
|
+
<div class="flex gap-2.5 {orientation === 'horizontal' ? 'flex-row flex-wrap' : 'flex-col'}">
|
|
55
|
+
{#if options}
|
|
56
|
+
{#each options as option (option.value)}
|
|
57
|
+
{#if boxed}
|
|
58
|
+
<label
|
|
59
|
+
class="flex flex-1 cursor-pointer items-start gap-3 rounded-lg border p-4 shadow-xs transition-colors duration-150 ease-brand-out
|
|
60
|
+
{value === option.value
|
|
61
|
+
? `${toneBorder[tone]} ${toneSurface[tone]}`
|
|
62
|
+
: 'border-hairline bg-bg hover:border-hairline-strong'}
|
|
63
|
+
{option.disabled ? 'pointer-events-none opacity-50' : ''}"
|
|
64
|
+
>
|
|
65
|
+
<Radio
|
|
66
|
+
bind:group={value}
|
|
67
|
+
value={option.value}
|
|
68
|
+
label={option.label}
|
|
69
|
+
description={option.description}
|
|
70
|
+
disabled={option.disabled}
|
|
71
|
+
{tone}
|
|
72
|
+
/>
|
|
73
|
+
</label>
|
|
74
|
+
{:else}
|
|
75
|
+
<Radio
|
|
76
|
+
bind:group={value}
|
|
77
|
+
value={option.value}
|
|
78
|
+
label={option.label}
|
|
79
|
+
description={option.description}
|
|
80
|
+
disabled={option.disabled}
|
|
81
|
+
{tone}
|
|
82
|
+
/>
|
|
83
|
+
{/if}
|
|
84
|
+
{/each}
|
|
85
|
+
{:else if children}
|
|
86
|
+
{@render children()}
|
|
87
|
+
{/if}
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
{#if error}
|
|
91
|
+
<p class="font-sans text-[13px] text-danger">{error}</p>
|
|
92
|
+
{:else if hint}
|
|
93
|
+
<p class="font-sans text-[13px] text-text-muted">{hint}</p>
|
|
94
|
+
{/if}
|
|
95
|
+
</fieldset>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLFieldsetAttributes } from 'svelte/elements';
|
|
3
|
+
import { type Tone } from '../../core/tones.js';
|
|
4
|
+
export interface RadioOption {
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface Props extends HTMLFieldsetAttributes {
|
|
11
|
+
/** Bindable — the selected option's `value`. */
|
|
12
|
+
value?: string;
|
|
13
|
+
options?: RadioOption[];
|
|
14
|
+
legend?: string;
|
|
15
|
+
hint?: string;
|
|
16
|
+
error?: string;
|
|
17
|
+
required?: boolean;
|
|
18
|
+
tone?: Tone;
|
|
19
|
+
orientation?: 'vertical' | 'horizontal';
|
|
20
|
+
/** Wraps each option in a bordered, clickable card. */
|
|
21
|
+
boxed?: boolean;
|
|
22
|
+
/** Pass your own `Radio`s instead of `options`. */
|
|
23
|
+
children?: Snippet;
|
|
24
|
+
}
|
|
25
|
+
declare const RadioGroup: import("svelte").Component<Props, {}, "value">;
|
|
26
|
+
type RadioGroup = ReturnType<typeof RadioGroup>;
|
|
27
|
+
export default RadioGroup;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { focusRing, toneRing, type Tone } from '../../core/tones.js';
|
|
4
|
+
|
|
5
|
+
export interface SegmentOption {
|
|
6
|
+
value: string;
|
|
7
|
+
label: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type SegmentedSize = 'sm' | 'md';
|
|
12
|
+
|
|
13
|
+
interface Props extends Omit<HTMLAttributes<HTMLDivElement>, 'onchange'> {
|
|
14
|
+
/** Bindable — the selected option's `value`. */
|
|
15
|
+
value?: string;
|
|
16
|
+
options: SegmentOption[];
|
|
17
|
+
/** Submits with a form when set. */
|
|
18
|
+
name?: string;
|
|
19
|
+
size?: SegmentedSize;
|
|
20
|
+
tone?: Tone;
|
|
21
|
+
/** Spread the segments evenly across the full width. */
|
|
22
|
+
fullWidth?: boolean;
|
|
23
|
+
label?: string;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
onchange?: (value: string) => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let {
|
|
29
|
+
value = $bindable(''),
|
|
30
|
+
options,
|
|
31
|
+
name,
|
|
32
|
+
size = 'md',
|
|
33
|
+
tone = 'brand',
|
|
34
|
+
fullWidth = false,
|
|
35
|
+
label,
|
|
36
|
+
disabled = false,
|
|
37
|
+
class: className = '',
|
|
38
|
+
onchange,
|
|
39
|
+
...rest
|
|
40
|
+
}: Props = $props();
|
|
41
|
+
|
|
42
|
+
const sizes: Record<SegmentedSize, string> = {
|
|
43
|
+
sm: 'h-7 px-2.5 text-[13px]',
|
|
44
|
+
md: 'h-8 px-3.5 text-sm'
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
function select(option: SegmentOption) {
|
|
48
|
+
if (option.disabled || disabled) return;
|
|
49
|
+
value = option.value;
|
|
50
|
+
onchange?.(option.value);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function onKeydown(event: KeyboardEvent) {
|
|
54
|
+
const step = event.key === 'ArrowRight' ? 1 : event.key === 'ArrowLeft' ? -1 : 0;
|
|
55
|
+
if (!step) return;
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
const usable = options.filter((option) => !option.disabled);
|
|
58
|
+
const index = usable.findIndex((option) => option.value === value);
|
|
59
|
+
select(usable[(index + step + usable.length) % usable.length]);
|
|
60
|
+
}
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<div
|
|
64
|
+
role="radiogroup"
|
|
65
|
+
aria-label={label}
|
|
66
|
+
onkeydown={onKeydown}
|
|
67
|
+
class="inline-flex items-center gap-1 rounded-lg border border-hairline bg-bg-inset p-1
|
|
68
|
+
{fullWidth ? 'flex w-full *:flex-1' : ''}
|
|
69
|
+
{disabled ? 'pointer-events-none opacity-50' : ''} {className}"
|
|
70
|
+
{...rest}
|
|
71
|
+
>
|
|
72
|
+
{#each options as option (option.value)}
|
|
73
|
+
<button
|
|
74
|
+
type="button"
|
|
75
|
+
role="radio"
|
|
76
|
+
aria-checked={value === option.value}
|
|
77
|
+
disabled={option.disabled || disabled}
|
|
78
|
+
tabindex={value === option.value ? 0 : -1}
|
|
79
|
+
onclick={() => select(option)}
|
|
80
|
+
class="inline-flex items-center justify-center rounded-md font-sans font-medium whitespace-nowrap transition-all duration-150 ease-brand-out disabled:pointer-events-none disabled:opacity-40
|
|
81
|
+
{sizes[size]} {focusRing} {toneRing[tone]}
|
|
82
|
+
{value === option.value ? 'bg-bg text-text shadow-xs' : 'text-text-muted hover:text-text'}"
|
|
83
|
+
>
|
|
84
|
+
{option.label}
|
|
85
|
+
</button>
|
|
86
|
+
{/each}
|
|
87
|
+
{#if name}<input type="hidden" {name} {value} />{/if}
|
|
88
|
+
</div>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import { type Tone } from '../../core/tones.js';
|
|
3
|
+
export interface SegmentOption {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export type SegmentedSize = 'sm' | 'md';
|
|
9
|
+
interface Props extends Omit<HTMLAttributes<HTMLDivElement>, 'onchange'> {
|
|
10
|
+
/** Bindable — the selected option's `value`. */
|
|
11
|
+
value?: string;
|
|
12
|
+
options: SegmentOption[];
|
|
13
|
+
/** Submits with a form when set. */
|
|
14
|
+
name?: string;
|
|
15
|
+
size?: SegmentedSize;
|
|
16
|
+
tone?: Tone;
|
|
17
|
+
/** Spread the segments evenly across the full width. */
|
|
18
|
+
fullWidth?: boolean;
|
|
19
|
+
label?: string;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
onchange?: (value: string) => void;
|
|
22
|
+
}
|
|
23
|
+
declare const SegmentedControl: import("svelte").Component<Props, {}, "value">;
|
|
24
|
+
type SegmentedControl = ReturnType<typeof SegmentedControl>;
|
|
25
|
+
export default SegmentedControl;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLSelectAttributes } from 'svelte/elements';
|
|
4
|
+
import { toneFocusBorder, type Tone } from '../../core/tones.js';
|
|
5
|
+
|
|
6
|
+
export interface SelectOption {
|
|
7
|
+
value: string;
|
|
8
|
+
label: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface Props extends HTMLSelectAttributes {
|
|
13
|
+
value?: string;
|
|
14
|
+
/** Data-driven options. Omit and pass `children` to write `<option>`s yourself. */
|
|
15
|
+
options?: SelectOption[];
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
tone?: Tone;
|
|
18
|
+
invalid?: boolean;
|
|
19
|
+
children?: Snippet;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let {
|
|
23
|
+
value = $bindable(''),
|
|
24
|
+
options,
|
|
25
|
+
placeholder,
|
|
26
|
+
tone = 'brand',
|
|
27
|
+
invalid = false,
|
|
28
|
+
class: className = '',
|
|
29
|
+
children,
|
|
30
|
+
...rest
|
|
31
|
+
}: Props = $props();
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<span class="relative inline-flex w-full items-center">
|
|
35
|
+
<select
|
|
36
|
+
bind:value
|
|
37
|
+
aria-invalid={invalid ? 'true' : undefined}
|
|
38
|
+
class="h-10 w-full appearance-none rounded-md border bg-bg py-0 pr-9 pl-3 font-sans text-sm text-text shadow-xs transition-colors duration-150 ease-brand-out focus:outline-none disabled:pointer-events-none disabled:opacity-50
|
|
39
|
+
{invalid ? 'border-danger' : `border-hairline-strong ${toneFocusBorder[tone]}`} {className}"
|
|
40
|
+
{...rest}
|
|
41
|
+
>
|
|
42
|
+
{#if placeholder}
|
|
43
|
+
<option value="" disabled>{placeholder}</option>
|
|
44
|
+
{/if}
|
|
45
|
+
{#if options}
|
|
46
|
+
{#each options as option (option.value)}
|
|
47
|
+
<option value={option.value} disabled={option.disabled}>{option.label}</option>
|
|
48
|
+
{/each}
|
|
49
|
+
{:else if children}
|
|
50
|
+
{@render children()}
|
|
51
|
+
{/if}
|
|
52
|
+
</select>
|
|
53
|
+
<svg
|
|
54
|
+
class="pointer-events-none absolute right-3 size-4 text-text-muted"
|
|
55
|
+
viewBox="0 0 16 16"
|
|
56
|
+
fill="none"
|
|
57
|
+
aria-hidden="true"
|
|
58
|
+
>
|
|
59
|
+
<path d="m4 6 4 4 4-4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
|
|
60
|
+
</svg>
|
|
61
|
+
</span>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLSelectAttributes } from 'svelte/elements';
|
|
3
|
+
import { type Tone } from '../../core/tones.js';
|
|
4
|
+
export interface SelectOption {
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface Props extends HTMLSelectAttributes {
|
|
10
|
+
value?: string;
|
|
11
|
+
/** Data-driven options. Omit and pass `children` to write `<option>`s yourself. */
|
|
12
|
+
options?: SelectOption[];
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
tone?: Tone;
|
|
15
|
+
invalid?: boolean;
|
|
16
|
+
children?: Snippet;
|
|
17
|
+
}
|
|
18
|
+
declare const Select: import("svelte").Component<Props, {}, "value">;
|
|
19
|
+
type Select = ReturnType<typeof Select>;
|
|
20
|
+
export default Select;
|