lapikit 0.0.0-insiders.e877f7f → 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 (74) 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/components/accordion/accordion.css +113 -0
  10. package/dist/components/accordion/accordion.svelte +37 -0
  11. package/dist/components/accordion/accordion.svelte.d.ts +4 -0
  12. package/dist/components/accordion/accordion.svelte.js +24 -0
  13. package/dist/components/accordion/modules/accordion-item.svelte +94 -0
  14. package/dist/components/accordion/modules/accordion-item.svelte.d.ts +4 -0
  15. package/dist/components/accordion/types.d.ts +33 -0
  16. package/dist/components/accordion/types.js +1 -0
  17. package/dist/components/alert/alert.css +127 -0
  18. package/dist/components/alert/alert.svelte +89 -0
  19. package/dist/components/alert/alert.svelte.d.ts +4 -0
  20. package/dist/components/alert/types.d.ts +28 -0
  21. package/dist/components/alert/types.js +1 -0
  22. package/dist/components/app/app.css +16 -0
  23. package/dist/components/app/app.svelte +12 -1
  24. package/dist/components/aspect-ratio/aspect-ratio.css +19 -0
  25. package/dist/components/aspect-ratio/aspect-ratio.svelte +25 -0
  26. package/dist/components/aspect-ratio/aspect-ratio.svelte.d.ts +4 -0
  27. package/dist/components/aspect-ratio/types.d.ts +5 -0
  28. package/dist/components/aspect-ratio/types.js +1 -0
  29. package/dist/components/avatar/avatar.css +109 -0
  30. package/dist/components/avatar/avatar.svelte +46 -0
  31. package/dist/components/avatar/avatar.svelte.d.ts +4 -0
  32. package/dist/components/avatar/types.d.ts +22 -0
  33. package/dist/components/avatar/types.js +1 -0
  34. package/dist/components/button/button.svelte +1 -1
  35. package/dist/components/chip/chip.css +17 -0
  36. package/dist/components/chip/chip.svelte +118 -0
  37. package/dist/components/chip/chip.svelte.d.ts +4 -0
  38. package/dist/components/chip/types.d.ts +30 -0
  39. package/dist/components/chip/types.js +1 -0
  40. package/dist/components/dialog/dialog.css +134 -0
  41. package/dist/components/dialog/dialog.svelte +67 -0
  42. package/dist/components/dialog/dialog.svelte.d.ts +4 -0
  43. package/dist/components/dialog/types.d.ts +24 -0
  44. package/dist/components/dialog/types.js +1 -0
  45. package/dist/components/index.d.ts +10 -0
  46. package/dist/components/index.js +10 -0
  47. package/dist/components/list/list.css +195 -0
  48. package/dist/components/list/list.svelte +46 -0
  49. package/dist/components/list/list.svelte.d.ts +4 -0
  50. package/dist/components/list/modules/list-item.svelte +68 -0
  51. package/dist/components/list/modules/list-item.svelte.d.ts +4 -0
  52. package/dist/components/list/types.d.ts +36 -0
  53. package/dist/components/list/types.js +1 -0
  54. package/dist/components/modal/modal.css +140 -0
  55. package/dist/components/modal/modal.svelte +112 -0
  56. package/dist/components/modal/modal.svelte.d.ts +4 -0
  57. package/dist/components/modal/types.d.ts +26 -0
  58. package/dist/components/modal/types.js +1 -0
  59. package/dist/components/separator/separator.css +46 -0
  60. package/dist/components/separator/separator.svelte +37 -0
  61. package/dist/components/separator/separator.svelte.d.ts +4 -0
  62. package/dist/components/separator/types.d.ts +11 -0
  63. package/dist/components/separator/types.js +1 -0
  64. package/dist/internal/assets.svelte.d.ts +1 -0
  65. package/dist/internal/assets.svelte.js +11 -0
  66. package/dist/internal/index.d.ts +1 -0
  67. package/dist/internal/index.js +1 -0
  68. package/dist/internal/scroll.d.ts +1 -0
  69. package/dist/internal/scroll.js +6 -0
  70. package/dist/stores/index.d.ts +5 -0
  71. package/dist/stores/index.js +21 -2
  72. package/dist/style/css.js +3 -0
  73. package/dist/style/variable.css +12 -0
  74. package/package.json +6 -2
