lapikit 0.0.0-insiders.e330f8d → 0.0.0-insiders.efb49b7

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 (104) hide show
  1. package/dist/actions/index.d.ts +1 -0
  2. package/dist/actions/index.js +1 -0
  3. package/dist/assets/icons/arrow-down.svelte +10 -0
  4. package/dist/assets/icons/arrow-down.svelte.d.ts +26 -0
  5. package/dist/assets/icons/arrow-up.svelte +10 -0
  6. package/dist/assets/icons/arrow-up.svelte.d.ts +26 -0
  7. package/dist/assets/icons/close-fill.svelte +10 -0
  8. package/dist/assets/icons/close-fill.svelte.d.ts +26 -0
  9. package/dist/assets/icons/loading-fill.svelte +29 -0
  10. package/dist/assets/icons/loading-fill.svelte.d.ts +26 -0
  11. package/dist/components/accordion/accordion.css +113 -0
  12. package/dist/components/accordion/accordion.svelte +37 -0
  13. package/dist/components/accordion/accordion.svelte.d.ts +4 -0
  14. package/dist/components/accordion/accordion.svelte.js +24 -0
  15. package/dist/components/accordion/modules/accordion-item.svelte +94 -0
  16. package/dist/components/accordion/modules/accordion-item.svelte.d.ts +4 -0
  17. package/dist/components/accordion/types.d.ts +33 -0
  18. package/dist/components/accordion/types.js +1 -0
  19. package/dist/components/alert/alert.css +127 -0
  20. package/dist/components/alert/alert.svelte +89 -0
  21. package/dist/components/alert/alert.svelte.d.ts +4 -0
  22. package/dist/components/alert/types.d.ts +28 -0
  23. package/dist/components/alert/types.js +1 -0
  24. package/dist/components/app/app.css +16 -0
  25. package/dist/components/app/app.svelte +12 -1
  26. package/dist/components/aspect-ratio/aspect-ratio.css +19 -0
  27. package/dist/components/aspect-ratio/aspect-ratio.svelte +25 -0
  28. package/dist/components/aspect-ratio/aspect-ratio.svelte.d.ts +4 -0
  29. package/dist/components/aspect-ratio/types.d.ts +5 -0
  30. package/dist/components/aspect-ratio/types.js +1 -0
  31. package/dist/components/avatar/avatar.css +109 -0
  32. package/dist/components/avatar/avatar.svelte +46 -0
  33. package/dist/components/avatar/avatar.svelte.d.ts +4 -0
  34. package/dist/components/avatar/types.d.ts +22 -0
  35. package/dist/components/avatar/types.js +1 -0
  36. package/dist/components/button/button.css +44 -8
  37. package/dist/components/button/button.svelte +14 -1
  38. package/dist/components/button/types.d.ts +3 -0
  39. package/dist/components/chip/chip.css +17 -0
  40. package/dist/components/chip/chip.svelte +118 -0
  41. package/dist/components/chip/chip.svelte.d.ts +4 -0
  42. package/dist/components/chip/types.d.ts +30 -0
  43. package/dist/components/chip/types.js +1 -0
  44. package/dist/components/dialog/dialog.css +134 -0
  45. package/dist/components/dialog/dialog.svelte +67 -0
  46. package/dist/components/dialog/dialog.svelte.d.ts +4 -0
  47. package/dist/components/dialog/types.d.ts +24 -0
  48. package/dist/components/dialog/types.js +1 -0
  49. package/dist/components/dropdown/dropdown.css +22 -0
  50. package/dist/components/dropdown/dropdown.svelte +116 -0
  51. package/dist/components/dropdown/dropdown.svelte.d.ts +4 -0
  52. package/dist/components/dropdown/dropdown.svelte.js +148 -0
  53. package/dist/components/dropdown/types.d.ts +26 -0
  54. package/dist/components/dropdown/types.js +1 -0
  55. package/dist/components/icon/icon.css +76 -0
  56. package/dist/components/icon/icon.svelte +49 -0
  57. package/dist/components/icon/icon.svelte.d.ts +4 -0
  58. package/dist/components/icon/types.d.ts +16 -0
  59. package/dist/components/icon/types.js +1 -0
  60. package/dist/components/index.d.ts +14 -0
  61. package/dist/components/index.js +14 -0
  62. package/dist/components/list/list.css +195 -0
  63. package/dist/components/list/list.svelte +46 -0
  64. package/dist/components/list/list.svelte.d.ts +4 -0
  65. package/dist/components/list/modules/list-item.svelte +68 -0
  66. package/dist/components/list/modules/list-item.svelte.d.ts +4 -0
  67. package/dist/components/list/types.d.ts +36 -0
  68. package/dist/components/list/types.js +1 -0
  69. package/dist/components/modal/modal.css +140 -0
  70. package/dist/components/modal/modal.svelte +112 -0
  71. package/dist/components/modal/modal.svelte.d.ts +4 -0
  72. package/dist/components/modal/types.d.ts +26 -0
  73. package/dist/components/modal/types.js +1 -0
  74. package/dist/components/popover/popover.css +22 -0
  75. package/dist/components/popover/popover.svelte +73 -0
  76. package/dist/components/popover/popover.svelte.d.ts +4 -0
  77. package/dist/components/popover/popover.svelte.js +134 -0
  78. package/dist/components/popover/types.d.ts +20 -0
  79. package/dist/components/popover/types.js +1 -0
  80. package/dist/components/separator/separator.css +46 -0
  81. package/dist/components/separator/separator.svelte +37 -0
  82. package/dist/components/separator/separator.svelte.d.ts +4 -0
  83. package/dist/components/separator/types.d.ts +11 -0
  84. package/dist/components/separator/types.js +1 -0
  85. package/dist/components/tooltip/tooltip.css +124 -0
  86. package/dist/components/tooltip/tooltip.svelte +113 -0
  87. package/dist/components/tooltip/tooltip.svelte.d.ts +4 -0
  88. package/dist/components/tooltip/tooltip.svelte.js +131 -0
  89. package/dist/components/tooltip/types.d.ts +23 -0
  90. package/dist/components/tooltip/types.js +1 -0
  91. package/dist/internal/assets.svelte.d.ts +1 -0
  92. package/dist/internal/assets.svelte.js +11 -0
  93. package/dist/internal/clickOutside.d.ts +9 -0
  94. package/dist/internal/clickOutside.js +34 -0
  95. package/dist/internal/index.d.ts +1 -0
  96. package/dist/internal/index.js +1 -0
  97. package/dist/internal/scroll.d.ts +1 -0
  98. package/dist/internal/scroll.js +6 -0
  99. package/dist/stores/index.d.ts +5 -0
  100. package/dist/stores/index.js +21 -2
  101. package/dist/style/animation.css +9 -0
  102. package/dist/style/css.js +3 -0
  103. package/dist/style/variable.css +12 -0
  104. package/package.json +6 -2
