uisv 0.0.1 → 0.0.2

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 (317) hide show
  1. package/dist/components/alert.svelte +50 -20
  2. package/dist/components/alert.svelte.d.ts +0 -1
  3. package/dist/components/banner.svelte +257 -0
  4. package/dist/components/banner.svelte.d.ts +24 -0
  5. package/dist/components/button.svelte +20 -23
  6. package/dist/components/button.svelte.d.ts +3 -4
  7. package/dist/components/card.svelte +70 -0
  8. package/dist/components/card.svelte.d.ts +17 -0
  9. package/dist/components/chip.svelte +82 -0
  10. package/dist/components/chip.svelte.d.ts +17 -0
  11. package/dist/components/index.d.ts +10 -0
  12. package/dist/components/index.js +10 -0
  13. package/dist/components/placeholder.svelte +32 -0
  14. package/dist/components/placeholder.svelte.d.ts +7 -0
  15. package/dist/components/progress.svelte +124 -0
  16. package/dist/components/progress.svelte.d.ts +21 -0
  17. package/dist/components/switch.svelte +180 -0
  18. package/dist/components/switch.svelte.d.ts +27 -0
  19. package/dist/vite.d.ts +4 -0
  20. package/dist/vite.js +15 -3
  21. package/package.json +5 -1
  22. package/dist/theme/accordion.d.ts +0 -21
  23. package/dist/theme/accordion.js +0 -20
  24. package/dist/theme/alert.d.ts +0 -45
  25. package/dist/theme/alert.js +0 -102
  26. package/dist/theme/auth-form.d.ts +0 -21
  27. package/dist/theme/auth-form.js +0 -20
  28. package/dist/theme/avatar-group.d.ts +0 -41
  29. package/dist/theme/avatar-group.js +0 -40
  30. package/dist/theme/avatar.d.ts +0 -43
  31. package/dist/theme/avatar.js +0 -42
  32. package/dist/theme/badge.d.ts +0 -18
  33. package/dist/theme/badge.js +0 -131
  34. package/dist/theme/banner.d.ts +0 -29
  35. package/dist/theme/banner.js +0 -42
  36. package/dist/theme/blog-post.d.ts +0 -112
  37. package/dist/theme/blog-post.js +0 -116
  38. package/dist/theme/blog-posts.d.ts +0 -10
  39. package/dist/theme/blog-posts.js +0 -9
  40. package/dist/theme/breadcrumb.d.ts +0 -41
  41. package/dist/theme/breadcrumb.js +0 -42
  42. package/dist/theme/button.d.ts +0 -19
  43. package/dist/theme/button.js +0 -194
  44. package/dist/theme/calendar.d.ts +0 -59
  45. package/dist/theme/calendar.js +0 -68
  46. package/dist/theme/card.d.ts +0 -28
  47. package/dist/theme/card.js +0 -27
  48. package/dist/theme/carousel.d.ts +0 -36
  49. package/dist/theme/carousel.js +0 -38
  50. package/dist/theme/changelog-version.d.ts +0 -42
  51. package/dist/theme/changelog-version.js +0 -41
  52. package/dist/theme/changelog-versions.d.ts +0 -9
  53. package/dist/theme/changelog-versions.js +0 -8
  54. package/dist/theme/chat-message.d.ts +0 -101
  55. package/dist/theme/chat-message.js +0 -97
  56. package/dist/theme/chat-messages.d.ts +0 -15
  57. package/dist/theme/chat-messages.js +0 -14
  58. package/dist/theme/chat-palette.d.ts +0 -9
  59. package/dist/theme/chat-palette.js +0 -8
  60. package/dist/theme/chat-prompt-submit.d.ts +0 -6
  61. package/dist/theme/chat-prompt-submit.js +0 -5
  62. package/dist/theme/chat-prompt.d.ts +0 -29
  63. package/dist/theme/chat-prompt.js +0 -28
  64. package/dist/theme/checkbox-group.d.ts +0 -62
  65. package/dist/theme/checkbox-group.js +0 -105
  66. package/dist/theme/checkbox.d.ts +0 -92
  67. package/dist/theme/checkbox.js +0 -125
  68. package/dist/theme/chip.d.ts +0 -45
  69. package/dist/theme/chip.js +0 -62
  70. package/dist/theme/collapsible.d.ts +0 -7
  71. package/dist/theme/collapsible.js +0 -6
  72. package/dist/theme/color-picker.d.ts +0 -40
  73. package/dist/theme/color-picker.js +0 -39
  74. package/dist/theme/command-palette.d.ts +0 -47
  75. package/dist/theme/command-palette.js +0 -52
  76. package/dist/theme/container.d.ts +0 -4
  77. package/dist/theme/container.js +0 -3
  78. package/dist/theme/content/content-navigation.d.ts +0 -65
  79. package/dist/theme/content/content-navigation.js +0 -153
  80. package/dist/theme/content/content-search-button.d.ts +0 -7
  81. package/dist/theme/content/content-search-button.js +0 -6
  82. package/dist/theme/content/content-search.d.ts +0 -7
  83. package/dist/theme/content/content-search.js +0 -6
  84. package/dist/theme/content/content-surround.d.ts +0 -23
  85. package/dist/theme/content/content-surround.js +0 -21
  86. package/dist/theme/content/content-toc.d.ts +0 -53
  87. package/dist/theme/content/content-toc.js +0 -69
  88. package/dist/theme/content/index.d.ts +0 -5
  89. package/dist/theme/content/index.js +0 -5
  90. package/dist/theme/context-menu.d.ts +0 -91
  91. package/dist/theme/context-menu.js +0 -114
  92. package/dist/theme/dashboard-group.d.ts +0 -4
  93. package/dist/theme/dashboard-group.js +0 -3
  94. package/dist/theme/dashboard-navbar.d.ts +0 -22
  95. package/dist/theme/dashboard-navbar.js +0 -21
  96. package/dist/theme/dashboard-panel.d.ts +0 -18
  97. package/dist/theme/dashboard-panel.js +0 -17
  98. package/dist/theme/dashboard-resize-handle.d.ts +0 -4
  99. package/dist/theme/dashboard-resize-handle.js +0 -3
  100. package/dist/theme/dashboard-search-button.d.ts +0 -7
  101. package/dist/theme/dashboard-search-button.js +0 -6
  102. package/dist/theme/dashboard-search.d.ts +0 -7
  103. package/dist/theme/dashboard-search.js +0 -6
  104. package/dist/theme/dashboard-sidebar-collapse.d.ts +0 -10
  105. package/dist/theme/dashboard-sidebar-collapse.js +0 -9
  106. package/dist/theme/dashboard-sidebar-toggle.d.ts +0 -10
  107. package/dist/theme/dashboard-sidebar-toggle.js +0 -9
  108. package/dist/theme/dashboard-sidebar.d.ts +0 -38
  109. package/dist/theme/dashboard-sidebar.js +0 -37
  110. package/dist/theme/dashboard-toolbar.d.ts +0 -8
  111. package/dist/theme/dashboard-toolbar.js +0 -7
  112. package/dist/theme/drawer.d.ts +0 -54
  113. package/dist/theme/drawer.js +0 -110
  114. package/dist/theme/dropdown-menu.d.ts +0 -92
  115. package/dist/theme/dropdown-menu.js +0 -115
  116. package/dist/theme/error.d.ts +0 -10
  117. package/dist/theme/error.js +0 -9
  118. package/dist/theme/file-upload.d.ts +0 -100
  119. package/dist/theme/file-upload.js +0 -212
  120. package/dist/theme/footer-columns.d.ts +0 -27
  121. package/dist/theme/footer-columns.js +0 -25
  122. package/dist/theme/footer.d.ts +0 -12
  123. package/dist/theme/footer.js +0 -11
  124. package/dist/theme/form-field.d.ts +0 -41
  125. package/dist/theme/form-field.js +0 -30
  126. package/dist/theme/form.d.ts +0 -4
  127. package/dist/theme/form.js +0 -3
  128. package/dist/theme/header.d.ts +0 -26
  129. package/dist/theme/header.js +0 -25
  130. package/dist/theme/icons.d.ts +0 -44
  131. package/dist/theme/icons.js +0 -43
  132. package/dist/theme/index.d.ts +0 -99
  133. package/dist/theme/index.js +0 -99
  134. package/dist/theme/input-menu.d.ts +0 -159
  135. package/dist/theme/input-menu.js +0 -136
  136. package/dist/theme/input-number.d.ts +0 -16
  137. package/dist/theme/input-number.js +0 -130
  138. package/dist/theme/input-tags.d.ts +0 -86
  139. package/dist/theme/input-tags.js +0 -50
  140. package/dist/theme/input.d.ts +0 -20
  141. package/dist/theme/input.js +0 -179
  142. package/dist/theme/kbd.d.ts +0 -26
  143. package/dist/theme/kbd.js +0 -67
  144. package/dist/theme/link.d.ts +0 -18
  145. package/dist/theme/link.js +0 -19
  146. package/dist/theme/main.d.ts +0 -4
  147. package/dist/theme/main.js +0 -3
  148. package/dist/theme/marquee.d.ts +0 -47
  149. package/dist/theme/marquee.js +0 -56
  150. package/dist/theme/modal.d.ts +0 -30
  151. package/dist/theme/modal.js +0 -29
  152. package/dist/theme/navigation-menu.d.ts +0 -108
  153. package/dist/theme/navigation-menu.js +0 -315
  154. package/dist/theme/page-anchors.d.ts +0 -26
  155. package/dist/theme/page-anchors.js +0 -24
  156. package/dist/theme/page-aside.d.ts +0 -11
  157. package/dist/theme/page-aside.js +0 -10
  158. package/dist/theme/page-body.d.ts +0 -4
  159. package/dist/theme/page-body.js +0 -3
  160. package/dist/theme/page-card.d.ts +0 -90
  161. package/dist/theme/page-card.js +0 -156
  162. package/dist/theme/page-columns.d.ts +0 -4
  163. package/dist/theme/page-columns.js +0 -3
  164. package/dist/theme/page-cta.d.ts +0 -63
  165. package/dist/theme/page-cta.js +0 -62
  166. package/dist/theme/page-feature.d.ts +0 -27
  167. package/dist/theme/page-feature.js +0 -26
  168. package/dist/theme/page-grid.d.ts +0 -4
  169. package/dist/theme/page-grid.js +0 -3
  170. package/dist/theme/page-header.d.ts +0 -19
  171. package/dist/theme/page-header.js +0 -18
  172. package/dist/theme/page-hero.d.ts +0 -45
  173. package/dist/theme/page-hero.js +0 -44
  174. package/dist/theme/page-links.d.ts +0 -24
  175. package/dist/theme/page-links.js +0 -22
  176. package/dist/theme/page-list.d.ts +0 -9
  177. package/dist/theme/page-list.js +0 -8
  178. package/dist/theme/page-logos.d.ts +0 -16
  179. package/dist/theme/page-logos.js +0 -15
  180. package/dist/theme/page-section.d.ts +0 -85
  181. package/dist/theme/page-section.js +0 -75
  182. package/dist/theme/page.d.ts +0 -24
  183. package/dist/theme/page.js +0 -29
  184. package/dist/theme/pagination.d.ts +0 -14
  185. package/dist/theme/pagination.js +0 -13
  186. package/dist/theme/pin-input.d.ts +0 -45
  187. package/dist/theme/pin-input.js +0 -69
  188. package/dist/theme/popover.d.ts +0 -7
  189. package/dist/theme/popover.js +0 -6
  190. package/dist/theme/pricing-plan.d.ts +0 -81
  191. package/dist/theme/pricing-plan.js +0 -86
  192. package/dist/theme/pricing-plans.d.ts +0 -21
  193. package/dist/theme/pricing-plans.js +0 -20
  194. package/dist/theme/pricing-table.d.ts +0 -52
  195. package/dist/theme/pricing-table.js +0 -51
  196. package/dist/theme/progress.d.ts +0 -131
  197. package/dist/theme/progress.js +0 -241
  198. package/dist/theme/prose/a.d.ts +0 -5
  199. package/dist/theme/prose/a.js +0 -3
  200. package/dist/theme/prose/accordion-item.d.ts +0 -4
  201. package/dist/theme/prose/accordion-item.js +0 -3
  202. package/dist/theme/prose/accordion.d.ts +0 -7
  203. package/dist/theme/prose/accordion.js +0 -6
  204. package/dist/theme/prose/badge.d.ts +0 -4
  205. package/dist/theme/prose/badge.js +0 -3
  206. package/dist/theme/prose/blockquote.d.ts +0 -4
  207. package/dist/theme/prose/blockquote.js +0 -3
  208. package/dist/theme/prose/callout.d.ts +0 -25
  209. package/dist/theme/prose/callout.js +0 -42
  210. package/dist/theme/prose/card-group.d.ts +0 -4
  211. package/dist/theme/prose/card-group.js +0 -3
  212. package/dist/theme/prose/card.d.ts +0 -30
  213. package/dist/theme/prose/card.js +0 -45
  214. package/dist/theme/prose/code-collapse.d.ts +0 -20
  215. package/dist/theme/prose/code-collapse.js +0 -19
  216. package/dist/theme/prose/code-group.d.ts +0 -12
  217. package/dist/theme/prose/code-group.js +0 -10
  218. package/dist/theme/prose/code-icon.d.ts +0 -67
  219. package/dist/theme/prose/code-icon.js +0 -66
  220. package/dist/theme/prose/code-preview.d.ts +0 -15
  221. package/dist/theme/prose/code-preview.js +0 -14
  222. package/dist/theme/prose/code-tree.d.ts +0 -27
  223. package/dist/theme/prose/code-tree.js +0 -25
  224. package/dist/theme/prose/code.d.ts +0 -13
  225. package/dist/theme/prose/code.js +0 -12
  226. package/dist/theme/prose/collapsible.d.ts +0 -11
  227. package/dist/theme/prose/collapsible.js +0 -9
  228. package/dist/theme/prose/em.d.ts +0 -4
  229. package/dist/theme/prose/em.js +0 -3
  230. package/dist/theme/prose/field-group.d.ts +0 -4
  231. package/dist/theme/prose/field-group.js +0 -3
  232. package/dist/theme/prose/field.d.ts +0 -12
  233. package/dist/theme/prose/field.js +0 -11
  234. package/dist/theme/prose/h1.d.ts +0 -7
  235. package/dist/theme/prose/h1.js +0 -6
  236. package/dist/theme/prose/h2.d.ts +0 -10
  237. package/dist/theme/prose/h2.js +0 -8
  238. package/dist/theme/prose/h3.d.ts +0 -10
  239. package/dist/theme/prose/h3.js +0 -8
  240. package/dist/theme/prose/h4.d.ts +0 -7
  241. package/dist/theme/prose/h4.js +0 -6
  242. package/dist/theme/prose/hr.d.ts +0 -4
  243. package/dist/theme/prose/hr.js +0 -3
  244. package/dist/theme/prose/icon.d.ts +0 -4
  245. package/dist/theme/prose/icon.js +0 -3
  246. package/dist/theme/prose/img.d.ts +0 -21
  247. package/dist/theme/prose/img.js +0 -20
  248. package/dist/theme/prose/index.d.ts +0 -41
  249. package/dist/theme/prose/index.js +0 -41
  250. package/dist/theme/prose/kbd.d.ts +0 -4
  251. package/dist/theme/prose/kbd.js +0 -3
  252. package/dist/theme/prose/li.d.ts +0 -4
  253. package/dist/theme/prose/li.js +0 -3
  254. package/dist/theme/prose/ol.d.ts +0 -4
  255. package/dist/theme/prose/ol.js +0 -3
  256. package/dist/theme/prose/p.d.ts +0 -4
  257. package/dist/theme/prose/p.js +0 -3
  258. package/dist/theme/prose/pre.d.ts +0 -18
  259. package/dist/theme/prose/pre.js +0 -17
  260. package/dist/theme/prose/steps.d.ts +0 -14
  261. package/dist/theme/prose/steps.js +0 -13
  262. package/dist/theme/prose/strong.d.ts +0 -4
  263. package/dist/theme/prose/strong.js +0 -3
  264. package/dist/theme/prose/table.d.ts +0 -7
  265. package/dist/theme/prose/table.js +0 -6
  266. package/dist/theme/prose/tabs-item.d.ts +0 -4
  267. package/dist/theme/prose/tabs-item.js +0 -3
  268. package/dist/theme/prose/tabs.d.ts +0 -6
  269. package/dist/theme/prose/tabs.js +0 -5
  270. package/dist/theme/prose/tbody.d.ts +0 -4
  271. package/dist/theme/prose/tbody.js +0 -3
  272. package/dist/theme/prose/td.d.ts +0 -4
  273. package/dist/theme/prose/td.js +0 -3
  274. package/dist/theme/prose/th.d.ts +0 -4
  275. package/dist/theme/prose/th.js +0 -3
  276. package/dist/theme/prose/thead.d.ts +0 -4
  277. package/dist/theme/prose/thead.js +0 -3
  278. package/dist/theme/prose/tr.d.ts +0 -4
  279. package/dist/theme/prose/tr.js +0 -3
  280. package/dist/theme/prose/ul.d.ts +0 -4
  281. package/dist/theme/prose/ul.js +0 -3
  282. package/dist/theme/radio-group.d.ts +0 -117
  283. package/dist/theme/radio-group.js +0 -180
  284. package/dist/theme/select-menu.d.ts +0 -141
  285. package/dist/theme/select-menu.js +0 -21
  286. package/dist/theme/select.d.ts +0 -86
  287. package/dist/theme/select.js +0 -100
  288. package/dist/theme/separator.d.ts +0 -61
  289. package/dist/theme/separator.js +0 -104
  290. package/dist/theme/skeleton.d.ts +0 -4
  291. package/dist/theme/skeleton.js +0 -3
  292. package/dist/theme/slideover.d.ts +0 -42
  293. package/dist/theme/slideover.js +0 -59
  294. package/dist/theme/slider.d.ts +0 -60
  295. package/dist/theme/slider.js +0 -131
  296. package/dist/theme/stepper.d.ts +0 -94
  297. package/dist/theme/stepper.js +0 -137
  298. package/dist/theme/switch.d.ts +0 -84
  299. package/dist/theme/switch.js +0 -96
  300. package/dist/theme/table.d.ts +0 -56
  301. package/dist/theme/table.js +0 -99
  302. package/dist/theme/tabs.d.ts +0 -78
  303. package/dist/theme/tabs.js +0 -145
  304. package/dist/theme/textarea.d.ts +0 -72
  305. package/dist/theme/textarea.js +0 -39
  306. package/dist/theme/timeline.d.ts +0 -52
  307. package/dist/theme/timeline.js +0 -212
  308. package/dist/theme/toast.d.ts +0 -41
  309. package/dist/theme/toast.js +0 -47
  310. package/dist/theme/toaster.d.ts +0 -50
  311. package/dist/theme/toaster.js +0 -56
  312. package/dist/theme/tooltip.d.ts +0 -10
  313. package/dist/theme/tooltip.js +0 -9
  314. package/dist/theme/tree.d.ts +0 -66
  315. package/dist/theme/tree.js +0 -89
  316. package/dist/theme/user.d.ts +0 -85
  317. package/dist/theme/user.js +0 -83
