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,96 +1,68 @@
1
1
  <script lang="ts">
2
- import { useClassName, useElevation, useStyles } from '../../utils';
3
- import { makeComponentProps } from '../../html-mapped';
2
+ import { useComponentAttrs, useElevation } from '../../utils';
4
3
  import type { AlertProps } from './alert.types.js';
5
4
 
6
5
  let {
7
6
  ref = $bindable(),
8
7
  is = 'div',
9
8
  children,
10
- class: className = '',
11
- style: styleAttr = '',
9
+ class: className,
10
+ style: styleAttr,
12
11
  's-class': sClass,
13
12
  's-style': sStyle,
14
13
  open = $bindable(true),
15
14
  closable,
15
+ multiline,
16
16
  size = 'md',
17
17
  variant = 'filled',
18
18
  density = 'default',
19
19
  rounded = 'md',
20
20
  tone = 'default',
21
21
  color,
22
- background,
23
22
  prepend,
24
23
  append,
25
24
  close,
26
- multiline,
27
25
  elevation,
28
26
  ...rest
29
27
  }: AlertProps = $props();
30
28
 
31
- let { classProps, styleProps, restProps } = $derived(
32
- makeComponentProps(rest as Record<string, unknown>)
29
+ let resolvedColor = $derived(color ?? (tone === 'default' ? undefined : tone));
30
+ let attrs = $derived(
31
+ useComponentAttrs(
32
+ 'kit-alert',
33
+ { className, sClass, styleAttr, sStyle, color: resolvedColor },
34
+ rest
35
+ )
33
36
  );
34
-
35
37
  let elevationState = $derived(useElevation(elevation));
36
-
37
- let componentClass = $derived(
38
- useClassName({
39
- baseClass: 'kit-alert',
40
- className: `${className ?? ''}`.trim(),
41
- sClass,
42
- classProps
43
- })
44
- );
45
-
46
- let componentStyle = $derived(
47
- useStyles({
48
- styleAttr,
49
- sStyle,
50
- styleProps
51
- })
52
- );
53
-
54
- let resolvedStyle = $derived(
55
- [
56
- componentStyle,
57
- color ? `--kit-alert-fg:${color && `var(--kit-color-${color})`}` : '',
58
- background ? `--kit-alert-bg:${background && `var(--kit-color-${background})`}` : ''
59
- ]
60
- .filter(Boolean)
61
- .join('; ')
62
- );
38
+ let hasOutline = $derived(variant === 'outline' || variant === 'surface');
39
+ let role = $derived(tone === 'warning' || tone === 'error' ? 'alert' : 'status');
63
40
  </script>
64
41
 
65
- {#if !closable || (closable && open)}
42
+ {#if !closable || open}
66
43
  <svelte:element
67
44
  this={is}
68
45
  bind:this={ref}
69
- class={componentClass}
70
- style={resolvedStyle}
71
- role="alert"
72
- data-size={size}
46
+ class={attrs.class}
47
+ style={attrs.style}
48
+ {role}
73
49
  data-variant={variant}
50
+ data-size={size}
74
51
  data-density={density}
75
52
  data-rounded={rounded}
76
53
  data-tone={tone}
77
- data-mutline={multiline}
78
- data-append={append && true}
79
- data-prepend={prepend && true}
80
- data-closable={closable && true}
54
+ data-multiline={multiline}
81
55
  data-elevation={elevationState.base}
82
56
  data-elevation-hover={elevationState.hover}
83
57
  data-elevation-active={elevationState.active}
84
- {...restProps}
58
+ {...attrs.rest}
85
59
  >
86
- {#if variant === 'outline'}
60
+ {#if hasOutline}
87
61
  <span class="outline"></span>
88
62
  {/if}
89
63
 
90
64
  {#if prepend}
91
- <span class="kit-alert__prepend">
92
- {@render prepend?.()}
93
- </span>
65
+ <span class="kit-alert__prepend">{@render prepend()}</span>
94
66
  {/if}
95
67
 
96
68
  <div class="kit-alert__content">
@@ -98,20 +70,18 @@
98
70
  </div>
99
71
 
100
72
  {#if append}
101
- <span class="kit-alert__append">
102
- {@render append?.()}
103
- </span>
73
+ <span class="kit-alert__append">{@render append()}</span>
104
74
  {/if}
105
75
 
106
76
  {#if closable}
107
77
  <button
108
78
  class="kit-alert__close"
109
79
  type="button"
110
- aria-label="close"
80
+ aria-label="Close"
111
81
  onclick={() => (open = false)}
112
82
  >
113
83
  {#if close}
114
- {@render close?.()}
84
+ {@render close()}
115
85
  {:else}
116
86
  <svg viewBox="0 0 24 24" aria-hidden="true">
117
87
  <path
@@ -125,241 +95,224 @@
125
95
  </svelte:element>
126
96
  {/if}
127
97
 
128
- <style>
129
- .kit-alert {
130
- position: relative;
131
- display: grid;
132
- grid-template-columns: minmax(0, 1fr);
133
- gap: var(--kit-alert-gap);
134
- min-height: calc(var(--kit-alert-item-h) + var(--kit-alert-density-offset) / 2);
135
- padding: calc(var(--kit-alert-p) + var(--kit-alert-density-offset) / 2);
136
- border-radius: var(--kit-alert-radius);
137
- color: var(--kit-alert-fg);
138
- background: var(--kit-alert-bg);
139
- font-size: var(--kit-alert-font);
140
- border: 0;
141
- }
142
-
143
- .kit-alert[data-mutline='true'] .kit-alert__prepend,
144
- .kit-alert[data-mutline='true'] .kit-alert__content,
145
- .kit-alert[data-mutline='true'] .kit-alert__append,
146
- .kit-alert[data-mutline='true'] .kit-alert__close {
147
- display: flex;
148
- align-items: start;
149
- }
150
-
151
- .kit-alert:not([data-mutline='true']) .kit-alert__prepend,
152
- .kit-alert:not([data-mutline='true']) .kit-alert__content,
153
- .kit-alert:not([data-mutline='true']) .kit-alert__append,
154
- .kit-alert:not([data-mutline='true']) .kit-alert__close {
155
- display: flex;
156
- align-items: center;
157
- }
158
-
159
- .kit-alert__close svg {
160
- width: 1.125rem;
161
- height: 1.125rem;
162
- display: block;
163
- }
164
-
165
- .kit-alert[data-prepend='true']:not([data-append='true']):not([data-closable='true']) {
166
- grid-template-columns: auto minmax(0, 1fr);
167
- }
168
- .kit-alert[data-append='true']:not([data-prepend='true']):not([data-closable='true']),
169
- .kit-alert[data-closable='true']:not([data-prepend='true']):not([data-append='true']) {
170
- grid-template-columns: minmax(0, 1fr) auto;
171
- }
172
-
173
- .kit-alert[data-append='true']:not([data-prepend='true']):not([data-closable='true']) {
174
- grid-template-columns: minmax(0, 1fr) auto;
175
- }
176
- .kit-alert[data-prepend='true'][data-closable='true']:not([data-append='true']),
177
- .kit-alert[data-prepend='true'][data-append='true']:not([data-closable='true']) {
178
- grid-template-columns: auto minmax(0, 1fr) auto;
179
- }
180
- .kit-alert[data-append='true'][data-closable='true']:not([data-prepend='true']) {
181
- grid-template-columns: minmax(0, 1fr) auto auto;
182
- }
183
- .kit-alert[data-prepend='true'][data-append='true'][data-closable='true'] {
184
- grid-template-columns: auto minmax(0, 1fr) auto auto;
185
- }
186
-
187
- /**
188
- * rounded
189
- * @link ...
190
- */
191
- .kit-alert[data-rounded='0'] {
192
- --kit-alert-radius: var(--kit-shape-none);
193
- }
194
- .kit-alert[data-rounded='xs'] {
195
- --kit-alert-radius: var(--kit-shape-xs);
196
- }
197
- .kit-alert[data-rounded='sm'] {
198
- --kit-alert-radius: var(--kit-shape-sm);
199
- }
200
- .kit-alert[data-rounded='md'] {
201
- --kit-alert-radius: var(--kit-shape-md);
202
- }
203
- .kit-alert[data-rounded='lg'] {
204
- --kit-alert-radius: var(--kit-shape-lg);
205
- }
206
- .kit-alert[data-rounded='xl'] {
207
- --kit-alert-radius: var(--kit-shape-xl);
208
- }
209
- .kit-alert[data-rounded='full'] {
210
- --kit-alert-radius: var(--kit-shape-full);
211
- }
212
-
213
- /**
214
- * density
215
- * @link no links
216
- */
217
- .kit-alert[data-density='compact'] {
218
- --kit-alert-density-offset: var(--kit-density-compact);
219
- }
220
- .kit-alert[data-density='default'] {
221
- --kit-alert-density-offset: var(--kit-density-default);
222
- }
223
- .kit-alert[data-density='comfortable'] {
224
- --kit-alert-density-offset: var(--kit-density-comfortable);
225
- }
226
-
227
- /**
228
- * variant
229
- * @link no links...
230
- */
231
- .kit-alert[data-variant='filled'] {
232
- --kit-alert-bg: var(--kit-color-surface-2);
233
- --kit-alert-fg: var(--kit-color-text);
234
-
235
- --kit-alert-hover-bg: color-mix(in oklab, var(--kit-alert-bg), black 10%);
236
- --kit-alert-active-bg: color-mix(in oklab, var(--kit-alert-bg), black 16%);
237
- }
238
- .kit-alert[data-variant='outline'] {
239
- --kit-alert-bg: transparent;
240
- --kit-alert-fg: var(--kit-color-text);
241
- --kit-alert-bd: var(--kit-alert-fg);
242
-
243
- --kit-alert-hover-bg: color-mix(in oklab, var(--kit-alert-fg), transparent 80%);
244
- --kit-alert-active-bg: color-mix(in oklab, var(--kit-alert-fg), transparent 92%);
245
- }
246
- .kit-alert[data-variant='text'] {
247
- --kit-alert-bg: transparent;
248
- --kit-alert-fg: var(--kit-color-text);
249
-
250
- --kit-alert-hover-bg: color-mix(in oklab, var(--kit-alert-fg), transparent 80%);
251
- --kit-alert-active-bg: color-mix(in oklab, var(--kit-alert-fg), transparent 92%);
252
- }
253
-
254
- /**
255
- * size
256
- * @link nothing...
257
- */
258
- .kit-alert[data-size='xs'] {
259
- --kit-alert-h: 32px;
260
- --kit-alert-p: 8px;
261
- --kit-alert-gap: var(--kit-space-compact);
262
- --kit-alert-font: var(--kit-font-xs);
263
- }
264
- .kit-alert[data-size='sm'] {
265
- --kit-alert-h: 40px;
266
- --kit-alert-p: 10px;
267
- --kit-alert-gap: var(--kit-space-default);
268
- --kit-alert-font: var(--kit-font-sm);
269
- }
270
- .kit-alert[data-size='md'] {
271
- --kit-alert-h: 48px;
272
- --kit-alert-p: 12px;
273
- --kit-alert-gap: var(--kit-space-default);
274
- --kit-alert-font: var(--kit-font-md);
275
- }
276
- .kit-alert[data-size='lg'] {
277
- --kit-alert-h: 56px;
278
- --kit-alert-p: 16px;
279
- --kit-alert-gap: var(--kit-space-default);
280
- --kit-alert-font: var(--kit-font-lg);
281
- }
282
- .kit-alert[data-size='xl'] {
283
- --kit-alert-h: 64px;
284
- --kit-alert-p: 20px;
285
- --kit-alert-gap: var(--kit-space-comfortable);
286
- --kit-alert-font: var(--kit-font-xl);
287
- }
288
-
289
- /**
290
- * tone
291
- * @link nothing...
292
- */
293
- .kit-alert[data-tone='info'][data-variant='filled'] {
294
- --kit-alert-bg: var(--kit-color-info);
295
- --kit-alert-fg: var(--kit-color-on-info);
296
- }
297
- .kit-alert[data-tone='info'][data-variant='outline'],
298
- .kit-alert[data-tone='info'][data-variant='text'] {
299
- --kit-alert-fg: var(--kit-color-info);
300
- }
301
-
302
- .kit-alert[data-tone='success'][data-variant='filled'] {
303
- --kit-alert-bg: var(--kit-color-success);
304
- --kit-alert-fg: var(--kit-color-on-success);
305
- }
306
- .kit-alert[data-tone='success'][data-variant='outline'],
307
- .kit-alert[data-tone='success'][data-variant='text'] {
308
- --kit-alert-fg: var(--kit-color-success);
309
- }
310
-
311
- .kit-alert[data-tone='warning'][data-variant='filled'] {
312
- --kit-alert-bg: var(--kit-color-warning);
313
- --kit-alert-fg: var(--kit-color-on-warning);
314
- }
315
- .kit-alert[data-tone='warning'][data-variant='outline'],
316
- .kit-alert[data-tone='warning'][data-variant='text'] {
317
- --kit-alert-fg: var(--kit-color-warning);
318
- }
319
-
320
- .kit-alert[data-tone='error'][data-variant='filled'] {
321
- --kit-alert-bg: var(--kit-color-error);
322
- --kit-alert-fg: var(--kit-color-on-error);
323
- }
324
- .kit-alert[data-tone='error'][data-variant='outline'],
325
- .kit-alert[data-tone='error'][data-variant='text'] {
326
- --kit-alert-fg: var(--kit-color-error);
327
- }
328
-
329
- .kit-alert__prepend,
330
- .kit-alert__append {
331
- display: inline-flex;
332
- align-items: center;
333
- justify-content: center;
334
- line-height: 1;
335
- }
336
-
337
- .kit-alert__content {
338
- min-width: 0;
339
- line-height: 1.4;
340
- }
341
-
342
- .kit-alert__close {
343
- appearance: none;
344
- border: 0;
345
- background: transparent;
346
- color: inherit;
347
- padding: 0;
348
- width: 1.25rem;
349
- height: 1.25rem;
350
- display: inline-flex;
351
- align-items: center;
352
- justify-content: center;
353
- cursor: pointer;
354
- border-radius: 6px;
355
- }
356
-
357
- .kit-alert .outline {
358
- --outline-color: var(--kit-alert-bd);
359
- }
360
-
361
- .kit-alert__close:hover {
362
- background: color-mix(in oklab, currentColor 10%, transparent);
363
- border-radius: 9999px;
364
- }
365
- </style>
98
+ <style>:where(.kit-alert) {
99
+ --kit-alert-color: initial;
100
+ --kit-alert-on-color: initial;
101
+ --kit-alert-active-fg: initial;
102
+ --kit-alert-active-shade: initial;
103
+ --kit-alert-hover-fg: initial;
104
+ --kit-alert-pressed-fg: initial;
105
+ --kit-alert-bg: var(--kit-alert-color, var(--kit-color-surface-2));
106
+ --kit-alert-fg: var(--kit-alert-on-color, var(--kit-alert-contrast, var(--kit-color-text)));
107
+ --kit-alert-ink: var(--kit-alert-color, var(--kit-color-text));
108
+ --kit-alert-hover: color-mix(in oklab, var(--kit-alert-bg), var(--kit-alert-fg) 8%);
109
+ --kit-alert-pressed: color-mix(in oklab, var(--kit-alert-bg), var(--kit-alert-fg) 14%);
110
+ --kit-alert-soft: color-mix(in oklab, var(--kit-alert-bg) 16%, transparent);
111
+ --kit-alert-border: color-mix(in oklab, var(--kit-alert-bg), var(--kit-alert-fg) 20%);
112
+ --kit-alert-active: color-mix(
113
+ in oklab,
114
+ var(--kit-alert-color),
115
+ var(--kit-alert-fg) var(--kit-alert-active-shade, 14%)
116
+ );
117
+ }
118
+ @supports (color: color(from red srgb-linear r g b)) {
119
+ :where(.kit-alert) {
120
+ --kit-alert-contrast: color(from var(--kit-alert-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);
121
+ }
122
+ }
123
+
124
+ .kit-alert {
125
+ position: relative;
126
+ display: flex;
127
+ align-items: center;
128
+ gap: var(--kit-alert-gap);
129
+ box-sizing: border-box;
130
+ min-height: calc(var(--kit-alert-h) + var(--kit-alert-density-offset) / 2);
131
+ padding: calc(var(--kit-alert-p) + var(--kit-alert-density-offset) / 2);
132
+ border: 0;
133
+ border-radius: var(--kit-alert-radius);
134
+ background-color: var(--kit-alert-bg);
135
+ color: var(--kit-alert-fg);
136
+ font-size: var(--kit-alert-font);
137
+ transition-property: background-color, color, border-color, box-shadow;
138
+ transition-duration: var(--kit-animation-component);
139
+ transition-timing-function: ease;
140
+ }
141
+ @media (prefers-reduced-motion: reduce) {
142
+ .kit-alert {
143
+ transition: none;
144
+ }
145
+ }
146
+ .kit-alert[data-multiline=true] {
147
+ align-items: flex-start;
148
+ }
149
+ .kit-alert__prepend, .kit-alert__append, .kit-alert__close {
150
+ display: inline-flex;
151
+ flex: none;
152
+ align-items: center;
153
+ justify-content: center;
154
+ line-height: 1;
155
+ }
156
+ .kit-alert__content {
157
+ flex: 1;
158
+ min-width: 0;
159
+ line-height: 1.4;
160
+ }
161
+ .kit-alert__close {
162
+ appearance: none;
163
+ width: 1.25rem;
164
+ height: 1.25rem;
165
+ padding: 0;
166
+ border: 0;
167
+ border-radius: var(--kit-shape-full);
168
+ background: transparent;
169
+ color: inherit;
170
+ cursor: pointer;
171
+ }
172
+ .kit-alert__close:hover {
173
+ background-color: color-mix(in oklab, currentColor 10%, transparent);
174
+ }
175
+ .kit-alert__close:focus-visible {
176
+ outline: 2px solid var(--kit-color-focus);
177
+ outline-offset: 2px;
178
+ }
179
+ .kit-alert__close svg {
180
+ display: block;
181
+ width: 1.125rem;
182
+ height: 1.125rem;
183
+ }
184
+
185
+ /**
186
+ * size
187
+ * @link https://lapikit.dev/docs/components/alert#size
188
+ */
189
+ :where(.kit-alert[data-size=xs]) {
190
+ --kit-alert-h: 2rem;
191
+ --kit-alert-p: 0.5rem;
192
+ --kit-alert-gap: 0.375rem;
193
+ --kit-alert-font: var(--kit-font-xs);
194
+ }
195
+
196
+ :where(.kit-alert[data-size=sm]) {
197
+ --kit-alert-h: 2.5rem;
198
+ --kit-alert-p: 0.625rem;
199
+ --kit-alert-gap: 0.5rem;
200
+ --kit-alert-font: var(--kit-font-sm);
201
+ }
202
+
203
+ :where(.kit-alert[data-size=md]) {
204
+ --kit-alert-h: 3rem;
205
+ --kit-alert-p: 0.75rem;
206
+ --kit-alert-gap: 0.625rem;
207
+ --kit-alert-font: var(--kit-font-md);
208
+ }
209
+
210
+ :where(.kit-alert[data-size=lg]) {
211
+ --kit-alert-h: 3.5rem;
212
+ --kit-alert-p: 1rem;
213
+ --kit-alert-gap: 0.75rem;
214
+ --kit-alert-font: var(--kit-font-lg);
215
+ }
216
+
217
+ :where(.kit-alert[data-size=xl]) {
218
+ --kit-alert-h: 4rem;
219
+ --kit-alert-p: 1.25rem;
220
+ --kit-alert-gap: 0.875rem;
221
+ --kit-alert-font: var(--kit-font-xl);
222
+ }
223
+
224
+ /**
225
+ * variant
226
+ * @link https://lapikit.dev/docs/components/alert#variants
227
+ */
228
+ :where(.kit-alert[data-variant=tonal]) {
229
+ --kit-alert-bg: color-mix(in oklab, var(--kit-alert-ink) 16%, transparent);
230
+ --kit-alert-fg: var(--kit-alert-ink);
231
+ --kit-alert-border: transparent;
232
+ --kit-alert-active: color-mix(in oklab, var(--kit-alert-ink) 28%, transparent);
233
+ --kit-alert-active-fg: var(--kit-alert-ink);
234
+ }
235
+
236
+ :where(.kit-alert[data-variant=outline]) {
237
+ --kit-alert-bg: transparent;
238
+ --kit-alert-fg: var(--kit-alert-ink);
239
+ --kit-alert-border: var(--kit-alert-color, var(--kit-color-border));
240
+ --kit-alert-active: color-mix(in oklab, var(--kit-alert-ink) 14%, transparent);
241
+ --kit-alert-active-fg: var(--kit-alert-ink);
242
+ }
243
+
244
+ :where(.kit-alert[data-variant=surface]) {
245
+ --kit-alert-bg: color-mix(in oklab, var(--kit-alert-ink) 8%, transparent);
246
+ --kit-alert-fg: var(--kit-alert-ink);
247
+ --kit-alert-border: color-mix(in oklab, var(--kit-alert-ink) 35%, transparent);
248
+ --kit-alert-active: color-mix(in oklab, var(--kit-alert-ink) 18%, transparent);
249
+ --kit-alert-active-fg: var(--kit-alert-ink);
250
+ }
251
+
252
+ :where(.kit-alert[data-variant=text]) {
253
+ --kit-alert-bg: transparent;
254
+ --kit-alert-fg: var(--kit-alert-ink);
255
+ --kit-alert-border: transparent;
256
+ --kit-alert-active: color-mix(in oklab, var(--kit-alert-ink) 14%, transparent);
257
+ --kit-alert-active-fg: var(--kit-alert-ink);
258
+ }
259
+
260
+ :where(.kit-alert .outline) {
261
+ --outline-color: var(--kit-alert-border);
262
+ }
263
+
264
+ /**
265
+ * rounded
266
+ * @link https://lapikit.dev/docs/customize
267
+ */
268
+ :where(.kit-alert[data-rounded="0"]) {
269
+ --kit-alert-radius: var(--kit-shape-none);
270
+ }
271
+
272
+ :where(.kit-alert[data-rounded=xs]) {
273
+ --kit-alert-radius: var(--kit-shape-xs);
274
+ }
275
+
276
+ :where(.kit-alert[data-rounded=sm]) {
277
+ --kit-alert-radius: var(--kit-shape-sm);
278
+ }
279
+
280
+ :where(.kit-alert[data-rounded=md]) {
281
+ --kit-alert-radius: var(--kit-shape-md);
282
+ }
283
+
284
+ :where(.kit-alert[data-rounded=lg]) {
285
+ --kit-alert-radius: var(--kit-shape-lg);
286
+ }
287
+
288
+ :where(.kit-alert[data-rounded=xl]) {
289
+ --kit-alert-radius: var(--kit-shape-xl);
290
+ }
291
+
292
+ :where(.kit-alert[data-rounded=full]) {
293
+ --kit-alert-radius: var(--kit-shape-full);
294
+ }
295
+
296
+ /**
297
+ * density
298
+ * @link https://lapikit.dev/docs/components/alert#density
299
+ */
300
+ :where(.kit-alert[data-density=dense]) {
301
+ --kit-alert-density-offset: var(--kit-density-dense);
302
+ }
303
+
304
+ :where(.kit-alert[data-density=compact]) {
305
+ --kit-alert-density-offset: var(--kit-density-compact);
306
+ }
307
+
308
+ :where(.kit-alert[data-density=default]) {
309
+ --kit-alert-density-offset: var(--kit-density-default);
310
+ }
311
+
312
+ :where(.kit-alert[data-density=comfortable]) {
313
+ --kit-alert-density-offset: var(--kit-density-comfortable);
314
+ }
315
+
316
+ :where(.kit-alert[data-density=spacious]) {
317
+ --kit-alert-density-offset: var(--kit-density-spacious);
318
+ }</style>
@@ -1,19 +1,19 @@
1
1
  import type { Snippet } from 'svelte';
2
- import type { Component, DensityType, ElevationProps, RoundedType, SizeType } from '../../@types';
3
- type AlertVariant = 'filled' | 'outline' | 'text';
2
+ import type { ColorProps, Component, ElevationProps, RoundedType, SizeType } from '../../@types';
3
+ type AlertVariant = 'filled' | 'tonal' | 'outline' | 'surface' | 'text';
4
4
  type AlertTone = 'default' | 'info' | 'success' | 'warning' | 'error';
5
5
  export interface AlertProps extends Component {
6
6
  ref?: HTMLElement | null;
7
7
  is?: 'div' | 'section' | 'aside' | 'article';
8
8
  open?: boolean;
9
9
  closable?: boolean;
10
+ multiline?: boolean;
10
11
  variant?: AlertVariant;
11
12
  size?: SizeType;
12
- density?: DensityType;
13
+ density?: 'dense' | 'compact' | 'default' | 'comfortable' | 'spacious';
13
14
  rounded?: RoundedType | 'full';
14
15
  tone?: AlertTone;
15
- color?: string;
16
- background?: string;
16
+ color?: ColorProps;
17
17
  prepend?: Snippet;
18
18
  append?: Snippet;
19
19
  close?: Snippet;