@loidolt/theme-svelte 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.
Files changed (85) hide show
  1. package/LICENSE +21 -0
  2. package/dist/components/Alert.svelte +36 -0
  3. package/dist/components/Alert.svelte.d.ts +15 -0
  4. package/dist/components/AppShell.svelte +31 -0
  5. package/dist/components/AppShell.svelte.d.ts +14 -0
  6. package/dist/components/Badge.svelte +27 -0
  7. package/dist/components/Badge.svelte.d.ts +12 -0
  8. package/dist/components/Brand.svelte +35 -0
  9. package/dist/components/Brand.svelte.d.ts +15 -0
  10. package/dist/components/Button.svelte +85 -0
  11. package/dist/components/Button.svelte.d.ts +21 -0
  12. package/dist/components/Card.svelte +43 -0
  13. package/dist/components/Card.svelte.d.ts +18 -0
  14. package/dist/components/Checkbox.svelte +54 -0
  15. package/dist/components/Checkbox.svelte.d.ts +21 -0
  16. package/dist/components/ContextBar.svelte +33 -0
  17. package/dist/components/ContextBar.svelte.d.ts +13 -0
  18. package/dist/components/Dialog.svelte +84 -0
  19. package/dist/components/Dialog.svelte.d.ts +28 -0
  20. package/dist/components/DropdownMenu.svelte +99 -0
  21. package/dist/components/DropdownMenu.svelte.d.ts +47 -0
  22. package/dist/components/Field.svelte +52 -0
  23. package/dist/components/Field.svelte.d.ts +24 -0
  24. package/dist/components/IconButton.svelte +43 -0
  25. package/dist/components/IconButton.svelte.d.ts +16 -0
  26. package/dist/components/Input.svelte +27 -0
  27. package/dist/components/Input.svelte.d.ts +11 -0
  28. package/dist/components/Label.svelte +24 -0
  29. package/dist/components/Label.svelte.d.ts +11 -0
  30. package/dist/components/NavMenu.svelte +62 -0
  31. package/dist/components/NavMenu.svelte.d.ts +43 -0
  32. package/dist/components/NumberField.svelte +78 -0
  33. package/dist/components/NumberField.svelte.d.ts +21 -0
  34. package/dist/components/PageHeader.svelte +37 -0
  35. package/dist/components/PageHeader.svelte.d.ts +15 -0
  36. package/dist/components/Panel.svelte +38 -0
  37. package/dist/components/Panel.svelte.d.ts +15 -0
  38. package/dist/components/Popover.svelte +58 -0
  39. package/dist/components/Popover.svelte.d.ts +21 -0
  40. package/dist/components/Progress.svelte +43 -0
  41. package/dist/components/Progress.svelte.d.ts +12 -0
  42. package/dist/components/RadioGroup.svelte +49 -0
  43. package/dist/components/RadioGroup.svelte.d.ts +37 -0
  44. package/dist/components/Section.svelte +39 -0
  45. package/dist/components/Section.svelte.d.ts +15 -0
  46. package/dist/components/Select.svelte +57 -0
  47. package/dist/components/Select.svelte.d.ts +41 -0
  48. package/dist/components/Separator.svelte +29 -0
  49. package/dist/components/Separator.svelte.d.ts +10 -0
  50. package/dist/components/Sidebar.svelte +35 -0
  51. package/dist/components/Sidebar.svelte.d.ts +16 -0
  52. package/dist/components/Skeleton.svelte +26 -0
  53. package/dist/components/Skeleton.svelte.d.ts +11 -0
  54. package/dist/components/Spinner.svelte +22 -0
  55. package/dist/components/Spinner.svelte.d.ts +10 -0
  56. package/dist/components/Switch.svelte +62 -0
  57. package/dist/components/Switch.svelte.d.ts +17 -0
  58. package/dist/components/Table.svelte +43 -0
  59. package/dist/components/Table.svelte.d.ts +17 -0
  60. package/dist/components/Tabs.svelte +63 -0
  61. package/dist/components/Tabs.svelte.d.ts +41 -0
  62. package/dist/components/Textarea.svelte +27 -0
  63. package/dist/components/Textarea.svelte.d.ts +11 -0
  64. package/dist/components/Toast.svelte +53 -0
  65. package/dist/components/Toast.svelte.d.ts +16 -0
  66. package/dist/components/ToastViewport.svelte +38 -0
  67. package/dist/components/ToastViewport.svelte.d.ts +13 -0
  68. package/dist/components/Tooltip.svelte +76 -0
  69. package/dist/components/Tooltip.svelte.d.ts +28 -0
  70. package/dist/components/TooltipProvider.svelte +33 -0
  71. package/dist/components/TooltipProvider.svelte.d.ts +14 -0
  72. package/dist/components/Topbar.svelte +32 -0
  73. package/dist/components/Topbar.svelte.d.ts +14 -0
  74. package/dist/components/Workspace.svelte +38 -0
  75. package/dist/components/Workspace.svelte.d.ts +12 -0
  76. package/dist/index.d.ts +46 -0
  77. package/dist/index.js +44 -0
  78. package/dist/styles.css +1 -0
  79. package/dist/toaster.svelte.d.ts +43 -0
  80. package/dist/toaster.svelte.js +82 -0
  81. package/dist/types.d.ts +39 -0
  82. package/dist/types.js +1 -0
  83. package/dist/utils.d.ts +5 -0
  84. package/dist/utils.js +7 -0
  85. package/package.json +66 -0
