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,8 @@
1
1
  <script module lang="ts">
2
+ import { getAppContext } from '../contexts.js';
2
3
  import { Accordion } from 'bits-ui';
3
4
  import type { Component, Snippet } from 'svelte';
4
- import type { ClassNameValue } from 'tailwind-merge';
5
- import { tv } from 'tailwind-variants';
5
+ import { tv, type ClassValue } from 'tailwind-variants';
6
6
 
7
7
  export type AccordionItem = {
8
8
  label: string;
@@ -25,15 +25,15 @@
25
25
  content?: Snippet<[{ item: AccordionItem; index: number; open: boolean }]>;
26
26
  body?: Snippet<[{ item: AccordionItem; index: number; open: boolean }]>;
27
27
  ui?: {
28
- root?: ClassNameValue;
29
- item?: ClassNameValue;
30
- header?: ClassNameValue;
31
- trigger?: ClassNameValue;
32
- content?: ClassNameValue;
33
- body?: ClassNameValue;
34
- leadingicon?: ClassNameValue;
35
- trailingicon?: ClassNameValue;
36
- label?: ClassNameValue;
28
+ root?: ClassValue;
29
+ item?: ClassValue;
30
+ header?: ClassValue;
31
+ trigger?: ClassValue;
32
+ content?: ClassValue;
33
+ body?: ClassValue;
34
+ leadingicon?: ClassValue;
35
+ trailingicon?: ClassValue;
36
+ label?: ClassValue;
37
37
  };
38
38
  };
39
39
  </script>
@@ -45,15 +45,15 @@
45
45
  collapsible = true,
46
46
  disabled,
47
47
  type = 'single',
48
- trailingicon = 'i-lucide-baret-down',
48
+ trailingicon = getAppContext().icons.chevrondown,
49
49
  leading,
50
50
  default: defau,
51
51
  trailing,
52
52
  content,
53
53
  body,
54
- ui = {}
54
+ ui = {},
55
55
  }: AccordionProps = $props();
56
- const classes = $derived(
56
+ const variants = $derived(
57
57
  tv({
58
58
  slots: {
59
59
  root: 'w-full',
@@ -67,23 +67,23 @@
67
67
  leadingIcon: 'shrink-0 size-5',
68
68
  trailingIcon:
69
69
  'shrink-0 size-5 ms-auto group-data-[state=open]:rotate-180 transition-transform duration-200',
70
- label: 'text-start break-words'
70
+ label: 'text-start break-words',
71
71
  },
72
72
  variants: {
73
73
  disabled: {
74
74
  true: {
75
- trigger: 'cursor-not-allowed opacity-75'
76
- }
77
- }
78
- }
75
+ trigger: 'cursor-not-allowed opacity-75',
76
+ },
77
+ },
78
+ },
79
79
  })({
80
- disabled
81
- })
80
+ disabled,
81
+ }),
82
82
  );
83
83
  </script>
84
84
 
85
85
  <Accordion.Root
86
- class={classes.root({ class: ui.root })}
86
+ class={variants.root({ class: ui.root })}
87
87
  type="multiple"
88
88
  bind:value={
89
89
  () => {
@@ -1,6 +1,6 @@
1
1
  import { Accordion } from 'bits-ui';
2
2
  import type { Component, Snippet } from 'svelte';
3
- import type { ClassNameValue } from 'tailwind-merge';
3
+ import { type ClassValue } from 'tailwind-variants';
4
4
  export type AccordionItem = {
5
5
  label: string;
6
6
  icon?: string | Snippet | Component;
@@ -42,15 +42,15 @@ export type AccordionProps = {
42
42
  open: boolean;
43
43
  }]>;
44
44
  ui?: {
45
- root?: ClassNameValue;
46
- item?: ClassNameValue;
47
- header?: ClassNameValue;
48
- trigger?: ClassNameValue;
49
- content?: ClassNameValue;
50
- body?: ClassNameValue;
51
- leadingicon?: ClassNameValue;
52
- trailingicon?: ClassNameValue;
53
- label?: ClassNameValue;
45
+ root?: ClassValue;
46
+ item?: ClassValue;
47
+ header?: ClassValue;
48
+ trigger?: ClassValue;
49
+ content?: ClassValue;
50
+ body?: ClassValue;
51
+ leadingicon?: ClassValue;
52
+ trailingicon?: ClassValue;
53
+ label?: ClassValue;
54
54
  };
55
55
  };
56
56
  declare const Accordion: Component<AccordionProps, {}, "value">;
@@ -5,11 +5,12 @@
5
5
  type ButtonProps,
6
6
  Button,
7
7
  type PropVariant,
8
+ Icon,
8
9
  } from '../index.js';
