uisv 0.0.1

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 (319) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +26 -0
  3. package/dist/components/alert.svelte +244 -0
  4. package/dist/components/alert.svelte.d.ts +25 -0
  5. package/dist/components/badge.svelte +227 -0
  6. package/dist/components/badge.svelte.d.ts +19 -0
  7. package/dist/components/button.svelte +383 -0
  8. package/dist/components/button.svelte.d.ts +51 -0
  9. package/dist/components/index.d.ts +6 -0
  10. package/dist/components/index.js +6 -0
  11. package/dist/index.d.ts +2 -0
  12. package/dist/index.js +2 -0
  13. package/dist/theme/accordion.d.ts +21 -0
  14. package/dist/theme/accordion.js +20 -0
  15. package/dist/theme/alert.d.ts +45 -0
  16. package/dist/theme/alert.js +102 -0
  17. package/dist/theme/auth-form.d.ts +21 -0
  18. package/dist/theme/auth-form.js +20 -0
  19. package/dist/theme/avatar-group.d.ts +41 -0
  20. package/dist/theme/avatar-group.js +40 -0
  21. package/dist/theme/avatar.d.ts +43 -0
  22. package/dist/theme/avatar.js +42 -0
  23. package/dist/theme/badge.d.ts +18 -0
  24. package/dist/theme/badge.js +131 -0
  25. package/dist/theme/banner.d.ts +29 -0
  26. package/dist/theme/banner.js +42 -0
  27. package/dist/theme/blog-post.d.ts +112 -0
  28. package/dist/theme/blog-post.js +116 -0
  29. package/dist/theme/blog-posts.d.ts +10 -0
  30. package/dist/theme/blog-posts.js +9 -0
  31. package/dist/theme/breadcrumb.d.ts +41 -0
  32. package/dist/theme/breadcrumb.js +42 -0
  33. package/dist/theme/button.d.ts +19 -0
  34. package/dist/theme/button.js +194 -0
  35. package/dist/theme/calendar.d.ts +59 -0
  36. package/dist/theme/calendar.js +68 -0
  37. package/dist/theme/card.d.ts +28 -0
  38. package/dist/theme/card.js +27 -0
  39. package/dist/theme/carousel.d.ts +36 -0
  40. package/dist/theme/carousel.js +38 -0
  41. package/dist/theme/changelog-version.d.ts +42 -0
  42. package/dist/theme/changelog-version.js +41 -0
  43. package/dist/theme/changelog-versions.d.ts +9 -0
  44. package/dist/theme/changelog-versions.js +8 -0
  45. package/dist/theme/chat-message.d.ts +101 -0
  46. package/dist/theme/chat-message.js +97 -0
  47. package/dist/theme/chat-messages.d.ts +15 -0
  48. package/dist/theme/chat-messages.js +14 -0
  49. package/dist/theme/chat-palette.d.ts +9 -0
  50. package/dist/theme/chat-palette.js +8 -0
  51. package/dist/theme/chat-prompt-submit.d.ts +6 -0
  52. package/dist/theme/chat-prompt-submit.js +5 -0
  53. package/dist/theme/chat-prompt.d.ts +29 -0
  54. package/dist/theme/chat-prompt.js +28 -0
  55. package/dist/theme/checkbox-group.d.ts +62 -0
  56. package/dist/theme/checkbox-group.js +105 -0
  57. package/dist/theme/checkbox.d.ts +92 -0
  58. package/dist/theme/checkbox.js +125 -0
  59. package/dist/theme/chip.d.ts +45 -0
  60. package/dist/theme/chip.js +62 -0
  61. package/dist/theme/collapsible.d.ts +7 -0
  62. package/dist/theme/collapsible.js +6 -0
  63. package/dist/theme/color-picker.d.ts +40 -0
  64. package/dist/theme/color-picker.js +39 -0
  65. package/dist/theme/command-palette.d.ts +47 -0
  66. package/dist/theme/command-palette.js +52 -0
  67. package/dist/theme/container.d.ts +4 -0
  68. package/dist/theme/container.js +3 -0
  69. package/dist/theme/content/content-navigation.d.ts +65 -0
  70. package/dist/theme/content/content-navigation.js +153 -0
  71. package/dist/theme/content/content-search-button.d.ts +7 -0
  72. package/dist/theme/content/content-search-button.js +6 -0
  73. package/dist/theme/content/content-search.d.ts +7 -0
  74. package/dist/theme/content/content-search.js +6 -0
  75. package/dist/theme/content/content-surround.d.ts +23 -0
  76. package/dist/theme/content/content-surround.js +21 -0
  77. package/dist/theme/content/content-toc.d.ts +53 -0
  78. package/dist/theme/content/content-toc.js +69 -0
  79. package/dist/theme/content/index.d.ts +5 -0
  80. package/dist/theme/content/index.js +5 -0
  81. package/dist/theme/context-menu.d.ts +91 -0
  82. package/dist/theme/context-menu.js +114 -0
  83. package/dist/theme/dashboard-group.d.ts +4 -0
  84. package/dist/theme/dashboard-group.js +3 -0
  85. package/dist/theme/dashboard-navbar.d.ts +22 -0
  86. package/dist/theme/dashboard-navbar.js +21 -0
  87. package/dist/theme/dashboard-panel.d.ts +18 -0
  88. package/dist/theme/dashboard-panel.js +17 -0
  89. package/dist/theme/dashboard-resize-handle.d.ts +4 -0
  90. package/dist/theme/dashboard-resize-handle.js +3 -0
  91. package/dist/theme/dashboard-search-button.d.ts +7 -0
  92. package/dist/theme/dashboard-search-button.js +6 -0
  93. package/dist/theme/dashboard-search.d.ts +7 -0
  94. package/dist/theme/dashboard-search.js +6 -0
  95. package/dist/theme/dashboard-sidebar-collapse.d.ts +10 -0
  96. package/dist/theme/dashboard-sidebar-collapse.js +9 -0
  97. package/dist/theme/dashboard-sidebar-toggle.d.ts +10 -0
  98. package/dist/theme/dashboard-sidebar-toggle.js +9 -0
  99. package/dist/theme/dashboard-sidebar.d.ts +38 -0
  100. package/dist/theme/dashboard-sidebar.js +37 -0
  101. package/dist/theme/dashboard-toolbar.d.ts +8 -0
  102. package/dist/theme/dashboard-toolbar.js +7 -0
  103. package/dist/theme/drawer.d.ts +54 -0
  104. package/dist/theme/drawer.js +110 -0
  105. package/dist/theme/dropdown-menu.d.ts +92 -0
  106. package/dist/theme/dropdown-menu.js +115 -0
  107. package/dist/theme/error.d.ts +10 -0
  108. package/dist/theme/error.js +9 -0
  109. package/dist/theme/file-upload.d.ts +100 -0
  110. package/dist/theme/file-upload.js +212 -0
  111. package/dist/theme/footer-columns.d.ts +27 -0
  112. package/dist/theme/footer-columns.js +25 -0
  113. package/dist/theme/footer.d.ts +12 -0
  114. package/dist/theme/footer.js +11 -0
  115. package/dist/theme/form-field.d.ts +41 -0
  116. package/dist/theme/form-field.js +30 -0
  117. package/dist/theme/form.d.ts +4 -0
  118. package/dist/theme/form.js +3 -0
  119. package/dist/theme/header.d.ts +26 -0
  120. package/dist/theme/header.js +25 -0
  121. package/dist/theme/icons.d.ts +44 -0
  122. package/dist/theme/icons.js +43 -0
  123. package/dist/theme/index.d.ts +99 -0
  124. package/dist/theme/index.js +99 -0
  125. package/dist/theme/input-menu.d.ts +159 -0
  126. package/dist/theme/input-menu.js +136 -0
  127. package/dist/theme/input-number.d.ts +16 -0
  128. package/dist/theme/input-number.js +130 -0
  129. package/dist/theme/input-tags.d.ts +86 -0
  130. package/dist/theme/input-tags.js +50 -0
  131. package/dist/theme/input.d.ts +20 -0
  132. package/dist/theme/input.js +179 -0
  133. package/dist/theme/kbd.d.ts +26 -0
  134. package/dist/theme/kbd.js +67 -0
  135. package/dist/theme/link.d.ts +18 -0
  136. package/dist/theme/link.js +19 -0
  137. package/dist/theme/main.d.ts +4 -0
  138. package/dist/theme/main.js +3 -0
  139. package/dist/theme/marquee.d.ts +47 -0
  140. package/dist/theme/marquee.js +56 -0
  141. package/dist/theme/modal.d.ts +30 -0
  142. package/dist/theme/modal.js +29 -0
  143. package/dist/theme/navigation-menu.d.ts +108 -0
  144. package/dist/theme/navigation-menu.js +315 -0
  145. package/dist/theme/page-anchors.d.ts +26 -0
  146. package/dist/theme/page-anchors.js +24 -0
  147. package/dist/theme/page-aside.d.ts +11 -0
  148. package/dist/theme/page-aside.js +10 -0
  149. package/dist/theme/page-body.d.ts +4 -0
  150. package/dist/theme/page-body.js +3 -0
  151. package/dist/theme/page-card.d.ts +90 -0
  152. package/dist/theme/page-card.js +156 -0
  153. package/dist/theme/page-columns.d.ts +4 -0
  154. package/dist/theme/page-columns.js +3 -0
  155. package/dist/theme/page-cta.d.ts +63 -0
  156. package/dist/theme/page-cta.js +62 -0
  157. package/dist/theme/page-feature.d.ts +27 -0
  158. package/dist/theme/page-feature.js +26 -0
  159. package/dist/theme/page-grid.d.ts +4 -0
  160. package/dist/theme/page-grid.js +3 -0
  161. package/dist/theme/page-header.d.ts +19 -0
  162. package/dist/theme/page-header.js +18 -0
  163. package/dist/theme/page-hero.d.ts +45 -0
  164. package/dist/theme/page-hero.js +44 -0
  165. package/dist/theme/page-links.d.ts +24 -0
  166. package/dist/theme/page-links.js +22 -0
  167. package/dist/theme/page-list.d.ts +9 -0
  168. package/dist/theme/page-list.js +8 -0
  169. package/dist/theme/page-logos.d.ts +16 -0
  170. package/dist/theme/page-logos.js +15 -0
  171. package/dist/theme/page-section.d.ts +85 -0
  172. package/dist/theme/page-section.js +75 -0
  173. package/dist/theme/page.d.ts +24 -0
  174. package/dist/theme/page.js +29 -0
  175. package/dist/theme/pagination.d.ts +14 -0
  176. package/dist/theme/pagination.js +13 -0
  177. package/dist/theme/pin-input.d.ts +45 -0
  178. package/dist/theme/pin-input.js +69 -0
  179. package/dist/theme/popover.d.ts +7 -0
  180. package/dist/theme/popover.js +6 -0
  181. package/dist/theme/pricing-plan.d.ts +81 -0
  182. package/dist/theme/pricing-plan.js +86 -0
  183. package/dist/theme/pricing-plans.d.ts +21 -0
  184. package/dist/theme/pricing-plans.js +20 -0
  185. package/dist/theme/pricing-table.d.ts +52 -0
  186. package/dist/theme/pricing-table.js +51 -0
  187. package/dist/theme/progress.d.ts +131 -0
  188. package/dist/theme/progress.js +241 -0
  189. package/dist/theme/prose/a.d.ts +5 -0
  190. package/dist/theme/prose/a.js +3 -0
  191. package/dist/theme/prose/accordion-item.d.ts +4 -0
  192. package/dist/theme/prose/accordion-item.js +3 -0
  193. package/dist/theme/prose/accordion.d.ts +7 -0
  194. package/dist/theme/prose/accordion.js +6 -0
  195. package/dist/theme/prose/badge.d.ts +4 -0
  196. package/dist/theme/prose/badge.js +3 -0
  197. package/dist/theme/prose/blockquote.d.ts +4 -0
  198. package/dist/theme/prose/blockquote.js +3 -0
  199. package/dist/theme/prose/callout.d.ts +25 -0
  200. package/dist/theme/prose/callout.js +42 -0
  201. package/dist/theme/prose/card-group.d.ts +4 -0
  202. package/dist/theme/prose/card-group.js +3 -0
  203. package/dist/theme/prose/card.d.ts +30 -0
  204. package/dist/theme/prose/card.js +45 -0
  205. package/dist/theme/prose/code-collapse.d.ts +20 -0
  206. package/dist/theme/prose/code-collapse.js +19 -0
  207. package/dist/theme/prose/code-group.d.ts +12 -0
  208. package/dist/theme/prose/code-group.js +10 -0
  209. package/dist/theme/prose/code-icon.d.ts +67 -0
  210. package/dist/theme/prose/code-icon.js +66 -0
  211. package/dist/theme/prose/code-preview.d.ts +15 -0
  212. package/dist/theme/prose/code-preview.js +14 -0
  213. package/dist/theme/prose/code-tree.d.ts +27 -0
  214. package/dist/theme/prose/code-tree.js +25 -0
  215. package/dist/theme/prose/code.d.ts +13 -0
  216. package/dist/theme/prose/code.js +12 -0
  217. package/dist/theme/prose/collapsible.d.ts +11 -0
  218. package/dist/theme/prose/collapsible.js +9 -0
  219. package/dist/theme/prose/em.d.ts +4 -0
  220. package/dist/theme/prose/em.js +3 -0
  221. package/dist/theme/prose/field-group.d.ts +4 -0
  222. package/dist/theme/prose/field-group.js +3 -0
  223. package/dist/theme/prose/field.d.ts +12 -0
  224. package/dist/theme/prose/field.js +11 -0
  225. package/dist/theme/prose/h1.d.ts +7 -0
  226. package/dist/theme/prose/h1.js +6 -0
  227. package/dist/theme/prose/h2.d.ts +10 -0
  228. package/dist/theme/prose/h2.js +8 -0
  229. package/dist/theme/prose/h3.d.ts +10 -0
  230. package/dist/theme/prose/h3.js +8 -0
  231. package/dist/theme/prose/h4.d.ts +7 -0
  232. package/dist/theme/prose/h4.js +6 -0
  233. package/dist/theme/prose/hr.d.ts +4 -0
  234. package/dist/theme/prose/hr.js +3 -0
  235. package/dist/theme/prose/icon.d.ts +4 -0
  236. package/dist/theme/prose/icon.js +3 -0
  237. package/dist/theme/prose/img.d.ts +21 -0
  238. package/dist/theme/prose/img.js +20 -0
  239. package/dist/theme/prose/index.d.ts +41 -0
  240. package/dist/theme/prose/index.js +41 -0
  241. package/dist/theme/prose/kbd.d.ts +4 -0
  242. package/dist/theme/prose/kbd.js +3 -0
  243. package/dist/theme/prose/li.d.ts +4 -0
  244. package/dist/theme/prose/li.js +3 -0
  245. package/dist/theme/prose/ol.d.ts +4 -0
  246. package/dist/theme/prose/ol.js +3 -0
  247. package/dist/theme/prose/p.d.ts +4 -0
  248. package/dist/theme/prose/p.js +3 -0
  249. package/dist/theme/prose/pre.d.ts +18 -0
  250. package/dist/theme/prose/pre.js +17 -0
  251. package/dist/theme/prose/steps.d.ts +14 -0
  252. package/dist/theme/prose/steps.js +13 -0
  253. package/dist/theme/prose/strong.d.ts +4 -0
  254. package/dist/theme/prose/strong.js +3 -0
  255. package/dist/theme/prose/table.d.ts +7 -0
  256. package/dist/theme/prose/table.js +6 -0
  257. package/dist/theme/prose/tabs-item.d.ts +4 -0
  258. package/dist/theme/prose/tabs-item.js +3 -0
  259. package/dist/theme/prose/tabs.d.ts +6 -0
  260. package/dist/theme/prose/tabs.js +5 -0
  261. package/dist/theme/prose/tbody.d.ts +4 -0
  262. package/dist/theme/prose/tbody.js +3 -0
  263. package/dist/theme/prose/td.d.ts +4 -0
  264. package/dist/theme/prose/td.js +3 -0
  265. package/dist/theme/prose/th.d.ts +4 -0
  266. package/dist/theme/prose/th.js +3 -0
  267. package/dist/theme/prose/thead.d.ts +4 -0
  268. package/dist/theme/prose/thead.js +3 -0
  269. package/dist/theme/prose/tr.d.ts +4 -0
  270. package/dist/theme/prose/tr.js +3 -0
  271. package/dist/theme/prose/ul.d.ts +4 -0
  272. package/dist/theme/prose/ul.js +3 -0
  273. package/dist/theme/radio-group.d.ts +117 -0
  274. package/dist/theme/radio-group.js +180 -0
  275. package/dist/theme/select-menu.d.ts +141 -0
  276. package/dist/theme/select-menu.js +21 -0
  277. package/dist/theme/select.d.ts +86 -0
  278. package/dist/theme/select.js +100 -0
  279. package/dist/theme/separator.d.ts +61 -0
  280. package/dist/theme/separator.js +104 -0
  281. package/dist/theme/skeleton.d.ts +4 -0
  282. package/dist/theme/skeleton.js +3 -0
  283. package/dist/theme/slideover.d.ts +42 -0
  284. package/dist/theme/slideover.js +59 -0
  285. package/dist/theme/slider.d.ts +60 -0
  286. package/dist/theme/slider.js +131 -0
  287. package/dist/theme/stepper.d.ts +94 -0
  288. package/dist/theme/stepper.js +137 -0
  289. package/dist/theme/switch.d.ts +84 -0
  290. package/dist/theme/switch.js +96 -0
  291. package/dist/theme/table.d.ts +56 -0
  292. package/dist/theme/table.js +99 -0
  293. package/dist/theme/tabs.d.ts +78 -0
  294. package/dist/theme/tabs.js +145 -0
  295. package/dist/theme/textarea.d.ts +72 -0
  296. package/dist/theme/textarea.js +39 -0
  297. package/dist/theme/timeline.d.ts +52 -0
  298. package/dist/theme/timeline.js +212 -0
  299. package/dist/theme/toast.d.ts +41 -0
  300. package/dist/theme/toast.js +47 -0
  301. package/dist/theme/toaster.d.ts +50 -0
  302. package/dist/theme/toaster.js +56 -0
  303. package/dist/theme/tooltip.d.ts +10 -0
  304. package/dist/theme/tooltip.js +9 -0
  305. package/dist/theme/tree.d.ts +66 -0
  306. package/dist/theme/tree.js +89 -0
  307. package/dist/theme/user.d.ts +85 -0
  308. package/dist/theme/user.js +83 -0
  309. package/dist/types.d.ts +7 -0
  310. package/dist/types.js +1 -0
  311. package/dist/utils/common.d.ts +14 -0
  312. package/dist/utils/common.js +18 -0
  313. package/dist/utils/keys.d.ts +8 -0
  314. package/dist/utils/keys.js +8 -0
  315. package/dist/utils/types.d.ts +1 -0
  316. package/dist/utils/types.js +1 -0
  317. package/dist/vite.d.ts +34 -0
  318. package/dist/vite.js +73 -0
  319. package/package.json +82 -0
