lapikit 0.0.0-insiders.fbbc9f6 → 0.0.0-insiders.fbd9b54
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 +22 -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/prompts.js +101 -0
- package/dist/actions/index.d.ts +1 -0
- package/dist/actions/index.js +1 -0
- package/dist/assets/icons/arrow-down.svelte +12 -0
- package/dist/assets/icons/arrow-down.svelte.d.ts +18 -0
- package/dist/assets/icons/arrow-up.svelte +12 -0
- package/dist/assets/icons/arrow-up.svelte.d.ts +18 -0
- package/dist/assets/icons/close-fill.svelte +12 -0
- package/dist/assets/icons/close-fill.svelte.d.ts +18 -0
- package/dist/assets/icons/loading-fill.svelte +2 -0
- package/dist/assets/icons/loading-fill.svelte.d.ts +6 -14
- 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 +137 -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 +40 -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 +47 -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 +165 -194
- package/dist/components/button/button.svelte +39 -31
- package/dist/components/button/button.svelte.d.ts +2 -2
- package/dist/components/button/types.d.ts +7 -5
- package/dist/components/card/card.css +115 -0
- package/dist/components/card/card.svelte +63 -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 +231 -0
- package/dist/components/chip/chip.svelte +129 -0
- package/dist/components/chip/chip.svelte.d.ts +4 -0
- package/dist/components/chip/types.d.ts +31 -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/dropdown/dropdown.css +22 -0
- package/dist/components/dropdown/dropdown.svelte +116 -0
- package/dist/components/dropdown/dropdown.svelte.d.ts +4 -0
- package/dist/components/dropdown/dropdown.svelte.js +148 -0
- package/dist/components/dropdown/types.d.ts +26 -0
- package/dist/components/dropdown/types.js +1 -0
- package/dist/components/icon/icon.css +14 -11
- package/dist/components/index.d.ts +20 -1
- package/dist/components/index.js +20 -1
- package/dist/components/list/list.css +221 -0
- package/dist/components/list/list.svelte +44 -0
- package/dist/components/list/list.svelte.d.ts +4 -0
- package/dist/components/list/modules/list-item.svelte +76 -0
- package/dist/components/list/modules/list-item.svelte.d.ts +4 -0
- package/dist/components/list/types.d.ts +33 -0
- package/dist/components/list/types.js +1 -0
- package/dist/components/modal/modal.css +144 -0
- package/dist/components/modal/modal.svelte +113 -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/popover/popover.css +22 -0
- package/dist/components/popover/popover.svelte +73 -0
- package/dist/components/popover/popover.svelte.d.ts +4 -0
- package/dist/components/popover/popover.svelte.js +134 -0
- package/dist/components/popover/types.d.ts +20 -0
- package/dist/components/popover/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/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 +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/components/tooltip/tooltip.css +124 -0
- package/dist/components/tooltip/tooltip.svelte +113 -0
- package/dist/components/tooltip/tooltip.svelte.d.ts +4 -0
- package/dist/components/tooltip/tooltip.svelte.js +131 -0
- package/dist/components/tooltip/types.d.ts +23 -0
- package/dist/components/tooltip/types.js +1 -0
- package/dist/internal/assets.svelte.d.ts +1 -0
- package/dist/internal/assets.svelte.js +13 -0
- package/dist/internal/clickOutside.d.ts +9 -0
- package/dist/internal/clickOutside.js +34 -0
- package/dist/internal/index.d.ts +1 -0
- package/dist/internal/index.js +1 -0
- package/dist/internal/ripple.d.ts +12 -0
- package/dist/internal/ripple.js +93 -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 +42 -0
- package/dist/style/css.js +3 -0
- package/dist/style/normalize.css +2 -0
- package/dist/style/parser/color.js +2 -2
- package/dist/style/parser/device.js +31 -19
- package/dist/style/variable.css +12 -0
- package/package.json +12 -4
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/* root */
|
|
2
|
+
.kit-card {
|
|
3
|
+
--card-color: var(--on, var(--kit-on-surface));
|
|
4
|
+
--card-background: var(--base, var(--kit-surface));
|
|
5
|
+
--card-radius: var(--shape, var(--kit-radius-md));
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.kit-card {
|
|
9
|
+
position: relative;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
text-align: start;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
/* transition:
|
|
15
|
+
color 0.5s,
|
|
16
|
+
background-color 0.5s; */
|
|
17
|
+
padding-top: var(--card-spacing-x);
|
|
18
|
+
padding-bottom: var(--card-spacing-x);
|
|
19
|
+
padding-right: var(--card-spacing-y);
|
|
20
|
+
padding-left: var(--card-spacing-y);
|
|
21
|
+
border-radius: var(--card-radius);
|
|
22
|
+
font-weight: 500;
|
|
23
|
+
color: var(--card-color);
|
|
24
|
+
text-decoration: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.kit-card.kit-card--clickable {
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
}
|
|
30
|
+
|
|
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;
|
|
40
|
+
}
|
|
41
|
+
.kit-card.kit-card--clickable:hover::after {
|
|
42
|
+
opacity: 0.08;
|
|
43
|
+
}
|
|
44
|
+
.kit-card.kit-card--clickable:active::after {
|
|
45
|
+
opacity: 0.12;
|
|
46
|
+
}
|
|
47
|
+
.kit-card.kit-card--clickable:focus-visible::after {
|
|
48
|
+
opacity: 0.12;
|
|
49
|
+
}
|
|
50
|
+
|
|
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);
|
|
55
|
+
}
|
|
56
|
+
.kit-card[breakpoint]kit-card--density-compact {
|
|
57
|
+
--card-spacing-x: 0;
|
|
58
|
+
--card-spacing-y: 0;
|
|
59
|
+
}
|
|
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);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* variant */
|
|
66
|
+
.kit-card[breakpoint]kit-card--variant-filled {
|
|
67
|
+
background-color: var(--card-background);
|
|
68
|
+
}
|
|
69
|
+
|
|
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;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.kit-card[breakpoint]kit-card--variant-text {
|
|
84
|
+
--card-color: var(--base, var(--kit-on-surface));
|
|
85
|
+
background-color: transparent;
|
|
86
|
+
border: none;
|
|
87
|
+
}
|
|
88
|
+
|
|
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));
|
|
93
|
+
}
|
|
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 {
|
|
100
|
+
background-color: color-mix(in oklab, currentColor 15%, transparent);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* disabled */
|
|
104
|
+
.kit-card.kit-card--disabled,
|
|
105
|
+
.kit-card[disabled],
|
|
106
|
+
.kit-card:disabled {
|
|
107
|
+
pointer-events: none;
|
|
108
|
+
user-select: none;
|
|
109
|
+
opacity: 0.6;
|
|
110
|
+
}
|
|
111
|
+
.kit-card.kit-card--disabled > *,
|
|
112
|
+
.kit-card[disabled] > *,
|
|
113
|
+
.kit-card:disabled > * {
|
|
114
|
+
opacity: 0.6;
|
|
115
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getAssets } from '../../internal/index.js';
|
|
3
|
+
import type { CardProps } from './types.js';
|
|
4
|
+
|
|
5
|
+
// external
|
|
6
|
+
import { ripple } from '../../internal/ripple.js';
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
children,
|
|
10
|
+
ref = $bindable(),
|
|
11
|
+
is = 'div',
|
|
12
|
+
href,
|
|
13
|
+
dark,
|
|
14
|
+
light,
|
|
15
|
+
active,
|
|
16
|
+
density = 'default',
|
|
17
|
+
variant = 'filled',
|
|
18
|
+
disabled,
|
|
19
|
+
rounded,
|
|
20
|
+
color,
|
|
21
|
+
background,
|
|
22
|
+
noRipple,
|
|
23
|
+
...rest
|
|
24
|
+
}: CardProps = $props();
|
|
25
|
+
|
|
26
|
+
const assets = getAssets();
|
|
27
|
+
let isClickable: boolean = $state(false);
|
|
28
|
+
|
|
29
|
+
$effect(() => {
|
|
30
|
+
const refProps = { ...rest };
|
|
31
|
+
if (href) is = 'a';
|
|
32
|
+
if (refProps?.onclick || href || is === 'a') isClickable = true;
|
|
33
|
+
else isClickable = false;
|
|
34
|
+
});
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<svelte:element
|
|
38
|
+
this={is}
|
|
39
|
+
bind:this={ref}
|
|
40
|
+
{...rest}
|
|
41
|
+
href={href && !disabled ? href : undefined}
|
|
42
|
+
class={[
|
|
43
|
+
'kit-card',
|
|
44
|
+
light && 'light',
|
|
45
|
+
dark && 'dark',
|
|
46
|
+
variant && assets.className('card', 'variant', variant),
|
|
47
|
+
density && assets.className('card', 'density', density),
|
|
48
|
+
isClickable && 'kit-card--clickable',
|
|
49
|
+
active && 'kit-card--active',
|
|
50
|
+
disabled && 'kit-card--disabled',
|
|
51
|
+
rest.class
|
|
52
|
+
]}
|
|
53
|
+
disabled={href ? undefined : disabled}
|
|
54
|
+
use:ripple={{
|
|
55
|
+
component: 'card',
|
|
56
|
+
disabled: noRipple || disabled || !isClickable
|
|
57
|
+
}}
|
|
58
|
+
style:--base={assets.color(background)}
|
|
59
|
+
style:--on={assets.color(color)}
|
|
60
|
+
style:--shape={assets.shape(rounded)}
|
|
61
|
+
>
|
|
62
|
+
{@render children?.()}
|
|
63
|
+
</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' | 'filled';
|
|
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,231 @@
|
|
|
1
|
+
/* root */
|
|
2
|
+
.kit-chip {
|
|
3
|
+
--chip-color: var(--on, var(--kit-on-container));
|
|
4
|
+
--chip-background: var(--base, var(--kit-container));
|
|
5
|
+
--chip-radius: var(--shape, var(--kit-radius-full));
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.kit-chip {
|
|
9
|
+
min-width: calc(var(--kit-spacing) * var(--chip-multiplier-x));
|
|
10
|
+
position: relative;
|
|
11
|
+
border: none;
|
|
12
|
+
outline: none;
|
|
13
|
+
padding-top: var(--chip-spacing-x);
|
|
14
|
+
padding-bottom: var(--chip-spacing-x);
|
|
15
|
+
padding-right: var(--chip-spacing-y);
|
|
16
|
+
padding-left: var(--chip-spacing-y);
|
|
17
|
+
border-radius: var(--chip-radius);
|
|
18
|
+
color: var(--chip-color);
|
|
19
|
+
font-weight: 500;
|
|
20
|
+
text-decoration: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.kit-chip:not(div):not(span) {
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.kit-chip,
|
|
28
|
+
.kit-chip .kit-chip-content,
|
|
29
|
+
.kit-chip .kit-chip-append,
|
|
30
|
+
.kit-chip .kit-chip-prepend,
|
|
31
|
+
.kit-chip .kit-chip--close,
|
|
32
|
+
.kit-chip .kit-chip-loading {
|
|
33
|
+
display: inline-flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
white-space: nowrap;
|
|
37
|
+
gap: calc(var(--kit-spacing) * var(--chip-multiplier-gap));
|
|
38
|
+
font-size: calc(var(--kit-spacing) * var(--chip-multiplier-font-size));
|
|
39
|
+
line-height: 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.kit-chip:not(div):not(span)::after {
|
|
43
|
+
content: '';
|
|
44
|
+
position: absolute;
|
|
45
|
+
inset: 0;
|
|
46
|
+
background-color: currentColor;
|
|
47
|
+
opacity: 0;
|
|
48
|
+
transition: opacity 150ms ease;
|
|
49
|
+
pointer-events: none;
|
|
50
|
+
border-radius: inherit;
|
|
51
|
+
}
|
|
52
|
+
.kit-chip:not(div):not(span):hover::after {
|
|
53
|
+
opacity: 0.08;
|
|
54
|
+
}
|
|
55
|
+
.kit-chip:not(div):not(span):active::after {
|
|
56
|
+
opacity: 0.12;
|
|
57
|
+
}
|
|
58
|
+
.kit-chip:not(div):not(span):focus-visible::after {
|
|
59
|
+
opacity: 0.12;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* size */
|
|
63
|
+
.kit-chip[breakpoint]kit-chip--size-xs {
|
|
64
|
+
--chip-multiplier-x: 12;
|
|
65
|
+
--chip-multiplier-y: 2;
|
|
66
|
+
--chip-multiplier-gap: 2;
|
|
67
|
+
--chip-multiplier-font-size: 6;
|
|
68
|
+
}
|
|
69
|
+
.kit-chip[breakpoint]kit-chip--size-xs .kit-icon[class*='kit-icon--size-md'] {
|
|
70
|
+
--icon-multiplier-parent-size: 7;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.kit-chip[breakpoint]kit-chip--size-sm {
|
|
74
|
+
--chip-multiplier-x: 14;
|
|
75
|
+
--chip-multiplier-y: 2;
|
|
76
|
+
--chip-multiplier-gap: 2;
|
|
77
|
+
--chip-multiplier-font-size: 6.5;
|
|
78
|
+
}
|
|
79
|
+
.kit-chip[breakpoint]kit-chip--size-sm .kit-icon[class*='kit-icon--size-md'] {
|
|
80
|
+
--icon-multiplier-parent-size: 8;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.kit-chip[breakpoint]kit-chip--size-md {
|
|
84
|
+
--chip-multiplier-x: 16;
|
|
85
|
+
--chip-multiplier-y: 3;
|
|
86
|
+
--chip-multiplier-gap: 4;
|
|
87
|
+
--chip-multiplier-font-size: 7;
|
|
88
|
+
}
|
|
89
|
+
.kit-chip[breakpoint]kit-chip--size-md .kit-icon[class*='kit-icon--size-md'] {
|
|
90
|
+
--icon-multiplier-parent-size: 9;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.kit-chip[breakpoint]kit-chip--size-lg {
|
|
94
|
+
--chip-multiplier-x: 18;
|
|
95
|
+
--chip-multiplier-y: 3;
|
|
96
|
+
--chip-multiplier-gap: 4;
|
|
97
|
+
--chip-multiplier-font-size: 8;
|
|
98
|
+
}
|
|
99
|
+
.kit-chip[breakpoint]kit-chip--size-lg .kit-icon[class*='kit-icon--size-md'] {
|
|
100
|
+
--icon-multiplier-parent-size: 10;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.kit-chip[breakpoint]kit-chip--size-xl {
|
|
104
|
+
--chip-multiplier-x: 20;
|
|
105
|
+
--chip-multiplier-y: 4;
|
|
106
|
+
--chip-multiplier-gap: 4;
|
|
107
|
+
--chip-multiplier-font-size: 9;
|
|
108
|
+
}
|
|
109
|
+
.kit-chip[breakpoint]kit-chip--size-xl .kit-icon[class*='kit-icon--size-md'] {
|
|
110
|
+
--icon-multiplier-parent-size: 11;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* variant */
|
|
114
|
+
.kit-chip[breakpoint]kit-chip--variant-filled {
|
|
115
|
+
background-color: var(--chip-background);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.kit-chip[breakpoint]kit-chip--variant-outline {
|
|
119
|
+
--chip-color: var(--on, var(--kit-on-container));
|
|
120
|
+
background-color: var(--chip-background);
|
|
121
|
+
}
|
|
122
|
+
.kit-chip[breakpoint]kit-chip--variant-outline::before {
|
|
123
|
+
content: '';
|
|
124
|
+
position: absolute;
|
|
125
|
+
inset: 0;
|
|
126
|
+
border: 1px solid currentColor;
|
|
127
|
+
pointer-events: none;
|
|
128
|
+
border-radius: inherit;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* density */
|
|
132
|
+
.kit-chip[breakpoint]kit-chip--density-default {
|
|
133
|
+
height: calc(var(--kit-spacing) * var(--chip-multiplier-x));
|
|
134
|
+
--chip-spacing-x: 0;
|
|
135
|
+
--chip-spacing-y: calc(var(--kit-spacing) * var(--chip-multiplier-y));
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.kit-chip[breakpoint]kit-chip--density-compact {
|
|
139
|
+
height: calc(var(--kit-spacing) * var(--chip-multiplier-x) - 0.25rem);
|
|
140
|
+
--chip-spacing-x: 0;
|
|
141
|
+
--chip-spacing-y: calc(var(--kit-spacing) * var(--chip-multiplier-y) - 0.25rem);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.kit-chip[breakpoint]kit-chip--density-comfortable {
|
|
145
|
+
height: calc(var(--kit-spacing) * var(--chip-multiplier-x) + 0.25rem);
|
|
146
|
+
--chip-spacing-x: 0;
|
|
147
|
+
--chip-spacing-y: calc(var(--kit-spacing) * var(--chip-multiplier-y) + 0.25rem);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* state */
|
|
151
|
+
.kit-chip.kit-chip--info[class*='chip--variant-filled'] {
|
|
152
|
+
--on: var(--kit-on-info);
|
|
153
|
+
--base: var(--kit-info);
|
|
154
|
+
}
|
|
155
|
+
.kit-chip.kit-chip--info[class*='chip--variant-']:not([class*='variant-filled']) {
|
|
156
|
+
--base: var(--kit-info);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.kit-chip.kit-chip--success[class*='chip--variant-filled'] {
|
|
160
|
+
--on: var(--kit-on-success);
|
|
161
|
+
--base: var(--kit-success);
|
|
162
|
+
}
|
|
163
|
+
.kit-chip.kit-chip--success[class*='chip--variant-']:not([class*='variant-filled']) {
|
|
164
|
+
--base: var(--kit-success);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.kit-chip.kit-chip--warning[class*='chip--variant-filled'] {
|
|
168
|
+
--on: var(--kit-on-warning);
|
|
169
|
+
--base: var(--kit-warning);
|
|
170
|
+
}
|
|
171
|
+
.kit-chip.kit-chip--warning[class*='chip--variant-']:not([class*='variant-filled']) {
|
|
172
|
+
--base: var(--kit-warning);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.kit-chip.kit-chip--error[class*='chip--variant-filled'] {
|
|
176
|
+
--on: var(--kit-on-error);
|
|
177
|
+
--base: var(--kit-error);
|
|
178
|
+
}
|
|
179
|
+
.kit-chip.kit-chip--error[class*='chip--variant-']:not([class*='variant-filled']) {
|
|
180
|
+
--base: var(--kit-error);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/* events */
|
|
184
|
+
.kit-chip[class*='chip--variant-filled']:active,
|
|
185
|
+
.kit-chip.kit-chip--active[class*='chip--variant-filled'] {
|
|
186
|
+
background-color: color-mix(in oklab, var(--chip-background) 90%, var(--kit-scrim));
|
|
187
|
+
}
|
|
188
|
+
.kit-chip.kit-chip--active[class*='chip--variant-']:not([class*='variant-filled']):active,
|
|
189
|
+
.kit-chip.kit-chip--active[class*='chip--variant-']:not([class*='variant-filled']) {
|
|
190
|
+
background-color: color-mix(in oklab, currentColor 15%, transparent);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/* disabled */
|
|
194
|
+
.kit-chip.kit-chip--disabled,
|
|
195
|
+
.kit-chip[disabled],
|
|
196
|
+
.kit-chip.kit-chip--loading {
|
|
197
|
+
pointer-events: none;
|
|
198
|
+
user-select: none;
|
|
199
|
+
cursor: default;
|
|
200
|
+
}
|
|
201
|
+
.kit-chip[class*='chip--variant-filled'].kit-chip--disabled {
|
|
202
|
+
color: color-mix(in oklab, var(--chip-color) 40%, transparent) !important;
|
|
203
|
+
background-color: color-mix(in oklab, var(--chip-background) 70%, transparent) !important;
|
|
204
|
+
}
|
|
205
|
+
.kit-chip[class*='chip--variant-filled'].kit-chip--disabled i:before {
|
|
206
|
+
color: color-mix(in oklab, var(--chip-color) 40%, transparent) !important;
|
|
207
|
+
}
|
|
208
|
+
.kit-chip[class*='chip--variant-']:not([class*='variant-filled']).kit-chip--disabled,
|
|
209
|
+
.kit-chip[class*='chip--variant-']:not([class*='variant-filled']).kit-chip--disabled i::before {
|
|
210
|
+
color: color-mix(in oklab, var(--chip-background) 40%, transparent) !important;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/* icon */
|
|
214
|
+
.kit-chip i::before,
|
|
215
|
+
.kit-chip .kit-icon {
|
|
216
|
+
--base-parent: var(--chip-color);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/* loading */
|
|
220
|
+
.kit-chip.kit-chip--loading > .kit-chip-content,
|
|
221
|
+
.kit-chip.kit-chip--loading > .kit-chip-append,
|
|
222
|
+
.kit-chip.kit-chip--loading > .kit-chip-prepend {
|
|
223
|
+
visibility: hidden;
|
|
224
|
+
}
|
|
225
|
+
.kit-chip.kit-chip--loading > .kit-chip-loading {
|
|
226
|
+
position: absolute;
|
|
227
|
+
min-width: fit-content;
|
|
228
|
+
}
|
|
229
|
+
.kit-chip.kit-chip--loading > .kit-chip-loading .kit-icon-load {
|
|
230
|
+
animation: icon-rotate 1s ease-out infinite;
|
|
231
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
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
|
+
import { ripple } from '../../internal/ripple.js';
|
|
10
|
+
|
|
11
|
+
let {
|
|
12
|
+
children,
|
|
13
|
+
load,
|
|
14
|
+
close,
|
|
15
|
+
append,
|
|
16
|
+
prepend,
|
|
17
|
+
ref = $bindable(),
|
|
18
|
+
open = $bindable(true),
|
|
19
|
+
is = 'div',
|
|
20
|
+
href,
|
|
21
|
+
dark,
|
|
22
|
+
light,
|
|
23
|
+
active,
|
|
24
|
+
variant = 'filled',
|
|
25
|
+
error,
|
|
26
|
+
info,
|
|
27
|
+
success,
|
|
28
|
+
warning,
|
|
29
|
+
density = 'default',
|
|
30
|
+
disabled,
|
|
31
|
+
size = 'md',
|
|
32
|
+
type,
|
|
33
|
+
background,
|
|
34
|
+
color,
|
|
35
|
+
label,
|
|
36
|
+
loading,
|
|
37
|
+
rounded,
|
|
38
|
+
closable,
|
|
39
|
+
noRipple,
|
|
40
|
+
...rest
|
|
41
|
+
}: ChipProps = $props();
|
|
42
|
+
|
|
43
|
+
const assets = getAssets();
|
|
44
|
+
|
|
45
|
+
$effect(() => {
|
|
46
|
+
const refProps = { ...rest };
|
|
47
|
+
if (refProps?.onclick) is = 'button';
|
|
48
|
+
});
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
{#if !closable || (open && closable)}
|
|
52
|
+
<svelte:element
|
|
53
|
+
this={href ? 'a' : is}
|
|
54
|
+
bind:this={ref}
|
|
55
|
+
{...rest}
|
|
56
|
+
href={href && !disabled ? href : undefined}
|
|
57
|
+
class={[
|
|
58
|
+
'kit-chip',
|
|
59
|
+
light && 'light',
|
|
60
|
+
dark && 'dark',
|
|
61
|
+
size && assets.className('chip', 'size', size),
|
|
62
|
+
variant && assets.className('chip', 'variant', variant),
|
|
63
|
+
density && assets.className('chip', 'density', density),
|
|
64
|
+
error && 'kit-chip--error',
|
|
65
|
+
info && 'kit-chip--info',
|
|
66
|
+
success && 'kit-chip--success',
|
|
67
|
+
warning && 'kit-chip--warning',
|
|
68
|
+
disabled && 'kit-chip--disabled',
|
|
69
|
+
active && 'kit-chip--active',
|
|
70
|
+
loading && 'kit-chip--loading',
|
|
71
|
+
rest.class
|
|
72
|
+
]}
|
|
73
|
+
tabindex={href && disabled ? -1 : 0}
|
|
74
|
+
aria-disabled={href ? disabled : undefined}
|
|
75
|
+
aria-label={type !== 'button' ? label : undefined}
|
|
76
|
+
disabled={href ? undefined : disabled}
|
|
77
|
+
type={href ? undefined : type}
|
|
78
|
+
use:ripple={{
|
|
79
|
+
component: 'chip',
|
|
80
|
+
disabled: noRipple || disabled || is === 'div' || is === 'span'
|
|
81
|
+
}}
|
|
82
|
+
style:--base={assets.color(background)}
|
|
83
|
+
style:--on={assets.color(color)}
|
|
84
|
+
style:--shape={assets.shape(rounded)}
|
|
85
|
+
>
|
|
86
|
+
{#if loading}
|
|
87
|
+
<div class="kit-chip-loading">
|
|
88
|
+
{#if load}
|
|
89
|
+
{@render load?.()}
|
|
90
|
+
{:else}
|
|
91
|
+
<Icon class="kit-icon-load">
|
|
92
|
+
<LoadingFill />
|
|
93
|
+
</Icon>
|
|
94
|
+
{/if}
|
|
95
|
+
</div>
|
|
96
|
+
{/if}
|
|
97
|
+
|
|
98
|
+
{#if prepend}
|
|
99
|
+
<div class="kit-chip-prepend">
|
|
100
|
+
{@render prepend?.()}
|
|
101
|
+
</div>
|
|
102
|
+
{/if}
|
|
103
|
+
<div class="kit-chip-content">
|
|
104
|
+
{@render children?.()}
|
|
105
|
+
</div>
|
|
106
|
+
{#if append}
|
|
107
|
+
<div class="kit-chip-append">
|
|
108
|
+
{@render append?.()}
|
|
109
|
+
</div>
|
|
110
|
+
{/if}
|
|
111
|
+
|
|
112
|
+
{#if closable}
|
|
113
|
+
<button
|
|
114
|
+
class="kit-chip--close"
|
|
115
|
+
type="button"
|
|
116
|
+
aria-label="close"
|
|
117
|
+
onclick={() => (open = false)}
|
|
118
|
+
>
|
|
119
|
+
{#if close}
|
|
120
|
+
{@render close?.()}
|
|
121
|
+
{:else}
|
|
122
|
+
<Icon>
|
|
123
|
+
<Close />
|
|
124
|
+
</Icon>
|
|
125
|
+
{/if}
|
|
126
|
+
</button>
|
|
127
|
+
{/if}
|
|
128
|
+
</svelte:element>
|
|
129
|
+
{/if}
|
|
@@ -0,0 +1,31 @@
|
|
|
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' | 'filled';
|
|
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
|
+
noRipple?: boolean;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|