9
10
  import type { Component, Snippet } from 'svelte';
10
- import type { ClassNameValue } from 'tailwind-merge';
11
- import { tv } from 'tailwind-variants';
11
+ import { tv, type ClassValue } from 'tailwind-variants';
12
12
  import { defu } from 'defu';
13
+ import { getAppContext } from '../contexts.js';
13
14
 
14
15
  export type AlertProps = {
15
16
  title?: string | Snippet;
@@ -21,10 +22,10 @@
21
22
  actions?: ButtonProps[];
22
23
  close?: boolean | ButtonProps;
23
24
  ui?: {
24
- base?: ClassNameValue;
25
- icon?: ClassNameValue;
26
- description?: ClassNameValue;
27
- title?: ClassNameValue;
25
+ base?: ClassValue;
26
+ icon?: ClassValue;
27
+ description?: ClassValue;
28
+ title?: ClassValue;
28
29
  };
29
30
  onclose?: () => void | Promise<void>;
30
31
  };
@@ -46,7 +47,7 @@
46
47
 
47
48
  const close_props = $derived.by(() => {
48
49
  return defu(typeof close === 'boolean' ? {} : close, {
49
- icon: 'i-lucide-x',
50
+ icon: getAppContext().icons.close,
50
51
  variant: 'link',
51
52
  color: variant === 'solid' ? 'surface' : color,
52
53
  ui: {
@@ -54,7 +55,7 @@
54
55
  },
55
56
  } as ButtonProps);
56
57
  });
