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,140 @@
|
|
|
1
|
+
.kit-modal {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 100%;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.kit-modal-container {
|
|
7
|
+
--modal-color: var(--on, var(--kit-on-neutral));
|
|
8
|
+
--modal-background: var(--base, var(--kit-neutral));
|
|
9
|
+
--modal-radius: var(--shape, var(--kit-radius-md));
|
|
10
|
+
--modal-translate-x: -50%;
|
|
11
|
+
--modal-translate-y: -50%;
|
|
12
|
+
|
|
13
|
+
position: fixed;
|
|
14
|
+
overflow-y: auto;
|
|
15
|
+
z-index: 9100;
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
padding-top: var(--modal-spacing-x);
|
|
19
|
+
padding-bottom: var(--modal-spacing-x);
|
|
20
|
+
padding-right: var(--modal-spacing-y);
|
|
21
|
+
padding-left: var(--modal-spacing-y);
|
|
22
|
+
|
|
23
|
+
/* theme */
|
|
24
|
+
color: var(--modal-color);
|
|
25
|
+
background-color: var(--modal-background);
|
|
26
|
+
border-color: var(--modal-background);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.kit-modal.kit-modal--contain {
|
|
30
|
+
position: absolute;
|
|
31
|
+
top: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.kit-modal.kit-modal--contain .kit-overlay {
|
|
35
|
+
position: absolute;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.kit-modal.kit-modal--contain .kit-modal-container {
|
|
39
|
+
position: absolute;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* size */
|
|
43
|
+
.kit-modal [breakpoint]kit-modal-container--size-xs {
|
|
44
|
+
max-width: var(--kit-modal-size-xs);
|
|
45
|
+
max-height: calc(100% - 3rem);
|
|
46
|
+
height: fit-content;
|
|
47
|
+
margin: 0 auto;
|
|
48
|
+
top: 50%;
|
|
49
|
+
left: 50%;
|
|
50
|
+
bottom: initial;
|
|
51
|
+
translate: var(--modal-translate-x) var(--modal-translate-y);
|
|
52
|
+
border-radius: var(--modal-radius);
|
|
53
|
+
}
|
|
54
|
+
.kit-modal [breakpoint]kit-modal-container--size-sm {
|
|
55
|
+
max-width: var(--kit-modal-size-sm);
|
|
56
|
+
max-height: calc(100% - 3rem);
|
|
57
|
+
height: fit-content;
|
|
58
|
+
margin: 0 auto;
|
|
59
|
+
top: 50%;
|
|
60
|
+
left: 50%;
|
|
61
|
+
bottom: initial;
|
|
62
|
+
translate: var(--modal-translate-x) var(--modal-translate-y);
|
|
63
|
+
border-radius: var(--modal-radius);
|
|
64
|
+
}
|
|
65
|
+
.kit-modal [breakpoint]kit-modal-container--size-md {
|
|
66
|
+
max-width: var(--kit-modal-size-md);
|
|
67
|
+
max-height: calc(100% - 3rem);
|
|
68
|
+
height: fit-content;
|
|
69
|
+
margin: 0 auto;
|
|
70
|
+
top: 50%;
|
|
71
|
+
left: 50%;
|
|
72
|
+
bottom: initial;
|
|
73
|
+
translate: var(--modal-translate-x) var(--modal-translate-y);
|
|
74
|
+
border-radius: var(--modal-radius);
|
|
75
|
+
}
|
|
76
|
+
.kit-modal [breakpoint]kit-modal-container--size-lg {
|
|
77
|
+
max-width: var(--kit-modal-size-lg);
|
|
78
|
+
max-height: calc(100% - 3rem);
|
|
79
|
+
height: fit-content;
|
|
80
|
+
margin: 0 auto;
|
|
81
|
+
top: 50%;
|
|
82
|
+
left: 50%;
|
|
83
|
+
bottom: initial;
|
|
84
|
+
translate: var(--modal-translate-x) var(--modal-translate-y);
|
|
85
|
+
border-radius: var(--modal-radius);
|
|
86
|
+
}
|
|
87
|
+
.kit-modal [breakpoint]kit-modal-container--size-xl {
|
|
88
|
+
max-width: var(--kit-modal-size-xl);
|
|
89
|
+
max-height: calc(100% - 3rem);
|
|
90
|
+
height: fit-content;
|
|
91
|
+
margin: 0 auto;
|
|
92
|
+
top: 50%;
|
|
93
|
+
left: 50%;
|
|
94
|
+
bottom: initial;
|
|
95
|
+
translate: var(--modal-translate-x) var(--modal-translate-y);
|
|
96
|
+
border-radius: var(--modal-radius);
|
|
97
|
+
}
|
|
98
|
+
.kit-modal [breakpoint]kit-modal-container--size-full {
|
|
99
|
+
max-width: 100%;
|
|
100
|
+
max-height: calc(100% - 3rem);
|
|
101
|
+
margin: 0 auto;
|
|
102
|
+
bottom: 0;
|
|
103
|
+
translate: 0 0;
|
|
104
|
+
left: 0;
|
|
105
|
+
top: initial;
|
|
106
|
+
height: 100%;
|
|
107
|
+
border-radius: var(--modal-radius) var(--modal-radius) 0 0;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* density */
|
|
111
|
+
.kit-modal [breakpoint]kit-modal-container--density-default {
|
|
112
|
+
--modal-spacing-x: 0.5rem;
|
|
113
|
+
--modal-spacing-y: 0.5rem;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.kit-modal [breakpoint]kit-modal-container--density-compact {
|
|
117
|
+
--modal-spacing-x: 0.25rem;
|
|
118
|
+
--modal-spacing-y: 0.25rem;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.kit-modal [breakpoint]kit-modal-container--density-comfortable {
|
|
122
|
+
--modal-spacing-x: 0.75rem;
|
|
123
|
+
--modal-spacing-y: 0.75rem;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* position */
|
|
127
|
+
.kit-modal [breakpoint]kit-modal-container--position-bottom {
|
|
128
|
+
--modal-translate-y: 0;
|
|
129
|
+
bottom: 0;
|
|
130
|
+
top: initial;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.kit-modal [breakpoint]kit-modal-container--position-top {
|
|
134
|
+
--modal-translate-y: 0;
|
|
135
|
+
top: 0;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.kit-modal [breakpoint]kit-modal-container--position-center {
|
|
139
|
+
margin: auto;
|
|
140
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// import { disabledScroll } from '../../internal/index.js';
|
|
3
|
+
import { getAssets } from '../../internal/index.js';
|
|
4
|
+
import { modalOpen, modalStack, popModal, pushModal, setOpenModal } from '../../stores/index.js';
|
|
5
|
+
import { onDestroy } from 'svelte';
|
|
6
|
+
import type { ModalProps } from './types.js';
|
|
7
|
+
import { get } from 'svelte/store';
|
|
8
|
+
|
|
9
|
+
const modalId = crypto.randomUUID();
|
|
10
|
+
let wasPushed = $state(false);
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
children,
|
|
14
|
+
ref = $bindable(),
|
|
15
|
+
open = $bindable(),
|
|
16
|
+
contain,
|
|
17
|
+
size = 'md',
|
|
18
|
+
persistent,
|
|
19
|
+
dark,
|
|
20
|
+
light,
|
|
21
|
+
classContent,
|
|
22
|
+
color,
|
|
23
|
+
background,
|
|
24
|
+
position = 'center',
|
|
25
|
+
rounded,
|
|
26
|
+
density = 'default',
|
|
27
|
+
closeWithEsc,
|
|
28
|
+
...rest
|
|
29
|
+
}: ModalProps = $props();
|
|
30
|
+
|
|
31
|
+
const assets = getAssets();
|
|
32
|
+
|
|
33
|
+
$effect(() => {
|
|
34
|
+
if (open && !wasPushed) {
|
|
35
|
+
pushModal(modalId);
|
|
36
|
+
wasPushed = true;
|
|
37
|
+
} else if (!open && wasPushed) {
|
|
38
|
+
popModal(modalId);
|
|
39
|
+
wasPushed = false;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
onDestroy(() => {
|
|
44
|
+
if (wasPushed) popModal(modalId);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
$effect(() => {
|
|
48
|
+
if (open !== undefined && !contain)
|
|
49
|
+
setOpenModal(open ? (persistent ? 'persistent' : open) : open);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
$effect(() => {
|
|
53
|
+
if ($modalOpen === false && !contain) open = false;
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
$effect(() => {
|
|
57
|
+
if (!closeWithEsc || persistent || !open) return;
|
|
58
|
+
|
|
59
|
+
const onKeyDown = (event: KeyboardEvent) => {
|
|
60
|
+
const stack = get(modalStack);
|
|
61
|
+
const isTop = stack[stack.length - 1] === modalId;
|
|
62
|
+
|
|
63
|
+
if (event.key === 'Escape' && isTop) {
|
|
64
|
+
event.preventDefault();
|
|
65
|
+
open = false;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
document.addEventListener('keydown', onKeyDown);
|
|
70
|
+
return () => {
|
|
71
|
+
document.removeEventListener('keydown', onKeyDown);
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const handleClose = () => {
|
|
76
|
+
if (!persistent) open = false;
|
|
77
|
+
};
|
|
78
|
+
</script>
|
|
79
|
+
|
|
80
|
+
{#if open}
|
|
81
|
+
<div
|
|
82
|
+
bind:this={ref}
|
|
83
|
+
class={['kit-modal', contain && 'kit-modal--contain', rest.class]}
|
|
84
|
+
role="dialog"
|
|
85
|
+
>
|
|
86
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
87
|
+
{#if contain}
|
|
88
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
89
|
+
<div
|
|
90
|
+
class={['kit-overlay', persistent && 'kit-overlay--persistent']}
|
|
91
|
+
onclick={() => handleClose()}
|
|
92
|
+
></div>
|
|
93
|
+
{/if}
|
|
94
|
+
|
|
95
|
+
<div
|
|
96
|
+
class={[
|
|
97
|
+
'kit-modal-container',
|
|
98
|
+
classContent,
|
|
99
|
+
light && 'light',
|
|
100
|
+
dark && 'dark',
|
|
101
|
+
size && assets.className('modal-container', 'size', size),
|
|
102
|
+
density && assets.className('modal-container', 'density', density),
|
|
103
|
+
position && assets.className('modal-container', 'position', position)
|
|
104
|
+
]}
|
|
105
|
+
style:--base={assets.color(background)}
|
|
106
|
+
style:--on={assets.color(color)}
|
|
107
|
+
style:--shape={assets.shape(rounded)}
|
|
108
|
+
>
|
|
109
|
+
{@render children?.()}
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
{/if}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Component } from '../../internal/types.js';
|
|
2
|
+
type ModalSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
3
|
+
type ModalPosition = 'bottom' | 'center' | 'top';
|
|
4
|
+
type ModalDensity = 'compact' | 'comfortable' | 'default';
|
|
5
|
+
export interface ModalProps extends Component {
|
|
6
|
+
ref?: HTMLDivElement;
|
|
7
|
+
open?: boolean;
|
|
8
|
+
classContent?: string | string[] | undefined;
|
|
9
|
+
size?: ModalSize | {
|
|
10
|
+
[key: string]: ModalSize;
|
|
11
|
+
};
|
|
12
|
+
persistent?: boolean;
|
|
13
|
+
position?: ModalPosition | {
|
|
14
|
+
[key: string]: ModalPosition;
|
|
15
|
+
};
|
|
16
|
+
dark?: boolean;
|
|
17
|
+
light?: boolean;
|
|
18
|
+
color?: string;
|
|
19
|
+
background?: string;
|
|
20
|
+
density?: ModalDensity | {
|
|
21
|
+
[key: string]: ModalDensity;
|
|
22
|
+
};
|
|
23
|
+
contain?: boolean;
|
|
24
|
+
closeWithEsc?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
.kit-separator {
|
|
2
|
+
--separator-opacity: var(--opacity, 0.12);
|
|
3
|
+
--separator-color: var(--base, var(--kit-scrim));
|
|
4
|
+
|
|
5
|
+
display: block;
|
|
6
|
+
flex: 1 1 100%;
|
|
7
|
+
height: 0px;
|
|
8
|
+
max-height: 0px;
|
|
9
|
+
opacity: var(--separator-opacity);
|
|
10
|
+
transition: inherit;
|
|
11
|
+
border-color: var(--separator-color);
|
|
12
|
+
transition: border-color 0.5s;
|
|
13
|
+
border-style: solid;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.kit-separator:not(.kit-separator--orientation-vertical) {
|
|
17
|
+
border-width: var(--border-top-width, thin) 0 0 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.kit-separator--orientation-vertical {
|
|
21
|
+
align-self: stretch;
|
|
22
|
+
border-width: 0 thin 0 0;
|
|
23
|
+
display: inline-flex;
|
|
24
|
+
height: auto;
|
|
25
|
+
margin-left: 0px;
|
|
26
|
+
max-height: 100%;
|
|
27
|
+
max-width: 0px;
|
|
28
|
+
vertical-align: text-bottom;
|
|
29
|
+
width: 0px;
|
|
30
|
+
border-width: 0 var(--border-right-width, thin) 0 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.kit-separator--inset:not(.kit-separator--orientation-vertical) {
|
|
34
|
+
max-width: calc(100% - 4.5rem);
|
|
35
|
+
margin-inline-start: 4.5rem;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.kit-separator--inset.kit-separator--orientation-vertical {
|
|
39
|
+
margin-bottom: 0.5rem;
|
|
40
|
+
margin-top: 0.5rem;
|
|
41
|
+
max-height: calc(100% - 1rem);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.kit-separator:not(.kit-separator--orientation-vertical) {
|
|
45
|
+
width: 100%;
|
|
46
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getAssets } from '../../internal/index.js';
|
|
3
|
+
import type { SeparatorProps } from './types.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
is = 'hr',
|
|
7
|
+
light,
|
|
8
|
+
dark,
|
|
9
|
+
inset,
|
|
10
|
+
thickness,
|
|
11
|
+
orientation = 'horizontal',
|
|
12
|
+
opacity,
|
|
13
|
+
color,
|
|
14
|
+
...rest
|
|
15
|
+
}: SeparatorProps = $props();
|
|
16
|
+
|
|
17
|
+
const assets = getAssets();
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<svelte:element
|
|
21
|
+
this={is}
|
|
22
|
+
{...rest}
|
|
23
|
+
class={[
|
|
24
|
+
'kit-separator',
|
|
25
|
+
light && 'light',
|
|
26
|
+
dark && 'dark',
|
|
27
|
+
inset && 'kit-separator--inset',
|
|
28
|
+
orientation && assets.className('separator', 'orientation', orientation),
|
|
29
|
+
rest.class
|
|
30
|
+
]}
|
|
31
|
+
aria-orientation={orientation}
|
|
32
|
+
role="separator"
|
|
33
|
+
style:--base={assets.color(color)}
|
|
34
|
+
style:--opacity={opacity}
|
|
35
|
+
style:--border-top-width={orientation === 'horizontal' ? assets.unit(thickness) : undefined}
|
|
36
|
+
style:--border-right-width={orientation === 'vertical' ? assets.unit(thickness) : undefined}
|
|
37
|
+
/>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Base } from '../../internal/types.js';
|
|
2
|
+
export interface SeparatorProps extends Base {
|
|
3
|
+
is?: 'div' | 'hr';
|
|
4
|
+
light?: boolean;
|
|
5
|
+
dark?: boolean;
|
|
6
|
+
inset?: boolean;
|
|
7
|
+
thickness?: string;
|
|
8
|
+
opacity?: string | number;
|
|
9
|
+
color?: string;
|
|
10
|
+
orientation?: 'horizontal' | 'vertical';
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,129 @@
|
|
|
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-toolbar[breakpoint]kit-toolbar--density-default {
|
|
27
|
+
border-radius: calc(var(--kit-spacing) * 2.25);
|
|
28
|
+
}
|
|
29
|
+
.kit-toolbar[breakpoint]kit-toolbar--density-default:not([class*='toolbar--orientation-vertical']) {
|
|
30
|
+
height: 3rem;
|
|
31
|
+
padding-inline: calc(var(--kit-spacing) * 1.5);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.kit-toolbar[breakpoint]kit-toolbar--density-default[class*='toolbar--orientation-vertical'] {
|
|
35
|
+
width: 3rem;
|
|
36
|
+
padding: calc(var(--kit-spacing) * 1.5) 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.kit-toolbar[breakpoint]kit-toolbar--density-compact {
|
|
40
|
+
border-radius: calc(var(--kit-spacing) * 1.75);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.kit-toolbar[breakpoint]kit-toolbar--density-compact:not([class*='toolbar--orientation-vertical']) {
|
|
44
|
+
height: 2.625rem;
|
|
45
|
+
padding-inline: calc(var(--kit-spacing) * 0.75);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.kit-toolbar[breakpoint]kit-toolbar--density-compact[class*='toolbar--orientation-vertical'] {
|
|
49
|
+
width: 2.625rem;
|
|
50
|
+
padding: calc(var(--kit-spacing) * 0.75) 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.kit-toolbar[breakpoint]kit-toolbar--density-comfortable {
|
|
54
|
+
border-radius: calc(var(--kit-spacing) * 3.5);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.kit-toolbar[breakpoint]kit-toolbar--density-comfortable:not(
|
|
58
|
+
[class*='toolbar--orientation-vertical']
|
|
59
|
+
) {
|
|
60
|
+
height: 3.5rem;
|
|
61
|
+
padding-inline: calc(var(--kit-spacing) * 2.25);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.kit-toolbar[breakpoint]kit-toolbar--density-comfortable[class*='toolbar--orientation-vertical'] {
|
|
65
|
+
width: 3.5rem;
|
|
66
|
+
padding: calc(var(--kit-spacing) * 2.25) 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.kit-toolbar[breakpoint]kit-toolbar--variant-text,
|
|
70
|
+
.kit-toolbar[breakpoint]kit-toolbar--variant-outline,
|
|
71
|
+
.kit-toolbar[breakpoint]kit-toolbar--variant-dash {
|
|
72
|
+
--toolbar-color: var(--base, var(--kit-neutral));
|
|
73
|
+
background-color: transparent;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.kit-toolbar[breakpoint]kit-toolbar--variant-outline {
|
|
77
|
+
border-color: currentColor;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.kit-toolbar[breakpoint]kit-toolbar--variant-dash {
|
|
81
|
+
border-style: dashed;
|
|
82
|
+
border-color: currentColor;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.kit-toolbar[breakpoint]kit-toolbar--orientation-horizontal {
|
|
86
|
+
flex-direction: row;
|
|
87
|
+
width: 100%;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.kit-toolbar[breakpoint]kit-toolbar--orientation-vertical {
|
|
91
|
+
flex-direction: column;
|
|
92
|
+
min-height: fit-content;
|
|
93
|
+
width: fit-content;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* wrapper */
|
|
97
|
+
.kit-toolbar .kit-toolbar--wrapper {
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
/* margin-left: auto;
|
|
101
|
+
margin-right: auto; */
|
|
102
|
+
flex-direction: row;
|
|
103
|
+
height: auto;
|
|
104
|
+
width: 100%;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.kit-toolbar[breakpoint]kit-toolbar--orientation-vertical .kit-toolbar--wrapper {
|
|
108
|
+
flex-direction: column;
|
|
109
|
+
height: 100%;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* location */
|
|
113
|
+
.kit-toolbar[breakpoint]kit-toolbar--location-top {
|
|
114
|
+
top: 0px;
|
|
115
|
+
z-index: 1004;
|
|
116
|
+
transform: translateY(0px);
|
|
117
|
+
position: fixed;
|
|
118
|
+
left: 0px;
|
|
119
|
+
width: calc(100% + 0px);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.kit-toolbar[breakpoint]kit-toolbar--location-bottom {
|
|
123
|
+
z-index: 1004;
|
|
124
|
+
transform: translateY(0px);
|
|
125
|
+
position: fixed;
|
|
126
|
+
left: 0px;
|
|
127
|
+
width: calc(100% + 0px);
|
|
128
|
+
bottom: 0px;
|
|
129
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getAssets } from '../../internal/index.js';
|
|
3
|
+
import type { ToolbarProps } from './types.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
children,
|
|
7
|
+
ref = $bindable(),
|
|
8
|
+
is = 'div',
|
|
9
|
+
classContent,
|
|
10
|
+
light,
|
|
11
|
+
dark,
|
|
12
|
+
variant,
|
|
13
|
+
rounded,
|
|
14
|
+
background,
|
|
15
|
+
color,
|
|
16
|
+
density = 'default',
|
|
17
|
+
orientation = 'horizontal',
|
|
18
|
+
location,
|
|
19
|
+
...rest
|
|
20
|
+
}: ToolbarProps = $props();
|
|
21
|
+
|
|
22
|
+
const assets = getAssets();
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<svelte:element
|
|
26
|
+
this={is}
|
|
27
|
+
bind:this={ref}
|
|
28
|
+
{...rest}
|
|
29
|
+
role="toolbar"
|
|
30
|
+
class={[
|
|
31
|
+
'kit-toolbar',
|
|
32
|
+
light && 'light',
|
|
33
|
+
dark && 'dark',
|
|
34
|
+
variant && assets.className('toolbar', 'variant', variant),
|
|
35
|
+
density && assets.className('toolbar', 'density', density),
|
|
36
|
+
orientation && assets.className('toolbar', 'orientation', orientation),
|
|
37
|
+
location && assets.className('toolbar', 'location', location),
|
|
38
|
+
rest.class
|
|
39
|
+
]}
|
|
40
|
+
style:--base={assets.color(background)}
|
|
41
|
+
style:--on={assets.color(color)}
|
|
42
|
+
style:--shape={assets.shape(rounded)}
|
|
43
|
+
>
|
|
44
|
+
<div class={['kit-toolbar--wrapper', classContent]}>
|
|
45
|
+
{@render children?.()}
|
|
46
|
+
</div>
|
|
47
|
+
</svelte:element>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Component } from '../../internal/types.js';
|
|
2
|
+
type Variant = 'outline' | 'text' | 'dash';
|
|
3
|
+
type Density = 'compact' | 'comfortable' | 'default';
|
|
4
|
+
type Orientation = 'horizontal' | 'vertical';
|
|
5
|
+
type Location = 'top' | 'bottom';
|
|
6
|
+
export interface ToolbarProps extends Component {
|
|
7
|
+
is?: 'div' | 'header' | 'nav';
|
|
8
|
+
variant?: Variant | {
|
|
9
|
+
[key: string]: Variant;
|
|
10
|
+
};
|
|
11
|
+
rounded?: string;
|
|
12
|
+
density?: Density | {
|
|
13
|
+
[key: string]: Density;
|
|
14
|
+
};
|
|
15
|
+
dark?: boolean;
|
|
16
|
+
light?: boolean;
|
|
17
|
+
color?: string;
|
|
18
|
+
orientation?: Orientation | {
|
|
19
|
+
[key: string]: Orientation;
|
|
20
|
+
};
|
|
21
|
+
background?: string;
|
|
22
|
+
location?: Location | {
|
|
23
|
+
[key: string]: Location;
|
|
24
|
+
};
|
|
25
|
+
classContent?: string | string[] | undefined;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -36,6 +36,17 @@ export function getAssets() {
|
|
|
36
36
|
return color;
|
|
37
37
|
return `var(--kit-${color})`;
|
|
38
38
|
}
|
|
39
|
+
},
|
|
40
|
+
unit(value) {
|
|
41
|
+
if (typeof value === 'number')
|
|
42
|
+
return `${value}px`;
|
|
43
|
+
if (typeof value === 'string') {
|
|
44
|
+
const cleaned = value.trim();
|
|
45
|
+
const isOnlyNumericLike = /^[\d.,]+$/.test(cleaned);
|
|
46
|
+
if (isOnlyNumericLike)
|
|
47
|
+
return `${value}px`;
|
|
48
|
+
}
|
|
49
|
+
return value;
|
|
39
50
|
}
|
|
40
51
|
};
|
|
41
52
|
}
|
package/dist/internal/index.d.ts
CHANGED
package/dist/internal/index.js
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface RippleOptions {
|
|
2
|
+
center?: boolean;
|
|
3
|
+
color?: string;
|
|
4
|
+
duration?: number;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function ripple(el: HTMLElement, options?: RippleOptions): {
|
|
8
|
+
destroy(): void;
|
|
9
|
+
update(newOptions: RippleOptions): void;
|
|
10
|
+
};
|
|
11
|
+
export {};
|