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,18 +1,18 @@
|
|
|
1
|
-
import type {
|
|
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' | '
|
|
9
|
-
density?:
|
|
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?:
|
|
28
|
-
background?: string;
|
|
27
|
+
color?: ColorProps;
|
|
29
28
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
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
|
|
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']
|
|
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
|
|
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={
|
|
74
|
-
style={
|
|
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 ||
|
|
64
|
+
disabled: noRipple || isDisabled || !isInteractive
|
|
92
65
|
}}
|
|
93
|
-
{...
|
|
66
|
+
{...attrs.rest}
|
|
94
67
|
>
|
|
95
|
-
{#if
|
|
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
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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
|
-
|
|
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 {
|
|
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?:
|
|
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 {
|
|
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
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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 {
|
|
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
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
</style>
|
|
25
|
+
<style>.kit-card-container {
|
|
26
|
+
gap: var(--kit-card-gap);
|
|
27
|
+
}</style>
|