@@ -5,6 +5,8 @@
5
5
  import type { ClassNameValue } from 'tailwind-merge';
6
6
  import { tv } from 'tailwind-variants';
7
7
  import { isSnippet } from '../utils/common.js';
8
+ import { defu } from 'defu';
9
+ import Button from './button.svelte';
8
10
 
9
11
  export type AlertProps = {
10
12
  title?: string | Snippet;
@@ -15,7 +17,6 @@
15
17
  position?: 'bottom' | 'right';
16
18
  actions?: ButtonProps[];
17
19
  close?: boolean | ButtonProps;
18
- closeiicon?: string | Snippet | Component;
19
20
  ui?: {
20
21
  base?: ClassNameValue;
21
22
  icon?: ClassNameValue;
@@ -33,7 +34,6 @@
33
34
  close,
34
35
  icon,
35
36
  actions = [],
36
- closeiicon = '',
37
37
  color = 'primary',
38
38
  variant = 'solid',
39
39
  position = 'bottom',
@@ -41,10 +41,20 @@
41
41
  onclose = () => {}
42
42
  }: AlertProps = $props();
43
43
 
44
+ const close_props = $derived.by(() => {
45
+ return defu(typeof close === 'boolean' ? {} : close, {
46
+ icon: 'i-lucide-x',
47
+ variant: 'link',
48
+ color: variant === 'solid' ? 'secondary' : color,
49
+ ui: {
50
+ icon: variant === 'solid' ? 'text-white' : ''
51
+ }
52
+ } as ButtonProps);
53
+ });
44
54
  const classes = $derived.by(() =>
45
55
  tv({
46
56
  slots: {
47
- base: 'flex gap-2 font-sans p-4 pb-2 rounded-lg',
57
+ base: 'flex gap-2 font-sans p-4 rounded-lg',
48
58
  icon: 'pi size-6',
49
59
  actions: '',
50
60
  description: 'text-opacity-50 text-sm',
@@ -207,7 +217,7 @@
207
217
  </script>
208
218
 
209
219
  <div class={classes.base({ class: [position === 'bottom' ? '' : 'flex', ui.base] })}>
210
- <div class="flex gap-2">
220
+ <div class="flex gap-2 flex-grow">
211
221
  {#if icon}
212
222
  <div class="size-6">
213
223
  {#if typeof icon === 'string'}
@@ -221,24 +231,44 @@
221
231
  </div>
222
232
  {/if}
223
233
 
224
- <div class="space-y-1">
225
- <div class={classes.title({ class: [ui.title] })}>
226
- {#if isSnippet(title)}
227
- {@render title()}
228
- {:else}
229
- {title}
230
- {/if}
231
- </div>
234
+ <div class="space-y-1 flex-grow">
235
+ {#if title}
236
+ <div class={classes.title({ class: [ui.title] })}>
237
+ {#if isSnippet(title)}
238
+ {@render title()}
239
+ {:else}
240
+ {title}
241
+ {/if}
242
+ </div>
243
+ {/if}
232
244
 
233
- <div class={classes.description({ class: [ui.title] })}>
234
- {#if isSnippet(description)}
235
- {@render description()}
236
- {:else}
237
- {description}
238
- {/if}
239
- </div>
245
+ {#if description}
246
+ <div class={classes.description({ class: [ui.title] })}>
247
+ {#if isSnippet(description)}
248
+ {@render description()}
249
+ {:else}
250
+ {description}
251
+ {/if}
252
+ </div>
253
+ {/if}
240
254
  </div>
255
+
256
+ {#if close}
257
+ <div>
258
+ <Button {...close_props} onclick={onclose} />
259
+ </div>
260
+ {/if}
241
261
  </div>
242
262
 
243
- <div></div>
263
+ {#if actions.length > 0}
264
+ <div class="flex gap-2 items-center pl-8">
265
+ {#each actions as action (action.label)}
266
+ <Button
267
+ {...defu(action, {
268
+ size: 'xs'
269
+ } as ButtonProps)}
270
+ />
271
+ {/each}
272
+ </div>
273
+ {/if}
244
274
  </div>
@@ -11,7 +11,6 @@ export type AlertProps = {
11
11
  position?: 'bottom' | 'right';
12
12
  actions?: ButtonProps[];
13
13
  close?: boolean | ButtonProps;
14
- closeiicon?: string | Snippet | Component;
15
14
  ui?: {
16
15
  base?: ClassNameValue;
17
16
  icon?: ClassNameValue;
@@ -0,0 +1,257 @@
1
+ <script module lang="ts">
2
+ import type { PropColor } from '../types.js';
3
+ import type { Component, Snippet } from 'svelte';
4
+ import type { ButtonProps } from './button.svelte';
5
+ import type { ClassNameValue } from 'tailwind-merge';
6
+ import { tv } from 'tailwind-variants';
7
+ import { isSnippet } from '../utils/common.js';
8
+ import { defu } from 'defu';
9
+ import { useId } from 'bits-ui';
10
+ import Button from './button.svelte';
11
+
12
+ export type BannerProps = {
13
+ title: string | Snippet;
14
+ icon?: string | Snippet | Component;
15
+ color?: PropColor;
16
+ variant?: 'solid' | 'outline' | 'soft' | 'subtle';
17
+ actions?: ButtonProps[];
18
+ close?: boolean | ButtonProps;
19
+ href?: string;
20
+ target?: string;
21
+ ui?: {
22
+ base?: ClassNameValue;
23
+ icon?: ClassNameValue;
24
+ description?: ClassNameValue;
25
+ title?: ClassNameValue;
26
+ };
27
+ onclose?: () => void | Promise<void>;
28
+ };
29
+ </script>
30
+
31
+ <script lang="ts">
32
+ let {
33
+ title,
34
+ close,
35
+ icon,
36
+ href,
37
+ target,
38
+ actions = [],
39
+ color = 'primary',
40
+ variant = 'solid',
41
+ ui = {},
42
+ onclose = () => {}
43
+ }: BannerProps = $props();
44
+ const id = useId();
45
+
46
+ const close_props = $derived.by(() => {
47
+ return defu(typeof close === 'boolean' ? {} : close, {
48
+ icon: 'i-lucide-x',
49
+ variant: 'link',
50
+ color: variant === 'solid' ? 'secondary' : color,
51
+ ui: {
52
+ icon: variant === 'solid' ? 'text-white' : ''
53
+ }
54
+ } as ButtonProps);
55
+ });
56
+ const classes = $derived.by(() =>
57
+ tv({
58
+ slots: {
59
+ base: 'flex items-center gap-2 font-sans p-4',
60
+ icon: 'pi size-6',
61
+ actions: '',
62
+ title: ''
63
+ },
64
+ variants: {
65
+ color: {
66
+ primary: '',
67
+ secondary: '',
68
+ info: '',
69
+ success: '',
70
+ warning: '',
71
+ error: ''
72
+ },
73
+ variant: {
74
+ solid: {
75
+ base: 'text-white',
76
+ description: 'text-white/90'
77
+ },
78
+ outline: 'border',
79
+ soft: '',
80
+ subtle: 'border'
81
+ }
82
+ },
83
+ compoundVariants: [
84
+ {
85
+ variant: 'solid',
86
+ color: 'primary',
87
+ class: 'bg-primary-500'
88
+ },
89
+ {
90
+ variant: 'solid',
91
+ color: 'secondary',
92
+ class: 'bg-secondary-900'
93
+ },
94
+ {
95
+ variant: 'solid',
96
+ color: 'info',
97
+ class: 'bg-info-500'
98
+ },
99
+ {
100
+ variant: 'solid',
101
+ color: 'success',
102
+ class: 'bg-success-500'
103
+ },
104
+ {
105
+ variant: 'solid',
106
+ color: 'warning',
107
+ class: 'bg-warning-500'
108
+ },
109
+ {
110
+ variant: 'solid',
111
+ color: 'error',
112
+ class: 'bg-error-500'
113
+ },
114
+
115
+ {
116
+ variant: 'outline',
117
+ color: 'primary',
118
+ class: 'border-primary-300 text-primary-500'
119
+ },
120
+ {
121
+ variant: 'outline',
122
+ color: 'secondary',
123
+ class: 'border-secondary-300 text-secondary-900'
124
+ },
125
+ {
126
+ variant: 'outline',
127
+ color: 'info',
128
+ class: 'border-info-300 text-info-500'
129
+ },
130
+ {
131
+ variant: 'outline',
132
+ color: 'success',
133
+ class: 'border-success-300 text-success-500'
134
+ },
135
+ {
136
+ variant: 'outline',
137
+ color: 'warning',
138
+ class: 'border-warning-300 text-warning-500'
139
+ },
140
+ {
141
+ variant: 'outline',
142
+ color: 'error',
143
+ class: 'border-error-300 text-error-500'
144
+ },
145
+
146
+ {
147
+ variant: 'soft',
148
+ color: 'primary',
149
+ class: 'bg-primary-100 text-primary-500'
150
+ },
151
+ {
152
+ variant: 'soft',
153
+ color: 'secondary',
154
+ class: 'bg-secondary-50 text-secondary-900'
155
+ },
156
+ {
157
+ variant: 'soft',
158
+ color: 'info',
159
+ class: 'bg-info-50 text-info-500'
160
+ },
161
+ {
162
+ variant: 'soft',
163
+ color: 'success',
164
+ class: 'bg-success-50 text-success-500'
165
+ },
166
+ {
167
+ variant: 'soft',
168
+ color: 'warning',
169
+ class: 'bg-warning-50 text-warning-500'
170
+ },
171
+ {
172
+ variant: 'soft',
173
+ color: 'error',
174
+ class: 'bg-error-50 text-error-500'
175
+ },
176
+
177
+ {
178
+ variant: 'subtle',
179
+ color: 'primary',
180
+ class: 'bg-primary-100 text-primary-500 border-primary-300'
181
+ },
182
+ {
183
+ variant: 'subtle',
184
+ color: 'secondary',
185
+ class: 'bg-secondary-50 text-secondary-900 border-secondary-300'
186
+ },
187
+ {
188
+ variant: 'subtle',
189
+ color: 'info',
190
+ class: 'bg-info-50 text-info-500 border-info-300'
191
+ },
192
+ {
193
+ variant: 'subtle',
194
+ color: 'success',
195
+ class: 'bg-success-50 text-success-500 border-success-300'
196
+ },
197
+ {
198
+ variant: 'subtle',
199
+ color: 'warning',
200
+ class: 'bg-warning-50 text-warning-500 border-warning-300'
201
+ },
202
+ {
203
+ variant: 'subtle',
204
+ color: 'error',
205
+ class: 'bg-error-50 text-error-500 border-error-300'
206
+ }
207
+ ]
208
+ })({ color, variant })
209
+ );
210
+ </script>
211
+
212
+ <svelte:element
213
+ this={href ? 'a' : 'button'}
214
+ {href}
215
+ {target}
216
+ class={classes.base({ class: [ui.base] })}
217
+ >
218
+ <div class="flex flex-grow gap-2 text-sm items-center">
219
+ {#if icon}
220
+ <div class="size-6">
221
+ {#if typeof icon === 'string'}
222
+ <div class={classes.icon({ class: [icon] })}></div>
223
+ {:else if isSnippet(icon)}
224
+ {@render icon()}
225
+ {:else}
226
+ {@const Icon = icon}
227
+ <Icon />
228
+ {/if}
229
+ </div>
230
+ {/if}
231
+
232
+ <div class={classes.title({ class: [ui.title] })}>
233
+ {#if isSnippet(title)}
234
+ {@render title()}
235
+ {:else}
236
+ {title}
237
+ {/if}
238
+ </div>
239
+
240
+ {#if actions.length > 0}
241
+ {#each actions as action (action.label)}
242
+ <Button
243
+ {...defu(action, {
244
+ size: 'xs',
245
+ color: 'secondary'
246
+ } as ButtonProps)}
247
+ />
248
+ {/each}
249
+ {/if}
250
+ </div>
251
+
252
+ {#if close}
253
+ <div>
254
+ <Button {...close_props} onclick={onclose} />
255
+ </div>
256
+ {/if}
257
+ </svelte:element>
@@ -0,0 +1,24 @@
1
+ import type { PropColor } from '../types.js';
2
+ import type { Component, Snippet } from 'svelte';
3
+ import type { ButtonProps } from './button.svelte';
4
+ import type { ClassNameValue } from 'tailwind-merge';
5
+ export type BannerProps = {
6
+ title: string | Snippet;
7
+ icon?: string | Snippet | Component;
8
+ color?: PropColor;
9
+ variant?: 'solid' | 'outline' | 'soft' | 'subtle';
10
+ actions?: ButtonProps[];
11
+ close?: boolean | ButtonProps;
12
+ href?: string;
13
+ target?: string;
14
+ ui?: {
15
+ base?: ClassNameValue;
16
+ icon?: ClassNameValue;
17
+ description?: ClassNameValue;
18
+ title?: ClassNameValue;
19
+ };
20
+ onclose?: () => void | Promise<void>;
21
+ };
22
+ declare const Banner: Component<BannerProps, {}, "">;
23
+ type Banner = ReturnType<typeof Banner>;
24
+ export default Banner;
@@ -15,9 +15,9 @@
15
15
  loadingicon?: string;
16
16
  /** When true, the loading icon will be displayed. */
17
17
  loading?: boolean;
18
- /** When `true`, the icon will be displayed on the right side. */
19
- trailingicon?: boolean;
20
- /** Display an icon based on the `leading` and `trailing` props. */
18
+ /** The position of the icon, including the loading icon */
19
+ iconposition?: 'left' | 'right';
20
+ /** Icon when `loading` is `false` */
21
21
  icon?: string | Snippet | Component;
22
22
  /** Route Location the link should navigate to when clicked on. */
23
23
  href?: string;
@@ -50,7 +50,6 @@
50
50
  </script>
51
51
 
52
52
  <script lang="ts">
53
- import { Button } from 'bits-ui';
54
53
  // import { FORM_LOADING_CONTEXT_KEY } from '../utils/keys.js';
55
54
  import { type Component, type Snippet } from 'svelte';
56
55
  import { isSnippet } from '../utils/common.js';
@@ -64,6 +63,7 @@
64
63
  size = 'md',
65
64
  variant = 'solid',
66
65
  color = 'primary',
66
+ iconposition = 'left',
67
67
  children,
68
68
  // active,
69
69
  // activecolor,
@@ -79,7 +79,6 @@
79
79
  loading,
80
80
  loadingicon,
81
81
  target,
82
- trailingicon,
83
82
  type
84
83
  }: ButtonProps = $props();
85
84
 
@@ -139,7 +138,7 @@
139
138
  {
140
139
  color: 'secondary',
141
140
  variant: 'solid',
142
- class: 'bg-secondary-900 hover:(bg-secondary-900)'
141
+ class: 'bg-secondary-900 hover:(bg-secondary-800)'
143
142
  },
144
143
  {
145
144
  color: 'info',
@@ -165,32 +164,32 @@
165
164
  {
166
165
  color: 'primary',
167
166
  variant: 'outline',
168
- class: 'border-primary-500 text-primary-500 hover:(bg-primary-50)'
167
+ class: 'border-primary-300 text-primary-500 hover:(bg-primary-50)'
169
168
  },
170
169
  {
171
170
  color: 'secondary',
172
171
  variant: 'outline',
173
- class: 'border-secondary-900 text-secondary-500 hover:(bg-secondary-50)'
172
+ class: 'border-secondary-300 hover:(bg-secondary-100)'
174
173
  },
175
174
  {
176
175
  color: 'info',
177
176
  variant: 'outline',
178
- class: 'border-blue-500 text-blue-500 hover:(bg-blue-50)'
177
+ class: 'border-blue-300 text-blue-500 hover:(bg-blue-50)'
179
178
  },
180
179
  {
181
180
  color: 'success',
182
181
  variant: 'outline',
183
- class: 'border-green-500 text-green-500 hover:(bg-green-50)'
182
+ class: 'border-green-300 text-green-500 hover:(bg-green-50)'
184
183
  },
185
184
  {
186
185
  color: 'error',
187
186
  variant: 'outline',
188
- class: 'border-red-500 text-red-500 hover:(bg-red-50)'
187
+ class: 'border-red-300 text-red-500 hover:(bg-red-50)'
189
188
  },
190
189
  {
191
190
  color: 'warning',
192
191
  variant: 'outline',
193
- class: 'border-yellow-500 text-yellow-500 hover:(bg-yellow-50)'
192
+ class: 'border-yellow-300 text-yellow-500 hover:(bg-yellow-50)'
194
193
  },
195
194
 
196
195
  {
@@ -201,7 +200,7 @@
201
200
  {
202
201
  color: 'secondary',
203
202
  variant: 'soft',
204
- class: 'bg-secondary-100 text-secondary-800 hover:(bg-secondary-50)'
203
+ class: 'bg-secondary-100 text-secondary-800 hover:(bg-secondary-200)'
205
204
  },
206
205
  {
207
206
  color: 'info',
@@ -294,7 +293,7 @@
294
293
  {
295
294
  color: 'secondary',
296
295
  variant: 'link',
297
- class: 'text-secondary-900 hover:(text-secondary-900)'
296
+ class: 'text-secondary-500 hover:(text-secondary-700)'
298
297
  },
299
298
  {
300
299
  color: 'info',
@@ -332,28 +331,26 @@
332
331
 
333
332
  {#if href}
334
333
  <a
335
- bind:this={ref}
336
334
  {href}
337
335
  {target}
338
336
  class={[classes.base(), !children && icon ? 'px-0 aspect-square' : '', ui.base]}
339
337
  onclick={onClickWrapper}
340
338
  >
341
- {@render Inside()}
339
+ {@render Content()}
342
340
  </a>
343
341
  {:else}
344
- <Button.Root
345
- bind:ref
342
+ <button
346
343
  {type}
347
344
  disabled={disabled || is_loading}
348
345
  class={[classes.base(), !children && icon ? 'px-0 aspect-square' : '', ui.base]}
349
346
  onclick={onClickWrapper}
350
347
  >
351
- {@render Inside()}
352
- </Button.Root>
348
+ {@render Content()}
349
+ </button>
353
350
  {/if}
354
351
 
355
- {#snippet Inside()}
356
- {#if !trailingicon}
352
+ {#snippet Content()}
353
+ {#if iconposition === 'left'}
357
354
  {@render Icon()}
358
355
  {/if}
359
356
 
@@ -363,7 +360,7 @@
363
360
  {@render children?.()}
364
361
  {/if}
365
362
 
366
- {#if trailingicon}
363
+ {#if iconposition !== 'left'}
367
364
  {@render Icon()}
368
365
  {/if}
369
366
  {/snippet}
@@ -12,9 +12,9 @@ export type ButtonProps = {
12
12
  loadingicon?: string;
13
13
  /** When true, the loading icon will be displayed. */
14
14
  loading?: boolean;
15
- /** When `true`, the icon will be displayed on the right side. */
16
- trailingicon?: boolean;
17
- /** Display an icon based on the `leading` and `trailing` props. */
15
+ /** The position of the icon, including the loading icon */
16
+ iconposition?: 'left' | 'right';
17
+ /** Icon when `loading` is `false` */
18
18
  icon?: string | Snippet | Component;
19
19
  /** Route Location the link should navigate to when clicked on. */
20
20
  href?: string;
@@ -42,7 +42,6 @@ export type ButtonProps = {
42
42
  };
43
43
  children?: Snippet;
44
44
  };
45
- import { Button } from 'bits-ui';
46
45
  import { type Component, type Snippet } from 'svelte';
47
46
  import type { ClassValue } from 'svelte/elements';
48
47
  import type { PropColor } from '../types.js';
@@ -0,0 +1,70 @@
1
+ <script module lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import type { ClassNameValue } from 'tailwind-merge';
4
+ import { tv } from 'tailwind-variants';
5
+
6
+ export type CardProps = {
7
+ children: Snippet;
8
+ header?: Snippet;
9
+ footer?: Snippet;
10
+ variant?: 'solid' | 'outline' | 'soft' | 'subtle';
11
+ ui?: {
12
+ base?: ClassNameValue;
13
+ header?: ClassNameValue;
14
+ content?: ClassNameValue;
15
+ footer?: ClassNameValue;
16
+ };
17
+ };
18
+ </script>
19
+
20
+ <script lang="ts">
21
+ let { header, children, footer, variant = 'solid', ui = {} }: CardProps = $props();
22
+
23
+ const classes = $derived.by(() =>
24
+ tv({
25
+ slots: {
26
+ base: 'rounded overflow-hidden',
27
+ header: 'p-4 sm:px-6',
28
+ content: 'p-4 sm:p-6',
29
+ footer: 'p-4 sm:px-6'
30
+ },
31
+ variants: {
32
+ variant: {
33
+ solid: {
34
+ base: 'bg-secondary-900 text-secondary-50',
35
+ header: 'border-transparent',
36
+ footer: 'border-transparent'
37
+ },
38
+ outline: {
39
+ base: 'border border-secondary-300 divide-y divide-secondary-300'
40
+ },
41
+ soft: {
42
+ base: 'bg-secondary-50 divide-y divide-secondary-300'
43
+ },
44
+ subtle: {
45
+ base: 'bg-secondary-50 border-secondary-300 border divide-y divide-secondary-300'
46
+ }
47
+ }
48
+ },
49
+ compoundVariants: []
50
+ })({ variant })
51
+ );
52
+ </script>
53
+
54
+ <div class={classes.base({ class: [ui.base] })}>
55
+ {#if header}
56
+ <div class={classes.header({ class: [ui.header] })}>
57
+ {@render header()}
58
+ </div>
59
+ {/if}
60
+
61
+ <div class={classes.content({ class: ui.content })}>
62
+ {@render children()}
63
+ </div>
64
+
65
+ {#if footer}
66
+ <div class={classes.header({ class: [ui.header] })}>
67
+ {@render footer()}
68
+ </div>
69
+ {/if}
70
+ </div>
@@ -0,0 +1,17 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { ClassNameValue } from 'tailwind-merge';
3
+ export type CardProps = {
4
+ children: Snippet;
5
+ header?: Snippet;
6
+ footer?: Snippet;
7
+ variant?: 'solid' | 'outline' | 'soft' | 'subtle';
8
+ ui?: {
9
+ base?: ClassNameValue;
10
+ header?: ClassNameValue;
11
+ content?: ClassNameValue;
12
+ footer?: ClassNameValue;
13
+ };
14
+ };
15
+ declare const Card: import("svelte").Component<CardProps, {}, "">;
16
+ type Card = ReturnType<typeof Card>;
17
+ export default Card;