@panneau/field-toggle 3.0.222 → 3.0.224
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/package.json +8 -5
- package/lib/index.js +0 -72
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/field-toggle",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.224",
|
|
4
4
|
"description": "A toggle field",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -33,8 +33,11 @@
|
|
|
33
33
|
}
|
|
34
34
|
],
|
|
35
35
|
"license": "ISC",
|
|
36
|
-
"
|
|
36
|
+
"type": "module",
|
|
37
37
|
"module": "es/index.js",
|
|
38
|
+
"exports": {
|
|
39
|
+
".": "./es/index.js"
|
|
40
|
+
},
|
|
38
41
|
"files": [
|
|
39
42
|
"lib",
|
|
40
43
|
"es",
|
|
@@ -54,8 +57,8 @@
|
|
|
54
57
|
},
|
|
55
58
|
"dependencies": {
|
|
56
59
|
"@babel/runtime": "^7.12.5",
|
|
57
|
-
"@panneau/core": "^3.0.
|
|
58
|
-
"@panneau/themes": "^3.0.
|
|
60
|
+
"@panneau/core": "^3.0.224",
|
|
61
|
+
"@panneau/themes": "^3.0.224",
|
|
59
62
|
"classnames": "^2.5.1",
|
|
60
63
|
"prop-types": "^15.7.2",
|
|
61
64
|
"rc-switch": "^4.1.0"
|
|
@@ -63,5 +66,5 @@
|
|
|
63
66
|
"publishConfig": {
|
|
64
67
|
"access": "public"
|
|
65
68
|
},
|
|
66
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "c95bd465867c4c7d112bf0ed66036574cc05c627"
|
|
67
70
|
}
|
package/lib/index.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
-
var classNames = require('classnames');
|
|
7
|
-
var PropTypes = require('prop-types');
|
|
8
|
-
var Switch = require('rc-switch');
|
|
9
|
-
var React = require('react');
|
|
10
|
-
require('rc-switch/assets/index.css');
|
|
11
|
-
|
|
12
|
-
var styles = {"container":"panneau-field-toggle-container"};
|
|
13
|
-
|
|
14
|
-
var propTypes = {
|
|
15
|
-
value: PropTypes.bool,
|
|
16
|
-
name: PropTypes.string,
|
|
17
|
-
queryValue: PropTypes.string,
|
|
18
|
-
disabled: PropTypes.bool,
|
|
19
|
-
className: PropTypes.string,
|
|
20
|
-
onChange: PropTypes.func
|
|
21
|
-
};
|
|
22
|
-
var defaultProps = {
|
|
23
|
-
value: null,
|
|
24
|
-
name: null,
|
|
25
|
-
queryValue: null,
|
|
26
|
-
disabled: false,
|
|
27
|
-
className: null,
|
|
28
|
-
onChange: null
|
|
29
|
-
};
|
|
30
|
-
var ToggleField = function ToggleField(_ref) {
|
|
31
|
-
var value = _ref.value,
|
|
32
|
-
queryValue = _ref.queryValue,
|
|
33
|
-
name = _ref.name,
|
|
34
|
-
disabled = _ref.disabled,
|
|
35
|
-
className = _ref.className,
|
|
36
|
-
onChange = _ref.onChange;
|
|
37
|
-
var isTrue = React.useMemo(function () {
|
|
38
|
-
return queryValue !== null ? value === queryValue : value === true || value === 'true' || value === 1 || value === '1';
|
|
39
|
-
}, [value, queryValue]);
|
|
40
|
-
var finalOnChange = React.useCallback(function (val) {
|
|
41
|
-
if (queryValue !== null) {
|
|
42
|
-
if (val === true) {
|
|
43
|
-
onChange(queryValue);
|
|
44
|
-
} else {
|
|
45
|
-
onChange(null);
|
|
46
|
-
}
|
|
47
|
-
} else {
|
|
48
|
-
onChange(val);
|
|
49
|
-
}
|
|
50
|
-
}, [onChange]);
|
|
51
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
52
|
-
className: classNames([styles.container, _defineProperty({
|
|
53
|
-
disabled: disabled
|
|
54
|
-
}, className, className !== null)])
|
|
55
|
-
}, /*#__PURE__*/React.createElement(Switch, {
|
|
56
|
-
name: name,
|
|
57
|
-
checked: isTrue,
|
|
58
|
-
onChange: finalOnChange,
|
|
59
|
-
disabled: disabled
|
|
60
|
-
}));
|
|
61
|
-
};
|
|
62
|
-
ToggleField.propTypes = propTypes;
|
|
63
|
-
ToggleField.defaultProps = defaultProps;
|
|
64
|
-
var ToggleField$1 = ToggleField;
|
|
65
|
-
|
|
66
|
-
var definition = {
|
|
67
|
-
id: 'toggle',
|
|
68
|
-
component: 'Toggle'
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
exports.default = ToggleField$1;
|
|
72
|
-
exports.definition = definition;
|