@loidolt/theme-svelte 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +21 -0
  2. package/dist/components/AlertDialog.svelte +24 -3
  3. package/dist/components/AlertDialog.svelte.d.ts +4 -1
  4. package/dist/components/AppShell.svelte +2 -1
  5. package/dist/components/AppShell.svelte.d.ts +1 -0
  6. package/dist/components/Card.svelte +23 -5
  7. package/dist/components/Card.svelte.d.ts +11 -4
  8. package/dist/components/CodeBlock.svelte +55 -0
  9. package/dist/components/CodeBlock.svelte.d.ts +14 -0
  10. package/dist/components/CommentList.svelte +67 -0
  11. package/dist/components/CommentList.svelte.d.ts +53 -0
  12. package/dist/components/Dialog.svelte +25 -3
  13. package/dist/components/Dialog.svelte.d.ts +4 -1
  14. package/dist/components/Drawer.svelte +18 -3
  15. package/dist/components/Drawer.svelte.d.ts +4 -1
  16. package/dist/components/FileInput.svelte +47 -0
  17. package/dist/components/FileInput.svelte.d.ts +15 -0
  18. package/dist/components/Filmstrip.svelte +72 -0
  19. package/dist/components/Filmstrip.svelte.d.ts +50 -0
  20. package/dist/components/FloatingBar.svelte +43 -0
  21. package/dist/components/FloatingBar.svelte.d.ts +16 -0
  22. package/dist/components/ListRow.svelte +50 -0
  23. package/dist/components/ListRow.svelte.d.ts +18 -0
  24. package/dist/components/Marker.svelte +38 -0
  25. package/dist/components/Marker.svelte.d.ts +14 -0
  26. package/dist/components/Popover.svelte +24 -3
  27. package/dist/components/Popover.svelte.d.ts +4 -1
  28. package/dist/components/RecordStepper.svelte +58 -0
  29. package/dist/components/RecordStepper.svelte.d.ts +18 -0
  30. package/dist/components/SegmentedNav.svelte +53 -0
  31. package/dist/components/SegmentedNav.svelte.d.ts +22 -0
  32. package/dist/components/Stat.svelte +41 -0
  33. package/dist/components/Stat.svelte.d.ts +17 -0
  34. package/dist/components/StatusDot.svelte +27 -0
  35. package/dist/components/StatusDot.svelte.d.ts +12 -0
  36. package/dist/components/SwatchGroup.svelte +69 -0
  37. package/dist/components/SwatchGroup.svelte.d.ts +44 -0
  38. package/dist/components/Switch.svelte +19 -0
  39. package/dist/components/Tabs.svelte +10 -0
  40. package/dist/components/ThemeToggle.svelte +102 -31
  41. package/dist/components/ThemeToggle.svelte.d.ts +5 -10
  42. package/dist/components/Thumbnail.svelte +51 -0
  43. package/dist/components/Thumbnail.svelte.d.ts +19 -0
  44. package/dist/components/Workspace.svelte +9 -1
  45. package/dist/components/Workspace.svelte.d.ts +4 -0
  46. package/dist/index.d.ts +13 -0
  47. package/dist/index.js +13 -0
  48. package/dist/theme.svelte.js +17 -7
  49. package/dist/toaster.svelte.d.ts +2 -0
  50. package/dist/toaster.svelte.js +30 -2
  51. package/package.json +8 -7
