@gnwebsoft/ui 2.18.25 → 2.18.27

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.
@@ -0,0 +1,1431 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunk6JZ35VQJjs = require('./chunk-6JZ35VQJ.js');
4
+
5
+
6
+ var _chunkDKBPCLECjs = require('./chunk-DKBPCLEC.js');
7
+
8
+ // src/wrappers2/DatePickerElement/DatePickerElement.tsx
9
+
10
+
11
+ var _reacthookform = require('react-hook-form');
12
+ var _material = require('@mui/material');
13
+
14
+
15
+ var _xdatepickers = require('@mui/x-date-pickers');
16
+ var _internals = require('@mui/x-date-pickers/internals');
17
+ var _jsxruntime = require('react/jsx-runtime');
18
+ var Component = function DatePickerElement(props) {
19
+ const {
20
+ parseError,
21
+ name,
22
+ required,
23
+ rules = {},
24
+ inputProps,
25
+ control,
26
+ textReadOnly,
27
+ label,
28
+ placeholder,
29
+ gridProps,
30
+ slotProps,
31
+ transform,
32
+ datePickerProps = {},
33
+ ...rest
34
+ } = props;
35
+ const adapter = _internals.useLocalizationContext.call(void 0, );
36
+ const { disabled, inputRef, onClose, ...restDatePickerProps } = datePickerProps;
37
+ const {
38
+ field,
39
+ fieldState: { error }
40
+ } = _reacthookform.useController.call(void 0, {
41
+ name,
42
+ control,
43
+ disabled,
44
+ defaultValue: null
45
+ });
46
+ const { value, onChange } = _chunk6JZ35VQJjs.useTransform.call(void 0, {
47
+ value: field.value,
48
+ onChange: field.onChange,
49
+ transform: {
50
+ input: typeof _optionalChain([transform, 'optionalAccess', _3 => _3.input]) === "function" ? transform.input : (newValue) => _chunkDKBPCLECjs.readValueAsDate.call(void 0, adapter, newValue),
51
+ output: typeof _optionalChain([transform, 'optionalAccess', _4 => _4.output]) === "function" ? transform.output : (newValue) => newValue
52
+ }
53
+ });
54
+ const handleInputRef = _material.useForkRef.call(void 0, field.ref, inputRef);
55
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
56
+ _xdatepickers.DatePicker,
57
+ {
58
+ ...rest,
59
+ ...restDatePickerProps,
60
+ ...field,
61
+ value,
62
+ label,
63
+ ...datePickerProps,
64
+ inputRef: handleInputRef,
65
+ onClose: (...args) => {
66
+ field.onBlur();
67
+ if (onClose) {
68
+ onClose(...args);
69
+ }
70
+ },
71
+ onChange: (newValue, context) => {
72
+ onChange(newValue, context);
73
+ if (typeof datePickerProps.onChange === "function") {
74
+ datePickerProps.onChange(newValue, context);
75
+ }
76
+ },
77
+ sx: {
78
+ "& .MuiInputBase-input": {
79
+ cursor: disabled ? "not-allowed" : "default"
80
+ },
81
+ bgcolor: disabled ? "#EEF1F5" : "transparent"
82
+ },
83
+ slotProps: {
84
+ ...slotProps,
85
+ textField: {
86
+ ...inputProps,
87
+ required,
88
+ placeholder,
89
+ fullWidth: true,
90
+ onBlur: (event) => {
91
+ field.onBlur();
92
+ if (typeof _optionalChain([inputProps, 'optionalAccess', _5 => _5.onBlur]) === "function") {
93
+ inputProps.onBlur(event);
94
+ }
95
+ },
96
+ error: !!error,
97
+ helperText: error ? error.message : _optionalChain([inputProps, 'optionalAccess', _6 => _6.helperText]) || rest.helperText,
98
+ inputProps: {
99
+ readOnly: !!textReadOnly,
100
+ ..._optionalChain([inputProps, 'optionalAccess', _7 => _7.inputProps])
101
+ }
102
+ }
103
+ }
104
+ }
105
+ );
106
+ };
107
+ var DatePickerElement2 = ({
108
+ gridProps,
109
+ ...props
110
+ }) => {
111
+ if (gridProps) {
112
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid2, { ...gridProps, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component, { ...props }) });
113
+ }
114
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component, { ...props });
115
+ };
116
+ DatePickerElement2.displayName = "DatePickerElement";
117
+ var DatePickerElement_default = DatePickerElement2;
118
+
119
+ // src/wrappers2/PasswordElement/PasswordElement.tsx
120
+ var _react = require('react'); var React = _interopRequireWildcard(_react);
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+ var _Visibility = require('@mui/icons-material/Visibility'); var _Visibility2 = _interopRequireDefault(_Visibility);
129
+ var _VisibilityOff = require('@mui/icons-material/VisibilityOff'); var _VisibilityOff2 = _interopRequireDefault(_VisibilityOff);
130
+
131
+
132
+
133
+
134
+ var Component2 = function PasswordEl(props) {
135
+ const {
136
+ type,
137
+ required,
138
+ iconColor,
139
+ renderIcon = (password2) => password2 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Visibility2.default, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _VisibilityOff2.default, {}),
140
+ slotProps,
141
+ name,
142
+ control,
143
+ component: TextFieldComponent = _material.TextField,
144
+ inputRef,
145
+ onBlur,
146
+ ...rest
147
+ } = props;
148
+ const [password, setPassword] = _react.useState.call(void 0, true);
149
+ const endAdornment = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.InputAdornment, { position: "end", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
150
+ _material.IconButton,
151
+ {
152
+ onMouseDown: (e) => e.preventDefault(),
153
+ onClick: () => setPassword(!password),
154
+ tabIndex: -1,
155
+ color: _nullishCoalesce(iconColor, () => ( "default")),
156
+ children: renderIcon(password)
157
+ }
158
+ ) });
159
+ const {
160
+ field,
161
+ fieldState: { error }
162
+ } = _reacthookform.useController.call(void 0, {
163
+ name,
164
+ control
165
+ });
166
+ const handleInputRef = _material.useForkRef.call(void 0, field.ref, inputRef);
167
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
168
+ _material.TextField,
169
+ {
170
+ ...rest,
171
+ inputRef: handleInputRef,
172
+ type: password ? "password" : "text",
173
+ value: field.value,
174
+ fullWidth: true,
175
+ onChange: (event) => {
176
+ field.onChange(event);
177
+ if (typeof rest.onChange === "function") {
178
+ rest.onChange(event);
179
+ }
180
+ },
181
+ onBlur: (event) => {
182
+ field.onBlur();
183
+ if (typeof onBlur === "function") {
184
+ onBlur(event);
185
+ }
186
+ },
187
+ ...typeof slotProps === "undefined" ? {
188
+ InputProps: {
189
+ endAdornment
190
+ }
191
+ } : {
192
+ slotProps: {
193
+ ...slotProps,
194
+ input: {
195
+ endAdornment,
196
+ ..._optionalChain([slotProps, 'optionalAccess', _8 => _8.input])
197
+ }
198
+ }
199
+ },
200
+ error: !!error,
201
+ helperText: error ? error.message : ""
202
+ }
203
+ );
204
+ };
205
+ var PasswordElement = ({
206
+ gridProps,
207
+ ...props
208
+ }) => {
209
+ if (gridProps) {
210
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid2, { ...gridProps, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component2, { ...props }) });
211
+ }
212
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component2, { ...props });
213
+ };
214
+ PasswordElement.displayName = "PasswordElement";
215
+ var PasswordElement_default = PasswordElement;
216
+
217
+ // src/wrappers2/RadioButtonGroup/RadioButtonGroup.tsx
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+ var Component3 = function RadioButtonGroup(props) {
234
+ const {
235
+ helperText,
236
+ options,
237
+ label,
238
+ name,
239
+ parseError,
240
+ labelKey = "label",
241
+ valueKey = "id",
242
+ disabledKey = "disabled",
243
+ required,
244
+ emptyOptionLabel,
245
+ returnObject,
246
+ row,
247
+ control,
248
+ type,
249
+ labelProps,
250
+ disabled,
251
+ formLabelProps,
252
+ radioProps,
253
+ transform,
254
+ rules = {},
255
+ ...rest
256
+ } = props;
257
+ const theme = _material.useTheme.call(void 0, );
258
+ const {
259
+ field,
260
+ fieldState: { error }
261
+ } = _reacthookform.useController.call(void 0, {
262
+ name,
263
+ disabled,
264
+ control
265
+ });
266
+ const { value, onChange } = _chunk6JZ35VQJjs.useTransform.call(void 0, {
267
+ value: field.value,
268
+ onChange: field.onChange,
269
+ transform: {
270
+ input: typeof _optionalChain([transform, 'optionalAccess', _9 => _9.input]) === "function" ? transform.input : (value2) => {
271
+ return value2 || "";
272
+ },
273
+ output: typeof _optionalChain([transform, 'optionalAccess', _10 => _10.output]) === "function" ? _optionalChain([transform, 'optionalAccess', _11 => _11.output]) : (_event, value2) => {
274
+ if (value2 && type === "number") {
275
+ return Number(value2);
276
+ }
277
+ return value2;
278
+ }
279
+ }
280
+ });
281
+ const onRadioChange = (event, radioValue) => {
282
+ const returnValue = returnObject ? options.find((items) => items[valueKey] === radioValue) : radioValue;
283
+ onChange(event, returnValue);
284
+ if (typeof rest.onChange === "function") {
285
+ rest.onChange(returnValue);
286
+ }
287
+ };
288
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.FormControl, { error: !!error, children: [
289
+ label && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.FormLabel, { ...formLabelProps, required, error: !!error, children: label }),
290
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.RadioGroup, { onChange: onRadioChange, name, row, value, children: [
291
+ emptyOptionLabel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
292
+ _material.FormControlLabel,
293
+ {
294
+ ...labelProps,
295
+ control: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
296
+ _material.Radio,
297
+ {
298
+ ...radioProps,
299
+ sx: {
300
+ color: error ? theme.palette.error.main : void 0
301
+ },
302
+ checked: !value
303
+ }
304
+ ),
305
+ label: emptyOptionLabel,
306
+ value: ""
307
+ }
308
+ ),
309
+ options.map((option) => {
310
+ const optionKey = option[valueKey];
311
+ const optionDisabled = option[disabledKey] || false;
312
+ if (optionKey === void 0) {
313
+ console.error(
314
+ `RadioButtonGroup: valueKey ${valueKey} does not exist on option`,
315
+ option
316
+ );
317
+ }
318
+ let val = returnObject ? _optionalChain([value, 'optionalAccess', _12 => _12[valueKey]]) : value;
319
+ if (type === "number") {
320
+ val = Number(val);
321
+ }
322
+ const isChecked = val === optionKey;
323
+ return /* @__PURE__ */ _react.createElement.call(void 0,
324
+ _material.FormControlLabel,
325
+ {
326
+ ...labelProps,
327
+ control: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
328
+ _material.Radio,
329
+ {
330
+ ...radioProps,
331
+ sx: {
332
+ color: error ? theme.palette.error.main : void 0
333
+ },
334
+ disabled: disabled || optionDisabled,
335
+ checked: isChecked
336
+ }
337
+ ),
338
+ value: optionKey,
339
+ label: option[labelKey],
340
+ key: optionKey
341
+ }
342
+ );
343
+ })
344
+ ] }),
345
+ error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.FormHelperText, { children: error.message })
346
+ ] });
347
+ };
348
+ var RadioButtonGroup2 = ({
349
+ gridProps,
350
+ ...props
351
+ }) => {
352
+ if (gridProps) {
353
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid2, { ...gridProps, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component3, { ...props }) });
354
+ }
355
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component3, { ...props });
356
+ };
357
+ RadioButtonGroup2.displayName = "RadioButtonGroup";
358
+ var RadioButtonGroup_default = RadioButtonGroup2;
359
+
360
+ // src/wrappers2/TextFieldElement/TextFieldElement.tsx
361
+
362
+
363
+
364
+
365
+
366
+
367
+
368
+
369
+
370
+ var Component4 = function TextFieldElement(props) {
371
+ const {
372
+ rules = {},
373
+ parseError,
374
+ name,
375
+ control,
376
+ component: TextFieldComponent = _material.TextField,
377
+ gridProps,
378
+ transform,
379
+ label,
380
+ placeholder,
381
+ textFieldProps = {},
382
+ ...rest
383
+ } = props;
384
+ const {
385
+ type,
386
+ required,
387
+ helperText,
388
+ inputRef,
389
+ onBlur,
390
+ disabled,
391
+ ...restTextProps
392
+ } = textFieldProps;
393
+ const {
394
+ field,
395
+ fieldState: { error }
396
+ } = _reacthookform.useController.call(void 0, {
397
+ name,
398
+ control,
399
+ disabled
400
+ });
401
+ const { value, onChange } = _chunk6JZ35VQJjs.useTransform.call(void 0, {
402
+ value: field.value,
403
+ onChange: field.onChange,
404
+ transform: {
405
+ input: typeof _optionalChain([transform, 'optionalAccess', _13 => _13.input]) === "function" ? transform.input : (value2) => {
406
+ return _nullishCoalesce(value2, () => ( ""));
407
+ },
408
+ output: typeof _optionalChain([transform, 'optionalAccess', _14 => _14.output]) === "function" ? transform.output : (event) => {
409
+ const value2 = event.target.value;
410
+ if (type !== "number") {
411
+ return value2;
412
+ }
413
+ if (value2 === "") {
414
+ return null;
415
+ }
416
+ if (value2 == null) {
417
+ return value2;
418
+ }
419
+ return Number(value2);
420
+ }
421
+ }
422
+ });
423
+ const handleInputRef = _material.useForkRef.call(void 0, field.ref, inputRef);
424
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
425
+ TextFieldComponent,
426
+ {
427
+ ...rest,
428
+ ...restTextProps,
429
+ name: field.name,
430
+ value,
431
+ onChange: (event) => {
432
+ field.onChange(event);
433
+ if (typeof onChange === "function") {
434
+ onChange(event);
435
+ }
436
+ },
437
+ onBlur: (event) => {
438
+ field.onBlur();
439
+ if (typeof onBlur === "function") {
440
+ onBlur(event);
441
+ }
442
+ },
443
+ disabled,
444
+ label,
445
+ placeholder,
446
+ fullWidth: true,
447
+ required,
448
+ type,
449
+ error: !!error,
450
+ helperText: error ? error.message : helperText,
451
+ inputRef: handleInputRef,
452
+ size: "small",
453
+ sx: {
454
+ "& .MuiInputBase-input": {
455
+ cursor: disabled ? "not-allowed" : "default"
456
+ },
457
+ bgcolor: disabled ? "#EEF1F5" : "transparent"
458
+ }
459
+ }
460
+ );
461
+ };
462
+ var TextFieldElement2 = ({
463
+ gridProps,
464
+ ...props
465
+ }) => {
466
+ if (gridProps) {
467
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid2, { ...gridProps, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component4, { ...props }) });
468
+ }
469
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component4, { ...props });
470
+ };
471
+ TextFieldElement2.displayName = "TextFieldElement";
472
+ var TextFieldElement_default = TextFieldElement2;
473
+
474
+ // src/wrappers2/TimePickerElement/TimePickerElement.tsx
475
+
476
+
477
+
478
+
479
+
480
+
481
+
482
+
483
+
484
+ var Component5 = function TimePickerElement(props) {
485
+ const {
486
+ parseError,
487
+ name,
488
+ required,
489
+ rules = {},
490
+ inputProps,
491
+ control,
492
+ textReadOnly,
493
+ slotProps,
494
+ inputRef,
495
+ transform,
496
+ ...rest
497
+ } = props;
498
+ const adapter = _internals.useLocalizationContext.call(void 0, );
499
+ const {
500
+ field,
501
+ fieldState: { error }
502
+ } = _reacthookform.useController.call(void 0, {
503
+ name,
504
+ control,
505
+ disabled: rest.disabled,
506
+ defaultValue: null
507
+ });
508
+ const { value, onChange } = _chunk6JZ35VQJjs.useTransform.call(void 0, {
509
+ value: field.value,
510
+ onChange: field.onChange,
511
+ transform: {
512
+ input: typeof _optionalChain([transform, 'optionalAccess', _15 => _15.input]) === "function" ? transform.input : (newValue) => _chunkDKBPCLECjs.readValueAsDate.call(void 0, adapter, newValue),
513
+ output: typeof _optionalChain([transform, 'optionalAccess', _16 => _16.output]) === "function" ? transform.output : (newValue) => newValue
514
+ }
515
+ });
516
+ const handleInputRef = _material.useForkRef.call(void 0, field.ref, inputRef);
517
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
518
+ _xdatepickers.TimePicker,
519
+ {
520
+ ...rest,
521
+ ...field,
522
+ value,
523
+ inputRef: handleInputRef,
524
+ onClose: (...args) => {
525
+ field.onBlur();
526
+ if (rest.onClose) {
527
+ rest.onClose(...args);
528
+ }
529
+ },
530
+ onChange: (value2, context) => {
531
+ onChange(value2, context);
532
+ if (typeof rest.onChange === "function") {
533
+ rest.onChange(value2, context);
534
+ }
535
+ },
536
+ slotProps: {
537
+ ...slotProps,
538
+ textField: {
539
+ ...inputProps,
540
+ required,
541
+ fullWidth: true,
542
+ error: !!error,
543
+ helperText: error ? error.message : _optionalChain([inputProps, 'optionalAccess', _17 => _17.helperText]) || rest.helperText,
544
+ inputProps: {
545
+ readOnly: textReadOnly,
546
+ ..._optionalChain([inputProps, 'optionalAccess', _18 => _18.inputProps])
547
+ }
548
+ }
549
+ }
550
+ }
551
+ );
552
+ };
553
+ var TimePickerElement2 = ({
554
+ gridProps,
555
+ ...props
556
+ }) => {
557
+ if (gridProps) {
558
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid2, { ...gridProps, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component5, { ...props }) });
559
+ }
560
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component5, { ...props });
561
+ };
562
+ TimePickerElement2.displayName = "TimePickerElement";
563
+ var TimePickerElement_default = TimePickerElement2;
564
+
565
+ // src/wrappers2/AsyncSelect/AsyncSelect.tsx
566
+
567
+ var _TextField = require('@mui/material/TextField'); var _TextField2 = _interopRequireDefault(_TextField);
568
+ var _Autocomplete = require('@mui/material/Autocomplete'); var _Autocomplete2 = _interopRequireDefault(_Autocomplete);
569
+ var _utils = require('@mui/material/utils');
570
+
571
+
572
+
573
+
574
+
575
+
576
+
577
+
578
+
579
+
580
+
581
+ var Component6 = function AsyncSelectElement(props) {
582
+ const {
583
+ name,
584
+ onBlur,
585
+ disabled,
586
+ control,
587
+ gridProps,
588
+ placeholder,
589
+ initialValue,
590
+ label,
591
+ queryFn,
592
+ ...rest
593
+ } = props;
594
+ const {
595
+ field,
596
+ fieldState: { error }
597
+ } = _reacthookform.useController.call(void 0, {
598
+ name,
599
+ control,
600
+ disabled
601
+ });
602
+ const [loading, setLoading] = _react.useState.call(void 0, false);
603
+ const [selectedOption, setSelectedOption] = _react.useState.call(void 0, null);
604
+ const [inputValue, setInputValue] = _react.useState.call(void 0, "");
605
+ const inputValue2 = _react.useMemo.call(void 0, () => inputValue, [inputValue]);
606
+ const setInputValue2 = _react.useCallback.call(void 0,
607
+ (inputValue3) => setInputValue(inputValue3),
608
+ []
609
+ );
610
+ const [options, setOptions] = _react.useState.call(void 0, []);
611
+ const initialValueLoaded = _react.useRef.call(void 0,
612
+ !initialValue ? true : !(initialValue != null && initialValue > 0)
613
+ );
614
+ const fieldValue = _react.useRef.call(void 0, field.value);
615
+ const fetchData = _react.useMemo.call(void 0,
616
+ () => _utils.debounce.call(void 0,
617
+ (payload, callback) => {
618
+ queryFn(payload).then((c) => callback(c));
619
+ },
620
+ 400
621
+ ),
622
+ []
623
+ );
624
+ const fillOptions = (results) => {
625
+ let newOptions = [];
626
+ if (selectedOption) {
627
+ newOptions = [selectedOption];
628
+ }
629
+ if (results) {
630
+ newOptions = [...newOptions, ...results];
631
+ }
632
+ setOptions(newOptions);
633
+ setLoading(false);
634
+ };
635
+ _react.useEffect.call(void 0, () => {
636
+ if (initialValueLoaded.current) return void 0;
637
+ let active = true;
638
+ const payload = {
639
+ query: null,
640
+ initialValue
641
+ };
642
+ setLoading(true);
643
+ fetchData(payload, (results) => {
644
+ if (active) {
645
+ if (!!results && results.length > 0) {
646
+ fillOptions(_optionalChain([results, 'optionalAccess', _19 => _19.filter, 'call', _20 => _20((c) => c.value == initialValue)]));
647
+ setSelectedOption(results[0]);
648
+ field.onChange(results[0].value);
649
+ fieldValue.current = results[0].value;
650
+ }
651
+ initialValueLoaded.current = true;
652
+ setLoading(false);
653
+ }
654
+ });
655
+ return () => {
656
+ active = false;
657
+ };
658
+ }, [initialValue]);
659
+ React.useEffect(() => {
660
+ let active = true;
661
+ if (inputValue2 === "" || initialValueLoaded.current === false) {
662
+ setOptions(selectedOption ? [selectedOption] : []);
663
+ return void 0;
664
+ }
665
+ if (!!fieldValue.current) {
666
+ if (field.value === fieldValue.current) {
667
+ return void 0;
668
+ }
669
+ }
670
+ setLoading(true);
671
+ const payload = {
672
+ query: inputValue2,
673
+ initialValue: null
674
+ };
675
+ fetchData(payload, (results) => {
676
+ if (active) {
677
+ fillOptions(results);
678
+ }
679
+ });
680
+ return () => {
681
+ active = false;
682
+ };
683
+ }, [initialValue, inputValue2, fetchData]);
684
+ const selectRef = _react.useRef.call(void 0, null);
685
+ const handleChange = (_2, selectedOption2, reason) => {
686
+ if (reason === "clear") {
687
+ setSelectedOption(null);
688
+ field.onChange(null);
689
+ } else if (reason === "selectOption" || reason === "removeOption") {
690
+ if (selectedOption2) {
691
+ setSelectedOption(selectedOption2);
692
+ field.onChange(selectedOption2.value);
693
+ fieldValue.current = selectedOption2.value;
694
+ }
695
+ }
696
+ setOptions([]);
697
+ };
698
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
699
+ _Autocomplete2.default,
700
+ {
701
+ ...rest,
702
+ ref: selectRef,
703
+ fullWidth: true,
704
+ loading,
705
+ getOptionLabel: (option) => option.Label,
706
+ getOptionKey: (option) => option.value,
707
+ isOptionEqualToValue: (option, val) => option.value === val.value,
708
+ autoComplete: true,
709
+ includeInputInList: true,
710
+ disabled,
711
+ options,
712
+ value: selectedOption,
713
+ filterSelectedOptions: true,
714
+ onChange: handleChange,
715
+ onInputChange: (_2, newInputValue) => {
716
+ setInputValue2(newInputValue);
717
+ },
718
+ renderInput: (params) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
719
+ _TextField2.default,
720
+ {
721
+ ...params,
722
+ label,
723
+ error: !!error,
724
+ helperText: error ? error.message : "",
725
+ placeholder,
726
+ slotProps: {
727
+ input: {
728
+ ...params.InputProps,
729
+ endAdornment: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
730
+ loading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.CircularProgress, { color: "inherit", size: 20 }) : null,
731
+ params.InputProps.endAdornment
732
+ ] })
733
+ }
734
+ },
735
+ sx: {
736
+ "& .MuiInputBase-input": {
737
+ cursor: disabled ? "not-allowed" : "default"
738
+ },
739
+ bgcolor: disabled ? "#EEF1F5" : "transparent"
740
+ }
741
+ }
742
+ ),
743
+ renderOption: (props2, option) => {
744
+ const { key, ...optionProps } = props2;
745
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { ...optionProps, children: option.Label }, key);
746
+ }
747
+ }
748
+ );
749
+ };
750
+ var AsyncSelectElement2 = ({
751
+ gridProps,
752
+ ...props
753
+ }) => {
754
+ if (gridProps) {
755
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid2, { ...gridProps, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component6, { ...props }) });
756
+ }
757
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component6, { ...props });
758
+ };
759
+ AsyncSelectElement2.displayName = "AsyncSelectElement";
760
+ var AsyncSelect_default = AsyncSelectElement2;
761
+
762
+ // src/wrappers2/AsyncMultiSelect/AsyncMultiSelect.tsx
763
+ var _lodash = require('lodash'); var _lodash2 = _interopRequireDefault(_lodash);
764
+
765
+
766
+
767
+
768
+
769
+
770
+
771
+
772
+
773
+
774
+
775
+
776
+
777
+
778
+
779
+
780
+ var _match = require('autosuggest-highlight/match'); var _match2 = _interopRequireDefault(_match);
781
+ var _parse = require('autosuggest-highlight/parse'); var _parse2 = _interopRequireDefault(_parse);
782
+
783
+ var Component7 = function AsyncSelectMultiElement(props) {
784
+ const {
785
+ name,
786
+ onBlur,
787
+ disabled,
788
+ control,
789
+ gridProps,
790
+ placeholder,
791
+ initialValues,
792
+ label,
793
+ queryFn,
794
+ ...rest
795
+ } = props;
796
+ const {
797
+ field,
798
+ fieldState: { error }
799
+ } = _reacthookform.useController.call(void 0, {
800
+ name,
801
+ control,
802
+ disabled
803
+ });
804
+ const multiSelectRef = _react.useRef.call(void 0, null);
805
+ const [selectedOptions, setSelectedOptions] = _react.useState.call(void 0, []);
806
+ const [inputValue, setInputValue] = _react.useState.call(void 0, "");
807
+ const [options, setOptions] = _react.useState.call(void 0, []);
808
+ const [loading, setLoading] = _react.useState.call(void 0, false);
809
+ const initialValuesLoaded = _react.useRef.call(void 0,
810
+ !(initialValues && initialValues.length > 0)
811
+ );
812
+ const inputValue2 = _react.useMemo.call(void 0, () => inputValue, [inputValue]);
813
+ const setInputValue2 = _react.useCallback.call(void 0,
814
+ (inputValue3) => setInputValue(inputValue3),
815
+ []
816
+ );
817
+ const fetchData = _react.useMemo.call(void 0,
818
+ () => _lodash.debounce.call(void 0,
819
+ (payload, callback) => {
820
+ queryFn(payload).then((c) => callback(c));
821
+ },
822
+ 400
823
+ ),
824
+ []
825
+ );
826
+ const fillOptions = (results) => {
827
+ let newOptions = [];
828
+ if (selectedOptions) {
829
+ newOptions = [...selectedOptions];
830
+ }
831
+ if (results) {
832
+ const newlyAdded = _lodash2.default.differenceBy(
833
+ results,
834
+ selectedOptions,
835
+ (c) => c.value
836
+ );
837
+ newOptions = [...newOptions, ...newlyAdded];
838
+ }
839
+ setOptions(newOptions);
840
+ setLoading(false);
841
+ };
842
+ _react.useEffect.call(void 0, () => {
843
+ if (initialValuesLoaded.current) return void 0;
844
+ let active = true;
845
+ const payload = {
846
+ query: null,
847
+ initialValues
848
+ };
849
+ setLoading(true);
850
+ fetchData(payload, (results) => {
851
+ if (active) {
852
+ setSelectedOptions([...results]);
853
+ field.onChange([...results.map((c) => c.value)]);
854
+ initialValuesLoaded.current = true;
855
+ setLoading(false);
856
+ }
857
+ });
858
+ return () => {
859
+ active = false;
860
+ };
861
+ }, [initialValues]);
862
+ _react.useEffect.call(void 0, () => {
863
+ let active = true;
864
+ if (inputValue2 === "" || initialValuesLoaded.current === false) {
865
+ setOptions(selectedOptions ? [...selectedOptions] : []);
866
+ return void 0;
867
+ }
868
+ setLoading(true);
869
+ const payload = {
870
+ query: inputValue2,
871
+ initialValues: null
872
+ };
873
+ fetchData(payload, (results) => {
874
+ if (active) {
875
+ fillOptions(results);
876
+ }
877
+ });
878
+ return () => {
879
+ active = false;
880
+ };
881
+ }, [initialValues, inputValue2, fetchData]);
882
+ const handleChange = (_2, selectedOptions2, reason) => {
883
+ if (reason === "clear") {
884
+ setSelectedOptions([]);
885
+ field.onChange([]);
886
+ } else if (reason === "selectOption" || reason === "removeOption") {
887
+ setSelectedOptions(selectedOptions2);
888
+ field.onChange(selectedOptions2.map((c) => c.value));
889
+ }
890
+ setOptions([]);
891
+ };
892
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
893
+ _material.Autocomplete,
894
+ {
895
+ ref: multiSelectRef,
896
+ multiple: true,
897
+ loading,
898
+ getOptionLabel: (option) => option.Label,
899
+ getOptionKey: (option) => option.value,
900
+ isOptionEqualToValue: (option, val) => option.value === val.value,
901
+ options,
902
+ value: selectedOptions,
903
+ filterSelectedOptions: true,
904
+ disabled,
905
+ onChange: handleChange,
906
+ onInputChange: (_2, newInputValue) => {
907
+ setInputValue2(newInputValue);
908
+ },
909
+ renderInput: (params) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
910
+ _material.TextField,
911
+ {
912
+ ...params,
913
+ label,
914
+ error: !!error,
915
+ helperText: error ? error.message : "",
916
+ placeholder,
917
+ slotProps: {
918
+ input: {
919
+ ...params.InputProps,
920
+ endAdornment: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
921
+ loading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.CircularProgress, { color: "inherit", size: 20 }) : null,
922
+ params.InputProps.endAdornment
923
+ ] })
924
+ }
925
+ },
926
+ sx: {
927
+ "& .MuiInputBase-input": {
928
+ cursor: disabled ? "not-allowed" : "default"
929
+ },
930
+ bgcolor: disabled ? "#EEF1F5" : "transparent"
931
+ }
932
+ }
933
+ ),
934
+ renderOption: (props2, option, { inputValue: inputValue3 }) => {
935
+ const { key, ...optionProps } = props2;
936
+ const matches = _match2.default.call(void 0, option.Label, inputValue3, { insideWords: true });
937
+ const parts = _parse2.default.call(void 0, option.Label, matches);
938
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { ...optionProps, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: parts.map((part, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
939
+ "span",
940
+ {
941
+ style: {
942
+ fontWeight: part.highlight ? 700 : 400
943
+ },
944
+ children: part.text
945
+ },
946
+ index
947
+ )) }) }, key);
948
+ },
949
+ ...rest
950
+ }
951
+ );
952
+ };
953
+ var AsyncSelectMultiElement2 = ({
954
+ gridProps,
955
+ ...props
956
+ }) => {
957
+ if (gridProps) {
958
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid2, { ...gridProps, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component7, { ...props }) });
959
+ }
960
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component7, { ...props });
961
+ };
962
+ AsyncSelectMultiElement2.displayName = "AsyncSelectMulti";
963
+ var AsyncMultiSelect_default = AsyncSelectMultiElement2;
964
+
965
+ // src/wrappers2/SelectElement/SelectElement.tsx
966
+
967
+
968
+
969
+
970
+
971
+
972
+
973
+
974
+
975
+ var Component8 = function SelectElement(props) {
976
+ const {
977
+ name,
978
+ onBlur,
979
+ onChange,
980
+ disabled,
981
+ options,
982
+ control,
983
+ gridProps,
984
+ loading = false,
985
+ placeholder,
986
+ label,
987
+ ...rest
988
+ } = props;
989
+ const {
990
+ field,
991
+ fieldState: { error }
992
+ } = _reacthookform.useController.call(void 0, {
993
+ name,
994
+ control,
995
+ disabled
996
+ });
997
+ if (options.length === 1 && field.value == null) {
998
+ field.onChange(options[0].value);
999
+ }
1000
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1001
+ _material.Autocomplete,
1002
+ {
1003
+ ...rest,
1004
+ value: field.value !== null ? _nullishCoalesce(options.find((option) => {
1005
+ return field.value === option.value;
1006
+ }), () => ( null)) : options.length === 1 ? options[0] : null,
1007
+ size: "small",
1008
+ loading,
1009
+ options,
1010
+ getOptionLabel: (c) => c.label,
1011
+ isOptionEqualToValue: (option, value) => option.value === value.value,
1012
+ ref: field.ref,
1013
+ disabled: field.disabled,
1014
+ onChange: (event, newValue, reason) => {
1015
+ field.onChange(newValue ? newValue.value : null);
1016
+ if (onChange && typeof onChange === "function") {
1017
+ onChange(event, newValue, reason);
1018
+ }
1019
+ },
1020
+ onBlur: (event) => {
1021
+ field.onBlur();
1022
+ if (typeof onBlur === "function") {
1023
+ onBlur(event);
1024
+ }
1025
+ },
1026
+ fullWidth: true,
1027
+ renderInput: (params) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1028
+ _material.TextField,
1029
+ {
1030
+ ...params,
1031
+ fullWidth: true,
1032
+ error: !!error,
1033
+ helperText: error ? error.message : "",
1034
+ placeholder,
1035
+ label,
1036
+ variant: "outlined",
1037
+ sx: {
1038
+ "& .MuiInputBase-input": {
1039
+ cursor: disabled ? "not-allowed" : "default"
1040
+ },
1041
+ bgcolor: disabled ? "#EEF1F5" : "transparent"
1042
+ }
1043
+ }
1044
+ )
1045
+ }
1046
+ );
1047
+ };
1048
+ var SelectElement2 = ({
1049
+ gridProps,
1050
+ ...props
1051
+ }) => {
1052
+ if (gridProps) {
1053
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid2, { ...gridProps, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component8, { ...props }) });
1054
+ }
1055
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component8, { ...props });
1056
+ };
1057
+ SelectElement2.displayName = "SelectElement";
1058
+ var SelectElement_default = SelectElement2;
1059
+
1060
+ // src/wrappers2/SelectMultiElement/SelectMultiElement.tsx
1061
+
1062
+
1063
+
1064
+
1065
+
1066
+
1067
+
1068
+
1069
+
1070
+
1071
+
1072
+ var Component9 = function SelectMultiElement(props) {
1073
+ const {
1074
+ name,
1075
+ onBlur,
1076
+ disabled,
1077
+ options,
1078
+ control,
1079
+ loading = false,
1080
+ placeholder,
1081
+ label,
1082
+ ...rest
1083
+ } = props;
1084
+ const {
1085
+ field,
1086
+ fieldState: { error }
1087
+ } = _reacthookform.useController.call(void 0, {
1088
+ name,
1089
+ control,
1090
+ disabled
1091
+ });
1092
+ const [selectedOptions, setSelectedOptions] = _react.useState.call(void 0, []);
1093
+ const handleChange = (_2, selectedOptions2, reason) => {
1094
+ if (reason === "clear") {
1095
+ setSelectedOptions([]);
1096
+ field.onChange([]);
1097
+ } else if (reason === "selectOption" || reason === "removeOption") {
1098
+ setSelectedOptions(selectedOptions2);
1099
+ field.onChange(selectedOptions2.map((c) => c.value));
1100
+ }
1101
+ };
1102
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1103
+ _material.Autocomplete,
1104
+ {
1105
+ multiple: true,
1106
+ value: selectedOptions,
1107
+ loading,
1108
+ options,
1109
+ getOptionLabel: (c) => c.Label,
1110
+ filterSelectedOptions: true,
1111
+ ref: field.ref,
1112
+ disabled: field.disabled,
1113
+ onChange: handleChange,
1114
+ onBlur: (event) => {
1115
+ field.onBlur();
1116
+ if (typeof onBlur === "function") {
1117
+ onBlur(event);
1118
+ }
1119
+ },
1120
+ fullWidth: true,
1121
+ renderInput: (params) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1122
+ _material.TextField,
1123
+ {
1124
+ ...params,
1125
+ label,
1126
+ error: !!error,
1127
+ helperText: error ? error.message : "",
1128
+ placeholder,
1129
+ slotProps: {
1130
+ input: {
1131
+ ...params.InputProps,
1132
+ endAdornment: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
1133
+ loading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.CircularProgress, { color: "inherit", size: 20 }) : null,
1134
+ params.InputProps.endAdornment
1135
+ ] })
1136
+ }
1137
+ }
1138
+ }
1139
+ ),
1140
+ ...rest
1141
+ }
1142
+ );
1143
+ };
1144
+ var SelectMultiElement2 = ({
1145
+ gridProps,
1146
+ ...props
1147
+ }) => {
1148
+ if (gridProps) {
1149
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid2, { ...gridProps, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component9, { ...props }) });
1150
+ }
1151
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component9, { ...props });
1152
+ };
1153
+ SelectMultiElement2.displayName = "SelectMultiElement";
1154
+ var SelectMultiElement_default = SelectMultiElement2;
1155
+
1156
+ // src/wrappers2/SelectCascadeElement/SelectCascadeElement.tsx
1157
+
1158
+
1159
+
1160
+
1161
+
1162
+
1163
+
1164
+
1165
+
1166
+
1167
+ var Component10 = function SelectCascadeElement(props) {
1168
+ const {
1169
+ name,
1170
+ onBlur,
1171
+ onChange,
1172
+ disabled,
1173
+ options,
1174
+ control,
1175
+ gridProps,
1176
+ loading = false,
1177
+ placeholder,
1178
+ label,
1179
+ dependsOn,
1180
+ initialValue,
1181
+ ...rest
1182
+ } = props;
1183
+ const {
1184
+ field,
1185
+ fieldState: { error }
1186
+ } = _reacthookform.useController.call(void 0, {
1187
+ name,
1188
+ control,
1189
+ disabled
1190
+ });
1191
+ const { field: dependentField } = _reacthookform.useController.call(void 0, {
1192
+ name: dependsOn,
1193
+ control,
1194
+ disabled
1195
+ });
1196
+ const parentValueRef = _react.useRef.call(void 0, _nullishCoalesce(dependentField.value, () => ( null)));
1197
+ _react.useEffect.call(void 0, () => {
1198
+ if (!!dependentField.value && _optionalChain([parentValueRef, 'optionalAccess', _21 => _21.current, 'optionalAccess', _22 => _22.value]) !== dependentField.value || dependentField.value === null) {
1199
+ field.onChange(null);
1200
+ }
1201
+ }, [dependentField.value]);
1202
+ _react.useEffect.call(void 0, () => {
1203
+ if (initialValue) {
1204
+ field.onChange(initialValue);
1205
+ }
1206
+ }, [initialValue]);
1207
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1208
+ _material.Autocomplete,
1209
+ {
1210
+ ...rest,
1211
+ value: field.value !== null ? _nullishCoalesce(options.find((option) => {
1212
+ return field.value === option.value;
1213
+ }), () => ( null)) : null,
1214
+ size: "small",
1215
+ loading,
1216
+ options,
1217
+ getOptionLabel: (c) => c.label,
1218
+ isOptionEqualToValue: (option, value) => option.value === value.value,
1219
+ ref: field.ref,
1220
+ disabled: field.disabled,
1221
+ onChange: (event, newValue, reason) => {
1222
+ field.onChange(newValue ? newValue.value : null);
1223
+ if (onChange && typeof onChange === "function") {
1224
+ onChange(event, newValue, reason);
1225
+ }
1226
+ },
1227
+ onBlur: (event) => {
1228
+ field.onBlur();
1229
+ if (typeof onBlur === "function") {
1230
+ onBlur(event);
1231
+ }
1232
+ },
1233
+ fullWidth: true,
1234
+ renderInput: (params) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1235
+ _material.TextField,
1236
+ {
1237
+ ...params,
1238
+ fullWidth: true,
1239
+ error: !!error,
1240
+ helperText: error ? error.message : "",
1241
+ placeholder,
1242
+ label,
1243
+ variant: "outlined",
1244
+ sx: {
1245
+ "& .MuiInputBase-input": {
1246
+ cursor: disabled ? "not-allowed" : "default"
1247
+ },
1248
+ bgcolor: disabled ? "#EEF1F5" : "transparent"
1249
+ }
1250
+ }
1251
+ )
1252
+ }
1253
+ );
1254
+ };
1255
+ var SelectCascadeElement2 = ({
1256
+ gridProps,
1257
+ ...props
1258
+ }) => {
1259
+ if (gridProps) {
1260
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid2, { ...gridProps, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component10, { ...props }) });
1261
+ }
1262
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component10, { ...props });
1263
+ };
1264
+ SelectCascadeElement2.displayName = "SelectCascadeElement";
1265
+ var SelectCascadeElement_default = SelectCascadeElement2;
1266
+
1267
+ // src/wrappers2/CheckboxElement/CheckboxElement.tsx
1268
+
1269
+
1270
+
1271
+
1272
+
1273
+
1274
+
1275
+
1276
+
1277
+
1278
+
1279
+
1280
+ var Component11 = function CheckboxElement(props) {
1281
+ const { name, control, label, labelProps, inputRef, ...rest } = props;
1282
+ const {
1283
+ field,
1284
+ fieldState: { error }
1285
+ } = _reacthookform.useController.call(void 0, {
1286
+ name,
1287
+ control,
1288
+ disabled: rest.disabled
1289
+ });
1290
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.FormControl, { error: !!error, children: [
1291
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.FormGroup, { row: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1292
+ _material.FormControlLabel,
1293
+ {
1294
+ label: label || "",
1295
+ ...labelProps,
1296
+ control: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1297
+ _material.Checkbox,
1298
+ {
1299
+ ...rest,
1300
+ color: rest.color || "primary",
1301
+ sx: [
1302
+ ...Array.isArray(rest.sx) ? rest.sx : [rest.sx],
1303
+ {
1304
+ color: error ? "error.main" : void 0
1305
+ }
1306
+ ],
1307
+ value: field.value,
1308
+ checked: !!field.value,
1309
+ onChange: (event, newValue) => {
1310
+ field.onChange(event, newValue);
1311
+ if (typeof rest.onChange === "function") {
1312
+ rest.onChange(event, newValue);
1313
+ }
1314
+ }
1315
+ }
1316
+ )
1317
+ }
1318
+ ) }),
1319
+ error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.FormHelperText, { error: !!error, children: error.message })
1320
+ ] });
1321
+ };
1322
+ var CheckboxElement2 = ({
1323
+ gridProps,
1324
+ ...props
1325
+ }) => {
1326
+ if (gridProps) {
1327
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid2, { ...gridProps, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component11, { ...props }) });
1328
+ }
1329
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component11, { ...props });
1330
+ };
1331
+ CheckboxElement2.displayName = "CheckboxElement";
1332
+ var CheckboxElement_default = CheckboxElement2;
1333
+
1334
+ // src/wrappers2/CheckboxGroup/CheckboxGroup.tsx
1335
+
1336
+
1337
+
1338
+
1339
+
1340
+
1341
+
1342
+
1343
+
1344
+
1345
+
1346
+
1347
+
1348
+ var Component12 = function CheckboxGroup(props) {
1349
+ const { name, control, label, labelProps, inputRef, options, ...rest } = props;
1350
+ const {
1351
+ field,
1352
+ fieldState: { error }
1353
+ } = _reacthookform.useController.call(void 0, {
1354
+ name,
1355
+ control,
1356
+ disabled: rest.disabled
1357
+ });
1358
+ const [selectedValues, setSelectedValues] = _react.useState.call(void 0,
1359
+ options.filter((c) => _optionalChain([field, 'access', _23 => _23.value, 'optionalAccess', _24 => _24.includes, 'call', _25 => _25(c.value)])).map((c) => c.value) || []
1360
+ );
1361
+ _react.useEffect.call(void 0, () => {
1362
+ field.onChange(selectedValues ? [...selectedValues] : []);
1363
+ }, [selectedValues]);
1364
+ const handleChange = (event) => {
1365
+ const value = parseInt(event.target.value, 10);
1366
+ if (event.target.checked) {
1367
+ setSelectedValues([...selectedValues, value]);
1368
+ } else {
1369
+ setSelectedValues(selectedValues.filter((item) => item !== value));
1370
+ }
1371
+ };
1372
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.FormControl, { error: !!error, children: [
1373
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.FormGroup, { row: true, children: options.map((option) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1374
+ _material.FormControlLabel,
1375
+ {
1376
+ label: option.label,
1377
+ ...labelProps,
1378
+ control: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1379
+ _material.Checkbox,
1380
+ {
1381
+ ...rest,
1382
+ color: rest.color || "primary",
1383
+ sx: [
1384
+ ...Array.isArray(rest.sx) ? rest.sx : [rest.sx],
1385
+ {
1386
+ color: error ? "error.main" : void 0
1387
+ }
1388
+ ],
1389
+ value: option.value,
1390
+ checked: selectedValues.includes(option.value),
1391
+ onChange: handleChange
1392
+ }
1393
+ )
1394
+ },
1395
+ `${option.value}`
1396
+ )) }),
1397
+ error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.FormHelperText, { error: !!error, children: error.message })
1398
+ ] });
1399
+ };
1400
+ var CheckboxGroup2 = ({
1401
+ gridProps,
1402
+ ...props
1403
+ }) => {
1404
+ if (gridProps) {
1405
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid2, { ...gridProps, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component12, { ...props }) });
1406
+ }
1407
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component12, { ...props });
1408
+ };
1409
+ CheckboxGroup2.displayName = "CheckboxGroup";
1410
+ var CheckboxGroup_default = CheckboxGroup2;
1411
+
1412
+ // src/wrappers2/Field/index.ts
1413
+ var Field2 = {
1414
+ Text: TextFieldElement_default,
1415
+ Checkbox: CheckboxElement_default,
1416
+ Date: DatePickerElement_default,
1417
+ RadioGroup: RadioButtonGroup_default,
1418
+ Password: PasswordElement_default,
1419
+ Time: TimePickerElement_default,
1420
+ Select: SelectElement_default,
1421
+ SelectMulti: SelectMultiElement_default,
1422
+ SelectCascade: SelectCascadeElement_default,
1423
+ AsyncSelect: AsyncSelect_default,
1424
+ AsyncMultiSelect: AsyncMultiSelect_default,
1425
+ CheckboxGroup: CheckboxGroup_default
1426
+ };
1427
+ var Field_default = Field2;
1428
+
1429
+
1430
+
1431
+ exports.Field_default = Field_default;