@rescui/checkbox 0.11.5-RUI-308-Fix-select-issues-405b9fa40.12 → 0.12.0

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.
@@ -1,10 +1,12 @@
1
1
  "use client";
2
- import React, { useState, useRef, useEffect, useCallback } from 'react';
2
+ import { c } from 'react-compiler-runtime';
3
+ import React, { useState, useRef, useEffect } from 'react';
3
4
  import PropTypes from 'prop-types';
4
5
  import { GroupContext } from './group-context.js';
5
6
 
6
- const CheckboxManager = _ref => {
7
- let {
7
+ const CheckboxManager = t0 => {
8
+ const $ = c(31);
9
+ const {
8
10
  onChange,
9
11
  value: valueFromProps,
10
12
  defaultValue,
@@ -14,41 +16,112 @@ const CheckboxManager = _ref => {
14
16
  disabled,
15
17
  mode,
16
18
  children
17
- } = _ref;
18
- const isControlled = typeof valueFromProps !== 'undefined';
19
- const [value, setValue] = useState(defaultValue || []);
19
+ } = t0;
20
+ const isControlled = typeof valueFromProps !== "undefined";
21
+ let t1;
22
+
23
+ if ($[0] !== defaultValue) {
24
+ t1 = defaultValue || [];
25
+ $[0] = defaultValue;
26
+ $[1] = t1;
27
+ } else {
28
+ t1 = $[1];
29
+ }
30
+
31
+ const [value, setValue] = useState(t1);
20
32
  const prevValue = useRef(value);
21
- useEffect(() => {
22
- // in controlled mode the onChange is already called
23
- if (!isControlled && onChange && prevValue.current !== value) {
24
- onChange(value);
25
- prevValue.current = value;
26
- }
27
- }, [isControlled, onChange, value]);
28
- const addToValue = useCallback(val => {
29
- if (!isControlled) {
30
- setValue(prevVal => prevVal.concat(val));
31
- } else if (onChange) {
32
- onChange(valueFromProps.concat(val));
33
- }
34
- }, [onChange, isControlled, valueFromProps]);
35
- const removeFromValue = useCallback(val => {
36
- if (!isControlled) {
37
- setValue(prevVal => prevVal.filter(v => v !== val));
38
- } else if (onChange) {
39
- onChange(valueFromProps.filter(v => v !== val));
40
- }
41
- }, [onChange, isControlled, valueFromProps]);
42
- const handleCheckboxChange = useCallback(e => {
43
- if (e.target.checked) {
44
- addToValue(e.target.value);
45
- } else {
46
- removeFromValue(e.target.value);
47
- }
48
- }, [addToValue, removeFromValue]);
49
- return /*#__PURE__*/React.createElement(GroupContext.Provider, {
50
- value: {
51
- value: isControlled ? valueFromProps : value,
33
+ let t2;
34
+ let t3;
35
+
36
+ if ($[2] !== isControlled || $[3] !== onChange || $[4] !== value) {
37
+ t2 = () => {
38
+ if (!isControlled && onChange && prevValue.current !== value) {
39
+ onChange(value);
40
+ prevValue.current = value;
41
+ }
42
+ };
43
+
44
+ t3 = [isControlled, onChange, value];
45
+ $[2] = isControlled;
46
+ $[3] = onChange;
47
+ $[4] = value;
48
+ $[5] = t2;
49
+ $[6] = t3;
50
+ } else {
51
+ t2 = $[5];
52
+ t3 = $[6];
53
+ }
54
+
55
+ useEffect(t2, t3);
56
+ let t4;
57
+
58
+ if ($[7] !== isControlled || $[8] !== onChange || $[9] !== valueFromProps) {
59
+ t4 = val => {
60
+ if (!isControlled) {
61
+ setValue(prevVal => prevVal.concat(val));
62
+ } else {
63
+ if (onChange) {
64
+ onChange(valueFromProps.concat(val));
65
+ }
66
+ }
67
+ };
68
+
69
+ $[7] = isControlled;
70
+ $[8] = onChange;
71
+ $[9] = valueFromProps;
72
+ $[10] = t4;
73
+ } else {
74
+ t4 = $[10];
75
+ }
76
+
77
+ const addToValue = t4;
78
+ let t5;
79
+
80
+ if ($[11] !== isControlled || $[12] !== onChange || $[13] !== valueFromProps) {
81
+ t5 = val_0 => {
82
+ if (!isControlled) {
83
+ setValue(prevVal_0 => prevVal_0.filter(v => v !== val_0));
84
+ } else {
85
+ if (onChange) {
86
+ onChange(valueFromProps.filter(v_0 => v_0 !== val_0));
87
+ }
88
+ }
89
+ };
90
+
91
+ $[11] = isControlled;
92
+ $[12] = onChange;
93
+ $[13] = valueFromProps;
94
+ $[14] = t5;
95
+ } else {
96
+ t5 = $[14];
97
+ }
98
+
99
+ const removeFromValue = t5;
100
+ let t6;
101
+
102
+ if ($[15] !== addToValue || $[16] !== removeFromValue) {
103
+ t6 = e => {
104
+ if (e.target.checked) {
105
+ addToValue(e.target.value);
106
+ } else {
107
+ removeFromValue(e.target.value);
108
+ }
109
+ };
110
+
111
+ $[15] = addToValue;
112
+ $[16] = removeFromValue;
113
+ $[17] = t6;
114
+ } else {
115
+ t6 = $[17];
116
+ }
117
+
118
+ const handleCheckboxChange = t6;
119
+ const t7 = isControlled ? valueFromProps : value;
120
+ let t8;
121
+
122
+ if ($[18] !== addToValue || $[19] !== disabled || $[20] !== handleCheckboxChange || $[21] !== isError || $[22] !== mode || $[23] !== removeFromValue || $[24] !== size || $[25] !== t7 || $[26] !== theme) {
123
+ t8 = {
124
+ value: t7,
52
125
  addToValue,
53
126
  removeFromValue,
54
127
  handleCheckboxChange,
@@ -58,8 +131,35 @@ const CheckboxManager = _ref => {
58
131
  size,
59
132
  mode,
60
133
  inGroup: true
61
- }
62
- }, children);
134
+ };
135
+ $[18] = addToValue;
136
+ $[19] = disabled;
137
+ $[20] = handleCheckboxChange;
138
+ $[21] = isError;
139
+ $[22] = mode;
140
+ $[23] = removeFromValue;
141
+ $[24] = size;
142
+ $[25] = t7;
143
+ $[26] = theme;
144
+ $[27] = t8;
145
+ } else {
146
+ t8 = $[27];
147
+ }
148
+
149
+ let t9;
150
+
151
+ if ($[28] !== children || $[29] !== t8) {
152
+ t9 = /*#__PURE__*/React.createElement(GroupContext.Provider, {
153
+ value: t8
154
+ }, children);
155
+ $[28] = children;
156
+ $[29] = t8;
157
+ $[30] = t9;
158
+ } else {
159
+ t9 = $[30];
160
+ }
161
+
162
+ return t9;
63
163
  };
64
164
 
65
165
  CheckboxManager.propTypes = {
@@ -1,25 +1,25 @@
1
1
  var styles = {
2
- "themeLight": "_themeLight_mhvs2m_8",
3
- "themeDark": "_themeDark_mhvs2m_11",
4
- "checkboxSizeS": "_checkboxSizeS_mhvs2m_15",
5
- "checkboxSizeM": "_checkboxSizeM_mhvs2m_18",
6
- "checkboxSizeL": "_checkboxSizeL_mhvs2m_21",
7
- "sizeS": "_sizeS_mhvs2m_25",
8
- "sizeM": "_sizeM_mhvs2m_28",
9
- "sizeL": "_sizeL_mhvs2m_31",
10
- "classic": "_classic_mhvs2m_35",
11
- "rock": "_rock_mhvs2m_38",
12
- "checkbox": "_checkbox_mhvs2m_15",
13
- "input": "_input_mhvs2m_65",
14
- "icon": "_icon_mhvs2m_76",
15
- "enabled": "_enabled_mhvs2m_93",
16
- "indeterminate": "_indeterminate_mhvs2m_97",
17
- "disabled": "_disabled_mhvs2m_105",
18
- "error": "_error_mhvs2m_134",
19
- "checkmark": "_checkmark_mhvs2m_161",
20
- "markS": "_markS_mhvs2m_186",
21
- "markM": "_markM_mhvs2m_189",
22
- "markL": "_markL_mhvs2m_192",
23
- "errorMessage": "_errorMessage_mhvs2m_196"
2
+ "themeLight": "_themeLight_116b7cs_8",
3
+ "themeDark": "_themeDark_116b7cs_11",
4
+ "checkboxSizeS": "_checkboxSizeS_116b7cs_15",
5
+ "checkboxSizeM": "_checkboxSizeM_116b7cs_18",
6
+ "checkboxSizeL": "_checkboxSizeL_116b7cs_21",
7
+ "sizeS": "_sizeS_116b7cs_25",
8
+ "sizeM": "_sizeM_116b7cs_28",
9
+ "sizeL": "_sizeL_116b7cs_31",
10
+ "classic": "_classic_116b7cs_35",
11
+ "rock": "_rock_116b7cs_38",
12
+ "checkbox": "_checkbox_116b7cs_15",
13
+ "input": "_input_116b7cs_65",
14
+ "icon": "_icon_116b7cs_76",
15
+ "enabled": "_enabled_116b7cs_93",
16
+ "indeterminate": "_indeterminate_116b7cs_97",
17
+ "disabled": "_disabled_116b7cs_105",
18
+ "error": "_error_116b7cs_134",
19
+ "checkmark": "_checkmark_116b7cs_161",
20
+ "markS": "_markS_116b7cs_186",
21
+ "markM": "_markM_116b7cs_189",
22
+ "markL": "_markL_116b7cs_192",
23
+ "errorMessage": "_errorMessage_116b7cs_196"
24
24
  };
25
25
  export { styles as default };
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { createContext } from 'react'; // eslint-disable-next-line @typescript-eslint/no-empty-function
2
+ import { createContext } from 'react';
3
3
 
4
4
  const noop = () => {};
5
5
 
@@ -1,40 +1,144 @@
1
+ import _extends from '@babel/runtime-corejs3/helpers/esm/extends';
2
+ import { c } from 'react-compiler-runtime';
1
3
  import React from 'react';
2
4
  import styles from './checkbox.p.module.css.js';
3
5
 
4
- const MarkS = props => /*#__PURE__*/React.createElement("svg", {
5
- xmlns: "http://www.w3.org/2000/svg",
6
- viewBox: "0 0 14 14",
7
- ...props
8
- }, /*#__PURE__*/React.createElement("path", {
9
- d: "M11.707 5.207L6 10.914 2.293 7.207l1.414-1.414L6 8.086l4.293-4.293 1.414 1.414z"
10
- }));
11
-
12
- const MarkM = props => /*#__PURE__*/React.createElement("svg", {
13
- xmlns: "http://www.w3.org/2000/svg",
14
- viewBox: "0 0 18 18",
15
- ...props
16
- }, /*#__PURE__*/React.createElement("path", {
17
- d: "M15.69 5.724l-8.053 7.662-4.332-4.192 1.39-1.437 2.953 2.857 6.663-6.338 1.378 1.448z"
18
- }));
19
-
20
- const MarkL = props => /*#__PURE__*/React.createElement("svg", {
21
- xmlns: "http://www.w3.org/2000/svg",
22
- viewBox: "0 0 20 20",
23
- ...props
24
- }, /*#__PURE__*/React.createElement("path", {
25
- d: "M17.717 5.447L7.63 15.815 2.277 10.22l1.446-1.382 3.919 4.097 8.641-8.882 1.434 1.394z"
26
- }));
27
-
28
- const Mark = props => /*#__PURE__*/React.createElement("svg", {
29
- xmlns: "http://www.w3.org/2000/svg",
30
- viewBox: "0 0 24 24",
31
- ...props
32
- }, /*#__PURE__*/React.createElement("g", {
33
- className: styles.markS
34
- }, /*#__PURE__*/React.createElement(MarkS, null)), /*#__PURE__*/React.createElement("g", {
35
- className: styles.markM
36
- }, /*#__PURE__*/React.createElement(MarkM, null)), /*#__PURE__*/React.createElement("g", {
37
- className: styles.markL
38
- }, /*#__PURE__*/React.createElement(MarkL, null)));
6
+ const MarkS = props => {
7
+ const $ = c(3);
8
+ let t0;
9
+
10
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
11
+ t0 = /*#__PURE__*/React.createElement("path", {
12
+ d: "M11.707 5.207L6 10.914 2.293 7.207l1.414-1.414L6 8.086l4.293-4.293 1.414 1.414z"
13
+ });
14
+ $[0] = t0;
15
+ } else {
16
+ t0 = $[0];
17
+ }
18
+
19
+ let t1;
20
+
21
+ if ($[1] !== props) {
22
+ t1 = /*#__PURE__*/React.createElement("svg", _extends({
23
+ xmlns: "http://www.w3.org/2000/svg",
24
+ viewBox: "0 0 14 14"
25
+ }, props), t0);
26
+ $[1] = props;
27
+ $[2] = t1;
28
+ } else {
29
+ t1 = $[2];
30
+ }
31
+
32
+ return t1;
33
+ };
34
+
35
+ const MarkM = props => {
36
+ const $ = c(3);
37
+ let t0;
38
+
39
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
40
+ t0 = /*#__PURE__*/React.createElement("path", {
41
+ d: "M15.69 5.724l-8.053 7.662-4.332-4.192 1.39-1.437 2.953 2.857 6.663-6.338 1.378 1.448z"
42
+ });
43
+ $[0] = t0;
44
+ } else {
45
+ t0 = $[0];
46
+ }
47
+
48
+ let t1;
49
+
50
+ if ($[1] !== props) {
51
+ t1 = /*#__PURE__*/React.createElement("svg", _extends({
52
+ xmlns: "http://www.w3.org/2000/svg",
53
+ viewBox: "0 0 18 18"
54
+ }, props), t0);
55
+ $[1] = props;
56
+ $[2] = t1;
57
+ } else {
58
+ t1 = $[2];
59
+ }
60
+
61
+ return t1;
62
+ };
63
+
64
+ const MarkL = props => {
65
+ const $ = c(3);
66
+ let t0;
67
+
68
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
69
+ t0 = /*#__PURE__*/React.createElement("path", {
70
+ d: "M17.717 5.447L7.63 15.815 2.277 10.22l1.446-1.382 3.919 4.097 8.641-8.882 1.434 1.394z"
71
+ });
72
+ $[0] = t0;
73
+ } else {
74
+ t0 = $[0];
75
+ }
76
+
77
+ let t1;
78
+
79
+ if ($[1] !== props) {
80
+ t1 = /*#__PURE__*/React.createElement("svg", _extends({
81
+ xmlns: "http://www.w3.org/2000/svg",
82
+ viewBox: "0 0 20 20"
83
+ }, props), t0);
84
+ $[1] = props;
85
+ $[2] = t1;
86
+ } else {
87
+ t1 = $[2];
88
+ }
89
+
90
+ return t1;
91
+ };
92
+
93
+ const Mark = props => {
94
+ const $ = c(5);
95
+ let t0;
96
+
97
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
98
+ t0 = /*#__PURE__*/React.createElement("g", {
99
+ className: styles.markS
100
+ }, /*#__PURE__*/React.createElement(MarkS, null));
101
+ $[0] = t0;
102
+ } else {
103
+ t0 = $[0];
104
+ }
105
+
106
+ let t1;
107
+
108
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
109
+ t1 = /*#__PURE__*/React.createElement("g", {
110
+ className: styles.markM
111
+ }, /*#__PURE__*/React.createElement(MarkM, null));
112
+ $[1] = t1;
113
+ } else {
114
+ t1 = $[1];
115
+ }
116
+
117
+ let t2;
118
+
119
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
120
+ t2 = /*#__PURE__*/React.createElement("g", {
121
+ className: styles.markL
122
+ }, /*#__PURE__*/React.createElement(MarkL, null));
123
+ $[2] = t2;
124
+ } else {
125
+ t2 = $[2];
126
+ }
127
+
128
+ let t3;
129
+
130
+ if ($[3] !== props) {
131
+ t3 = /*#__PURE__*/React.createElement("svg", _extends({
132
+ xmlns: "http://www.w3.org/2000/svg",
133
+ viewBox: "0 0 24 24"
134
+ }, props), t0, t1, t2);
135
+ $[3] = props;
136
+ $[4] = t3;
137
+ } else {
138
+ t3 = $[4];
139
+ }
140
+
141
+ return t3;
142
+ };
39
143
 
