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.
Files changed (73) hide show
  1. package/dist/@types/components.d.ts +1 -7
  2. package/dist/@types/dom.d.ts +4 -3
  3. package/dist/@types/props.d.ts +3 -3
  4. package/dist/animations/ripple.js +33 -17
  5. package/dist/components/accordion/accordion.svelte +192 -228
  6. package/dist/components/accordion/accordion.types.d.ts +5 -7
  7. package/dist/components/accordion/modules/accordion-item.svelte +144 -140
  8. package/dist/components/alert/alert.svelte +246 -293
  9. package/dist/components/alert/alert.types.d.ts +5 -5
  10. package/dist/components/app/app.svelte +29 -44
  11. package/dist/components/appbar/appbar.svelte +205 -190
  12. package/dist/components/appbar/appbar.types.d.ts +6 -6
  13. package/dist/components/aspect-ratio/aspect-ratio.svelte +43 -63
  14. package/dist/components/avatar/avatar.svelte +169 -161
  15. package/dist/components/avatar/avatar.types.d.ts +3 -4
  16. package/dist/components/btn/btn.svelte +431 -465
  17. package/dist/components/btn/btn.types.d.ts +5 -6
  18. package/dist/components/card/card.svelte +214 -176
  19. package/dist/components/card/card.types.d.ts +6 -3
  20. package/dist/components/card/modules/card-actions.svelte +11 -35
  21. package/dist/components/card/modules/card-container.svelte +9 -33
  22. package/dist/components/card/modules/card-content.svelte +18 -44
  23. package/dist/components/card/modules/card-media.svelte +10 -34
  24. package/dist/components/card/modules/card-title.svelte +22 -48
  25. package/dist/components/chip/chip.svelte +416 -464
  26. package/dist/components/chip/chip.types.d.ts +5 -5
  27. package/dist/components/dialog/dialog.svelte +174 -171
  28. package/dist/components/dialog/dialog.types.d.ts +6 -6
  29. package/dist/components/dropdown/dropdown.svelte +149 -144
  30. package/dist/components/dropdown/dropdown.types.d.ts +4 -11
  31. package/dist/components/field/field.svelte +474 -0
  32. package/dist/components/field/field.svelte.d.ts +4 -0
  33. package/dist/components/field/field.types.d.ts +46 -0
  34. package/dist/components/field/field.types.js +1 -0
  35. package/dist/components/icon/icon.svelte +67 -96
  36. package/dist/components/icon/icon.types.d.ts +2 -1
  37. package/dist/components/index.d.ts +2 -0
  38. package/dist/components/index.js +1 -0
  39. package/dist/components/list/list.svelte +193 -194
  40. package/dist/components/list/list.types.d.ts +5 -7
  41. package/dist/components/list/modules/list-item.svelte +134 -147
  42. package/dist/components/modal/modal.svelte +239 -222
  43. package/dist/components/modal/modal.types.d.ts +6 -6
  44. package/dist/components/popover/popover.svelte +125 -127
  45. package/dist/components/popover/popover.types.d.ts +4 -11
  46. package/dist/components/separator/separator.svelte +56 -87
  47. package/dist/components/separator/separator.types.d.ts +1 -1
  48. package/dist/components/spacer/spacer.svelte +6 -25
  49. package/dist/components/textfield/textfield.svelte +94 -543
  50. package/dist/components/textfield/textfield.types.d.ts +13 -33
  51. package/dist/components/toolbar/toolbar.svelte +216 -211
  52. package/dist/components/toolbar/toolbar.types.d.ts +8 -9
  53. package/dist/components/tooltip/tooltip.svelte +201 -266
  54. package/dist/components/tooltip/tooltip.types.d.ts +3 -10
  55. package/dist/constants.js +1 -0
  56. package/dist/html-mapped.d.ts +1 -15
  57. package/dist/html-mapped.js +0 -19
  58. package/dist/labs/sheet/sheet.svelte +145 -19
  59. package/dist/labs/sheet/sheet.svelte.d.ts +2 -10
  60. package/dist/labs/sheet/sheet.types.d.ts +16 -0
  61. package/dist/labs/sheet/sheet.types.js +1 -0
  62. package/dist/utils/color.d.ts +2 -2
  63. package/dist/utils/color.js +2 -1
  64. package/dist/utils/components.d.ts +10 -10
  65. package/dist/utils/components.js +16 -75
  66. package/dist/utils/floating.d.ts +58 -0
  67. package/dist/utils/floating.js +131 -0
  68. package/dist/utils/index.d.ts +1 -0
  69. package/dist/utils/index.js +1 -0
  70. package/package.json +3 -3
  71. package/dist/components/dropdown/dropdown.svelte.js +0 -148
  72. package/dist/components/popover/popover.svelte.js +0 -134
  73. 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 { useClassName, useStyles } from '../../utils';
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
- let { classProps, styleProps, restProps } = $derived(
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 resolvedStyle = $derived(
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 tooltipRef = $state<HTMLElement | null>(null);
73
- let axis = $state(positioner.values);
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
- clearTimeout(timer);
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={triggerClass}
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={handleKeydown}
83
+ onkeydown={(event) => event.key === 'Escape' && handleClose()}
168
84
  >
169
85
  {@render children?.()}
170
86
  </span>
171
87
 
172
- {#if open || forceMount}
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
- style={`transform: translate(${axis.x}px, ${axis.y}px); display:${open ? 'block' : 'none'}`}
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
- <div
182
- class={componentClass}
183
- style={resolvedStyle}
184
- data-density={density}
185
- data-location={axis.location ?? location}
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
- .kit-tooltip-trigger {
201
- display: inline-flex;
202
- width: fit-content;
203
- max-width: max-content;
204
- justify-self: start;
205
- align-self: start;
206
- }
207
-
208
- .kit-tooltip-trigger:focus-visible {
209
- outline: 2px solid var(--kit-color-focus);
210
- outline-offset: 2px;
211
- }
212
-
213
- .kit-tooltip {
214
- position: fixed;
215
- inset: 0 auto auto 0;
216
- z-index: 2000;
217
- margin: 0;
218
- pointer-events: none;
219
- }
220
-
221
- .kit-tooltip__content {
222
- --kit-tooltip-bg: var(--kit-color-surface-2);
223
- --kit-tooltip-fg: var(--kit-color-text);
224
-
225
- position: relative;
226
- display: inline-block;
227
- width: max-content;
228
- max-width: min(20rem, calc(100vw - 1rem));
229
- padding: calc(var(--kit-space-default) + var(--kit-tooltip-density-offset) / 2);
230
- border: 0;
231
- border-radius: var(--kit-tooltip-radius);
232
- background: var(--kit-tooltip-bg);
233
- color: var(--kit-tooltip-fg);
234
- font-size: 0.875rem;
235
- overflow-wrap: break-word;
236
- box-shadow: 0 16px 29px -10px color-mix(in oklab, var(--kit-color-shadow) 18%, transparent);
237
- animation: kit-tooltip-enter 150ms ease;
238
- }
239
-
240
- /**
241
- * density
242
- * @link no links
243
- */
244
- .kit-tooltip__content[data-density='compact'] {
245
- --kit-tooltip-density-offset: var(--kit-density-compact);
246
- }
247
- .kit-tooltip__content[data-density='default'] {
248
- --kit-tooltip-density-offset: var(--kit-density-default);
249
- }
250
- .kit-tooltip__content[data-density='comfortable'] {
251
- --kit-tooltip-density-offset: var(--kit-density-comfortable);
252
- }
253
-
254
- /**
255
- * rounded
256
- * @link ...
257
- */
258
- .kit-tooltip__content[data-rounded='0'] {
259
- --kit-tooltip-radius: var(--kit-shape-none);
260
- }
261
- .kit-tooltip__content[data-rounded='xs'] {
262
- --kit-tooltip-radius: var(--kit-shape-xs);
263
- }
264
- .kit-tooltip__content[data-rounded='sm'] {
265
- --kit-tooltip-radius: var(--kit-shape-sm);
266
- }
267
- .kit-tooltip__content[data-rounded='md'] {
268
- --kit-tooltip-radius: var(--kit-shape-md);
269
- }
270
- .kit-tooltip__content[data-rounded='lg'] {
271
- --kit-tooltip-radius: var(--kit-shape-lg);
272
- }
273
- .kit-tooltip__content[data-rounded='xl'] {
274
- --kit-tooltip-radius: var(--kit-shape-xl);
275
- }
276
- .kit-tooltip__content[data-rounded='full'] {
277
- --kit-tooltip-radius: var(--kit-shape-full);
278
- }
279
-
280
- .kit-tooltip__content[data-variant='arrow']::after {
281
- content: '';
282
- position: absolute;
283
- border-style: solid;
284
- }
285
-
286
- .kit-tooltip__content[data-variant='arrow'][data-location='bottom']::after,
287
- .kit-tooltip__content[data-variant='arrow'][data-location='top']::after {
288
- left: 50%;
289
- margin-left: -0.35rem;
290
- border-width: 0.35rem;
291
- }
292
-
293
- .kit-tooltip__content[data-variant='arrow'][data-location='bottom']::after {
294
- bottom: 100%;
295
- border-color: transparent transparent var(--kit-tooltip-bg) transparent;
296
- }
297
-
298
- .kit-tooltip__content[data-variant='arrow'][data-location='top']::after {
299
- top: 100%;
300
- border-color: var(--kit-tooltip-bg) transparent transparent transparent;
301
- }
302
-
303
- .kit-tooltip__content[data-variant='arrow'][data-location='left']::after,
304
- .kit-tooltip__content[data-variant='arrow'][data-location='right']::after {
305
- top: 50%;
306
- margin-top: -0.35rem;
307
- border-width: 0.35rem;
308
- }
309
-
310
- .kit-tooltip__content[data-variant='arrow'][data-location='right']::after {
311
- right: 100%;
312
- border-color: transparent var(--kit-tooltip-bg) transparent transparent;
313
- }
314
-
315
- .kit-tooltip__content[data-variant='arrow'][data-location='left']::after {
316
- left: 100%;
317
- border-color: transparent transparent transparent var(--kit-tooltip-bg);
318
- }
319
-
320
- .kit-tooltip__content[data-location='top'] {
321
- --kit-tooltip-enter-x: 0;
322
- --kit-tooltip-enter-y: 0.5rem;
323
- }
324
-
325
- .kit-tooltip__content[data-location='bottom'] {
326
- --kit-tooltip-enter-x: 0;
327
- --kit-tooltip-enter-y: -0.5rem;
328
- }
329
-
330
- .kit-tooltip__content[data-location='right'] {
331
- --kit-tooltip-enter-x: -0.5rem;
332
- --kit-tooltip-enter-y: 0;
333
- }
334
-
335
- .kit-tooltip__content[data-location='left'] {
336
- --kit-tooltip-enter-x: 0.5rem;
337
- --kit-tooltip-enter-y: 0;
338
- }
339
-
340
- @keyframes kit-tooltip-enter {
341
- from {
342
- opacity: 0;
343
- transform: translate(var(--kit-tooltip-enter-x, 0), var(--kit-tooltip-enter-y, 0)) scale(0.95);
344
- }
345
- }
346
- </style>
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 { Component, DensityType, PropValue, RoundedType } from '../../@types';
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?: string;
11
- background?: string;
10
+ color?: ColorProps;
12
11
  delayDuration?: number;
13
12
  variant?: 'arrow';
14
- density?: DensityType;
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',
@@ -1,18 +1,4 @@
1
- import type { PropValue, SClassProp, SStyleProp } from './@types';
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.
@@ -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.