uisv 0.0.21 → 0.0.23

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 (89) hide show
  1. package/dist/components/accordion.svelte +22 -22
  2. package/dist/components/accordion.svelte.d.ts +10 -10
  3. package/dist/components/alert.svelte +22 -28
  4. package/dist/components/alert.svelte.d.ts +5 -5
  5. package/dist/components/app.svelte +63 -0
  6. package/dist/components/app.svelte.d.ts +8 -0
  7. package/dist/components/badge.svelte +18 -23
  8. package/dist/components/badge.svelte.d.ts +3 -3
  9. package/dist/components/banner.svelte +18 -24
  10. package/dist/components/banner.svelte.d.ts +5 -5
  11. package/dist/components/breadcrumb.svelte +7 -8
  12. package/dist/components/breadcrumb.svelte.d.ts +5 -26
  13. package/dist/components/button.svelte +36 -44
  14. package/dist/components/button.svelte.d.ts +12 -11
  15. package/dist/components/calendar.svelte +6 -7
  16. package/dist/components/calendar.svelte.d.ts +3 -3
  17. package/dist/components/card.svelte +11 -12
  18. package/dist/components/card.svelte.d.ts +5 -5
  19. package/dist/components/checkbox-group.svelte +12 -13
  20. package/dist/components/checkbox-group.svelte.d.ts +4 -4
  21. package/dist/components/checkbox.svelte +42 -40
  22. package/dist/components/checkbox.svelte.d.ts +6 -6
  23. package/dist/components/chip.svelte +7 -8
  24. package/dist/components/chip.svelte.d.ts +3 -3
  25. package/dist/components/collapsible.svelte +7 -6
  26. package/dist/components/collapsible.svelte.d.ts +4 -4
  27. package/dist/components/color-picker.svelte +1 -1
  28. package/dist/components/h1.svelte +8 -7
  29. package/dist/components/h2.svelte +12 -11
  30. package/dist/components/h3.svelte +9 -8
  31. package/dist/components/h4.svelte +12 -11
  32. package/dist/components/h5.svelte +12 -11
  33. package/dist/components/h6.svelte +12 -11
  34. package/dist/components/index.d.ts +7 -0
  35. package/dist/components/index.js +7 -0
  36. package/dist/components/input-number.svelte +8 -9
  37. package/dist/components/input-number.svelte.d.ts +5 -5
  38. package/dist/components/input-time.svelte +11 -12
  39. package/dist/components/input-time.svelte.d.ts +6 -6
  40. package/dist/components/input.svelte +19 -29
  41. package/dist/components/input.svelte.d.ts +6 -6
  42. package/dist/components/kbd.svelte +6 -7
  43. package/dist/components/kbd.svelte.d.ts +2 -2
  44. package/dist/components/modal.svelte +189 -0
  45. package/dist/components/modal.svelte.d.ts +33 -0
  46. package/dist/components/p.svelte +3 -1
  47. package/dist/components/pin-input.svelte +10 -11
  48. package/dist/components/pin-input.svelte.d.ts +3 -3
  49. package/dist/components/placeholder.svelte +4 -4
  50. package/dist/components/popover.svelte +33 -61
  51. package/dist/components/popover.svelte.d.ts +8 -30
  52. package/dist/components/progress.svelte +62 -26
  53. package/dist/components/progress.svelte.d.ts +8 -7
  54. package/dist/components/select.svelte +49 -53
  55. package/dist/components/select.svelte.d.ts +22 -29
  56. package/dist/components/seperator.svelte +7 -8
  57. package/dist/components/seperator.svelte.d.ts +6 -6
  58. package/dist/components/slider.svelte +13 -14
  59. package/dist/components/slider.svelte.d.ts +4 -4
  60. package/dist/components/switch.svelte +19 -23
  61. package/dist/components/switch.svelte.d.ts +6 -6
  62. package/dist/components/tabs.svelte +19 -20
  63. package/dist/components/tabs.svelte.d.ts +7 -7
  64. package/dist/components/toast.svelte +173 -0
  65. package/dist/components/toast.svelte.d.ts +8 -0
  66. package/dist/components/toast.svelte.js +11 -0
  67. package/dist/components/tooltip.svelte +94 -0
  68. package/dist/components/tooltip.svelte.d.ts +24 -0
  69. package/dist/contexts.d.ts +54 -0
  70. package/dist/contexts.js +46 -0
  71. package/dist/index.d.ts +1 -1
  72. package/dist/index.js +1 -1
  73. package/dist/mode.d.ts +89 -0
  74. package/dist/mode.js +1 -0
  75. package/dist/utilities/index.d.ts +5 -0
  76. package/dist/utilities/index.js +5 -0
  77. package/dist/utilities/isComponent.d.ts +7 -0
  78. package/dist/utilities/isComponent.js +10 -0
  79. package/dist/utilities/isSnippet.d.ts +7 -0
  80. package/dist/utilities/isSnippet.js +8 -0
  81. package/dist/utilities/useElementRects.svelte.d.ts +11 -0
  82. package/dist/{utilities.svelte.js → utilities/useElementRects.svelte.js} +0 -38
  83. package/dist/utilities/useRafFn.svelte.d.ts +43 -0
  84. package/dist/utilities/useRafFn.svelte.js +56 -0
  85. package/dist/utilities/useStyle.svelte.d.ts +8 -0
  86. package/dist/utilities/useStyle.svelte.js +21 -0
  87. package/dist/vite.js +30 -35
  88. package/package.json +39 -27
  89. package/dist/utilities.svelte.d.ts +0 -31