@@ -0,0 +1,383 @@
1
+ <script lang="ts" module>
2
+ export type ButtonVariant = 'link' | 'solid' | 'outline' | 'soft' | 'subtle' | 'ghost';
3
+
4
+ export type ButtonProps = {
5
+ /** The underlying DOM element being rendered. You can bind to this to get a reference to the element. */
6
+ ref?: HTMLButtonElement | HTMLAnchorElement;
7
+ /** Where to display the linked URL, as the name for a browsing context. */
8
+ target?: null | '_blank' | '_parent' | '_self' | '_top' | (string & {});
9
+ /** Force the link to be active independent of the current route. */
10
+ // active?: boolean;
11
+ disabled?: boolean;
12
+ /** The type of the button when not a link. */
13
+ type?: 'submit' | 'reset' | 'button' | null | undefined;
14
+ /** When true, the icon will be displayed on the right side. */
15
+ loadingicon?: string;
16
+ /** When true, the loading icon will be displayed. */
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. */
21
+ icon?: string | Snippet | Component;
22
+ /** Route Location the link should navigate to when clicked on. */
23
+ href?: string;
24
+ label?: string;
25
+ /**
26
+ * @defaultValue 'primary'
27
+ */
28
+ color?: PropColor;
29
+ // activecolor?: PropColor;
30
+ /**
31
+ * @defaultValue 'solid'
32
+ */
33
+ variant?: ButtonVariant;
34
+ // activevariant?: ButtonVariant;
35
+ /**
36
+ * @defaultValue 'md'
37
+ */
38
+ size?: 'md' | 'xs' | 'sm' | 'lg' | 'xl';
39
+ /** Render the button full width. */
40
+ block?: boolean;
41
+ /** Set loading state automatically based on the `@click` promise state */
42
+ loadingauto?: boolean;
43
+ onclick?: (event: MouseEvent) => void | Promise<void>;
44
+ ui?: {
45
+ base?: ClassValue;
46
+ icon?: ClassValue;
47
+ };
48
+ children?: Snippet;
49
+ };
50
+ </script>
51
+
52
+ <script lang="ts">
53
+ import { Button } from 'bits-ui';
54
+ // import { FORM_LOADING_CONTEXT_KEY } from '../utils/keys.js';
55
+ import { type Component, type Snippet } from 'svelte';
56
+ import { isSnippet } from '../utils/common.js';
57
+ import { tv } from 'tailwind-variants';
58
+ import type { ClassValue } from 'svelte/elements';
59
+ import type { PropColor } from '../types.js';
60
+
61
+ // let form_loading = getContext<{ value: boolean } | undefined>(FORM_LOADING_CONTEXT_KEY);
62
+ let {
63
+ ref = $bindable(),
64
+ size = 'md',
65
+ variant = 'solid',
66
+ color = 'primary',
67
+ children,
68
+ // active,
69
+ // activecolor,
70
+ // activevariant,
71
+ block,
72
+ label,
73
+ loadingauto,
74
+ onclick,
75
+ ui = {},
76
+ disabled,
77
+ href,
78
+ icon,
79
+ loading,
80
+ loadingicon,
81
+ target,
82
+ trailingicon,
83
+ type
84
+ }: ButtonProps = $props();
85
+
86
+ let internal_loading = $state(false);
87
+ const is_loading = $derived.by(() => {
88
+ if (loading) return true;
89
+ if (loadingauto) return internal_loading;
90
+ return false;
91
+ });
92
+
93
+ const classes = $derived.by(() =>
94
+ tv({
95
+ slots: {
96
+ icon: '',
97
+ base: 'transition flex items-center font-sans'
98
+ },
99
+ variants: {
100
+ color: {
101
+ primary: '',
102
+ secondary: '',
103
+ error: '',
104
+ success: '',
105
+ info: '',
106
+ warning: ''
107
+ },
108
+ variant: {
109
+ link: '',
110
+ solid: 'text-white',
111
+ outline: 'border',
112
+ soft: '',
113
+ subtle: 'border',
114
+ ghost: ''
115
+ },
116
+ size: {
117
+ xs: {
118
+ base: 'font-medium text-xs px-2 h-6 rounded gap-1',
119
+ icon: 'size-4'
120
+ },
121
+ sm: { base: 'font-medium text-xs px-2 h-7 rounded gap-1', icon: 'size-4' },
122
+ md: { base: 'font-medium text-sm rounded-md px-2 h-8 gap-2', icon: 'size-5' },
123
+ lg: { base: 'font-medium text-sm px-3 h-9 rounded-md gap-2', icon: 'size-6' },
124
+ xl: { base: 'font-medium px-3 h-10 rounded-md gap-2', icon: 'size-6' }
125
+ },
126
+ block: {
127
+ true: 'w-full'
128
+ },
129
+ disabled: {
130
+ true: 'cursor-not-allowed'
131
+ }
132
+ },
133
+ compoundVariants: [
134
+ {
135
+ color: 'primary',
136
+ variant: 'solid',
137
+ class: 'bg-primary-500 hover:(bg-primary-400)'
138
+ },
139
+ {
140
+ color: 'secondary',
141
+ variant: 'solid',
142
+ class: 'bg-secondary-900 hover:(bg-secondary-900)'
143
+ },
144
+ {
145
+ color: 'info',
146
+ variant: 'solid',
147
+ class: 'bg-blue-500 hover:(bg-blue-400)'
148
+ },
149
+ {
150
+ color: 'success',
151
+ variant: 'solid',
152
+ class: 'bg-green-500 hover:(bg-green-400)'
153
+ },
154
+ {
155
+ color: 'error',
156
+ variant: 'solid',
157
+ class: 'bg-red-500 hover:(bg-red-400)'
158
+ },
159
+ {
160
+ color: 'warning',
161
+ variant: 'solid',
162
+ class: 'bg-yellow-500 hover:(bg-yellow-400)'
163
+ },
164
+
165
+ {
166
+ color: 'primary',
167
+ variant: 'outline',
168
+ class: 'border-primary-500 text-primary-500 hover:(bg-primary-50)'
169
+ },
170
+ {
171
+ color: 'secondary',
172
+ variant: 'outline',
173
+ class: 'border-secondary-900 text-secondary-500 hover:(bg-secondary-50)'
174
+ },
175
+ {
176
+ color: 'info',
177
+ variant: 'outline',
178
+ class: 'border-blue-500 text-blue-500 hover:(bg-blue-50)'
179
+ },
180
+ {
181
+ color: 'success',
182
+ variant: 'outline',
183
+ class: 'border-green-500 text-green-500 hover:(bg-green-50)'
184
+ },
185
+ {
186
+ color: 'error',
187
+ variant: 'outline',
188
+ class: 'border-red-500 text-red-500 hover:(bg-red-50)'
189
+ },
190
+ {
191
+ color: 'warning',
192
+ variant: 'outline',
193
+ class: 'border-yellow-500 text-yellow-500 hover:(bg-yellow-50)'
194
+ },
195
+
196
+ {
197
+ color: 'primary',
198
+ variant: 'soft',
199
+ class: ' bg-primary-50 text-primary-500 hover:(bg-primary-100)'
200
+ },
201
+ {
202
+ color: 'secondary',
203
+ variant: 'soft',
204
+ class: 'bg-secondary-100 text-secondary-800 hover:(bg-secondary-50)'
205
+ },
206
+ {
207
+ color: 'info',
208
+ variant: 'soft',
209
+ class: 'bg-blue-100 text-blue-500 hover:(bg-blue-50)'
210
+ },
211
+ {
212
+ color: 'success',
213
+ variant: 'soft',
214
+ class: 'bg-green-100 text-green-500 hover:(bg-green-50)'
215
+ },
216
+ {
217
+ color: 'error',
218
+ variant: 'soft',
219
+ class: 'bg-red-100 text-red-500 hover:(bg-red-50)'
220
+ },
221
+ {
222
+ color: 'warning',
223
+ variant: 'soft',
224
+ class: 'bg-yellow-100 text-yellow-500 hover:(bg-yellow-50)'
225
+ },
226
+
227
+ {
228
+ color: 'primary',
229
+ variant: 'subtle',
230
+ class: 'bg-primary-50 text-primary-500 border-primary-200 hover:(bg-primary-100)'
231
+ },
232
+ {
233
+ color: 'secondary',
234
+ variant: 'subtle',
235
+ class: 'bg-secondary-50 text-secondary-800 border-secondary-300 hover:(bg-secondary-100)'
236
+ },
237
+ {
238
+ color: 'info',
239
+ variant: 'subtle',
240
+ class: 'bg-blue-50 text-blue-600 border-blue-200 hover:(bg-blue-100)'
241
+ },
242
+ {
243
+ color: 'success',
244
+ variant: 'subtle',
245
+ class: 'bg-green-100 text-green-600 border-green-300 hover:(bg-green-100)'
246
+ },
247
+ {
248
+ color: 'error',
249
+ variant: 'subtle',
250
+ class: 'bg-red-50 text-red-600 border-red-200 hover:(bg-red-100)'
251
+ },
252
+ {
253
+ color: 'warning',
254
+ variant: 'subtle',
255
+ class: 'bg-yellow-50 text-yellow-600 border-yellow-300 hover:(bg-yellow-100)'
256
+ },
257
+
258
+ {
259
+ color: 'primary',
260
+ variant: 'ghost',
261
+ class: 'text-primary-500 hover:(bg-primary-100)'
262
+ },
263
+ {
264
+ color: 'secondary',
265
+ variant: 'ghost',
266
+ class: 'text-secondary-900 hover:(bg-secondary-100)'
267
+ },
268
+ {
269
+ color: 'info',
270
+ variant: 'ghost',
271
+ class: 'text-blue-600 hover:(bg-blue-100)'
272
+ },
273
+ {
274
+ color: 'success',
275
+ variant: 'ghost',
276
+ class: 'text-green-600 hover:(bg-green-100)'
277
+ },
278
+ {
279
+ color: 'error',
280
+ variant: 'ghost',
281
+ class: 'text-red-600 hover:(bg-red-100)'
282
+ },
283
+ {
284
+ color: 'warning',
285
+ variant: 'ghost',
286
+ class: 'text-yellow-600 hover:(bg-yellow-100)'
287
+ },
288
+
289
+ {
290
+ color: 'primary',
291
+ variant: 'link',
292
+ class: 'text-primary-500 hover:(text-primary-400)'
293
+ },
294
+ {
295
+ color: 'secondary',
296
+ variant: 'link',
297
+ class: 'text-secondary-900 hover:(text-secondary-900)'
298
+ },
299
+ {
300
+ color: 'info',
301
+ variant: 'link',
302
+ class: 'text-blue-500 hover:(text-blue-400)'
303
+ },
304
+ {
305
+ color: 'success',
306
+ variant: 'link',
307
+ class: 'text-green-500 hover:(text-green-400)'
308
+ },
309
+ {
310
+ color: 'error',
311
+ variant: 'link',
312
+ class: 'text-red-500 hover:(text-red-400)'
313
+ },
314
+ {
315
+ color: 'warning',
316
+ variant: 'link',
317
+ class: 'text-yellow-500 hover:(text-yellow-400)'
318
+ }
319
+ ]
320
+ })({ variant, color, size, block, disabled: disabled || is_loading })
321
+ );
322
+
323
+ async function onClickWrapper(event: MouseEvent) {
324
+ if (!onclick) return;
325
+ internal_loading = true;
326
+
327
+ await onclick(event);
328
+
329
+ internal_loading = false;
330
+ }
331
+ </script>
332
+
333
+ {#if href}
334
+ <a
335
+ bind:this={ref}
336
+ {href}
337
+ {target}
338
+ class={[classes.base(), !children && icon ? 'px-0 aspect-square' : '', ui.base]}
339
+ onclick={onClickWrapper}
340
+ >
341
+ {@render Inside()}
342
+ </a>
343
+ {:else}
344
+ <Button.Root
345
+ bind:ref
346
+ {type}
347
+ disabled={disabled || is_loading}
348
+ class={[classes.base(), !children && icon ? 'px-0 aspect-square' : '', ui.base]}
349
+ onclick={onClickWrapper}
350
+ >
351
+ {@render Inside()}
352
+ </Button.Root>
353
+ {/if}
354
+
355
+ {#snippet Inside()}
356
+ {#if !trailingicon}
357
+ {@render Icon()}
358
+ {/if}
359
+
360
+ {#if label}
361
+ {label}
362
+ {:else}
363
+ {@render children?.()}
364
+ {/if}
365
+
366
+ {#if trailingicon}
367
+ {@render Icon()}
368
+ {/if}
369
+ {/snippet}
370
+
371
+ {#snippet Icon()}
372
+ {@const IconCom = is_loading ? loadingicon || 'i-lucide-loader-circle' : icon}
373
+
374
+ {#if IconCom}
375
+ {#if typeof IconCom === 'string'}
376
+ <div class={['pi', IconCom, is_loading ? 'animate-spin' : '', classes.icon(), ui.icon]}></div>
377
+ {:else if isSnippet(IconCom)}
378
+ {@render IconCom()}
379
+ {:else}
380
+ <IconCom />
381
+ {/if}
382
+ {/if}
383
+ {/snippet}
@@ -0,0 +1,51 @@
1
+ export type ButtonVariant = 'link' | 'solid' | 'outline' | 'soft' | 'subtle' | 'ghost';
2
+ export type ButtonProps = {
3
+ /** The underlying DOM element being rendered. You can bind to this to get a reference to the element. */
4
+ ref?: HTMLButtonElement | HTMLAnchorElement;
5
+ /** Where to display the linked URL, as the name for a browsing context. */
6
+ target?: null | '_blank' | '_parent' | '_self' | '_top' | (string & {});
7
+ /** Force the link to be active independent of the current route. */
8
+ disabled?: boolean;
9
+ /** The type of the button when not a link. */
10
+ type?: 'submit' | 'reset' | 'button' | null | undefined;
11
+ /** When true, the icon will be displayed on the right side. */
12
+ loadingicon?: string;
13
+ /** When true, the loading icon will be displayed. */
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. */
18
+ icon?: string | Snippet | Component;
19
+ /** Route Location the link should navigate to when clicked on. */
20
+ href?: string;
21
+ label?: string;
22
+ /**
23
+ * @defaultValue 'primary'
24
+ */
25
+ color?: PropColor;
26
+ /**
27
+ * @defaultValue 'solid'
28
+ */
29
+ variant?: ButtonVariant;
30
+ /**
31
+ * @defaultValue 'md'
32
+ */
33
+ size?: 'md' | 'xs' | 'sm' | 'lg' | 'xl';
34
+ /** Render the button full width. */
35
+ block?: boolean;
36
+ /** Set loading state automatically based on the `@click` promise state */
37
+ loadingauto?: boolean;
38
+ onclick?: (event: MouseEvent) => void | Promise<void>;
39
+ ui?: {
40
+ base?: ClassValue;
41
+ icon?: ClassValue;
42
+ };
43
+ children?: Snippet;
44
+ };
45
+ import { Button } from 'bits-ui';
46
+ import { type Component, type Snippet } from 'svelte';
47
+ import type { ClassValue } from 'svelte/elements';
48
+ import type { PropColor } from '../types.js';
49
+ declare const Button: Component<ButtonProps, {}, "ref">;
50
+ type Button = ReturnType<typeof Button>;
51
+ export default Button;
@@ -0,0 +1,6 @@
1
+ export * from './button.svelte';
2
+ export { default as Button } from './button.svelte';
3
+ export * from './badge.svelte';
4
+ export { default as Badge } from './badge.svelte';
5
+ export * from './alert.svelte';
6
+ export { default as Alert } from './alert.svelte';
@@ -0,0 +1,6 @@
1
+ export * from './button.svelte';
2
+ export { default as Button } from './button.svelte';
3
+ export * from './badge.svelte';
4
+ export { default as Badge } from './badge.svelte';
5
+ export * from './alert.svelte';
6
+ export { default as Alert } from './alert.svelte';
@@ -0,0 +1,2 @@
1
+ export * from './components/index.js';
2
+ export * from './types.js';
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './components/index.js';
2
+ export * from './types.js';
@@ -0,0 +1,21 @@
1
+ declare const _default: {
2
+ slots: {
3
+ root: string;
4
+ item: string;
5
+ header: string;
6
+ trigger: string;
7
+ content: string;
8
+ body: string;
9
+ leadingIcon: string;
10
+ trailingIcon: string;
11
+ label: string;
12
+ };
13
+ variants: {
14
+ disabled: {
15
+ true: {
16
+ trigger: string;
17
+ };
18
+ };
19
+ };
20
+ };
21
+ export default _default;
@@ -0,0 +1,20 @@
1
+ export default {
2
+ slots: {
3
+ root: 'w-full',
4
+ item: 'border-b border-default last:border-b-0',
5
+ header: 'flex',
6
+ trigger: 'group flex-1 flex items-center gap-1.5 font-medium text-sm py-3.5 focus-visible:outline-primary min-w-0',
7
+ content: 'data-[state=open]:animate-[accordion-down_200ms_ease-out] data-[state=closed]:animate-[accordion-up_200ms_ease-out] overflow-hidden focus:outline-none',
8
+ body: 'text-sm pb-3.5',
9
+ leadingIcon: 'shrink-0 size-5',
10
+ trailingIcon: 'shrink-0 size-5 ms-auto group-data-[state=open]:rotate-180 transition-transform duration-200',
11
+ label: 'text-start break-words'
12
+ },
13
+ variants: {
14
+ disabled: {
15
+ true: {
16
+ trigger: 'cursor-not-allowed opacity-75'
17
+ }
18
+ }
19
+ }
20
+ };
@@ -0,0 +1,45 @@
1
+ declare const _default: (options: Required<ModuleOptions>) => {
2
+ slots: {
3
+ root: string;
4
+ wrapper: string;
5
+ title: string;
6
+ description: string;
7
+ icon: string;
8
+ avatar: string;
9
+ avatarSize: string;
10
+ actions: string;
11
+ close: string;
12
+ };
13
+ variants: {
14
+ color: {
15
+ neutral: string;
16
+ };
17
+ variant: {
18
+ solid: string;
19
+ outline: string;
20
+ soft: string;
21
+ subtle: string;
22
+ };
23
+ orientation: {
24
+ horizontal: {
25
+ root: string;
26
+ actions: string;
27
+ };
28
+ vertical: {
29
+ root: string;
30
+ actions: string;
31
+ };
32
+ };
33
+ title: {
34
+ true: {
35
+ description: string;
36
+ };
37
+ };
38
+ };
39
+ compoundVariants: any[];
40
+ defaultVariants: {
41
+ color: string;
42
+ variant: string;
43
+ };
44
+ };
45
+ export default _default;
@@ -0,0 +1,102 @@
1
+ export default (options) => ({
2
+ slots: {
3
+ root: 'relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5',
4
+ wrapper: 'min-w-0 flex-1 flex flex-col',
5
+ title: 'text-sm font-medium',
6
+ description: 'text-sm opacity-90',
7
+ icon: 'shrink-0 size-5',
8
+ avatar: 'shrink-0',
9
+ avatarSize: '2xl',
10
+ actions: 'flex flex-wrap gap-1.5 shrink-0',
11
+ close: 'p-0'
12
+ },
13
+ variants: {
14
+ color: {
15
+ ...Object.fromEntries((options.theme.colors || []).map((color) => [color, ''])),
16
+ neutral: ''
17
+ },
18
+ variant: {
19
+ solid: '',
20
+ outline: '',
21
+ soft: '',
22
+ subtle: ''
23
+ },
24
+ orientation: {
25
+ horizontal: {
26
+ root: 'items-center',
27
+ actions: 'items-center'
28
+ },
29
+ vertical: {
30
+ root: 'items-start',
31
+ actions: 'items-start mt-2.5'
32
+ }
33
+ },
34
+ title: {
35
+ true: {
36
+ description: 'mt-1'
37
+ }
38
+ }
39
+ },
40
+ compoundVariants: [
41
+ ...(options.theme.colors || []).map((color) => ({
42
+ color,
43
+ variant: 'solid',
44
+ class: {
45
+ root: `bg-${color} text-inverted`
46
+ }
47
+ })),
48
+ ...(options.theme.colors || []).map((color) => ({
49
+ color,
50
+ variant: 'outline',
51
+ class: {
52
+ root: `text-${color} ring ring-inset ring-${color}/25`
53
+ }
54
+ })),
55
+ ...(options.theme.colors || []).map((color) => ({
56
+ color,
57
+ variant: 'soft',
58
+ class: {
59
+ root: `bg-${color}/10 text-${color}`
60
+ }
61
+ })),
62
+ ...(options.theme.colors || []).map((color) => ({
63
+ color,
64
+ variant: 'subtle',
65
+ class: {
66
+ root: `bg-${color}/10 text-${color} ring ring-inset ring-${color}/25`
67
+ }
68
+ })),
69
+ {
70
+ color: 'neutral',
71
+ variant: 'solid',
72
+ class: {
73
+ root: 'text-inverted bg-inverted'
74
+ }
75
+ },
76
+ {
77
+ color: 'neutral',
78
+ variant: 'outline',
79
+ class: {
80
+ root: 'text-highlighted bg-default ring ring-inset ring-default'
81
+ }
82
+ },
83
+ {
84
+ color: 'neutral',
85
+ variant: 'soft',
86
+ class: {
87
+ root: 'text-highlighted bg-elevated/50'
88
+ }
89
+ },
90
+ {
91
+ color: 'neutral',
92
+ variant: 'subtle',
93
+ class: {
94
+ root: 'text-highlighted bg-elevated/50 ring ring-inset ring-accented'
95
+ }
96
+ }
97
+ ],
98
+ defaultVariants: {
99
+ color: 'primary',
100
+ variant: 'solid'
101
+ }
102
+ });
@@ -0,0 +1,21 @@
1
+ declare const _default: {
2
+ slots: {
3
+ root: string;
4
+ header: string;
5
+ leading: string;
6
+ leadingIcon: string;
7
+ title: string;
8
+ description: string;
9
+ body: string;
10
+ providers: string;
11
+ checkbox: string;
12
+ select: string;
13
+ password: string;
14
+ otp: string;
15
+ input: string;
16
+ separator: string;
17
+ form: string;
18
+ footer: string;
19
+ };
20
+ };
21
+ export default _default;
@@ -0,0 +1,20 @@
1
+ export default {
2
+ slots: {
3
+ root: 'w-full space-y-6',
4
+ header: 'flex flex-col text-center',
5
+ leading: 'mb-2',
6
+ leadingIcon: 'size-8 shrink-0 inline-block',
7
+ title: 'text-xl text-pretty font-semibold text-highlighted',
8
+ description: 'mt-1 text-base text-pretty text-muted',
9
+ body: 'gap-y-6 flex flex-col',
10
+ providers: 'space-y-3',
11
+ checkbox: '',
12
+ select: '',
13
+ password: 'w-full',
14
+ otp: 'w-full justify-center',
15
+ input: 'w-full',
16
+ separator: '',
17
+ form: 'space-y-5',
18
+ footer: 'text-sm text-center text-muted mt-2'
19
+ }
20
+ };