@cloudtower/eagle 490.0.9 → 490.0.10
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/dist/cjs/core/Checkbox/index.js +28 -2
- package/dist/cjs/core/Radio/index.js +30 -6
- package/dist/cjs/stats1.html +1 -1
- package/dist/components.css +1477 -1477
- package/dist/esm/core/Checkbox/index.js +29 -3
- package/dist/esm/core/Radio/index.js +31 -7
- package/dist/esm/stats1.html +1 -1
- package/dist/linaria.merged.scss +2101 -2101
- package/dist/style.css +1477 -1477
- package/package.json +4 -4
|
@@ -2,7 +2,7 @@ import { CheckboxStyle } from './checkbox.style.js';
|
|
|
2
2
|
import { Typo } from '../Typo/index.js';
|
|
3
3
|
import { Checkbox as Checkbox$2 } from 'antd';
|
|
4
4
|
import cs from 'classnames';
|
|
5
|
-
import React__default from 'react';
|
|
5
|
+
import React__default, { useCallback } from 'react';
|
|
6
6
|
|
|
7
7
|
var __defProp = Object.defineProperty;
|
|
8
8
|
var __defProps = Object.defineProperties;
|
|
@@ -36,13 +36,39 @@ var __objRest = (source, exclude) => {
|
|
|
36
36
|
return target;
|
|
37
37
|
};
|
|
38
38
|
const Checkbox = (_a) => {
|
|
39
|
-
var _b = _a, {
|
|
39
|
+
var _b = _a, {
|
|
40
|
+
className,
|
|
41
|
+
children,
|
|
42
|
+
description,
|
|
43
|
+
compact,
|
|
44
|
+
"data-testid": dataTestId
|
|
45
|
+
} = _b, props = __objRest(_b, [
|
|
46
|
+
"className",
|
|
47
|
+
"children",
|
|
48
|
+
"description",
|
|
49
|
+
"compact",
|
|
50
|
+
"data-testid"
|
|
51
|
+
]);
|
|
52
|
+
const markerRef = useCallback(
|
|
53
|
+
(node) => {
|
|
54
|
+
if (node) {
|
|
55
|
+
const label = node.closest("label.ant-checkbox-wrapper");
|
|
56
|
+
if (label) {
|
|
57
|
+
const testId = dataTestId || props.value;
|
|
58
|
+
if (testId) {
|
|
59
|
+
label.setAttribute("data-testid", String(testId));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
[dataTestId, props.value]
|
|
65
|
+
);
|
|
40
66
|
return /* @__PURE__ */ React__default.createElement(
|
|
41
67
|
Checkbox$2,
|
|
42
68
|
__spreadProps(__spreadValues({}, props), {
|
|
43
|
-
"data-testid": props["data-testid"] || props.value,
|
|
44
69
|
className: cs(className, CheckboxStyle, compact && "compact")
|
|
45
70
|
}),
|
|
71
|
+
(dataTestId || props.value) && /* @__PURE__ */ React__default.createElement("span", { ref: markerRef, style: { display: "none" } }),
|
|
46
72
|
children ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", { className: cs("main", Typo.Label.l2_regular) }, children), description ? /* @__PURE__ */ React__default.createElement("div", { className: cs("sub", Typo.Label.l4_regular) }, description) : null) : null
|
|
47
73
|
);
|
|
48
74
|
};
|
|
@@ -2,7 +2,7 @@ import { cx } from '@linaria/core';
|
|
|
2
2
|
import { Typo } from '../Typo/index.js';
|
|
3
3
|
import { Radio as Radio$2, InputNumber, Input } from 'antd';
|
|
4
4
|
import _ from 'lodash';
|
|
5
|
-
import React__default, { useState } from 'react';
|
|
5
|
+
import React__default, { useCallback, useState } from 'react';
|
|
6
6
|
import { EMPTY_FUNCTION } from '../../utils/constants.js';
|
|
7
7
|
|
|
8
8
|
var __defProp = Object.defineProperty;
|
|
@@ -48,17 +48,29 @@ const Radio = _a => {
|
|
|
48
48
|
description
|
|
49
49
|
} = props;
|
|
50
50
|
const context = React__default.useContext(KitRadioGroupContext);
|
|
51
|
+
const markerRef = useCallback(node => {
|
|
52
|
+
if (node && dataTestId) {
|
|
53
|
+
const label = node.closest("label.ant-radio-wrapper");
|
|
54
|
+
if (label) {
|
|
55
|
+
label.setAttribute("data-testid", dataTestId);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}, [dataTestId]);
|
|
51
59
|
if (description) {
|
|
52
60
|
children = /* @__PURE__ */React__default.createElement(React__default.Fragment, null, children, /* @__PURE__ */React__default.createElement("div", {
|
|
53
61
|
className: cx("radio-description", Typo.Label.l4_regular)
|
|
54
62
|
}, description));
|
|
55
63
|
}
|
|
56
|
-
return /* @__PURE__ */React__default.createElement(
|
|
64
|
+
return /* @__PURE__ */React__default.createElement(Radio$2, __spreadValues({
|
|
57
65
|
className: cx(className, RadioStyle, compact && "compact"),
|
|
58
66
|
checked: checked || false,
|
|
59
|
-
"data-testid": dataTestId,
|
|
60
67
|
"data-test": context.name ? `${context.name}-${String(props.value)}` : String(props.value)
|
|
61
|
-
}, props),
|
|
68
|
+
}, props), dataTestId && /* @__PURE__ */React__default.createElement("span", {
|
|
69
|
+
ref: markerRef,
|
|
70
|
+
style: {
|
|
71
|
+
display: "none"
|
|
72
|
+
}
|
|
73
|
+
}), children ? children : null);
|
|
62
74
|
};
|
|
63
75
|
const RadioGroup = _c => {
|
|
64
76
|
var _d = _c,
|
|
@@ -98,6 +110,14 @@ const RadioButton = _e => {
|
|
|
98
110
|
const [inputValue, setInputValue] = useState(initialValue);
|
|
99
111
|
const radioButtonValue = type === "input" || type === "input-number" ? inputValue : props.value;
|
|
100
112
|
const radioGroupContext = React__default.useContext(KitRadioGroupContext);
|
|
113
|
+
const markerRef = useCallback(node => {
|
|
114
|
+
if (node && dataTestId) {
|
|
115
|
+
const label = node.closest("label.ant-radio-button-wrapper");
|
|
116
|
+
if (label) {
|
|
117
|
+
label.setAttribute("data-testid", dataTestId);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}, [dataTestId]);
|
|
101
121
|
const renderInput = () => {
|
|
102
122
|
const inputDisabled = props.disabled || (radioGroupContext == null ? void 0 : radioGroupContext.disabled);
|
|
103
123
|
if (type === "input-number") return /* @__PURE__ */React__default.createElement(InputNumber, {
|
|
@@ -135,9 +155,13 @@ const RadioButton = _e => {
|
|
|
135
155
|
};
|
|
136
156
|
return /* @__PURE__ */React__default.createElement(Radio$2.Button, __spreadValues({
|
|
137
157
|
className: cx(className, RadioButtonStyle),
|
|
138
|
-
value: radioButtonValue
|
|
139
|
-
|
|
140
|
-
|
|
158
|
+
value: radioButtonValue
|
|
159
|
+
}, props), dataTestId && /* @__PURE__ */React__default.createElement("span", {
|
|
160
|
+
ref: markerRef,
|
|
161
|
+
style: {
|
|
162
|
+
display: "none"
|
|
163
|
+
}
|
|
164
|
+
}), renderChildren());
|
|
141
165
|
};
|
|
142
166
|
var Radio$1 = Radio;
|
|
143
167
|
|