@panneau/field-toggle 4.0.37 → 4.0.40-alpha.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/index.js +77 -35
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,50 +1,92 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import Switch from 'rc-switch';
|
|
4
|
-
import { useMemo, useCallback } from 'react';
|
|
5
4
|
import 'rc-switch/assets/index.css';
|
|
6
5
|
import { jsx } from 'react/jsx-runtime';
|
|
7
6
|
|
|
8
7
|
var styles = {"container":"panneau-field-toggle-container"};
|
|
9
8
|
|
|
10
|
-
function ToggleField(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
queryValue
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
9
|
+
function ToggleField(t0) {
|
|
10
|
+
const $ = c(15);
|
|
11
|
+
const {
|
|
12
|
+
value: t1,
|
|
13
|
+
queryValue: t2,
|
|
14
|
+
name: t3,
|
|
15
|
+
disabled: t4,
|
|
16
|
+
className: t5,
|
|
17
|
+
onChange: t6
|
|
18
|
+
} = t0;
|
|
19
|
+
const value = t1 === undefined ? null : t1;
|
|
20
|
+
const queryValue = t2 === undefined ? null : t2;
|
|
21
|
+
const name = t3 === undefined ? null : t3;
|
|
22
|
+
const disabled = t4 === undefined ? false : t4;
|
|
23
|
+
const className = t5 === undefined ? null : t5;
|
|
24
|
+
const onChange = t6 === undefined ? null : t6;
|
|
25
|
+
const isTrue = queryValue !== null ? value === queryValue : value === true || value === "true" || value === 1 || value === "1";
|
|
26
|
+
let t7;
|
|
27
|
+
if ($[0] !== onChange || $[1] !== queryValue) {
|
|
28
|
+
t7 = val => {
|
|
29
|
+
if (queryValue !== null) {
|
|
30
|
+
if (val === true) {
|
|
31
|
+
onChange?.(queryValue);
|
|
32
|
+
} else {
|
|
33
|
+
onChange?.(null);
|
|
34
|
+
}
|
|
30
35
|
} else {
|
|
31
|
-
onChange
|
|
36
|
+
onChange?.(val);
|
|
32
37
|
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
};
|
|
39
|
+
$[0] = onChange;
|
|
40
|
+
$[1] = queryValue;
|
|
41
|
+
$[2] = t7;
|
|
42
|
+
} else {
|
|
43
|
+
t7 = $[2];
|
|
44
|
+
}
|
|
45
|
+
const finalOnChange = t7;
|
|
46
|
+
const t8 = className !== null;
|
|
47
|
+
let t9;
|
|
48
|
+
if ($[3] !== className || $[4] !== disabled || $[5] !== t8) {
|
|
49
|
+
t9 = classNames([styles.container, {
|
|
50
|
+
disabled,
|
|
51
|
+
[className]: t8
|
|
52
|
+
}]);
|
|
53
|
+
$[3] = className;
|
|
54
|
+
$[4] = disabled;
|
|
55
|
+
$[5] = t8;
|
|
56
|
+
$[6] = t9;
|
|
57
|
+
} else {
|
|
58
|
+
t9 = $[6];
|
|
59
|
+
}
|
|
60
|
+
const t10 = name || undefined;
|
|
61
|
+
let t11;
|
|
62
|
+
if ($[7] !== disabled || $[8] !== finalOnChange || $[9] !== isTrue || $[10] !== t10) {
|
|
63
|
+
t11 = /*#__PURE__*/jsx(Switch, {
|
|
64
|
+
name: t10,
|
|
43
65
|
checked: isTrue,
|
|
44
66
|
onChange: finalOnChange,
|
|
45
67
|
disabled: disabled
|
|
46
|
-
})
|
|
47
|
-
|
|
68
|
+
});
|
|
69
|
+
$[7] = disabled;
|
|
70
|
+
$[8] = finalOnChange;
|
|
71
|
+
$[9] = isTrue;
|
|
72
|
+
$[10] = t10;
|
|
73
|
+
$[11] = t11;
|
|
74
|
+
} else {
|
|
75
|
+
t11 = $[11];
|
|
76
|
+
}
|
|
77
|
+
let t12;
|
|
78
|
+
if ($[12] !== t11 || $[13] !== t9) {
|
|
79
|
+
t12 = /*#__PURE__*/jsx("div", {
|
|
80
|
+
className: t9,
|
|
81
|
+
children: t11
|
|
82
|
+
});
|
|
83
|
+
$[12] = t11;
|
|
84
|
+
$[13] = t9;
|
|
85
|
+
$[14] = t12;
|
|
86
|
+
} else {
|
|
87
|
+
t12 = $[14];
|
|
88
|
+
}
|
|
89
|
+
return t12;
|
|
48
90
|
}
|
|
49
91
|
|
|
50
92
|
var definition = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/field-toggle",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.40-alpha.1",
|
|
4
4
|
"description": "A toggle field",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -64,13 +64,13 @@
|
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@babel/runtime": "^7.28.6",
|
|
67
|
-
"@panneau/core": "^4.0.
|
|
68
|
-
"@panneau/themes": "^4.0.
|
|
67
|
+
"@panneau/core": "^4.0.40-alpha.1",
|
|
68
|
+
"@panneau/themes": "^4.0.40-alpha.1",
|
|
69
69
|
"classnames": "^2.5.1",
|
|
70
70
|
"rc-switch": "^4.1.0"
|
|
71
71
|
},
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "66520f92373b3aa371222b354d60ed3cf3d20c96"
|
|
76
76
|
}
|