sv5ui 1.2.0 → 1.4.0

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 (71) hide show
  1. package/README.md +16 -11
  2. package/dist/CheckboxGroup/CheckboxGroup.svelte +215 -0
  3. package/dist/CheckboxGroup/CheckboxGroup.svelte.d.ts +5 -0
  4. package/dist/CheckboxGroup/checkbox-group.types.d.ts +130 -0
  5. package/dist/CheckboxGroup/checkbox-group.types.js +1 -0
  6. package/dist/CheckboxGroup/checkbox-group.variants.d.ts +553 -0
  7. package/dist/CheckboxGroup/checkbox-group.variants.js +231 -0
  8. package/dist/CheckboxGroup/index.d.ts +2 -0
  9. package/dist/CheckboxGroup/index.js +1 -0
  10. package/dist/Collapsible/Collapsible.svelte +69 -0
  11. package/dist/Collapsible/Collapsible.svelte.d.ts +6 -0
  12. package/dist/Collapsible/CollapsibleTestWrapper.svelte +17 -0
  13. package/dist/Collapsible/CollapsibleTestWrapper.svelte.d.ts +4 -0
  14. package/dist/Collapsible/collapsible.types.d.ts +75 -0
  15. package/dist/Collapsible/collapsible.types.js +1 -0
  16. package/dist/Collapsible/collapsible.variants.d.ts +53 -0
  17. package/dist/Collapsible/collapsible.variants.js +21 -0
  18. package/dist/Collapsible/index.d.ts +2 -0
  19. package/dist/Collapsible/index.js +1 -0
  20. package/dist/Command/Command.svelte +183 -0
  21. package/dist/Command/Command.svelte.d.ts +6 -0
  22. package/dist/Command/CommandTestWrapper.svelte +13 -0
  23. package/dist/Command/CommandTestWrapper.svelte.d.ts +4 -0
  24. package/dist/Command/command.types.d.ts +98 -0
  25. package/dist/Command/command.types.js +1 -0
  26. package/dist/Command/command.variants.d.ts +226 -0
  27. package/dist/Command/command.variants.js +86 -0
  28. package/dist/Command/index.d.ts +2 -0
  29. package/dist/Command/index.js +1 -0
  30. package/dist/FileUpload/FileUpload.svelte +561 -0
  31. package/dist/FileUpload/FileUpload.svelte.d.ts +8 -0
  32. package/dist/FileUpload/file-upload.types.d.ts +164 -0
  33. package/dist/FileUpload/file-upload.types.js +1 -0
  34. package/dist/FileUpload/file-upload.variants.d.ts +397 -0
  35. package/dist/FileUpload/file-upload.variants.js +224 -0
  36. package/dist/FileUpload/index.d.ts +2 -0
  37. package/dist/FileUpload/index.js +1 -0
  38. package/dist/PinInput/PinInput.svelte +150 -0
  39. package/dist/PinInput/PinInput.svelte.d.ts +6 -0
  40. package/dist/PinInput/index.d.ts +2 -0
  41. package/dist/PinInput/index.js +1 -0
  42. package/dist/PinInput/pin-input.types.d.ts +99 -0
  43. package/dist/PinInput/pin-input.types.js +1 -0
  44. package/dist/PinInput/pin-input.variants.d.ts +303 -0
  45. package/dist/PinInput/pin-input.variants.js +196 -0
  46. package/dist/Select/select.variants.js +1 -1
  47. package/dist/SelectMenu/select-menu.variants.js +1 -1
  48. package/dist/Slider/Slider.svelte +135 -0
  49. package/dist/Slider/Slider.svelte.d.ts +6 -0
  50. package/dist/Slider/index.d.ts +2 -0
  51. package/dist/Slider/index.js +1 -0
  52. package/dist/Slider/slider.types.d.ts +55 -0
  53. package/dist/Slider/slider.types.js +1 -0
  54. package/dist/Slider/slider.variants.d.ts +383 -0
  55. package/dist/Slider/slider.variants.js +102 -0
  56. package/dist/Toast/Toaster.svelte +618 -0
  57. package/dist/Toast/Toaster.svelte.d.ts +5 -0
  58. package/dist/Toast/index.d.ts +4 -0
  59. package/dist/Toast/index.js +2 -0
  60. package/dist/Toast/toast.d.ts +38 -0
  61. package/dist/Toast/toast.js +73 -0
  62. package/dist/Toast/toast.types.d.ts +19 -0
  63. package/dist/Toast/toast.types.js +1 -0
  64. package/dist/Toast/toast.variants.d.ts +7 -0
  65. package/dist/Toast/toast.variants.js +5 -0
  66. package/dist/config.d.ts +5 -0
  67. package/dist/config.js +6 -1
  68. package/dist/index.d.ts +7 -0
  69. package/dist/index.js +7 -0
  70. package/dist/theme.css +36 -0
  71. package/package.json +2 -1
