lapikit 0.7.2 → 0.7.4
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/@types/components.d.ts +1 -7
- package/dist/@types/dom.d.ts +4 -3
- package/dist/@types/props.d.ts +3 -3
- package/dist/animations/ripple.js +33 -17
- package/dist/components/accordion/accordion.svelte +192 -228
- package/dist/components/accordion/accordion.types.d.ts +5 -7
- package/dist/components/accordion/modules/accordion-item.svelte +144 -140
- package/dist/components/alert/alert.svelte +246 -293
- package/dist/components/alert/alert.types.d.ts +5 -5
- package/dist/components/app/app.svelte +29 -44
- package/dist/components/appbar/appbar.svelte +205 -190
- package/dist/components/appbar/appbar.types.d.ts +6 -6
- package/dist/components/aspect-ratio/aspect-ratio.svelte +43 -63
- package/dist/components/avatar/avatar.svelte +169 -161
- package/dist/components/avatar/avatar.types.d.ts +3 -4
- package/dist/components/btn/btn.svelte +431 -465
- package/dist/components/btn/btn.types.d.ts +5 -6
- package/dist/components/card/card.svelte +214 -176
- package/dist/components/card/card.types.d.ts +6 -3
- package/dist/components/card/modules/card-actions.svelte +11 -35
- package/dist/components/card/modules/card-container.svelte +9 -33
- package/dist/components/card/modules/card-content.svelte +18 -44
- package/dist/components/card/modules/card-media.svelte +10 -34
- package/dist/components/card/modules/card-title.svelte +22 -48
- package/dist/components/chip/chip.svelte +416 -464
- package/dist/components/chip/chip.types.d.ts +5 -5
- package/dist/components/dialog/dialog.svelte +174 -171
- package/dist/components/dialog/dialog.types.d.ts +6 -6
- package/dist/components/dropdown/dropdown.svelte +149 -144
- package/dist/components/dropdown/dropdown.types.d.ts +4 -11
- package/dist/components/field/field.svelte +474 -0
- package/dist/components/field/field.svelte.d.ts +4 -0
- package/dist/components/field/field.types.d.ts +46 -0
- package/dist/components/field/field.types.js +1 -0
- package/dist/components/icon/icon.svelte +67 -96
- package/dist/components/icon/icon.types.d.ts +2 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +1 -0
- package/dist/components/list/list.svelte +193 -194
- package/dist/components/list/list.types.d.ts +5 -7
- package/dist/components/list/modules/list-item.svelte +134 -147
- package/dist/components/modal/modal.svelte +239 -222
- package/dist/components/modal/modal.types.d.ts +6 -6
- package/dist/components/popover/popover.svelte +125 -127
- package/dist/components/popover/popover.types.d.ts +4 -11
- package/dist/components/separator/separator.svelte +56 -87
- package/dist/components/separator/separator.types.d.ts +1 -1
- package/dist/components/spacer/spacer.svelte +6 -25
- package/dist/components/textfield/textfield.svelte +94 -543
- package/dist/components/textfield/textfield.types.d.ts +13 -33
- package/dist/components/toolbar/toolbar.svelte +216 -211
- package/dist/components/toolbar/toolbar.types.d.ts +8 -9
- package/dist/components/tooltip/tooltip.svelte +201 -266
- package/dist/components/tooltip/tooltip.types.d.ts +3 -10
- package/dist/constants.js +1 -0
- package/dist/html-mapped.d.ts +1 -15
- package/dist/html-mapped.js +0 -19
- package/dist/labs/sheet/sheet.svelte +145 -19
- package/dist/labs/sheet/sheet.svelte.d.ts +2 -10
- package/dist/labs/sheet/sheet.types.d.ts +16 -0
- package/dist/labs/sheet/sheet.types.js +1 -0
- package/dist/utils/color.d.ts +2 -2
- package/dist/utils/color.js +2 -1
- package/dist/utils/components.d.ts +10 -10
- package/dist/utils/components.js +16 -75
- package/dist/utils/floating.d.ts +58 -0
- package/dist/utils/floating.js +131 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +3 -3
- package/dist/components/dropdown/dropdown.svelte.js +0 -148
- package/dist/components/popover/popover.svelte.js +0 -134
- package/dist/components/tooltip/tooltip.svelte.js +0 -131
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { onDestroy } from 'svelte';
|
|
3
|
-
import {
|
|
4
|
-
import { makeComponentProps } from '../../html-mapped';
|
|
5
|
-
import { getPositionsTooltip } from './tooltip.svelte.js';
|
|
3
|
+
import { floating, useComponentAttrs } from '../../utils';
|
|
6
4
|
import type { TooltipProps } from './tooltip.types.js';
|
|
7
5
|
|
|
8
6
|
let {
|
|
@@ -14,85 +12,36 @@
|
|
|
14
12
|
label,
|
|
15
13
|
rounded = 'xs',
|
|
16
14
|
color,
|
|
17
|
-
background,
|
|
18
15
|
location = 'bottom',
|
|
19
16
|
delayDuration = 850,
|
|
20
17
|
density = 'default',
|
|
21
18
|
variant,
|
|
22
19
|
disabled = false,
|
|
23
20
|
avoidCollisions = true,
|
|
24
|
-
class: className
|
|
25
|
-
style: styleAttr
|
|
21
|
+
class: className,
|
|
22
|
+
style: styleAttr,
|
|
26
23
|
's-class': sClass,
|
|
27
24
|
's-style': sStyle,
|
|
28
25
|
...rest
|
|
29
26
|
}: TooltipProps = $props();
|
|
30
27
|
|
|
31
|
-
|
|
32
|
-
makeComponentProps(rest as Record<string, unknown>)
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
let triggerClass = $derived(
|
|
36
|
-
useClassName({
|
|
37
|
-
baseClass: 'kit-tooltip-trigger',
|
|
38
|
-
className: '',
|
|
39
|
-
sClass,
|
|
40
|
-
classProps
|
|
41
|
-
})
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
let componentClass = $derived(
|
|
45
|
-
useClassName({
|
|
46
|
-
baseClass: 'kit-tooltip__content',
|
|
47
|
-
className: `${className ?? ''}`.trim()
|
|
48
|
-
})
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
let componentStyle = $derived(
|
|
52
|
-
useStyles({
|
|
53
|
-
styleAttr,
|
|
54
|
-
sStyle,
|
|
55
|
-
styleProps
|
|
56
|
-
})
|
|
57
|
-
);
|
|
28
|
+
const tooltipId = $props.id();
|
|
58
29
|
|
|
59
|
-
let
|
|
60
|
-
|
|
61
|
-
componentStyle,
|
|
62
|
-
color ? `--kit-tooltip-fg:${color && `var(--kit-color-${color})`}` : '',
|
|
63
|
-
background ? `--kit-tooltip-bg:${background && `var(--kit-color-${background})`}` : ''
|
|
64
|
-
]
|
|
65
|
-
.filter(Boolean)
|
|
66
|
-
.join('; ')
|
|
30
|
+
let attrs = $derived(
|
|
31
|
+
useComponentAttrs('kit-tooltip', { className, sClass, styleAttr, sStyle, color }, rest)
|
|
67
32
|
);
|
|
68
33
|
|
|
69
|
-
const positioner = getPositionsTooltip();
|
|
70
|
-
|
|
71
34
|
let triggerRef = $state<HTMLElement | null>(null);
|
|
72
|
-
let
|
|
73
|
-
let
|
|
74
|
-
let timer = $state<ReturnType<typeof setTimeout> | null>(null);
|
|
75
|
-
const tooltipId = `kit-tooltip-${Math.random().toString(36).slice(2, 10)}`;
|
|
35
|
+
let timer: ReturnType<typeof setTimeout> | null = null;
|
|
36
|
+
let mounted = $derived(open || forceMount || !!tooltip);
|
|
76
37
|
|
|
77
38
|
const clearTimer = () => {
|
|
78
|
-
if (timer)
|
|
79
|
-
|
|
80
|
-
timer = null;
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const updatePosition = () => {
|
|
85
|
-
if (!triggerRef || !tooltipRef) return;
|
|
86
|
-
positioner.update(triggerRef, tooltipRef, location, true, avoidCollisions);
|
|
87
|
-
axis = positioner.values;
|
|
39
|
+
if (timer) clearTimeout(timer);
|
|
40
|
+
timer = null;
|
|
88
41
|
};
|
|
89
42
|
|
|
90
43
|
const handleHoverOpen = () => {
|
|
91
|
-
if (disabled)
|
|
92
|
-
open = false;
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
|
|
44
|
+
if (disabled) return;
|
|
96
45
|
clearTimer();
|
|
97
46
|
timer = setTimeout(() => {
|
|
98
47
|
open = true;
|
|
@@ -101,11 +50,7 @@
|
|
|
101
50
|
};
|
|
102
51
|
|
|
103
52
|
const handleFocusOpen = () => {
|
|
104
|
-
if (disabled)
|
|
105
|
-
open = false;
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
|
|
53
|
+
if (disabled) return;
|
|
109
54
|
clearTimer();
|
|
110
55
|
open = true;
|
|
111
56
|
};
|
|
@@ -115,232 +60,222 @@
|
|
|
115
60
|
open = false;
|
|
116
61
|
};
|
|
117
62
|
|
|
118
|
-
const handleKeydown = (event: KeyboardEvent) => {
|
|
119
|
-
if (event.key === 'Escape') handleClose();
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
$effect(() => {
|
|
123
|
-
if (tooltip) forceMount = true;
|
|
124
|
-
});
|
|
125
|
-
|
|
126
63
|
$effect(() => {
|
|
127
64
|
if (disabled) open = false;
|
|
128
65
|
});
|
|
129
66
|
|
|
130
|
-
$effect(() => {
|
|
131
|
-
if (open && triggerRef && tooltipRef) {
|
|
132
|
-
updatePosition();
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
$effect(() => {
|
|
137
|
-
if (!open) return;
|
|
138
|
-
|
|
139
|
-
window.addEventListener('scroll', updatePosition, { passive: true });
|
|
140
|
-
window.addEventListener('resize', updatePosition);
|
|
141
|
-
|
|
142
|
-
return () => {
|
|
143
|
-
window.removeEventListener('scroll', updatePosition);
|
|
144
|
-
window.removeEventListener('resize', updatePosition);
|
|
145
|
-
};
|
|
146
|
-
});
|
|
147
|
-
|
|
148
67
|
$effect(() => {
|
|
149
68
|
ref = triggerRef;
|
|
150
69
|
});
|
|
151
70
|
|
|
152
|
-
onDestroy(
|
|
153
|
-
clearTimer();
|
|
154
|
-
});
|
|
71
|
+
onDestroy(clearTimer);
|
|
155
72
|
</script>
|
|
156
73
|
|
|
157
74
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
158
75
|
<span
|
|
159
76
|
bind:this={triggerRef}
|
|
160
|
-
class=
|
|
161
|
-
style="display:inline-flex"
|
|
77
|
+
class="kit-tooltip-trigger"
|
|
162
78
|
aria-describedby={open ? tooltipId : undefined}
|
|
163
79
|
onmouseenter={handleHoverOpen}
|
|
164
80
|
onmouseleave={handleClose}
|
|
165
81
|
onfocusin={handleFocusOpen}
|
|
166
82
|
onfocusout={handleClose}
|
|
167
|
-
onkeydown={
|
|
83
|
+
onkeydown={(event) => event.key === 'Escape' && handleClose()}
|
|
168
84
|
>
|
|
169
85
|
{@render children?.()}
|
|
170
86
|
</span>
|
|
171
87
|
|
|
172
|
-
{#if
|
|
88
|
+
{#if mounted}
|
|
173
89
|
<div
|
|
174
|
-
bind:this={tooltipRef}
|
|
175
|
-
class="kit-tooltip"
|
|
176
90
|
id={tooltipId}
|
|
91
|
+
popover="manual"
|
|
177
92
|
role="tooltip"
|
|
178
93
|
aria-label={label}
|
|
179
|
-
|
|
94
|
+
class={attrs.class}
|
|
95
|
+
style={attrs.style}
|
|
96
|
+
data-density={density}
|
|
97
|
+
data-variant={variant}
|
|
98
|
+
data-rounded={rounded}
|
|
99
|
+
use:floating={{
|
|
100
|
+
anchor: triggerRef,
|
|
101
|
+
open,
|
|
102
|
+
side: location,
|
|
103
|
+
align: 'center',
|
|
104
|
+
offset: 6,
|
|
105
|
+
flip: avoidCollisions
|
|
106
|
+
}}
|
|
107
|
+
{...attrs.rest}
|
|
180
108
|
>
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
data-variant={variant}
|
|
187
|
-
data-rounded={rounded}
|
|
188
|
-
{...restProps}
|
|
189
|
-
>
|
|
190
|
-
{#if tooltip}
|
|
191
|
-
{@render tooltip?.()}
|
|
192
|
-
{:else}
|
|
193
|
-
{label}
|
|
194
|
-
{/if}
|
|
195
|
-
</div>
|
|
109
|
+
{#if tooltip}
|
|
110
|
+
{@render tooltip()}
|
|
111
|
+
{:else}
|
|
112
|
+
{label}
|
|
113
|
+
{/if}
|
|
196
114
|
</div>
|
|
197
115
|
{/if}
|
|
198
116
|
|
|
199
|
-
<style
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
117
|
+
<style>:where(.kit-tooltip) {
|
|
118
|
+
--kit-tooltip-color: initial;
|
|
119
|
+
--kit-tooltip-on-color: initial;
|
|
120
|
+
--kit-tooltip-active-fg: initial;
|
|
121
|
+
--kit-tooltip-active-shade: initial;
|
|
122
|
+
--kit-tooltip-hover-fg: initial;
|
|
123
|
+
--kit-tooltip-pressed-fg: initial;
|
|
124
|
+
--kit-tooltip-bg: var(--kit-tooltip-color, var(--kit-color-surface-2));
|
|
125
|
+
--kit-tooltip-fg: var(--kit-tooltip-on-color, var(--kit-tooltip-contrast, var(--kit-color-text)));
|
|
126
|
+
--kit-tooltip-ink: var(--kit-tooltip-color, var(--kit-color-text));
|
|
127
|
+
--kit-tooltip-hover: color-mix(in oklab, var(--kit-tooltip-bg), var(--kit-tooltip-fg) 8%);
|
|
128
|
+
--kit-tooltip-pressed: color-mix(in oklab, var(--kit-tooltip-bg), var(--kit-tooltip-fg) 14%);
|
|
129
|
+
--kit-tooltip-soft: color-mix(in oklab, var(--kit-tooltip-bg) 16%, transparent);
|
|
130
|
+
--kit-tooltip-border: color-mix(in oklab, var(--kit-tooltip-bg), var(--kit-tooltip-fg) 20%);
|
|
131
|
+
--kit-tooltip-active: color-mix(
|
|
132
|
+
in oklab,
|
|
133
|
+
var(--kit-tooltip-color),
|
|
134
|
+
var(--kit-tooltip-fg) var(--kit-tooltip-active-shade, 14%)
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
@supports (color: color(from red srgb-linear r g b)) {
|
|
138
|
+
:where(.kit-tooltip) {
|
|
139
|
+
--kit-tooltip-contrast: color(from var(--kit-tooltip-color) srgb-linear clamp(0, (0.1791 - (0.2126 * r + 0.7152 * g + 0.0722 * b)) * 100000, 1) clamp(0, (0.1791 - (0.2126 * r + 0.7152 * g + 0.0722 * b)) * 100000, 1) clamp(0, (0.1791 - (0.2126 * r + 0.7152 * g + 0.0722 * b)) * 100000, 1)/1);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
:where(.kit-tooltip) {
|
|
143
|
+
--kit-tooltip-arrow: 0.35rem;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.kit-tooltip-trigger {
|
|
147
|
+
display: inline-flex;
|
|
148
|
+
align-self: start;
|
|
149
|
+
justify-self: start;
|
|
150
|
+
width: fit-content;
|
|
151
|
+
max-width: max-content;
|
|
152
|
+
}
|
|
153
|
+
.kit-tooltip-trigger:focus-visible {
|
|
154
|
+
outline: 2px solid var(--kit-color-focus);
|
|
155
|
+
outline-offset: 2px;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.kit-tooltip {
|
|
159
|
+
position: fixed;
|
|
160
|
+
inset: auto;
|
|
161
|
+
z-index: 2000;
|
|
162
|
+
box-sizing: border-box;
|
|
163
|
+
width: max-content;
|
|
164
|
+
max-width: min(20rem, 100vw - 1rem);
|
|
165
|
+
margin: 0;
|
|
166
|
+
padding: calc(var(--kit-space-default) + var(--kit-tooltip-density-offset) / 2);
|
|
167
|
+
overflow: visible;
|
|
168
|
+
border: 0;
|
|
169
|
+
border-radius: var(--kit-tooltip-radius);
|
|
170
|
+
background-color: var(--kit-tooltip-bg);
|
|
171
|
+
color: var(--kit-tooltip-fg);
|
|
172
|
+
font-size: 0.875rem;
|
|
173
|
+
overflow-wrap: break-word;
|
|
174
|
+
pointer-events: none;
|
|
175
|
+
box-shadow: 0 16px 29px -10px color-mix(in oklab, var(--kit-color-shadow) 18%, transparent);
|
|
176
|
+
animation: kit-tooltip-enter 150ms ease;
|
|
177
|
+
}
|
|
178
|
+
.kit-tooltip[data-side=top] {
|
|
179
|
+
--kit-tooltip-enter-y: 0.5rem;
|
|
180
|
+
}
|
|
181
|
+
.kit-tooltip[data-side=bottom] {
|
|
182
|
+
--kit-tooltip-enter-y: -0.5rem;
|
|
183
|
+
}
|
|
184
|
+
.kit-tooltip[data-side=right] {
|
|
185
|
+
--kit-tooltip-enter-x: -0.5rem;
|
|
186
|
+
}
|
|
187
|
+
.kit-tooltip[data-side=left] {
|
|
188
|
+
--kit-tooltip-enter-x: 0.5rem;
|
|
189
|
+
}
|
|
190
|
+
.kit-tooltip[data-variant=arrow]::after {
|
|
191
|
+
content: "";
|
|
192
|
+
position: absolute;
|
|
193
|
+
border: var(--kit-tooltip-arrow) solid transparent;
|
|
194
|
+
}
|
|
195
|
+
.kit-tooltip[data-variant=arrow]:is([data-side=top], [data-side=bottom])::after {
|
|
196
|
+
left: var(--kit-floating-arrow, 50%);
|
|
197
|
+
margin-left: calc(var(--kit-tooltip-arrow) * -1);
|
|
198
|
+
}
|
|
199
|
+
.kit-tooltip[data-variant=arrow]:is([data-side=left], [data-side=right])::after {
|
|
200
|
+
top: var(--kit-floating-arrow, 50%);
|
|
201
|
+
margin-top: calc(var(--kit-tooltip-arrow) * -1);
|
|
202
|
+
}
|
|
203
|
+
.kit-tooltip[data-variant=arrow][data-side=bottom]::after {
|
|
204
|
+
bottom: 100%;
|
|
205
|
+
border-bottom-color: var(--kit-tooltip-bg);
|
|
206
|
+
}
|
|
207
|
+
.kit-tooltip[data-variant=arrow][data-side=top]::after {
|
|
208
|
+
top: 100%;
|
|
209
|
+
border-top-color: var(--kit-tooltip-bg);
|
|
210
|
+
}
|
|
211
|
+
.kit-tooltip[data-variant=arrow][data-side=right]::after {
|
|
212
|
+
right: 100%;
|
|
213
|
+
border-right-color: var(--kit-tooltip-bg);
|
|
214
|
+
}
|
|
215
|
+
.kit-tooltip[data-variant=arrow][data-side=left]::after {
|
|
216
|
+
left: 100%;
|
|
217
|
+
border-left-color: var(--kit-tooltip-bg);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
@keyframes kit-tooltip-enter {
|
|
221
|
+
from {
|
|
222
|
+
opacity: 0;
|
|
223
|
+
translate: var(--kit-tooltip-enter-x, 0) var(--kit-tooltip-enter-y, 0);
|
|
224
|
+
scale: 0.95;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* rounded
|
|
229
|
+
* @link https://lapikit.dev/docs/customize
|
|
230
|
+
*/
|
|
231
|
+
:where(.kit-tooltip[data-rounded="0"]) {
|
|
232
|
+
--kit-tooltip-radius: var(--kit-shape-none);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
:where(.kit-tooltip[data-rounded=xs]) {
|
|
236
|
+
--kit-tooltip-radius: var(--kit-shape-xs);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
:where(.kit-tooltip[data-rounded=sm]) {
|
|
240
|
+
--kit-tooltip-radius: var(--kit-shape-sm);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
:where(.kit-tooltip[data-rounded=md]) {
|
|
244
|
+
--kit-tooltip-radius: var(--kit-shape-md);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
:where(.kit-tooltip[data-rounded=lg]) {
|
|
248
|
+
--kit-tooltip-radius: var(--kit-shape-lg);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
:where(.kit-tooltip[data-rounded=xl]) {
|
|
252
|
+
--kit-tooltip-radius: var(--kit-shape-xl);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
:where(.kit-tooltip[data-rounded=full]) {
|
|
256
|
+
--kit-tooltip-radius: var(--kit-shape-full);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* density
|
|
261
|
+
* @link https://lapikit.dev/docs/components/tooltip#density
|
|
262
|
+
*/
|
|
263
|
+
:where(.kit-tooltip[data-density=dense]) {
|
|
264
|
+
--kit-tooltip-density-offset: var(--kit-density-dense);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
:where(.kit-tooltip[data-density=compact]) {
|
|
268
|
+
--kit-tooltip-density-offset: var(--kit-density-compact);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
:where(.kit-tooltip[data-density=default]) {
|
|
272
|
+
--kit-tooltip-density-offset: var(--kit-density-default);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
:where(.kit-tooltip[data-density=comfortable]) {
|
|
276
|
+
--kit-tooltip-density-offset: var(--kit-density-comfortable);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
:where(.kit-tooltip[data-density=spacious]) {
|
|
280
|
+
--kit-tooltip-density-offset: var(--kit-density-spacious);
|
|
281
|
+
}</style>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ColorProps, Component, RoundedType } from '../../@types';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
export interface TooltipProps extends Component {
|
|
4
4
|
ref?: HTMLElement | null;
|
|
@@ -7,18 +7,11 @@ export interface TooltipProps extends Component {
|
|
|
7
7
|
rounded?: RoundedType | 'full';
|
|
8
8
|
label?: string;
|
|
9
9
|
location?: 'top' | 'bottom' | 'left' | 'right';
|
|
10
|
-
color?:
|
|
11
|
-
background?: string;
|
|
10
|
+
color?: ColorProps;
|
|
12
11
|
delayDuration?: number;
|
|
13
12
|
variant?: 'arrow';
|
|
14
|
-
density?:
|
|
13
|
+
density?: 'dense' | 'compact' | 'default' | 'comfortable' | 'spacious';
|
|
15
14
|
disabled?: boolean;
|
|
16
15
|
avoidCollisions?: boolean;
|
|
17
16
|
tooltip?: Snippet;
|
|
18
|
-
[key: string]: PropValue | Record<string, PropValue> | unknown;
|
|
19
17
|
}
|
|
20
|
-
export type PositionElement = {
|
|
21
|
-
x: number;
|
|
22
|
-
y: number;
|
|
23
|
-
location: 'top' | 'bottom' | 'left' | 'right' | null;
|
|
24
|
-
};
|
package/dist/constants.js
CHANGED
|
@@ -9,6 +9,7 @@ export const lapikitComponentPaths = {
|
|
|
9
9
|
dropdown: 'dropdown/dropdown.svelte',
|
|
10
10
|
popover: 'popover/popover.svelte',
|
|
11
11
|
tooltip: 'tooltip/tooltip.svelte',
|
|
12
|
+
field: 'field/field.svelte',
|
|
12
13
|
textfield: 'textfield/textfield.svelte',
|
|
13
14
|
toolbar: 'toolbar/toolbar.svelte',
|
|
14
15
|
list: 'list/list.svelte',
|
package/dist/html-mapped.d.ts
CHANGED
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
import type { PropValue
|
|
2
|
-
/**
|
|
3
|
-
* Computes a string of class names based on the provided sClass and classDirectiveProps.
|
|
4
|
-
* @param sClass - The s-class property which can be a string, array, or object.
|
|
5
|
-
* @param classDirectiveProps - An object containing s-class_xxx directives.
|
|
6
|
-
* @returns A string of class names.
|
|
7
|
-
*/
|
|
8
|
-
export declare function computeSClasses(sClass: SClassProp, classDirectiveProps: Record<string, unknown>): string;
|
|
9
|
-
/**
|
|
10
|
-
* Computes a string of style declarations based on the provided sStyle and styleDirectiveProps.
|
|
11
|
-
* @param sStyle - The s-style property which is an object of style key-value pairs.
|
|
12
|
-
* @param styleDirectiveProps - An object containing s-style_xxx directives.
|
|
13
|
-
* @returns A string of style declarations.
|
|
14
|
-
*/
|
|
15
|
-
export declare function computeSStyles(sStyle: SStyleProp, styleDirectiveProps: Record<string, unknown>): string;
|
|
1
|
+
import type { PropValue } from './@types';
|
|
16
2
|
/**
|
|
17
3
|
* Makes component props by separating s-class and s-style directives from other props.
|
|
18
4
|
* Optimized to use a single pass instead of three separate iterations.
|
package/dist/html-mapped.js
CHANGED
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
import { useClassName, useStyles } from './utils/components.js';
|
|
2
|
-
/**
|
|
3
|
-
* Computes a string of class names based on the provided sClass and classDirectiveProps.
|
|
4
|
-
* @param sClass - The s-class property which can be a string, array, or object.
|
|
5
|
-
* @param classDirectiveProps - An object containing s-class_xxx directives.
|
|
6
|
-
* @returns A string of class names.
|
|
7
|
-
*/
|
|
8
|
-
export function computeSClasses(sClass, classDirectiveProps) {
|
|
9
|
-
return useClassName({ sClass, classProps: classDirectiveProps });
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Computes a string of style declarations based on the provided sStyle and styleDirectiveProps.
|
|
13
|
-
* @param sStyle - The s-style property which is an object of style key-value pairs.
|
|
14
|
-
* @param styleDirectiveProps - An object containing s-style_xxx directives.
|
|
15
|
-
* @returns A string of style declarations.
|
|
16
|
-
*/
|
|
17
|
-
export function computeSStyles(sStyle, styleDirectiveProps) {
|
|
18
|
-
return useStyles({ sStyle, styleProps: styleDirectiveProps });
|
|
19
|
-
}
|
|
20
1
|
/**
|
|
21
2
|
* Makes component props by separating s-class and s-style directives from other props.
|
|
22
3
|
* Optimized to use a single pass instead of three separate iterations.
|