@esportsplus/ui 0.21.5 → 0.21.6
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { reactive } from '@esportsplus/reactivity';
|
|
1
|
+
import { reactive, root } from '@esportsplus/reactivity';
|
|
2
2
|
import { html } from '@esportsplus/template';
|
|
3
3
|
import { omit } from '@esportsplus/utilities';
|
|
4
4
|
import template from '../../components/template/index.js';
|
|
@@ -17,7 +17,7 @@ function mask(attributes, modifier, state) {
|
|
|
17
17
|
<input
|
|
18
18
|
class='field-mask-tag field-mask-tag--hidden'
|
|
19
19
|
${{
|
|
20
|
-
checked: a.checked ||
|
|
20
|
+
checked: a.checked || root(() => state.active),
|
|
21
21
|
type: modifier === 'radio' ? 'radio' : 'checkbox',
|
|
22
22
|
value: a.value || 1
|
|
23
23
|
}}
|
|
@@ -37,11 +37,11 @@ const field = template.factory(function (attributes, content) {
|
|
|
37
37
|
${{
|
|
38
38
|
class: () => state.active && '--active',
|
|
39
39
|
onchange: (e) => {
|
|
40
|
-
let
|
|
40
|
+
let target = e.target, type = target.type;
|
|
41
41
|
if (type !== 'checkbox' && type !== 'radio') {
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
-
state.active =
|
|
44
|
+
state.active = target.checked;
|
|
45
45
|
}
|
|
46
46
|
}}
|
|
47
47
|
>
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { reactive } from '@esportsplus/reactivity';
|
|
1
|
+
import { reactive, root } from '@esportsplus/reactivity';
|
|
2
2
|
import { html, type Attributes, type Renderable } from '@esportsplus/template';
|
|
3
3
|
import { omit } from '@esportsplus/utilities';
|
|
4
4
|
import template from '~/components/template';
|
|
@@ -28,7 +28,7 @@ function mask(attributes: A, modifier: string, state: { active: boolean }) {
|
|
|
28
28
|
<input
|
|
29
29
|
class='field-mask-tag field-mask-tag--hidden'
|
|
30
30
|
${{
|
|
31
|
-
checked: a.checked ||
|
|
31
|
+
checked: a.checked || root(() => state.active),
|
|
32
32
|
type: modifier === 'radio' ? 'radio' : 'checkbox',
|
|
33
33
|
value: a.value || 1
|
|
34
34
|
}}
|
|
@@ -56,13 +56,14 @@ const field = template.factory(
|
|
|
56
56
|
${{
|
|
57
57
|
class: () => state.active && '--active',
|
|
58
58
|
onchange: (e) => {
|
|
59
|
-
let
|
|
59
|
+
let target = (e.target as HTMLInputElement),
|
|
60
|
+
type = target.type;
|
|
60
61
|
|
|
61
62
|
if (type !== 'checkbox' && type !== 'radio') {
|
|
62
63
|
return;
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
state.active =
|
|
66
|
+
state.active = target.checked;
|
|
66
67
|
}
|
|
67
68
|
}}
|
|
68
69
|
>
|