@r2digisolutions/ui 0.6.1 → 0.8.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.
package/README.md CHANGED
@@ -56,3 +56,13 @@ To publish your library to [npm](https://www.npmjs.com):
56
56
  ```bash
57
57
  npm publish
58
58
  ```
59
+
60
+ ## Publishing
61
+
62
+ Go into the `package.json` and give your package the desired name through the `"name"` option.
63
+
64
+ To publish your library to [npm](https://www.npmjs.com):
65
+
66
+ ```bash
67
+ npm publish
68
+ ```
@@ -1,3 +1,10 @@
1
1
  import Alert from './ui/Alert/Alert.svelte';
2
2
  import TableList from './ui/TableList/TableList.svelte';
3
- export { Alert, TableList };
3
+ import Card from './ui/Card/Card.svelte';
4
+ import CardTitle from './ui/Card/CardTitle.svelte';
5
+ import CardDescription from './ui/Card/CardDescription.svelte';
6
+ import CardContent from './ui/Card/CardContent.svelte';
7
+ import CardFooter from './ui/Card/CardFooter.svelte';
8
+ import CardHeader from './ui/Card/CardHeader.svelte';
9
+ import Avatar from './ui/Avatar/Avatar.svelte';
10
+ export { Alert, TableList, Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, Avatar };
@@ -1,3 +1,10 @@
1
1
  import Alert from './ui/Alert/Alert.svelte';
2
2
  import TableList from './ui/TableList/TableList.svelte';
3
- export { Alert, TableList };
3
+ import Card from './ui/Card/Card.svelte';
4
+ import CardTitle from './ui/Card/CardTitle.svelte';
5
+ import CardDescription from './ui/Card/CardDescription.svelte';
6
+ import CardContent from './ui/Card/CardContent.svelte';
7
+ import CardFooter from './ui/Card/CardFooter.svelte';
8
+ import CardHeader from './ui/Card/CardHeader.svelte';
9
+ import Avatar from './ui/Avatar/Avatar.svelte';
10
+ export { Alert, TableList, Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, Avatar };
@@ -3,15 +3,24 @@
3
3
  import type { Props } from './type.js';
4
4
 
5
5
  const { message, type = 'error', errors, children, ...props }: Props = $props();
6
+
7
+ const class_type: Record<typeof type, string> = {
8
+ error:
9
+ 'border-red-200 border bg-red-50 text-sm text-red-800 dark:border-red-900 dark:bg-red-800/10 dark:text-red-500',
10
+ warning:
11
+ 'border-yellow-200 border bg-yellow-50 text-sm text-yellow-800 dark:border-yellow-900 dark:bg-yellow-800/10 dark:text-yellow-500',
12
+ info: 'border-blue-200 border bg-blue-50 text-sm text-blue-800 dark:border-blue-900 dark:bg-blue-800/10 dark:text-blue-500',
13
+ success:
14
+ 'border-green-200 border bg-green-50 text-sm text-green-800 dark:border-green-900 dark:bg-green-800/10 dark:text-green-500'
15
+ };
16
+
17
+ const class_types = $derived(class_type[type]);
6
18
  </script>
7
19
 
8
20
  <div
9
21
  in:fade={{ duration: 300 }}
10
22
  out:fade={{ duration: 300 }}
11
- class={[
12
- 'rounded-lg border border-red-200 bg-red-50 p-4 text-sm text-red-800 dark:border-red-900 dark:bg-red-800/10 dark:text-red-500',
13
- props.class
14
- ]}
23
+ class={['rounded-lg p-4', class_types, props.class]}
15
24
  role="alert"
16
25
  tabindex="-1"
17
26
  aria-labelledby="hs-with-list-label"
@@ -4,6 +4,6 @@ export interface Props {
4
4
  class?: ClassValue;
5
5
  message: string;
6
6
  type?: 'error' | 'success' | 'warning' | 'info';
7
- errors?: Record<string, string>;
7
+ errors?: Record<string, string[]>;
8
8
  children?: Snippet;
9
9
  }
@@ -0,0 +1,40 @@
1
+ <script lang="ts">
2
+ import type { Props } from './type.js';
3
+
4
+ const { src, alt, size = 'md', fallback, online = false }: Props = $props();
5
+
6
+ const sizes: Record<typeof size, string> = {
7
+ xs: 'w-4 h-4',
8
+ sm: 'w-5 h-5',
9
+ md: 'w-6 h-6',
10
+ lg: 'w-8 h-8',
11
+ xl: 'w-10 h-10',
12
+ '2xl': 'w-12 h-12',
13
+ '3xl': 'w-14 h-14',
14
+ '4xl': 'w-16 h-16',
15
+ '5xl': 'w-20 h-20',
16
+ '6xl': 'w-24 h-24',
17
+ '7xl': 'w-28 h-28',
18
+ '8xl': 'w-32 h-32'
19
+ };
20
+ </script>
21
+
22
+ <div class="relative">
23
+ <div
24
+ class={[
25
+ 'flex items-center justify-center overflow-hidden rounded-full bg-gray-900 font-semibold text-white ring-2 ring-gray-100',
26
+ sizes[size]
27
+ ]}
28
+ >
29
+ {#if src}
30
+ <img {src} {alt} class="h-full w-full object-cover" />
31
+ {:else}
32
+ <span>{fallback}</span>
33
+ {/if}
34
+ </div>
35
+ {#if online}
36
+ <div
37
+ class="absolute -right-0.5 -bottom-0.5 h-3 w-3 rounded-full border-2 border-white bg-green-500"
38
+ ></div>
39
+ {/if}
40
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { Props } from './type.js';
2
+ declare const Avatar: import("svelte").Component<Props, {}, "">;
3
+ type Avatar = ReturnType<typeof Avatar>;
4
+ export default Avatar;
@@ -0,0 +1,9 @@
1
+ import type { BaseProps } from "../../../types/base.type.js";
2
+ import type { TSize } from "../../../types/sizes.type.js";
3
+ export interface Props extends BaseProps {
4
+ src?: string;
5
+ alt?: string;
6
+ size?: TSize;
7
+ fallback?: string;
8
+ online?: boolean;
9
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,37 @@
1
+ <script lang="ts">
2
+ import type { Props } from './type.js';
3
+
4
+ const { children, footer, header, onclick, ...props }: Props = $props();
5
+ </script>
6
+
7
+ <svelte:element
8
+ this={onclick ? 'button' : 'article'}
9
+ {...props}
10
+ role="button"
11
+ type={onclick ? 'button' : undefined}
12
+ tabindex="0"
13
+ aria-label="Card"
14
+ {onclick}
15
+ class={[
16
+ 'overflow-hidden rounded-3xl border border-white/50 bg-white text-black shadow-sm backdrop-blur-xl dark:border-neutral-700 dark:bg-neutral-900 dark:text-white',
17
+ props.class
18
+ ]}
19
+ >
20
+ {#if header}
21
+ <header class="flex flex-row gap-2 p-6 pb-2">
22
+ {@render header()}
23
+ </header>
24
+ {/if}
25
+
26
+ <section class={['flex flex-1 flex-col gap-2', props.body_class]}>
27
+ {@render children()}
28
+ </section>
29
+
30
+ {#if footer}
31
+ <footer
32
+ class="flex justify-between rounded-b-xl border-t border-gray-200 bg-gray-50 p-3 pt-2 dark:border-neutral-700 dark:bg-neutral-800"
33
+ >
34
+ {@render footer()}
35
+ </footer>
36
+ {/if}
37
+ </svelte:element>
@@ -0,0 +1,4 @@
1
+ import type { Props } from './type.js';
2
+ declare const Card: import("svelte").Component<Props, {}, "">;
3
+ type Card = ReturnType<typeof Card>;
4
+ export default Card;
@@ -0,0 +1,7 @@
1
+ <script>
2
+ const { children } = $props();
3
+ </script>
4
+
5
+ <div class="flex flex-1 flex-col gap-2 p-6">
6
+ {@render children()}
7
+ </div>
@@ -0,0 +1,11 @@
1
+ export default CardContent;
2
+ type CardContent = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<$$ComponentProps>): void;
5
+ };
6
+ declare const CardContent: import("svelte").Component<{
7
+ children: any;
8
+ }, {}, "">;
9
+ type $$ComponentProps = {
10
+ children: any;
11
+ };
@@ -0,0 +1,7 @@
1
+ <script>
2
+ const { children } = $props();
3
+ </script>
4
+
5
+ <p class="text-sm text-gray-500 dark:text-gray-400">
6
+ {@render children()}
7
+ </p>
@@ -0,0 +1,11 @@
1
+ export default CardDescription;
2
+ type CardDescription = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<$$ComponentProps>): void;
5
+ };
6
+ declare const CardDescription: import("svelte").Component<{
7
+ children: any;
8
+ }, {}, "">;
9
+ type $$ComponentProps = {
10
+ children: any;
11
+ };
@@ -0,0 +1,9 @@
1
+ <script lang="ts">
2
+ const { children } = $props();
3
+ </script>
4
+
5
+ <footer
6
+ class="flex justify-between rounded-b-xl border-t border-gray-200 bg-gray-50 p-3 pt-2 dark:border-neutral-700 dark:bg-neutral-800"
7
+ >
8
+ {@render children()}
9
+ </footer>
@@ -0,0 +1,5 @@
1
+ declare const CardFooter: import("svelte").Component<{
2
+ children: any;
3
+ }, {}, "">;
4
+ type CardFooter = ReturnType<typeof CardFooter>;
5
+ export default CardFooter;
@@ -0,0 +1,7 @@
1
+ <script lang="ts">
2
+ const { children } = $props();
3
+ </script>
4
+
5
+ <header class="flex flex-row gap-2">
6
+ {@render children()}
7
+ </header>
@@ -0,0 +1,5 @@
1
+ declare const CardHeader: import("svelte").Component<{
2
+ children: any;
3
+ }, {}, "">;
4
+ type CardHeader = ReturnType<typeof CardHeader>;
5
+ export default CardHeader;
@@ -0,0 +1,16 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import type { ClassValue } from 'svelte/elements';
4
+
5
+ const {
6
+ children,
7
+ ...props
8
+ }: {
9
+ children: Snippet;
10
+ class?: ClassValue;
11
+ } = $props();
12
+ </script>
13
+
14
+ <h3 {...props} class={['text-lg font-semibold', props.class]}>
15
+ {@render children()}
16
+ </h3>
@@ -0,0 +1,9 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { ClassValue } from 'svelte/elements';
3
+ type $$ComponentProps = {
4
+ children: Snippet;
5
+ class?: ClassValue;
6
+ };
7
+ declare const CardTitle: import("svelte").Component<$$ComponentProps, {}, "">;
8
+ type CardTitle = ReturnType<typeof CardTitle>;
9
+ export default CardTitle;
@@ -0,0 +1,11 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { ClassValue } from 'svelte/elements';
3
+ export interface Props {
4
+ style?: string;
5
+ onclick?: () => void;
6
+ body_class?: ClassValue;
7
+ class?: ClassValue;
8
+ footer?: Snippet;
9
+ header?: Snippet;
10
+ children: Snippet;
11
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { ClassValue } from "svelte/elements";
2
+ export interface BaseProps {
3
+ class?: ClassValue;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export type TSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | '7xl' | '8xl';
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@r2digisolutions/ui",
3
- "version": "0.6.1",
3
+ "version": "0.8.0",
4
4
  "private": false,
5
- "packageManager": "bun@1.2.8",
5
+ "packageManager": "bun@1.2.18",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
@@ -47,42 +47,43 @@
47
47
  "svelte": "^5.0.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@changesets/cli": "^2.29.4",
51
- "@chromatic-com/storybook": "^3.2.6",
52
- "@eslint/compat": "^1.2.9",
53
- "@playwright/test": "^1.52.0",
50
+ "@changesets/cli": "^2.29.5",
51
+ "@chromatic-com/storybook": "^4.0.1",
52
+ "@eslint/compat": "^1.3.1",
53
+ "@playwright/test": "^1.54.1",
54
54
  "@storybook/addon-essentials": "^8.6.14",
55
55
  "@storybook/addon-interactions": "^8.6.14",
56
- "@storybook/addon-svelte-csf": "5.0.0",
56
+ "@storybook/addon-svelte-csf": "5.0.6",
57
57
  "@storybook/blocks": "^8.6.14",
58
- "@storybook/svelte": "^8.6.14",
59
- "@storybook/sveltekit": "^8.6.14",
58
+ "@storybook/svelte": "^9.0.16",
59
+ "@storybook/sveltekit": "^9.0.16",
60
60
  "@storybook/test": "^8.6.14",
61
61
  "@sveltejs/adapter-static": "^3.0.8",
62
- "@sveltejs/kit": "^2.21.0",
63
- "@sveltejs/package": "^2.3.11",
64
- "@sveltejs/vite-plugin-svelte": "^5.0.3",
65
- "@tailwindcss/postcss": "^4.1.7",
66
- "@vitest/browser": "^3.1.3",
62
+ "@sveltejs/kit": "^2.22.5",
63
+ "@sveltejs/package": "^2.3.12",
64
+ "@sveltejs/vite-plugin-svelte": "^6.0.0",
65
+ "@tailwindcss/postcss": "^4.1.11",
66
+ "@testing-library/svelte": "^5.2.8",
67
+ "@vitest/browser": "^3.2.4",
67
68
  "changeset": "^0.2.6",
68
- "eslint": "^9.27.0",
69
+ "eslint": "^9.31.0",
69
70
  "eslint-config-prettier": "^10.1.5",
70
- "eslint-plugin-svelte": "^3.8.0",
71
- "globals": "^16.1.0",
71
+ "eslint-plugin-svelte": "^3.10.1",
72
+ "globals": "^16.3.0",
72
73
  "jsdom": "^26.1.0",
73
- "lucide-svelte": "^0.511.0",
74
- "prettier": "^3.5.3",
74
+ "lucide-svelte": "^0.525.0",
75
+ "prettier": "^3.6.2",
75
76
  "prettier-plugin-svelte": "^3.4.0",
76
- "prettier-plugin-tailwindcss": "^0.6.11",
77
+ "prettier-plugin-tailwindcss": "^0.6.14",
77
78
  "publint": "^0.3.12",
78
- "storybook": "^8.6.14",
79
- "svelte": "^5.30.1",
80
- "svelte-check": "^4.2.1",
81
- "tailwindcss": "^4.1.7",
79
+ "storybook": "^9.0.16",
80
+ "svelte": "^5.35.6",
81
+ "svelte-check": "^4.2.2",
82
+ "tailwindcss": "^4.1.11",
82
83
  "typescript": "^5.8.3",
83
- "typescript-eslint": "^8.32.1",
84
- "vite": "^6.3.5",
85
- "vitest": "^3.1.3"
84
+ "typescript-eslint": "^8.36.0",
85
+ "vite": "^7.0.4",
86
+ "vitest": "^3.2.4"
86
87
  },
87
88
  "dependencies": {
88
89
  "@tailwindcss/container-queries": "^0.1.1",