@sveltia/ui 0.16.0 → 0.17.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/alert/alert.svelte +22 -7
- package/package/components/alert/alert.svelte.d.ts +32 -28
- package/package/components/button/button-group.svelte +16 -6
- package/package/components/button/button-group.svelte.d.ts +23 -23
- package/package/components/button/button.svelte +41 -136
- package/package/components/button/button.svelte.d.ts +5 -146
- package/package/components/button/select-button-group.svelte +31 -37
- package/package/components/button/select-button-group.svelte.d.ts +76 -34
- package/package/components/button/select-button.svelte +19 -62
- package/package/components/button/select-button.svelte.d.ts +17 -73
- package/package/components/button/split-button.svelte +37 -47
- package/package/components/button/split-button.svelte.d.ts +40 -47
- package/package/components/calendar/calendar.svelte +80 -55
- package/package/components/calendar/calendar.svelte.d.ts +13 -10
- package/package/components/checkbox/checkbox-group.svelte +23 -20
- package/package/components/checkbox/checkbox-group.svelte.d.ts +49 -27
- package/package/components/checkbox/checkbox.svelte +57 -67
- package/package/components/checkbox/checkbox.svelte.d.ts +67 -55
- package/package/components/dialog/alert-dialog.svelte +9 -36
- package/package/components/dialog/alert-dialog.svelte.d.ts +5 -44
- package/package/components/dialog/confirmation-dialog.svelte +9 -41
- package/package/components/dialog/confirmation-dialog.svelte.d.ts +5 -46
- package/package/components/dialog/dialog.svelte +60 -105
- package/package/components/dialog/dialog.svelte.d.ts +5 -102
- package/package/components/dialog/prompt-dialog.svelte +32 -61
- package/package/components/dialog/prompt-dialog.svelte.d.ts +38 -62
- package/package/components/disclosure/disclosure.svelte +39 -34
- package/package/components/disclosure/disclosure.svelte.d.ts +74 -56
- package/package/components/divider/divider.svelte +18 -14
- package/package/components/divider/divider.svelte.d.ts +31 -10
- package/package/components/divider/spacer.svelte +13 -8
- package/package/components/divider/spacer.svelte.d.ts +20 -9
- package/package/components/drawer/drawer.svelte +63 -76
- package/package/components/drawer/drawer.svelte.d.ts +102 -84
- package/package/components/grid/grid-body.svelte +15 -10
- package/package/components/grid/grid-body.svelte.d.ts +30 -24
- package/package/components/grid/grid-cell.svelte +16 -6
- package/package/components/grid/grid-cell.svelte.d.ts +23 -23
- package/package/components/grid/grid-col-header.svelte +16 -6
- package/package/components/grid/grid-col-header.svelte.d.ts +23 -23
- package/package/components/grid/grid-foot.svelte +16 -6
- package/package/components/grid/grid-foot.svelte.d.ts +23 -23
- package/package/components/grid/grid-head.svelte +16 -6
- package/package/components/grid/grid-head.svelte.d.ts +23 -23
- package/package/components/grid/grid-row-header.svelte +16 -6
- package/package/components/grid/grid-row-header.svelte.d.ts +23 -23
- package/package/components/grid/grid-row.svelte +19 -23
- package/package/components/grid/grid-row.svelte.d.ts +48 -38
- package/package/components/grid/grid.svelte +28 -25
- package/package/components/grid/grid.svelte.d.ts +56 -32
- package/package/components/icon/icon.svelte +14 -9
- package/package/components/icon/icon.svelte.d.ts +20 -9
- package/package/components/listbox/listbox.svelte +46 -52
- package/package/components/listbox/listbox.svelte.d.ts +102 -40
- package/package/components/listbox/option-group.svelte +23 -19
- package/package/components/listbox/option-group.svelte.d.ts +49 -27
- package/package/components/listbox/option.svelte +44 -57
- package/package/components/listbox/option.svelte.d.ts +54 -84
- package/package/components/menu/menu-button.svelte +42 -63
- package/package/components/menu/menu-button.svelte.d.ts +18 -72
- package/package/components/menu/menu-item-checkbox.svelte +29 -41
- package/package/components/menu/menu-item-checkbox.svelte.d.ts +5 -44
- package/package/components/menu/menu-item-group.svelte +22 -19
- package/package/components/menu/menu-item-group.svelte.d.ts +41 -27
- package/package/components/menu/menu-item-radio.svelte +29 -41
- package/package/components/menu/menu-item-radio.svelte.d.ts +5 -44
- package/package/components/menu/menu-item.svelte +66 -75
- package/package/components/menu/menu-item.svelte.d.ts +5 -80
- package/package/components/menu/menu.svelte +27 -22
- package/package/components/menu/menu.svelte.d.ts +50 -30
- package/package/components/radio/radio-group.svelte +38 -42
- package/package/components/radio/radio-group.svelte.d.ts +85 -35
- package/package/components/radio/radio.svelte +45 -48
- package/package/components/radio/radio.svelte.d.ts +96 -42
- package/package/components/select/combobox.svelte +76 -101
- package/package/components/select/combobox.svelte.d.ts +5 -56
- package/package/components/select/select-tags.svelte +48 -59
- package/package/components/select/select-tags.svelte.d.ts +109 -28
- package/package/components/select/select.svelte +18 -37
- package/package/components/select/select.svelte.d.ts +5 -40
- package/package/components/slider/slider.svelte +71 -68
- package/package/components/slider/slider.svelte.d.ts +142 -31
- package/package/components/switch/switch.svelte +36 -46
- package/package/components/switch/switch.svelte.d.ts +83 -37
- package/package/components/table/table-body.svelte +15 -11
- package/package/components/table/table-body.svelte.d.ts +30 -24
- package/package/components/table/table-cell.svelte +16 -6
- package/package/components/table/table-cell.svelte.d.ts +23 -23
- package/package/components/table/table-col-header.svelte +16 -6
- package/package/components/table/table-col-header.svelte.d.ts +23 -23
- package/package/components/table/table-foot.svelte +16 -6
- package/package/components/table/table-foot.svelte.d.ts +23 -23
- package/package/components/table/table-head.svelte +16 -6
- package/package/components/table/table-head.svelte.d.ts +23 -23
- package/package/components/table/table-row-header.svelte +16 -6
- package/package/components/table/table-row-header.svelte.d.ts +23 -23
- package/package/components/table/table-row.svelte +16 -6
- package/package/components/table/table-row.svelte.d.ts +23 -23
- package/package/components/table/table.svelte +16 -6
- package/package/components/table/table.svelte.d.ts +23 -23
- package/package/components/tabs/tab-box.svelte +16 -9
- package/package/components/tabs/tab-box.svelte.d.ts +32 -22
- package/package/components/tabs/tab-list.svelte +36 -35
- package/package/components/tabs/tab-list.svelte.d.ts +65 -33
- package/package/components/tabs/tab-panel.svelte +16 -6
- package/package/components/tabs/tab-panel.svelte.d.ts +23 -23
- package/package/components/tabs/tab-panels.svelte +16 -6
- package/package/components/tabs/tab-panels.svelte.d.ts +23 -21
- package/package/components/tabs/tab.svelte +28 -25
- package/package/components/tabs/tab.svelte.d.ts +17 -63
- package/package/components/text-editor/lexical-root.svelte +38 -32
- package/package/components/text-editor/lexical-root.svelte.d.ts +74 -13
- package/package/components/text-editor/text-editor.svelte +63 -79
- package/package/components/text-editor/text-editor.svelte.d.ts +97 -20
- package/package/components/text-editor/toolbar/editor-toolbar.svelte +41 -24
- package/package/components/text-editor/toolbar/editor-toolbar.svelte.d.ts +32 -7
- package/package/components/text-editor/toolbar/format-text-button.svelte +15 -5
- package/package/components/text-editor/toolbar/format-text-button.svelte.d.ts +13 -6
- package/package/components/text-editor/toolbar/insert-link-button.svelte +18 -16
- package/package/components/text-editor/toolbar/insert-link-button.svelte.d.ts +4 -8
- 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 +13 -6
- package/package/components/text-field/number-input.svelte +63 -81
- package/package/components/text-field/number-input.svelte.d.ts +48 -55
- package/package/components/text-field/password-input.svelte +38 -57
- package/package/components/text-field/password-input.svelte.d.ts +16 -45
- package/package/components/text-field/search-bar.svelte +45 -62
- package/package/components/text-field/search-bar.svelte.d.ts +25 -66
- package/package/components/text-field/text-area.svelte +38 -54
- package/package/components/text-field/text-area.svelte.d.ts +100 -35
- package/package/components/text-field/text-input.svelte +28 -86
- package/package/components/text-field/text-input.svelte.d.ts +4 -78
- package/package/components/toast/toast.svelte +36 -30
- package/package/components/toast/toast.svelte.d.ts +50 -28
- package/package/components/toolbar/toolbar.svelte +25 -25
- package/package/components/toolbar/toolbar.svelte.d.ts +57 -29
- package/package/components/util/app-shell.svelte +22 -10
- package/package/components/util/app-shell.svelte.d.ts +25 -29
- package/package/components/util/group.svelte +20 -15
- package/package/components/util/group.svelte.d.ts +40 -26
- package/package/components/util/modal.svelte +89 -105
- package/package/components/util/modal.svelte.d.ts +6 -71
- package/package/components/util/placeholder.svelte +21 -0
- package/package/components/util/{portal.svelte.d.ts → placeholder.svelte.d.ts} +17 -25
- package/package/components/util/popup.svelte +65 -62
- package/package/components/util/popup.svelte.d.ts +89 -77
- 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 +12 -19
- package/package/components/util/portal.svelte +0 -36
- /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,17 +8,32 @@
|
|
|
8
8
|
import Icon from '../icon/icon.svelte';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
* @
|
|
11
|
+
* @typedef {object} Props
|
|
12
|
+
* @property {'error' | 'warning' | 'info' | 'success'} status - Alert status.
|
|
13
|
+
* @property {import('svelte').Snippet} [children] - Primary slot content.
|
|
14
|
+
* @property {import('svelte').Snippet} [icon] - Icon slot content.
|
|
13
15
|
*/
|
|
14
|
-
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @type {Props & Record<string, any>}
|
|
19
|
+
*/
|
|
20
|
+
let {
|
|
21
|
+
/* eslint-disable prefer-const */
|
|
22
|
+
status,
|
|
23
|
+
children,
|
|
24
|
+
icon,
|
|
25
|
+
...restProps
|
|
26
|
+
/* eslint-enable prefer-const */
|
|
27
|
+
} = $props();
|
|
15
28
|
</script>
|
|
16
29
|
|
|
17
|
-
<div role="alert" class="sui alert {status}"
|
|
18
|
-
|
|
30
|
+
<div {...restProps} role="alert" class="sui alert {status}">
|
|
31
|
+
{#if icon}
|
|
32
|
+
{@render icon()}
|
|
33
|
+
{:else}
|
|
19
34
|
<Icon name={status === 'success' ? 'check_circle' : status} />
|
|
20
|
-
|
|
21
|
-
|
|
35
|
+
{/if}
|
|
36
|
+
{@render children?.()}
|
|
22
37
|
</div>
|
|
23
38
|
|
|
24
39
|
<style>.alert {
|
|
@@ -1,40 +1,44 @@
|
|
|
1
1
|
export default Alert;
|
|
2
|
-
type Alert = SvelteComponent
|
|
3
|
-
[x: string]: any;
|
|
4
|
-
status?: "error" | "warning" | "info" | "success" | undefined;
|
|
5
|
-
}, {
|
|
6
|
-
icon: {};
|
|
7
|
-
default: {};
|
|
8
|
-
}>, {
|
|
2
|
+
type Alert = SvelteComponent<Props & Record<string, any>, {
|
|
9
3
|
[evt: string]: CustomEvent<any>;
|
|
10
|
-
}, {
|
|
11
|
-
|
|
12
|
-
default: {};
|
|
13
|
-
}> & {
|
|
14
|
-
$$bindings?: string | undefined;
|
|
4
|
+
}, {}> & {
|
|
5
|
+
$$bindings?: "" | undefined;
|
|
15
6
|
};
|
|
16
7
|
/**
|
|
17
8
|
* Inline alert message.
|
|
18
9
|
* @see https://w3c.github.io/aria/#alert
|
|
19
10
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/alert/
|
|
20
11
|
*/
|
|
21
|
-
declare const Alert: $$__sveltets_2_IsomorphicComponent
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
12
|
+
declare const Alert: $$__sveltets_2_IsomorphicComponent<{
|
|
13
|
+
/**
|
|
14
|
+
* - Alert status.
|
|
15
|
+
*/
|
|
16
|
+
status: "error" | "warning" | "info" | "success";
|
|
17
|
+
/**
|
|
18
|
+
* - Primary slot content.
|
|
19
|
+
*/
|
|
20
|
+
children?: import("svelte").Snippet<[]> | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* - Icon slot content.
|
|
23
|
+
*/
|
|
24
|
+
icon?: import("svelte").Snippet<[]> | undefined;
|
|
25
|
+
} & Record<string, any>, {
|
|
28
26
|
[evt: string]: CustomEvent<any>;
|
|
29
|
-
}, {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
}, {}, {}, "">;
|
|
28
|
+
type Props = {
|
|
29
|
+
/**
|
|
30
|
+
* - Alert status.
|
|
31
|
+
*/
|
|
32
|
+
status: "error" | "warning" | "info" | "success";
|
|
33
|
+
/**
|
|
34
|
+
* - Primary slot content.
|
|
35
|
+
*/
|
|
36
|
+
children?: import("svelte").Snippet<[]> | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* - Icon slot content.
|
|
39
|
+
*/
|
|
40
|
+
icon?: import("svelte").Snippet<[]> | undefined;
|
|
41
|
+
};
|
|
38
42
|
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> {
|
|
39
43
|
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
40
44
|
$$bindings?: Bindings;
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* @
|
|
3
|
+
* @typedef {object} Props
|
|
4
|
+
* @property {string} [class] - The `class` attribute on the wrapper element.
|
|
5
|
+
* @property {import('svelte').Snippet} [children] - Primary slot content.
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @type {Props & Record<string, any>}
|
|
10
|
+
*/
|
|
11
|
+
let {
|
|
12
|
+
/* eslint-disable prefer-const */
|
|
13
|
+
class: className,
|
|
14
|
+
children,
|
|
15
|
+
...restProps
|
|
16
|
+
/* eslint-enable prefer-const */
|
|
17
|
+
} = $props();
|
|
8
18
|
</script>
|
|
9
19
|
|
|
10
|
-
<div role="group" class="sui button-group {className}"
|
|
11
|
-
|
|
20
|
+
<div {...restProps} role="group" class="sui button-group {className}">
|
|
21
|
+
{@render children?.()}
|
|
12
22
|
</div>
|
|
13
23
|
|
|
14
24
|
<style>.button-group {
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
export default ButtonGroup;
|
|
2
|
-
type ButtonGroup = SvelteComponent
|
|
3
|
-
[x: string]: any;
|
|
4
|
-
class?: string | undefined;
|
|
5
|
-
}, {
|
|
6
|
-
default: {};
|
|
7
|
-
}>, {
|
|
2
|
+
type ButtonGroup = SvelteComponent<Props & Record<string, any>, {
|
|
8
3
|
[evt: string]: CustomEvent<any>;
|
|
9
|
-
}, {
|
|
10
|
-
|
|
11
|
-
}> & {
|
|
12
|
-
$$bindings?: string | undefined;
|
|
4
|
+
}, {}> & {
|
|
5
|
+
$$bindings?: "" | undefined;
|
|
13
6
|
};
|
|
14
|
-
declare const ButtonGroup: $$__sveltets_2_IsomorphicComponent
|
|
15
|
-
|
|
7
|
+
declare const ButtonGroup: $$__sveltets_2_IsomorphicComponent<{
|
|
8
|
+
/**
|
|
9
|
+
* - The `class` attribute on the wrapper element.
|
|
10
|
+
*/
|
|
16
11
|
class?: string | undefined;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
/**
|
|
13
|
+
* - Primary slot content.
|
|
14
|
+
*/
|
|
15
|
+
children?: import("svelte").Snippet<[]> | undefined;
|
|
16
|
+
} & Record<string, any>, {
|
|
20
17
|
[evt: string]: CustomEvent<any>;
|
|
21
|
-
}, {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
}, {}, {}, "">;
|
|
19
|
+
type Props = {
|
|
20
|
+
/**
|
|
21
|
+
* - The `class` attribute on the wrapper element.
|
|
22
|
+
*/
|
|
23
|
+
class?: string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* - Primary slot content.
|
|
26
|
+
*/
|
|
27
|
+
children?: import("svelte").Snippet<[]> | undefined;
|
|
28
|
+
};
|
|
29
29
|
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> {
|
|
30
30
|
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
31
31
|
$$bindings?: Bindings;
|
|
@@ -4,119 +4,47 @@
|
|
|
4
4
|
@see https://w3c.github.io/aria/#button
|
|
5
5
|
@see https://www.w3.org/WAI/ARIA/apg/patterns/button/
|
|
6
6
|
-->
|
|
7
|
-
<svelte:options accessors={true} />
|
|
8
|
-
|
|
9
7
|
<script>
|
|
10
|
-
import {
|
|
11
|
-
import { activateKeyShortcuts } from '../../services/events';
|
|
8
|
+
import { activateKeyShortcuts } from '../../services/events.svelte';
|
|
12
9
|
import Popup from '../util/popup.svelte';
|
|
13
10
|
|
|
14
11
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*/
|
|
18
|
-
export let element = undefined;
|
|
19
|
-
/**
|
|
20
|
-
* The `class` attribute on the `<button>` element.
|
|
21
|
-
* @type {string}
|
|
22
|
-
*/
|
|
23
|
-
let className = '';
|
|
24
|
-
export { className as class };
|
|
25
|
-
/**
|
|
26
|
-
* The `type` attribute on the `<button>` element.
|
|
27
|
-
* @type {'button' | 'submit' | 'reset'}
|
|
28
|
-
*/
|
|
29
|
-
export let type = 'button';
|
|
30
|
-
/**
|
|
31
|
-
* The `role` attribute on the `<button>` element.
|
|
32
|
-
* @type {string}
|
|
33
|
-
*/
|
|
34
|
-
export let role = 'button';
|
|
35
|
-
/**
|
|
36
|
-
* The `name` attribute on the `<button>` element.
|
|
37
|
-
* @type {string | undefined}
|
|
38
|
-
*/
|
|
39
|
-
export let name = undefined;
|
|
40
|
-
/**
|
|
41
|
-
* The `value` attribute on the `<button>` element.
|
|
42
|
-
* @type {string | undefined}
|
|
43
|
-
*/
|
|
44
|
-
export let value = undefined;
|
|
45
|
-
/**
|
|
46
|
-
* Whether to hide the widget. An alias of the `aria-hidden` attribute.
|
|
47
|
-
* @type {boolean | undefined}
|
|
48
|
-
*/
|
|
49
|
-
export let hidden = undefined;
|
|
50
|
-
/**
|
|
51
|
-
* Whether to disable the widget. An alias of the `aria-disabled` attribute.
|
|
52
|
-
* @type {boolean}
|
|
53
|
-
*/
|
|
54
|
-
export let disabled = false;
|
|
55
|
-
/**
|
|
56
|
-
* Whether to make the widget read-only. An alias of the `aria-readonly` attribute used in certain
|
|
57
|
-
* roles, including `checkbox`, `listbox`, `slider` and `textbox`.
|
|
58
|
-
* @type {boolean | undefined}
|
|
59
|
-
*/
|
|
60
|
-
export let readonly = undefined;
|
|
61
|
-
/**
|
|
62
|
-
* Whether to mark the widget pressed. An alias of the `aria-pressed` attribute.
|
|
63
|
-
* @type {boolean | 'mixed' | undefined}
|
|
64
|
-
*/
|
|
65
|
-
export let pressed = undefined;
|
|
66
|
-
/**
|
|
67
|
-
* Keyboard shortcuts. An alias of the `aria-keyshortcuts` attribute. Accepts the special `Accel`
|
|
68
|
-
* key, which will be replaced with `Control` or `Meta` depending on the user’s operating system.
|
|
69
|
-
* @type {string | undefined}
|
|
70
|
-
*/
|
|
71
|
-
export let keyShortcuts = undefined;
|
|
72
|
-
/**
|
|
73
|
-
* Text label displayed on the button.
|
|
74
|
-
* @type {string}
|
|
75
|
-
*/
|
|
76
|
-
export let label = '';
|
|
77
|
-
/**
|
|
78
|
-
* The style variant of the button.
|
|
79
|
-
* @type {'primary' | 'secondary' | 'tertiary' | 'ghost' | 'link' | undefined}
|
|
80
|
-
*/
|
|
81
|
-
export let variant = undefined;
|
|
82
|
-
/**
|
|
83
|
-
* The size of the button.
|
|
84
|
-
* @type {'small' | 'medium' | 'large' | undefined}
|
|
85
|
-
*/
|
|
86
|
-
export let size = 'medium';
|
|
87
|
-
/**
|
|
88
|
-
* Whether to only show an icon on the button and trim the padding.
|
|
89
|
-
*/
|
|
90
|
-
export let iconic = false;
|
|
91
|
-
/**
|
|
92
|
-
* Whether to make the button rounded.
|
|
93
|
-
*/
|
|
94
|
-
export let pill = false;
|
|
95
|
-
/**
|
|
96
|
-
* Make the button width flexible.
|
|
97
|
-
* @type {boolean}
|
|
98
|
-
*/
|
|
99
|
-
export let flex = false;
|
|
100
|
-
/**
|
|
101
|
-
* Where to show the dropdown menu.
|
|
102
|
-
* @type {import('../../typedefs').PopupPosition}
|
|
103
|
-
*/
|
|
104
|
-
export let popupPosition = 'bottom-left';
|
|
105
|
-
/**
|
|
106
|
-
* Whether to show the backdrop for the popup.
|
|
107
|
-
* @type {boolean}
|
|
108
|
-
*/
|
|
109
|
-
export let showPopupBackdrop = false;
|
|
110
|
-
|
|
111
|
-
const dispatch = createEventDispatcher();
|
|
112
|
-
/**
|
|
113
|
-
* Reference to the `Popup` component.
|
|
114
|
-
* @type {Popup | undefined}
|
|
12
|
+
* @type {import('../../typedefs').ButtonProps & import('../../typedefs').CommonEventHandlers &
|
|
13
|
+
* Record<string, any>}
|
|
115
14
|
*/
|
|
116
|
-
let
|
|
15
|
+
let {
|
|
16
|
+
/* eslint-disable prefer-const */
|
|
17
|
+
element = $bindable(),
|
|
18
|
+
class: className = '',
|
|
19
|
+
type = 'button',
|
|
20
|
+
role = 'button',
|
|
21
|
+
name = undefined,
|
|
22
|
+
value = undefined,
|
|
23
|
+
hidden = false,
|
|
24
|
+
disabled = false,
|
|
25
|
+
readonly = false,
|
|
26
|
+
pressed = undefined,
|
|
27
|
+
keyShortcuts = undefined,
|
|
28
|
+
label = '',
|
|
29
|
+
variant = undefined,
|
|
30
|
+
size = 'medium',
|
|
31
|
+
iconic = false,
|
|
32
|
+
pill = false,
|
|
33
|
+
flex = false,
|
|
34
|
+
popupPosition = 'bottom-left',
|
|
35
|
+
showPopupBackdrop = false,
|
|
36
|
+
children,
|
|
37
|
+
startIcon,
|
|
38
|
+
endIcon,
|
|
39
|
+
popup,
|
|
40
|
+
...restProps
|
|
41
|
+
/* eslint-enable prefer-const */
|
|
42
|
+
} = $props();
|
|
117
43
|
</script>
|
|
118
44
|
|
|
119
45
|
<button
|
|
46
|
+
bind:this={element}
|
|
47
|
+
{...restProps}
|
|
120
48
|
class="sui button {variant ?? ''} {size} {className}"
|
|
121
49
|
class:iconic
|
|
122
50
|
class:pill
|
|
@@ -124,38 +52,16 @@
|
|
|
124
52
|
{type}
|
|
125
53
|
{name}
|
|
126
54
|
{value}
|
|
127
|
-
|
|
128
|
-
|
|
55
|
+
{hidden}
|
|
56
|
+
{disabled}
|
|
129
57
|
{role}
|
|
130
58
|
aria-hidden={hidden}
|
|
131
59
|
aria-disabled={disabled}
|
|
132
60
|
aria-readonly={readonly}
|
|
133
61
|
aria-pressed={pressed}
|
|
134
|
-
{...$$restProps}
|
|
135
|
-
bind:this={element}
|
|
136
62
|
use:activateKeyShortcuts={keyShortcuts}
|
|
137
|
-
on:mouseenter
|
|
138
|
-
on:mouseleave
|
|
139
|
-
on:click
|
|
140
|
-
on:dblclick
|
|
141
|
-
on:dragover
|
|
142
|
-
on:dragleave
|
|
143
|
-
on:dragend
|
|
144
|
-
on:drop
|
|
145
|
-
on:keydown
|
|
146
|
-
on:keyup
|
|
147
|
-
on:keypress
|
|
148
|
-
on:focus
|
|
149
|
-
on:blur
|
|
150
|
-
on:select={(/** @type {CustomEvent} */ event) => {
|
|
151
|
-
dispatch('select', event.detail);
|
|
152
|
-
}}
|
|
153
|
-
on:change={(/** @type {CustomEvent} */ event) => {
|
|
154
|
-
dispatch('change', event.detail);
|
|
155
|
-
}}
|
|
156
|
-
on:toggle
|
|
157
63
|
>
|
|
158
|
-
|
|
64
|
+
{@render startIcon?.()}
|
|
159
65
|
{#if variant === 'link'}
|
|
160
66
|
{#if label}
|
|
161
67
|
<span role="none" class="label">
|
|
@@ -163,7 +69,7 @@
|
|
|
163
69
|
</span>
|
|
164
70
|
{:else}
|
|
165
71
|
<span role="none" class="label">
|
|
166
|
-
|
|
72
|
+
{@render children?.()}
|
|
167
73
|
</span>
|
|
168
74
|
{/if}
|
|
169
75
|
{:else}
|
|
@@ -172,20 +78,19 @@
|
|
|
172
78
|
{label}
|
|
173
79
|
</span>
|
|
174
80
|
{/if}
|
|
175
|
-
|
|
81
|
+
{@render children?.()}
|
|
176
82
|
{/if}
|
|
177
|
-
|
|
83
|
+
{@render endIcon?.()}
|
|
178
84
|
</button>
|
|
179
85
|
|
|
180
|
-
{#if
|
|
86
|
+
{#if popup}
|
|
181
87
|
<Popup
|
|
182
88
|
anchor={element}
|
|
183
89
|
position={popupPosition}
|
|
184
90
|
showBackdrop={showPopupBackdrop}
|
|
185
91
|
touchOptimized={true}
|
|
186
|
-
bind:this={popupComponent}
|
|
187
92
|
>
|
|
188
|
-
|
|
93
|
+
{@render popup()}
|
|
189
94
|
</Popup>
|
|
190
95
|
{/if}
|
|
191
96
|
|
|
@@ -1,158 +1,17 @@
|
|
|
1
1
|
export default Button;
|
|
2
|
-
type Button = SvelteComponent
|
|
3
|
-
[x: string]: any;
|
|
4
|
-
class?: string | undefined;
|
|
5
|
-
name?: string | undefined;
|
|
6
|
-
disabled?: boolean | undefined;
|
|
7
|
-
label?: string | undefined;
|
|
8
|
-
size?: "small" | "medium" | "large" | undefined;
|
|
9
|
-
type?: "reset" | "submit" | "button" | undefined;
|
|
10
|
-
value?: string | undefined;
|
|
11
|
-
role?: string | undefined;
|
|
12
|
-
hidden?: boolean | undefined;
|
|
13
|
-
element?: HTMLButtonElement | undefined;
|
|
14
|
-
readonly?: boolean | undefined;
|
|
15
|
-
pressed?: boolean | "mixed" | undefined;
|
|
16
|
-
keyShortcuts?: string | undefined;
|
|
17
|
-
variant?: "link" | "primary" | "secondary" | "tertiary" | "ghost" | undefined;
|
|
18
|
-
iconic?: boolean | undefined;
|
|
19
|
-
pill?: boolean | undefined;
|
|
20
|
-
flex?: boolean | undefined;
|
|
21
|
-
popupPosition?: PopupPosition | undefined;
|
|
22
|
-
showPopupBackdrop?: boolean | undefined;
|
|
23
|
-
}, {
|
|
24
|
-
'start-icon': {};
|
|
25
|
-
default: {};
|
|
26
|
-
'end-icon': {};
|
|
27
|
-
popup: {};
|
|
28
|
-
}>, {
|
|
29
|
-
mouseenter: MouseEvent;
|
|
30
|
-
mouseleave: MouseEvent;
|
|
31
|
-
click: MouseEvent;
|
|
32
|
-
dblclick: MouseEvent;
|
|
33
|
-
dragover: DragEvent;
|
|
34
|
-
dragleave: DragEvent;
|
|
35
|
-
dragend: DragEvent;
|
|
36
|
-
drop: DragEvent;
|
|
37
|
-
keydown: KeyboardEvent;
|
|
38
|
-
keyup: KeyboardEvent;
|
|
39
|
-
keypress: KeyboardEvent;
|
|
40
|
-
focus: FocusEvent;
|
|
41
|
-
blur: FocusEvent;
|
|
42
|
-
toggle: Event;
|
|
43
|
-
select: CustomEvent<any>;
|
|
44
|
-
change: CustomEvent<any>;
|
|
45
|
-
} & {
|
|
2
|
+
type Button = SvelteComponent<ButtonProps & KeyboardEventHandlers & MouseEventHandlers & FocusEventHandlers & DragEventHandlers & Record<string, any>, {
|
|
46
3
|
[evt: string]: CustomEvent<any>;
|
|
47
|
-
}, {
|
|
48
|
-
|
|
49
|
-
default: {};
|
|
50
|
-
'end-icon': {};
|
|
51
|
-
popup: {};
|
|
52
|
-
}> & {
|
|
53
|
-
$$bindings?: string | undefined;
|
|
54
|
-
} & {
|
|
55
|
-
element: HTMLButtonElement | undefined;
|
|
56
|
-
class: string;
|
|
57
|
-
type: "reset" | "submit" | "button";
|
|
58
|
-
role: string;
|
|
59
|
-
name: string | undefined;
|
|
60
|
-
value: string | undefined;
|
|
61
|
-
hidden: boolean | undefined;
|
|
62
|
-
disabled: boolean;
|
|
63
|
-
readonly: boolean | undefined;
|
|
64
|
-
pressed: boolean | "mixed" | undefined;
|
|
65
|
-
keyShortcuts: string | undefined;
|
|
66
|
-
label: string;
|
|
67
|
-
variant: "link" | "primary" | "secondary" | "tertiary" | "ghost" | undefined;
|
|
68
|
-
size: "small" | "medium" | "large" | undefined;
|
|
69
|
-
iconic: boolean;
|
|
70
|
-
pill: boolean;
|
|
71
|
-
flex: boolean;
|
|
72
|
-
popupPosition: PopupPosition;
|
|
73
|
-
showPopupBackdrop: boolean;
|
|
4
|
+
}, {}> & {
|
|
5
|
+
$$bindings?: "element" | undefined;
|
|
74
6
|
};
|
|
75
7
|
/**
|
|
76
8
|
* A generic button widget based on the HTML `<button>` element.
|
|
77
9
|
* @see https://w3c.github.io/aria/#button
|
|
78
10
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/button/
|
|
79
11
|
*/
|
|
80
|
-
declare const Button: $$__sveltets_2_IsomorphicComponent
|
|
81
|
-
[x: string]: any;
|
|
82
|
-
class?: string | undefined;
|
|
83
|
-
name?: string | undefined;
|
|
84
|
-
disabled?: boolean | undefined;
|
|
85
|
-
label?: string | undefined;
|
|
86
|
-
size?: "small" | "medium" | "large" | undefined;
|
|
87
|
-
type?: "reset" | "submit" | "button" | undefined;
|
|
88
|
-
value?: string | undefined;
|
|
89
|
-
role?: string | undefined;
|
|
90
|
-
hidden?: boolean | undefined;
|
|
91
|
-
element?: HTMLButtonElement | undefined;
|
|
92
|
-
readonly?: boolean | undefined;
|
|
93
|
-
pressed?: boolean | "mixed" | undefined;
|
|
94
|
-
keyShortcuts?: string | undefined;
|
|
95
|
-
variant?: "primary" | "secondary" | "tertiary" | "ghost" | "link" | undefined;
|
|
96
|
-
iconic?: boolean | undefined;
|
|
97
|
-
pill?: boolean | undefined;
|
|
98
|
-
flex?: boolean | undefined;
|
|
99
|
-
popupPosition?: import("../../typedefs").PopupPosition | undefined;
|
|
100
|
-
showPopupBackdrop?: boolean | undefined;
|
|
101
|
-
}, {
|
|
102
|
-
'start-icon': {};
|
|
103
|
-
default: {};
|
|
104
|
-
'end-icon': {};
|
|
105
|
-
popup: {};
|
|
106
|
-
}>, {
|
|
107
|
-
mouseenter: MouseEvent;
|
|
108
|
-
mouseleave: MouseEvent;
|
|
109
|
-
click: MouseEvent;
|
|
110
|
-
dblclick: MouseEvent;
|
|
111
|
-
dragover: DragEvent;
|
|
112
|
-
dragleave: DragEvent;
|
|
113
|
-
dragend: DragEvent;
|
|
114
|
-
drop: DragEvent;
|
|
115
|
-
keydown: KeyboardEvent;
|
|
116
|
-
keyup: KeyboardEvent;
|
|
117
|
-
keypress: KeyboardEvent;
|
|
118
|
-
focus: FocusEvent;
|
|
119
|
-
blur: FocusEvent;
|
|
120
|
-
toggle: Event;
|
|
121
|
-
select: CustomEvent<any>;
|
|
122
|
-
change: CustomEvent<any>;
|
|
123
|
-
} & {
|
|
12
|
+
declare const Button: $$__sveltets_2_IsomorphicComponent<import("../../typedefs").ButtonProps & import("../../typedefs").KeyboardEventHandlers & import("../../typedefs").MouseEventHandlers & import("../../typedefs").FocusEventHandlers & import("../../typedefs").DragEventHandlers & Record<string, any>, {
|
|
124
13
|
[evt: string]: CustomEvent<any>;
|
|
125
|
-
}, {
|
|
126
|
-
'start-icon': {};
|
|
127
|
-
default: {};
|
|
128
|
-
'end-icon': {};
|
|
129
|
-
popup: {};
|
|
130
|
-
}, {
|
|
131
|
-
element: HTMLButtonElement | undefined;
|
|
132
|
-
class: string;
|
|
133
|
-
type: "reset" | "submit" | "button";
|
|
134
|
-
role: string;
|
|
135
|
-
name: string | undefined;
|
|
136
|
-
value: string | undefined;
|
|
137
|
-
hidden: boolean | undefined;
|
|
138
|
-
disabled: boolean;
|
|
139
|
-
readonly: boolean | undefined;
|
|
140
|
-
pressed: boolean | "mixed" | undefined;
|
|
141
|
-
keyShortcuts: string | undefined;
|
|
142
|
-
label: string;
|
|
143
|
-
variant: "link" | "primary" | "secondary" | "tertiary" | "ghost" | undefined;
|
|
144
|
-
size: "small" | "medium" | "large" | undefined;
|
|
145
|
-
iconic: boolean;
|
|
146
|
-
pill: boolean;
|
|
147
|
-
flex: boolean;
|
|
148
|
-
popupPosition: import("../../typedefs").PopupPosition;
|
|
149
|
-
showPopupBackdrop: boolean;
|
|
150
|
-
}, string>;
|
|
151
|
-
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
152
|
-
default: any;
|
|
153
|
-
} ? Props extends Record<string, never> ? any : {
|
|
154
|
-
children?: any;
|
|
155
|
-
} : {});
|
|
14
|
+
}, {}, {}, "element">;
|
|
156
15
|
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> {
|
|
157
16
|
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
158
17
|
$$bindings?: Bindings;
|
|
@@ -5,62 +5,56 @@
|
|
|
5
5
|
@see https://www.w3.org/WAI/ARIA/apg/patterns/radio/
|
|
6
6
|
-->
|
|
7
7
|
<script>
|
|
8
|
-
import {
|
|
9
|
-
import { activateGroup } from '../../services/group';
|
|
8
|
+
import { activateGroup } from '../../services/group.svelte';
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
|
-
*
|
|
13
|
-
* @
|
|
11
|
+
* @typedef {object} Props
|
|
12
|
+
* @property {string} [class] - The `class` attribute on the wrapper element.
|
|
13
|
+
* @property {boolean} [hidden] - Whether to hide the widget.
|
|
14
|
+
* @property {boolean} [disabled] - Whether to disable the widget. An alias of the `aria-disabled`
|
|
15
|
+
* attribute.
|
|
16
|
+
* @property {boolean} [readonly] - Whether to make the widget read-only. An alias of the
|
|
17
|
+
* `aria-readonly` attribute.
|
|
18
|
+
* @property {boolean} [required] - Whether to mark the widget required. An alias of the
|
|
19
|
+
* `aria-required` attribute.
|
|
20
|
+
* @property {boolean} [invalid] - Whether to mark the widget invalid. An alias of the
|
|
21
|
+
* `aria-invalid` attribute.
|
|
22
|
+
* @property {import('svelte').Snippet} [children] - Primary slot content.
|
|
23
|
+
* @property {(event: CustomEvent) => void} [onChange] - Custom `Change` event handler.
|
|
14
24
|
*/
|
|
15
|
-
|
|
16
|
-
export { className as class };
|
|
17
|
-
/**
|
|
18
|
-
* Whether to hide the widget.
|
|
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 make the widget read-only. An alias of the `aria-readonly` attribute.
|
|
29
|
-
* @type {boolean}
|
|
30
|
-
*/
|
|
31
|
-
export let readonly = false;
|
|
32
|
-
/**
|
|
33
|
-
* Whether to mark the widget required. An alias of the `aria-required` attribute.
|
|
34
|
-
* @type {boolean}
|
|
35
|
-
*/
|
|
36
|
-
export let required = false;
|
|
25
|
+
|
|
37
26
|
/**
|
|
38
|
-
*
|
|
39
|
-
* @type {boolean}
|
|
27
|
+
* @type {Props & Record<string, any>}
|
|
40
28
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
29
|
+
let {
|
|
30
|
+
/* eslint-disable prefer-const */
|
|
31
|
+
class: className,
|
|
32
|
+
hidden = false,
|
|
33
|
+
disabled = false,
|
|
34
|
+
readonly = false,
|
|
35
|
+
required = false,
|
|
36
|
+
invalid = false,
|
|
37
|
+
children,
|
|
38
|
+
...restProps
|
|
39
|
+
/* eslint-enable prefer-const */
|
|
40
|
+
} = $props();
|
|
44
41
|
</script>
|
|
45
42
|
|
|
46
43
|
<div
|
|
44
|
+
{...restProps}
|
|
47
45
|
role="radiogroup"
|
|
48
46
|
class="sui select-button-group {className}"
|
|
49
|
-
|
|
47
|
+
{hidden}
|
|
50
48
|
tabindex="-1"
|
|
51
49
|
aria-hidden={hidden}
|
|
52
50
|
aria-disabled={disabled}
|
|
53
51
|
aria-readonly={readonly}
|
|
54
52
|
aria-required={required}
|
|
55
53
|
aria-invalid={invalid}
|
|
56
|
-
{...$$restProps}
|
|
57
54
|
use:activateGroup
|
|
58
|
-
on:change={(/** @type {CustomEvent} */ event) => {
|
|
59
|
-
dispatch('change', event.detail);
|
|
60
|
-
}}
|
|
61
55
|
>
|
|
62
56
|
<div role="none" class="inner" inert={disabled}>
|
|
63
|
-
|
|
57
|
+
{@render children?.()}
|
|
64
58
|
</div>
|
|
65
59
|
</div>
|
|
66
60
|
|