lapikit 0.7.3 → 0.7.5
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 +8 -2
- 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 +25 -43
- 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 +432 -466
- package/dist/components/btn/btn.types.d.ts +5 -6
- package/dist/components/card/card.svelte +24 -23
- package/dist/components/card/card.types.d.ts +2 -2
- package/dist/components/card/modules/card-content.svelte +4 -1
- package/dist/components/card/modules/card-title.svelte +4 -1
- package/dist/components/chip/chip.svelte +416 -464
- package/dist/components/chip/chip.types.d.ts +5 -5
- package/dist/components/dialog/dialog.svelte +184 -175
- 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.js +9 -9
- 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/escaping.js +0 -1
- package/dist/html-mapped.d.ts +1 -15
- package/dist/html-mapped.js +0 -19
- package/dist/labs/sheet/sheet.svelte +27 -22
- 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/dist/utils/outside.d.ts +3 -1
- package/dist/utils/outside.js +15 -3
- package/package.json +6 -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
|
}
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
}: CardProps = $props();
|
|
27
27
|
|
|
28
28
|
let tag = $derived((href && 'a') || is);
|
|
29
|
-
// undefined: detected (a, button, onclick...), true: forced, false: no visual feedback (still clickable)
|
|
30
29
|
let isInteractive = $derived(interactive ?? useIsInteractive(rest, tag, ['a', 'button']));
|
|
31
30
|
let isDisabled = $derived(!!disabled);
|
|
32
31
|
let resolvedHref = $derived(tag === 'a' && !isDisabled ? href : undefined);
|
|
@@ -38,7 +37,6 @@
|
|
|
38
37
|
useComponentAttrs('kit-card', { className, sClass, styleAttr, sStyle, color, active }, rest)
|
|
39
38
|
);
|
|
40
39
|
let elevationState = $derived(useElevation(elevation));
|
|
41
|
-
// the border is drawn over the content, so the outline and surface variants keep the same box
|
|
42
40
|
let hasOutline = $derived(variant === 'outline' || variant === 'surface');
|
|
43
41
|
</script>
|
|
44
42
|
|
|
@@ -74,7 +72,7 @@
|
|
|
74
72
|
{@render children?.()}
|
|
75
73
|
</svelte:element>
|
|
76
74
|
|
|
77
|
-
<style
|
|
75
|
+
<style>:where(.kit-card) {
|
|
78
76
|
--kit-card-color: initial;
|
|
79
77
|
--kit-card-on-color: initial;
|
|
80
78
|
--kit-card-active-fg: initial;
|
|
@@ -95,13 +93,16 @@
|
|
|
95
93
|
);
|
|
96
94
|
}
|
|
97
95
|
@supports (color: color(from red srgb-linear r g b)) {
|
|
98
|
-
.kit-card {
|
|
96
|
+
:where(.kit-card) {
|
|
99
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);
|
|
100
98
|
}
|
|
101
99
|
}
|
|
102
|
-
.kit-card {
|
|
100
|
+
:where(.kit-card) {
|
|
103
101
|
--kit-card-gap: calc(var(--kit-space-default) + var(--kit-card-density-offset) / 2);
|
|
104
102
|
--kit-card-padding: calc(10px + var(--kit-card-density-offset) / 2);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.kit-card {
|
|
105
106
|
display: flex;
|
|
106
107
|
position: relative;
|
|
107
108
|
flex-direction: column;
|
|
@@ -138,7 +139,7 @@ button.kit-card {
|
|
|
138
139
|
* variant
|
|
139
140
|
* @link https://lapikit.dev/docs/components/card#variants
|
|
140
141
|
*/
|
|
141
|
-
.kit-card[data-variant=tonal] {
|
|
142
|
+
:where(.kit-card[data-variant=tonal]) {
|
|
142
143
|
--kit-card-bg: color-mix(in oklab, var(--kit-card-ink) 16%, transparent);
|
|
143
144
|
--kit-card-fg: var(--kit-card-ink);
|
|
144
145
|
--kit-card-border: transparent;
|
|
@@ -146,7 +147,7 @@ button.kit-card {
|
|
|
146
147
|
--kit-card-active-fg: var(--kit-card-ink);
|
|
147
148
|
}
|
|
148
149
|
|
|
149
|
-
.kit-card[data-variant=text] {
|
|
150
|
+
:where(.kit-card[data-variant=text]) {
|
|
150
151
|
--kit-card-bg: transparent;
|
|
151
152
|
--kit-card-fg: var(--kit-card-ink);
|
|
152
153
|
--kit-card-border: transparent;
|
|
@@ -154,7 +155,7 @@ button.kit-card {
|
|
|
154
155
|
--kit-card-active-fg: var(--kit-card-ink);
|
|
155
156
|
}
|
|
156
157
|
|
|
157
|
-
.kit-card[data-variant=plain] {
|
|
158
|
+
:where(.kit-card[data-variant=plain]) {
|
|
158
159
|
--kit-card-bg: transparent;
|
|
159
160
|
--kit-card-fg: var(--kit-card-ink);
|
|
160
161
|
--kit-card-border: transparent;
|
|
@@ -166,7 +167,7 @@ button.kit-card {
|
|
|
166
167
|
--kit-card-active-fg: var(--kit-card-color, var(--kit-color-accent));
|
|
167
168
|
}
|
|
168
169
|
|
|
169
|
-
.kit-card[data-variant=outline] {
|
|
170
|
+
:where(.kit-card[data-variant=outline]) {
|
|
170
171
|
--kit-card-bg: transparent;
|
|
171
172
|
--kit-card-fg: var(--kit-card-ink);
|
|
172
173
|
--kit-card-border: var(--kit-card-color, var(--kit-color-border));
|
|
@@ -174,7 +175,7 @@ button.kit-card {
|
|
|
174
175
|
--kit-card-active-fg: var(--kit-card-ink);
|
|
175
176
|
}
|
|
176
177
|
|
|
177
|
-
.kit-card[data-variant=surface] {
|
|
178
|
+
:where(.kit-card[data-variant=surface]) {
|
|
178
179
|
--kit-card-bg: color-mix(in oklab, var(--kit-card-ink) 8%, transparent);
|
|
179
180
|
--kit-card-fg: var(--kit-card-ink);
|
|
180
181
|
--kit-card-border: color-mix(in oklab, var(--kit-card-ink) 35%, transparent);
|
|
@@ -182,11 +183,11 @@ button.kit-card {
|
|
|
182
183
|
--kit-card-active-fg: var(--kit-card-ink);
|
|
183
184
|
}
|
|
184
185
|
|
|
185
|
-
.kit-card .outline {
|
|
186
|
+
:where(.kit-card .outline) {
|
|
186
187
|
--outline-color: var(--kit-card-border);
|
|
187
188
|
}
|
|
188
189
|
|
|
189
|
-
.kit-card[data-active=true] {
|
|
190
|
+
:where(.kit-card[data-active=true]) {
|
|
190
191
|
--kit-card-bg: var(--kit-card-active, var(--kit-color-accent));
|
|
191
192
|
--kit-card-fg: var(
|
|
192
193
|
--kit-card-active-fg,
|
|
@@ -224,27 +225,27 @@ button.kit-card {
|
|
|
224
225
|
* rounded
|
|
225
226
|
* @link https://lapikit.dev/docs/customize
|
|
226
227
|
*/
|
|
227
|
-
.kit-card[data-rounded="0"] {
|
|
228
|
+
:where(.kit-card[data-rounded="0"]) {
|
|
228
229
|
--kit-card-radius: var(--kit-shape-none);
|
|
229
230
|
}
|
|
230
231
|
|
|
231
|
-
.kit-card[data-rounded=xs] {
|
|
232
|
+
:where(.kit-card[data-rounded=xs]) {
|
|
232
233
|
--kit-card-radius: var(--kit-shape-xs);
|
|
233
234
|
}
|
|
234
235
|
|
|
235
|
-
.kit-card[data-rounded=sm] {
|
|
236
|
+
:where(.kit-card[data-rounded=sm]) {
|
|
236
237
|
--kit-card-radius: var(--kit-shape-sm);
|
|
237
238
|
}
|
|
238
239
|
|
|
239
|
-
.kit-card[data-rounded=md] {
|
|
240
|
+
:where(.kit-card[data-rounded=md]) {
|
|
240
241
|
--kit-card-radius: var(--kit-shape-md);
|
|
241
242
|
}
|
|
242
243
|
|
|
243
|
-
.kit-card[data-rounded=lg] {
|
|
244
|
+
:where(.kit-card[data-rounded=lg]) {
|
|
244
245
|
--kit-card-radius: var(--kit-shape-lg);
|
|
245
246
|
}
|
|
246
247
|
|
|
247
|
-
.kit-card[data-rounded=xl] {
|
|
248
|
+
:where(.kit-card[data-rounded=xl]) {
|
|
248
249
|
--kit-card-radius: var(--kit-shape-xl);
|
|
249
250
|
}
|
|
250
251
|
|
|
@@ -252,22 +253,22 @@ button.kit-card {
|
|
|
252
253
|
* density
|
|
253
254
|
* @link https://lapikit.dev/docs/components/card#density
|
|
254
255
|
*/
|
|
255
|
-
.kit-card[data-density=dense] {
|
|
256
|
+
:where(.kit-card[data-density=dense]) {
|
|
256
257
|
--kit-card-density-offset: var(--kit-density-dense);
|
|
257
258
|
}
|
|
258
259
|
|
|
259
|
-
.kit-card[data-density=compact] {
|
|
260
|
+
:where(.kit-card[data-density=compact]) {
|
|
260
261
|
--kit-card-density-offset: var(--kit-density-compact);
|
|
261
262
|
}
|
|
262
263
|
|
|
263
|
-
.kit-card[data-density=default] {
|
|
264
|
+
:where(.kit-card[data-density=default]) {
|
|
264
265
|
--kit-card-density-offset: var(--kit-density-default);
|
|
265
266
|
}
|
|
266
267
|
|
|
267
|
-
.kit-card[data-density=comfortable] {
|
|
268
|
+
:where(.kit-card[data-density=comfortable]) {
|
|
268
269
|
--kit-card-density-offset: var(--kit-density-comfortable);
|
|
269
270
|
}
|
|
270
271
|
|
|
271
|
-
.kit-card[data-density=spacious] {
|
|
272
|
+
:where(.kit-card[data-density=spacious]) {
|
|
272
273
|
--kit-card-density-offset: var(--kit-density-spacious);
|
|
273
274
|
}</style>
|
|
@@ -17,12 +17,12 @@ export interface CardProps extends Component {
|
|
|
17
17
|
export interface CardTitleProps extends Component {
|
|
18
18
|
ref?: HTMLElement | null;
|
|
19
19
|
is?: 'div' | 'p' | 'span' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
20
|
-
color?: string;
|
|
20
|
+
color?: string | false;
|
|
21
21
|
}
|
|
22
22
|
export interface CardContentProps extends Component {
|
|
23
23
|
ref?: HTMLElement | null;
|
|
24
24
|
is?: 'div' | 'p' | 'span' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
25
|
-
color?: string;
|
|
25
|
+
color?: string | false;
|
|
26
26
|
}
|
|
27
27
|
export interface CardMediaProps extends Component {
|
|
28
28
|
ref?: HTMLElement | null;
|
|
@@ -23,8 +23,11 @@
|
|
|
23
23
|
{@render children?.()}
|
|
24
24
|
</svelte:element>
|
|
25
25
|
|
|
26
|
-
<style
|
|
26
|
+
<style>:where(.kit-card-content) {
|
|
27
27
|
--kit-card-content-color: initial;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.kit-card-content {
|
|
28
31
|
color: var(--kit-card-content-color, currentColor);
|
|
29
32
|
display: block;
|
|
30
33
|
line-height: 1.45;
|