lutra 0.1.68 → 0.1.70
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/components/AspectRatio.svelte +19 -9
- package/dist/components/AspectRatio.svelte.d.ts +2 -1
- package/dist/components/Avatar.svelte +5 -8
- package/dist/components/Close.svelte +24 -27
- package/dist/components/Close.svelte.d.ts +2 -0
- package/dist/components/ContextTip.svelte +3 -2
- package/dist/components/DataList.svelte +111 -0
- package/dist/components/DataList.svelte.d.ts +10 -0
- package/dist/components/DataListTypes.d.ts +14 -0
- package/dist/components/DataListTypes.js +1 -0
- package/dist/components/Dialog.svelte +38 -0
- package/dist/components/Icon.svelte +2 -2
- package/dist/components/IconButton.svelte +10 -22
- package/dist/components/Image.svelte +2 -2
- package/dist/components/Indicator.svelte +2 -1
- package/dist/components/Inset.svelte +13 -0
- package/dist/components/Layout.svelte +7 -3
- package/dist/components/Layout.svelte.d.ts +3 -2
- package/dist/components/MenuDropdown.svelte +12 -2
- package/dist/components/MenuItem.svelte +30 -14
- package/dist/components/MenuItem.svelte.d.ts +6 -0
- package/dist/components/Modal.svelte +36 -20
- package/dist/components/Popover.svelte +43 -13
- package/dist/components/TabbedContent.svelte +1 -1
- package/dist/components/TabbedContentItem.svelte +14 -0
- package/dist/components/TabbedContentItem.svelte.d.ts +4 -0
- package/dist/components/Table.svelte +69 -0
- package/dist/components/Table.svelte.d.ts +7 -0
- package/dist/components/Tabs.svelte +44 -36
- package/dist/components/Tag.svelte +53 -13
- package/dist/components/Tag.svelte.d.ts +4 -0
- package/dist/components/Theme.svelte +121 -94
- package/dist/components/Theme.svelte.d.ts +7 -6
- package/dist/components/Toast.svelte +11 -8
- package/dist/components/Tooltip.svelte +17 -10
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/css/1-props.css +197 -163
- package/dist/css/2-init.css +519 -0
- package/dist/css/{2-base.css → 3-base.css} +42 -131
- package/dist/css/{3-typo.css → 4-typo.css} +3 -1
- package/dist/css/lutra.css +7 -6
- package/dist/css/themes/DefaultTheme.css +26 -4
- package/dist/form/Button.svelte +20 -0
- package/dist/form/Button.svelte.d.ts +9 -0
- package/dist/form/Datepicker.svelte +13 -0
- package/dist/form/Datepicker.svelte.d.ts +3 -0
- package/dist/form/FieldContent.svelte +20 -11
- package/dist/form/FieldError.svelte +1 -1
- package/dist/form/FieldGroup.svelte +84 -0
- package/dist/form/FieldGroup.svelte.d.ts +20 -0
- package/dist/form/Fieldset.svelte +19 -11
- package/dist/form/Form.svelte +137 -63
- package/dist/form/Form.svelte.d.ts +21 -0
- package/dist/form/FormActions.svelte +21 -3
- package/dist/form/FormActions.svelte.d.ts +3 -0
- package/dist/form/FormSection.svelte +22 -20
- package/dist/form/ImageUpload.svelte +50 -30
- package/dist/form/ImageUpload.svelte.d.ts +14 -0
- package/dist/form/Input.svelte +62 -30
- package/dist/form/Input.svelte.d.ts +0 -1
- package/dist/form/InputLength.svelte +5 -5
- package/dist/form/Label.svelte +6 -6
- package/dist/form/LogoUpload.svelte +24 -10
- package/dist/form/Select.svelte +23 -10
- package/dist/form/Select.svelte.d.ts +6 -6
- package/dist/form/Textarea.svelte +11 -1
- package/dist/form/Toggle.svelte +162 -0
- package/dist/form/Toggle.svelte.d.ts +31 -17
- package/dist/form/client.svelte.js +0 -2
- package/dist/form/index.d.ts +1 -0
- package/dist/form/index.js +1 -0
- package/dist/state/Persisted.svelte.d.ts +6 -0
- package/dist/state/Persisted.svelte.js +29 -0
- package/dist/state/theme.svelte.d.ts +7 -0
- package/dist/state/theme.svelte.js +14 -0
- package/dist/types.d.ts +6 -23
- package/dist/types.js +0 -17
- package/dist/util/color.js +2 -2
- package/package.json +5 -4
- package/dist/config.d.ts +0 -30
- package/dist/config.js +0 -18
- /package/dist/css/{4-layout.css → 5-layout.css} +0 -0
- /package/dist/css/{5-media.css → 6-media.css} +0 -0
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* A tag is a small piece of information that can be used to categorize or label an item. You can pick between `rounded`, `pill` or `rectangle` shapes. The font size and padding are relative to the parent element by default.
|
|
8
8
|
* Changing the font size without changing the padding will cause padding to be scaled with the font size. This can be changed by setting the `--padding` CSS prop.
|
|
9
9
|
* You can pass a `href` to make the tag a link, or an `onclick` function to make it a button. If you pass a `href`, you can also pass a `target` to specify the target of the link.
|
|
10
|
+
* @cssprop --prefix-padding - The padding of the prefix content. (Default: var(--space-xxs))
|
|
11
|
+
* @cssprop --suffix-padding - The padding of the suffix content. (Default: var(--space-xxs))
|
|
10
12
|
* @cssprop --font-size - The font size of the tag. (Default: 1em)
|
|
11
13
|
* @cssprop --font-weight - The font weight of the tag. (Default: 500)
|
|
12
14
|
* @cssprop --padding - The padding of the tag. (Default: 0.25em 0.5em)
|
|
@@ -26,6 +28,8 @@
|
|
|
26
28
|
href,
|
|
27
29
|
target,
|
|
28
30
|
children,
|
|
31
|
+
prefix,
|
|
32
|
+
suffix
|
|
29
33
|
}: {
|
|
30
34
|
/** Use a mono-spaced font for the tag. */
|
|
31
35
|
code?: boolean;
|
|
@@ -41,6 +45,10 @@
|
|
|
41
45
|
target?: string;
|
|
42
46
|
/** The content of the tag. */
|
|
43
47
|
children: Snippet;
|
|
48
|
+
/** Prefix content, to display before the tag. */
|
|
49
|
+
prefix?: string | Snippet;
|
|
50
|
+
/** Suffix content, to display after the tag. */
|
|
51
|
+
suffix?: string | Snippet;
|
|
44
52
|
} = $props();
|
|
45
53
|
let isSet = $derived(color ? isStatusColor(color) : true);
|
|
46
54
|
</script>
|
|
@@ -51,30 +59,61 @@
|
|
|
51
59
|
</em>
|
|
52
60
|
{/snippet}
|
|
53
61
|
|
|
62
|
+
{#snippet _prefix()}
|
|
63
|
+
{#if prefix}
|
|
64
|
+
<span class="Prefix">
|
|
65
|
+
{#if typeof prefix === 'string'}
|
|
66
|
+
{prefix}
|
|
67
|
+
{:else}
|
|
68
|
+
{@render prefix()}
|
|
69
|
+
{/if}
|
|
70
|
+
</span>
|
|
71
|
+
{/if}
|
|
72
|
+
{/snippet}
|
|
73
|
+
|
|
74
|
+
{#snippet _suffix()}
|
|
75
|
+
{#if suffix}
|
|
76
|
+
<span class="Suffix">
|
|
77
|
+
{#if typeof suffix === 'string'}
|
|
78
|
+
{suffix}
|
|
79
|
+
{:else}
|
|
80
|
+
{@render suffix()}
|
|
81
|
+
{/if}
|
|
82
|
+
</span>
|
|
83
|
+
{/if}
|
|
84
|
+
{/snippet}
|
|
85
|
+
|
|
54
86
|
{#if href}
|
|
55
87
|
<a {href} {target} class:code class="Tag Link {shape}" style="--bgColor: {!isSet ? color : 'var(--status-'+color+'-background)'}; --textColor: {!isSet ? color : 'var(--status-'+color+'-color)'};" onclick={onclick}>
|
|
88
|
+
{@render _prefix()}
|
|
56
89
|
{@render content()}
|
|
90
|
+
{@render _suffix()}
|
|
57
91
|
</a>
|
|
58
92
|
{:else if onclick}
|
|
59
93
|
<button type="button" class:code class="Tag {shape}" style="--bgColor: {!isSet ? color : 'var(--status-'+color+'-background)'}; --textColor: {!isSet ? color : 'var(--status-'+color+'-color)'};" onclick={onclick}>
|
|
94
|
+
{@render _prefix()}
|
|
60
95
|
{@render content()}
|
|
96
|
+
{@render _suffix()}
|
|
61
97
|
</button>
|
|
62
98
|
{:else}
|
|
63
99
|
<span class:code class="Tag {shape}" style="--bgColor: {!isSet ? color : 'var(--status-'+color+'-background)'}; --textColor: {!isSet ? color : 'var(--status-'+color+'-color)'};">
|
|
100
|
+
{@render _prefix()}
|
|
64
101
|
{@render content()}
|
|
102
|
+
{@render _suffix()}
|
|
65
103
|
</span>
|
|
66
104
|
{/if}
|
|
67
105
|
|
|
68
106
|
<style>
|
|
69
107
|
.Tag {
|
|
70
108
|
display: inline-flex;
|
|
109
|
+
align-items: center;
|
|
71
110
|
padding: var(--padding, 0.5em 0.5em);
|
|
72
|
-
font-weight: var(--font-weight,
|
|
111
|
+
font-weight: var(--font-weight, var(--font-weight-normal));
|
|
73
112
|
background: var(--bgColor);
|
|
74
|
-
border-radius: var(--border-radius);
|
|
113
|
+
border-radius: var(--border-radius-base);
|
|
75
114
|
font-size: var(--font-size, 0.85em);
|
|
76
115
|
vertical-align: var(--vertical-align, baseline);
|
|
77
|
-
border:
|
|
116
|
+
border: var(--border-size-thin) solid color-mix(in oklch, var(--bgColor) 95%, var(--mix-target, black) 5%);
|
|
78
117
|
}
|
|
79
118
|
.Tag.rectangle {
|
|
80
119
|
border-radius: 0;
|
|
@@ -87,26 +126,27 @@
|
|
|
87
126
|
padding: var(--padding, 0.15em 0.35em);
|
|
88
127
|
font-size: 1em;
|
|
89
128
|
line-height: 1em;
|
|
90
|
-
background: var(--
|
|
91
|
-
color: var(--textColor);
|
|
92
|
-
border: var(--border
|
|
129
|
+
background: var(--code-background);
|
|
130
|
+
color: var(--textColor, var(--code-color));
|
|
131
|
+
border: var(--code-border-size) var(--code-border-style) var(--code-border-color);
|
|
93
132
|
}
|
|
94
133
|
em {
|
|
95
134
|
font-style: normal;
|
|
96
|
-
left: 50%;
|
|
97
135
|
text-box: trim-both cap alphabetic;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
136
|
+
}
|
|
137
|
+
.Prefix {
|
|
138
|
+
padding-inline-end: var(--prefix-padding, var(--space-xxs));
|
|
139
|
+
}
|
|
140
|
+
.Suffix {
|
|
141
|
+
padding-inline-start: var(--suffix-padding, var(--space-xxs));
|
|
101
142
|
}
|
|
102
143
|
a:hover, button:hover {
|
|
103
|
-
|
|
104
|
-
background-color: var(--bgColor2);
|
|
144
|
+
background-color: color-mix(in oklch, var(--bgColor) 87%, white 13%);
|
|
105
145
|
cursor: pointer;
|
|
106
146
|
}
|
|
107
147
|
@media (prefers-contrast: more) {
|
|
108
148
|
.Tag {
|
|
109
|
-
border:
|
|
149
|
+
border: var(--border-size-thin) solid color-mix(in oklch, var(--bgColor) 50%, var(--mix-target, black) 50%);
|
|
110
150
|
}
|
|
111
151
|
em {
|
|
112
152
|
opacity: 0.99;
|
|
@@ -15,6 +15,10 @@ type $$ComponentProps = {
|
|
|
15
15
|
target?: string;
|
|
16
16
|
/** The content of the tag. */
|
|
17
17
|
children: Snippet;
|
|
18
|
+
/** Prefix content, to display before the tag. */
|
|
19
|
+
prefix?: string | Snippet;
|
|
20
|
+
/** Suffix content, to display after the tag. */
|
|
21
|
+
suffix?: string | Snippet;
|
|
18
22
|
};
|
|
19
23
|
declare const Tag: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
20
24
|
type Tag = ReturnType<typeof Tag>;
|
|
@@ -1,104 +1,131 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
_theme = e.matches ? 'dark' : 'light';
|
|
68
|
-
} else if(root && theme === "invert") {
|
|
69
|
-
_theme = existingTheme === 'light' ? 'dark' : 'light';
|
|
70
|
-
} else if(root && !theme) {
|
|
71
|
-
_theme = existingTheme || getTheme();
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
// Set the theme in the context for child components to access
|
|
77
|
-
setContext(LutraContext.Theme, theme);
|
|
2
|
+
import { BROWSER } from 'esm-env';
|
|
3
|
+
import { setContext, type Snippet } from "svelte";
|
|
4
|
+
import { getContextItem, LutraContext, type LutraTheme } from "../types.js";
|
|
5
|
+
import { theme as themeState } from "../state/theme.svelte.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @description
|
|
9
|
+
* Provides light/dark theming at the root layout level, and can override the theme for nested sections.
|
|
10
|
+
* At the root level, sets the `color-scheme` on the document and manages the `theme-color` meta tag.
|
|
11
|
+
* Nested instances can invert or force a specific theme via `color-scheme` scoping.
|
|
12
|
+
* @example
|
|
13
|
+
* <Theme theme="dark">
|
|
14
|
+
* <p>This section is always dark.</p>
|
|
15
|
+
* </Theme>
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
let {
|
|
19
|
+
theme,
|
|
20
|
+
themeColor,
|
|
21
|
+
children
|
|
22
|
+
}: {
|
|
23
|
+
/** The theme to use. Leave undefined to use the system theme. */
|
|
24
|
+
theme?: LutraTheme;
|
|
25
|
+
/**
|
|
26
|
+
* Theme color for the theme-color meta tag. Only used in the root theme.
|
|
27
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name/theme-color
|
|
28
|
+
*/
|
|
29
|
+
themeColor?: {
|
|
30
|
+
light?: string;
|
|
31
|
+
dark?: string;
|
|
32
|
+
};
|
|
33
|
+
children: Snippet
|
|
34
|
+
} = $props();
|
|
35
|
+
|
|
36
|
+
const isRoot = getContextItem(LutraContext.Theme)?.() === undefined;
|
|
37
|
+
|
|
38
|
+
const parentTheme = isRoot ? undefined : getContextItem(LutraContext.Theme);
|
|
39
|
+
|
|
40
|
+
/** Effective theme for root, derived reactively from theme state. */
|
|
41
|
+
const rootTheme = $derived.by(() => {
|
|
42
|
+
if (!theme || theme === "system") return themeState.current;
|
|
43
|
+
if (theme === "invert") return themeState.current === "light" ? "dark" : "light";
|
|
44
|
+
return theme as "light" | "dark";
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
/** Effective theme for nested (non-root) Theme components. */
|
|
48
|
+
const nestedTheme = $derived.by(() => {
|
|
49
|
+
if (isRoot) return undefined;
|
|
50
|
+
const parent = parentTheme?.() as "light" | "dark" | undefined;
|
|
51
|
+
if (!theme || theme === "system") return parent;
|
|
52
|
+
if (theme === "invert") return parent === "light" ? "dark" : "light";
|
|
53
|
+
return theme as "light" | "dark";
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
setContext(
|
|
57
|
+
LutraContext.Theme,
|
|
58
|
+
isRoot ? () => rootTheme : () => nestedTheme
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
if (isRoot) {
|
|
62
|
+
$effect(() => {
|
|
63
|
+
document.documentElement.classList.remove("light", "dark");
|
|
64
|
+
document.documentElement.classList.add(rootTheme);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
78
67
|
</script>
|
|
79
68
|
|
|
80
69
|
<svelte:head>
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
70
|
+
{#if isRoot}
|
|
71
|
+
{#if BROWSER && rootTheme === "dark"}
|
|
72
|
+
<meta name="theme-color" content={themeColor?.dark || "#000"} />
|
|
73
|
+
{:else if BROWSER && rootTheme === "light"}
|
|
74
|
+
<meta name="theme-color" content={themeColor?.light || "#fff"} />
|
|
75
|
+
{:else}
|
|
76
|
+
<meta name="theme-color" media="(prefers-color-scheme: light)" content={themeColor?.light || "#fff"} />
|
|
77
|
+
<meta name="theme-color" media="(prefers-color-scheme: dark)" content={themeColor?.dark || "#000"} />
|
|
78
|
+
{/if}
|
|
79
|
+
<script>
|
|
80
|
+
{
|
|
81
|
+
const theme = localStorage.getItem('lutra.theme');
|
|
82
|
+
|
|
83
|
+
document.documentElement.classList.add(
|
|
84
|
+
!theme || theme === 'system'
|
|
85
|
+
? window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
86
|
+
? 'dark'
|
|
87
|
+
: 'light'
|
|
88
|
+
: theme
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
</script>
|
|
92
|
+
{/if}
|
|
84
93
|
</svelte:head>
|
|
85
94
|
|
|
86
|
-
<div
|
|
87
|
-
|
|
95
|
+
<div
|
|
96
|
+
class="Theme"
|
|
97
|
+
class:light={!isRoot && nestedTheme === "light" && (theme !== "invert" || BROWSER)}
|
|
98
|
+
class:dark={!isRoot && nestedTheme === "dark" && (theme !== "invert" || BROWSER)}
|
|
99
|
+
class:invert={!isRoot && theme === "invert"}
|
|
100
|
+
class:isRoot
|
|
101
|
+
>
|
|
102
|
+
{@render children()}
|
|
88
103
|
</div>
|
|
89
104
|
|
|
90
105
|
<style>
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
106
|
+
.Theme {
|
|
107
|
+
display: contents;
|
|
108
|
+
}
|
|
109
|
+
.Theme.light {
|
|
110
|
+
color-scheme: only light;
|
|
111
|
+
}
|
|
112
|
+
.Theme.dark {
|
|
113
|
+
color-scheme: only dark;
|
|
114
|
+
}
|
|
115
|
+
/* CSS-only inversion fallback (SSR / no-JS).
|
|
116
|
+
Active only when JS has not yet added .light/.dark to the element. */
|
|
117
|
+
:global(html:not(.light):not(.dark)) .invert:not(.light):not(.dark) {
|
|
118
|
+
@media (prefers-color-scheme: dark) {
|
|
119
|
+
color-scheme: only light;
|
|
120
|
+
}
|
|
121
|
+
@media (prefers-color-scheme: light) {
|
|
122
|
+
color-scheme: only dark;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
:global(html.dark) .invert:not(.light):not(.dark) {
|
|
126
|
+
color-scheme: only light;
|
|
127
|
+
}
|
|
128
|
+
:global(html.light) .invert:not(.light):not(.dark) {
|
|
129
|
+
color-scheme: only dark;
|
|
130
|
+
}
|
|
103
131
|
</style>
|
|
104
|
-
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { type Snippet } from "svelte";
|
|
2
|
-
import { type LutraRootConfig } from "../config.js";
|
|
3
2
|
import { type LutraTheme } from "../types.js";
|
|
4
3
|
type $$ComponentProps = {
|
|
5
|
-
/**
|
|
6
|
-
* The theme to use. Leave undefined to use the system theme.
|
|
7
|
-
*/
|
|
4
|
+
/** The theme to use. Leave undefined to use the system theme. */
|
|
8
5
|
theme?: LutraTheme;
|
|
9
6
|
/**
|
|
10
|
-
*
|
|
7
|
+
* Theme color for the theme-color meta tag. Only used in the root theme.
|
|
8
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name/theme-color
|
|
11
9
|
*/
|
|
12
|
-
|
|
10
|
+
themeColor?: {
|
|
11
|
+
light?: string;
|
|
12
|
+
dark?: string;
|
|
13
|
+
};
|
|
13
14
|
children: Snippet;
|
|
14
15
|
};
|
|
15
16
|
declare const Theme: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
@@ -5,9 +5,12 @@
|
|
|
5
5
|
import { removeToast } from "./toasts.svelte.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* Uses the
|
|
10
|
-
* Typically
|
|
8
|
+
* @description
|
|
9
|
+
* A styled toast/notification card. Uses the shared surface styling system (background, border, shadow).
|
|
10
|
+
* Typically created via `addToast()` but can be used standalone. Automatically adapts its grid layout
|
|
11
|
+
* based on whether an icon and/or actions are present.
|
|
12
|
+
* @example
|
|
13
|
+
* <Toast title="Saved" content="Your changes have been saved." />
|
|
11
14
|
*/
|
|
12
15
|
let {
|
|
13
16
|
id,
|
|
@@ -42,7 +45,7 @@
|
|
|
42
45
|
}
|
|
43
46
|
</script>
|
|
44
47
|
|
|
45
|
-
<div class="Toast"
|
|
48
|
+
<div class="Toast">
|
|
46
49
|
{#if !actions}
|
|
47
50
|
<Close position="top right" onclick={handleClose} />
|
|
48
51
|
{/if}
|
|
@@ -55,7 +58,7 @@
|
|
|
55
58
|
|
|
56
59
|
<div class="Content">
|
|
57
60
|
{#if title}
|
|
58
|
-
<
|
|
61
|
+
<h5 class="Title">{title}</h5>
|
|
59
62
|
{/if}
|
|
60
63
|
{#if content}
|
|
61
64
|
<p class="Text">{content}</p>
|
|
@@ -95,15 +98,15 @@
|
|
|
95
98
|
}
|
|
96
99
|
}
|
|
97
100
|
|
|
98
|
-
.Toast
|
|
101
|
+
.Toast:has(> .Icon) {
|
|
99
102
|
grid-template-columns: auto 1fr;
|
|
100
103
|
}
|
|
101
104
|
|
|
102
|
-
.Toast
|
|
105
|
+
.Toast:has(> .Actions) {
|
|
103
106
|
grid-template-columns: 1fr auto;
|
|
104
107
|
}
|
|
105
108
|
|
|
106
|
-
.Toast
|
|
109
|
+
.Toast:has(> .Icon):has(> .Actions) {
|
|
107
110
|
grid-template-columns: auto 1fr auto;
|
|
108
111
|
}
|
|
109
112
|
|
|
@@ -28,7 +28,12 @@
|
|
|
28
28
|
* Displays on hover (with delay) or focus (immediate).
|
|
29
29
|
* Supports "warming" - if a tooltip was recently shown, new tooltips appear instantly.
|
|
30
30
|
* @supports prefers-reduced-motion
|
|
31
|
-
* @cssprop --delay - Hover delay before showing (
|
|
31
|
+
* @cssprop --delay - Hover delay before showing. (Default: 0.4s)
|
|
32
|
+
* @cssprop --tooltip-offset - Gap between the anchor and the tooltip. (Default: var(--space-xs))
|
|
33
|
+
* @cssprop --tooltip-padding-block - Block padding of the tooltip. (Default: var(--space-xxs))
|
|
34
|
+
* @cssprop --tooltip-padding-inline - Inline padding of the tooltip. (Default: var(--space-xs))
|
|
35
|
+
* @cssprop --tooltip-font-size - Font size of the tooltip. (Default: max(0.75rem, 11px))
|
|
36
|
+
* @cssprop --tooltip-max-width - Maximum width of the tooltip. (Default: 25ch)
|
|
32
37
|
*/
|
|
33
38
|
let {
|
|
34
39
|
children,
|
|
@@ -99,17 +104,18 @@
|
|
|
99
104
|
position: fixed;
|
|
100
105
|
position-area: block-start center;
|
|
101
106
|
position-try-fallbacks: flip-block;
|
|
102
|
-
margin-block-end:
|
|
107
|
+
margin-block-end: var(--tooltip-offset, var(--space-xs));
|
|
103
108
|
background: var(--tooltip-background, var(--surface-background));
|
|
104
109
|
border: var(--tooltip-border, var(--surface-border));
|
|
105
110
|
border-radius: var(--tooltip-border-radius, var(--surface-border-radius));
|
|
106
111
|
box-shadow: var(--tooltip-shadow, var(--surface-shadow));
|
|
107
|
-
padding:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
112
|
+
padding-block: var(--tooltip-padding-block, var(--space-xxs));
|
|
113
|
+
padding-inline: var(--tooltip-padding-inline, var(--space-xs));
|
|
114
|
+
font-size: var(--tooltip-font-size, max(0.75rem, 11px));
|
|
115
|
+
line-height: var(--font-line-height-tight);
|
|
116
|
+
font-weight: var(--font-weight-normal);
|
|
111
117
|
color: var(--tooltip-color, var(--text-color-p));
|
|
112
|
-
max-width: 25ch;
|
|
118
|
+
max-width: var(--tooltip-max-width, 25ch);
|
|
113
119
|
width: max-content;
|
|
114
120
|
text-align: center;
|
|
115
121
|
opacity: 0;
|
|
@@ -117,12 +123,12 @@
|
|
|
117
123
|
}
|
|
118
124
|
|
|
119
125
|
.TooltipContent :global(code) {
|
|
120
|
-
font-weight:
|
|
126
|
+
font-weight: var(--font-weight-medium);
|
|
121
127
|
}
|
|
122
128
|
|
|
123
129
|
.TooltipContent :global(strong),
|
|
124
130
|
.TooltipContent :global(b) {
|
|
125
|
-
font-weight:
|
|
131
|
+
font-weight: var(--font-weight-semibold);
|
|
126
132
|
}
|
|
127
133
|
|
|
128
134
|
.TooltipTrigger {
|
|
@@ -140,7 +146,8 @@
|
|
|
140
146
|
}
|
|
141
147
|
|
|
142
148
|
|
|
143
|
-
.Tooltip:has(.TooltipTrigger:focus-visible) .TooltipContent
|
|
149
|
+
.Tooltip:has(.TooltipTrigger :focus-visible) .TooltipContent,
|
|
150
|
+
.Tooltip:focus-within .TooltipContent {
|
|
144
151
|
opacity: 1;
|
|
145
152
|
transition-delay: 0s;
|
|
146
153
|
}
|
|
@@ -2,6 +2,7 @@ export { default as AspectRatio } from './AspectRatio.svelte';
|
|
|
2
2
|
export { default as Avatar } from './Avatar.svelte';
|
|
3
3
|
export { default as Close } from './Close.svelte';
|
|
4
4
|
export { default as ContextTip } from './ContextTip.svelte';
|
|
5
|
+
export { default as DataList } from './DataList.svelte';
|
|
5
6
|
export { default as Dialog } from './Dialog.svelte';
|
|
6
7
|
export { default as Icon } from './Icon.svelte';
|
|
7
8
|
export { default as IconButton } from './IconButton.svelte';
|
|
@@ -22,6 +23,7 @@ export { default as Toast } from './Toast.svelte';
|
|
|
22
23
|
export { default as ToastContainer } from './ToastContainer.svelte';
|
|
23
24
|
export { default as Tooltip } from './Tooltip.svelte';
|
|
24
25
|
export { default as UIContent } from './UIContent.svelte';
|
|
26
|
+
export * from './DataListTypes.js';
|
|
25
27
|
export * from './MenuTypes.js';
|
|
26
28
|
export * from './ModalTypes.js';
|
|
27
29
|
export * from './toasts.svelte.js';
|
package/dist/components/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export { default as AspectRatio } from './AspectRatio.svelte';
|
|
|
2
2
|
export { default as Avatar } from './Avatar.svelte';
|
|
3
3
|
export { default as Close } from './Close.svelte';
|
|
4
4
|
export { default as ContextTip } from './ContextTip.svelte';
|
|
5
|
+
export { default as DataList } from './DataList.svelte';
|
|
5
6
|
export { default as Dialog } from './Dialog.svelte';
|
|
6
7
|
export { default as Icon } from './Icon.svelte';
|
|
7
8
|
export { default as IconButton } from './IconButton.svelte';
|
|
@@ -23,6 +24,7 @@ export { default as ToastContainer } from './ToastContainer.svelte';
|
|
|
23
24
|
export { default as Tooltip } from './Tooltip.svelte';
|
|
24
25
|
export { default as UIContent } from './UIContent.svelte';
|
|
25
26
|
// Types and APIs
|
|
27
|
+
export * from './DataListTypes.js';
|
|
26
28
|
export * from './MenuTypes.js';
|
|
27
29
|
export * from './ModalTypes.js';
|
|
28
30
|
export * from './toasts.svelte.js';
|