lapikit 0.0.0-insiders.de81aed → 0.0.0-insiders.df15d32
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 +304 -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/presets.js +26 -0
- package/bin/prompts.js +100 -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/colors.css +0 -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 +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 +37 -3
- 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 +131 -0
- package/dist/components/chip/chip.svelte.d.ts +4 -0
- package/dist/components/chip/types.d.ts +32 -0
- package/dist/components/chip/types.js +1 -0
- package/dist/components/dialog/dialog.css +5 -12
- package/dist/components/dialog/types.d.ts +5 -2
- package/dist/components/dropdown/dropdown.css +4 -4
- package/dist/components/icon/icon.css +14 -11
- package/dist/components/index.d.ts +14 -1
- package/dist/components/index.js +14 -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 +133 -7
- package/dist/components/modal/modal.svelte +92 -38
- package/dist/components/modal/types.d.ts +6 -1
- package/dist/components/popover/popover.css +4 -4
- package/dist/components/separator/separator.css +1 -1
- 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 +4 -4
- package/dist/index.d.ts +27 -1
- package/dist/index.js +27 -3
- package/dist/internal/assets.svelte.js +2 -0
- package/dist/internal/deepMerge.d.ts +44 -0
- package/dist/internal/deepMerge.js +80 -0
- package/dist/internal/ripple.d.ts +12 -0
- package/dist/internal/ripple.js +93 -0
- package/dist/internal/unit.d.ts +1 -0
- package/dist/internal/unit.js +11 -0
- package/dist/plugin/css.d.ts +1 -0
- package/dist/plugin/css.js +56 -0
- package/dist/plugin/preset-v2.d.ts +96 -0
- package/dist/plugin/preset-v2.js +114 -0
- package/dist/plugin/vitejs.d.ts +5 -1
- package/dist/plugin/vitejs.js +32 -3
- package/dist/preset.js +2 -2
- package/dist/stores/breakpoints.d.ts +6 -0
- package/dist/stores/breakpoints.js +14 -0
- package/dist/stores/components.d.ts +8 -0
- package/dist/stores/components.js +26 -0
- package/dist/stores/devices.d.ts +6 -0
- package/dist/stores/devices.js +9 -0
- package/dist/stores/index.d.ts +4 -4
- package/dist/stores/index.js +4 -23
- package/dist/stores/themes.d.ts +8 -0
- package/dist/stores/themes.js +34 -0
- package/dist/style/animation.css +42 -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 +5 -0
- package/dist/utils/convert.d.ts +1 -0
- package/dist/utils/convert.js +17 -0
- package/package.json +14 -5
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getAssets } from '../../../internal/index.js';
|
|
3
|
+
import type { ListItemProps } from '../types.js';
|
|
4
|
+
|
|
5
|
+
// external
|
|
6
|
+
import { ripple } from '../../../internal/ripple.js';
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
children,
|
|
10
|
+
append,
|
|
11
|
+
prepend,
|
|
12
|
+
ref = $bindable(),
|
|
13
|
+
is = 'div',
|
|
14
|
+
dark,
|
|
15
|
+
light,
|
|
16
|
+
background,
|
|
17
|
+
color,
|
|
18
|
+
rounded,
|
|
19
|
+
disabled,
|
|
20
|
+
active,
|
|
21
|
+
href,
|
|
22
|
+
noRipple,
|
|
23
|
+
...rest
|
|
24
|
+
}: ListItemProps = $props();
|
|
25
|
+
|
|
26
|
+
const assets = getAssets();
|
|
27
|
+
|
|
28
|
+
$effect(() => {
|
|
29
|
+
const refProps = { ...rest };
|
|
30
|
+
if (refProps?.onclick) is = 'button';
|
|
31
|
+
});
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<svelte:element
|
|
35
|
+
this={href ? 'a' : is}
|
|
36
|
+
bind:this={ref}
|
|
37
|
+
{...rest}
|
|
38
|
+
href={href && !disabled ? href : undefined}
|
|
39
|
+
class={[
|
|
40
|
+
'kit-list-item',
|
|
41
|
+
light && 'light',
|
|
42
|
+
dark && 'dark',
|
|
43
|
+
append && 'kit-list-item--append',
|
|
44
|
+
prepend && 'kit-list-item--prepend',
|
|
45
|
+
active && 'kit-list-item--active',
|
|
46
|
+
disabled && 'kit-list-item--disabled',
|
|
47
|
+
rest.class
|
|
48
|
+
]}
|
|
49
|
+
use:ripple={{
|
|
50
|
+
component: 'list-item',
|
|
51
|
+
disabled: noRipple || disabled || is === 'div'
|
|
52
|
+
}}
|
|
53
|
+
role={is === 'button' ? 'listitem' : undefined}
|
|
54
|
+
tabindex={href && disabled ? -2 : 0}
|
|
55
|
+
aria-disabled={href ? disabled : undefined}
|
|
56
|
+
disabled={href ? undefined : disabled}
|
|
57
|
+
style:--base={assets.color(background)}
|
|
58
|
+
style:--on={assets.color(color)}
|
|
59
|
+
style:--shape={assets.shape(rounded)}
|
|
60
|
+
>
|
|
61
|
+
{#if append}
|
|
62
|
+
<div class="kit-list-item-content--append">
|
|
63
|
+
{@render append?.()}
|
|
64
|
+
</div>
|
|
65
|
+
{/if}
|
|
66
|
+
|
|
67
|
+
<div class="kit-list-item-content--content">
|
|
68
|
+
{@render children?.()}
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
{#if prepend}
|
|
72
|
+
<div class="kit-list-item-content--prepend">
|
|
73
|
+
{@render prepend?.()}
|
|
74
|
+
</div>
|
|
75
|
+
{/if}
|
|
76
|
+
</svelte:element>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Component } from '../../internal/types.js';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
type ListSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
4
|
+
type ListDensity = 'compact' | 'comfortable' | 'default';
|
|
5
|
+
export interface ListProps extends Component {
|
|
6
|
+
ref?: HTMLElement | null;
|
|
7
|
+
is?: 'div' | 'nav';
|
|
8
|
+
dark?: boolean;
|
|
9
|
+
light?: boolean;
|
|
10
|
+
size?: ListSize | {
|
|
11
|
+
[key: string]: ListSize;
|
|
12
|
+
};
|
|
13
|
+
variant?: 'outline' | 'text' | 'filled';
|
|
14
|
+
density?: ListDensity | {
|
|
15
|
+
[key: string]: ListDensity;
|
|
16
|
+
};
|
|
17
|
+
nav?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface ListItemProps extends Component {
|
|
20
|
+
ref?: HTMLElement | null;
|
|
21
|
+
is?: 'div' | 'a' | 'button';
|
|
22
|
+
href?: string;
|
|
23
|
+
dark?: boolean;
|
|
24
|
+
light?: boolean;
|
|
25
|
+
append?: Snippet;
|
|
26
|
+
prepend?: Snippet;
|
|
27
|
+
color?: string;
|
|
28
|
+
background?: string;
|
|
29
|
+
active?: boolean;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
noRipple?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,19 +1,145 @@
|
|
|
1
|
+
/* root */
|
|
2
|
+
.kit-modal {
|
|
3
|
+
--modal-color: var(--on, var(--kit-on-surface));
|
|
4
|
+
--modal-background: var(--base, var(--kit-surface));
|
|
5
|
+
--modal-radius: var(--shape, var(--kit-radius-md));
|
|
6
|
+
--modal-translate-x: -50%;
|
|
7
|
+
--modal-translate-y: -50%;
|
|
8
|
+
}
|
|
9
|
+
|
|
1
10
|
.kit-modal {
|
|
2
11
|
width: 100%;
|
|
3
12
|
height: 100%;
|
|
13
|
+
position: absolute;
|
|
4
14
|
}
|
|
5
15
|
|
|
6
|
-
.kit-modal
|
|
16
|
+
.kit-modal-container {
|
|
17
|
+
position: fixed;
|
|
18
|
+
overflow-y: auto;
|
|
19
|
+
z-index: 9100;
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
padding-top: var(--modal-spacing-x);
|
|
23
|
+
padding-bottom: var(--modal-spacing-x);
|
|
24
|
+
padding-right: var(--modal-spacing-y);
|
|
25
|
+
padding-left: var(--modal-spacing-y);
|
|
26
|
+
|
|
27
|
+
/* theme */
|
|
28
|
+
color: var(--modal-color);
|
|
29
|
+
background-color: var(--modal-background);
|
|
30
|
+
border-color: var(--modal-background);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.kit-modal.kit-modal--contain {
|
|
34
|
+
position: absolute;
|
|
7
35
|
top: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.kit-modal.kit-modal--contain .kit-overlay {
|
|
39
|
+
position: absolute;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.kit-modal.kit-modal--contain .kit-modal-container {
|
|
43
|
+
position: absolute;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* size */
|
|
47
|
+
.kit-modal [breakpoint]kit-modal-container--size-xs {
|
|
48
|
+
max-width: var(--kit-modal-size-xs);
|
|
49
|
+
max-height: calc(100% - 3rem);
|
|
50
|
+
height: fit-content;
|
|
51
|
+
margin: 0 auto;
|
|
52
|
+
left: 50%;
|
|
53
|
+
bottom: initial;
|
|
54
|
+
translate: var(--modal-translate-x) var(--modal-translate-y);
|
|
55
|
+
border-radius: var(--modal-radius);
|
|
56
|
+
}
|
|
57
|
+
.kit-modal [breakpoint]kit-modal-container--size-sm {
|
|
58
|
+
max-width: var(--kit-modal-size-sm);
|
|
59
|
+
max-height: calc(100% - 3rem);
|
|
60
|
+
height: fit-content;
|
|
61
|
+
margin: 0 auto;
|
|
62
|
+
left: 50%;
|
|
63
|
+
bottom: initial;
|
|
64
|
+
translate: var(--modal-translate-x) var(--modal-translate-y);
|
|
65
|
+
border-radius: var(--modal-radius);
|
|
66
|
+
}
|
|
67
|
+
.kit-modal [breakpoint]kit-modal-container--size-md {
|
|
68
|
+
max-width: var(--kit-modal-size-md);
|
|
69
|
+
max-height: calc(100% - 3rem);
|
|
70
|
+
height: fit-content;
|
|
71
|
+
margin: 0 auto;
|
|
72
|
+
left: 50%;
|
|
73
|
+
bottom: initial;
|
|
74
|
+
translate: var(--modal-translate-x) var(--modal-translate-y);
|
|
75
|
+
border-radius: var(--modal-radius);
|
|
76
|
+
}
|
|
77
|
+
.kit-modal [breakpoint]kit-modal-container--size-lg {
|
|
78
|
+
max-width: var(--kit-modal-size-lg);
|
|
79
|
+
max-height: calc(100% - 3rem);
|
|
80
|
+
height: fit-content;
|
|
81
|
+
margin: 0 auto;
|
|
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
|
+
left: 50%;
|
|
93
|
+
bottom: initial;
|
|
94
|
+
translate: var(--modal-translate-x) var(--modal-translate-y);
|
|
95
|
+
border-radius: var(--modal-radius);
|
|
96
|
+
}
|
|
97
|
+
.kit-modal [breakpoint]kit-modal-container--size-full {
|
|
98
|
+
max-width: 100%;
|
|
99
|
+
max-height: calc(100% - 3rem);
|
|
100
|
+
margin: 0 auto;
|
|
101
|
+
bottom: 0;
|
|
102
|
+
translate: 0 0;
|
|
8
103
|
left: 0;
|
|
104
|
+
top: initial;
|
|
105
|
+
height: 100%;
|
|
106
|
+
border-radius: var(--modal-radius) var(--modal-radius) 0 0;
|
|
9
107
|
}
|
|
10
108
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
109
|
+
/* density */
|
|
110
|
+
.kit-modal [breakpoint]kit-modal-container--density-default {
|
|
111
|
+
--modal-spacing-x: 0.5rem;
|
|
112
|
+
--modal-spacing-y: 0.5rem;
|
|
14
113
|
}
|
|
15
114
|
|
|
16
|
-
.kit-modal-container {
|
|
17
|
-
|
|
18
|
-
|
|
115
|
+
.kit-modal [breakpoint]kit-modal-container--density-compact {
|
|
116
|
+
--modal-spacing-x: 0.25rem;
|
|
117
|
+
--modal-spacing-y: 0.25rem;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.kit-modal [breakpoint]kit-modal-container--density-comfortable {
|
|
121
|
+
--modal-spacing-x: 0.75rem;
|
|
122
|
+
--modal-spacing-y: 0.75rem;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* position */
|
|
126
|
+
.kit-modal [breakpoint]kit-modal-container--position-bottom {
|
|
127
|
+
--modal-translate-y: 0;
|
|
128
|
+
margin: auto;
|
|
129
|
+
top: initial;
|
|
130
|
+
bottom: 0;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.kit-modal [breakpoint]kit-modal-container--position-top {
|
|
134
|
+
--modal-translate-y: 0;
|
|
135
|
+
margin: auto;
|
|
136
|
+
top: 0;
|
|
137
|
+
bottom: initial;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.kit-modal [breakpoint]kit-modal-container--position-center {
|
|
141
|
+
--modal-translate-y: -50%;
|
|
142
|
+
margin: auto;
|
|
143
|
+
top: 50%;
|
|
144
|
+
bottom: initial;
|
|
19
145
|
}
|
|
@@ -1,59 +1,113 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
// import { disabledScroll } from '../../internal/index.js';
|
|
3
|
-
|
|
3
|
+
import { getAssets } from '../../internal/index.js';
|
|
4
|
+
import { modalOpen, modalStack, popModal, pushModal, setOpenModal } from '../../stores/index.js';
|
|
5
|
+
import { onDestroy } from 'svelte';
|
|
4
6
|
import type { ModalProps } from './types.js';
|
|
7
|
+
import { get } from 'svelte/store';
|
|
8
|
+
|
|
9
|
+
const modalId = crypto.randomUUID();
|
|
10
|
+
let wasPushed = $state(false);
|
|
5
11
|
|
|
6
12
|
let {
|
|
7
13
|
children,
|
|
8
14
|
ref = $bindable(),
|
|
9
15
|
open = $bindable(),
|
|
10
16
|
contain,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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,
|
|
21
28
|
...rest
|
|
22
29
|
}: ModalProps = $props();
|
|
23
30
|
|
|
24
|
-
|
|
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;
|
|
25
62
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
+
};
|
|
31
78
|
</script>
|
|
32
79
|
|
|
33
80
|
{#if open}
|
|
34
|
-
<div class={['kit-modal', contain && 'kit-modal--contain', rest.class]}>
|
|
35
|
-
<div class="kit-modal-overlay">overlay</div>
|
|
36
|
-
<div class="kit-modal-container">
|
|
37
|
-
{@render children?.()}
|
|
38
|
-
</div>
|
|
39
|
-
<!-- surcharge-dialog autofocus-action-element -->
|
|
40
|
-
<!-- <button type="button" class="close-dialog">close</button>
|
|
41
81
|
<div
|
|
82
|
+
bind:this={ref}
|
|
42
83
|
{...rest}
|
|
43
|
-
class={[
|
|
44
|
-
|
|
45
|
-
light && 'light',
|
|
46
|
-
dark && 'dark',
|
|
47
|
-
classContent,
|
|
48
|
-
density && assets.className('dialog-container', 'density', density),
|
|
49
|
-
rest.class
|
|
50
|
-
]}
|
|
51
|
-
onclick={(event: MouseEvent) => event.stopPropagation()}
|
|
52
|
-
style:--base={assets.color(background)}
|
|
53
|
-
style:--on={assets.color(color)}
|
|
54
|
-
style:--shape={assets.shape(rounded)}
|
|
84
|
+
class={['kit-modal', contain && 'kit-modal--contain', rest.class]}
|
|
85
|
+
role="dialog"
|
|
55
86
|
>
|
|
56
|
-
|
|
57
|
-
|
|
87
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
88
|
+
{#if contain}
|
|
89
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
90
|
+
<div
|
|
91
|
+
class={['kit-overlay', persistent && 'kit-overlay--persistent']}
|
|
92
|
+
onclick={() => handleClose()}
|
|
93
|
+
></div>
|
|
94
|
+
{/if}
|
|
95
|
+
|
|
96
|
+
<div
|
|
97
|
+
class={[
|
|
98
|
+
'kit-modal-container',
|
|
99
|
+
classContent,
|
|
100
|
+
light && 'light',
|
|
101
|
+
dark && 'dark',
|
|
102
|
+
size && assets.className('modal-container', 'size', size),
|
|
103
|
+
density && assets.className('modal-container', 'density', density),
|
|
104
|
+
position && assets.className('modal-container', 'position', position)
|
|
105
|
+
]}
|
|
106
|
+
style:--base={assets.color(background)}
|
|
107
|
+
style:--on={assets.color(color)}
|
|
108
|
+
style:--shape={assets.shape(rounded)}
|
|
109
|
+
>
|
|
110
|
+
{@render children?.()}
|
|
111
|
+
</div>
|
|
58
112
|
</div>
|
|
59
113
|
{/if}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Component } from '../../internal/types.js';
|
|
2
2
|
type ModalSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
3
3
|
type ModalPosition = 'bottom' | 'center' | 'top';
|
|
4
|
+
type ModalDensity = 'compact' | 'comfortable' | 'default';
|
|
4
5
|
export interface ModalProps extends Component {
|
|
5
6
|
ref?: HTMLDivElement;
|
|
6
7
|
open?: boolean;
|
|
@@ -16,6 +17,10 @@ export interface ModalProps extends Component {
|
|
|
16
17
|
light?: boolean;
|
|
17
18
|
color?: string;
|
|
18
19
|
background?: string;
|
|
19
|
-
density?:
|
|
20
|
+
density?: ModalDensity | {
|
|
21
|
+
[key: string]: ModalDensity;
|
|
22
|
+
};
|
|
23
|
+
contain?: boolean;
|
|
24
|
+
closeWithEsc?: boolean;
|
|
20
25
|
}
|
|
21
26
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.kit-popover-content {
|
|
2
|
-
--popover-color: var(--on, var(--kit-on-
|
|
3
|
-
--popover-background: var(--base, var(--kit-
|
|
2
|
+
--popover-color: var(--on, var(--kit-on-container));
|
|
3
|
+
--popover-background: var(--base, var(--kit-container));
|
|
4
4
|
--popover-radius: var(--shape, var(--kit-radius-md));
|
|
5
5
|
|
|
6
6
|
inset: 0px auto auto 0px;
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
width: auto;
|
|
12
12
|
opacity: 1;
|
|
13
13
|
transition-property: opacity, transform;
|
|
14
|
-
transition:
|
|
14
|
+
/* transition:
|
|
15
15
|
color 0.5s,
|
|
16
|
-
background-color 0.5s;
|
|
16
|
+
background-color 0.5s; */
|
|
17
17
|
|
|
18
18
|
/* theme */
|
|
19
19
|
background-color: var(--popover-background);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|