@websline/system-components 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 (84) hide show
  1. package/README.md +0 -0
  2. package/dist/components/atoms/avatar/Avatar.svelte +78 -0
  3. package/dist/components/atoms/avatar/Avatar.svelte.d.ts +65 -0
  4. package/dist/components/atoms/avatar/avatar.variants.d.ts +37 -0
  5. package/dist/components/atoms/avatar/avatar.variants.js +20 -0
  6. package/dist/components/atoms/closeButton/CloseButton.svelte +92 -0
  7. package/dist/components/atoms/closeButton/CloseButton.svelte.d.ts +25 -0
  8. package/dist/components/atoms/closeButton/closeButton.variants.d.ts +37 -0
  9. package/dist/components/atoms/closeButton/closeButton.variants.js +21 -0
  10. package/dist/components/atoms/form/button/Button.svelte +67 -0
  11. package/dist/components/atoms/form/button/Button.svelte.d.ts +81 -0
  12. package/dist/components/atoms/form/button/button.variants.d.ts +58 -0
  13. package/dist/components/atoms/form/button/button.variants.js +82 -0
  14. package/dist/components/atoms/form/formField/FormField.svelte +69 -0
  15. package/dist/components/atoms/form/formField/FormField.svelte.d.ts +73 -0
  16. package/dist/components/atoms/form/helperText/HelperText.svelte +18 -0
  17. package/dist/components/atoms/form/helperText/HelperText.svelte.d.ts +15 -0
  18. package/dist/components/atoms/form/iconButton/IconButton.svelte +69 -0
  19. package/dist/components/atoms/form/iconButton/IconButton.svelte.d.ts +89 -0
  20. package/dist/components/atoms/form/iconButton/iconButton.variants.d.ts +64 -0
  21. package/dist/components/atoms/form/iconButton/iconButton.variants.js +91 -0
  22. package/dist/components/atoms/form/input/Input.svelte +65 -0
  23. package/dist/components/atoms/form/input/Input.svelte.d.ts +89 -0
  24. package/dist/components/atoms/form/input/input.variants.d.ts +22 -0
  25. package/dist/components/atoms/form/input/input.variants.js +15 -0
  26. package/dist/components/atoms/form/label/Label.svelte +36 -0
  27. package/dist/components/atoms/form/label/Label.svelte.d.ts +41 -0
  28. package/dist/components/atoms/form/textarea/Textarea.svelte +64 -0
  29. package/dist/components/atoms/form/textarea/Textarea.svelte.d.ts +89 -0
  30. package/dist/components/atoms/form/textarea/textarea.variants.d.ts +37 -0
  31. package/dist/components/atoms/form/textarea/textarea.variants.js +20 -0
  32. package/dist/components/atoms/icon/Icon.svelte +41 -0
  33. package/dist/components/atoms/icon/Icon.svelte.d.ts +21 -0
  34. package/dist/components/atoms/icon/components/Academy.svelte +27 -0
  35. package/dist/components/atoms/icon/components/Academy.svelte.d.ts +41 -0
  36. package/dist/components/atoms/icon/components/Bold.svelte +27 -0
  37. package/dist/components/atoms/icon/components/Bold.svelte.d.ts +41 -0
  38. package/dist/components/atoms/icon/components/Close.svelte +27 -0
  39. package/dist/components/atoms/icon/components/Close.svelte.d.ts +41 -0
  40. package/dist/components/atoms/icon/components/Italic.svelte +27 -0
  41. package/dist/components/atoms/icon/components/Italic.svelte.d.ts +41 -0
  42. package/dist/components/atoms/icon/components/Link.svelte +27 -0
  43. package/dist/components/atoms/icon/components/Link.svelte.d.ts +41 -0
  44. package/dist/components/atoms/icon/components/ListOrdered.svelte +27 -0
  45. package/dist/components/atoms/icon/components/ListOrdered.svelte.d.ts +41 -0
  46. package/dist/components/atoms/icon/components/ListUnordered.svelte +26 -0
  47. package/dist/components/atoms/icon/components/ListUnordered.svelte.d.ts +41 -0
  48. package/dist/components/atoms/icon/components/Refresh.svelte +27 -0
  49. package/dist/components/atoms/icon/components/Refresh.svelte.d.ts +41 -0
  50. package/dist/components/atoms/icon/components/Underline.svelte +26 -0
  51. package/dist/components/atoms/icon/components/Underline.svelte.d.ts +41 -0
  52. package/dist/components/atoms/icon/index.d.ts +20 -0
  53. package/dist/components/atoms/icon/index.js +21 -0
  54. package/dist/components/atoms/loading/spinner/Spinner.svelte +40 -0
  55. package/dist/components/atoms/loading/spinner/Spinner.svelte.d.ts +25 -0
  56. package/dist/components/molecules/notification/Notification.svelte +42 -0
  57. package/dist/components/molecules/notification/Notification.svelte.d.ts +57 -0
  58. package/dist/components/molecules/notification/notification.variants.d.ts +67 -0
  59. package/dist/components/molecules/notification/notification.variants.js +30 -0
  60. package/dist/components/molecules/richTextEditor/RichTextEditor.svelte +144 -0
  61. package/dist/components/molecules/richTextEditor/RichTextEditor.svelte.d.ts +87 -0
  62. package/dist/components/molecules/richTextEditor/RichTextEditorToolbar.svelte +5 -0
  63. package/dist/components/molecules/richTextEditor/RichTextEditorToolbar.svelte.d.ts +11 -0
  64. package/dist/components/molecules/richTextEditor/richTextEditor.variants.d.ts +64 -0
  65. package/dist/components/molecules/richTextEditor/richTextEditor.variants.js +30 -0
  66. package/dist/components/molecules/toggleGroup/ToggleGroup.svelte +61 -0
  67. package/dist/components/molecules/toggleGroup/ToggleGroup.svelte.d.ts +49 -0
  68. package/dist/components/molecules/toggleGroup/ToggleGroupItem.svelte +47 -0
  69. package/dist/components/molecules/toggleGroup/ToggleGroupItem.svelte.d.ts +25 -0
  70. package/dist/components/molecules/toggleGroup/toggleGroup.variants.d.ts +35 -0
  71. package/dist/components/molecules/toggleGroup/toggleGroup.variants.js +21 -0
  72. package/dist/components/molecules/toggleGroup/toggleGroupItem.variants.d.ts +110 -0
  73. package/dist/components/molecules/toggleGroup/toggleGroupItem.variants.js +69 -0
  74. package/dist/components/organisms/notificationGroup/NotificationGroup.svelte +68 -0
  75. package/dist/components/organisms/notificationGroup/NotificationGroup.svelte.d.ts +6 -0
  76. package/dist/components/organisms/notificationGroup/notificationGroup.variants.d.ts +24 -0
  77. package/dist/components/organisms/notificationGroup/notificationGroup.variants.js +11 -0
  78. package/dist/index.d.ts +17 -0
  79. package/dist/index.js +32 -0
  80. package/dist/utils/index.d.ts +1 -0
  81. package/dist/utils/index.js +1 -0
  82. package/dist/utils/notification.d.ts +1 -0
  83. package/dist/utils/notification.js +11 -0
  84. package/package.json +95 -0
