@geoffcox/sterling-svelte 0.0.29 → 0.0.31
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/Callout.svelte +227 -0
- package/Callout.svelte.d.ts +54 -0
- package/Dropdown.svelte +2 -1
- package/Menu.svelte +3 -2
- package/MenuButton.svelte +1 -1
- package/Popover.constants.d.ts +2 -0
- package/{floating-ui.constants.js → Popover.constants.js} +10 -9
- package/Popover.svelte +23 -19
- package/Popover.svelte.d.ts +5 -5
- package/Popover.types.d.ts +4 -0
- package/Select.svelte +4 -3
- package/Tooltip.svelte +62 -195
- package/Tooltip.svelte.d.ts +14 -11
- package/TreeItem.svelte +1 -1
- package/index.d.ts +4 -5
- package/index.js +3 -3
- package/package.json +24 -12
- package/Tooltip.constants.d.ts +0 -1
- package/Tooltip.constants.js +0 -1
- package/Tooltip.types.d.ts +0 -4
- package/floating-ui.constants.d.ts +0 -1
- package/floating-ui.types.d.ts +0 -4
- package/floating-ui.types.js +0 -1
- /package/{Tooltip.types.js → Popover.types.js} +0 -0
package/Callout.svelte
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
<script>import { onMount } from "svelte";
|
|
2
|
+
import {
|
|
3
|
+
arrow,
|
|
4
|
+
autoUpdate,
|
|
5
|
+
computePosition,
|
|
6
|
+
flip,
|
|
7
|
+
offset
|
|
8
|
+
} from "@floating-ui/dom";
|
|
9
|
+
import { portal } from "./actions/portal";
|
|
10
|
+
import { POPOVER_PORTAL_ID } from "./Popover.constants";
|
|
11
|
+
import { fade } from "svelte/transition";
|
|
12
|
+
import { prefersReducedMotion } from "./stores/prefersReducedMotion";
|
|
13
|
+
export let colorful = false;
|
|
14
|
+
export let conditionalRender = true;
|
|
15
|
+
export let crossAxisOffset = 0;
|
|
16
|
+
export let mainAxisOffset = 0;
|
|
17
|
+
export let open = false;
|
|
18
|
+
export let placement = "bottom-start";
|
|
19
|
+
export let portalHost = void 0;
|
|
20
|
+
export let reference;
|
|
21
|
+
let popupRef;
|
|
22
|
+
let arrowRef;
|
|
23
|
+
let popupPosition = { x: 0, y: 0 };
|
|
24
|
+
$:
|
|
25
|
+
floatingUIPlacement = placement;
|
|
26
|
+
const ensurePortalHost = () => {
|
|
27
|
+
if (document) {
|
|
28
|
+
if (portalHost) {
|
|
29
|
+
return portalHost;
|
|
30
|
+
}
|
|
31
|
+
let host = document.querySelector(`#${POPOVER_PORTAL_ID}`);
|
|
32
|
+
if (!host) {
|
|
33
|
+
host = document.createElement("div");
|
|
34
|
+
host.id = POPOVER_PORTAL_ID;
|
|
35
|
+
host.style.overflow = "visible";
|
|
36
|
+
document.body.append(host);
|
|
37
|
+
}
|
|
38
|
+
portalHost = host;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
let bodyHeight = 0;
|
|
42
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
43
|
+
bodyHeight = entries[0].target.clientHeight;
|
|
44
|
+
});
|
|
45
|
+
$:
|
|
46
|
+
middleware = [
|
|
47
|
+
offset({ mainAxis: mainAxisOffset, crossAxis: crossAxisOffset }),
|
|
48
|
+
flip(),
|
|
49
|
+
arrow({ element: arrowRef, padding: 8 })
|
|
50
|
+
];
|
|
51
|
+
const computeCalloutPosition = async () => {
|
|
52
|
+
if (reference && popupRef) {
|
|
53
|
+
popupPosition = await computePosition(reference, popupRef, {
|
|
54
|
+
placement: floatingUIPlacement,
|
|
55
|
+
middleware
|
|
56
|
+
});
|
|
57
|
+
} else {
|
|
58
|
+
popupPosition = { x: 0, y: 0 };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
let cleanupAutoUpdate = () => {
|
|
62
|
+
};
|
|
63
|
+
const autoUpdateCalloutPosition = () => {
|
|
64
|
+
cleanupAutoUpdate();
|
|
65
|
+
if (reference && popupRef) {
|
|
66
|
+
cleanupAutoUpdate = autoUpdate(reference, popupRef, computeCalloutPosition);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
$:
|
|
70
|
+
popupRef, reference, autoUpdateCalloutPosition();
|
|
71
|
+
$:
|
|
72
|
+
open, bodyHeight, middleware, placement, computeCalloutPosition();
|
|
73
|
+
const getArrowPlacementStyle = (position) => {
|
|
74
|
+
if (position?.placement && arrowRef) {
|
|
75
|
+
switch (position.placement) {
|
|
76
|
+
case "top":
|
|
77
|
+
case "top-start":
|
|
78
|
+
case "top-end":
|
|
79
|
+
return `bottom: -${arrowRef.offsetWidth}px;filter: drop-shadow(-1px -2px 1px rgba(0,0,0,0.2));transform:translate(0, -50%) rotate(135deg);`;
|
|
80
|
+
case "right":
|
|
81
|
+
case "right-start":
|
|
82
|
+
case "right-end":
|
|
83
|
+
return `left: -${arrowRef.offsetWidth}px;transform:translate(50%, 0) rotate(225deg);`;
|
|
84
|
+
case "bottom":
|
|
85
|
+
case "bottom-start":
|
|
86
|
+
case "bottom-end":
|
|
87
|
+
return `top: -${arrowRef.offsetWidth}px;transform:translate(0, 50%) rotate(-45deg);`;
|
|
88
|
+
case "left":
|
|
89
|
+
case "left-start":
|
|
90
|
+
case "left-end":
|
|
91
|
+
return `right: -${arrowRef.offsetWidth}px;filter: drop-shadow(2px 2px 1px rgba(0,0,0,0.2));transform:translate(-50%, 0) rotate(45deg);`;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return "";
|
|
95
|
+
};
|
|
96
|
+
const getArrowOffsetStyle = (position) => {
|
|
97
|
+
const arrow2 = position?.middlewareData?.arrow;
|
|
98
|
+
if (arrow2) {
|
|
99
|
+
if (arrow2.x !== null && arrow2.x !== void 0) {
|
|
100
|
+
return `left: ${arrow2.x}px;`;
|
|
101
|
+
} else if (arrow2.y !== null && arrow2.y !== void 0) {
|
|
102
|
+
return `top: ${arrow2.y}px;`;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return "";
|
|
106
|
+
};
|
|
107
|
+
$:
|
|
108
|
+
arrowStyle = getArrowPlacementStyle(popupPosition) + getArrowOffsetStyle(popupPosition);
|
|
109
|
+
const fadeNoOp = (node, params) => {
|
|
110
|
+
return { delay: 0, duration: 0 };
|
|
111
|
+
};
|
|
112
|
+
$:
|
|
113
|
+
fadeMotion = !$prefersReducedMotion ? fade : fadeNoOp;
|
|
114
|
+
onMount(() => {
|
|
115
|
+
ensurePortalHost();
|
|
116
|
+
resizeObserver.observe(document.body);
|
|
117
|
+
return () => {
|
|
118
|
+
resizeObserver.unobserve(document.body);
|
|
119
|
+
};
|
|
120
|
+
});
|
|
121
|
+
const onKeydown = (event) => {
|
|
122
|
+
if (event.key === "Escape") {
|
|
123
|
+
open = false;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
ensurePortalHost();
|
|
127
|
+
</script>
|
|
128
|
+
|
|
129
|
+
{#if open || !conditionalRender}
|
|
130
|
+
<div
|
|
131
|
+
use:portal={{ target: portalHost ?? document.body }}
|
|
132
|
+
class="sterling-callout-portal"
|
|
133
|
+
transition:fadeMotion|global={{ duration: 250 }}
|
|
134
|
+
>
|
|
135
|
+
<div
|
|
136
|
+
bind:this={popupRef}
|
|
137
|
+
class="sterling-callout"
|
|
138
|
+
class:open
|
|
139
|
+
class:colorful
|
|
140
|
+
on:blur
|
|
141
|
+
on:click
|
|
142
|
+
on:copy
|
|
143
|
+
on:cut
|
|
144
|
+
on:dblclick
|
|
145
|
+
on:dragend
|
|
146
|
+
on:dragenter
|
|
147
|
+
on:dragleave
|
|
148
|
+
on:dragover
|
|
149
|
+
on:dragstart
|
|
150
|
+
on:drop
|
|
151
|
+
on:focus
|
|
152
|
+
on:focusin
|
|
153
|
+
on:focusout
|
|
154
|
+
on:keydown
|
|
155
|
+
on:keypress
|
|
156
|
+
on:keyup
|
|
157
|
+
on:mousedown
|
|
158
|
+
on:mouseenter
|
|
159
|
+
on:mouseleave
|
|
160
|
+
on:mousemove
|
|
161
|
+
on:mouseover
|
|
162
|
+
on:mouseout
|
|
163
|
+
on:mouseup
|
|
164
|
+
on:scroll
|
|
165
|
+
on:wheel|passive
|
|
166
|
+
on:paste
|
|
167
|
+
on:keydown={onKeydown}
|
|
168
|
+
{...$$restProps}
|
|
169
|
+
style="left:{popupPosition.x}px; top:{popupPosition.y}px"
|
|
170
|
+
>
|
|
171
|
+
<slot />
|
|
172
|
+
<div class="arrow" bind:this={arrowRef} style={arrowStyle} />
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
{/if}
|
|
176
|
+
|
|
177
|
+
<style>
|
|
178
|
+
.sterling-callout-portal {
|
|
179
|
+
position: relative;
|
|
180
|
+
overflow: visible;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.sterling-callout {
|
|
184
|
+
background-color: var(--stsv-common__background-color);
|
|
185
|
+
border-color: var(--stsv-common__border-color);
|
|
186
|
+
border-radius: var(--stsv-common__border-radius);
|
|
187
|
+
border-style: var(--stsv-common__border-style);
|
|
188
|
+
border-width: var(--stsv-common__border-width);
|
|
189
|
+
box-shadow: rgba(0, 0, 0, 0.4) 2px 2px 4px -1px;
|
|
190
|
+
box-sizing: border-box;
|
|
191
|
+
color: var(--stsv-common__color);
|
|
192
|
+
display: none;
|
|
193
|
+
grid-template-columns: 1fr;
|
|
194
|
+
grid-template-rows: 1fr;
|
|
195
|
+
height: fit-content;
|
|
196
|
+
left: 0;
|
|
197
|
+
overflow: visible;
|
|
198
|
+
position: absolute;
|
|
199
|
+
top: 0;
|
|
200
|
+
width: max-content;
|
|
201
|
+
z-index: 0;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.sterling-callout.open {
|
|
205
|
+
display: grid;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.sterling-callout.colorful {
|
|
209
|
+
background-color: var(--stsv-button--colorful__background-color);
|
|
210
|
+
border-color: var(--stsv-button--colorful__border-color);
|
|
211
|
+
color: var(--stsv-button--colorful__color);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.arrow {
|
|
215
|
+
position: absolute;
|
|
216
|
+
box-sizing: border-box;
|
|
217
|
+
width: 14px;
|
|
218
|
+
height: 14px;
|
|
219
|
+
background-color: inherit;
|
|
220
|
+
border-color: inherit;
|
|
221
|
+
border-style: inherit;
|
|
222
|
+
border-width: inherit;
|
|
223
|
+
/* This clip path clips 1/2 the square to create a triangle */
|
|
224
|
+
/* The -100% and 200% allow for the drop-shadow to not be clipped */
|
|
225
|
+
clip-path: polygon(-100% -100%, 200% -100%, 200% 200%, -100% -100%);
|
|
226
|
+
}
|
|
227
|
+
</style>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
colorful?: boolean | undefined;
|
|
6
|
+
conditionalRender?: boolean | undefined;
|
|
7
|
+
crossAxisOffset?: number | undefined;
|
|
8
|
+
mainAxisOffset?: number | undefined;
|
|
9
|
+
open?: boolean | undefined;
|
|
10
|
+
placement?: string | undefined;
|
|
11
|
+
portalHost?: HTMLElement | undefined;
|
|
12
|
+
reference: HTMLElement | undefined;
|
|
13
|
+
};
|
|
14
|
+
events: {
|
|
15
|
+
blur: FocusEvent;
|
|
16
|
+
click: MouseEvent;
|
|
17
|
+
copy: ClipboardEvent;
|
|
18
|
+
cut: ClipboardEvent;
|
|
19
|
+
dblclick: MouseEvent;
|
|
20
|
+
dragend: DragEvent;
|
|
21
|
+
dragenter: DragEvent;
|
|
22
|
+
dragleave: DragEvent;
|
|
23
|
+
dragover: DragEvent;
|
|
24
|
+
dragstart: DragEvent;
|
|
25
|
+
drop: DragEvent;
|
|
26
|
+
focus: FocusEvent;
|
|
27
|
+
focusin: FocusEvent;
|
|
28
|
+
focusout: FocusEvent;
|
|
29
|
+
keydown: KeyboardEvent;
|
|
30
|
+
keypress: KeyboardEvent;
|
|
31
|
+
keyup: KeyboardEvent;
|
|
32
|
+
mousedown: MouseEvent;
|
|
33
|
+
mouseenter: MouseEvent;
|
|
34
|
+
mouseleave: MouseEvent;
|
|
35
|
+
mousemove: MouseEvent;
|
|
36
|
+
mouseover: MouseEvent;
|
|
37
|
+
mouseout: MouseEvent;
|
|
38
|
+
mouseup: MouseEvent;
|
|
39
|
+
scroll: Event;
|
|
40
|
+
wheel: WheelEvent;
|
|
41
|
+
paste: ClipboardEvent;
|
|
42
|
+
} & {
|
|
43
|
+
[evt: string]: CustomEvent<any>;
|
|
44
|
+
};
|
|
45
|
+
slots: {
|
|
46
|
+
default: {};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export type CalloutProps = typeof __propDef.props;
|
|
50
|
+
export type CalloutEvents = typeof __propDef.events;
|
|
51
|
+
export type CalloutSlots = typeof __propDef.slots;
|
|
52
|
+
export default class Callout extends SvelteComponentTyped<CalloutProps, CalloutEvents, CalloutSlots> {
|
|
53
|
+
}
|
|
54
|
+
export {};
|
package/Dropdown.svelte
CHANGED
|
@@ -118,7 +118,7 @@ $:
|
|
|
118
118
|
<Popover reference={dropdownRef} open={!disabled && open}>
|
|
119
119
|
<div
|
|
120
120
|
class="popup-content"
|
|
121
|
-
transition:slideMotion={{ duration: 200 }}
|
|
121
|
+
transition:slideMotion|global={{ duration: 200 }}
|
|
122
122
|
class:colorful
|
|
123
123
|
bind:this={popupContentRef}
|
|
124
124
|
>
|
|
@@ -278,6 +278,7 @@ $:
|
|
|
278
278
|
border-radius: var(--stsv-common__border-radius);
|
|
279
279
|
border-style: var(--stsv-common__border-style);
|
|
280
280
|
border-width: var(--stsv-common__border-width);
|
|
281
|
+
box-shadow: rgba(0, 0, 0, 0.4) 2px 2px 4px -1px;
|
|
281
282
|
color: var(--stsv-common__color);
|
|
282
283
|
padding: 0.25em;
|
|
283
284
|
display: grid;
|
package/Menu.svelte
CHANGED
|
@@ -66,8 +66,8 @@ export const focusLastMenuItem = () => {
|
|
|
66
66
|
role="menu"
|
|
67
67
|
class:open
|
|
68
68
|
data-root-value={rootValue}
|
|
69
|
-
in:slideMotion={{ duration: 300 }}
|
|
70
|
-
out:slideMotion={{ duration: 100 }}
|
|
69
|
+
in:slideMotion|global={{ duration: 300 }}
|
|
70
|
+
out:slideMotion|global={{ duration: 100 }}
|
|
71
71
|
on:blur
|
|
72
72
|
on:click
|
|
73
73
|
on:copy
|
|
@@ -109,6 +109,7 @@ export const focusLastMenuItem = () => {
|
|
|
109
109
|
border-radius: var(--stsv-common__border-radius);
|
|
110
110
|
border-style: var(--stsv-common__border-style);
|
|
111
111
|
border-width: var(--stsv-common__border-width);
|
|
112
|
+
box-shadow: rgba(0, 0, 0, 0.4) 2px 2px 4px -1px;
|
|
112
113
|
box-sizing: border-box;
|
|
113
114
|
display: grid;
|
|
114
115
|
grid-template-columns: 1fr;
|
package/MenuButton.svelte
CHANGED
|
@@ -134,7 +134,7 @@ setContext(MENU_ITEM_CONTEXT_KEY, {
|
|
|
134
134
|
<div class="reference" bind:this={reference} use:clickOutside on:click_outside={onClickOutside}>
|
|
135
135
|
<slot shape={$$restProps.shape} variant={$$restProps.variant} />
|
|
136
136
|
</div>
|
|
137
|
-
<Popover {reference}
|
|
137
|
+
<Popover {reference} {open}>
|
|
138
138
|
<Menu bind:this={menuRef} id={menuId} {reference} {open}>
|
|
139
139
|
<slot name="items" />
|
|
140
140
|
</Menu>
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
export const
|
|
2
|
-
'top',
|
|
3
|
-
'right',
|
|
4
|
-
'bottom',
|
|
5
|
-
'left',
|
|
1
|
+
export const POPOVER_PLACEMENTS = [
|
|
6
2
|
'top-start',
|
|
7
|
-
'
|
|
8
|
-
'bottom-start',
|
|
9
|
-
'left-start',
|
|
3
|
+
'top',
|
|
10
4
|
'top-end',
|
|
5
|
+
'right-start',
|
|
6
|
+
'right',
|
|
11
7
|
'right-end',
|
|
12
8
|
'bottom-end',
|
|
13
|
-
'
|
|
9
|
+
'bottom',
|
|
10
|
+
'bottom-start',
|
|
11
|
+
'left-end',
|
|
12
|
+
'left',
|
|
13
|
+
'left-start'
|
|
14
14
|
];
|
|
15
|
+
export const POPOVER_PORTAL_ID = 'SterlingPopoverPortal';
|
package/Popover.svelte
CHANGED
|
@@ -1,25 +1,32 @@
|
|
|
1
1
|
<script>import { onMount } from "svelte";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
autoUpdate,
|
|
4
|
+
computePosition,
|
|
5
|
+
flip,
|
|
6
|
+
offset
|
|
7
|
+
} from "@floating-ui/dom";
|
|
3
8
|
import { portal } from "./actions/portal";
|
|
4
|
-
|
|
9
|
+
import { POPOVER_PORTAL_ID } from "./Popover.constants";
|
|
10
|
+
export let conditionalRender = true;
|
|
11
|
+
export let crossAxisOffset = 0;
|
|
12
|
+
export let mainAxisOffset = 0;
|
|
5
13
|
export let open = false;
|
|
6
|
-
export let persistent = false;
|
|
7
14
|
export let placement = "bottom-start";
|
|
8
15
|
export let portalHost = void 0;
|
|
9
16
|
export let reference;
|
|
10
17
|
let popupRef;
|
|
11
18
|
let popupPosition = { x: 0, y: 0 };
|
|
12
|
-
|
|
19
|
+
$:
|
|
20
|
+
floatingUIPlacement = placement;
|
|
13
21
|
const ensurePortalHost = () => {
|
|
14
22
|
if (document) {
|
|
15
23
|
if (portalHost) {
|
|
16
24
|
return portalHost;
|
|
17
25
|
}
|
|
18
|
-
let host = document.querySelector(`#${
|
|
26
|
+
let host = document.querySelector(`#${POPOVER_PORTAL_ID}`);
|
|
19
27
|
if (!host) {
|
|
20
|
-
console.log("creating portal host");
|
|
21
28
|
host = document.createElement("div");
|
|
22
|
-
host.id =
|
|
29
|
+
host.id = POPOVER_PORTAL_ID;
|
|
23
30
|
host.style.overflow = "visible";
|
|
24
31
|
document.body.append(host);
|
|
25
32
|
}
|
|
@@ -31,11 +38,11 @@ const resizeObserver = new ResizeObserver((entries) => {
|
|
|
31
38
|
bodyHeight = entries[0].target.clientHeight;
|
|
32
39
|
});
|
|
33
40
|
$:
|
|
34
|
-
middleware = [offset(
|
|
35
|
-
const
|
|
41
|
+
middleware = [offset({ mainAxis: mainAxisOffset, crossAxis: crossAxisOffset }), flip()];
|
|
42
|
+
const computePopoverPosition = async () => {
|
|
36
43
|
if (reference && popupRef) {
|
|
37
44
|
popupPosition = await computePosition(reference, popupRef, {
|
|
38
|
-
placement,
|
|
45
|
+
placement: floatingUIPlacement,
|
|
39
46
|
middleware
|
|
40
47
|
});
|
|
41
48
|
} else {
|
|
@@ -44,16 +51,16 @@ const computePopupPosition = async () => {
|
|
|
44
51
|
};
|
|
45
52
|
let cleanupAutoUpdate = () => {
|
|
46
53
|
};
|
|
47
|
-
const
|
|
54
|
+
const autoUpdatePopoverPosition = () => {
|
|
48
55
|
cleanupAutoUpdate();
|
|
49
56
|
if (reference && popupRef) {
|
|
50
|
-
cleanupAutoUpdate = autoUpdate(reference, popupRef,
|
|
57
|
+
cleanupAutoUpdate = autoUpdate(reference, popupRef, computePopoverPosition);
|
|
51
58
|
}
|
|
52
59
|
};
|
|
53
60
|
$:
|
|
54
|
-
popupRef, reference,
|
|
61
|
+
popupRef, reference, autoUpdatePopoverPosition();
|
|
55
62
|
$:
|
|
56
|
-
open, bodyHeight, middleware,
|
|
63
|
+
open, bodyHeight, middleware, floatingUIPlacement, computePopoverPosition();
|
|
57
64
|
onMount(() => {
|
|
58
65
|
ensurePortalHost();
|
|
59
66
|
resizeObserver.observe(document.body);
|
|
@@ -69,7 +76,7 @@ const onKeydown = (event) => {
|
|
|
69
76
|
ensurePortalHost();
|
|
70
77
|
</script>
|
|
71
78
|
|
|
72
|
-
{#if open ||
|
|
79
|
+
{#if open || !conditionalRender}
|
|
73
80
|
<div use:portal={{ target: portalHost ?? document.body }} class="sterling-popover-portal">
|
|
74
81
|
<div
|
|
75
82
|
bind:this={popupRef}
|
|
@@ -115,22 +122,19 @@ ensurePortalHost();
|
|
|
115
122
|
.sterling-popover-portal {
|
|
116
123
|
position: relative;
|
|
117
124
|
overflow: visible;
|
|
118
|
-
background: rgba(255, 0, 0, 0.1);
|
|
119
125
|
}
|
|
120
126
|
|
|
121
127
|
.sterling-popover {
|
|
122
|
-
box-shadow: rgba(0, 0, 0, 0.4) 2px 2px 4px -1px;
|
|
123
128
|
box-sizing: border-box;
|
|
124
129
|
display: none;
|
|
125
130
|
grid-template-columns: 1fr;
|
|
126
131
|
grid-template-rows: 1fr;
|
|
127
132
|
height: fit-content;
|
|
128
133
|
left: 0;
|
|
129
|
-
overflow:
|
|
134
|
+
overflow: visible;
|
|
130
135
|
position: absolute;
|
|
131
136
|
top: 0;
|
|
132
137
|
width: max-content;
|
|
133
|
-
z-index: 1;
|
|
134
138
|
}
|
|
135
139
|
|
|
136
140
|
.sterling-popover.open {
|
package/Popover.svelte.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { Placement } from '@floating-ui/dom';
|
|
3
2
|
declare const __propDef: {
|
|
4
3
|
props: {
|
|
5
4
|
[x: string]: any;
|
|
6
|
-
|
|
5
|
+
conditionalRender?: boolean | undefined;
|
|
6
|
+
crossAxisOffset?: number | undefined;
|
|
7
|
+
mainAxisOffset?: number | undefined;
|
|
7
8
|
open?: boolean | undefined;
|
|
8
|
-
|
|
9
|
-
placement?: Placement | undefined;
|
|
9
|
+
placement?: string | undefined;
|
|
10
10
|
portalHost?: HTMLElement | undefined;
|
|
11
|
-
reference: HTMLElement;
|
|
11
|
+
reference: HTMLElement | undefined;
|
|
12
12
|
};
|
|
13
13
|
events: {
|
|
14
14
|
blur: FocusEvent;
|
package/Select.svelte
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { clickOutside } from "./actions/clickOutside";
|
|
3
3
|
import { idGenerator } from "./idGenerator";
|
|
4
4
|
import List from "./List.svelte";
|
|
5
|
-
import
|
|
5
|
+
import Popover from "./Popover.svelte";
|
|
6
6
|
const popupId = idGenerator.nextId("Select-popup");
|
|
7
7
|
export let disabled = false;
|
|
8
8
|
export let composed = false;
|
|
@@ -199,7 +199,7 @@ const onListSelect = (event) => {
|
|
|
199
199
|
<div class="chevron" />
|
|
200
200
|
</slot>
|
|
201
201
|
</div>
|
|
202
|
-
<
|
|
202
|
+
<Popover reference={selectRef} bind:open id={popupId} conditionalRender={false}>
|
|
203
203
|
<div class="popup-content">
|
|
204
204
|
<List
|
|
205
205
|
bind:this={listRef}
|
|
@@ -214,7 +214,7 @@ const onListSelect = (event) => {
|
|
|
214
214
|
<slot />
|
|
215
215
|
</List>
|
|
216
216
|
</div>
|
|
217
|
-
</
|
|
217
|
+
</Popover>
|
|
218
218
|
</div>
|
|
219
219
|
|
|
220
220
|
<style>
|
|
@@ -341,6 +341,7 @@ const onListSelect = (event) => {
|
|
|
341
341
|
border-radius: var(--stsv-common__border-radius);
|
|
342
342
|
border-style: var(--stsv-common__border-style);
|
|
343
343
|
border-width: var(--stsv-common__border-width);
|
|
344
|
+
box-shadow: rgba(0, 0, 0, 0.4) 2px 2px 4px -1px;
|
|
344
345
|
padding: 0.25em;
|
|
345
346
|
display: grid;
|
|
346
347
|
grid-template-columns: 1fr;
|
package/Tooltip.svelte
CHANGED
|
@@ -1,103 +1,22 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
<script>import { onMount } from "svelte";
|
|
2
|
+
import Callout from "./Callout.svelte";
|
|
3
|
+
export let conditionalRender = true;
|
|
4
|
+
export let crossAxisOffset = 0;
|
|
5
|
+
export let mainAxisOffset = 0;
|
|
6
6
|
export let disabled = false;
|
|
7
|
-
export let showOn = "hover";
|
|
8
7
|
export let hoverDelayMilliseconds = 1e3;
|
|
9
8
|
export let open = false;
|
|
10
|
-
export let placement = "
|
|
11
|
-
export let
|
|
9
|
+
export let placement = "bottom-start";
|
|
10
|
+
export let portalHost = void 0;
|
|
12
11
|
let originRef;
|
|
13
|
-
let tooltipRef;
|
|
14
|
-
let arrowRef;
|
|
15
|
-
let position = void 0;
|
|
16
12
|
$:
|
|
17
13
|
reference = $$slots.default ? originRef?.previousElementSibling : void 0;
|
|
18
|
-
const computeTooltipPosition = async () => {
|
|
19
|
-
if (reference && tooltipRef && arrowRef) {
|
|
20
|
-
const floatingOffset = Math.sqrt(2 * arrowRef.offsetWidth ** 2) / 2;
|
|
21
|
-
const middleware = [
|
|
22
|
-
offset(floatingOffset),
|
|
23
|
-
flip({ fallbackPlacements: ["top", "bottom", "right", "left"] }),
|
|
24
|
-
arrow({
|
|
25
|
-
element: arrowRef
|
|
26
|
-
})
|
|
27
|
-
];
|
|
28
|
-
position = await computePosition(reference, tooltipRef, {
|
|
29
|
-
placement,
|
|
30
|
-
middleware
|
|
31
|
-
});
|
|
32
|
-
} else {
|
|
33
|
-
position = void 0;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
let cleanupAutoUpdate = () => {
|
|
37
|
-
};
|
|
38
|
-
const autoUpdateTooltipPosition = () => {
|
|
39
|
-
cleanupAutoUpdate();
|
|
40
|
-
cleanupAutoUpdate = () => {
|
|
41
|
-
};
|
|
42
|
-
if (reference && tooltipRef) {
|
|
43
|
-
cleanupAutoUpdate = autoUpdate(reference, tooltipRef, computeTooltipPosition);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
$:
|
|
47
|
-
reference, tooltipRef, autoUpdateTooltipPosition();
|
|
48
|
-
$:
|
|
49
|
-
open, placement, computeTooltipPosition();
|
|
50
|
-
$:
|
|
51
|
-
tipStyle = position ? `left:${position.x}px; top:${position.y}px;` : "";
|
|
52
|
-
const getArrowPlacementStyle = (position2) => {
|
|
53
|
-
if (position2?.placement) {
|
|
54
|
-
switch (position2.placement) {
|
|
55
|
-
case "top":
|
|
56
|
-
case "top-start":
|
|
57
|
-
case "top-end":
|
|
58
|
-
return `bottom: -${arrowRef.offsetWidth}px;transform:translate(0, -50%) rotate(135deg);`;
|
|
59
|
-
case "right":
|
|
60
|
-
case "right-start":
|
|
61
|
-
case "right-end":
|
|
62
|
-
return `left: -${arrowRef.offsetWidth}px;transform:translate(50%, 0) rotate(225deg);`;
|
|
63
|
-
case "bottom":
|
|
64
|
-
case "bottom-start":
|
|
65
|
-
case "bottom-end":
|
|
66
|
-
return `top: -${arrowRef.offsetWidth}px;transform:translate(0, 50%) rotate(-45deg);`;
|
|
67
|
-
case "left":
|
|
68
|
-
case "left-start":
|
|
69
|
-
case "left-end":
|
|
70
|
-
return `right: -${arrowRef.offsetWidth}px;transform:translate(-50%, 0) rotate(45deg);`;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return "";
|
|
74
|
-
};
|
|
75
|
-
const getArrowOffsetStyle = (position2) => {
|
|
76
|
-
const arrow2 = position2?.middlewareData?.arrow;
|
|
77
|
-
if (arrow2) {
|
|
78
|
-
if (arrow2.x !== null && arrow2.x !== void 0) {
|
|
79
|
-
return `left: ${arrow2.x}px;`;
|
|
80
|
-
} else if (arrow2.y !== null && arrow2.y !== void 0) {
|
|
81
|
-
return `top: ${arrow2.y}px;`;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return "";
|
|
85
|
-
};
|
|
86
|
-
$:
|
|
87
|
-
arrowStyle = getArrowPlacementStyle(position) + getArrowOffsetStyle(position);
|
|
88
14
|
const show = () => {
|
|
89
15
|
if (!disabled) {
|
|
90
16
|
open = true;
|
|
91
17
|
}
|
|
92
18
|
};
|
|
93
19
|
const hide = () => open = false;
|
|
94
|
-
const toggle = () => {
|
|
95
|
-
if (!disabled) {
|
|
96
|
-
open = !open;
|
|
97
|
-
} else {
|
|
98
|
-
open = false;
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
20
|
const delayShow = () => {
|
|
102
21
|
hoverDelayMilliseconds === 0 ? show() : setTimeout(() => {
|
|
103
22
|
show();
|
|
@@ -117,124 +36,72 @@ const autoShowUpdate = () => {
|
|
|
117
36
|
const element = reference;
|
|
118
37
|
open = false;
|
|
119
38
|
if (element) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
element.addEventListener("mouseenter", delayShow);
|
|
127
|
-
element.addEventListener("mouseleave", hide);
|
|
128
|
-
cleanupAutoShowUpdate = () => {
|
|
129
|
-
element.removeEventListener("mouseenter", delayShow);
|
|
130
|
-
element.removeEventListener("mouseleave", hide);
|
|
131
|
-
};
|
|
132
|
-
}
|
|
39
|
+
element.addEventListener("mouseenter", delayShow);
|
|
40
|
+
element.addEventListener("mouseleave", hide);
|
|
41
|
+
cleanupAutoShowUpdate = () => {
|
|
42
|
+
element.removeEventListener("mouseenter", delayShow);
|
|
43
|
+
element.removeEventListener("mouseleave", hide);
|
|
44
|
+
};
|
|
133
45
|
}
|
|
134
46
|
};
|
|
135
47
|
$:
|
|
136
|
-
reference,
|
|
137
|
-
const fadeNoOp = (node, params) => {
|
|
138
|
-
return { delay: 0, duration: 0 };
|
|
139
|
-
};
|
|
140
|
-
$:
|
|
141
|
-
fadeMotion = !$prefersReducedMotion ? fade : fadeNoOp;
|
|
142
|
-
let mounted = false;
|
|
48
|
+
reference, autoShowUpdate();
|
|
143
49
|
onMount(() => {
|
|
144
|
-
mounted = true;
|
|
145
|
-
portalTarget = portalTarget || document.body;
|
|
146
|
-
autoUpdateTooltipPosition();
|
|
147
|
-
computeTooltipPosition();
|
|
148
50
|
autoShowUpdate();
|
|
149
51
|
});
|
|
150
52
|
</script>
|
|
151
53
|
|
|
152
|
-
<slot {disabled} {open} />
|
|
54
|
+
<slot {disabled} {hoverDelayMilliseconds} {open} />
|
|
153
55
|
<div class="sterling-tooltip-origin" bind:this={originRef} />
|
|
154
|
-
|
|
155
|
-
{
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
>
|
|
198
|
-
<div class="arrow" bind:this={arrowRef} style={arrowStyle} />
|
|
199
|
-
<slot name="tip" />
|
|
200
|
-
</div>
|
|
201
|
-
</div>
|
|
202
|
-
{/if}
|
|
56
|
+
<Callout
|
|
57
|
+
{conditionalRender}
|
|
58
|
+
{crossAxisOffset}
|
|
59
|
+
{mainAxisOffset}
|
|
60
|
+
{open}
|
|
61
|
+
{placement}
|
|
62
|
+
{portalHost}
|
|
63
|
+
{reference}
|
|
64
|
+
on:blur
|
|
65
|
+
on:click
|
|
66
|
+
on:dblclick
|
|
67
|
+
on:dragend
|
|
68
|
+
on:dragenter
|
|
69
|
+
on:dragleave
|
|
70
|
+
on:dragover
|
|
71
|
+
on:dragstart
|
|
72
|
+
on:drop
|
|
73
|
+
on:focus
|
|
74
|
+
on:focusin
|
|
75
|
+
on:focusout
|
|
76
|
+
on:keydown
|
|
77
|
+
on:keypress
|
|
78
|
+
on:keyup
|
|
79
|
+
on:mousedown
|
|
80
|
+
on:mouseenter
|
|
81
|
+
on:mouseleave
|
|
82
|
+
on:mousemove
|
|
83
|
+
on:mouseover
|
|
84
|
+
on:mouseout
|
|
85
|
+
on:mouseup
|
|
86
|
+
on:pointercancel
|
|
87
|
+
on:pointerdown
|
|
88
|
+
on:pointerenter
|
|
89
|
+
on:pointerleave
|
|
90
|
+
on:pointermove
|
|
91
|
+
on:pointerover
|
|
92
|
+
on:pointerout
|
|
93
|
+
on:pointerup
|
|
94
|
+
on:wheel
|
|
95
|
+
{...$$restProps}
|
|
96
|
+
>
|
|
97
|
+
<slot name="tip" />
|
|
98
|
+
</Callout>
|
|
203
99
|
|
|
204
100
|
<style>
|
|
205
101
|
.sterling-tooltip-origin {
|
|
206
|
-
display:
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
.sterling-tooltip-portal {
|
|
212
|
-
position: relative;
|
|
213
|
-
overflow: visible;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
.sterling-tooltip {
|
|
217
|
-
background-color: var(--stsv-common__background-color);
|
|
218
|
-
border-color: var(--stsv-common__border-color);
|
|
219
|
-
border-radius: var(--stsv-common__border-radius);
|
|
220
|
-
border-style: var(--stsv-common__border-style);
|
|
221
|
-
border-width: var(--stsv-common__border-width);
|
|
222
|
-
color: var(--stsv-common__color);
|
|
223
|
-
position: absolute;
|
|
224
|
-
overflow: visible;
|
|
225
|
-
box-shadow: rgba(0, 0, 0, 0.4) 2px 2px 4px -1px;
|
|
226
|
-
z-index: 4;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
.arrow {
|
|
230
|
-
position: absolute;
|
|
231
|
-
width: 10px;
|
|
232
|
-
height: 10px;
|
|
233
|
-
background-color: var(--stsv-common__background-color);
|
|
234
|
-
border-color: var(--stsv-common__border-color);
|
|
235
|
-
border-radius: var(--stsv-common__border-radius);
|
|
236
|
-
border-style: var(--stsv-common__border-style);
|
|
237
|
-
border-width: var(--stsv-common__border-width);
|
|
238
|
-
clip-path: polygon(0% 1%, 100% 1%, 100% 100%, 0% 1%);
|
|
102
|
+
display: block;
|
|
103
|
+
background: transparent;
|
|
104
|
+
width: 0px;
|
|
105
|
+
height: 0px;
|
|
239
106
|
}
|
|
240
107
|
</style>
|
package/Tooltip.svelte.d.ts
CHANGED
|
@@ -2,12 +2,14 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
|
+
conditionalRender?: boolean | undefined;
|
|
6
|
+
crossAxisOffset?: number | undefined;
|
|
7
|
+
mainAxisOffset?: number | undefined;
|
|
5
8
|
disabled?: boolean | undefined;
|
|
6
|
-
showOn?: string | undefined;
|
|
7
9
|
hoverDelayMilliseconds?: number | undefined;
|
|
8
10
|
open?: boolean | undefined;
|
|
9
|
-
placement?:
|
|
10
|
-
|
|
11
|
+
placement?: string | undefined;
|
|
12
|
+
portalHost?: HTMLElement | undefined;
|
|
11
13
|
};
|
|
12
14
|
events: {
|
|
13
15
|
blur: FocusEvent;
|
|
@@ -32,14 +34,14 @@ declare const __propDef: {
|
|
|
32
34
|
mouseover: MouseEvent;
|
|
33
35
|
mouseout: MouseEvent;
|
|
34
36
|
mouseup: MouseEvent;
|
|
35
|
-
pointercancel:
|
|
36
|
-
pointerdown:
|
|
37
|
-
pointerenter:
|
|
38
|
-
pointerleave:
|
|
39
|
-
pointermove:
|
|
40
|
-
pointerover:
|
|
41
|
-
pointerout:
|
|
42
|
-
pointerup:
|
|
37
|
+
pointercancel: CustomEvent<any>;
|
|
38
|
+
pointerdown: CustomEvent<any>;
|
|
39
|
+
pointerenter: CustomEvent<any>;
|
|
40
|
+
pointerleave: CustomEvent<any>;
|
|
41
|
+
pointermove: CustomEvent<any>;
|
|
42
|
+
pointerover: CustomEvent<any>;
|
|
43
|
+
pointerout: CustomEvent<any>;
|
|
44
|
+
pointerup: CustomEvent<any>;
|
|
43
45
|
wheel: WheelEvent;
|
|
44
46
|
} & {
|
|
45
47
|
[evt: string]: CustomEvent<any>;
|
|
@@ -47,6 +49,7 @@ declare const __propDef: {
|
|
|
47
49
|
slots: {
|
|
48
50
|
default: {
|
|
49
51
|
disabled: boolean;
|
|
52
|
+
hoverDelayMilliseconds: number;
|
|
50
53
|
open: boolean;
|
|
51
54
|
};
|
|
52
55
|
tip: {};
|
package/TreeItem.svelte
CHANGED
|
@@ -330,7 +330,7 @@ A item in a Tree displaying the item and children.
|
|
|
330
330
|
</slot>
|
|
331
331
|
</div>
|
|
332
332
|
{#if expanded && hasChildren}
|
|
333
|
-
<div class="children" transition:slideMotion={{ duration: 200 }} role="group">
|
|
333
|
+
<div class="children" transition:slideMotion|global={{ duration: 200 }} role="group">
|
|
334
334
|
<slot {depth} {selected} {value} />
|
|
335
335
|
</div>
|
|
336
336
|
{/if}
|
package/index.d.ts
CHANGED
|
@@ -13,30 +13,29 @@ export { neutralColors, lightStatusColors, darkStatusColors, blueColors as blueA
|
|
|
13
13
|
export { toggleDarkTheme } from './theme/toggleDarkTheme';
|
|
14
14
|
export type { ButtonVariant, ButtonShape } from './Button.types';
|
|
15
15
|
export type { LabelStatus } from './Label.types';
|
|
16
|
-
export type { FloatingPlacement, FloatingOffsetOptions } from './floating-ui.types';
|
|
17
16
|
export type { LinkVariant } from './Link.types';
|
|
18
17
|
export type { ListContext } from './List.types';
|
|
19
18
|
export type { MenuBarContext } from './MenuBar.types';
|
|
20
19
|
export type { MenuItemContext, MenuItemRegistration, MenuItemRole } from './MenuItem.types';
|
|
20
|
+
export type { PopoverPlacement } from './Popover.types';
|
|
21
21
|
export type { ProgressStatus } from './Progress.types';
|
|
22
22
|
export type { TabListContext } from './TabList.types';
|
|
23
23
|
export type { TextAreaResize } from './TextArea.types';
|
|
24
|
-
export type { TooltipShowOn } from './Tooltip.types';
|
|
25
24
|
export type { TreeContext } from './Tree.types';
|
|
26
25
|
export type { TreeItemContext } from './TreeItem.types';
|
|
27
26
|
export { BUTTON_SHAPES, BUTTON_VARIANTS } from './Button.constants';
|
|
28
27
|
export { LABEL_STATUSES } from './Label.constants';
|
|
29
|
-
export { FLOATING_PLACEMENTS } from './floating-ui.constants';
|
|
30
28
|
export { LINK_VARIANTS } from './Link.constants';
|
|
31
29
|
export { LIST_CONTEXT_KEY } from './List.constants';
|
|
32
30
|
export { MENU_BAR_CONTEXT_KEY } from './MenuBar.constants';
|
|
33
31
|
export { MENU_ITEM_CONTEXT_KEY, MENU_ITEM_ROLES } from './MenuItem.constants';
|
|
32
|
+
export { POPOVER_PLACEMENTS } from './Popover.constants';
|
|
34
33
|
export { PROGRESS_STATUSES } from './Progress.constants';
|
|
35
34
|
export { TAB_LIST_CONTEXT_KEY } from './TabList.constants';
|
|
36
35
|
export { TEXT_AREA_RESIZES } from './TextArea.constants';
|
|
37
|
-
export { TOOLTIP_SHOW_ONS } from './Tooltip.constants';
|
|
38
36
|
export { TREE_CONTEXT_KEY, TREE_ITEM_CONTEXT_KEY } from './Tree.constants';
|
|
39
37
|
import Button from './Button.svelte';
|
|
38
|
+
import Callout from './Callout.svelte';
|
|
40
39
|
import Checkbox from './Checkbox.svelte';
|
|
41
40
|
import ColorPicker from './ColorPicker.svelte';
|
|
42
41
|
import Dialog from './Dialog.svelte';
|
|
@@ -69,4 +68,4 @@ import Tree from './Tree.svelte';
|
|
|
69
68
|
import TreeChevron from './TreeChevron.svelte';
|
|
70
69
|
import TreeItem from './TreeItem.svelte';
|
|
71
70
|
import TreeItemDisplay from './TreeItemDisplay.svelte';
|
|
72
|
-
export { Button, Checkbox, ColorPicker, Dialog, Dropdown, HexColorSliders, HslColorSliders, Input, Label, Link, List, ListItem, Menu, MenuBar, MenuButton, MenuItem, MenuItemDisplay, MenuSeparator, Popover, Progress, Radio, RgbColorSliders, Select, Slider, Switch, Tab, TabList, TextArea, Tooltip, Tree, TreeChevron, TreeItem, TreeItemDisplay };
|
|
71
|
+
export { Button, Callout, Checkbox, ColorPicker, Dialog, Dropdown, HexColorSliders, HslColorSliders, Input, Label, Link, List, ListItem, Menu, MenuBar, MenuButton, MenuItem, MenuItemDisplay, MenuSeparator, Popover, Progress, Radio, RgbColorSliders, Select, Slider, Switch, Tab, TabList, TextArea, Tooltip, Tree, TreeChevron, TreeItem, TreeItemDisplay };
|
package/index.js
CHANGED
|
@@ -17,18 +17,18 @@ export { toggleDarkTheme } from './theme/toggleDarkTheme';
|
|
|
17
17
|
// ----- Component constants ----- //
|
|
18
18
|
export { BUTTON_SHAPES, BUTTON_VARIANTS } from './Button.constants';
|
|
19
19
|
export { LABEL_STATUSES } from './Label.constants';
|
|
20
|
-
export { FLOATING_PLACEMENTS } from './floating-ui.constants';
|
|
21
20
|
export { LINK_VARIANTS } from './Link.constants';
|
|
22
21
|
export { LIST_CONTEXT_KEY } from './List.constants';
|
|
23
22
|
export { MENU_BAR_CONTEXT_KEY } from './MenuBar.constants';
|
|
24
23
|
export { MENU_ITEM_CONTEXT_KEY, MENU_ITEM_ROLES } from './MenuItem.constants';
|
|
24
|
+
export { POPOVER_PLACEMENTS } from './Popover.constants';
|
|
25
25
|
export { PROGRESS_STATUSES } from './Progress.constants';
|
|
26
26
|
export { TAB_LIST_CONTEXT_KEY } from './TabList.constants';
|
|
27
27
|
export { TEXT_AREA_RESIZES } from './TextArea.constants';
|
|
28
|
-
export { TOOLTIP_SHOW_ONS } from './Tooltip.constants';
|
|
29
28
|
export { TREE_CONTEXT_KEY, TREE_ITEM_CONTEXT_KEY } from './Tree.constants';
|
|
30
29
|
// ----- Components ----- //
|
|
31
30
|
import Button from './Button.svelte';
|
|
31
|
+
import Callout from './Callout.svelte';
|
|
32
32
|
import Checkbox from './Checkbox.svelte';
|
|
33
33
|
import ColorPicker from './ColorPicker.svelte';
|
|
34
34
|
import Dialog from './Dialog.svelte';
|
|
@@ -61,4 +61,4 @@ import Tree from './Tree.svelte';
|
|
|
61
61
|
import TreeChevron from './TreeChevron.svelte';
|
|
62
62
|
import TreeItem from './TreeItem.svelte';
|
|
63
63
|
import TreeItemDisplay from './TreeItemDisplay.svelte';
|
|
64
|
-
export { Button, Checkbox, ColorPicker, Dialog, Dropdown, HexColorSliders, HslColorSliders, Input, Label, Link, List, ListItem, Menu, MenuBar, MenuButton, MenuItem, MenuItemDisplay, MenuSeparator, Popover, Progress, Radio, RgbColorSliders, Select, Slider, Switch, Tab, TabList, TextArea, Tooltip, Tree, TreeChevron, TreeItem, TreeItemDisplay };
|
|
64
|
+
export { Button, Callout, Checkbox, ColorPicker, Dialog, Dropdown, HexColorSliders, HslColorSliders, Input, Label, Link, List, ListItem, Menu, MenuBar, MenuButton, MenuItem, MenuItemDisplay, MenuSeparator, Popover, Progress, Radio, RgbColorSliders, Select, Slider, Switch, Tab, TabList, TextArea, Tooltip, Tree, TreeChevron, TreeItem, TreeItemDisplay };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geoffcox/sterling-svelte",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.31",
|
|
4
4
|
"author": "Geoff Cox",
|
|
5
5
|
"description": "A modern, accessible, and lightweight component library for Svelte.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,12 +10,22 @@
|
|
|
10
10
|
"homepage": "https://github.com/GeoffCox/sterling-svelte/blob/main/README.md",
|
|
11
11
|
"keywords": [
|
|
12
12
|
"svelte",
|
|
13
|
+
"svelte 4",
|
|
14
|
+
"sveltekit",
|
|
13
15
|
"design system",
|
|
14
16
|
"component",
|
|
17
|
+
"components",
|
|
15
18
|
"controls",
|
|
16
|
-
"sveltekit",
|
|
17
19
|
"typescript",
|
|
18
|
-
"javascript"
|
|
20
|
+
"javascript",
|
|
21
|
+
"button",
|
|
22
|
+
"checkbox",
|
|
23
|
+
"list",
|
|
24
|
+
"menu",
|
|
25
|
+
"radio",
|
|
26
|
+
"select",
|
|
27
|
+
"textarea",
|
|
28
|
+
"tree"
|
|
19
29
|
],
|
|
20
30
|
"devDependencies": {
|
|
21
31
|
"@fontsource/open-sans": "^4.5.14",
|
|
@@ -23,7 +33,7 @@
|
|
|
23
33
|
"@playwright/test": "^1.28.1",
|
|
24
34
|
"@sveltejs/adapter-auto": "^2.0.0",
|
|
25
35
|
"@sveltejs/adapter-static": "^1.0.0",
|
|
26
|
-
"@sveltejs/kit": "^1.
|
|
36
|
+
"@sveltejs/kit": "^1.20.4",
|
|
27
37
|
"@sveltejs/package": "^1.0.0",
|
|
28
38
|
"@types/lodash-es": "^4.17.6",
|
|
29
39
|
"@types/tinycolor2": "^1.4.3",
|
|
@@ -34,11 +44,11 @@
|
|
|
34
44
|
"eslint-plugin-svelte3": "^4.0.0",
|
|
35
45
|
"mdsvex": "^0.10.6",
|
|
36
46
|
"prettier": "^2.8.0",
|
|
37
|
-
"prettier-plugin-svelte": "^2.
|
|
38
|
-
"svelte": "^
|
|
39
|
-
"svelte-check": "^3.
|
|
47
|
+
"prettier-plugin-svelte": "^2.10.1",
|
|
48
|
+
"svelte": "^4.0.0",
|
|
49
|
+
"svelte-check": "^3.4.3",
|
|
40
50
|
"tslib": "^2.4.1",
|
|
41
|
-
"typescript": "^
|
|
51
|
+
"typescript": "^5.0.0",
|
|
42
52
|
"vite": "^4.2.0",
|
|
43
53
|
"vitest": "^0.25.3"
|
|
44
54
|
},
|
|
@@ -49,11 +59,15 @@
|
|
|
49
59
|
"keyborg": "^2.0.0",
|
|
50
60
|
"lodash-es": "^4.17.21"
|
|
51
61
|
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"svelte": "^4.0.0"
|
|
64
|
+
},
|
|
52
65
|
"exports": {
|
|
53
66
|
"./package.json": "./package.json",
|
|
54
67
|
"./Button.constants": "./Button.constants.js",
|
|
55
68
|
"./Button.svelte": "./Button.svelte",
|
|
56
69
|
"./Button.types": "./Button.types.js",
|
|
70
|
+
"./Callout.svelte": "./Callout.svelte",
|
|
57
71
|
"./Checkbox.svelte": "./Checkbox.svelte",
|
|
58
72
|
"./ColorPicker.constants": "./ColorPicker.constants.js",
|
|
59
73
|
"./ColorPicker.svelte": "./ColorPicker.svelte",
|
|
@@ -84,7 +98,9 @@
|
|
|
84
98
|
"./MenuItem.utils": "./MenuItem.utils.js",
|
|
85
99
|
"./MenuItemDisplay.svelte": "./MenuItemDisplay.svelte",
|
|
86
100
|
"./MenuSeparator.svelte": "./MenuSeparator.svelte",
|
|
101
|
+
"./Popover.constants": "./Popover.constants.js",
|
|
87
102
|
"./Popover.svelte": "./Popover.svelte",
|
|
103
|
+
"./Popover.types": "./Popover.types.js",
|
|
88
104
|
"./Progress.constants": "./Progress.constants.js",
|
|
89
105
|
"./Progress.svelte": "./Progress.svelte",
|
|
90
106
|
"./Progress.types": "./Progress.types.js",
|
|
@@ -100,9 +116,7 @@
|
|
|
100
116
|
"./TextArea.constants": "./TextArea.constants.js",
|
|
101
117
|
"./TextArea.svelte": "./TextArea.svelte",
|
|
102
118
|
"./TextArea.types": "./TextArea.types.js",
|
|
103
|
-
"./Tooltip.constants": "./Tooltip.constants.js",
|
|
104
119
|
"./Tooltip.svelte": "./Tooltip.svelte",
|
|
105
|
-
"./Tooltip.types": "./Tooltip.types.js",
|
|
106
120
|
"./Tree.constants": "./Tree.constants.js",
|
|
107
121
|
"./Tree.svelte": "./Tree.svelte",
|
|
108
122
|
"./Tree.types": "./Tree.types.js",
|
|
@@ -114,8 +128,6 @@
|
|
|
114
128
|
"./actions/forwardEvents": "./actions/forwardEvents.js",
|
|
115
129
|
"./actions/portal": "./actions/portal.js",
|
|
116
130
|
"./actions/trapKeyboardFocus": "./actions/trapKeyboardFocus.js",
|
|
117
|
-
"./floating-ui.constants": "./floating-ui.constants.js",
|
|
118
|
-
"./floating-ui.types": "./floating-ui.types.js",
|
|
119
131
|
"./idGenerator": "./idGenerator.js",
|
|
120
132
|
".": "./index.js",
|
|
121
133
|
"./stores/prefersReducedMotion": "./stores/prefersReducedMotion.js",
|
package/Tooltip.constants.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const TOOLTIP_SHOW_ONS: string[];
|
package/Tooltip.constants.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const TOOLTIP_SHOW_ONS = ['hover', 'click'];
|
package/Tooltip.types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const FLOATING_PLACEMENTS: string[];
|
package/floating-ui.types.d.ts
DELETED
package/floating-ui.types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|