@@ -0,0 +1,73 @@
1
+ import { toast as sonnerToast } from 'svelte-sonner';
2
+ import { mount, unmount } from 'svelte';
3
+ import Icon from '../Icon/Icon.svelte';
4
+ import Avatar from '../Avatar/Avatar.svelte';
5
+ function createIconComponent(name) {
6
+ function SvelteSonnerIcon(anchor) {
7
+ if (!anchor.parentNode)
8
+ return { destroy() { } };
9
+ const instance = mount(Icon, {
10
+ target: anchor.parentNode,
11
+ anchor,
12
+ props: { name, size: '18' }
13
+ });
14
+ return {
15
+ destroy() {
16
+ unmount(instance);
17
+ }
18
+ };
19
+ }
20
+ return SvelteSonnerIcon;
21
+ }
22
+ function createAvatarComponent(props) {
23
+ function SvelteSonnerAvatar(anchor) {
24
+ if (!anchor.parentNode)
25
+ return { destroy() { } };
26
+ const instance = mount(Avatar, {
27
+ target: anchor.parentNode,
28
+ anchor,
29
+ props: { size: 'sm', ...props }
30
+ });
31
+ return {
32
+ destroy() {
33
+ unmount(instance);
34
+ }
35
+ };
36
+ }
37
+ return SvelteSonnerAvatar;
38
+ }
39
+ function resolveOptions(data) {
40
+ if (!data)
41
+ return data;
42
+ const { color, icon, avatar, ...rest } = data;
43
+ const resolved = { ...rest };
44
+ // Color -> class
45
+ if (color) {
46
+ const existing = resolved.class ?? '';
47
+ resolved.class = `${existing} sv5ui-color-${color}`.trim();
48
+ }
49
+ // Avatar takes priority over icon
50
+ if (avatar) {
51
+ resolved.icon = createAvatarComponent(avatar);
52
+ }
53
+ else if (typeof icon === 'string') {
54
+ resolved.icon = createIconComponent(icon);
55
+ }
56
+ else if (icon !== undefined) {
57
+ resolved.icon = icon;
58
+ }
59
+ return resolved;
60
+ }
61
+ function toastFn(message, data) {
62
+ return sonnerToast(message, resolveOptions(data));
63
+ }
64
+ toastFn.success = (message, data) => sonnerToast.success(message, resolveOptions(data));
65
+ toastFn.error = (message, data) => sonnerToast.error(message, resolveOptions(data));
66
+ toastFn.warning = (message, data) => sonnerToast.warning(message, resolveOptions(data));
67
+ toastFn.info = (message, data) => sonnerToast.info(message, resolveOptions(data));
68
+ toastFn.loading = (message, data) => sonnerToast.loading(message, resolveOptions(data));
69
+ toastFn.promise = sonnerToast.promise;
70
+ toastFn.dismiss = sonnerToast.dismiss;
71
+ toastFn.custom = sonnerToast.custom;
72
+ toastFn.message = sonnerToast.message;
73
+ export { toastFn as toast };
@@ -0,0 +1,19 @@
1
+ import type { ClassNameValue } from 'tailwind-merge';
2
+ import type { ToasterProps as SonnerToasterProps } from 'svelte-sonner';
3
+ import type { ToastVariant } from './toast.variants.js';
4
+ export type ToasterProps = Omit<SonnerToasterProps, 'class' | 'toastOptions' | 'richColors'> & {
5
+ /**
6
+ * The visual style variant.
7
+ * - `outline`: Border with surface background, semantic border accent per type (default)
8
+ * - `soft`: Light tinted background per type
9
+ * - `subtle`: Light tinted background + semantic border per type
10
+ * - `solid`: Full semantic color background per type
11
+ * - `accent`: Left color stripe with surface background
12
+ * @default 'outline'
13
+ */
14
+ variant?: ToastVariant;
15
+ /**
16
+ * Additional CSS classes for the toaster container.
17
+ */
18
+ class?: ClassNameValue;
19
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ export type ToastVariant = 'solid' | 'outline' | 'soft' | 'subtle' | 'accent';
2
+ export type ToastColor = 'primary' | 'secondary' | 'tertiary' | 'success' | 'warning' | 'error' | 'info';
3
+ export declare const toastDefaults: {
4
+ defaultVariants: {
5
+ variant: ToastVariant;
6
+ };
7
+ };
@@ -0,0 +1,5 @@
1
+ export const toastDefaults = {
2
+ defaultVariants: {
3
+ variant: 'outline'
4
+ }
5
+ };
package/dist/config.d.ts CHANGED
@@ -33,6 +33,11 @@ export declare const iconsDefaults: {
33
33
  check: string;
34
34
  light: string;
35
35
  dark: string;
36
+ upload: string;
37
+ file: string;
38
+ zoomIn: string;
39
+ trash: string;
40
+ search: string;
36
41
  };
37
42
  /** Deep partial type for config objects */
38
43
  type DeepPartial<T> = {
package/dist/config.js CHANGED
@@ -33,7 +33,12 @@ export const iconsDefaults = {
33
33
  close: 'lucide:x',
34
34
  check: 'lucide:check',
35
35
  light: 'lucide:sun',
36
- dark: 'lucide:moon'
36
+ dark: 'lucide:moon',
37
+ upload: 'lucide:upload',
38
+ file: 'lucide:file',
39
+ zoomIn: 'lucide:zoom-in',
40
+ trash: 'lucide:trash-2',
41
+ search: 'lucide:search'
37
42
  };
38
43
  // ==================== GLOBAL STATE ====================
39
44
  let globalConfig = {};
package/dist/index.d.ts CHANGED
@@ -19,6 +19,8 @@ export * from './Drawer/index.js';
19
19
  export * from './Tooltip/index.js';
20
20
  export * from './Modal/index.js';
21
21
  export * from './Accordion/index.js';
22
+ export * from './Collapsible/index.js';
23
+ export * from './Command/index.js';
22
24
  export * from './Slideover/index.js';
23
25
  export * from './Popover/index.js';
24
26
  export * from './Breadcrumb/index.js';
@@ -35,7 +37,12 @@ export * from './Select/index.js';
35
37
  export * from './SelectMenu/index.js';
36
38
  export * from './Switch/index.js';
37
39
  export * from './Checkbox/index.js';
40
+ export * from './CheckboxGroup/index.js';
38
41
  export * from './RadioGroup/index.js';
42
+ export * from './FileUpload/index.js';
43
+ export * from './Slider/index.js';
44
+ export * from './PinInput/index.js';
39
45
  export * from './ThemeModeButton/index.js';
46
+ export * from './Toast/index.js';
40
47
  export { defineConfig } from './config.js';
41
48
  export type { UIConfig } from './config.js';
package/dist/index.js CHANGED
@@ -20,6 +20,8 @@ export * from './Drawer/index.js';
20
20
  export * from './Tooltip/index.js';
21
21
  export * from './Modal/index.js';
22
22
  export * from './Accordion/index.js';
23
+ export * from './Collapsible/index.js';
24
+ export * from './Command/index.js';
23
25
  export * from './Slideover/index.js';
24
26
  export * from './Popover/index.js';
25
27
  export * from './Breadcrumb/index.js';
@@ -36,7 +38,12 @@ export * from './Select/index.js';
36
38
  export * from './SelectMenu/index.js';
37
39
  export * from './Switch/index.js';
38
40
  export * from './Checkbox/index.js';
41
+ export * from './CheckboxGroup/index.js';
39
42
  export * from './RadioGroup/index.js';
43
+ export * from './FileUpload/index.js';
44
+ export * from './Slider/index.js';
45
+ export * from './PinInput/index.js';
40
46
  export * from './ThemeModeButton/index.js';
47
+ export * from './Toast/index.js';
41
48
  // Configuration
42
49
  export { defineConfig } from './config.js';
package/dist/theme.css CHANGED
@@ -597,3 +597,39 @@
597
597
  scale: 0.95;
598
598
  }
599
599
  }
