@sveltia/ui 0.6.5 → 0.7.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/button/button.svelte +114 -79
- package/package/components/button/button.svelte.d.ts +45 -18
- package/package/components/button/select-button-group.svelte +51 -30
- package/package/components/button/select-button-group.svelte.d.ts +12 -8
- package/package/components/button/select-button.svelte +50 -2
- package/package/components/button/select-button.svelte.d.ts +16 -0
- package/package/components/calendar/calendar.svelte +6 -4
- package/package/components/checkbox/checkbox-group.svelte +28 -10
- package/package/components/checkbox/checkbox-group.svelte.d.ts +4 -2
- package/package/components/checkbox/checkbox.svelte +115 -71
- package/package/components/checkbox/checkbox.svelte.d.ts +13 -7
- package/package/components/dialog/dialog.svelte +39 -19
- package/package/components/dialog/dialog.svelte.d.ts +0 -4
- package/package/components/disclosure/disclosure.svelte +48 -21
- package/package/components/disclosure/disclosure.svelte.d.ts +19 -0
- package/package/components/divider/divider.svelte +14 -6
- package/package/components/divider/divider.svelte.d.ts +3 -1
- package/package/components/divider/spacer.svelte +17 -5
- package/package/components/divider/spacer.svelte.d.ts +2 -0
- package/package/components/drawer/drawer.svelte +14 -7
- package/package/components/drawer/drawer.svelte.d.ts +2 -2
- package/package/components/listbox/listbox.svelte +55 -20
- package/package/components/listbox/listbox.svelte.d.ts +12 -13
- package/package/components/listbox/option-group.svelte +22 -5
- package/package/components/listbox/option-group.svelte.d.ts +4 -0
- package/package/components/listbox/option.svelte +41 -14
- package/package/components/listbox/option.svelte.d.ts +9 -3
- package/package/components/menu/menu-button.svelte +51 -5
- package/package/components/menu/menu-button.svelte.d.ts +15 -0
- package/package/components/menu/menu-item-checkbox.svelte +41 -2
- package/package/components/menu/menu-item-checkbox.svelte.d.ts +14 -0
- package/package/components/menu/menu-item-group.svelte +26 -9
- package/package/components/menu/menu-item-group.svelte.d.ts +4 -2
- package/package/components/menu/menu-item-radio.svelte +47 -3
- package/package/components/menu/menu-item-radio.svelte.d.ts +14 -0
- package/package/components/menu/menu-item.svelte +48 -21
- package/package/components/menu/menu-item.svelte.d.ts +10 -4
- package/package/components/menu/menu.svelte +17 -9
- package/package/components/menu/menu.svelte.d.ts +8 -8
- package/package/components/radio/radio-group.svelte +50 -11
- package/package/components/radio/radio-group.svelte.d.ts +13 -5
- package/package/components/radio/radio.svelte +76 -45
- package/package/components/radio/radio.svelte.d.ts +11 -5
- package/package/components/select/combobox.svelte +59 -29
- package/package/components/select/combobox.svelte.d.ts +11 -8
- package/package/components/select/select.svelte +31 -6
- package/package/components/select/select.svelte.d.ts +10 -2
- package/package/components/slider/slider.svelte +158 -70
- package/package/components/slider/slider.svelte.d.ts +12 -4
- package/package/components/switch/switch.svelte +71 -29
- package/package/components/switch/switch.svelte.d.ts +11 -3
- package/package/components/table/table-row-header.svelte +1 -0
- package/package/components/table/table-row.svelte +16 -3
- package/package/components/table/table-row.svelte.d.ts +4 -0
- package/package/components/table/table.svelte +2 -1
- package/package/components/table/table.svelte.d.ts +4 -0
- package/package/components/tabs/tab-list.svelte +33 -16
- package/package/components/tabs/tab-list.svelte.d.ts +8 -18
- package/package/components/tabs/tab-panel.svelte +1 -2
- package/package/components/tabs/tab.svelte +25 -3
- package/package/components/tabs/tab.svelte.d.ts +10 -0
- package/package/components/text-field/markdown-editor.svelte +54 -22
- package/package/components/text-field/markdown-editor.svelte.d.ts +11 -1
- package/package/components/text-field/number-input.svelte +66 -15
- package/package/components/text-field/number-input.svelte.d.ts +13 -5
- package/package/components/text-field/password-input.svelte +42 -9
- package/package/components/text-field/password-input.svelte.d.ts +11 -1
- package/package/components/text-field/search-bar.svelte +68 -18
- package/package/components/text-field/search-bar.svelte.d.ts +26 -1
- package/package/components/text-field/text-area.svelte +55 -21
- package/package/components/text-field/text-area.svelte.d.ts +12 -19
- package/package/components/text-field/text-input.svelte +71 -46
- package/package/components/text-field/text-input.svelte.d.ts +34 -14
- package/package/components/toast/toast.svelte +119 -0
- package/package/components/toast/toast.svelte.d.ts +36 -0
- package/package/components/toolbar/toolbar.svelte +33 -10
- package/package/components/toolbar/toolbar.svelte.d.ts +7 -1
- package/package/components/util/app-shell.svelte +133 -68
- package/package/components/util/group.svelte +21 -6
- package/package/components/util/group.svelte.d.ts +4 -2
- package/package/components/util/popup.svelte +62 -10
- package/package/components/util/popup.svelte.d.ts +13 -3
- package/package/components/util/portal.svelte +1 -1
- package/package/components/util/portal.svelte.d.ts +2 -0
- package/package/index.d.ts +2 -0
- package/package/index.js +4 -3
- package/package/locales/en.d.ts +7 -9
- package/package/locales/en.js +7 -9
- package/package/locales/ja.d.ts +7 -9
- package/package/locales/ja.js +7 -9
- package/package/{components/util → services}/events.d.ts +1 -1
- package/package/{components/util → services}/events.js +3 -2
- package/package/services/group.d.ts +1 -0
- package/package/{components/util → services}/group.js +15 -13
- package/package/{components/util → services}/popup.js +10 -1
- package/package/{components/util → services}/util.d.ts +1 -1
- package/package/{components/util → services}/util.js +2 -2
- package/package/styles/core.scss +36 -7
- package/package/styles/variables.scss +98 -61
- package/package.json +40 -32
- package/package/components/util/group.d.ts +0 -1
- /package/package/{components/util → services}/popup.d.ts +0 -0
|
@@ -4,47 +4,70 @@
|
|
|
4
4
|
@see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details
|
|
5
5
|
@see https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/
|
|
6
6
|
-->
|
|
7
|
+
<svelte:options accessors={true} />
|
|
8
|
+
|
|
7
9
|
<script>
|
|
10
|
+
import { getRandomId } from '../../services/util';
|
|
8
11
|
import Button from '../button/button.svelte';
|
|
9
12
|
import Icon from '../icon/icon.svelte';
|
|
10
|
-
import { getRandomId } from '../util/util';
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
|
-
*
|
|
15
|
+
* The `class` attribute on the wrapper element.
|
|
14
16
|
* @type {string}
|
|
15
17
|
*/
|
|
16
18
|
let className = '';
|
|
17
|
-
|
|
18
19
|
export { className as class };
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Whether to hide the widget. An alias of the `aria-hidden` attribute.
|
|
22
|
+
* @type {boolean | undefined}
|
|
23
|
+
*/
|
|
24
|
+
export let hidden = undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Whether to disable the widget. An alias of the `aria-disabled` attribute.
|
|
27
|
+
* @type {boolean}
|
|
28
|
+
*/
|
|
29
|
+
export let disabled = false;
|
|
30
|
+
/**
|
|
31
|
+
* Whether to show the content. An alias of the `aria-expanded` attribute.
|
|
32
|
+
* @type {boolean}
|
|
33
|
+
*/
|
|
22
34
|
export let expanded = false;
|
|
35
|
+
/**
|
|
36
|
+
* Text label displayed next to the expander.
|
|
37
|
+
* @type {string}
|
|
38
|
+
*/
|
|
39
|
+
export let label = '';
|
|
23
40
|
|
|
24
41
|
const id = getRandomId('disclosure');
|
|
25
42
|
</script>
|
|
26
43
|
|
|
27
44
|
<div
|
|
28
|
-
class="sui disclosure {className}"
|
|
29
45
|
{id}
|
|
46
|
+
class="sui disclosure {className}"
|
|
30
47
|
role="group"
|
|
48
|
+
hidden={hidden || undefined}
|
|
49
|
+
aria-hidden={hidden}
|
|
50
|
+
aria-disabled={disabled}
|
|
31
51
|
aria-labelledby="{id}-header"
|
|
32
52
|
{...$$restProps}
|
|
33
53
|
>
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
expanded
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
<div class="inner" inert={disabled}>
|
|
55
|
+
<Button
|
|
56
|
+
class="header"
|
|
57
|
+
id="{id}-header"
|
|
58
|
+
{disabled}
|
|
59
|
+
aria-controls="{id}-content"
|
|
60
|
+
aria-expanded={expanded}
|
|
61
|
+
on:click={() => {
|
|
62
|
+
expanded = !expanded;
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
<Icon name="expand_more" />
|
|
66
|
+
{label}
|
|
67
|
+
</Button>
|
|
68
|
+
<div class="content" id="{id}-content" hidden={!expanded}>
|
|
69
|
+
<slot />
|
|
70
|
+
</div>
|
|
48
71
|
</div>
|
|
49
72
|
</div>
|
|
50
73
|
|
|
@@ -60,6 +83,10 @@
|
|
|
60
83
|
transform: rotate(-90deg);
|
|
61
84
|
}
|
|
62
85
|
|
|
86
|
+
.inner {
|
|
87
|
+
display: contents;
|
|
88
|
+
}
|
|
89
|
+
|
|
63
90
|
.content[hidden] {
|
|
64
91
|
display: block;
|
|
65
92
|
overflow: hidden;
|
|
@@ -10,12 +10,29 @@ export default class Disclosure extends SvelteComponent<{
|
|
|
10
10
|
[x: string]: any;
|
|
11
11
|
class?: string;
|
|
12
12
|
label?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
hidden?: boolean;
|
|
13
15
|
expanded?: boolean;
|
|
14
16
|
}, {
|
|
15
17
|
[evt: string]: CustomEvent<any>;
|
|
16
18
|
}, {
|
|
17
19
|
default: {};
|
|
18
20
|
}> {
|
|
21
|
+
/**accessor*/
|
|
22
|
+
set class(arg: string);
|
|
23
|
+
get class(): string;
|
|
24
|
+
/**accessor*/
|
|
25
|
+
set hidden(arg: boolean);
|
|
26
|
+
get hidden(): boolean;
|
|
27
|
+
/**accessor*/
|
|
28
|
+
set disabled(arg: boolean);
|
|
29
|
+
get disabled(): boolean;
|
|
30
|
+
/**accessor*/
|
|
31
|
+
set expanded(arg: boolean);
|
|
32
|
+
get expanded(): boolean;
|
|
33
|
+
/**accessor*/
|
|
34
|
+
set label(arg: string);
|
|
35
|
+
get label(): string;
|
|
19
36
|
}
|
|
20
37
|
export type DisclosureProps = typeof __propDef.props;
|
|
21
38
|
export type DisclosureEvents = typeof __propDef.events;
|
|
@@ -26,6 +43,8 @@ declare const __propDef: {
|
|
|
26
43
|
[x: string]: any;
|
|
27
44
|
class?: string;
|
|
28
45
|
label?: string;
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
hidden?: boolean | undefined;
|
|
29
48
|
expanded?: boolean;
|
|
30
49
|
};
|
|
31
50
|
events: {
|
|
@@ -4,21 +4,29 @@
|
|
|
4
4
|
@see https://w3c.github.io/aria/#separator
|
|
5
5
|
-->
|
|
6
6
|
<script>
|
|
7
|
-
/** @type {('horizontal' | 'vertical')} */
|
|
8
|
-
export let orientation = 'horizontal';
|
|
9
|
-
|
|
10
7
|
/**
|
|
11
|
-
* CSS class name on the
|
|
8
|
+
* CSS class name on the wrapper element.
|
|
12
9
|
* @type {string}
|
|
13
10
|
*/
|
|
14
11
|
let className = '';
|
|
15
|
-
|
|
16
12
|
export { className as class };
|
|
13
|
+
/**
|
|
14
|
+
* Whether to hide the widget. An alias of the `aria-hidden` attribute.
|
|
15
|
+
* @type {boolean | undefined}
|
|
16
|
+
*/
|
|
17
|
+
export let hidden = undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Orientation of the widget. An alias of the `aria-orientation` attribute.
|
|
20
|
+
* @type {'horizontal' | 'vertical'}
|
|
21
|
+
*/
|
|
22
|
+
export let orientation = 'horizontal';
|
|
17
23
|
</script>
|
|
18
24
|
|
|
19
25
|
<div
|
|
20
|
-
role="separator"
|
|
21
26
|
class="sui divider {className}"
|
|
27
|
+
role="separator"
|
|
28
|
+
hidden={hidden || undefined}
|
|
29
|
+
aria-hidden={hidden}
|
|
22
30
|
aria-orientation={orientation}
|
|
23
31
|
{...$$restProps}
|
|
24
32
|
/>
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
export default class Divider extends SvelteComponent<{
|
|
9
9
|
[x: string]: any;
|
|
10
10
|
class?: string;
|
|
11
|
+
hidden?: boolean;
|
|
11
12
|
orientation?: "vertical" | "horizontal";
|
|
12
13
|
}, {
|
|
13
14
|
[evt: string]: CustomEvent<any>;
|
|
@@ -21,7 +22,8 @@ declare const __propDef: {
|
|
|
21
22
|
props: {
|
|
22
23
|
[x: string]: any;
|
|
23
24
|
class?: string;
|
|
24
|
-
|
|
25
|
+
hidden?: boolean | undefined;
|
|
26
|
+
orientation?: 'horizontal' | 'vertical';
|
|
25
27
|
};
|
|
26
28
|
events: {
|
|
27
29
|
[evt: string]: CustomEvent<any>;
|
|
@@ -4,18 +4,30 @@
|
|
|
4
4
|
-->
|
|
5
5
|
<script>
|
|
6
6
|
/**
|
|
7
|
-
* CSS class name on the
|
|
7
|
+
* CSS class name on the wrapper element.
|
|
8
8
|
* @type {string}
|
|
9
9
|
*/
|
|
10
10
|
let className = '';
|
|
11
|
-
|
|
12
11
|
export { className as class };
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Whether to hide the widget. An alias of the `aria-hidden` attribute.
|
|
14
|
+
* @type {boolean | undefined}
|
|
15
|
+
*/
|
|
16
|
+
export let hidden = undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Whether to make the spacer flexible.
|
|
19
|
+
* @type {boolean}
|
|
20
|
+
*/
|
|
15
21
|
export let flex = false;
|
|
16
22
|
</script>
|
|
17
23
|
|
|
18
|
-
<div
|
|
24
|
+
<div
|
|
25
|
+
class="sui spacer {className}"
|
|
26
|
+
class:flex
|
|
27
|
+
hidden={hidden || undefined}
|
|
28
|
+
aria-hidden={hidden}
|
|
29
|
+
{...$$restProps}
|
|
30
|
+
/>
|
|
19
31
|
|
|
20
32
|
<style>.spacer.flex {
|
|
21
33
|
flex: auto;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
export default class Spacer extends SvelteComponent<{
|
|
6
6
|
[x: string]: any;
|
|
7
7
|
class?: string;
|
|
8
|
+
hidden?: boolean;
|
|
8
9
|
flex?: boolean;
|
|
9
10
|
}, {
|
|
10
11
|
[evt: string]: CustomEvent<any>;
|
|
@@ -18,6 +19,7 @@ declare const __propDef: {
|
|
|
18
19
|
props: {
|
|
19
20
|
[x: string]: any;
|
|
20
21
|
class?: string;
|
|
22
|
+
hidden?: boolean | undefined;
|
|
21
23
|
flex?: boolean;
|
|
22
24
|
};
|
|
23
25
|
events: {
|
|
@@ -113,9 +113,10 @@
|
|
|
113
113
|
}
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
$: {
|
|
117
|
+
void open;
|
|
118
|
+
toggleDialog();
|
|
119
|
+
}
|
|
119
120
|
|
|
120
121
|
onMount(() => {
|
|
121
122
|
dialog.remove();
|
|
@@ -149,13 +150,15 @@
|
|
|
149
150
|
<div class="extra-control">
|
|
150
151
|
{#if showClose === 'outside'}
|
|
151
152
|
<Button
|
|
152
|
-
|
|
153
|
+
variant="ghost"
|
|
154
|
+
iconic
|
|
155
|
+
class="close"
|
|
153
156
|
on:click={() => {
|
|
154
157
|
dialog.returnValue = 'close';
|
|
155
158
|
open = false;
|
|
156
159
|
}}
|
|
157
160
|
>
|
|
158
|
-
<Icon slot="start-icon" name="close" label={$_('_sui.
|
|
161
|
+
<Icon slot="start-icon" name="close" label={$_('_sui.close')} />
|
|
159
162
|
</Button>
|
|
160
163
|
{/if}
|
|
161
164
|
</div>
|
|
@@ -174,13 +177,15 @@
|
|
|
174
177
|
{/if}
|
|
175
178
|
{#if showClose === 'inside'}
|
|
176
179
|
<Button
|
|
177
|
-
|
|
180
|
+
variant="ghost"
|
|
181
|
+
iconic
|
|
182
|
+
class="close"
|
|
178
183
|
on:click={() => {
|
|
179
184
|
dialog.returnValue = 'close';
|
|
180
185
|
open = false;
|
|
181
186
|
}}
|
|
182
187
|
>
|
|
183
|
-
<Icon slot="start-icon" name="close" label={$_('_sui.
|
|
188
|
+
<Icon slot="start-icon" name="close" label={$_('_sui.close')} />
|
|
184
189
|
</Button>
|
|
185
190
|
{/if}
|
|
186
191
|
{/if}
|
|
@@ -232,6 +237,8 @@ dialog form {
|
|
|
232
237
|
display: flex;
|
|
233
238
|
flex-direction: column;
|
|
234
239
|
border-radius: 4px;
|
|
240
|
+
max-width: 100vw;
|
|
241
|
+
max-height: 100vh;
|
|
235
242
|
background-color: var(--sui-secondary-background-color-translucent);
|
|
236
243
|
-webkit-backdrop-filter: blur(16px);
|
|
237
244
|
backdrop-filter: blur(16px);
|
|
@@ -10,8 +10,8 @@ export default class Drawer extends SvelteComponent<{
|
|
|
10
10
|
[x: string]: any;
|
|
11
11
|
class?: string;
|
|
12
12
|
title?: string;
|
|
13
|
-
position?: "top" | "right" | "bottom" | "left";
|
|
14
13
|
size?: "small" | "medium" | "large" | "x-large";
|
|
14
|
+
position?: "top" | "right" | "bottom" | "left";
|
|
15
15
|
open?: boolean;
|
|
16
16
|
showClose?: false | "inside" | "outside";
|
|
17
17
|
closeOnBackdropClick?: boolean;
|
|
@@ -38,8 +38,8 @@ declare const __propDef: {
|
|
|
38
38
|
[x: string]: any;
|
|
39
39
|
class?: string;
|
|
40
40
|
title?: string;
|
|
41
|
-
position?: ('top' | 'right' | 'bottom' | 'left');
|
|
42
41
|
size?: ('small' | 'medium' | 'large' | 'x-large');
|
|
42
|
+
position?: ('top' | 'right' | 'bottom' | 'left');
|
|
43
43
|
open?: boolean;
|
|
44
44
|
showClose?: ('inside' | 'outside' | false);
|
|
45
45
|
closeOnBackdropClick?: boolean;
|
|
@@ -5,37 +5,67 @@
|
|
|
5
5
|
@see https://w3c.github.io/aria/#listbox
|
|
6
6
|
@see https://www.w3.org/WAI/ARIA/apg/patterns/listbox/
|
|
7
7
|
-->
|
|
8
|
-
<svelte:options accessors={true} />
|
|
9
|
-
|
|
10
8
|
<script>
|
|
11
|
-
import { activateGroup } from '
|
|
9
|
+
import { activateGroup } from '../../services/group';
|
|
12
10
|
|
|
13
11
|
/**
|
|
14
|
-
*
|
|
12
|
+
* The `class` attribute on the wrapper element.
|
|
15
13
|
* @type {string}
|
|
16
14
|
*/
|
|
17
15
|
let className = '';
|
|
18
|
-
|
|
19
16
|
export { className as class };
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Whether to hide the widget. An alias of the `aria-hidden` attribute.
|
|
19
|
+
* @type {boolean | undefined}
|
|
20
|
+
*/
|
|
21
|
+
export let hidden = undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Whether to disable the widget. An alias of the `aria-disabled` attribute.
|
|
24
|
+
* @type {boolean}
|
|
25
|
+
*/
|
|
26
|
+
export let disabled = false;
|
|
27
|
+
/**
|
|
28
|
+
* Whether to disable the widget. An alias of the `aria-readonly` attribute.
|
|
29
|
+
* @type {boolean}
|
|
30
|
+
*/
|
|
31
|
+
export let readonly = false;
|
|
32
|
+
/**
|
|
33
|
+
* Whether to disable the widget. An alias of the `aria-required` attribute.
|
|
34
|
+
* @type {boolean}
|
|
35
|
+
*/
|
|
36
|
+
export let required = false;
|
|
37
|
+
/**
|
|
38
|
+
* Whether to disable the widget. An alias of the `aria-invalid` attribute.
|
|
39
|
+
* @type {boolean}
|
|
40
|
+
*/
|
|
41
|
+
export let invalid = false;
|
|
42
|
+
/**
|
|
43
|
+
* Whether to allow selecting more than one `<Option>`. An alias of the `aria-multiselectable`
|
|
44
|
+
* attribute.
|
|
45
|
+
* @type {boolean}
|
|
46
|
+
*/
|
|
24
47
|
export let multiple = false;
|
|
25
48
|
</script>
|
|
26
49
|
|
|
27
50
|
<div
|
|
28
51
|
class="sui listbox {className}"
|
|
29
|
-
tabindex=
|
|
52
|
+
tabindex={disabled ? -1 : 0}
|
|
30
53
|
role="listbox"
|
|
54
|
+
hidden={hidden || undefined}
|
|
55
|
+
aria-hidden={hidden}
|
|
56
|
+
aria-disabled={disabled}
|
|
57
|
+
aria-readonly={readonly}
|
|
58
|
+
aria-required={required}
|
|
59
|
+
aria-invalid={invalid}
|
|
31
60
|
aria-multiselectable={multiple}
|
|
32
61
|
{...$$restProps}
|
|
33
|
-
bind:this={element}
|
|
34
|
-
on:click
|
|
35
|
-
on:select
|
|
36
62
|
use:activateGroup
|
|
63
|
+
on:click
|
|
64
|
+
on:change
|
|
37
65
|
>
|
|
38
|
-
<
|
|
66
|
+
<div class="inner" inert={disabled}>
|
|
67
|
+
<slot />
|
|
68
|
+
</div>
|
|
39
69
|
</div>
|
|
40
70
|
|
|
41
71
|
<style>[role=listbox] {
|
|
@@ -43,18 +73,19 @@
|
|
|
43
73
|
flex-direction: column;
|
|
44
74
|
margin: 0;
|
|
45
75
|
border-width: 1px;
|
|
46
|
-
border-color: var(--sui-
|
|
47
|
-
border-radius:
|
|
76
|
+
border-color: var(--sui-listbox-border-color);
|
|
77
|
+
border-radius: var(--sui-listbox-border-radius);
|
|
48
78
|
padding: 4px;
|
|
49
|
-
min-width:
|
|
50
|
-
color: var(--sui-
|
|
51
|
-
background-color: var(--sui-
|
|
79
|
+
min-width: var(--sui-listbox-min-width, calc(var(--sui-option-height) * 5));
|
|
80
|
+
color: var(--sui-listbox-foreground-color);
|
|
81
|
+
background-color: var(--sui-listbox-background-color);
|
|
52
82
|
font-family: var(--sui-control-font-family);
|
|
53
83
|
font-size: var(--sui-control-font-size);
|
|
54
84
|
line-height: var(--sui-control-line-height);
|
|
55
85
|
}
|
|
56
86
|
[role=listbox] :global([role="separator"]) {
|
|
57
87
|
margin: 4px;
|
|
88
|
+
background-color: var(--sui-control-border-color);
|
|
58
89
|
}
|
|
59
90
|
[role=listbox]:global(.tabs) {
|
|
60
91
|
padding: 0;
|
|
@@ -74,5 +105,9 @@
|
|
|
74
105
|
display: none;
|
|
75
106
|
}
|
|
76
107
|
[role=listbox]:global(.tabs) :global(.option button[aria-selected="true"]) {
|
|
77
|
-
border-color: var(--sui-primary-accent-color-
|
|
108
|
+
border-color: var(--sui-primary-accent-color-light);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.inner {
|
|
112
|
+
display: contents;
|
|
78
113
|
}</style>
|
|
@@ -10,25 +10,20 @@
|
|
|
10
10
|
export default class Listbox extends SvelteComponent<{
|
|
11
11
|
[x: string]: any;
|
|
12
12
|
class?: string;
|
|
13
|
+
invalid?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
13
15
|
multiple?: boolean;
|
|
14
|
-
|
|
16
|
+
required?: boolean;
|
|
17
|
+
hidden?: boolean;
|
|
18
|
+
readonly?: boolean;
|
|
15
19
|
}, {
|
|
16
20
|
click: MouseEvent;
|
|
17
|
-
|
|
21
|
+
change: Event;
|
|
18
22
|
} & {
|
|
19
23
|
[evt: string]: CustomEvent<any>;
|
|
20
24
|
}, {
|
|
21
25
|
default: {};
|
|
22
26
|
}> {
|
|
23
|
-
/**accessor*/
|
|
24
|
-
set class(arg: string);
|
|
25
|
-
get class(): string;
|
|
26
|
-
/**accessor*/
|
|
27
|
-
set element(arg: HTMLElement);
|
|
28
|
-
get element(): HTMLElement;
|
|
29
|
-
/**accessor*/
|
|
30
|
-
set multiple(arg: boolean);
|
|
31
|
-
get multiple(): boolean;
|
|
32
27
|
}
|
|
33
28
|
export type ListboxProps = typeof __propDef.props;
|
|
34
29
|
export type ListboxEvents = typeof __propDef.events;
|
|
@@ -38,12 +33,16 @@ declare const __propDef: {
|
|
|
38
33
|
props: {
|
|
39
34
|
[x: string]: any;
|
|
40
35
|
class?: string;
|
|
36
|
+
invalid?: boolean;
|
|
37
|
+
disabled?: boolean;
|
|
41
38
|
multiple?: boolean;
|
|
42
|
-
|
|
39
|
+
required?: boolean;
|
|
40
|
+
hidden?: boolean | undefined;
|
|
41
|
+
readonly?: boolean;
|
|
43
42
|
};
|
|
44
43
|
events: {
|
|
45
44
|
click: MouseEvent;
|
|
46
|
-
|
|
45
|
+
change: Event;
|
|
47
46
|
} & {
|
|
48
47
|
[evt: string]: CustomEvent<any>;
|
|
49
48
|
};
|
|
@@ -7,16 +7,24 @@
|
|
|
7
7
|
@see https://www.w3.org/WAI/ARIA/apg/patterns/listbox/examples/listbox-grouped/
|
|
8
8
|
-->
|
|
9
9
|
<script>
|
|
10
|
-
import { getRandomId } from '
|
|
10
|
+
import { getRandomId } from '../../services/util';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* The `class` attribute on the wrapper element.
|
|
14
14
|
* @type {string}
|
|
15
15
|
*/
|
|
16
16
|
let className = '';
|
|
17
|
-
|
|
18
17
|
export { className as class };
|
|
19
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Whether to hide the widget. An alias of the `aria-hidden` attribute.
|
|
20
|
+
* @type {boolean | undefined}
|
|
21
|
+
*/
|
|
22
|
+
export let hidden = undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Whether to disable the widget. An alias of the `aria-disabled` attribute.
|
|
25
|
+
* @type {boolean}
|
|
26
|
+
*/
|
|
27
|
+
export let disabled = false;
|
|
20
28
|
/**
|
|
21
29
|
* The group’s label to be displayed above the child `<Option>`s.
|
|
22
30
|
*/
|
|
@@ -29,11 +37,16 @@
|
|
|
29
37
|
{id}
|
|
30
38
|
class="sui optgroup {className}"
|
|
31
39
|
role="group"
|
|
40
|
+
hidden={hidden || undefined}
|
|
41
|
+
aria-hidden={hidden}
|
|
42
|
+
aria-disabled={disabled}
|
|
32
43
|
aria-labelledby="{id}-label"
|
|
33
44
|
{...$$restProps}
|
|
34
45
|
>
|
|
35
46
|
<div id="{id}-label" class="label" role="none">{label}</div>
|
|
36
|
-
<
|
|
47
|
+
<div class="inner" inert={disabled}>
|
|
48
|
+
<slot />
|
|
49
|
+
</div>
|
|
37
50
|
</div>
|
|
38
51
|
|
|
39
52
|
<style>.optgroup:not(:first-child) {
|
|
@@ -44,4 +57,8 @@
|
|
|
44
57
|
margin: 8px;
|
|
45
58
|
color: var(--sui-secondary-foreground-color);
|
|
46
59
|
font-size: var(--sui-font-size-small);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.inner {
|
|
63
|
+
display: contents;
|
|
47
64
|
}</style>
|
|
@@ -12,6 +12,8 @@ export default class OptionGroup extends SvelteComponent<{
|
|
|
12
12
|
[x: string]: any;
|
|
13
13
|
class?: string;
|
|
14
14
|
label?: string;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
hidden?: boolean;
|
|
15
17
|
}, {
|
|
16
18
|
[evt: string]: CustomEvent<any>;
|
|
17
19
|
}, {
|
|
@@ -27,6 +29,8 @@ declare const __propDef: {
|
|
|
27
29
|
[x: string]: any;
|
|
28
30
|
class?: string;
|
|
29
31
|
label?: string;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
hidden?: boolean | undefined;
|
|
30
34
|
};
|
|
31
35
|
events: {
|
|
32
36
|
[evt: string]: CustomEvent<any>;
|
|
@@ -10,19 +10,40 @@
|
|
|
10
10
|
import Icon from '../icon/icon.svelte';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* The `class` attribute on the wrapper element.
|
|
14
14
|
* @type {string}
|
|
15
15
|
*/
|
|
16
16
|
let className = '';
|
|
17
|
-
|
|
18
17
|
export { className as class };
|
|
19
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Whether to select the widget. An alias of the `aria-selected` attribute.
|
|
20
|
+
* @type {boolean}
|
|
21
|
+
*/
|
|
22
|
+
export let selected = false;
|
|
23
|
+
/**
|
|
24
|
+
* Whether to hide the widget. An alias of the `aria-hidden` attribute.
|
|
25
|
+
* @type {boolean | undefined}
|
|
26
|
+
*/
|
|
27
|
+
export let hidden = undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Whether to disable the widget. An alias of the `aria-disabled` attribute.
|
|
30
|
+
* @type {boolean}
|
|
31
|
+
*/
|
|
32
|
+
export let disabled = false;
|
|
33
|
+
/**
|
|
34
|
+
* Text label displayed on the item.
|
|
35
|
+
* @type {string | undefined}
|
|
36
|
+
*/
|
|
20
37
|
export let label = '';
|
|
38
|
+
/**
|
|
39
|
+
* The `value` attribute on the `<button>` element.
|
|
40
|
+
* @type {string | undefined}
|
|
41
|
+
*/
|
|
21
42
|
export let value = undefined;
|
|
22
|
-
export let selected = false;
|
|
23
43
|
|
|
24
44
|
/**
|
|
25
|
-
*
|
|
45
|
+
* Reference to the `Button` component.
|
|
46
|
+
* @type {Button | undefined}
|
|
26
47
|
*/
|
|
27
48
|
let buttonComponent;
|
|
28
49
|
|
|
@@ -45,7 +66,7 @@
|
|
|
45
66
|
});
|
|
46
67
|
</script>
|
|
47
68
|
|
|
48
|
-
<div class="sui option {className}">
|
|
69
|
+
<div class="sui option {className}" hidden={hidden || undefined}>
|
|
49
70
|
<Button
|
|
50
71
|
bind:this={buttonComponent}
|
|
51
72
|
tabindex="-1"
|
|
@@ -53,6 +74,8 @@
|
|
|
53
74
|
aria-selected={selected}
|
|
54
75
|
{label}
|
|
55
76
|
{value}
|
|
77
|
+
{hidden}
|
|
78
|
+
{disabled}
|
|
56
79
|
data-type={typeof value}
|
|
57
80
|
{...$$restProps}
|
|
58
81
|
on:click
|
|
@@ -60,6 +83,7 @@
|
|
|
60
83
|
on:dragleave
|
|
61
84
|
on:dragend
|
|
62
85
|
on:drop
|
|
86
|
+
on:select
|
|
63
87
|
>
|
|
64
88
|
{#if selected}
|
|
65
89
|
<Icon class="check" name="check" />
|
|
@@ -76,22 +100,25 @@
|
|
|
76
100
|
.option:focus-visible {
|
|
77
101
|
outline-width: 0 !important;
|
|
78
102
|
}
|
|
79
|
-
.option :global(
|
|
103
|
+
.option :global(button) {
|
|
80
104
|
flex: none;
|
|
81
105
|
display: flex;
|
|
82
106
|
justify-content: space-between;
|
|
83
107
|
gap: 4px;
|
|
84
|
-
border-radius:
|
|
85
|
-
padding:
|
|
108
|
+
border-radius: var(--sui-option-border-radius);
|
|
109
|
+
padding: var(--sui-option-padding);
|
|
86
110
|
width: 100%;
|
|
87
|
-
height: var(--sui-option-
|
|
111
|
+
height: var(--sui-option-height);
|
|
88
112
|
white-space: nowrap;
|
|
89
113
|
}
|
|
90
114
|
.option :global(.focused),
|
|
91
|
-
.option :global(
|
|
115
|
+
.option :global(button:hover) {
|
|
92
116
|
color: var(--sui-highlight-foreground-color);
|
|
93
|
-
background-color: var(--sui-
|
|
117
|
+
background-color: var(--sui-hover-background-color);
|
|
118
|
+
}
|
|
119
|
+
.option :global(button:active) {
|
|
120
|
+
background-color: var(--sui-active-background-color);
|
|
94
121
|
}
|
|
95
|
-
.option :global([
|
|
96
|
-
color: var(--sui-primary-accent-color-
|
|
122
|
+
.option :global(button[aria-selected="true"]) :global(.icon) {
|
|
123
|
+
color: var(--sui-primary-accent-color-text);
|
|
97
124
|
}</style>
|