@sveltia/ui 0.7.5 → 0.8.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/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 +78 -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 +6 -16
- package/package/components/toast/toast.svelte.d.ts +2 -2
- 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.json +97 -1
|
@@ -8,17 +8,17 @@
|
|
|
8
8
|
import Icon from '../icon/icon.svelte';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Status of the alert.
|
|
12
12
|
* @type {'error' | 'warning' | 'info' | 'success'}
|
|
13
13
|
*/
|
|
14
|
-
export let
|
|
14
|
+
export let status = 'error';
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
|
-
<div class="sui alert {
|
|
17
|
+
<div role="alert" class="sui alert {status}" {...$$restProps}>
|
|
18
18
|
{#if $$slots.icon}
|
|
19
19
|
<slot name="icon" />
|
|
20
20
|
{:else}
|
|
21
|
-
<Icon name={
|
|
21
|
+
<Icon name={status === 'success' ? 'check_circle' : status} />
|
|
22
22
|
{/if}
|
|
23
23
|
<slot />
|
|
24
24
|
</div>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export default class Alert extends SvelteComponent<{
|
|
10
10
|
[x: string]: any;
|
|
11
|
-
|
|
11
|
+
status?: "error" | "warning" | "info" | "success";
|
|
12
12
|
}, {
|
|
13
13
|
[evt: string]: CustomEvent<any>;
|
|
14
14
|
}, {
|
|
@@ -23,7 +23,7 @@ import { SvelteComponent } from "svelte";
|
|
|
23
23
|
declare const __propDef: {
|
|
24
24
|
props: {
|
|
25
25
|
[x: string]: any;
|
|
26
|
-
|
|
26
|
+
status?: 'error' | 'warning' | 'info' | 'success';
|
|
27
27
|
};
|
|
28
28
|
events: {
|
|
29
29
|
[evt: string]: CustomEvent<any>;
|
|
@@ -132,21 +132,22 @@
|
|
|
132
132
|
on:keyup
|
|
133
133
|
on:keypress
|
|
134
134
|
on:select
|
|
135
|
+
on:change
|
|
135
136
|
>
|
|
136
137
|
<slot name="start-icon" />
|
|
137
138
|
{#if variant === 'link'}
|
|
138
139
|
{#if label}
|
|
139
|
-
<span class="label">
|
|
140
|
+
<span role="none" class="label">
|
|
140
141
|
{label}
|
|
141
142
|
</span>
|
|
142
143
|
{:else}
|
|
143
|
-
<span class="label">
|
|
144
|
+
<span role="none" class="label">
|
|
144
145
|
<slot />
|
|
145
146
|
</span>
|
|
146
147
|
{/if}
|
|
147
148
|
{:else}
|
|
148
149
|
{#if label}
|
|
149
|
-
<span class="label">
|
|
150
|
+
<span role="none" class="label">
|
|
150
151
|
{label}
|
|
151
152
|
</span>
|
|
152
153
|
{/if}
|
|
@@ -165,6 +166,7 @@
|
|
|
165
166
|
display: inline-flex;
|
|
166
167
|
align-items: center;
|
|
167
168
|
gap: 4px;
|
|
169
|
+
margin: var(--sui-focus-ring-width);
|
|
168
170
|
border-width: 0;
|
|
169
171
|
border-style: solid;
|
|
170
172
|
border-color: transparent;
|
|
@@ -11,13 +11,13 @@ export default class Button extends SvelteComponent<{
|
|
|
11
11
|
class?: string;
|
|
12
12
|
name?: string;
|
|
13
13
|
label?: string;
|
|
14
|
-
type?: "reset" | "submit" | "button";
|
|
15
14
|
disabled?: boolean;
|
|
16
15
|
size?: "small" | "medium" | "large";
|
|
16
|
+
type?: "reset" | "submit" | "button";
|
|
17
17
|
value?: string;
|
|
18
|
+
role?: string;
|
|
18
19
|
hidden?: boolean;
|
|
19
20
|
element?: HTMLButtonElement;
|
|
20
|
-
role?: string;
|
|
21
21
|
readonly?: boolean;
|
|
22
22
|
pressed?: boolean | "mixed";
|
|
23
23
|
keyShortcuts?: string;
|
|
@@ -37,6 +37,7 @@ export default class Button extends SvelteComponent<{
|
|
|
37
37
|
keyup: KeyboardEvent;
|
|
38
38
|
keypress: KeyboardEvent;
|
|
39
39
|
select: Event;
|
|
40
|
+
change: Event;
|
|
40
41
|
} & {
|
|
41
42
|
[evt: string]: CustomEvent<any>;
|
|
42
43
|
}, {
|
|
@@ -107,13 +108,13 @@ declare const __propDef: {
|
|
|
107
108
|
class?: string;
|
|
108
109
|
name?: string | undefined;
|
|
109
110
|
label?: string;
|
|
110
|
-
type?: 'button' | 'submit' | 'reset';
|
|
111
111
|
disabled?: boolean;
|
|
112
112
|
size?: 'small' | 'medium' | 'large' | undefined;
|
|
113
|
+
type?: 'button' | 'submit' | 'reset';
|
|
113
114
|
value?: string | undefined;
|
|
115
|
+
role?: string;
|
|
114
116
|
hidden?: boolean | undefined;
|
|
115
117
|
element?: HTMLButtonElement | undefined;
|
|
116
|
-
role?: string;
|
|
117
118
|
readonly?: boolean | undefined;
|
|
118
119
|
pressed?: boolean | 'mixed' | undefined;
|
|
119
120
|
keyShortcuts?: string | undefined;
|
|
@@ -134,6 +135,7 @@ declare const __propDef: {
|
|
|
134
135
|
keyup: KeyboardEvent;
|
|
135
136
|
keypress: KeyboardEvent;
|
|
136
137
|
select: Event;
|
|
138
|
+
change: Event;
|
|
137
139
|
} & {
|
|
138
140
|
[evt: string]: CustomEvent<any>;
|
|
139
141
|
};
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
</script>
|
|
42
42
|
|
|
43
43
|
<div
|
|
44
|
+
role="radiogroup"
|
|
44
45
|
class="sui select-button-group {className}"
|
|
45
46
|
hidden={hidden || undefined}
|
|
46
47
|
tabindex="-1"
|
|
47
|
-
role="radiogroup"
|
|
48
48
|
aria-hidden={hidden}
|
|
49
49
|
aria-disabled={disabled}
|
|
50
50
|
aria-readonly={readonly}
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
use:activateGroup
|
|
55
55
|
on:change
|
|
56
56
|
>
|
|
57
|
-
<div class="inner" inert={disabled}>
|
|
57
|
+
<div role="none" class="inner" inert={disabled}>
|
|
58
58
|
<slot />
|
|
59
59
|
</div>
|
|
60
60
|
</div>
|
|
@@ -62,22 +62,26 @@
|
|
|
62
62
|
<style>.select-button-group {
|
|
63
63
|
display: inline-flex;
|
|
64
64
|
align-items: center;
|
|
65
|
+
margin: var(--sui-focus-ring-width);
|
|
65
66
|
}
|
|
66
67
|
.select-button-group:focus-visible {
|
|
67
68
|
outline-width: 0 !important;
|
|
68
69
|
}
|
|
69
70
|
.select-button-group :global(button) {
|
|
70
|
-
|
|
71
|
+
margin: 0 !important;
|
|
72
|
+
border-radius: 0;
|
|
71
73
|
color: var(--sui-primary-foreground-color);
|
|
72
74
|
}
|
|
73
75
|
.select-button-group :global(button):first-child {
|
|
74
|
-
border-radius: 4px
|
|
76
|
+
border-top-left-radius: 4px !important;
|
|
77
|
+
border-bottom-left-radius: 4px;
|
|
75
78
|
}
|
|
76
79
|
.select-button-group :global(button):not(:first-child) {
|
|
77
80
|
border-left-width: 0;
|
|
78
81
|
}
|
|
79
82
|
.select-button-group :global(button):last-child {
|
|
80
|
-
border-radius:
|
|
83
|
+
border-top-right-radius: 4px;
|
|
84
|
+
border-bottom-right-radius: 4px;
|
|
81
85
|
}
|
|
82
86
|
.select-button-group :global(button[aria-checked="true"]) {
|
|
83
87
|
color: var(--sui-highlight-foreground-color);
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
</script>
|
|
57
57
|
|
|
58
58
|
<Button
|
|
59
|
+
role="radio"
|
|
59
60
|
class="sui select-button {className}"
|
|
60
61
|
{value}
|
|
61
62
|
{hidden}
|
|
@@ -64,14 +65,14 @@
|
|
|
64
65
|
{variant}
|
|
65
66
|
{size}
|
|
66
67
|
{iconic}
|
|
67
|
-
role="radio"
|
|
68
68
|
aria-checked={selected}
|
|
69
69
|
{...$$restProps}
|
|
70
70
|
on:click
|
|
71
|
-
on:click={() => {
|
|
72
|
-
selected = !selected;
|
|
73
|
-
}}
|
|
74
71
|
on:select
|
|
72
|
+
on:change
|
|
73
|
+
on:change={(event) => {
|
|
74
|
+
selected = /** @type {CustomEvent} */ (event).detail.selected;
|
|
75
|
+
}}
|
|
75
76
|
>
|
|
76
77
|
<slot name="start-icon" slot="start-icon" />
|
|
77
78
|
<slot />
|
|
@@ -20,6 +20,7 @@ export default class SelectButton extends SvelteComponent<{
|
|
|
20
20
|
}, {
|
|
21
21
|
click: MouseEvent;
|
|
22
22
|
select: Event;
|
|
23
|
+
change: Event;
|
|
23
24
|
} & {
|
|
24
25
|
[evt: string]: CustomEvent<any>;
|
|
25
26
|
}, {
|
|
@@ -52,6 +53,7 @@ declare const __propDef: {
|
|
|
52
53
|
events: {
|
|
53
54
|
click: MouseEvent;
|
|
54
55
|
select: Event;
|
|
56
|
+
change: Event;
|
|
55
57
|
} & {
|
|
56
58
|
[evt: string]: CustomEvent<any>;
|
|
57
59
|
};
|
|
@@ -50,34 +50,36 @@
|
|
|
50
50
|
|
|
51
51
|
<div role="group">
|
|
52
52
|
<input type="hidden" bind:value />
|
|
53
|
-
<div class="header">
|
|
53
|
+
<div role="none" class="header">
|
|
54
54
|
<Button
|
|
55
55
|
variant="ghost"
|
|
56
56
|
label={firstDay.toLocaleDateString('en', { year: 'numeric', month: 'short' })}
|
|
57
57
|
aria-haspopup="dialog"
|
|
58
58
|
>
|
|
59
59
|
<Icon slot="end-icon" name="arrow_drop_down" />
|
|
60
|
-
<div slot="popup" class="popup-inner"
|
|
60
|
+
<div slot="popup" role="none" class="popup-inner" on:click|stopPropagation>
|
|
61
61
|
<div role="group" aria-label={$_('_sui.calendar.year')}>
|
|
62
|
-
<div class="header">
|
|
62
|
+
<div role="none" class="header">
|
|
63
63
|
<Button
|
|
64
|
+
aria-label={$_('_sui.calendar.previous_decade')}
|
|
64
65
|
on:click={() => {
|
|
65
66
|
//
|
|
66
67
|
}}
|
|
67
68
|
>
|
|
68
|
-
<Icon name="chevron_left"
|
|
69
|
+
<Icon name="chevron_left" />
|
|
69
70
|
</Button>
|
|
70
71
|
<Button
|
|
72
|
+
aria-label={$_('_sui.calendar.next_decade')}
|
|
71
73
|
on:click={() => {
|
|
72
74
|
//
|
|
73
75
|
}}
|
|
74
76
|
>
|
|
75
|
-
<Icon name="chevron_right"
|
|
77
|
+
<Icon name="chevron_right" />
|
|
76
78
|
</Button>
|
|
77
79
|
</div>
|
|
78
|
-
<div class="grid">
|
|
80
|
+
<div role="none" class="grid">
|
|
79
81
|
{#each [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] as year}
|
|
80
|
-
<div>
|
|
82
|
+
<div role="none">
|
|
81
83
|
<Button>202{year}</Button>
|
|
82
84
|
</div>
|
|
83
85
|
{/each}
|
|
@@ -85,9 +87,9 @@
|
|
|
85
87
|
</div>
|
|
86
88
|
<Divider orientation="vertical" />
|
|
87
89
|
<div role="group" aria-label={$_('_sui.calendar.month')}>
|
|
88
|
-
<div class="grid">
|
|
90
|
+
<div role="none" class="grid">
|
|
89
91
|
{#each [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] as month}
|
|
90
|
-
<div>
|
|
92
|
+
<div role="none">
|
|
91
93
|
<Button>
|
|
92
94
|
{new Date(date.getUTCFullYear(), month, 10).toLocaleDateString('en', {
|
|
93
95
|
month: 'short',
|
|
@@ -100,30 +102,33 @@
|
|
|
100
102
|
</div>
|
|
101
103
|
</Button>
|
|
102
104
|
<Button
|
|
105
|
+
aria-label={$_('_sui.calendar.previous_month')}
|
|
103
106
|
on:click={() => {
|
|
104
107
|
firstDay.setUTCMonth(firstDay.getUTCMonth() - 1);
|
|
105
108
|
firstDay = firstDay;
|
|
106
109
|
}}
|
|
107
110
|
>
|
|
108
|
-
<Icon name="chevron_left"
|
|
111
|
+
<Icon name="chevron_left" />
|
|
109
112
|
</Button>
|
|
110
113
|
<Button
|
|
114
|
+
aria-label={$_('_sui.calendar.next_month')}
|
|
111
115
|
on:click={() => {
|
|
112
116
|
firstDay.setUTCMonth(firstDay.getUTCMonth() + 1);
|
|
113
117
|
firstDay = firstDay;
|
|
114
118
|
}}
|
|
115
119
|
>
|
|
116
|
-
<Icon name="chevron_right"
|
|
120
|
+
<Icon name="chevron_right" />
|
|
117
121
|
</Button>
|
|
118
122
|
</div>
|
|
119
|
-
<div
|
|
123
|
+
<div role="listbox" class="grid">
|
|
120
124
|
{#each dayList.slice(0, 7) as { day }}
|
|
121
|
-
<div
|
|
125
|
+
<div role="none" class="weekday">
|
|
122
126
|
{day.toLocaleDateString('en', { weekday: 'narrow' })}
|
|
123
127
|
</div>
|
|
124
128
|
{/each}
|
|
125
129
|
{#each dayList as { day }}
|
|
126
130
|
<div
|
|
131
|
+
role="none"
|
|
127
132
|
class:other-month={day.getUTCMonth() !== firstDay.getUTCMonth()}
|
|
128
133
|
class:today={day.getFullYear() === now.getFullYear() &&
|
|
129
134
|
day.getMonth() === now.getMonth() &&
|
|
@@ -141,7 +146,7 @@
|
|
|
141
146
|
</div>
|
|
142
147
|
{/each}
|
|
143
148
|
</div>
|
|
144
|
-
<div class="footer">
|
|
149
|
+
<div role="none" class="footer">
|
|
145
150
|
<Button
|
|
146
151
|
on:click={() => {
|
|
147
152
|
value = '';
|
|
@@ -211,6 +216,7 @@
|
|
|
211
216
|
}
|
|
212
217
|
.grid div :global(button) {
|
|
213
218
|
justify-content: center;
|
|
219
|
+
margin: 0 !important;
|
|
214
220
|
width: 100%;
|
|
215
221
|
height: 24px;
|
|
216
222
|
border-radius: 50%;
|
|
@@ -27,14 +27,15 @@
|
|
|
27
27
|
</script>
|
|
28
28
|
|
|
29
29
|
<div
|
|
30
|
+
role="group"
|
|
30
31
|
class="sui checkbox-group {className} {orientation}"
|
|
31
32
|
hidden={hidden || undefined}
|
|
32
|
-
role="group"
|
|
33
33
|
aria-hidden={hidden}
|
|
34
34
|
aria-disabled={disabled}
|
|
35
|
+
aria-roledescription="checkbox group"
|
|
35
36
|
{...$$restProps}
|
|
36
37
|
>
|
|
37
|
-
<div class="inner" inert={disabled}>
|
|
38
|
+
<div role="none" class="inner" inert={disabled}>
|
|
38
39
|
<slot />
|
|
39
40
|
</div>
|
|
40
41
|
</div>
|
|
@@ -43,16 +44,16 @@
|
|
|
43
44
|
display: inline-flex;
|
|
44
45
|
}
|
|
45
46
|
.checkbox-group.horizontal {
|
|
46
|
-
gap:
|
|
47
|
+
gap: 8px;
|
|
47
48
|
align-items: center;
|
|
48
49
|
}
|
|
49
50
|
.checkbox-group.vertical {
|
|
50
|
-
gap:
|
|
51
|
+
gap: 4px;
|
|
51
52
|
flex-direction: column;
|
|
52
53
|
}
|
|
53
54
|
@media (pointer: coarse) {
|
|
54
55
|
.checkbox-group.vertical {
|
|
55
|
-
gap:
|
|
56
|
+
gap: 8px;
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
|
|
@@ -77,26 +77,25 @@
|
|
|
77
77
|
</script>
|
|
78
78
|
|
|
79
79
|
<div
|
|
80
|
+
role="none"
|
|
80
81
|
class="sui checkbox {className}"
|
|
81
82
|
class:checked
|
|
82
83
|
class:indeterminate
|
|
83
84
|
class:disabled
|
|
84
85
|
class:readonly
|
|
85
86
|
hidden={hidden || undefined}
|
|
86
|
-
role="none"
|
|
87
|
-
{...$$restProps}
|
|
88
87
|
on:click|preventDefault|stopPropagation={(event) => {
|
|
89
88
|
if (!(/** @type {HTMLElement} */ (event.target).matches('button'))) {
|
|
90
89
|
buttonComponent.element.click();
|
|
91
90
|
}
|
|
92
91
|
}}
|
|
93
92
|
>
|
|
94
|
-
<div class="inner" inert={disabled}>
|
|
93
|
+
<div role="none" class="inner" inert={disabled}>
|
|
95
94
|
<Button
|
|
95
|
+
role="checkbox"
|
|
96
96
|
{id}
|
|
97
97
|
{name}
|
|
98
98
|
{value}
|
|
99
|
-
role="checkbox"
|
|
100
99
|
{hidden}
|
|
101
100
|
{disabled}
|
|
102
101
|
{readonly}
|
|
@@ -105,6 +104,7 @@
|
|
|
105
104
|
aria-checked={checked}
|
|
106
105
|
aria-label={ariaLabel || undefined}
|
|
107
106
|
aria-labelledby={ariaLabel ? undefined : '{id}-label'}
|
|
107
|
+
{...$$restProps}
|
|
108
108
|
bind:this={buttonComponent}
|
|
109
109
|
on:click={(event) => {
|
|
110
110
|
event.preventDefault();
|
|
@@ -134,6 +134,7 @@
|
|
|
134
134
|
display: inline-flex;
|
|
135
135
|
align-items: center;
|
|
136
136
|
gap: 8px;
|
|
137
|
+
margin: var(--sui-focus-ring-width);
|
|
137
138
|
color: var(--sui-control-foreground-color);
|
|
138
139
|
font-family: var(--sui-control-font-family);
|
|
139
140
|
font-size: var(--sui-control-font-size);
|
|
@@ -158,6 +159,7 @@
|
|
|
158
159
|
align-items: center;
|
|
159
160
|
justify-content: center;
|
|
160
161
|
overflow: hidden;
|
|
162
|
+
margin: 0 !important;
|
|
161
163
|
border-width: 1.5px;
|
|
162
164
|
border-color: var(--sui-checkbox-border-color);
|
|
163
165
|
border-radius: var(--sui-checkbox-border-radius);
|
|
@@ -11,8 +11,8 @@ export default class Checkbox extends SvelteComponent<{
|
|
|
11
11
|
[x: string]: any;
|
|
12
12
|
class?: string;
|
|
13
13
|
name?: string;
|
|
14
|
-
label?: string;
|
|
15
14
|
invalid?: boolean;
|
|
15
|
+
label?: string;
|
|
16
16
|
checked?: boolean | "mixed";
|
|
17
17
|
disabled?: boolean;
|
|
18
18
|
required?: boolean;
|
|
@@ -36,8 +36,8 @@ declare const __propDef: {
|
|
|
36
36
|
[x: string]: any;
|
|
37
37
|
class?: string;
|
|
38
38
|
name?: string | undefined;
|
|
39
|
-
label?: string | undefined;
|
|
40
39
|
invalid?: boolean;
|
|
40
|
+
label?: string | undefined;
|
|
41
41
|
checked?: boolean | 'mixed';
|
|
42
42
|
disabled?: boolean;
|
|
43
43
|
required?: boolean;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
A modal alert dialog. It only shows the OK button, just like `window.alert()`.
|
|
4
|
+
@see https://w3c.github.io/aria/#alertdialog
|
|
5
|
+
@see https://www.w3.org/WAI/ARIA/apg/patterns/alertdialog/
|
|
6
|
+
@see https://developer.mozilla.org/en-US/docs/Web/API/Window/alert
|
|
7
|
+
-->
|
|
8
|
+
<script>
|
|
9
|
+
import Dialog from './dialog.svelte';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The `class` attribute on the `<dialog>` element.
|
|
13
|
+
* @type {string}
|
|
14
|
+
*/
|
|
15
|
+
let className = '';
|
|
16
|
+
export { className as class };
|
|
17
|
+
/**
|
|
18
|
+
* Whether to open the dialog.
|
|
19
|
+
* @type {boolean}
|
|
20
|
+
*/
|
|
21
|
+
export let open = false;
|
|
22
|
+
/**
|
|
23
|
+
* Text label displayed on the header. Required.
|
|
24
|
+
* @type {string}
|
|
25
|
+
*/
|
|
26
|
+
export let title;
|
|
27
|
+
/**
|
|
28
|
+
* Text label displayed on the OK button.
|
|
29
|
+
* @type {string}
|
|
30
|
+
*/
|
|
31
|
+
export let okLabel = '';
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<Dialog
|
|
35
|
+
role="alertdialog"
|
|
36
|
+
class={className}
|
|
37
|
+
bind:open
|
|
38
|
+
{title}
|
|
39
|
+
{okLabel}
|
|
40
|
+
showCancel={false}
|
|
41
|
+
{...$$restProps}
|
|
42
|
+
on:opening
|
|
43
|
+
on:open
|
|
44
|
+
on:ok
|
|
45
|
+
on:cancel
|
|
46
|
+
on:closing
|
|
47
|
+
on:close
|
|
48
|
+
>
|
|
49
|
+
<slot />
|
|
50
|
+
</Dialog>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} AlertDialogProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} AlertDialogEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} AlertDialogSlots */
|
|
4
|
+
/**
|
|
5
|
+
* A modal alert dialog. It only shows the OK button, just like `window.alert()`.
|
|
6
|
+
* @see https://w3c.github.io/aria/#alertdialog
|
|
7
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/alertdialog/
|
|
8
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/alert
|
|
9
|
+
*/
|
|
10
|
+
export default class AlertDialog extends SvelteComponent<{
|
|
11
|
+
[x: string]: any;
|
|
12
|
+
title: string;
|
|
13
|
+
class?: string;
|
|
14
|
+
open?: boolean;
|
|
15
|
+
okLabel?: string;
|
|
16
|
+
}, {
|
|
17
|
+
opening: CustomEvent<any>;
|
|
18
|
+
open: CustomEvent<any>;
|
|
19
|
+
ok: CustomEvent<any>;
|
|
20
|
+
cancel: CustomEvent<any>;
|
|
21
|
+
closing: CustomEvent<any>;
|
|
22
|
+
close: CustomEvent<any>;
|
|
23
|
+
} & {
|
|
24
|
+
[evt: string]: CustomEvent<any>;
|
|
25
|
+
}, {
|
|
26
|
+
default: {};
|
|
27
|
+
}> {
|
|
28
|
+
}
|
|
29
|
+
export type AlertDialogProps = typeof __propDef.props;
|
|
30
|
+
export type AlertDialogEvents = typeof __propDef.events;
|
|
31
|
+
export type AlertDialogSlots = typeof __propDef.slots;
|
|
32
|
+
import { SvelteComponent } from "svelte";
|
|
33
|
+
declare const __propDef: {
|
|
34
|
+
props: {
|
|
35
|
+
[x: string]: any;
|
|
36
|
+
title: string;
|
|
37
|
+
class?: string;
|
|
38
|
+
open?: boolean;
|
|
39
|
+
okLabel?: string;
|
|
40
|
+
};
|
|
41
|
+
events: {
|
|
42
|
+
opening: CustomEvent<any>;
|
|
43
|
+
open: CustomEvent<any>;
|
|
44
|
+
ok: CustomEvent<any>;
|
|
45
|
+
cancel: CustomEvent<any>;
|
|
46
|
+
closing: CustomEvent<any>;
|
|
47
|
+
close: CustomEvent<any>;
|
|
48
|
+
} & {
|
|
49
|
+
[evt: string]: CustomEvent<any>;
|
|
50
|
+
};
|
|
51
|
+
slots: {
|
|
52
|
+
default: {};
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
A modal confirmation dialog. It shows the OK and Cancel buttons, just like `window.confirm()`.
|
|
4
|
+
@see https://w3c.github.io/aria/#alertdialog
|
|
5
|
+
@see https://www.w3.org/WAI/ARIA/apg/patterns/alertdialog/
|
|
6
|
+
@see https://developer.mozilla.org/en-US/docs/Web/API/Window/confirm
|
|
7
|
+
-->
|
|
8
|
+
<script>
|
|
9
|
+
import Dialog from './dialog.svelte';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The `class` attribute on the `<dialog>` element.
|
|
13
|
+
* @type {string}
|
|
14
|
+
*/
|
|
15
|
+
let className = '';
|
|
16
|
+
export { className as class };
|
|
17
|
+
/**
|
|
18
|
+
* Whether to open the dialog.
|
|
19
|
+
* @type {boolean}
|
|
20
|
+
*/
|
|
21
|
+
export let open = false;
|
|
22
|
+
/**
|
|
23
|
+
* Text label displayed on the header. Required.
|
|
24
|
+
* @type {string}
|
|
25
|
+
*/
|
|
26
|
+
export let title;
|
|
27
|
+
/**
|
|
28
|
+
* Text label displayed on the OK button.
|
|
29
|
+
* @type {string}
|
|
30
|
+
*/
|
|
31
|
+
export let okLabel = '';
|
|
32
|
+
/**
|
|
33
|
+
* Text label displayed on the Cancel button.
|
|
34
|
+
* @type {string}
|
|
35
|
+
*/
|
|
36
|
+
export let cancelLabel = '';
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<Dialog
|
|
40
|
+
role="alertdialog"
|
|
41
|
+
class={className}
|
|
42
|
+
bind:open
|
|
43
|
+
{title}
|
|
44
|
+
{okLabel}
|
|
45
|
+
{cancelLabel}
|
|
46
|
+
{...$$restProps}
|
|
47
|
+
on:opening
|
|
48
|
+
on:open
|
|
49
|
+
on:ok
|
|
50
|
+
on:cancel
|
|
51
|
+
on:closing
|
|
52
|
+
on:close
|
|
53
|
+
>
|
|
54
|
+
<slot />
|
|
55
|
+
</Dialog>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} ConfirmationDialogProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} ConfirmationDialogEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} ConfirmationDialogSlots */
|
|
4
|
+
/**
|
|
5
|
+
* A modal confirmation dialog. It shows the OK and Cancel buttons, just like `window.confirm()`.
|
|
6
|
+
* @see https://w3c.github.io/aria/#alertdialog
|
|
7
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/alertdialog/
|
|
8
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/confirm
|
|
9
|
+
*/
|
|
10
|
+
export default class ConfirmationDialog extends SvelteComponent<{
|
|
11
|
+
[x: string]: any;
|
|
12
|
+
title: string;
|
|
13
|
+
class?: string;
|
|
14
|
+
open?: boolean;
|
|
15
|
+
okLabel?: string;
|
|
16
|
+
cancelLabel?: string;
|
|
17
|
+
}, {
|
|
18
|
+
opening: CustomEvent<any>;
|
|
19
|
+
open: CustomEvent<any>;
|
|
20
|
+
ok: CustomEvent<any>;
|
|
21
|
+
cancel: CustomEvent<any>;
|
|
22
|
+
closing: CustomEvent<any>;
|
|
23
|
+
close: CustomEvent<any>;
|
|
24
|
+
} & {
|
|
25
|
+
[evt: string]: CustomEvent<any>;
|
|
26
|
+
}, {
|
|
27
|
+
default: {};
|
|
28
|
+
}> {
|
|
29
|
+
}
|
|
30
|
+
export type ConfirmationDialogProps = typeof __propDef.props;
|
|
31
|
+
export type ConfirmationDialogEvents = typeof __propDef.events;
|
|
32
|
+
export type ConfirmationDialogSlots = typeof __propDef.slots;
|
|
33
|
+
import { SvelteComponent } from "svelte";
|
|
34
|
+
declare const __propDef: {
|
|
35
|
+
props: {
|
|
36
|
+
[x: string]: any;
|
|
37
|
+
title: string;
|
|
38
|
+
class?: string;
|
|
39
|
+
open?: boolean;
|
|
40
|
+
okLabel?: string;
|
|
41
|
+
cancelLabel?: string;
|
|
42
|
+
};
|
|
43
|
+
events: {
|
|
44
|
+
opening: CustomEvent<any>;
|
|
45
|
+
open: CustomEvent<any>;
|
|
46
|
+
ok: CustomEvent<any>;
|
|
47
|
+
cancel: CustomEvent<any>;
|
|
48
|
+
closing: CustomEvent<any>;
|
|
49
|
+
close: CustomEvent<any>;
|
|
50
|
+
} & {
|
|
51
|
+
[evt: string]: CustomEvent<any>;
|
|
52
|
+
};
|
|
53
|
+
slots: {
|
|
54
|
+
default: {};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export {};
|