@gnwebsoft/ui 2.18.23 → 2.18.25

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