@sveltia/ui 0.7.5 → 0.8.1
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/package/components/alert/alert.svelte +4 -4
- package/package/components/alert/alert.svelte.d.ts +2 -2
- package/package/components/button/button.svelte +5 -3
- package/package/components/button/button.svelte.d.ts +6 -4
- package/package/components/button/select-button-group.svelte +9 -5
- package/package/components/button/select-button.svelte +5 -4
- package/package/components/button/select-button.svelte.d.ts +2 -0
- package/package/components/calendar/calendar.svelte +20 -14
- package/package/components/checkbox/checkbox-group.svelte +6 -5
- package/package/components/checkbox/checkbox.svelte +6 -4
- package/package/components/checkbox/checkbox.svelte.d.ts +2 -2
- package/package/components/dialog/alert-dialog.svelte +50 -0
- package/package/components/dialog/alert-dialog.svelte.d.ts +55 -0
- package/package/components/dialog/confirmation-dialog.svelte +55 -0
- package/package/components/dialog/confirmation-dialog.svelte.d.ts +57 -0
- package/package/components/dialog/dialog.svelte +165 -221
- package/package/components/dialog/dialog.svelte.d.ts +20 -12
- package/package/components/dialog/prompt-dialog.svelte +87 -0
- package/package/components/dialog/prompt-dialog.svelte.d.ts +72 -0
- package/package/components/disclosure/disclosure.svelte +3 -2
- package/package/components/divider/divider.svelte +1 -1
- package/package/components/divider/spacer.svelte +1 -12
- package/package/components/divider/spacer.svelte.d.ts +0 -2
- package/package/components/drawer/drawer.svelte +119 -209
- package/package/components/drawer/drawer.svelte.d.ts +13 -9
- package/package/components/grid/grid-body.svelte +51 -0
- package/package/components/grid/grid-body.svelte.d.ts +36 -0
- package/package/components/grid/grid-cell.svelte +22 -0
- package/package/components/grid/grid-cell.svelte.d.ts +34 -0
- package/package/components/grid/grid-col-header.svelte +22 -0
- package/package/components/grid/grid-col-header.svelte.d.ts +34 -0
- package/package/components/grid/grid-foot.svelte +27 -0
- package/package/components/grid/grid-foot.svelte.d.ts +34 -0
- package/package/components/grid/grid-head.svelte +27 -0
- package/package/components/grid/grid-head.svelte.d.ts +34 -0
- package/package/components/grid/grid-row-header.svelte +23 -0
- package/package/components/grid/grid-row-header.svelte.d.ts +34 -0
- package/package/components/grid/grid-row.svelte +37 -0
- package/package/components/grid/grid-row.svelte.d.ts +44 -0
- package/package/components/grid/grid.svelte +52 -0
- package/package/components/grid/grid.svelte.d.ts +42 -0
- package/package/components/icon/icon.svelte +6 -7
- package/package/components/icon/icon.svelte.d.ts +0 -2
- package/package/components/listbox/listbox.svelte +3 -3
- package/package/components/listbox/option-group.svelte +6 -5
- package/package/components/listbox/option.svelte +7 -28
- package/package/components/listbox/option.svelte.d.ts +2 -0
- package/package/components/menu/menu-button.svelte +26 -16
- package/package/components/menu/menu-button.svelte.d.ts +2 -2
- package/package/components/menu/menu-item-checkbox.svelte +5 -4
- package/package/components/menu/menu-item-checkbox.svelte.d.ts +2 -0
- package/package/components/menu/menu-item-group.svelte +4 -3
- package/package/components/menu/menu-item-radio.svelte +5 -4
- package/package/components/menu/menu-item-radio.svelte.d.ts +2 -0
- package/package/components/menu/menu-item.svelte +7 -5
- package/package/components/menu/menu-item.svelte.d.ts +4 -2
- package/package/components/menu/menu.svelte +1 -1
- package/package/components/radio/radio-group.svelte +5 -5
- package/package/components/radio/radio.svelte +5 -2
- package/package/components/radio/radio.svelte.d.ts +2 -0
- package/package/components/select/combobox.svelte +11 -9
- package/package/components/slider/slider.svelte +12 -5
- package/package/components/switch/switch.svelte +3 -2
- package/package/components/switch/switch.svelte.d.ts +2 -2
- package/package/components/table/table-body.svelte +31 -3
- package/package/components/table/table-body.svelte.d.ts +2 -0
- package/package/components/table/table-cell.svelte +3 -4
- package/package/components/table/table-cell.svelte.d.ts +1 -1
- package/package/components/table/table-col-header.svelte +1 -2
- package/package/components/table/table-foot.svelte +7 -3
- package/package/components/table/table-head.svelte +7 -3
- package/package/components/table/table-row-header.svelte +1 -2
- package/package/components/table/table-row.svelte +1 -14
- package/package/components/table/table-row.svelte.d.ts +0 -8
- package/package/components/table/table.svelte +5 -17
- package/package/components/table/table.svelte.d.ts +1 -7
- package/package/components/tabs/tab-list.svelte +7 -5
- package/package/components/tabs/tab-panel.svelte +1 -1
- package/package/components/tabs/tab.svelte +2 -1
- package/package/components/tabs/tab.svelte.d.ts +2 -0
- package/package/components/text-field/markdown-editor.svelte +30 -6
- package/package/components/text-field/markdown-editor.svelte.d.ts +2 -0
- package/package/components/text-field/number-input.svelte +36 -6
- package/package/components/text-field/number-input.svelte.d.ts +2 -0
- package/package/components/text-field/password-input.svelte +34 -8
- package/package/components/text-field/password-input.svelte.d.ts +2 -0
- package/package/components/text-field/search-bar.svelte +39 -11
- package/package/components/text-field/search-bar.svelte.d.ts +5 -0
- package/package/components/text-field/text-area.svelte +21 -2
- package/package/components/text-field/text-area.svelte.d.ts +2 -0
- package/package/components/text-field/text-input.svelte +22 -4
- package/package/components/text-field/text-input.svelte.d.ts +7 -2
- package/package/components/toast/toast.svelte +47 -17
- package/package/components/toast/toast.svelte.d.ts +7 -3
- package/package/components/toolbar/toolbar.svelte +3 -4
- package/package/components/util/app-shell.svelte +26 -27
- package/package/components/util/group.svelte +2 -2
- package/package/components/util/modal.svelte +220 -0
- package/package/components/util/modal.svelte.d.ts +83 -0
- package/package/components/util/popup.svelte +81 -127
- package/package/components/util/popup.svelte.d.ts +22 -18
- package/package/components/util/portal.svelte +1 -1
- package/package/index.d.ts +12 -0
- package/package/index.js +12 -0
- package/package/locales/en.d.ts +1 -0
- package/package/locales/en.js +1 -0
- package/package/locales/ja.d.ts +1 -0
- package/package/locales/ja.js +1 -0
- package/package/services/group.js +51 -13
- package/package/styles/core.scss +9 -26
- package/package/styles/variables.scss +12 -0
- package/package/typedef.d.ts +1 -0
- package/package/typedef.js +5 -0
- package/package.json +97 -1
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
<script>
|
|
11
11
|
import { _ } from 'svelte-i18n';
|
|
12
|
+
import { getRandomId } from '../../services/util';
|
|
12
13
|
import Button from '../button/button.svelte';
|
|
13
14
|
import Icon from '../icon/icon.svelte';
|
|
14
15
|
import TextInput from './text-input.svelte';
|
|
@@ -19,6 +20,11 @@
|
|
|
19
20
|
*/
|
|
20
21
|
let className = '';
|
|
21
22
|
export { className as class };
|
|
23
|
+
/**
|
|
24
|
+
* Make the text input container flexible.
|
|
25
|
+
* @type {boolean}
|
|
26
|
+
*/
|
|
27
|
+
export let flex = false;
|
|
22
28
|
/**
|
|
23
29
|
* Whether to hide the widget. An alias of the `aria-hidden` attribute.
|
|
24
30
|
* @type {boolean | undefined}
|
|
@@ -50,6 +56,7 @@
|
|
|
50
56
|
*/
|
|
51
57
|
export let value = undefined;
|
|
52
58
|
|
|
59
|
+
const id = getRandomId('searchbox');
|
|
53
60
|
/**
|
|
54
61
|
* Reference to the `TextInput` component.
|
|
55
62
|
* @type {TextInput | undefined}
|
|
@@ -67,19 +74,22 @@
|
|
|
67
74
|
</script>
|
|
68
75
|
|
|
69
76
|
<div
|
|
77
|
+
role={hidden ? undefined : 'none'}
|
|
70
78
|
class="sui search-bar {className}"
|
|
79
|
+
class:flex
|
|
71
80
|
class:disabled
|
|
72
81
|
class:readonly
|
|
73
|
-
role="search"
|
|
74
82
|
hidden={hidden || undefined}
|
|
75
83
|
aria-hidden={hidden}
|
|
76
84
|
>
|
|
77
|
-
<span>
|
|
85
|
+
<span role="none">
|
|
78
86
|
<Icon name="search" />
|
|
79
87
|
</span>
|
|
80
88
|
<TextInput
|
|
81
|
-
bind:value
|
|
82
89
|
role="searchbox"
|
|
90
|
+
{id}
|
|
91
|
+
bind:value
|
|
92
|
+
{flex}
|
|
83
93
|
{hidden}
|
|
84
94
|
{disabled}
|
|
85
95
|
{readonly}
|
|
@@ -97,6 +107,8 @@
|
|
|
97
107
|
{#if value}
|
|
98
108
|
<Button
|
|
99
109
|
iconic
|
|
110
|
+
aria-label={$_('_sui.clear')}
|
|
111
|
+
aria-controls={id}
|
|
100
112
|
on:click={() => {
|
|
101
113
|
value = '';
|
|
102
114
|
input?.focus();
|
|
@@ -107,21 +119,29 @@
|
|
|
107
119
|
});
|
|
108
120
|
}}
|
|
109
121
|
>
|
|
110
|
-
<Icon slot="start-icon" name="close"
|
|
122
|
+
<Icon slot="start-icon" name="close" />
|
|
111
123
|
</Button>
|
|
112
124
|
{/if}
|
|
113
125
|
</div>
|
|
114
126
|
|
|
115
|
-
<style
|
|
116
|
-
display: flex;
|
|
127
|
+
<style>.search-bar {
|
|
128
|
+
display: inline-flex;
|
|
117
129
|
align-items: center;
|
|
118
130
|
position: relative;
|
|
131
|
+
margin: var(--sui-focus-ring-width);
|
|
132
|
+
min-width: var(--sui-textbox-singleline-min-width);
|
|
119
133
|
}
|
|
120
|
-
|
|
134
|
+
.search-bar.flex {
|
|
135
|
+
width: -moz-available;
|
|
136
|
+
width: -webkit-fill-available;
|
|
137
|
+
width: stretch;
|
|
138
|
+
min-width: 0;
|
|
139
|
+
}
|
|
140
|
+
.search-bar :global(.icon) {
|
|
121
141
|
font-size: var(--sui-font-size-xx-large);
|
|
122
142
|
opacity: 0.5;
|
|
123
143
|
}
|
|
124
|
-
|
|
144
|
+
.search-bar > span {
|
|
125
145
|
position: absolute;
|
|
126
146
|
inset: 0 auto 0 0;
|
|
127
147
|
z-index: 2;
|
|
@@ -131,16 +151,24 @@
|
|
|
131
151
|
width: var(--sui-button-medium-height);
|
|
132
152
|
height: var(--sui-button-medium-height);
|
|
133
153
|
}
|
|
134
|
-
|
|
154
|
+
.search-bar > :global(button) {
|
|
135
155
|
position: absolute;
|
|
136
156
|
inset: 0 0 auto auto;
|
|
137
157
|
z-index: 2;
|
|
158
|
+
margin: 0 !important;
|
|
138
159
|
height: var(--sui-button-medium-height);
|
|
139
160
|
}
|
|
140
|
-
|
|
161
|
+
.search-bar :global(.label) {
|
|
141
162
|
inset: 0 36px;
|
|
142
163
|
}
|
|
143
|
-
|
|
164
|
+
.search-bar :global(.text-input) {
|
|
165
|
+
flex: auto;
|
|
166
|
+
margin: 0 !important;
|
|
167
|
+
width: 0;
|
|
168
|
+
min-width: 0 !important;
|
|
169
|
+
}
|
|
170
|
+
.search-bar :global(input) {
|
|
171
|
+
z-index: 1;
|
|
144
172
|
padding: 0 var(--sui-button-medium-height) !important;
|
|
145
173
|
width: 100%;
|
|
146
174
|
}</style>
|
|
@@ -17,6 +17,7 @@ export default class SearchBar extends SvelteComponent<{
|
|
|
17
17
|
value?: string;
|
|
18
18
|
hidden?: boolean;
|
|
19
19
|
readonly?: boolean;
|
|
20
|
+
flex?: boolean;
|
|
20
21
|
}, {
|
|
21
22
|
input: Event;
|
|
22
23
|
keydown: KeyboardEvent;
|
|
@@ -31,6 +32,9 @@ export default class SearchBar extends SvelteComponent<{
|
|
|
31
32
|
set class(arg: string);
|
|
32
33
|
get class(): string;
|
|
33
34
|
/**accessor*/
|
|
35
|
+
set flex(arg: boolean);
|
|
36
|
+
get flex(): boolean;
|
|
37
|
+
/**accessor*/
|
|
34
38
|
set hidden(arg: boolean);
|
|
35
39
|
get hidden(): boolean;
|
|
36
40
|
/**accessor*/
|
|
@@ -64,6 +68,7 @@ declare const __propDef: {
|
|
|
64
68
|
value?: string | undefined;
|
|
65
69
|
hidden?: boolean | undefined;
|
|
66
70
|
readonly?: boolean;
|
|
71
|
+
flex?: boolean;
|
|
67
72
|
};
|
|
68
73
|
events: {
|
|
69
74
|
input: Event;
|
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
*/
|
|
13
13
|
let className = '';
|
|
14
14
|
export { className as class };
|
|
15
|
+
/**
|
|
16
|
+
* Make the text input container flexible.
|
|
17
|
+
* @type {boolean}
|
|
18
|
+
*/
|
|
19
|
+
export let flex = false;
|
|
15
20
|
/**
|
|
16
21
|
* Whether to hide the widget. An alias of the `aria-hidden` attribute.
|
|
17
22
|
* @type {boolean | undefined}
|
|
@@ -54,7 +59,14 @@
|
|
|
54
59
|
export let autoResize = false;
|
|
55
60
|
</script>
|
|
56
61
|
|
|
57
|
-
<div
|
|
62
|
+
<div
|
|
63
|
+
role="none"
|
|
64
|
+
class="sui text-area {className}"
|
|
65
|
+
class:flex
|
|
66
|
+
class:disabled
|
|
67
|
+
class:readonly
|
|
68
|
+
hidden={hidden || undefined}
|
|
69
|
+
>
|
|
58
70
|
<textarea
|
|
59
71
|
{name}
|
|
60
72
|
bind:value
|
|
@@ -78,7 +90,14 @@
|
|
|
78
90
|
|
|
79
91
|
<style>.text-area {
|
|
80
92
|
display: inline-grid;
|
|
81
|
-
|
|
93
|
+
margin: var(--sui-focus-ring-width);
|
|
94
|
+
min-width: var(--sui-textbox-multiline-min-width);
|
|
95
|
+
}
|
|
96
|
+
.text-area.flex {
|
|
97
|
+
width: -moz-available;
|
|
98
|
+
width: -webkit-fill-available;
|
|
99
|
+
width: stretch;
|
|
100
|
+
min-width: 0;
|
|
82
101
|
}
|
|
83
102
|
|
|
84
103
|
textarea,
|
|
@@ -17,6 +17,7 @@ export default class TextArea extends SvelteComponent<{
|
|
|
17
17
|
value?: string;
|
|
18
18
|
hidden?: boolean;
|
|
19
19
|
readonly?: boolean;
|
|
20
|
+
flex?: boolean;
|
|
20
21
|
autoResize?: boolean;
|
|
21
22
|
}, {
|
|
22
23
|
click: MouseEvent;
|
|
@@ -41,6 +42,7 @@ declare const __propDef: {
|
|
|
41
42
|
value?: string | undefined;
|
|
42
43
|
hidden?: boolean | undefined;
|
|
43
44
|
readonly?: boolean;
|
|
45
|
+
flex?: boolean;
|
|
44
46
|
autoResize?: boolean;
|
|
45
47
|
};
|
|
46
48
|
events: {
|
|
@@ -21,6 +21,11 @@
|
|
|
21
21
|
*/
|
|
22
22
|
let className = '';
|
|
23
23
|
export { className as class };
|
|
24
|
+
/**
|
|
25
|
+
* Make the text input container flexible.
|
|
26
|
+
* @type {boolean}
|
|
27
|
+
*/
|
|
28
|
+
export let flex = false;
|
|
24
29
|
/**
|
|
25
30
|
* The `role` attribute on the `<input>` element.
|
|
26
31
|
* @type {'textbox' | 'searchbox' | 'combobox' | 'spinbutton'}
|
|
@@ -85,7 +90,14 @@
|
|
|
85
90
|
$: ariaLabel = $$restProps['aria-label'];
|
|
86
91
|
</script>
|
|
87
92
|
|
|
88
|
-
<div
|
|
93
|
+
<div
|
|
94
|
+
role="none"
|
|
95
|
+
class="sui text-input {className}"
|
|
96
|
+
class:flex
|
|
97
|
+
class:disabled
|
|
98
|
+
class:readonly
|
|
99
|
+
hidden={hidden || undefined}
|
|
100
|
+
>
|
|
89
101
|
<input
|
|
90
102
|
type="text"
|
|
91
103
|
{role}
|
|
@@ -117,10 +129,17 @@
|
|
|
117
129
|
</div>
|
|
118
130
|
|
|
119
131
|
<style>.text-input {
|
|
120
|
-
position: relative;
|
|
121
|
-
width: 100%;
|
|
122
132
|
display: inline-flex;
|
|
123
133
|
align-items: center;
|
|
134
|
+
position: relative;
|
|
135
|
+
margin: var(--sui-focus-ring-width);
|
|
136
|
+
min-width: var(--sui-textbox-singleline-min-width);
|
|
137
|
+
}
|
|
138
|
+
.text-input.flex {
|
|
139
|
+
width: -moz-available;
|
|
140
|
+
width: -webkit-fill-available;
|
|
141
|
+
width: stretch;
|
|
142
|
+
min-width: 0;
|
|
124
143
|
}
|
|
125
144
|
|
|
126
145
|
input:-webkit-autofill,
|
|
@@ -129,7 +148,6 @@ input:-webkit-autofill:focus {
|
|
|
129
148
|
}
|
|
130
149
|
|
|
131
150
|
input {
|
|
132
|
-
z-index: 1;
|
|
133
151
|
display: inline-block;
|
|
134
152
|
flex: auto;
|
|
135
153
|
border-width: 1px;
|
|
@@ -14,11 +14,12 @@ export default class TextInput extends SvelteComponent<{
|
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
required?: boolean;
|
|
16
16
|
value?: string | number;
|
|
17
|
+
role?: "textbox" | "searchbox" | "combobox" | "spinbutton";
|
|
17
18
|
hidden?: boolean;
|
|
18
19
|
element?: HTMLInputElement;
|
|
19
|
-
role?: "textbox" | "searchbox" | "combobox" | "spinbutton";
|
|
20
20
|
readonly?: boolean;
|
|
21
21
|
keyShortcuts?: string;
|
|
22
|
+
flex?: boolean;
|
|
22
23
|
showInlineLabel?: boolean;
|
|
23
24
|
inputmode?: "text" | "numeric" | "decimal" | "tel" | "search" | "email" | "url";
|
|
24
25
|
}, {
|
|
@@ -37,6 +38,9 @@ export default class TextInput extends SvelteComponent<{
|
|
|
37
38
|
set class(arg: string);
|
|
38
39
|
get class(): string;
|
|
39
40
|
/**accessor*/
|
|
41
|
+
set flex(arg: boolean);
|
|
42
|
+
get flex(): boolean;
|
|
43
|
+
/**accessor*/
|
|
40
44
|
set role(arg: "textbox" | "searchbox" | "combobox" | "spinbutton");
|
|
41
45
|
get role(): "textbox" | "searchbox" | "combobox" | "spinbutton";
|
|
42
46
|
/**accessor*/
|
|
@@ -83,11 +87,12 @@ declare const __propDef: {
|
|
|
83
87
|
disabled?: boolean;
|
|
84
88
|
required?: boolean;
|
|
85
89
|
value?: string | number | undefined;
|
|
90
|
+
role?: 'textbox' | 'searchbox' | 'combobox' | 'spinbutton';
|
|
86
91
|
hidden?: boolean | undefined;
|
|
87
92
|
element?: HTMLInputElement | undefined;
|
|
88
|
-
role?: 'textbox' | 'searchbox' | 'combobox' | 'spinbutton';
|
|
89
93
|
readonly?: boolean;
|
|
90
94
|
keyShortcuts?: string | undefined;
|
|
95
|
+
flex?: boolean;
|
|
91
96
|
showInlineLabel?: boolean;
|
|
92
97
|
inputmode?: 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';
|
|
93
98
|
};
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
|
-
Toast notification. Use the Popover API if possible to acquire a non-modal top layer.
|
|
3
|
+
Toast/snackbar notification. Use the Popover API if possible to acquire a non-modal top layer.
|
|
4
4
|
@see https://w3c.github.io/aria/#alert
|
|
5
5
|
@see https://developer.chrome.com/blog/introducing-popover-api/
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
8
|
import { onMount } from 'svelte';
|
|
9
|
-
import Alert from '../alert/alert.svelte';
|
|
10
9
|
|
|
11
10
|
/**
|
|
11
|
+
* The toast ID. If updated, the timer that hides the toast will be reset, meaning the same toast
|
|
12
|
+
* can be displayed for a longer period of time.
|
|
13
|
+
* @type {number}
|
|
14
|
+
*/
|
|
15
|
+
export let id = undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Whether to show the toast.
|
|
12
18
|
* @type {boolean}
|
|
13
19
|
*/
|
|
14
20
|
export let show = false;
|
|
@@ -18,10 +24,10 @@
|
|
|
18
24
|
*/
|
|
19
25
|
export let duration = 5000;
|
|
20
26
|
/**
|
|
21
|
-
*
|
|
22
|
-
* @type {
|
|
27
|
+
* Position of the toast.
|
|
28
|
+
* @type {ToastPosition}
|
|
23
29
|
*/
|
|
24
|
-
export let
|
|
30
|
+
export let position = 'bottom-right';
|
|
25
31
|
|
|
26
32
|
/**
|
|
27
33
|
* @type {HTMLElement}
|
|
@@ -35,6 +41,10 @@
|
|
|
35
41
|
* @type {HTMLElement}
|
|
36
42
|
*/
|
|
37
43
|
let toast;
|
|
44
|
+
/**
|
|
45
|
+
* @type {number}
|
|
46
|
+
*/
|
|
47
|
+
let timerId = 0;
|
|
38
48
|
|
|
39
49
|
onMount(() => {
|
|
40
50
|
popover = document.querySelector('.sui.toast-base.enabled');
|
|
@@ -65,22 +75,23 @@
|
|
|
65
75
|
}
|
|
66
76
|
|
|
67
77
|
$: {
|
|
78
|
+
void id;
|
|
79
|
+
void show;
|
|
80
|
+
void duration;
|
|
81
|
+
window.clearTimeout(timerId);
|
|
82
|
+
|
|
68
83
|
if (show && duration) {
|
|
69
|
-
window.setTimeout(() => {
|
|
84
|
+
timerId = window.setTimeout(() => {
|
|
70
85
|
show = false;
|
|
71
86
|
}, duration);
|
|
72
87
|
}
|
|
73
88
|
}
|
|
74
89
|
</script>
|
|
75
90
|
|
|
76
|
-
<div class="sui toast-base" bind:this={popoverBase} />
|
|
91
|
+
<div role="none" class="sui toast-base" bind:this={popoverBase} />
|
|
77
92
|
|
|
78
|
-
<div class="sui toast" hidden={!show
|
|
79
|
-
<
|
|
80
|
-
{#if show}
|
|
81
|
-
<slot />
|
|
82
|
-
{/if}
|
|
83
|
-
</Alert>
|
|
93
|
+
<div class="sui toast {position}" aria-hidden={!show} bind:this={toast} {...$$restProps}>
|
|
94
|
+
<slot />
|
|
84
95
|
</div>
|
|
85
96
|
|
|
86
97
|
<style>.toast-base {
|
|
@@ -95,8 +106,8 @@
|
|
|
95
106
|
margin: 0;
|
|
96
107
|
border: 0;
|
|
97
108
|
padding: 16px;
|
|
98
|
-
width:
|
|
99
|
-
height:
|
|
109
|
+
width: 100dvw;
|
|
110
|
+
height: 100dvh;
|
|
100
111
|
background-color: transparent;
|
|
101
112
|
font-family: var(--sui-font-family-default);
|
|
102
113
|
font-size: var(--sui-font-size-default);
|
|
@@ -108,13 +119,32 @@
|
|
|
108
119
|
|
|
109
120
|
.toast {
|
|
110
121
|
position: absolute;
|
|
111
|
-
inset: auto 16px 16px auto;
|
|
112
122
|
box-shadow: 0 8px 16px var(--sui-popup-shadow-color);
|
|
113
123
|
opacity: 1;
|
|
114
124
|
transition-duration: 250ms;
|
|
115
125
|
will-change: opacity;
|
|
116
126
|
}
|
|
117
|
-
.toast[hidden] {
|
|
127
|
+
.toast[aria-hidden=true] {
|
|
118
128
|
display: block;
|
|
119
129
|
opacity: 0;
|
|
130
|
+
}
|
|
131
|
+
.toast.top-left {
|
|
132
|
+
inset: 16px auto auto 16px;
|
|
133
|
+
}
|
|
134
|
+
.toast.top-center {
|
|
135
|
+
inset: 16px auto auto 50%;
|
|
136
|
+
transform: translateX(-50%);
|
|
137
|
+
}
|
|
138
|
+
.toast.top-right {
|
|
139
|
+
inset: 16px 16px auto auto;
|
|
140
|
+
}
|
|
141
|
+
.toast.bottom-left {
|
|
142
|
+
inset: auto auto 16px 16px;
|
|
143
|
+
}
|
|
144
|
+
.toast.bottom-center {
|
|
145
|
+
inset: auto auto 16px 50%;
|
|
146
|
+
transform: translateX(-50%);
|
|
147
|
+
}
|
|
148
|
+
.toast.bottom-right {
|
|
149
|
+
inset: auto 16px 16px auto;
|
|
120
150
|
}</style>
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
/** @typedef {typeof __propDef.events} ToastEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} ToastSlots */
|
|
4
4
|
/**
|
|
5
|
-
* Toast notification. Use the Popover API if possible to acquire a non-modal top layer.
|
|
5
|
+
* Toast/snackbar notification. Use the Popover API if possible to acquire a non-modal top layer.
|
|
6
6
|
* @see https://w3c.github.io/aria/#alert
|
|
7
7
|
* @see https://developer.chrome.com/blog/introducing-popover-api/
|
|
8
8
|
*/
|
|
9
9
|
export default class Toast extends SvelteComponent<{
|
|
10
|
-
|
|
10
|
+
[x: string]: any;
|
|
11
|
+
id?: number;
|
|
12
|
+
position?: ToastPosition;
|
|
11
13
|
show?: boolean;
|
|
12
14
|
duration?: number;
|
|
13
15
|
}, {
|
|
@@ -22,7 +24,9 @@ export type ToastSlots = typeof __propDef.slots;
|
|
|
22
24
|
import { SvelteComponent } from "svelte";
|
|
23
25
|
declare const __propDef: {
|
|
24
26
|
props: {
|
|
25
|
-
|
|
27
|
+
[x: string]: any;
|
|
28
|
+
id?: number;
|
|
29
|
+
position?: ToastPosition;
|
|
26
30
|
show?: boolean;
|
|
27
31
|
duration?: number;
|
|
28
32
|
};
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
</script>
|
|
35
35
|
|
|
36
36
|
<div
|
|
37
|
-
class="sui toolbar {orientation} {variant ?? ''} {className}"
|
|
38
37
|
role="toolbar"
|
|
38
|
+
class="sui toolbar {orientation} {variant ?? ''} {className}"
|
|
39
39
|
hidden={hidden || undefined}
|
|
40
40
|
aria-hidden={hidden}
|
|
41
41
|
aria-disabled={disabled}
|
|
42
42
|
aria-orientation={orientation}
|
|
43
43
|
{...$$restProps}
|
|
44
44
|
>
|
|
45
|
-
<div class="inner" inert={disabled}>
|
|
45
|
+
<div role="none" class="inner" inert={disabled}>
|
|
46
46
|
<slot />
|
|
47
47
|
</div>
|
|
48
48
|
</div>
|
|
@@ -52,8 +52,7 @@
|
|
|
52
52
|
flex: none !important;
|
|
53
53
|
display: flex;
|
|
54
54
|
align-items: center;
|
|
55
|
-
|
|
56
|
-
padding: 8px;
|
|
55
|
+
padding: 0 4px;
|
|
57
56
|
}
|
|
58
57
|
[role=toolbar].primary {
|
|
59
58
|
--toolbar-size: var(--sui-primary-toolbar-size);
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
<!-- Preload fonts, including the icons -->
|
|
61
61
|
<div class="font-loader" aria-hidden="true" bind:this={fontLoader} style:opacity="0">
|
|
62
62
|
Loading <strong>Sveltia</strong> <em>UI</em>
|
|
63
|
-
<span class="material-symbols-outlined">favorite</span>
|
|
63
|
+
<span role="none" class="material-symbols-outlined">favorite</span>
|
|
64
64
|
</div>
|
|
65
65
|
|
|
66
66
|
<div
|
|
67
|
-
class="sui app-shell"
|
|
68
67
|
role="none"
|
|
68
|
+
class="sui app-shell"
|
|
69
69
|
{...$$restProps}
|
|
70
70
|
on:dragover|preventDefault
|
|
71
71
|
on:drop|preventDefault
|
|
@@ -105,6 +105,7 @@
|
|
|
105
105
|
--sui-primary-accent-color: hsl(var(--sui-base-hue) 80% 40%);
|
|
106
106
|
--sui-primary-accent-color-dark: hsl(var(--sui-base-hue) 80% 35%);
|
|
107
107
|
--sui-primary-accent-color-inverted: hsl(var(--sui-base-hue) 10% 100%);
|
|
108
|
+
--sui-primary-accent-color-translucent: hsl(var(--sui-base-hue) 80% 50% / 40%);
|
|
108
109
|
--sui-error-color-hue: 0;
|
|
109
110
|
--sui-warning-color-hue: 40;
|
|
110
111
|
--sui-info-color-hue: 210;
|
|
@@ -138,6 +139,7 @@
|
|
|
138
139
|
--sui-primary-accent-color: hsl(var(--sui-base-hue) 100% 40%);
|
|
139
140
|
--sui-primary-accent-color-dark: hsl(var(--sui-base-hue) 100% 35%);
|
|
140
141
|
--sui-primary-accent-color-inverted: hsl(var(--sui-base-hue) 10% 100%);
|
|
142
|
+
--sui-primary-accent-color-translucent: hsl(var(--sui-base-hue) 80% 50% / 40%);
|
|
141
143
|
--sui-error-color-hue: 0;
|
|
142
144
|
--sui-warning-color-hue: 40;
|
|
143
145
|
--sui-info-color-hue: 210;
|
|
@@ -201,6 +203,7 @@
|
|
|
201
203
|
var(--sui-success-color-hue) var(--sui-alert-background-color-saturation)
|
|
202
204
|
var(--sui-alert-background-color-lightness)
|
|
203
205
|
);
|
|
206
|
+
--sui-focus-ring-width: 4px;
|
|
204
207
|
--sui-primary-border-color: hsl(var(--sui-border-color-2-hsl));
|
|
205
208
|
--sui-secondary-border-color: hsl(var(--sui-border-color-3-hsl));
|
|
206
209
|
--sui-error-border-color: hsl(
|
|
@@ -283,7 +286,9 @@
|
|
|
283
286
|
--sui-textbox-background-color: hsl(var(--sui-background-color-1-hsl));
|
|
284
287
|
--sui-textbox-font-family: var(--sui-font-family-default);
|
|
285
288
|
--sui-textbox-font-size: var(--sui-font-size-default);
|
|
289
|
+
--sui-textbox-singleline-min-width: 240px;
|
|
286
290
|
--sui-textbox-singleline-line-height: var(--sui-line-height-compact);
|
|
291
|
+
--sui-textbox-multiline-min-width: 480px;
|
|
287
292
|
--sui-textbox-multiline-line-height: var(--sui-line-height-comfortable);
|
|
288
293
|
--sui-tab-small-height: var(--sui-control-small-height);
|
|
289
294
|
--sui-tab-medium-height: var(--sui-control-medium-height);
|
|
@@ -306,6 +311,14 @@
|
|
|
306
311
|
--sui-secondary-row-height: 48px;
|
|
307
312
|
}
|
|
308
313
|
}
|
|
314
|
+
@media (prefers-reduced-transparency) {
|
|
315
|
+
:global(:root),
|
|
316
|
+
:global(:host) {
|
|
317
|
+
--sui-primary-background-color-translucent: hsl(var(--sui-background-color-2-hsl));
|
|
318
|
+
--sui-secondary-background-color-translucent: hsl(var(--sui-background-color-3-hsl));
|
|
319
|
+
--sui-tertiary-background-color-translucent: hsl(var(--sui-background-color-4-hsl));
|
|
320
|
+
}
|
|
321
|
+
}
|
|
309
322
|
|
|
310
323
|
:global(.material-symbols-outlined) {
|
|
311
324
|
font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 24;
|
|
@@ -317,14 +330,21 @@
|
|
|
317
330
|
overflow-anchor: none;
|
|
318
331
|
scroll-behavior: smooth;
|
|
319
332
|
box-sizing: border-box;
|
|
320
|
-
outline-offset:
|
|
321
|
-
outline-width:
|
|
333
|
+
outline-offset: 0px;
|
|
334
|
+
outline-width: var(--sui-focus-ring-width) !important;
|
|
322
335
|
outline-style: solid;
|
|
323
336
|
outline-color: transparent;
|
|
324
337
|
border-width: 0;
|
|
325
338
|
border-style: solid;
|
|
326
339
|
vertical-align: top;
|
|
327
340
|
}
|
|
341
|
+
@media (prefers-reduced-motion) {
|
|
342
|
+
:global(*),
|
|
343
|
+
:global(::before),
|
|
344
|
+
:global(::after) {
|
|
345
|
+
transition-duration: 1ms !important;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
328
348
|
|
|
329
349
|
:global(*) {
|
|
330
350
|
-webkit-tap-highlight-color: transparent;
|
|
@@ -336,7 +356,8 @@
|
|
|
336
356
|
}
|
|
337
357
|
|
|
338
358
|
:global(:focus-visible) {
|
|
339
|
-
outline-color: var(--sui-primary-accent-color-
|
|
359
|
+
outline-color: var(--sui-primary-accent-color-translucent);
|
|
360
|
+
z-index: 2;
|
|
340
361
|
}
|
|
341
362
|
|
|
342
363
|
:global(h1),
|
|
@@ -374,28 +395,6 @@
|
|
|
374
395
|
user-select: text;
|
|
375
396
|
}
|
|
376
397
|
|
|
377
|
-
:global(dialog) {
|
|
378
|
-
position: fixed;
|
|
379
|
-
inset: 0;
|
|
380
|
-
outline: 0;
|
|
381
|
-
margin: 0;
|
|
382
|
-
border: 0;
|
|
383
|
-
padding: 0;
|
|
384
|
-
width: 100vw;
|
|
385
|
-
max-width: 100vw;
|
|
386
|
-
height: 100vh;
|
|
387
|
-
max-height: 100vh;
|
|
388
|
-
color: var(--sui-primary-foreground-color);
|
|
389
|
-
background: transparent;
|
|
390
|
-
-webkit-user-select: none;
|
|
391
|
-
user-select: none;
|
|
392
|
-
touch-action: none;
|
|
393
|
-
cursor: default;
|
|
394
|
-
}
|
|
395
|
-
:global(dialog::backdrop) {
|
|
396
|
-
background: transparent;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
398
|
:global(.disabled),
|
|
400
399
|
:global(.readonly),
|
|
401
400
|
:global([aria-disabled=true]),
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
</script>
|
|
24
24
|
|
|
25
25
|
<div
|
|
26
|
-
class="sui group {className}"
|
|
27
26
|
role="group"
|
|
27
|
+
class="sui group {className}"
|
|
28
28
|
hidden={hidden || undefined}
|
|
29
29
|
aria-hidden={hidden}
|
|
30
30
|
aria-disabled={disabled}
|
|
31
31
|
{...$$restProps}
|
|
32
32
|
>
|
|
33
|
-
<div class="inner" inert={disabled}>
|
|
33
|
+
<div role="none" class="inner" inert={disabled}>
|
|
34
34
|
<slot />
|
|
35
35
|
</div>
|
|
36
36
|
</div>
|