@@ -0,0 +1,69 @@
1
+ import { tv } from "tailwind-variants";
2
+
3
+ const toggleGroupItemVariants = tv({
4
+ slots: {
5
+ base: "relative h-full w-full whitespace-nowrap",
6
+ button:
7
+ "button-small w-full h-full cursor-pointer block bg-transparent transition-[background,color] rounded-sm",
8
+ span: "relative z-2 block",
9
+ trigger: "absolute inset-0 z-1 bg-white shadow-sm rounded-sm",
10
+ },
11
+ variants: {
12
+ isActive: {
13
+ true: {
14
+ button: "text-neutral-900 dark:text-white",
15
+ },
16
+ false: {
17
+ button: "text-neutral-500",
18
+ },
19
+ },
20
+ size: {
21
+ small: {
22
+ button: "px-1.5",
23
+ },
24
+ medium: {
25
+ button: "px-3",
26
+ },
27
+ },
28
+ },
29
+ compoundVariants: [
30
+ {
31
+ appearance: "default",
32
+ class: {
33
+ button:
34
+ "hover:bg-neutral-300 hover:text-neutral-900 dark:hover:bg-neutral-600 dark:hover:text-white",
35
+ trigger: "dark:bg-neutral-700",
36
+ },
37
+ },
38
+ {
39
+ appearance: "raised",
40
+ class: {
41
+ button:
42
+ "hover:bg-neutral-100 hover:text-neutral-900 dark:hover:bg-neutral-600 dark:hover:text-white",
43
+ trigger: "dark:bg-neutral-800",
44
+ },
45
+ },
46
+ ],
47
+ });
48
+
49
+ const toggleGroupItemTabVariants = tv({
50
+ slots: {
51
+ base: "relative h-full w-full whitespace-nowrap px-1",
52
+ button: "button-default w-full h-full cursor-pointer transition-[color]",
53
+ span: "block",
54
+ trigger:
55
+ "bg-blue-500 h-0.5 w-full absolute -bottom-px left-0 rounded-t-xs dark:bg-blue-400",
56
+ },
57
+ variants: {
58
+ isActive: {
59
+ true: {
60
+ button: "text-neutral-900 dark:text-white",
61
+ },
62
+ false: {
63
+ button: "text-neutral-500 hover:text-neutral-900 dark:hover:text-white",
64
+ },
65
+ },
66
+ },
67
+ });
68
+
69
+ export { toggleGroupItemVariants, toggleGroupItemTabVariants };
@@ -0,0 +1,68 @@
1
+ <script>
2
+ import { onMount } from "svelte";
3
+ import { fly } from "svelte/transition";
4
+ import { cubicOut } from "svelte/easing";
5
+ import { Notification } from "../../../index.js";
6
+ import { notificationGroupVariants } from "./notificationGroup.variants.js";
7
+
8
+ onMount(() => {
9
+ document.body.addEventListener("notification:show", addNotification);
10
+
11
+ return () => {
12
+ document.body.removeEventListener("notification:show", addNotification);
13
+ };
14
+ });
15
+
16
+ const addNotification = (e) => {
17
+ const { detail } = e;
18
+
19
+ if (detail.position === "bottom-left") {
20
+ dataBottomLeft.push(detail);
21
+ } else if (detail.position === "bottom-right") {
22
+ dataBottomRight.push(detail);
23
+ }
24
+ };
25
+
26
+ let dataBottomLeft = $state([]);
27
+ let dataBottomRight = $state([]);
28
+
29
+ let { bottomLeft, bottomRight } = notificationGroupVariants();
30
+
31
+ const MOVE_MS = 400;
32
+ const IN_MS = 220;
33
+ const STAGGER = MOVE_MS - 200;
34
+
35
+ const handleClose = (id, position) => {
36
+ if (position === "bottom-left") {
37
+ const index = dataBottomLeft.findIndex((n) => n.id === id);
38
+ if (index !== -1) dataBottomLeft.splice(index, 1);
39
+ } else if (position === "bottom-right") {
40
+ const index = dataBottomRight.findIndex((n) => n.id === id);
41
+ if (index !== -1) dataBottomRight.splice(index, 1);
42
+ }
43
+ };
44
+ </script>
45
+
46
+ {#each [{ data: dataBottomLeft, class: bottomLeft(), x: -32, position: "bottom-left" }, { data: dataBottomRight, class: bottomRight(), x: 32, position: "bottom-right" }] as { data, class: cls, x, position }, idx (idx)}
47
+ <div class={cls}>
48
+ {#each data as item, i (item.id)}
49
+ <div
50
+ in:fly={{
51
+ x,
52
+ y: 0,
53
+ duration: IN_MS,
54
+ delay: i === data.length - 1 ? STAGGER : 0,
55
+ easing: cubicOut,
56
+ }}
57
+ out:fly={{
58
+ x,
59
+ y: 0,
60
+ duration: IN_MS,
61
+ delay: i === data.length - 1 ? STAGGER : 0,
62
+ easing: cubicOut,
63
+ }}>
64
+ <Notification {...item} onClose={() => handleClose(item.id, position)} />
65
+ </div>
66
+ {/each}
67
+ </div>
68
+ {/each}
@@ -0,0 +1,6 @@
1
+ export default NotificationGroup;
2
+ type NotificationGroup = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<Record<string, never>>): void;
5
+ };
6
+ declare const NotificationGroup: import("svelte").Component<Record<string, never>, {}, "">;
@@ -0,0 +1,24 @@
1
+ export const notificationGroupVariants: import("tailwind-variants").TVReturnType<{
2
+ [key: string]: {
3
+ [key: string]: import("tailwind-variants").ClassValue | {
4
+ bottomLeft?: import("tailwind-variants").ClassValue;
5
+ bottomRight?: import("tailwind-variants").ClassValue;
6
+ };
7
+ };
8
+ } | {
9
+ [x: string]: {
10
+ [x: string]: import("tailwind-variants").ClassValue | {
11
+ bottomLeft?: import("tailwind-variants").ClassValue;
12
+ bottomRight?: import("tailwind-variants").ClassValue;
13
+ };
14
+ };
15
+ }, {
16
+ bottomLeft: string;
17
+ bottomRight: string;
18
+ }, undefined, any, {
19
+ bottomLeft: string;
20
+ bottomRight: string;
21
+ }, import("tailwind-variants").TVReturnType<any, {
22
+ bottomLeft: string;
23
+ bottomRight: string;
24
+ }, undefined, unknown, unknown, undefined>>;
@@ -0,0 +1,11 @@
1
+ import { tv } from "tailwind-variants";
2
+
3
+ const notificationGroupVariants = tv({
4
+ slots: {
5
+ bottomLeft: "flex flex-col gap-2 absolute bottom-4 left-4 z-9999 overflow-hidden",
6
+ bottomRight:
7
+ "flex flex-col gap-2 absolute bottom-4 right-4 z-9999 overflow-hidden",
8
+ },
9
+ });
10
+
11
+ export { notificationGroupVariants };
@@ -0,0 +1,17 @@
1
+ export * as utils from "./utils/index.js";
2
+ export { default as Avatar } from "./components/atoms/avatar/Avatar.svelte";
3
+ export { default as Button } from "./components/atoms/form/button/Button.svelte";
4
+ export { default as CloseButton } from "./components/atoms/closeButton/CloseButton.svelte";
5
+ export { default as FormField } from "./components/atoms/form/formField/FormField.svelte";
6
+ export { default as HelperText } from "./components/atoms/form/helperText/HelperText.svelte";
7
+ export { default as Icon } from "./components/atoms/icon/Icon.svelte";
8
+ export { default as IconButton } from "./components/atoms/form/iconButton/IconButton.svelte";
9
+ export { default as Input } from "./components/atoms/form/input/Input.svelte";
10
+ export { default as Label } from "./components/atoms/form/label/Label.svelte";
11
+ export { default as Spinner } from "./components/atoms/loading/spinner/Spinner.svelte";
12
+ export { default as Textarea } from "./components/atoms/form/textarea/Textarea.svelte";
13
+ export { default as Notification } from "./components/molecules/notification/Notification.svelte";
14
+ export { default as RichTextEditor } from "./components/molecules/richTextEditor/RichTextEditor.svelte";
15
+ export { default as ToggleGroup } from "./components/molecules/toggleGroup/ToggleGroup.svelte";
16
+ export { default as ToggleGroupItem } from "./components/molecules/toggleGroup/ToggleGroupItem.svelte";
17
+ export { default as NotificationGroup } from "./components/organisms/notificationGroup/NotificationGroup.svelte";
package/dist/index.js ADDED
@@ -0,0 +1,32 @@
1
+ export * as utils from "./utils/index.js";
2
+
3
+ /**
4
+ * Atoms
5
+ */
6
+
7
+ export { default as Avatar } from "./components/atoms/avatar/Avatar.svelte";
8
+ export { default as Button } from "./components/atoms/form/button/Button.svelte";
9
+ export { default as CloseButton } from "./components/atoms/closeButton/CloseButton.svelte";
10
+ export { default as FormField } from "./components/atoms/form/formField/FormField.svelte";
11
+ export { default as HelperText } from "./components/atoms/form/helperText/HelperText.svelte";
12
+ export { default as Icon } from "./components/atoms/icon/Icon.svelte";
13
+ export { default as IconButton } from "./components/atoms/form/iconButton/IconButton.svelte";
14
+ export { default as Input } from "./components/atoms/form/input/Input.svelte";
15
+ export { default as Label } from "./components/atoms/form/label/Label.svelte";
16
+ export { default as Spinner } from "./components/atoms/loading/spinner/Spinner.svelte";
17
+ export { default as Textarea } from "./components/atoms/form/textarea/Textarea.svelte";
18
+
19
+ /**
20
+ * Molecules
21
+ */
22
+
23
+ export { default as Notification } from "./components/molecules/notification/Notification.svelte";
24
+ export { default as RichTextEditor } from "./components/molecules/richTextEditor/RichTextEditor.svelte";
25
+ export { default as ToggleGroup } from "./components/molecules/toggleGroup/ToggleGroup.svelte";
26
+ export { default as ToggleGroupItem } from "./components/molecules/toggleGroup/ToggleGroupItem.svelte";
27
+
28
+ /**
29
+ * Organisms
30
+ */
31
+
32
+ export { default as NotificationGroup } from "./components/organisms/notificationGroup/NotificationGroup.svelte";
@@ -0,0 +1 @@
1
+ export * from "./notification.js";
@@ -0,0 +1 @@
1
+ export * from "./notification.js";
@@ -0,0 +1 @@
1
+ export function showNotification(props: any): void;
@@ -0,0 +1,11 @@
1
+ import { v4 as uuidv4 } from "uuid";
2
+
3
+ const showNotification = (props) => {
4
+ document.body.dispatchEvent(
5
+ new CustomEvent("notification:show", {
6
+ detail: { id: uuidv4(), ...props },
7
+ }),
8
+ );
9
+ };
10
+
11
+ export { showNotification };
package/package.json ADDED
@@ -0,0 +1,95 @@
1
+ {
2
+ "name": "@websline/system-components",
3
+ "version": "0.0.1",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/Websline/websline.system-components.git"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "!dist/**/*.test.*",
14
+ "!dist/**/*.spec.*"
15
+ ],
16
+ "sideEffects": [
17
+ "**/*.css"
18
+ ],
19
+ "svelte": "./dist/index.js",
20
+ "types": "./dist/index.d.ts",
21
+ "type": "module",
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "svelte": "./dist/index.js"
26
+ }
27
+ },
28
+ "dependencies": {
29
+ "@tiptap/core": "^3.4.0",
30
+ "@tiptap/extension-color": "^3.4.0",
31
+ "@tiptap/extension-highlight": "^3.4.0",
32
+ "@tiptap/extension-link": "^3.4.0",
33
+ "@tiptap/extension-placeholder": "^3.4.0",
34
+ "@tiptap/extension-text-align": "^3.4.0",
35
+ "@tiptap/extension-text-style": "^3.4.0",
36
+ "@tiptap/extension-underline": "^3.4.0",
37
+ "@tiptap/pm": "^3.4.0",
38
+ "@tiptap/starter-kit": "^3.4.0",
39
+ "dompurify": "^3.2.6",
40
+ "tailwind-variants": "^3.1.0",
41
+ "uuid": "^11.1.0"
42
+ },
43
+ "peerDependencies": {
44
+ "svelte": "^5.38.6"
45
+ },
46
+ "devDependencies": {
47
+ "@eslint/compat": "^1.3.2",
48
+ "@eslint/js": "^9.34.0",
49
+ "@storybook/addon-a11y": "^9.1.4",
50
+ "@storybook/addon-docs": "^9.1.4",
51
+ "@storybook/addon-svelte-csf": "^5.0.8",
52
+ "@storybook/manager-api": "^8.6.14",
53
+ "@storybook/sveltekit": "^9.1.4",
54
+ "@storybook/theming": "^8.6.14",
55
+ "@sveltejs/adapter-auto": "^6.1.0",
56
+ "@sveltejs/kit": "^2.37.0",
57
+ "@sveltejs/package": "^2.5.0",
58
+ "@sveltejs/vite-plugin-svelte": "^6.1.4",
59
+ "@tailwindcss/forms": "^0.5.10",
60
+ "@tailwindcss/typography": "^0.5.16",
61
+ "@tailwindcss/vite": "^4.1.12",
62
+ "@types/node": "^24.3.0",
63
+ "@vitest/browser": "^3.2.4",
64
+ "eslint": "^9.34.0",
65
+ "eslint-config-prettier": "^10.1.8",
66
+ "eslint-plugin-storybook": "^9.1.4",
67
+ "eslint-plugin-svelte": "^3.12.1",
68
+ "globals": "^16.3.0",
69
+ "playwright": "^1.55.0",
70
+ "prettier": "^3.6.2",
71
+ "prettier-plugin-svelte": "^3.4.0",
72
+ "prettier-plugin-tailwindcss": "^0.6.14",
73
+ "publint": "^0.3.12",
74
+ "storybook": "^9.1.4",
75
+ "svelte": "^5.38.6",
76
+ "tailwindcss": "^4.1.12",
77
+ "typescript": "^5.9.2",
78
+ "vite": "^7.1.4",
79
+ "vitest": "^3.2.4",
80
+ "vitest-browser-svelte": "^1.1.0"
81
+ },
82
+ "keywords": [
83
+ "svelte"
84
+ ],
85
+ "scripts": {
86
+ "dev": "vite dev",
87
+ "build": "vite build && npm run prepack",
88
+ "format": "prettier --write .",
89
+ "lint": "prettier --check . && eslint .",
90
+ "test:unit": "vitest",
91
+ "test": "npm run test:unit -- --run",
92
+ "storybook": "storybook dev -p 6006",
93
+ "build-storybook": "storybook build"
94
+ }
95
+ }