@primer/react 0.0.0-20260304190511 → 0.0.0-20260304194558
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
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormControl.d.ts","sourceRoot":"","sources":["../../src/FormControl/FormControl.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAavC,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAA;AASvD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IAClC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;CAC5B,CAAA;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"FormControl.d.ts","sourceRoot":"","sources":["../../src/FormControl/FormControl.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAavC,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAA;AASvD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IAClC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;CAC5B,CAAA;;;;;;;;;;;;;;AAiMD,wBAME"}
|
|
@@ -25,7 +25,7 @@ import { SelectPanel } from '../SelectPanel/SelectPanel.js';
|
|
|
25
25
|
|
|
26
26
|
const FormControl = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
27
27
|
var _slots$validation, _slots$label;
|
|
28
|
-
const $ = c(
|
|
28
|
+
const $ = c(32);
|
|
29
29
|
const {
|
|
30
30
|
children,
|
|
31
31
|
disabled: disabledProp,
|
|
@@ -61,7 +61,17 @@ const FormControl = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
|
61
61
|
const isChoiceInput = /*#__PURE__*/React.isValidElement(InputComponent) && (InputComponent.type === Checkbox || InputComponent.type === Radio || isSlot(InputComponent, Checkbox) || isSlot(InputComponent, Radio));
|
|
62
62
|
const isRadioInput = /*#__PURE__*/React.isValidElement(InputComponent) && (InputComponent.type === Radio || isSlot(InputComponent, Radio));
|
|
63
63
|
const isSelectPanelInput = /*#__PURE__*/React.isValidElement(InputComponent) && (InputComponent.type === SelectPanel || isSlot(InputComponent, SelectPanel));
|
|
64
|
-
|
|
64
|
+
let t3;
|
|
65
|
+
if ($[1] !== id || $[2] !== slots.label) {
|
|
66
|
+
var _ref;
|
|
67
|
+
t3 = slots.label ? (_ref = /*#__PURE__*/React.isValidElement(slots.label) ? slots.label.props.id : undefined) !== null && _ref !== void 0 ? _ref : `${id}-label` : undefined;
|
|
68
|
+
$[1] = id;
|
|
69
|
+
$[2] = slots.label;
|
|
70
|
+
$[3] = t3;
|
|
71
|
+
} else {
|
|
72
|
+
t3 = $[3];
|
|
73
|
+
}
|
|
74
|
+
const labelId = t3;
|
|
65
75
|
if (InputComponent) {
|
|
66
76
|
process.env.NODE_ENV !== "production" ? warning(inputProps === null || inputProps === void 0 ? void 0 : inputProps.id, "instead of passing the 'id' prop directly to the input component, it should be passed to the parent component, <FormControl>") : void 0;
|
|
67
77
|
process.env.NODE_ENV !== "production" ? warning(inputProps === null || inputProps === void 0 ? void 0 : inputProps.disabled, "instead of passing the 'disabled' prop directly to the input component, it should be passed to the parent component, <FormControl>") : void 0;
|
|
@@ -77,97 +87,97 @@ const FormControl = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
|
77
87
|
process.env.NODE_ENV !== "production" ? 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.") : void 0;
|
|
78
88
|
}
|
|
79
89
|
const isLabelHidden = (_slots$label = slots.label) === null || _slots$label === void 0 ? void 0 : _slots$label.props.visuallyHidden;
|
|
80
|
-
const
|
|
90
|
+
const t4 = /*#__PURE__*/React.isValidElement(InputComponent) ? /*#__PURE__*/React.cloneElement(InputComponent, {
|
|
81
91
|
id,
|
|
82
92
|
disabled,
|
|
83
93
|
required: required && !isRadioInput,
|
|
84
94
|
"aria-describedby": captionId
|
|
85
95
|
}) : null;
|
|
86
|
-
let t4;
|
|
87
|
-
if ($[1] !== childrenWithoutSlots) {
|
|
88
|
-
t4 = childrenWithoutSlots.filter(_temp2);
|
|
89
|
-
$[1] = childrenWithoutSlots;
|
|
90
|
-
$[2] = t4;
|
|
91
|
-
} else {
|
|
92
|
-
t4 = $[2];
|
|
93
|
-
}
|
|
94
96
|
let t5;
|
|
95
|
-
if ($[
|
|
96
|
-
t5 =
|
|
97
|
-
|
|
98
|
-
children: [t3, t4]
|
|
99
|
-
});
|
|
100
|
-
$[3] = t3;
|
|
101
|
-
$[4] = t4;
|
|
97
|
+
if ($[4] !== childrenWithoutSlots) {
|
|
98
|
+
t5 = childrenWithoutSlots.filter(_temp2);
|
|
99
|
+
$[4] = childrenWithoutSlots;
|
|
102
100
|
$[5] = t5;
|
|
103
101
|
} else {
|
|
104
102
|
t5 = $[5];
|
|
105
103
|
}
|
|
106
104
|
let t6;
|
|
107
|
-
if ($[6] !==
|
|
108
|
-
t6 =
|
|
105
|
+
if ($[6] !== t4 || $[7] !== t5) {
|
|
106
|
+
t6 = /*#__PURE__*/jsxs("div", {
|
|
107
|
+
className: classes.ControlChoiceInputs,
|
|
108
|
+
children: [t4, t5]
|
|
109
|
+
});
|
|
110
|
+
$[6] = t4;
|
|
111
|
+
$[7] = t5;
|
|
112
|
+
$[8] = t6;
|
|
113
|
+
} else {
|
|
114
|
+
t6 = $[8];
|
|
115
|
+
}
|
|
116
|
+
let t7;
|
|
117
|
+
if ($[9] !== disabled || $[10] !== slots.caption || $[11] !== slots.leadingVisual) {
|
|
118
|
+
t7 = slots.leadingVisual ? /*#__PURE__*/jsx("div", {
|
|
109
119
|
className: classes.LeadingVisual,
|
|
110
120
|
"data-disabled": disabled ? "" : undefined,
|
|
111
121
|
"data-has-caption": slots.caption ? "" : undefined,
|
|
112
122
|
children: slots.leadingVisual
|
|
113
123
|
}) : null;
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
116
|
-
$[
|
|
117
|
-
$[
|
|
124
|
+
$[9] = disabled;
|
|
125
|
+
$[10] = slots.caption;
|
|
126
|
+
$[11] = slots.leadingVisual;
|
|
127
|
+
$[12] = t7;
|
|
118
128
|
} else {
|
|
119
|
-
|
|
129
|
+
t7 = $[12];
|
|
120
130
|
}
|
|
121
|
-
let
|
|
122
|
-
if ($[
|
|
123
|
-
|
|
131
|
+
let t8;
|
|
132
|
+
if ($[13] !== slots.caption || $[14] !== slots.label) {
|
|
133
|
+
t8 = /*#__PURE__*/jsxs("div", {
|
|
124
134
|
className: classes.LabelContainer,
|
|
125
135
|
children: [slots.label, slots.caption]
|
|
126
136
|
});
|
|
127
|
-
$[
|
|
128
|
-
$[
|
|
129
|
-
$[
|
|
137
|
+
$[13] = slots.caption;
|
|
138
|
+
$[14] = slots.label;
|
|
139
|
+
$[15] = t8;
|
|
130
140
|
} else {
|
|
131
|
-
|
|
141
|
+
t8 = $[15];
|
|
132
142
|
}
|
|
133
|
-
let
|
|
134
|
-
if ($[
|
|
135
|
-
|
|
136
|
-
children: [
|
|
143
|
+
let t9;
|
|
144
|
+
if ($[16] !== t6 || $[17] !== t7 || $[18] !== t8) {
|
|
145
|
+
t9 = /*#__PURE__*/jsxs(Fragment, {
|
|
146
|
+
children: [t6, t7, t8]
|
|
137
147
|
});
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
148
|
+
$[16] = t6;
|
|
149
|
+
$[17] = t7;
|
|
150
|
+
$[18] = t8;
|
|
151
|
+
$[19] = t9;
|
|
142
152
|
} else {
|
|
143
|
-
|
|
153
|
+
t9 = $[19];
|
|
144
154
|
}
|
|
145
|
-
const InputChildren =
|
|
155
|
+
const InputChildren = t9;
|
|
146
156
|
const T0 = FormControlContextProvider;
|
|
147
|
-
const
|
|
148
|
-
let
|
|
149
|
-
if ($[
|
|
150
|
-
|
|
157
|
+
const t10 = !isSelectPanelInput;
|
|
158
|
+
let t11;
|
|
159
|
+
if ($[20] !== captionId || $[21] !== disabled || $[22] !== id || $[23] !== labelId || $[24] !== required || $[25] !== t10 || $[26] !== validationMessageId) {
|
|
160
|
+
t11 = {
|
|
151
161
|
captionId,
|
|
152
162
|
disabled,
|
|
153
163
|
id,
|
|
154
164
|
required,
|
|
155
165
|
validationMessageId,
|
|
156
|
-
isReferenced:
|
|
166
|
+
isReferenced: t10,
|
|
157
167
|
labelId
|
|
158
168
|
};
|
|
159
|
-
$[
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
169
|
+
$[20] = captionId;
|
|
170
|
+
$[21] = disabled;
|
|
171
|
+
$[22] = id;
|
|
172
|
+
$[23] = labelId;
|
|
173
|
+
$[24] = required;
|
|
174
|
+
$[25] = t10;
|
|
175
|
+
$[26] = validationMessageId;
|
|
176
|
+
$[27] = t11;
|
|
167
177
|
} else {
|
|
168
|
-
|
|
178
|
+
t11 = $[27];
|
|
169
179
|
}
|
|
170
|
-
const
|
|
180
|
+
const t12 = isChoiceInput || layout === "horizontal" ? /*#__PURE__*/jsx("div", {
|
|
171
181
|
ref: ref,
|
|
172
182
|
"data-has-leading-visual": slots.leadingVisual ? "" : undefined,
|
|
173
183
|
className: clsx(className, classes.ControlHorizontalLayout),
|
|
@@ -189,20 +199,20 @@ const FormControl = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
|
189
199
|
children: slots.validation
|
|
190
200
|
}) : null, slots.caption]
|
|
191
201
|
});
|
|
192
|
-
let
|
|
193
|
-
if ($[
|
|
194
|
-
|
|
195
|
-
value:
|
|
196
|
-
children:
|
|
202
|
+
let t13;
|
|
203
|
+
if ($[28] !== T0 || $[29] !== t11 || $[30] !== t12) {
|
|
204
|
+
t13 = /*#__PURE__*/jsx(T0, {
|
|
205
|
+
value: t11,
|
|
206
|
+
children: t12
|
|
197
207
|
});
|
|
198
|
-
$[
|
|
199
|
-
$[
|
|
200
|
-
$[
|
|
201
|
-
$[
|
|
208
|
+
$[28] = T0;
|
|
209
|
+
$[29] = t11;
|
|
210
|
+
$[30] = t12;
|
|
211
|
+
$[31] = t13;
|
|
202
212
|
} else {
|
|
203
|
-
|
|
213
|
+
t13 = $[31];
|
|
204
214
|
}
|
|
205
|
-
return
|
|
215
|
+
return t13;
|
|
206
216
|
});
|
|
207
217
|
var FormControl$1 = Object.assign(FormControl, {
|
|
208
218
|
__SLOT__: Symbol('FormControl'),
|
package/package.json
CHANGED