@primer/react 38.42.0-rc.c4a4f80b3 → 38.42.0-rc.ebd425836
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/CHANGELOG.md +4 -0
- package/dist/FormControl/FormControl.js +55 -80
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
- [#8415](https://github.com/primer/react/pull/8415) [`66a9f31`](https://github.com/primer/react/commit/66a9f31611c642209f66ed68b7d43712b09dbd88) Thanks [@rickyzhangca](https://github.com/rickyzhangca)! - DataTable: Add controlled and uncontrolled row selection.
|
|
10
10
|
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#8508](https://github.com/primer/react/pull/8508) [`f71dce4`](https://github.com/primer/react/commit/f71dce4869dedf4cb8460ed2fa8e18edc0604198) Thanks [@namangoyal176-10](https://github.com/namangoyal176-10)! - FormControl: Prevent duplicate input rendering when layout is horizontal with non-choice inputs
|
|
14
|
+
|
|
11
15
|
## 38.41.0
|
|
12
16
|
|
|
13
17
|
### Minor Changes
|
|
@@ -24,7 +24,7 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
24
24
|
import { clsx } from "clsx";
|
|
25
25
|
var FormControl_default = Object.assign(/* @__PURE__ */ React.forwardRef((t0, ref) => {
|
|
26
26
|
var _slots$validation, _slots$label;
|
|
27
|
-
const $ = c(
|
|
27
|
+
const $ = c(23);
|
|
28
28
|
const { children, disabled: disabledProp, layout: t1, id: idProp, required, className, style } = t0;
|
|
29
29
|
const layout = t1 === void 0 ? "vertical" : t1;
|
|
30
30
|
let t2;
|
|
@@ -78,87 +78,65 @@ var FormControl_default = Object.assign(/* @__PURE__ */ React.forwardRef((t0, re
|
|
|
78
78
|
warning(isRadioInput && childrenWithoutSlots.find(_temp), "An individual radio cannot be a required field.");
|
|
79
79
|
} else warning(!!slots.leadingVisual, "A leading visual is only rendered for a checkbox or radio form control. If you want to render a leading visual inside of your input, check if your input supports a leading visual.");
|
|
80
80
|
const isLabelHidden = (_slots$label = slots.label) === null || _slots$label === void 0 ? void 0 : _slots$label.props.visuallyHidden;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
required: required && !isRadioInput,
|
|
85
|
-
"aria-describedby": captionId
|
|
86
|
-
}) : null;
|
|
87
|
-
let t5;
|
|
88
|
-
if ($[4] !== childrenWithoutSlots) {
|
|
89
|
-
t5 = childrenWithoutSlots.filter(_temp2);
|
|
90
|
-
$[4] = childrenWithoutSlots;
|
|
91
|
-
$[5] = t5;
|
|
92
|
-
} else t5 = $[5];
|
|
93
|
-
let t6;
|
|
94
|
-
if ($[6] !== t4 || $[7] !== t5) {
|
|
95
|
-
t6 = /* @__PURE__ */ jsxs("div", {
|
|
96
|
-
className: FormControl_module_css_default.ControlChoiceInputs,
|
|
97
|
-
children: [t4, t5]
|
|
98
|
-
});
|
|
99
|
-
$[6] = t4;
|
|
100
|
-
$[7] = t5;
|
|
101
|
-
$[8] = t6;
|
|
102
|
-
} else t6 = $[8];
|
|
103
|
-
let t7;
|
|
104
|
-
if ($[9] !== disabled || $[10] !== slots.caption || $[11] !== slots.leadingVisual) {
|
|
105
|
-
t7 = slots.leadingVisual ? /* @__PURE__ */ jsx("div", {
|
|
81
|
+
let t4;
|
|
82
|
+
if ($[4] !== disabled || $[5] !== slots.caption || $[6] !== slots.leadingVisual) {
|
|
83
|
+
t4 = slots.leadingVisual ? /* @__PURE__ */ jsx("div", {
|
|
106
84
|
className: FormControl_module_css_default.LeadingVisual,
|
|
107
85
|
"data-disabled": disabled ? "" : void 0,
|
|
108
86
|
"data-has-caption": slots.caption ? "" : void 0,
|
|
109
87
|
children: slots.leadingVisual
|
|
110
88
|
}) : null;
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
114
|
-
$[
|
|
115
|
-
} else
|
|
116
|
-
let
|
|
117
|
-
if ($[
|
|
118
|
-
|
|
89
|
+
$[4] = disabled;
|
|
90
|
+
$[5] = slots.caption;
|
|
91
|
+
$[6] = slots.leadingVisual;
|
|
92
|
+
$[7] = t4;
|
|
93
|
+
} else t4 = $[7];
|
|
94
|
+
let t5;
|
|
95
|
+
if ($[8] !== slots.caption || $[9] !== slots.label) {
|
|
96
|
+
t5 = /* @__PURE__ */ jsxs("div", {
|
|
119
97
|
className: FormControl_module_css_default.LabelContainer,
|
|
120
98
|
children: [slots.label, slots.caption]
|
|
121
99
|
});
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
124
|
-
$[
|
|
125
|
-
} else
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
100
|
+
$[8] = slots.caption;
|
|
101
|
+
$[9] = slots.label;
|
|
102
|
+
$[10] = t5;
|
|
103
|
+
} else t5 = $[10];
|
|
104
|
+
const InputChildren = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
105
|
+
/* @__PURE__ */ jsxs("div", {
|
|
106
|
+
className: FormControl_module_css_default.ControlChoiceInputs,
|
|
107
|
+
children: [/*#__PURE__*/ React.isValidElement(InputComponent) ? /*#__PURE__*/ React.cloneElement(InputComponent, {
|
|
108
|
+
id,
|
|
109
|
+
disabled,
|
|
110
|
+
required: required && !isRadioInput,
|
|
111
|
+
"aria-describedby": captionId
|
|
112
|
+
}) : null, childrenWithoutSlots.filter((child_1) => /*#__PURE__*/ React.isValidElement(child_1) && !expectedInputComponents.some((inputComponent_0) => child_1.type === inputComponent_0 || isSlot(child_1, inputComponent_0)))]
|
|
113
|
+
}),
|
|
114
|
+
t4,
|
|
115
|
+
t5
|
|
116
|
+
] });
|
|
139
117
|
const T0 = FormControlContextProvider;
|
|
140
|
-
const
|
|
141
|
-
let
|
|
142
|
-
if ($[
|
|
143
|
-
|
|
118
|
+
const t6 = !isSelectPanelInput;
|
|
119
|
+
let t7;
|
|
120
|
+
if ($[11] !== captionId || $[12] !== disabled || $[13] !== id || $[14] !== labelId || $[15] !== required || $[16] !== t6 || $[17] !== validationMessageId) {
|
|
121
|
+
t7 = {
|
|
144
122
|
captionId,
|
|
145
123
|
disabled,
|
|
146
124
|
id,
|
|
147
125
|
required,
|
|
148
126
|
validationMessageId,
|
|
149
|
-
isReferenced:
|
|
127
|
+
isReferenced: t6,
|
|
150
128
|
labelId
|
|
151
129
|
};
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
160
|
-
} else
|
|
161
|
-
const
|
|
130
|
+
$[11] = captionId;
|
|
131
|
+
$[12] = disabled;
|
|
132
|
+
$[13] = id;
|
|
133
|
+
$[14] = labelId;
|
|
134
|
+
$[15] = required;
|
|
135
|
+
$[16] = t6;
|
|
136
|
+
$[17] = validationMessageId;
|
|
137
|
+
$[18] = t7;
|
|
138
|
+
} else t7 = $[18];
|
|
139
|
+
const t8 = isChoiceInput || layout === "horizontal" ? /* @__PURE__ */ jsx("div", {
|
|
162
140
|
ref,
|
|
163
141
|
"data-has-leading-visual": slots.leadingVisual ? "" : void 0,
|
|
164
142
|
className: clsx(className, FormControl_module_css_default.ControlHorizontalLayout),
|
|
@@ -188,18 +166,18 @@ var FormControl_default = Object.assign(/* @__PURE__ */ React.forwardRef((t0, re
|
|
|
188
166
|
slots.caption
|
|
189
167
|
]
|
|
190
168
|
});
|
|
191
|
-
let
|
|
192
|
-
if ($[
|
|
193
|
-
|
|
194
|
-
value:
|
|
195
|
-
children:
|
|
169
|
+
let t9;
|
|
170
|
+
if ($[19] !== T0 || $[20] !== t7 || $[21] !== t8) {
|
|
171
|
+
t9 = /* @__PURE__ */ jsx(T0, {
|
|
172
|
+
value: t7,
|
|
173
|
+
children: t8
|
|
196
174
|
});
|
|
197
|
-
$[
|
|
198
|
-
$[
|
|
199
|
-
$[
|
|
200
|
-
$[
|
|
201
|
-
} else
|
|
202
|
-
return
|
|
175
|
+
$[19] = T0;
|
|
176
|
+
$[20] = t7;
|
|
177
|
+
$[21] = t8;
|
|
178
|
+
$[22] = t9;
|
|
179
|
+
} else t9 = $[22];
|
|
180
|
+
return t9;
|
|
203
181
|
}), {
|
|
204
182
|
__SLOT__: Symbol("FormControl"),
|
|
205
183
|
Caption: FormControlCaption,
|
|
@@ -211,8 +189,5 @@ function _temp(child_0) {
|
|
|
211
189
|
var _child_0$props;
|
|
212
190
|
return /*#__PURE__*/ React.isValidElement(child_0) && ((_child_0$props = child_0.props) === null || _child_0$props === void 0 ? void 0 : _child_0$props.required);
|
|
213
191
|
}
|
|
214
|
-
function _temp2(child_1) {
|
|
215
|
-
return /*#__PURE__*/ React.isValidElement(child_1) && ![Checkbox, Radio].some((inputComponent_0) => child_1.type === inputComponent_0 || isSlot(child_1, inputComponent_0));
|
|
216
|
-
}
|
|
217
192
|
//#endregion
|
|
218
193
|
export { FormControl_default as default };
|
package/package.json
CHANGED