lapikit 0.0.0-insiders.f502b02 → 0.0.0-insiders.f7cfacb
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/bin/configuration.js +304 -0
- package/bin/helper.js +23 -0
- package/bin/index.js +41 -0
- package/bin/lapikit.js +37 -5
- package/bin/legacy.js +34 -0
- package/bin/modules/adapter.js +3 -3
- package/bin/modules/plugin.js +223 -0
- package/bin/presets.js +26 -0
- package/bin/prompts.js +100 -0
- package/dist/assets/icons/arrow-down.svelte +2 -0
- package/dist/assets/icons/arrow-down.svelte.d.ts +6 -14
- package/dist/assets/icons/arrow-up.svelte +2 -0
- package/dist/assets/icons/arrow-up.svelte.d.ts +6 -14
- package/dist/assets/icons/close-fill.svelte +2 -0
- package/dist/assets/icons/close-fill.svelte.d.ts +6 -14
- package/dist/assets/icons/loading-fill.svelte +2 -0
- package/dist/assets/icons/loading-fill.svelte.d.ts +6 -14
- package/dist/colors.css +0 -0
- package/dist/components/accordion/accordion.css +6 -6
- package/dist/components/alert/alert.css +19 -9
- package/dist/components/app/app.css +1 -1
- package/dist/components/app/app.svelte +8 -3
- package/dist/components/appbar/appbar.css +2 -2
- package/dist/components/appbar/appbar.svelte +0 -1
- package/dist/components/aspect-ratio/aspect-ratio.svelte +0 -1
- package/dist/components/avatar/avatar.css +5 -5
- package/dist/components/button/button.css +28 -25
- package/dist/components/button/button.svelte +8 -12
- package/dist/components/button/types.d.ts +2 -2
- package/dist/components/card/card.css +64 -58
- package/dist/components/card/card.svelte +14 -1
- package/dist/components/card/types.d.ts +1 -1
- package/dist/components/chip/chip.css +114 -82
- package/dist/components/chip/chip.svelte +21 -8
- package/dist/components/chip/types.d.ts +3 -1
- package/dist/components/dialog/dialog.css +5 -3
- package/dist/components/dropdown/dropdown.css +4 -4
- package/dist/components/icon/icon.css +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/list/list.css +145 -119
- package/dist/components/list/list.svelte +1 -3
- package/dist/components/list/modules/list-item.svelte +9 -1
- package/dist/components/list/types.d.ts +2 -5
- package/dist/components/modal/modal.css +17 -12
- package/dist/components/modal/modal.svelte +1 -0
- package/dist/components/popover/popover.css +4 -4
- package/dist/components/separator/separator.css +1 -1
- package/dist/components/textfield/textfield.css +305 -0
- package/dist/components/textfield/textfield.svelte +193 -0
- package/dist/components/textfield/textfield.svelte.d.ts +4 -0
- package/dist/components/textfield/types.d.ts +37 -0
- package/dist/components/textfield/types.js +1 -0
- package/dist/components/toolbar/toolbar.css +6 -6
- package/dist/components/tooltip/tooltip.css +4 -4
- package/dist/index.d.ts +27 -1
- package/dist/index.js +27 -3
- package/dist/internal/assets.svelte.js +2 -0
- package/dist/internal/deepMerge.d.ts +44 -0
- package/dist/internal/deepMerge.js +80 -0
- package/dist/internal/ripple.d.ts +1 -0
- package/dist/internal/ripple.js +3 -0
- package/dist/plugin/css.d.ts +1 -0
- package/dist/plugin/css.js +55 -0
- package/dist/plugin/preset-v2.d.ts +96 -0
- package/dist/plugin/preset-v2.js +114 -0
- package/dist/plugin/vitejs.d.ts +5 -1
- package/dist/plugin/vitejs.js +32 -3
- package/dist/stores/breakpoints.d.ts +6 -0
- package/dist/stores/breakpoints.js +14 -0
- package/dist/stores/components.d.ts +8 -0
- package/dist/stores/components.js +26 -0
- package/dist/stores/devices.d.ts +6 -0
- package/dist/stores/devices.js +9 -0
- package/dist/stores/index.d.ts +4 -10
- package/dist/stores/index.js +4 -47
- package/dist/stores/themes.d.ts +8 -0
- package/dist/stores/themes.js +34 -0
- package/dist/style/animation.css +2 -0
- package/dist/style/normalize.css +2 -0
- package/dist/style/parser/color.js +2 -2
- package/dist/utils/convert.d.ts +1 -0
- package/dist/utils/convert.js +17 -0
- package/package.json +9 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.kit-avatar {
|
|
2
|
-
--avatar-color: var(--on, var(--kit-on-
|
|
3
|
-
--avatar-background: var(--base, var(--kit-
|
|
2
|
+
--avatar-color: var(--on, var(--kit-on-container));
|
|
3
|
+
--avatar-background: var(--base, var(--kit-container));
|
|
4
4
|
--avatar-radius: var(--shape, var(--kit-radius-full));
|
|
5
5
|
|
|
6
6
|
display: flex;
|
|
@@ -91,19 +91,19 @@
|
|
|
91
91
|
|
|
92
92
|
/* variant */
|
|
93
93
|
.kit-avatar[breakpoint]kit-avatar--variant-outline {
|
|
94
|
-
--avatar-color: var(--base, var(--kit-
|
|
94
|
+
--avatar-color: var(--base, var(--kit-container));
|
|
95
95
|
background-color: transparent;
|
|
96
96
|
border: 1px solid currentColor;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
.kit-avatar[breakpoint]kit-avatar--variant-text {
|
|
100
|
-
--avatar-color: var(--base, var(--kit-
|
|
100
|
+
--avatar-color: var(--base, var(--kit-container));
|
|
101
101
|
background-color: transparent;
|
|
102
102
|
border-color: transparent;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
.kit-avatar[breakpoint]kit-avatar--variant-dash {
|
|
106
|
-
--avatar-color: var(--base, var(--kit-
|
|
106
|
+
--avatar-color: var(--base, var(--kit-container));
|
|
107
107
|
background-color: transparent;
|
|
108
108
|
border: 1px dashed currentColor;
|
|
109
109
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* root */
|
|
2
2
|
.kit-button {
|
|
3
|
-
--button-color: var(--on, var(--kit-on-
|
|
4
|
-
--button-background: var(--base, var(--kit-
|
|
3
|
+
--button-color: var(--on, var(--kit-on-container));
|
|
4
|
+
--button-background: var(--base, var(--kit-container));
|
|
5
5
|
--button-radius: var(--shape, var(--kit-radius-md));
|
|
6
6
|
}
|
|
7
7
|
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
padding-left: var(--button-spacing-y);
|
|
17
17
|
border-radius: var(--button-radius);
|
|
18
18
|
color: var(--button-color);
|
|
19
|
-
|
|
19
|
+
font-weight: 500;
|
|
20
|
+
text-decoration: none;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
.kit-button,
|
|
@@ -141,9 +142,13 @@
|
|
|
141
142
|
}
|
|
142
143
|
|
|
143
144
|
/* variant */
|
|
145
|
+
.kit-button[breakpoint]kit-button--variant-filled {
|
|
146
|
+
background-color: var(--button-background);
|
|
147
|
+
}
|
|
148
|
+
|
|
144
149
|
.kit-button[breakpoint]kit-button--variant-outline {
|
|
145
|
-
--button-color: var(--
|
|
146
|
-
background-color:
|
|
150
|
+
--button-color: var(--on, var(--kit-on-container));
|
|
151
|
+
background-color: var(--button-background);
|
|
147
152
|
}
|
|
148
153
|
.kit-button[breakpoint]kit-button--variant-outline::before {
|
|
149
154
|
content: '';
|
|
@@ -155,51 +160,49 @@
|
|
|
155
160
|
}
|
|
156
161
|
|
|
157
162
|
.kit-button[breakpoint]kit-button--variant-text {
|
|
158
|
-
--button-color: var(--base, var(--kit-
|
|
163
|
+
--button-color: var(--base, var(--kit-on-container));
|
|
159
164
|
background-color: transparent;
|
|
160
165
|
border: none;
|
|
161
166
|
}
|
|
162
167
|
|
|
163
168
|
/* state */
|
|
164
|
-
.kit-button.kit-button--info
|
|
169
|
+
.kit-button.kit-button--info[class*='button--variant-filled'] {
|
|
165
170
|
--on: var(--kit-on-info);
|
|
166
171
|
--base: var(--kit-info);
|
|
167
172
|
}
|
|
168
|
-
.kit-button.kit-button--info[class*='button--variant-'] {
|
|
173
|
+
.kit-button.kit-button--info[class*='button--variant-']:not([class*='variant-filled']) {
|
|
169
174
|
--base: var(--kit-info);
|
|
170
175
|
}
|
|
171
|
-
.kit-button.kit-button--success
|
|
176
|
+
.kit-button.kit-button--success[class*='button--variant-filled'] {
|
|
172
177
|
--on: var(--kit-on-success);
|
|
173
178
|
--base: var(--kit-success);
|
|
174
179
|
}
|
|
175
|
-
.kit-button.kit-button--success[class*='button--variant-'] {
|
|
180
|
+
.kit-button.kit-button--success[class*='button--variant-']:not([class*='variant-filled']) {
|
|
176
181
|
--base: var(--kit-success);
|
|
177
182
|
}
|
|
178
|
-
.kit-button.kit-button--warning
|
|
183
|
+
.kit-button.kit-button--warning[class*='button--variant-filled'] {
|
|
179
184
|
--on: var(--kit-on-warning);
|
|
180
185
|
--base: var(--kit-warning);
|
|
181
186
|
}
|
|
182
|
-
.kit-button.kit-button--warning[class*='button--variant-'] {
|
|
187
|
+
.kit-button.kit-button--warning[class*='button--variant-']:not([class*='variant-filled']) {
|
|
183
188
|
--base: var(--kit-warning);
|
|
184
189
|
}
|
|
185
|
-
.kit-button.kit-button--error
|
|
190
|
+
.kit-button.kit-button--error[class*='button--variant-filled'] {
|
|
186
191
|
--on: var(--kit-on-error);
|
|
187
192
|
--base: var(--kit-error);
|
|
188
193
|
}
|
|
189
|
-
.kit-button.kit-button--error[class*='button--variant-'] {
|
|
194
|
+
.kit-button.kit-button--error[class*='button--variant-']:not([class*='variant-filled']) {
|
|
190
195
|
--base: var(--kit-error);
|
|
191
196
|
}
|
|
192
197
|
|
|
193
198
|
/* events */
|
|
194
|
-
.kit-button
|
|
195
|
-
.kit-button.kit-button--active
|
|
199
|
+
.kit-button[class*='button--variant-filled']:active,
|
|
200
|
+
.kit-button.kit-button--active[class*='button--variant-filled'] {
|
|
196
201
|
background-color: color-mix(in oklab, var(--button-background) 90%, var(--kit-scrim));
|
|
197
|
-
border-color: color-mix(in oklab, var(--button-background) 90%, var(--kit-scrim));
|
|
198
202
|
}
|
|
199
|
-
.kit-button.kit-button--active[class*='button--variant-']:active,
|
|
200
|
-
.kit-button.kit-button--active[class*='button--variant-'] {
|
|
203
|
+
.kit-button.kit-button--active[class*='button--variant-']:not([class*='variant-filled']):active,
|
|
204
|
+
.kit-button.kit-button--active[class*='button--variant-']:not([class*='variant-filled']) {
|
|
201
205
|
background-color: color-mix(in oklab, currentColor 15%, transparent);
|
|
202
|
-
border-color: color-mix(in oklab, currentColor 15%, transparent);
|
|
203
206
|
}
|
|
204
207
|
|
|
205
208
|
/* icon */
|
|
@@ -216,16 +219,16 @@
|
|
|
216
219
|
user-select: none;
|
|
217
220
|
cursor: default;
|
|
218
221
|
}
|
|
219
|
-
.kit-button
|
|
222
|
+
.kit-button[class*='button--variant-filled'].kit-button--disabled {
|
|
220
223
|
color: color-mix(in oklab, var(--button-color) 40%, transparent) !important;
|
|
221
224
|
background-color: color-mix(in oklab, var(--button-background) 70%, transparent) !important;
|
|
222
|
-
border-color: color-mix(in oklab, var(--button-background) 70%, transparent) !important;
|
|
223
225
|
}
|
|
224
|
-
.kit-button
|
|
226
|
+
.kit-button[class*='button--variant-filled'].kit-button--disabled i:before {
|
|
225
227
|
color: color-mix(in oklab, var(--button-color) 40%, transparent) !important;
|
|
226
228
|
}
|
|
227
|
-
.kit-button[class*='button--variant-'].kit-button--disabled,
|
|
228
|
-
.kit-button[class*='button--variant-'].kit-button--disabled
|
|
229
|
+
.kit-button[class*='button--variant-']:not([class*='variant-filled']).kit-button--disabled,
|
|
230
|
+
.kit-button[class*='button--variant-']:not([class*='variant-filled']).kit-button--disabled
|
|
231
|
+
i::before {
|
|
229
232
|
color: color-mix(in oklab, var(--button-background) 40%, transparent) !important;
|
|
230
233
|
}
|
|
231
234
|
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
dark,
|
|
18
18
|
light,
|
|
19
19
|
active,
|
|
20
|
-
variant,
|
|
20
|
+
variant = 'filled',
|
|
21
21
|
error,
|
|
22
22
|
info,
|
|
23
23
|
success,
|
|
@@ -37,11 +37,6 @@
|
|
|
37
37
|
}: ButtonProps = $props();
|
|
38
38
|
|
|
39
39
|
const assets = getAssets();
|
|
40
|
-
|
|
41
|
-
$effect(() => {
|
|
42
|
-
if (type === 'submit') is = 'input';
|
|
43
|
-
if (type === 'reset') is = 'input';
|
|
44
|
-
});
|
|
45
40
|
</script>
|
|
46
41
|
|
|
47
42
|
<svelte:element
|
|
@@ -70,6 +65,7 @@
|
|
|
70
65
|
disabled={href ? undefined : disabled}
|
|
71
66
|
type={href ? undefined : type}
|
|
72
67
|
use:ripple={{
|
|
68
|
+
component: 'button',
|
|
73
69
|
disabled: noRipple || disabled
|
|
74
70
|
}}
|
|
75
71
|
style:--base={assets.color(background)}
|
|
@@ -89,18 +85,18 @@
|
|
|
89
85
|
{/if}
|
|
90
86
|
|
|
91
87
|
{#if prepend}
|
|
92
|
-
<
|
|
88
|
+
<div class="kit-button-prepend">
|
|
93
89
|
{@render prepend?.()}
|
|
94
|
-
</
|
|
90
|
+
</div>
|
|
95
91
|
{/if}
|
|
96
92
|
|
|
97
|
-
<
|
|
93
|
+
<div class="kit-button-content">
|
|
98
94
|
{@render children?.()}
|
|
99
|
-
</
|
|
95
|
+
</div>
|
|
100
96
|
|
|
101
97
|
{#if append}
|
|
102
|
-
<
|
|
98
|
+
<div class="kit-button-append">
|
|
103
99
|
{@render append?.()}
|
|
104
|
-
</
|
|
100
|
+
</div>
|
|
105
101
|
{/if}
|
|
106
102
|
</svelte:element>
|
|
@@ -2,11 +2,11 @@ import type { Component } from '../../internal/types.js';
|
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
export interface ButtonProps extends Component {
|
|
4
4
|
ref?: HTMLElement | null;
|
|
5
|
-
is?: 'button' | 'a'
|
|
5
|
+
is?: 'button' | 'a';
|
|
6
6
|
dark?: boolean;
|
|
7
7
|
light?: boolean;
|
|
8
8
|
href?: string;
|
|
9
|
-
variant?: 'outline' | 'text';
|
|
9
|
+
variant?: 'outline' | 'text' | 'filled';
|
|
10
10
|
density?: 'compact' | 'comfortable' | 'default';
|
|
11
11
|
active?: boolean;
|
|
12
12
|
loading?: boolean;
|
|
@@ -1,100 +1,106 @@
|
|
|
1
|
+
/* root */
|
|
1
2
|
.kit-card {
|
|
2
|
-
--card-color: var(--on, var(--kit-on-
|
|
3
|
-
--card-background: var(--base, var(--kit-
|
|
3
|
+
--card-color: var(--on, var(--kit-on-surface));
|
|
4
|
+
--card-background: var(--base, var(--kit-surface));
|
|
4
5
|
--card-radius: var(--shape, var(--kit-radius-md));
|
|
6
|
+
}
|
|
5
7
|
|
|
8
|
+
.kit-card {
|
|
6
9
|
position: relative;
|
|
7
10
|
display: flex;
|
|
8
11
|
flex-direction: column;
|
|
9
12
|
text-align: start;
|
|
10
13
|
overflow: hidden;
|
|
11
|
-
transition:
|
|
14
|
+
/* transition:
|
|
12
15
|
color 0.5s,
|
|
13
|
-
background-color 0.5s;
|
|
14
|
-
|
|
16
|
+
background-color 0.5s; */
|
|
15
17
|
padding-top: var(--card-spacing-x);
|
|
16
18
|
padding-bottom: var(--card-spacing-x);
|
|
17
19
|
padding-right: var(--card-spacing-y);
|
|
18
20
|
padding-left: var(--card-spacing-y);
|
|
19
|
-
|
|
20
|
-
border-width: 1px;
|
|
21
|
-
border-style: solid;
|
|
22
21
|
border-radius: var(--card-radius);
|
|
23
|
-
|
|
24
|
-
/* theme */
|
|
22
|
+
font-weight: 500;
|
|
25
23
|
color: var(--card-color);
|
|
26
|
-
|
|
27
|
-
border-color: var(--card-background);
|
|
24
|
+
text-decoration: none;
|
|
28
25
|
}
|
|
29
26
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
--card-spacing-x: 0.25rem;
|
|
33
|
-
--card-spacing-y: 0.25rem;
|
|
27
|
+
.kit-card.kit-card--clickable {
|
|
28
|
+
cursor: pointer;
|
|
34
29
|
}
|
|
35
30
|
|
|
36
|
-
.kit-card
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
.kit-card.kit-card--clickable::after {
|
|
32
|
+
content: '';
|
|
33
|
+
position: absolute;
|
|
34
|
+
inset: 0;
|
|
35
|
+
background-color: currentColor;
|
|
36
|
+
opacity: 0;
|
|
37
|
+
transition: opacity 150ms ease;
|
|
38
|
+
pointer-events: none;
|
|
39
|
+
border-radius: inherit;
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
-
.
|
|
42
|
-
--card-spacing-x: 0.5rem;
|
|
43
|
-
--card-spacing-y: 0.5rem;
|
|
41
|
+
.kit-card.kit-card--clickable:hover::after {
|
|
42
|
+
opacity: 0.08;
|
|
44
43
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
text-decoration: none;
|
|
44
|
+
.kit-card.kit-card--clickable:active::after {
|
|
45
|
+
opacity: 0.12;
|
|
48
46
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
background-color: color-mix(in oklab, var(--card-background) 90%, black);
|
|
47
|
+
.kit-card.kit-card--clickable:focus-visible::after {
|
|
48
|
+
opacity: 0.12;
|
|
52
49
|
}
|
|
53
50
|
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
/* density */
|
|
52
|
+
.kit-card[breakpoint]kit-card--density-default {
|
|
53
|
+
--card-spacing-x: calc(var(--kit-spacing) * 2);
|
|
54
|
+
--card-spacing-y: calc(var(--kit-spacing) * 2);
|
|
56
55
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
background-color: color-mix(in oklab, var(--card-background) 95%, black);
|
|
56
|
+
.kit-card[breakpoint]kit-card--density-compact {
|
|
57
|
+
--card-spacing-x: 0;
|
|
58
|
+
--card-spacing-y: 0;
|
|
61
59
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
.kit-card[breakpoint]kit-card--density-comfortable {
|
|
61
|
+
--card-spacing-x: calc(var(--kit-spacing) * 4);
|
|
62
|
+
--card-spacing-y: calc(var(--kit-spacing) * 4);
|
|
65
63
|
}
|
|
66
64
|
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
/* variant */
|
|
66
|
+
.kit-card[breakpoint]kit-card--variant-filled {
|
|
67
|
+
background-color: var(--card-background);
|
|
69
68
|
}
|
|
70
69
|
|
|
71
|
-
.kit-card
|
|
72
|
-
|
|
70
|
+
.kit-card[breakpoint]kit-card--variant-outline {
|
|
71
|
+
--card-color: var(--base, var(--kit-on-surface));
|
|
72
|
+
background-color: transparent;
|
|
73
|
+
}
|
|
74
|
+
.kit-card[breakpoint]kit-card--variant-outline::before {
|
|
75
|
+
content: '';
|
|
76
|
+
position: absolute;
|
|
77
|
+
inset: 0;
|
|
78
|
+
border: 1px solid currentColor;
|
|
79
|
+
pointer-events: none;
|
|
80
|
+
border-radius: inherit;
|
|
73
81
|
}
|
|
74
82
|
|
|
75
|
-
.kit-card
|
|
76
|
-
|
|
77
|
-
--card-color: var(--base, var(--kit-neutral));
|
|
83
|
+
.kit-card[breakpoint]kit-card--variant-text {
|
|
84
|
+
--card-color: var(--base, var(--kit-on-surface));
|
|
78
85
|
background-color: transparent;
|
|
86
|
+
border: none;
|
|
79
87
|
}
|
|
80
88
|
|
|
81
|
-
|
|
82
|
-
.kit-card.kit-card--
|
|
83
|
-
|
|
89
|
+
/* events */
|
|
90
|
+
.kit-card[class*='card--variant-filled'].kit-card--clickable:active,
|
|
91
|
+
.kit-card.kit-card--active[class*='card--variant-filled'].kit-card--clickable {
|
|
92
|
+
background-color: color-mix(in oklab, var(--card-background) 90%, var(--kit-scrim));
|
|
84
93
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
.kit-card
|
|
94
|
+
.kit-card.kit-card--active[class*='card--variant-']:not(
|
|
95
|
+
[class*='variant-filled']
|
|
96
|
+
).kit-card--clickable:active,
|
|
97
|
+
.kit-card.kit-card--active[class*='card--variant-']:not(
|
|
98
|
+
[class*='variant-filled']
|
|
99
|
+
).kit-card--clickable {
|
|
88
100
|
background-color: color-mix(in oklab, currentColor 15%, transparent);
|
|
89
101
|
}
|
|
90
102
|
|
|
91
|
-
|
|
92
|
-
.kit-card.kit-card--variant-text:active:not(div),
|
|
93
|
-
.kit-card.kit-card--variant-outline.kit-card--active,
|
|
94
|
-
.kit-card.kit-card--variant-text.kit-card--active {
|
|
95
|
-
background-color: color-mix(in oklab, currentColor 10%, transparent);
|
|
96
|
-
}
|
|
97
|
-
|
|
103
|
+
/* disabled */
|
|
98
104
|
.kit-card.kit-card--disabled,
|
|
99
105
|
.kit-card[disabled],
|
|
100
106
|
.kit-card:disabled {
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import { getAssets } from '../../internal/index.js';
|
|
3
3
|
import type { CardProps } from './types.js';
|
|
4
4
|
|
|
5
|
+
// external
|
|
6
|
+
import { ripple } from '../../internal/ripple.js';
|
|
7
|
+
|
|
5
8
|
let {
|
|
6
9
|
children,
|
|
7
10
|
ref = $bindable(),
|
|
@@ -11,18 +14,23 @@
|
|
|
11
14
|
light,
|
|
12
15
|
active,
|
|
13
16
|
density = 'default',
|
|
14
|
-
variant,
|
|
17
|
+
variant = 'filled',
|
|
15
18
|
disabled,
|
|
16
19
|
rounded,
|
|
17
20
|
color,
|
|
18
21
|
background,
|
|
22
|
+
noRipple,
|
|
19
23
|
...rest
|
|
20
24
|
}: CardProps = $props();
|
|
21
25
|
|
|
22
26
|
const assets = getAssets();
|
|
27
|
+
let isClickable: boolean = $state(false);
|
|
23
28
|
|
|
24
29
|
$effect(() => {
|
|
30
|
+
const refProps = { ...rest };
|
|
25
31
|
if (href) is = 'a';
|
|
32
|
+
if (refProps?.onclick || href || is === 'a') isClickable = true;
|
|
33
|
+
else isClickable = false;
|
|
26
34
|
});
|
|
27
35
|
</script>
|
|
28
36
|
|
|
@@ -37,11 +45,16 @@
|
|
|
37
45
|
dark && 'dark',
|
|
38
46
|
variant && assets.className('card', 'variant', variant),
|
|
39
47
|
density && assets.className('card', 'density', density),
|
|
48
|
+
isClickable && 'kit-card--clickable',
|
|
40
49
|
active && 'kit-card--active',
|
|
41
50
|
disabled && 'kit-card--disabled',
|
|
42
51
|
rest.class
|
|
43
52
|
]}
|
|
44
53
|
disabled={href ? undefined : disabled}
|
|
54
|
+
use:ripple={{
|
|
55
|
+
component: 'card',
|
|
56
|
+
disabled: noRipple || disabled || !isClickable
|
|
57
|
+
}}
|
|
45
58
|
style:--base={assets.color(background)}
|
|
46
59
|
style:--on={assets.color(color)}
|
|
47
60
|
style:--shape={assets.shape(rounded)}
|