@valerius_petrini/corekit-ui 0.1.58 → 0.1.60

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 (37) hide show
  1. package/dist/actions/toast.svelte.d.ts +10 -0
  2. package/dist/actions/toast.svelte.js +21 -0
  3. package/dist/components/Button.svelte +14 -34
  4. package/dist/components/Card.svelte +13 -31
  5. package/dist/components/FileInput.svelte +113 -0
  6. package/dist/components/FileInput.svelte.d.ts +4 -0
  7. package/dist/components/Input.svelte +6 -5
  8. package/dist/components/Modal.svelte +6 -5
  9. package/dist/components/Progress.svelte +4 -5
  10. package/dist/components/Toast.svelte +72 -0
  11. package/dist/components/Toast.svelte.d.ts +5 -0
  12. package/dist/components/Toaster.svelte +25 -0
  13. package/dist/components/Toaster.svelte.d.ts +3 -0
  14. package/dist/index.d.ts +4 -0
  15. package/dist/index.js +4 -0
  16. package/dist/styles/color.d.ts +1 -1
  17. package/dist/styles/color.js +28 -0
  18. package/dist/styles/layout.css +37 -20
  19. package/dist/styles/posititon.js +9 -9
  20. package/dist/styles/size.d.ts +2 -0
  21. package/dist/styles/size.js +20 -0
  22. package/dist/types/BaseComponent.d.ts +5 -0
  23. package/dist/types/BaseComponent.js +2 -0
  24. package/dist/types/Button.d.ts +2 -5
  25. package/dist/types/Card.d.ts +2 -5
  26. package/dist/types/Checkbox.d.ts +2 -4
  27. package/dist/types/Input.d.ts +15 -5
  28. package/dist/types/Input.js +1 -0
  29. package/dist/types/Navbar.d.ts +3 -8
  30. package/dist/types/Progress.d.ts +2 -4
  31. package/dist/types/Select.d.ts +2 -4
  32. package/dist/types/Table.d.ts +2 -4
  33. package/dist/types/Text.d.ts +2 -4
  34. package/dist/types/Toast.d.ts +13 -0
  35. package/dist/types/Toast.js +1 -0
  36. package/dist/types/Typewriter.d.ts +2 -3
  37. package/package.json +3 -1
@@ -0,0 +1,10 @@
1
+ import type { ToastProps } from "../types/Toast.ts";
2
+ export declare const toastState: {
3
+ items: (ToastProps & {
4
+ id: number;
5
+ })[];
6
+ };
7
+ export declare const toast: {
8
+ add(props: ToastProps): number;
9
+ dismiss(id: number): void;
10
+ };
@@ -0,0 +1,21 @@
1
+ import { mount } from "svelte";
2
+ import Toaster from "../components/Toaster.svelte";
3
+ let count = 0;
4
+ let toasterMounted = false;
5
+ export const toastState = $state({
6
+ items: []
7
+ });
8
+ export const toast = {
9
+ add(props) {
10
+ if (!toasterMounted && typeof document !== "undefined") {
11
+ mount(Toaster, { target: document.body });
12
+ toasterMounted = true;
13
+ }
14
+ const id = count++;
15
+ toastState.items.push({ ...props, id });
16
+ return id;
17
+ },
18
+ dismiss(id) {
19
+ toastState.items = toastState.items.filter(t => t.id !== id);
20
+ }
21
+ };
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { generateColorStyle } from "../styles/color.js";
3
- import { sizeStyleParts, type SizeStyleTheme } from "../styles/size.js";
3
+ import { getSizeStyle, getSizeStyleClass, sizeStyleParts, type SizeStyleTheme } from "../styles/size.js";
4
4
  import type { ButtonProps } from "../types/Button.js";
5
5
  import { twMerge } from "tailwind-merge";
6
6
  import { getLinkProps } from "../utils/link.js";
@@ -21,49 +21,29 @@
21
21
  ...restProps
22
22
  }: ButtonProps = $props();
23
23
 
24
- const sizeClasses = $derived.by(() => {
25
- const parts = typeof size === "string" ? sizeStyleParts[size as SizeStyleTheme] : null;
26
- const radiusParts = typeof radius === "string" ? sizeStyleParts[radius as SizeStyleTheme] : null;
27
-
28
- return twMerge(
29
- icon ? "p-0 flex-none" : "h-fit",
30
- parts?.[icon ? "buttonIcon" : "button"],
31
- radiusParts?.radius,
32
- pill || icon ? "rounded-full" : "",
33
- square ? "aspect-square rounded-none" : ""
34
- );
35
- });
36
-
37
- const customStyle = $derived.by(() => {
38
- const styles: string[] = [];
39
-
40
- if (typeof size === "number") {
41
- styles.push(`height: ${size}px`);
42
- styles.push(icon
43
- ? `width: ${size}px; padding: ${size / 8}px`
44
- : `padding: ${size / 4}px ${size / 8}px`
45
- );
46
- }
47
-
48
- if (typeof radius === "number") {
49
- styles.push(`border-radius: ${radius}px`);
50
- }
51
-
52
- return styles.join("; ");
53
- });
54
-
55
24
  const defaultClass = "inline-flex items-center justify-center gap-2 transition-colors duration-300 ease-in-out text-white whitespace-nowrap";
56
25
  const disabledClass = $derived(disabled ? "opacity-50 pointer-events-none" : "cursor-pointer");
26
+ const iconClass = $derived(icon ? "p-0 flex-none" : "h-fit");
27
+ const pillClass = $derived((pill || icon) && "rounded-full");
28
+ const squareClass = $derived(square && "aspect-square rounded-none");
57
29
 
58
30
  const mergedClass = $derived(twMerge(
59
31
  defaultClass,
60
32
  generateColorStyle(color, variant),
61
33
  disabledClass,
62
- sizeClasses,
34
+ getSizeStyleClass(size, icon ? "buttonIcon" : "button"),
35
+ getSizeStyleClass(radius, "radius"),
36
+ iconClass,
37
+ pillClass,
38
+ squareClass,
63
39
  className
64
40
  ));
65
41
 
66
- const mergedStyle = $derived([customStyle, restProps.style].filter(Boolean).join("; "));
42
+ const mergedStyle = $derived([
43
+ getSizeStyle(size, icon ? "button" : "button"),
44
+ getSizeStyle(radius, "radius"),
45
+ restProps.style
46
+ ].filter(Boolean).join("; "));
67
47
 
68
48
  const anchorProps = $derived(getLinkProps(href, external));
69
49
  </script>
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
- import { sizeStyleParts, type SizeStyleTheme } from "../styles/size.js";
2
+ import { getLinkProps } from "../utils/link.js";
3
+ import { getSizeStyle, getSizeStyleClass } from "../styles/size.js";
3
4
  import { cardVariantStyles, type CardProps } from "../types/Card.js";
4
5
  import { twMerge } from "tailwind-merge";
5
6
 
@@ -14,49 +15,30 @@
14
15
  ...restProps
15
16
  }: CardProps = $props();
16
17
 
