@dhis2-ui/checkbox 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.
@@ -12,10 +12,9 @@ var _react = _interopRequireDefault(require("react"));
12
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
13
  const commonStyles = ["svg.jsx-4069423049{display:block;pointer-events:none;}", `svg.jsx-4069423049 .border.jsx-4069423049{fill:${_uiConstants.colors.grey800};}`, `svg.jsx-4069423049 .background.jsx-4069423049,svg.jsx-4069423049 .indeterminate.jsx-4069423049,svg.jsx-4069423049 .checkmark.jsx-4069423049{fill:${_uiConstants.colors.white};}`, `svg.checked.jsx-4069423049 .background.jsx-4069423049,svg.indeterminate.jsx-4069423049 .background.jsx-4069423049{fill:${_uiConstants.colors.teal500};}`, `svg.valid.jsx-4069423049 .background.jsx-4069423049{fill:${_uiConstants.colors.blue600};}`, `svg.warning.jsx-4069423049 .background.jsx-4069423049{fill:${_uiConstants.colors.yellow700};}`, `svg.error.jsx-4069423049 .background.jsx-4069423049{fill:${_uiConstants.colors.red500};}`, `svg.checked.jsx-4069423049 .border.jsx-4069423049,svg.indeterminate.jsx-4069423049 .border.jsx-4069423049{fill:${_uiConstants.colors.teal900};}`, "svg.jsx-4069423049:not(.checked) .checkmark.jsx-4069423049,svg.jsx-4069423049:not(.indeterminate) .indeterminate.jsx-4069423049{fill:none;}", `svg.jsx-4069423049:not(.checked):not(.indeterminate) .background.jsx-4069423049{fill:${_uiConstants.colors.white};}`];
14
14
  commonStyles.__hash = "4069423049";
