lapikit 0.1.5 → 0.1.7
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/aspect-ratio/aspect-ratio.css +19 -0
- package/dist/components/aspect-ratio/aspect-ratio.svelte +25 -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/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/index.d.ts +10 -0
- package/dist/components/index.js +10 -0
- 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/toolbar/toolbar.css +142 -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/package.json +4 -1
|
@@ -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 {};
|
|
@@ -7,3 +7,13 @@ export { default as Tooltip } from './tooltip/tooltip.svelte';
|
|
|
7
7
|
export { default as Dialog } from './dialog/dialog.svelte';
|
|
8
8
|
export { default as Separator } from './separator/separator.svelte';
|
|
9
9
|
export { default as Modal } from './modal/modal.svelte';
|
|
10
|
+
export { default as List } from './list/list.svelte';
|
|
11
|
+
export { default as ListItem } from './list/modules/list-item.svelte';
|
|
12
|
+
export { default as Avatar } from './avatar/avatar.svelte';
|
|
13
|
+
export { default as Accordion } from './accordion/accordion.svelte';
|
|
14
|
+
export { default as AccordionItem } from './accordion/modules/accordion-item.svelte';
|
|
15
|
+
export { default as AspectRatio } from './aspect-ratio/aspect-ratio.svelte';
|
|
16
|
+
export { default as Alert } from './alert/alert.svelte';
|
|
17
|
+
export { default as Chip } from './chip/chip.svelte';
|
|
18
|
+
export { default as Card } from './card/card.svelte';
|
|
19
|
+
export { default as Toolbar } from './toolbar/toolbar.svelte';
|
package/dist/components/index.js
CHANGED
|
@@ -8,3 +8,13 @@ export { default as Tooltip } from './tooltip/tooltip.svelte';
|
|
|
8
8
|
export { default as Dialog } from './dialog/dialog.svelte';
|
|
9
9
|
export { default as Separator } from './separator/separator.svelte';
|
|
10
10
|
export { default as Modal } from './modal/modal.svelte';
|
|
11
|
+
export { default as List } from './list/list.svelte';
|
|
12
|
+
export { default as ListItem } from './list/modules/list-item.svelte';
|
|
13
|
+
export { default as Avatar } from './avatar/avatar.svelte';
|
|
14
|
+
export { default as Accordion } from './accordion/accordion.svelte';
|
|
15
|
+
export { default as AccordionItem } from './accordion/modules/accordion-item.svelte';
|
|
16
|
+
export { default as AspectRatio } from './aspect-ratio/aspect-ratio.svelte';
|
|
17
|
+
export { default as Alert } from './alert/alert.svelte';
|
|
18
|
+
export { default as Chip } from './chip/chip.svelte';
|
|
19
|
+
export { default as Card } from './card/card.svelte';
|
|
20
|
+
export { default as Toolbar } from './toolbar/toolbar.svelte';
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
.kit-list {
|
|
2
|
+
--list-color: var(--on, var(--kit-on-neutral));
|
|
3
|
+
--list-background: var(--base, var(--kit-neutral));
|
|
4
|
+
--list-radius: var(--shape, var(--kit-radius-md));
|
|
5
|
+
|
|
6
|
+
display: flex;
|
|
7
|
+
width: 100%;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.kit-list.kit-list--nav {
|
|
11
|
+
padding-top: 8px;
|
|
12
|
+
padding-bottom: 8px;
|
|
13
|
+
padding-inline: 8px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* orientation */
|
|
17
|
+
.kit-list[breakpoint]kit-list--orientation-vertical {
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
}
|
|
20
|
+
.kit-list[breakpoint]kit-list--orientation-horizontal {
|
|
21
|
+
flex-direction: row;
|
|
22
|
+
}
|
|
23
|
+
.kit-list[breakpoint]kit-list--orientation-horizontal .kit-list-item {
|
|
24
|
+
justify-content: center;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* size */
|
|
28
|
+
.kit-list[breakpoint]kit-list--size-xs {
|
|
29
|
+
--list-height: 1.75rem;
|
|
30
|
+
--list-multiplier-y: 2;
|
|
31
|
+
--list-gap: 0.25rem;
|
|
32
|
+
font-size: 0.75rem;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.kit-list[breakpoint]kit-list--size-sm {
|
|
36
|
+
--list-height: 2rem;
|
|
37
|
+
--list-multiplier-y: 3;
|
|
38
|
+
--list-gap: 0.5rem;
|
|
39
|
+
font-size: 0.875rem;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.kit-list[breakpoint]kit-list--size-md {
|
|
43
|
+
--list-height: 2.25rem;
|
|
44
|
+
--list-multiplier-y: 4;
|
|
45
|
+
--list-gap: 0.5rem;
|
|
46
|
+
font-size: 0.875rem;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.kit-list[breakpoint]kit-list--size-lg {
|
|
50
|
+
--list-height: 2.5rem;
|
|
51
|
+
--list-multiplier-y: 5;
|
|
52
|
+
--list-gap: 0.5rem;
|
|
53
|
+
font-size: 1rem;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.kit-list[breakpoint]kit-list--size-xl {
|
|
57
|
+
--list-height: 2.75rem;
|
|
58
|
+
--list-multiplier-y: 6;
|
|
59
|
+
--list-gap: 0.675rem;
|
|
60
|
+
font-size: 1.125rem;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* density */
|
|
64
|
+
.kit-list[breakpoint]kit-list--density-default .kit-list-item {
|
|
65
|
+
height: calc(var(--list-height));
|
|
66
|
+
min-width: calc(var(--list-height));
|
|
67
|
+
--list-spacing-x: 0;
|
|
68
|
+
--list-spacing-y: calc(var(--kit-spacing) * var(--list-multiplier-y));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.kit-list[breakpoint]kit-list--density-compact .kit-list-item {
|
|
72
|
+
height: calc(var(--list-height) - 0.25rem);
|
|
73
|
+
min-width: calc(var(--list-height - 0.25rem));
|
|
74
|
+
--list-spacing-x: 0;
|
|
75
|
+
--list-spacing-y: calc(var(--list-spacing) * var(--list-multiplier-y) - 0.25rem);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.kit-list[breakpoint]kit-list--density-comfortable .kit-list-item {
|
|
79
|
+
height: calc(var(--list-height) + 0.25rem);
|
|
80
|
+
min-width: calc(var(--list-height + 0.25rem));
|
|
81
|
+
--list-spacing-x: 0;
|
|
82
|
+
--list-spacing-y: calc(var(--kit-spacing) * var(--list-multiplier-y) + 0.25rem);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* variant */
|
|
86
|
+
.kit-list[breakpoint]kit-list--variant-outline .kit-list-item {
|
|
87
|
+
--list-item-color: var(--base, var(--list-background, var(--kit-neutral)));
|
|
88
|
+
background-color: transparent;
|
|
89
|
+
border: 1px solid currentColor;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.kit-list[breakpoint]kit-list--variant-text .kit-list-item {
|
|
93
|
+
--list-item-color: var(--base, var(--list-background, var(--kit-neutral)));
|
|
94
|
+
background-color: transparent;
|
|
95
|
+
border-color: transparent;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.kit-list[breakpoint]kit-list--variant-dash .kit-list-item {
|
|
99
|
+
--list-item-color: var(--base, var(--list-background, var(--kit-neutral)));
|
|
100
|
+
background-color: transparent;
|
|
101
|
+
border: 1px dashed currentColor;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.kit-list[breakpoint]kit-list--variant-link .kit-list-item {
|
|
105
|
+
--list-item-color: var(--base, var(--list-background, var(--kit-neutral)));
|
|
106
|
+
background-color: transparent;
|
|
107
|
+
border-color: transparent;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* events */
|
|
111
|
+
.kit-list:not([class*='list--variant-']) .kit-list-item.kit-list-item--active {
|
|
112
|
+
background-color: color-mix(in oklab, var(--list-item-background) 90%, var(--kit-scrim));
|
|
113
|
+
border-color: color-mix(in oklab, var(--list-item-background) 90%, var(--kit-scrim));
|
|
114
|
+
}
|
|
115
|
+
.kit-list[class*='list--variant-'] .kit-list-item.kit-list-item--active {
|
|
116
|
+
background-color: color-mix(in oklab, currentColor 15%, transparent);
|
|
117
|
+
border-color: color-mix(in oklab, currentColor 15%, transparent);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.kit-list:not([class*='list--variant-']) .kit-list-item:not(div):hover {
|
|
121
|
+
background-color: color-mix(in oklab, var(--list-item-background) 85%, var(--kit-scrim));
|
|
122
|
+
border-color: color-mix(in oklab, var(--list-item-background) 85%, var(--kit-scrim));
|
|
123
|
+
}
|
|
124
|
+
.kit-list[class*='list--variant-'] .kit-list-item:not(div):hover {
|
|
125
|
+
background-color: color-mix(in oklab, currentColor 25%, transparent);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* disabled */
|
|
129
|
+
.kit-list .kit-list-item.kit-list-item--disabled,
|
|
130
|
+
.kit-list .kit-list-item[disabled],
|
|
131
|
+
.kit-list.kit-list--disabled .kit-list-item {
|
|
132
|
+
pointer-events: none;
|
|
133
|
+
user-select: none;
|
|
134
|
+
cursor: default;
|
|
135
|
+
}
|
|
136
|
+
.kit-list:not([class*='list--variant-']) .kit-list-item.kit-list-item--disabled {
|
|
137
|
+
color: color-mix(in oklab, var(--list-item-color) 40%, transparent) !important;
|
|
138
|
+
background-color: color-mix(in oklab, var(--list-item-background) 70%, transparent) !important;
|
|
139
|
+
border-color: color-mix(in oklab, var(--list-item-background) 70%, transparent) !important;
|
|
140
|
+
}
|
|
141
|
+
.kit-list:not([class*='list--variant-']) .kit-list-item.kit-list-item--disabled i:before {
|
|
142
|
+
color: color-mix(in oklab, var(--list-item-color) 40%, transparent) !important;
|
|
143
|
+
}
|
|
144
|
+
.kit-list[class*='list--variant-'] .kit-list-item.kit-list-item--disabled,
|
|
145
|
+
.kit-list[class*='list--variant-'] .kit-list-item.kit-list-item--disabled i:before {
|
|
146
|
+
color: color-mix(in oklab, var(--list-item-background) 40%, transparent) !important;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* list item */
|
|
150
|
+
.kit-list .kit-list-item {
|
|
151
|
+
--list-item-color: var(--on, var(--list-color, var(--kit-on-neutral)));
|
|
152
|
+
--list-item-background: var(--base, var(--list-background, var(--kit-neutral)));
|
|
153
|
+
--list-item-radius: var(--shape, var(--list-radius, var(--kit-radius-md)));
|
|
154
|
+
|
|
155
|
+
display: inline-flex;
|
|
156
|
+
padding-top: var(--list-spacing-x);
|
|
157
|
+
padding-bottom: var(--list-spacing-x);
|
|
158
|
+
padding-right: var(--list-spacing-y);
|
|
159
|
+
padding-left: var(--list-spacing-y);
|
|
160
|
+
align-items: center;
|
|
161
|
+
white-space: nowrap;
|
|
162
|
+
gap: var(--list-gap);
|
|
163
|
+
|
|
164
|
+
border-width: 1px;
|
|
165
|
+
border-style: solid;
|
|
166
|
+
border-radius: var(--list-item-radius);
|
|
167
|
+
|
|
168
|
+
/* theme */
|
|
169
|
+
color: var(--list-item-color);
|
|
170
|
+
background-color: var(--list-item-background);
|
|
171
|
+
border-color: var(--list-item-background);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.kit-list .kit-list-item:not(div) {
|
|
175
|
+
cursor: pointer;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.kit-list .kit-list-item > .kit-list-item-content {
|
|
179
|
+
display: flex;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.kit-list .kit-list-item.kit-list-item--append:not(.kit-list-item--prepend) {
|
|
183
|
+
display: grid;
|
|
184
|
+
grid-template-columns: auto 1fr;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.kit-list .kit-list-item.kit-list-item--prepend:not(.kit-list-item--append) {
|
|
188
|
+
display: grid;
|
|
189
|
+
grid-template-columns: 1fr auto;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.kit-list .kit-list-item.kit-list-item--prepend.kit-list-item--append {
|
|
193
|
+
display: grid;
|
|
194
|
+
grid-template-columns: auto 1fr auto;
|
|
195
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getAssets } from '../../internal/index.js';
|
|
3
|
+
import type { ListProps } from './types.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
children,
|
|
7
|
+
ref = $bindable(),
|
|
8
|
+
is = 'div',
|
|
9
|
+
dark,
|
|
10
|
+
light,
|
|
11
|
+
orientation = 'vertical',
|
|
12
|
+
background,
|
|
13
|
+
color,
|
|
14
|
+
rounded,
|
|
15
|
+
size = 'md',
|
|
16
|
+
density = 'default',
|
|
17
|
+
variant,
|
|
18
|
+
nav,
|
|
19
|
+
...rest
|
|
20
|
+
}: ListProps = $props();
|
|
21
|
+
|
|
22
|
+
const assets = getAssets();
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<svelte:element
|
|
26
|
+
this={is}
|
|
27
|
+
bind:this={ref}
|
|
28
|
+
{...rest}
|
|
29
|
+
class={[
|
|
30
|
+
'kit-list',
|
|
31
|
+
light && 'light',
|
|
32
|
+
dark && 'dark',
|
|
33
|
+
orientation && assets.className('list', 'orientation', orientation),
|
|
34
|
+
size && assets.className('list', 'size', size),
|
|
35
|
+
variant && assets.className('list', 'variant', variant),
|
|
36
|
+
density && assets.className('list', 'density', density),
|
|
37
|
+
nav && 'kit-list--nav',
|
|
38
|
+
rest.class
|
|
39
|
+
]}
|
|
40
|
+
role="listbox"
|
|
41
|
+
style:--base={assets.color(background)}
|
|
42
|
+
style:--on={assets.color(color)}
|
|
43
|
+
style:--shape={assets.shape(rounded)}
|
|
44
|
+
>
|
|
45
|
+
{@render children?.()}
|
|
46
|
+
</svelte:element>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getAssets } from '../../../internal/index.js';
|
|
3
|
+
import type { ListItemProps } from '../types.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
children,
|
|
7
|
+
append,
|
|
8
|
+
prepend,
|
|
9
|
+
ref = $bindable(),
|
|
10
|
+
is = 'div',
|
|
11
|
+
dark,
|
|
12
|
+
light,
|
|
13
|
+
background,
|
|
14
|
+
color,
|
|
15
|
+
rounded,
|
|
16
|
+
disabled,
|
|
17
|
+
active,
|
|
18
|
+
href,
|
|
19
|
+
...rest
|
|
20
|
+
}: ListItemProps = $props();
|
|
21
|
+
|
|
22
|
+
const assets = getAssets();
|
|
23
|
+
|
|
24
|
+
$effect(() => {
|
|
25
|
+
const refProps = { ...rest };
|
|
26
|
+
if (refProps?.onclick) is = 'button';
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<svelte:element
|
|
31
|
+
this={href ? 'a' : is}
|
|
32
|
+
bind:this={ref}
|
|
33
|
+
{...rest}
|
|
34
|
+
href={href && !disabled ? href : undefined}
|
|
35
|
+
class={[
|
|
36
|
+
'kit-list-item',
|
|
37
|
+
light && 'light',
|
|
38
|
+
dark && 'dark',
|
|
39
|
+
append && 'kit-list-item--append',
|
|
40
|
+
prepend && 'kit-list-item--prepend',
|
|
41
|
+
active && 'kit-list-item--active',
|
|
42
|
+
disabled && 'kit-list-item--disabled',
|
|
43
|
+
rest.class
|
|
44
|
+
]}
|
|
45
|
+
role={is === 'button' ? 'listitem' : undefined}
|
|
46
|
+
tabindex={href && disabled ? -2 : 0}
|
|
47
|
+
aria-disabled={href ? disabled : undefined}
|
|
48
|
+
disabled={href ? undefined : disabled}
|
|
49
|
+
style:--base={assets.color(background)}
|
|
50
|
+
style:--on={assets.color(color)}
|
|
51
|
+
style:--shape={assets.shape(rounded)}
|
|
52
|
+
>
|
|
53
|
+
{#if append}
|
|
54
|
+
<div class="kit-list-item-content--append">
|
|
55
|
+
{@render append?.()}
|
|
56
|
+
</div>
|
|
57
|
+
{/if}
|
|
58
|
+
|
|
59
|
+
<div class="kit-list-item-content">
|
|
60
|
+
{@render children?.()}
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
{#if prepend}
|
|
64
|
+
<div class="kit-list-item-content--prepend">
|
|
65
|
+
{@render prepend?.()}
|
|
66
|
+
</div>
|
|
67
|
+
{/if}
|
|
68
|
+
</svelte:element>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Component } from '../../internal/types.js';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
type ListOrientation = 'vertical' | 'horizontal';
|
|
4
|
+
type ListSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
5
|
+
type ListDensity = 'compact' | 'comfortable' | 'default';
|
|
6
|
+
export interface ListProps extends Component {
|
|
7
|
+
ref?: HTMLElement | null;
|
|
8
|
+
is?: 'div' | 'nav';
|
|
9
|
+
dark?: boolean;
|
|
10
|
+
light?: boolean;
|
|
11
|
+
size?: ListSize | {
|
|
12
|
+
[key: string]: ListSize;
|
|
13
|
+
};
|
|
14
|
+
variant?: 'outline' | 'text' | 'dash' | 'link';
|
|
15
|
+
density?: ListDensity | {
|
|
16
|
+
[key: string]: ListDensity;
|
|
17
|
+
};
|
|
18
|
+
nav?: boolean;
|
|
19
|
+
orientation?: ListOrientation | {
|
|
20
|
+
[key: string]: ListOrientation;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface ListItemProps extends Component {
|
|
24
|
+
ref?: HTMLElement | null;
|
|
25
|
+
is?: 'div' | 'a' | 'button';
|
|
26
|
+
href?: string;
|
|
27
|
+
dark?: boolean;
|
|
28
|
+
light?: boolean;
|
|
29
|
+
append?: Snippet;
|
|
30
|
+
prepend?: Snippet;
|
|
31
|
+
color?: string;
|
|
32
|
+
background?: string;
|
|
33
|
+
active?: boolean;
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
.kit-toolbar {
|
|
2
|
+
--toolbar-color: var(--on, var(--kit-on-neutral));
|
|
3
|
+
--toolbar-background: var(--base, var(--kit-neutral));
|
|
4
|
+
--toolbar-radius: var(--shape, var(--kit-radius-md));
|
|
5
|
+
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
min-width: max-content;
|
|
9
|
+
border-style: solid;
|
|
10
|
+
transition:
|
|
11
|
+
color 0.5s,
|
|
12
|
+
border-color 0.5s,
|
|
13
|
+
background-color 0.5s;
|
|
14
|
+
|
|
15
|
+
border-width: 1px;
|
|
16
|
+
border-style: solid;
|
|
17
|
+
border-radius: var(--toolbar-radius);
|
|
18
|
+
|
|
19
|
+
/* theme */
|
|
20
|
+
color: var(--toolbar-color);
|
|
21
|
+
background-color: var(--toolbar-background);
|
|
22
|
+
border-color: var(--toolbar-background);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* density */
|
|
26
|
+
.kit-card[breakpoint]kit-card--density-default {
|
|
27
|
+
--card-spacing-x: 0.25rem;
|
|
28
|
+
--card-spacing-y: 0.25rem;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.kit-card[breakpoint]kit-card--density-compact {
|
|
32
|
+
--card-spacing-x: 0;
|
|
33
|
+
--card-spacing-y: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.kit-card[breakpoint]kit-card--density-comfortable {
|
|
37
|
+
--card-spacing-x: 0.5rem;
|
|
38
|
+
--card-spacing-y: 0.5rem;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* density */
|
|
42
|
+
.kit-toolbar[breakpoint]kit-toolbar--density-default {
|
|
43
|
+
border-radius: calc(var(--kit-spacing) * 2.25);
|
|
44
|
+
}
|
|
45
|
+
.kit-toolbar[breakpoint]kit-toolbar--density-default:not([class*='toolbar--orientation-vertical']) {
|
|
46
|
+
height: 3rem;
|
|
47
|
+
padding-inline: calc(var(--kit-spacing) * 1.5);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.kit-toolbar[breakpoint]kit-toolbar--density-default[class*='toolbar--orientation-vertical'] {
|
|
51
|
+
width: 3rem;
|
|
52
|
+
padding: calc(var(--kit-spacing) * 1.5) 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.kit-toolbar[breakpoint]kit-toolbar--density-compact {
|
|
56
|
+
border-radius: calc(var(--kit-spacing) * 1.75);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.kit-toolbar[breakpoint]kit-toolbar--density-compact:not([class*='toolbar--orientation-vertical']) {
|
|
60
|
+
height: 2.625rem;
|
|
61
|
+
padding-inline: calc(var(--kit-spacing) * 0.75);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.kit-toolbar[breakpoint]kit-toolbar--density-compact[class*='toolbar--orientation-vertical'] {
|
|
65
|
+
width: 2.625rem;
|
|
66
|
+
padding: calc(var(--kit-spacing) * 0.75) 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.kit-toolbar[breakpoint]kit-toolbar--density-comfortable {
|
|
70
|
+
border-radius: calc(var(--kit-spacing) * 3.5);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.kit-toolbar[breakpoint]kit-toolbar--density-comfortable:not(
|
|
74
|
+
[class*='toolbar--orientation-vertical']
|
|
75
|
+
) {
|
|
76
|
+
height: 3.5rem;
|
|
77
|
+
padding-inline: calc(var(--kit-spacing) * 2.25);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.kit-toolbar[breakpoint]kit-toolbar--density-comfortable[class*='toolbar--orientation-vertical'] {
|
|
81
|
+
width: 3.5rem;
|
|
82
|
+
padding: calc(var(--kit-spacing) * 2.25) 0;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.kit-toolbar[breakpoint]kit-toolbar--variant-text,
|
|
86
|
+
.kit-toolbar[breakpoint]kit-toolbar--variant-outline,
|
|
87
|
+
.kit-toolbar[breakpoint]kit-toolbar--variant-dash {
|
|
88
|
+
--toolbar-color: var(--base, var(--kit-neutral));
|
|
89
|
+
background-color: transparent;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.kit-toolbar[breakpoint]kit-toolbar--variant-outline {
|
|
93
|
+
border-color: currentColor;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.kit-toolbar[breakpoint]kit-toolbar--variant-dash {
|
|
97
|
+
border-style: dashed;
|
|
98
|
+
border-color: currentColor;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.kit-toolbar[breakpoint]kit-toolbar--orientation-horizontal {
|
|
102
|
+
flex-direction: row;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.kit-toolbar[breakpoint]kit-toolbar--orientation-vertical {
|
|
106
|
+
flex-direction: column;
|
|
107
|
+
min-height: fit-content;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* wrapper */
|
|
111
|
+
.kit-toolbar .kit-toolbar--wrapper {
|
|
112
|
+
display: flex;
|
|
113
|
+
align-items: center;
|
|
114
|
+
margin-left: auto;
|
|
115
|
+
margin-right: auto;
|
|
116
|
+
flex-direction: row;
|
|
117
|
+
height: auto;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.kit-toolbar[breakpoint]kit-toolbar--orientation-vertical .kit-toolbar--wrapper {
|
|
121
|
+
flex-direction: column;
|
|
122
|
+
height: 100%;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* location */
|
|
126
|
+
.kit-toolbar[breakpoint]kit-toolbar--location-top {
|
|
127
|
+
top: 0px;
|
|
128
|
+
z-index: 1004;
|
|
129
|
+
transform: translateY(0px);
|
|
130
|
+
position: fixed;
|
|
131
|
+
left: 0px;
|
|
132
|
+
width: calc(100% + 0px);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.kit-toolbar[breakpoint]kit-toolbar--location-bottom {
|
|
136
|
+
z-index: 1004;
|
|
137
|
+
transform: translateY(0px);
|
|
138
|
+
position: fixed;
|
|
139
|
+
left: 0px;
|
|
140
|
+
width: calc(100% + 0px);
|
|
141
|
+
bottom: 0px;
|
|
142
|
+
}
|