17
- const sizeClasses = $derived.by(() => {
18
- const parts = typeof size === "string" ? sizeStyleParts[size as SizeStyleTheme] : null;
19
- const radiusParts = typeof radius === "string" ? sizeStyleParts[radius as SizeStyleTheme] : null;
20
-
21
- return twMerge(
22
- parts?.card,
23
- radiusParts?.radius,
24
- );
25
- });
26
-
27
- const customStyle = $derived.by(() => {
28
- const styles: string[] = [];
29
-
30
- if (typeof size === "number")
31
- styles.push(`width: ${size}px`);
32
-
33
- if (typeof radius === "number")
34
- styles.push(`border-radius: ${radius}px`);
35
-
36
- return styles.join("; ");
37
- });
38
-
39
18
  let defaultClass = "text-main-text rounded-lg transition-colors ease-in-out bg-sub-background p-4";
40
19
  let linkClass = "block hover:bg-sub-background-hover cursor-pointer";
41
20
  let combinedClass = $derived(twMerge(
42
21
  defaultClass,
43
- href ? linkClass : "",
22
+ href && linkClass,
44
23
  cardVariantStyles[variant],
45
- sizeClasses,
24
+ getSizeStyleClass(size, "card"),
25
+ getSizeStyleClass(radius, "radius"),
46
26
  className
47
27
  ));
48
28
 
49
- const anchorProps = $derived(href ? {
50
- href,
51
- target: external ? "_blank" : undefined,
52
- rel: external ? "noopener noreferrer" : undefined,
53
- } : {});
29
+ const mergedStyle = $derived([
30
+ getSizeStyle(size, "card"),
31
+ getSizeStyle(radius, "radius"),
32
+ restProps.style
33
+ ].filter(Boolean).join("; "));
34
+
35
+ const anchorProps = $derived(getLinkProps(href, external));
54
36
  </script>
55
37
 
56
38
  <svelte:element
57
39
  this={href ? "a" : "div"}
58
40
  class={combinedClass}
59
- style={customStyle}
41
+ style={mergedStyle}
60
42
  {...anchorProps}
61
43
  {...restProps}
62
44
  >
@@ -0,0 +1,113 @@
1
+ <script lang="ts">
2
+ import { getSizeStyle, getSizeStyleClass } from "../styles/size.js";
3
+ import type { FileInputProps } from "../types/Input.js";
4
+ import { twMerge } from "tailwind-merge";
5
+ import Text from "./Text.svelte";
6
+ import bytes from "bytes";
7
+
8
+ import Upload from "@lucide/svelte/icons/upload";
9
+ import File from "@lucide/svelte/icons/file";
10
+ import Button from "./Button.svelte";
11
+
12
+ let {
13
+ children = undefined,
14
+ class: className = "",
15
+ label = undefined,
16
+ labelClass = "",
17
+ divClass = "",
18
+ outerDivClass = "",
19
+ files = $bindable(undefined),
20
+ required = false,
21
+ disabled = false,
22
+ size = "md",
23
+ radius = "md",
24
+ id = crypto.randomUUID(),
25
+ ...restProps
26
+ }: FileInputProps = $props();
27
+
28
+ let inputElement: HTMLInputElement;
29
+
30
+ const defaultClass = "text-main-text w-full flex items-center gap-1 rounded-full outline-none px-1.5 w-full bg-inherit border-0 py-0";
31
+ const defaultLabelClass = "block text-sub-text font-medium mb-1 pointer-events-none truncate w-fit";
32
+ const defaultDivClass = "relative flex-center gap-0 bg-form-background border-[1px] border-form-border p-0";
33
+
34
+ const divFullClass = $derived(size === "full" ? "w-full" : "");
35
+ const disabledClass = $derived(disabled ? "opacity-50 pointer-events-none" : "");
36
+
37
+ const iconContainerClass = "h-5 aspect-square px-1 py-0!";
38
+ const iconClass = "h-full aspect-square text-sub-text";
39
+
40
+ const selectedDivClass = $derived(files ? "border-blue-500 cursor-default" : "hover:bg-form-hover cursor-pointer");
41
+
42
+ const combinedOuterDivClass = $derived(twMerge(
43
+ "flex flex-col bg-transparent border-0 p-0",
44
+ divFullClass,
45
+ outerDivClass,
46
+ disabledClass
47
+ ));
48
+ const combinedLabelClass = $derived(twMerge(
49
+ defaultLabelClass,
50
+ getSizeStyleClass(size, "formLabel"),
51
+ labelClass
52
+ ));
53
+ const combinedDivClass = $derived(twMerge(
54
+ defaultDivClass,
55
+ selectedDivClass,
56
+ getSizeStyleClass(radius, "radius"),
57
+ divFullClass,
58
+ divClass,
59
+ ));
60
+ let combinedClass = $derived(twMerge(
61
+ getSizeStyleClass(size, "form"),
62
+ defaultClass,
63
+ className,
64
+ ));
65
+
66
+ const Icon = $derived(files ? File : Upload);
67
+
68
+ function handleClick() {
69
+ if (!files) inputElement.click();
70
+ }
71
+
72
+ function handleClear(e: MouseEvent) {
73
+ e.stopPropagation();
74
+ files = undefined;
75
+ }
76
+ </script>
77
+
78
+ <div class={combinedOuterDivClass}>
79
+ <Text tag="label" for={id} class={combinedLabelClass} style={getSizeStyle(size, "formLabel")}>
80
+ {label}
81
+ {#if required}
82
+ <span class="text-[#E05555]">*</span>
83
+ {/if}
84
+ </Text>
85
+ <Button color="none" class={combinedDivClass} onclick={handleClick} {disabled}>
86
+ <div class={iconContainerClass}>
87
+ <Icon class={iconClass}></Icon>
88
+ </div>
89
+ <input
90
+ {id}
91
+ bind:files={files}
92
+ bind:this={inputElement}
93
+ class="hidden"
94
+ {required}
95
+ {disabled}
96
+ aria-disabled={disabled}
97
+ {...restProps}
98
+ type="file"
99
+ />
100
+ <Text class={combinedClass}>
101
+ {files ? files[0]?.name : "Upload File"}
102
+ <Text tag="span" class="text-sub-text text-xs pt-0.75">
103
+ {files ? bytes(files[0]?.size || 0) : ""}
104
+ </Text>
105
+ </Text>
106
+
107
+ {#if files}
108
+ <Button color="blue" variant="outline" size="xs" class="ml-auto mr-2" onclick={handleClear} {disabled}>
109
+ Clear
110
+ </Button>
111
+ {/if}
112
+ </Button>
113
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { FileInputProps } from "../types/Input.js";
2
+ declare const FileInput: import("svelte").Component<FileInputProps, {}, "files">;
3
+ type FileInput = ReturnType<typeof FileInput>;
4
+ export default FileInput;
@@ -20,6 +20,7 @@
20
20
  label = "",
21
21
  labelClass = "",
22
22
  divClass = "",
23
+ outerDivClass = "",
23
24
  icon = undefined,
24
25
  variant = "default",
25
26
  placeholder = "",
@@ -103,8 +104,8 @@
103
104
  email: Mail, password: Lock, tel: Phone
104
105
  }[restProps.type as string] as Component ?? null));
105
106
 
106
- let defaultClass = "text-main-text w-full rounded outline-none px-1.5 w-full bg-inherit border-0 focus:ring-0 focus-visible:ring-0";
107
- let defaultLabelClass = "block text-sub-text rounded-md font-medium mb-1 duration-100 pointer-events-none truncate w-fit";
107
+ let defaultClass = "text-main-text w-full rounded-full outline-none px-1.5 w-full bg-inherit border-0 focus:ring-0 focus-visible:ring-0";
108
+ let defaultLabelClass = "block text-sub-text font-medium mb-1 duration-100 pointer-events-none truncate w-fit";
108
109
  let defaultDivClass = "relative *:transition-all flex-center bg-form-background border-[1px] border-form-border focus-within:ring-1 focus-within:ring-blue-500";
