lapikit 0.1.3 → 0.1.4
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/components/dialog/dialog.css +143 -0
- package/dist/components/dialog/dialog.svelte +68 -0
- package/dist/components/dialog/dialog.svelte.d.ts +4 -0
- package/dist/components/dialog/types.d.ts +20 -0
- package/dist/components/dialog/types.js +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/internal/index.d.ts +1 -0
- package/dist/internal/index.js +1 -0
- package/dist/internal/scroll.d.ts +1 -0
- package/dist/internal/scroll.js +6 -0
- package/dist/style/css.js +3 -0
- package/dist/style/variable.css +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,143 @@
|
|
|
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[class*='kit-dialog--size-full'] .kit-dialog-container {
|
|
46
|
+
height: 100%;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.kit-dialog .close-dialog {
|
|
50
|
+
opacity: 0;
|
|
51
|
+
position: fixed;
|
|
52
|
+
top: 0;
|
|
53
|
+
z-index: -1;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.kit-dialog[breakpoint]kit-dialog--position-bottom {
|
|
57
|
+
margin-bottom: 0;
|
|
58
|
+
margin-top: auto;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.kit-dialog[breakpoint]kit-dialog--position-top {
|
|
62
|
+
margin-top: 0;
|
|
63
|
+
margin-bottom: auto;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.kit-dialog[breakpoint]kit-dialog--position-center {
|
|
67
|
+
margin: auto;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.kit-dialog[breakpoint]kit-dialog--size-xs {
|
|
71
|
+
max-width: var(--kit-dialog-size-xs);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.kit-dialog[breakpoint]kit-dialog--size-sm {
|
|
75
|
+
max-width: var(--kit-dialog-size-sm);
|
|
76
|
+
height: fit-content;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.kit-dialog[breakpoint]kit-dialog--size-md {
|
|
80
|
+
max-width: var(--kit-dialog-size-md);
|
|
81
|
+
height: fit-content;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.kit-dialog[breakpoint]kit-dialog--size-lg {
|
|
85
|
+
max-width: var(--kit-dialog-size-lg);
|
|
86
|
+
height: fit-content;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.kit-dialog[breakpoint]kit-dialog--size-xl {
|
|
90
|
+
max-width: var(--kit-dialog-size-xl);
|
|
91
|
+
height: fit-content;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.kit-dialog[breakpoint]kit-dialog--size-full {
|
|
95
|
+
height: 100%;
|
|
96
|
+
max-height: 100%;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.kit-dialog[breakpoint]kit-dialog--size-xs .kit-dialog-container {
|
|
100
|
+
max-height: calc(100% - 3rem);
|
|
101
|
+
margin: 0 auto;
|
|
102
|
+
}
|
|
103
|
+
.kit-dialog[breakpoint]kit-dialog--size-sm .kit-dialog-container {
|
|
104
|
+
max-height: calc(100% - 3rem);
|
|
105
|
+
margin: 0 auto;
|
|
106
|
+
}
|
|
107
|
+
.kit-dialog[breakpoint]kit-dialog--size-md .kit-dialog-container {
|
|
108
|
+
max-height: calc(100% - 3rem);
|
|
109
|
+
margin: 0 auto;
|
|
110
|
+
}
|
|
111
|
+
.kit-dialog[breakpoint]kit-dialog--size-lg .kit-dialog-container {
|
|
112
|
+
max-height: calc(100% - 3rem);
|
|
113
|
+
margin: 0 auto;
|
|
114
|
+
}
|
|
115
|
+
.kit-dialog[breakpoint]kit-dialog--size-xl .kit-dialog-container {
|
|
116
|
+
max-height: calc(100% - 3rem);
|
|
117
|
+
margin: 0 auto;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* density */
|
|
121
|
+
.kit-dialog .kit-dialog-container[breakpoint]kit-dialog-container--density-default {
|
|
122
|
+
--dialog-spacing-x: 0.5rem;
|
|
123
|
+
--dialog-spacing-y: 0.5rem;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.kit-dialog .kit-dialog-container[breakpoint]kit-dialog-container--density-compact {
|
|
127
|
+
--dialog-spacing-x: 0.25rem;
|
|
128
|
+
--dialog-spacing-y: 0.25rem;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.kit-dialog .kit-dialog-container[breakpoint]kit-dialog-container--density-comfortable {
|
|
132
|
+
--dialog-spacing-x: 0.75rem;
|
|
133
|
+
--dialog-spacing-y: 0.75rem;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
@keyframes fade {
|
|
137
|
+
from {
|
|
138
|
+
opacity: 0;
|
|
139
|
+
}
|
|
140
|
+
to {
|
|
141
|
+
opacity: 1;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { disabledScroll } from '../../internal/index.js';
|
|
3
|
+
import { getAssets } from '../../internal/index.js';
|
|
4
|
+
import type { DialogProps } from './types.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
open = $bindable(),
|
|
9
|
+
dark,
|
|
10
|
+
light,
|
|
11
|
+
classContent,
|
|
12
|
+
color,
|
|
13
|
+
background,
|
|
14
|
+
size = 'md',
|
|
15
|
+
persistent,
|
|
16
|
+
position = 'center',
|
|
17
|
+
rounded,
|
|
18
|
+
density = 'default',
|
|
19
|
+
...rest
|
|
20
|
+
}: DialogProps = $props();
|
|
21
|
+
|
|
22
|
+
const assets = getAssets();
|
|
23
|
+
|
|
24
|
+
let ref: HTMLDialogElement;
|
|
25
|
+
|
|
26
|
+
$effect(() => {
|
|
27
|
+
if (ref && open) ref.showModal();
|
|
28
|
+
if (ref && !open) ref.close();
|
|
29
|
+
disabledScroll(open ? true : false);
|
|
30
|
+
});
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<dialog
|
|
34
|
+
bind:this={ref}
|
|
35
|
+
class={[
|
|
36
|
+
'kit-dialog',
|
|
37
|
+
persistent && 'kit-dialog--persistent',
|
|
38
|
+
size && assets.className('dialog', 'size', size),
|
|
39
|
+
position && assets.className('dialog', 'position', position),
|
|
40
|
+
rest.class
|
|
41
|
+
]}
|
|
42
|
+
onclose={() => (!persistent ? (open = false) : null)}
|
|
43
|
+
onclick={(event: MouseEvent) => {
|
|
44
|
+
if (event.target === ref) {
|
|
45
|
+
if (!persistent) ref.close();
|
|
46
|
+
}
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
<!-- surcharge-dialog autofocus-action-element -->
|
|
50
|
+
<button type="button" class="close-dialog">close</button>
|
|
51
|
+
<div
|
|
52
|
+
{...rest}
|
|
53
|
+
class={[
|
|
54
|
+
'kit-dialog-container',
|
|
55
|
+
light && 'light',
|
|
56
|
+
dark && 'dark',
|
|
57
|
+
classContent,
|
|
58
|
+
density && assets.className('dialog-container', 'density', density),
|
|
59
|
+
rest.class
|
|
60
|
+
]}
|
|
61
|
+
onclick={(event: MouseEvent) => event.stopPropagation()}
|
|
62
|
+
style:--base={assets.color(background)}
|
|
63
|
+
style:--on={assets.color(color)}
|
|
64
|
+
style:--shape={assets.shape(rounded)}
|
|
65
|
+
>
|
|
66
|
+
{@render children?.()}
|
|
67
|
+
</div>
|
|
68
|
+
</dialog>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Component } from '../../internal/types.js';
|
|
2
|
+
type DialogSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
3
|
+
type DialogPosition = 'bottom' | 'center' | 'top';
|
|
4
|
+
export interface DialogProps extends Component {
|
|
5
|
+
open?: boolean;
|
|
6
|
+
classContent?: string | string[] | undefined;
|
|
7
|
+
size?: DialogSize | {
|
|
8
|
+
[key: string]: DialogSize;
|
|
9
|
+
};
|
|
10
|
+
persistent?: boolean;
|
|
11
|
+
position?: DialogPosition | {
|
|
12
|
+
[key: string]: DialogPosition;
|
|
13
|
+
};
|
|
14
|
+
dark?: boolean;
|
|
15
|
+
light?: boolean;
|
|
16
|
+
color?: string;
|
|
17
|
+
background?: string;
|
|
18
|
+
density?: 'compact' | 'comfortable' | 'default';
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,3 +4,4 @@ export { default as Icon } from './icon/icon.svelte';
|
|
|
4
4
|
export { default as Dropdown } from './dropdown/dropdown.svelte';
|
|
5
5
|
export { default as Popover } from './popover/popover.svelte';
|
|
6
6
|
export { default as Tooltip } from './tooltip/tooltip.svelte';
|
|
7
|
+
export { default as Dialog } from './dialog/dialog.svelte';
|
package/dist/components/index.js
CHANGED
|
@@ -5,3 +5,4 @@ export { default as Icon } from './icon/icon.svelte';
|
|
|
5
5
|
export { default as Dropdown } from './dropdown/dropdown.svelte';
|
|
6
6
|
export { default as Popover } from './popover/popover.svelte';
|
|
7
7
|
export { default as Tooltip } from './tooltip/tooltip.svelte';
|
|
8
|
+
export { default as Dialog } from './dialog/dialog.svelte';
|
package/dist/internal/index.d.ts
CHANGED
package/dist/internal/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function disabledScroll(state: boolean): void;
|
package/dist/style/css.js
CHANGED
|
@@ -11,6 +11,7 @@ const __dirname = dirname(__filename);
|
|
|
11
11
|
export const processCSS = async (config) => {
|
|
12
12
|
const _normalize = fs.readFileSync(path.resolve(__dirname, './normalize.css'), 'utf-8');
|
|
13
13
|
const _animation = fs.readFileSync(path.resolve(__dirname, './animation.css'), 'utf-8');
|
|
14
|
+
const _variables = fs.readFileSync(path.resolve(__dirname, './variable.css'), 'utf-8');
|
|
14
15
|
let styles = ``;
|
|
15
16
|
if (config.options.normalize)
|
|
16
17
|
styles += `${_normalize}\n`;
|
|
@@ -19,6 +20,8 @@ export const processCSS = async (config) => {
|
|
|
19
20
|
const variablesStyles = variables(config);
|
|
20
21
|
styles += `${colorScheme.root}\n`;
|
|
21
22
|
styles += `${variablesStyles}\n`;
|
|
23
|
+
styles += `${variablesStyles}\n`;
|
|
24
|
+
styles += `${_variables}\n`;
|
|
22
25
|
styles += `${colorScheme.className}\n`;
|
|
23
26
|
styles += `${deviceDisplay}\n`;
|
|
24
27
|
styles += component(config);
|