@@ -0,0 +1,72 @@
1
+ <script lang="ts" generics="T extends { id: string }">
2
+ import type { Snippet } from 'svelte';
3
+ import type { HTMLAttributes } from 'svelte/elements';
4
+ import type { Orientation } from '../types.js';
5
+ import { cx } from '../utils.js';
6
+
7
+ interface Props extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
8
+ items: T[];
9
+ selectedId?: string | null;
10
+ onSelect?: (id: string) => void;
11
+ /** Vertical rails flip horizontal on their own when the workspace container goes compact. */
12
+ orientation?: Orientation;
13
+ /** Accessible name of the listbox. */
14
+ label: string;
15
+ /** Thumbnail contents for one item; second argument is whether it is selected. */
16
+ item: Snippet<[T, boolean]>;
17
+ class?: string;
18
+ itemClass?: string;
19
+ ref?: HTMLDivElement | null;
20
+ }
21
+
22
+ let {
23
+ items,
24
+ selectedId = $bindable(null),
25
+ onSelect,
26
+ orientation = 'vertical',
27
+ label,
28
+ item,
29
+ class: className,
30
+ itemClass,
31
+ ref = $bindable(null),
32
+ ...rest
33
+ }: Props = $props();
34
+
35
+ let buttons = $state<Record<string, HTMLButtonElement | null>>({});
36
+
37
+ $effect(() => {
38
+ if (selectedId) {
39
+ buttons[selectedId]?.scrollIntoView({ block: 'nearest', inline: 'nearest' });
40
+ }
41
+ });
42
+
43
+ function select(id: string) {
44
+ selectedId = id;
45
+ onSelect?.(id);
46
+ }
47
+ </script>
48
+
49
+ <div
50
+ bind:this={ref}
51
+ class={cx(
52
+ 'ldt-filmstrip',
53
+ orientation === 'horizontal' && 'ldt-filmstrip--horizontal',
54
+ className
55
+ )}
56
+ role="listbox"
57
+ aria-label={label}
58
+ {...rest}
59
+ >
60
+ {#each items as entry (entry.id)}
61
+ <button
62
+ type="button"
63
+ class={cx('ldt-filmstrip__item', itemClass)}
64
+ role="option"
65
+ aria-selected={selectedId === entry.id}
66
+ bind:this={buttons[entry.id]}
67
+ onclick={() => select(entry.id)}
68
+ >
69
+ {@render item(entry, selectedId === entry.id)}
70
+ </button>
71
+ {/each}
72
+ </div>
@@ -0,0 +1,50 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import type { Orientation } from '../types.js';
4
+ declare function $$render<T extends {
5
+ id: string;
6
+ }>(): {
7
+ props: Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
8
+ items: T[];
9
+ selectedId?: string | null;
10
+ onSelect?: (id: string) => void;
11
+ /** Vertical rails flip horizontal on their own when the workspace container goes compact. */
12
+ orientation?: Orientation;
13
+ /** Accessible name of the listbox. */
14
+ label: string;
15
+ /** Thumbnail contents for one item; second argument is whether it is selected. */
16
+ item: Snippet<[T, boolean]>;
17
+ class?: string;
18
+ itemClass?: string;
19
+ ref?: HTMLDivElement | null;
20
+ };
21
+ exports: {};
22
+ bindings: "ref" | "selectedId";
23
+ slots: {};
24
+ events: {};
25
+ };
26
+ declare class __sveltets_Render<T extends {
27
+ id: string;
28
+ }> {
29
+ props(): ReturnType<typeof $$render<T>>['props'];
30
+ events(): ReturnType<typeof $$render<T>>['events'];
31
+ slots(): ReturnType<typeof $$render<T>>['slots'];
32
+ bindings(): "ref" | "selectedId";
33
+ exports(): {};
34
+ }
35
+ interface $$IsomorphicComponent {
36
+ new <T extends {
37
+ id: string;
38
+ }>(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']>> & {
39
+ $$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
40
+ } & ReturnType<__sveltets_Render<T>['exports']>;
41
+ <T extends {
42
+ id: string;
43
+ }>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
44
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
45
+ }
46
+ declare const Filmstrip: $$IsomorphicComponent;
47
+ type Filmstrip<T extends {
48
+ id: string;
49
+ }> = InstanceType<typeof Filmstrip<T>>;
50
+ export default Filmstrip;
@@ -0,0 +1,43 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import type { HTMLAttributes } from 'svelte/elements';
4
+ import type { Orientation } from '../types.js';
5
+ import { cx } from '../utils.js';
6
+
7
+ interface Props extends HTMLAttributes<HTMLDivElement> {
8
+ /** Corner of the nearest positioned ancestor to pin to. */
9
+ placement?: 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';
10
+ orientation?: Orientation;
11
+ /** Accessible name; renders `role="group"` when set. */
12
+ label?: string;
13
+ children: Snippet;
14
+ class?: string;
15
+ ref?: HTMLDivElement | null;
16
+ }
17
+
18
+ let {
19
+ placement = 'bottom-end',
20
+ orientation = 'horizontal',
21
+ label,
22
+ children,
23
+ class: className,
24
+ ref = $bindable(null),
25
+ ...rest
26
+ }: Props = $props();
27
+ </script>
28
+
29
+ <!-- The parent supplies position: relative — the bar is a pointer-events island over a stage. -->
30
+ <div
31
+ bind:this={ref}
32
+ class={cx(
33
+ 'ldt-floating-bar',
34
+ `ldt-floating-bar--${placement}`,
35
+ orientation === 'vertical' && 'ldt-floating-bar--vertical',
36
+ className
37
+ )}
38
+ role={label ? 'group' : undefined}
39
+ aria-label={label}
40
+ {...rest}
41
+ >
42
+ {@render children()}
43
+ </div>
@@ -0,0 +1,16 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import type { Orientation } from '../types.js';
4
+ interface Props extends HTMLAttributes<HTMLDivElement> {
5
+ /** Corner of the nearest positioned ancestor to pin to. */
6
+ placement?: 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';
7
+ orientation?: Orientation;
8
+ /** Accessible name; renders `role="group"` when set. */
9
+ label?: string;
10
+ children: Snippet;
11
+ class?: string;
12
+ ref?: HTMLDivElement | null;
13
+ }
14
+ declare const FloatingBar: import("svelte").Component<Props, {}, "ref">;
15
+ type FloatingBar = ReturnType<typeof FloatingBar>;
16
+ export default FloatingBar;
@@ -0,0 +1,50 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
4
+ import { cx } from '../utils.js';
5
+
6
+ interface CommonProps {
7
+ /** Highlighted as the current item: `aria-current` on links, `aria-pressed` on buttons. */
8
+ selected?: boolean;
9
+ class?: string;
10
+ children: Snippet;
11
+ ref?: HTMLAnchorElement | HTMLButtonElement | null;
12
+ }
13
+
14
+ // Same href rule as Button: with it an <a>, without it a <button>.
15
+ type Props = CommonProps &
16
+ (
17
+ | (Omit<HTMLAnchorAttributes, 'class' | 'type'> & { href: string; type?: never })
18
+ | (Omit<HTMLButtonAttributes, 'class'> & { href?: never })
19
+ );
20
+
21
+ let {
22
+ selected = false,
23
+ href,
24
+ type = 'button',
25
+ class: className,
26
+ children,
27
+ ref = $bindable(null),
28
+ ...rest
29
+ }: Props = $props();
30
+
31
+ const classes = $derived(cx('ldt-list-row', selected && 'ldt-list-row--selected', className));
32
+ </script>
33
+
34
+ {#if href}
35
+ <a
36
+ bind:this={ref}
37
+ {href}
38
+ class={classes}
39
+ aria-current={selected || undefined}
40
+ {...rest as HTMLAnchorAttributes}>{@render children()}</a
41
+ >
42
+ {:else}
43
+ <button
44
+ bind:this={ref}
45
+ {type}
46
+ class={classes}
47
+ aria-pressed={selected || undefined}
48
+ {...rest as HTMLButtonAttributes}>{@render children()}</button
49
+ >
50
+ {/if}
@@ -0,0 +1,18 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
3
+ interface CommonProps {
4
+ /** Highlighted as the current item: `aria-current` on links, `aria-pressed` on buttons. */
5
+ selected?: boolean;
6
+ class?: string;
7
+ children: Snippet;
8
+ ref?: HTMLAnchorElement | HTMLButtonElement | null;
9
+ }
10
+ type Props = CommonProps & ((Omit<HTMLAnchorAttributes, 'class' | 'type'> & {
11
+ href: string;
12
+ type?: never;
13
+ }) | (Omit<HTMLButtonAttributes, 'class'> & {
14
+ href?: never;
15
+ }));
16
+ declare const ListRow: import("svelte").Component<Props, {}, "ref">;
17
+ type ListRow = ReturnType<typeof ListRow>;
18
+ export default ListRow;
@@ -0,0 +1,38 @@
1
+ <script lang="ts">
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import { cx } from '../utils.js';
4
+
5
+ interface Props extends HTMLAttributes<HTMLSpanElement> {
6
+ number?: number;
7
+ /** `dot` sits in lists; `pin` is the teardrop that points at a spot on a canvas. */
8
+ shape?: 'dot' | 'pin';
9
+ active?: boolean;
10
+ /** Accessible name, e.g. "Comment 3". Omit when adjacent text already names it. */
11
+ label?: string;
12
+ class?: string;
13
+ ref?: HTMLSpanElement | null;
14
+ }
15
+
16
+ let {
17
+ number,
18
+ shape = 'dot',
19
+ active = false,
20
+ label,
21
+ class: className,
22
+ ref = $bindable(null),
23
+ ...rest
24
+ }: Props = $props();
25
+ </script>
26
+
27
+ <span
28
+ bind:this={ref}
29
+ class={cx(
30
+ 'ldt-marker',
31
+ shape === 'pin' && 'ldt-marker--pin',
32
+ active && 'ldt-marker--active',
33
+ className
34
+ )}
35
+ {...rest}
36
+ >{#if number !== undefined}{number}{/if}{#if label}<span class="ldt-sr-only">{label}</span
37
+ >{/if}</span
38
+ >
@@ -0,0 +1,14 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ interface Props extends HTMLAttributes<HTMLSpanElement> {
3
+ number?: number;
4
+ /** `dot` sits in lists; `pin` is the teardrop that points at a spot on a canvas. */
5
+ shape?: 'dot' | 'pin';
6
+ active?: boolean;
7
+ /** Accessible name, e.g. "Comment 3". Omit when adjacent text already names it. */
8
+ label?: string;
9
+ class?: string;
10
+ ref?: HTMLSpanElement | null;
11
+ }
12
+ declare const Marker: import("svelte").Component<Props, {}, "ref">;
13
+ type Marker = ReturnType<typeof Marker>;
14
+ export default Marker;
@@ -2,7 +2,13 @@
2
2
  import { Popover as PopoverPrimitive } from 'bits-ui';
3
3
  import type { Snippet } from 'svelte';
4
4
  import type { PopoverContentProps } from 'bits-ui';
5
- import type { Alignment, Placement, TriggerChildProps } from '../types.js';
5
+ import type {
6
+ ActionVariant,
7
+ Alignment,
8
+ ControlSize,
9
+ Placement,
10
+ TriggerChildProps,
11
+ } from '../types.js';
6
12
  import { cx } from '../utils.js';
7
13
 
8
14
  type Props = Omit<PopoverContentProps, 'children' | 'class' | 'child'> & {
@@ -10,6 +16,9 @@
10
16
  trigger?: Snippet;
11
17
  /** Full control of the trigger element — receives the props Bits needs on it. */
12
18
  triggerChild?: Snippet<[TriggerChildProps]>;
19
+ /** Button variant for the default trigger (`quiet` unless set). An explicit `triggerClass` wins wholesale. */
20
+ triggerVariant?: ActionVariant;
21
+ triggerSize?: ControlSize;
13
22
  triggerClass?: string;
14
23
  children: Snippet;
15
24
  side?: Placement;
@@ -25,7 +34,9 @@
25
34
  open = $bindable(false),
26
35
  trigger,
27
36
  triggerChild,
28
- triggerClass = 'ldt-button ldt-button--quiet',
37
+ triggerVariant,
38
+ triggerSize,
39
+ triggerClass,
29
40
  children,
30
41
  side = 'bottom',
31
42
  align = 'start',
@@ -35,6 +46,16 @@
35
46
  ref = $bindable(null),
36
47
  ...rest
37
48
  }: Props = $props();
49
+
50
+ // Popover's historical default trigger is the quiet button; an explicit triggerClass wins.
51
+ const triggerClasses = $derived(
52
+ triggerClass ??
53
+ cx(
54
+ 'ldt-button',
55
+ (triggerVariant ?? 'quiet') !== 'default' && `ldt-button--${triggerVariant ?? 'quiet'}`,
56
+ triggerSize && triggerSize !== 'md' && `ldt-button--${triggerSize}`
57
+ )
58
+ );
38
59
  </script>
39
60
 
40
61
  <PopoverPrimitive.Root bind:open {onOpenChange}>
@@ -42,7 +63,7 @@
42
63
  >{#snippet child(childProps)}{@render triggerChild(
43
64
  childProps
44
65
  )}{/snippet}</PopoverPrimitive.Trigger
45
- >{:else if trigger}<PopoverPrimitive.Trigger class={triggerClass}
66
+ >{:else if trigger}<PopoverPrimitive.Trigger class={triggerClasses}
46
67
  >{@render trigger()}</PopoverPrimitive.Trigger
47
68
  >{/if}
48
69
  <PopoverPrimitive.Portal
@@ -1,11 +1,14 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import type { PopoverContentProps } from 'bits-ui';
3
- import type { Alignment, Placement, TriggerChildProps } from '../types.js';
3
+ import type { ActionVariant, Alignment, ControlSize, Placement, TriggerChildProps } from '../types.js';
4
4
  type Props = Omit<PopoverContentProps, 'children' | 'class' | 'child'> & {
5
5
  open?: boolean;
6
6
  trigger?: Snippet;
7
7
  /** Full control of the trigger element — receives the props Bits needs on it. */
8
8
  triggerChild?: Snippet<[TriggerChildProps]>;
9
+ /** Button variant for the default trigger (`quiet` unless set). An explicit `triggerClass` wins wholesale. */
10
+ triggerVariant?: ActionVariant;
11
+ triggerSize?: ControlSize;
9
12
  triggerClass?: string;
10
13
  children: Snippet;
11
14
  side?: Placement;
@@ -0,0 +1,58 @@
1
+ <script lang="ts">
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import { cx } from '../utils.js';
4
+
5
+ interface Props extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
6
+ /** 0-based position in the set; `format` receives it 1-based. */
7
+ index: number;
8
+ total: number;
9
+ onPrevious?: () => void;
10
+ onNext?: () => void;
11
+ label?: string;
12
+ previousLabel?: string;
13
+ nextLabel?: string;
14
+ format?: (n: number, total: number) => string;
15
+ disabled?: boolean;
16
+ class?: string;
17
+ ref?: HTMLDivElement | null;
18
+ }
19
+
20
+ let {
21
+ index,
22
+ total,
23
+ onPrevious,
24
+ onNext,
25
+ label = 'Records',
26
+ previousLabel = 'Previous',
27
+ nextLabel = 'Next',
28
+ format = (n, t) => `${n} of ${t}`,
29
+ disabled = false,
30
+ class: className,
31
+ ref = $bindable(null),
32
+ ...rest
33
+ }: Props = $props();
34
+ </script>
35
+
36
+ <div
37
+ bind:this={ref}
38
+ class={cx('ldt-record-stepper', className)}
39
+ role="group"
40
+ aria-label={label}
41
+ {...rest}
42
+ >
43
+ <button
44
+ type="button"
45
+ class="ldt-button ldt-button--text ldt-button--sm"
46
+ disabled={disabled || index <= 0}
47
+ onclick={() => onPrevious?.()}>{previousLabel}</button
48
+ >
49
+ <span class="ldt-record-stepper__count ldt-utility-text" aria-live="polite"
50
+ >{format(index + 1, total)}</span
51
+ >
52
+ <button
53
+ type="button"
54
+ class="ldt-button ldt-button--text ldt-button--sm"
55
+ disabled={disabled || index >= total - 1}
56
+ onclick={() => onNext?.()}>{nextLabel}</button
57
+ >
58
+ </div>
@@ -0,0 +1,18 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ interface Props extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
3
+ /** 0-based position in the set; `format` receives it 1-based. */
4
+ index: number;
5
+ total: number;
6
+ onPrevious?: () => void;
7
+ onNext?: () => void;
8
+ label?: string;
9
+ previousLabel?: string;
10
+ nextLabel?: string;
11
+ format?: (n: number, total: number) => string;
12
+ disabled?: boolean;
13
+ class?: string;
14
+ ref?: HTMLDivElement | null;
15
+ }
16
+ declare const RecordStepper: import("svelte").Component<Props, {}, "ref">;
17
+ type RecordStepper = ReturnType<typeof RecordStepper>;
18
+ export default RecordStepper;
@@ -0,0 +1,53 @@
1
+ <script lang="ts">
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import type { ControlSize } from '../types.js';
4
+ import { cx } from '../utils.js';
5
+
6
+ interface SegmentedNavItem {
7
+ label: string;
8
+ href: string;
9
+ /** Marks the current page (`aria-current="page"`), which is also the pressed style. */
10
+ current?: boolean;
11
+ /** Small trailing annotation, e.g. "latest". */
12
+ hint?: string;
13
+ }
14
+
15
+ interface Props extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
16
+ items: SegmentedNavItem[];
17
+ /** Accessible name of the navigation region. */
18
+ label?: string;
19
+ size?: ControlSize;
20
+ class?: string;
21
+ itemClass?: string;
22
+ ref?: HTMLElement | null;
23
+ }
24
+
25
+ let {
26
+ items,
27
+ label = 'Sections',
28
+ size = 'md',
29
+ class: className,
30
+ itemClass,
31
+ ref = $bindable(null),
32
+ ...rest
33
+ }: Props = $props();
34
+ </script>
35
+
36
+ <!-- ToggleGroup's shape for navigation: options are real links, so open-in-new-tab and the
37
+ rotor both work — an anchor inside a radiogroup would surrender that. -->
38
+ <nav
39
+ bind:this={ref}
40
+ class={cx('ldt-segmented-nav', size !== 'md' && `ldt-toggle-group--${size}`, className)}
41
+ aria-label={label}
42
+ {...rest}
43
+ >
44
+ {#each items as item, index (index)}
45
+ <a
46
+ class={cx('ldt-toggle-group__item', itemClass)}
47
+ href={item.href}
48
+ aria-current={item.current ? 'page' : undefined}
49
+ >
50
+ {item.label}{#if item.hint}<span class="ldt-segmented-nav__hint">{item.hint}</span>{/if}
51
+ </a>
52
+ {/each}
53
+ </nav>
@@ -0,0 +1,22 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ import type { ControlSize } from '../types.js';
3
+ interface SegmentedNavItem {
4
+ label: string;
5
+ href: string;
6
+ /** Marks the current page (`aria-current="page"`), which is also the pressed style. */
7
+ current?: boolean;
8
+ /** Small trailing annotation, e.g. "latest". */
9
+ hint?: string;
10
+ }
11
+ interface Props extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
12
+ items: SegmentedNavItem[];
13
+ /** Accessible name of the navigation region. */
14
+ label?: string;
15
+ size?: ControlSize;
16
+ class?: string;
17
+ itemClass?: string;
18
+ ref?: HTMLElement | null;
19
+ }
20
+ declare const SegmentedNav: import("svelte").Component<Props, {}, "ref">;
21
+ type SegmentedNav = ReturnType<typeof SegmentedNav>;
22
+ export default SegmentedNav;
@@ -0,0 +1,41 @@
1
+ <script lang="ts">
2
+ import type { HTMLAnchorAttributes, HTMLAttributes } from 'svelte/elements';
3
+ import { cx } from '../utils.js';
4
+
5
+ interface CommonProps {
6
+ label: string;
7
+ value: string | number;
8
+ /** Small accent line above the value, in the eyebrow voice. */
9
+ eyebrow?: string;
10
+ class?: string;
11
+ ref?: HTMLElement | null;
12
+ }
13
+
14
+ type Props = CommonProps &
15
+ (
16
+ | (Omit<HTMLAnchorAttributes, 'class'> & { href: string })
17
+ | (Omit<HTMLAttributes<HTMLElement>, 'class'> & { href?: never })
18
+ );
19
+
20
+ let {
21
+ label,
22
+ value,
23
+ eyebrow,
24
+ href,
25
+ class: className,
26
+ ref = $bindable(null),
27
+ ...rest
28
+ }: Props = $props();
29
+ </script>
30
+
31
+ <svelte:element
32
+ this={href ? 'a' : 'div'}
33
+ bind:this={ref}
34
+ class={cx('ldt-stat', className)}
35
+ {href}
36
+ {...rest}
37
+ >
38
+ {#if eyebrow}<p class="ldt-eyebrow">{eyebrow}</p>{/if}
39
+ <p class="ldt-stat__value">{value}</p>
40
+ <p class="ldt-stat__label">{label}</p>
41
+ </svelte:element>
@@ -0,0 +1,17 @@
1
+ import type { HTMLAnchorAttributes, HTMLAttributes } from 'svelte/elements';
2
+ interface CommonProps {
3
+ label: string;
4
+ value: string | number;
5
+ /** Small accent line above the value, in the eyebrow voice. */
6
+ eyebrow?: string;
7
+ class?: string;
8
+ ref?: HTMLElement | null;
9
+ }
10
+ type Props = CommonProps & ((Omit<HTMLAnchorAttributes, 'class'> & {
11
+ href: string;
12
+ }) | (Omit<HTMLAttributes<HTMLElement>, 'class'> & {
13
+ href?: never;
14
+ }));
15
+ declare const Stat: import("svelte").Component<Props, {}, "ref">;
16
+ type Stat = ReturnType<typeof Stat>;
17
+ export default Stat;
@@ -0,0 +1,27 @@
1
+ <script lang="ts">
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import type { BadgeVariant } from '../types.js';
4
+ import { cx } from '../utils.js';
5
+
6
+ interface Props extends HTMLAttributes<HTMLSpanElement> {
7
+ variant?: BadgeVariant;
8
+ /** Accessible name — color alone must never carry the state. */
9
+ label: string;
10
+ class?: string;
11
+ ref?: HTMLSpanElement | null;
12
+ }
13
+
14
+ let {
15
+ variant = 'default',
16
+ label,
17
+ class: className,
18
+ ref = $bindable(null),
19
+ ...rest
20
+ }: Props = $props();
21
+ </script>
22
+
23
+ <span
24
+ bind:this={ref}
25
+ class={cx('ldt-status-dot', variant !== 'default' && `ldt-status-dot--${variant}`, className)}
26
+ {...rest}><span class="ldt-sr-only">{label}</span></span
27
+ >
@@ -0,0 +1,12 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ import type { BadgeVariant } from '../types.js';
3
+ interface Props extends HTMLAttributes<HTMLSpanElement> {
4
+ variant?: BadgeVariant;
5
+ /** Accessible name — color alone must never carry the state. */
6
+ label: string;
7
+ class?: string;
8
+ ref?: HTMLSpanElement | null;
9
+ }
10
+ declare const StatusDot: import("svelte").Component<Props, {}, "ref">;
11
+ type StatusDot = ReturnType<typeof StatusDot>;
12
+ export default StatusDot;