109
110
  let iconContainerClass = "h-5 aspect-square px-1 py-0!";
110
111
  let floatingLabelClass = "absolute w-full";
@@ -118,7 +119,7 @@
118
119
 
119
120
  let floatingLabelClassFull = $derived(twMerge(originalLabelClassInput, originalLabelClass, floatingLabelClass));
120
121
  let divFullClass = $derived(size === "full" ? "w-full" : "");
121
- let disabledClass = $derived(disabled ? "opacity-50 pointer-events-none" : "cursor-pointer");
122
+ let disabledClass = $derived(disabled ? "opacity-50 pointer-events-none" : "");
122
123
 
123
124
  function handleFocus(e: FocusEvent) {
124
125
  isFocused = true;
@@ -136,12 +137,12 @@
136
137
 
137
138
  let defaultInputClassCheck = $derived(variant !== "floating" ? "py-0" : "");
138
139
  let floatingLabelClassCheck = $derived(variant === "floating" ? floatingLabelClassFull : "");
139
- let defaultLabelClassCheck = $derived(variant !== "floating" ? "px-1.5" : "");
140
+ let defaultLabelClassCheck = $derived(variant !== "floating" ? "px-0" : "");
140
141
  let selectedLabelClass = $derived(twMerge((isFocused || hasContent) && variant === "floating" ? `${originalSelectedLabelClass} ${selectedLabelSizeClass}` : ""));
141
142
  let combinedLabelClass = $derived(twMerge(defaultLabelClass, floatingLabelClassCheck, labelSizeClass, selectedLabelClass, labelClassIcon, defaultLabelClassCheck, labelClass));
142
143
  let combinedClass = $derived(twMerge(defaultClass, sizeClasses, defaultInputClassCheck, labelSizeClass, inputClassIcon, className, isValid ? "" : invalidClass));
143
144
  let combinedDivClass = $derived(twMerge(defaultDivClass, divSizeClass, divFullClass, divClass, disabledClass));
144
- let combinedOuterDivClass = $derived(twMerge("flex flex-col bg-transparent border-0 p-0", divSizeClass, divFullClass, divClass, disabledClass));
145
+ let combinedOuterDivClass = $derived(twMerge("flex flex-col bg-transparent border-0 p-0", divSizeClass, divFullClass, outerDivClass, disabledClass));
145
146
 
146
147
  let EyeComponent = $derived(canSeePassword ? Eye : EyeOff);
147
148
 
@@ -13,11 +13,12 @@
13
13
  ...restProps
14
14
  }: ModalProps = $props();
15
15
 
16
- const defaultOuterDivClass = "w-full h-screen absolute bg-black/50 z-200 flex items-center justify-center top-0 left-0 p-4";
17
- const positionOuterDivClass = $derived(positionParts[position] || "");
18
- const combinedOuterDivClass = $derived(twMerge(defaultOuterDivClass, positionOuterDivClass));
16
+ const defaultOuterDivClass = "w-full h-screen fixed bg-black/50 z-200 flex items-center justify-center top-0 left-0 p-4";
17
+ const combinedOuterDivClass = $derived(twMerge(defaultOuterDivClass));
19
18
 
20
- const defaultInnerDivClass = "z-300 max-h-full";
19
+ const defaultInnerDivClass = "z-300 max-h-full absolute";
20
+ const positionInnerDivClass = $derived(positionParts[position] || "");
21
+ const combinedInnerDivClass = $derived(twMerge(defaultInnerDivClass, positionInnerDivClass));
21
22
 
22
23
  const defaultCardClass = "overflow-y-auto max-h-[95vh]";
23
24
  const combinedCardClass = $derived(twMerge(defaultCardClass, className));
@@ -27,7 +28,7 @@
27
28
  <!-- svelte-ignore a11y_click_events_have_key_events -->
28
29
  <!-- svelte-ignore a11y_no_static_element_interactions -->
29
30
  <div class={combinedOuterDivClass} transition:fade={{ duration: 200 }} onclick={() => open = false}>
30
- <div class={defaultInnerDivClass} transition:fly={{ y: -20, duration: 200 }} onclick={(e) => e.stopPropagation()}>
31
+ <div class={combinedInnerDivClass} transition:fly={{ y: -20, duration: 200 }} onclick={(e) => e.stopPropagation()}>
31
32
  <Card class={combinedCardClass} {...restProps}>
32
33
  {@render children()}
33
34
  </Card>
@@ -17,7 +17,7 @@
17
17
  ...restProps
18
18
  }: ProgressProps = $props();
19
19
 
20
- let currentProgress = $state(0);
20
+ let mounted = $state(false);
21
21
 
22
22
  let defaultDivClass = "w-full bg-sub-background overflow-hidden";
23
23
 
@@ -59,12 +59,11 @@
59
59
 
60
60
  onMount(() => {
61
61
  if (!animate) return;
62
- currentProgress = animate.from;
63
- requestAnimationFrame(() => currentProgress = animate.to);
62
+ requestAnimationFrame(() => mounted = true);
64
63
  if (animate.onend) setTimeout(animate.onend, animate.duration);
65
64
  });
66
65
  </script>
67
66
 
68
- <div class={combinedDivClass} {...restProps} style={customStyle}>
69
- <div class={combinedInnerClass} style="width: {animate ? currentProgress : progress}%; transition: width {animate?.duration ?? 500}ms ease;"></div>
67
+ <div class={combinedDivClass} {...restProps} style="--duration: {animate?.duration}ms; {customStyle}">
68
+ <div class={combinedInnerClass} style="width: {animate ? (mounted ? animate?.to : animate?.from) : progress}%; transition: width var(--duration) linear;"></div>
70
69
  </div>
