@r2digisolutions/ui 0.16.0 → 0.18.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 +3 -1
- package/dist/components/index.js +3 -1
- package/dist/components/ui/Checkbox/Checkbox.svelte +35 -0
- package/dist/components/ui/Checkbox/Checkbox.svelte.d.ts +4 -0
- package/dist/components/ui/Checkbox/type.d.ts +14 -0
- package/dist/components/ui/Checkbox/type.js +1 -0
- package/dist/components/ui/Textarea/Textarea.svelte +18 -0
- package/dist/components/ui/Textarea/Textarea.svelte.d.ts +4 -0
- package/dist/components/ui/Textarea/type.d.ts +17 -0
- package/dist/components/ui/Textarea/type.js +1 -0
- package/package.json +1 -1
|
@@ -16,4 +16,6 @@ import Label from './ui/Label/Label.svelte';
|
|
|
16
16
|
import Field from './ui/Field/Field.svelte';
|
|
17
17
|
import Input from './ui/Input/Input.svelte';
|
|
18
18
|
import InputRadio from './ui/InputRadio/InputRadio.svelte';
|
|
19
|
-
|
|
19
|
+
import Textarea from './ui/Textarea/Textarea.svelte';
|
|
20
|
+
import Checkbox from './ui/Checkbox/Checkbox.svelte';
|
|
21
|
+
export { Alert, Avatar, Button, Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, Container, Checkbox, Field, Section, Loading, TableList, Heading, Label, Input, InputRadio, Textarea, };
|
package/dist/components/index.js
CHANGED
|
@@ -16,4 +16,6 @@ import Label from './ui/Label/Label.svelte';
|
|
|
16
16
|
import Field from './ui/Field/Field.svelte';
|
|
17
17
|
import Input from './ui/Input/Input.svelte';
|
|
18
18
|
import InputRadio from './ui/InputRadio/InputRadio.svelte';
|
|
19
|
-
|
|
19
|
+
import Textarea from './ui/Textarea/Textarea.svelte';
|
|
20
|
+
import Checkbox from './ui/Checkbox/Checkbox.svelte';
|
|
21
|
+
export { Alert, Avatar, Button, Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, Container, Checkbox, Field, Section, Loading, TableList, Heading, Label, Input, InputRadio, Textarea, };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Props } from './type.js';
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
name,
|
|
6
|
+
label,
|
|
7
|
+
required,
|
|
8
|
+
checked,
|
|
9
|
+
disabled,
|
|
10
|
+
value,
|
|
11
|
+
group = $bindable([]),
|
|
12
|
+
onchange,
|
|
13
|
+
...props
|
|
14
|
+
}: Props = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<input
|
|
18
|
+
{...props}
|
|
19
|
+
{required}
|
|
20
|
+
bind:checked
|
|
21
|
+
{value}
|
|
22
|
+
type="checkbox"
|
|
23
|
+
{name}
|
|
24
|
+
class="shrink-0 rounded-sm border-gray-300 text-blue-600 focus:ring-blue-500 disabled:pointer-events-none disabled:opacity-50 dark:border-neutral-600 dark:bg-neutral-900 dark:checked:border-blue-500 dark:checked:bg-blue-500 dark:focus:ring-offset-gray-800"
|
|
25
|
+
onchange={(e) => {
|
|
26
|
+
const checked = e.currentTarget.checked;
|
|
27
|
+
const value = e.currentTarget.value;
|
|
28
|
+
|
|
29
|
+
onchange?.(Boolean(checked ?? false), value ?? null);
|
|
30
|
+
}}
|
|
31
|
+
/>
|
|
32
|
+
|
|
33
|
+
{#if label}
|
|
34
|
+
<span class="sr-only">{label}</span>
|
|
35
|
+
{/if}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ClassValue } from 'svelte/elements';
|
|
2
|
+
type Value = string | number | boolean;
|
|
3
|
+
export interface Props {
|
|
4
|
+
class?: ClassValue;
|
|
5
|
+
group?: boolean[];
|
|
6
|
+
name?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
value?: Value;
|
|
9
|
+
checked?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
onchange?(checked: boolean, value: Value): void;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Props } from './type.js';
|
|
3
|
+
|
|
4
|
+
const { onchange, rows = 10, ...props }: Props = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<textarea
|
|
8
|
+
{...props}
|
|
9
|
+
{rows}
|
|
10
|
+
onchange={(e) => {
|
|
11
|
+
const value = e.currentTarget.value;
|
|
12
|
+
(onchange as (value: string | null, e: Event) => void)?.(value || null, e);
|
|
13
|
+
}}
|
|
14
|
+
class={[
|
|
15
|
+
'block w-full rounded-lg border border-gray-300 px-3 py-3 transition-colors focus:border-transparent focus:ring-2 focus:ring-purple-500',
|
|
16
|
+
props.class
|
|
17
|
+
]}
|
|
18
|
+
></textarea>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ClassValue } from "svelte/elements";
|
|
2
|
+
export interface Props {
|
|
3
|
+
onchange?: (value: string | null, e: Event) => void;
|
|
4
|
+
class?: ClassValue;
|
|
5
|
+
rows?: number;
|
|
6
|
+
cols?: number;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
readonly?: boolean;
|
|
10
|
+
autofocus?: boolean;
|
|
11
|
+
value?: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
maxlength?: number;
|
|
15
|
+
minlength?: number;
|
|
16
|
+
autocomplete?: 'on' | 'off';
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|