@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
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
@see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/search
|
|
6
6
|
@see https://w3c.github.io/aria/#search
|
|
7
7
|
-->
|
|
8
|
-
<svelte:options accessors={true} />
|
|
9
8
|
|
|
10
9
|
<script>
|
|
11
10
|
import { generateElementId } from '@sveltia/utils/element';
|
|
@@ -15,61 +14,44 @@
|
|
|
15
14
|
import TextInput from './text-input.svelte';
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
|
-
*
|
|
19
|
-
* @
|
|
17
|
+
* @typedef {object} Props
|
|
18
|
+
* @property {import('svelte').Snippet} [searchIcon] - Search icon slot content.
|
|
19
|
+
* @property {import('svelte').Snippet} [closeIcon] - Close icon slot content.
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
export { className as class };
|
|
23
|
-
/**
|
|
24
|
-
* Make the text input container flexible.
|
|
25
|
-
* @type {boolean}
|
|
26
|
-
*/
|
|
27
|
-
export let flex = false;
|
|
28
|
-
/**
|
|
29
|
-
* Whether to hide the widget. An alias of the `aria-hidden` attribute.
|
|
30
|
-
* @type {boolean | undefined}
|
|
31
|
-
*/
|
|
32
|
-
export let hidden = undefined;
|
|
33
|
-
/**
|
|
34
|
-
* Whether to disable the widget. An alias of the `aria-disabled` attribute.
|
|
35
|
-
* @type {boolean}
|
|
36
|
-
*/
|
|
37
|
-
export let disabled = false;
|
|
38
|
-
/**
|
|
39
|
-
* Whether to disable the widget. An alias of `aria-readonly` attribute.
|
|
40
|
-
* @type {boolean}
|
|
41
|
-
*/
|
|
42
|
-
export let readonly = false;
|
|
43
|
-
/**
|
|
44
|
-
* Whether to mark the widget required. An alias of the `aria-required` attribute.
|
|
45
|
-
* @type {boolean}
|
|
46
|
-
*/
|
|
47
|
-
export let required = false;
|
|
48
|
-
/**
|
|
49
|
-
* Whether to mark the widget invalid. An alias of the `aria-invalid` attribute.
|
|
50
|
-
* @type {boolean}
|
|
51
|
-
*/
|
|
52
|
-
export let invalid = false;
|
|
21
|
+
|
|
53
22
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
23
|
+
* @type {import('../../typedefs').TextInputProps & import('../../typedefs').CommonEventHandlers &
|
|
24
|
+
* import('../../typedefs').InputEventHandlers & Props & Record<string, any>}
|
|
56
25
|
*/
|
|
57
|
-
|
|
26
|
+
let {
|
|
27
|
+
/* eslint-disable prefer-const */
|
|
28
|
+
value = $bindable(),
|
|
29
|
+
flex = false,
|
|
30
|
+
class: className,
|
|
31
|
+
hidden = false,
|
|
32
|
+
disabled = false,
|
|
33
|
+
readonly = false,
|
|
34
|
+
required = false,
|
|
35
|
+
invalid = false,
|
|
36
|
+
children,
|
|
37
|
+
searchIcon,
|
|
38
|
+
closeIcon,
|
|
39
|
+
...restProps
|
|
40
|
+
/* eslint-enable prefer-const */
|
|
41
|
+
} = $props();
|
|
58
42
|
|
|
59
43
|
const id = generateElementId('searchbox');
|
|
60
44
|
/**
|
|
61
|
-
* Reference to the
|
|
62
|
-
* @type {
|
|
45
|
+
* Reference to the `<input>` element.
|
|
46
|
+
* @type {HTMLInputElement | undefined}
|
|
63
47
|
*/
|
|
64
|
-
let
|
|
65
|
-
|
|
66
|
-
$: input = inputComponent?.element;
|
|
48
|
+
let inputElement = $state();
|
|
67
49
|
|
|
68
50
|
/**
|
|
69
51
|
* Move focus to the `<input>` element.
|
|
70
52
|
*/
|
|
71
53
|
export const focus = () => {
|
|
72
|
-
|
|
54
|
+
inputElement?.focus();
|
|
73
55
|
};
|
|
74
56
|
</script>
|
|
75
57
|
|
|
@@ -79,15 +61,19 @@
|
|
|
79
61
|
class:flex
|
|
80
62
|
class:disabled
|
|
81
63
|
class:readonly
|
|
82
|
-
|
|
64
|
+
{hidden}
|
|
83
65
|
aria-hidden={hidden}
|
|
84
66
|
>
|
|
85
67
|
<span role="none">
|
|
86
|
-
|
|
68
|
+
{#if searchIcon}
|
|
69
|
+
{@render searchIcon()}
|
|
70
|
+
{:else}
|
|
87
71
|
<Icon name="search" />
|
|
88
|
-
|
|
72
|
+
{/if}
|
|
89
73
|
</span>
|
|
90
74
|
<TextInput
|
|
75
|
+
bind:element={inputElement}
|
|
76
|
+
{...restProps}
|
|
91
77
|
role="searchbox"
|
|
92
78
|
{id}
|
|
93
79
|
bind:value
|
|
@@ -98,32 +84,29 @@
|
|
|
98
84
|
{required}
|
|
99
85
|
{invalid}
|
|
100
86
|
inputmode="search"
|
|
101
|
-
{...$$restProps}
|
|
102
|
-
bind:this={inputComponent}
|
|
103
|
-
on:keydown
|
|
104
|
-
on:keyup
|
|
105
|
-
on:keypress
|
|
106
|
-
on:input
|
|
107
|
-
on:change
|
|
108
87
|
/>
|
|
109
88
|
{#if value}
|
|
110
89
|
<Button
|
|
111
90
|
iconic
|
|
112
91
|
aria-label={$_('_sui.clear')}
|
|
113
92
|
aria-controls={id}
|
|
114
|
-
|
|
93
|
+
onclick={() => {
|
|
115
94
|
value = '';
|
|
116
|
-
|
|
95
|
+
inputElement?.focus();
|
|
117
96
|
globalThis.requestIdleCallback(() => {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
97
|
+
inputElement?.dispatchEvent(new KeyboardEvent('input'));
|
|
98
|
+
inputElement?.dispatchEvent(new KeyboardEvent('keypress'));
|
|
99
|
+
inputElement?.dispatchEvent(new KeyboardEvent('change'));
|
|
121
100
|
});
|
|
122
101
|
}}
|
|
123
102
|
>
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
103
|
+
{#snippet startIcon()}
|
|
104
|
+
{#if closeIcon}
|
|
105
|
+
{@render closeIcon()}
|
|
106
|
+
{:else}
|
|
107
|
+
<Icon name="close" />
|
|
108
|
+
{/if}
|
|
109
|
+
{/snippet}
|
|
127
110
|
</Button>
|
|
128
111
|
{/if}
|
|
129
112
|
</div>
|
|
@@ -1,39 +1,9 @@
|
|
|
1
1
|
export default SearchBar;
|
|
2
|
-
type SearchBar = SvelteComponent<{
|
|
3
|
-
[x: string]: any;
|
|
4
|
-
class?: string | undefined;
|
|
5
|
-
disabled?: boolean | undefined;
|
|
6
|
-
focus?: (() => void) | undefined;
|
|
7
|
-
invalid?: boolean | undefined;
|
|
8
|
-
required?: boolean | undefined;
|
|
9
|
-
value?: string | undefined;
|
|
10
|
-
hidden?: boolean | undefined;
|
|
11
|
-
readonly?: boolean | undefined;
|
|
12
|
-
flex?: boolean | undefined;
|
|
13
|
-
}, {
|
|
14
|
-
keydown: KeyboardEvent;
|
|
15
|
-
keyup: KeyboardEvent;
|
|
16
|
-
keypress: KeyboardEvent;
|
|
17
|
-
input: Event;
|
|
18
|
-
change: Event;
|
|
19
|
-
} & {
|
|
2
|
+
type SearchBar = SvelteComponent<TextInputProps & KeyboardEventHandlers & MouseEventHandlers & FocusEventHandlers & DragEventHandlers & InputEventHandlers & Props & Record<string, any>, {
|
|
20
3
|
[evt: string]: CustomEvent<any>;
|
|
21
|
-
}, {
|
|
22
|
-
|
|
23
|
-
'close-button': {
|
|
24
|
-
slot: string;
|
|
25
|
-
};
|
|
26
|
-
}> & {
|
|
27
|
-
$$bindings?: string | undefined;
|
|
4
|
+
}, {}> & {
|
|
5
|
+
$$bindings?: "value" | undefined;
|
|
28
6
|
} & {
|
|
29
|
-
class: string;
|
|
30
|
-
flex: boolean;
|
|
31
|
-
hidden: boolean | undefined;
|
|
32
|
-
disabled: boolean;
|
|
33
|
-
readonly: boolean;
|
|
34
|
-
required: boolean;
|
|
35
|
-
invalid: boolean;
|
|
36
|
-
value: string | undefined;
|
|
37
7
|
focus: () => void;
|
|
38
8
|
};
|
|
39
9
|
/**
|
|
@@ -42,41 +12,30 @@ type SearchBar = SvelteComponent<{
|
|
|
42
12
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/search
|
|
43
13
|
* @see https://w3c.github.io/aria/#search
|
|
44
14
|
*/
|
|
45
|
-
declare const SearchBar: $$__sveltets_2_IsomorphicComponent<{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
flex?: boolean | undefined;
|
|
56
|
-
}, {
|
|
57
|
-
keydown: KeyboardEvent;
|
|
58
|
-
keyup: KeyboardEvent;
|
|
59
|
-
keypress: KeyboardEvent;
|
|
60
|
-
input: Event;
|
|
61
|
-
change: Event;
|
|
62
|
-
} & {
|
|
15
|
+
declare const SearchBar: $$__sveltets_2_IsomorphicComponent<import("../../typedefs").TextInputProps & import("../../typedefs").KeyboardEventHandlers & import("../../typedefs").MouseEventHandlers & import("../../typedefs").FocusEventHandlers & import("../../typedefs").DragEventHandlers & import("../../typedefs").InputEventHandlers & {
|
|
16
|
+
/**
|
|
17
|
+
* - Search icon slot content.
|
|
18
|
+
*/
|
|
19
|
+
searchIcon?: import("svelte").Snippet<[]> | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* - Close icon slot content.
|
|
22
|
+
*/
|
|
23
|
+
closeIcon?: import("svelte").Snippet<[]> | undefined;
|
|
24
|
+
} & Record<string, any>, {
|
|
63
25
|
[evt: string]: CustomEvent<any>;
|
|
64
|
-
}, {
|
|
65
|
-
'search-icon': {};
|
|
66
|
-
'close-button': {
|
|
67
|
-
slot: string;
|
|
68
|
-
};
|
|
69
|
-
}, {
|
|
70
|
-
class: string;
|
|
71
|
-
flex: boolean;
|
|
72
|
-
hidden: boolean | undefined;
|
|
73
|
-
disabled: boolean;
|
|
74
|
-
readonly: boolean;
|
|
75
|
-
required: boolean;
|
|
76
|
-
invalid: boolean;
|
|
77
|
-
value: string | undefined;
|
|
26
|
+
}, {}, {
|
|
78
27
|
focus: () => void;
|
|
79
|
-
},
|
|
28
|
+
}, "value">;
|
|
29
|
+
type Props = {
|
|
30
|
+
/**
|
|
31
|
+
* - Search icon slot content.
|
|
32
|
+
*/
|
|
33
|
+
searchIcon?: import("svelte").Snippet<[]> | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* - Close icon slot content.
|
|
36
|
+
*/
|
|
37
|
+
closeIcon?: import("svelte").Snippet<[]> | undefined;
|
|
38
|
+
};
|
|
80
39
|
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> {
|
|
81
40
|
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
82
41
|
$$bindings?: Bindings;
|
|
@@ -7,56 +7,45 @@
|
|
|
7
7
|
-->
|
|
8
8
|
<script>
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
* @
|
|
10
|
+
* @typedef {object} Props
|
|
11
|
+
* @property {string | undefined} [value] - Input value.
|
|
12
|
+
* @property {boolean} [flex] - Make the text input container flexible.
|
|
13
|
+
* @property {string | undefined} [name] - The `name` attribute on the `<textarea>` element.
|
|
14
|
+
* @property {boolean} [autoResize] - Whether to automatically resize the `<textarea>` based on
|
|
15
|
+
* the content.
|
|
16
|
+
* @property {string} [class] - The `class` attribute on the wrapper element.
|
|
17
|
+
* @property {boolean} [hidden] - Whether to hide the widget.
|
|
18
|
+
* @property {boolean} [disabled] - Whether to disable the widget. An alias of the `aria-disabled`
|
|
19
|
+
* attribute.
|
|
20
|
+
* @property {boolean} [readonly] - Whether to make the widget read-only. An alias of the
|
|
21
|
+
* `aria-readonly` attribute.
|
|
22
|
+
* @property {boolean} [required] - Whether to mark the widget required. An alias of the
|
|
23
|
+
* `aria-required` attribute.
|
|
24
|
+
* @property {boolean} [invalid] - Whether to mark the widget invalid. An alias of the
|
|
25
|
+
* `aria-invalid` attribute.
|
|
26
|
+
* @property {import('svelte').Snippet} [children] - Primary slot content.
|
|
12
27
|
*/
|
|
13
|
-
|
|
14
|
-
export { className as class };
|
|
15
|
-
/**
|
|
16
|
-
* Make the text input container flexible.
|
|
17
|
-
* @type {boolean}
|
|
18
|
-
*/
|
|
19
|
-
export let flex = false;
|
|
20
|
-
/**
|
|
21
|
-
* Whether to hide the widget. An alias of the `aria-hidden` attribute.
|
|
22
|
-
* @type {boolean | undefined}
|
|
23
|
-
*/
|
|
24
|
-
export let hidden = undefined;
|
|
25
|
-
/**
|
|
26
|
-
* Whether to disable the widget. An alias of the `aria-disabled` attribute.
|
|
27
|
-
* @type {boolean}
|
|
28
|
-
*/
|
|
29
|
-
export let disabled = false;
|
|
30
|
-
/**
|
|
31
|
-
* Whether to disable the widget. An alias of `aria-readonly` attribute.
|
|
32
|
-
* @type {boolean}
|
|
33
|
-
*/
|
|
34
|
-
export let readonly = false;
|
|
35
|
-
/**
|
|
36
|
-
* Whether to mark the widget required. An alias of the `aria-required` attribute.
|
|
37
|
-
* @type {boolean}
|
|
38
|
-
*/
|
|
39
|
-
export let required = false;
|
|
40
|
-
/**
|
|
41
|
-
* Whether to mark the widget invalid. An alias of the `aria-invalid` attribute.
|
|
42
|
-
* @type {boolean}
|
|
43
|
-
*/
|
|
44
|
-
export let invalid = false;
|
|
45
|
-
/**
|
|
46
|
-
* The `name` attribute on the `<textarea>` element.
|
|
47
|
-
* @type {string | undefined}
|
|
48
|
-
*/
|
|
49
|
-
export let name = undefined;
|
|
50
|
-
/**
|
|
51
|
-
* Input value.
|
|
52
|
-
* @type {string | undefined}
|
|
53
|
-
*/
|
|
54
|
-
export let value = undefined;
|
|
28
|
+
|
|
55
29
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
30
|
+
* @type {import('../../typedefs').CommonEventHandlers & import('../../typedefs').InputEventHandlers
|
|
31
|
+
* & Props & Record<string, any>}
|
|
58
32
|
*/
|
|
59
|
-
|
|
33
|
+
let {
|
|
34
|
+
/* eslint-disable prefer-const */
|
|
35
|
+
value = $bindable(''),
|
|
36
|
+
flex = false,
|
|
37
|
+
name = undefined,
|
|
38
|
+
autoResize = false,
|
|
39
|
+
class: className,
|
|
40
|
+
hidden = false,
|
|
41
|
+
disabled = false,
|
|
42
|
+
readonly = false,
|
|
43
|
+
required = false,
|
|
44
|
+
invalid = false,
|
|
45
|
+
children,
|
|
46
|
+
...restProps
|
|
47
|
+
/* eslint-enable prefer-const */
|
|
48
|
+
} = $props();
|
|
60
49
|
</script>
|
|
61
50
|
|
|
62
51
|
<div
|
|
@@ -65,9 +54,10 @@
|
|
|
65
54
|
class:flex
|
|
66
55
|
class:disabled
|
|
67
56
|
class:readonly
|
|
68
|
-
|
|
57
|
+
{hidden}
|
|
69
58
|
>
|
|
70
59
|
<textarea
|
|
60
|
+
{...restProps}
|
|
71
61
|
{name}
|
|
72
62
|
bind:value
|
|
73
63
|
disabled={disabled || undefined}
|
|
@@ -77,13 +67,7 @@
|
|
|
77
67
|
aria-readonly={readonly}
|
|
78
68
|
aria-required={required}
|
|
79
69
|
aria-invalid={invalid}
|
|
80
|
-
{...$$restProps}
|
|
81
70
|
class:auto-resize={autoResize}
|
|
82
|
-
on:keydown
|
|
83
|
-
on:keyup
|
|
84
|
-
on:keypress
|
|
85
|
-
on:input
|
|
86
|
-
on:change
|
|
87
71
|
></textarea>
|
|
88
72
|
{#if autoResize}
|
|
89
73
|
<div class="clone" aria-hidden="true">{value ?? ''}</div>
|
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
export default TextArea;
|
|
2
|
-
type TextArea = SvelteComponent<{
|
|
3
|
-
[x: string]: any;
|
|
4
|
-
class?: string | undefined;
|
|
5
|
-
name?: string | undefined;
|
|
6
|
-
disabled?: boolean | undefined;
|
|
7
|
-
invalid?: boolean | undefined;
|
|
8
|
-
required?: boolean | undefined;
|
|
9
|
-
value?: string | undefined;
|
|
10
|
-
hidden?: boolean | undefined;
|
|
11
|
-
readonly?: boolean | undefined;
|
|
12
|
-
flex?: boolean | undefined;
|
|
13
|
-
autoResize?: boolean | undefined;
|
|
14
|
-
}, {
|
|
15
|
-
keydown: KeyboardEvent;
|
|
16
|
-
keyup: KeyboardEvent;
|
|
17
|
-
keypress: KeyboardEvent;
|
|
18
|
-
input: Event;
|
|
19
|
-
change: Event;
|
|
20
|
-
} & {
|
|
2
|
+
type TextArea = SvelteComponent<KeyboardEventHandlers & MouseEventHandlers & FocusEventHandlers & DragEventHandlers & InputEventHandlers & Props & Record<string, any>, {
|
|
21
3
|
[evt: string]: CustomEvent<any>;
|
|
22
4
|
}, {}> & {
|
|
23
|
-
$$bindings?:
|
|
5
|
+
$$bindings?: "value" | undefined;
|
|
24
6
|
};
|
|
25
7
|
/**
|
|
26
8
|
* A multi-line text field based on the HTML `<textarea>` element, providing the auto-resize support.
|
|
@@ -28,27 +10,110 @@ type TextArea = SvelteComponent<{
|
|
|
28
10
|
* @see https://w3c.github.io/aria/#textbox
|
|
29
11
|
* @see https://css-tricks.com/the-cleanest-trick-for-autogrowing-textareas/
|
|
30
12
|
*/
|
|
31
|
-
declare const TextArea: $$__sveltets_2_IsomorphicComponent<{
|
|
32
|
-
|
|
33
|
-
|
|
13
|
+
declare const TextArea: $$__sveltets_2_IsomorphicComponent<import("../../typedefs").KeyboardEventHandlers & import("../../typedefs").MouseEventHandlers & import("../../typedefs").FocusEventHandlers & import("../../typedefs").DragEventHandlers & import("../../typedefs").InputEventHandlers & {
|
|
14
|
+
/**
|
|
15
|
+
* - Input value.
|
|
16
|
+
*/
|
|
17
|
+
value?: string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* - Make the text input container flexible.
|
|
20
|
+
*/
|
|
21
|
+
flex?: boolean | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* - The `name` attribute on the `<textarea>` element.
|
|
24
|
+
*/
|
|
34
25
|
name?: string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* - Whether to automatically resize the `<textarea>` based on
|
|
28
|
+
* the content.
|
|
29
|
+
*/
|
|
30
|
+
autoResize?: boolean | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* - The `class` attribute on the wrapper element.
|
|
33
|
+
*/
|
|
34
|
+
class?: string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* - Whether to hide the widget.
|
|
37
|
+
*/
|
|
38
|
+
hidden?: boolean | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* - Whether to disable the widget. An alias of the `aria-disabled`
|
|
41
|
+
* attribute.
|
|
42
|
+
*/
|
|
35
43
|
disabled?: boolean | undefined;
|
|
36
|
-
|
|
44
|
+
/**
|
|
45
|
+
* - Whether to make the widget read-only. An alias of the
|
|
46
|
+
* `aria-readonly` attribute.
|
|
47
|
+
*/
|
|
48
|
+
readonly?: boolean | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* - Whether to mark the widget required. An alias of the
|
|
51
|
+
* `aria-required` attribute.
|
|
52
|
+
*/
|
|
37
53
|
required?: boolean | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* - Whether to mark the widget invalid. An alias of the
|
|
56
|
+
* `aria-invalid` attribute.
|
|
57
|
+
*/
|
|
58
|
+
invalid?: boolean | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* - Primary slot content.
|
|
61
|
+
*/
|
|
62
|
+
children?: import("svelte").Snippet<[]> | undefined;
|
|
63
|
+
} & Record<string, any>, {
|
|
64
|
+
[evt: string]: CustomEvent<any>;
|
|
65
|
+
}, {}, {}, "value">;
|
|
66
|
+
type Props = {
|
|
67
|
+
/**
|
|
68
|
+
* - Input value.
|
|
69
|
+
*/
|
|
38
70
|
value?: string | undefined;
|
|
39
|
-
|
|
40
|
-
|
|
71
|
+
/**
|
|
72
|
+
* - Make the text input container flexible.
|
|
73
|
+
*/
|
|
41
74
|
flex?: boolean | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* - The `name` attribute on the `<textarea>` element.
|
|
77
|
+
*/
|
|
78
|
+
name?: string | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* - Whether to automatically resize the `<textarea>` based on
|
|
81
|
+
* the content.
|
|
82
|
+
*/
|
|
42
83
|
autoResize?: boolean | undefined;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
84
|
+
/**
|
|
85
|
+
* - The `class` attribute on the wrapper element.
|
|
86
|
+
*/
|
|
87
|
+
class?: string | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* - Whether to hide the widget.
|
|
90
|
+
*/
|
|
91
|
+
hidden?: boolean | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* - Whether to disable the widget. An alias of the `aria-disabled`
|
|
94
|
+
* attribute.
|
|
95
|
+
*/
|
|
96
|
+
disabled?: boolean | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* - Whether to make the widget read-only. An alias of the
|
|
99
|
+
* `aria-readonly` attribute.
|
|
100
|
+
*/
|
|
101
|
+
readonly?: boolean | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* - Whether to mark the widget required. An alias of the
|
|
104
|
+
* `aria-required` attribute.
|
|
105
|
+
*/
|
|
106
|
+
required?: boolean | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* - Whether to mark the widget invalid. An alias of the
|
|
109
|
+
* `aria-invalid` attribute.
|
|
110
|
+
*/
|
|
111
|
+
invalid?: boolean | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* - Primary slot content.
|
|
114
|
+
*/
|
|
115
|
+
children?: import("svelte").Snippet<[]> | undefined;
|
|
116
|
+
};
|
|
52
117
|
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> {
|
|
53
118
|
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
54
119
|
$$bindings?: Bindings;
|
|
@@ -4,90 +4,37 @@
|
|
|
4
4
|
@see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/text
|
|
5
5
|
@see https://w3c.github.io/aria/#textbox
|
|
6
6
|
-->
|
|
7
|
-
<svelte:options accessors={true} />
|
|
8
|
-
|
|
9
7
|
<script>
|
|
10
8
|
import { generateElementId } from '@sveltia/utils/element';
|
|
11
|
-
import { activateKeyShortcuts } from '../../services/events';
|
|
9
|
+
import { activateKeyShortcuts } from '../../services/events.svelte';
|
|
12
10
|
|
|
13
11
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
export let element = undefined;
|
|
18
|
-
/**
|
|
19
|
-
* The `class` attribute on the wrapper element.
|
|
20
|
-
* @type {string}
|
|
21
|
-
*/
|
|
22
|
-
let className = '';
|
|
23
|
-
export { className as class };
|
|
24
|
-
/**
|
|
25
|
-
* Make the text input container flexible.
|
|
26
|
-
* @type {boolean}
|
|
27
|
-
*/
|
|
28
|
-
export let flex = false;
|
|
29
|
-
/**
|
|
30
|
-
* The `role` attribute on the `<input>` element.
|
|
31
|
-
* @type {'textbox' | 'searchbox' | 'combobox' | 'spinbutton'}
|
|
32
|
-
*/
|
|
33
|
-
export let role = 'textbox';
|
|
34
|
-
/**
|
|
35
|
-
* Whether to hide the widget. An alias of the `aria-hidden` attribute.
|
|
36
|
-
* @type {boolean | undefined}
|
|
37
|
-
*/
|
|
38
|
-
export let hidden = undefined;
|
|
39
|
-
/**
|
|
40
|
-
* Whether to disable the widget. An alias of the `aria-disabled` attribute.
|
|
41
|
-
* @type {boolean}
|
|
42
|
-
*/
|
|
43
|
-
export let disabled = false;
|
|
44
|
-
/**
|
|
45
|
-
* Whether to disable the widget. An alias of `aria-readonly` attribute.
|
|
46
|
-
* @type {boolean}
|
|
47
|
-
*/
|
|
48
|
-
export let readonly = false;
|
|
49
|
-
/**
|
|
50
|
-
* Whether to mark the widget required. An alias of the `aria-required` attribute.
|
|
51
|
-
* @type {boolean}
|
|
52
|
-
*/
|
|
53
|
-
export let required = false;
|
|
54
|
-
/**
|
|
55
|
-
* Whether to mark the widget invalid. An alias of the `aria-invalid` attribute.
|
|
56
|
-
* @type {boolean}
|
|
57
|
-
*/
|
|
58
|
-
export let invalid = false;
|
|
59
|
-
/**
|
|
60
|
-
* Keyboard shortcuts. An alias of the `aria-keyshortcuts` attribute. Accepts the special `Accel`
|
|
61
|
-
* key, which will be replaced with `Control` or `Meta` depending on the user’s operating system.
|
|
62
|
-
* @type {string | undefined}
|
|
63
|
-
*/
|
|
64
|
-
export let keyShortcuts = undefined;
|
|
65
|
-
/**
|
|
66
|
-
* The `name` attribute on the `<input>` element.
|
|
67
|
-
* @type {string | undefined}
|
|
68
|
-
*/
|
|
69
|
-
export let name = undefined;
|
|
70
|
-
/**
|
|
71
|
-
* Input value.
|
|
72
|
-
* @type {any} = string | number | undefined
|
|
73
|
-
*/
|
|
74
|
-
export let value = undefined;
|
|
75
|
-
/**
|
|
76
|
-
* Whether to display `aria-label` over the `<input>` element if it’s empty, just like how the
|
|
77
|
-
* HTML `placeholder` attribute works.
|
|
78
|
-
* @type {boolean}
|
|
79
|
-
*/
|
|
80
|
-
export let showInlineLabel = false;
|
|
81
|
-
/**
|
|
82
|
-
* The `inputmode` attribute on the `<input>`.
|
|
83
|
-
* @type {'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'}
|
|
84
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode
|
|
12
|
+
* @type {import('../../typedefs').TextInputProps & import('../../typedefs').CommonEventHandlers &
|
|
13
|
+
* import('../../typedefs').InputEventHandlers & Record<string, any>}
|
|
85
14
|
*/
|
|
86
|
-
|
|
15
|
+
let {
|
|
16
|
+
/* eslint-disable prefer-const */
|
|
17
|
+
value = $bindable(),
|
|
18
|
+
element = $bindable(),
|
|
19
|
+
role = 'textbox',
|
|
20
|
+
keyShortcuts = undefined,
|
|
21
|
+
name = undefined,
|
|
22
|
+
showInlineLabel = false,
|
|
23
|
+
inputmode = 'text',
|
|
24
|
+
flex = false,
|
|
25
|
+
class: className,
|
|
26
|
+
hidden = false,
|
|
27
|
+
disabled = false,
|
|
28
|
+
readonly = false,
|
|
29
|
+
required = false,
|
|
30
|
+
invalid = false,
|
|
31
|
+
'aria-label': ariaLabel,
|
|
32
|
+
children,
|
|
33
|
+
...restProps
|
|
34
|
+
/* eslint-enable prefer-const */
|
|
35
|
+
} = $props();
|
|
87
36
|
|
|
88
37
|
const id = generateElementId('input');
|
|
89
|
-
|
|
90
|
-
$: ariaLabel = $$restProps['aria-label'];
|
|
91
38
|
</script>
|
|
92
39
|
|
|
93
40
|
<div
|
|
@@ -96,9 +43,12 @@
|
|
|
96
43
|
class:flex
|
|
97
44
|
class:disabled
|
|
98
45
|
class:readonly
|
|
99
|
-
|
|
46
|
+
{hidden}
|
|
100
47
|
>
|
|
101
48
|
<input
|
|
49
|
+
bind:this={element}
|
|
50
|
+
{...restProps}
|
|
51
|
+
bind:value
|
|
102
52
|
type="text"
|
|
103
53
|
{role}
|
|
104
54
|
name={name || undefined}
|
|
@@ -111,14 +61,6 @@
|
|
|
111
61
|
aria-readonly={readonly}
|
|
112
62
|
aria-required={required}
|
|
113
63
|
aria-invalid={invalid}
|
|
114
|
-
{...$$restProps}
|
|
115
|
-
bind:this={element}
|
|
116
|
-
bind:value
|
|
117
|
-
on:keydown
|
|
118
|
-
on:keyup
|
|
119
|
-
on:keypress
|
|
120
|
-
on:input
|
|
121
|
-
on:change
|
|
122
64
|
use:activateKeyShortcuts={keyShortcuts}
|
|
123
65
|
/>
|
|
124
66
|
{#if ariaLabel && showInlineLabel}
|