@fangzsx/component-library 0.0.11 → 0.0.13
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/Box-DPlM16yK.js +30 -0
- package/dist/ButtonBase-qMhxbNdC.js +878 -0
- package/dist/FormLabel-DKoCtSGZ.js +600 -0
- package/dist/{Paper-CAUsv8qs.js → Paper-DyRh03We.js} +54 -51
- package/dist/SwitchBase-DStPyUhD.js +311 -0
- package/dist/Typography-B0rSrz7H.js +253 -0
- package/dist/components/AppBarPublic/index.js +83 -105
- package/dist/components/Button/index.js +1 -1
- package/dist/components/Checkbox/index.js +103 -607
- package/dist/components/CheckboxGroup/index.d.ts +17 -0
- package/dist/components/CheckboxGroup/index.js +68 -0
- package/dist/components/Dropdown/index.d.ts +22 -0
- package/dist/components/Dropdown/index.js +120 -0
- package/dist/components/LinearProgress/index.d.ts +3 -0
- package/dist/components/LinearProgress/index.js +19 -0
- package/dist/components/MediaCardWithAction/index.js +157 -436
- package/dist/components/RadioButtonGroup/index.d.ts +17 -0
- package/dist/components/RadioButtonGroup/index.js +836 -0
- package/dist/components/TextFieldInput/index.d.ts +15 -0
- package/dist/components/TextFieldInput/index.js +6578 -0
- package/dist/{createSvgIcon-DAI5icic.js → createSvgIcon-Dj0SJuc1.js} +8 -7
- package/dist/generateUtilityClasses-BCID9NF1.js +2806 -0
- package/dist/{index-DGepNtNg.js → index-CoBGCD2e.js} +143 -158
- package/dist/index-o1i1vy-V.js +73 -0
- package/dist/main.d.ts +5 -1
- package/dist/main.js +21 -13
- package/dist/mergeSlotProps-C-n2ing7.js +62 -0
- package/dist/useId-CK6Kn3Tn.js +21 -0
- package/dist/useSlot-S2pEBHE8.js +161 -0
- package/dist/useTimeout-BWi4JTOH.js +635 -0
- package/package.json +1 -1
- package/dist/ButtonBase-CAtBagnK.js +0 -4293
- package/dist/assets/index2.css +0 -1
- package/dist/components/Input/index.d.ts +0 -1
- package/dist/components/Input/index.js +0 -11
|
@@ -0,0 +1,836 @@
|
|
|
1
|
+
import { jsx as l, jsxs as I } from "react/jsx-runtime";
|
|
2
|
+
import * as u from "react";
|
|
3
|
+
import { useState as Z } from "react";
|
|
4
|
+
import { f as X, c as lo, F as io, a as co, b as po } from "../../FormLabel-DKoCtSGZ.js";
|
|
5
|
+
import { a as $, g as B, c as M, P as o } from "../../generateUtilityClasses-BCID9NF1.js";
|
|
6
|
+
import { u as _, c as G, s as N, a as L, m as V, d as Y, r as oo, b as J, h as uo } from "../../useTimeout-BWi4JTOH.js";
|
|
7
|
+
import { a as A, b as eo, u as fo } from "../../useSlot-S2pEBHE8.js";
|
|
8
|
+
import { u as mo } from "../../useId-CK6Kn3Tn.js";
|
|
9
|
+
import { T as K } from "../../Typography-B0rSrz7H.js";
|
|
10
|
+
import { S as bo } from "../../SwitchBase-DStPyUhD.js";
|
|
11
|
+
import { c as ro } from "../../createSvgIcon-Dj0SJuc1.js";
|
|
12
|
+
function yo(e) {
|
|
13
|
+
return B("MuiFormControlLabel", e);
|
|
14
|
+
}
|
|
15
|
+
const E = $("MuiFormControlLabel", ["root", "labelPlacementStart", "labelPlacementTop", "labelPlacementBottom", "disabled", "label", "error", "required", "asterisk"]), ho = (e) => {
|
|
16
|
+
const {
|
|
17
|
+
classes: r,
|
|
18
|
+
disabled: t,
|
|
19
|
+
labelPlacement: s,
|
|
20
|
+
error: a,
|
|
21
|
+
required: i
|
|
22
|
+
} = e, p = {
|
|
23
|
+
root: ["root", t && "disabled", `labelPlacement${M(s)}`, a && "error", i && "required"],
|
|
24
|
+
label: ["label", t && "disabled"],
|
|
25
|
+
asterisk: ["asterisk", a && "error"]
|
|
26
|
+
};
|
|
27
|
+
return L(p, yo, r);
|
|
28
|
+
}, go = N("label", {
|
|
29
|
+
name: "MuiFormControlLabel",
|
|
30
|
+
slot: "Root",
|
|
31
|
+
overridesResolver: (e, r) => {
|
|
32
|
+
const {
|
|
33
|
+
ownerState: t
|
|
34
|
+
} = e;
|
|
35
|
+
return [{
|
|
36
|
+
[`& .${E.label}`]: r.label
|
|
37
|
+
}, r.root, r[`labelPlacement${M(t.labelPlacement)}`]];
|
|
38
|
+
}
|
|
39
|
+
})(V(({
|
|
40
|
+
theme: e
|
|
41
|
+
}) => ({
|
|
42
|
+
display: "inline-flex",
|
|
43
|
+
alignItems: "center",
|
|
44
|
+
cursor: "pointer",
|
|
45
|
+
// For correct alignment with the text.
|
|
46
|
+
verticalAlign: "middle",
|
|
47
|
+
WebkitTapHighlightColor: "transparent",
|
|
48
|
+
marginLeft: -11,
|
|
49
|
+
marginRight: 16,
|
|
50
|
+
// used for row presentation of radio/checkbox
|
|
51
|
+
[`&.${E.disabled}`]: {
|
|
52
|
+
cursor: "default"
|
|
53
|
+
},
|
|
54
|
+
[`& .${E.label}`]: {
|
|
55
|
+
[`&.${E.disabled}`]: {
|
|
56
|
+
color: (e.vars || e).palette.text.disabled
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
variants: [{
|
|
60
|
+
props: {
|
|
61
|
+
labelPlacement: "start"
|
|
62
|
+
},
|
|
63
|
+
style: {
|
|
64
|
+
flexDirection: "row-reverse",
|
|
65
|
+
marginRight: -11
|
|
66
|
+
}
|
|
67
|
+
}, {
|
|
68
|
+
props: {
|
|
69
|
+
labelPlacement: "top"
|
|
70
|
+
},
|
|
71
|
+
style: {
|
|
72
|
+
flexDirection: "column-reverse"
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
props: {
|
|
76
|
+
labelPlacement: "bottom"
|
|
77
|
+
},
|
|
78
|
+
style: {
|
|
79
|
+
flexDirection: "column"
|
|
80
|
+
}
|
|
81
|
+
}, {
|
|
82
|
+
props: ({
|
|
83
|
+
labelPlacement: r
|
|
84
|
+
}) => r === "start" || r === "top" || r === "bottom",
|
|
85
|
+
style: {
|
|
86
|
+
marginLeft: 16
|
|
87
|
+
// used for row presentation of radio/checkbox
|
|
88
|
+
}
|
|
89
|
+
}]
|
|
90
|
+
}))), Co = N("span", {
|
|
91
|
+
name: "MuiFormControlLabel",
|
|
92
|
+
slot: "Asterisk"
|
|
93
|
+
})(V(({
|
|
94
|
+
theme: e
|
|
95
|
+
}) => ({
|
|
96
|
+
[`&.${E.error}`]: {
|
|
97
|
+
color: (e.vars || e).palette.error.main
|
|
98
|
+
}
|
|
99
|
+
}))), to = /* @__PURE__ */ u.forwardRef(function(r, t) {
|
|
100
|
+
const s = _({
|
|
101
|
+
props: r,
|
|
102
|
+
name: "MuiFormControlLabel"
|
|
103
|
+
}), {
|
|
104
|
+
checked: a,
|
|
105
|
+
className: i,
|
|
106
|
+
componentsProps: p = {},
|
|
107
|
+
control: c,
|
|
108
|
+
disabled: d,
|
|
109
|
+
disableTypography: m,
|
|
110
|
+
inputRef: f,
|
|
111
|
+
label: h,
|
|
112
|
+
labelPlacement: P = "end",
|
|
113
|
+
name: S,
|
|
114
|
+
onChange: R,
|
|
115
|
+
required: w,
|
|
116
|
+
slots: b = {},
|
|
117
|
+
slotProps: F = {},
|
|
118
|
+
value: n,
|
|
119
|
+
...y
|
|
120
|
+
} = s, x = A(), j = d ?? c.props.disabled ?? x?.disabled, g = w ?? c.props.required, O = {
|
|
121
|
+
disabled: j,
|
|
122
|
+
required: g
|
|
123
|
+
};
|
|
124
|
+
["checked", "name", "onChange", "value", "inputRef"].forEach((k) => {
|
|
125
|
+
typeof c.props[k] > "u" && typeof s[k] < "u" && (O[k] = s[k]);
|
|
126
|
+
});
|
|
127
|
+
const D = X({
|
|
128
|
+
props: s,
|
|
129
|
+
muiFormControl: x,
|
|
130
|
+
states: ["error"]
|
|
131
|
+
}), v = {
|
|
132
|
+
...s,
|
|
133
|
+
disabled: j,
|
|
134
|
+
labelPlacement: P,
|
|
135
|
+
required: g,
|
|
136
|
+
error: D.error
|
|
137
|
+
}, T = ho(v), q = {
|
|
138
|
+
slots: b,
|
|
139
|
+
slotProps: {
|
|
140
|
+
...p,
|
|
141
|
+
...F
|
|
142
|
+
}
|
|
143
|
+
}, [U, z] = eo("typography", {
|
|
144
|
+
elementType: K,
|
|
145
|
+
externalForwardedProps: q,
|
|
146
|
+
ownerState: v
|
|
147
|
+
});
|
|
148
|
+
let C = h;
|
|
149
|
+
return C != null && C.type !== K && !m && (C = /* @__PURE__ */ l(U, {
|
|
150
|
+
component: "span",
|
|
151
|
+
...z,
|
|
152
|
+
className: G(T.label, z?.className),
|
|
153
|
+
children: C
|
|
154
|
+
})), /* @__PURE__ */ I(go, {
|
|
155
|
+
className: G(T.root, i),
|
|
156
|
+
ownerState: v,
|
|
157
|
+
ref: t,
|
|
158
|
+
...y,
|
|
159
|
+
children: [/* @__PURE__ */ u.cloneElement(c, O), g ? /* @__PURE__ */ I("div", {
|
|
160
|
+
children: [C, /* @__PURE__ */ I(Co, {
|
|
161
|
+
ownerState: v,
|
|
162
|
+
"aria-hidden": !0,
|
|
163
|
+
className: T.asterisk,
|
|
164
|
+
children: [" ", "*"]
|
|
165
|
+
})]
|
|
166
|
+
}) : C]
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
process.env.NODE_ENV !== "production" && (to.propTypes = {
|
|
170
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
171
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
172
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
173
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
174
|
+
/**
|
|
175
|
+
* If `true`, the component appears selected.
|
|
176
|
+
*/
|
|
177
|
+
checked: o.bool,
|
|
178
|
+
/**
|
|
179
|
+
* Override or extend the styles applied to the component.
|
|
180
|
+
*/
|
|
181
|
+
classes: o.object,
|
|
182
|
+
/**
|
|
183
|
+
* @ignore
|
|
184
|
+
*/
|
|
185
|
+
className: o.string,
|
|
186
|
+
/**
|
|
187
|
+
* The props used for each slot inside.
|
|
188
|
+
* @default {}
|
|
189
|
+
* @deprecated use the `slotProps` prop instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
190
|
+
*/
|
|
191
|
+
componentsProps: o.shape({
|
|
192
|
+
typography: o.object
|
|
193
|
+
}),
|
|
194
|
+
/**
|
|
195
|
+
* A control element. For instance, it can be a `Radio`, a `Switch` or a `Checkbox`.
|
|
196
|
+
*/
|
|
197
|
+
control: o.element.isRequired,
|
|
198
|
+
/**
|
|
199
|
+
* If `true`, the control is disabled.
|
|
200
|
+
*/
|
|
201
|
+
disabled: o.bool,
|
|
202
|
+
/**
|
|
203
|
+
* If `true`, the label is rendered as it is passed without an additional typography node.
|
|
204
|
+
*/
|
|
205
|
+
disableTypography: o.bool,
|
|
206
|
+
/**
|
|
207
|
+
* Pass a ref to the `input` element.
|
|
208
|
+
*/
|
|
209
|
+
inputRef: Y,
|
|
210
|
+
/**
|
|
211
|
+
* A text or an element to be used in an enclosing label element.
|
|
212
|
+
*/
|
|
213
|
+
label: o.node,
|
|
214
|
+
/**
|
|
215
|
+
* The position of the label.
|
|
216
|
+
* @default 'end'
|
|
217
|
+
*/
|
|
218
|
+
labelPlacement: o.oneOf(["bottom", "end", "start", "top"]),
|
|
219
|
+
/**
|
|
220
|
+
* @ignore
|
|
221
|
+
*/
|
|
222
|
+
name: o.string,
|
|
223
|
+
/**
|
|
224
|
+
* Callback fired when the state is changed.
|
|
225
|
+
*
|
|
226
|
+
* @param {React.SyntheticEvent} event The event source of the callback.
|
|
227
|
+
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
|
|
228
|
+
*/
|
|
229
|
+
onChange: o.func,
|
|
230
|
+
/**
|
|
231
|
+
* If `true`, the label will indicate that the `input` is required.
|
|
232
|
+
*/
|
|
233
|
+
required: o.bool,
|
|
234
|
+
/**
|
|
235
|
+
* The props used for each slot inside.
|
|
236
|
+
* @default {}
|
|
237
|
+
*/
|
|
238
|
+
slotProps: o.shape({
|
|
239
|
+
typography: o.oneOfType([o.func, o.object])
|
|
240
|
+
}),
|
|
241
|
+
/**
|
|
242
|
+
* The components used for each slot inside.
|
|
243
|
+
* @default {}
|
|
244
|
+
*/
|
|
245
|
+
slots: o.shape({
|
|
246
|
+
typography: o.elementType
|
|
247
|
+
}),
|
|
248
|
+
/**
|
|
249
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
250
|
+
*/
|
|
251
|
+
sx: o.oneOfType([o.arrayOf(o.oneOfType([o.func, o.object, o.bool])), o.func, o.object]),
|
|
252
|
+
/**
|
|
253
|
+
* The value of the component.
|
|
254
|
+
*/
|
|
255
|
+
value: o.any
|
|
256
|
+
});
|
|
257
|
+
const Ro = ro(/* @__PURE__ */ l("path", {
|
|
258
|
+
d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
|
|
259
|
+
}), "RadioButtonUnchecked"), vo = ro(/* @__PURE__ */ l("path", {
|
|
260
|
+
d: "M8.465 8.465C9.37 7.56 10.62 7 12 7C14.76 7 17 9.24 17 12C17 13.38 16.44 14.63 15.535 15.535C14.63 16.44 13.38 17 12 17C9.24 17 7 14.76 7 12C7 10.62 7.56 9.37 8.465 8.465Z"
|
|
261
|
+
}), "RadioButtonChecked"), Po = N("span", {
|
|
262
|
+
name: "MuiRadioButtonIcon",
|
|
263
|
+
shouldForwardProp: oo
|
|
264
|
+
})({
|
|
265
|
+
position: "relative",
|
|
266
|
+
display: "flex"
|
|
267
|
+
}), So = N(Ro, {
|
|
268
|
+
name: "MuiRadioButtonIcon"
|
|
269
|
+
})({
|
|
270
|
+
// Scale applied to prevent dot misalignment in Safari
|
|
271
|
+
transform: "scale(1)"
|
|
272
|
+
}), wo = N(vo, {
|
|
273
|
+
name: "MuiRadioButtonIcon"
|
|
274
|
+
})(V(({
|
|
275
|
+
theme: e
|
|
276
|
+
}) => ({
|
|
277
|
+
left: 0,
|
|
278
|
+
position: "absolute",
|
|
279
|
+
transform: "scale(0)",
|
|
280
|
+
transition: e.transitions.create("transform", {
|
|
281
|
+
easing: e.transitions.easing.easeIn,
|
|
282
|
+
duration: e.transitions.duration.shortest
|
|
283
|
+
}),
|
|
284
|
+
variants: [{
|
|
285
|
+
props: {
|
|
286
|
+
checked: !0
|
|
287
|
+
},
|
|
288
|
+
style: {
|
|
289
|
+
transform: "scale(1)",
|
|
290
|
+
transition: e.transitions.create("transform", {
|
|
291
|
+
easing: e.transitions.easing.easeOut,
|
|
292
|
+
duration: e.transitions.duration.shortest
|
|
293
|
+
})
|
|
294
|
+
}
|
|
295
|
+
}]
|
|
296
|
+
})));
|
|
297
|
+
function H(e) {
|
|
298
|
+
const {
|
|
299
|
+
checked: r = !1,
|
|
300
|
+
classes: t = {},
|
|
301
|
+
fontSize: s
|
|
302
|
+
} = e, a = {
|
|
303
|
+
...e,
|
|
304
|
+
checked: r
|
|
305
|
+
};
|
|
306
|
+
return /* @__PURE__ */ I(Po, {
|
|
307
|
+
className: t.root,
|
|
308
|
+
ownerState: a,
|
|
309
|
+
children: [/* @__PURE__ */ l(So, {
|
|
310
|
+
fontSize: s,
|
|
311
|
+
className: t.background,
|
|
312
|
+
ownerState: a
|
|
313
|
+
}), /* @__PURE__ */ l(wo, {
|
|
314
|
+
fontSize: s,
|
|
315
|
+
className: t.dot,
|
|
316
|
+
ownerState: a
|
|
317
|
+
})]
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
process.env.NODE_ENV !== "production" && (H.propTypes = {
|
|
321
|
+
/**
|
|
322
|
+
* If `true`, the component is checked.
|
|
323
|
+
*/
|
|
324
|
+
checked: o.bool,
|
|
325
|
+
/**
|
|
326
|
+
* Override or extend the styles applied to the component.
|
|
327
|
+
*/
|
|
328
|
+
classes: o.object,
|
|
329
|
+
/**
|
|
330
|
+
* The size of the component.
|
|
331
|
+
* `small` is equivalent to the dense radio styling.
|
|
332
|
+
*/
|
|
333
|
+
fontSize: o.oneOf(["small", "medium"])
|
|
334
|
+
});
|
|
335
|
+
const W = /* @__PURE__ */ u.createContext(void 0);
|
|
336
|
+
process.env.NODE_ENV !== "production" && (W.displayName = "RadioGroupContext");
|
|
337
|
+
function Fo() {
|
|
338
|
+
return u.useContext(W);
|
|
339
|
+
}
|
|
340
|
+
function To(e) {
|
|
341
|
+
return B("MuiRadio", e);
|
|
342
|
+
}
|
|
343
|
+
const Q = $("MuiRadio", ["root", "checked", "disabled", "colorPrimary", "colorSecondary", "sizeSmall"]), ko = (e) => {
|
|
344
|
+
const {
|
|
345
|
+
classes: r,
|
|
346
|
+
color: t,
|
|
347
|
+
size: s
|
|
348
|
+
} = e, a = {
|
|
349
|
+
root: ["root", `color${M(t)}`, s !== "medium" && `size${M(s)}`]
|
|
350
|
+
};
|
|
351
|
+
return {
|
|
352
|
+
...r,
|
|
353
|
+
...L(a, To, r)
|
|
354
|
+
};
|
|
355
|
+
}, No = N(bo, {
|
|
356
|
+
shouldForwardProp: (e) => oo(e) || e === "classes",
|
|
357
|
+
name: "MuiRadio",
|
|
358
|
+
slot: "Root",
|
|
359
|
+
overridesResolver: (e, r) => {
|
|
360
|
+
const {
|
|
361
|
+
ownerState: t
|
|
362
|
+
} = e;
|
|
363
|
+
return [r.root, t.size !== "medium" && r[`size${M(t.size)}`], r[`color${M(t.color)}`]];
|
|
364
|
+
}
|
|
365
|
+
})(V(({
|
|
366
|
+
theme: e
|
|
367
|
+
}) => ({
|
|
368
|
+
color: (e.vars || e).palette.text.secondary,
|
|
369
|
+
[`&.${Q.disabled}`]: {
|
|
370
|
+
color: (e.vars || e).palette.action.disabled
|
|
371
|
+
},
|
|
372
|
+
variants: [{
|
|
373
|
+
props: {
|
|
374
|
+
color: "default",
|
|
375
|
+
disabled: !1,
|
|
376
|
+
disableRipple: !1
|
|
377
|
+
},
|
|
378
|
+
style: {
|
|
379
|
+
"&:hover": {
|
|
380
|
+
backgroundColor: e.alpha((e.vars || e).palette.action.active, (e.vars || e).palette.action.hoverOpacity)
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}, ...Object.entries(e.palette).filter(J()).map(([r]) => ({
|
|
384
|
+
props: {
|
|
385
|
+
color: r,
|
|
386
|
+
disabled: !1,
|
|
387
|
+
disableRipple: !1
|
|
388
|
+
},
|
|
389
|
+
style: {
|
|
390
|
+
"&:hover": {
|
|
391
|
+
backgroundColor: e.alpha((e.vars || e).palette[r].main, (e.vars || e).palette.action.hoverOpacity)
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
})), ...Object.entries(e.palette).filter(J()).map(([r]) => ({
|
|
395
|
+
props: {
|
|
396
|
+
color: r,
|
|
397
|
+
disabled: !1
|
|
398
|
+
},
|
|
399
|
+
style: {
|
|
400
|
+
[`&.${Q.checked}`]: {
|
|
401
|
+
color: (e.vars || e).palette[r].main
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
})), {
|
|
405
|
+
// Should be last to override other colors
|
|
406
|
+
props: {
|
|
407
|
+
disableRipple: !1
|
|
408
|
+
},
|
|
409
|
+
style: {
|
|
410
|
+
// Reset on touch devices, it doesn't add specificity
|
|
411
|
+
"&:hover": {
|
|
412
|
+
"@media (hover: none)": {
|
|
413
|
+
backgroundColor: "transparent"
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}]
|
|
418
|
+
})));
|
|
419
|
+
function xo(e, r) {
|
|
420
|
+
return typeof r == "object" && r !== null ? e === r : String(e) === String(r);
|
|
421
|
+
}
|
|
422
|
+
const Oo = /* @__PURE__ */ l(H, {
|
|
423
|
+
checked: !0
|
|
424
|
+
}), Mo = /* @__PURE__ */ l(H, {}), so = /* @__PURE__ */ u.forwardRef(function(r, t) {
|
|
425
|
+
const s = _({
|
|
426
|
+
props: r,
|
|
427
|
+
name: "MuiRadio"
|
|
428
|
+
}), {
|
|
429
|
+
checked: a,
|
|
430
|
+
checkedIcon: i = Oo,
|
|
431
|
+
color: p = "primary",
|
|
432
|
+
icon: c = Mo,
|
|
433
|
+
name: d,
|
|
434
|
+
onChange: m,
|
|
435
|
+
size: f = "medium",
|
|
436
|
+
className: h,
|
|
437
|
+
disabled: P,
|
|
438
|
+
disableRipple: S = !1,
|
|
439
|
+
slots: R = {},
|
|
440
|
+
slotProps: w = {},
|
|
441
|
+
inputProps: b,
|
|
442
|
+
...F
|
|
443
|
+
} = s, n = A();
|
|
444
|
+
let y = P;
|
|
445
|
+
n && typeof y > "u" && (y = n.disabled), y ??= !1;
|
|
446
|
+
const x = {
|
|
447
|
+
...s,
|
|
448
|
+
disabled: y,
|
|
449
|
+
disableRipple: S,
|
|
450
|
+
color: p,
|
|
451
|
+
size: f
|
|
452
|
+
}, j = ko(x), g = Fo();
|
|
453
|
+
let O = a;
|
|
454
|
+
const D = lo(m, g && g.onChange);
|
|
455
|
+
let v = d;
|
|
456
|
+
g && (typeof O > "u" && (O = xo(g.value, s.value)), typeof v > "u" && (v = g.name));
|
|
457
|
+
const T = w.input ?? b, [q, U] = eo("root", {
|
|
458
|
+
ref: t,
|
|
459
|
+
elementType: No,
|
|
460
|
+
className: G(j.root, h),
|
|
461
|
+
shouldForwardComponentProp: !0,
|
|
462
|
+
externalForwardedProps: {
|
|
463
|
+
slots: R,
|
|
464
|
+
slotProps: w,
|
|
465
|
+
...F
|
|
466
|
+
},
|
|
467
|
+
getSlotProps: (z) => ({
|
|
468
|
+
...z,
|
|
469
|
+
onChange: (C, ...k) => {
|
|
470
|
+
z.onChange?.(C, ...k), D(C, ...k);
|
|
471
|
+
}
|
|
472
|
+
}),
|
|
473
|
+
ownerState: x,
|
|
474
|
+
additionalProps: {
|
|
475
|
+
type: "radio",
|
|
476
|
+
icon: /* @__PURE__ */ u.cloneElement(c, {
|
|
477
|
+
fontSize: c.props.fontSize ?? f
|
|
478
|
+
}),
|
|
479
|
+
checkedIcon: /* @__PURE__ */ u.cloneElement(i, {
|
|
480
|
+
fontSize: i.props.fontSize ?? f
|
|
481
|
+
}),
|
|
482
|
+
disabled: y,
|
|
483
|
+
name: v,
|
|
484
|
+
checked: O,
|
|
485
|
+
slots: R,
|
|
486
|
+
slotProps: {
|
|
487
|
+
// Do not forward `slotProps.root` again because it's already handled by the `RootSlot` in this file.
|
|
488
|
+
input: typeof T == "function" ? T(x) : T
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
return /* @__PURE__ */ l(q, {
|
|
493
|
+
...U,
|
|
494
|
+
classes: j
|
|
495
|
+
});
|
|
496
|
+
});
|
|
497
|
+
process.env.NODE_ENV !== "production" && (so.propTypes = {
|
|
498
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
499
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
500
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
501
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
502
|
+
/**
|
|
503
|
+
* If `true`, the component is checked.
|
|
504
|
+
*/
|
|
505
|
+
checked: o.bool,
|
|
506
|
+
/**
|
|
507
|
+
* The icon to display when the component is checked.
|
|
508
|
+
* @default <RadioButtonIcon checked />
|
|
509
|
+
*/
|
|
510
|
+
checkedIcon: o.node,
|
|
511
|
+
/**
|
|
512
|
+
* Override or extend the styles applied to the component.
|
|
513
|
+
*/
|
|
514
|
+
classes: o.object,
|
|
515
|
+
/**
|
|
516
|
+
* @ignore
|
|
517
|
+
*/
|
|
518
|
+
className: o.string,
|
|
519
|
+
/**
|
|
520
|
+
* The color of the component.
|
|
521
|
+
* It supports both default and custom theme colors, which can be added as shown in the
|
|
522
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
523
|
+
* @default 'primary'
|
|
524
|
+
*/
|
|
525
|
+
color: o.oneOfType([o.oneOf(["default", "primary", "secondary", "error", "info", "success", "warning"]), o.string]),
|
|
526
|
+
/**
|
|
527
|
+
* If `true`, the component is disabled.
|
|
528
|
+
*/
|
|
529
|
+
disabled: o.bool,
|
|
530
|
+
/**
|
|
531
|
+
* If `true`, the ripple effect is disabled.
|
|
532
|
+
* @default false
|
|
533
|
+
*/
|
|
534
|
+
disableRipple: o.bool,
|
|
535
|
+
/**
|
|
536
|
+
* The icon to display when the component is unchecked.
|
|
537
|
+
* @default <RadioButtonIcon />
|
|
538
|
+
*/
|
|
539
|
+
icon: o.node,
|
|
540
|
+
/**
|
|
541
|
+
* The id of the `input` element.
|
|
542
|
+
*/
|
|
543
|
+
id: o.string,
|
|
544
|
+
/**
|
|
545
|
+
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#attributes) applied to the `input` element.
|
|
546
|
+
* @deprecated Use `slotProps.input` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
547
|
+
*/
|
|
548
|
+
inputProps: o.object,
|
|
549
|
+
/**
|
|
550
|
+
* Pass a ref to the `input` element.
|
|
551
|
+
* @deprecated Use `slotProps.input.ref` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
552
|
+
*/
|
|
553
|
+
inputRef: Y,
|
|
554
|
+
/**
|
|
555
|
+
* Name attribute of the `input` element.
|
|
556
|
+
*/
|
|
557
|
+
name: o.string,
|
|
558
|
+
/**
|
|
559
|
+
* Callback fired when the state is changed.
|
|
560
|
+
*
|
|
561
|
+
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
562
|
+
* You can pull out the new value by accessing `event.target.value` (string).
|
|
563
|
+
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
|
|
564
|
+
*/
|
|
565
|
+
onChange: o.func,
|
|
566
|
+
/**
|
|
567
|
+
* If `true`, the `input` element is required.
|
|
568
|
+
* @default false
|
|
569
|
+
*/
|
|
570
|
+
required: o.bool,
|
|
571
|
+
/**
|
|
572
|
+
* The size of the component.
|
|
573
|
+
* `small` is equivalent to the dense radio styling.
|
|
574
|
+
* @default 'medium'
|
|
575
|
+
*/
|
|
576
|
+
size: o.oneOfType([o.oneOf(["medium", "small"]), o.string]),
|
|
577
|
+
/**
|
|
578
|
+
* The props used for each slot inside.
|
|
579
|
+
* @default {}
|
|
580
|
+
*/
|
|
581
|
+
slotProps: o.shape({
|
|
582
|
+
input: o.oneOfType([o.func, o.object]),
|
|
583
|
+
root: o.oneOfType([o.func, o.object])
|
|
584
|
+
}),
|
|
585
|
+
/**
|
|
586
|
+
* The components used for each slot inside.
|
|
587
|
+
* @default {}
|
|
588
|
+
*/
|
|
589
|
+
slots: o.shape({
|
|
590
|
+
input: o.elementType,
|
|
591
|
+
root: o.elementType
|
|
592
|
+
}),
|
|
593
|
+
/**
|
|
594
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
595
|
+
*/
|
|
596
|
+
sx: o.oneOfType([o.arrayOf(o.oneOfType([o.func, o.object, o.bool])), o.func, o.object]),
|
|
597
|
+
/**
|
|
598
|
+
* The value of the component. The DOM API casts this to a string.
|
|
599
|
+
*/
|
|
600
|
+
value: o.any
|
|
601
|
+
});
|
|
602
|
+
function jo(e) {
|
|
603
|
+
return B("MuiFormGroup", e);
|
|
604
|
+
}
|
|
605
|
+
$("MuiFormGroup", ["root", "row", "error"]);
|
|
606
|
+
const zo = (e) => {
|
|
607
|
+
const {
|
|
608
|
+
classes: r,
|
|
609
|
+
row: t,
|
|
610
|
+
error: s
|
|
611
|
+
} = e;
|
|
612
|
+
return L({
|
|
613
|
+
root: ["root", t && "row", s && "error"]
|
|
614
|
+
}, jo, r);
|
|
615
|
+
}, Eo = N("div", {
|
|
616
|
+
name: "MuiFormGroup",
|
|
617
|
+
slot: "Root",
|
|
618
|
+
overridesResolver: (e, r) => {
|
|
619
|
+
const {
|
|
620
|
+
ownerState: t
|
|
621
|
+
} = e;
|
|
622
|
+
return [r.root, t.row && r.row];
|
|
623
|
+
}
|
|
624
|
+
})({
|
|
625
|
+
display: "flex",
|
|
626
|
+
flexDirection: "column",
|
|
627
|
+
flexWrap: "wrap",
|
|
628
|
+
variants: [{
|
|
629
|
+
props: {
|
|
630
|
+
row: !0
|
|
631
|
+
},
|
|
632
|
+
style: {
|
|
633
|
+
flexDirection: "row"
|
|
634
|
+
}
|
|
635
|
+
}]
|
|
636
|
+
}), ao = /* @__PURE__ */ u.forwardRef(function(r, t) {
|
|
637
|
+
const s = _({
|
|
638
|
+
props: r,
|
|
639
|
+
name: "MuiFormGroup"
|
|
640
|
+
}), {
|
|
641
|
+
className: a,
|
|
642
|
+
row: i = !1,
|
|
643
|
+
...p
|
|
644
|
+
} = s, c = A(), d = X({
|
|
645
|
+
props: s,
|
|
646
|
+
muiFormControl: c,
|
|
647
|
+
states: ["error"]
|
|
648
|
+
}), m = {
|
|
649
|
+
...s,
|
|
650
|
+
row: i,
|
|
651
|
+
error: d.error
|
|
652
|
+
}, f = zo(m);
|
|
653
|
+
return /* @__PURE__ */ l(Eo, {
|
|
654
|
+
className: G(f.root, a),
|
|
655
|
+
ownerState: m,
|
|
656
|
+
ref: t,
|
|
657
|
+
...p
|
|
658
|
+
});
|
|
659
|
+
});
|
|
660
|
+
process.env.NODE_ENV !== "production" && (ao.propTypes = {
|
|
661
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
662
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
663
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
664
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
665
|
+
/**
|
|
666
|
+
* The content of the component.
|
|
667
|
+
*/
|
|
668
|
+
children: o.node,
|
|
669
|
+
/**
|
|
670
|
+
* Override or extend the styles applied to the component.
|
|
671
|
+
*/
|
|
672
|
+
classes: o.object,
|
|
673
|
+
/**
|
|
674
|
+
* @ignore
|
|
675
|
+
*/
|
|
676
|
+
className: o.string,
|
|
677
|
+
/**
|
|
678
|
+
* Display group of elements in a compact row.
|
|
679
|
+
* @default false
|
|
680
|
+
*/
|
|
681
|
+
row: o.bool,
|
|
682
|
+
/**
|
|
683
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
684
|
+
*/
|
|
685
|
+
sx: o.oneOfType([o.arrayOf(o.oneOfType([o.func, o.object, o.bool])), o.func, o.object])
|
|
686
|
+
});
|
|
687
|
+
function Io(e) {
|
|
688
|
+
return B("MuiRadioGroup", e);
|
|
689
|
+
}
|
|
690
|
+
$("MuiRadioGroup", ["root", "row", "error"]);
|
|
691
|
+
const Go = (e) => {
|
|
692
|
+
const {
|
|
693
|
+
classes: r,
|
|
694
|
+
row: t,
|
|
695
|
+
error: s
|
|
696
|
+
} = e;
|
|
697
|
+
return L({
|
|
698
|
+
root: ["root", t && "row", s && "error"]
|
|
699
|
+
}, Io, r);
|
|
700
|
+
}, no = /* @__PURE__ */ u.forwardRef(function(r, t) {
|
|
701
|
+
const {
|
|
702
|
+
// private
|
|
703
|
+
// eslint-disable-next-line react/prop-types
|
|
704
|
+
actions: s,
|
|
705
|
+
children: a,
|
|
706
|
+
className: i,
|
|
707
|
+
defaultValue: p,
|
|
708
|
+
name: c,
|
|
709
|
+
onChange: d,
|
|
710
|
+
value: m,
|
|
711
|
+
...f
|
|
712
|
+
} = r, h = u.useRef(null), P = Go(r), [S, R] = fo({
|
|
713
|
+
controlled: m,
|
|
714
|
+
default: p,
|
|
715
|
+
name: "RadioGroup"
|
|
716
|
+
});
|
|
717
|
+
u.useImperativeHandle(s, () => ({
|
|
718
|
+
focus: () => {
|
|
719
|
+
let n = h.current.querySelector("input:not(:disabled):checked");
|
|
720
|
+
n || (n = h.current.querySelector("input:not(:disabled)")), n && n.focus();
|
|
721
|
+
}
|
|
722
|
+
}), []);
|
|
723
|
+
const w = uo(t, h), b = mo(c), F = u.useMemo(() => ({
|
|
724
|
+
name: b,
|
|
725
|
+
onChange(n) {
|
|
726
|
+
R(n.target.value), d && d(n, n.target.value);
|
|
727
|
+
},
|
|
728
|
+
value: S
|
|
729
|
+
}), [b, d, R, S]);
|
|
730
|
+
return /* @__PURE__ */ l(W.Provider, {
|
|
731
|
+
value: F,
|
|
732
|
+
children: /* @__PURE__ */ l(ao, {
|
|
733
|
+
role: "radiogroup",
|
|
734
|
+
ref: w,
|
|
735
|
+
className: G(P.root, i),
|
|
736
|
+
...f,
|
|
737
|
+
children: a
|
|
738
|
+
})
|
|
739
|
+
});
|
|
740
|
+
});
|
|
741
|
+
process.env.NODE_ENV !== "production" && (no.propTypes = {
|
|
742
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
743
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
744
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
745
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
746
|
+
/**
|
|
747
|
+
* The content of the component.
|
|
748
|
+
*/
|
|
749
|
+
children: o.node,
|
|
750
|
+
/**
|
|
751
|
+
* @ignore
|
|
752
|
+
*/
|
|
753
|
+
className: o.string,
|
|
754
|
+
/**
|
|
755
|
+
* The default value. Use when the component is not controlled.
|
|
756
|
+
*/
|
|
757
|
+
defaultValue: o.any,
|
|
758
|
+
/**
|
|
759
|
+
* The name used to reference the value of the control.
|
|
760
|
+
* If you don't provide this prop, it falls back to a randomly generated name.
|
|
761
|
+
*/
|
|
762
|
+
name: o.string,
|
|
763
|
+
/**
|
|
764
|
+
* Callback fired when a radio button is selected.
|
|
765
|
+
*
|
|
766
|
+
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
767
|
+
* @param {string} value The value of the selected radio button.
|
|
768
|
+
* You can pull out the new value by accessing `event.target.value` (string).
|
|
769
|
+
*/
|
|
770
|
+
onChange: o.func,
|
|
771
|
+
/**
|
|
772
|
+
* Value of the selected radio button. The DOM API casts this to a string.
|
|
773
|
+
*/
|
|
774
|
+
value: o.any
|
|
775
|
+
});
|
|
776
|
+
function Wo({
|
|
777
|
+
label: e,
|
|
778
|
+
options: r,
|
|
779
|
+
defaultValue: t,
|
|
780
|
+
required: s = !1,
|
|
781
|
+
errorMessage: a = "Please select an option",
|
|
782
|
+
helperText: i,
|
|
783
|
+
onChange: p,
|
|
784
|
+
row: c = !1,
|
|
785
|
+
direction: d,
|
|
786
|
+
sx: m
|
|
787
|
+
}) {
|
|
788
|
+
const [f, h] = Z(t || ""), [P, S] = Z(!1), R = (n) => {
|
|
789
|
+
const y = n.target.value;
|
|
790
|
+
h(y), S(!0), p && p(y);
|
|
791
|
+
}, b = P && s && f === "", F = d ? d === "row" : c;
|
|
792
|
+
return /* @__PURE__ */ I(
|
|
793
|
+
io,
|
|
794
|
+
{
|
|
795
|
+
error: b,
|
|
796
|
+
required: s,
|
|
797
|
+
sx: {
|
|
798
|
+
"& .MuiFormHelperText-root": {
|
|
799
|
+
marginLeft: 0,
|
|
800
|
+
marginRight: 0
|
|
801
|
+
},
|
|
802
|
+
...m
|
|
803
|
+
},
|
|
804
|
+
children: [
|
|
805
|
+
e && /* @__PURE__ */ l(co, { children: e }),
|
|
806
|
+
/* @__PURE__ */ l(
|
|
807
|
+
no,
|
|
808
|
+
{
|
|
809
|
+
value: f,
|
|
810
|
+
onChange: R,
|
|
811
|
+
row: F,
|
|
812
|
+
children: r.map((n) => /* @__PURE__ */ l(
|
|
813
|
+
to,
|
|
814
|
+
{
|
|
815
|
+
value: n.value,
|
|
816
|
+
control: /* @__PURE__ */ l(so, {}),
|
|
817
|
+
label: n.label,
|
|
818
|
+
sx: {
|
|
819
|
+
"& .MuiFormControlLabel-label": {
|
|
820
|
+
color: "#404A58",
|
|
821
|
+
fontSize: "16px"
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
},
|
|
825
|
+
n.value
|
|
826
|
+
))
|
|
827
|
+
}
|
|
828
|
+
),
|
|
829
|
+
(b || i) && /* @__PURE__ */ l(po, { children: b ? a : i || " " })
|
|
830
|
+
]
|
|
831
|
+
}
|
|
832
|
+
);
|
|
833
|
+
}
|
|
834
|
+
export {
|
|
835
|
+
Wo as RadioButtonGroup
|
|
836
|
+
};
|