@@ -1,8 +1,7 @@
1
1
  <script module lang="ts">
2
2
  import { type PropColor, type PropVariant } from '../index.js';
3
3
  import type { Component, Snippet } from 'svelte';
4
- import type { ClassNameValue } from 'tailwind-merge';
5
- import { tv } from 'tailwind-variants';
4
+ import { tv, type ClassValue } from 'tailwind-variants';
6
5
  import { Time } from '../date.js';
7
6
 
8
7
  export { default as InputTime } from './input-time.svelte';
@@ -45,11 +44,11 @@
45
44
  value?: Time;
46
45
  icon?: string | Snippet | Component;
47
46
  ui?: {
48
- root?: ClassNameValue;
49
- leading?: ClassNameValue;
50
- icon?: ClassNameValue;
51
- trailing?: ClassNameValue;
52
- segment?: ClassNameValue;
47
+ root?: ClassValue;
48
+ leading?: ClassValue;
49
+ icon?: ClassValue;
50
+ trailing?: ClassValue;
51
+ segment?: ClassValue;
53
52
  };
54
53
  };
55
54
  </script>
@@ -74,12 +73,12 @@
74
73
  tv({
75
74
  slots: {
76
75
  root: 'inline-flex items-center rounded transition-all ring ring-inset ring-transparent',
77
- leading: 'text-muted',
78
- trailing: 'text-muted',
76
+ leading: 'text-label-muted',
77
+ trailing: 'text-label-muted',
79
78
  icon: '',
80
79
  segment: [
81
80
  'rounded text-center outline-hidden transition-all focus:bg-surface-accented shrink',
82
- 'aria-[valuetext="Empty"]:text-dimmed data-[segment="literal"]:text-muted data-[segment="literal"]:px-1 data-invalid:text-error data-disabled:cursor-not-allowed data-disabled:opacity-75',
81
+ 'aria-[valuetext="Empty"]:text-label-dimmed data-[segment="literal"]:text-label-muted data-[segment="literal"]:px-1 data-invalid:text-error data-disabled:cursor-not-allowed data-disabled:opacity-75',
83
82
  ],
84
83
  },
85
84
  variants: {
@@ -158,7 +157,7 @@
158
157
  true: '',
159
158
  },
160
159
  type: {
161
- file: 'file:me-1.5 file:font-medium file:text-muted file:outline-none',
160
+ file: 'file:me-1.5 file:font-medium file:text-label-muted file:outline-none',
162
161
  },
163
162
  },
164
163
  compoundVariants: [
@@ -175,7 +174,7 @@
175
174
  variant: ['outline', 'subtle'],
176
175
  highlight: true,
177
176
  class: {
178
- root: 'ring-surface-800 ring-2',
177
+ root: 'ring-surface-inverted ring-2',
179
178
  },
180
179
  },
181
180
  {
@@ -1,6 +1,6 @@
1
1
  import { type PropColor, type PropVariant } from '../index.js';
2
2
  import type { Component, Snippet } from 'svelte';
3
- import type { ClassNameValue } from 'tailwind-merge';
3
+ import { type ClassValue } from 'tailwind-variants';
4
4
  import { Time } from '../date.js';
5
5
  export { default as InputTime } from './input-time.svelte';
6
6
  export type InputTimeProps = {
@@ -41,11 +41,11 @@ export type InputTimeProps = {
41
41
  value?: Time;
42
42
  icon?: string | Snippet | Component;
43
43
  ui?: {
44
- root?: ClassNameValue;
45
- leading?: ClassNameValue;
46
- icon?: ClassNameValue;
47
- trailing?: ClassNameValue;
48
- segment?: ClassNameValue;
44
+ root?: ClassValue;
45
+ leading?: ClassValue;
46
+ icon?: ClassValue;
47
+ trailing?: ClassValue;
48
+ segment?: ClassValue;
49
49
  };
50
50
  };
51
51
  declare const InputTime: Component<InputTimeProps, {}, "value">;
@@ -1,11 +1,11 @@
1
1
  <script module lang="ts">
2
- import { type PropColor, type PropVariant, isComponent, isSnippet } from '../index.js';
2
+ import { type PropColor, type PropVariant, isComponent, isSnippet, Icon } from '../index.js';
3
3
  import type { Component, Snippet } from 'svelte';
4
4
  import type { SvelteHTMLElements } from 'svelte/elements';
5
- import type { ClassNameValue } from 'tailwind-merge';
6
5
  import { maska } from 'maska/svelte';
7
6
  import { type MaskInputOptions } from 'maska';
8
- import { tv } from 'tailwind-variants';
7
+ import { tv, type ClassValue } from 'tailwind-variants';
8
+ import { getAppContext } from '../contexts.js';
9
9
 
10
10
  export type InputProps = Omit<SvelteHTMLElements['input'], 'size'> & {
11
11
  name?: string;
@@ -47,18 +47,16 @@
47
47
  loadingicon?: string | Component;
48
48
  mask?: string | MaskInputOptions;
49
49
  ui?: {
50
- root?: ClassNameValue;
51
- base?: ClassNameValue;
52
- leading?: ClassNameValue;
53
- icon?: ClassNameValue;
54
- trailing?: ClassNameValue;
50
+ root?: ClassValue;
51
+ base?: ClassValue;
52
+ leading?: ClassValue;
53
+ icon?: ClassValue;
54
+ trailing?: ClassValue;
55
55
  };
56
56
  };
57
57
  </script>
58
58
 
59
59
  <script lang="ts">
60
- import Icon from './icon.svelte';
61
-
62
60
  let {
63
61
  type,
64
62
  value = $bindable(),
@@ -71,7 +69,7 @@
71
69
  highlight,
72
70
  leading,
73
71
  loading,
74
- loadingicon = 'i-lucide-loader-circle',
72
+ loadingicon = getAppContext().icons.loading,
75
73
  required,
76
74
  trailing,
77
75
  mask,
@@ -84,9 +82,9 @@
84
82
  tv({
85
83
  slots: {
86
84
  root: 'inline-flex items-center rounded transition-all ring ring-inset ring-transparent',
87
- base: 'appearance-none outline-none placeholder:text-muted',
88
- leading: 'text-muted flex items-center',
89
- trailing: 'text-muted flex items-center',
85
+ base: 'appearance-none outline-none placeholder:text-label-muted',
86
+ leading: 'text-label-muted flex items-center',
87
+ trailing: 'text-label-muted flex items-center',
90
88
  icon: '',
91
89
  },
92
90
  variants: {
@@ -162,7 +160,7 @@
162
160
  true: '',
163
161
  },
164
162
  type: {
165
- file: 'file:me-1.5 file:font-medium file:text-muted file:outline-none',
163
+ file: 'file:me-1.5 file:font-medium file:text-label-muted file:outline-none',
166
164
  },
167
165
  },
168
166
  compoundVariants: [
@@ -177,7 +175,7 @@
177
175
  color: 'surface',
178
176
  variant: ['outline', 'subtle'],
179
177
  class: {
180
- root: 'focus-within:ring-surface-800 focus-within:ring-2',
178
+ root: 'focus-within:ring-surface-inverted focus-within:ring-2',
181
179
  },
182
180
  },
183
181
  {
@@ -224,7 +222,7 @@
224
222
 
225
223
  <div class={variants.root({ class: ui.root })}>
226
224
  {#if leading || (icon && iconposition === 'leading') || loading}
227
- {@const TrailingIcon = loading ? loadingicon : icon}
225
+ {@const leadingicon = loading ? loadingicon : icon}
228
226
 
229
227
  <span class={variants.leading({ class: ui.leading })}>
230
228
  {#if !!leading && !loading}
@@ -238,7 +236,7 @@
238
236
  {/if}
239
237
  {:else}
240
238
  <Icon
241
- name={TrailingIcon}
239
+ name={leadingicon}
242
240
  class={variants.icon({ class: [loading ? 'animate-spin' : ''] })}
243
241
  />
244
242
  {/if}
@@ -252,6 +250,7 @@
252
250
  class={variants.base({ class: [ui.base] })}
253
251
  {...rest}
254
252
  use:maska={mask}
253
+ bind:value
255
254
  />
256
255
 
257
256
  {#if trailing || (icon && iconposition === 'trailing')}
@@ -265,17 +264,8 @@
265
264
  {:else if isSnippet(trailing)}
266
265
  {@render trailing()}
267
266
  {/if}
268
- {:else if typeof icon === 'string'}
269
- <div
270
- class={variants.icon({
271
- class: [icon, ui.icon],
272
- })}
273
- ></div>
274
- {:else if isSnippet(icon)}
275
- {@render icon()}
276
- {:else if isComponent(icon)}
277
- {@const Icon = icon}
278
- <Icon class={variants.icon({ class: [ui.icon] })} />
267
+ {:else}
268
+ <Icon name={icon} class={variants.icon({ class: [ui.icon] })} />
279
269
  {/if}
280
270
  </span>
281
271
  {/if}
@@ -1,8 +1,8 @@
1
1
  import { type PropColor, type PropVariant } from '../index.js';
2
2
  import type { Component, Snippet } from 'svelte';
3
3
  import type { SvelteHTMLElements } from 'svelte/elements';
4
- import type { ClassNameValue } from 'tailwind-merge';
5
4
  import { type MaskInputOptions } from 'maska';
5
+ import { type ClassValue } from 'tailwind-variants';
6
6
  export type InputProps = Omit<SvelteHTMLElements['input'], 'size'> & {
7
7
  name?: string;
8
8
  /**
@@ -43,11 +43,11 @@ export type InputProps = Omit<SvelteHTMLElements['input'], 'size'> & {
43
43
  loadingicon?: string | Component;
44
44
  mask?: string | MaskInputOptions;
45
45
  ui?: {
46
- root?: ClassNameValue;
47
- base?: ClassNameValue;
48
- leading?: ClassNameValue;
49
- icon?: ClassNameValue;
50
- trailing?: ClassNameValue;
46
+ root?: ClassValue;
47
+ base?: ClassValue;
48
+ leading?: ClassValue;
49
+ icon?: ClassValue;
50
+ trailing?: ClassValue;
51
51
  };
52
52
  };
53
53
  declare const Input: Component<InputProps, {}, "value">;
@@ -1,8 +1,7 @@
1
1
  <script module lang="ts">
2
2
  import type { PropColor, PropVariant } from '../index.js';
3
3
  import type { Snippet } from 'svelte';
4
- import type { ClassNameValue } from 'tailwind-merge';
5
- import { tv } from 'tailwind-variants';
4
+ import { tv, type ClassValue } from 'tailwind-variants';
6
5
 
7
6
  export type KbdProps = {
8
7
  children?: Snippet;
@@ -10,7 +9,7 @@
10
9
  color?: PropColor;
11
10
  variant?: Exclude<PropVariant, 'none' | 'ghost'>;
12
11
  size?: 'sm' | 'md' | 'lg';
13
- class?: ClassNameValue;
12
+ class?: ClassValue;
14
13
  };
15
14
 
16
15
  export const KBD_KEYS = {
@@ -110,7 +109,7 @@
110
109
  {
111
110
  color: 'surface',
112
111
  variant: 'outline',
113
- class: 'border-surface-600',
112
+ class: 'border-label-toned',
114
113
  },
115
114
  {
116
115
  color: 'info',
@@ -142,7 +141,7 @@
142
141
  {
143
142
  color: 'surface',
144
143
  variant: 'solid',
145
- class: 'bg-surface-600 border-surface-700',
144
+ class: 'bg-label-toned border-label-highlighted',
146
145
  },
147
146
  {
148
147
  color: 'info',
@@ -174,7 +173,7 @@
174
173
  {
175
174
  color: 'surface',
176
175
  variant: 'soft',
177
- class: 'bg-surface-100 text-surface-700',
176
+ class: 'bg-surface-elevated text-label-toned',
178
177
  },
179
178
  {
180
179
  color: 'info',
@@ -206,7 +205,7 @@
206
205
  {
207
206
  color: 'surface',
208
207
  variant: 'subtle',
209
- class: 'bg-surface-100 border-surface-200 text-surface-700',
208
+ class: 'bg-surface-muted border-surface-accented text-label-toned',
210
209
  },
211
210
  {
212
211
  color: 'info',
@@ -1,13 +1,13 @@
1
1
  import type { PropColor, PropVariant } from '../index.js';
2
2
  import type { Snippet } from 'svelte';
3
- import type { ClassNameValue } from 'tailwind-merge';
3
+ import { type ClassValue } from 'tailwind-variants';
4
4
  export type KbdProps = {
5
5
  children?: Snippet;
6
6
  value?: string;
7
7
  color?: PropColor;
8
8
  variant?: Exclude<PropVariant, 'none' | 'ghost'>;
9
9
  size?: 'sm' | 'md' | 'lg';
10
- class?: ClassNameValue;
10
+ class?: ClassValue;
11
11
  };
12
12
  export declare const KBD_KEYS: {
13
13
  meta: string;
@@ -0,0 +1,189 @@
1
+ <script module lang="ts">
2
+ import { Dialog, type DialogContentProps, type PortalProps } from 'bits-ui';
3
+ import { tv, type ClassValue } from 'tailwind-variants';
4
+ import { Button, isComponent, isSnippet, type ButtonProps } from '../index.js';
5
+ import type { Component, Snippet } from 'svelte';
6
+ import defu from 'defu';
7
+ import { fade, scale } from 'svelte/transition';
8
+ import { cubicIn } from 'svelte/easing';
9
+ import { getAppContext } from '../contexts.js';
10
+
11
+ export type ModalProps = {
12
+ open?: boolean;
13
+ trigger?: ButtonProps;
14
+ ui?: {
15
+ overlay?: ClassValue;
16
+ content?: ClassValue;
17
+ header?: ClassValue;
18
+ body?: ClassValue;
19
+ footer?: ClassValue;
20
+ title?: ClassValue;
21
+ description?: ClassValue;
22
+ };
23
+ children?: Snippet;
24
+ title?: string | Snippet<[Record<string, unknown>]> | Component;
25
+ description?: string | Snippet<[Record<string, unknown>]> | Component;
26
+ footer?: Snippet<[{ close: () => void }]>;
27
+ close?: boolean | ButtonProps;
28
+ transition?: boolean;
29
+ overlay?: boolean;
30
+ fullscreen?: boolean;
31
+ dismissable?: boolean;
32
+ portal?: PortalProps;
33
+ content?: DialogContentProps;
34
+ };
35
+ </script>
36
+
37
+ <script lang="ts">
38
+ let {
39
+ open = $bindable(false),
40
+ trigger,
41
+ ui = {},
42
+ children,
43
+ title,
44
+ description,
45
+ footer,
46
+ close = true,
47
+ transition = true,
48
+ overlay = true,
49
+ fullscreen,
50
+ dismissable = true,
51
+ portal,
52
+ content,
53
+ }: ModalProps = $props();
54
+
55
+ let content_element = $state<HTMLDivElement | null>(null);
56
+
57
+ const variants = $derived(
58
+ tv({
59
+ slots: {
60
+ content:
61
+ 'z-[calc(var(--bits-dialog-depth)*10+11)] fixed bg-surface-base border border-surface-accented rounded-md divide-y divide-surface-accented flex flex-col overflow-hidden pointer-events-auto',
62
+ overlay: 'fixed inset-0 bg-surface-elevated/75 z-[calc(var(--bits-dialog-depth)*10+10)] ',
63
+ header: 'flex items-center gap-1.5 p-4 sm:px-6',
64
+ body: 'flex-1 p-4 sm:p-6 overflow-y-auto',
65
+ footer: 'flex items-center gap-1.5 p-4 sm:px-6',
66
+ title: 'text-label-highlighted font-semibold select-all',
67
+ description: 'mt-1 text-label-muted text-sm',
68
+ },
69
+ variants: {
70
+ fullscreen: {
71
+ true: {
72
+ content: 'inset-0',
73
+ },
74
+ false: {
75
+ content:
76
+ '-translate-1/2 top-1/2 left-1/2 max-h-[calc(100dvh-2rem)] sm:max-h-[calc(100dvh-4rem)] max-w-lg w-full',
77
+ },
78
+ },
79
+ },
80
+ })({ fullscreen }),
81
+ );
82
+ </script>
83
+
84
+ <Dialog.Root bind:open>
85
+ {#if trigger}
86
+ <Dialog.Trigger>
87
+ {#snippet child({ props })}
88
+ <Button {...props} {...trigger} />
89
+ {/snippet}
90
+ </Dialog.Trigger>
91
+ {/if}
92
+
93
+ <Dialog.Portal {...portal}>
94
+ <Dialog.Overlay forceMount>
95
+ {#snippet child({ props })}
96
+ {#if overlay && open}
97
+ <div
98
+ {...props}
99
+ class={variants.overlay({
100
+ class: [ui.overlay],
101
+ })}
102
+ transition:fade={{ duration: transition ? 200 : 0 }}
103
+ ></div>
104
+ {/if}
105
+ {/snippet}
106
+ </Dialog.Overlay>
107
+
108
+ <Dialog.Content
109
+ {...content}
110
+ forceMount
111
+ escapeKeydownBehavior={dismissable ? 'close' : 'ignore'}
112
+ interactOutsideBehavior={dismissable ? 'close' : 'ignore'}
113
+ onInteractOutside={(e) => {
114
+ if (content_element?.contains(e.target as Node)) e.preventDefault();
115
+ if (content?.onInteractOutside) content.onInteractOutside(e);
116
+ }}
117
+ >
118
+ {#snippet child({ props })}
119
+ {#if open}
120
+ <div
121
+ bind:this={content_element}
122
+ {...props}
123
+ class={variants.content({ class: ui.content })}
124
+ transition:scale={{
125
+ duration: transition ? 200 : 0,
126
+ easing: cubicIn,
127
+ start: 0.95,
128
+ opacity: 0,
129
+ }}
130
+ >
131
+ {#if title || description}
132
+ <div class={variants.header({ class: ui.header })}>
133
+ <div class="flex-1">
134
+ {#if typeof title === 'string'}
135
+ <h1 class={variants.title({ class: ui.title })}>{title}</h1>
136
+ {:else if isSnippet(title)}
137
+ {@render title({ class: variants.title({ class: ui.title }) })}
138
+ {:else if isComponent(title)}
139
+ {@const Comp = title}
140
+
141
+ <Comp class={variants.title({ class: ui.title })} />
142
+ {/if}
143
+
144
+ {#if typeof description === 'string'}
145
+ <h1 class={variants.description({ class: ui.description })}>{description}</h1>
146
+ {:else if isSnippet(description)}
147
+ {@render description({
148
+ class: variants.description({ class: ui.description }),
149
+ })}
150
+ {:else if isComponent(title)}
151
+ {@const Comp = description}
152
+
153
+ <Comp class={variants.description({ class: ui.description })} />
154
+ {/if}
155
+ </div>
156
+
157
+ {#if close}
158
+ <Button
159
+ {...props}
160
+ {...defu(typeof close === 'boolean' ? {} : close, <ButtonProps>{
161
+ variant: 'ghost',
162
+ color: 'surface',
163
+ icon: getAppContext().icons.close,
164
+ onclick() {
165
+ open = false;
166
+ },
167
+ })}
168
+ />
169
+ {/if}
170
+ </div>
171
+ {/if}
172
+
173
+ <div class={variants.body({ class: ui.body })}>
174
+ {@render children?.()}
175
+ </div>
176
+
177
+ {#if footer}
178
+ <div class={variants.footer({ class: ui.footer })}>
179
+ {@render footer({
180
+ close: () => (open = false),
181
+ })}
182
+ </div>
183
+ {/if}
184
+ </div>
185
+ {/if}
186
+ {/snippet}
187
+ </Dialog.Content>
188
+ </Dialog.Portal>
189
+ </Dialog.Root>
@@ -0,0 +1,33 @@
1
+ import { type DialogContentProps, type PortalProps } from 'bits-ui';
2
+ import { type ClassValue } from 'tailwind-variants';
3
+ import { type ButtonProps } from '../index.js';
4
+ import type { Component, Snippet } from 'svelte';
5
+ export type ModalProps = {
6
+ open?: boolean;
7
+ trigger?: ButtonProps;
8
+ ui?: {
9
+ overlay?: ClassValue;
10
+ content?: ClassValue;
11
+ header?: ClassValue;
12
+ body?: ClassValue;
13
+ footer?: ClassValue;
14
+ title?: ClassValue;
15
+ description?: ClassValue;
16
+ };
17
+ children?: Snippet;
18
+ title?: string | Snippet<[Record<string, unknown>]> | Component;
19
+ description?: string | Snippet<[Record<string, unknown>]> | Component;
20
+ footer?: Snippet<[{
21
+ close: () => void;
22
+ }]>;
23
+ close?: boolean | ButtonProps;
24
+ transition?: boolean;
25
+ overlay?: boolean;
26
+ fullscreen?: boolean;
27
+ dismissable?: boolean;
28
+ portal?: PortalProps;
29
+ content?: DialogContentProps;
30
+ };
31
+ declare const Modal: Component<ModalProps, {}, "open">;
32
+ type Modal = ReturnType<typeof Modal>;
33
+ export default Modal;
@@ -2,8 +2,10 @@
2
2
  import type { SvelteHTMLElements } from 'svelte/elements';
3
3
  import { cn } from 'tailwind-variants';
4
4
  const { children, class: classes }: SvelteHTMLElements['p'] = $props();
5
+
6
+ const classname = $derived(cn('my-5 leading-7 text-pretty', classes));
5
7
  </script>
6
8
 
7
- <p class={cn('my-5 leading-7 text-pretty', classes)}>
9
+ <p class={classname}>
8
10
  {@render children?.()}
9
11
  </p>
@@ -1,8 +1,7 @@
1
1
  <script module lang="ts">
2
2
  import type { PropColor, PropVariant } from '../index.js';
3
3
  import { onMount } from 'svelte';
4
- import type { ClassNameValue } from 'tailwind-merge';
5
- import { tv } from 'tailwind-variants';
4
+ import { tv, type ClassValue } from 'tailwind-variants';
6
5
 
7
6
  export type PinInputProps = {
8
7
  value?: number[] | string[];
@@ -19,7 +18,7 @@
19
18
  placeholder?: string;
20
19
  required?: boolean;
21
20
  type?: 'text' | 'number';
22
- ui?: { root?: ClassNameValue; cell?: ClassNameValue };
21
+ ui?: { root?: ClassValue; cell?: ClassValue };
23
22
  };
24
23
  </script>
25
24
 
@@ -59,7 +58,7 @@
59
58
  const internal_id = $props.id();
60
59
  let input_els = $state<HTMLInputElement[]>([]);
61
60
 
62
- const classes = $derived(
61
+ const variants = $derived(
63
62
  tv({
64
63
  slots: { root: 'flex gap-2', cell: 'rounded text-center outline-none transition relative' },
65
64
  variants: {
@@ -80,13 +79,13 @@
80
79
  },
81
80
  variant: {
82
81
  outline: {
83
- cell: 'border border-surface-300 focus:border-2',
82
+ cell: 'border border-surface-accented focus:border-2',
84
83
  },
85
84
  soft: {
86
- cell: 'bg-surface-50 hover:bg-surface-100 focus:bg-surface-100',
85
+ cell: 'bg-surface-muted hover:bg-surface-elevated focus:bg-surface-elevated',
87
86
  },
88
- subtle: { cell: 'border border-surface-300 bg-surface-100 focus:border-2' },
89
- ghost: { cell: 'hover:bg-surface-100 focus:bg-surface-100' },
87
+ subtle: { cell: 'border border-surface-accented bg-surface-elevated focus:border-2' },
88
+ ghost: { cell: 'hover:bg-surface-elevated focus:bg-surface-elevated' },
90
89
  none: { cell: '' },
91
90
  },
92
91
  },
@@ -99,7 +98,7 @@
99
98
  {
100
99
  variant: ['outline', 'subtle'],
101
100
  color: 'surface',
102
- class: { cell: 'focus:border-surface-900' },
101
+ class: { cell: 'focus:border-surface-inverted' },
103
102
  },
104
103
  {
105
104
  variant: ['outline', 'subtle'],
@@ -132,7 +131,7 @@
132
131
  });
133
132
  </script>
134
133
 
135
- <div id={id || internal_id} class={classes.root({ class: ui.root })}>
134
+ <div id={id || internal_id} class={variants.root({ class: ui.root })}>
136
135
  {#each { length }, i (i)}
137
136
  <input
138
137
  bind:this={input_els[i]}
@@ -148,7 +147,7 @@
148
147
  }
149
148
  }
150
149
  }
151
- class={classes.cell({ class: ui.cell })}
150
+ class={variants.cell({ class: ui.cell })}
152
151
  onkeydown={(e) => {
153
152
  if (KEYS_TO_IGNORE.includes(e.key)) e.preventDefault();
154
153
  if (type === 'number' && isNaN(parseInt(e.key))) e.preventDefault();
@@ -1,5 +1,5 @@
1
1
  import type { PropColor, PropVariant } from '../index.js';
2
- import type { ClassNameValue } from 'tailwind-merge';
2
+ import { type ClassValue } from 'tailwind-variants';
3
3
  export type PinInputProps = {
4
4
  value?: number[] | string[];
5
5
  color?: PropColor;
@@ -16,8 +16,8 @@ export type PinInputProps = {
16
16
  required?: boolean;
17
17
  type?: 'text' | 'number';
18
18
  ui?: {
19
- root?: ClassNameValue;
20
- cell?: ClassNameValue;
19
+ root?: ClassValue;
20
+ cell?: ClassValue;
21
21
  };
22
22
  };
23
23
  declare const PinInput: import("svelte").Component<PinInputProps, {}, "value">;
@@ -1,15 +1,15 @@
1
1
  <script lang="ts">
2
2
  import type { SvelteHTMLElements } from 'svelte/elements';
3
- import { cx } from 'tailwind-variants';
3
+ import { cn } from 'tailwind-variants';
4
4
 
5
- let { class: klass, ...rest }: SvelteHTMLElements['svg'] = $props();
5
+ let { class: classes, ...rest }: SvelteHTMLElements['svg'] = $props();
6
6
  </script>
7
7
 
8
8
  <svg
9
9
  {...rest}
10
- class={cx(
10
+ class={cn(
11
11
  'inset-0 w-full stroke-surface-elevated border border-dashed border-surface-accented rounded-md',
12
- klass,
12
+ classes,
13
13
  )}
14
14
  fill="none"
15
15
  >