lapikit 0.0.0-insiders.b2fe678 → 0.0.0-insiders.cee8a41

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.
Files changed (78) hide show
  1. package/LICENSE +21 -0
  2. package/dist/assets/icons/loading-fill.svelte +29 -0
  3. package/dist/assets/icons/loading-fill.svelte.d.ts +26 -0
  4. package/dist/components/app/app.css +16 -0
  5. package/dist/components/app/app.svelte +25 -0
  6. package/dist/components/app/app.svelte.d.ts +7 -0
  7. package/dist/components/app/types.d.ts +4 -0
  8. package/dist/components/app/types.js +1 -0
  9. package/dist/components/button/button.css +276 -0
  10. package/dist/components/button/button.svelte +94 -0
  11. package/dist/components/button/button.svelte.d.ts +4 -0
  12. package/dist/components/button/types.d.ts +27 -0
  13. package/dist/components/button/types.js +1 -0
  14. package/dist/components/dialog/dialog.css +134 -0
  15. package/dist/components/dialog/dialog.svelte +67 -0
  16. package/dist/components/dialog/dialog.svelte.d.ts +4 -0
  17. package/dist/components/dialog/types.d.ts +24 -0
  18. package/dist/components/dialog/types.js +1 -0
  19. package/dist/components/dropdown/dropdown.css +22 -0
  20. package/dist/components/dropdown/dropdown.svelte +116 -0
  21. package/dist/components/dropdown/dropdown.svelte.d.ts +4 -0
  22. package/dist/components/dropdown/dropdown.svelte.js +148 -0
  23. package/dist/components/dropdown/types.d.ts +26 -0
  24. package/dist/components/dropdown/types.js +1 -0
  25. package/dist/components/icon/icon.css +76 -0
  26. package/dist/components/icon/icon.svelte +49 -0
  27. package/dist/components/icon/icon.svelte.d.ts +4 -0
  28. package/dist/components/icon/types.d.ts +16 -0
  29. package/dist/components/icon/types.js +1 -0
  30. package/dist/components/index.d.ts +11 -0
  31. package/dist/components/index.js +12 -0
  32. package/dist/components/list/list.css +193 -0
  33. package/dist/components/list/list.svelte +46 -0
  34. package/dist/components/list/list.svelte.d.ts +4 -0
  35. package/dist/components/list/modules/list-item.svelte +68 -0
  36. package/dist/components/list/modules/list-item.svelte.d.ts +4 -0
  37. package/dist/components/list/types.d.ts +36 -0
  38. package/dist/components/list/types.js +1 -0
  39. package/dist/components/modal/modal.css +140 -0
  40. package/dist/components/modal/modal.svelte +112 -0
  41. package/dist/components/modal/modal.svelte.d.ts +4 -0
  42. package/dist/components/modal/types.d.ts +26 -0
  43. package/dist/components/modal/types.js +1 -0
  44. package/dist/components/popover/popover.css +22 -0
  45. package/dist/components/popover/popover.svelte +73 -0
  46. package/dist/components/popover/popover.svelte.d.ts +4 -0
  47. package/dist/components/popover/popover.svelte.js +134 -0
  48. package/dist/components/popover/types.d.ts +20 -0
  49. package/dist/components/popover/types.js +1 -0
  50. package/dist/components/separator/separator.css +46 -0
  51. package/dist/components/separator/separator.svelte +37 -0
  52. package/dist/components/separator/separator.svelte.d.ts +4 -0
  53. package/dist/components/separator/types.d.ts +11 -0
  54. package/dist/components/separator/types.js +1 -0
  55. package/dist/components/tooltip/tooltip.css +124 -0
  56. package/dist/components/tooltip/tooltip.svelte +113 -0
  57. package/dist/components/tooltip/tooltip.svelte.d.ts +4 -0
  58. package/dist/components/tooltip/tooltip.svelte.js +131 -0
  59. package/dist/components/tooltip/types.d.ts +23 -0
  60. package/dist/components/tooltip/types.js +1 -0
  61. package/dist/internal/assets.svelte.d.ts +8 -0
  62. package/dist/internal/assets.svelte.js +52 -0
  63. package/dist/internal/clickOutside.d.ts +9 -0
  64. package/dist/internal/clickOutside.js +34 -0
  65. package/dist/internal/index.d.ts +2 -0
  66. package/dist/internal/index.js +2 -0
  67. package/dist/internal/scroll.d.ts +1 -0
  68. package/dist/internal/scroll.js +6 -0
  69. package/dist/internal/types.d.ts +13 -0
  70. package/dist/preset.js +14 -2
  71. package/dist/stores/index.d.ts +9 -0
  72. package/dist/stores/index.js +42 -0
  73. package/dist/style/animation.css +20 -0
  74. package/dist/style/css.js +6 -3
  75. package/dist/style/parser/color.js +13 -2
  76. package/dist/style/variable.css +12 -0
  77. package/dist/utils/x11.d.ts +1 -1
  78. package/package.json +11 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Nycolaide <https://github.com/Nycolaide>.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,29 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
