lapikit 0.0.0-insiders.e330f8d → 0.0.0-insiders.e552ce3
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 +152 -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 +23 -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 +31 -0
- package/dist/assets/icons/loading-fill.svelte.d.ts +18 -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 +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 +168 -161
- package/dist/components/button/button.svelte +51 -30
- package/dist/components/button/button.svelte.d.ts +2 -2
- package/dist/components/button/types.d.ts +10 -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 +79 -0
- package/dist/components/icon/icon.svelte +49 -0
- package/dist/components/icon/icon.svelte.d.ts +4 -0
- package/dist/components/icon/types.d.ts +16 -0
- package/dist/components/icon/types.js +1 -0
- package/dist/components/index.d.ts +21 -1
- package/dist/components/index.js +21 -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 +51 -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
package/bin/prompts.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import prompts from 'prompts';
|
|
3
|
+
|
|
4
|
+
export async function initPrompts() {
|
|
5
|
+
const { confirm } = await prompts({
|
|
6
|
+
type: 'toggle',
|
|
7
|
+
name: 'confirm',
|
|
8
|
+
message: 'Start install Lapikit on your app?',
|
|
9
|
+
initial: true,
|
|
10
|
+
active: 'Yes',
|
|
11
|
+
inactive: 'No'
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
if (!confirm) {
|
|
15
|
+
console.log('❌ Installation canceled. See you soon.');
|
|
16
|
+
process.exit(0);
|
|
17
|
+
}
|
|
18
|
+
// temps with legacy and new process install
|
|
19
|
+
const { type } = await prompts({
|
|
20
|
+
type: 'select',
|
|
21
|
+
name: 'type',
|
|
22
|
+
message: 'Select installation type:',
|
|
23
|
+
choices: [
|
|
24
|
+
{ title: 'Classic install with lapikit.config.js', value: 'current' },
|
|
25
|
+
{
|
|
26
|
+
title: 'Preview install with new plugin/lapikit.(js|ts) <experimental>',
|
|
27
|
+
value: 'experimental'
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
if (type === 'current') {
|
|
33
|
+
// Classic install
|
|
34
|
+
const settings = await prompts([
|
|
35
|
+
{
|
|
36
|
+
type: 'text',
|
|
37
|
+
name: 'pathCSS',
|
|
38
|
+
message: 'Where would you like to import the lapikit CSS files?',
|
|
39
|
+
initial: 'src/app.css',
|
|
40
|
+
validate: (value) =>
|
|
41
|
+
value.startsWith('src/') ? true : 'Please provide a valid path starting with src/'
|
|
42
|
+
}
|
|
43
|
+
]);
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
...settings,
|
|
47
|
+
env: 'current'
|
|
48
|
+
};
|
|
49
|
+
} else if (type === 'experimental') {
|
|
50
|
+
// Preview install
|
|
51
|
+
let settings = await prompts([
|
|
52
|
+
{
|
|
53
|
+
type: 'text',
|
|
54
|
+
name: 'pathConfig',
|
|
55
|
+
message: 'Where would you like to install the lapikit configuration files?',
|
|
56
|
+
initial: 'src/plugins',
|
|
57
|
+
validate: (value) =>
|
|
58
|
+
value.startsWith('src/') ? true : 'Please provide a valid path starting with src/'
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
type: 'toggle',
|
|
62
|
+
name: 'typescript',
|
|
63
|
+
message: 'Use TypeScript?',
|
|
64
|
+
initial: true,
|
|
65
|
+
active: 'Yes',
|
|
66
|
+
inactive: 'No'
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
type: 'select',
|
|
70
|
+
name: 'formatCSS',
|
|
71
|
+
message: 'What is your CSS format used on your app?',
|
|
72
|
+
choices: [
|
|
73
|
+
{ title: 'Basic (classic import)', value: 'global' },
|
|
74
|
+
{
|
|
75
|
+
title: 'TailwindCSS (v4)',
|
|
76
|
+
value: 'tailwind-v4'
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
title: 'UnoCSS',
|
|
80
|
+
value: 'unocss'
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
type: (prev) => (prev !== 'global' ? 'text' : null),
|
|
86
|
+
name: 'pathCSS',
|
|
87
|
+
message: 'Where would you like to import the lapikit CSS files?',
|
|
88
|
+
initial: 'src/app.css',
|
|
89
|
+
validate: (value) =>
|
|
90
|
+
value.startsWith('src/') ? true : 'Please provide a valid path starting with src/'
|
|
91
|
+
}
|
|
92
|
+
]);
|
|
93
|
+
|
|
94
|
+
console.log('response config', settings);
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
...settings,
|
|
98
|
+
env: 'experimental'
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../components/accordion/accordion.svelte.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../components/accordion/accordion.svelte.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts"></script>
|
|
2
|
+
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
|
|
4
|
+
><path
|
|
5
|
+
fill="none"
|
|
6
|
+
stroke="currentColor"
|
|
7
|
+
stroke-linecap="round"
|
|
8
|
+
stroke-linejoin="round"
|
|
9
|
+
stroke-width="2.5"
|
|
10
|
+
d="m7 10l5 5m0 0l5-5"
|
|
11
|
+
/></svg
|
|
12
|
+
>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const ArrowDown: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type ArrowDown = InstanceType<typeof ArrowDown>;
|
|
18
|
+
export default ArrowDown;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts"></script>
|
|
2
|
+
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
|
|
4
|
+
><path
|
|
5
|
+
fill="none"
|
|
6
|
+
stroke="currentColor"
|
|
7
|
+
stroke-linecap="round"
|
|
8
|
+
stroke-linejoin="round"
|
|
9
|
+
stroke-width="2.5"
|
|
10
|
+
d="m17 14l-5-5m0 0l-5 5"
|
|
11
|
+
/></svg
|
|
12
|
+
>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const ArrowUp: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type ArrowUp = InstanceType<typeof ArrowUp>;
|
|
18
|
+
export default ArrowUp;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts"></script>
|
|
2
|
+
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
|
|
4
|
+
><title>close_fill</title><g id="close_fill" fill="none" fill-rule="evenodd"
|
|
5
|
+
><path
|
|
6
|
+
d="M24 0v24H0V0zM12.593 23.258l-.011.002-.071.035-.02.004-.014-.004-.071-.035c-.01-.004-.019-.001-.024.005l-.004.01-.017.428.005.02.01.013.104.074.015.004.012-.004.104-.074.012-.016.004-.017-.017-.427c-.002-.01-.009-.017-.017-.018m.265-.113-.013.002-.185.093-.01.01-.003.011.018.43.005.012.008.007.201.093c.012.004.023 0 .029-.008l.004-.014-.034-.614c-.003-.012-.01-.02-.02-.022m-.715.002a.023.023 0 0 0-.027.006l-.006.014-.034.614c0 .012.007.02.017.024l.015-.002.201-.093.01-.008.004-.011.017-.43-.003-.012-.01-.01z"
|
|
7
|
+
/><path
|
|
8
|
+
fill="currentColor"
|
|
9
|
+
d="m12 14.122 5.303 5.303a1.5 1.5 0 0 0 2.122-2.122L14.12 12l5.304-5.303a1.5 1.5 0 1 0-2.122-2.121L12 9.879 6.697 4.576a1.5 1.5 0 1 0-2.122 2.12L9.88 12l-5.304 5.304a1.5 1.5 0 1 0 2.122 2.12z"
|
|
10
|
+
/></g
|
|
11
|
+
></svg
|
|
12
|
+
>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const CloseFill: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type CloseFill = InstanceType<typeof CloseFill>;
|
|
18
|
+
export default CloseFill;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script lang="ts"></script>
|
|
2
|
+
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
|
|
4
|
+
><defs
|
|
5
|
+
><linearGradient id="a" x1="50%" x2="50%" y1="5.271%" y2="91.793%"
|
|
6
|
+
><stop offset="0%" stop-color="currentColor" /><stop
|
|
7
|
+
offset="100%"
|
|
8
|
+
stop-color="currentColor"
|
|
9
|
+
stop-opacity=".55"
|
|
10
|
+
/></linearGradient
|
|
11
|
+
><linearGradient id="b" x1="50%" x2="50%" y1="15.24%" y2="87.15%"
|
|
12
|
+
><stop offset="0%" stop-color="currentColor" stop-opacity="0" /><stop
|
|
13
|
+
offset="100%"
|
|
14
|
+
stop-color="currentColor"
|
|
15
|
+
stop-opacity=".55"
|
|
16
|
+
/></linearGradient
|
|
17
|
+
></defs
|
|
18
|
+
><g fill="none"
|
|
19
|
+
><path
|
|
20
|
+
d="M24 0v24H0V0zM12.593 23.258l-.011.002-.071.035-.02.004-.014-.004-.071-.035c-.01-.004-.019-.001-.024.005l-.004.01-.017.428.005.02.01.013.104.074.015.004.012-.004.104-.074.012-.016.004-.017-.017-.427c-.002-.01-.009-.017-.017-.018m.265-.113-.013.002-.185.093-.01.01-.003.011.018.43.005.012.008.007.201.093c.012.004.023 0 .029-.008l.004-.014-.034-.614c-.003-.012-.01-.02-.02-.022m-.715.002a.023.023 0 0 0-.027.006l-.006.014-.034.614c0 .012.007.02.017.024l.015-.002.201-.093.01-.008.004-.011.017-.43-.003-.012-.01-.01z"
|
|
21
|
+
/><path
|
|
22
|
+
fill="url(#a)"
|
|
23
|
+
d="M8.749.021a1.5 1.5 0 0 1 .497 2.958A7.502 7.502 0 0 0 3 10.375a7.5 7.5 0 0 0 7.5 7.5v3c-5.799 0-10.5-4.7-10.5-10.5C0 5.23 3.726.865 8.749.021"
|
|
24
|
+
transform="translate(1.5 1.625)"
|
|
25
|
+
/><path
|
|
26
|
+
fill="url(#b)"
|
|
27
|
+
d="M15.392 2.673a1.5 1.5 0 0 1 2.119-.115A10.475 10.475 0 0 1 21 10.375c0 5.8-4.701 10.5-10.5 10.5v-3a7.5 7.5 0 0 0 5.007-13.084 1.5 1.5 0 0 1-.115-2.118"
|
|
28
|
+
transform="translate(1.5 1.625)"
|
|
29
|
+
/></g
|
|
30
|
+
></svg
|
|
31
|
+
>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const LoadingFill: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type LoadingFill = InstanceType<typeof LoadingFill>;
|
|
18
|
+
export default LoadingFill;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
.kit-accordion {
|
|
2
|
+
--accordion-color: var(--on, var(--kit-on-container));
|
|
3
|
+
--accordion-background: var(--base, var(--kit-container));
|
|
4
|
+
--accordion-radius: var(--shape, var(--kit-radius-md));
|
|
5
|
+
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-wrap: wrap;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
list-style-type: none;
|
|
10
|
+
padding: 0;
|
|
11
|
+
width: 100%;
|
|
12
|
+
position: relative;
|
|
13
|
+
z-index: 1;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.kit-accordion.kit-accordion--spacer .kit-accordion-item:first-child.kit-accordion-item--active {
|
|
17
|
+
margin-bottom: 1rem;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.kit-accordion.kit-accordion--spacer
|
|
21
|
+
.kit-accordion-item:not(:first-child):not(:last-child).kit-accordion-item--active {
|
|
22
|
+
margin-bottom: 1rem;
|
|
23
|
+
margin-top: 1rem;
|
|
24
|
+
}
|
|
25
|
+
.kit-accordion.kit-accordion--spacer .kit-accordion-item:last-child.kit-accordion-item--active {
|
|
26
|
+
margin-top: 1rem;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.kit-accordion.kit-accordion--hide-icon
|
|
30
|
+
.kit-accordion-item
|
|
31
|
+
.kit-accordion-item--title
|
|
32
|
+
> .kit-accordion-item--icon {
|
|
33
|
+
display: none !important;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.kit-accordion.kit-accordion--hide-icon .kit-accordion-item .kit-accordion-item--title {
|
|
37
|
+
cursor: default;
|
|
38
|
+
pointer-events: none;
|
|
39
|
+
user-select: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* item */
|
|
43
|
+
.kit-accordion .kit-accordion-item {
|
|
44
|
+
flex: 1 0 100%;
|
|
45
|
+
max-width: 100%;
|
|
46
|
+
position: relative;
|
|
47
|
+
transition: 0.3s all cubic-bezier(0.4, 0, 0.2, 1);
|
|
48
|
+
transition-property: margin-top, border-radius, border, max-width;
|
|
49
|
+
border-radius: var(--shape, var(--accordion-radius, var(--kit-radius-md)));
|
|
50
|
+
color: var(--on, var(--accordion-color, var(--kit-on-container)));
|
|
51
|
+
background-color: var(--base, var(--accordion-background, var(--kit-container)));
|
|
52
|
+
/* transition:
|
|
53
|
+
color 0.5s,
|
|
54
|
+
background-color 0.5s; */
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.kit-accordion .kit-accordion-item > button,
|
|
58
|
+
.kit-accordion .kit-accordion-item > [type='button'] {
|
|
59
|
+
font: inherit;
|
|
60
|
+
overflow: visible;
|
|
61
|
+
background-color: transparent;
|
|
62
|
+
border-style: none;
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
color: inherit;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.kit-accordion .kit-accordion-item .kit-accordion-item--title {
|
|
68
|
+
align-items: center;
|
|
69
|
+
text-align: start;
|
|
70
|
+
border-radius: inherit;
|
|
71
|
+
display: flex;
|
|
72
|
+
font-size: 0.9375rem;
|
|
73
|
+
min-height: 3rem;
|
|
74
|
+
outline: none;
|
|
75
|
+
padding: 1rem 1.5rem;
|
|
76
|
+
position: relative;
|
|
77
|
+
transition: 0.3s min-height margin-bottom margin-top border-radius cubic-bezier(0.4, 0, 0.2, 1);
|
|
78
|
+
width: 100%;
|
|
79
|
+
justify-content: space-between;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.kit-accordion .kit-accordion-item .kit-accordion-item--text {
|
|
83
|
+
display: flex;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.kit-accordion .kit-accordion-item .kit-accordion-item--text .kit-accordion-item--text-wrapper {
|
|
87
|
+
padding: 0.5rem 1.5rem 1rem;
|
|
88
|
+
flex: 1 1 auto;
|
|
89
|
+
max-width: 100%;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.kit-accordion .kit-accordion-item .kit-accordion-item--icon {
|
|
93
|
+
display: inline-flex;
|
|
94
|
+
margin-bottom: -0.25rem;
|
|
95
|
+
margin-top: -0.25rem;
|
|
96
|
+
-webkit-user-select: none;
|
|
97
|
+
user-select: none;
|
|
98
|
+
margin-inline-start: auto;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* disabled */
|
|
102
|
+
.kit-accordion .kit-accordion-item .kit-accordion-item--title.kit-accordion-item--disabled,
|
|
103
|
+
.kit-accordion .kit-accordion-item .kit-accordion-item--title[disabled],
|
|
104
|
+
.kit-accordion .kit-accordion-item .kit-accordion-item--title:disabled {
|
|
105
|
+
pointer-events: none;
|
|
106
|
+
user-select: none;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.kit-accordion .kit-accordion-item .kit-accordion-item--title.kit-accordion-item--disabled > *,
|
|
110
|
+
.kit-accordion .kit-accordion-item .kit-accordion-item--title[disabled] > *,
|
|
111
|
+
.kit-accordion .kit-accordion-item .kit-accordion-item--title:disabled > * {
|
|
112
|
+
opacity: 0.6;
|
|
113
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getAssets } from '../../internal/assets.svelte.js';
|
|
3
|
+
import type { AccordionProps } from './types.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(),
|
|
7
|
+
children,
|
|
8
|
+
is = 'div',
|
|
9
|
+
dark,
|
|
10
|
+
light,
|
|
11
|
+
color,
|
|
12
|
+
background,
|
|
13
|
+
spacer,
|
|
14
|
+
hideIcon,
|
|
15
|
+
...rest
|
|
16
|
+
}: AccordionProps = $props();
|
|
17
|
+
|
|
18
|
+
const assets = getAssets();
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<svelte:element
|
|
22
|
+
this={is}
|
|
23
|
+
bind:this={ref}
|
|
24
|
+
{...rest}
|
|
25
|
+
class={[
|
|
26
|
+
'kit-accordion',
|
|
27
|
+
spacer && 'kit-accordion--spacer',
|
|
28
|
+
hideIcon && 'kit-accordion--hide-icon',
|
|
29
|
+
light && 'light',
|
|
30
|
+
dark && 'dark',
|
|
31
|
+
rest.class
|
|
32
|
+
]}
|
|
33
|
+
style:--base={assets.color(background)}
|
|
34
|
+
style:--on={assets.color(color)}
|
|
35
|
+
>
|
|
36
|
+
{@render children?.()}
|
|
37
|
+
</svelte:element>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function useAccordion({ multiple = false, readOnly = false } = {}) {
|
|
2
|
+
// state
|
|
3
|
+
let openIndex = $state([10]);
|
|
4
|
+
return {
|
|
5
|
+
get values() {
|
|
6
|
+
return openIndex;
|
|
7
|
+
},
|
|
8
|
+
toggle(id) {
|
|
9
|
+
if (!readOnly) {
|
|
10
|
+
if (multiple) {
|
|
11
|
+
if (openIndex.includes(id)) {
|
|
12
|
+
openIndex = openIndex.filter((i) => i !== id);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
openIndex = [...openIndex, id];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
openIndex = openIndex.includes(id) ? [] : [id];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getAssets } from '../../../internal/assets.svelte.js';
|
|
3
|
+
import type { AccordionItemProps, ModelAccordionItemProps } from '../types.js';
|
|
4
|
+
|
|
5
|
+
// components
|
|
6
|
+
import Icon from '../../icon/icon.svelte';
|
|
7
|
+
|
|
8
|
+
// assets
|
|
9
|
+
import ArrowUp from '../../../assets/icons/arrow-up.svelte';
|
|
10
|
+
import ArrowDown from '../../../assets/icons/arrow-down.svelte';
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
activator,
|
|
14
|
+
children,
|
|
15
|
+
indicator,
|
|
16
|
+
ref = $bindable(),
|
|
17
|
+
text,
|
|
18
|
+
is = 'div',
|
|
19
|
+
dark,
|
|
20
|
+
light,
|
|
21
|
+
rounded,
|
|
22
|
+
color,
|
|
23
|
+
background,
|
|
24
|
+
index,
|
|
25
|
+
open,
|
|
26
|
+
toggle,
|
|
27
|
+
disabled,
|
|
28
|
+
readOnly,
|
|
29
|
+
...rest
|
|
30
|
+
}: AccordionItemProps = $props();
|
|
31
|
+
|
|
32
|
+
const assets = getAssets();
|
|
33
|
+
|
|
34
|
+
let model: ModelAccordionItemProps = {
|
|
35
|
+
get open() {
|
|
36
|
+
return open !== undefined ? open : false;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<svelte:element
|
|
42
|
+
this={is}
|
|
43
|
+
bind:this={ref}
|
|
44
|
+
{...rest}
|
|
45
|
+
class={[
|
|
46
|
+
'kit-accordion-item',
|
|
47
|
+
light && 'light',
|
|
48
|
+
dark && 'dark',
|
|
49
|
+
open && 'kit-accordion-item--active',
|
|
50
|
+
rest.class
|
|
51
|
+
]}
|
|
52
|
+
style:--base={assets.color(background)}
|
|
53
|
+
style:--on={assets.color(color)}
|
|
54
|
+
style:--shape={assets.shape(rounded)}
|
|
55
|
+
>
|
|
56
|
+
<button
|
|
57
|
+
class={[
|
|
58
|
+
'kit-accordion-item--title',
|
|
59
|
+
disabled && 'kit-accordion-item--disabled',
|
|
60
|
+
dark && 'dark',
|
|
61
|
+
open && 'kit-accordion-item--active',
|
|
62
|
+
rest.class
|
|
63
|
+
]}
|
|
64
|
+
onclick={() => toggle && !readOnly && !disabled && toggle(index)}
|
|
65
|
+
aria-expanded={open}
|
|
66
|
+
type="button"
|
|
67
|
+
{disabled}
|
|
68
|
+
>
|
|
69
|
+
{#if activator}
|
|
70
|
+
{@render activator?.()}
|
|
71
|
+
{:else}
|
|
72
|
+
{text}
|
|
73
|
+
{/if}
|
|
74
|
+
|
|
75
|
+
<span class="kit-accordion-item--icon">
|
|
76
|
+
{#if indicator}
|
|
77
|
+
{@render indicator?.(model)}
|
|
78
|
+
{:else if open}
|
|
79
|
+
<Icon>
|
|
80
|
+
<ArrowUp />
|
|
81
|
+
</Icon>
|
|
82
|
+
{:else}
|
|
83
|
+
<Icon>
|
|
84
|
+
<ArrowDown />
|
|
85
|
+
</Icon>
|
|
86
|
+
{/if}
|
|
87
|
+
</span>
|
|
88
|
+
</button>
|
|
89
|
+
<div class="kit-accordion-item--text" style:display={!open ? 'none' : ''}>
|
|
90
|
+
<div class="kit-accordion-item--text-wrapper">
|
|
91
|
+
{@render children?.()}
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
</svelte:element>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Component } from '../../internal/types.js';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
export interface AccordionProps extends Component {
|
|
4
|
+
ref?: HTMLElement | null;
|
|
5
|
+
is?: 'div';
|
|
6
|
+
text?: string;
|
|
7
|
+
dark?: boolean;
|
|
8
|
+
light?: boolean;
|
|
9
|
+
color?: string;
|
|
10
|
+
background?: string;
|
|
11
|
+
spacer?: boolean;
|
|
12
|
+
hideIcon?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface AccordionItemProps extends Component {
|
|
15
|
+
index: number | string;
|
|
16
|
+
indicator?: Snippet<[ModelAccordionItemProps]>;
|
|
17
|
+
activator?: Snippet;
|
|
18
|
+
ref?: HTMLElement | null;
|
|
19
|
+
is?: 'div';
|
|
20
|
+
text?: string;
|
|
21
|
+
dark?: boolean;
|
|
22
|
+
light?: boolean;
|
|
23
|
+
rounded?: string;
|
|
24
|
+
color?: string;
|
|
25
|
+
background?: string;
|
|
26
|
+
readOnly?: boolean;
|
|
27
|
+
open?: boolean;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
toggle?: (index: number | string) => void;
|
|
30
|
+
}
|
|
31
|
+
export type ModelAccordionItemProps = {
|
|
32
|
+
open: boolean;
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|