40
144
  export { Mark, MarkL, MarkM, MarkS };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rescui/checkbox",
3
- "version": "0.11.5-RUI-308-Fix-select-issues-405b9fa40.12+405b9fa40",
3
+ "version": "0.12.0",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "author": "JetBrains",
@@ -17,26 +17,27 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@babel/runtime-corejs3": "^7.26.0",
20
- "@rescui/form-field": "0.1.8-RUI-308-Fix-select-issues-405b9fa40.12+405b9fa40",
21
- "@rescui/menu": "0.14.2-RUI-308-Fix-select-issues-405b9fa40.12+405b9fa40",
22
- "classnames": "^2.2.6"
20
+ "@rescui/form-field": "^0.2.0",
21
+ "@rescui/menu": "^0.15.0",
22
+ "classnames": "^2.2.6",
23
+ "react-compiler-runtime": "^1.0.0"
23
24
  },
24
25
  "peerDependencies": {
25
26
  "@rescui/ui-contexts": "^0.6.0",
26
27
  "prop-types": "^15",
27
- "react": ">=16.8.0 <20"
28
+ "react": ">=17.0.0 <20"
28
29
  },
29
30
  "devDependencies": {
30
- "@rescui/colors": "0.3.4-RUI-308-Fix-select-issues-405b9fa40.12+405b9fa40",
31
- "@rescui/postcss-preset-library": "0.2.3",
32
- "@rescui/scripts": "0.5.2",
33
- "@rescui/typography": "0.27.5-RUI-308-Fix-select-issues-405b9fa40.12+405b9fa40",
34
- "@rescui/visual-regression": "0.1.4"
31
+ "@rescui/colors": "^0.3.4",
32
+ "@rescui/postcss-preset-library": "^0.2.3",
33
+ "@rescui/scripts": "^0.5.3",
34
+ "@rescui/typography": "^0.28.0",
35
+ "@rescui/visual-regression": "^0.1.4"
35
36
  },
36
37
  "scripts": {
37
38
  "build": "rescui-scripts build && yarn run build-pcss-api",
38
39
  "build-pcss-api": "rescui-scripts build-pcss-api --file public-api.p.css"
39
40
  },
40
41
  "nx": {},
41
- "gitHead": "405b9fa40886b0ab6709c9185e8214599d2d792e"
42
+ "gitHead": "8ffbbe20b8bcbb9ea15204113ab603675d4c03cd"
42
43
  }