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,18 +1,18 @@
1
- import type { Component, DensityType, ElevationProps, RoundedType, SizeType } from '../../@types';
1
+ import type { ColorProps, Component, ElevationProps, RoundedType, SizeType } from '../../@types';
2
2
  import type { Snippet } from 'svelte';
3
3
  export interface ButtonProps extends Component {
4
4
  ref?: HTMLElement | null;
5
5
  is?: 'button' | 'a' | 'input';
6
6
  input?: boolean;
7
7
  href?: string;
8
- variant?: 'outline' | 'text' | 'filled' | 'link';
9
- density?: DensityType;
8
+ variant?: 'filled' | 'tonal' | 'outline' | 'text' | 'plain' | 'surface' | 'link';
9
+ density?: 'dense' | 'compact' | 'default' | 'comfortable' | 'spacious';
10
10
  active?: boolean;
11
11
  loading?: boolean;
12
12
  disabled?: boolean;
13
13
  checked?: boolean;
14
14
  size?: SizeType;
15
- rounded?: RoundedType;
15
+ rounded?: RoundedType | 'full';
16
16
  type?: 'button' | 'submit' | 'reset' | 'checkbox' | 'radio';
17
17
  value?: string | number | boolean;
18
18
  label?: string;
@@ -24,6 +24,5 @@ export interface ButtonProps extends Component {
24
24
  append?: Snippet;
25
25
  prepend?: Snippet;
26
26
  elevation?: ElevationProps;
27
- color?: string;
28
- background?: string;
27
+ color?: ColorProps;
29
28
  }
@@ -1,6 +1,5 @@
1
1
  <script lang="ts">
2
- import { useClassName, useElevation, useIsInteractive, useStyles } from '../../utils';
3
- import { makeComponentProps } from '../../html-mapped';
2
+ import { useComponentAttrs, useElevation, useIsInteractive } from '../../utils';
4
3
  import { ripple } from '../../animations';
5
4
  import type { CardProps } from './card.types.js';
6
5
 
@@ -8,8 +7,8 @@
8
7
  ref = $bindable(),
9
8
  is = 'div',
10
9
  children,
11
- class: className = '',
12
- style: styleAttr = '',
10
+ class: className,
11
+ style: styleAttr,
13
12
  's-class': sClass,
14
13
  's-style': sStyle,
15
14
  href,
@@ -17,61 +16,35 @@
17
16
  variant = 'filled',
18
17
  density = 'default',
19
18
  rounded = 'md',
20
- interactive = false,
19
+ interactive,
21
20
  active = false,
22
21
  disabled = false,
23
22
  noRipple,
24
23
  color,
25
- background,
26
24
  elevation,
27
25
  ...rest
28
26
  }: CardProps = $props();
29
27
 
30
28
  let tag = $derived((href && 'a') || is);
31
- let isInteractive = $derived(useIsInteractive(rest, tag, ['a', 'button'], interactive));
29
+ let isInteractive = $derived(interactive ?? useIsInteractive(rest, tag, ['a', 'button']));
32
30
  let isDisabled = $derived(!!disabled);
33
31
  let resolvedHref = $derived(tag === 'a' && !isDisabled ? href : undefined);
34
32
  let resolvedType = $derived(tag === 'button' ? (type ?? 'button') : undefined);
35
33
  let resolvedDisabled = $derived(tag === 'button' ? isDisabled : undefined);
36
34
  let resolvedTabIndex = $derived(tag === 'a' && isDisabled ? -1 : undefined);
37
35
 
