noph-ui 0.12.0 → 0.12.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.
package/dist/button/types.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export interface SegmentedButtonProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
45
45
|
icon?: Snippet;
|
|
46
46
|
onclick?: (event: Event) => void;
|
|
47
47
|
}[];
|
|
48
|
-
group?: string | number | null;
|
|
48
|
+
group?: string | number | (string | number)[] | null;
|
|
49
49
|
element?: HTMLElement;
|
|
50
50
|
}
|
|
51
51
|
export {};
|
|
@@ -10,31 +10,42 @@
|
|
|
10
10
|
style,
|
|
11
11
|
...attributes
|
|
12
12
|
}: CheckboxProps = $props()
|
|
13
|
+
|
|
14
|
+
$effect(() => {
|
|
15
|
+
if (group && attributes.value) {
|
|
16
|
+
checked = group.includes(attributes.value)
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
$effect(() => {
|
|
21
|
+
if (attributes.value && group) {
|
|
22
|
+
const index = group.indexOf(attributes.value)
|
|
23
|
+
if (checked) {
|
|
24
|
+
if (index < 0) {
|
|
25
|
+
group?.push(attributes.value)
|
|
26
|
+
group = group
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
if (index >= 0) {
|
|
30
|
+
group.splice(index, 1)
|
|
31
|
+
group = group
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
})
|
|
13
36
|
</script>
|
|
14
37
|
|
|
15
38
|
<div {style} class={['np-host', attributes.class]} bind:this={element}>
|
|
16
39
|
<div class="np-container">
|
|
17
40
|
<label class="np-input-wrapper">
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
aria-checked={indeterminate ? 'mixed' : undefined}
|
|
27
|
-
/>
|
|
28
|
-
{:else}
|
|
29
|
-
<input
|
|
30
|
-
{...attributes}
|
|
31
|
-
class="np-input"
|
|
32
|
-
type="checkbox"
|
|
33
|
-
bind:indeterminate
|
|
34
|
-
bind:checked
|
|
35
|
-
aria-checked={indeterminate ? 'mixed' : undefined}
|
|
36
|
-
/>
|
|
37
|
-
{/if}
|
|
41
|
+
<input
|
|
42
|
+
{...attributes}
|
|
43
|
+
class="np-input"
|
|
44
|
+
type="checkbox"
|
|
45
|
+
bind:indeterminate
|
|
46
|
+
bind:checked
|
|
47
|
+
aria-checked={indeterminate ? 'mixed' : undefined}
|
|
48
|
+
/>
|
|
38
49
|
{#if !attributes.disabled}
|
|
39
50
|
<Ripple />
|
|
40
51
|
{/if}
|
package/dist/checkbox/types.d.ts
CHANGED
|
@@ -23,6 +23,29 @@
|
|
|
23
23
|
}: FilterChipProps = $props()
|
|
24
24
|
|
|
25
25
|
let chipLabel: HTMLLabelElement | undefined = $state()
|
|
26
|
+
|
|
27
|
+
$effect(() => {
|
|
28
|
+
if (group && value) {
|
|
29
|
+
selected = group.includes(value)
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
$effect(() => {
|
|
34
|
+
if (value && group) {
|
|
35
|
+
const index = group.indexOf(value)
|
|
36
|
+
if (selected) {
|
|
37
|
+
if (index < 0) {
|
|
38
|
+
group?.push(value)
|
|
39
|
+
group = group
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
if (index >= 0) {
|
|
43
|
+
group.splice(index, 1)
|
|
44
|
+
group = group
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
})
|
|
26
49
|
</script>
|
|
27
50
|
|
|
28
51
|
<div
|
|
@@ -47,26 +70,14 @@
|
|
|
47
70
|
<CheckIcon width={18} height={18} />
|
|
48
71
|
</div>
|
|
49
72
|
<div class="np-chip-label">{label}</div>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
bind:group
|
|
59
|
-
/>
|
|
60
|
-
{:else}
|
|
61
|
-
<input
|
|
62
|
-
type="checkbox"
|
|
63
|
-
bind:checked={selected}
|
|
64
|
-
{value}
|
|
65
|
-
{name}
|
|
66
|
-
{disabled}
|
|
67
|
-
defaultChecked={defaultSelected}
|
|
68
|
-
/>
|
|
69
|
-
{/if}
|
|
73
|
+
<input
|
|
74
|
+
type="checkbox"
|
|
75
|
+
bind:checked={selected}
|
|
76
|
+
{value}
|
|
77
|
+
{name}
|
|
78
|
+
{disabled}
|
|
79
|
+
defaultChecked={defaultSelected}
|
|
80
|
+
/>
|
|
70
81
|
</label>
|
|
71
82
|
{#if !disabled}
|
|
72
83
|
<Ripple forElement={chipLabel} />
|
package/dist/chip/types.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface FilterChipProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
11
11
|
element?: HTMLDivElement;
|
|
12
12
|
name?: string;
|
|
13
13
|
value?: string;
|
|
14
|
-
group?: string | number | null;
|
|
14
|
+
group?: (string | number)[] | null;
|
|
15
15
|
defaultSelected?: boolean | null;
|
|
16
16
|
remove?: (chip: HTMLDivElement) => void;
|
|
17
17
|
}
|