2
+ ><defs
3
+ ><linearGradient id="a" x1="50%" x2="50%" y1="5.271%" y2="91.793%"
4
+ ><stop offset="0%" stop-color="currentColor" /><stop
5
+ offset="100%"
6
+ stop-color="currentColor"
7
+ stop-opacity=".55"
8
+ /></linearGradient
9
+ ><linearGradient id="b" x1="50%" x2="50%" y1="15.24%" y2="87.15%"
10
+ ><stop offset="0%" stop-color="currentColor" stop-opacity="0" /><stop
11
+ offset="100%"
12
+ stop-color="currentColor"
13
+ stop-opacity=".55"
14
+ /></linearGradient
15
+ ></defs
16
+ ><g fill="none"
17
+ ><path
18
+ 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"
19
+ /><path
20
+ fill="url(#a)"
21
+ 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"
22
+ transform="translate(1.5 1.625)"
23
+ /><path
24
+ fill="url(#b)"
25
+ 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"
26
+ transform="translate(1.5 1.625)"
27
+ /></g
28
+ ></svg
29
+ >
@@ -0,0 +1,26 @@
1
+ export default LoadingFill;
2
+ type LoadingFill = SvelteComponent<{
3
+ [x: string]: never;
4
+ }, {
5
+ [evt: string]: CustomEvent<any>;
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
8
+ };
9
+ declare const LoadingFill: $$__sveltets_2_IsomorphicComponent<{
10
+ [x: string]: never;
11
+ }, {
12
+ [evt: string]: CustomEvent<any>;
13
+ }, {}, {}, string>;
14
+ 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> {
15
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
16
+ $$bindings?: Bindings;
17
+ } & Exports;
18
+ (internal: unknown, props: {
19
+ $$events?: Events;
20
+ $$slots?: Slots;
21
+ }): Exports & {
22
+ $set?: any;
23
+ $on?: any;
24
+ };
25
+ z_$$bindings?: Bindings;
26
+ }
@@ -0,0 +1,16 @@
1
+ .kit-overlay {
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ height: 100%;
6
+ width: 100%;
7
+ background-color: color-mix(in oklab, var(--kit-shadow) 45%, transparent);
8
+ z-index: 9000;
9
+ cursor: default;
10
+ }
11
+
12
+ .kit-overlay.kit-overlay--persistent {
13
+ /* pointer-events: none; */
14
+ user-select: none;
15
+ cursor: default;
16
+ }
@@ -0,0 +1,25 @@
1
+ <script lang="ts">
2
+ import { BROWSER } from 'esm-env';
3
+ import { modalOpen, setOpenModal, updateThemeStore } from '../../stores/index.js';
4
+ import type { Snippet } from 'svelte';
5
+ let { children }: { children: Snippet } = $props();
6
+
7
+ $effect.pre(() => {
8
+ if (!BROWSER) return;
9
+ const local = localStorage.getItem('@lapikit/theme');
10
+ if (local !== null) updateThemeStore(local as 'dark' | 'light' | 'auto');
11
+ });
12
+ </script>
13
+
14
+ {$modalOpen ? ($modalOpen === 'persistent' ? 'persistent' : 'true') : 'false'}
15
+
16
+ {@render children?.()}
17
+
18
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
19
+ {#if $modalOpen}
20
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
21
+ <div
22
+ class={['kit-overlay', $modalOpen === 'persistent' && 'kit-overlay--persistent']}
23
+ onclick={() => $modalOpen !== 'persistent' && setOpenModal(false)}
24
+ ></div>
25
+ {/if}
@@ -0,0 +1,7 @@
1
+ import type { Snippet } from 'svelte';
2
+ type $$ComponentProps = {
3
+ children: Snippet;
4
+ };
5
+ declare const App: import("svelte").Component<$$ComponentProps, {}, "">;
6
+ type App = ReturnType<typeof App>;
7
+ export default App;
@@ -0,0 +1,4 @@
1
+ import type { Snippet } from 'svelte';
2
+ export interface AppProps {
3
+ children?: Snippet;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,276 @@
1
+ .kit-btn {
2
+ --btn-color: var(--on, var(--kit-on-neutral));
3
+ --btn-background: var(--base, var(--kit-neutral));
4
+ --btn-radius: var(--shape, var(--kit-radius-md));
5
+
6
+ display: inline-flex;
7
+ align-items: center;
8
+ justify-content: center;
9
+ white-space: nowrap;
10
+ padding-top: var(--btn-spacing-x);
11
+ padding-bottom: var(--btn-spacing-x);
12
+ padding-right: var(--btn-spacing-y);
13
+ padding-left: var(--btn-spacing-y);
14
+ cursor: pointer;
15
+
16
+ border-width: 1px;
17
+ border-style: solid;
18
+ border-radius: var(--btn-radius);
19
+
20
+ /* theme */
21
+ color: var(--btn-color);
22
+ background-color: var(--btn-background);
23
+ border-color: var(--btn-background);
24
+ }
25
+
26
+ .kit-btn .kit-btn-content,
27
+ .kit-btn .kit-btn-loading {
28
+ display: inline-flex;
29
+ align-items: center;
30
+ justify-content: center;
31
+ white-space: nowrap;
32
+ gap: var(--btn-gap);
33
+ }
34
+
35
+ .kit-btn:active:hover,
36
+ .kit-btn:active:focus {
37
+ animation: button-click 0s ease-out;
38
+ transform: scale(0.97);
39
+ }
40
+
41
+ /* size */
42
+ .kit-btn[breakpoint]kit-btn--size-xs {
43
+ --btn-height: 1.75rem;
44
+ --btn-multiplier-y: 2;
45
+ --btn-gap: 0.25rem;
46
+ font-size: 0.75rem;
47
+ gap: var(--btn-gap);
48
+ }
49
+
50
+ .kit-btn[breakpoint]kit-btn--size-sm {
51
+ --btn-height: 2rem;
52
+ --btn-multiplier-y: 3;
53
+ --btn-gap: 0.5rem;
54
+ font-size: 0.875rem;
55
+ gap: var(--btn-gap);
56
+ }
57
+
58
+ .kit-btn[breakpoint]kit-btn--size-md {
59
+ --btn-height: 2.25rem;
60
+ --btn-multiplier-y: 4;
61
+ --btn-gap: 0.5rem;
62
+ font-size: 0.875rem;
63
+ gap: var(--btn-gap);
64
+ }
65
+
66
+ .kit-btn[breakpoint]kit-btn--size-lg {
67
+ --btn-height: 2.5rem;
68
+ --btn-multiplier-y: 5;
69
+ --btn-gap: 0.5rem;
70
+ font-size: 1rem;
71
+ gap: var(--btn-gap);
72
+ }
73
+
74
+ .kit-btn[breakpoint]kit-btn--size-xl {
75
+ --btn-height: 2.75rem;
76
+ --btn-multiplier-y: 6;
77
+ --btn-gap: 0.675rem;
78
+ font-size: 1.125rem;
79
+ gap: var(--btn-gap);
80
+ }
81
+
82
+ /* density */
83
+ .kit-btn:not(.kit-btn--icon)[breakpoint]kit-btn--density-default {
84
+ height: calc(var(--btn-height));
85
+ min-width: calc(var(--btn-height));
86
+ --btn-spacing-x: 0;
87
+ --btn-spacing-y: calc(var(--kit-spacing) * var(--btn-multiplier-y));
88
+ }
89
+ .kit-btn.kit-btn--icon[breakpoint]kit-btn--density-default {
90
+ height: calc(var(--btn-height));
91
+ width: calc(var(--btn-height));
92
+ --btn-spacing-x: 0;
93
+ --btn-spacing-y: 0;
94
+ }
95
+
96
+ .kit-btn:not(.kit-btn--icon)[breakpoint]kit-btn--density-compact {
97
+ height: calc(var(--btn-height) - 0.25rem);
98
+ min-width: calc(var(--btn-height - 0.25rem));
99
+ --btn-spacing-x: 0;
100
+ --btn-spacing-y: calc(var(--kit-spacing) * var(--btn-multiplier-y) - 0.25rem);
101
+ }
102
+ .kit-btn.kit-btn--icon[breakpoint]kit-btn--density-compact {
103
+ height: calc(var(--btn-height) - 0.25rem);
104
+ width: calc(var(--btn-height) - 0.25rem);
105
+ --btn-spacing-x: 0;
106
+ --btn-spacing-y: 0;
107
+ }
108
+
109
+ .kit-btn:not(.kit-btn--icon)[breakpoint]kit-btn--density-comfortable {
110
+ height: calc(var(--btn-height) + 0.25rem);
111
+ min-width: calc(var(--btn-height) + 0.25rem);
112
+ --btn-spacing-x: 0;
113
+ --btn-spacing-y: calc(var(--kit-spacing) * var(--btn-multiplier-y) + 0.25rem);
114
+ }
115
+ .kit-btn.kit-btn--icon[breakpoint]kit-btn--density-comfortable {
116
+ height: calc(var(--btn-height) + 0.25rem);
117
+ width: calc(var(--btn-height) + 0.25rem);
118
+ --btn-spacing-x: 0;
119
+ --btn-spacing-y: 0;
120
+ }
121
+
122
+ /* variant */
123
+ .kit-btn[breakpoint]kit-btn--variant-outline {
124
+ --btn-color: var(--base, var(--kit-neutral));
125
+ background-color: transparent;
126
+ border: 1px solid currentColor;
127
+ }
128
+
129
+ .kit-btn[breakpoint]kit-btn--variant-text {
130
+ --btn-color: var(--base, var(--kit-neutral));
131
+ background-color: transparent;
132
+ border-color: transparent;
133
+ }
134
+
135
+ .kit-btn[breakpoint]kit-btn--variant-dash {
136
+ --btn-color: var(--base, var(--kit-neutral));
137
+ background-color: transparent;
138
+ border: 1px dashed currentColor;
139
+ }
140
+
141
+ .kit-btn[breakpoint]kit-btn--variant-link {
142
+ --btn-color: var(--base, var(--kit-neutral));
143
+ background-color: transparent;
144
+ border-color: transparent;
145
+ }
146
+
147
+ /* state */
148
+ .kit-btn.kit-btn--info:not([class*='btn--variant-']) {
149
+ --on: var(--kit-on-info);
150
+ --base: var(--kit-info);
151
+ }
152
+ .kit-btn.kit-btn--info[class*='btn--variant-'] {
153
+ --base: var(--kit-info);
154
+ }
155
+
156
+ .kit-btn.kit-btn--success:not([class*='btn--variant-']) {
157
+ --on: var(--kit-on-success);
158
+ --base: var(--kit-success);
159
+ }
160
+ .kit-btn.kit-btn--success[class*='btn--variant-'] {
161
+ --base: var(--kit-success);
162
+ }
163
+
164
+ .kit-btn.kit-btn--warning:not([class*='btn--variant-']) {
165
+ --on: var(--kit-on-warning);
166
+ --base: var(--kit-warning);
167
+ }
168
+ .kit-btn.kit-btn--warning[class*='btn--variant-'] {
169
+ --base: var(--kit-warning);
170
+ }
171
+
172
+ .kit-btn.kit-btn--error:not([class*='btn--variant-']) {
173
+ --on: var(--kit-on-error);
174
+ --base: var(--kit-error);
175
+ }
176
+ .kit-btn.kit-btn--error[class*='btn--variant-'] {
177
+ --base: var(--kit-error);
178
+ }
179
+
180
+ /* types */
181
+ .kit-btn:where(.kit-btn:is(input[type='checkbox'])),
182
+ .kit-btn:where(.kit-btn:is(input[type='radio'])) {
183
+ width: auto;
184
+ -webkit-appearance: none;
185
+ -moz-appearance: none;
186
+ appearance: none;
187
+ vertical-align: inherit;
188
+ }
189
+ .kit-btn:is(input[type='checkbox']):after,
190
+ .kit-btn:is(input[type='radio']):after {
191
+ --btn-content: attr(aria-label);
192
+ content: var(--btn-content);
193
+ }
194
+
195
+ .kit-btn:is(input[type='checkbox']):focus,
196
+ .kit-btn:is(input[type='radio']):focus {
197
+ outline: none;
198
+ outline-offset: inherit;
199
+ box-shadow: none;
200
+ }
201
+
202
+ .kit-btn:is(input[type='checkbox']):checked,
203
+ .kit-btn:is(input[type='radio']):checked {
204
+ background-image: initial;
205
+ }
206
+
207
+ /* events */
208
+ .kit-btn.kit-btn--active:not([class*='btn--variant-']),
209
+ .kit-btn:not([class*='btn--variant-']):is(input[type='radio']):checked,
210
+ .kit-btn:not([class*='btn--variant-']):is(input[type='checkbox']):checked {
211
+ background-color: color-mix(in oklab, var(--btn-background) 90%, var(--kit-scrim));
212
+ border-color: color-mix(in oklab, var(--btn-background) 90%, var(--kit-scrim));
213
+ }
214
+ .kit-btn.kit-btn--active[class*='btn--variant-'],
215
+ .kit-btn[class*='btn--variant-']:is(input[type='radio']):checked,
216
+ .kit-btn[class*='btn--variant-']:is(input[type='checkbox']):checked {
217
+ background-color: color-mix(in oklab, currentColor 15%, transparent);
218
+ border-color: color-mix(in oklab, currentColor 15%, transparent);
219
+ }
220
+
221
+ .kit-btn:hover:not([class*='btn--variant-']),
222
+ .kit-btn:not([class*='btn--variant-']):is(input[type='radio']):hover,
223
+ .kit-btn:not([class*='btn--variant-']):is(input[type='checkbox']):hover {
224
+ background-color: color-mix(in oklab, var(--btn-background) 85%, var(--kit-scrim));
225
+ border-color: color-mix(in oklab, var(--btn-background) 85%, var(--kit-scrim));
226
+ }
227
+ .kit-btn:hover[class*='btn--variant-'],
228
+ .kit-btn[class*='btn--variant-']:is(input[type='radio']):hover,
229
+ .kit-btn[class*='btn--variant-']:is(input[type='checkbox']):hover {
230
+ background-color: color-mix(in oklab, currentColor 25%, transparent);
231
+ }
232
+
233
+ /* icon */
234
+ .kit-btn i:before {
235
+ color: var(--btn-color);
236
+ }
237
+
238
+ /* disabled */
239
+ .kit-btn.kit-btn--disabled,
240
+ .kit-btn[disabled],
241
+ input.kit-btn.kit-btn--disabled,
242
+ input.kit-btn[disabled] {
243
+ pointer-events: none;
244
+ user-select: none;
245
+ cursor: default;
246
+ }
247
+ .kit-btn:not([class*='btn--variant-']).kit-btn--disabled {
248
+ color: color-mix(in oklab, var(--btn-color) 40%, transparent) !important;
249
+ background-color: color-mix(in oklab, var(--btn-background) 70%, transparent) !important;
250
+ border-color: color-mix(in oklab, var(--btn-background) 70%, transparent) !important;
251
+ }
252
+ .kit-btn:not([class*='btn--variant-']).kit-btn--disabled i:before {
253
+ color: color-mix(in oklab, var(--btn-color) 40%, transparent) !important;
254
+ }
255
+ .kit-btn[class*='btn--variant-'].kit-btn--disabled,
256
+ .kit-btn[class*='btn--variant-'].kit-btn--disabled i:before {
257
+ color: color-mix(in oklab, var(--btn-background) 40%, transparent) !important;
258
+ }
259
+
260
+ /* loading */
261
+ .kit-btn.kit-btn--loading {
262
+ pointer-events: none;
263
+ user-select: none;
264
+ cursor: default;
265
+ }
266
+ .kit-btn.kit-btn--loading > .kit-btn-content {
267
+ color: transparent;
268
+ opacity: 0;
269
+ }
270
+ .kit-btn.kit-btn--loading > .kit-btn-loading {
271
+ position: absolute;
272
+ min-width: fit-content;
273
+ }
274
+ .kit-btn.kit-btn--loading > .kit-btn-loading .kit-icon-load {
275
+ animation: icon-rotate 1s ease-out infinite;
276
+ }
@@ -0,0 +1,94 @@
1
+ <script lang="ts">
2
+ import { getAssets } from '../../internal/index.js';
3
+ import { Icon } from '../index.js';
4
+ import type { BtnProps } from './types.js';
5
+
6
+ // external
7
+ import LoadingFill from '../../assets/icons/loading-fill.svelte';
8
+
9
+ let {
10
+ children,
11
+ ref = $bindable(),
12
+ is = 'button',
13
+ href,
14
+ dark,
15
+ light,
16
+ active,
17
+ variant,
18
+ error,
19
+ info,
20
+ success,
21
+ warning,
22
+ density = 'default',
23
+ disabled,
24
+ size = 'md',
25
+ type = 'button',
26
+ background,
27
+ color,
28
+ label,
29
+ loading,
30
+ rounded,
31
+ icon,
32
+ load,
33
+ ...rest
34
+ }: BtnProps = $props();
35
+
36
+ const assets = getAssets();
37
+
38
+ $effect(() => {
39
+ if (type === 'radio') is = 'input';
40
+ if (type === 'checkbox') is = 'input';
41
+ if (type === 'submit') is = 'input';
42
+ if (type === 'reset') is = 'input';
43
+ });
44
+ </script>
45
+
46
+ <svelte:element
47
+ this={href ? 'a' : is}
48
+ bind:this={ref}
49
+ {...rest}
50
+ href={href && !disabled ? href : undefined}
51
+ class={[
52
+ 'kit-btn',
53
+ light && 'light',
54
+ dark && 'dark',
55
+ size && assets.className('btn', 'size', size),
56
+ variant && assets.className('btn', 'variant', variant),
57
+ density && assets.className('btn', 'density', density),
58
+ error && 'kit-btn--error',
59
+ info && 'kit-btn--info',
60
+ success && 'kit-btn--success',
61
+ warning && 'kit-btn--warning',
62
+ disabled && 'kit-btn--disabled',
63
+ active && 'kit-btn--active',
64
+ loading && 'kit-btn--loading',
65
+ icon && 'kit-btn--icon',
66
+ rest.class
67
+ ]}
68
+ tabindex={href && disabled ? -1 : 0}
69
+ aria-disabled={href ? disabled : undefined}
70
+ aria-label={type !== 'button' ? label : undefined}
71
+ disabled={href ? undefined : disabled}
72
+ type={href ? undefined : type}
73
+ style:--base={assets.color(background)}
74
+ style:--on={assets.color(color)}
75
+ style:--shape={assets.shape(rounded)}
76
+ >
77
+ {#if loading}
78
+ <div class="kit-btn-loading">
79
+ {#if load}
80
+ {@render load?.()}
81
+ {:else}
82
+ <Icon class="kit-icon-load">
83
+ <LoadingFill />
84
+ </Icon>
85
+ {/if}
86
+ </div>
87
+ {/if}
88
+
89
+ {#if !label}
90
+ <span class="kit-btn-content">
91
+ {@render children?.()}
92
+ </span>
93
+ {/if}
94
+ </svelte:element>
@@ -0,0 +1,4 @@
1
+ import type { BtnProps } from './types.js';
2
+ declare const Button: import("svelte").Component<BtnProps, {}, "ref">;
3
+ type Button = ReturnType<typeof Button>;
4
+ export default Button;
@@ -0,0 +1,27 @@
1
+ import type { Component } from '../../internal/types.js';
2
+ import type { Snippet } from 'svelte';
3
+ export interface BtnProps extends Component {
4
+ ref?: HTMLElement | null;
5
+ is?: 'button' | 'a' | 'input';
6
+ dark?: boolean;
7
+ light?: boolean;
8
+ href?: string;
9
+ variant?: 'outline' | 'text' | 'dash' | 'link';
10
+ density?: 'compact' | 'comfortable' | 'default';
11
+ active?: boolean;
12
+ loading?: boolean;
13
+ error?: boolean;
14
+ info?: boolean;
15
+ warning?: boolean;
16
+ success?: boolean;
17
+ disabled?: boolean;
18
+ color?: string;
19
+ background?: string;
20
+ size?: string | {
21
+ [key: string]: string;
22
+ };
23
+ type?: 'button' | 'submit' | 'reset' | 'radio' | 'checkbox';
24
+ label?: string;
25
+ icon?: boolean;
26
+ load?: Snippet;
27
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,134 @@
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 .close-dialog {
46
+ opacity: 0;
47
+ position: fixed;
48
+ top: 0;
49
+ z-index: -1;
50
+ }
51
+
52
+ .kit-dialog[breakpoint]kit-dialog--position-bottom {
53
+ margin-bottom: 0;
54
+ margin-top: auto;
55
+ }
56
+
57
+ .kit-dialog[breakpoint]kit-dialog--position-top {
58
+ margin-top: 0;
59
+ margin-bottom: auto;
60
+ }
61
+
62
+ .kit-dialog[breakpoint]kit-dialog--position-center {
63
+ margin: auto;
64
+ }
65
+
66
+ .kit-dialog[breakpoint]kit-dialog--size-xs {
67
+ max-width: var(--kit-dialog-size-xs);
68
+ }
69
+
70
+ .kit-dialog[breakpoint]kit-dialog--size-sm {
71
+ max-width: var(--kit-dialog-size-sm);
72
+ height: fit-content;
73
+ }
74
+
75
+ .kit-dialog[breakpoint]kit-dialog--size-md {
76
+ max-width: var(--kit-dialog-size-md);
77
+ height: fit-content;
78
+ }
79
+
80
+ .kit-dialog[breakpoint]kit-dialog--size-lg {
81
+ max-width: var(--kit-dialog-size-lg);
82
+ height: fit-content;
83
+ }
84
+
85
+ .kit-dialog[breakpoint]kit-dialog--size-xl {
86
+ max-width: var(--kit-dialog-size-xl);
87
+ height: fit-content;
88
+ }
89
+
90
+ .kit-dialog[breakpoint]kit-dialog--size-xs .kit-dialog-container {
91
+ max-height: calc(100% - 3rem);
92
+ margin: 0 auto;
93
+ }
94
+ .kit-dialog[breakpoint]kit-dialog--size-sm .kit-dialog-container {
95
+ max-height: calc(100% - 3rem);
96
+ margin: 0 auto;
97
+ }
98
+ .kit-dialog[breakpoint]kit-dialog--size-md .kit-dialog-container {
99
+ max-height: calc(100% - 3rem);
100
+ margin: 0 auto;
101
+ }
102
+ .kit-dialog[breakpoint]kit-dialog--size-lg .kit-dialog-container {
103
+ max-height: calc(100% - 3rem);
104
+ margin: 0 auto;
105
+ }
106
+ .kit-dialog[breakpoint]kit-dialog--size-xl .kit-dialog-container {
107
+ max-height: calc(100% - 3rem);
108
+ margin: 0 auto;
109
+ }
110
+
111
+ /* density */
112
+ .kit-dialog .kit-dialog-container[breakpoint]kit-dialog-container--density-default {
113
+ --dialog-spacing-x: 0.5rem;
114
+ --dialog-spacing-y: 0.5rem;
115
+ }
116
+
117
+ .kit-dialog .kit-dialog-container[breakpoint]kit-dialog-container--density-compact {
118
+ --dialog-spacing-x: 0.25rem;
119
+ --dialog-spacing-y: 0.25rem;
120
+ }
121
+
122
+ .kit-dialog .kit-dialog-container[breakpoint]kit-dialog-container--density-comfortable {
123
+ --dialog-spacing-x: 0.75rem;
124
+ --dialog-spacing-y: 0.75rem;
125
+ }
126
+
127
+ @keyframes fade {
128
+ from {
129
+ opacity: 0;
130
+ }
131
+ to {
132
+ opacity: 1;
133
+ }
134
+ }