@geoffcox/sterling-svelte 0.0.21 → 0.0.23
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/Button.svelte +7 -0
- package/Button.svelte.d.ts +7 -0
- package/Checkbox.svelte +18 -20
- package/Checkbox.svelte.d.ts +6 -1
- package/Dropdown.svelte +8 -2
- package/Dropdown.svelte.d.ts +6 -0
- package/Field.svelte +9 -3
- package/Field.svelte.d.ts +7 -1
- package/Input.svelte +9 -2
- package/Input.svelte.d.ts +7 -0
- package/Label.svelte +6 -0
- package/Label.svelte.d.ts +6 -0
- package/Link.svelte +6 -0
- package/Link.svelte.d.ts +6 -0
- package/List.svelte +6 -3
- package/List.svelte.d.ts +6 -0
- package/ListItem.svelte +6 -0
- package/ListItem.svelte.d.ts +6 -0
- package/Menu.svelte +7 -1
- package/Menu.svelte.d.ts +6 -0
- package/MenuBar.svelte +6 -0
- package/MenuBar.svelte.d.ts +6 -0
- package/MenuButton.svelte +9 -3
- package/MenuButton.svelte.d.ts +6 -0
- package/MenuItem.svelte +8 -2
- package/MenuItem.svelte.d.ts +6 -0
- package/MenuSeparator.svelte +6 -0
- package/MenuSeparator.svelte.d.ts +12 -0
- package/Progress.svelte +6 -0
- package/Progress.svelte.d.ts +6 -0
- package/Radio.svelte +18 -20
- package/Radio.svelte.d.ts +6 -1
- package/Select.svelte +8 -2
- package/Select.svelte.d.ts +6 -0
- package/Slider.svelte +6 -0
- package/Slider.svelte.d.ts +6 -0
- package/Switch.svelte +9 -4
- package/Switch.svelte.d.ts +6 -1
- package/Tab.svelte +6 -0
- package/Tab.svelte.d.ts +6 -0
- package/TabList.svelte +6 -0
- package/TabList.svelte.d.ts +6 -0
- package/TextArea.svelte +7 -0
- package/TextArea.svelte.d.ts +7 -0
- package/Tooltip.svelte +0 -1
- package/Tree.svelte +6 -0
- package/Tree.svelte.d.ts +6 -0
- package/Tree.types.d.ts +0 -12
- package/TreeChevron.svelte +38 -1
- package/TreeChevron.svelte.d.ts +33 -0
- package/TreeItem.svelte +6 -0
- package/TreeItem.svelte.d.ts +6 -0
- package/TreeItem.types.d.ts +13 -0
- package/TreeItem.types.js +1 -0
- package/TreeItemDisplay.svelte +7 -0
- package/TreeItemDisplay.svelte.d.ts +6 -0
- package/idGenerator.d.ts +4 -0
- package/idGenerator.js +10 -0
- package/index.d.ts +3 -1
- package/index.js +2 -0
- package/package.json +10 -10
- package/theme/toggleDarkTheme.d.ts +1 -1
- package/theme/toggleDarkTheme.js +1 -1
package/Button.svelte
CHANGED
package/Button.svelte.d.ts
CHANGED
|
@@ -11,6 +11,13 @@ declare const __propDef: {
|
|
|
11
11
|
events: {
|
|
12
12
|
blur: FocusEvent;
|
|
13
13
|
click: MouseEvent;
|
|
14
|
+
drag: DragEvent;
|
|
15
|
+
dragend: DragEvent;
|
|
16
|
+
dragenter: DragEvent;
|
|
17
|
+
dragleave: DragEvent;
|
|
18
|
+
dragover: DragEvent;
|
|
19
|
+
dragstart: DragEvent;
|
|
20
|
+
drop: DragEvent;
|
|
14
21
|
dblclick: MouseEvent;
|
|
15
22
|
focus: FocusEvent;
|
|
16
23
|
focusin: FocusEvent;
|
package/Checkbox.svelte
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import {
|
|
1
|
+
<script>import { idGenerator } from "./idGenerator";
|
|
2
2
|
import Label from "./Label.svelte";
|
|
3
3
|
export let checked = false;
|
|
4
4
|
export let disabled = false;
|
|
@@ -6,7 +6,7 @@ export let id = void 0;
|
|
|
6
6
|
let inputRef;
|
|
7
7
|
$: {
|
|
8
8
|
if ($$slots.default && id === void 0) {
|
|
9
|
-
id =
|
|
9
|
+
id = idGenerator.nextId("Checkbox");
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
export const blur = () => {
|
|
@@ -35,6 +35,12 @@ export const focus = (options) => {
|
|
|
35
35
|
on:click
|
|
36
36
|
on:change
|
|
37
37
|
on:dblclick
|
|
38
|
+
on:dragend
|
|
39
|
+
on:dragenter
|
|
40
|
+
on:dragleave
|
|
41
|
+
on:dragover
|
|
42
|
+
on:dragstart
|
|
43
|
+
on:drop
|
|
38
44
|
on:focus
|
|
39
45
|
on:focusin
|
|
40
46
|
on:focusout
|
|
@@ -49,7 +55,6 @@ export const focus = (options) => {
|
|
|
49
55
|
on:mouseover
|
|
50
56
|
on:mouseout
|
|
51
57
|
on:mouseup
|
|
52
|
-
on:toggle
|
|
53
58
|
on:wheel
|
|
54
59
|
bind:checked
|
|
55
60
|
{...$$restProps}
|
|
@@ -57,27 +62,24 @@ export const focus = (options) => {
|
|
|
57
62
|
<div class="indicator" />
|
|
58
63
|
</div>
|
|
59
64
|
{#if $$slots.default}
|
|
60
|
-
<
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
</Label>
|
|
66
|
-
</div>
|
|
65
|
+
<Label {disabled} for={id}>
|
|
66
|
+
<slot {checked} {disabled} inputId={id} value={$$restProps.value}>
|
|
67
|
+
{$$restProps.value}
|
|
68
|
+
</slot>
|
|
69
|
+
</Label>
|
|
67
70
|
{/if}
|
|
68
71
|
</div>
|
|
69
72
|
|
|
70
73
|
<style>
|
|
71
74
|
.sterling-checkbox {
|
|
72
|
-
|
|
73
|
-
align-
|
|
74
|
-
align-items: stretch;
|
|
75
|
+
align-content: center;
|
|
76
|
+
align-items: center;
|
|
75
77
|
box-sizing: border-box;
|
|
78
|
+
display: inline-flex;
|
|
76
79
|
font: inherit;
|
|
77
|
-
|
|
80
|
+
margin: 0;
|
|
78
81
|
outline: none;
|
|
79
82
|
padding: 0;
|
|
80
|
-
margin: 0;
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
/*
|
|
@@ -91,6 +93,7 @@ export const focus = (options) => {
|
|
|
91
93
|
position: relative;
|
|
92
94
|
display: grid;
|
|
93
95
|
align-items: center;
|
|
96
|
+
margin-right: 0.25em;
|
|
94
97
|
}
|
|
95
98
|
|
|
96
99
|
/*
|
|
@@ -166,11 +169,6 @@ export const focus = (options) => {
|
|
|
166
169
|
border-color: var(--stsv-Common__color--disabled);
|
|
167
170
|
}
|
|
168
171
|
|
|
169
|
-
.label {
|
|
170
|
-
user-select: none;
|
|
171
|
-
margin-top: 0.25em;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
172
|
@media (prefers-reduced-motion) {
|
|
175
173
|
.indicator,
|
|
176
174
|
input:checked + .indicator::after {
|
package/Checkbox.svelte.d.ts
CHANGED
|
@@ -14,6 +14,12 @@ declare const __propDef: {
|
|
|
14
14
|
click: MouseEvent;
|
|
15
15
|
change: Event;
|
|
16
16
|
dblclick: MouseEvent;
|
|
17
|
+
dragend: DragEvent;
|
|
18
|
+
dragenter: DragEvent;
|
|
19
|
+
dragleave: DragEvent;
|
|
20
|
+
dragover: DragEvent;
|
|
21
|
+
dragstart: DragEvent;
|
|
22
|
+
drop: DragEvent;
|
|
17
23
|
focus: FocusEvent;
|
|
18
24
|
focusin: FocusEvent;
|
|
19
25
|
focusout: FocusEvent;
|
|
@@ -28,7 +34,6 @@ declare const __propDef: {
|
|
|
28
34
|
mouseover: MouseEvent;
|
|
29
35
|
mouseout: MouseEvent;
|
|
30
36
|
mouseup: MouseEvent;
|
|
31
|
-
toggle: Event;
|
|
32
37
|
wheel: WheelEvent;
|
|
33
38
|
} & {
|
|
34
39
|
[evt: string]: CustomEvent<any>;
|
package/Dropdown.svelte
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script>import { computePosition, flip, offset, shift, autoUpdate } from "@floating-ui/dom";
|
|
2
2
|
import { createEventDispatcher, onMount, tick } from "svelte";
|
|
3
|
-
import { v4 as uuid } from "uuid";
|
|
4
3
|
import { clickOutside } from "./actions/clickOutside";
|
|
5
|
-
|
|
4
|
+
import { idGenerator } from "./idGenerator";
|
|
5
|
+
const popupId = idGenerator.nextId("Dropdown-popup");
|
|
6
6
|
export let composed = false;
|
|
7
7
|
export let disabled = false;
|
|
8
8
|
export let open = false;
|
|
@@ -88,6 +88,12 @@ const onClickOutside = (event) => {
|
|
|
88
88
|
on:copy
|
|
89
89
|
on:cut
|
|
90
90
|
on:dblclick
|
|
91
|
+
on:dragend
|
|
92
|
+
on:dragenter
|
|
93
|
+
on:dragleave
|
|
94
|
+
on:dragover
|
|
95
|
+
on:dragstart
|
|
96
|
+
on:drop
|
|
91
97
|
on:focus
|
|
92
98
|
on:focusin
|
|
93
99
|
on:focusout
|
package/Dropdown.svelte.d.ts
CHANGED
|
@@ -16,6 +16,12 @@ declare const __propDef: {
|
|
|
16
16
|
copy: ClipboardEvent;
|
|
17
17
|
cut: ClipboardEvent;
|
|
18
18
|
dblclick: MouseEvent;
|
|
19
|
+
dragend: DragEvent;
|
|
20
|
+
dragenter: DragEvent;
|
|
21
|
+
dragleave: DragEvent;
|
|
22
|
+
dragover: DragEvent;
|
|
23
|
+
dragstart: DragEvent;
|
|
24
|
+
drop: DragEvent;
|
|
19
25
|
focus: FocusEvent;
|
|
20
26
|
focusin: FocusEvent;
|
|
21
27
|
focusout: FocusEvent;
|
package/Field.svelte
CHANGED
|
@@ -7,7 +7,7 @@ export { htmlFor as for };
|
|
|
7
7
|
export let label = void 0;
|
|
8
8
|
export let message = void 0;
|
|
9
9
|
export let required = false;
|
|
10
|
-
export let
|
|
10
|
+
export let requiredReason = "This field is required";
|
|
11
11
|
export let status = "none";
|
|
12
12
|
let fieldRef;
|
|
13
13
|
let targetDisabled = false;
|
|
@@ -102,6 +102,12 @@ const onClick = () => {
|
|
|
102
102
|
on:copy
|
|
103
103
|
on:cut
|
|
104
104
|
on:dblclick
|
|
105
|
+
on:dragend
|
|
106
|
+
on:dragenter
|
|
107
|
+
on:dragleave
|
|
108
|
+
on:dragover
|
|
109
|
+
on:dragstart
|
|
110
|
+
on:drop
|
|
105
111
|
on:focus
|
|
106
112
|
on:focusin
|
|
107
113
|
on:focusout
|
|
@@ -146,9 +152,9 @@ const onClick = () => {
|
|
|
146
152
|
</slot>
|
|
147
153
|
{/if}
|
|
148
154
|
{#if required}
|
|
149
|
-
<slot name="required" {
|
|
155
|
+
<slot name="required" requiredTip={requiredReason}>
|
|
150
156
|
<Tooltip showOn="hover">
|
|
151
|
-
<span class="required-tip" slot="tip">{
|
|
157
|
+
<span class="required-tip" slot="tip">{requiredReason}</span>
|
|
152
158
|
<div class="required">*</div>
|
|
153
159
|
</Tooltip>
|
|
154
160
|
</slot>
|
package/Field.svelte.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ declare const __propDef: {
|
|
|
7
7
|
label?: string | undefined;
|
|
8
8
|
message?: string | undefined;
|
|
9
9
|
required?: boolean | undefined;
|
|
10
|
-
|
|
10
|
+
requiredReason?: string | undefined;
|
|
11
11
|
status?: string | undefined;
|
|
12
12
|
click?: (() => void) | undefined;
|
|
13
13
|
blur?: (() => void) | undefined;
|
|
@@ -19,6 +19,12 @@ declare const __propDef: {
|
|
|
19
19
|
copy: ClipboardEvent;
|
|
20
20
|
cut: ClipboardEvent;
|
|
21
21
|
dblclick: MouseEvent;
|
|
22
|
+
dragend: DragEvent;
|
|
23
|
+
dragenter: DragEvent;
|
|
24
|
+
dragleave: DragEvent;
|
|
25
|
+
dragover: DragEvent;
|
|
26
|
+
dragstart: DragEvent;
|
|
27
|
+
drop: DragEvent;
|
|
22
28
|
focus: FocusEvent;
|
|
23
29
|
focusin: FocusEvent;
|
|
24
30
|
focusout: FocusEvent;
|
package/Input.svelte
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import {
|
|
1
|
+
<script>import { idGenerator } from "./idGenerator";
|
|
2
2
|
import Label from "./Label.svelte";
|
|
3
3
|
export let composed = false;
|
|
4
4
|
export let disabled = false;
|
|
@@ -7,7 +7,7 @@ export let value = "";
|
|
|
7
7
|
let inputRef;
|
|
8
8
|
$: {
|
|
9
9
|
if ($$slots.default && id === void 0) {
|
|
10
|
-
id =
|
|
10
|
+
id = idGenerator.nextId("Input");
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
export const blur = () => {
|
|
@@ -46,6 +46,7 @@ export const setRangeText = (replacement, start, end, selectionMode) => {
|
|
|
46
46
|
{disabled}
|
|
47
47
|
{id}
|
|
48
48
|
bind:value
|
|
49
|
+
on:beforeinput
|
|
49
50
|
on:blur
|
|
50
51
|
on:click
|
|
51
52
|
on:change
|
|
@@ -53,6 +54,12 @@ export const setRangeText = (replacement, start, end, selectionMode) => {
|
|
|
53
54
|
on:cut
|
|
54
55
|
on:paste
|
|
55
56
|
on:dblclick
|
|
57
|
+
on:dragend
|
|
58
|
+
on:dragenter
|
|
59
|
+
on:dragleave
|
|
60
|
+
on:dragover
|
|
61
|
+
on:dragstart
|
|
62
|
+
on:drop
|
|
56
63
|
on:focus
|
|
57
64
|
on:focusin
|
|
58
65
|
on:focusout
|
package/Input.svelte.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ declare const __propDef: {
|
|
|
14
14
|
setRangeText?: ((replacement: string, start?: number, end?: number, selectionMode?: SelectionMode) => void) | undefined;
|
|
15
15
|
};
|
|
16
16
|
events: {
|
|
17
|
+
beforeinput: InputEvent;
|
|
17
18
|
blur: FocusEvent;
|
|
18
19
|
click: MouseEvent;
|
|
19
20
|
change: Event;
|
|
@@ -21,6 +22,12 @@ declare const __propDef: {
|
|
|
21
22
|
cut: ClipboardEvent;
|
|
22
23
|
paste: ClipboardEvent;
|
|
23
24
|
dblclick: MouseEvent;
|
|
25
|
+
dragend: DragEvent;
|
|
26
|
+
dragenter: DragEvent;
|
|
27
|
+
dragleave: DragEvent;
|
|
28
|
+
dragover: DragEvent;
|
|
29
|
+
dragstart: DragEvent;
|
|
30
|
+
drop: DragEvent;
|
|
24
31
|
focus: FocusEvent;
|
|
25
32
|
focusin: FocusEvent;
|
|
26
33
|
focusout: FocusEvent;
|
package/Label.svelte
CHANGED
package/Label.svelte.d.ts
CHANGED
|
@@ -13,6 +13,12 @@ declare const __propDef: {
|
|
|
13
13
|
copy: ClipboardEvent;
|
|
14
14
|
cut: ClipboardEvent;
|
|
15
15
|
dblclick: MouseEvent;
|
|
16
|
+
dragend: DragEvent;
|
|
17
|
+
dragenter: DragEvent;
|
|
18
|
+
dragleave: DragEvent;
|
|
19
|
+
dragover: DragEvent;
|
|
20
|
+
dragstart: DragEvent;
|
|
21
|
+
drop: DragEvent;
|
|
16
22
|
focus: FocusEvent;
|
|
17
23
|
focusin: FocusEvent;
|
|
18
24
|
focusout: FocusEvent;
|
package/Link.svelte
CHANGED
package/Link.svelte.d.ts
CHANGED
|
@@ -13,6 +13,12 @@ declare const __propDef: {
|
|
|
13
13
|
blur: FocusEvent;
|
|
14
14
|
click: MouseEvent;
|
|
15
15
|
dblclick: MouseEvent;
|
|
16
|
+
dragend: DragEvent;
|
|
17
|
+
dragenter: DragEvent;
|
|
18
|
+
dragleave: DragEvent;
|
|
19
|
+
dragover: DragEvent;
|
|
20
|
+
dragstart: DragEvent;
|
|
21
|
+
drop: DragEvent;
|
|
16
22
|
focus: FocusEvent;
|
|
17
23
|
focusin: FocusEvent;
|
|
18
24
|
focusout: FocusEvent;
|
package/List.svelte
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
<script>import { createKeyborg } from "keyborg";
|
|
2
2
|
import { createEventDispatcher, onMount, setContext } from "svelte";
|
|
3
3
|
import { writable } from "svelte/store";
|
|
4
|
-
import { v4 as uuid } from "uuid";
|
|
5
4
|
import { LIST_CONTEXT_KEY } from "./List.constants";
|
|
6
5
|
export let composed = false;
|
|
7
6
|
export let disabled = false;
|
|
8
7
|
export let horizontal = false;
|
|
9
8
|
export let selectedValue = void 0;
|
|
10
|
-
const listId = `list-${uuid()}`;
|
|
11
9
|
let listRef;
|
|
12
10
|
let lastSelectedItemRef;
|
|
13
11
|
const disabledStore = writable(disabled);
|
|
@@ -200,7 +198,6 @@ A list of items where a single item can be selected.
|
|
|
200
198
|
class:disabled
|
|
201
199
|
class:horizontal
|
|
202
200
|
class:using-keyboard={usingKeyboard}
|
|
203
|
-
id={listId}
|
|
204
201
|
role="list"
|
|
205
202
|
tabindex={0}
|
|
206
203
|
on:blur
|
|
@@ -209,6 +206,12 @@ A list of items where a single item can be selected.
|
|
|
209
206
|
on:copy
|
|
210
207
|
on:cut
|
|
211
208
|
on:dblclick
|
|
209
|
+
on:dragend
|
|
210
|
+
on:dragenter
|
|
211
|
+
on:dragleave
|
|
212
|
+
on:dragover
|
|
213
|
+
on:dragstart
|
|
214
|
+
on:drop
|
|
212
215
|
on:focus
|
|
213
216
|
on:focusin
|
|
214
217
|
on:focusout
|
package/List.svelte.d.ts
CHANGED
|
@@ -21,6 +21,12 @@ declare const __propDef: {
|
|
|
21
21
|
copy: ClipboardEvent;
|
|
22
22
|
cut: ClipboardEvent;
|
|
23
23
|
dblclick: MouseEvent;
|
|
24
|
+
dragend: DragEvent;
|
|
25
|
+
dragenter: DragEvent;
|
|
26
|
+
dragleave: DragEvent;
|
|
27
|
+
dragover: DragEvent;
|
|
28
|
+
dragstart: DragEvent;
|
|
29
|
+
drop: DragEvent;
|
|
24
30
|
focus: FocusEvent;
|
|
25
31
|
focusin: FocusEvent;
|
|
26
32
|
focusout: FocusEvent;
|
package/ListItem.svelte
CHANGED
package/ListItem.svelte.d.ts
CHANGED
|
@@ -12,6 +12,12 @@ declare const __propDef: {
|
|
|
12
12
|
blur: FocusEvent;
|
|
13
13
|
click: MouseEvent;
|
|
14
14
|
dblclick: MouseEvent;
|
|
15
|
+
dragend: DragEvent;
|
|
16
|
+
dragenter: DragEvent;
|
|
17
|
+
dragleave: DragEvent;
|
|
18
|
+
dragover: DragEvent;
|
|
19
|
+
dragstart: DragEvent;
|
|
20
|
+
drop: DragEvent;
|
|
15
21
|
focus: FocusEvent;
|
|
16
22
|
focusin: FocusEvent;
|
|
17
23
|
focusout: FocusEvent;
|
package/Menu.svelte
CHANGED
|
@@ -80,6 +80,12 @@ onMount(() => {
|
|
|
80
80
|
on:copy
|
|
81
81
|
on:cut
|
|
82
82
|
on:dblclick
|
|
83
|
+
on:dragend
|
|
84
|
+
on:dragenter
|
|
85
|
+
on:dragleave
|
|
86
|
+
on:dragover
|
|
87
|
+
on:dragstart
|
|
88
|
+
on:drop
|
|
83
89
|
on:focus
|
|
84
90
|
on:focusin
|
|
85
91
|
on:focusout
|
|
@@ -127,7 +133,7 @@ onMount(() => {
|
|
|
127
133
|
height: fit-content;
|
|
128
134
|
left: 0;
|
|
129
135
|
max-height: calc(50vh);
|
|
130
|
-
overflow:
|
|
136
|
+
overflow: auto;
|
|
131
137
|
overscroll-behavior: contain;
|
|
132
138
|
padding: 0.25em;
|
|
133
139
|
position: absolute;
|
package/Menu.svelte.d.ts
CHANGED
|
@@ -13,6 +13,12 @@ declare const __propDef: {
|
|
|
13
13
|
copy: ClipboardEvent;
|
|
14
14
|
cut: ClipboardEvent;
|
|
15
15
|
dblclick: MouseEvent;
|
|
16
|
+
dragend: DragEvent;
|
|
17
|
+
dragenter: DragEvent;
|
|
18
|
+
dragleave: DragEvent;
|
|
19
|
+
dragover: DragEvent;
|
|
20
|
+
dragstart: DragEvent;
|
|
21
|
+
drop: DragEvent;
|
|
16
22
|
focus: FocusEvent;
|
|
17
23
|
focusin: FocusEvent;
|
|
18
24
|
focusout: FocusEvent;
|
package/MenuBar.svelte
CHANGED
package/MenuBar.svelte.d.ts
CHANGED
|
@@ -11,6 +11,12 @@ declare const __propDef: {
|
|
|
11
11
|
copy: ClipboardEvent;
|
|
12
12
|
cut: ClipboardEvent;
|
|
13
13
|
dblclick: MouseEvent;
|
|
14
|
+
dragend: DragEvent;
|
|
15
|
+
dragenter: DragEvent;
|
|
16
|
+
dragleave: DragEvent;
|
|
17
|
+
dragover: DragEvent;
|
|
18
|
+
dragstart: DragEvent;
|
|
19
|
+
drop: DragEvent;
|
|
14
20
|
focus: FocusEvent;
|
|
15
21
|
focusin: FocusEvent;
|
|
16
22
|
focusout: FocusEvent;
|
package/MenuButton.svelte
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
import { createEventDispatcher, getContext, setContext } from "svelte";
|
|
1
|
+
<script>import { createEventDispatcher, getContext, setContext } from "svelte";
|
|
3
2
|
import { writable } from "svelte/store";
|
|
4
3
|
import Button from "./Button.svelte";
|
|
5
4
|
import Menu from "./Menu.svelte";
|
|
6
5
|
import { MENU_ITEM_CONTEXT_KEY } from "./MenuItem.constants";
|
|
7
6
|
import { focusFirstChild, focusNextChild, focusPreviousChild } from "./MenuItem.utils";
|
|
7
|
+
import { idGenerator } from "./idGenerator";
|
|
8
8
|
export let open = false;
|
|
9
9
|
export let shape = "rounded";
|
|
10
10
|
export let value;
|
|
11
11
|
export let variant = "regular";
|
|
12
|
-
const instanceId =
|
|
12
|
+
const instanceId = idGenerator.nextId("MenuButton");
|
|
13
13
|
let buttonRef;
|
|
14
14
|
let reference;
|
|
15
15
|
let prevOpen = open;
|
|
@@ -87,6 +87,12 @@ setContext(MENU_ITEM_CONTEXT_KEY, {
|
|
|
87
87
|
on:click
|
|
88
88
|
on:click={onClick}
|
|
89
89
|
on:dblclick
|
|
90
|
+
on:dragend
|
|
91
|
+
on:dragenter
|
|
92
|
+
on:dragleave
|
|
93
|
+
on:dragover
|
|
94
|
+
on:dragstart
|
|
95
|
+
on:drop
|
|
90
96
|
on:focus
|
|
91
97
|
on:focusin
|
|
92
98
|
on:focusout
|
package/MenuButton.svelte.d.ts
CHANGED
|
@@ -14,6 +14,12 @@ declare const __propDef: {
|
|
|
14
14
|
blur: FocusEvent;
|
|
15
15
|
click: MouseEvent;
|
|
16
16
|
dblclick: MouseEvent;
|
|
17
|
+
dragend: DragEvent;
|
|
18
|
+
dragenter: DragEvent;
|
|
19
|
+
dragleave: DragEvent;
|
|
20
|
+
dragover: DragEvent;
|
|
21
|
+
dragstart: DragEvent;
|
|
22
|
+
drop: DragEvent;
|
|
17
23
|
focus: FocusEvent;
|
|
18
24
|
focusin: FocusEvent;
|
|
19
25
|
focusout: FocusEvent;
|
package/MenuItem.svelte
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<script>import { createKeyborg } from "keyborg";
|
|
2
|
-
import { v4 as uuid } from "uuid";
|
|
3
2
|
import { getContext, onMount, setContext } from "svelte";
|
|
4
3
|
import { writable } from "svelte/store";
|
|
5
4
|
import { clickOutside } from "./actions/clickOutside";
|
|
@@ -14,6 +13,7 @@ import {
|
|
|
14
13
|
focusNextChild,
|
|
15
14
|
focusPreviousChild
|
|
16
15
|
} from "./MenuItem.utils";
|
|
16
|
+
import { idGenerator } from "./idGenerator";
|
|
17
17
|
export let checked = false;
|
|
18
18
|
export let composed = false;
|
|
19
19
|
export let disabled = false;
|
|
@@ -34,7 +34,7 @@ const {
|
|
|
34
34
|
onSelect = void 0
|
|
35
35
|
} = getContext(MENU_ITEM_CONTEXT_KEY) || {};
|
|
36
36
|
const { openPreviousMenu = void 0, openNextMenu = void 0 } = getContext(MENU_BAR_CONTEXT_KEY) || {};
|
|
37
|
-
const instanceId =
|
|
37
|
+
const instanceId = idGenerator.nextId("MenuItem");
|
|
38
38
|
$:
|
|
39
39
|
displayId = `${value}-display-${instanceId}`;
|
|
40
40
|
$:
|
|
@@ -241,6 +241,12 @@ setContext(MENU_ITEM_CONTEXT_KEY, {
|
|
|
241
241
|
on:blur
|
|
242
242
|
on:click
|
|
243
243
|
on:dblclick
|
|
244
|
+
on:dragend
|
|
245
|
+
on:dragenter
|
|
246
|
+
on:dragleave
|
|
247
|
+
on:dragover
|
|
248
|
+
on:dragstart
|
|
249
|
+
on:drop
|
|
244
250
|
on:focus
|
|
245
251
|
on:focusin
|
|
246
252
|
on:focusout
|
package/MenuItem.svelte.d.ts
CHANGED
|
@@ -17,6 +17,12 @@ declare const __propDef: {
|
|
|
17
17
|
blur: FocusEvent;
|
|
18
18
|
click: MouseEvent;
|
|
19
19
|
dblclick: MouseEvent;
|
|
20
|
+
dragend: DragEvent;
|
|
21
|
+
dragenter: DragEvent;
|
|
22
|
+
dragleave: DragEvent;
|
|
23
|
+
dragover: DragEvent;
|
|
24
|
+
dragstart: DragEvent;
|
|
25
|
+
drop: DragEvent;
|
|
20
26
|
focus: FocusEvent;
|
|
21
27
|
focusin: FocusEvent;
|
|
22
28
|
focusout: FocusEvent;
|
package/MenuSeparator.svelte
CHANGED
|
@@ -8,6 +8,12 @@ export default class MenuSeparator extends SvelteComponentTyped<{
|
|
|
8
8
|
blur: FocusEvent;
|
|
9
9
|
click: MouseEvent;
|
|
10
10
|
dblclick: MouseEvent;
|
|
11
|
+
dragend: DragEvent;
|
|
12
|
+
dragenter: DragEvent;
|
|
13
|
+
dragleave: DragEvent;
|
|
14
|
+
dragover: DragEvent;
|
|
15
|
+
dragstart: DragEvent;
|
|
16
|
+
drop: DragEvent;
|
|
11
17
|
focus: FocusEvent;
|
|
12
18
|
focusin: FocusEvent;
|
|
13
19
|
focusout: FocusEvent;
|
|
@@ -46,6 +52,12 @@ declare const __propDef: {
|
|
|
46
52
|
blur: FocusEvent;
|
|
47
53
|
click: MouseEvent;
|
|
48
54
|
dblclick: MouseEvent;
|
|
55
|
+
dragend: DragEvent;
|
|
56
|
+
dragenter: DragEvent;
|
|
57
|
+
dragleave: DragEvent;
|
|
58
|
+
dragover: DragEvent;
|
|
59
|
+
dragstart: DragEvent;
|
|
60
|
+
drop: DragEvent;
|
|
49
61
|
focus: FocusEvent;
|
|
50
62
|
focusin: FocusEvent;
|
|
51
63
|
focusout: FocusEvent;
|
package/Progress.svelte
CHANGED
package/Progress.svelte.d.ts
CHANGED
|
@@ -13,6 +13,12 @@ declare const __propDef: {
|
|
|
13
13
|
blur: FocusEvent;
|
|
14
14
|
click: MouseEvent;
|
|
15
15
|
dblclick: MouseEvent;
|
|
16
|
+
dragend: DragEvent;
|
|
17
|
+
dragenter: DragEvent;
|
|
18
|
+
dragleave: DragEvent;
|
|
19
|
+
dragover: DragEvent;
|
|
20
|
+
dragstart: DragEvent;
|
|
21
|
+
drop: DragEvent;
|
|
16
22
|
focus: FocusEvent;
|
|
17
23
|
focusin: FocusEvent;
|
|
18
24
|
focusout: FocusEvent;
|