lapikit 0.0.0-insiders.e877f7f → 0.0.0-insiders.f502b02
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/actions/index.d.ts +1 -0
- package/dist/actions/index.js +1 -0
- package/dist/assets/icons/arrow-down.svelte +10 -0
- package/dist/assets/icons/arrow-down.svelte.d.ts +26 -0
- package/dist/assets/icons/arrow-up.svelte +10 -0
- package/dist/assets/icons/arrow-up.svelte.d.ts +26 -0
- package/dist/assets/icons/close-fill.svelte +10 -0
- package/dist/assets/icons/close-fill.svelte.d.ts +26 -0
- package/dist/components/accordion/accordion.css +113 -0
- package/dist/components/accordion/accordion.svelte +37 -0
- package/dist/components/accordion/accordion.svelte.d.ts +4 -0
- package/dist/components/accordion/accordion.svelte.js +24 -0
- package/dist/components/accordion/modules/accordion-item.svelte +94 -0
- package/dist/components/accordion/modules/accordion-item.svelte.d.ts +4 -0
- package/dist/components/accordion/types.d.ts +33 -0
- package/dist/components/accordion/types.js +1 -0
- package/dist/components/alert/alert.css +127 -0
- package/dist/components/alert/alert.svelte +89 -0
- package/dist/components/alert/alert.svelte.d.ts +4 -0
- package/dist/components/alert/types.d.ts +28 -0
- package/dist/components/alert/types.js +1 -0
- package/dist/components/app/app.css +16 -0
- package/dist/components/app/app.svelte +31 -2
- package/dist/components/appbar/appbar.css +48 -0
- package/dist/components/appbar/appbar.svelte +41 -0
- package/dist/components/appbar/appbar.svelte.d.ts +4 -0
- package/dist/components/appbar/types.d.ts +15 -0
- package/dist/components/appbar/types.js +1 -0
- package/dist/components/aspect-ratio/aspect-ratio.css +19 -0
- package/dist/components/aspect-ratio/aspect-ratio.svelte +48 -0
- package/dist/components/aspect-ratio/aspect-ratio.svelte.d.ts +4 -0
- package/dist/components/aspect-ratio/types.d.ts +5 -0
- package/dist/components/aspect-ratio/types.js +1 -0
- package/dist/components/avatar/avatar.css +109 -0
- package/dist/components/avatar/avatar.svelte +46 -0
- package/dist/components/avatar/avatar.svelte.d.ts +4 -0
- package/dist/components/avatar/types.d.ts +22 -0
- package/dist/components/avatar/types.js +1 -0
- package/dist/components/button/button.css +162 -194
- package/dist/components/button/button.svelte +36 -24
- package/dist/components/button/button.svelte.d.ts +2 -2
- package/dist/components/button/types.d.ts +6 -4
- package/dist/components/card/card.css +109 -0
- package/dist/components/card/card.svelte +50 -0
- package/dist/components/card/card.svelte.d.ts +4 -0
- package/dist/components/card/types.d.ts +18 -0
- package/dist/components/card/types.js +1 -0
- package/dist/components/chip/chip.css +199 -0
- package/dist/components/chip/chip.svelte +118 -0
- package/dist/components/chip/chip.svelte.d.ts +4 -0
- package/dist/components/chip/types.d.ts +30 -0
- package/dist/components/chip/types.js +1 -0
- package/dist/components/dialog/dialog.css +134 -0
- package/dist/components/dialog/dialog.svelte +67 -0
- package/dist/components/dialog/dialog.svelte.d.ts +4 -0
- package/dist/components/dialog/types.d.ts +24 -0
- package/dist/components/dialog/types.js +1 -0
- package/dist/components/icon/icon.css +13 -10
- package/dist/components/index.d.ts +16 -1
- package/dist/components/index.js +16 -1
- package/dist/components/list/list.css +195 -0
- package/dist/components/list/list.svelte +46 -0
- package/dist/components/list/list.svelte.d.ts +4 -0
- package/dist/components/list/modules/list-item.svelte +68 -0
- package/dist/components/list/modules/list-item.svelte.d.ts +4 -0
- package/dist/components/list/types.d.ts +36 -0
- package/dist/components/list/types.js +1 -0
- package/dist/components/modal/modal.css +140 -0
- package/dist/components/modal/modal.svelte +112 -0
- package/dist/components/modal/modal.svelte.d.ts +4 -0
- package/dist/components/modal/types.d.ts +26 -0
- package/dist/components/modal/types.js +1 -0
- package/dist/components/separator/separator.css +46 -0
- package/dist/components/separator/separator.svelte +37 -0
- package/dist/components/separator/separator.svelte.d.ts +4 -0
- package/dist/components/separator/types.d.ts +11 -0
- package/dist/components/separator/types.js +1 -0
- package/dist/components/spacer/spacer.css +3 -0
- package/dist/components/spacer/spacer.svelte +7 -0
- package/dist/components/spacer/spacer.svelte.d.ts +4 -0
- package/dist/components/spacer/types.d.ts +4 -0
- package/dist/components/spacer/types.js +1 -0
- package/dist/components/toolbar/toolbar.css +129 -0
- package/dist/components/toolbar/toolbar.svelte +47 -0
- package/dist/components/toolbar/toolbar.svelte.d.ts +4 -0
- package/dist/components/toolbar/types.d.ts +27 -0
- package/dist/components/toolbar/types.js +1 -0
- package/dist/internal/assets.svelte.d.ts +1 -0
- package/dist/internal/assets.svelte.js +11 -0
- package/dist/internal/index.d.ts +1 -0
- package/dist/internal/index.js +1 -0
- package/dist/internal/ripple.d.ts +11 -0
- package/dist/internal/ripple.js +90 -0
- package/dist/internal/scroll.d.ts +1 -0
- package/dist/internal/scroll.js +6 -0
- package/dist/internal/unit.d.ts +1 -0
- package/dist/internal/unit.js +11 -0
- package/dist/preset.js +2 -2
- package/dist/stores/index.d.ts +9 -3
- package/dist/stores/index.js +27 -3
- package/dist/style/animation.css +40 -0
- package/dist/style/css.js +3 -0
- package/dist/style/parser/device.js +31 -19
- package/dist/style/variable.css +12 -0
- package/package.json +6 -2
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
.kit-card {
|
|
2
|
+
--card-color: var(--on, var(--kit-on-neutral));
|
|
3
|
+
--card-background: var(--base, var(--kit-neutral));
|
|
4
|
+
--card-radius: var(--shape, var(--kit-radius-md));
|
|
5
|
+
|
|
6
|
+
position: relative;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
text-align: start;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
transition:
|
|
12
|
+
color 0.5s,
|
|
13
|
+
background-color 0.5s;
|
|
14
|
+
|
|
15
|
+
padding-top: var(--card-spacing-x);
|
|
16
|
+
padding-bottom: var(--card-spacing-x);
|
|
17
|
+
padding-right: var(--card-spacing-y);
|
|
18
|
+
padding-left: var(--card-spacing-y);
|
|
19
|
+
|
|
20
|
+
border-width: 1px;
|
|
21
|
+
border-style: solid;
|
|
22
|
+
border-radius: var(--card-radius);
|
|
23
|
+
|
|
24
|
+
/* theme */
|
|
25
|
+
color: var(--card-color);
|
|
26
|
+
background-color: var(--card-background);
|
|
27
|
+
border-color: var(--card-background);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* density */
|
|
31
|
+
.kit-card[breakpoint]kit-card--density-default {
|
|
32
|
+
--card-spacing-x: 0.25rem;
|
|
33
|
+
--card-spacing-y: 0.25rem;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.kit-card[breakpoint]kit-card--density-compact {
|
|
37
|
+
--card-spacing-x: 0;
|
|
38
|
+
--card-spacing-y: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.kit-card[breakpoint]kit-card--density-comfortable {
|
|
42
|
+
--card-spacing-x: 0.5rem;
|
|
43
|
+
--card-spacing-y: 0.5rem;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
a.kit-card {
|
|
47
|
+
text-decoration: none;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.kit-card:hover:not(div) {
|
|
51
|
+
background-color: color-mix(in oklab, var(--card-background) 90%, black);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.kit-card:focus:not(div) {
|
|
55
|
+
background-color: color-mix(in oklab, var(--card-background) 95%, black);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.kit-card:active:not(div),
|
|
59
|
+
.kit-card.kit-card--active {
|
|
60
|
+
background-color: color-mix(in oklab, var(--card-background) 95%, black);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.kit-card:not(div) {
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.kit-card.kit-card--variant-outline {
|
|
68
|
+
border-color: currentColor;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.kit-card.kit-card--variant-text {
|
|
72
|
+
border-color: transparent;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.kit-card.kit-card--variant-outline,
|
|
76
|
+
.kit-card.kit-card--variant-text {
|
|
77
|
+
--card-color: var(--base, var(--kit-neutral));
|
|
78
|
+
background-color: transparent;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.kit-card.kit-card--variant-outline:hover:not(div),
|
|
82
|
+
.kit-card.kit-card--variant-text:hover:not(div) {
|
|
83
|
+
background-color: color-mix(in oklab, currentColor 7%, transparent);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.kit-card.kit-card--variant-outline:focus:not(div),
|
|
87
|
+
.kit-card.kit-card--variant-text:focus:not(div) {
|
|
88
|
+
background-color: color-mix(in oklab, currentColor 15%, transparent);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.kit-card.kit-card--variant-outline:active:not(div),
|
|
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
|
+
|
|
98
|
+
.kit-card.kit-card--disabled,
|
|
99
|
+
.kit-card[disabled],
|
|
100
|
+
.kit-card:disabled {
|
|
101
|
+
pointer-events: none;
|
|
102
|
+
user-select: none;
|
|
103
|
+
opacity: 0.6;
|
|
104
|
+
}
|
|
105
|
+
.kit-card.kit-card--disabled > *,
|
|
106
|
+
.kit-card[disabled] > *,
|
|
107
|
+
.kit-card:disabled > * {
|
|
108
|
+
opacity: 0.6;
|
|
109
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getAssets } from '../../internal/index.js';
|
|
3
|
+
import type { CardProps } from './types.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
children,
|
|
7
|
+
ref = $bindable(),
|
|
8
|
+
is = 'div',
|
|
9
|
+
href,
|
|
10
|
+
dark,
|
|
11
|
+
light,
|
|
12
|
+
active,
|
|
13
|
+
density = 'default',
|
|
14
|
+
variant,
|
|
15
|
+
disabled,
|
|
16
|
+
rounded,
|
|
17
|
+
color,
|
|
18
|
+
background,
|
|
19
|
+
...rest
|
|
20
|
+
}: CardProps = $props();
|
|
21
|
+
|
|
22
|
+
const assets = getAssets();
|
|
23
|
+
|
|
24
|
+
$effect(() => {
|
|
25
|
+
if (href) is = 'a';
|
|
26
|
+
});
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<svelte:element
|
|
30
|
+
this={is}
|
|
31
|
+
bind:this={ref}
|
|
32
|
+
{...rest}
|
|
33
|
+
href={href && !disabled ? href : undefined}
|
|
34
|
+
class={[
|
|
35
|
+
'kit-card',
|
|
36
|
+
light && 'light',
|
|
37
|
+
dark && 'dark',
|
|
38
|
+
variant && assets.className('card', 'variant', variant),
|
|
39
|
+
density && assets.className('card', 'density', density),
|
|
40
|
+
active && 'kit-card--active',
|
|
41
|
+
disabled && 'kit-card--disabled',
|
|
42
|
+
rest.class
|
|
43
|
+
]}
|
|
44
|
+
disabled={href ? undefined : disabled}
|
|
45
|
+
style:--base={assets.color(background)}
|
|
46
|
+
style:--on={assets.color(color)}
|
|
47
|
+
style:--shape={assets.shape(rounded)}
|
|
48
|
+
>
|
|
49
|
+
{@render children?.()}
|
|
50
|
+
</svelte:element>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Component } from '../../internal/types.js';
|
|
2
|
+
type Density = 'compact' | 'comfortable' | 'default';
|
|
3
|
+
export interface CardProps extends Component {
|
|
4
|
+
is?: 'a' | 'button' | 'div';
|
|
5
|
+
dark?: boolean;
|
|
6
|
+
light?: boolean;
|
|
7
|
+
href?: string;
|
|
8
|
+
variant?: 'outline' | 'text';
|
|
9
|
+
density?: Density | {
|
|
10
|
+
[key: string]: Density;
|
|
11
|
+
};
|
|
12
|
+
active?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
rounded?: string;
|
|
15
|
+
color?: string;
|
|
16
|
+
background?: string;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
.kit-chip {
|
|
2
|
+
--chip-color: var(--on, var(--kit-on-neutral));
|
|
3
|
+
--chip-background: var(--base, var(--kit-neutral));
|
|
4
|
+
--chip-radius: var(--shape, var(--kit-radius-full));
|
|
5
|
+
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
white-space: nowrap;
|
|
10
|
+
padding-top: var(--chip-spacing-x);
|
|
11
|
+
padding-bottom: var(--chip-spacing-x);
|
|
12
|
+
padding-right: var(--chip-spacing-y);
|
|
13
|
+
padding-left: var(--chip-spacing-y);
|
|
14
|
+
|
|
15
|
+
border-width: 1px;
|
|
16
|
+
border-style: solid;
|
|
17
|
+
border-radius: var(--chip-radius);
|
|
18
|
+
|
|
19
|
+
/* theme */
|
|
20
|
+
color: var(--chip-color);
|
|
21
|
+
background-color: var(--chip-background);
|
|
22
|
+
border-color: var(--chip-background);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
a.kit-chip,
|
|
26
|
+
button.kit-chip {
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.kit-chip .kit-chip-content,
|
|
31
|
+
.kit-chip .kit-chip-append,
|
|
32
|
+
.kit-chip .kit-chip-prepend,
|
|
33
|
+
.kit-chip .kit-chip--close,
|
|
34
|
+
.kit-chip .kit-chip-loading {
|
|
35
|
+
display: inline-flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
white-space: nowrap;
|
|
39
|
+
gap: var(--chip-gap);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* size */
|
|
43
|
+
.kit-chip[breakpoint]kit-chip--size-xs {
|
|
44
|
+
--chip-height: 1.25rem;
|
|
45
|
+
--chip-multiplier-y: 2;
|
|
46
|
+
--chip-gap: 0.25rem;
|
|
47
|
+
font-size: 0.625rem;
|
|
48
|
+
gap: var(--chip-gap);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.kit-chip[breakpoint]kit-chip--size-sm {
|
|
52
|
+
--chip-height: 1.625rem;
|
|
53
|
+
--chip-multiplier-y: 3;
|
|
54
|
+
--chip-gap: 0.5rem;
|
|
55
|
+
font-size: 0.75rem;
|
|
56
|
+
gap: var(--chip-gap);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.kit-chip[breakpoint]kit-chip--size-md {
|
|
60
|
+
--chip-height: 2rem;
|
|
61
|
+
--chip-multiplier-y: 4;
|
|
62
|
+
--chip-gap: 0.5rem;
|
|
63
|
+
font-size: 0.875rem;
|
|
64
|
+
gap: var(--chip-gap);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.kit-chip[breakpoint]kit-chip--size-lg {
|
|
68
|
+
--chip-height: 2.375rem;
|
|
69
|
+
--chip-multiplier-y: 5;
|
|
70
|
+
--chip-gap: 0.5rem;
|
|
71
|
+
font-size: 1rem;
|
|
72
|
+
gap: var(--chip-gap);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.kit-chip[breakpoint]kit-chip--size-xl {
|
|
76
|
+
--chip-height: 2.75rem;
|
|
77
|
+
--chip-multiplier-y: 6;
|
|
78
|
+
--chip-gap: 0.675rem;
|
|
79
|
+
font-size: 1.125rem;
|
|
80
|
+
gap: var(--chip-gap);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* variant */
|
|
84
|
+
.kit-chip[breakpoint]kit-chip--variant-outline {
|
|
85
|
+
--chip-color: var(--base, var(--kit-neutral));
|
|
86
|
+
background-color: transparent;
|
|
87
|
+
border: 1px solid currentColor;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* density */
|
|
91
|
+
.kit-chip[breakpoint]kit-chip--density-default {
|
|
92
|
+
height: calc(var(--chip-height));
|
|
93
|
+
min-width: calc(var(--chip-height));
|
|
94
|
+
--chip-spacing-x: 0;
|
|
95
|
+
--chip-spacing-y: calc(var(--kit-spacing) * var(--chip-multiplier-y));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.kit-chip[breakpoint]kit-chip--density-compact {
|
|
99
|
+
height: calc(var(--chip-height) - 0.25rem);
|
|
100
|
+
min-width: calc(var(--chip-height - 0.25rem));
|
|
101
|
+
--chip-spacing-x: 0;
|
|
102
|
+
--chip-spacing-y: calc(var(--kit-spacing) * var(--chip-multiplier-y) - 0.25rem);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.kit-chip[breakpoint]kit-chip--density-comfortable {
|
|
106
|
+
height: calc(var(--chip-height) + 0.25rem);
|
|
107
|
+
min-width: calc(var(--chip-height) + 0.25rem);
|
|
108
|
+
--chip-spacing-x: 0;
|
|
109
|
+
--chip-spacing-y: calc(var(--kit-spacing) * var(--chip-multiplier-y) + 0.25rem);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* state */
|
|
113
|
+
.kit-chip.kit-chip--info:not([class*='chip--variant-']) {
|
|
114
|
+
--on: var(--kit-on-info);
|
|
115
|
+
--base: var(--kit-info);
|
|
116
|
+
}
|
|
117
|
+
.kit-chip.kit-chip--info[class*='chip--variant-'] {
|
|
118
|
+
--base: var(--kit-info);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.kit-chip.kit-chip--success:not([class*='chip--variant-']) {
|
|
122
|
+
--on: var(--kit-on-success);
|
|
123
|
+
--base: var(--kit-success);
|
|
124
|
+
}
|
|
125
|
+
.kit-chip.kit-chip--success[class*='chip--variant-'] {
|
|
126
|
+
--base: var(--kit-success);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.kit-chip.kit-chip--warning:not([class*='chip--variant-']) {
|
|
130
|
+
--on: var(--kit-on-warning);
|
|
131
|
+
--base: var(--kit-warning);
|
|
132
|
+
}
|
|
133
|
+
.kit-chip.kit-chip--warning[class*='chip--variant-'] {
|
|
134
|
+
--base: var(--kit-warning);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.kit-chip.kit-chip--error:not([class*='chip--variant-']) {
|
|
138
|
+
--on: var(--kit-on-error);
|
|
139
|
+
--base: var(--kit-error);
|
|
140
|
+
}
|
|
141
|
+
.kit-chip.kit-chip--error[class*='chip--variant-'] {
|
|
142
|
+
--base: var(--kit-error);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* events */
|
|
146
|
+
.kit-chip.kit-chip--active:not([class*='chip--variant-']) {
|
|
147
|
+
background-color: color-mix(in oklab, var(--chip-background) 90%, var(--kit-scrim));
|
|
148
|
+
border-color: color-mix(in oklab, var(--chip-background) 90%, var(--kit-scrim));
|
|
149
|
+
}
|
|
150
|
+
.kit-chip.kit-chip--active[class*='chip--variant-'] {
|
|
151
|
+
background-color: color-mix(in oklab, currentColor 15%, transparent);
|
|
152
|
+
border-color: color-mix(in oklab, currentColor 15%, transparent);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.kit-chip:hover:not([class*='chip--variant-']) {
|
|
156
|
+
background-color: color-mix(in oklab, var(--chip-background) 85%, var(--kit-scrim));
|
|
157
|
+
border-color: color-mix(in oklab, var(--chip-background) 85%, var(--kit-scrim));
|
|
158
|
+
}
|
|
159
|
+
.kit-chip:hover[class*='chip--variant-'] {
|
|
160
|
+
background-color: color-mix(in oklab, currentColor 25%, transparent);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* disabled */
|
|
164
|
+
.kit-chip.kit-chip--disabled,
|
|
165
|
+
.kit-chip[disabled] {
|
|
166
|
+
pointer-events: none;
|
|
167
|
+
user-select: none;
|
|
168
|
+
cursor: default;
|
|
169
|
+
}
|
|
170
|
+
.kit-chip:not([class*='chip--variant-']).kit-chip--disabled {
|
|
171
|
+
color: color-mix(in oklab, var(--chip-color) 40%, transparent) !important;
|
|
172
|
+
background-color: color-mix(in oklab, var(--chip-background) 70%, transparent) !important;
|
|
173
|
+
border-color: color-mix(in oklab, var(--chip-background) 70%, transparent) !important;
|
|
174
|
+
}
|
|
175
|
+
.kit-chip:not([class*='chip--variant-']).kit-chip--disabled i:before {
|
|
176
|
+
color: color-mix(in oklab, var(--chip-color) 40%, transparent) !important;
|
|
177
|
+
}
|
|
178
|
+
.kit-chip[class*='chip--variant-'].kit-chip--disabled,
|
|
179
|
+
.kit-chip[class*='chip--variant-'].kit-chip--disabled i:before {
|
|
180
|
+
color: color-mix(in oklab, var(--chip-background) 40%, transparent) !important;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/* loading */
|
|
184
|
+
.kit-chip.kit-chip--loading {
|
|
185
|
+
pointer-events: none;
|
|
186
|
+
user-select: none;
|
|
187
|
+
cursor: default;
|
|
188
|
+
}
|
|
189
|
+
.kit-chip.kit-chip--loading > .kit-chip-content {
|
|
190
|
+
color: transparent;
|
|
191
|
+
opacity: 0;
|
|
192
|
+
}
|
|
193
|
+
.kit-chip.kit-chip--loading > .kit-chip-loading {
|
|
194
|
+
position: absolute;
|
|
195
|
+
min-width: fit-content;
|
|
196
|
+
}
|
|
197
|
+
.kit-chip.kit-chip--loading > .kit-chip-loading .kit-icon-load {
|
|
198
|
+
animation: icon-rotate 1s ease-out infinite;
|
|
199
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getAssets } from '../../internal/index.js';
|
|
3
|
+
import { Icon } from '../index.js';
|
|
4
|
+
import type { ChipProps } from './types.js';
|
|
5
|
+
|
|
6
|
+
// external
|
|
7
|
+
import LoadingFill from '../../assets/icons/loading-fill.svelte';
|
|
8
|
+
import Close from '../../assets/icons/close-fill.svelte';
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
children,
|
|
12
|
+
load,
|
|
13
|
+
close,
|
|
14
|
+
append,
|
|
15
|
+
prepend,
|
|
16
|
+
ref = $bindable(),
|
|
17
|
+
open = $bindable(true),
|
|
18
|
+
is = 'div',
|
|
19
|
+
href,
|
|
20
|
+
dark,
|
|
21
|
+
light,
|
|
22
|
+
active,
|
|
23
|
+
variant,
|
|
24
|
+
error,
|
|
25
|
+
info,
|
|
26
|
+
success,
|
|
27
|
+
warning,
|
|
28
|
+
density = 'default',
|
|
29
|
+
disabled,
|
|
30
|
+
size = 'md',
|
|
31
|
+
type,
|
|
32
|
+
background,
|
|
33
|
+
color,
|
|
34
|
+
label,
|
|
35
|
+
loading,
|
|
36
|
+
rounded,
|
|
37
|
+
closable,
|
|
38
|
+
...rest
|
|
39
|
+
}: ChipProps = $props();
|
|
40
|
+
|
|
41
|
+
const assets = getAssets();
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
{#if !closable || (open && closable)}
|
|
45
|
+
<svelte:element
|
|
46
|
+
this={href ? 'a' : is}
|
|
47
|
+
bind:this={ref}
|
|
48
|
+
{...rest}
|
|
49
|
+
href={href && !disabled ? href : undefined}
|
|
50
|
+
class={[
|
|
51
|
+
'kit-chip',
|
|
52
|
+
light && 'light',
|
|
53
|
+
dark && 'dark',
|
|
54
|
+
size && assets.className('chip', 'size', size),
|
|
55
|
+
variant && assets.className('chip', 'variant', variant),
|
|
56
|
+
density && assets.className('chip', 'density', density),
|
|
57
|
+
error && 'kit-chip--error',
|
|
58
|
+
info && 'kit-chip--info',
|
|
59
|
+
success && 'kit-chip--success',
|
|
60
|
+
warning && 'kit-chip--warning',
|
|
61
|
+
disabled && 'kit-chip--disabled',
|
|
62
|
+
active && 'kit-chip--active',
|
|
63
|
+
loading && 'kit-chip--loading',
|
|
64
|
+
rest.class
|
|
65
|
+
]}
|
|
66
|
+
tabindex={href && disabled ? -1 : 0}
|
|
67
|
+
aria-disabled={href ? disabled : undefined}
|
|
68
|
+
aria-label={type !== 'button' ? label : undefined}
|
|
69
|
+
disabled={href ? undefined : disabled}
|
|
70
|
+
type={href ? undefined : type}
|
|
71
|
+
style:--base={assets.color(background)}
|
|
72
|
+
style:--on={assets.color(color)}
|
|
73
|
+
style:--shape={assets.shape(rounded)}
|
|
74
|
+
>
|
|
75
|
+
{#if loading}
|
|
76
|
+
<div class="kit-chip-loading">
|
|
77
|
+
{#if load}
|
|
78
|
+
{@render load?.()}
|
|
79
|
+
{:else}
|
|
80
|
+
<Icon class="kit-icon-load">
|
|
81
|
+
<LoadingFill />
|
|
82
|
+
</Icon>
|
|
83
|
+
{/if}
|
|
84
|
+
</div>
|
|
85
|
+
{/if}
|
|
86
|
+
|
|
87
|
+
{#if prepend}
|
|
88
|
+
<span class="kit-chip-prepend">
|
|
89
|
+
{@render prepend?.()}
|
|
90
|
+
</span>
|
|
91
|
+
{/if}
|
|
92
|
+
<span class="kit-chip-content">
|
|
93
|
+
{@render children?.()}
|
|
94
|
+
</span>
|
|
95
|
+
{#if append}
|
|
96
|
+
<span class="kit-chip-append">
|
|
97
|
+
{@render append?.()}
|
|
98
|
+
</span>
|
|
99
|
+
{/if}
|
|
100
|
+
|
|
101
|
+
{#if closable}
|
|
102
|
+
<button
|
|
103
|
+
class="kit-chip--close"
|
|
104
|
+
type="button"
|
|
105
|
+
aria-label="close"
|
|
106
|
+
onclick={() => (open = false)}
|
|
107
|
+
>
|
|
108
|
+
{#if close}
|
|
109
|
+
{@render close?.()}
|
|
110
|
+
{:else}
|
|
111
|
+
<Icon>
|
|
112
|
+
<Close />
|
|
113
|
+
</Icon>
|
|
114
|
+
{/if}
|
|
115
|
+
</button>
|
|
116
|
+
{/if}
|
|
117
|
+
</svelte:element>
|
|
118
|
+
{/if}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Component } from '../../internal/types.js';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
export interface ChipProps extends Component {
|
|
4
|
+
load?: Snippet;
|
|
5
|
+
close?: Snippet;
|
|
6
|
+
append?: Snippet;
|
|
7
|
+
prepend?: Snippet;
|
|
8
|
+
ref?: HTMLElement | null;
|
|
9
|
+
is?: 'button' | 'a' | 'span' | 'div';
|
|
10
|
+
dark?: boolean;
|
|
11
|
+
light?: boolean;
|
|
12
|
+
href?: string;
|
|
13
|
+
variant?: 'outline';
|
|
14
|
+
density?: 'compact' | 'comfortable' | 'default';
|
|
15
|
+
active?: boolean;
|
|
16
|
+
loading?: boolean;
|
|
17
|
+
error?: boolean;
|
|
18
|
+
info?: boolean;
|
|
19
|
+
warning?: boolean;
|
|
20
|
+
success?: boolean;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
color?: string;
|
|
23
|
+
background?: string;
|
|
24
|
+
size?: string | {
|
|
25
|
+
[key: string]: string;
|
|
26
|
+
};
|
|
27
|
+
type?: 'button';
|
|
28
|
+
label?: string;
|
|
29
|
+
closable?: boolean;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
.kit-dialog {
|
|
2
|
+
border: 0;
|
|
3
|
+
padding: 0;
|
|
4
|
+
margin: auto;
|
|
5
|
+
width: 100%;
|
|
6
|
+
max-width: none;
|
|
7
|
+
background-color: transparent;
|
|
8
|
+
color: inherit;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.kit-dialog[open] {
|
|
12
|
+
pointer-events: auto;
|
|
13
|
+
visibility: visible;
|
|
14
|
+
opacity: 1;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.kit-dialog::backdrop {
|
|
18
|
+
background-color: color-mix(in oklab, var(--kit-shadow) 30%, transparent);
|
|
19
|
+
animation: fade 0.2s ease-out;
|
|
20
|
+
}
|
|
21
|
+
.kit-dialog[open]::backdrop {
|
|
22
|
+
animation: fade 0.2s ease-out;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.kit-dialog .kit-dialog-container {
|
|
26
|
+
--dialog-color: var(--on, var(--kit-on-neutral));
|
|
27
|
+
--dialog-background: var(--base, var(--kit-neutral));
|
|
28
|
+
--dialog-radius: var(--shape, var(--kit-radius-md));
|
|
29
|
+
|
|
30
|
+
border-radius: var(--dialog-radius);
|
|
31
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
32
|
+
transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
|
|
33
|
+
transition-duration: 0.2s;
|
|
34
|
+
padding-top: var(--dialog-spacing-x);
|
|
35
|
+
padding-bottom: var(--dialog-spacing-x);
|
|
36
|
+
padding-right: var(--dialog-spacing-y);
|
|
37
|
+
padding-left: var(--dialog-spacing-y);
|
|
38
|
+
|
|
39
|
+
/* theme */
|
|
40
|
+
color: var(--dialog-color);
|
|
41
|
+
background-color: var(--dialog-background);
|
|
42
|
+
border-color: var(--dialog-background);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.kit-dialog .close-dialog {
|
|
46
|
+
opacity: 0;
|
|
47
|
+
position: fixed;
|
|
48
|
+
top: 0;
|
|
49
|
+
z-index: -1;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.kit-dialog[breakpoint]kit-dialog--position-bottom {
|
|
53
|
+
margin-bottom: 0;
|
|
54
|
+
margin-top: auto;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.kit-dialog[breakpoint]kit-dialog--position-top {
|
|
58
|
+
margin-top: 0;
|
|
59
|
+
margin-bottom: auto;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.kit-dialog[breakpoint]kit-dialog--position-center {
|
|
63
|
+
margin: auto;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.kit-dialog[breakpoint]kit-dialog--size-xs {
|
|
67
|
+
max-width: var(--kit-dialog-size-xs);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.kit-dialog[breakpoint]kit-dialog--size-sm {
|
|
71
|
+
max-width: var(--kit-dialog-size-sm);
|
|
72
|
+
height: fit-content;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.kit-dialog[breakpoint]kit-dialog--size-md {
|
|
76
|
+
max-width: var(--kit-dialog-size-md);
|
|
77
|
+
height: fit-content;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.kit-dialog[breakpoint]kit-dialog--size-lg {
|
|
81
|
+
max-width: var(--kit-dialog-size-lg);
|
|
82
|
+
height: fit-content;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.kit-dialog[breakpoint]kit-dialog--size-xl {
|
|
86
|
+
max-width: var(--kit-dialog-size-xl);
|
|
87
|
+
height: fit-content;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.kit-dialog[breakpoint]kit-dialog--size-xs .kit-dialog-container {
|
|
91
|
+
max-height: calc(100% - 3rem);
|
|
92
|
+
margin: 0 auto;
|
|
93
|
+
}
|
|
94
|
+
.kit-dialog[breakpoint]kit-dialog--size-sm .kit-dialog-container {
|
|
95
|
+
max-height: calc(100% - 3rem);
|
|
96
|
+
margin: 0 auto;
|
|
97
|
+
}
|
|
98
|
+
.kit-dialog[breakpoint]kit-dialog--size-md .kit-dialog-container {
|
|
99
|
+
max-height: calc(100% - 3rem);
|
|
100
|
+
margin: 0 auto;
|
|
101
|
+
}
|
|
102
|
+
.kit-dialog[breakpoint]kit-dialog--size-lg .kit-dialog-container {
|
|
103
|
+
max-height: calc(100% - 3rem);
|
|
104
|
+
margin: 0 auto;
|
|
105
|
+
}
|
|
106
|
+
.kit-dialog[breakpoint]kit-dialog--size-xl .kit-dialog-container {
|
|
107
|
+
max-height: calc(100% - 3rem);
|
|
108
|
+
margin: 0 auto;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* density */
|
|
112
|
+
.kit-dialog .kit-dialog-container[breakpoint]kit-dialog-container--density-default {
|
|
113
|
+
--dialog-spacing-x: 0.5rem;
|
|
114
|
+
--dialog-spacing-y: 0.5rem;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.kit-dialog .kit-dialog-container[breakpoint]kit-dialog-container--density-compact {
|
|
118
|
+
--dialog-spacing-x: 0.25rem;
|
|
119
|
+
--dialog-spacing-y: 0.25rem;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.kit-dialog .kit-dialog-container[breakpoint]kit-dialog-container--density-comfortable {
|
|
123
|
+
--dialog-spacing-x: 0.75rem;
|
|
124
|
+
--dialog-spacing-y: 0.75rem;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@keyframes fade {
|
|
128
|
+
from {
|
|
129
|
+
opacity: 0;
|
|
130
|
+
}
|
|
131
|
+
to {
|
|
132
|
+
opacity: 1;
|
|
133
|
+
}
|
|
134
|
+
}
|