@sveltia/ui 0.6.6 → 0.7.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/button/button.svelte +112 -75
- 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 +5 -3
- 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 +114 -71
- package/package/components/checkbox/checkbox.svelte.d.ts +13 -7
- package/package/components/dialog/dialog.svelte +37 -17
- 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 +13 -6
- 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 +8 -2
- 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 +67 -17
- 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 +120 -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 -69
- package/package/components/util/group.svelte +21 -6
- package/package/components/util/group.svelte.d.ts +4 -2
- package/package/components/util/popup.svelte +63 -11
- 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/{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 +17 -15
- 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 -62
- package/package.json +42 -34
- package/package/components/util/group.d.ts +0 -1
- /package/package/{components/util → services}/popup.d.ts +0 -0
- /package/package/{components/util → services}/popup.js +0 -0
|
@@ -8,6 +8,13 @@
|
|
|
8
8
|
export default class MenuButton extends SvelteComponent<{
|
|
9
9
|
[x: string]: any;
|
|
10
10
|
class?: string;
|
|
11
|
+
label?: string;
|
|
12
|
+
focus?: () => void;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
size?: "small" | "medium" | "large";
|
|
15
|
+
hidden?: boolean;
|
|
16
|
+
variant?: "link" | "primary" | "secondary" | "tertiary" | "ghost";
|
|
17
|
+
iconic?: boolean;
|
|
11
18
|
popupPosition?: PopupPosition;
|
|
12
19
|
}, {
|
|
13
20
|
[evt: string]: CustomEvent<any>;
|
|
@@ -21,6 +28,7 @@ export default class MenuButton extends SvelteComponent<{
|
|
|
21
28
|
};
|
|
22
29
|
popup: {};
|
|
23
30
|
}> {
|
|
31
|
+
get focus(): () => void;
|
|
24
32
|
}
|
|
25
33
|
export type MenuButtonProps = typeof __propDef.props;
|
|
26
34
|
export type MenuButtonEvents = typeof __propDef.events;
|
|
@@ -30,6 +38,13 @@ declare const __propDef: {
|
|
|
30
38
|
props: {
|
|
31
39
|
[x: string]: any;
|
|
32
40
|
class?: string;
|
|
41
|
+
label?: string;
|
|
42
|
+
focus?: () => void;
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
size?: 'small' | 'medium' | 'large';
|
|
45
|
+
hidden?: boolean | undefined;
|
|
46
|
+
variant?: 'primary' | 'secondary' | 'tertiary' | 'ghost' | 'link' | undefined;
|
|
47
|
+
iconic?: boolean;
|
|
33
48
|
popupPosition?: PopupPosition;
|
|
34
49
|
};
|
|
35
50
|
events: {
|
|
@@ -4,22 +4,61 @@
|
|
|
4
4
|
@see https://w3c.github.io/aria/#menuitemcheckbox
|
|
5
5
|
-->
|
|
6
6
|
<script>
|
|
7
|
+
import Icon from '../icon/icon.svelte';
|
|
7
8
|
import MenuItem from './menu-item.svelte';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
+
* The `class` attribute on the wrapper element.
|
|
11
12
|
* @type {string}
|
|
12
13
|
*/
|
|
13
14
|
let className = '';
|
|
14
|
-
|
|
15
15
|
export { className as class };
|
|
16
|
+
/**
|
|
17
|
+
* Whether to hide the widget. An alias of the `aria-hidden` attribute.
|
|
18
|
+
* @type {boolean | undefined}
|
|
19
|
+
*/
|
|
20
|
+
export let hidden = undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Whether to disable the widget. An alias of the `aria-disabled` attribute.
|
|
23
|
+
* @type {boolean}
|
|
24
|
+
*/
|
|
25
|
+
export let disabled = false;
|
|
26
|
+
/**
|
|
27
|
+
* Whether to mark the widget checked.
|
|
28
|
+
* @type {boolean}
|
|
29
|
+
*/
|
|
30
|
+
export let checked = false;
|
|
31
|
+
/**
|
|
32
|
+
* Text label displayed on the item.
|
|
33
|
+
* @type {string | undefined}
|
|
34
|
+
*/
|
|
35
|
+
export let label = '';
|
|
36
|
+
/**
|
|
37
|
+
* Name of `<Icon>` displayed before the label.
|
|
38
|
+
*/
|
|
39
|
+
export let iconName = '';
|
|
40
|
+
/**
|
|
41
|
+
* ARIA label of `<Icon>` displayed before the label.
|
|
42
|
+
*/
|
|
43
|
+
export let iconLabel = '';
|
|
16
44
|
</script>
|
|
17
45
|
|
|
18
46
|
<MenuItem
|
|
19
47
|
class="sui menu-item-checkbox {className}"
|
|
20
48
|
role="menuitemcheckbox"
|
|
49
|
+
{label}
|
|
50
|
+
{hidden}
|
|
51
|
+
{disabled}
|
|
52
|
+
aria-checked={checked}
|
|
53
|
+
{iconName}
|
|
54
|
+
{iconLabel}
|
|
21
55
|
{...$$restProps}
|
|
22
56
|
on:click
|
|
57
|
+
on:click={() => {
|
|
58
|
+
checked = !checked;
|
|
59
|
+
}}
|
|
60
|
+
on:select
|
|
23
61
|
>
|
|
24
62
|
<slot />
|
|
63
|
+
<svelte:component this={checked ? Icon : undefined} slot="end-icon" name="check" />
|
|
25
64
|
</MenuItem>
|
|
@@ -8,8 +8,15 @@
|
|
|
8
8
|
export default class MenuItemCheckbox extends SvelteComponent<{
|
|
9
9
|
[x: string]: any;
|
|
10
10
|
class?: string;
|
|
11
|
+
label?: string;
|
|
12
|
+
checked?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
hidden?: boolean;
|
|
15
|
+
iconName?: string;
|
|
16
|
+
iconLabel?: string;
|
|
11
17
|
}, {
|
|
12
18
|
click: MouseEvent;
|
|
19
|
+
select: Event;
|
|
13
20
|
} & {
|
|
14
21
|
[evt: string]: CustomEvent<any>;
|
|
15
22
|
}, {
|
|
@@ -24,9 +31,16 @@ declare const __propDef: {
|
|
|
24
31
|
props: {
|
|
25
32
|
[x: string]: any;
|
|
26
33
|
class?: string;
|
|
34
|
+
label?: string | undefined;
|
|
35
|
+
checked?: boolean;
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
hidden?: boolean | undefined;
|
|
38
|
+
iconName?: string;
|
|
39
|
+
iconLabel?: string;
|
|
27
40
|
};
|
|
28
41
|
events: {
|
|
29
42
|
click: MouseEvent;
|
|
43
|
+
select: Event;
|
|
30
44
|
} & {
|
|
31
45
|
[evt: string]: CustomEvent<any>;
|
|
32
46
|
};
|
|
@@ -3,33 +3,50 @@
|
|
|
3
3
|
A menu item group.
|
|
4
4
|
-->
|
|
5
5
|
<script>
|
|
6
|
-
import { getRandomId } from '
|
|
6
|
+
import { getRandomId } from '../../services/util';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* The `class` attribute on the wrapper element.
|
|
10
10
|
* @type {string}
|
|
11
11
|
*/
|
|
12
12
|
let className = '';
|
|
13
|
-
|
|
14
13
|
export { className as class };
|
|
15
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Whether to hide the widget. An alias of the `aria-hidden` attribute.
|
|
16
|
+
* @type {boolean | undefined}
|
|
17
|
+
*/
|
|
18
|
+
export let hidden = undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Whether to disable the widget. An alias of the `aria-disabled` attribute.
|
|
21
|
+
* @type {boolean}
|
|
22
|
+
*/
|
|
23
|
+
export let disabled = false;
|
|
24
|
+
/**
|
|
25
|
+
* Text label displayed above the group items.
|
|
26
|
+
*/
|
|
16
27
|
export let title = '';
|
|
17
28
|
|
|
18
|
-
export let ariaLabel = '';
|
|
19
|
-
|
|
20
29
|
const id = getRandomId('group');
|
|
21
30
|
</script>
|
|
22
31
|
|
|
23
32
|
<div
|
|
33
|
+
{id}
|
|
24
34
|
class="sui menu-item-group {className}"
|
|
35
|
+
hidden={hidden || undefined}
|
|
25
36
|
role="group"
|
|
26
|
-
{
|
|
27
|
-
aria-
|
|
37
|
+
aria-hidden={hidden}
|
|
38
|
+
aria-disabled={disabled}
|
|
28
39
|
aria-labelledby={title ? '{id}-title' : undefined}
|
|
29
40
|
{...$$restProps}
|
|
30
41
|
>
|
|
31
42
|
{#if title}
|
|
32
43
|
<div class="title" id="{id}-title">{title}</div>
|
|
33
44
|
{/if}
|
|
34
|
-
<
|
|
45
|
+
<div class="inner" inert={disabled}>
|
|
46
|
+
<slot />
|
|
47
|
+
</div>
|
|
35
48
|
</div>
|
|
49
|
+
|
|
50
|
+
<style>.inner {
|
|
51
|
+
display: contents;
|
|
52
|
+
}</style>
|
|
@@ -6,7 +6,8 @@ export default class MenuItemGroup extends SvelteComponent<{
|
|
|
6
6
|
[x: string]: any;
|
|
7
7
|
class?: string;
|
|
8
8
|
title?: string;
|
|
9
|
-
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
hidden?: boolean;
|
|
10
11
|
}, {
|
|
11
12
|
[evt: string]: CustomEvent<any>;
|
|
12
13
|
}, {
|
|
@@ -22,7 +23,8 @@ declare const __propDef: {
|
|
|
22
23
|
[x: string]: any;
|
|
23
24
|
class?: string;
|
|
24
25
|
title?: string;
|
|
25
|
-
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
hidden?: boolean | undefined;
|
|
26
28
|
};
|
|
27
29
|
events: {
|
|
28
30
|
[evt: string]: CustomEvent<any>;
|
|
@@ -5,17 +5,61 @@
|
|
|
5
5
|
@see https://w3c.github.io/aria/#menuitemradio
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
|
+
import Icon from '../icon/icon.svelte';
|
|
8
9
|
import MenuItem from './menu-item.svelte';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
+
* The `class` attribute on the wrapper element.
|
|
12
13
|
* @type {string}
|
|
13
14
|
*/
|
|
14
15
|
let className = '';
|
|
15
|
-
|
|
16
16
|
export { className as class };
|
|
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 check the widget. An alias of the `aria-checked` attribute.
|
|
29
|
+
* @type {boolean}
|
|
30
|
+
*/
|
|
31
|
+
export let checked = false;
|
|
32
|
+
/**
|
|
33
|
+
* Text label displayed on the item.
|
|
34
|
+
* @type {string | undefined}
|
|
35
|
+
*/
|
|
36
|
+
export let label = '';
|
|
37
|
+
/**
|
|
38
|
+
* Name of `<Icon>` displayed before the label.
|
|
39
|
+
*/
|
|
40
|
+
export let iconName = '';
|
|
41
|
+
/**
|
|
42
|
+
* ARIA label of `<Icon>` displayed before the label.
|
|
43
|
+
*/
|
|
44
|
+
export let iconLabel = '';
|
|
17
45
|
</script>
|
|
18
46
|
|
|
19
|
-
<MenuItem
|
|
47
|
+
<MenuItem
|
|
48
|
+
class="sui menu-item-radio {className}"
|
|
49
|
+
role="menuitemradio"
|
|
50
|
+
{label}
|
|
51
|
+
{hidden}
|
|
52
|
+
{disabled}
|
|
53
|
+
aria-checked={checked}
|
|
54
|
+
{iconName}
|
|
55
|
+
{iconLabel}
|
|
56
|
+
{...$$restProps}
|
|
57
|
+
on:click
|
|
58
|
+
on:click={() => {
|
|
59
|
+
checked = !checked;
|
|
60
|
+
}}
|
|
61
|
+
on:select
|
|
62
|
+
>
|
|
20
63
|
<slot />
|
|
64
|
+
<svelte:component this={checked ? Icon : undefined} slot="end-icon" name="check" />
|
|
21
65
|
</MenuItem>
|
|
@@ -9,8 +9,15 @@
|
|
|
9
9
|
export default class MenuItemRadio extends SvelteComponent<{
|
|
10
10
|
[x: string]: any;
|
|
11
11
|
class?: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
checked?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
hidden?: boolean;
|
|
16
|
+
iconName?: string;
|
|
17
|
+
iconLabel?: string;
|
|
12
18
|
}, {
|
|
13
19
|
click: MouseEvent;
|
|
20
|
+
select: Event;
|
|
14
21
|
} & {
|
|
15
22
|
[evt: string]: CustomEvent<any>;
|
|
16
23
|
}, {
|
|
@@ -25,9 +32,16 @@ declare const __propDef: {
|
|
|
25
32
|
props: {
|
|
26
33
|
[x: string]: any;
|
|
27
34
|
class?: string;
|
|
35
|
+
label?: string | undefined;
|
|
36
|
+
checked?: boolean;
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
hidden?: boolean | undefined;
|
|
39
|
+
iconName?: string;
|
|
40
|
+
iconLabel?: string;
|
|
28
41
|
};
|
|
29
42
|
events: {
|
|
30
43
|
click: MouseEvent;
|
|
44
|
+
select: Event;
|
|
31
45
|
} & {
|
|
32
46
|
[evt: string]: CustomEvent<any>;
|
|
33
47
|
};
|
|
@@ -10,21 +10,41 @@
|
|
|
10
10
|
import Popup from '../util/popup.svelte';
|
|
11
11
|
import Menu from './menu.svelte';
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* The `class` attribute on the wrapper element.
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
13
17
|
let className = '';
|
|
14
|
-
|
|
15
18
|
export { className as class };
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
/**
|
|
20
|
+
* The `role` attribute on the `<button>` element.
|
|
21
|
+
* @type {'menuitem' | 'menuitemcheckbox' | 'menuitemradio'}
|
|
22
|
+
*/
|
|
18
23
|
export let role = 'menuitem';
|
|
19
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Whether to hide the widget. An alias of the `aria-hidden` attribute.
|
|
26
|
+
* @type {boolean | undefined}
|
|
27
|
+
*/
|
|
28
|
+
export let hidden = undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Whether to disable the widget. An alias of the `aria-disabled` attribute.
|
|
31
|
+
* @type {boolean}
|
|
32
|
+
*/
|
|
33
|
+
export let disabled = false;
|
|
34
|
+
/**
|
|
35
|
+
* Text label displayed on the item.
|
|
36
|
+
* @type {string | undefined}
|
|
37
|
+
*/
|
|
20
38
|
export let label = '';
|
|
21
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Name of `<Icon>` displayed before the label.
|
|
41
|
+
*/
|
|
22
42
|
export let iconName = '';
|
|
23
|
-
|
|
43
|
+
/**
|
|
44
|
+
* ARIA label of `<Icon>` displayed before the label.
|
|
45
|
+
*/
|
|
24
46
|
export let iconLabel = '';
|
|
25
47
|
|
|
26
|
-
export let checked = false;
|
|
27
|
-
|
|
28
48
|
/** @type {Button} */
|
|
29
49
|
let buttonComponent;
|
|
30
50
|
let isPopupOpen = writable(false);
|
|
@@ -32,21 +52,27 @@
|
|
|
32
52
|
$: hasChildren = role === 'menuitem' && $$slots.default;
|
|
33
53
|
</script>
|
|
34
54
|
|
|
35
|
-
<div class="sui menuitem {className}">
|
|
55
|
+
<div class="sui menuitem {className}" hidden={hidden || undefined}>
|
|
36
56
|
<Button
|
|
37
57
|
{role}
|
|
38
|
-
|
|
58
|
+
{hidden}
|
|
59
|
+
{disabled}
|
|
39
60
|
aria-haspopup={hasChildren ? 'menu' : undefined}
|
|
40
|
-
aria-expanded={hasChildren
|
|
61
|
+
aria-expanded={hasChildren ? $isPopupOpen : undefined}
|
|
41
62
|
{...$$restProps}
|
|
42
63
|
bind:this={buttonComponent}
|
|
43
64
|
on:click
|
|
44
65
|
on:mouseenter={() => {
|
|
45
|
-
|
|
66
|
+
if (hasChildren) {
|
|
67
|
+
$isPopupOpen = true;
|
|
68
|
+
}
|
|
46
69
|
}}
|
|
47
70
|
on:mouseleave={() => {
|
|
48
|
-
|
|
71
|
+
if (hasChildren) {
|
|
72
|
+
$isPopupOpen = false;
|
|
73
|
+
}
|
|
49
74
|
}}
|
|
75
|
+
on:select
|
|
50
76
|
>
|
|
51
77
|
{#if iconName}
|
|
52
78
|
<Icon slot="start-icon" name={iconName} label={iconLabel} />
|
|
@@ -54,11 +80,9 @@
|
|
|
54
80
|
{#if label}
|
|
55
81
|
<span class="label">{label}</span>
|
|
56
82
|
{/if}
|
|
57
|
-
{#if
|
|
83
|
+
{#if $$slots['end-icon']}
|
|
58
84
|
<span class="icon-outer">
|
|
59
|
-
|
|
60
|
-
<Icon name="check" />
|
|
61
|
-
{/if}
|
|
85
|
+
<slot name="end-icon" />
|
|
62
86
|
</span>
|
|
63
87
|
{/if}
|
|
64
88
|
{#if hasChildren}
|
|
@@ -82,18 +106,21 @@
|
|
|
82
106
|
.menuitem :global(button) {
|
|
83
107
|
display: flex;
|
|
84
108
|
justify-content: space-between !important;
|
|
85
|
-
border-radius:
|
|
109
|
+
border-radius: var(--sui-option-border-radius);
|
|
86
110
|
padding: 0 16px;
|
|
87
111
|
width: 100%;
|
|
88
112
|
min-width: 160px;
|
|
89
|
-
height: var(--sui-option-
|
|
113
|
+
height: var(--sui-option-height);
|
|
90
114
|
}
|
|
91
115
|
.menuitem :global(button[aria-checked="true"]) :global(.icon) {
|
|
92
|
-
color: var(--sui-primary-accent-color-
|
|
116
|
+
color: var(--sui-primary-accent-color-text);
|
|
93
117
|
}
|
|
94
118
|
.menuitem :global(button:hover) {
|
|
95
119
|
color: var(--sui-highlight-foreground-color);
|
|
96
|
-
background-color: var(--sui-
|
|
120
|
+
background-color: var(--sui-hover-background-color);
|
|
121
|
+
}
|
|
122
|
+
.menuitem :global(button:active) {
|
|
123
|
+
background-color: var(--sui-active-background-color);
|
|
97
124
|
}
|
|
98
125
|
.menuitem:hover > :global([role="menu"]) {
|
|
99
126
|
opacity: 1;
|
|
@@ -9,15 +9,18 @@ export default class MenuItem extends SvelteComponent<{
|
|
|
9
9
|
[x: string]: any;
|
|
10
10
|
class?: string;
|
|
11
11
|
label?: string;
|
|
12
|
-
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
hidden?: boolean;
|
|
13
14
|
role?: "menuitem" | "menuitemcheckbox" | "menuitemradio";
|
|
14
15
|
iconName?: string;
|
|
15
16
|
iconLabel?: string;
|
|
16
17
|
}, {
|
|
17
18
|
click: MouseEvent;
|
|
19
|
+
select: Event;
|
|
18
20
|
} & {
|
|
19
21
|
[evt: string]: CustomEvent<any>;
|
|
20
22
|
}, {
|
|
23
|
+
'end-icon': {};
|
|
21
24
|
default: {};
|
|
22
25
|
}> {
|
|
23
26
|
}
|
|
@@ -29,18 +32,21 @@ declare const __propDef: {
|
|
|
29
32
|
props: {
|
|
30
33
|
[x: string]: any;
|
|
31
34
|
class?: string;
|
|
32
|
-
label?: string;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
label?: string | undefined;
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
hidden?: boolean | undefined;
|
|
38
|
+
role?: 'menuitem' | 'menuitemcheckbox' | 'menuitemradio';
|
|
35
39
|
iconName?: string;
|
|
36
40
|
iconLabel?: string;
|
|
37
41
|
};
|
|
38
42
|
events: {
|
|
39
43
|
click: MouseEvent;
|
|
44
|
+
select: Event;
|
|
40
45
|
} & {
|
|
41
46
|
[evt: string]: CustomEvent<any>;
|
|
42
47
|
};
|
|
43
48
|
slots: {
|
|
49
|
+
'end-icon': {};
|
|
44
50
|
default: {};
|
|
45
51
|
};
|
|
46
52
|
};
|
|
@@ -4,29 +4,36 @@
|
|
|
4
4
|
@see https://w3c.github.io/aria/#menu
|
|
5
5
|
@see https://www.w3.org/WAI/ARIA/apg/patterns/menubar/
|
|
6
6
|
-->
|
|
7
|
-
<svelte:options accessors={true} />
|
|
8
|
-
|
|
9
7
|
<script>
|
|
10
|
-
import { activateGroup } from '
|
|
8
|
+
import { activateGroup } from '../../services/group';
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
|
-
*
|
|
11
|
+
* The `class` attribute on the wrapper element.
|
|
14
12
|
* @type {string}
|
|
15
13
|
*/
|
|
16
14
|
let className = '';
|
|
17
|
-
|
|
18
15
|
export { className as class };
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Whether to hide the widget. An alias of the `aria-hidden` attribute.
|
|
18
|
+
* @type {boolean | undefined}
|
|
19
|
+
*/
|
|
20
|
+
export let hidden = undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Whether to disable the widget. An alias of the `aria-disabled` attribute.
|
|
23
|
+
* @type {boolean}
|
|
24
|
+
*/
|
|
25
|
+
export let disabled = false;
|
|
22
26
|
</script>
|
|
23
27
|
|
|
24
28
|
<div
|
|
25
29
|
class="sui menu {className}"
|
|
26
30
|
role="menu"
|
|
31
|
+
hidden={hidden || undefined}
|
|
32
|
+
aria-hidden={hidden}
|
|
33
|
+
aria-disabled={disabled}
|
|
27
34
|
{...$$restProps}
|
|
28
|
-
bind:this={element}
|
|
29
35
|
use:activateGroup
|
|
36
|
+
on:change
|
|
30
37
|
>
|
|
31
38
|
<slot />
|
|
32
39
|
</div>
|
|
@@ -42,4 +49,5 @@
|
|
|
42
49
|
}
|
|
43
50
|
.menu :global([role="separator"]) {
|
|
44
51
|
margin: 4px;
|
|
52
|
+
background-color: var(--sui-control-border-color);
|
|
45
53
|
}</style>
|
|
@@ -9,18 +9,15 @@
|
|
|
9
9
|
export default class Menu extends SvelteComponent<{
|
|
10
10
|
[x: string]: any;
|
|
11
11
|
class?: string;
|
|
12
|
-
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
hidden?: boolean;
|
|
13
14
|
}, {
|
|
15
|
+
change: Event;
|
|
16
|
+
} & {
|
|
14
17
|
[evt: string]: CustomEvent<any>;
|
|
15
18
|
}, {
|
|
16
19
|
default: {};
|
|
17
20
|
}> {
|
|
18
|
-
/**accessor*/
|
|
19
|
-
set class(arg: string);
|
|
20
|
-
get class(): string;
|
|
21
|
-
/**accessor*/
|
|
22
|
-
set element(arg: HTMLElement);
|
|
23
|
-
get element(): HTMLElement;
|
|
24
21
|
}
|
|
25
22
|
export type MenuProps = typeof __propDef.props;
|
|
26
23
|
export type MenuEvents = typeof __propDef.events;
|
|
@@ -30,9 +27,12 @@ declare const __propDef: {
|
|
|
30
27
|
props: {
|
|
31
28
|
[x: string]: any;
|
|
32
29
|
class?: string;
|
|
33
|
-
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
hidden?: boolean | undefined;
|
|
34
32
|
};
|
|
35
33
|
events: {
|
|
34
|
+
change: Event;
|
|
35
|
+
} & {
|
|
36
36
|
[evt: string]: CustomEvent<any>;
|
|
37
37
|
};
|
|
38
38
|
slots: {
|
|
@@ -5,34 +5,64 @@
|
|
|
5
5
|
@see https://www.w3.org/WAI/ARIA/apg/patterns/radio/
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
|
-
import { activateGroup } from '
|
|
8
|
+
import { activateGroup } from '../../services/group';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* The `class` attribute on the wrapper element.
|
|
12
12
|
* @type {string}
|
|
13
13
|
*/
|
|
14
14
|
let className = '';
|
|
15
|
-
|
|
16
15
|
export { className as class };
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Whether to hide the widget. An alias of the `aria-hidden` attribute.
|
|
18
|
+
* @type {boolean | undefined}
|
|
19
|
+
*/
|
|
20
|
+
export let hidden = undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Whether to disable the widget. An alias of the `aria-disabled` attribute.
|
|
23
|
+
* @type {boolean}
|
|
24
|
+
*/
|
|
25
|
+
export let disabled = false;
|
|
26
|
+
/**
|
|
27
|
+
* Whether to disable the widget. An alias of the `aria-readonly` attribute.
|
|
28
|
+
* @type {boolean}
|
|
29
|
+
*/
|
|
30
|
+
export let readonly = false;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to disable the widget. An alias of the `aria-required` attribute.
|
|
33
|
+
* @type {boolean}
|
|
34
|
+
*/
|
|
35
|
+
export let required = false;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to disable the widget. An alias of the `aria-invalid` attribute.
|
|
38
|
+
* @type {boolean}
|
|
39
|
+
*/
|
|
40
|
+
export let invalid = false;
|
|
41
|
+
/**
|
|
42
|
+
* Orientation of the widget. An alias of the `aria-orientation` attribute.
|
|
43
|
+
* @type {'horizontal' | 'vertical'}
|
|
44
|
+
*/
|
|
19
45
|
export let orientation = 'horizontal';
|
|
20
|
-
|
|
21
|
-
/** @type {HTMLElement?} */
|
|
22
|
-
export let element = undefined;
|
|
23
46
|
</script>
|
|
24
47
|
|
|
25
48
|
<div
|
|
26
49
|
class="sui radio-group {className} {orientation}"
|
|
27
50
|
tabindex="-1"
|
|
28
51
|
role="radiogroup"
|
|
52
|
+
hidden={hidden || undefined}
|
|
53
|
+
aria-hidden={hidden}
|
|
54
|
+
aria-disabled={disabled}
|
|
55
|
+
aria-readonly={readonly}
|
|
56
|
+
aria-required={required}
|
|
57
|
+
aria-invalid={invalid}
|
|
29
58
|
aria-orientation={orientation}
|
|
30
59
|
{...$$restProps}
|
|
31
|
-
bind:this={element}
|
|
32
|
-
on:select
|
|
33
60
|
use:activateGroup
|
|
61
|
+
on:change
|
|
34
62
|
>
|
|
35
|
-
<
|
|
63
|
+
<div class="inner" inert={disabled}>
|
|
64
|
+
<slot />
|
|
65
|
+
</div>
|
|
36
66
|
</div>
|
|
37
67
|
|
|
38
68
|
<style>.radio-group {
|
|
@@ -48,4 +78,13 @@
|
|
|
48
78
|
.radio-group.vertical {
|
|
49
79
|
gap: 8px;
|
|
50
80
|
flex-direction: column;
|
|
81
|
+
}
|
|
82
|
+
@media (pointer: coarse) {
|
|
83
|
+
.radio-group.vertical {
|
|
84
|
+
gap: 16px;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.inner {
|
|
89
|
+
display: contents;
|
|
51
90
|
}</style>
|
|
@@ -9,10 +9,14 @@
|
|
|
9
9
|
export default class RadioGroup extends SvelteComponent<{
|
|
10
10
|
[x: string]: any;
|
|
11
11
|
class?: string;
|
|
12
|
-
|
|
12
|
+
invalid?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
hidden?: boolean;
|
|
13
16
|
orientation?: "vertical" | "horizontal";
|
|
17
|
+
readonly?: boolean;
|
|
14
18
|
}, {
|
|
15
|
-
|
|
19
|
+
change: Event;
|
|
16
20
|
} & {
|
|
17
21
|
[evt: string]: CustomEvent<any>;
|
|
18
22
|
}, {
|
|
@@ -27,11 +31,15 @@ declare const __propDef: {
|
|
|
27
31
|
props: {
|
|
28
32
|
[x: string]: any;
|
|
29
33
|
class?: string;
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
invalid?: boolean;
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
required?: boolean;
|
|
37
|
+
hidden?: boolean | undefined;
|
|
38
|
+
orientation?: 'horizontal' | 'vertical';
|
|
39
|
+
readonly?: boolean;
|
|
32
40
|
};
|
|
33
41
|
events: {
|
|
34
|
-
|
|
42
|
+
change: Event;
|
|
35
43
|
} & {
|
|
36
44
|
[evt: string]: CustomEvent<any>;
|
|
37
45
|
};
|