@@ -0,0 +1,99 @@
1
+ <script lang="ts" generics="T extends string = string">
2
+ import { DropdownMenu as MenuPrimitive } from 'bits-ui';
3
+ import type { Snippet } from 'svelte';
4
+ import type { DropdownMenuContentProps } from 'bits-ui';
5
+ import type { Alignment, MenuItem, Placement, TriggerChildProps } from '../types.js';
6
+ import { cx } from '../utils.js';
7
+
8
+ type Props = Omit<DropdownMenuContentProps, 'children' | 'class' | 'child'> & {
9
+ open?: boolean;
10
+ /** Heading rendered above `items`, associated with them via a menu group. */
11
+ groupLabel?: string;
12
+ trigger?: Snippet;
13
+ /** Full control of the trigger element — receives the props Bits needs on it. */
14
+ triggerChild?: Snippet<[TriggerChildProps]>;
15
+ triggerClass?: string;
16
+ /** Declarative rows. Ignored when `children` is provided. */
17
+ items?: MenuItem<T>[];
18
+ /** Escape hatch: compose the menu body yourself from the re-exported primitives. */
19
+ children?: Snippet;
20
+ side?: Placement;
21
+ align?: Alignment;
22
+ sideOffset?: number;
23
+ /** `class` lands on the portaled Content element. */
24
+ class?: string;
25
+ onSelect?: (value: T) => void;
26
+ onOpenChange?: (open: boolean) => void;
27
+ ref?: HTMLElement | null;
28
+ };
29
+
30
+ let {
31
+ open = $bindable(false),
32
+ groupLabel,
33
+ trigger,
34
+ triggerChild,
35
+ triggerClass = 'ldt-button ldt-button--quiet',
36
+ items = [],
37
+ children,
38
+ side = 'bottom',
39
+ align = 'start',
40
+ sideOffset = 6,
41
+ class: className,
42
+ onSelect,
43
+ onOpenChange,
44
+ ref = $bindable(null),
45
+ ...rest
46
+ }: Props = $props();
47
+ </script>
48
+
49
+ {#snippet rows()}
50
+ {#each items as item (item.value)}
51
+ {#if item.separatorBefore}<MenuPrimitive.Separator class="ldt-menu__separator" />{/if}
52
+ <MenuPrimitive.Item
53
+ class="ldt-menu__item"
54
+ disabled={item.disabled}
55
+ onSelect={() => onSelect?.(item.value)}
56
+ >
57
+ {#snippet child({ props })}
58
+ {#if item.href}
59
+ <a {...props} href={item.href}
60
+ >{#if item.icon}{@render item.icon()}{/if}<span>{item.label}</span>{#if item.hint}<span
61
+ aria-hidden="true">{item.hint}</span
62
+ >{/if}</a
63
+ >
64
+ {:else}
65
+ <button {...props} type="button"
66
+ >{#if item.icon}{@render item.icon()}{/if}<span>{item.label}</span>{#if item.hint}<span
67
+ aria-hidden="true">{item.hint}</span
68
+ >{/if}</button
69
+ >
70
+ {/if}
71
+ {/snippet}
72
+ </MenuPrimitive.Item>
73
+ {/each}
74
+ {/snippet}
75
+
76
+ <MenuPrimitive.Root bind:open {onOpenChange}>
77
+ {#if triggerChild}<MenuPrimitive.Trigger
78
+ >{#snippet child(childProps)}{@render triggerChild(
79
+ childProps
80
+ )}{/snippet}</MenuPrimitive.Trigger
81
+ >{:else if trigger}<MenuPrimitive.Trigger class={triggerClass}
82
+ >{@render trigger()}</MenuPrimitive.Trigger
83
+ >{/if}
84
+ <MenuPrimitive.Portal
85
+ ><MenuPrimitive.Content
86
+ bind:ref
87
+ {side}
88
+ {align}
89
+ {sideOffset}
90
+ class={cx('ldt-menu', className)}
91
+ {...rest}
92
+ >{#if children}{@render children()}{:else if groupLabel}<MenuPrimitive.Group
93
+ ><MenuPrimitive.GroupHeading class="ldt-menu__label"
94
+ >{groupLabel}</MenuPrimitive.GroupHeading
95
+ >{@render rows()}</MenuPrimitive.Group
96
+ >{:else}{@render rows()}{/if}</MenuPrimitive.Content
97
+ ></MenuPrimitive.Portal
98
+ >
99
+ </MenuPrimitive.Root>
@@ -0,0 +1,47 @@
1
+ import { DropdownMenu as MenuPrimitive } from 'bits-ui';
2
+ import type { Snippet } from 'svelte';
3
+ import type { Alignment, MenuItem, Placement, TriggerChildProps } from '../types.js';
4
+ declare function $$render<T extends string = string>(): {
5
+ props: Omit<MenuPrimitive.ContentProps, "class" | "children" | "child"> & {
6
+ open?: boolean;
7
+ /** Heading rendered above `items`, associated with them via a menu group. */
8
+ groupLabel?: string;
9
+ trigger?: Snippet;
10
+ /** Full control of the trigger element — receives the props Bits needs on it. */
11
+ triggerChild?: Snippet<[TriggerChildProps]>;
12
+ triggerClass?: string;
13
+ /** Declarative rows. Ignored when `children` is provided. */
14
+ items?: MenuItem<T>[];
15
+ /** Escape hatch: compose the menu body yourself from the re-exported primitives. */
16
+ children?: Snippet;
17
+ side?: Placement;
18
+ align?: Alignment;
19
+ sideOffset?: number;
20
+ /** `class` lands on the portaled Content element. */
21
+ class?: string;
22
+ onSelect?: (value: T) => void;
23
+ onOpenChange?: (open: boolean) => void;
24
+ ref?: HTMLElement | null;
25
+ };
26
+ exports: {};
27
+ bindings: "ref" | "open";
28
+ slots: {};
29
+ events: {};
30
+ };
31
+ declare class __sveltets_Render<T extends string = string> {
32
+ props(): ReturnType<typeof $$render<T>>['props'];
33
+ events(): ReturnType<typeof $$render<T>>['events'];
34
+ slots(): ReturnType<typeof $$render<T>>['slots'];
35
+ bindings(): "ref" | "open";
36
+ exports(): {};
37
+ }
38
+ interface $$IsomorphicComponent {
39
+ new <T extends string = string>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
40
+ $$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
41
+ } & ReturnType<__sveltets_Render<T>['exports']>;
42
+ <T extends string = string>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
43
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
44
+ }
45
+ declare const DropdownMenu: $$IsomorphicComponent;
46
+ type DropdownMenu<T extends string = string> = InstanceType<typeof DropdownMenu<T>>;
47
+ export default DropdownMenu;
@@ -0,0 +1,52 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import type { HTMLAttributes } from 'svelte/elements';
4
+ import { cx } from '../utils.js';
5
+
6
+ // `children` is omitted from the base: this snippet takes the field's wiring as an argument.
7
+ interface Props extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
8
+ /** Defaults to an SSR-stable generated id shared by the label and the control. */
9
+ id?: string;
10
+ /** Visible label text. */
11
+ label: string;
12
+ description?: string;
13
+ error?: string;
14
+ optional?: boolean;
15
+ /** Text of the "optional" marker, for localisation. */
16
+ optionalText?: string;
17
+ class?: string;
18
+ /** Receives the wiring the control needs: `id`, `aria-describedby`, and validity. */
19
+ children: Snippet<[{ id: string; describedBy?: string; invalid: boolean }]>;
20
+ ref?: HTMLDivElement | null;
21
+ }
22
+
23
+ // `$props.id()` is stable across SSR and hydration; `Math.random()` was not.
24
+ const generatedId = $props.id();
25
+
26
+ let {
27
+ id = generatedId,
28
+ label,
29
+ description,
30
+ error,
31
+ optional = false,
32
+ optionalText = 'Optional',
33
+ class: className,
34
+ children,
35
+ ref = $bindable(null),
36
+ ...rest
37
+ }: Props = $props();
38
+
39
+ const describedBy = $derived(
40
+ [description && `${id}-description`, error && `${id}-error`].filter(Boolean).join(' ') ||
41
+ undefined
42
+ );
43
+ </script>
44
+
45
+ <div bind:this={ref} class={cx('ldt-field', className)} {...rest}>
46
+ <label class="ldt-field__label" for={id}
47
+ ><span>{label}</span>{#if optional}<small>{optionalText}</small>{/if}</label
48
+ >
49
+ {@render children({ id, describedBy, invalid: Boolean(error) })}
50
+ {#if description}<p class="ldt-field__description" id={`${id}-description`}>{description}</p>{/if}
51
+ {#if error}<p class="ldt-field__error" id={`${id}-error`} role="alert">{error}</p>{/if}
52
+ </div>
@@ -0,0 +1,24 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ interface Props extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
4
+ /** Defaults to an SSR-stable generated id shared by the label and the control. */
5
+ id?: string;
6
+ /** Visible label text. */
7
+ label: string;
8
+ description?: string;
9
+ error?: string;
10
+ optional?: boolean;
11
+ /** Text of the "optional" marker, for localisation. */
12
+ optionalText?: string;
13
+ class?: string;
14
+ /** Receives the wiring the control needs: `id`, `aria-describedby`, and validity. */
15
+ children: Snippet<[{
16
+ id: string;
17
+ describedBy?: string;
18
+ invalid: boolean;
19
+ }]>;
20
+ ref?: HTMLDivElement | null;
21
+ }
22
+ declare const Field: import("svelte").Component<Props, {}, "ref">;
23
+ type Field = ReturnType<typeof Field>;
24
+ export default Field;
@@ -0,0 +1,43 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import type { HTMLButtonAttributes } from 'svelte/elements';
4
+ import type { ActionVariant, ControlSize } from '../types.js';
5
+ import { cx } from '../utils.js';
6
+
7
+ interface Props extends HTMLButtonAttributes {
8
+ /** Accessible name for the icon-only control. Required — there is no visible text. */
9
+ label: string;
10
+ variant?: ActionVariant;
11
+ size?: ControlSize;
12
+ disabled?: boolean;
13
+ class?: string;
14
+ children: Snippet;
15
+ ref?: HTMLButtonElement | null;
16
+ }
17
+
18
+ let {
19
+ label,
20
+ variant = 'ghost',
21
+ size = 'md',
22
+ disabled = false,
23
+ type = 'button',
24
+ class: className,
25
+ children,
26
+ ref = $bindable(null),
27
+ ...rest
28
+ }: Props = $props();
29
+ </script>
30
+
31
+ <button
32
+ bind:this={ref}
33
+ {type}
34
+ {disabled}
35
+ class={cx(
36
+ 'ldt-button ldt-icon-button',
37
+ `ldt-button--${variant}`,
38
+ size !== 'md' && `ldt-button--${size}`,
39
+ className
40
+ )}
41
+ aria-label={label}
42
+ {...rest}>{@render children()}</button
43
+ >
@@ -0,0 +1,16 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLButtonAttributes } from 'svelte/elements';
3
+ import type { ActionVariant, ControlSize } from '../types.js';
4
+ interface Props extends HTMLButtonAttributes {
5
+ /** Accessible name for the icon-only control. Required — there is no visible text. */
6
+ label: string;
7
+ variant?: ActionVariant;
8
+ size?: ControlSize;
9
+ disabled?: boolean;
10
+ class?: string;
11
+ children: Snippet;
12
+ ref?: HTMLButtonElement | null;
13
+ }
14
+ declare const IconButton: import("svelte").Component<Props, {}, "ref">;
15
+ type IconButton = ReturnType<typeof IconButton>;
16
+ export default IconButton;
@@ -0,0 +1,27 @@
1
+ <script lang="ts">
2
+ import type { HTMLInputAttributes } from 'svelte/elements';
3
+ import { cx } from '../utils.js';
4
+
5
+ interface Props extends Omit<HTMLInputAttributes, 'value'> {
6
+ value?: string;
7
+ /** Draws the full box instead of the default underline. */
8
+ boxed?: boolean;
9
+ class?: string;
10
+ ref?: HTMLInputElement | null;
11
+ }
12
+
13
+ let {
14
+ value = $bindable(''),
15
+ boxed = false,
16
+ class: className,
17
+ ref = $bindable(null),
18
+ ...rest
19
+ }: Props = $props();
20
+ </script>
21
+
22
+ <input
23
+ bind:this={ref}
24
+ bind:value
25
+ class={cx('ldt-input', boxed && 'ldt-input--boxed', className)}
26
+ {...rest}
27
+ />
@@ -0,0 +1,11 @@
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
+ interface Props extends Omit<HTMLInputAttributes, 'value'> {
3
+ value?: string;
4
+ /** Draws the full box instead of the default underline. */
5
+ boxed?: boolean;
6
+ class?: string;
7
+ ref?: HTMLInputElement | null;
8
+ }
9
+ declare const Input: import("svelte").Component<Props, {}, "ref" | "value">;
10
+ type Input = ReturnType<typeof Input>;
11
+ export default Input;
@@ -0,0 +1,24 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import type { HTMLLabelAttributes } from 'svelte/elements';
4
+ import { cx } from '../utils.js';
5
+
6
+ interface Props extends HTMLLabelAttributes {
7
+ for?: string;
8
+ class?: string;
9
+ children: Snippet;
10
+ ref?: HTMLLabelElement | null;
11
+ }
12
+
13
+ let {
14
+ for: htmlFor,
15
+ class: className,
16
+ children,
17
+ ref = $bindable(null),
18
+ ...rest
19
+ }: Props = $props();
20
+ </script>
21
+
22
+ <label bind:this={ref} for={htmlFor} class={cx('ldt-label', className)} {...rest}
23
+ >{@render children()}</label
24
+ >
@@ -0,0 +1,11 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLLabelAttributes } from 'svelte/elements';
3
+ interface Props extends HTMLLabelAttributes {
4
+ for?: string;
5
+ class?: string;
6
+ children: Snippet;
7
+ ref?: HTMLLabelElement | null;
8
+ }
9
+ declare const Label: import("svelte").Component<Props, {}, "ref">;
10
+ type Label = ReturnType<typeof Label>;
11
+ export default Label;
@@ -0,0 +1,62 @@
1
+ <script lang="ts" generics="T extends string = string">
2
+ import type { Snippet } from 'svelte';
3
+ import DropdownMenu from './DropdownMenu.svelte';
4
+ import type { Alignment, MenuItem, Placement } from '../types.js';
5
+ import { cx } from '../utils.js';
6
+
7
+ interface Props {
8
+ open?: boolean;
9
+ /** Trigger text. */
10
+ label: string;
11
+ /** Heading above the items inside the popup. */
12
+ groupLabel?: string;
13
+ items?: MenuItem<T>[];
14
+ children?: Snippet;
15
+ /** Marks this entry as the current section: styles the trigger and sets `aria-current`. */
16
+ active?: boolean;
17
+ side?: Placement;
18
+ align?: Alignment;
19
+ /** `class` lands on the trigger; use `menuClass` for the popup. */
20
+ class?: string;
21
+ menuClass?: string;
22
+ onSelect?: (value: T) => void;
23
+ onOpenChange?: (open: boolean) => void;
24
+ }
25
+
26
+ let {
27
+ open = $bindable(false),
28
+ label,
29
+ groupLabel,
30
+ items,
31
+ children,
32
+ active = false,
33
+ side,
34
+ align,
35
+ class: className,
36
+ menuClass,
37
+ onSelect,
38
+ onOpenChange,
39
+ }: Props = $props();
40
+ </script>
41
+
42
+ {#snippet navTrigger({ props }: { props: Record<string, unknown> })}
43
+ <button
44
+ {...props}
45
+ type="button"
46
+ class={cx('ldt-nav-menu', active && 'ldt-nav-menu--active', className)}
47
+ aria-current={active ? 'page' : undefined}>{label} <span aria-hidden="true">⌄</span></button
48
+ >
49
+ {/snippet}
50
+
51
+ <DropdownMenu
52
+ bind:open
53
+ {items}
54
+ {groupLabel}
55
+ {children}
56
+ {side}
57
+ {align}
58
+ {onSelect}
59
+ {onOpenChange}
60
+ triggerChild={navTrigger}
61
+ class={menuClass}
62
+ />
@@ -0,0 +1,43 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { Alignment, MenuItem, Placement } from '../types.js';
3
+ declare function $$render<T extends string = string>(): {
4
+ props: {
5
+ open?: boolean;
6
+ /** Trigger text. */
7
+ label: string;
8
+ /** Heading above the items inside the popup. */
9
+ groupLabel?: string;
10
+ items?: MenuItem<T>[];
11
+ children?: Snippet;
12
+ /** Marks this entry as the current section: styles the trigger and sets `aria-current`. */
13
+ active?: boolean;
14
+ side?: Placement;
15
+ align?: Alignment;
16
+ /** `class` lands on the trigger; use `menuClass` for the popup. */
17
+ class?: string;
18
+ menuClass?: string;
19
+ onSelect?: (value: T) => void;
20
+ onOpenChange?: (open: boolean) => void;
21
+ };
22
+ exports: {};
23
+ bindings: "open";
24
+ slots: {};
25
+ events: {};
26
+ };
27
+ declare class __sveltets_Render<T extends string = string> {
28
+ props(): ReturnType<typeof $$render<T>>['props'];
29
+ events(): ReturnType<typeof $$render<T>>['events'];
30
+ slots(): ReturnType<typeof $$render<T>>['slots'];
31
+ bindings(): "open";
32
+ exports(): {};
33
+ }
34
+ interface $$IsomorphicComponent {
35
+ new <T extends string = string>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
36
+ $$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
37
+ } & ReturnType<__sveltets_Render<T>['exports']>;
38
+ <T extends string = string>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
39
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
40
+ }
41
+ declare const NavMenu: $$IsomorphicComponent;
42
+ type NavMenu<T extends string = string> = InstanceType<typeof NavMenu<T>>;
43
+ export default NavMenu;
@@ -0,0 +1,78 @@
1
+ <script lang="ts">
2
+ import type { HTMLInputAttributes } from 'svelte/elements';
3
+ import { cx } from '../utils.js';
4
+
5
+ interface Props extends Omit<HTMLInputAttributes, 'type' | 'value' | 'min' | 'max' | 'step'> {
6
+ value?: number;
7
+ min?: number;
8
+ max?: number;
9
+ step?: number;
10
+ /** Accessible name of the field; also used to name the two spin buttons. */
11
+ label: string;
12
+ decrementLabel?: (label: string) => string;
13
+ incrementLabel?: (label: string) => string;
14
+ /** Draws the full box instead of the default underline. */
15
+ boxed?: boolean;
16
+ onValueChange?: (value: number) => void;
17
+ /** `class` lands on the wrapper; use `inputClass` to reach the input. */
18
+ class?: string;
19
+ inputClass?: string;
20
+ ref?: HTMLInputElement | null;
21
+ }
22
+
23
+ let {
24
+ value = $bindable(0),
25
+ min = -Infinity,
26
+ max = Infinity,
27
+ step = 1,
28
+ label,
29
+ decrementLabel = (name) => `Decrease ${name}`,
30
+ incrementLabel = (name) => `Increase ${name}`,
31
+ boxed = false,
32
+ onValueChange,
33
+ class: className,
34
+ inputClass,
35
+ ref = $bindable(null),
36
+ ...rest
37
+ }: Props = $props();
38
+
39
+ /** Clearing the input yields `NaN`; fall back to the low bound rather than wedging the field. */
40
+ const fallback = $derived(Number.isFinite(min) ? min : 0);
41
+
42
+ const atMin = $derived(value <= min);
43
+ const atMax = $derived(value >= max);
44
+
45
+ function set(next: number) {
46
+ value = Number.isFinite(next) ? Math.min(max, Math.max(min, next)) : fallback;
47
+ onValueChange?.(value);
48
+ }
49
+ </script>
50
+
51
+ <div class={cx('ldt-number-field', boxed && 'ldt-number-field--boxed', className)}>
52
+ <button
53
+ class="ldt-number-field__button"
54
+ type="button"
55
+ aria-label={decrementLabel(label)}
56
+ aria-disabled={atMin || undefined}
57
+ onclick={() => !atMin && set(value - step)}>−</button
58
+ >
59
+ <input
60
+ bind:this={ref}
61
+ class={cx('ldt-number-field__input', inputClass)}
62
+ type="number"
63
+ bind:value
64
+ min={Number.isFinite(min) ? min : undefined}
65
+ max={Number.isFinite(max) ? max : undefined}
66
+ {step}
67
+ aria-label={label}
68
+ {...rest}
69
+ onchange={(event) => set(Number(event.currentTarget.value))}
70
+ />
71
+ <button
72
+ class="ldt-number-field__button"
73
+ type="button"
74
+ aria-label={incrementLabel(label)}
75
+ aria-disabled={atMax || undefined}
76
+ onclick={() => !atMax && set(value + step)}>+</button
77
+ >
78
+ </div>
@@ -0,0 +1,21 @@
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
+ interface Props extends Omit<HTMLInputAttributes, 'type' | 'value' | 'min' | 'max' | 'step'> {
3
+ value?: number;
4
+ min?: number;
5
+ max?: number;
6
+ step?: number;
7
+ /** Accessible name of the field; also used to name the two spin buttons. */
8
+ label: string;
9
+ decrementLabel?: (label: string) => string;
10
+ incrementLabel?: (label: string) => string;
11
+ /** Draws the full box instead of the default underline. */
12
+ boxed?: boolean;
13
+ onValueChange?: (value: number) => void;
14
+ /** `class` lands on the wrapper; use `inputClass` to reach the input. */
15
+ class?: string;
16
+ inputClass?: string;
17
+ ref?: HTMLInputElement | null;
18
+ }
19
+ declare const NumberField: import("svelte").Component<Props, {}, "ref" | "value">;
20
+ type NumberField = ReturnType<typeof NumberField>;
21
+ export default NumberField;
@@ -0,0 +1,37 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import type { HTMLAttributes } from 'svelte/elements';
4
+ import type { HeadingLevel } from '../types.js';
5
+ import { cx } from '../utils.js';
6
+
7
+ interface Props extends HTMLAttributes<HTMLElement> {
8
+ eyebrow?: string;
9
+ title: string;
10
+ description?: string;
11
+ actions?: Snippet;
12
+ headingLevel?: HeadingLevel;
13
+ class?: string;
14
+ ref?: HTMLElement | null;
15
+ }
16
+
17
+ let {
18
+ eyebrow,
19
+ title,
20
+ description,
21
+ actions,
22
+ headingLevel = 1,
23
+ class: className,
24
+ ref = $bindable(null),
25
+ ...rest
26
+ }: Props = $props();
27
+ </script>
28
+
29
+ <header bind:this={ref} class={cx('ldt-page-header', className)} {...rest}>
30
+ <div>
31
+ {#if eyebrow}<p class="ldt-eyebrow">{eyebrow}</p>{/if}
32
+ <svelte:element this={`h${headingLevel}`} class="ldt-page-header__title">{title}</svelte:element
33
+ >
34
+ {#if description}<p class="ldt-page-header__description">{description}</p>{/if}
35
+ </div>
36
+ {#if actions}<div class="ldt-cluster">{@render actions()}</div>{/if}
37
+ </header>
@@ -0,0 +1,15 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import type { HeadingLevel } from '../types.js';
4
+ interface Props extends HTMLAttributes<HTMLElement> {
5
+ eyebrow?: string;
6
+ title: string;
7
+ description?: string;
8
+ actions?: Snippet;
9
+ headingLevel?: HeadingLevel;
10
+ class?: string;
11
+ ref?: HTMLElement | null;
12
+ }
13
+ declare const PageHeader: import("svelte").Component<Props, {}, "ref">;
14
+ type PageHeader = ReturnType<typeof PageHeader>;
15
+ export default PageHeader;
@@ -0,0 +1,38 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import type { HTMLAttributes } from 'svelte/elements';
4
+ import type { HeadingLevel } from '../types.js';
5
+ import { cx } from '../utils.js';
6
+
7
+ interface Props extends HTMLAttributes<HTMLElement> {
8
+ title?: string;
9
+ header?: Snippet;
10
+ children: Snippet;
11
+ footer?: Snippet;
12
+ headingLevel?: HeadingLevel;
13
+ class?: string;
14
+ ref?: HTMLElement | null;
15
+ }
16
+
17
+ let {
18
+ title,
19
+ header,
20
+ children,
21
+ footer,
22
+ headingLevel = 2,
23
+ class: className,
24
+ ref = $bindable(null),
25
+ ...rest
26
+ }: Props = $props();
27
+ </script>
28
+
29
+ <section bind:this={ref} class={cx('ldt-panel', className)} {...rest}>
30
+ {#if header || title}<header class="ldt-panel__header">
31
+ {#if header}{@render header()}{:else}<svelte:element
32
+ this={`h${headingLevel}`}
33
+ class="ldt-panel__title">{title}</svelte:element
34
+ >{/if}
35
+ </header>{/if}
36
+ <div class="ldt-panel__content">{@render children()}</div>
37
+ {#if footer}<footer class="ldt-panel__footer">{@render footer()}</footer>{/if}
38
+ </section>