@sveltia/ui 0.1.5 → 0.2.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/composite/calendar.svelte +5 -6
- package/package/components/composite/calendar.svelte.d.ts +8 -1
- package/package/components/composite/checkbox-group.svelte.d.ts +11 -1
- package/package/components/composite/combobox.svelte +21 -17
- package/package/components/composite/combobox.svelte.d.ts +16 -1
- package/package/components/composite/disclosure.svelte.d.ts +10 -1
- package/package/components/composite/grid.svelte.d.ts +10 -1
- package/package/components/composite/listbox.svelte +1 -1
- package/package/components/composite/listbox.svelte.d.ts +20 -7
- package/package/components/composite/menu-item-group.svelte.d.ts +11 -1
- package/package/components/composite/menu.svelte.d.ts +14 -5
- package/package/components/composite/radio-button-group.svelte.d.ts +10 -1
- package/package/components/composite/select-button-group.svelte.d.ts +14 -1
- package/package/components/composite/select.svelte.d.ts +14 -2
- package/package/components/composite/tab-list.svelte.d.ts +22 -9
- package/package/components/core/button.svelte +25 -14
- package/package/components/core/button.svelte.d.ts +50 -19
- package/package/components/core/checkbox.svelte +11 -1
- package/package/components/core/checkbox.svelte.d.ts +16 -1
- package/package/components/core/dialog.svelte +50 -36
- package/package/components/core/dialog.svelte.d.ts +29 -1
- package/package/components/core/drawer.svelte +338 -0
- package/package/components/core/drawer.svelte.d.ts +59 -0
- package/package/components/core/grid-cell.svelte.d.ts +9 -1
- package/package/components/core/group.svelte.d.ts +11 -1
- package/package/components/core/icon.svelte.d.ts +8 -1
- package/package/components/core/menu-button.svelte.d.ts +17 -1
- package/package/components/core/menu-item-checkbox.svelte.d.ts +12 -2
- package/package/components/core/menu-item-radio.svelte.d.ts +12 -2
- package/package/components/core/menu-item.svelte.d.ts +17 -2
- package/package/components/core/number-input.svelte +1 -1
- package/package/components/core/number-input.svelte.d.ts +17 -3
- package/package/components/core/option.svelte +6 -0
- package/package/components/core/option.svelte.d.ts +31 -6
- package/package/components/core/password-input.svelte +1 -1
- package/package/components/core/password-input.svelte.d.ts +15 -4
- package/package/components/core/radio-button.svelte +1 -1
- package/package/components/core/radio-button.svelte.d.ts +11 -1
- package/package/components/core/row-group.svelte.d.ts +9 -1
- package/package/components/core/row.svelte.d.ts +11 -1
- package/package/components/core/search-bar.svelte +3 -2
- package/package/components/core/search-bar.svelte.d.ts +25 -11
- package/package/components/core/select-button.svelte.d.ts +19 -2
- package/package/components/core/separator.svelte.d.ts +7 -1
- package/package/components/core/slider.svelte +2 -1
- package/package/components/core/slider.svelte.d.ts +17 -1
- package/package/components/core/spacer.svelte.d.ts +7 -1
- package/package/components/core/switch.svelte +6 -0
- package/package/components/core/switch.svelte.d.ts +11 -1
- package/package/components/core/tab-panel.svelte.d.ts +9 -1
- package/package/components/core/tab.svelte.d.ts +15 -1
- package/package/components/core/text-area.svelte.d.ts +25 -11
- package/package/components/core/text-input.svelte +3 -2
- package/package/components/core/text-input.svelte.d.ts +33 -15
- package/package/components/core/toolbar.svelte +3 -3
- package/package/components/core/toolbar.svelte.d.ts +10 -1
- package/package/components/editor/markdown.svelte +1 -1
- package/package/components/editor/markdown.svelte.d.ts +7 -1
- package/package/components/helpers/popup.d.ts +7 -2
- package/package/components/helpers/popup.js +11 -0
- package/package/components/util/app-shell.svelte +128 -58
- package/package/components/util/app-shell.svelte.d.ts +11 -1
- package/package/components/util/popup.svelte +24 -14
- package/package/components/util/popup.svelte.d.ts +24 -8
- package/package/components/util/portal.svelte.d.ts +8 -1
- package/package/index.d.ts +2 -0
- package/package/index.js +5 -5
- package/package/styles/core.scss +3 -3
- package/package/styles/variables.scss +127 -57
- package/package.json +23 -13
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
/** @type {Boolean} */
|
|
30
30
|
export let indeterminate = false;
|
|
31
31
|
|
|
32
|
+
/** @type {Boolean} */
|
|
33
|
+
export let disabled = false;
|
|
34
|
+
|
|
32
35
|
const dispatch = createEventDispatcher();
|
|
33
36
|
const id = getRandomId('checkbox');
|
|
34
37
|
/** @type {Button} */
|
|
@@ -42,6 +45,9 @@
|
|
|
42
45
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
43
46
|
<label
|
|
44
47
|
class="sui checkbox {className}"
|
|
48
|
+
class:checked
|
|
49
|
+
class:indeterminate
|
|
50
|
+
class:disabled
|
|
45
51
|
on:click|preventDefault|stopPropagation={(event) => {
|
|
46
52
|
if (!event.target.matches('button')) {
|
|
47
53
|
button.element.click();
|
|
@@ -50,6 +56,7 @@
|
|
|
50
56
|
>
|
|
51
57
|
<Button
|
|
52
58
|
{id}
|
|
59
|
+
{disabled}
|
|
53
60
|
role="checkbox"
|
|
54
61
|
aria-checked={indeterminate ? 'mixed' : checked}
|
|
55
62
|
aria-labelledby="{id}-label"
|
|
@@ -80,6 +87,9 @@
|
|
|
80
87
|
-webkit-user-select: none;
|
|
81
88
|
user-select: none;
|
|
82
89
|
}
|
|
90
|
+
.checkbox.disabled {
|
|
91
|
+
cursor: default;
|
|
92
|
+
}
|
|
83
93
|
.checkbox :global(button) {
|
|
84
94
|
align-items: center;
|
|
85
95
|
justify-content: center;
|
|
@@ -93,7 +103,7 @@
|
|
|
93
103
|
transition: all 200ms;
|
|
94
104
|
}
|
|
95
105
|
.checkbox :global(button) :global(.icon) {
|
|
96
|
-
font-size:
|
|
106
|
+
font-size: var(--font-size--xx-large);
|
|
97
107
|
}
|
|
98
108
|
.checkbox :global(button[aria-checked="true"]),
|
|
99
109
|
.checkbox :global(button[aria-checked="mixed"]) {
|
|
@@ -5,14 +5,29 @@
|
|
|
5
5
|
* @see https://w3c.github.io/aria/#checkbox
|
|
6
6
|
* @see https://w3c.github.io/aria-practices/#checkbox
|
|
7
7
|
*/
|
|
8
|
-
export default class Checkbox {
|
|
8
|
+
export default class Checkbox extends SvelteComponentTyped<{
|
|
9
|
+
class?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
name?: string;
|
|
12
|
+
value?: string;
|
|
13
|
+
checked?: string | boolean;
|
|
14
|
+
indeterminate?: boolean;
|
|
15
|
+
}, {
|
|
16
|
+
change: CustomEvent<any>;
|
|
17
|
+
} & {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {
|
|
20
|
+
default: {};
|
|
21
|
+
}> {
|
|
9
22
|
}
|
|
10
23
|
export type CheckboxProps = typeof __propDef.props;
|
|
11
24
|
export type CheckboxEvents = typeof __propDef.events;
|
|
12
25
|
export type CheckboxSlots = typeof __propDef.slots;
|
|
26
|
+
import { SvelteComponentTyped } from "svelte";
|
|
13
27
|
declare const __propDef: {
|
|
14
28
|
props: {
|
|
15
29
|
class?: string;
|
|
30
|
+
disabled?: boolean;
|
|
16
31
|
name?: string;
|
|
17
32
|
value?: (string | undefined);
|
|
18
33
|
checked?: (boolean | string | undefined);
|
|
@@ -49,47 +49,60 @@
|
|
|
49
49
|
const dispatch = createEventDispatcher();
|
|
50
50
|
/** @type {?HTMLDialogElement} */
|
|
51
51
|
let dialog;
|
|
52
|
+
/** @type {?HTMLFormElement} */
|
|
53
|
+
let form;
|
|
52
54
|
let showDialog = false;
|
|
53
55
|
let showContent = false;
|
|
54
|
-
let closeDialogTimer = 0;
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
showDialog = true;
|
|
71
|
-
});
|
|
72
|
-
} else {
|
|
73
|
-
showDialog = false;
|
|
57
|
+
const openDialog = async () => {
|
|
58
|
+
(document.querySelector('.sui.app-shell') || document.body).appendChild(dialog);
|
|
59
|
+
showContent = true;
|
|
60
|
+
|
|
61
|
+
if (modal) {
|
|
62
|
+
dialog.showModal();
|
|
63
|
+
} else {
|
|
64
|
+
dialog.show();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
window.requestAnimationFrame(() => {
|
|
68
|
+
showDialog = true;
|
|
69
|
+
});
|
|
70
|
+
};
|
|
74
71
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
dialog?.close();
|
|
78
|
-
dialog?.remove();
|
|
79
|
-
}, 500);
|
|
72
|
+
const closeDialog = async () => {
|
|
73
|
+
showDialog = false;
|
|
80
74
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
if (dialog.returnValue === 'ok') {
|
|
76
|
+
dispatch('ok');
|
|
77
|
+
}
|
|
84
78
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
79
|
+
if (dialog.returnValue === 'cancel') {
|
|
80
|
+
dispatch('cancel');
|
|
81
|
+
}
|
|
88
82
|
|
|
89
|
-
|
|
83
|
+
dispatch('close', dialog.returnValue);
|
|
84
|
+
|
|
85
|
+
await new Promise((resolve) => {
|
|
86
|
+
form.addEventListener('transitionend', () => resolve(), { once: true });
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
showContent = false;
|
|
90
|
+
dialog?.close();
|
|
91
|
+
dialog?.remove();
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const toggleDialog = () => {
|
|
95
|
+
if (dialog) {
|
|
96
|
+
if (open) {
|
|
97
|
+
openDialog();
|
|
98
|
+
} else {
|
|
99
|
+
closeDialog();
|
|
90
100
|
}
|
|
91
101
|
}
|
|
92
|
-
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// Call the function only when the `open` prop is changed
|
|
105
|
+
$: toggleDialog(open);
|
|
93
106
|
|
|
94
107
|
onMount(() => {
|
|
95
108
|
dialog.remove();
|
|
@@ -113,12 +126,12 @@
|
|
|
113
126
|
open = false;
|
|
114
127
|
}
|
|
115
128
|
}}
|
|
116
|
-
on:cancel={() => {
|
|
129
|
+
on:cancel|preventDefault={() => {
|
|
117
130
|
// Cancelled with the Escape key
|
|
118
131
|
open = false;
|
|
119
132
|
}}
|
|
120
133
|
>
|
|
121
|
-
<form method="dialog" on:submit|preventDefault>
|
|
134
|
+
<form method="dialog" bind:this={form} on:submit|preventDefault>
|
|
122
135
|
{#if showContent}
|
|
123
136
|
{#if title || showClose || $$slots.header || $$slots['header-extra']}
|
|
124
137
|
<div class="header">
|
|
@@ -134,7 +147,7 @@
|
|
|
134
147
|
{/if}
|
|
135
148
|
{#if showClose}
|
|
136
149
|
<Button
|
|
137
|
-
class="
|
|
150
|
+
class="tertiary iconic"
|
|
138
151
|
on:click={() => {
|
|
139
152
|
dialog.returnValue = 'close';
|
|
140
153
|
open = false;
|
|
@@ -191,6 +204,7 @@
|
|
|
191
204
|
display: flex;
|
|
192
205
|
justify-content: center;
|
|
193
206
|
align-items: center;
|
|
207
|
+
outline: 0;
|
|
194
208
|
background-color: var(--popup-backdrop-color);
|
|
195
209
|
}
|
|
196
210
|
dialog.open form {
|
|
@@ -260,7 +274,7 @@ dialog.x-large form {
|
|
|
260
274
|
height: 32px;
|
|
261
275
|
}
|
|
262
276
|
.header .title {
|
|
263
|
-
font-size:
|
|
277
|
+
font-size: var(--font-size--large);
|
|
264
278
|
}
|
|
265
279
|
|
|
266
280
|
.footer {
|
|
@@ -5,11 +5,39 @@
|
|
|
5
5
|
* @see https://w3c.github.io/aria/#dialog
|
|
6
6
|
* @see https://w3c.github.io/aria-practices/#dialog_modal
|
|
7
7
|
*/
|
|
8
|
-
export default class Dialog {
|
|
8
|
+
export default class Dialog extends SvelteComponentTyped<{
|
|
9
|
+
title?: string;
|
|
10
|
+
open?: boolean;
|
|
11
|
+
class?: string;
|
|
12
|
+
size?: "small" | "medium" | "large";
|
|
13
|
+
modal?: boolean;
|
|
14
|
+
showCancel?: boolean;
|
|
15
|
+
showOk?: boolean;
|
|
16
|
+
showClose?: boolean;
|
|
17
|
+
okLabel?: string;
|
|
18
|
+
okDisabled?: boolean;
|
|
19
|
+
cancelLabel?: string;
|
|
20
|
+
cancelDisabled?: boolean;
|
|
21
|
+
closeOnBackdropClick?: boolean;
|
|
22
|
+
}, {
|
|
23
|
+
submit: SubmitEvent;
|
|
24
|
+
ok: CustomEvent<any>;
|
|
25
|
+
cancel: CustomEvent<any>;
|
|
26
|
+
close: CustomEvent<any>;
|
|
27
|
+
} & {
|
|
28
|
+
[evt: string]: CustomEvent<any>;
|
|
29
|
+
}, {
|
|
30
|
+
header: {};
|
|
31
|
+
'header-extra': {};
|
|
32
|
+
default: {};
|
|
33
|
+
footer: {};
|
|
34
|
+
'footer-extra': {};
|
|
35
|
+
}> {
|
|
9
36
|
}
|
|
10
37
|
export type DialogProps = typeof __propDef.props;
|
|
11
38
|
export type DialogEvents = typeof __propDef.events;
|
|
12
39
|
export type DialogSlots = typeof __propDef.slots;
|
|
40
|
+
import { SvelteComponentTyped } from "svelte";
|
|
13
41
|
declare const __propDef: {
|
|
14
42
|
props: {
|
|
15
43
|
title?: string;
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
@see https://w3c.github.io/aria/#dialog
|
|
4
|
+
@see https://w3c.github.io/aria-practices/#dialog_modal
|
|
5
|
+
-->
|
|
6
|
+
<script>
|
|
7
|
+
import { createEventDispatcher, onMount } from 'svelte';
|
|
8
|
+
import { _ } from 'svelte-i18n';
|
|
9
|
+
import Button from './button.svelte';
|
|
10
|
+
import Icon from './icon.svelte';
|
|
11
|
+
import Spacer from './spacer.svelte';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* CSS class name on the button.
|
|
15
|
+
* @type {String}
|
|
16
|
+
*/
|
|
17
|
+
let className = '';
|
|
18
|
+
|
|
19
|
+
export { className as class };
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Whether to open the drawer.
|
|
23
|
+
*/
|
|
24
|
+
export let open = false;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Title text displayed on the header.
|
|
28
|
+
*/
|
|
29
|
+
export let title = '';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Position of the drawer.
|
|
33
|
+
* @type {('top'|'right'|'bottom'|'left')}
|
|
34
|
+
*/
|
|
35
|
+
export let position = 'right';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Width or height of the drawer.
|
|
39
|
+
* @type {('small'|'medium'|'large'|'x-large')}
|
|
40
|
+
*/
|
|
41
|
+
export let size = 'small';
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Whether to show the Close button.
|
|
45
|
+
* @type {('inside'|'outside'|false)}
|
|
46
|
+
*/
|
|
47
|
+
export let showClose = 'outside';
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Whether to close the drawer when the backdrop (outside of the drawer) is clicked.
|
|
51
|
+
*/
|
|
52
|
+
export let closeOnBackdropClick = false;
|
|
53
|
+
|
|
54
|
+
const dispatch = createEventDispatcher();
|
|
55
|
+
/** @type {?HTMLDialogElement} */
|
|
56
|
+
let dialog;
|
|
57
|
+
/** @type {?HTMLFormElement} */
|
|
58
|
+
let form;
|
|
59
|
+
let showDialog = false;
|
|
60
|
+
let showContent = false;
|
|
61
|
+
|
|
62
|
+
$: orientation = position === 'right' || position === 'left' ? 'vertical' : 'horizontal';
|
|
63
|
+
|
|
64
|
+
const openDialog = async () => {
|
|
65
|
+
(document.querySelector('.sui.app-shell') || document.body).appendChild(dialog);
|
|
66
|
+
showContent = true;
|
|
67
|
+
dialog.showModal();
|
|
68
|
+
|
|
69
|
+
window.requestAnimationFrame(() => {
|
|
70
|
+
showDialog = true;
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const closeDialog = async () => {
|
|
75
|
+
showDialog = false;
|
|
76
|
+
|
|
77
|
+
if (dialog.returnValue === 'ok') {
|
|
78
|
+
dispatch('ok');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (dialog.returnValue === 'cancel') {
|
|
82
|
+
dispatch('cancel');
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
dispatch('close', dialog.returnValue);
|
|
86
|
+
|
|
87
|
+
await new Promise((resolve) => {
|
|
88
|
+
form.addEventListener('transitionend', () => resolve(), { once: true });
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
showContent = false;
|
|
92
|
+
dialog?.close();
|
|
93
|
+
dialog?.remove();
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const toggleDialog = () => {
|
|
97
|
+
if (dialog) {
|
|
98
|
+
if (open) {
|
|
99
|
+
openDialog();
|
|
100
|
+
} else {
|
|
101
|
+
closeDialog();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// Call the function only when the `open` prop is changed
|
|
107
|
+
$: toggleDialog(open);
|
|
108
|
+
|
|
109
|
+
onMount(() => {
|
|
110
|
+
dialog.remove();
|
|
111
|
+
|
|
112
|
+
// onUnmount
|
|
113
|
+
return () => {
|
|
114
|
+
dialog?.close();
|
|
115
|
+
dialog?.remove();
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
</script>
|
|
119
|
+
|
|
120
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
121
|
+
<dialog
|
|
122
|
+
bind:this={dialog}
|
|
123
|
+
class="sui dialog {className} {size} {position} {orientation}"
|
|
124
|
+
class:open={showDialog}
|
|
125
|
+
on:click={({ target }) => {
|
|
126
|
+
if (closeOnBackdropClick && target?.matches('dialog')) {
|
|
127
|
+
dialog.returnValue = 'cancel';
|
|
128
|
+
open = false;
|
|
129
|
+
}
|
|
130
|
+
}}
|
|
131
|
+
on:cancel|preventDefault={() => {
|
|
132
|
+
// Cancelled with the Escape key
|
|
133
|
+
open = false;
|
|
134
|
+
}}
|
|
135
|
+
>
|
|
136
|
+
<form method="dialog" bind:this={form} on:submit|preventDefault>
|
|
137
|
+
<div class="extra-control">
|
|
138
|
+
{#if showClose === 'outside'}
|
|
139
|
+
<Button
|
|
140
|
+
class="iconic close"
|
|
141
|
+
on:click={() => {
|
|
142
|
+
dialog.returnValue = 'close';
|
|
143
|
+
open = false;
|
|
144
|
+
}}
|
|
145
|
+
>
|
|
146
|
+
<Icon slot="start-icon" name="close" label={$_('sui._.close')} />
|
|
147
|
+
</Button>
|
|
148
|
+
{/if}
|
|
149
|
+
</div>
|
|
150
|
+
{#if showContent}
|
|
151
|
+
{#if title || showClose === 'inside' || $$slots.header || $$slots['header-extra']}
|
|
152
|
+
<div class="header">
|
|
153
|
+
{#if $$slots.header}
|
|
154
|
+
<slot name="header" />
|
|
155
|
+
{:else}
|
|
156
|
+
<div class="title">
|
|
157
|
+
{title}
|
|
158
|
+
</div>
|
|
159
|
+
<Spacer flex={true} />
|
|
160
|
+
{#if $$slots['header-extra']}
|
|
161
|
+
<slot name="header-extra" />
|
|
162
|
+
{/if}
|
|
163
|
+
{#if showClose === 'inside'}
|
|
164
|
+
<Button
|
|
165
|
+
class="tertiary iconic close"
|
|
166
|
+
on:click={() => {
|
|
167
|
+
dialog.returnValue = 'close';
|
|
168
|
+
open = false;
|
|
169
|
+
}}
|
|
170
|
+
>
|
|
171
|
+
<Icon slot="start-icon" name="close" label={$_('sui._.close')} />
|
|
172
|
+
</Button>
|
|
173
|
+
{/if}
|
|
174
|
+
{/if}
|
|
175
|
+
</div>
|
|
176
|
+
{/if}
|
|
177
|
+
<div class="main">
|
|
178
|
+
<slot />
|
|
179
|
+
</div>
|
|
180
|
+
{#if $$slots.footer}
|
|
181
|
+
<div class="footer">
|
|
182
|
+
<slot name="footer" />
|
|
183
|
+
</div>
|
|
184
|
+
{/if}
|
|
185
|
+
{/if}
|
|
186
|
+
</form>
|
|
187
|
+
</dialog>
|
|
188
|
+
|
|
189
|
+
<style>dialog {
|
|
190
|
+
overflow: hidden;
|
|
191
|
+
outline: 0;
|
|
192
|
+
background-color: var(--popup-backdrop-color);
|
|
193
|
+
}
|
|
194
|
+
dialog.open form {
|
|
195
|
+
opacity: 1;
|
|
196
|
+
transform: translateX(0%);
|
|
197
|
+
transition-duration: 100ms;
|
|
198
|
+
}
|
|
199
|
+
dialog:not(.open) {
|
|
200
|
+
pointer-events: none !important;
|
|
201
|
+
}
|
|
202
|
+
dialog:not(.open) form {
|
|
203
|
+
opacity: 0;
|
|
204
|
+
transform: translateX(105%);
|
|
205
|
+
pointer-events: none;
|
|
206
|
+
transition-duration: 200ms;
|
|
207
|
+
}
|
|
208
|
+
dialog:not(.open) :global(*) {
|
|
209
|
+
pointer-events: none !important;
|
|
210
|
+
}
|
|
211
|
+
dialog :global(a),
|
|
212
|
+
dialog :global(input),
|
|
213
|
+
dialog :global(textarea),
|
|
214
|
+
dialog :global(button),
|
|
215
|
+
dialog :global([tabindex="0"]) {
|
|
216
|
+
pointer-events: all;
|
|
217
|
+
}
|
|
218
|
+
dialog form {
|
|
219
|
+
position: absolute;
|
|
220
|
+
display: flex;
|
|
221
|
+
flex-direction: column;
|
|
222
|
+
border-radius: 4px;
|
|
223
|
+
background-color: var(--secondary-background-color-translucent);
|
|
224
|
+
backdrop-filter: blur(16px);
|
|
225
|
+
box-shadow: 0 8px 16px var(--popup-shadow-color);
|
|
226
|
+
will-change: opacity, transform;
|
|
227
|
+
transition-property: opacity, transform;
|
|
228
|
+
}
|
|
229
|
+
dialog form .extra-control {
|
|
230
|
+
position: absolute;
|
|
231
|
+
}
|
|
232
|
+
dialog form .extra-control :global(button.close) {
|
|
233
|
+
margin: 8px;
|
|
234
|
+
}
|
|
235
|
+
dialog.right form {
|
|
236
|
+
inset: 0 0 0 auto;
|
|
237
|
+
}
|
|
238
|
+
dialog.right form .extra-control {
|
|
239
|
+
inset: 0 100% auto auto;
|
|
240
|
+
}
|
|
241
|
+
dialog.right:not(.open) form {
|
|
242
|
+
transform: translateX(105%);
|
|
243
|
+
}
|
|
244
|
+
dialog.left form {
|
|
245
|
+
inset: 0 auto 0 0;
|
|
246
|
+
}
|
|
247
|
+
dialog.left form .extra-control {
|
|
248
|
+
inset: 0 auto auto 100%;
|
|
249
|
+
}
|
|
250
|
+
dialog.left:not(.open) form {
|
|
251
|
+
transform: translateX(-105%);
|
|
252
|
+
}
|
|
253
|
+
dialog.vertical {
|
|
254
|
+
height: 100%;
|
|
255
|
+
max-width: 100vw;
|
|
256
|
+
}
|
|
257
|
+
dialog.vertical.open form {
|
|
258
|
+
transform: translateX(0%);
|
|
259
|
+
}
|
|
260
|
+
dialog.vertical.small form {
|
|
261
|
+
width: 400px;
|
|
262
|
+
}
|
|
263
|
+
dialog.vertical.medium form {
|
|
264
|
+
width: 600px;
|
|
265
|
+
}
|
|
266
|
+
dialog.vertical.large form {
|
|
267
|
+
width: 800px;
|
|
268
|
+
}
|
|
269
|
+
dialog.vertical.x-large form {
|
|
270
|
+
width: 1000px;
|
|
271
|
+
}
|
|
272
|
+
dialog.top form {
|
|
273
|
+
inset: 0 0 auto 0;
|
|
274
|
+
}
|
|
275
|
+
dialog.top form .extra-control {
|
|
276
|
+
inset: 100% 0 auto auto;
|
|
277
|
+
}
|
|
278
|
+
dialog.top:not(.open) form {
|
|
279
|
+
transform: translateY(-105%);
|
|
280
|
+
}
|
|
281
|
+
dialog.bottom form {
|
|
282
|
+
inset: auto 0 0 0;
|
|
283
|
+
}
|
|
284
|
+
dialog.bottom form .extra-control {
|
|
285
|
+
inset: auto 0 100% auto;
|
|
286
|
+
}
|
|
287
|
+
dialog.bottom:not(.open) form {
|
|
288
|
+
transform: translateY(105%);
|
|
289
|
+
}
|
|
290
|
+
dialog.horizontal {
|
|
291
|
+
width: 100%;
|
|
292
|
+
max-height: 100vh;
|
|
293
|
+
}
|
|
294
|
+
dialog.horizontal.open form {
|
|
295
|
+
transform: translateY(0%);
|
|
296
|
+
}
|
|
297
|
+
dialog.horizontal.small form {
|
|
298
|
+
height: 400px;
|
|
299
|
+
}
|
|
300
|
+
dialog.horizontal.medium form {
|
|
301
|
+
height: 600px;
|
|
302
|
+
}
|
|
303
|
+
dialog.horizontal.large form {
|
|
304
|
+
height: 800px;
|
|
305
|
+
}
|
|
306
|
+
dialog.horizontal.x-large form {
|
|
307
|
+
height: 1000px;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.header,
|
|
311
|
+
.footer {
|
|
312
|
+
display: flex;
|
|
313
|
+
align-items: center;
|
|
314
|
+
gap: 8px;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.header {
|
|
318
|
+
box-sizing: content-box;
|
|
319
|
+
margin: 0 16px;
|
|
320
|
+
border-width: 0 0 1px;
|
|
321
|
+
border-color: var(--secondary-border-color);
|
|
322
|
+
padding: 16px 8px;
|
|
323
|
+
height: 32px;
|
|
324
|
+
}
|
|
325
|
+
.header .title {
|
|
326
|
+
font-size: var(--font-size--large);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.footer {
|
|
330
|
+
margin: 0 24px 24px;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.main {
|
|
334
|
+
flex: auto;
|
|
335
|
+
overflow: auto;
|
|
336
|
+
margin: 24px 24px;
|
|
337
|
+
white-space: normal;
|
|
338
|
+
}</style>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} DrawerProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} DrawerEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} DrawerSlots */
|
|
4
|
+
/**
|
|
5
|
+
* @see https://w3c.github.io/aria/#dialog
|
|
6
|
+
* @see https://w3c.github.io/aria-practices/#dialog_modal
|
|
7
|
+
*/
|
|
8
|
+
export default class Drawer extends SvelteComponentTyped<{
|
|
9
|
+
title?: string;
|
|
10
|
+
position?: "top" | "right" | "bottom" | "left";
|
|
11
|
+
open?: boolean;
|
|
12
|
+
class?: string;
|
|
13
|
+
size?: "small" | "medium" | "large" | "x-large";
|
|
14
|
+
showClose?: false | "inside" | "outside";
|
|
15
|
+
closeOnBackdropClick?: boolean;
|
|
16
|
+
}, {
|
|
17
|
+
submit: SubmitEvent;
|
|
18
|
+
ok: CustomEvent<any>;
|
|
19
|
+
cancel: CustomEvent<any>;
|
|
20
|
+
close: CustomEvent<any>;
|
|
21
|
+
} & {
|
|
22
|
+
[evt: string]: CustomEvent<any>;
|
|
23
|
+
}, {
|
|
24
|
+
header: {};
|
|
25
|
+
'header-extra': {};
|
|
26
|
+
default: {};
|
|
27
|
+
footer: {};
|
|
28
|
+
}> {
|
|
29
|
+
}
|
|
30
|
+
export type DrawerProps = typeof __propDef.props;
|
|
31
|
+
export type DrawerEvents = typeof __propDef.events;
|
|
32
|
+
export type DrawerSlots = typeof __propDef.slots;
|
|
33
|
+
import { SvelteComponentTyped } from "svelte";
|
|
34
|
+
declare const __propDef: {
|
|
35
|
+
props: {
|
|
36
|
+
title?: string;
|
|
37
|
+
position?: ('top' | 'right' | 'bottom' | 'left');
|
|
38
|
+
open?: boolean;
|
|
39
|
+
class?: string;
|
|
40
|
+
size?: ('small' | 'medium' | 'large' | 'x-large');
|
|
41
|
+
showClose?: ('inside' | 'outside' | false);
|
|
42
|
+
closeOnBackdropClick?: boolean;
|
|
43
|
+
};
|
|
44
|
+
events: {
|
|
45
|
+
submit: SubmitEvent;
|
|
46
|
+
ok: CustomEvent<any>;
|
|
47
|
+
cancel: CustomEvent<any>;
|
|
48
|
+
close: CustomEvent<any>;
|
|
49
|
+
} & {
|
|
50
|
+
[evt: string]: CustomEvent<any>;
|
|
51
|
+
};
|
|
52
|
+
slots: {
|
|
53
|
+
header: {};
|
|
54
|
+
'header-extra': {};
|
|
55
|
+
default: {};
|
|
56
|
+
footer: {};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export {};
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
/** @typedef {typeof __propDef.props} GridCellProps */
|
|
2
2
|
/** @typedef {typeof __propDef.events} GridCellEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} GridCellSlots */
|
|
4
|
-
export default class GridCell {
|
|
4
|
+
export default class GridCell extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
class?: string;
|
|
7
|
+
}, {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
}, {
|
|
10
|
+
default: {};
|
|
11
|
+
}> {
|
|
5
12
|
}
|
|
6
13
|
export type GridCellProps = typeof __propDef.props;
|
|
7
14
|
export type GridCellEvents = typeof __propDef.events;
|
|
8
15
|
export type GridCellSlots = typeof __propDef.slots;
|
|
16
|
+
import { SvelteComponentTyped } from "svelte";
|
|
9
17
|
declare const __propDef: {
|
|
10
18
|
props: {
|
|
11
19
|
[x: string]: any;
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
/** @typedef {typeof __propDef.props} GroupProps */
|
|
2
2
|
/** @typedef {typeof __propDef.events} GroupEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} GroupSlots */
|
|
4
|
-
export default class Group {
|
|
4
|
+
export default class Group extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
title?: string;
|
|
7
|
+
class?: string;
|
|
8
|
+
ariaLabel?: string;
|
|
9
|
+
}, {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
}, {
|
|
12
|
+
default: {};
|
|
13
|
+
}> {
|
|
5
14
|
}
|
|
6
15
|
export type GroupProps = typeof __propDef.props;
|
|
7
16
|
export type GroupEvents = typeof __propDef.events;
|
|
8
17
|
export type GroupSlots = typeof __propDef.slots;
|
|
18
|
+
import { SvelteComponentTyped } from "svelte";
|
|
9
19
|
declare const __propDef: {
|
|
10
20
|
props: {
|
|
11
21
|
[x: string]: any;
|