@geoffcox/sterling-svelte 2.0.4 → 2.0.6
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/dist/Autocomplete.svelte +154 -0
- package/dist/Autocomplete.svelte.d.ts +4 -0
- package/dist/Autocomplete.types.d.ts +7 -0
- package/dist/Autocomplete.types.js +1 -0
- package/dist/Button.svelte +2 -4
- package/dist/Button.svelte.d.ts +1 -2
- package/dist/Button.types.d.ts +2 -0
- package/dist/Button.types.js +1 -0
- package/dist/Callout.svelte +2 -11
- package/dist/Callout.svelte.d.ts +2 -12
- package/dist/Checkbox.svelte +2 -4
- package/dist/Checkbox.svelte.d.ts +1 -2
- package/dist/Checkbox.types.d.ts +2 -0
- package/dist/Checkbox.types.js +1 -0
- package/dist/Dialog.svelte +4 -14
- package/dist/Dialog.svelte.d.ts +2 -12
- package/dist/Dialog.types.d.ts +11 -0
- package/dist/Dialog.types.js +1 -0
- package/dist/Dropdown.svelte +3 -20
- package/dist/Dropdown.svelte.d.ts +2 -17
- package/dist/Dropdown.types.d.ts +17 -0
- package/dist/Dropdown.types.js +1 -0
- package/dist/Input.svelte +2 -4
- package/dist/Input.svelte.d.ts +1 -2
- package/dist/Input.types.d.ts +2 -0
- package/dist/Input.types.js +1 -0
- package/dist/Label.svelte +111 -24
- package/dist/Label.svelte.d.ts +2 -11
- package/dist/Label.types.d.ts +18 -0
- package/dist/Label.types.js +1 -0
- package/dist/Link.svelte +2 -6
- package/dist/Link.svelte.d.ts +2 -5
- package/dist/Link.types.d.ts +4 -0
- package/dist/Link.types.js +1 -0
- package/dist/List.svelte +3 -10
- package/dist/List.svelte.d.ts +2 -8
- package/dist/List.types.d.ts +7 -0
- package/dist/ListItem.svelte +2 -7
- package/dist/ListItem.svelte.d.ts +2 -6
- package/dist/ListItem.types.d.ts +5 -0
- package/dist/ListItem.types.js +1 -0
- package/dist/Menu.svelte +2 -4
- package/dist/Menu.svelte.d.ts +2 -3
- package/dist/Menu.types.d.ts +2 -0
- package/dist/Menu.types.js +1 -0
- package/dist/MenuBar.svelte +2 -9
- package/dist/MenuBar.svelte.d.ts +2 -7
- package/dist/MenuBar.types.d.ts +6 -0
- package/dist/MenuButton.svelte +2 -12
- package/dist/MenuButton.svelte.d.ts +2 -14
- package/dist/MenuButton.types.d.ts +13 -0
- package/dist/MenuButton.types.js +1 -0
- package/dist/MenuItem.svelte +4 -21
- package/dist/MenuItem.svelte.d.ts +2 -16
- package/dist/MenuItem.types.d.ts +14 -0
- package/dist/MenuSeparator.svelte +2 -4
- package/dist/MenuSeparator.svelte.d.ts +2 -3
- package/dist/MenuSeparator.types.d.ts +2 -0
- package/dist/MenuSeparator.types.js +1 -0
- package/dist/Popover.svelte +3 -13
- package/dist/Popover.svelte.d.ts +2 -12
- package/dist/Popover.types.d.ts +10 -0
- package/dist/Progress.svelte +2 -10
- package/dist/Progress.svelte.d.ts +2 -9
- package/dist/Progress.types.d.ts +8 -0
- package/dist/Radio.svelte +2 -6
- package/dist/Radio.svelte.d.ts +2 -5
- package/dist/Radio.types.d.ts +4 -0
- package/dist/Radio.types.js +1 -0
- package/dist/Select.svelte +4 -23
- package/dist/Select.svelte.d.ts +2 -19
- package/dist/Select.types.d.ts +19 -0
- package/dist/Select.types.js +1 -0
- package/dist/Slider.svelte +3 -13
- package/dist/Slider.svelte.d.ts +2 -12
- package/dist/Slider.types.d.ts +11 -0
- package/dist/Slider.types.js +1 -0
- package/dist/Switch.svelte +2 -13
- package/dist/Switch.svelte.d.ts +2 -15
- package/dist/Switch.types.d.ts +14 -0
- package/dist/Switch.types.js +1 -0
- package/dist/Tab.svelte +2 -6
- package/dist/Tab.svelte.d.ts +2 -5
- package/dist/Tab.types.d.ts +4 -0
- package/dist/Tab.types.js +1 -0
- package/dist/TabList.svelte +3 -10
- package/dist/TabList.svelte.d.ts +2 -8
- package/dist/TabList.types.d.ts +7 -0
- package/dist/TextArea.svelte +4 -11
- package/dist/TextArea.svelte.d.ts +3 -10
- package/dist/TextArea.types.d.ts +7 -0
- package/dist/Tooltip.svelte +24 -16
- package/dist/Tooltip.svelte.d.ts +2 -8
- package/dist/Tooltip.types.d.ts +7 -0
- package/dist/Tooltip.types.js +1 -0
- package/dist/Tree.svelte +2 -11
- package/dist/Tree.svelte.d.ts +2 -9
- package/dist/Tree.types.d.ts +8 -0
- package/dist/TreeChevron.svelte +8 -8
- package/dist/TreeChevron.svelte.d.ts +2 -6
- package/dist/TreeChevron.types.d.ts +5 -0
- package/dist/TreeChevron.types.js +1 -0
- package/dist/TreeItem.svelte +4 -11
- package/dist/TreeItem.svelte.d.ts +2 -9
- package/dist/TreeItem.types.d.ts +8 -0
- package/dist/index.d.ts +32 -10
- package/dist/index.js +4 -3
- package/package.json +3 -2
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
const defaultFilter = (values: string[], text?: string): string[] => {
|
|
3
|
+
const filtered = values.filter((v) => !text || v.toLowerCase().includes(text.toLowerCase()));
|
|
4
|
+
|
|
5
|
+
if (filtered.length === 0) {
|
|
6
|
+
return values;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
return filtered;
|
|
10
|
+
};
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<script lang="ts">
|
|
14
|
+
import type {
|
|
15
|
+
ChangeEventHandler,
|
|
16
|
+
FocusEventHandler,
|
|
17
|
+
KeyboardEventHandler
|
|
18
|
+
} from 'svelte/elements';
|
|
19
|
+
import type { AutocompleteProps } from './Autocomplete.types';
|
|
20
|
+
import { List, Input, Popover, ListItem } from './';
|
|
21
|
+
|
|
22
|
+
const uuid = $props.id();
|
|
23
|
+
const popoverId = `Autocomplete-Popover-${uuid}`;
|
|
24
|
+
|
|
25
|
+
let {
|
|
26
|
+
filter = defaultFilter,
|
|
27
|
+
item,
|
|
28
|
+
value: inputValue = $bindable(),
|
|
29
|
+
values = [],
|
|
30
|
+
...rest
|
|
31
|
+
}: AutocompleteProps = $props();
|
|
32
|
+
|
|
33
|
+
let autocompleteDiv: HTMLDivElement | undefined = $state();
|
|
34
|
+
let contentDiv: HTMLDivElement | undefined = $state();
|
|
35
|
+
let list: List | undefined = $state();
|
|
36
|
+
|
|
37
|
+
let open = $state(false);
|
|
38
|
+
let filteredValues = $state(values);
|
|
39
|
+
let selectedListValue: string | undefined = $state();
|
|
40
|
+
|
|
41
|
+
// if the filters items do not include the selectedValue, clear it
|
|
42
|
+
$effect(() => {
|
|
43
|
+
if (selectedListValue && !filteredValues.includes(selectedListValue)) {
|
|
44
|
+
selectedListValue = undefined;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// if the filter, value, or inputValue changes, update the filteredValues
|
|
49
|
+
$effect(() => {
|
|
50
|
+
filteredValues = filter(values, inputValue);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const onFocus: FocusEventHandler<HTMLInputElement> = (event) => {
|
|
54
|
+
open = true;
|
|
55
|
+
event.stopPropagation();
|
|
56
|
+
rest.onfocus?.(event);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const onBlur: FocusEventHandler<HTMLInputElement> = (event) => {
|
|
60
|
+
const relatedNode = event.relatedTarget as Node;
|
|
61
|
+
if (!relatedNode || (contentDiv && !contentDiv.contains(relatedNode))) {
|
|
62
|
+
open = false;
|
|
63
|
+
}
|
|
64
|
+
rest.onblur?.(event);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const onInput: ChangeEventHandler<HTMLInputElement> = (event) => {
|
|
68
|
+
open = true;
|
|
69
|
+
filteredValues = filter(values, event.currentTarget.value);
|
|
70
|
+
rest.oninput?.(event);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const onKeydown: KeyboardEventHandler<HTMLInputElement> = (event) => {
|
|
74
|
+
if (!event.ctrlKey && !event.shiftKey && !event.altKey && !event.metaKey) {
|
|
75
|
+
switch (event.key) {
|
|
76
|
+
case ' ':
|
|
77
|
+
event.stopPropagation();
|
|
78
|
+
break;
|
|
79
|
+
case 'Escape':
|
|
80
|
+
open = false;
|
|
81
|
+
event.stopPropagation();
|
|
82
|
+
break;
|
|
83
|
+
case 'Enter':
|
|
84
|
+
if (selectedListValue) {
|
|
85
|
+
inputValue = selectedListValue;
|
|
86
|
+
open = false;
|
|
87
|
+
}
|
|
88
|
+
event.stopPropagation();
|
|
89
|
+
break;
|
|
90
|
+
case 'ArrowUp': {
|
|
91
|
+
if (!open) {
|
|
92
|
+
open = true;
|
|
93
|
+
filteredValues = values;
|
|
94
|
+
}
|
|
95
|
+
if (selectedListValue) {
|
|
96
|
+
list?.selectPreviousItem();
|
|
97
|
+
} else {
|
|
98
|
+
list?.selectLastItem();
|
|
99
|
+
}
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
event.stopPropagation();
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
case 'ArrowDown': {
|
|
105
|
+
if (!open) {
|
|
106
|
+
open = true;
|
|
107
|
+
filteredValues = values;
|
|
108
|
+
}
|
|
109
|
+
if (selectedListValue) {
|
|
110
|
+
list?.selectNextItem();
|
|
111
|
+
} else {
|
|
112
|
+
selectedListValue = undefined;
|
|
113
|
+
list?.selectFirstItem();
|
|
114
|
+
}
|
|
115
|
+
event.preventDefault();
|
|
116
|
+
event.stopPropagation();
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
rest.onkeydown?.(event);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const onListItemClick = (event: MouseEvent, value: string) => {
|
|
125
|
+
inputValue = value;
|
|
126
|
+
open = false;
|
|
127
|
+
};
|
|
128
|
+
</script>
|
|
129
|
+
|
|
130
|
+
<div class="sterling-autocomplete" bind:this={autocompleteDiv}>
|
|
131
|
+
<Input
|
|
132
|
+
bind:value={inputValue}
|
|
133
|
+
{...rest}
|
|
134
|
+
onkeydown={onKeydown}
|
|
135
|
+
oninput={onInput}
|
|
136
|
+
onfocus={onFocus}
|
|
137
|
+
onblur={onBlur}
|
|
138
|
+
/>
|
|
139
|
+
<Popover id={popoverId} {open} placement="bottom-start" reference={autocompleteDiv}>
|
|
140
|
+
<div bind:this={contentDiv} class="sterling-autocomplete-content">
|
|
141
|
+
<List bind:this={list} bind:selectedValue={selectedListValue} class="composed">
|
|
142
|
+
{#each filteredValues as itemValue}
|
|
143
|
+
<ListItem value={itemValue} onclick={(event) => onListItemClick(event, itemValue)}>
|
|
144
|
+
{#if item}
|
|
145
|
+
{@render item(itemValue)}
|
|
146
|
+
{:else}
|
|
147
|
+
{itemValue}
|
|
148
|
+
{/if}
|
|
149
|
+
</ListItem>
|
|
150
|
+
{/each}
|
|
151
|
+
</List>
|
|
152
|
+
</div>
|
|
153
|
+
</Popover>
|
|
154
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/Button.svelte
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
<svelte:options runes={true} />
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
|
-
import type {
|
|
4
|
+
import type { ButtonProps } from './Button.types';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
let { children, class: _class, ...rest }: Props = $props();
|
|
6
|
+
let { children, class: _class, ...rest }: ButtonProps = $props();
|
|
9
7
|
|
|
10
8
|
let buttonRef: HTMLButtonElement;
|
|
11
9
|
|
package/dist/Button.svelte.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
declare const Button: import("svelte").Component<HTMLButtonAttributes, {
|
|
1
|
+
declare const Button: import("svelte").Component<import("svelte/elements").HTMLButtonAttributes, {
|
|
3
2
|
click: () => void;
|
|
4
3
|
blur: () => void;
|
|
5
4
|
focus: (options?: FocusOptions) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/Callout.svelte
CHANGED
|
@@ -18,16 +18,7 @@
|
|
|
18
18
|
import type { PopoverPlacement } from './Popover.types';
|
|
19
19
|
import { STERLING_PORTAL_CONTEXT_ID, STERLING_PORTAL_HOST_ID } from './Portal.constants';
|
|
20
20
|
import type { PortalContext } from './Portal.types';
|
|
21
|
-
|
|
22
|
-
type Props = HTMLAttributes<HTMLDivElement> & {
|
|
23
|
-
conditionalRender?: boolean | null;
|
|
24
|
-
crossAxisOffset?: number;
|
|
25
|
-
mainAxisOffset?: number;
|
|
26
|
-
open?: boolean | null;
|
|
27
|
-
placement?: PopoverPlacement;
|
|
28
|
-
portalHost?: HTMLElement;
|
|
29
|
-
reference?: HTMLElement | null;
|
|
30
|
-
};
|
|
21
|
+
import type { CalloutProps } from './Callout.types';
|
|
31
22
|
|
|
32
23
|
let {
|
|
33
24
|
children,
|
|
@@ -40,7 +31,7 @@
|
|
|
40
31
|
reference,
|
|
41
32
|
class: _class,
|
|
42
33
|
...rest
|
|
43
|
-
}:
|
|
34
|
+
}: CalloutProps = $props();
|
|
44
35
|
|
|
45
36
|
let popupRef: HTMLDivElement | undefined = $state(undefined);
|
|
46
37
|
let arrowRef: HTMLDivElement | undefined = $state(undefined);
|
package/dist/Callout.svelte.d.ts
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
type Props = HTMLAttributes<HTMLDivElement> & {
|
|
4
|
-
conditionalRender?: boolean | null;
|
|
5
|
-
crossAxisOffset?: number;
|
|
6
|
-
mainAxisOffset?: number;
|
|
7
|
-
open?: boolean | null;
|
|
8
|
-
placement?: PopoverPlacement;
|
|
9
|
-
portalHost?: HTMLElement;
|
|
10
|
-
reference?: HTMLElement | null;
|
|
11
|
-
};
|
|
12
|
-
declare const Callout: import("svelte").Component<Props, {}, "conditionalRender" | "crossAxisOffset" | "mainAxisOffset" | "open" | "placement">;
|
|
1
|
+
import type { CalloutProps } from './Callout.types';
|
|
2
|
+
declare const Callout: import("svelte").Component<CalloutProps, {}, "conditionalRender" | "crossAxisOffset" | "mainAxisOffset" | "open" | "placement">;
|
|
13
3
|
type Callout = ReturnType<typeof Callout>;
|
|
14
4
|
export default Callout;
|
package/dist/Checkbox.svelte
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
<svelte:options runes={true} />
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
|
-
import type {
|
|
4
|
+
import type { CheckboxProps } from './Checkbox.types';
|
|
5
5
|
import { usingKeyboard } from './mediaQueries/usingKeyboard';
|
|
6
6
|
|
|
7
7
|
const uuid = $props.id();
|
|
8
8
|
|
|
9
|
-
type Props = HTMLInputAttributes;
|
|
10
|
-
|
|
11
9
|
let {
|
|
12
10
|
id,
|
|
13
11
|
children,
|
|
@@ -15,7 +13,7 @@
|
|
|
15
13
|
class: _class,
|
|
16
14
|
disabled = $bindable(false),
|
|
17
15
|
...rest
|
|
18
|
-
}:
|
|
16
|
+
}: CheckboxProps = $props();
|
|
19
17
|
|
|
20
18
|
let inputRef: HTMLInputElement;
|
|
21
19
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
1
|
/** A styled HTML input type=checkbox element. */
|
|
3
|
-
declare const Checkbox: import("svelte").Component<HTMLInputAttributes, {
|
|
2
|
+
declare const Checkbox: import("svelte").Component<import("svelte/elements").HTMLInputAttributes, {
|
|
4
3
|
blur: () => void;
|
|
5
4
|
click: () => void;
|
|
6
5
|
focus: (options?: FocusOptions) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/Dialog.svelte
CHANGED
|
@@ -1,25 +1,15 @@
|
|
|
1
1
|
<svelte:options runes={true} />
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
|
-
import { onMount, setContext, tick
|
|
5
|
-
import type { FormEventHandler
|
|
6
|
-
import { writable } from 'svelte/store';
|
|
4
|
+
import { onMount, setContext, tick } from 'svelte';
|
|
5
|
+
import type { FormEventHandler } from 'svelte/elements';
|
|
7
6
|
import Button from './Button.svelte';
|
|
8
7
|
import { STERLING_PORTAL_CONTEXT_ID } from './Portal.constants';
|
|
9
8
|
import type { PortalContext } from './Portal.types';
|
|
9
|
+
import type { DialogProps } from './Dialog.types';
|
|
10
10
|
|
|
11
11
|
const dialogFadeDuration = 250;
|
|
12
12
|
|
|
13
|
-
type Props = HTMLDialogAttributes & {
|
|
14
|
-
backdropCloses?: boolean | null | undefined;
|
|
15
|
-
body?: Snippet;
|
|
16
|
-
content?: Snippet;
|
|
17
|
-
footer?: Snippet;
|
|
18
|
-
header?: Snippet;
|
|
19
|
-
returnValue?: string;
|
|
20
|
-
headerTitle?: string | Snippet;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
13
|
let {
|
|
24
14
|
backdropCloses = false,
|
|
25
15
|
open = $bindable(false),
|
|
@@ -31,7 +21,7 @@
|
|
|
31
21
|
returnValue = $bindable(''),
|
|
32
22
|
headerTitle,
|
|
33
23
|
...rest
|
|
34
|
-
}:
|
|
24
|
+
}: DialogProps = $props();
|
|
35
25
|
|
|
36
26
|
let dialogRef: HTMLDialogElement;
|
|
37
27
|
let contentRef: HTMLDivElement;
|
package/dist/Dialog.svelte.d.ts
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type Props = HTMLDialogAttributes & {
|
|
4
|
-
backdropCloses?: boolean | null | undefined;
|
|
5
|
-
body?: Snippet;
|
|
6
|
-
content?: Snippet;
|
|
7
|
-
footer?: Snippet;
|
|
8
|
-
header?: Snippet;
|
|
9
|
-
returnValue?: string;
|
|
10
|
-
headerTitle?: string | Snippet;
|
|
11
|
-
};
|
|
12
|
-
declare const Dialog: import("svelte").Component<Props, {}, "open" | "returnValue">;
|
|
1
|
+
import type { DialogProps } from './Dialog.types';
|
|
2
|
+
declare const Dialog: import("svelte").Component<DialogProps, {}, "open" | "returnValue">;
|
|
13
3
|
type Dialog = ReturnType<typeof Dialog>;
|
|
14
4
|
export default Dialog;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLDialogAttributes } from 'svelte/elements';
|
|
3
|
+
export type DialogProps = HTMLDialogAttributes & {
|
|
4
|
+
backdropCloses?: boolean | null | undefined;
|
|
5
|
+
body?: Snippet;
|
|
6
|
+
content?: Snippet;
|
|
7
|
+
footer?: Snippet;
|
|
8
|
+
header?: Snippet;
|
|
9
|
+
returnValue?: string;
|
|
10
|
+
headerTitle?: string | Snippet;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/Dropdown.svelte
CHANGED
|
@@ -1,35 +1,18 @@
|
|
|
1
1
|
<svelte:options runes={true} />
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
|
-
import {
|
|
5
|
-
import type { HTMLAttributes, KeyboardEventHandler, MouseEventHandler } from 'svelte/elements';
|
|
4
|
+
import type { KeyboardEventHandler, MouseEventHandler } from 'svelte/elements';
|
|
6
5
|
import { slide, type SlideParams, type TransitionConfig } from 'svelte/transition';
|
|
7
6
|
import { clickOutside } from './actions/clickOutside';
|
|
8
7
|
import { prefersReducedMotion } from './mediaQueries/prefersReducedMotion';
|
|
9
8
|
import { usingKeyboard } from './mediaQueries/usingKeyboard';
|
|
10
9
|
import Popover from './Popover.svelte';
|
|
10
|
+
import type { DropdownProps } from './Dropdown.types';
|
|
11
11
|
|
|
12
12
|
const uuid = $props.id();
|
|
13
13
|
|
|
14
14
|
const popoverId = `Dropdown-Popover-${uuid}`;
|
|
15
15
|
|
|
16
|
-
type DeprecatedProps = {
|
|
17
|
-
/** @deprecated Use icon instead. */
|
|
18
|
-
button?: Snippet;
|
|
19
|
-
/** @deprecated Use icon instead. */
|
|
20
|
-
buttonIcon?: Snippet;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
type Props = HTMLAttributes<HTMLDivElement> &
|
|
24
|
-
DeprecatedProps & {
|
|
25
|
-
disabled?: boolean | null | undefined;
|
|
26
|
-
open?: boolean | null | undefined;
|
|
27
|
-
stayOpenOnClickAway?: boolean | null | undefined;
|
|
28
|
-
onOpen?: (open: boolean | null | undefined) => void;
|
|
29
|
-
icon?: Snippet;
|
|
30
|
-
value?: string | Snippet;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
16
|
let {
|
|
34
17
|
button,
|
|
35
18
|
buttonIcon,
|
|
@@ -42,7 +25,7 @@
|
|
|
42
25
|
stayOpenOnClickAway = false,
|
|
43
26
|
value,
|
|
44
27
|
...rest
|
|
45
|
-
}:
|
|
28
|
+
}: DropdownProps = $props();
|
|
46
29
|
|
|
47
30
|
icon = icon || buttonIcon || button;
|
|
48
31
|
|
|
@@ -1,20 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type DeprecatedProps = {
|
|
4
|
-
/** @deprecated Use icon instead. */
|
|
5
|
-
button?: Snippet;
|
|
6
|
-
/** @deprecated Use icon instead. */
|
|
7
|
-
buttonIcon?: Snippet;
|
|
8
|
-
};
|
|
9
|
-
type Props = HTMLAttributes<HTMLDivElement> & DeprecatedProps & {
|
|
10
|
-
disabled?: boolean | null | undefined;
|
|
11
|
-
open?: boolean | null | undefined;
|
|
12
|
-
stayOpenOnClickAway?: boolean | null | undefined;
|
|
13
|
-
onOpen?: (open: boolean | null | undefined) => void;
|
|
14
|
-
icon?: Snippet;
|
|
15
|
-
value?: string | Snippet;
|
|
16
|
-
};
|
|
17
|
-
declare const Dropdown: import("svelte").Component<Props, {
|
|
1
|
+
import type { DropdownProps } from './Dropdown.types';
|
|
2
|
+
declare const Dropdown: import("svelte").Component<DropdownProps, {
|
|
18
3
|
click: () => void;
|
|
19
4
|
blur: () => void;
|
|
20
5
|
focus: (options?: FocusOptions) => void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
type DeprecatedProps = {
|
|
4
|
+
/** @deprecated Use icon instead. */
|
|
5
|
+
button?: Snippet;
|
|
6
|
+
/** @deprecated Use icon instead. */
|
|
7
|
+
buttonIcon?: Snippet;
|
|
8
|
+
};
|
|
9
|
+
export type DropdownProps = HTMLAttributes<HTMLDivElement> & DeprecatedProps & {
|
|
10
|
+
disabled?: boolean | null | undefined;
|
|
11
|
+
open?: boolean | null | undefined;
|
|
12
|
+
stayOpenOnClickAway?: boolean | null | undefined;
|
|
13
|
+
onOpen?: (open: boolean | null | undefined) => void;
|
|
14
|
+
icon?: Snippet;
|
|
15
|
+
value?: string | Snippet;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/Input.svelte
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
<svelte:options runes={true} />
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
|
-
import type {
|
|
4
|
+
import type { InputProps } from './Input.types';
|
|
5
5
|
import { usingKeyboard } from './mediaQueries/usingKeyboard';
|
|
6
6
|
|
|
7
7
|
const uuid = $props.id();
|
|
8
8
|
|
|
9
|
-
type Props = HTMLInputAttributes;
|
|
10
|
-
|
|
11
9
|
let {
|
|
12
10
|
id,
|
|
13
11
|
children,
|
|
@@ -15,7 +13,7 @@
|
|
|
15
13
|
disabled = false,
|
|
16
14
|
value = $bindable(undefined),
|
|
17
15
|
...rest
|
|
18
|
-
}:
|
|
16
|
+
}: InputProps = $props();
|
|
19
17
|
|
|
20
18
|
let inputRef: HTMLInputElement;
|
|
21
19
|
|
package/dist/Input.svelte.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
declare const Input: import("svelte").Component<HTMLInputAttributes, {
|
|
1
|
+
declare const Input: import("svelte").Component<import("svelte/elements").HTMLInputAttributes, {
|
|
3
2
|
blur: () => void;
|
|
4
3
|
click: () => void;
|
|
5
4
|
focus: (options?: FocusOptions) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|