@lyeve-labs/ui-kit 0.11.0 → 0.11.2
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/Button.svelte +12 -2
- package/dist/components/Button.svelte.d.ts +8 -2
- package/dist/components/Checkbox.svelte +2 -2
- package/dist/components/Input.svelte +12 -2
- package/dist/components/Input.svelte.d.ts +8 -2
- package/dist/components/Radio.svelte +2 -2
- package/dist/components/RadioGroup.svelte +2 -2
- package/dist/components/Textarea.svelte +4 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
|
|
3
4
|
import Spinner from './Spinner.svelte';
|
|
4
5
|
|
|
5
6
|
type Variant = 'primary' | 'secondary' | 'danger' | 'ghost' | 'outline' | 'violet';
|
|
6
7
|
type Size = 'sm' | 'md' | 'lg';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Attributes forwarded to whichever element renders. Naming them, rather than
|
|
11
|
+
* accepting an open index signature, means a prop the component does not
|
|
12
|
+
* define fails the build instead of reaching the DOM as a stray attribute.
|
|
13
|
+
*/
|
|
14
|
+
type Forwarded = Omit<
|
|
15
|
+
HTMLButtonAttributes & HTMLAnchorAttributes,
|
|
16
|
+
'type' | 'href' | 'disabled' | 'class' | 'onclick' | 'children'
|
|
17
|
+
>;
|
|
18
|
+
|
|
19
|
+
interface Props extends Forwarded {
|
|
9
20
|
variant?: Variant;
|
|
10
21
|
size?: Size;
|
|
11
22
|
disabled?: boolean;
|
|
@@ -16,7 +27,6 @@
|
|
|
16
27
|
class?: string;
|
|
17
28
|
onclick?: (e: MouseEvent) => void;
|
|
18
29
|
children: Snippet;
|
|
19
|
-
[key: string]: unknown;
|
|
20
30
|
}
|
|
21
31
|
|
|
22
32
|
let {
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
|
|
2
3
|
type Variant = 'primary' | 'secondary' | 'danger' | 'ghost' | 'outline' | 'violet';
|
|
3
4
|
type Size = 'sm' | 'md' | 'lg';
|
|
4
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Attributes forwarded to whichever element renders. Naming them, rather than
|
|
7
|
+
* accepting an open index signature, means a prop the component does not
|
|
8
|
+
* define fails the build instead of reaching the DOM as a stray attribute.
|
|
9
|
+
*/
|
|
10
|
+
type Forwarded = Omit<HTMLButtonAttributes & HTMLAnchorAttributes, 'type' | 'href' | 'disabled' | 'class' | 'onclick' | 'children'>;
|
|
11
|
+
interface Props extends Forwarded {
|
|
5
12
|
variant?: Variant;
|
|
6
13
|
size?: Size;
|
|
7
14
|
disabled?: boolean;
|
|
@@ -12,7 +19,6 @@ interface Props {
|
|
|
12
19
|
class?: string;
|
|
13
20
|
onclick?: (e: MouseEvent) => void;
|
|
14
21
|
children: Snippet;
|
|
15
|
-
[key: string]: unknown;
|
|
16
22
|
}
|
|
17
23
|
declare const Button: import("svelte").Component<Props, {}, "">;
|
|
18
24
|
type Button = ReturnType<typeof Button>;
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
{disabled}
|
|
46
46
|
{checked}
|
|
47
47
|
onchange={handleChange}
|
|
48
|
-
class="peer
|
|
48
|
+
class="peer absolute inset-0 m-0 h-full w-full cursor-pointer opacity-0 disabled:cursor-not-allowed"
|
|
49
49
|
/>
|
|
50
50
|
<span
|
|
51
|
-
class="w-4 h-4 rounded border transition-colors duration-150 flex items-center justify-center
|
|
51
|
+
class="pointer-events-none w-4 h-4 rounded border transition-colors duration-150 flex items-center justify-center
|
|
52
52
|
{checked
|
|
53
53
|
? 'bg-brand border-brand'
|
|
54
54
|
: 'bg-surface-2 border-line peer-focus-visible:border-brand'}"
|
|
@@ -8,8 +8,19 @@
|
|
|
8
8
|
controlBorder,
|
|
9
9
|
describedBy,
|
|
10
10
|
} from '../internal/field.js';
|
|
11
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Attributes forwarded to the input. Naming them, rather than accepting an
|
|
15
|
+
* open index signature, means a prop the component does not define fails the
|
|
16
|
+
* build instead of reaching the DOM as a stray attribute.
|
|
17
|
+
*/
|
|
18
|
+
type Forwarded = Omit<
|
|
19
|
+
HTMLInputAttributes,
|
|
20
|
+
'value' | 'type' | 'placeholder' | 'disabled' | 'required' | 'id' | 'name' | 'class'
|
|
21
|
+
>;
|
|
22
|
+
|
|
23
|
+
interface Props extends Forwarded {
|
|
13
24
|
value?: string;
|
|
14
25
|
label?: string;
|
|
15
26
|
type?: string;
|
|
@@ -21,7 +32,6 @@
|
|
|
21
32
|
id?: string;
|
|
22
33
|
name?: string;
|
|
23
34
|
class?: string;
|
|
24
|
-
[key: string]: unknown;
|
|
25
35
|
}
|
|
26
36
|
|
|
27
37
|
let {
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
|
+
/**
|
|
3
|
+
* Attributes forwarded to the input. Naming them, rather than accepting an
|
|
4
|
+
* open index signature, means a prop the component does not define fails the
|
|
5
|
+
* build instead of reaching the DOM as a stray attribute.
|
|
6
|
+
*/
|
|
7
|
+
type Forwarded = Omit<HTMLInputAttributes, 'value' | 'type' | 'placeholder' | 'disabled' | 'required' | 'id' | 'name' | 'class'>;
|
|
8
|
+
interface Props extends Forwarded {
|
|
2
9
|
value?: string;
|
|
3
10
|
label?: string;
|
|
4
11
|
type?: string;
|
|
@@ -10,7 +17,6 @@ interface Props {
|
|
|
10
17
|
id?: string;
|
|
11
18
|
name?: string;
|
|
12
19
|
class?: string;
|
|
13
|
-
[key: string]: unknown;
|
|
14
20
|
}
|
|
15
21
|
declare const Input: import("svelte").Component<Props, {}, "value">;
|
|
16
22
|
type Input = ReturnType<typeof Input>;
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
{disabled}
|
|
47
47
|
checked={group === value}
|
|
48
48
|
onchange={handleChange}
|
|
49
|
-
class="peer
|
|
49
|
+
class="peer absolute inset-0 m-0 h-full w-full cursor-pointer opacity-0 disabled:cursor-not-allowed"
|
|
50
50
|
/>
|
|
51
51
|
<span
|
|
52
|
-
class="flex h-4 w-4 items-center justify-center rounded-full border-2 transition-colors duration-150
|
|
52
|
+
class="pointer-events-none flex h-4 w-4 items-center justify-center rounded-full border-2 transition-colors duration-150
|
|
53
53
|
{group === value
|
|
54
54
|
? 'border-brand bg-surface-2'
|
|
55
55
|
: 'border-line bg-surface-2 peer-focus-visible:border-brand'}"
|
|
@@ -68,10 +68,10 @@
|
|
|
68
68
|
disabled={disabled || opt.disabled}
|
|
69
69
|
checked={value === opt.value}
|
|
70
70
|
onchange={() => select(opt)}
|
|
71
|
-
class="peer
|
|
71
|
+
class="peer absolute inset-0 m-0 h-full w-full cursor-pointer opacity-0 disabled:cursor-not-allowed"
|
|
72
72
|
/>
|
|
73
73
|
<span
|
|
74
|
-
class="flex h-4 w-4 items-center justify-center rounded-full border-2 transition-colors duration-150
|
|
74
|
+
class="pointer-events-none flex h-4 w-4 items-center justify-center rounded-full border-2 transition-colors duration-150
|
|
75
75
|
{value === opt.value
|
|
76
76
|
? 'border-brand bg-surface-2'
|
|
77
77
|
: 'border-line bg-surface-2 peer-focus-visible:border-brand'}"
|
|
@@ -49,11 +49,6 @@
|
|
|
49
49
|
} = $props();
|
|
50
50
|
|
|
51
51
|
const fieldId = $derived(id ?? (label ? label.toLowerCase().replace(/\s+/g, '-') : undefined));
|
|
52
|
-
|
|
53
|
-
function handleInput(e: TAE) {
|
|
54
|
-
value = e.currentTarget.value;
|
|
55
|
-
oninput?.(e);
|
|
56
|
-
}
|
|
57
52
|
</script>
|
|
58
53
|
|
|
59
54
|
<div class="{FIELD_WRAP} {cls}">
|
|
@@ -75,9 +70,10 @@
|
|
|
75
70
|
aria-invalid={error ? 'true' : undefined}
|
|
76
71
|
aria-describedby={describedBy(fieldId, error, hint)}
|
|
77
72
|
class="{CONTROL_MULTILINE} {controlBorder(!!error)} {resize ? 'resize-y' : 'resize-none'}"
|
|
78
|
-
|
|
79
|
-
{
|
|
80
|
-
|
|
73
|
+
bind:value
|
|
74
|
+
{oninput}
|
|
75
|
+
{onblur}
|
|
76
|
+
></textarea>
|
|
81
77
|
|
|
82
78
|
{#if error}
|
|
83
79
|
<p id={fieldId ? `${fieldId}-error` : undefined} class={FIELD_ERROR}>{error}</p>
|
package/dist/index.d.ts
CHANGED
|
@@ -60,4 +60,4 @@ export { openDialog, closeDialog, dismissDialog, dismissAllDialogs, confirm, set
|
|
|
60
60
|
export type { DialogOptions, DialogEntry, DialogSize } from './components/dialog/types.js';
|
|
61
61
|
export { cn, type ClassValue } from './utils/cn.js';
|
|
62
62
|
export { getTheme, setTheme, toggleTheme, themeBootScript, type Theme } from './utils/theme.js';
|
|
63
|
-
export declare const VERSION = "0.11.
|
|
63
|
+
export declare const VERSION = "0.11.2";
|
package/dist/index.js
CHANGED
|
@@ -71,4 +71,4 @@ export { getTheme, setTheme, toggleTheme, themeBootScript } from './utils/theme.
|
|
|
71
71
|
// ── Version ────────────────────────────────────────────────────────────────
|
|
72
72
|
// Generated from package.json by `pnpm version:sync`. Bump package.json, never
|
|
73
73
|
// this line; the build and the test suite fail when the two disagree.
|
|
74
|
-
export const VERSION = '0.11.
|
|
74
|
+
export const VERSION = '0.11.2';
|
package/package.json
CHANGED