600
+
601
+ /* ==================== Scrollbar ==================== */
602
+
603
+ @utility scrollbar-thin {
604
+ scrollbar-width: thin;
605
+ scrollbar-color: var(--color-outline-variant) transparent;
606
+
607
+ &::-webkit-scrollbar {
608
+ width: 6px;
609
+ }
610
+ &::-webkit-scrollbar-track {
611
+ background: transparent;
612
+ }
613
+ &::-webkit-scrollbar-thumb {
614
+ background-color: var(--color-outline-variant);
615
+ border-radius: 3px;
616
+ }
617
+ }
618
+
619
+ @keyframes collapsible-down {
620
+ 0% {
621
+ height: 0;
622
+ }
623
+ to {
624
+ height: var(--bits-collapsible-content-height);
625
+ }
626
+ }
627
+
628
+ @keyframes collapsible-up {
629
+ 0% {
630
+ height: var(--bits-collapsible-content-height);
631
+ }
632
+ to {
633
+ height: 0;
634
+ }
635
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sv5ui",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "A modern Svelte 5 UI component library with Tailwind CSS",
5
5
  "author": "ndlabdev",
6
6
  "license": "MIT",
@@ -99,6 +99,7 @@
99
99
  "@iconify/svelte": "^5.2.1",
100
100
  "@internationalized/date": "^3.11.0",
101
101
  "bits-ui": "^2.15.4",
102
+ "svelte-sonner": "^1.1.0",
102
103
  "tailwind-merge": "^3.4.0",
103
104
  "tailwind-variants": "^3.2.2",
104
105
  "vaul-svelte": "1.0.0-next.7"