@cloudtower/eagle 490.0.9 → 490.0.11
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 +29 -2
- package/dist/cjs/core/LegacySelect/index.js +10 -3
- package/dist/cjs/core/Radio/index.js +30 -6
- package/dist/cjs/stats1.html +1 -1
- package/dist/components.css +1400 -1400
- package/dist/esm/core/Checkbox/index.js +30 -3
- package/dist/esm/core/LegacySelect/index.js +10 -3
- package/dist/esm/core/Radio/index.js +31 -7
- package/dist/esm/stats1.html +1 -1
- package/dist/linaria.merged.scss +1774 -1774
- package/dist/src/core/Checkbox/index.d.ts +4 -0
- package/dist/src/core/LegacySelect/select.type.d.ts +4 -0
- package/dist/style.css +1400 -1400
- 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,40 @@ 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-
|
|
69
|
+
"data-test": props["data-test"] || props.value,
|
|
44
70
|
className: cs(className, CheckboxStyle, compact && "compact")
|
|
45
71
|
}),
|
|
72
|
+
(dataTestId || props.value) && /* @__PURE__ */ React__default.createElement("span", { ref: markerRef, style: { display: "none" } }),
|
|
46
73
|
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
74
|
);
|
|
48
75
|
};
|
|
@@ -61,7 +61,8 @@ const LegacySelect = (_a) => {
|
|
|
61
61
|
size = "middle",
|
|
62
62
|
meta,
|
|
63
63
|
placeholder,
|
|
64
|
-
"data-testid": dataTestId
|
|
64
|
+
"data-testid": dataTestId,
|
|
65
|
+
"data-test": dataTest
|
|
65
66
|
} = _b, restProps = __objRest(_b, [
|
|
66
67
|
"input",
|
|
67
68
|
"multiple",
|
|
@@ -82,7 +83,8 @@ const LegacySelect = (_a) => {
|
|
|
82
83
|
"size",
|
|
83
84
|
"meta",
|
|
84
85
|
"placeholder",
|
|
85
|
-
"data-testid"
|
|
86
|
+
"data-testid",
|
|
87
|
+
"data-test"
|
|
86
88
|
]);
|
|
87
89
|
var _a2;
|
|
88
90
|
const limitExceeded = multiple && selectLimit && selectLimit <= (((_a2 = input.value) == null ? void 0 : _a2.length) || 0);
|
|
@@ -114,6 +116,10 @@ const LegacySelect = (_a) => {
|
|
|
114
116
|
"data-testid",
|
|
115
117
|
String(placeholder || item.textContent)
|
|
116
118
|
);
|
|
119
|
+
inputDom && (placeholder || item) && inputDom.setAttribute(
|
|
120
|
+
"data-test",
|
|
121
|
+
String(placeholder || item.textContent)
|
|
122
|
+
);
|
|
117
123
|
}
|
|
118
124
|
}, [selectRef, placeholder]);
|
|
119
125
|
useEffect(() => {
|
|
@@ -184,7 +190,8 @@ const LegacySelect = (_a) => {
|
|
|
184
190
|
React__default.Children.map(children, (child) => {
|
|
185
191
|
return isElement(child) ? __spreadProps(__spreadValues({}, child), {
|
|
186
192
|
props: __spreadProps(__spreadValues({}, child.props), {
|
|
187
|
-
"data-
|
|
193
|
+
"data-test": child.props.value,
|
|
194
|
+
"data-testid": dataTestId || dataTest ? `${dataTestId || dataTest}-option-${child.props.value}` : void 0
|
|
188
195
|
})
|
|
189
196
|
}) : child;
|
|
190
197
|
})
|
|
@@ -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
|
|