@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.
- package/LICENSE +21 -0
- package/dist/components/Alert.svelte +36 -0
- package/dist/components/Alert.svelte.d.ts +15 -0
- package/dist/components/AppShell.svelte +31 -0
- package/dist/components/AppShell.svelte.d.ts +14 -0
- package/dist/components/Badge.svelte +27 -0
- package/dist/components/Badge.svelte.d.ts +12 -0
- package/dist/components/Brand.svelte +35 -0
- package/dist/components/Brand.svelte.d.ts +15 -0
- package/dist/components/Button.svelte +85 -0
- package/dist/components/Button.svelte.d.ts +21 -0
- package/dist/components/Card.svelte +43 -0
- package/dist/components/Card.svelte.d.ts +18 -0
- package/dist/components/Checkbox.svelte +54 -0
- package/dist/components/Checkbox.svelte.d.ts +21 -0
- package/dist/components/ContextBar.svelte +33 -0
- package/dist/components/ContextBar.svelte.d.ts +13 -0
- package/dist/components/Dialog.svelte +84 -0
- package/dist/components/Dialog.svelte.d.ts +28 -0
- package/dist/components/DropdownMenu.svelte +99 -0
- package/dist/components/DropdownMenu.svelte.d.ts +47 -0
- package/dist/components/Field.svelte +52 -0
- package/dist/components/Field.svelte.d.ts +24 -0
- package/dist/components/IconButton.svelte +43 -0
- package/dist/components/IconButton.svelte.d.ts +16 -0
- package/dist/components/Input.svelte +27 -0
- package/dist/components/Input.svelte.d.ts +11 -0
- package/dist/components/Label.svelte +24 -0
- package/dist/components/Label.svelte.d.ts +11 -0
- package/dist/components/NavMenu.svelte +62 -0
- package/dist/components/NavMenu.svelte.d.ts +43 -0
- package/dist/components/NumberField.svelte +78 -0
- package/dist/components/NumberField.svelte.d.ts +21 -0
- package/dist/components/PageHeader.svelte +37 -0
- package/dist/components/PageHeader.svelte.d.ts +15 -0
- package/dist/components/Panel.svelte +38 -0
- package/dist/components/Panel.svelte.d.ts +15 -0
- package/dist/components/Popover.svelte +58 -0
- package/dist/components/Popover.svelte.d.ts +21 -0
- package/dist/components/Progress.svelte +43 -0
- package/dist/components/Progress.svelte.d.ts +12 -0
- package/dist/components/RadioGroup.svelte +49 -0
- package/dist/components/RadioGroup.svelte.d.ts +37 -0
- package/dist/components/Section.svelte +39 -0
- package/dist/components/Section.svelte.d.ts +15 -0
- package/dist/components/Select.svelte +57 -0
- package/dist/components/Select.svelte.d.ts +41 -0
- package/dist/components/Separator.svelte +29 -0
- package/dist/components/Separator.svelte.d.ts +10 -0
- package/dist/components/Sidebar.svelte +35 -0
- package/dist/components/Sidebar.svelte.d.ts +16 -0
- package/dist/components/Skeleton.svelte +26 -0
- package/dist/components/Skeleton.svelte.d.ts +11 -0
- package/dist/components/Spinner.svelte +22 -0
- package/dist/components/Spinner.svelte.d.ts +10 -0
- package/dist/components/Switch.svelte +62 -0
- package/dist/components/Switch.svelte.d.ts +17 -0
- package/dist/components/Table.svelte +43 -0
- package/dist/components/Table.svelte.d.ts +17 -0
- package/dist/components/Tabs.svelte +63 -0
- package/dist/components/Tabs.svelte.d.ts +41 -0
- package/dist/components/Textarea.svelte +27 -0
- package/dist/components/Textarea.svelte.d.ts +11 -0
- package/dist/components/Toast.svelte +53 -0
- package/dist/components/Toast.svelte.d.ts +16 -0
- package/dist/components/ToastViewport.svelte +38 -0
- package/dist/components/ToastViewport.svelte.d.ts +13 -0
- package/dist/components/Tooltip.svelte +76 -0
- package/dist/components/Tooltip.svelte.d.ts +28 -0
- package/dist/components/TooltipProvider.svelte +33 -0
- package/dist/components/TooltipProvider.svelte.d.ts +14 -0
- package/dist/components/Topbar.svelte +32 -0
- package/dist/components/Topbar.svelte.d.ts +14 -0
- package/dist/components/Workspace.svelte +38 -0
- package/dist/components/Workspace.svelte.d.ts +12 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.js +44 -0
- package/dist/styles.css +1 -0
- package/dist/toaster.svelte.d.ts +43 -0
- package/dist/toaster.svelte.js +82 -0
- package/dist/types.d.ts +39 -0
- package/dist/types.js +1 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +7 -0
- package/package.json +66 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLTableAttributes } from 'svelte/elements';
|
|
4
|
+
import { cx } from '../utils.js';
|
|
5
|
+
|
|
6
|
+
interface Props extends HTMLTableAttributes {
|
|
7
|
+
/** Names the table and its scroll region. */
|
|
8
|
+
caption?: string;
|
|
9
|
+
/** Accessible name for the scroll region when there is no `caption`. */
|
|
10
|
+
regionLabel?: string;
|
|
11
|
+
/** `class` lands on the `<table>`; use `wrapperClass` for the scroll container. */
|
|
12
|
+
class?: string;
|
|
13
|
+
wrapperClass?: string;
|
|
14
|
+
children: Snippet;
|
|
15
|
+
ref?: HTMLTableElement | null;
|
|
16
|
+
wrapperRef?: HTMLDivElement | null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let {
|
|
20
|
+
caption,
|
|
21
|
+
regionLabel = 'Data table',
|
|
22
|
+
class: className,
|
|
23
|
+
wrapperClass,
|
|
24
|
+
children,
|
|
25
|
+
ref = $bindable(null),
|
|
26
|
+
wrapperRef = $bindable(null),
|
|
27
|
+
...rest
|
|
28
|
+
}: Props = $props();
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<!-- `tabindex` is required: a scrollable region is unreachable by keyboard without it. -->
|
|
32
|
+
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
|
|
33
|
+
<div
|
|
34
|
+
bind:this={wrapperRef}
|
|
35
|
+
class={cx('ldt-table-wrap', wrapperClass)}
|
|
36
|
+
role="region"
|
|
37
|
+
tabindex="0"
|
|
38
|
+
aria-label={caption ?? regionLabel}
|
|
39
|
+
>
|
|
40
|
+
<table bind:this={ref} class={cx('ldt-table', className)} {...rest}>
|
|
41
|
+
{#if caption}<caption class="ldt-sr-only">{caption}</caption>{/if}{@render children()}
|
|
42
|
+
</table>
|
|
43
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLTableAttributes } from 'svelte/elements';
|
|
3
|
+
interface Props extends HTMLTableAttributes {
|
|
4
|
+
/** Names the table and its scroll region. */
|
|
5
|
+
caption?: string;
|
|
6
|
+
/** Accessible name for the scroll region when there is no `caption`. */
|
|
7
|
+
regionLabel?: string;
|
|
8
|
+
/** `class` lands on the `<table>`; use `wrapperClass` for the scroll container. */
|
|
9
|
+
class?: string;
|
|
10
|
+
wrapperClass?: string;
|
|
11
|
+
children: Snippet;
|
|
12
|
+
ref?: HTMLTableElement | null;
|
|
13
|
+
wrapperRef?: HTMLDivElement | null;
|
|
14
|
+
}
|
|
15
|
+
declare const Table: import("svelte").Component<Props, {}, "ref" | "wrapperRef">;
|
|
16
|
+
type Table = ReturnType<typeof Table>;
|
|
17
|
+
export default Table;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<script lang="ts" generics="T extends string = string">
|
|
2
|
+
import { Tabs as TabsPrimitive } from 'bits-ui';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { NavItem, Orientation } from '../types.js';
|
|
5
|
+
import { cx } from '../utils.js';
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
/** Defaults to the first tab, so a panel is always rendered. */
|
|
9
|
+
value?: T;
|
|
10
|
+
tabs: NavItem<T>[];
|
|
11
|
+
/** Accessible name of the tab list. */
|
|
12
|
+
label?: string;
|
|
13
|
+
orientation?: Orientation;
|
|
14
|
+
children: Snippet<[{ value: T }]>;
|
|
15
|
+
class?: string;
|
|
16
|
+
listClass?: string;
|
|
17
|
+
contentClass?: string;
|
|
18
|
+
onValueChange?: (value: T) => void;
|
|
19
|
+
ref?: HTMLElement | null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let {
|
|
23
|
+
value = $bindable(),
|
|
24
|
+
tabs,
|
|
25
|
+
label,
|
|
26
|
+
orientation = 'horizontal',
|
|
27
|
+
children,
|
|
28
|
+
class: className,
|
|
29
|
+
listClass,
|
|
30
|
+
contentClass,
|
|
31
|
+
onValueChange,
|
|
32
|
+
ref = $bindable(null),
|
|
33
|
+
}: Props = $props();
|
|
34
|
+
|
|
35
|
+
$effect(() => {
|
|
36
|
+
if (value === undefined && tabs.length > 0) value = tabs[0].value;
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const active = $derived(value ?? tabs[0]?.value);
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<TabsPrimitive.Root
|
|
43
|
+
bind:ref
|
|
44
|
+
value={active}
|
|
45
|
+
onValueChange={(next) => {
|
|
46
|
+
value = next as T;
|
|
47
|
+
onValueChange?.(next as T);
|
|
48
|
+
}}
|
|
49
|
+
{orientation}
|
|
50
|
+
class={cx('ldt-tabs', className)}
|
|
51
|
+
>
|
|
52
|
+
<TabsPrimitive.List class={cx('ldt-tabs__list', listClass)} aria-label={label}
|
|
53
|
+
>{#each tabs as tab (tab.value)}<TabsPrimitive.Trigger
|
|
54
|
+
class="ldt-tabs__trigger"
|
|
55
|
+
value={tab.value}
|
|
56
|
+
disabled={tab.disabled}>{tab.label}</TabsPrimitive.Trigger
|
|
57
|
+
>{/each}</TabsPrimitive.List
|
|
58
|
+
>
|
|
59
|
+
{#each tabs as tab (tab.value)}<TabsPrimitive.Content
|
|
60
|
+
class={cx('ldt-tabs__content', contentClass)}
|
|
61
|
+
value={tab.value}>{@render children({ value: tab.value })}</TabsPrimitive.Content
|
|
62
|
+
>{/each}
|
|
63
|
+
</TabsPrimitive.Root>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { NavItem, Orientation } from '../types.js';
|
|
3
|
+
declare function $$render<T extends string = string>(): {
|
|
4
|
+
props: {
|
|
5
|
+
/** Defaults to the first tab, so a panel is always rendered. */
|
|
6
|
+
value?: T;
|
|
7
|
+
tabs: NavItem<T>[];
|
|
8
|
+
/** Accessible name of the tab list. */
|
|
9
|
+
label?: string;
|
|
10
|
+
orientation?: Orientation;
|
|
11
|
+
children: Snippet<[{
|
|
12
|
+
value: T;
|
|
13
|
+
}]>;
|
|
14
|
+
class?: string;
|
|
15
|
+
listClass?: string;
|
|
16
|
+
contentClass?: string;
|
|
17
|
+
onValueChange?: (value: T) => void;
|
|
18
|
+
ref?: HTMLElement | null;
|
|
19
|
+
};
|
|
20
|
+
exports: {};
|
|
21
|
+
bindings: "ref" | "value";
|
|
22
|
+
slots: {};
|
|
23
|
+
events: {};
|
|
24
|
+
};
|
|
25
|
+
declare class __sveltets_Render<T extends string = string> {
|
|
26
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
27
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
28
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
29
|
+
bindings(): "ref" | "value";
|
|
30
|
+
exports(): {};
|
|
31
|
+
}
|
|
32
|
+
interface $$IsomorphicComponent {
|
|
33
|
+
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']>> & {
|
|
34
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
35
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
36
|
+
<T extends string = string>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
37
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
38
|
+
}
|
|
39
|
+
declare const Tabs: $$IsomorphicComponent;
|
|
40
|
+
type Tabs<T extends string = string> = InstanceType<typeof Tabs<T>>;
|
|
41
|
+
export default Tabs;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLTextareaAttributes } from 'svelte/elements';
|
|
3
|
+
import { cx } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
interface Props extends Omit<HTMLTextareaAttributes, 'value'> {
|
|
6
|
+
value?: string;
|
|
7
|
+
/** Draws the full box instead of the default underline. */
|
|
8
|
+
boxed?: boolean;
|
|
9
|
+
class?: string;
|
|
10
|
+
ref?: HTMLTextAreaElement | 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
|
+
<textarea
|
|
23
|
+
bind:this={ref}
|
|
24
|
+
bind:value
|
|
25
|
+
class={cx('ldt-textarea', boxed && 'ldt-textarea--boxed', className)}
|
|
26
|
+
{...rest}
|
|
27
|
+
></textarea>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HTMLTextareaAttributes } from 'svelte/elements';
|
|
2
|
+
interface Props extends Omit<HTMLTextareaAttributes, 'value'> {
|
|
3
|
+
value?: string;
|
|
4
|
+
/** Draws the full box instead of the default underline. */
|
|
5
|
+
boxed?: boolean;
|
|
6
|
+
class?: string;
|
|
7
|
+
ref?: HTMLTextAreaElement | null;
|
|
8
|
+
}
|
|
9
|
+
declare const Textarea: import("svelte").Component<Props, {}, "ref" | "value">;
|
|
10
|
+
type Textarea = ReturnType<typeof Textarea>;
|
|
11
|
+
export default Textarea;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
import IconButton from './IconButton.svelte';
|
|
5
|
+
import type { StatusVariant } from '../types.js';
|
|
6
|
+
import { cx } from '../utils.js';
|
|
7
|
+
|
|
8
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
title: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
variant?: StatusVariant;
|
|
12
|
+
dismissLabel?: string;
|
|
13
|
+
onDismiss?: () => void;
|
|
14
|
+
class?: string;
|
|
15
|
+
children?: Snippet;
|
|
16
|
+
ref?: HTMLDivElement | null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let {
|
|
20
|
+
title,
|
|
21
|
+
description,
|
|
22
|
+
variant,
|
|
23
|
+
dismissLabel = 'Dismiss notification',
|
|
24
|
+
onDismiss,
|
|
25
|
+
class: className,
|
|
26
|
+
children,
|
|
27
|
+
ref = $bindable(null),
|
|
28
|
+
...rest
|
|
29
|
+
}: Props = $props();
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<!--
|
|
33
|
+
No `role="status"` here: `ToastViewport` is the live region, and nesting one inside another
|
|
34
|
+
makes screen readers announce each toast twice.
|
|
35
|
+
-->
|
|
36
|
+
<div
|
|
37
|
+
bind:this={ref}
|
|
38
|
+
class={cx('ldt-toast', variant && `ldt-toast--${variant}`, className)}
|
|
39
|
+
{...rest}
|
|
40
|
+
>
|
|
41
|
+
<strong class="ldt-toast__title">{title}</strong>{#if description}<p
|
|
42
|
+
class="ldt-toast__description"
|
|
43
|
+
>
|
|
44
|
+
{description}
|
|
45
|
+
</p>{/if}{#if children}<div class="ldt-toast__description">
|
|
46
|
+
{@render children()}
|
|
47
|
+
</div>{/if}{#if onDismiss}<IconButton
|
|
48
|
+
class="ldt-toast__dismiss"
|
|
49
|
+
size="sm"
|
|
50
|
+
label={dismissLabel}
|
|
51
|
+
onclick={onDismiss}>×</IconButton
|
|
52
|
+
>{/if}
|
|
53
|
+
</div>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { StatusVariant } from '../types.js';
|
|
4
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
variant?: StatusVariant;
|
|
8
|
+
dismissLabel?: string;
|
|
9
|
+
onDismiss?: () => void;
|
|
10
|
+
class?: string;
|
|
11
|
+
children?: Snippet;
|
|
12
|
+
ref?: HTMLDivElement | null;
|
|
13
|
+
}
|
|
14
|
+
declare const Toast: import("svelte").Component<Props, {}, "ref">;
|
|
15
|
+
type Toast = ReturnType<typeof Toast>;
|
|
16
|
+
export default Toast;
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
label?: string;
|
|
8
|
+
/** `polite` for routine updates; `assertive` interrupts and should be rare. */
|
|
9
|
+
politeness?: 'polite' | 'assertive';
|
|
10
|
+
class?: string;
|
|
11
|
+
children: Snippet;
|
|
12
|
+
ref?: HTMLDivElement | null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let {
|
|
16
|
+
label = 'Notifications',
|
|
17
|
+
politeness = 'polite',
|
|
18
|
+
class: className,
|
|
19
|
+
children,
|
|
20
|
+
ref = $bindable(null),
|
|
21
|
+
...rest
|
|
22
|
+
}: Props = $props();
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<!--
|
|
26
|
+
A plain `<div>`, not a `<section>`: the region has to stay mounted for a screen reader to
|
|
27
|
+
announce toasts added later, and an always-present landmark with nothing in it is noise.
|
|
28
|
+
-->
|
|
29
|
+
<div
|
|
30
|
+
bind:this={ref}
|
|
31
|
+
class={cx('ldt-toast-viewport', className)}
|
|
32
|
+
aria-label={label}
|
|
33
|
+
aria-live={politeness}
|
|
34
|
+
aria-relevant="additions text"
|
|
35
|
+
{...rest}
|
|
36
|
+
>
|
|
37
|
+
{@render children()}
|
|
38
|
+
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
label?: string;
|
|
5
|
+
/** `polite` for routine updates; `assertive` interrupts and should be rare. */
|
|
6
|
+
politeness?: 'polite' | 'assertive';
|
|
7
|
+
class?: string;
|
|
8
|
+
children: Snippet;
|
|
9
|
+
ref?: HTMLDivElement | null;
|
|
10
|
+
}
|
|
11
|
+
declare const ToastViewport: import("svelte").Component<Props, {}, "ref">;
|
|
12
|
+
type ToastViewport = ReturnType<typeof ToastViewport>;
|
|
13
|
+
export default ToastViewport;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Tooltip as TooltipPrimitive } from 'bits-ui';
|
|
3
|
+
import type { TooltipContentProps } from 'bits-ui';
|
|
4
|
+
import { getContext, type Snippet } from 'svelte';
|
|
5
|
+
import type { Alignment, Placement, TriggerChildProps } from '../types.js';
|
|
6
|
+
import { cx } from '../utils.js';
|
|
7
|
+
import { TOOLTIP_PROVIDER_KEY } from './TooltipProvider.svelte';
|
|
8
|
+
|
|
9
|
+
type Props = Omit<TooltipContentProps, 'children' | 'class' | 'child'> & {
|
|
10
|
+
open?: boolean;
|
|
11
|
+
content: string;
|
|
12
|
+
trigger?: Snippet;
|
|
13
|
+
/** Full control of the trigger element — avoids nesting a button inside the trigger. */
|
|
14
|
+
triggerChild?: Snippet<[TriggerChildProps]>;
|
|
15
|
+
triggerClass?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Set only when the trigger has no accessible name of its own. Bits already wires
|
|
18
|
+
* `aria-describedby`, so forcing an `aria-label` here would clobber that name.
|
|
19
|
+
*/
|
|
20
|
+
triggerLabel?: string;
|
|
21
|
+
side?: Placement;
|
|
22
|
+
align?: Alignment;
|
|
23
|
+
sideOffset?: number;
|
|
24
|
+
/** Ignored when an ancestor `TooltipProvider` is present. */
|
|
25
|
+
delayDuration?: number;
|
|
26
|
+
/** `class` lands on the portaled Content element. */
|
|
27
|
+
class?: string;
|
|
28
|
+
onOpenChange?: (open: boolean) => void;
|
|
29
|
+
ref?: HTMLElement | null;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
let {
|
|
33
|
+
open = $bindable(false),
|
|
34
|
+
content,
|
|
35
|
+
trigger,
|
|
36
|
+
triggerChild,
|
|
37
|
+
triggerClass = 'ldt-button ldt-icon-button ldt-button--ghost',
|
|
38
|
+
triggerLabel,
|
|
39
|
+
side = 'top',
|
|
40
|
+
align = 'center',
|
|
41
|
+
sideOffset = 6,
|
|
42
|
+
delayDuration = 350,
|
|
43
|
+
class: className,
|
|
44
|
+
onOpenChange,
|
|
45
|
+
ref = $bindable(null),
|
|
46
|
+
...rest
|
|
47
|
+
}: Props = $props();
|
|
48
|
+
|
|
49
|
+
const hasProvider = getContext(TOOLTIP_PROVIDER_KEY) === true;
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
{#snippet tooltip()}
|
|
53
|
+
<TooltipPrimitive.Root bind:open {onOpenChange}>
|
|
54
|
+
{#if triggerChild}<TooltipPrimitive.Trigger
|
|
55
|
+
>{#snippet child(childProps)}{@render triggerChild(
|
|
56
|
+
childProps
|
|
57
|
+
)}{/snippet}</TooltipPrimitive.Trigger
|
|
58
|
+
>{:else if trigger}<TooltipPrimitive.Trigger class={triggerClass} aria-label={triggerLabel}
|
|
59
|
+
>{@render trigger()}</TooltipPrimitive.Trigger
|
|
60
|
+
>{/if}
|
|
61
|
+
<TooltipPrimitive.Portal
|
|
62
|
+
><TooltipPrimitive.Content
|
|
63
|
+
bind:ref
|
|
64
|
+
{side}
|
|
65
|
+
{align}
|
|
66
|
+
{sideOffset}
|
|
67
|
+
class={cx('ldt-tooltip', className)}
|
|
68
|
+
{...rest}>{content}</TooltipPrimitive.Content
|
|
69
|
+
></TooltipPrimitive.Portal
|
|
70
|
+
>
|
|
71
|
+
</TooltipPrimitive.Root>
|
|
72
|
+
{/snippet}
|
|
73
|
+
|
|
74
|
+
{#if hasProvider}{@render tooltip()}{:else}<TooltipPrimitive.Provider {delayDuration}
|
|
75
|
+
>{@render tooltip()}</TooltipPrimitive.Provider
|
|
76
|
+
>{/if}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { TooltipContentProps } from 'bits-ui';
|
|
2
|
+
import { type Snippet } from 'svelte';
|
|
3
|
+
import type { Alignment, Placement, TriggerChildProps } from '../types.js';
|
|
4
|
+
type Props = Omit<TooltipContentProps, 'children' | 'class' | 'child'> & {
|
|
5
|
+
open?: boolean;
|
|
6
|
+
content: string;
|
|
7
|
+
trigger?: Snippet;
|
|
8
|
+
/** Full control of the trigger element — avoids nesting a button inside the trigger. */
|
|
9
|
+
triggerChild?: Snippet<[TriggerChildProps]>;
|
|
10
|
+
triggerClass?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Set only when the trigger has no accessible name of its own. Bits already wires
|
|
13
|
+
* `aria-describedby`, so forcing an `aria-label` here would clobber that name.
|
|
14
|
+
*/
|
|
15
|
+
triggerLabel?: string;
|
|
16
|
+
side?: Placement;
|
|
17
|
+
align?: Alignment;
|
|
18
|
+
sideOffset?: number;
|
|
19
|
+
/** Ignored when an ancestor `TooltipProvider` is present. */
|
|
20
|
+
delayDuration?: number;
|
|
21
|
+
/** `class` lands on the portaled Content element. */
|
|
22
|
+
class?: string;
|
|
23
|
+
onOpenChange?: (open: boolean) => void;
|
|
24
|
+
ref?: HTMLElement | null;
|
|
25
|
+
};
|
|
26
|
+
declare const Tooltip: import("svelte").Component<Props, {}, "ref" | "open">;
|
|
27
|
+
type Tooltip = ReturnType<typeof Tooltip>;
|
|
28
|
+
export default Tooltip;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
export const TOOLTIP_PROVIDER_KEY = Symbol('ldt-tooltip-provider');
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script lang="ts">
|
|
6
|
+
import { Tooltip as TooltipPrimitive } from 'bits-ui';
|
|
7
|
+
import { setContext, type Snippet } from 'svelte';
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
/** Delay before the first tooltip in the group opens. */
|
|
11
|
+
delayDuration?: number;
|
|
12
|
+
/** Window after closing one tooltip in which the next opens instantly. */
|
|
13
|
+
skipDelayDuration?: number;
|
|
14
|
+
disableHoverableContent?: boolean;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
children: Snippet;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let {
|
|
20
|
+
delayDuration = 350,
|
|
21
|
+
skipDelayDuration = 300,
|
|
22
|
+
disableHoverableContent = false,
|
|
23
|
+
disabled = false,
|
|
24
|
+
children,
|
|
25
|
+
}: Props = $props();
|
|
26
|
+
|
|
27
|
+
// Tooltips inside this subtree skip their own Provider, so skip-delay grouping works.
|
|
28
|
+
setContext(TOOLTIP_PROVIDER_KEY, true);
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<TooltipPrimitive.Provider {delayDuration} {skipDelayDuration} {disableHoverableContent} {disabled}
|
|
32
|
+
>{@render children()}</TooltipPrimitive.Provider
|
|
33
|
+
>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const TOOLTIP_PROVIDER_KEY: unique symbol;
|
|
2
|
+
import { type Snippet } from 'svelte';
|
|
3
|
+
interface Props {
|
|
4
|
+
/** Delay before the first tooltip in the group opens. */
|
|
5
|
+
delayDuration?: number;
|
|
6
|
+
/** Window after closing one tooltip in which the next opens instantly. */
|
|
7
|
+
skipDelayDuration?: number;
|
|
8
|
+
disableHoverableContent?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
children: Snippet;
|
|
11
|
+
}
|
|
12
|
+
declare const TooltipProvider: import("svelte").Component<Props, {}, "">;
|
|
13
|
+
type TooltipProvider = ReturnType<typeof TooltipProvider>;
|
|
14
|
+
export default TooltipProvider;
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
interface Props extends HTMLAttributes<HTMLElement> {
|
|
7
|
+
brand: Snippet;
|
|
8
|
+
navigation?: Snippet;
|
|
9
|
+
actions?: Snippet;
|
|
10
|
+
/** Accessible name of the `<nav>`, so several navs stay distinguishable. */
|
|
11
|
+
navLabel?: string;
|
|
12
|
+
class?: string;
|
|
13
|
+
ref?: HTMLElement | null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let {
|
|
17
|
+
brand,
|
|
18
|
+
navigation,
|
|
19
|
+
actions,
|
|
20
|
+
navLabel = 'Primary',
|
|
21
|
+
class: className,
|
|
22
|
+
ref = $bindable(null),
|
|
23
|
+
...rest
|
|
24
|
+
}: Props = $props();
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<header bind:this={ref} class={cx('ldt-topbar', className)} {...rest}>
|
|
28
|
+
<div>{@render brand()}</div>
|
|
29
|
+
{#if navigation}<nav class="ldt-topbar__nav" aria-label={navLabel}>
|
|
30
|
+
{@render navigation()}
|
|
31
|
+
</nav>{/if}{#if actions}<div class="ldt-topbar__actions">{@render actions()}</div>{/if}
|
|
32
|
+
</header>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
interface Props extends HTMLAttributes<HTMLElement> {
|
|
4
|
+
brand: Snippet;
|
|
5
|
+
navigation?: Snippet;
|
|
6
|
+
actions?: Snippet;
|
|
7
|
+
/** Accessible name of the `<nav>`, so several navs stay distinguishable. */
|
|
8
|
+
navLabel?: string;
|
|
9
|
+
class?: string;
|
|
10
|
+
ref?: HTMLElement | null;
|
|
11
|
+
}
|
|
12
|
+
declare const Topbar: import("svelte").Component<Props, {}, "ref">;
|
|
13
|
+
type Topbar = ReturnType<typeof Topbar>;
|
|
14
|
+
export default Topbar;
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
sidebar?: Snippet;
|
|
8
|
+
children: Snippet;
|
|
9
|
+
inspector?: Snippet;
|
|
10
|
+
class?: string;
|
|
11
|
+
ref?: HTMLDivElement | null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let {
|
|
15
|
+
sidebar,
|
|
16
|
+
children,
|
|
17
|
+
inspector,
|
|
18
|
+
class: className,
|
|
19
|
+
ref = $bindable(null),
|
|
20
|
+
...rest
|
|
21
|
+
}: Props = $props();
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<!-- The grid columns follow the snippets that are actually present. -->
|
|
25
|
+
<div
|
|
26
|
+
bind:this={ref}
|
|
27
|
+
class={cx(
|
|
28
|
+
'ldt-workspace',
|
|
29
|
+
sidebar && 'ldt-workspace--sidebar',
|
|
30
|
+
inspector && 'ldt-workspace--inspector',
|
|
31
|
+
className
|
|
32
|
+
)}
|
|
33
|
+
{...rest}
|
|
34
|
+
>
|
|
35
|
+
{#if sidebar}{@render sidebar()}{/if}
|
|
36
|
+
<div class="ldt-workspace__main">{@render children()}</div>
|
|
37
|
+
{#if inspector}{@render inspector()}{/if}
|
|
38
|
+
</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
sidebar?: Snippet;
|
|
5
|
+
children: Snippet;
|
|
6
|
+
inspector?: Snippet;
|
|
7
|
+
class?: string;
|
|
8
|
+
ref?: HTMLDivElement | null;
|
|
9
|
+
}
|
|
10
|
+
declare const Workspace: import("svelte").Component<Props, {}, "ref">;
|
|
11
|
+
type Workspace = ReturnType<typeof Workspace>;
|
|
12
|
+
export default Workspace;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export { default as Alert } from './components/Alert.svelte';
|
|
2
|
+
export { default as AppShell } from './components/AppShell.svelte';
|
|
3
|
+
export { default as Badge } from './components/Badge.svelte';
|
|
4
|
+
export { default as Brand } from './components/Brand.svelte';
|
|
5
|
+
export { default as Button } from './components/Button.svelte';
|
|
6
|
+
export { default as Card } from './components/Card.svelte';
|
|
7
|
+
export { default as Checkbox } from './components/Checkbox.svelte';
|
|
8
|
+
export { default as ContextBar } from './components/ContextBar.svelte';
|
|
9
|
+
export { default as Dialog } from './components/Dialog.svelte';
|
|
10
|
+
export { default as DropdownMenu } from './components/DropdownMenu.svelte';
|
|
11
|
+
export { default as Field } from './components/Field.svelte';
|
|
12
|
+
export { default as IconButton } from './components/IconButton.svelte';
|
|
13
|
+
export { default as Input } from './components/Input.svelte';
|
|
14
|
+
export { default as Label } from './components/Label.svelte';
|
|
15
|
+
export { default as NavMenu } from './components/NavMenu.svelte';
|
|
16
|
+
export { default as NumberField } from './components/NumberField.svelte';
|
|
17
|
+
export { default as PageHeader } from './components/PageHeader.svelte';
|
|
18
|
+
export { default as Panel } from './components/Panel.svelte';
|
|
19
|
+
export { default as Popover } from './components/Popover.svelte';
|
|
20
|
+
export { default as Progress } from './components/Progress.svelte';
|
|
21
|
+
export { default as RadioGroup } from './components/RadioGroup.svelte';
|
|
22
|
+
export { default as Section } from './components/Section.svelte';
|
|
23
|
+
export { default as Select } from './components/Select.svelte';
|
|
24
|
+
export { default as Separator } from './components/Separator.svelte';
|
|
25
|
+
export { default as Sidebar } from './components/Sidebar.svelte';
|
|
26
|
+
export { default as Skeleton } from './components/Skeleton.svelte';
|
|
27
|
+
export { default as Spinner } from './components/Spinner.svelte';
|
|
28
|
+
export { default as Switch } from './components/Switch.svelte';
|
|
29
|
+
export { default as Table } from './components/Table.svelte';
|
|
30
|
+
export { default as Tabs } from './components/Tabs.svelte';
|
|
31
|
+
export { default as Textarea } from './components/Textarea.svelte';
|
|
32
|
+
export { default as Toast } from './components/Toast.svelte';
|
|
33
|
+
export { default as ToastViewport } from './components/ToastViewport.svelte';
|
|
34
|
+
export { default as Tooltip } from './components/Tooltip.svelte';
|
|
35
|
+
export { default as TooltipProvider } from './components/TooltipProvider.svelte';
|
|
36
|
+
export { default as Topbar } from './components/Topbar.svelte';
|
|
37
|
+
export { default as Workspace } from './components/Workspace.svelte';
|
|
38
|
+
/**
|
|
39
|
+
* Bits UI primitives behind the wrappers, for menus and overlays this package does not
|
|
40
|
+
* model declaratively (checkbox/radio items, submenus, custom overlay composition).
|
|
41
|
+
*/
|
|
42
|
+
export { Dialog as DialogPrimitive, DropdownMenu as DropdownMenuPrimitive, Popover as PopoverPrimitive, Tabs as TabsPrimitive, Tooltip as TooltipPrimitive, } from 'bits-ui';
|
|
43
|
+
export { cx } from './utils.js';
|
|
44
|
+
export { createToaster } from './toaster.svelte.js';
|
|
45
|
+
export type { Toaster, ToasterOptions, ToastOptions, ToastRecord } from './toaster.svelte.js';
|
|
46
|
+
export type { ActionVariant, Alignment, BadgeVariant, ControlSize, DialogSize, HeadingLevel, MenuItem, NavItem, Option, Orientation, Placement, StatusVariant, TriggerChildProps, } from './types.js';
|