@micromag/element-checkbox 0.4.71 → 0.4.74

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.
Files changed (2) hide show
  1. package/es/index.js +121 -39
  2. package/package.json +9 -7
package/es/index.js CHANGED
@@ -1,47 +1,129 @@
1
- import _objectSpread from '@babel/runtime/helpers/objectSpread2';
1
+ import { c } from 'react/compiler-runtime';
2
2
  import classNames from 'classnames';
3
3
  import { jsx, jsxs } from 'react/jsx-runtime';
4
4
 
5
5
  var styles = {"container":"micromag-element-checkbox-container","label":"micromag-element-checkbox-label","input":"micromag-element-checkbox-input"};
6
6
 
7
- function Checkbox(_ref) {
8
- var _ref$option = _ref.option,
9
- option = _ref$option === void 0 ? null : _ref$option,
10
- _ref$value = _ref.value,
11
- value = _ref$value === void 0 ? null : _ref$value,
12
- _ref$onChange = _ref.onChange,
13
- _onChange = _ref$onChange === void 0 ? null : _ref$onChange,
14
- _ref$focusable = _ref.focusable,
15
- focusable = _ref$focusable === void 0 ? true : _ref$focusable,
16
- _ref$checkboxStyle = _ref.checkboxStyle,
17
- checkboxStyle = _ref$checkboxStyle === void 0 ? null : _ref$checkboxStyle,
18
- _ref$className = _ref.className,
19
- className = _ref$className === void 0 ? null : _ref$className;
20
- var _ref2 = option || {},
21
- _ref2$body = _ref2.body,
22
- body = _ref2$body === void 0 ? null : _ref2$body;
23
- return /*#__PURE__*/jsx("div", {
24
- className: classNames([styles.container, className]),
25
- style: _objectSpread({}, checkboxStyle),
26
- children: /*#__PURE__*/jsxs("label", {
27
- className: classNames([styles.label, {
28
- active: body === value
29
- }]),
30
- children: [/*#__PURE__*/jsx("input", {
31
- className: styles.input,
32
- type: "checkbox",
33
- autoComplete: "off",
34
- value: value === true,
35
- checked: value === true,
36
- tabIndex: focusable ? '0' : '-1',
37
- onChange: function onChange() {
38
- if (_onChange !== null) {
39
- _onChange(!value);
40
- }
41
- }
42
- }), body]
43
- })
44
- });
7
+ function Checkbox(t0) {
8
+ const $ = c(24);
9
+ const {
10
+ option: t1,
11
+ value: t2,
12
+ onChange: t3,
13
+ focusable: t4,
14
+ checkboxStyle: t5,
15
+ className: t6
16
+ } = t0;
17
+ const option = t1 === undefined ? null : t1;
18
+ const value = t2 === undefined ? null : t2;
19
+ const onChange = t3 === undefined ? null : t3;
20
+ const focusable = t4 === undefined ? true : t4;
21
+ const checkboxStyle = t5 === undefined ? null : t5;
22
+ const className = t6 === undefined ? null : t6;
23
+ let t7;
24
+ if ($[0] !== option) {
25
+ t7 = option || {};
26
+ $[0] = option;
27
+ $[1] = t7;
28
+ } else {
29
+ t7 = $[1];
30
+ }
31
+ const {
32
+ body: t8
33
+ } = t7;
34
+ const body = t8 === undefined ? null : t8;
35
+ let t9;
36
+ if ($[2] !== className) {
37
+ t9 = classNames([styles.container, className]);
38
+ $[2] = className;
39
+ $[3] = t9;
40
+ } else {
41
+ t9 = $[3];
42
+ }
43
+ let t10;
44
+ if ($[4] !== checkboxStyle) {
45
+ t10 = {
46
+ ...checkboxStyle
47
+ };
48
+ $[4] = checkboxStyle;
49
+ $[5] = t10;
50
+ } else {
51
+ t10 = $[5];
52
+ }
53
+ const t11 = body === value;
54
+ let t12;
55
+ if ($[6] !== t11) {
56
+ t12 = classNames([styles.label, {
57
+ active: t11
58
+ }]);
59
+ $[6] = t11;
60
+ $[7] = t12;
61
+ } else {
62
+ t12 = $[7];
63
+ }
64
+ const t13 = value === true;
65
+ const t14 = value === true;
66
+ const t15 = focusable ? "0" : "-1";
67
+ let t16;
68
+ if ($[8] !== onChange || $[9] !== value) {
69
+ t16 = () => {
70
+ if (onChange !== null) {
71
+ onChange(!value);
72
+ }
73
+ };
74
+ $[8] = onChange;
75
+ $[9] = value;
76
+ $[10] = t16;
77
+ } else {
78
+ t16 = $[10];
79
+ }
80
+ let t17;
81
+ if ($[11] !== t13 || $[12] !== t14 || $[13] !== t15 || $[14] !== t16) {
82
+ t17 = /*#__PURE__*/jsx("input", {
83
+ className: styles.input,
84
+ type: "checkbox",
85
+ autoComplete: "off",
86
+ value: t13,
87
+ checked: t14,
88
+ tabIndex: t15,
89
+ onChange: t16
90
+ });
91
+ $[11] = t13;
92
+ $[12] = t14;
93
+ $[13] = t15;
94
+ $[14] = t16;
95
+ $[15] = t17;
96
+ } else {
97
+ t17 = $[15];
98
+ }
99
+ let t18;
100
+ if ($[16] !== body || $[17] !== t12 || $[18] !== t17) {
101
+ t18 = /*#__PURE__*/jsxs("label", {
102
+ className: t12,
103
+ children: [t17, body]
104
+ });
105
+ $[16] = body;
106
+ $[17] = t12;
107
+ $[18] = t17;
108
+ $[19] = t18;
109
+ } else {
110
+ t18 = $[19];
111
+ }
112
+ let t19;
113
+ if ($[20] !== t10 || $[21] !== t18 || $[22] !== t9) {
114
+ t19 = /*#__PURE__*/jsx("div", {
115
+ className: t9,
116
+ style: t10,
117
+ children: t18
118
+ });
119
+ $[20] = t10;
120
+ $[21] = t18;
121
+ $[22] = t9;
122
+ $[23] = t19;
123
+ } else {
124
+ t19 = $[23];
125
+ }
126
+ return t19;
45
127
  }
46
128
 
47
129
  export { Checkbox as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/element-checkbox",
3
- "version": "0.4.71",
3
+ "version": "0.4.74",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -32,9 +32,11 @@
32
32
  "license": "ISC",
33
33
  "type": "module",
34
34
  "module": "es/index.js",
35
+ "style": "./assets/css/styles.css",
35
36
  "exports": {
36
37
  ".": {
37
38
  "types": "./es/index.d.ts",
39
+ "style": "./assets/css/styles.css",
38
40
  "import": "./es/index.js"
39
41
  },
40
42
  "./assets/css/styles": "./assets/css/styles.css",
@@ -51,16 +53,16 @@
51
53
  "build": "../../scripts/prepare-package.sh --types"
52
54
  },
53
55
  "devDependencies": {
54
- "react": "^18.3.0 || ^19.0.0",
55
- "react-dom": "^18.3.0 || ^19.0.0"
56
+ "react": "^19.0.0",
57
+ "react-dom": "^19.0.0"
56
58
  },
57
59
  "peerDependencies": {
58
- "react": "^18.3.0 || ^19.0.0",
59
- "react-dom": "^18.3.0 || ^19.0.0"
60
+ "react": "^19.0.0",
61
+ "react-dom": "^19.0.0"
60
62
  },
61
63
  "dependencies": {
62
64
  "@babel/runtime": "^7.28.6",
63
- "@micromag/core": "^0.4.71",
65
+ "@micromag/core": "^0.4.74",
64
66
  "classnames": "^2.2.6",
65
67
  "lodash": "^4.17.23",
66
68
  "react-intl": "^8.1.3 || ^10.0.0",
@@ -70,6 +72,6 @@
70
72
  "access": "public",
71
73
  "registry": "https://registry.npmjs.org/"
72
74
  },
73
- "gitHead": "9101554bc5761e32b4a002a10d26800608c69773",
75
+ "gitHead": "fe510ee87845280d0760cb292aef9d2eb69e67c1",
74
76
  "types": "es/index.d.ts"
75
77
  }