@@ -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 {};
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { getAssets } from '../../internal/index.js';
3
- import Icon from '../icon/icon.svelte';
3
+ import { Icon } from '../index.js';
4
4
  import type { BtnProps } from './types.js';
5
5
 
6
6
  // external
@@ -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
+ }
@@ -0,0 +1,118 @@
1
+ <script lang="ts">
2
+ import { getAssets } from '../../internal/index.js';
3
+ import { Icon } from '../index.js';
4
+ import type { ChipProps } from './types.js';
5
+
6
+ // external
7
+ import LoadingFill from '../../assets/icons/loading-fill.svelte';
8
+ import Close from '../../assets/icons/close-fill.svelte';
9
+
10
+ let {
11
+ children,
12
+ load,
13
+ close,
14
+ append,
15
+ prepend,
16
+ ref = $bindable(),
17
+ open = $bindable(true),
18
+ is = 'span',
19
+ href,
20
+ dark,
21
+ light,
22
+ active,
23
+ variant,
24
+ error,
25
+ info,
26
+ success,
27
+ warning,
28
+ density = 'default',
29
+ disabled,
30
+ size = 'md',
31
+ type,
32
+ background,
33
+ color,
34
+ label,
35
+ loading,
36
+ rounded,
37
+ closable,
38
+ ...rest
39
+ }: ChipProps = $props();
40
+
41
+ const assets = getAssets();
42
+ </script>
43
+
44
+ {#if !closable || (open && closable)}
45
+ <svelte:element
46
+ this={href ? 'a' : is}
47
+ bind:this={ref}
48
+ {...rest}
49
+ href={href && !disabled ? href : undefined}
50
+ class={[
51
+ 'kit-chip',
52
+ light && 'light',
53
+ dark && 'dark',
54
+ size && assets.className('chip', 'size', size),
55
+ variant && assets.className('chip', 'variant', variant),
56
+ density && assets.className('chip', 'density', density),
57
+ error && 'kit-chip--error',
58
+ info && 'kit-chip--info',
59
+ success && 'kit-chip--success',
60
+ warning && 'kit-chip--warning',
61
+ disabled && 'kit-chip--disabled',
62
+ active && 'kit-chip--active',
63
+ loading && 'kit-chip--loading',
64
+ rest.class
65
+ ]}
66
+ tabindex={href && disabled ? -1 : 0}
67
+ aria-disabled={href ? disabled : undefined}
68
+ aria-label={type !== 'button' ? label : undefined}
69
+ disabled={href ? undefined : disabled}
70
+ type={href ? undefined : type}
71
+ style:--base={assets.color(background)}
72
+ style:--on={assets.color(color)}
73
+ style:--shape={assets.shape(rounded)}
74
+ >
75
+ {#if loading}
76
+ <div class="kit-chip-loading">
77
+ {#if load}
78
+ {@render load?.()}
79
+ {:else}
80
+ <Icon class="kit-icon-load">
81
+ <LoadingFill />
82
+ </Icon>
83
+ {/if}
84
+ </div>
85
+ {/if}
86
+
87
+ {#if prepend}
88
+ <div class="kit-chip-prepend">
89
+ {@render prepend?.()}
90
+ </div>
91
+ {/if}
92
+ <span class="kit-chip-content">
93
+ {@render children?.()}
94
+ </span>
95
+ {#if append}
96
+ <div class="kit-chip-append">
97
+ {@render append?.()}
98
+ </div>
99
+ {/if}
100
+
101
+ {#if closable}
102
+ <button
103
+ class="kit-chip--close"
104
+ type="button"
105
+ aria-label="close"
106
+ onclick={() => (open = false)}
107
+ >
108
+ {#if close}
109
+ {@render close?.()}
110
+ {:else}
111
+ <Icon>
112
+ <Close />
113
+ </Icon>
114
+ {/if}
115
+ </button>
116
+ {/if}
117
+ </svelte:element>
118
+ {/if}
@@ -0,0 +1,4 @@
1
+ import type { ChipProps } from './types.js';
2
+ declare const Chip: import("svelte").Component<ChipProps, {}, "ref" | "open">;
3
+ type Chip = ReturnType<typeof Chip>;
4
+ export default Chip;
@@ -0,0 +1,30 @@
1
+ import type { Component } from '../../internal/types.js';
2
+ import type { Snippet } from 'svelte';
3
+ export interface ChipProps extends Component {
4
+ load?: Snippet;
5
+ close?: Snippet;
6
+ append?: Snippet;
7
+ prepend?: Snippet;
8
+ ref?: HTMLElement | null;
9
+ is?: 'button' | 'a' | 'span' | 'div';
10
+ dark?: boolean;
11
+ light?: boolean;
12
+ href?: string;
13
+ variant?: 'outline' | 'label';
14
+ density?: 'compact' | 'comfortable' | 'default';
15
+ active?: boolean;
16
+ loading?: boolean;
17
+ error?: boolean;
18
+ info?: boolean;
19
+ warning?: boolean;
20
+ success?: boolean;
21
+ disabled?: boolean;
22
+ color?: string;
23
+ background?: string;
24
+ size?: string | {
25
+ [key: string]: string;
26
+ };
27
+ type?: 'button';
28
+ label?: string;
29
+ closable?: boolean;
30
+ }
@@ -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
+ }
@@ -0,0 +1,67 @@
1
+ <script lang="ts">
2
+ import { disabledScroll } from '../../internal/index.js';
3
+ import { getAssets } from '../../internal/index.js';
4
+ import type { DialogProps } from './types.js';
5
+
6
+ let {
7
+ children,
8
+ ref = $bindable(),
9
+ open = $bindable(),
10
+ dark,
11
+ light,
12
+ classContent,
13
+ color,
14
+ background,
15
+ size = 'md',
16
+ persistent,
17
+ position = 'center',
18
+ rounded,
19
+ density = 'default',
20
+ ...rest
21
+ }: DialogProps = $props();
22
+
23
+ const assets = getAssets();
24
+
25
+ $effect(() => {
26
+ if (ref && open) ref.showModal();
27
+ if (ref && !open) ref.close();
28
+ disabledScroll(open ? true : false);
29
+ });
30
+ </script>
31
+
32
+ <dialog
33
+ bind:this={ref}
34
+ class={[
35
+ 'kit-dialog',
36
+ persistent && 'kit-dialog--persistent',
37
+ size && assets.className('dialog', 'size', size),
38
+ position && assets.className('dialog', 'position', position),
39
+ rest.class
40
+ ]}
41
+ onclose={() => (!persistent ? (open = false) : null)}
42
+ onclick={(event: MouseEvent) => {
43
+ if (event.target === ref) {
44
+ if (!persistent) ref.close();
45
+ }
46
+ }}
47
+ >
48
+ <!-- surcharge-dialog autofocus-action-element -->
49
+ <button type="button" class="close-dialog">close</button>
50
+ <div
51
+ {...rest}
52
+ class={[
53
+ 'kit-dialog-container',
54
+ light && 'light',
55
+ dark && 'dark',
56
+ classContent,
57
+ density && assets.className('dialog-container', 'density', density),
58
+ rest.class
59
+ ]}
60
+ onclick={(event: MouseEvent) => event.stopPropagation()}
61
+ style:--base={assets.color(background)}
62
+ style:--on={assets.color(color)}
63
+ style:--shape={assets.shape(rounded)}
64
+ >
65
+ {@render children?.()}
66
+ </div>
67
+ </dialog>
@@ -0,0 +1,4 @@
1
+ import type { DialogProps } from './types.js';
2
+ declare const Dialog: import("svelte").Component<DialogProps, {}, "ref" | "open">;
3
+ type Dialog = ReturnType<typeof Dialog>;
4
+ export default Dialog;