@sentropic/design-system-svelte 0.4.1 → 0.6.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/dist/ContentSwitcher.svelte +126 -0
- package/dist/ContentSwitcher.svelte.d.ts +17 -0
- package/dist/ContentSwitcher.svelte.d.ts.map +1 -0
- package/dist/CopyButton.svelte +132 -0
- package/dist/CopyButton.svelte.d.ts +15 -0
- package/dist/CopyButton.svelte.d.ts.map +1 -0
- package/dist/DatePicker.svelte +680 -0
- package/dist/DatePicker.svelte.d.ts +34 -0
- package/dist/DatePicker.svelte.d.ts.map +1 -0
- package/dist/FileUploader.svelte +431 -0
- package/dist/FileUploader.svelte.d.ts +30 -0
- package/dist/FileUploader.svelte.d.ts.map +1 -0
- package/dist/Form.svelte +117 -0
- package/dist/Form.svelte.d.ts +16 -0
- package/dist/Form.svelte.d.ts.map +1 -0
- package/dist/FormGroup.svelte +71 -0
- package/dist/FormGroup.svelte.d.ts +13 -0
- package/dist/FormGroup.svelte.d.ts.map +1 -0
- package/dist/Header.svelte +117 -0
- package/dist/Header.svelte.d.ts +16 -0
- package/dist/Header.svelte.d.ts.map +1 -0
- package/dist/InlineLoading.svelte +81 -0
- package/dist/InlineLoading.svelte.d.ts +10 -0
- package/dist/InlineLoading.svelte.d.ts.map +1 -0
- package/dist/OverflowMenu.svelte +222 -0
- package/dist/OverflowMenu.svelte.d.ts +21 -0
- package/dist/OverflowMenu.svelte.d.ts.map +1 -0
- package/dist/PaginationNav.svelte +219 -0
- package/dist/PaginationNav.svelte.d.ts +15 -0
- package/dist/PaginationNav.svelte.d.ts.map +1 -0
- package/dist/ProgressIndicator.svelte +283 -0
- package/dist/ProgressIndicator.svelte.d.ts +18 -0
- package/dist/ProgressIndicator.svelte.d.ts.map +1 -0
- package/dist/SkeletonText.svelte +79 -0
- package/dist/SkeletonText.svelte.d.ts +12 -0
- package/dist/SkeletonText.svelte.d.ts.map +1 -0
- package/dist/Toggletip.svelte +148 -0
- package/dist/Toggletip.svelte.d.ts +14 -0
- package/dist/Toggletip.svelte.d.ts.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -0
- package/package.json +2 -2
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
|
|
5
|
+
type HeaderProps = Omit<HTMLAttributes<HTMLElement>, "class"> & {
|
|
6
|
+
title?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
sticky?: boolean;
|
|
9
|
+
class?: string;
|
|
10
|
+
logo?: Snippet;
|
|
11
|
+
navigation?: Snippet;
|
|
12
|
+
actions?: Snippet;
|
|
13
|
+
children?: Snippet;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
let {
|
|
17
|
+
title,
|
|
18
|
+
label = "Application header",
|
|
19
|
+
sticky = true,
|
|
20
|
+
class: className,
|
|
21
|
+
logo,
|
|
22
|
+
navigation,
|
|
23
|
+
actions,
|
|
24
|
+
children,
|
|
25
|
+
...rest
|
|
26
|
+
}: HeaderProps = $props();
|
|
27
|
+
|
|
28
|
+
const classes = () =>
|
|
29
|
+
["st-header", sticky ? "st-header--sticky" : null, className].filter(Boolean).join(" ");
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<header {...rest} class={classes()} aria-label={label}>
|
|
33
|
+
<div class="st-header__leading">
|
|
34
|
+
{#if logo}
|
|
35
|
+
<span class="st-header__logo">{@render logo()}</span>
|
|
36
|
+
{/if}
|
|
37
|
+
{#if title}
|
|
38
|
+
<span class="st-header__title">{title}</span>
|
|
39
|
+
{/if}
|
|
40
|
+
</div>
|
|
41
|
+
{#if navigation}
|
|
42
|
+
<nav class="st-header__navigation" aria-label="Primary">
|
|
43
|
+
{@render navigation()}
|
|
44
|
+
</nav>
|
|
45
|
+
{/if}
|
|
46
|
+
{#if actions}
|
|
47
|
+
<div class="st-header__actions">
|
|
48
|
+
{@render actions()}
|
|
49
|
+
</div>
|
|
50
|
+
{/if}
|
|
51
|
+
{#if children}
|
|
52
|
+
{@render children()}
|
|
53
|
+
{/if}
|
|
54
|
+
</header>
|
|
55
|
+
|
|
56
|
+
<style>
|
|
57
|
+
.st-header {
|
|
58
|
+
align-items: center;
|
|
59
|
+
background: var(--st-component-header-background, var(--st-semantic-surface-default));
|
|
60
|
+
border-bottom: 1px solid var(--st-component-header-border, var(--st-semantic-border-subtle));
|
|
61
|
+
box-shadow: var(--st-component-header-shadow, 0 1px 3px rgb(15 23 42 / 0.06));
|
|
62
|
+
color: var(--st-component-header-text, var(--st-semantic-text-primary));
|
|
63
|
+
display: flex;
|
|
64
|
+
gap: var(--st-spacing-4, 1rem);
|
|
65
|
+
height: var(--st-component-header-height, 3.5rem);
|
|
66
|
+
padding: 0 var(--st-spacing-4, 1rem);
|
|
67
|
+
width: 100%;
|
|
68
|
+
z-index: var(--st-component-header-zIndex, 70);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.st-header--sticky {
|
|
72
|
+
position: sticky;
|
|
73
|
+
top: 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.st-header__leading {
|
|
77
|
+
align-items: center;
|
|
78
|
+
display: flex;
|
|
79
|
+
flex: 0 0 auto;
|
|
80
|
+
gap: var(--st-spacing-3, 0.75rem);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.st-header__logo {
|
|
84
|
+
align-items: center;
|
|
85
|
+
color: var(--st-component-header-logoText, var(--st-semantic-text-primary));
|
|
86
|
+
display: inline-flex;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.st-header__title {
|
|
90
|
+
color: var(--st-component-header-titleText, var(--st-semantic-text-primary));
|
|
91
|
+
font-size: 0.9375rem;
|
|
92
|
+
font-weight: 650;
|
|
93
|
+
letter-spacing: -0.005em;
|
|
94
|
+
line-height: 1.2;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.st-header__navigation {
|
|
98
|
+
align-items: center;
|
|
99
|
+
display: flex;
|
|
100
|
+
flex: 1 1 auto;
|
|
101
|
+
justify-content: center;
|
|
102
|
+
min-width: 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.st-header__actions {
|
|
106
|
+
align-items: center;
|
|
107
|
+
display: flex;
|
|
108
|
+
flex: 0 0 auto;
|
|
109
|
+
gap: var(--st-spacing-2, 0.5rem);
|
|
110
|
+
margin-left: auto;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/*
|
|
114
|
+
* When no navigation snippet is provided, the actions area still flushes
|
|
115
|
+
* to the right because flex:1 leading + auto margin keep the layout balanced.
|
|
116
|
+
*/
|
|
117
|
+
</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
type HeaderProps = Omit<HTMLAttributes<HTMLElement>, "class"> & {
|
|
4
|
+
title?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
sticky?: boolean;
|
|
7
|
+
class?: string;
|
|
8
|
+
logo?: Snippet;
|
|
9
|
+
navigation?: Snippet;
|
|
10
|
+
actions?: Snippet;
|
|
11
|
+
children?: Snippet;
|
|
12
|
+
};
|
|
13
|
+
declare const Header: import("svelte").Component<HeaderProps, {}, "">;
|
|
14
|
+
type Header = ReturnType<typeof Header>;
|
|
15
|
+
export default Header;
|
|
16
|
+
//# sourceMappingURL=Header.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.svelte.d.ts","sourceRoot":"","sources":["../src/lib/Header.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGpD,KAAK,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,GAAG;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAkDJ,QAAA,MAAM,MAAM,iDAAwC,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AACxC,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
|
|
4
|
+
type InlineLoadingProps = Omit<HTMLAttributes<HTMLDivElement>, "class"> & {
|
|
5
|
+
label?: string;
|
|
6
|
+
status?: "active" | "success" | "error" | "inactive";
|
|
7
|
+
class?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
label,
|
|
12
|
+
status = "active",
|
|
13
|
+
class: className,
|
|
14
|
+
...rest
|
|
15
|
+
}: InlineLoadingProps = $props();
|
|
16
|
+
|
|
17
|
+
const classes = () =>
|
|
18
|
+
["st-inlineLoading", `st-inlineLoading--${status}`, className].filter(Boolean).join(" ");
|
|
19
|
+
|
|
20
|
+
const role = () => (status === "error" ? "alert" : "status");
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<div {...rest} class={classes()} role={role()} aria-live="polite">
|
|
24
|
+
<span class="st-inlineLoading__icon" aria-hidden="true">
|
|
25
|
+
{#if status === "active"}
|
|
26
|
+
<svg viewBox="0 0 16 16" width="16" height="16">
|
|
27
|
+
<circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-opacity="0.2" />
|
|
28
|
+
<path d="M14 8a6 6 0 0 0-6-6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round">
|
|
29
|
+
<animateTransform attributeName="transform" type="rotate" from="0 8 8" to="360 8 8" dur="0.9s" repeatCount="indefinite" />
|
|
30
|
+
</path>
|
|
31
|
+
</svg>
|
|
32
|
+
{:else if status === "success"}
|
|
33
|
+
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" width="14" height="14">
|
|
34
|
+
<path d="m3 8 3.5 3.5L13 5" stroke-linecap="round" stroke-linejoin="round" />
|
|
35
|
+
</svg>
|
|
36
|
+
{:else if status === "error"}
|
|
37
|
+
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" width="14" height="14">
|
|
38
|
+
<path d="M4 4l8 8M12 4l-8 8" stroke-linecap="round" />
|
|
39
|
+
</svg>
|
|
40
|
+
{/if}
|
|
41
|
+
</span>
|
|
42
|
+
{#if label}<span class="st-inlineLoading__label">{label}</span>{/if}
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<style>
|
|
46
|
+
.st-inlineLoading {
|
|
47
|
+
align-items: center;
|
|
48
|
+
color: var(--st-semantic-text-secondary);
|
|
49
|
+
display: inline-flex;
|
|
50
|
+
font-size: 0.875rem;
|
|
51
|
+
gap: 0.5rem;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.st-inlineLoading__icon {
|
|
55
|
+
align-items: center;
|
|
56
|
+
display: inline-flex;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.st-inlineLoading--active .st-inlineLoading__icon {
|
|
61
|
+
color: var(--st-semantic-action-primary);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.st-inlineLoading--success {
|
|
65
|
+
color: var(--st-semantic-feedback-success);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.st-inlineLoading--error {
|
|
69
|
+
color: var(--st-semantic-feedback-error);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.st-inlineLoading--inactive {
|
|
73
|
+
color: var(--st-semantic-text-muted);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@media (prefers-reduced-motion: reduce) {
|
|
77
|
+
.st-inlineLoading__icon svg path animateTransform {
|
|
78
|
+
display: none;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
2
|
+
type InlineLoadingProps = Omit<HTMLAttributes<HTMLDivElement>, "class"> & {
|
|
3
|
+
label?: string;
|
|
4
|
+
status?: "active" | "success" | "error" | "inactive";
|
|
5
|
+
class?: string;
|
|
6
|
+
};
|
|
7
|
+
declare const InlineLoading: import("svelte").Component<InlineLoadingProps, {}, "">;
|
|
8
|
+
type InlineLoading = ReturnType<typeof InlineLoading>;
|
|
9
|
+
export default InlineLoading;
|
|
10
|
+
//# sourceMappingURL=InlineLoading.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InlineLoading.svelte.d.ts","sourceRoot":"","sources":["../src/lib/InlineLoading.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGpD,KAAK,kBAAkB,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,GAAG;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,UAAU,CAAC;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AA4CJ,QAAA,MAAM,aAAa,wDAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
export interface OverflowMenuItem {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
danger?: boolean;
|
|
7
|
+
onclick?: () => void;
|
|
8
|
+
}
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
13
|
+
|
|
14
|
+
type OverflowMenuProps = Omit<HTMLAttributes<HTMLDivElement>, "class" | "onselect"> & {
|
|
15
|
+
items: OverflowMenuItem[];
|
|
16
|
+
label?: string;
|
|
17
|
+
open?: boolean;
|
|
18
|
+
placement?: "bottom-start" | "bottom-end" | "top-start" | "top-end";
|
|
19
|
+
class?: string;
|
|
20
|
+
triggerLabel?: string;
|
|
21
|
+
onselect?: (value: string) => void;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
let {
|
|
25
|
+
items,
|
|
26
|
+
label = "Menu",
|
|
27
|
+
open = $bindable(false),
|
|
28
|
+
placement = "bottom-end",
|
|
29
|
+
class: className,
|
|
30
|
+
triggerLabel = "More actions",
|
|
31
|
+
onselect,
|
|
32
|
+
...rest
|
|
33
|
+
}: OverflowMenuProps = $props();
|
|
34
|
+
|
|
35
|
+
let host: HTMLDivElement | undefined = $state();
|
|
36
|
+
|
|
37
|
+
const classes = () =>
|
|
38
|
+
["st-overflowMenu", `st-overflowMenu--${placement}`, className].filter(Boolean).join(" ");
|
|
39
|
+
|
|
40
|
+
function toggle() {
|
|
41
|
+
open = !open;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function close() {
|
|
45
|
+
open = false;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function selectItem(item: OverflowMenuItem) {
|
|
49
|
+
if (item.disabled) return;
|
|
50
|
+
item.onclick?.();
|
|
51
|
+
onselect?.(item.value);
|
|
52
|
+
close();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function onWindowKeydown(event: KeyboardEvent) {
|
|
56
|
+
if (event.key === "Escape" && open) {
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
close();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function onWindowPointerDown(event: MouseEvent) {
|
|
63
|
+
if (!open) return;
|
|
64
|
+
const target = event.target as Node | null;
|
|
65
|
+
if (host && target && !host.contains(target)) close();
|
|
66
|
+
}
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<svelte:window onkeydown={onWindowKeydown} onpointerdown={onWindowPointerDown} />
|
|
70
|
+
|
|
71
|
+
<div {...rest} bind:this={host} class={classes()}>
|
|
72
|
+
<button
|
|
73
|
+
type="button"
|
|
74
|
+
class="st-overflowMenu__trigger"
|
|
75
|
+
aria-haspopup="menu"
|
|
76
|
+
aria-expanded={open ? "true" : "false"}
|
|
77
|
+
aria-label={triggerLabel}
|
|
78
|
+
onclick={toggle}
|
|
79
|
+
>
|
|
80
|
+
<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" focusable="false">
|
|
81
|
+
<circle cx="3" cy="8" r="1.4" fill="currentColor" />
|
|
82
|
+
<circle cx="8" cy="8" r="1.4" fill="currentColor" />
|
|
83
|
+
<circle cx="13" cy="8" r="1.4" fill="currentColor" />
|
|
84
|
+
</svg>
|
|
85
|
+
</button>
|
|
86
|
+
{#if open}
|
|
87
|
+
<ul class="st-overflowMenu__list" role="menu" aria-label={label}>
|
|
88
|
+
{#each items as item (item.value)}
|
|
89
|
+
<li role="none" class="st-overflowMenu__listItem">
|
|
90
|
+
<button
|
|
91
|
+
type="button"
|
|
92
|
+
class="st-overflowMenu__item"
|
|
93
|
+
class:st-overflowMenu__item--danger={item.danger}
|
|
94
|
+
role="menuitem"
|
|
95
|
+
aria-disabled={item.disabled ? "true" : undefined}
|
|
96
|
+
disabled={item.disabled}
|
|
97
|
+
onclick={() => selectItem(item)}
|
|
98
|
+
>
|
|
99
|
+
{item.label}
|
|
100
|
+
</button>
|
|
101
|
+
</li>
|
|
102
|
+
{/each}
|
|
103
|
+
</ul>
|
|
104
|
+
{/if}
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
<style>
|
|
108
|
+
.st-overflowMenu {
|
|
109
|
+
display: inline-block;
|
|
110
|
+
position: relative;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.st-overflowMenu__trigger {
|
|
114
|
+
align-items: center;
|
|
115
|
+
background: transparent;
|
|
116
|
+
border: 1px solid transparent;
|
|
117
|
+
border-radius: var(--st-component-overflowMenu-triggerRadius, var(--st-radius-small, 0.375rem));
|
|
118
|
+
color: var(--st-component-overflowMenu-triggerText, var(--st-semantic-text-primary));
|
|
119
|
+
cursor: pointer;
|
|
120
|
+
display: inline-flex;
|
|
121
|
+
height: 2rem;
|
|
122
|
+
justify-content: center;
|
|
123
|
+
padding: 0;
|
|
124
|
+
width: 2rem;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.st-overflowMenu__trigger:hover {
|
|
128
|
+
background: var(
|
|
129
|
+
--st-component-overflowMenu-triggerHoverBackground,
|
|
130
|
+
var(--st-semantic-surface-subtle)
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.st-overflowMenu__trigger:focus-visible {
|
|
135
|
+
border-color: var(--st-component-control-focusRing, var(--st-semantic-border-interactive));
|
|
136
|
+
box-shadow: 0 0 0 2px var(--st-component-control-focusRing, var(--st-semantic-border-interactive));
|
|
137
|
+
outline: none;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.st-overflowMenu__trigger[aria-expanded="true"] {
|
|
141
|
+
background: var(
|
|
142
|
+
--st-component-overflowMenu-triggerHoverBackground,
|
|
143
|
+
var(--st-semantic-surface-subtle)
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.st-overflowMenu__list {
|
|
148
|
+
background: var(--st-component-menu-background, var(--st-semantic-surface-raised));
|
|
149
|
+
border: 1px solid var(--st-component-menu-border, var(--st-semantic-border-subtle));
|
|
150
|
+
border-radius: var(--st-component-menu-radius, 0.375rem);
|
|
151
|
+
box-shadow: var(--st-component-menu-shadow, 0 8px 24px rgb(15 23 42 / 0.14));
|
|
152
|
+
display: grid;
|
|
153
|
+
list-style: none;
|
|
154
|
+
margin: 0;
|
|
155
|
+
min-width: 12rem;
|
|
156
|
+
padding: var(--st-spacing-1, 0.25rem);
|
|
157
|
+
position: absolute;
|
|
158
|
+
z-index: var(--st-component-popover-zIndex, 80);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.st-overflowMenu--bottom-end .st-overflowMenu__list {
|
|
162
|
+
right: 0;
|
|
163
|
+
top: calc(100% + var(--st-spacing-1, 0.25rem));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.st-overflowMenu--bottom-start .st-overflowMenu__list {
|
|
167
|
+
left: 0;
|
|
168
|
+
top: calc(100% + var(--st-spacing-1, 0.25rem));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.st-overflowMenu--top-end .st-overflowMenu__list {
|
|
172
|
+
bottom: calc(100% + var(--st-spacing-1, 0.25rem));
|
|
173
|
+
right: 0;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.st-overflowMenu--top-start .st-overflowMenu__list {
|
|
177
|
+
bottom: calc(100% + var(--st-spacing-1, 0.25rem));
|
|
178
|
+
left: 0;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.st-overflowMenu__listItem {
|
|
182
|
+
margin: 0;
|
|
183
|
+
padding: 0;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.st-overflowMenu__item {
|
|
187
|
+
background: transparent;
|
|
188
|
+
border: 0;
|
|
189
|
+
border-radius: var(--st-radius-small, 0.375rem);
|
|
190
|
+
color: var(--st-component-menu-text, var(--st-semantic-text-primary));
|
|
191
|
+
cursor: pointer;
|
|
192
|
+
display: block;
|
|
193
|
+
font: inherit;
|
|
194
|
+
padding: var(--st-spacing-2, 0.5rem) var(--st-spacing-3, 0.75rem);
|
|
195
|
+
text-align: left;
|
|
196
|
+
width: 100%;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.st-overflowMenu__item:hover:not(:disabled),
|
|
200
|
+
.st-overflowMenu__item:focus-visible {
|
|
201
|
+
background: var(--st-component-menu-itemHoverBackground, var(--st-semantic-surface-subtle));
|
|
202
|
+
outline: none;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.st-overflowMenu__item:disabled {
|
|
206
|
+
color: var(--st-component-menu-disabledText, var(--st-semantic-text-muted));
|
|
207
|
+
cursor: not-allowed;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.st-overflowMenu__item--danger {
|
|
211
|
+
color: var(--st-component-overflowMenu-dangerText, var(--st-semantic-feedback-error));
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.st-overflowMenu__item--danger:hover:not(:disabled),
|
|
215
|
+
.st-overflowMenu__item--danger:focus-visible {
|
|
216
|
+
background: var(
|
|
217
|
+
--st-component-overflowMenu-dangerHoverBackground,
|
|
218
|
+
var(--st-semantic-feedback-error)
|
|
219
|
+
);
|
|
220
|
+
color: var(--st-component-overflowMenu-dangerHoverText, var(--st-semantic-action-primaryText));
|
|
221
|
+
}
|
|
222
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface OverflowMenuItem {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
danger?: boolean;
|
|
6
|
+
onclick?: () => void;
|
|
7
|
+
}
|
|
8
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
9
|
+
type OverflowMenuProps = Omit<HTMLAttributes<HTMLDivElement>, "class" | "onselect"> & {
|
|
10
|
+
items: OverflowMenuItem[];
|
|
11
|
+
label?: string;
|
|
12
|
+
open?: boolean;
|
|
13
|
+
placement?: "bottom-start" | "bottom-end" | "top-start" | "top-end";
|
|
14
|
+
class?: string;
|
|
15
|
+
triggerLabel?: string;
|
|
16
|
+
onselect?: (value: string) => void;
|
|
17
|
+
};
|
|
18
|
+
declare const OverflowMenu: import("svelte").Component<OverflowMenuProps, {}, "open">;
|
|
19
|
+
type OverflowMenu = ReturnType<typeof OverflowMenu>;
|
|
20
|
+
export default OverflowMenu;
|
|
21
|
+
//# sourceMappingURL=OverflowMenu.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OverflowMenu.svelte.d.ts","sourceRoot":"","sources":["../src/lib/OverflowMenu.svelte.ts"],"names":[],"mappings":"AAGE,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGpD,KAAK,iBAAiB,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC,GAAG;IACpF,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,cAAc,GAAG,YAAY,GAAG,WAAW,GAAG,SAAS,CAAC;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,CAAC;AA+EJ,QAAA,MAAM,YAAY,2DAAwC,CAAC;AAC3D,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACpD,eAAe,YAAY,CAAC"}
|