@@ -0,0 +1,89 @@
1
+ <script lang="ts">
2
+ import { getAssets } from '../../internal/assets.svelte.js';
3
+ import type { AlertProps } from './types.js';
4
+
5
+ // components
6
+ import Icon from '../icon/icon.svelte';
7
+
8
+ // assets
9
+ import Close from '../../assets/icons/close-fill.svelte';
10
+
11
+ let {
12
+ children,
13
+ append,
14
+ prepend,
15
+ close,
16
+ ref = $bindable(),
17
+ open = $bindable(true),
18
+ is = 'div',
19
+ light,
20
+ dark,
21
+ variant,
22
+ density = 'default',
23
+ rounded,
24
+ warning,
25
+ info,
26
+ success,
27
+ error,
28
+ closable,
29
+ color,
30
+ background,
31
+ ...rest
32
+ }: AlertProps = $props();
33
+
34
+ const assets = getAssets();
35
+ </script>
36
+
37
+ {#if !closable || (open && closable)}
38
+ <svelte:element
39
+ this={is}
40
+ {...rest}
41
+ class={[
42
+ 'kit-alert',
43
+ light && 'light',
44
+ dark && 'dark',
45
+ variant && assets.className('alert', 'variant', variant),
46
+ density && assets.className('alert', 'density', density),
47
+ warning && 'kit-alert--warning',
48
+ info && 'kit-alert--info',
49
+ success && 'kit-alert--success',
50
+ error && 'kit-alert--error',
51
+ rest.class
52
+ ]}
53
+ role="alert"
54
+ style:--base={assets.color(background)}
55
+ style:--on={assets.color(color)}
56
+ style:--shape={assets.shape(rounded)}
57
+ >
58
+ {#if prepend}
59
+ <div class="kit-alert--prepend">
60
+ {@render prepend?.()}
61
+ </div>
62
+ {/if}
63
+ <span class="kit-alert--content">
64
+ {@render children?.()}
65
+ </span>
66
+ {#if append}
67
+ <div class="kit-alert--append">
68
+ {@render append?.()}
69
+ </div>
70
+ {/if}
71
+
72
+ {#if closable}
73
+ <button
74
+ class="kit-alert--close"
75
+ type="button"
76
+ aria-label="close"
77
+ onclick={() => (open = false)}
78
+ >
79
+ {#if close}
80
+ {@render close?.()}
81
+ {:else}
82
+ <Icon>
83
+ <Close />
84
+ </Icon>
85
+ {/if}
86
+ </button>
87
+ {/if}
88
+ </svelte:element>
89
+ {/if}
@@ -0,0 +1,4 @@
1
+ import type { AlertProps } from './types.js';
2
+ declare const Alert: import("svelte").Component<AlertProps, {}, "ref" | "open">;
3
+ type Alert = ReturnType<typeof Alert>;
4
+ export default Alert;
@@ -0,0 +1,28 @@
1
+ import type { Component } from '../../internal/types.js';
2
+ import type { Snippet } from 'svelte';
3
+ type AlertDensity = 'compact' | 'comfortable' | 'default';
4
+ type AlertVariant = 'outline' | 'dash' | 'text';
5
+ export interface AlertProps extends Component {
6
+ append?: Snippet;
7
+ prepend?: Snippet;
8
+ close?: Snippet;
9
+ href?: string;
10
+ is?: 'div';
11
+ dark?: boolean;
12
+ light?: boolean;
13
+ variant?: AlertVariant | {
14
+ [key: string]: AlertVariant;
15
+ };
16
+ density?: AlertDensity | {
17
+ [key: string]: AlertDensity;
18
+ };
19
+ rounded?: string;
20
+ closable?: boolean;
21
+ color?: string;
22
+ background?: string;
23
+ warning?: boolean;
24
+ info?: boolean;
25
+ success?: boolean;
26
+ error?: boolean;
27
+ }
28
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -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
+ }
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { BROWSER } from 'esm-env';
3
- import { updateThemeStore } from '../../stores/index.js';
3
+ import { modalOpen, setOpenModal, updateThemeStore } from '../../stores/index.js';
4
4
  import type { Snippet } from 'svelte';
5
5
  let { children }: { children: Snippet } = $props();
6
6
 
@@ -11,4 +11,15 @@
11
11
  });
12
12
  </script>
13
13
 
14
+ {$modalOpen ? ($modalOpen === 'persistent' ? 'persistent' : 'true') : 'false'}
15
+
14
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,19 @@
1
+ .kit-aspect-ratio {
2
+ display: flex;
3
+ flex: 1 0 auto;
4
+ max-height: 100%;
5
+ max-width: 100%;
6
+ overflow: hidden;
7
+ position: relative;
8
+ }
9
+
10
+ .kit-aspect-ratio--inline {
11
+ display: inline-flex;
12
+ flex: 0 0 auto;
13
+ }
14
+
15
+ .kit-aspect-ratio--sizer {
16
+ flex: 1 0 0px;
17
+ transition: padding-bottom 0.2s cubic-bezier(0.4, 0, 0.2, 1);
18
+ pointer-events: none;
19
+ }
@@ -0,0 +1,25 @@
1
+ <script lang="ts">
2
+ import type { AspectRationProps } from './types.js';
3
+ let { children, aspectRatio, inline, ...rest }: AspectRationProps = $props();
4
+
5
+ let paddingBottom = $state(0);
6
+
7
+ $effect.pre(() => {
8
+ if (aspectRatio) {
9
+ const [width, height] = aspectRatio.split('/').map(Number);
10
+ paddingBottom = (height / width) * 100;
11
+ }
12
+ });
13
+
14
+ $effect(() => {
15
+ if (aspectRatio) {
16
+ const [width, height] = aspectRatio.split('/').map(Number);
17
+ paddingBottom = (height / width) * 100;
18
+ }
19
+ });
20
+ </script>
21
+
22
+ <div {...rest} class={['kit-aspect-ratio', inline && 'kit-aspect-ratio--inline', rest.class]}>
23
+ <div class="kit-aspect-ratio--sizer" style={`padding-bottom: ${paddingBottom}%;`}></div>
24
+ {@render children?.()}
25
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { AspectRationProps } from './types.js';
2
+ declare const AspectRatio: import("svelte").Component<AspectRationProps, {}, "">;
3
+ type AspectRatio = ReturnType<typeof AspectRatio>;
4
+ export default AspectRatio;
@@ -0,0 +1,5 @@
1
+ import type { Component } from '../../internal/types.js';
2
+ export interface AspectRationProps extends Component {
3
+ aspectRatio?: string;
4
+ inline?: boolean;
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,109 @@
1
+ .kit-avatar {
2
+ --avatar-color: var(--on, var(--kit-on-neutral));
3
+ --avatar-background: var(--base, var(--kit-neutral));
4
+ --avatar-radius: var(--shape, var(--kit-radius-full));
5
+
6
+ display: flex;
7
+ align-items: center;
8
+ justify-content: center;
9
+ white-space: nowrap;
10
+ padding-top: var(--avatar-spacing-x);
11
+ padding-bottom: var(--avatar-spacing-x);
12
+ padding-right: var(--avatar-spacing-y);
13
+ padding-left: var(--avatar-spacing-y);
14
+
15
+ border-width: 1px;
16
+ border-style: solid;
17
+ border-radius: var(--avatar-radius);
18
+
19
+ /* theme */
20
+ color: var(--avatar-color);
21
+ background-color: var(--avatar-background);
22
+ border-color: var(--avatar-background);
23
+ }
24
+
25
+ .kit-avatar.kit-avatar--image {
26
+ position: relative;
27
+ overflow: hidden;
28
+ }
29
+
30
+ .kit-avatar.kit-avatar--image img {
31
+ position: relative;
32
+ top: 0;
33
+ left: 0;
34
+ width: 100%;
35
+ height: 100%;
36
+ object-fit: cover;
37
+ }
38
+
39
+ /* size */
40
+ .kit-avatar[breakpoint]kit-avatar--size-xs {
41
+ --avatar-height: 1.75rem;
42
+ --avatar-multiplier-y: 2;
43
+ font-size: 0.75rem;
44
+ }
45
+
46
+ .kit-avatar[breakpoint]kit-avatar--size-sm {
47
+ --avatar-height: 2rem;
48
+ --avatar-multiplier-y: 3;
49
+ font-size: 0.875rem;
50
+ }
51
+
52
+ .kit-avatar[breakpoint]kit-avatar--size-md {
53
+ --avatar-height: 2.25rem;
54
+ --avatar-multiplier-y: 4;
55
+ font-size: 0.875rem;
56
+ }
57
+
58
+ .kit-avatar[breakpoint]kit-avatar--size-lg {
59
+ --avatar-height: 2.5rem;
60
+ --avatar-multiplier-y: 5;
61
+ font-size: 1rem;
62
+ }
63
+
64
+ .kit-avatar[breakpoint]kit-avatar--size-xl {
65
+ --avatar-height: 2.75rem;
66
+ --avatar-multiplier-y: 6;
67
+ font-size: 1.125rem;
68
+ }
69
+
70
+ /* density */
71
+ .kit-avatar[breakpoint]kit-avatar--density-default {
72
+ height: calc(var(--avatar-height));
73
+ width: calc(var(--avatar-height));
74
+ --avatar-spacing-x: 0;
75
+ --avatar-spacing-y: 0;
76
+ }
77
+
78
+ .kit-avatar[breakpoint]kit-avatar--density-compact {
79
+ height: calc(var(--avatar-height) - 0.25rem);
80
+ width: calc(var(--avatar-height) - 0.25rem);
81
+ --avatar-spacing-x: 0;
82
+ --avatar-spacing-y: 0;
83
+ }
84
+
85
+ .kit-avatar[breakpoint]kit-avatar--density-comfortable {
86
+ height: calc(var(--avatar-height) + 0.25rem);
87
+ width: calc(var(--avatar-height) + 0.25rem);
88
+ --avatar-spacing-x: 0;
89
+ --avatar-spacing-y: 0;
90
+ }
91
+
92
+ /* variant */
93
+ .kit-avatar[breakpoint]kit-avatar--variant-outline {
94
+ --avatar-color: var(--base, var(--kit-neutral));
95
+ background-color: transparent;
96
+ border: 1px solid currentColor;
97
+ }
98
+
99
+ .kit-avatar[breakpoint]kit-avatar--variant-text {
100
+ --avatar-color: var(--base, var(--kit-neutral));
101
+ background-color: transparent;
102
+ border-color: transparent;
103
+ }
104
+
105
+ .kit-avatar[breakpoint]kit-avatar--variant-dash {
106
+ --avatar-color: var(--base, var(--kit-neutral));
107
+ background-color: transparent;
108
+ border: 1px dashed currentColor;
109
+ }
@@ -0,0 +1,46 @@
1
+ <script lang="ts">
2
+ import { getAssets } from '../../internal/assets.svelte.js';
3
+ import type { AvatarProps } from './types.js';
4
+ let {
5
+ children,
6
+ ref = $bindable(),
7
+ light,
8
+ dark,
9
+ size = 'md',
10
+ rounded,
11
+ alt,
12
+ background,
13
+ color,
14
+ image,
15
+ variant,
16
+ density = 'default',
17
+ ...rest
18
+ }: AvatarProps = $props();
19
+
20
+ const assets = getAssets();
21
+ </script>
22
+
23
+ <svelte:element
24
+ this={'div'}
25
+ bind:this={ref}
26
+ {...rest}
27
+ class={[
28
+ 'kit-avatar',
29
+ light && 'light',
30
+ dark && 'dark',
31
+ image && 'kit-avatar--image',
32
+ size && assets.className('avatar', 'size', size),
33
+ variant && assets.className('avatar', 'variant', variant),
34
+ density && assets.className('avatar', 'density', density),
35
+ rest.class
36
+ ]}
37
+ style:--base={assets.color(background)}
38
+ style:--on={assets.color(color)}
39
+ style:--shape={assets.shape(rounded)}
40
+ >
41
+ {#if image}
42
+ <img src={image} {alt} />
43
+ {:else}
44
+ {@render children?.()}
45
+ {/if}
46
+ </svelte:element>
@@ -0,0 +1,4 @@
1
+ import type { AvatarProps } from './types.js';
2
+ declare const Avatar: import("svelte").Component<AvatarProps, {}, "ref">;
3
+ type Avatar = ReturnType<typeof Avatar>;
4
+ export default Avatar;
@@ -0,0 +1,22 @@
1
+ import type { Component } from '../../internal/types.js';
2
+ type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
3
+ type AvatarDensity = 'compact' | 'comfortable' | 'default';
4
+ type AvatarVariant = 'outline' | 'text' | 'dash';
5
+ export interface AvatarProps extends Component {
6
+ ref?: HTMLElement | null;
7
+ dark?: boolean;
8
+ light?: boolean;
9
+ color?: string;
10
+ background?: string;
11
+ image?: string;
12
+ size?: AvatarSize | {
13
+ [key: string]: AvatarSize;
14
+ };
15
+ variant?: AvatarVariant | {
16
+ [key: string]: AvatarVariant;
17
+ };
18
+ density?: AvatarDensity | {
19
+ [key: string]: AvatarDensity;
20
+ };
21
+ }
22
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -23,6 +23,15 @@
23
23
  border-color: var(--btn-background);
24
24
  }
25
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
+
26
35
  .kit-btn:active:hover,
27
36
  .kit-btn:active:focus {
28
37
  animation: button-click 0s ease-out;
@@ -33,59 +42,82 @@
33
42
  .kit-btn[breakpoint]kit-btn--size-xs {
34
43
  --btn-height: 1.75rem;
35
44
  --btn-multiplier-y: 2;
45
+ --btn-gap: 0.25rem;
36
46
  font-size: 0.75rem;
37
- gap: 0.25rem;
47
+ gap: var(--btn-gap);
38
48
  }
39
49
 
40
50
  .kit-btn[breakpoint]kit-btn--size-sm {
41
51
  --btn-height: 2rem;
42
52
  --btn-multiplier-y: 3;
53
+ --btn-gap: 0.5rem;
43
54
  font-size: 0.875rem;
44
- gap: 0.5rem;
55
+ gap: var(--btn-gap);
45
56
  }
46
57
 
47
58
  .kit-btn[breakpoint]kit-btn--size-md {
48
59
  --btn-height: 2.25rem;
49
60
  --btn-multiplier-y: 4;
61
+ --btn-gap: 0.5rem;
50
62
  font-size: 0.875rem;
51
- gap: 0.5rem;
63
+ gap: var(--btn-gap);
52
64
  }
53
65
 
54
66
  .kit-btn[breakpoint]kit-btn--size-lg {
55
67
  --btn-height: 2.5rem;
56
68
  --btn-multiplier-y: 5;
69
+ --btn-gap: 0.5rem;
57
70
  font-size: 1rem;
58
- gap: 0.5rem;
71
+ gap: var(--btn-gap);
59
72
  }
60
73
 
61
74
  .kit-btn[breakpoint]kit-btn--size-xl {
62
75
  --btn-height: 2.75rem;
63
76
  --btn-multiplier-y: 6;
77
+ --btn-gap: 0.675rem;
64
78
  font-size: 1.125rem;
65
- gap: 0.675rem;
79
+ gap: var(--btn-gap);
66
80
  }
67
81
 
68
82
  /* density */
69
- .kit-btn[breakpoint]kit-btn--density-default {
83
+ .kit-btn:not(.kit-btn--icon)[breakpoint]kit-btn--density-default {
70
84
  height: calc(var(--btn-height));
71
85
  min-width: calc(var(--btn-height));
72
86
  --btn-spacing-x: 0;
73
87
  --btn-spacing-y: calc(var(--kit-spacing) * var(--btn-multiplier-y));
74
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
+ }
75
95
 
76
- .kit-btn[breakpoint]kit-btn--density-compact {
96
+ .kit-btn:not(.kit-btn--icon)[breakpoint]kit-btn--density-compact {
77
97
  height: calc(var(--btn-height) - 0.25rem);
78
98
  min-width: calc(var(--btn-height - 0.25rem));
79
99
  --btn-spacing-x: 0;
80
100
  --btn-spacing-y: calc(var(--kit-spacing) * var(--btn-multiplier-y) - 0.25rem);
81
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
+ }
82
108
 
83
- .kit-btn[breakpoint]kit-btn--density-comfortable {
109
+ .kit-btn:not(.kit-btn--icon)[breakpoint]kit-btn--density-comfortable {
84
110
  height: calc(var(--btn-height) + 0.25rem);
85
111
  min-width: calc(var(--btn-height) + 0.25rem);
86
112
  --btn-spacing-x: 0;
87
113
  --btn-spacing-y: calc(var(--kit-spacing) * var(--btn-multiplier-y) + 0.25rem);
88
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
+ }
89
121
 
90
122
  /* variant */
91
123
  .kit-btn[breakpoint]kit-btn--variant-outline {
@@ -233,8 +265,12 @@ input.kit-btn[disabled] {
233
265
  }
234
266
  .kit-btn.kit-btn--loading > .kit-btn-content {
235
267
  color: transparent;
268
+ opacity: 0;
236
269
  }
237
270
  .kit-btn.kit-btn--loading > .kit-btn-loading {
238
271
  position: absolute;
239
272
  min-width: fit-content;
240
273
  }
274
+ .kit-btn.kit-btn--loading > .kit-btn-loading .kit-icon-load {
275
+ animation: icon-rotate 1s ease-out infinite;
276
+ }
@@ -1,7 +1,11 @@
1
1
  <script lang="ts">
2
2
  import { getAssets } from '../../internal/index.js';
3
+ import { Icon } from '../index.js';
3
4
  import type { BtnProps } from './types.js';
4
5
 
6
+ // external
7
+ import LoadingFill from '../../assets/icons/loading-fill.svelte';
8
+
5
9
  let {
6
10
  children,
7
11
  ref = $bindable(),
@@ -24,6 +28,8 @@
24
28
  label,
25
29
  loading,
26
30
  rounded,
31
+ icon,
32
+ load,
27
33
  ...rest
28
34
  }: BtnProps = $props();
29
35
 
@@ -56,6 +62,7 @@
56
62
  disabled && 'kit-btn--disabled',
57
63
  active && 'kit-btn--active',
58
64
  loading && 'kit-btn--loading',
65
+ icon && 'kit-btn--icon',
59
66
  rest.class
60
67
  ]}
61
68
  tabindex={href && disabled ? -1 : 0}
@@ -69,7 +76,13 @@
69
76
  >
70
77
  {#if loading}
71
78
  <div class="kit-btn-loading">
72
- <div>loading ...</div>
79
+ {#if load}
80
+ {@render load?.()}
81
+ {:else}
82
+ <Icon class="kit-icon-load">
83
+ <LoadingFill />
84
+ </Icon>
85
+ {/if}
73
86
  </div>
74
87
  {/if}
75
88
 
@@ -1,4 +1,5 @@
1
1
  import type { Component } from '../../internal/types.js';
2
+ import type { Snippet } from 'svelte';
2
3
  export interface BtnProps extends Component {
3
4
  ref?: HTMLElement | null;
4
5
  is?: 'button' | 'a' | 'input';
@@ -21,4 +22,6 @@ export interface BtnProps extends Component {
21
22
  };
22
23
  type?: 'button' | 'submit' | 'reset' | 'radio' | 'checkbox';
23
24
  label?: string;
25
+ icon?: boolean;
26
+ load?: Snippet;
24
27
  }
@@ -0,0 +1,17 @@
1
+ /* loading */
2
+ .kit-chip.kit-chip--loading {
3
+ pointer-events: none;
4
+ user-select: none;
5
+ cursor: default;
6
+ }
7
+ .kit-chip.kit-chip--loading > .kit-chip-content {
8
+ color: transparent;
9
+ opacity: 0;
10
+ }
11
+ .kit-chip.kit-chip--loading > .kit-chip-loading {
12
+ position: absolute;
13
+ min-width: fit-content;
14
+ }
15
+ .kit-chip.kit-chip--loading > .kit-chip-loading .kit-icon-load {
16
+ animation: icon-rotate 1s ease-out infinite;
17
+ }