15
- function CheckboxRegular(_ref) {
16
- let {
17
- className
18
- } = _ref;
15
+ function CheckboxRegular({
16
+ className
17
+ }) {
19
18
  return /*#__PURE__*/_react.default.createElement("svg", {
20
19
  viewBox: "0 0 18 18",
21
20
  xmlns: "http://www.w3.org/2000/svg",
@@ -50,10 +49,9 @@ function CheckboxRegular(_ref) {
50
49
  CheckboxRegular.propTypes = {
51
50
  className: _propTypes.default.string
52
51
  };
53
- function CheckboxDense(_ref2) {
54
- let {
55
- className
56
- } = _ref2;
52
+ function CheckboxDense({
53
+ className
54
+ }) {
57
55
  return /*#__PURE__*/_react.default.createElement("svg", {
58
56
  viewBox: "0 0 14 14",
59
57
  xmlns: "http://www.w3.org/2000/svg",
@@ -11,15 +11,14 @@ var _classnames = _interopRequireDefault(require("classnames"));
11
11
  var _propTypes2 = _interopRequireDefault(require("prop-types"));
12
12
  var _react = _interopRequireWildcard(require("react"));
13
13
  var _checkboxIcon = require("./checkbox-icon.js");
14
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
- 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; }
14
+ 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); }
16
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
16
  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; }
18
17
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
19
18
  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); }
20
19
  class Checkbox extends _react.Component {
21
- constructor() {
22
- super(...arguments);
20
+ constructor(...args) {
21
+ super(...args);
23
22
  _defineProperty(this, "ref", /*#__PURE__*/(0, _react.createRef)());
24
23
  _defineProperty(this, "handleChange", e => {
25
24
  if (this.props.onChange) {
@@ -33,15 +33,9 @@ window.onBlur = (payload, event) => {
33
33
  console.log('onBlur payload', payload);
34
34
  console.log('onBlur event', event);
35
35
  };
36
- const onChange = function () {
37
- return window.onChange(...arguments);
38
- };
39
- const onFocus = function () {
40
- return window.onFocus(...arguments);
41
- };
42
- const onBlur = function () {
43
- return window.onBlur(...arguments);
44
- };
36
+ const onChange = (...args) => window.onChange(...args);
37
+ const onFocus = (...args) => window.onFocus(...args);
38
+ const onBlur = (...args) => window.onBlur(...args);
45
39
  const defaultArgs = {
46
40
  name: 'Ex',
47
41
  label: 'Checkbox',
@@ -11,75 +11,69 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
  var _react = _interopRequireDefault(require("react"));
12
12
  var _index = require("../checkbox/index.js");
13
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
- const AddRequired = _ref => {
15
- let {
16
- label,
17
- required,
18
- dataTest
19
- } = _ref;
20
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, label, required && /*#__PURE__*/_react.default.createElement(_required.Required, {
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 CheckboxField = _ref2 => {
30
- let {
31
- value,
32
- label,
33
- name,
34
- className,
35
- tabIndex,
36
- onChange,
37
- onFocus,
38
- onKeyDown,
39
- onBlur,
40
- checked,
41
- disabled,
42
- valid,
43
- warning,
44
- error,
45
- dense,
46
- initialFocus,
47
- required,
48
- helpText,
49
- validationText,
50
- dataTest = 'dhis2-uiwidgets-checkboxfield'
51
- } = _ref2;
52
- return /*#__PURE__*/_react.default.createElement(_field.Field, {
53
- className: className,
54
- dataTest: dataTest,
55
- helpText: helpText,
56
- validationText: validationText,
57
- error: error,
58
- warning: warning,
59
- valid: valid,
60
- disabled: disabled
61
- }, /*#__PURE__*/_react.default.createElement(_index.Checkbox, {
62
- value: value,
63
- label: /*#__PURE__*/_react.default.createElement(AddRequired, {
64
- label: label,
65
- required: required,
66
- dataTest: dataTest
67
- }),
68
- name: name,
69
- tabIndex: tabIndex,
70
- onChange: onChange,
71
- onFocus: onFocus,
72
- onKeyDown: onKeyDown,
73
- onBlur: onBlur,
74
- checked: checked,
75
- disabled: disabled,
76
- valid: valid,
77
- warning: warning,
78
- error: error,
79
- dense: dense,
80
- initialFocus: initialFocus
81
- }));
82
- };
26
+ const CheckboxField = ({
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-checkboxfield'
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
+ disabled: disabled
56
+ }, /*#__PURE__*/_react.default.createElement(_index.Checkbox, {
57
+ value: value,
58
+ label: /*#__PURE__*/_react.default.createElement(AddRequired, {
59
+ label: label,
60
+ required: required,
61
+ dataTest: dataTest
62
+ }),
63
+ name: name,
64
+ tabIndex: tabIndex,
65
+ onChange: onChange,
66
+ onFocus: onFocus,
67
+ onKeyDown: onKeyDown,
68
+ onBlur: onBlur,
69
+ checked: checked,
70
+ disabled: disabled,
71
+ valid: valid,
72
+ warning: warning,
73
+ error: error,
74
+ dense: dense,
75
+ initialFocus: initialFocus
76
+ }));
83
77
  exports.CheckboxField = CheckboxField;
84
78
  CheckboxField.propTypes = {
85
79
  checked: _propTypes.default.bool,
@@ -18,14 +18,11 @@ See the basic Checkbox for usage and design system guidelines.
18
18
  import { CheckboxField } from '@dhis2/ui'
19
19
  \`\`\`
20
20
  `;
21
- const logger = _ref => {
22
- let {
23
- name,
24
- value,
25
- checked
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: 'Checkbox Field',
31
28
  component: _index.CheckboxField,
@@ -4,10 +4,9 @@ import PropTypes from 'prop-types';
4
4
  import React from 'react';
5
5
  const commonStyles = ["svg.jsx-4069423049{display:block;pointer-events:none;}", `svg.jsx-4069423049 .border.jsx-4069423049{fill:${colors.grey800};}`, `svg.jsx-4069423049 .background.jsx-4069423049,svg.jsx-4069423049 .indeterminate.jsx-4069423049,svg.jsx-4069423049 .checkmark.jsx-4069423049{fill:${colors.white};}`, `svg.checked.jsx-4069423049 .background.jsx-4069423049,svg.indeterminate.jsx-4069423049 .background.jsx-4069423049{fill:${colors.teal500};}`, `svg.valid.jsx-4069423049 .background.jsx-4069423049{fill:${colors.blue600};}`, `svg.warning.jsx-4069423049 .background.jsx-4069423049{fill:${colors.yellow700};}`, `svg.error.jsx-4069423049 .background.jsx-4069423049{fill:${colors.red500};}`, `svg.checked.jsx-4069423049 .border.jsx-4069423049,svg.indeterminate.jsx-4069423049 .border.jsx-4069423049{fill:${colors.teal900};}`, "svg.jsx-4069423049:not(.checked) .checkmark.jsx-4069423049,svg.jsx-4069423049:not(.indeterminate) .indeterminate.jsx-4069423049{fill:none;}", `svg.jsx-4069423049:not(.checked):not(.indeterminate) .background.jsx-4069423049{fill:${colors.white};}`];
6
6
  commonStyles.__hash = "4069423049";
7
- export function CheckboxRegular(_ref) {
8
- let {
9
- className
10
- } = _ref;
7
+ export function CheckboxRegular({
8
+ className
9
+ }) {
11
10
  return /*#__PURE__*/React.createElement("svg", {
12
11
  viewBox: "0 0 18 18",
13
12
  xmlns: "http://www.w3.org/2000/svg",
@@ -42,10 +41,9 @@ export function CheckboxRegular(_ref) {
42
41
  CheckboxRegular.propTypes = {
43
42
  className: PropTypes.string
44
43
  };
45
- export function CheckboxDense(_ref2) {
46
- let {
47
- className
48
- } = _ref2;
44
+ export function CheckboxDense({
45
+ className
46
+ }) {
49
47
  return /*#__PURE__*/React.createElement("svg", {
50
48
  viewBox: "0 0 14 14",
51
49
  xmlns: "http://www.w3.org/2000/svg",
@@ -9,8 +9,8 @@ import PropTypes from 'prop-types';
9
9
  import React, { Component, createRef } from 'react';
10
10
  import { CheckboxRegular, CheckboxDense } from './checkbox-icon.js';
11
11
  class Checkbox extends Component {
12
- constructor() {
13
- super(...arguments);
12
+ constructor(...args) {
13
+ super(...args);
14
14
  _defineProperty(this, "ref", /*#__PURE__*/createRef());
15
15
  _defineProperty(this, "handleChange", e => {
16
16
  if (this.props.onChange) {
@@ -26,15 +26,9 @@ window.onBlur = (payload, event) => {
26
26
  console.log('onBlur payload', payload);
27
27
  console.log('onBlur event', event);
28
28
  };
29
- const onChange = function () {
30
- return window.onChange(...arguments);
31
- };
32
- const onFocus = function () {
33
- return window.onFocus(...arguments);
34
- };
35
- const onBlur = function () {
36
- return window.onBlur(...arguments);
37
- };
29
+ const onChange = (...args) => window.onChange(...args);
30
+ const onFocus = (...args) => window.onFocus(...args);
31
+ const onBlur = (...args) => window.onBlur(...args);
38
32
  const defaultArgs = {
39
33
  name: 'Ex',
40
34
  label: 'Checkbox',
@@ -4,75 +4,69 @@ import { Required } from '@dhis2-ui/required';
4
4
  import PropTypes from 'prop-types';
5
5
  import React from 'react';
6
6
  import { Checkbox } from '../checkbox/index.js';
7
- const AddRequired = _ref => {
8
- let {
9
- label,
10
- required,
11
- dataTest
12
- } = _ref;
13
- return /*#__PURE__*/React.createElement(React.Fragment, null, label, required && /*#__PURE__*/React.createElement(Required, {
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 CheckboxField = _ref2 => {
23
- let {
24
- value,
25
- label,
26
- name,
27
- className,
28
- tabIndex,
29
- onChange,
30
- onFocus,
31
- onKeyDown,
32
- onBlur,
33
- checked,
34
- disabled,
35
- valid,
36
- warning,
37
- error,
38
- dense,
39
- initialFocus,
40
- required,
41
- helpText,
42
- validationText,
43
- dataTest = 'dhis2-uiwidgets-checkboxfield'
44
- } = _ref2;
45
- return /*#__PURE__*/React.createElement(Field, {
46
- className: className,
47
- dataTest: dataTest,
48
- helpText: helpText,
49
- validationText: validationText,
50
- error: error,
51
- warning: warning,
52
- valid: valid,
53
- disabled: disabled
54
- }, /*#__PURE__*/React.createElement(Checkbox, {
55
- value: value,
56
- label: /*#__PURE__*/React.createElement(AddRequired, {
57
- label: label,
58
- required: required,
59
- dataTest: dataTest
60
- }),
61
- name: name,
62
- tabIndex: tabIndex,
63
- onChange: onChange,
64
- onFocus: onFocus,
65
- onKeyDown: onKeyDown,
66
- onBlur: onBlur,
67
- checked: checked,
68
- disabled: disabled,
69
- valid: valid,
70
- warning: warning,
71
- error: error,
72
- dense: dense,
73
- initialFocus: initialFocus
74
- }));
75
- };
19
+ const CheckboxField = ({
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-checkboxfield'
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
+ disabled: disabled
49
+ }, /*#__PURE__*/React.createElement(Checkbox, {
50
+ value: value,
51
+ label: /*#__PURE__*/React.createElement(AddRequired, {
52
+ label: label,
53
+ required: required,
54
+ dataTest: dataTest
55
+ }),
56
+ name: name,
57
+ tabIndex: tabIndex,
58
+ onChange: onChange,
59
+ onFocus: onFocus,
60
+ onKeyDown: onKeyDown,
61
+ onBlur: onBlur,
62
+ checked: checked,
63
+ disabled: disabled,
64
+ valid: valid,
65
+ warning: warning,
66
+ error: error,
67
+ dense: dense,
68
+ initialFocus: initialFocus
69
+ }));
76
70
  CheckboxField.propTypes = {
77
71
  checked: PropTypes.bool,
78
72
  className: PropTypes.string,
@@ -11,14 +11,11 @@ See the basic Checkbox for usage and design system guidelines.
11
11
  import { CheckboxField } from '@dhis2/ui'
12
12
  \`\`\`
13
13
  `;
14
- const logger = _ref => {
15
- let {
16
- name,
17
- value,
18
- checked
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: 'Checkbox Field',
24
21
  component: CheckboxField,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2-ui/checkbox",
3
- "version": "10.16.3-alpha.1",
3
+ "version": "10.16.4",
4
4
  "description": "UI Checkbox",
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.3-alpha.1",
37
- "@dhis2-ui/required": "10.16.3-alpha.1",
38
- "@dhis2/ui-constants": "10.16.3-alpha.1",
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
  },