@@ -0,0 +1,72 @@
1
+ <script lang="ts">
2
+ import { twMerge } from "tailwind-merge";
3
+ import type { ToastProps } from "../types/Toast.js";
4
+ import Text from "./Text.svelte";
5
+ import Progress from "./Progress.svelte";
6
+ import type { Component } from "svelte";
7
+
8
+ import CircleCheck from "@lucide/svelte/icons/circle-check";
9
+ import CircleX from "@lucide/svelte/icons/circle-x";
10
+ import X from "@lucide/svelte/icons/x";
11
+ import Info from "@lucide/svelte/icons/info";
12
+ import TriangleAlert from "@lucide/svelte/icons/triangle-alert";
13
+ import { colorStyleParts, type ColorStyle } from "../styles/color.js";
14
+ import Button from "./Button.svelte";
15
+ import { getSizeStyleClass } from "../styles/size.js";
16
+ import { fly } from "svelte/transition";
17
+ import { backOut } from "svelte/easing";
18
+
19
+
20
+ let {
21
+ message = "",
22
+ duration = 3000,
23
+ type = "info",
24
+ position = "top-right",
25
+ class: className = "",
26
+ size = "md",
27
+ radius = "md",
28
+ onclose = undefined,
29
+ ...restProps
30
+ }: ToastProps = $props();
31
+
32
+ const defaultToastClass = "px-4 py-4 overflow-hidden rounded shadow text-white flex justify-center items-start gap-2 relative bg-sub-background border-[1px]";
33
+ const defaultProgressClass = "absolute bottom-1 left-1 right-1 w-[calc(100%-8px)]";
34
+ const defualtIconClass = $derived(`${colorStyleParts[type as ColorStyle]?.text} w-5 h-5`);
35
+
36
+ const Icon = $derived({
37
+ success: CircleCheck,
38
+ error: CircleX,
39
+ warning: TriangleAlert,
40
+ info: Info
41
+ }[type] as Component ?? null);
42
+
43
+ const combinedToastClass = $derived(twMerge(
44
+ defaultToastClass,
45
+ colorStyleParts[type as ColorStyle]?.text,
46
+ getSizeStyleClass(size, "card"),
47
+ getSizeStyleClass(radius, "radius"),
48
+ className,
49
+ ));
50
+
51
+ const flyParams = $derived.by(() => {
52
+ if (position == "top" || position == "center")
53
+ return { y: -20, duration: 400, easing: backOut };
54
+ else if (position == "bottom")
55
+ return { y: 20, duration: 400, easing: backOut };
56
+ const x = position.includes("right") ? 20 : -20;
57
+ return { x, duration: 400, easing: backOut };
58
+ });
59
+ </script>
60
+
61
+ <div transition:fly={flyParams} class={combinedToastClass} {...restProps}>
62
+ <div class="w-8 h-8 flex-center">
63
+ <Icon class={defualtIconClass}/>
64
+ </div>
65
+ <Text class="px-1 grow flex self-center">{message}</Text>
66
+ <Button onclick={onclose} variant="ghost" class="hover:bg-form-background" icon><X size={16}/></Button>
67
+ <Progress
68
+ size="sm"
69
+ divClass={defaultProgressClass}
70
+ color={type}
71
+ animate={{ duration: duration, from: 100, to: 0, onend: onclose }}/>
72
+ </div>
@@ -0,0 +1,5 @@
1
+ import type { ToastProps } from "../types/Toast.ts";
2
+ import type { Component } from "svelte";
3
+ declare const Toast: Component<ToastProps, {}, "">;
4
+ type Toast = ReturnType<typeof Toast>;
5
+ export default Toast;
@@ -0,0 +1,25 @@
1
+ <script lang="ts">
2
+ import { positionParts, type PositionStyle } from "../styles/posititon.js";
3
+ import { flip } from "svelte/animate";
4
+ import { toastState, toast } from "../actions/toast.svelte.js";
5
+ import Toast from "./Toast.svelte";
6
+
7
+ const getItems = $derived((pos: PositionStyle) => {
8
+ return toastState.items.filter(i => (i.position ?? 'top-right') === pos);
9
+ });
10
+ </script>
11
+
12
+ <div>
13
+ {#each Object.keys(positionParts) as pos (pos)}
14
+ <div class="fixed z-9999 flex flex-col gap-2 pointer-events-none {positionParts[pos as PositionStyle]}">
15
+ {#each getItems(pos as PositionStyle) as item (item.id)}
16
+ <div class="pointer-events-auto" animate:flip={{ duration: 300 }}>
17
+ <Toast
18
+ {...item}
19
+ onclose={() => toast.dismiss(item.id)}
20
+ />
21
+ </div>
22
+ {/each}
23
+ </div>
24
+ {/each}
25
+ </div>
@@ -0,0 +1,3 @@
1
+ declare const Toaster: import("svelte").Component<Record<string, never>, {}, "">;
2
+ type Toaster = ReturnType<typeof Toaster>;
3
+ export default Toaster;
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export { default as Navbar } from "./components/Navbar.svelte";
6
6
  export { default as NavbarSeparator } from "./components/NavbarSeparator.svelte";
7
7
  export { default as NavbarElement } from "./components/NavbarElement.svelte";
8
8
  export { default as Input } from "./components/Input.svelte";
9
+ export { default as FileInput } from "./components/FileInput.svelte";
9
10
  export { default as Select } from "./components/Select.svelte";
10
11
  export { default as Text } from "./components/Text.svelte";
11
12
  export { default as Card } from "./components/Card.svelte";
@@ -13,5 +14,8 @@ export { default as Checkbox } from "./components/Checkbox.svelte";
13
14
  export { default as Progress } from "./components/Progress.svelte";
14
15
  export { default as Modal } from "./components/Modal.svelte";
15
16
  export { default as Table } from "./components/Table.svelte";
17
+ export { default as Toast } from "./components/Toast.svelte";
18
+ export { default as Toaster } from "./components/Toaster.svelte";
16
19
  export { fbmBackground } from "./actions/fbm.ts";
20
+ export { toast } from "./actions/toast.svelte.ts";
17
21
  export type { TypewriterAction, DisplaySegment } from "./types/Typewriter.ts";
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ export { default as Navbar } from "./components/Navbar.svelte";
6
6
  export { default as NavbarSeparator } from "./components/NavbarSeparator.svelte";
7
7
  export { default as NavbarElement } from "./components/NavbarElement.svelte";
8
8
  export { default as Input } from "./components/Input.svelte";
9
+ export { default as FileInput } from "./components/FileInput.svelte";
9
10
  export { default as Select } from "./components/Select.svelte";
10
11
  export { default as Text } from "./components/Text.svelte";
11
12
  export { default as Card } from "./components/Card.svelte";
@@ -13,4 +14,7 @@ export { default as Checkbox } from "./components/Checkbox.svelte";
13
14
  export { default as Progress } from "./components/Progress.svelte";
14
15
  export { default as Modal } from "./components/Modal.svelte";
15
16
  export { default as Table } from "./components/Table.svelte";
17
+ export { default as Toast } from "./components/Toast.svelte";
18
+ export { default as Toaster } from "./components/Toaster.svelte";
16
19
  export { fbmBackground } from "./actions/fbm.js";
20
+ export { toast } from "./actions/toast.svelte.js";
@@ -1,4 +1,4 @@
1
1
  export type ColorStyle = "rose" | "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink" | "gray" | "sub" | "none" | "white" | "black" | "primary" | "secondary" | "accent" | "error" | "warning" | "success" | "info";
2
- export type ColorStyleType = "base" | "full" | "light" | "outline" | "ghost";
2
+ export type ColorStyleType = "base" | "text" | "full" | "light" | "outline" | "ghost";
3
3
  export declare const colorStyleParts: Record<ColorStyle, Record<ColorStyleType, string>>;
4
4
  export declare function generateColorStyle(color: ColorStyle, variant: ColorStyleType): string;
@@ -1,6 +1,7 @@
1
1
  export const colorStyleParts = {
2
2
  rose: {
3
3
  base: "bg-rose-500",
4
+ text: "text-rose-500",
4
5
  full: "bg-rose-500 hover:bg-rose-600",
5
6
  light: "bg-rose-500/35 hover:bg-rose-600/35 text-white/60",
6
7
  outline: "border border-rose-500 hover:border-rose-600 text-rose-500 hover:text-rose-600 hover:bg-rose-500/10",
@@ -8,6 +9,7 @@ export const colorStyleParts = {
8
9
  },
9
10
  red: {
10
11
  base: "bg-red-500",
12
+ text: "text-red-500",
11
13
  full: "bg-red-500 hover:bg-red-600",
12
14
  light: "bg-red-500/35 hover:bg-red-600/35 text-white/60",
13
15
  outline: "border border-red-500 hover:border-red-600 text-red-500 hover:text-red-600 hover:bg-red-500/10",
@@ -15,6 +17,7 @@ export const colorStyleParts = {
15
17
  },
16
18
  orange: {
17
19
  base: "bg-orange-500",
20
+ text: "text-orange-500",
18
21
  full: "bg-orange-500 hover:bg-orange-600",
19
22
  light: "bg-orange-500/35 hover:bg-orange-600/35 text-white/60",
20
23
  outline: "border border-orange-500 hover:border-orange-600 text-orange-500 hover:text-orange-600 hover:bg-orange-500/10",
@@ -22,6 +25,7 @@ export const colorStyleParts = {
22
25
  },
23
26
  amber: {
24
27
  base: "bg-amber-500",
28
+ text: "text-amber-500",
25
29
  full: "bg-amber-500 hover:bg-amber-600",
26
30
  light: "bg-amber-500/35 hover:bg-amber-600/35 text-white/60",
27
31
  outline: "border border-amber-500 hover:border-amber-600 text-amber-500 hover:text-amber-600 hover:bg-amber-500/10",
@@ -29,6 +33,7 @@ export const colorStyleParts = {
29
33
  },
30
34
  yellow: {
31
35
  base: "bg-yellow-500",
36
+ text: "text-yellow-500",
32
37
  full: "bg-yellow-500 hover:bg-yellow-600",
33
38
  light: "bg-yellow-500/35 hover:bg-yellow-600/35 text-white/60",
34
39
  outline: "border border-yellow-500 hover:border-yellow-600 text-yellow-500 hover:text-yellow-600 hover:bg-yellow-500/10",
@@ -36,6 +41,7 @@ export const colorStyleParts = {
36
41
  },
37
42
  lime: {
38
43
  base: "bg-lime-500",
44
+ text: "text-lime-500",
39
45
  full: "bg-lime-500 hover:bg-lime-600",
40
46
  light: "bg-lime-500/35 hover:bg-lime-600/35 text-white/60",
41
47
  outline: "border border-lime-500 hover:border-lime-600 text-lime-500 hover:text-lime-600 hover:bg-lime-500/10",
@@ -43,6 +49,7 @@ export const colorStyleParts = {
43
49
  },
44
50
  green: {
45
51
  base: "bg-green-500",
52
+ text: "text-green-500",
46
53
  full: "bg-green-500 hover:bg-green-600",
47
54
  light: "bg-green-500/35 hover:bg-green-600/35 text-white/60",
48
55
  outline: "border border-green-500 hover:border-green-600 text-green-500 hover:text-green-600 hover:bg-green-500/10",
@@ -50,6 +57,7 @@ export const colorStyleParts = {
50
57
  },
51
58
  emerald: {
52
59
  base: "bg-emerald-500",
60
+ text: "text-emerald-500",
53
61
  full: "bg-emerald-500 hover:bg-emerald-600",
54
62
  light: "bg-emerald-500/35 hover:bg-emerald-600/35 text-white/60",
55
63
  outline: "border border-emerald-500 hover:border-emerald-600 text-emerald-500 hover:text-emerald-600 hover:bg-emerald-500/10",
@@ -57,6 +65,7 @@ export const colorStyleParts = {
57
65
  },
58
66
  teal: {
59
67
  base: "bg-teal-500",
68
+ text: "text-teal-500",
60
69
  full: "bg-teal-500 hover:bg-teal-600",
61
70
  light: "bg-teal-500/35 hover:bg-teal-600/35 text-white/60",
62
71
  outline: "border border-teal-500 hover:border-teal-600 text-teal-500 hover:text-teal-600 hover:bg-teal-500/10",
@@ -64,6 +73,7 @@ export const colorStyleParts = {
64
73
  },
65
74
  cyan: {
66
75
  base: "bg-cyan-500",
76
+ text: "text-cyan-500",
67
77
  full: "bg-cyan-500 hover:bg-cyan-600",
68
78
  light: "bg-cyan-500/35 hover:bg-cyan-600/35 text-white/60",
69
79
  outline: "border border-cyan-500 hover:border-cyan-600 text-cyan-500 hover:text-cyan-600 hover:bg-cyan-500/10",
@@ -71,6 +81,7 @@ export const colorStyleParts = {
71
81
  },
72
82
  blue: {
73
83
  base: "bg-blue-500",
84
+ text: "text-blue-500",
74
85
  full: "bg-blue-500 hover:bg-blue-600",
75
86
  light: "bg-blue-500/35 hover:bg-blue-600/35 text-white/60",
76
87
  outline: "border border-blue-500 hover:border-blue-600 text-blue-500 hover:text-blue-600 hover:bg-blue-500/10",
@@ -78,6 +89,7 @@ export const colorStyleParts = {
78
89
  },
79
90
  indigo: {
80
91
  base: "bg-indigo-500",
92
+ text: "text-indigo-500",
81
93
  full: "bg-indigo-500 hover:bg-indigo-600",
82
94
  light: "bg-indigo-500/35 hover:bg-indigo-600/35 text-white/60",
83
95
  outline: "border border-indigo-500 hover:border-indigo-600 text-indigo-500 hover:text-indigo-600 hover:bg-indigo-500/10",
@@ -85,6 +97,7 @@ export const colorStyleParts = {
85
97
  },
86
98
  violet: {
87
99
  base: "bg-violet-500",
100
+ text: "text-violet-500",
88
101
  full: "bg-violet-500 hover:bg-violet-600",
89
102
  light: "bg-violet-500/35 hover:bg-violet-600/35 text-white/60",
90
103
  outline: "border border-violet-500 hover:border-violet-600 text-violet-500 hover:text-violet-600 hover:bg-violet-500/10",
@@ -92,6 +105,7 @@ export const colorStyleParts = {
92
105
  },
93
106
  purple: {
94
107
  base: "bg-purple-500",
108
+ text: "text-purple-500",
95
109
  full: "bg-purple-500 hover:bg-purple-600",
96
110
  light: "bg-purple-500/35 hover:bg-purple-600/35 text-white/60",
97
111
  outline: "border border-purple-500 hover:border-purple-600 text-purple-500 hover:text-purple-600 hover:bg-purple-500/10",
@@ -99,6 +113,7 @@ export const colorStyleParts = {
99
113
  },
100
114
  pink: {
101
115
  base: "bg-pink-500",
116
+ text: "text-pink-500",
102
117
  full: "bg-pink-500 hover:bg-pink-600",
103
118
  light: "bg-pink-500/35 hover:bg-pink-600/35 text-white/60",
104
119
  outline: "border border-pink-500 hover:border-pink-600 text-pink-500 hover:text-pink-600 hover:bg-pink-500/10",
@@ -106,6 +121,7 @@ export const colorStyleParts = {
106
121
  },
107
122
  fuchsia: {
108
123
  base: "bg-fuchsia-500",
124
+ text: "text-fuchsia-500",
109
125
  full: "bg-fuchsia-500 hover:bg-fuchsia-600",
110
126
  light: "bg-fuchsia-500/35 hover:bg-fuchsia-600/35 text-white/60",
111
127
  outline: "border border-fuchsia-500 hover:border-fuchsia-600 text-fuchsia-500 hover:text-fuchsia-600 hover:bg-fuchsia-500/10",
@@ -113,6 +129,7 @@ export const colorStyleParts = {
113
129
  },
114
130
  gray: {
115
131
  base: "bg-gray-500",
132
+ text: "text-gray-500",
116
133
  full: "bg-gray-500 hover:bg-gray-600",
117
134
  light: "bg-gray-500/35 hover:bg-gray-600/35 text-white/60",
118
135
  outline: "border border-gray-500 hover:border-gray-600 text-gray-500 hover:text-gray-600 hover:bg-gray-500/10",
@@ -120,6 +137,7 @@ export const colorStyleParts = {
120
137
  },
121
138
  sub: {
122
139
  base: "bg-sub-background",
140
+ text: "text-sub-background",
123
141
  full: "bg-sub-background hover:bg-sub-background-hover",
124
142
  light: "bg-sub-background hover:bg-sub-background-hover text-white/60",
125
143
  outline: "border border-sub-background hover:border-sub-background-hover text-sub-background hover:text-sub-background-hover hover:bg-sub-background/10",
@@ -127,6 +145,7 @@ export const colorStyleParts = {
127
145
  },
128
146
  none: {
129
147
  base: "",
148
+ text: "",
130
149
  full: "",
131
150
  light: "",
132
151
  outline: "",
@@ -134,6 +153,7 @@ export const colorStyleParts = {
134
153
  },
135
154
  white: {
136
155
  base: "bg-white text-contrast-text",
156
+ text: "text-white",
137
157
  full: "bg-white hover:bg-gray-100 text-contrast-text hover:text-contrast-text",
138
158
  light: "bg-white/35 hover:bg-white/35 text-gray-700",
139
159
  outline: "border border-white hover:border-gray-300 text-white hover:text-gray-300 hover:bg-white/10",
@@ -141,6 +161,7 @@ export const colorStyleParts = {
141
161
  },
142
162
  black: {
143
163
  base: "bg-black",
164
+ text: "text-black",
144
165
  full: "bg-black hover:bg-stone-950",
145
166
  light: "bg-black/35 hover:bg-black/35 text-gray-500",
146
167
  outline: "border border-black hover:border-gray-700 text-black hover:text-gray-700 hover:bg-black/10",
@@ -148,6 +169,7 @@ export const colorStyleParts = {
148
169
  },
149
170
  primary: {
150
171
  base: "bg-primary",
172
+ text: "text-primary",
151
173
  full: "bg-primary hover:bg-primary/90",
152
174
  light: "bg-primary/35 hover:bg-primary/35 text-white/60",
153
175
  outline: "border border-primary hover:border-primary/90 text-primary hover:text-primary/90 hover:bg-primary/10",
@@ -155,6 +177,7 @@ export const colorStyleParts = {
155
177
  },
156
178
  secondary: {
157
179
  base: "bg-secondary",
180
+ text: "text-secondary",
158
181
  full: "bg-secondary hover:bg-secondary/90",
159
182
  light: "bg-secondary/35 hover:bg-secondary/35 text-white/60",
160
183
  outline: "border border-secondary hover:border-secondary/90 text-secondary hover:text-secondary/90 hover:bg-secondary/10",
@@ -162,6 +185,7 @@ export const colorStyleParts = {
162
185
  },
163
186
  accent: {
164
187
  base: "bg-accent",
188
+ text: "text-accent",
165
189
  full: "bg-accent hover:bg-accent/90",
166
190
  light: "bg-accent/35 hover:bg-accent/35 text-white/60",
167
191
  outline: "border border-accent hover:border-accent/90 text-accent hover:text-accent/90 hover:bg-accent/10",
@@ -169,6 +193,7 @@ export const colorStyleParts = {
169
193
  },
170
194
  error: {
171
195
  base: "bg-red-500",
196
+ text: "text-red-500",
172
197
  full: "bg-red-500 hover:bg-red-600",
173
198
  light: "bg-red-500/35 hover:bg-red-600/35 text-white/60",
174
199
  outline: "border border-red-500 hover:border-red-600 text-red-500 hover:text-red-600 hover:bg-red-500/10",
@@ -176,6 +201,7 @@ export const colorStyleParts = {
176
201
  },
177
202
  warning: {
178
203
  base: "bg-amber-500",
204
+ text: "text-amber-500",
179
205
  full: "bg-amber-500 hover:bg-amber-600",
180
206
  light: "bg-amber-500/35 hover:bg-amber-600/35 text-white/60",
181
207
  outline: "border border-amber-500 hover:border-amber-600 text-amber-500 hover:text-amber-600 hover:bg-amber-500/10",
@@ -183,6 +209,7 @@ export const colorStyleParts = {
183
209
  },
184
210
  success: {
185
211
  base: "bg-emerald-500",
212
+ text: "text-emerald-500",
186
213
  full: "bg-emerald-500 hover:bg-emerald-600",
187
214
  light: "bg-emerald-500/35 hover:bg-emerald-600/35 text-white/60",
188
215
  outline: "border border-emerald-500 hover:border-emerald-600 text-emerald-500 hover:text-emerald-600 hover:bg-emerald-500/10",
@@ -190,6 +217,7 @@ export const colorStyleParts = {
190
217
  },
191
218
  info: {
192
219
  base: "bg-sky-500",
220
+ text: "text-sky-500",
193
221
  full: "bg-sky-500 hover:bg-sky-600",
194
222
  light: "bg-sky-500/35 hover:bg-sky-600/35 text-white/60",
195
223
  outline: "border border-sky-500 hover:border-sky-600 text-sky-500 hover:text-sky-600 hover:bg-sky-500/10",
@@ -16,35 +16,52 @@
16
16
  --color-form-background: var(--vpcui-form-background);
17
17
  --color-form-hover: var(--vpcui-form-hover);
18
18
  --color-form-border: var(--vpcui-form-border);
19
- --color-navbar-element-hover-background: var(--vpcui-navbar-element-hover-background);
19
+
20
20
  --color-primary: var(--vpcui-primary);
21
21
  --color-secondary: var(--vpcui-secondary);
22
22
  --color-accent: var(--vpcui-accent);
23
23
  }
24
24
 
25
25
  :root {
26
- --vpcui-main-background: #FFFFFF;
27
- --vpcui-sub-background: #F5F5F5;
28
- --vpcui-sub-background-hover: #EEE;
29
- --vpcui-main-text: #111;
30
- --vpcui-sub-text: #6B6B6B ;
31
- --vpcui-contrast-text: #F5F5F5;
32
- --vpcui-form-background: #FFFFFF;
33
- --vpcui-form-hover: #D4D4D4;
34
- --vpcui-form-border: #C4C4C4;
35
- --vpcui-color-navbar-element-hover-background: var(--color-mist-100);
26
+ --vpcui-light-50: #FFFFFF;
27
+ --vpcui-light-100: #F5F5F5;
28
+ --vpcui-light-150: #EEEEEE;
29
+ --vpcui-light-200: #D4D4D4;
30
+ --vpcui-light-250: #C4C4C4;
31
+ --vpcui-light-300: #6B6B6B;
32
+
33
+ --vpcui-light-950: #111;
34
+
35
+ --vpcui-main-background: var(--vpcui-light-50);
36
+ --vpcui-sub-background: var(--vpcui-light-100);
37
+ --vpcui-sub-background-hover: var(--vpcui-light-150);
38
+ --vpcui-main-text: var(--vpcui-light-950);
39
+ --vpcui-sub-text: var(--vpcui-light-300);
40
+ --vpcui-contrast-text: var(--vpcui-light-50);
41
+ --vpcui-form-background: var(--vpcui-light-50);
42
+ --vpcui-form-hover: var(--vpcui-light-200);
43
+ --vpcui-form-border: var(--vpcui-light-250);
36
44
  }
37
45
 
38
46
  html.dark {
39
- --vpcui-main-background: #121212;
40
- --vpcui-sub-background: #1E1E1E;
41
- --vpcui-sub-background-hover: #2A2A2A;
42
- --vpcui-main-text: #F5F5F5;
43
- --vpcui-sub-text: #A0A0A0;
44
- --vpcui-contrast-text: #111;
45
- --vpcui-form-background: #2A2A2A;
46
- --vpcui-form-border: #4A4A4A;
47
- --vpcui-navbar-element-hover-background: var(--color-zinc-900);
47
+ --vpcui-dark-50: #121212;
48
+ --vpcui-dark-100: #1E1E1E;
49
+ --vpcui-dark-150: #2A2A2A;
50
+ --vpcui-dark-200: #3A3A3A;
51
+ --vpcui-dark-250: #4A4A4A;
52
+ --vpcui-dark-300: #A0A0A0;
53
+
54
+ --vpcui-dark-950: #F5F5F5;
55
+
56
+ --vpcui-main-background: var(--vpcui-dark-50);
57
+ --vpcui-sub-background: var(--vpcui-dark-100);
58
+ --vpcui-sub-background-hover: var(--vpcui-dark-150);
59
+ --vpcui-main-text: var(--vpcui-dark-950);
60
+ --vpcui-sub-text: var(--vpcui-dark-300);
61
+ --vpcui-contrast-text: var(--vpcui-dark-950);
62
+ --vpcui-form-background: var(--vpcui-dark-150);
63
+ --vpcui-form-border: var(--vpcui-dark-250);
64
+ --vpcui-form-hover: var(--vpcui-dark-200);
48
65
  }
49
66
 
50
67
  html {
@@ -1,11 +1,11 @@
1
1
  export const positionParts = {
2
- "top": "flex items-start justify-center",
3
- "right": "flex items-center justify-end",
4
- "bottom": "flex items-end justify-center",
5
- "left": "flex items-center justify-start",
6
- "top-left": "flex items-start justify-start",
7
- "top-right": "flex items-start justify-end",
8
- "bottom-left": "flex items-end justify-start",
9
- "bottom-right": "flex items-end justify-end",
10
- "center": "flex-center"
2
+ "top": "top-4 left-1/2 -translate-x-1/2",
3
+ "right": "top-1/2 right-4 transform -translate-y-1/2 flex-col",
4
+ "bottom": "bottom-4 left-1/2 transform -translate-x-1/2 flex-col-reverse",
5
+ "left": "top-1/2 left-4 transform -translate-y-1/2 flex-col",
6
+ "top-left": "top-4 left-4",
7
+ "top-right": "top-4 right-4",
8
+ "bottom-left": "bottom-4 left-4",
9
+ "bottom-right": "bottom-4 right-4",
10
+ "center": "top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2"
11
11
  };
@@ -2,6 +2,8 @@ export type SizeStyleTheme = "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" |
2
2
  export type SizeStyleType = "button" | "buttonIcon" | "radius" | "text" | "card" | "form" | "formLabel" | "formLabelSelected" | "progress";
3
3
  export type SizeStyle = SizeStyleTheme | number;
4
4
  export declare const sizeStyleParts: Record<SizeStyleTheme, Record<SizeStyleType, string>>;
5
+ export declare function getSizeStyleClass(size: SizeStyle, type: SizeStyleType): string;
6
+ export declare function getSizeStyle(size: SizeStyle, type: SizeStyleType): string;
5
7
  export declare const textStyle: {
6
8
  "text-xs": string;
7
9
  "text-sm": string;
@@ -132,6 +132,26 @@ export const sizeStyleParts = {
132
132
  progress: ""
133
133
  }
134
134
  };
135
+ export function getSizeStyleClass(size, type) {
136
+ if (typeof size === "string")
137
+ return sizeStyleParts[size][type];
138
+ return "";
139
+ }
140
+ export function getSizeStyle(size, type) {
141
+ if (typeof size === "number") {
142
+ switch (type) {
143
+ case "button":
144
+ return `height: ${size}px; padding: ${size / 4}px ${size / 8}px`;
145
+ case "buttonIcon":
146
+ return `height: ${size}px; width: ${size}px; padding: ${size / 4}px`;
147
+ case "card":
148
+ return `width: ${size}px`;
149
+ case "radius":
150
+ return `border-radius: ${size}px`;
151
+ }
152
+ }
153
+ return "";
154
+ }
135
155
  export const textStyle = {
136
156
  "text-xs": "0.75rem",
137
157
  "text-sm": "0.875rem",
@@ -0,0 +1,5 @@
1
+ export interface BaseComponentProps {
2
+ children?: any;
3
+ class?: string;
4
+ [key: string]: any;
5
+ }
@@ -0,0 +1,2 @@
1
+ ;
2
+ export {};
@@ -1,9 +1,7 @@
1
- import type { HTMLButtonAttributes } from "svelte/elements";
2
1
  import type { ColorStyle, ColorStyleType } from "../styles/color.ts";
3
2
  import type { SizeStyle } from "../styles/size.ts";
4
- export interface ButtonProps extends Omit<HTMLButtonAttributes, 'size'> {
5
- children?: any;
6
- class?: string;
3
+ import type { BaseComponentProps } from "./BaseComponent.ts";
4
+ export interface ButtonProps extends BaseComponentProps {
7
5
  pill?: boolean;
8
6
  icon?: boolean;
9
7
  square?: boolean;
@@ -14,5 +12,4 @@ export interface ButtonProps extends Omit<HTMLButtonAttributes, 'size'> {
14
12
  external?: boolean;
15
13
  size?: SizeStyle;
16
14
  radius?: SizeStyle;
17
- [key: string]: any;
18
15
  }
@@ -1,14 +1,11 @@
1
- import type { HTMLAttributes } from "svelte/elements";
2
1
  import type { SizeStyle } from "../styles/size.ts";
2
+ import type { BaseComponentProps } from "./BaseComponent.ts";
3
3
  export type CardVariant = "bordered" | "elevated";
4
4
  export declare const cardVariantStyles: Record<CardVariant, string>;
5
- export interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'size'> {
6
- children?: any;
7
- class?: string;
5
+ export interface CardProps extends BaseComponentProps {
8
6
  href?: string;
9
7
  external?: boolean;
10
8
  variant?: CardVariant;
11
9
  size?: SizeStyle;
12
10
  radius?: SizeStyle;
13
- [key: string]: any;
14
11
  }
@@ -1,10 +1,8 @@
1
- export interface CheckboxProps {
2
- children?: any;
3
- class?: string;
1
+ import type { BaseComponentProps } from "./BaseComponent.ts";
2
+ export interface CheckboxProps extends BaseComponentProps {
4
3
  label?: string;
5
4
  labelClass?: string;
6
5
  divClass?: string;
7
6
  checked?: boolean;
8
7
  id?: string;
9
- [key: string]: any;
10
8
  }
@@ -1,13 +1,12 @@
1
1
  import type { Component } from "svelte";
2
2
  import type { SizeStyle } from "../styles/size.ts";
3
- import type { HTMLInputAttributes } from "svelte/elements";
3
+ import type { BaseComponentProps } from "./BaseComponent.ts";
4
4
  export type InputVariant = "default" | "floating";
5
- export interface InputProps extends Omit<HTMLInputAttributes, 'size'> {
6
- children?: any;
7
- class?: string;
5
+ export interface InputProps extends BaseComponentProps {
8
6
  label?: string;
9
7
  labelClass?: string;
10
8
  divClass?: string;
9
+ outerDivClass?: string;
11
10
  icon?: Component;
12
11
  value?: any;
13
12
  required?: boolean;
@@ -23,5 +22,16 @@ export interface InputProps extends Omit<HTMLInputAttributes, 'size'> {
23
22
  size?: SizeStyle;
24
23
  radius?: SizeStyle;
25
24
  id?: `${string}-${string}-${string}-${string}-${string}`;
26
- [key: string]: any;
25
+ }
26
+ export interface FileInputProps extends BaseComponentProps {
27
+ label?: string;
28
+ labelClass?: string;
29
+ divClass?: string;
30
+ outerDivClass?: string;
31
+ files?: FileList;
32
+ required?: boolean;
33
+ disabled?: boolean;
34
+ size?: SizeStyle;
35
+ radius?: SizeStyle;
36
+ id?: `${string}-${string}-${string}-${string}-${string}`;
27
37
  }
@@ -1,2 +1,3 @@
1
1
  ;
2
+ ;
2
3
  export {};
@@ -1,16 +1,11 @@
1
- export interface NavbarProps {
2
- children?: any;
3
- class?: string;
1
+ import type { BaseComponentProps } from "./BaseComponent.ts";
2
+ export interface NavbarProps extends BaseComponentProps {
4
3
  classTop?: string;
5
4
  threshold?: number;
6
- [key: string]: any;
7
5
  }
8
- export interface NavbarElementProps {
9
- children?: any;
10
- class?: string;
6
+ export interface NavbarElementProps extends BaseComponentProps {
11
7
  classTop?: string;
12
8
  activeClass?: string;
13
9
  href?: string;
14
10
  threshold?: number;
15
- [key: string]: any;
16
11
  }
@@ -1,20 +1,18 @@
1
1
  import type { ColorStyle } from "../styles/color.ts";
2
2
  import type { SizeStyle } from "../styles/size.ts";
3
+ import type { BaseComponentProps } from "./BaseComponent.ts";
3
4
  interface AnimateProps {
4
5
  from: number;
5
6
  to: number;
6
7
  duration: number;
7
8
  onend?: () => void;
8
9
  }
9
- export interface ProgressProps {
10
- children?: any;
11
- class?: string;
10
+ export interface ProgressProps extends BaseComponentProps {
12
11
  divClass?: string;
13
12
  progress?: number;
14
13
  animate?: AnimateProps;
15
14
  color?: ColorStyle;
16
15
  size?: SizeStyle;
17
16
  radius?: SizeStyle;
18
- [key: string]: any;
19
17
  }
20
18
  export {};
@@ -1,6 +1,5 @@
1
- export interface SelectProps {
2
- children?: any;
3
- class?: string;
1
+ import type { BaseComponentProps } from "./BaseComponent.ts";
2
+ export interface SelectProps extends BaseComponentProps {
4
3
  label?: string;
5
4
  divClass?: string;
6
5
  optionClass?: string;
@@ -10,5 +9,4 @@ export interface SelectProps {
10
9
  label: string;
11
10
  }[];
12
11
  id?: `${string}-${string}-${string}-${string}-${string}`;
13
- [key: string]: any;
14
12
  }
@@ -1,14 +1,12 @@
1
1
  import type { SizeStyle } from "../styles/size.js";
2
+ import type { BaseComponentProps } from "./BaseComponent.ts";
2
3
  export interface TableHeaders {
3
4
  key: string;
4
5
  label: string;
5
6
  }
6
- export interface TableProps {
7
- children?: any;
8
- class?: string;
7
+ export interface TableProps extends BaseComponentProps {
9
8
  tableHeaders?: TableHeaders[];
10
9
  tableData?: any[];
11
10
  size?: SizeStyle;
12
11
  radius?: SizeStyle;
13
- [key: string]: any;
14
12
  }
@@ -1,11 +1,9 @@
1
1
  import type { SizeStyle } from "../styles/size.ts";
2
+ import type { BaseComponentProps } from "./BaseComponent.ts";
2
3
  type TextTagOptions = "p" | "div" | "span" | "label" | "strong" | "em" | "b" | "i" | "u" | "small" | "blockquote" | "pre" | "code" | "a" | "li" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
3
- export interface TextProps {
4
- children?: any;
5
- class?: string;
4
+ export interface TextProps extends BaseComponentProps {
6
5
  tag?: TextTagOptions;
7
6
  shrink?: number;
8
7
  size?: SizeStyle;
9
- [key: string]: any;
10
8
  }
11
9
  export {};
@@ -0,0 +1,13 @@
1
+ import type { PositionStyle } from "../styles/posititon.js";
2
+ import type { SizeStyle } from "../styles/size.js";
3
+ import type { BaseComponentProps } from "./BaseComponent.ts";
4
+ export type ToastType = "success" | "error" | "info" | "warning";
5
+ export interface ToastProps extends BaseComponentProps {
6
+ message: string;
7
+ duration?: number;
8
+ position?: PositionStyle;
9
+ type?: ToastType;
10
+ size?: SizeStyle;
11
+ radius?: SizeStyle;
12
+ onclose?: () => void;
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,4 @@
1
+ import type { BaseComponentProps } from "./BaseComponent.ts";
1
2
  export type TypewriterAction = {
2
3
  type: "write";
3
4
  value: string | (() => string);
@@ -25,9 +26,7 @@ export interface DisplaySegment {
25
26
  color?: string;
26
27
  label?: string;
27
28
  }
28
- export interface TypewriterProps {
29
+ export interface TypewriterProps extends BaseComponentProps {
29
30
  actions: TypewriterAction[];
30
- class?: string;
31
31
  textClass?: string;
32
- [key: string]: any;
33
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valerius_petrini/corekit-ui",
3
- "version": "0.1.58",
3
+ "version": "0.1.60",
4
4
  "description": "Component Library used across all my projects",
5
5
  "author": "Valerius Petrini Jr.",
6
6
  "license": "MIT",
@@ -42,6 +42,7 @@
42
42
  "@tailwindcss/forms": "^0.5.11",
43
43
  "@tailwindcss/typography": "^0.5.19",
44
44
  "@tailwindcss/vite": "^4.1.18",
45
+ "@types/bytes": "^3.1.5",
45
46
  "publint": "^0.3.17",
46
47
  "svelte": "^5.51.0",
47
48
  "svelte-check": "^4.4.2",
@@ -55,6 +56,7 @@
55
56
  ],
56
57
  "dependencies": {
57
58
  "@lucide/svelte": "^1.3.0",
59
+ "bytes": "^3.1.2",
58
60
  "tailwind-merge": "^3.5.0"
59
61
  }
60
62
  }