@r2digisolutions/ui 0.7.0 → 0.9.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/dist/components/index.d.ts +9 -1
- package/dist/components/index.js +9 -1
- package/dist/components/ui/Alert/Alert.svelte +13 -4
- package/dist/components/ui/Alert/type.d.ts +1 -1
- package/dist/components/ui/Avatar/Avatar.svelte +40 -0
- package/dist/components/ui/Avatar/Avatar.svelte.d.ts +4 -0
- package/dist/components/ui/Avatar/type.d.ts +9 -0
- package/dist/components/ui/Avatar/type.js +1 -0
- package/dist/components/ui/Card/Card.svelte +37 -0
- package/dist/components/ui/Card/Card.svelte.d.ts +4 -0
- package/dist/components/ui/Card/CardContent.svelte +7 -0
- package/dist/components/ui/Card/CardContent.svelte.d.ts +11 -0
- package/dist/components/ui/Card/CardDescription.svelte +7 -0
- package/dist/components/ui/Card/CardDescription.svelte.d.ts +11 -0
- package/dist/components/ui/Card/CardFooter.svelte +9 -0
- package/dist/components/ui/Card/CardFooter.svelte.d.ts +5 -0
- package/dist/components/ui/Card/CardHeader.svelte +7 -0
- package/dist/components/ui/Card/CardHeader.svelte.d.ts +5 -0
- package/dist/components/ui/Card/CardTitle.svelte +16 -0
- package/dist/components/ui/Card/CardTitle.svelte.d.ts +9 -0
- package/dist/components/ui/Card/type.d.ts +11 -0
- package/dist/components/ui/Card/type.js +1 -0
- package/dist/components/ui/Container/Container.svelte +9 -0
- package/dist/components/ui/Container/Container.svelte.d.ts +4 -0
- package/dist/components/ui/Container/type.d.ts +5 -0
- package/dist/components/ui/Container/type.js +1 -0
- package/dist/types/base.type.d.ts +4 -0
- package/dist/types/base.type.js +1 -0
- package/dist/types/sizes.type.d.ts +1 -0
- package/dist/types/sizes.type.js +1 -0
- package/package.json +3 -2
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import Alert from './ui/Alert/Alert.svelte';
|
|
2
2
|
import TableList from './ui/TableList/TableList.svelte';
|
|
3
|
-
|
|
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
|
+
import Container from './ui/Container/Container.svelte';
|
|
11
|
+
export { Alert, TableList, Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, Avatar, Container, };
|
package/dist/components/index.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import Alert from './ui/Alert/Alert.svelte';
|
|
2
2
|
import TableList from './ui/TableList/TableList.svelte';
|
|
3
|
-
|
|
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
|
+
import Container from './ui/Container/Container.svelte';
|
|
11
|
+
export { Alert, TableList, Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, Avatar, Container, };
|
|
@@ -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"
|
|
@@ -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 @@
|
|
|
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,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,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,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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@r2digisolutions/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"packageManager": "bun@1.2.18",
|
|
6
6
|
"publishConfig": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
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.
|
|
56
|
+
"@storybook/addon-svelte-csf": "5.0.7",
|
|
57
57
|
"@storybook/blocks": "^8.6.14",
|
|
58
58
|
"@storybook/svelte": "^9.0.16",
|
|
59
59
|
"@storybook/sveltekit": "^9.0.16",
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
"@sveltejs/package": "^2.3.12",
|
|
64
64
|
"@sveltejs/vite-plugin-svelte": "^6.0.0",
|
|
65
65
|
"@tailwindcss/postcss": "^4.1.11",
|
|
66
|
+
"@testing-library/svelte": "^5.2.8",
|
|
66
67
|
"@vitest/browser": "^3.2.4",
|
|
67
68
|
"changeset": "^0.2.6",
|
|
68
69
|
"eslint": "^9.31.0",
|