@sveltia/ui 0.15.16 → 0.17.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 +22 -7
- package/package/components/alert/alert.svelte.d.ts +47 -31
- package/package/components/button/button-group.svelte +16 -6
- package/package/components/button/button-group.svelte.d.ts +38 -28
- package/package/components/button/button.svelte +41 -136
- package/package/components/button/button.svelte.d.ts +20 -162
- package/package/components/button/select-button-group.svelte +31 -37
- package/package/components/button/select-button-group.svelte.d.ts +91 -39
- package/package/components/button/select-button.svelte +19 -62
- package/package/components/button/select-button.svelte.d.ts +31 -65
- package/package/components/button/split-button.svelte +37 -47
- package/package/components/button/split-button.svelte.d.ts +54 -60
- package/package/components/calendar/calendar.svelte +80 -55
- package/package/components/calendar/calendar.svelte.d.ts +30 -26
- package/package/components/checkbox/checkbox-group.svelte +23 -20
- package/package/components/checkbox/checkbox-group.svelte.d.ts +64 -32
- package/package/components/checkbox/checkbox.svelte +57 -67
- package/package/components/checkbox/checkbox.svelte.d.ts +81 -53
- package/package/components/dialog/alert-dialog.svelte +9 -36
- package/package/components/dialog/alert-dialog.svelte.d.ts +20 -49
- package/package/components/dialog/confirmation-dialog.svelte +9 -41
- package/package/components/dialog/confirmation-dialog.svelte.d.ts +20 -51
- package/package/components/dialog/dialog.svelte +60 -105
- package/package/components/dialog/dialog.svelte.d.ts +19 -86
- package/package/components/dialog/prompt-dialog.svelte +32 -61
- package/package/components/dialog/prompt-dialog.svelte.d.ts +53 -65
- package/package/components/disclosure/disclosure.svelte +39 -34
- package/package/components/disclosure/disclosure.svelte.d.ts +88 -57
- package/package/components/divider/divider.svelte +18 -14
- package/package/components/divider/divider.svelte.d.ts +48 -26
- package/package/components/divider/spacer.svelte +13 -8
- package/package/components/divider/spacer.svelte.d.ts +37 -25
- package/package/components/drawer/drawer.svelte +63 -76
- package/package/components/drawer/drawer.svelte.d.ts +116 -70
- package/package/components/grid/grid-body.svelte +15 -10
- package/package/components/grid/grid-body.svelte.d.ts +45 -29
- package/package/components/grid/grid-cell.svelte +16 -6
- package/package/components/grid/grid-cell.svelte.d.ts +38 -28
- package/package/components/grid/grid-col-header.svelte +16 -6
- package/package/components/grid/grid-col-header.svelte.d.ts +38 -28
- package/package/components/grid/grid-foot.svelte +16 -6
- package/package/components/grid/grid-foot.svelte.d.ts +38 -28
- package/package/components/grid/grid-head.svelte +16 -6
- package/package/components/grid/grid-head.svelte.d.ts +38 -28
- package/package/components/grid/grid-row-header.svelte +16 -6
- package/package/components/grid/grid-row-header.svelte.d.ts +38 -28
- package/package/components/grid/grid-row.svelte +19 -23
- package/package/components/grid/grid-row.svelte.d.ts +63 -43
- package/package/components/grid/grid.svelte +26 -25
- package/package/components/grid/grid.svelte.d.ts +71 -37
- package/package/components/icon/icon.svelte +14 -9
- package/package/components/icon/icon.svelte.d.ts +37 -25
- package/package/components/listbox/listbox.svelte +46 -52
- package/package/components/listbox/listbox.svelte.d.ts +117 -45
- package/package/components/listbox/option-group.svelte +23 -19
- package/package/components/listbox/option-group.svelte.d.ts +64 -32
- package/package/components/listbox/option.svelte +44 -57
- package/package/components/listbox/option.svelte.d.ts +68 -74
- package/package/components/menu/menu-button.svelte +42 -63
- package/package/components/menu/menu-button.svelte.d.ts +35 -62
- package/package/components/menu/menu-item-checkbox.svelte +29 -41
- package/package/components/menu/menu-item-checkbox.svelte.d.ts +20 -49
- package/package/components/menu/menu-item-group.svelte +22 -19
- package/package/components/menu/menu-item-group.svelte.d.ts +56 -32
- package/package/components/menu/menu-item-radio.svelte +29 -41
- package/package/components/menu/menu-item-radio.svelte.d.ts +20 -49
- package/package/components/menu/menu-item.svelte +66 -75
- package/package/components/menu/menu-item.svelte.d.ts +19 -68
- package/package/components/menu/menu.svelte +25 -22
- package/package/components/menu/menu.svelte.d.ts +65 -35
- package/package/components/radio/radio-group.svelte +36 -42
- package/package/components/radio/radio-group.svelte.d.ts +100 -40
- package/package/components/radio/radio.svelte +45 -48
- package/package/components/radio/radio.svelte.d.ts +111 -47
- package/package/components/select/combobox.svelte +76 -101
- package/package/components/select/combobox.svelte.d.ts +19 -54
- package/package/components/select/select-tags.svelte +48 -59
- package/package/components/select/select-tags.svelte.d.ts +127 -45
- package/package/components/select/select.svelte +18 -37
- package/package/components/select/select.svelte.d.ts +20 -45
- package/package/components/slider/slider.svelte +71 -68
- package/package/components/slider/slider.svelte.d.ts +159 -47
- package/package/components/switch/switch.svelte +36 -46
- package/package/components/switch/switch.svelte.d.ts +98 -42
- package/package/components/table/table-body.svelte +15 -11
- package/package/components/table/table-body.svelte.d.ts +45 -29
- package/package/components/table/table-cell.svelte +16 -6
- package/package/components/table/table-cell.svelte.d.ts +38 -28
- package/package/components/table/table-col-header.svelte +16 -6
- package/package/components/table/table-col-header.svelte.d.ts +38 -28
- package/package/components/table/table-foot.svelte +16 -6
- package/package/components/table/table-foot.svelte.d.ts +38 -28
- package/package/components/table/table-head.svelte +16 -6
- package/package/components/table/table-head.svelte.d.ts +38 -28
- package/package/components/table/table-row-header.svelte +16 -6
- package/package/components/table/table-row-header.svelte.d.ts +38 -28
- package/package/components/table/table-row.svelte +16 -6
- package/package/components/table/table-row.svelte.d.ts +38 -28
- package/package/components/table/table.svelte +16 -6
- package/package/components/table/table.svelte.d.ts +38 -28
- package/package/components/tabs/tab-box.svelte +16 -9
- package/package/components/tabs/tab-box.svelte.d.ts +47 -27
- package/package/components/tabs/tab-list.svelte +36 -35
- package/package/components/tabs/tab-list.svelte.d.ts +80 -38
- package/package/components/tabs/tab-panel.svelte +16 -6
- package/package/components/tabs/tab-panel.svelte.d.ts +38 -28
- package/package/components/tabs/tab-panels.svelte +16 -6
- package/package/components/tabs/tab-panels.svelte.d.ts +38 -26
- package/package/components/tabs/tab.svelte +28 -25
- package/package/components/tabs/tab.svelte.d.ts +31 -55
- package/package/components/text-editor/lexical-root.svelte +38 -32
- package/package/components/text-editor/lexical-root.svelte.d.ts +91 -29
- package/package/components/text-editor/text-editor.svelte +63 -79
- package/package/components/text-editor/text-editor.svelte.d.ts +114 -36
- package/package/components/text-editor/toolbar/editor-toolbar.svelte +41 -24
- package/package/components/text-editor/toolbar/editor-toolbar.svelte.d.ts +49 -23
- package/package/components/text-editor/toolbar/format-text-button.svelte +15 -5
- package/package/components/text-editor/toolbar/format-text-button.svelte.d.ts +30 -22
- package/package/components/text-editor/toolbar/insert-link-button.svelte +18 -16
- package/package/components/text-editor/toolbar/insert-link-button.svelte.d.ts +20 -23
- package/package/components/text-editor/toolbar/toggle-block-menu-item.svelte +19 -7
- package/package/components/text-editor/toolbar/toggle-block-menu-item.svelte.d.ts +30 -22
- package/package/components/text-field/number-input.svelte +63 -81
- package/package/components/text-field/number-input.svelte.d.ts +62 -68
- package/package/components/text-field/password-input.svelte +38 -57
- package/package/components/text-field/password-input.svelte.d.ts +30 -58
- package/package/components/text-field/search-bar.svelte +45 -62
- package/package/components/text-field/search-bar.svelte.d.ts +42 -87
- package/package/components/text-field/text-area.svelte +38 -54
- package/package/components/text-field/text-area.svelte.d.ts +116 -50
- package/package/components/text-field/text-input.svelte +30 -86
- package/package/components/text-field/text-input.svelte.d.ts +20 -105
- package/package/components/toast/toast.svelte +36 -30
- package/package/components/toast/toast.svelte.d.ts +65 -33
- package/package/components/toolbar/toolbar.svelte +25 -25
- package/package/components/toolbar/toolbar.svelte.d.ts +72 -34
- package/package/components/util/app-shell.svelte +22 -10
- package/package/components/util/app-shell.svelte.d.ts +40 -34
- package/package/components/util/group.svelte +20 -15
- package/package/components/util/group.svelte.d.ts +55 -31
- package/package/components/util/modal.svelte +89 -105
- package/package/components/util/modal.svelte.d.ts +24 -82
- package/package/components/util/placeholder.svelte +21 -0
- package/package/components/util/placeholder.svelte.d.ts +34 -0
- package/package/components/util/popup.svelte +65 -62
- package/package/components/util/popup.svelte.d.ts +104 -82
- package/package/services/{group.js → group.svelte.js} +11 -12
- package/package/services/{popup.js → popup.svelte.js} +6 -5
- package/package/typedefs.d.ts +545 -0
- package/package/typedefs.js +202 -0
- package/package.json +16 -23
- package/package/components/util/portal.svelte +0 -36
- package/package/components/util/portal.svelte.d.ts +0 -32
- /package/package/services/{events.d.ts → events.svelte.d.ts} +0 -0
- /package/package/services/{events.js → events.svelte.js} +0 -0
- /package/package/services/{group.d.ts → group.svelte.d.ts} +0 -0
- /package/package/services/{popup.d.ts → popup.svelte.d.ts} +0 -0
|
@@ -8,77 +8,53 @@
|
|
|
8
8
|
import Popup from '../util/popup.svelte';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
* @
|
|
11
|
+
* @typedef {object} Props
|
|
12
|
+
* @property {HTMLElement | undefined} [popupPositionBaseElement] - The base element of
|
|
13
|
+
* {@link popupPosition}. If omitted, this will be {@link buttonComponent}.
|
|
13
14
|
*/
|
|
14
|
-
let className = '';
|
|
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
|
-
* Where to show the dropdown menu.
|
|
28
|
-
* @type {import('../../typedefs').PopupPosition}
|
|
29
|
-
*/
|
|
30
|
-
export let popupPosition = 'bottom-left';
|
|
31
|
-
/**
|
|
32
|
-
* The base element of {@link popupPosition}. If omitted, this will be {@link buttonComponent}.
|
|
33
|
-
* @type {HTMLElement | undefined}
|
|
34
|
-
*/
|
|
35
|
-
export let popupPositionBaseElement = undefined;
|
|
36
|
-
/**
|
|
37
|
-
* Whether to show the backdrop for the popup.
|
|
38
|
-
* @type {boolean}
|
|
39
|
-
*/
|
|
40
|
-
export let showPopupBackdrop = false;
|
|
41
|
-
/**
|
|
42
|
-
* Text label displayed on the button.
|
|
43
|
-
* @type {string}
|
|
44
|
-
*/
|
|
45
|
-
export let label = '';
|
|
46
|
-
/**
|
|
47
|
-
* The style variant of the button.
|
|
48
|
-
* @type {'primary' | 'secondary' | 'tertiary' | 'ghost' | 'link' | undefined}
|
|
49
|
-
*/
|
|
50
|
-
export let variant = undefined;
|
|
51
|
-
/**
|
|
52
|
-
* The size of the button.
|
|
53
|
-
* @type {'small' | 'medium' | 'large'}
|
|
54
|
-
*/
|
|
55
|
-
export let size = 'medium';
|
|
56
|
-
/**
|
|
57
|
-
* Whether to only show an icon on the button and trim the padding.
|
|
58
|
-
*/
|
|
59
|
-
export let iconic = false;
|
|
60
15
|
|
|
61
16
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
17
|
+
* @type {import('../../typedefs').ButtonProps & import('../../typedefs').CommonEventHandlers &
|
|
18
|
+
* Props & Record<string, any>}
|
|
64
19
|
*/
|
|
65
|
-
let
|
|
20
|
+
let {
|
|
21
|
+
/* eslint-disable prefer-const */
|
|
22
|
+
class: className,
|
|
23
|
+
hidden = false,
|
|
24
|
+
disabled = false,
|
|
25
|
+
popupPosition = 'bottom-left',
|
|
26
|
+
popupPositionBaseElement = undefined,
|
|
27
|
+
showPopupBackdrop = false,
|
|
28
|
+
label = '',
|
|
29
|
+
variant = undefined,
|
|
30
|
+
size = 'medium',
|
|
31
|
+
iconic = false,
|
|
32
|
+
children: _children,
|
|
33
|
+
startIcon: _startIcon,
|
|
34
|
+
endIcon: _endIcon,
|
|
35
|
+
popup,
|
|
36
|
+
...restProps
|
|
37
|
+
/* eslint-enable prefer-const */
|
|
38
|
+
} = $props();
|
|
39
|
+
|
|
66
40
|
/**
|
|
67
|
-
* Reference to the
|
|
68
|
-
* @type {
|
|
41
|
+
* Reference to the `<button>` element.
|
|
42
|
+
* @type {HTMLButtonElement | undefined}
|
|
69
43
|
*/
|
|
70
|
-
let
|
|
44
|
+
let buttonElement = $state();
|
|
71
45
|
|
|
72
46
|
/**
|
|
73
47
|
* Move focus to the `<button>` element.
|
|
74
48
|
*/
|
|
75
49
|
export const focus = () => {
|
|
76
|
-
|
|
50
|
+
buttonElement?.focus();
|
|
77
51
|
};
|
|
78
52
|
</script>
|
|
79
53
|
|
|
80
54
|
<div role="none" class="wrapper">
|
|
81
55
|
<Button
|
|
56
|
+
{...restProps}
|
|
57
|
+
bind:element={buttonElement}
|
|
82
58
|
class="sui menu-button {className}"
|
|
83
59
|
{hidden}
|
|
84
60
|
{disabled}
|
|
@@ -87,21 +63,24 @@
|
|
|
87
63
|
{size}
|
|
88
64
|
{iconic}
|
|
89
65
|
aria-haspopup="menu"
|
|
90
|
-
{...$$restProps}
|
|
91
|
-
bind:this={buttonComponent}
|
|
92
66
|
>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
67
|
+
{#snippet startIcon()}
|
|
68
|
+
{@render _startIcon?.()}
|
|
69
|
+
{/snippet}
|
|
70
|
+
{#snippet children()}
|
|
71
|
+
{@render _children?.()}
|
|
72
|
+
{/snippet}
|
|
73
|
+
{#snippet endIcon()}
|
|
74
|
+
{@render _endIcon?.()}
|
|
75
|
+
{/snippet}
|
|
96
76
|
</Button>
|
|
97
77
|
</div>
|
|
98
78
|
|
|
99
79
|
<Popup
|
|
100
|
-
anchor={
|
|
80
|
+
anchor={buttonElement}
|
|
101
81
|
position={popupPosition}
|
|
102
82
|
positionBaseElement={popupPositionBaseElement}
|
|
103
83
|
showBackdrop={showPopupBackdrop}
|
|
104
|
-
bind:this={popupComponent}
|
|
105
84
|
>
|
|
106
|
-
|
|
85
|
+
{@render popup?.()}
|
|
107
86
|
</Popup>
|
|
@@ -1,70 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export default MenuButton;
|
|
2
|
+
type MenuButton = SvelteComponent<ButtonProps & KeyboardEventHandlers & MouseEventHandlers & FocusEventHandlers & DragEventHandlers & Props & Record<string, any>, {
|
|
3
|
+
[evt: string]: CustomEvent<any>;
|
|
4
|
+
}, {}> & {
|
|
5
|
+
$$bindings?: "" | undefined;
|
|
6
|
+
} & {
|
|
7
|
+
focus: () => void;
|
|
8
|
+
};
|
|
4
9
|
/**
|
|
5
10
|
* A button to open a `<Menu>` widget.
|
|
6
11
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/
|
|
7
12
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
label?: string | undefined;
|
|
14
|
-
size?: "small" | "medium" | "large" | undefined;
|
|
15
|
-
hidden?: boolean | undefined;
|
|
16
|
-
variant?: "primary" | "secondary" | "tertiary" | "ghost" | "link" | undefined;
|
|
17
|
-
iconic?: boolean | undefined;
|
|
18
|
-
popupPosition?: import("../../typedefs").PopupPosition | undefined;
|
|
19
|
-
showPopupBackdrop?: boolean | undefined;
|
|
13
|
+
declare const MenuButton: $$__sveltets_2_IsomorphicComponent<import("../../typedefs").ButtonProps & import("../../typedefs").KeyboardEventHandlers & import("../../typedefs").MouseEventHandlers & import("../../typedefs").FocusEventHandlers & import("../../typedefs").DragEventHandlers & {
|
|
14
|
+
/**
|
|
15
|
+
* - The base element of
|
|
16
|
+
* {@link popupPosition}. If omitted, this will be {@link buttonComponent}.
|
|
17
|
+
*/
|
|
20
18
|
popupPositionBaseElement?: HTMLElement | undefined;
|
|
21
|
-
}, {
|
|
19
|
+
} & Record<string, any>, {
|
|
22
20
|
[evt: string]: CustomEvent<any>;
|
|
23
|
-
}, {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
}, {}, {
|
|
22
|
+
focus: () => void;
|
|
23
|
+
}, "">;
|
|
24
|
+
type Props = {
|
|
25
|
+
/**
|
|
26
|
+
* - The base element of
|
|
27
|
+
* {@link popupPosition}. If omitted, this will be {@link buttonComponent}.
|
|
28
|
+
*/
|
|
29
|
+
popupPositionBaseElement?: HTMLElement | undefined;
|
|
30
|
+
};
|
|
31
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
32
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
33
|
+
$$bindings?: Bindings;
|
|
34
|
+
} & Exports;
|
|
35
|
+
(internal: unknown, props: Props & {
|
|
36
|
+
$$events?: Events;
|
|
37
|
+
$$slots?: Slots;
|
|
38
|
+
}): Exports & {
|
|
39
|
+
$set?: any;
|
|
40
|
+
$on?: any;
|
|
30
41
|
};
|
|
31
|
-
|
|
32
|
-
}> {
|
|
33
|
-
get focus(): () => void;
|
|
42
|
+
z_$$bindings?: Bindings;
|
|
34
43
|
}
|
|
35
|
-
export type MenuButtonProps = typeof __propDef.props;
|
|
36
|
-
export type MenuButtonEvents = typeof __propDef.events;
|
|
37
|
-
export type MenuButtonSlots = typeof __propDef.slots;
|
|
38
|
-
import { SvelteComponent } from "svelte";
|
|
39
|
-
declare const __propDef: {
|
|
40
|
-
props: {
|
|
41
|
-
[x: string]: any;
|
|
42
|
-
class?: string | undefined;
|
|
43
|
-
disabled?: boolean | undefined;
|
|
44
|
-
focus?: (() => void) | undefined;
|
|
45
|
-
label?: string | undefined;
|
|
46
|
-
size?: "small" | "medium" | "large" | undefined;
|
|
47
|
-
hidden?: boolean | undefined;
|
|
48
|
-
variant?: "primary" | "secondary" | "tertiary" | "ghost" | "link" | undefined;
|
|
49
|
-
iconic?: boolean | undefined;
|
|
50
|
-
popupPosition?: import("../../typedefs").PopupPosition | undefined;
|
|
51
|
-
showPopupBackdrop?: boolean | undefined;
|
|
52
|
-
popupPositionBaseElement?: HTMLElement | undefined;
|
|
53
|
-
};
|
|
54
|
-
events: {
|
|
55
|
-
[evt: string]: CustomEvent<any>;
|
|
56
|
-
};
|
|
57
|
-
slots: {
|
|
58
|
-
'start-icon': {
|
|
59
|
-
slot: string;
|
|
60
|
-
};
|
|
61
|
-
default: {};
|
|
62
|
-
'end-icon': {
|
|
63
|
-
slot: string;
|
|
64
|
-
};
|
|
65
|
-
popup: {};
|
|
66
|
-
};
|
|
67
|
-
exports?: undefined;
|
|
68
|
-
bindings?: undefined;
|
|
69
|
-
};
|
|
70
|
-
export {};
|
|
@@ -8,58 +8,46 @@
|
|
|
8
8
|
import MenuItem from './menu-item.svelte';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* @type {import('../../typedefs').ButtonProps & import('../../typedefs').MenuItemProps &
|
|
12
|
+
* import('../../typedefs').CommonEventHandlers & Record<string, any>}
|
|
13
13
|
*/
|
|
14
|
-
let
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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 = '';
|
|
14
|
+
let {
|
|
15
|
+
/* eslint-disable prefer-const */
|
|
16
|
+
checked = $bindable(false),
|
|
17
|
+
class: className,
|
|
18
|
+
hidden = false,
|
|
19
|
+
disabled = false,
|
|
20
|
+
label = '',
|
|
21
|
+
children: _children,
|
|
22
|
+
startIcon: _startIcon,
|
|
23
|
+
onChange,
|
|
24
|
+
...restProps
|
|
25
|
+
/* eslint-enable prefer-const */
|
|
26
|
+
} = $props();
|
|
44
27
|
</script>
|
|
45
28
|
|
|
46
29
|
<MenuItem
|
|
30
|
+
{...restProps}
|
|
47
31
|
role="menuitemcheckbox"
|
|
48
32
|
class="sui menu-item-checkbox {className}"
|
|
49
33
|
{label}
|
|
50
34
|
{hidden}
|
|
51
35
|
{disabled}
|
|
52
36
|
aria-checked={checked}
|
|
53
|
-
{
|
|
54
|
-
|
|
55
|
-
{...$$restProps}
|
|
56
|
-
on:click
|
|
57
|
-
on:select
|
|
58
|
-
on:change
|
|
59
|
-
on:change={(event) => {
|
|
37
|
+
onChange={(event) => {
|
|
38
|
+
onChange?.(event);
|
|
60
39
|
checked = event.detail.checked;
|
|
61
40
|
}}
|
|
62
41
|
>
|
|
63
|
-
|
|
64
|
-
|
|
42
|
+
{#snippet startIcon()}
|
|
43
|
+
{@render _startIcon?.()}
|
|
44
|
+
{/snippet}
|
|
45
|
+
{#snippet children()}
|
|
46
|
+
{@render _children?.()}
|
|
47
|
+
{/snippet}
|
|
48
|
+
{#snippet endIcon()}
|
|
49
|
+
{#if checked}
|
|
50
|
+
<Icon name="check" />
|
|
51
|
+
{/if}
|
|
52
|
+
{/snippet}
|
|
65
53
|
</MenuItem>
|
|
@@ -1,55 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export default MenuItemCheckbox;
|
|
2
|
+
type MenuItemCheckbox = SvelteComponent<ButtonProps & MenuItemProps & KeyboardEventHandlers & MouseEventHandlers & FocusEventHandlers & DragEventHandlers & Record<string, any>, {
|
|
3
|
+
[evt: string]: CustomEvent<any>;
|
|
4
|
+
}, {}> & {
|
|
5
|
+
$$bindings?: "checked" | undefined;
|
|
6
|
+
};
|
|
4
7
|
/**
|
|
5
8
|
* A menu item widget with a checkbox.
|
|
6
9
|
* @see https://w3c.github.io/aria/#menuitemcheckbox
|
|
7
10
|
*/
|
|
8
|
-
|
|
9
|
-
[x: string]: any;
|
|
10
|
-
class?: string | undefined;
|
|
11
|
-
disabled?: boolean | undefined;
|
|
12
|
-
label?: string | undefined;
|
|
13
|
-
checked?: boolean | undefined;
|
|
14
|
-
hidden?: boolean | undefined;
|
|
15
|
-
iconName?: string | undefined;
|
|
16
|
-
iconLabel?: string | undefined;
|
|
17
|
-
}, {
|
|
18
|
-
click: MouseEvent;
|
|
19
|
-
select: CustomEvent<any>;
|
|
20
|
-
change: CustomEvent<any>;
|
|
21
|
-
} & {
|
|
11
|
+
declare const MenuItemCheckbox: $$__sveltets_2_IsomorphicComponent<import("../../typedefs").ButtonProps & import("../../typedefs").MenuItemProps & import("../../typedefs").KeyboardEventHandlers & import("../../typedefs").MouseEventHandlers & import("../../typedefs").FocusEventHandlers & import("../../typedefs").DragEventHandlers & Record<string, any>, {
|
|
22
12
|
[evt: string]: CustomEvent<any>;
|
|
23
|
-
}, {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
class?: string | undefined;
|
|
35
|
-
disabled?: boolean | undefined;
|
|
36
|
-
label?: string | undefined;
|
|
37
|
-
checked?: boolean | undefined;
|
|
38
|
-
hidden?: boolean | undefined;
|
|
39
|
-
iconName?: string | undefined;
|
|
40
|
-
iconLabel?: string | undefined;
|
|
41
|
-
};
|
|
42
|
-
events: {
|
|
43
|
-
click: MouseEvent;
|
|
44
|
-
select: CustomEvent<any>;
|
|
45
|
-
change: CustomEvent<any>;
|
|
46
|
-
} & {
|
|
47
|
-
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, "checked">;
|
|
14
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: Props & {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
48
24
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
};
|
|
52
|
-
exports?: undefined;
|
|
53
|
-
bindings?: undefined;
|
|
54
|
-
};
|
|
55
|
-
export {};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -6,45 +6,48 @@
|
|
|
6
6
|
import { generateElementId } from '@sveltia/utils/element';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* @
|
|
9
|
+
* @typedef {object} Props
|
|
10
|
+
* @property {string} [class] - The `class` attribute on the wrapper element.
|
|
11
|
+
* @property {boolean} [hidden] - Whether to hide the widget. An alias of the `aria-hidden`
|
|
12
|
+
* attribute.
|
|
13
|
+
* @property {boolean} [disabled] - Whether to disable the widget. An alias of the `aria-disabled`
|
|
14
|
+
* attribute.
|
|
15
|
+
* @property {string} [title] - Text label displayed above the group items.
|
|
11
16
|
*/
|
|
12
|
-
|
|
13
|
-
export { className as class };
|
|
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;
|
|
17
|
+
|
|
24
18
|
/**
|
|
25
|
-
*
|
|
19
|
+
* @type {import('../../typedefs').CommonEventHandlers & Props & Record<string, any>}
|
|
26
20
|
*/
|
|
27
|
-
|
|
21
|
+
let {
|
|
22
|
+
/* eslint-disable prefer-const */
|
|
23
|
+
class: className,
|
|
24
|
+
hidden = false,
|
|
25
|
+
disabled = false,
|
|
26
|
+
title = '',
|
|
27
|
+
children,
|
|
28
|
+
...restProps
|
|
29
|
+
/* eslint-enable prefer-const */
|
|
30
|
+
} = $props();
|
|
28
31
|
|
|
29
32
|
const id = generateElementId('group');
|
|
30
33
|
</script>
|
|
31
34
|
|
|
32
35
|
<div
|
|
36
|
+
{...restProps}
|
|
33
37
|
role="group"
|
|
34
38
|
{id}
|
|
35
39
|
class="sui menu-item-group {className}"
|
|
36
|
-
|
|
40
|
+
{hidden}
|
|
37
41
|
aria-hidden={hidden}
|
|
38
42
|
aria-disabled={disabled}
|
|
39
43
|
aria-labelledby={title ? `${id}-title` : undefined}
|
|
40
44
|
aria-roledescription="menu item group"
|
|
41
|
-
{...$$restProps}
|
|
42
45
|
>
|
|
43
46
|
{#if title}
|
|
44
47
|
<div role="none" class="title" id="{id}-title">{title}</div>
|
|
45
48
|
{/if}
|
|
46
49
|
<div role="none" class="inner" inert={disabled}>
|
|
47
|
-
|
|
50
|
+
{@render children?.()}
|
|
48
51
|
</div>
|
|
49
52
|
</div>
|
|
50
53
|
|
|
@@ -1,38 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export default MenuItemGroup;
|
|
2
|
+
type MenuItemGroup = SvelteComponent<KeyboardEventHandlers & MouseEventHandlers & FocusEventHandlers & DragEventHandlers & Props & Record<string, any>, {
|
|
3
|
+
[evt: string]: CustomEvent<any>;
|
|
4
|
+
}, {}> & {
|
|
5
|
+
$$bindings?: "" | undefined;
|
|
6
|
+
};
|
|
4
7
|
/** A menu item group. */
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
declare const MenuItemGroup: $$__sveltets_2_IsomorphicComponent<import("../../typedefs").KeyboardEventHandlers & import("../../typedefs").MouseEventHandlers & import("../../typedefs").FocusEventHandlers & import("../../typedefs").DragEventHandlers & {
|
|
9
|
+
/**
|
|
10
|
+
* - The `class` attribute on the wrapper element.
|
|
11
|
+
*/
|
|
7
12
|
class?: string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* - Whether to hide the widget. An alias of the `aria-hidden`
|
|
15
|
+
* attribute.
|
|
16
|
+
*/
|
|
17
|
+
hidden?: boolean | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* - Whether to disable the widget. An alias of the `aria-disabled`
|
|
20
|
+
* attribute.
|
|
21
|
+
*/
|
|
8
22
|
disabled?: boolean | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* - Text label displayed above the group items.
|
|
25
|
+
*/
|
|
9
26
|
title?: string | undefined;
|
|
10
|
-
|
|
11
|
-
}, {
|
|
27
|
+
} & Record<string, any>, {
|
|
12
28
|
[evt: string]: CustomEvent<any>;
|
|
13
|
-
}, {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
default: {};
|
|
34
|
-
};
|
|
35
|
-
exports?: undefined;
|
|
36
|
-
bindings?: undefined;
|
|
29
|
+
}, {}, {}, "">;
|
|
30
|
+
type Props = {
|
|
31
|
+
/**
|
|
32
|
+
* - The `class` attribute on the wrapper element.
|
|
33
|
+
*/
|
|
34
|
+
class?: string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* - Whether to hide the widget. An alias of the `aria-hidden`
|
|
37
|
+
* attribute.
|
|
38
|
+
*/
|
|
39
|
+
hidden?: boolean | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* - Whether to disable the widget. An alias of the `aria-disabled`
|
|
42
|
+
* attribute.
|
|
43
|
+
*/
|
|
44
|
+
disabled?: boolean | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* - Text label displayed above the group items.
|
|
47
|
+
*/
|
|
48
|
+
title?: string | undefined;
|
|
37
49
|
};
|
|
38
|
-
|
|
50
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
51
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
52
|
+
$$bindings?: Bindings;
|
|
53
|
+
} & Exports;
|
|
54
|
+
(internal: unknown, props: Props & {
|
|
55
|
+
$$events?: Events;
|
|
56
|
+
$$slots?: Slots;
|
|
57
|
+
}): Exports & {
|
|
58
|
+
$set?: any;
|
|
59
|
+
$on?: any;
|
|
60
|
+
};
|
|
61
|
+
z_$$bindings?: Bindings;
|
|
62
|
+
}
|
|
@@ -9,58 +9,46 @@
|
|
|
9
9
|
import MenuItem from './menu-item.svelte';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* @type {import('../../typedefs').ButtonProps & import('../../typedefs').MenuItemProps &
|
|
13
|
+
* import('../../typedefs').CommonEventHandlers & Record<string, any>}
|
|
14
14
|
*/
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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 = '';
|
|
15
|
+
let {
|
|
16
|
+
/* eslint-disable prefer-const */
|
|
17
|
+
checked = $bindable(false),
|
|
18
|
+
class: className,
|
|
19
|
+
hidden = false,
|
|
20
|
+
disabled = false,
|
|
21
|
+
label = '',
|
|
22
|
+
children: _children,
|
|
23
|
+
startIcon: _startIcon,
|
|
24
|
+
onChange,
|
|
25
|
+
...restProps
|
|
26
|
+
/* eslint-enable prefer-const */
|
|
27
|
+
} = $props();
|
|
45
28
|
</script>
|
|
46
29
|
|
|
47
30
|
<MenuItem
|
|
31
|
+
{...restProps}
|
|
48
32
|
role="menuitemradio"
|
|
49
33
|
class="sui menu-item-radio {className}"
|
|
50
34
|
{label}
|
|
51
35
|
{hidden}
|
|
52
36
|
{disabled}
|
|
53
37
|
aria-checked={checked}
|
|
54
|
-
{
|
|
55
|
-
|
|
56
|
-
{...$$restProps}
|
|
57
|
-
on:click
|
|
58
|
-
on:select
|
|
59
|
-
on:change
|
|
60
|
-
on:change={(event) => {
|
|
38
|
+
onChange={(event) => {
|
|
39
|
+
onChange?.(event);
|
|
61
40
|
checked = event.detail.checked;
|
|
62
41
|
}}
|
|
63
42
|
>
|
|
64
|
-
|
|
65
|
-
|
|
43
|
+
{#snippet startIcon()}
|
|
44
|
+
{@render _startIcon?.()}
|
|
45
|
+
{/snippet}
|
|
46
|
+
{#snippet children()}
|
|
47
|
+
{@render _children?.()}
|
|
48
|
+
{/snippet}
|
|
49
|
+
{#snippet endIcon()}
|
|
50
|
+
{#if checked}
|
|
51
|
+
<Icon name="check" />
|
|
52
|
+
{/if}
|
|
53
|
+
{/snippet}
|
|
66
54
|
</MenuItem>
|