57
- const classes = $derived.by(() =>
58
+ const variants = $derived.by(() =>
58
59
  tv({
59
60
  slots: {
60
61
  base: 'flex gap-2 font-sans p-4 rounded-lg',
@@ -99,7 +100,7 @@
99
100
  {
100
101
  variant: 'solid',
101
102
  color: 'surface',
102
- class: 'bg-surface-900',
103
+ class: 'bg-surface-inverted',
103
104
  },
104
105
  {
105
106
  variant: 'solid',
@@ -130,7 +131,7 @@
130
131
  {
131
132
  variant: 'outline',
132
133
  color: 'surface',
133
- class: 'border-surface-300 text-surface-900',
134
+ class: 'border-surface-accented text-surface-inverted',
134
135
  },
135
136
  {
136
137
  variant: 'outline',
@@ -161,7 +162,7 @@
161
162
  {
162
163
  variant: 'soft',
163
164
  color: 'surface',
164
- class: 'bg-surface-50 text-surface-900',
165
+ class: 'bg-surface-muted text-surface-inverted',
165
166
  },
166
167
  {
167
168
  variant: 'soft',
@@ -192,7 +193,7 @@
192
193
  {
193
194
  variant: 'subtle',
194
195
  color: 'surface',
195
- class: 'bg-surface-50 text-surface-900 border-surface-300',
196
+ class: 'bg-surface-muted text-surface-inverted border-surface-accented',
196
197
  },
197
198
  {
198
199
  variant: 'subtle',
@@ -219,24 +220,17 @@
219
220
  );
220
221
  </script>
221
222
 
222
- <div class={classes.base({ class: [position === 'bottom' ? '' : 'flex', ui.base] })}>
223
- <div class="flex gap-2 flex-grow">
224
- {#if icon}
225
- <div class="size-6">
226
- {#if typeof icon === 'string'}
227
- <div class={classes.icon({ class: [icon] })}></div>
228
- {:else if isSnippet(icon)}
229
- {@render icon()}
230
- {:else}
231
- {@const Icon = icon}
232
- <Icon />
233
- {/if}
234
- </div>
223
+ <div class={variants.base({ class: [position === 'bottom' ? '' : 'flex', ui.base] })}>
224
+ <div class="flex gap-2 grow">
225
+ {#if isSnippet(icon)}
226
+ {@render icon()}
227
+ {:else}
228
+ <Icon name={icon} class={variants.icon({ class: ui.icon })} />
235
229
  {/if}
236
230
 
237
- <div class="space-y-1 flex-grow">
231
+ <div class="space-y-1 grow">
238
232
  {#if title}
239
- <div class={classes.title({ class: [ui.title] })}>
233
+ <div class={variants.title({ class: [ui.title] })}>
240
234
  {#if isSnippet(title)}
241
235
  {@render title()}
242
236
  {:else}
@@ -246,7 +240,7 @@
246
240
  {/if}
247
241
 
248
242
  {#if description}
249
- <div class={classes.description({ class: [ui.title] })}>
243
+ <div class={variants.description({ class: [ui.title] })}>
250
244
  {#if isSnippet(description)}
251
245
  {@render description()}
252
246
  {:else}
@@ -1,6 +1,6 @@
1
1
  import { type PropColor, type ButtonProps, 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
  export type AlertProps = {
5
5
  title?: string | Snippet;
6
6
  description?: string | Snippet;
@@ -11,10 +11,10 @@ export type AlertProps = {
11
11
  actions?: ButtonProps[];
12
12
  close?: boolean | ButtonProps;
13
13
  ui?: {
14
- base?: ClassNameValue;
15
- icon?: ClassNameValue;
16
- description?: ClassNameValue;
17
- title?: ClassNameValue;
14
+ base?: ClassValue;
15
+ icon?: ClassValue;
16
+ description?: ClassValue;
17
+ title?: ClassValue;
18
18
  };
19
19
  onclose?: () => void | Promise<void>;
20
20
  };
@@ -0,0 +1,63 @@
1
+ <script module lang="ts">
2
+ import { DEFAULT_ICONS, setAppContext, type AppContext } from '../contexts.js';
3
+ import { mode, ModeWatcher } from '../mode.js';
4
+ import { Tooltip } from 'bits-ui';
5
+ import defu from 'defu';
6
+ import { type Snippet } from 'svelte';
7
+ import { Toaster } from 'svelte-sonner';
8
+ import { boxWith } from 'svelte-toolbelt';
9
+ import { Icon } from './index.js';
10
+
11
+ export type AppProps = Partial<AppContext> & {
12
+ children?: Snippet;
13
+ };
14
+ </script>
15
+
16
+ <script lang="ts">
17
+ let { children, modewatcher = {}, toaster = {}, tooltip = {}, icons = {} }: AppProps = $props();
18
+
19
+ const context = boxWith(() =>
20
+ defu({ icons, toaster, modewatcher, tooltip }, <AppContext>{
21
+ icons: DEFAULT_ICONS,
22
+ toaster: {
23
+ visibleToasts: 5,
24
+ duration: 6000,
25
+ theme: mode.current,
26
+ },
27
+ modewatcher: {},
28
+ }),
29
+ );
30
+ setAppContext(context.current);
31
+ </script>
32
+
33
+ <ModeWatcher {...context.current.modewatcher} />
34
+
35
+ <Toaster {...context.current.toaster}>
36
+ {#snippet infoIcon()}
37
+ <Icon name={context.current.icons.info} />
38
+ {/snippet}
39
+
40
+ {#snippet closeIcon()}
41
+ <Icon name={context.current.icons.close} />
42
+ {/snippet}
43
+
44
+ {#snippet errorIcon()}
45
+ <Icon name={context.current.icons.error} />
46
+ {/snippet}
47
+
48
+ {#snippet loadingIcon()}
49
+ <Icon name={context.current.icons.loading} />
50
+ {/snippet}
51
+
52
+ {#snippet successIcon()}
53
+ <Icon name={context.current.icons.success} />
54
+ {/snippet}
55
+
56
+ {#snippet warningIcon()}
57
+ <Icon name={context.current.icons.warning} />
58
+ {/snippet}
59
+ </Toaster>
60
+
61
+ <Tooltip.Provider {...context.current.tooltip}>
62
+ {@render children?.()}
63
+ </Tooltip.Provider>
@@ -0,0 +1,8 @@
1
+ import { type AppContext } from '../contexts.js';
2
+ import { type Snippet } from 'svelte';
3
+ export type AppProps = Partial<AppContext> & {
4
+ children?: Snippet;
5
+ };
6
+ declare const App: import("svelte").Component<AppProps, {}, "">;
7
+ type App = ReturnType<typeof App>;
8
+ export default App;
@@ -1,8 +1,8 @@
1
1
  <script lang="ts" module>
2
2
  import type { Component, Snippet } from 'svelte';
3
- import { tv } from 'tailwind-variants';
3
+ import { tv, type ClassValue } from 'tailwind-variants';
4
4
  import { type PropColor, type PropVariant, isSnippet } from '../index.js';
5
- import type { ClassNameValue } from 'tailwind-merge';
5
+ import Icon from './icon.svelte';
6
6
 
7
7
  export type BadgeProps = {
8
8
  label?: string;
@@ -13,8 +13,8 @@
13
13
  trailingicon?: boolean;
14
14
  children?: Snippet;
15
15
  ui?: {
16
- base?: ClassNameValue;
17
- icon?: ClassNameValue;
16
+ base?: ClassValue;
17
+ icon?: ClassValue;
18
18
  };
19
19
  };
20
20
  </script>
@@ -31,7 +31,7 @@
31
31
  children,
32
32
  }: BadgeProps = $props();
33
33
 
34
- const classes = $derived.by(() => {
34
+ const variants = $derived.by(() => {
35
35
  return tv({
36
36
  slots: { icon: '', base: 'flex-inline items-center font-sans' },
37
37
  variants: {
@@ -71,7 +71,7 @@
71
71
  {
72
72
  color: 'surface',
73
73
  variant: 'solid',
74
- class: 'bg-surface-inverted text-inverted',
74
+ class: 'bg-surface-inverted text-label-inverted',
75
75
  },
76
76
  {
77
77
  color: 'info',
@@ -102,7 +102,7 @@
102
102
  {
103
103
  color: 'surface',
104
104
  variant: 'outline',
105
- class: 'border-surface-accented text-highlighted',
105
+ class: 'border-surface-accented text-label-highlighted',
106
106
  },
107
107
  {
108
108
  color: 'info',
@@ -133,7 +133,7 @@
133
133
  {
134
134
  color: 'surface',
135
135
  variant: 'soft',
136
- class: 'bg-surface/10 text-highlighted',
136
+ class: 'bg-surface/10 text-label-highlighted',
137
137
  },
138
138
  {
139
139
  color: 'info',
@@ -164,7 +164,7 @@
164
164
  {
165
165
  color: 'surface',
166
166
  variant: 'subtle',
167
- class: 'bg-surface/10 text-highlighted border-surface/20 ',
167
+ class: 'bg-surface/10 text-label-highlighted border-surface/20 ',
168
168
  },
169
169
  {
170
170
  color: 'info',
@@ -192,12 +192,16 @@
192
192
  </script>
193
193
 
194
194
  <span
195
- class={classes.base({
195
+ class={variants.base({
196
196
  class: [icon && !(children || label) ? 'px-0 aspect-square justify-center' : '', ui.base],
197
197
  })}
198
198
  >
199
199
  {#if !trailingicon}
200
- {@render Icon()}
200
+ {#if isSnippet(icon)}
201
+ {@render icon()}
202
+ {:else}
203
+ <Icon name={icon} class={variants.icon({ class: ui.icon })} />
204
+ {/if}
201
205
  {/if}
202
206
 
203
207
  {#if label}
@@ -207,19 +211,10 @@
207
211
  {/if}
208
212
 
209
213
  {#if trailingicon}
210
- {@render Icon()}
211
- {/if}
212
- </span>
213
-
214
- {#snippet Icon()}
215
- {#if icon}
216
- {#if typeof icon === 'string'}
217
- <div class={['pi', icon, classes.icon(), ui.icon]}></div>
218
- {:else if isSnippet(icon)}
214
+ {#if isSnippet(icon)}
219
215
  {@render icon()}
220
216
  {:else}
221
- {@const Icon = icon}
222
- <Icon />
217
+ <Icon name={icon} class={variants.icon({ class: ui.icon })} />
223
218
  {/if}
224
219
  {/if}
225
- {/snippet}
220
+ </span>
@@ -1,6 +1,6 @@
1
1
  import type { Component, Snippet } from 'svelte';
2
+ import { type ClassValue } from 'tailwind-variants';
2
3
  import { type PropColor, type PropVariant } from '../index.js';
3
- import type { ClassNameValue } from 'tailwind-merge';
4
4
  export type BadgeProps = {
5
5
  label?: string;
6
6
  color?: PropColor;
@@ -10,8 +10,8 @@ export type BadgeProps = {
10
10
  trailingicon?: boolean;
11
11
  children?: Snippet;
12
12
  ui?: {
13
- base?: ClassNameValue;
14
- icon?: ClassNameValue;
13
+ base?: ClassValue;
14
+ icon?: ClassValue;
15
15
  };
16
16
  };
17
17
  declare const Badge: Component<BadgeProps, {}, "">;
@@ -5,11 +5,12 @@
5
5
  type ButtonProps,
6
6
  Button,
7
7
  type PropVariant,
8
+ Icon,
8
9
  } from '../index.js';
9
10
  import type { Component, Snippet } from 'svelte';
10
- import type { ClassNameValue } from 'tailwind-merge';
11
- import { tv } from 'tailwind-variants';
11
+ import { tv, type ClassValue } from 'tailwind-variants';
12
12
  import { defu } from 'defu';
13
+ import { getAppContext } from '../contexts.js';
13
14
 
14
15
  export type BannerProps = {
15
16
  title: string | Snippet;
@@ -21,10 +22,10 @@
21
22
  href?: string;
22
23
  target?: string;
23
24
  ui?: {
24
- base?: ClassNameValue;
25
- icon?: ClassNameValue;
26
- description?: ClassNameValue;
27
- title?: ClassNameValue;
25
+ base?: ClassValue;
26
+ icon?: ClassValue;
27
+ description?: ClassValue;
28
+ title?: ClassValue;
28
29
  };
29
30
  onclose?: () => void | Promise<void>;
30
31
  };
@@ -44,7 +45,7 @@
44
45
  onclose = () => {},
45
46
  }: BannerProps = $props();
46
47
 
47
- const classes = $derived.by(() =>
48
+ const variants = $derived.by(() =>
48
49
  tv({
49
50
  slots: {
50
51
  base: 'flex items-center gap-2 font-sans p-4',
@@ -63,8 +64,8 @@
63
64
  },
64
65
  variant: {
65
66
  solid: {
66
- base: 'text-inverted',
67
- description: 'text-inverted/90',
67
+ base: 'text-label-inverted',
68
+ description: 'text-label-inverted/90',
68
69
  },
69
70
  outline: 'border',
70
71
  soft: '',
@@ -204,23 +205,16 @@
204
205
  this={href ? 'a' : 'button'}
205
206
  {href}
206
207
  {target}
207
- class={classes.base({ class: [ui.base] })}
208
+ class={variants.base({ class: [ui.base] })}
208
209
  >
209
210
  <div class="flex grow gap-2 text-sm items-center">
210
- {#if icon}
211
- <div class="size-6">
212
- {#if typeof icon === 'string'}
213
- <div class={classes.icon({ class: [icon] })}></div>
214
- {:else if isSnippet(icon)}
215
- {@render icon()}
216
- {:else}
217
- {@const Icon = icon}
218
- <Icon />
219
- {/if}
220
- </div>
211
+ {#if isSnippet(icon)}
212
+ {@render icon()}
213
+ {:else}
214
+ <Icon name={icon} class={variants.icon({ class: ui.icon })} />
221
215
  {/if}
222
216
 
223
- <div class={classes.title({ class: [ui.title] })}>
217
+ <div class={variants.title({ class: [ui.title] })}>
224
218
  {#if isSnippet(title)}
225
219
  {@render title()}
226
220
  {:else}
@@ -244,11 +238,11 @@
244
238
  <div>
245
239
  <Button
246
240
  {...defu<ButtonProps, [ButtonProps]>(typeof close === 'boolean' ? {} : close, {
247
- icon: 'i-lucide-x',
241
+ icon: getAppContext().icons.close,
248
242
  variant: 'ghost',
249
243
  color: 'surface',
250
244
  ui: {
251
- icon: variant === 'solid' ? 'text-inverted' : '',
245
+ icon: variant === 'solid' ? 'text-label-inverted' : '',
252
246
  },
253
247
  })}
254
248
  onclick={onclose}
@@ -1,6 +1,6 @@
1
1
  import { type PropColor, type ButtonProps, 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
  export type BannerProps = {
5
5
  title: string | Snippet;
6
6
  icon?: string | Snippet | Component;
@@ -11,10 +11,10 @@ export type BannerProps = {
11
11
  href?: string;
12
12
  target?: string;
13
13
  ui?: {
14
- base?: ClassNameValue;
15
- icon?: ClassNameValue;
16
- description?: ClassNameValue;
17
- title?: ClassNameValue;
14
+ base?: ClassValue;
15
+ icon?: ClassValue;
16
+ description?: ClassValue;
17
+ title?: ClassValue;
18
18
  };
19
19
  onclose?: () => void | Promise<void>;
20
20
  };
@@ -1,30 +1,29 @@
1
1
  <script module lang="ts">
2
2
  import type { Component, Snippet } from 'svelte';
3
- import type { ClassNameValue } from 'tailwind-merge';
4
- import { Button, Icon, type ButtonProps } from './index.js';
3
+ import { Button, Icon, type ButtonProps, isSnippet } from '../index.js';
5
4
  import { tv } from 'tailwind-variants';
6
- import { isSnippet } from '../utilities.svelte.js';
5
+ import { getAppContext } from '../contexts.js';
7
6
 
8
7
  export type BreadcrumbItem = Omit<ButtonProps, 'label'> & {
9
8
  label?: string;
10
9
  icon?: string | Component;
11
10
  snippet?: string;
12
- [key: string]: any;
11
+ [key: string]: unknown;
13
12
  };
14
13
 
15
14
  export type BreadcrumbProps = {
16
15
  items: BreadcrumbItem[];
17
16
  seperator?: string | Component | Snippet;
18
17
  labelkey?: string;
19
- [key: string]: any | Snippet<[BreadcrumbItem]>;
18
+ [key: string]: unknown | Snippet<[BreadcrumbItem]>;
20
19
  };
21
20
  </script>
22
21
 
23
- <script lang="ts" generics="T extends BreadcrumbItem">
22
+ <script lang="ts">
24
23
  let {
25
24
  items,
26
25
  labelkey = 'label',
27
- seperator = 'i-lucide:chevron-right',
26
+ seperator = getAppContext().icons.chevronright,
28
27
  ...rest
29
28
  }: BreadcrumbProps = $props();
30
29
 
@@ -53,7 +52,7 @@
53
52
  {/if}
54
53
  {:else}
55
54
  <Button
56
- label={item[labelkey]}
55
+ label={item[labelkey] as undefined}
57
56
  icon={item.icon}
58
57
  href={item.href}
59
58
  variant="link"
@@ -1,38 +1,17 @@
1
1
  import type { Component, Snippet } from 'svelte';
2
- import { type ButtonProps } from './index.js';
2
+ import { type ButtonProps } from '../index.js';
3
3
  export type BreadcrumbItem = Omit<ButtonProps, 'label'> & {
4
4
  label?: string;
5
5
  icon?: string | Component;
6
6
  snippet?: string;
7
- [key: string]: any;
7
+ [key: string]: unknown;
8
8
  };
9
9
  export type BreadcrumbProps = {
10
10
  items: BreadcrumbItem[];
11
11
  seperator?: string | Component | Snippet;
12
12
  labelkey?: string;
13
- [key: string]: any | Snippet<[BreadcrumbItem]>;
13
+ [key: string]: unknown | Snippet<[BreadcrumbItem]>;
14
14
  };
15
- declare function $$render<T extends BreadcrumbItem>(): {
16
- props: BreadcrumbProps;
17
- exports: {};
18
- bindings: "";
19
- slots: {};
20
- events: {};
21
- };
22
- declare class __sveltets_Render<T extends BreadcrumbItem> {
23
- props(): ReturnType<typeof $$render<T>>['props'];
24
- events(): ReturnType<typeof $$render<T>>['events'];
25
- slots(): ReturnType<typeof $$render<T>>['slots'];
26
- bindings(): "";
27
- exports(): {};
28
- }
29
- interface $$IsomorphicComponent {
30
- new <T extends BreadcrumbItem>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
31
- $$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
32
- } & ReturnType<__sveltets_Render<T>['exports']>;
33
- <T extends BreadcrumbItem>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
34
- z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
35
- }
36
- declare const Breadcrumb: $$IsomorphicComponent;
37
- type Breadcrumb<T extends BreadcrumbItem> = InstanceType<typeof Breadcrumb<T>>;
15
+ declare const Breadcrumb: Component<BreadcrumbProps, {}, "">;
16
+ type Breadcrumb = ReturnType<typeof Breadcrumb>;
38
17
  export default Breadcrumb;