38
- let { classProps, styleProps, restProps } = $derived(makeComponentProps(rest));
39
-
40
- let elevationState = $derived(useElevation(elevation));
41
-
42
- let componentClass = $derived(
43
- useClassName({
44
- baseClass: 'kit-card',
45
- className: `${className ?? ''}`.trim(),
46
- sClass,
47
- classProps
48
- })
49
- );
50
-
51
- let componentStyle = $derived(
52
- useStyles({
53
- styleAttr,
54
- sStyle,
55
- styleProps
56
- })
57
- );
58
-
59
- let resolvedStyle = $derived(
60
- [
61
- componentStyle,
62
- color ? `--kit-card-fg:${color && `var(--kit-color-${color})`}` : '',
63
- background ? `--kit-card-bg:${background && `var(--kit-color-${background})`}` : ''
64
- ]
65
- .filter(Boolean)
66
- .join('; ')
36
+ let attrs = $derived(
37
+ useComponentAttrs('kit-card', { className, sClass, styleAttr, sStyle, color, active }, rest)
67
38
  );
39
+ let elevationState = $derived(useElevation(elevation));
40
+ let hasOutline = $derived(variant === 'outline' || variant === 'surface');
68
41
  </script>
69
42
 
70
43
  <svelte:element
71
44
  this={tag}
72
45
  bind:this={ref}
73
- class={componentClass}
74
- style={resolvedStyle}
46
+ class={attrs.class}
47
+ style={attrs.style}
75
48
  href={resolvedHref}
76
49
  type={resolvedType}
77
50
  disabled={resolvedDisabled}
@@ -88,149 +61,214 @@
88
61
  aria-disabled={isDisabled || undefined}
89
62
  use:ripple={{
90
63
  component: 'card',
91
- disabled: noRipple || disabled || !isInteractive
64
+ disabled: noRipple || isDisabled || !isInteractive
92
65
  }}
93
- {...restProps}
66
+ {...attrs.rest}
94
67
  >
95
- {#if variant === 'outline'}
68
+ {#if hasOutline}
96
69
  <span class="outline"></span>
97
70
  {/if}
98
71
 
99
72
  {@render children?.()}
100
73
  </svelte:element>
101
74
 
102
- <style>
103
- .kit-card {
104
- display: flex;
105
- position: relative;
106
- flex-direction: column;
107
- gap: var(--kit-card-gap);
108
- background: var(--kit-card-bg);
109
- color: var(--kit-card-fg);
110
- border-radius: var(--kit-card-radius);
111
- border: 0;
112
- box-sizing: border-box;
113
- padding: calc(10px + var(--kit-card-density-offset) / 2);
114
- transition:
115
- background 140ms ease,
116
- color 140ms ease,
117
- box-shadow 140ms ease,
118
- translate 140ms ease;
119
- }
120
-
121
- a.kit-card {
122
- text-decoration: none;
123
- }
124
-
125
- button.kit-card {
126
- appearance: none;
127
- border: 0;
128
- background: none;
129
- font: inherit;
130
- text-align: inherit;
131
- }
132
-
133
- /**
134
- * rounded
135
- * @link ...
136
- */
137
- .kit-card[data-rounded='0'] {
138
- --kit-card-radius: var(--kit-shape-none);
139
- }
140
- .kit-card[data-rounded='xs'] {
141
- --kit-card-radius: var(--kit-shape-xs);
142
- }
143
- .kit-card[data-rounded='sm'] {
144
- --kit-card-radius: var(--kit-shape-sm);
145
- }
146
- .kit-card[data-rounded='md'] {
147
- --kit-card-radius: var(--kit-shape-md);
148
- }
149
- .kit-card[data-rounded='lg'] {
150
- --kit-card-radius: var(--kit-shape-lg);
151
- }
152
- .kit-card[data-rounded='xl'] {
153
- --kit-card-radius: var(--kit-shape-xl);
154
- }
155
-
156
- /**
157
- * density
158
- * @link https://lapikit.dev/docs/components/card#density
159
- */
160
- .kit-card[data-density='compact'] {
161
- --kit-card-gap: var(--kit-space-compact);
162
- --kit-card-density-offset: var(--kit-density-compact);
163
- }
164
- .kit-card[data-density='default'] {
165
- --kit-card-gap: var(--kit-space-default);
166
- --kit-card-density-offset: var(--kit-density-default);
167
- }
168
- .kit-card[data-density='comfortable'] {
169
- --kit-card-gap: var(--kit-space-comfortable);
170
- --kit-card-density-offset: var(--kit-density-comfortable);
171
- }
172
-
173
- /**
174
- * variant
175
- * @link https://lapikit.dev/docs/components/card#variants
176
- */
177
- .kit-card[data-variant='filled'] {
178
- --kit-card-bg: var(--kit-color-surface-1);
179
- --kit-card-fg: var(--kit-color-text);
180
-
181
- --kit-card-hover-bg: color-mix(in oklab, var(--kit-card-bg), black 10%);
182
- --kit-card-active-bg: color-mix(in oklab, var(--kit-card-bg), black 16%);
183
- }
184
- .kit-card[data-variant='outline'] {
185
- --kit-card-bg: transparent;
186
- --kit-card-fg: var(--kit-color-text);
187
- --kit-card-bd: var(--kit-card-fg);
188
-
189
- --kit-card-hover-bg: color-mix(in oklab, var(--kit-card-fg), transparent 80%);
190
- --kit-card-active-bg: color-mix(in oklab, var(--kit-card-fg), transparent 92%);
191
- }
192
- .kit-card[data-variant='text'] {
193
- --kit-card-bg: transparent;
194
- --kit-card-fg: var(--kit-color-text);
195
-
196
- --kit-card-hover-bg: color-mix(in oklab, var(--kit-card-fg), transparent 80%);
197
- --kit-card-active-bg: color-mix(in oklab, var(--kit-card-fg), transparent 92%);
198
- }
199
-
200
- .kit-card[data-interactive='true'][data-disabled='false'] {
201
- cursor: pointer;
202
- }
203
-
204
- .kit-card[data-interactive='true'][data-disabled='false']:hover {
205
- background: var(--kit-card-hover-bg);
206
- }
207
-
208
- .kit-card[data-variant='text'][data-interactive='true'][data-disabled='false']:hover {
209
- background: var(--kit-card-hover-bg);
210
- }
211
-
212
- .kit-card[data-interactive='true'][data-active='true'][data-disabled='false'],
213
- .kit-card[data-interactive='true'][data-disabled='false']:active {
214
- translate: 0 0;
215
- background: var(--kit-card-active-bg);
216
- }
217
-
218
- .kit-card[data-variant='text'][data-interactive='true'][data-active='true'][data-disabled='false'],
219
- .kit-card[data-variant='text'][data-interactive='true'][data-disabled='false']:active {
220
- background: var(--kit-card-active-bg);
221
- }
222
-
223
- .kit-card[data-interactive='true'][data-disabled='false']:focus-visible {
224
- outline: 2px solid var(--kit-color-focus);
225
- outline-offset: 2px;
226
- }
227
-
228
- .kit-card[data-disabled='true'] {
229
- opacity: var(--kit-disabled-opacity, 0.55);
230
- pointer-events: none;
231
- }
232
-
233
- .kit-card .outline {
234
- --outline-color: var(--kit-card-bd);
235
- }
236
- </style>
75
+ <style>:where(.kit-card) {
76
+ --kit-card-color: initial;
77
+ --kit-card-on-color: initial;
78
+ --kit-card-active-fg: initial;
79
+ --kit-card-active-shade: initial;
80
+ --kit-card-hover-fg: initial;
81
+ --kit-card-pressed-fg: initial;
82
+ --kit-card-bg: var(--kit-card-color, var(--kit-color-surface-1));
83
+ --kit-card-fg: var(--kit-card-on-color, var(--kit-card-contrast, var(--kit-color-text)));
84
+ --kit-card-ink: var(--kit-card-color, var(--kit-color-text));
85
+ --kit-card-hover: color-mix(in oklab, var(--kit-card-bg), var(--kit-card-fg) 8%);
86
+ --kit-card-pressed: color-mix(in oklab, var(--kit-card-bg), var(--kit-card-fg) 14%);
87
+ --kit-card-soft: color-mix(in oklab, var(--kit-card-bg) 16%, transparent);
88
+ --kit-card-border: color-mix(in oklab, var(--kit-card-bg), var(--kit-card-fg) 20%);
89
+ --kit-card-active: color-mix(
90
+ in oklab,
91
+ var(--kit-card-color),
92
+ var(--kit-card-fg) var(--kit-card-active-shade, 14%)
93
+ );
94
+ }
95
+ @supports (color: color(from red srgb-linear r g b)) {
96
+ :where(.kit-card) {
97
+ --kit-card-contrast: color(from var(--kit-card-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);
98
+ }
99
+ }
100
+ :where(.kit-card) {
101
+ --kit-card-gap: calc(var(--kit-space-default) + var(--kit-card-density-offset) / 2);
102
+ --kit-card-padding: calc(10px + var(--kit-card-density-offset) / 2);
103
+ }
104
+
105
+ .kit-card {
106
+ display: flex;
107
+ position: relative;
108
+ flex-direction: column;
109
+ gap: var(--kit-card-gap);
110
+ background-color: var(--kit-card-bg);
111
+ color: var(--kit-card-fg);
112
+ border-radius: var(--kit-card-radius);
113
+ border: 0;
114
+ box-sizing: border-box;
115
+ padding: var(--kit-card-padding);
116
+ transition-property: background-color, color, border-color, box-shadow;
117
+ transition-duration: var(--kit-animation-component);
118
+ transition-timing-function: ease;
119
+ }
120
+ @media (prefers-reduced-motion: reduce) {
121
+ .kit-card {
122
+ transition: none;
123
+ }
124
+ }
125
+
126
+ /* native resets: no background here, it would beat the background of .kit-card */
127
+ a.kit-card {
128
+ text-decoration: none;
129
+ }
130
+
131
+ button.kit-card {
132
+ appearance: none;
133
+ border: 0;
134
+ font: inherit;
135
+ text-align: inherit;
136
+ }
137
+
138
+ /**
139
+ * variant
140
+ * @link https://lapikit.dev/docs/components/card#variants
141
+ */
142
+ :where(.kit-card[data-variant=tonal]) {
143
+ --kit-card-bg: color-mix(in oklab, var(--kit-card-ink) 16%, transparent);
144
+ --kit-card-fg: var(--kit-card-ink);
145
+ --kit-card-border: transparent;
146
+ --kit-card-active: color-mix(in oklab, var(--kit-card-ink) 28%, transparent);
147
+ --kit-card-active-fg: var(--kit-card-ink);
148
+ }
149
+
150
+ :where(.kit-card[data-variant=text]) {
151
+ --kit-card-bg: transparent;
152
+ --kit-card-fg: var(--kit-card-ink);
153
+ --kit-card-border: transparent;
154
+ --kit-card-active: color-mix(in oklab, var(--kit-card-ink) 14%, transparent);
155
+ --kit-card-active-fg: var(--kit-card-ink);
156
+ }
157
+
158
+ :where(.kit-card[data-variant=plain]) {
159
+ --kit-card-bg: transparent;
160
+ --kit-card-fg: var(--kit-card-ink);
161
+ --kit-card-border: transparent;
162
+ --kit-card-hover: transparent;
163
+ --kit-card-pressed: transparent;
164
+ --kit-card-hover-fg: color-mix(in oklab, var(--kit-card-fg) 72%, transparent);
165
+ --kit-card-pressed-fg: color-mix(in oklab, var(--kit-card-fg) 56%, transparent);
166
+ --kit-card-active: transparent;
167
+ --kit-card-active-fg: var(--kit-card-color, var(--kit-color-accent));
168
+ }
169
+
170
+ :where(.kit-card[data-variant=outline]) {
171
+ --kit-card-bg: transparent;
172
+ --kit-card-fg: var(--kit-card-ink);
173
+ --kit-card-border: var(--kit-card-color, var(--kit-color-border));
174
+ --kit-card-active: color-mix(in oklab, var(--kit-card-ink) 14%, transparent);
175
+ --kit-card-active-fg: var(--kit-card-ink);
176
+ }
177
+
178
+ :where(.kit-card[data-variant=surface]) {
179
+ --kit-card-bg: color-mix(in oklab, var(--kit-card-ink) 8%, transparent);
180
+ --kit-card-fg: var(--kit-card-ink);
181
+ --kit-card-border: color-mix(in oklab, var(--kit-card-ink) 35%, transparent);
182
+ --kit-card-active: color-mix(in oklab, var(--kit-card-ink) 18%, transparent);
183
+ --kit-card-active-fg: var(--kit-card-ink);
184
+ }
185
+
186
+ :where(.kit-card .outline) {
187
+ --outline-color: var(--kit-card-border);
188
+ }
189
+
190
+ :where(.kit-card[data-active=true]) {
191
+ --kit-card-bg: var(--kit-card-active, var(--kit-color-accent));
192
+ --kit-card-fg: var(
193
+ --kit-card-active-fg,
194
+ var(--kit-card-on-color, var(--kit-card-contrast, var(--kit-color-on-accent)))
195
+ );
196
+ }
197
+
198
+ /**
199
+ * interactive: hover, pressed, focus-visible and disabled
200
+ */
201
+ .kit-card[data-interactive=true]:not([data-disabled=true]) {
202
+ cursor: pointer;
203
+ }
204
+ .kit-card[data-interactive=true]:not([data-disabled=true]):hover {
205
+ background-color: var(--kit-card-hover);
206
+ color: var(--kit-card-hover-fg, var(--kit-card-fg));
207
+ }
208
+ .kit-card[data-interactive=true]:not([data-disabled=true]):active {
209
+ background-color: var(--kit-card-pressed);
210
+ color: var(--kit-card-pressed-fg, var(--kit-card-fg));
211
+ }
212
+
213
+ .kit-card:not([data-disabled=true]):focus-visible {
214
+ outline: 2px solid var(--kit-color-focus);
215
+ outline-offset: 2px;
216
+ }
217
+
218
+ .kit-card[data-disabled=true] {
219
+ opacity: var(--kit-disabled-opacity, 0.55);
220
+ pointer-events: none;
221
+ user-select: none;
222
+ }
223
+
224
+ /**
225
+ * rounded
226
+ * @link https://lapikit.dev/docs/customize
227
+ */
228
+ :where(.kit-card[data-rounded="0"]) {
229
+ --kit-card-radius: var(--kit-shape-none);
230
+ }
231
+
232
+ :where(.kit-card[data-rounded=xs]) {
233
+ --kit-card-radius: var(--kit-shape-xs);
234
+ }
235
+
236
+ :where(.kit-card[data-rounded=sm]) {
237
+ --kit-card-radius: var(--kit-shape-sm);
238
+ }
239
+
240
+ :where(.kit-card[data-rounded=md]) {
241
+ --kit-card-radius: var(--kit-shape-md);
242
+ }
243
+
244
+ :where(.kit-card[data-rounded=lg]) {
245
+ --kit-card-radius: var(--kit-shape-lg);
246
+ }
247
+
248
+ :where(.kit-card[data-rounded=xl]) {
249
+ --kit-card-radius: var(--kit-shape-xl);
250
+ }
251
+
252
+ /**
253
+ * density
254
+ * @link https://lapikit.dev/docs/components/card#density
255
+ */
256
+ :where(.kit-card[data-density=dense]) {
257
+ --kit-card-density-offset: var(--kit-density-dense);
258
+ }
259
+
260
+ :where(.kit-card[data-density=compact]) {
261
+ --kit-card-density-offset: var(--kit-density-compact);
262
+ }
263
+
264
+ :where(.kit-card[data-density=default]) {
265
+ --kit-card-density-offset: var(--kit-density-default);
266
+ }
267
+
268
+ :where(.kit-card[data-density=comfortable]) {
269
+ --kit-card-density-offset: var(--kit-density-comfortable);
270
+ }
271
+
272
+ :where(.kit-card[data-density=spacious]) {
273
+ --kit-card-density-offset: var(--kit-density-spacious);
274
+ }</style>
@@ -1,25 +1,28 @@
1
- import type { Component, DensityType, ElevationProps, RoundedType } from '../../@types';
1
+ import type { ColorProps, Component, ElevationProps, RoundedType } from '../../@types';
2
2
  export interface CardProps extends Component {
3
3
  ref?: HTMLElement | null;
4
4
  is?: 'div' | 'article' | 'section' | 'aside' | 'a' | 'button';
5
5
  href?: string;
6
6
  type?: 'button' | 'submit' | 'reset';
7
- variant?: 'filled' | 'outline' | 'text';
8
- density?: DensityType;
7
+ variant?: 'filled' | 'tonal' | 'outline' | 'text' | 'plain' | 'surface';
8
+ density?: 'dense' | 'compact' | 'default' | 'comfortable' | 'spacious';
9
9
  rounded?: RoundedType;
10
10
  elevation?: ElevationProps;
11
11
  interactive?: boolean;
12
12
  active?: boolean;
13
13
  disabled?: boolean;
14
14
  noRipple?: boolean;
15
+ color?: ColorProps;
15
16
  }
16
17
  export interface CardTitleProps extends Component {
17
18
  ref?: HTMLElement | null;
18
19
  is?: 'div' | 'p' | 'span' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
20
+ color?: string | false;
19
21
  }
20
22
  export interface CardContentProps extends Component {
21
23
  ref?: HTMLElement | null;
22
24
  is?: 'div' | 'p' | 'span' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
25
+ color?: string | false;
23
26
  }
24
27
  export interface CardMediaProps extends Component {
25
28
  ref?: HTMLElement | null;
@@ -1,53 +1,29 @@
1
1
  <script lang="ts">
2
2
  import type { CardActionsProps } from '../card.types';
3
- import { makeComponentProps } from '../../../html-mapped';
4
- import { useClassName, useStyles } from '../../../utils';
3
+ import { useComponentAttrs } from '../../../utils';
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
  ...rest
15
14
  }: CardActionsProps = $props();
16
15
 
17
- let { classProps, styleProps, restProps } = $derived(makeComponentProps(rest));
18
-
19
- let componentClass = $derived(
20
- useClassName({
21
- baseClass: 'kit-card-actions',
22
- className: `${className ?? ''}`.trim(),
23
- sClass,
24
- classProps
25
- })
26
- );
27
-
28
- let componentStyle = $derived(
29
- useStyles({
30
- styleAttr,
31
- sStyle,
32
- styleProps
33
- })
16
+ let attrs = $derived(
17
+ useComponentAttrs('kit-card-actions', { className, sClass, styleAttr, sStyle }, rest)
34
18
  );
35
19
  </script>
36
20
 
37
- <svelte:element
38
- this={is}
39
- bind:this={ref}
40
- class={componentClass}
41
- style={componentStyle}
42
- {...restProps}
43
- >
21
+ <svelte:element this={is} bind:this={ref} class={attrs.class} style={attrs.style} {...attrs.rest}>
44
22
  {@render children?.()}
45
23
  </svelte:element>
46
24
 
47
- <style>
48
- .kit-card-actions {
49
- display: inline-flex;
50
- align-items: center;
51
- gap: var(--kit-card-gap);
52
- }
53
- </style>
25
+ <style>.kit-card-actions {
26
+ display: inline-flex;
27
+ align-items: center;
28
+ gap: var(--kit-card-gap);
29
+ }</style>
@@ -1,51 +1,27 @@
1
1
  <script lang="ts">
2
2
  import type { CardContainerProps } from '../card.types';
3
- import { makeComponentProps } from '../../../html-mapped';
4
- import { useClassName, useStyles } from '../../../utils';
3
+ import { useComponentAttrs } from '../../../utils';
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
  ...rest
15
14
  }: CardContainerProps = $props();
16
15
 
17
- let { classProps, styleProps, restProps } = $derived(makeComponentProps(rest));
18
-
19
- let componentClass = $derived(
20
- useClassName({
21
- baseClass: 'kit-card-container',
22
- className: `${className ?? ''}`.trim(),
23
- sClass,
24
- classProps
25
- })
26
- );
27
-
28
- let componentStyle = $derived(
29
- useStyles({
30
- styleAttr,
31
- sStyle,
32
- styleProps
33
- })
16
+ let attrs = $derived(
17
+ useComponentAttrs('kit-card-container', { className, sClass, styleAttr, sStyle }, rest)
34
18
  );
35
19
  </script>
36
20
 
37
- <svelte:element
38
- this={is}
39
- bind:this={ref}
40
- class={componentClass}
41
- style={componentStyle}
42
- {...restProps}
43
- >
21
+ <svelte:element this={is} bind:this={ref} class={attrs.class} style={attrs.style} {...attrs.rest}>
44
22
  {@render children?.()}
45
23
  </svelte:element>
46
24
 
47
- <style>
48
- .kit-card-container {
49
- gap: var(--kit-card-gap);
50
- }
51
- </style>
25
+ <style>.kit-card-container {
26
+ gap: var(--kit-card-gap);
27
+ }</style>