@dhis2-ui/switch 10.16.3-alpha.1 → 10.16.4
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/build/cjs/switch/switch-icons.js +3 -4
- package/build/cjs/switch/switch.js +3 -4
- package/build/cjs/switch/switch.prod.stories.js +4 -11
- package/build/cjs/switch-field/switch-field.js +59 -65
- package/build/cjs/switch-field/switch-field.prod.stories.js +5 -8
- package/build/es/switch/switch-icons.js +3 -4
- package/build/es/switch/switch.js +2 -2
- package/build/es/switch/switch.prod.stories.js +3 -9
- package/build/es/switch-field/switch-field.js +59 -65
- package/build/es/switch-field/switch-field.prod.stories.js +5 -8
- package/package.json +4 -4
|
@@ -11,11 +11,10 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
const styles = ["svg.jsx-4217794981{display:block;pointer-events:none;height:18px;width:35px;}", "svg.jsx-4217794981:dir(rtl){-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1);}", "svg[dir='rtl'].jsx-4217794981{-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1);}", "svg.dense.jsx-4217794981{height:14px;width:27px;}", `svg.jsx-4217794981 .background.jsx-4217794981,svg.jsx-4217794981 .border.jsx-4217794981{fill:${_uiConstants.colors.grey600};}`, `svg.jsx-4217794981 .checkmark.jsx-4217794981,svg.jsx-4217794981 .cross.jsx-4217794981,svg.jsx-4217794981 .handle.jsx-4217794981{fill:${_uiConstants.colors.white};}`, "svg.jsx-4217794981 .checkmark.jsx-4217794981:dir(rtl){display:none;}", "svg[dir='rtl'].jsx-4217794981 .checkmark.jsx-4217794981{display:none;}", "svg.checked.jsx-4217794981 .handle-unchecked.jsx-4217794981,svg.jsx-4217794981:not(.checked) .handle-checked.jsx-4217794981{fill:none;}", `svg.checked.jsx-4217794981 .background.jsx-4217794981{fill:${_uiConstants.colors.teal400};}`, `svg.valid.jsx-4217794981 .background.jsx-4217794981{fill:${_uiConstants.colors.blue600};}`, `svg.warning.jsx-4217794981 .background.jsx-4217794981{fill:${_uiConstants.colors.yellow700};}`, `svg.error.jsx-4217794981 .background.jsx-4217794981{fill:${_uiConstants.colors.red500};}`, `svg.checked.jsx-4217794981 .border.jsx-4217794981{fill:${_uiConstants.colors.teal700};}`, `svg.disabled.jsx-4217794981 .background.jsx-4217794981{fill:${_uiConstants.colors.grey300};}`, `svg.disabled.jsx-4217794981 .border.jsx-4217794981{fill:${_uiConstants.colors.grey400};}`, `svg.valid.jsx-4217794981 .border.jsx-4217794981{fill:${_uiConstants.colors.blue600};}`, `svg.valid.checked.jsx-4217794981 .border.jsx-4217794981,svg.valid.indeterminate.jsx-4217794981 .border.jsx-4217794981{fill:${_uiConstants.colors.blue700};}`, `svg.warning.jsx-4217794981 .border.jsx-4217794981{fill:${_uiConstants.colors.yellow700};}`, `svg.warning.checked.jsx-4217794981 .border.jsx-4217794981{fill:${_uiConstants.colors.yellow800};}`, `svg.error.jsx-4217794981 .border.jsx-4217794981{fill:${_uiConstants.colors.red500};}`, `svg.error.checked.jsx-4217794981 .border.jsx-4217794981{fill:${_uiConstants.colors.red700};}`];
|
|
13
13
|
styles.__hash = "4217794981";
|
|
14
|
-
function SwitchRegular(
|
|
14
|
+
function SwitchRegular({
|
|
15
|
+
className
|
|
16
|
+
}) {
|
|
15
17
|
var _document$documentEle, _document$documentEle2;
|
|
16
|
-
let {
|
|
17
|
-
className
|
|
18
|
-
} = _ref;
|
|
19
18
|
return /*#__PURE__*/_react.default.createElement("svg", {
|
|
20
19
|
viewBox: "0 0 42 22",
|
|
21
20
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -10,15 +10,14 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _switchIcons = require("./switch-icons.js");
|
|
13
|
-
function
|
|
14
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
15
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
17
16
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
18
17
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
19
18
|
class Switch extends _react.Component {
|
|
20
|
-
constructor() {
|
|
21
|
-
super(...
|
|
19
|
+
constructor(...args) {
|
|
20
|
+
super(...args);
|
|
22
21
|
_defineProperty(this, "ref", /*#__PURE__*/(0, _react.createRef)());
|
|
23
22
|
_defineProperty(this, "handleChange", e => {
|
|
24
23
|
if (this.props.onChange) {
|
|
@@ -7,8 +7,7 @@ exports.default = exports.WarningDense = exports.Warning = exports.ValidDense =
|
|
|
7
7
|
var _uiConstants = require("@dhis2/ui-constants");
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _index = require("./index.js");
|
|
10
|
-
function
|
|
11
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
11
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
13
12
|
const subtitle = 'An input control that allows an on and an off state';
|
|
14
13
|
const description = `
|
|
@@ -32,15 +31,9 @@ window.onBlur = (payload, event) => {
|
|
|
32
31
|
console.log('onBlur payload', payload);
|
|
33
32
|
console.log('onBlur event', event);
|
|
34
33
|
};
|
|
35
|
-
const onChange =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const onFocus = function () {
|
|
39
|
-
return window.onFocus(...arguments);
|
|
40
|
-
};
|
|
41
|
-
const onBlur = function () {
|
|
42
|
-
return window.onBlur(...arguments);
|
|
43
|
-
};
|
|
34
|
+
const onChange = (...args) => window.onChange(...args);
|
|
35
|
+
const onFocus = (...args) => window.onFocus(...args);
|
|
36
|
+
const onBlur = (...args) => window.onBlur(...args);
|
|
44
37
|
var _default = exports.default = {
|
|
45
38
|
title: 'Switch',
|
|
46
39
|
component: _index.Switch,
|
|
@@ -11,77 +11,71 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
12
|
var _index = require("../switch/index.js");
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
const AddRequired =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
dataTest: `${dataTest}-required`
|
|
22
|
-
}));
|
|
23
|
-
};
|
|
14
|
+
const AddRequired = ({
|
|
15
|
+
label,
|
|
16
|
+
required,
|
|
17
|
+
dataTest
|
|
18
|
+
}) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, label, required && /*#__PURE__*/_react.default.createElement(_required.Required, {
|
|
19
|
+
dataTest: `${dataTest}-required`
|
|
20
|
+
}));
|
|
24
21
|
AddRequired.propTypes = {
|
|
25
22
|
dataTest: _propTypes.default.string,
|
|
26
23
|
label: _propTypes.default.node,
|
|
27
24
|
required: _propTypes.default.bool
|
|
28
25
|
};
|
|
29
|
-
const SwitchField =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
26
|
+
const SwitchField = ({
|
|
27
|
+
value,
|
|
28
|
+
label,
|
|
29
|
+
name,
|
|
30
|
+
className,
|
|
31
|
+
tabIndex,
|
|
32
|
+
onChange,
|
|
33
|
+
onFocus,
|
|
34
|
+
onKeyDown,
|
|
35
|
+
onBlur,
|
|
36
|
+
checked,
|
|
37
|
+
disabled,
|
|
38
|
+
valid,
|
|
39
|
+
warning,
|
|
40
|
+
error,
|
|
41
|
+
dense,
|
|
42
|
+
initialFocus,
|
|
43
|
+
required,
|
|
44
|
+
helpText,
|
|
45
|
+
validationText,
|
|
46
|
+
dataTest = 'dhis2-uiwidgets-switchfield'
|
|
47
|
+
}) => /*#__PURE__*/_react.default.createElement(_field.Field, {
|
|
48
|
+
className: className,
|
|
49
|
+
dataTest: dataTest,
|
|
50
|
+
helpText: helpText,
|
|
51
|
+
validationText: validationText,
|
|
52
|
+
error: error,
|
|
53
|
+
warning: warning,
|
|
54
|
+
valid: valid,
|
|
55
|
+
required: required,
|
|
56
|
+
name: name,
|
|
57
|
+
disabled: disabled
|
|
58
|
+
}, /*#__PURE__*/_react.default.createElement(_index.Switch, {
|
|
59
|
+
value: value,
|
|
60
|
+
label: /*#__PURE__*/_react.default.createElement(AddRequired, {
|
|
61
|
+
label: label,
|
|
60
62
|
required: required,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
disabled: disabled,
|
|
78
|
-
valid: valid,
|
|
79
|
-
warning: warning,
|
|
80
|
-
error: error,
|
|
81
|
-
dense: dense,
|
|
82
|
-
initialFocus: initialFocus
|
|
83
|
-
}));
|
|
84
|
-
};
|
|
63
|
+
dataTest: dataTest
|
|
64
|
+
}),
|
|
65
|
+
name: name,
|
|
66
|
+
tabIndex: tabIndex,
|
|
67
|
+
onChange: onChange,
|
|
68
|
+
onFocus: onFocus,
|
|
69
|
+
onKeyDown: onKeyDown,
|
|
70
|
+
onBlur: onBlur,
|
|
71
|
+
checked: checked,
|
|
72
|
+
disabled: disabled,
|
|
73
|
+
valid: valid,
|
|
74
|
+
warning: warning,
|
|
75
|
+
error: error,
|
|
76
|
+
dense: dense,
|
|
77
|
+
initialFocus: initialFocus
|
|
78
|
+
}));
|
|
85
79
|
exports.SwitchField = SwitchField;
|
|
86
80
|
SwitchField.propTypes = {
|
|
87
81
|
checked: _propTypes.default.bool,
|
|
@@ -18,14 +18,11 @@ See the basic Switch for usage and design system guidelines.
|
|
|
18
18
|
import { SwitchField } from '@dhis2/ui'
|
|
19
19
|
\`\`\`
|
|
20
20
|
`;
|
|
21
|
-
const logger =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} = _ref;
|
|
27
|
-
return console.log(`name: ${name}, value: ${value}, checked: ${checked}`);
|
|
28
|
-
};
|
|
21
|
+
const logger = ({
|
|
22
|
+
name,
|
|
23
|
+
value,
|
|
24
|
+
checked
|
|
25
|
+
}) => console.log(`name: ${name}, value: ${value}, checked: ${checked}`);
|
|
29
26
|
var _default = exports.default = {
|
|
30
27
|
title: 'Switch Field',
|
|
31
28
|
component: _index.SwitchField,
|
|
@@ -4,11 +4,10 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
const styles = ["svg.jsx-4217794981{display:block;pointer-events:none;height:18px;width:35px;}", "svg.jsx-4217794981:dir(rtl){-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1);}", "svg[dir='rtl'].jsx-4217794981{-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1);}", "svg.dense.jsx-4217794981{height:14px;width:27px;}", `svg.jsx-4217794981 .background.jsx-4217794981,svg.jsx-4217794981 .border.jsx-4217794981{fill:${colors.grey600};}`, `svg.jsx-4217794981 .checkmark.jsx-4217794981,svg.jsx-4217794981 .cross.jsx-4217794981,svg.jsx-4217794981 .handle.jsx-4217794981{fill:${colors.white};}`, "svg.jsx-4217794981 .checkmark.jsx-4217794981:dir(rtl){display:none;}", "svg[dir='rtl'].jsx-4217794981 .checkmark.jsx-4217794981{display:none;}", "svg.checked.jsx-4217794981 .handle-unchecked.jsx-4217794981,svg.jsx-4217794981:not(.checked) .handle-checked.jsx-4217794981{fill:none;}", `svg.checked.jsx-4217794981 .background.jsx-4217794981{fill:${colors.teal400};}`, `svg.valid.jsx-4217794981 .background.jsx-4217794981{fill:${colors.blue600};}`, `svg.warning.jsx-4217794981 .background.jsx-4217794981{fill:${colors.yellow700};}`, `svg.error.jsx-4217794981 .background.jsx-4217794981{fill:${colors.red500};}`, `svg.checked.jsx-4217794981 .border.jsx-4217794981{fill:${colors.teal700};}`, `svg.disabled.jsx-4217794981 .background.jsx-4217794981{fill:${colors.grey300};}`, `svg.disabled.jsx-4217794981 .border.jsx-4217794981{fill:${colors.grey400};}`, `svg.valid.jsx-4217794981 .border.jsx-4217794981{fill:${colors.blue600};}`, `svg.valid.checked.jsx-4217794981 .border.jsx-4217794981,svg.valid.indeterminate.jsx-4217794981 .border.jsx-4217794981{fill:${colors.blue700};}`, `svg.warning.jsx-4217794981 .border.jsx-4217794981{fill:${colors.yellow700};}`, `svg.warning.checked.jsx-4217794981 .border.jsx-4217794981{fill:${colors.yellow800};}`, `svg.error.jsx-4217794981 .border.jsx-4217794981{fill:${colors.red500};}`, `svg.error.checked.jsx-4217794981 .border.jsx-4217794981{fill:${colors.red700};}`];
|
|
6
6
|
styles.__hash = "4217794981";
|
|
7
|
-
export function SwitchRegular(
|
|
7
|
+
export function SwitchRegular({
|
|
8
|
+
className
|
|
9
|
+
}) {
|
|
8
10
|
var _document$documentEle, _document$documentEle2;
|
|
9
|
-
let {
|
|
10
|
-
className
|
|
11
|
-
} = _ref;
|
|
12
11
|
return /*#__PURE__*/React.createElement("svg", {
|
|
13
12
|
viewBox: "0 0 42 22",
|
|
14
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -8,8 +8,8 @@ import PropTypes from 'prop-types';
|
|
|
8
8
|
import React, { Component, createRef } from 'react';
|
|
9
9
|
import { SwitchRegular } from './switch-icons.js';
|
|
10
10
|
class Switch extends Component {
|
|
11
|
-
constructor() {
|
|
12
|
-
super(...
|
|
11
|
+
constructor(...args) {
|
|
12
|
+
super(...args);
|
|
13
13
|
_defineProperty(this, "ref", /*#__PURE__*/createRef());
|
|
14
14
|
_defineProperty(this, "handleChange", e => {
|
|
15
15
|
if (this.props.onChange) {
|
|
@@ -24,15 +24,9 @@ window.onBlur = (payload, event) => {
|
|
|
24
24
|
console.log('onBlur payload', payload);
|
|
25
25
|
console.log('onBlur event', event);
|
|
26
26
|
};
|
|
27
|
-
const onChange =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const onFocus = function () {
|
|
31
|
-
return window.onFocus(...arguments);
|
|
32
|
-
};
|
|
33
|
-
const onBlur = function () {
|
|
34
|
-
return window.onBlur(...arguments);
|
|
35
|
-
};
|
|
27
|
+
const onChange = (...args) => window.onChange(...args);
|
|
28
|
+
const onFocus = (...args) => window.onFocus(...args);
|
|
29
|
+
const onBlur = (...args) => window.onBlur(...args);
|
|
36
30
|
export default {
|
|
37
31
|
title: 'Switch',
|
|
38
32
|
component: Switch,
|
|
@@ -4,77 +4,71 @@ import { Required } from '@dhis2-ui/required';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { Switch } from '../switch/index.js';
|
|
7
|
-
const AddRequired =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
dataTest: `${dataTest}-required`
|
|
15
|
-
}));
|
|
16
|
-
};
|
|
7
|
+
const AddRequired = ({
|
|
8
|
+
label,
|
|
9
|
+
required,
|
|
10
|
+
dataTest
|
|
11
|
+
}) => /*#__PURE__*/React.createElement(React.Fragment, null, label, required && /*#__PURE__*/React.createElement(Required, {
|
|
12
|
+
dataTest: `${dataTest}-required`
|
|
13
|
+
}));
|
|
17
14
|
AddRequired.propTypes = {
|
|
18
15
|
dataTest: PropTypes.string,
|
|
19
16
|
label: PropTypes.node,
|
|
20
17
|
required: PropTypes.bool
|
|
21
18
|
};
|
|
22
|
-
const SwitchField =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
19
|
+
const SwitchField = ({
|
|
20
|
+
value,
|
|
21
|
+
label,
|
|
22
|
+
name,
|
|
23
|
+
className,
|
|
24
|
+
tabIndex,
|
|
25
|
+
onChange,
|
|
26
|
+
onFocus,
|
|
27
|
+
onKeyDown,
|
|
28
|
+
onBlur,
|
|
29
|
+
checked,
|
|
30
|
+
disabled,
|
|
31
|
+
valid,
|
|
32
|
+
warning,
|
|
33
|
+
error,
|
|
34
|
+
dense,
|
|
35
|
+
initialFocus,
|
|
36
|
+
required,
|
|
37
|
+
helpText,
|
|
38
|
+
validationText,
|
|
39
|
+
dataTest = 'dhis2-uiwidgets-switchfield'
|
|
40
|
+
}) => /*#__PURE__*/React.createElement(Field, {
|
|
41
|
+
className: className,
|
|
42
|
+
dataTest: dataTest,
|
|
43
|
+
helpText: helpText,
|
|
44
|
+
validationText: validationText,
|
|
45
|
+
error: error,
|
|
46
|
+
warning: warning,
|
|
47
|
+
valid: valid,
|
|
48
|
+
required: required,
|
|
49
|
+
name: name,
|
|
50
|
+
disabled: disabled
|
|
51
|
+
}, /*#__PURE__*/React.createElement(Switch, {
|
|
52
|
+
value: value,
|
|
53
|
+
label: /*#__PURE__*/React.createElement(AddRequired, {
|
|
54
|
+
label: label,
|
|
53
55
|
required: required,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
disabled: disabled,
|
|
71
|
-
valid: valid,
|
|
72
|
-
warning: warning,
|
|
73
|
-
error: error,
|
|
74
|
-
dense: dense,
|
|
75
|
-
initialFocus: initialFocus
|
|
76
|
-
}));
|
|
77
|
-
};
|
|
56
|
+
dataTest: dataTest
|
|
57
|
+
}),
|
|
58
|
+
name: name,
|
|
59
|
+
tabIndex: tabIndex,
|
|
60
|
+
onChange: onChange,
|
|
61
|
+
onFocus: onFocus,
|
|
62
|
+
onKeyDown: onKeyDown,
|
|
63
|
+
onBlur: onBlur,
|
|
64
|
+
checked: checked,
|
|
65
|
+
disabled: disabled,
|
|
66
|
+
valid: valid,
|
|
67
|
+
warning: warning,
|
|
68
|
+
error: error,
|
|
69
|
+
dense: dense,
|
|
70
|
+
initialFocus: initialFocus
|
|
71
|
+
}));
|
|
78
72
|
SwitchField.propTypes = {
|
|
79
73
|
checked: PropTypes.bool,
|
|
80
74
|
className: PropTypes.string,
|
|
@@ -11,14 +11,11 @@ See the basic Switch for usage and design system guidelines.
|
|
|
11
11
|
import { SwitchField } from '@dhis2/ui'
|
|
12
12
|
\`\`\`
|
|
13
13
|
`;
|
|
14
|
-
const logger =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} = _ref;
|
|
20
|
-
return console.log(`name: ${name}, value: ${value}, checked: ${checked}`);
|
|
21
|
-
};
|
|
14
|
+
const logger = ({
|
|
15
|
+
name,
|
|
16
|
+
value,
|
|
17
|
+
checked
|
|
18
|
+
}) => console.log(`name: ${name}, value: ${value}, checked: ${checked}`);
|
|
22
19
|
export default {
|
|
23
20
|
title: 'Switch Field',
|
|
24
21
|
component: SwitchField,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2-ui/switch",
|
|
3
|
-
"version": "10.16.
|
|
3
|
+
"version": "10.16.4",
|
|
4
4
|
"description": "UI Switch",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@dhis2/prop-types": "^3.1.2",
|
|
36
|
-
"@dhis2-ui/field": "10.16.
|
|
37
|
-
"@dhis2-ui/required": "10.16.
|
|
38
|
-
"@dhis2/ui-constants": "10.16.
|
|
36
|
+
"@dhis2-ui/field": "10.16.4",
|
|
37
|
+
"@dhis2-ui/required": "10.16.4",
|
|
38
|
+
"@dhis2/ui-constants": "10.16.4",
|
|
39
39
|
"classnames": "^2.3.1",
|
|
40
40
|
"prop-types": "^15.7.2"
|
|
41
41
|
},
|