@clyrex-digital/clyrex-controls-dev 0.8.1-dev.20260724091901 → 0.8.1-dev.20260725061513

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.
@@ -161,9 +161,131 @@ var MoneyInput = (props) => {
161
161
  };
162
162
  var MoneyInput_default = MoneyInput;
163
163
 
164
- // src/components/controls/edit/PercentageInput.tsx
165
- import React4 from "react";
164
+ // src/components/controls/edit/Select.tsx
165
+ import { useState, useEffect } from "react";
166
166
  import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
167
+ var Select = (props) => {
168
+ const [list, setList] = useState();
169
+ const getSafeValue = (val) => {
170
+ if (val === null || val === void 0) return "";
171
+ if (typeof val === "boolean") return val ? "1" : "0";
172
+ return val;
173
+ };
174
+ const textChangeHandler = (event) => {
175
+ let rawValue = event.target.value;
176
+ if (rawValue === "") rawValue = null;
177
+ let finalValue = rawValue;
178
+ if (list && props.dataKeyFieldName) {
179
+ const key = props.dataKeyFieldName;
180
+ const selectedItem = list.find(
181
+ (item) => String(item[key]) === String(rawValue)
182
+ );
183
+ if (selectedItem) {
184
+ const keyValue = selectedItem[key];
185
+ if (typeof keyValue === "number") {
186
+ finalValue = Number(rawValue);
187
+ }
188
+ }
189
+ }
190
+ props.callback?.({
191
+ name: props.name,
192
+ value: finalValue,
193
+ index: props.index,
194
+ groupKey: props.groupKey
195
+ });
196
+ };
197
+ const inputChangeHandler = (event) => {
198
+ props.callback?.({
199
+ name: props.name,
200
+ value: event.target.value,
201
+ index: props.index,
202
+ groupKey: props.groupKey
203
+ });
204
+ };
205
+ useEffect(() => {
206
+ async function fetchData() {
207
+ if (props.dataset) {
208
+ setList(props.dataset);
209
+ return;
210
+ }
211
+ if (props.dataSource && props.serviceClient) {
212
+ let dataSource = props.dataSource;
213
+ let response;
214
+ if (props.dataSourceDependsOn) {
215
+ if (!props.dependentValue) {
216
+ setList([]);
217
+ return;
218
+ }
219
+ dataSource = dataSource.replace(
220
+ `{${props.dataSourceDependsOn}}`,
221
+ props.dependentValue
222
+ );
223
+ }
224
+ response = await props.serviceClient.get(dataSource);
225
+ setList(response.result ?? []);
226
+ return;
227
+ }
228
+ setList([]);
229
+ }
230
+ fetchData();
231
+ }, [
232
+ props.dataset,
233
+ props.dataSource,
234
+ props.dependentValue,
235
+ props.dataSourceDependsOn
236
+ ]);
237
+ const value = getSafeValue(props.value);
238
+ return /* @__PURE__ */ jsxs4("label", { className: "block", children: [
239
+ props.attributes?.label && /* @__PURE__ */ jsx4("span", { className: "text-sm font-medium inline-block pb-1", children: props.attributes?.label }),
240
+ " ",
241
+ props.attributes?.label && props.attributes?.required && /* @__PURE__ */ jsx4("span", { className: "bg-error-weak", children: "*" }),
242
+ list && list.length === 0 && /* @__PURE__ */ jsx4(
243
+ "input",
244
+ {
245
+ type: "text",
246
+ name: props.name,
247
+ id: props.name,
248
+ value,
249
+ onChange: inputChangeHandler,
250
+ required: props.attributes?.required,
251
+ placeholder: props.attributes?.placeholder,
252
+ maxLength: props.attributes?.maxLength,
253
+ pattern: props.attributes?.pattern,
254
+ disabled: props.attributes?.readOnly,
255
+ minLength: props.attributes?.minLength,
256
+ className: `peer input select mt-1 py-1.5 block w-full rounded shadow-sm ${props.inputClasses ?? ""}`
257
+ }
258
+ ),
259
+ list && list.length > 0 && /* @__PURE__ */ jsxs4(
260
+ "select",
261
+ {
262
+ name: props.name,
263
+ id: props.name,
264
+ value,
265
+ onChange: textChangeHandler,
266
+ required: props.attributes?.required,
267
+ disabled: props.attributes?.readOnly,
268
+ className: `peer select py-1.5 block w-full text-black rounded border-gray-300 shadow-sm
269
+ focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50
270
+ disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none ${props.inputClasses ?? ""}`,
271
+ children: [
272
+ /* @__PURE__ */ jsx4("option", { value: "", children: props.attributes?.placeholder || "Select" }),
273
+ list.map((item, index) => {
274
+ const keyField = props.dataKeyFieldName;
275
+ const textField = props.dataTextFieldName;
276
+ return /* @__PURE__ */ jsx4("option", { value: item[keyField], children: item[textField] }, index);
277
+ })
278
+ ]
279
+ }
280
+ ),
281
+ /* @__PURE__ */ jsx4("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 text-alert text-sm", children: props.attributes?.errorMessage || "" })
282
+ ] });
283
+ };
284
+ var Select_default = Select;
285
+
286
+ // src/components/controls/edit/PercentageInput.tsx
287
+ import React5 from "react";
288
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
167
289
  var PercentageInput = (props) => {
168
290
  const textChangeHandler = (event) => {
169
291
  const rawValue = event.target.value;
@@ -192,11 +314,11 @@ var PercentageInput = (props) => {
192
314
  e.preventDefault();
193
315
  }
194
316
  };
195
- return /* @__PURE__ */ jsx4(React4.Fragment, { children: /* @__PURE__ */ jsxs4("label", { className: "block mb-1", children: [
196
- /* @__PURE__ */ jsx4("span", { className: "text-sm font-medium ", children: props?.attributes?.label ? props?.attributes?.label + " %" : "" }),
317
+ return /* @__PURE__ */ jsx5(React5.Fragment, { children: /* @__PURE__ */ jsxs5("label", { className: "block mb-1", children: [
318
+ /* @__PURE__ */ jsx5("span", { className: "text-sm font-medium ", children: props?.attributes?.label ? props?.attributes?.label + " %" : "" }),
197
319
  " ",
198
- props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ jsx4("span", { className: "bg-error-weak", children: "*" }),
199
- /* @__PURE__ */ jsx4(
320
+ props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ jsx5("span", { className: "bg-error-weak", children: "*" }),
321
+ /* @__PURE__ */ jsx5(
200
322
  "input",
201
323
  {
202
324
  type: "number",
@@ -215,14 +337,14 @@ var PercentageInput = (props) => {
215
337
  className: "peer mt-1 py-1.5 block w-full rounded shadow-sm number-input"
216
338
  }
217
339
  ),
218
- /* @__PURE__ */ jsx4("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
340
+ /* @__PURE__ */ jsx5("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
219
341
  ] }) });
220
342
  };
221
343
  var PercentageInput_default = PercentageInput;
222
344
 
223
345
  // src/components/controls/edit/PhoneInput.tsx
224
- import React5 from "react";
225
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
346
+ import React6 from "react";
347
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
226
348
  var PhoneInput = (props) => {
227
349
  const textChangeHandler = (event) => {
228
350
  const text = event.target.value;
@@ -241,13 +363,13 @@ var PhoneInput = (props) => {
241
363
  if (props.value !== void 0 && props.value !== null) {
242
364
  value = props.value;
243
365
  }
244
- return /* @__PURE__ */ jsx5(React5.Fragment, { children: /* @__PURE__ */ jsxs5("label", { className: "block mb-1", children: [
245
- /* @__PURE__ */ jsx5("span", { className: "text-sm font-medium ", children: props?.attributes?.label }),
366
+ return /* @__PURE__ */ jsx6(React6.Fragment, { children: /* @__PURE__ */ jsxs6("label", { className: "block mb-1", children: [
367
+ /* @__PURE__ */ jsx6("span", { className: "text-sm font-medium ", children: props?.attributes?.label }),
246
368
  " ",
247
- props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ jsx5("span", { className: "bg-error-weak", children: "*" }),
248
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center rounded border ", children: [
249
- /* @__PURE__ */ jsx5("span", { className: "px-3", children: props.prefix }),
250
- /* @__PURE__ */ jsx5(
369
+ props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ jsx6("span", { className: "bg-error-weak", children: "*" }),
370
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center rounded border ", children: [
371
+ /* @__PURE__ */ jsx6("span", { className: "px-3", children: props.prefix }),
372
+ /* @__PURE__ */ jsx6(
251
373
  "input",
252
374
  {
253
375
  type: "text",
@@ -265,14 +387,14 @@ var PhoneInput = (props) => {
265
387
  }
266
388
  )
267
389
  ] }),
268
- /* @__PURE__ */ jsx5("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
390
+ /* @__PURE__ */ jsx6("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
269
391
  ] }) });
270
392
  };
271
393
  var PhoneInput_default = PhoneInput;
272
394
 
273
395
  // src/components/controls/edit/NumberInput.tsx
274
- import React6 from "react";
275
- import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
396
+ import React7 from "react";
397
+ import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
276
398
  var NumberInput = (props) => {
277
399
  const textChangeHandler = (event) => {
278
400
  const text = event.target.value;
@@ -295,11 +417,11 @@ var NumberInput = (props) => {
295
417
  if (props.value !== void 0 && props.value !== null) {
296
418
  value = props.value;
297
419
  }
298
- return /* @__PURE__ */ jsx6(React6.Fragment, { children: /* @__PURE__ */ jsxs6("label", { className: "block", children: [
299
- props?.attributes?.label && /* @__PURE__ */ jsx6("span", { className: "text-sm inline-block pb-1 font-medium ", children: props?.attributes?.label }),
420
+ return /* @__PURE__ */ jsx7(React7.Fragment, { children: /* @__PURE__ */ jsxs7("label", { className: "block", children: [
421
+ props?.attributes?.label && /* @__PURE__ */ jsx7("span", { className: "text-sm inline-block pb-1 font-medium ", children: props?.attributes?.label }),
300
422
  " ",
301
- props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ jsx6("span", { className: "bg-error-weak", children: "*" }),
302
- /* @__PURE__ */ jsx6(
423
+ props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ jsx7("span", { className: "bg-error-weak", children: "*" }),
424
+ /* @__PURE__ */ jsx7(
303
425
  "input",
304
426
  {
305
427
  type: "number",
@@ -318,14 +440,14 @@ var NumberInput = (props) => {
318
440
  className: "peer py-1.5 block w-full rounded shadow-sm number-input input\n disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none\n "
319
441
  }
320
442
  ),
321
- /* @__PURE__ */ jsx6("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
443
+ /* @__PURE__ */ jsx7("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
322
444
  ] }) });
323
445
  };
324
446
  var NumberInput_default = NumberInput;
325
447
 
326
448
  // src/components/controls/edit/CheckboxInput.tsx
327
- import React7 from "react";
328
- import { Fragment, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
449
+ import React8 from "react";
450
+ import { Fragment, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
329
451
  var CheckboxInput = (props) => {
330
452
  const textChangeHandler = (event) => {
331
453
  let text = event.target.checked;
@@ -342,9 +464,9 @@ var CheckboxInput = (props) => {
342
464
  if (props.value != void 0 && props.value != null && props.value != "" && (props.value == "true" || props.value.toString() == "true")) {
343
465
  value = true;
344
466
  }
345
- return /* @__PURE__ */ jsx7(React7.Fragment, { children: /* @__PURE__ */ jsxs7("div", { className: "mb-1", children: [
346
- props?.attributes?.label && /* @__PURE__ */ jsxs7(Fragment, { children: [
347
- /* @__PURE__ */ jsx7(
467
+ return /* @__PURE__ */ jsx8(React8.Fragment, { children: /* @__PURE__ */ jsxs8("div", { className: "mb-1", children: [
468
+ props?.attributes?.label && /* @__PURE__ */ jsxs8(Fragment, { children: [
469
+ /* @__PURE__ */ jsx8(
348
470
  "label",
349
471
  {
350
472
  htmlFor: props.name,
@@ -352,9 +474,9 @@ var CheckboxInput = (props) => {
352
474
  children: props.attributes.label
353
475
  }
354
476
  ),
355
- props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ jsx7("span", { className: "bg-error-weak", children: "*" })
477
+ props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ jsx8("span", { className: "bg-error-weak", children: "*" })
356
478
  ] }),
357
- /* @__PURE__ */ jsx7(
479
+ /* @__PURE__ */ jsx8(
358
480
  "input",
359
481
  {
360
482
  type: "checkbox",
@@ -371,14 +493,14 @@ var CheckboxInput = (props) => {
371
493
  className: "peer mt-1 py-1.5 block rounded shadow-sm\n disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none\n "
372
494
  }
373
495
  ),
374
- /* @__PURE__ */ jsx7("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage || "" })
496
+ /* @__PURE__ */ jsx8("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage || "" })
375
497
  ] }) });
376
498
  };
377
499
  var CheckboxInput_default = CheckboxInput;
378
500
 
379
501
  // src/components/controls/edit/OtpInput.tsx
380
- import React8 from "react";
381
- import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
502
+ import React9 from "react";
503
+ import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
382
504
  var OtpInput = (props) => {
383
505
  const textChangeHandler = (event) => {
384
506
  const text = event.target.value;
@@ -400,11 +522,11 @@ var OtpInput = (props) => {
400
522
  if (props.value !== void 0 && props.value !== null) {
401
523
  value = props.value;
402
524
  }
403
- return /* @__PURE__ */ jsx8(React8.Fragment, { children: /* @__PURE__ */ jsxs8("label", { htmlFor: props.name, className: "block mb-1 w-full", children: [
404
- /* @__PURE__ */ jsx8("span", { className: "text-sm font-medium ", children: props?.attributes?.label }),
525
+ return /* @__PURE__ */ jsx9(React9.Fragment, { children: /* @__PURE__ */ jsxs9("label", { htmlFor: props.name, className: "block mb-1 w-full", children: [
526
+ /* @__PURE__ */ jsx9("span", { className: "text-sm font-medium ", children: props?.attributes?.label }),
405
527
  " ",
406
- props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ jsx8("span", { className: "bg-error-weak", children: "*" }),
407
- /* @__PURE__ */ jsx8(
528
+ props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ jsx9("span", { className: "bg-error-weak", children: "*" }),
529
+ /* @__PURE__ */ jsx9(
408
530
  "input",
409
531
  {
410
532
  type: "text",
@@ -424,14 +546,14 @@ var OtpInput = (props) => {
424
546
  className: "peer mt-1 py-1.5 block w-full rounded shadow-sm tracking-[1.25em] text-center"
425
547
  }
426
548
  ),
427
- /* @__PURE__ */ jsx8("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
549
+ /* @__PURE__ */ jsx9("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
428
550
  ] }) });
429
551
  };
430
552
  var OtpInput_default = OtpInput;
431
553
 
432
554
  // src/components/controls/edit/DateTimeInput.tsx
433
- import React9 from "react";
434
- import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
555
+ import React10 from "react";
556
+ import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
435
557
  var DateTimeInput = (props) => {
436
558
  const textChangeHandler = (event) => {
437
559
  const localDate = new Date(event.target.value);
@@ -463,12 +585,12 @@ var DateTimeInput = (props) => {
463
585
  e.preventDefault();
464
586
  }
465
587
  };
466
- return /* @__PURE__ */ jsx9(React9.Fragment, { children: /* @__PURE__ */ jsxs9("label", { className: "block mb-1", children: [
467
- /* @__PURE__ */ jsx9("span", { className: "text-sm font-medium ", children: props?.attributes?.label }),
588
+ return /* @__PURE__ */ jsx10(React10.Fragment, { children: /* @__PURE__ */ jsxs10("label", { className: "block mb-1", children: [
589
+ /* @__PURE__ */ jsx10("span", { className: "text-sm font-medium ", children: props?.attributes?.label }),
468
590
  " ",
469
- props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ jsx9("span", { className: "bg-error-weak", children: "*" }),
470
- /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
471
- /* @__PURE__ */ jsx9(
591
+ props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ jsx10("span", { className: "bg-error-weak", children: "*" }),
592
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
593
+ /* @__PURE__ */ jsx10(
472
594
  "input",
473
595
  {
474
596
  type: "datetime-local",
@@ -486,19 +608,19 @@ var DateTimeInput = (props) => {
486
608
  className: "peer mt-1 py-1.5 block w-full rounded shadow-sm\n disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none\n "
487
609
  }
488
610
  ),
489
- /* @__PURE__ */ jsx9("span", { children: timeZoneAbbr })
611
+ /* @__PURE__ */ jsx10("span", { children: timeZoneAbbr })
490
612
  ] }),
491
- /* @__PURE__ */ jsx9("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
613
+ /* @__PURE__ */ jsx10("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
492
614
  ] }) });
493
615
  };
494
616
  var DateTimeInput_default = DateTimeInput;
495
617
 
496
618
  // src/components/controls/edit/ColorInput.tsx
497
- import React10, { useEffect } from "react";
498
- import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
619
+ import React11, { useEffect as useEffect2 } from "react";
620
+ import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
499
621
  var ColorInput = (props) => {
500
- const [color, setColor] = React10.useState("#3b82f6");
501
- useEffect(() => {
622
+ const [color, setColor] = React11.useState("#3b82f6");
623
+ useEffect2(() => {
502
624
  if (props.value !== void 0 && props.value !== null) {
503
625
  if (typeof props.value === "string") {
504
626
  setColor(props.value);
@@ -517,11 +639,11 @@ var ColorInput = (props) => {
517
639
  });
518
640
  }
519
641
  };
520
- return /* @__PURE__ */ jsxs10("label", { className: "block mb-1", children: [
521
- /* @__PURE__ */ jsx10("span", { className: "text-sm font-medium", children: props?.attributes?.label }),
642
+ return /* @__PURE__ */ jsxs11("label", { className: "block mb-1", children: [
643
+ /* @__PURE__ */ jsx11("span", { className: "text-sm font-medium", children: props?.attributes?.label }),
522
644
  " ",
523
- props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ jsx10("span", { className: "bg-error-weak", children: "*" }),
524
- /* @__PURE__ */ jsx10(
645
+ props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ jsx11("span", { className: "bg-error-weak", children: "*" }),
646
+ /* @__PURE__ */ jsx11(
525
647
  "input",
526
648
  {
527
649
  type: "color",
@@ -534,21 +656,21 @@ var ColorInput = (props) => {
534
656
  className: `w-[78px] h-12 block cursor-pointer`
535
657
  }
536
658
  ),
537
- props?.attributes?.errorMessage && /* @__PURE__ */ jsx10("p", { className: "mt-1 bg-error-weak text-sm", children: props.attributes.errorMessage })
659
+ props?.attributes?.errorMessage && /* @__PURE__ */ jsx11("p", { className: "mt-1 bg-error-weak text-sm", children: props.attributes.errorMessage })
538
660
  ] });
539
661
  };
540
662
  var ColorInput_default = ColorInput;
541
663
 
542
664
  // src/components/controls/edit/SelectWithSearchInput.tsx
543
- import { useEffect as useEffect2, useRef, useState } from "react";
544
- import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
665
+ import { useEffect as useEffect3, useRef, useState as useState2 } from "react";
666
+ import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
545
667
  var SelectWithSearchInput = (props) => {
546
- const [isOpen, setIsOpen] = useState(false);
547
- const [searchTerm, setSearchTerm] = useState("");
548
- const [highlightedIndex, setHighlightedIndex] = useState(-1);
549
- const [selectedItem, setSelectedItem] = useState(null);
550
- const [list, setList] = useState([]);
551
- useEffect2(() => {
668
+ const [isOpen, setIsOpen] = useState2(false);
669
+ const [searchTerm, setSearchTerm] = useState2("");
670
+ const [highlightedIndex, setHighlightedIndex] = useState2(-1);
671
+ const [selectedItem, setSelectedItem] = useState2(null);
672
+ const [list, setList] = useState2([]);
673
+ useEffect3(() => {
552
674
  async function fetchData() {
553
675
  if (props.dataset) {
554
676
  setList(props.dataset);
@@ -603,7 +725,7 @@ var SelectWithSearchInput = (props) => {
603
725
  }
604
726
  };
605
727
  const dropdownRef = useRef(null);
606
- useEffect2(() => {
728
+ useEffect3(() => {
607
729
  if (highlightedIndex >= 0 && dropdownRef.current) {
608
730
  const highlightedItem = dropdownRef.current.children[highlightedIndex];
609
731
  highlightedItem?.scrollIntoView({
@@ -612,15 +734,15 @@ var SelectWithSearchInput = (props) => {
612
734
  });
613
735
  }
614
736
  }, [highlightedIndex]);
615
- return /* @__PURE__ */ jsxs11("div", { className: "relative", children: [
616
- /* @__PURE__ */ jsxs11("label", { children: [
737
+ return /* @__PURE__ */ jsxs12("div", { className: "relative", children: [
738
+ /* @__PURE__ */ jsxs12("label", { children: [
617
739
  props.attributes?.label,
618
740
  " ",
619
741
  " ",
620
- props?.attributes?.required && /* @__PURE__ */ jsx11("span", { className: "bg-error-weak", children: "*" })
742
+ props?.attributes?.required && /* @__PURE__ */ jsx12("span", { className: "bg-error-weak", children: "*" })
621
743
  ] }),
622
- /* @__PURE__ */ jsxs11("div", { className: "relative", children: [
623
- /* @__PURE__ */ jsx11(
744
+ /* @__PURE__ */ jsxs12("div", { className: "relative", children: [
745
+ /* @__PURE__ */ jsx12(
624
746
  "input",
625
747
  {
626
748
  type: "text",
@@ -636,13 +758,13 @@ var SelectWithSearchInput = (props) => {
636
758
  className: "peer py-1.5 select block w-full text-black rounded border-gray-300 shadow-sm\n focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50\n disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none\n "
637
759
  }
638
760
  ),
639
- /* @__PURE__ */ jsx11(
761
+ /* @__PURE__ */ jsx12(
640
762
  "button",
641
763
  {
642
764
  type: "button",
643
765
  onClick: () => setIsOpen(!isOpen),
644
766
  className: "absolute right-2 top-3 h-5 w-5 text-gray-500 focus:outline-none",
645
- children: /* @__PURE__ */ jsx11(
767
+ children: /* @__PURE__ */ jsx12(
646
768
  "svg",
647
769
  {
648
770
  xmlns: "http://www.w3.org/2000/svg",
@@ -651,7 +773,7 @@ var SelectWithSearchInput = (props) => {
651
773
  strokeWidth: 1.5,
652
774
  stroke: "currentColor",
653
775
  className: "w-full h-full",
654
- children: /* @__PURE__ */ jsx11(
776
+ children: /* @__PURE__ */ jsx12(
655
777
  "path",
656
778
  {
657
779
  strokeLinecap: "round",
@@ -664,12 +786,12 @@ var SelectWithSearchInput = (props) => {
664
786
  }
665
787
  )
666
788
  ] }),
667
- isOpen && /* @__PURE__ */ jsx11(
789
+ isOpen && /* @__PURE__ */ jsx12(
668
790
  "div",
669
791
  {
670
792
  ref: dropdownRef,
671
793
  className: "absolute z-10 mt-2 w-full bg-white border border-gray-200 rounded-md shadow-lg max-h-48 overflow-y-auto",
672
- children: filteredItems.length > 0 ? filteredItems.map((item, index) => /* @__PURE__ */ jsx11(
794
+ children: filteredItems.length > 0 ? filteredItems.map((item, index) => /* @__PURE__ */ jsx12(
673
795
  "button",
674
796
  {
675
797
  onClick: (e) => handleSelect(e, item),
@@ -677,10 +799,10 @@ var SelectWithSearchInput = (props) => {
677
799
  role: "option",
678
800
  tabIndex: -1,
679
801
  onMouseEnter: () => setHighlightedIndex(index),
680
- children: /* @__PURE__ */ jsx11("span", { children: item[props.dataTextFieldName] })
802
+ children: /* @__PURE__ */ jsx12("span", { children: item[props.dataTextFieldName] })
681
803
  },
682
804
  item[props.dataKeyFieldName]
683
- )) : /* @__PURE__ */ jsx11("div", { className: "px-4 py-2 text-gray-500", children: "No results found" })
805
+ )) : /* @__PURE__ */ jsx12("div", { className: "px-4 py-2 text-gray-500", children: "No results found" })
684
806
  }
685
807
  )
686
808
  ] });
@@ -688,13 +810,13 @@ var SelectWithSearchInput = (props) => {
688
810
  var SelectWithSearchInput_default = SelectWithSearchInput;
689
811
 
690
812
  // src/components/controls/edit/BooleanSelect.tsx
691
- import React12, {
692
- useState as useState2,
693
- useEffect as useEffect3
813
+ import React13, {
814
+ useState as useState3,
815
+ useEffect as useEffect4
694
816
  } from "react";
695
- import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
817
+ import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
696
818
  var BooleanSelect = (props) => {
697
- const [list, setList] = useState2();
819
+ const [list, setList] = useState3();
698
820
  const textChangeHandler = (event) => {
699
821
  const text = event.target.value;
700
822
  const boolValue = text?.toLowerCase() === "true" || text === "1";
@@ -707,7 +829,7 @@ var BooleanSelect = (props) => {
707
829
  });
708
830
  }
709
831
  };
710
- useEffect3(() => {
832
+ useEffect4(() => {
711
833
  async function fetchData() {
712
834
  console.log("in select");
713
835
  if (props.dataset) {
@@ -741,11 +863,11 @@ var BooleanSelect = (props) => {
741
863
  if (props.value !== void 0 && props.value !== null) {
742
864
  value = props.value;
743
865
  }
744
- return /* @__PURE__ */ jsx12(React12.Fragment, { children: /* @__PURE__ */ jsxs12("label", { className: "block", children: [
745
- /* @__PURE__ */ jsx12("span", { className: "text-sm font-medium ", children: props?.attributes?.label }),
866
+ return /* @__PURE__ */ jsx13(React13.Fragment, { children: /* @__PURE__ */ jsxs13("label", { className: "block", children: [
867
+ /* @__PURE__ */ jsx13("span", { className: "text-sm font-medium ", children: props?.attributes?.label }),
746
868
  " ",
747
- props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ jsx12("span", { className: "bg-error-weak", children: "*" }),
748
- /* @__PURE__ */ jsxs12(
869
+ props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ jsx13("span", { className: "bg-error-weak", children: "*" }),
870
+ /* @__PURE__ */ jsxs13(
749
871
  "select",
750
872
  {
751
873
  name: props.name,
@@ -757,9 +879,9 @@ var BooleanSelect = (props) => {
757
879
  disabled: props?.attributes?.readOnly,
758
880
  className: "peer mt-1 py-1.5 block w-full text-black rounded shadow-sm\n disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none\n ",
759
881
  children: [
760
- /* @__PURE__ */ jsx12("option", { className: "", value: "", children: props.attributes?.placeholder || "Select" }),
882
+ /* @__PURE__ */ jsx13("option", { className: "", value: "", children: props.attributes?.placeholder || "Select" }),
761
883
  list && list.map((item, i) => {
762
- return /* @__PURE__ */ jsx12(
884
+ return /* @__PURE__ */ jsx13(
763
885
  "option",
764
886
  {
765
887
  className: "fac-select-option",
@@ -772,14 +894,14 @@ var BooleanSelect = (props) => {
772
894
  ]
773
895
  }
774
896
  ),
775
- /* @__PURE__ */ jsx12("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
897
+ /* @__PURE__ */ jsx13("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
776
898
  ] }) });
777
899
  };
778
900
  var BooleanSelect_default = BooleanSelect;
779
901
 
780
902
  // src/components/controls/edit/EmailInput.tsx
781
- import React13 from "react";
782
- import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
903
+ import React14 from "react";
904
+ import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
783
905
  var EmailInput = (props) => {
784
906
  const textChangeHandler = (event) => {
785
907
  const text = event.target.value;
@@ -804,11 +926,11 @@ var EmailInput = (props) => {
804
926
  if (props.value !== void 0 && props.value !== null) {
805
927
  value = props.value;
806
928
  }
807
- return /* @__PURE__ */ jsx13(React13.Fragment, { children: /* @__PURE__ */ jsxs13("label", { className: "block mb-1", children: [
808
- /* @__PURE__ */ jsx13("span", { className: "text-sm font-medium text-slate-700", children: props?.attributes?.label }),
929
+ return /* @__PURE__ */ jsx14(React14.Fragment, { children: /* @__PURE__ */ jsxs14("label", { className: "block mb-1", children: [
930
+ /* @__PURE__ */ jsx14("span", { className: "text-sm font-medium text-slate-700", children: props?.attributes?.label }),
809
931
  " ",
810
- props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ jsx13("span", { className: "bg-error-weak", children: "*" }),
811
- /* @__PURE__ */ jsx13(
932
+ props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ jsx14("span", { className: "bg-error-weak", children: "*" }),
933
+ /* @__PURE__ */ jsx14(
812
934
  "input",
813
935
  {
814
936
  type: "email",
@@ -824,14 +946,14 @@ var EmailInput = (props) => {
824
946
  className: "peer mt-1 py-1.5 block w-full rounded shadow-sm\n transition-all duration-500 ease-in-out"
825
947
  }
826
948
  ),
827
- /* @__PURE__ */ jsx13("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 mb-0 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
949
+ /* @__PURE__ */ jsx14("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 mb-0 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
828
950
  ] }) });
829
951
  };
830
952
  var EmailInput_default = EmailInput;
831
953
 
832
954
  // src/components/controls/edit/TimeInput.tsx
833
- import React14 from "react";
834
- import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
955
+ import React15 from "react";
956
+ import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
835
957
  var TimeInput = (props) => {
836
958
  const timeChangeHandler = (event) => {
837
959
  const timeValue = event.target.value;
@@ -844,11 +966,11 @@ var TimeInput = (props) => {
844
966
  });
845
967
  }
846
968
  };
847
- return /* @__PURE__ */ jsx14(React14.Fragment, { children: /* @__PURE__ */ jsxs14("label", { className: "block mb-1", children: [
848
- /* @__PURE__ */ jsx14("span", { className: "text-sm font-medium", children: props?.attributes?.label }),
969
+ return /* @__PURE__ */ jsx15(React15.Fragment, { children: /* @__PURE__ */ jsxs15("label", { className: "block mb-1", children: [
970
+ /* @__PURE__ */ jsx15("span", { className: "text-sm font-medium", children: props?.attributes?.label }),
849
971
  " ",
850
- props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ jsx14("span", { className: "bg-error-weak", children: "*" }),
851
- /* @__PURE__ */ jsx14("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx14(
972
+ props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ jsx15("span", { className: "bg-error-weak", children: "*" }),
973
+ /* @__PURE__ */ jsx15("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx15(
852
974
  "input",
853
975
  {
854
976
  type: "time",
@@ -861,7 +983,7 @@ var TimeInput = (props) => {
861
983
  className: "peer mt-1 py-1.5 block w-full rounded shadow-sm\n disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none"
862
984
  }
863
985
  ) }),
864
- /* @__PURE__ */ jsx14("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ?? "" })
986
+ /* @__PURE__ */ jsx15("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ?? "" })
865
987
  ] }) });
866
988
  };
867
989
  var TimeInput_default = TimeInput;
@@ -946,7 +1068,7 @@ var DateTimeUtility = class {
946
1068
  var DateTimeUtility_default = DateTimeUtility;
947
1069
 
948
1070
  // src/components/controls/edit/DateInput.tsx
949
- import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
1071
+ import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
950
1072
  var DateInput = (props) => {
951
1073
  const value = useMemo(() => {
952
1074
  if (props.value === void 0 || props.value === null || props.value === "") {
@@ -980,11 +1102,11 @@ var DateInput = (props) => {
980
1102
  groupKey: props.groupKey
981
1103
  });
982
1104
  };
983
- return /* @__PURE__ */ jsxs15("label", { className: "block mb-1", children: [
984
- props.attributes?.label && /* @__PURE__ */ jsx15("span", { className: "text-sm font-medium", children: props.attributes.label }),
1105
+ return /* @__PURE__ */ jsxs16("label", { className: "block mb-1", children: [
1106
+ props.attributes?.label && /* @__PURE__ */ jsx16("span", { className: "text-sm font-medium", children: props.attributes.label }),
985
1107
  " ",
986
- props.attributes?.label && props.attributes.required && /* @__PURE__ */ jsx15("span", { className: "bg-error-weak", children: "*" }),
987
- /* @__PURE__ */ jsx15(
1108
+ props.attributes?.label && props.attributes.required && /* @__PURE__ */ jsx16("span", { className: "bg-error-weak", children: "*" }),
1109
+ /* @__PURE__ */ jsx16(
988
1110
  "input",
989
1111
  {
990
1112
  type: "date",
@@ -998,17 +1120,17 @@ var DateInput = (props) => {
998
1120
  className: `peer input mt-1 py-1.5 block w-full rounded shadow-sm ${props.inputClasses ?? ""}`
999
1121
  }
1000
1122
  ),
1001
- /* @__PURE__ */ jsx15("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props.attributes?.errorMessage ?? "" })
1123
+ /* @__PURE__ */ jsx16("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props.attributes?.errorMessage ?? "" })
1002
1124
  ] });
1003
1125
  };
1004
1126
  var DateInput_default = DateInput;
1005
1127
 
1006
1128
  // src/components/controls/edit/RadioInput.tsx
1007
- import { useEffect as useEffect4, useState as useState3 } from "react";
1008
- import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
1129
+ import { useEffect as useEffect5, useState as useState4 } from "react";
1130
+ import { jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
1009
1131
  var RadioInput = (props) => {
1010
- const [list, setList] = useState3([]);
1011
- useEffect4(() => {
1132
+ const [list, setList] = useState4([]);
1133
+ useEffect5(() => {
1012
1134
  async function loadData() {
1013
1135
  if (props.dataset) {
1014
1136
  setList(props.dataset);
@@ -1050,22 +1172,22 @@ var RadioInput = (props) => {
1050
1172
  });
1051
1173
  }
1052
1174
  };
1053
- return /* @__PURE__ */ jsxs16("div", { className: "block", children: [
1054
- /* @__PURE__ */ jsx16("span", { className: "text-sm font-medium", children: props.attributes?.label }),
1055
- /* @__PURE__ */ jsx16("div", { className: "flex flex-col gap-3", children: list.map((item, index) => {
1175
+ return /* @__PURE__ */ jsxs17("div", { className: "block", children: [
1176
+ /* @__PURE__ */ jsx17("span", { className: "text-sm font-medium", children: props.attributes?.label }),
1177
+ /* @__PURE__ */ jsx17("div", { className: "flex flex-col gap-3", children: list.map((item, index) => {
1056
1178
  const itemValue = item[props.dataKeyFieldName];
1057
1179
  const isSelected = String(itemValue) === String(props.value ?? "");
1058
1180
  const isRecommended = props.dataRecommendedValue !== void 0 && String(itemValue) === String(props.dataRecommendedValue);
1059
1181
  const resultClassName = isSelected ? isRecommended ? "bg-success" : props.dataRecommendedValue ? "bg-alert" : "border-transparent" : "border-transparent";
1060
1182
  const iconName = isSelected && props.dataRecommendedValue ? isRecommended ? "checkCircle" : "xCircle" : void 0;
1061
1183
  const inputId = `${props.name}-${props.index ?? 0}-id-${index}`;
1062
- return /* @__PURE__ */ jsxs16(
1184
+ return /* @__PURE__ */ jsxs17(
1063
1185
  "div",
1064
1186
  {
1065
1187
  className: `font-normal flex items-center justify-between gap-4 cursor-pointer border rounded p-2 ${resultClassName}`,
1066
1188
  children: [
1067
- /* @__PURE__ */ jsxs16("div", { className: "flex gap-4 items-start", children: [
1068
- /* @__PURE__ */ jsx16(
1189
+ /* @__PURE__ */ jsxs17("div", { className: "flex gap-4 items-start", children: [
1190
+ /* @__PURE__ */ jsx17(
1069
1191
  "input",
1070
1192
  {
1071
1193
  type: "radio",
@@ -1079,25 +1201,25 @@ var RadioInput = (props) => {
1079
1201
  required: props.attributes?.required
1080
1202
  }
1081
1203
  ),
1082
- /* @__PURE__ */ jsx16("label", { className: "text-body-950 pr-2", htmlFor: inputId, children: item[props.dataTextFieldName] })
1204
+ /* @__PURE__ */ jsx17("label", { className: "text-body-950 pr-2", htmlFor: inputId, children: item[props.dataTextFieldName] })
1083
1205
  ] }),
1084
- iconName && /* @__PURE__ */ jsx16(Icon_default, { className: "w-5 h-5 text-success", name: iconName })
1206
+ iconName && /* @__PURE__ */ jsx17(Icon_default, { className: "w-5 h-5 text-success", name: iconName })
1085
1207
  ]
1086
1208
  },
1087
1209
  String(itemValue)
1088
1210
  );
1089
1211
  }) }),
1090
- /* @__PURE__ */ jsx16("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props.attributes?.errorMessage ?? "" })
1212
+ /* @__PURE__ */ jsx17("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props.attributes?.errorMessage ?? "" })
1091
1213
  ] });
1092
1214
  };
1093
1215
  var RadioInput_default = RadioInput;
1094
1216
 
1095
1217
  // src/components/controls/edit/Switcher.tsx
1096
- import { useEffect as useEffect5, useState as useState4 } from "react";
1097
- import { jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
1218
+ import { useEffect as useEffect6, useState as useState5 } from "react";
1219
+ import { jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
1098
1220
  var Switcher = (props) => {
1099
- const [list, setList] = useState4([]);
1100
- useEffect5(() => {
1221
+ const [list, setList] = useState5([]);
1222
+ useEffect6(() => {
1101
1223
  async function loadData() {
1102
1224
  if (props.dataset) {
1103
1225
  setList(props.dataset);
@@ -1138,9 +1260,9 @@ var Switcher = (props) => {
1138
1260
  });
1139
1261
  };
1140
1262
  const value = props.value === void 0 || props.value === null ? "" : String(props.value);
1141
- return /* @__PURE__ */ jsxs17("label", { className: "block mb-1", children: [
1142
- /* @__PURE__ */ jsx17("span", { className: "text-sm font-medium", children: props.attributes?.label }),
1143
- list.length === 0 ? /* @__PURE__ */ jsx17(
1263
+ return /* @__PURE__ */ jsxs18("label", { className: "block mb-1", children: [
1264
+ /* @__PURE__ */ jsx18("span", { className: "text-sm font-medium", children: props.attributes?.label }),
1265
+ list.length === 0 ? /* @__PURE__ */ jsx18(
1144
1266
  "input",
1145
1267
  {
1146
1268
  type: "text",
@@ -1153,7 +1275,7 @@ var Switcher = (props) => {
1153
1275
  disabled: props.attributes?.readOnly,
1154
1276
  className: `peer input mt-1 py-1.5 block w-full rounded shadow-sm ${props.inputClasses ?? ""}`
1155
1277
  }
1156
- ) : /* @__PURE__ */ jsxs17(
1278
+ ) : /* @__PURE__ */ jsxs18(
1157
1279
  "select",
1158
1280
  {
1159
1281
  name: props.name,
@@ -1164,8 +1286,8 @@ var Switcher = (props) => {
1164
1286
  disabled: props.attributes?.readOnly,
1165
1287
  className: `peer select my-1 py-1 block w-full rounded shadow-sm ${props.inputClasses ?? ""}`,
1166
1288
  children: [
1167
- /* @__PURE__ */ jsx17("option", { value: "", children: props.attributes?.placeholder || "Select" }),
1168
- list.map((item) => /* @__PURE__ */ jsx17(
1289
+ /* @__PURE__ */ jsx18("option", { value: "", children: props.attributes?.placeholder || "Select" }),
1290
+ list.map((item) => /* @__PURE__ */ jsx18(
1169
1291
  "option",
1170
1292
  {
1171
1293
  value: item[props.dataKeyFieldName],
@@ -1176,7 +1298,7 @@ var Switcher = (props) => {
1176
1298
  ]
1177
1299
  }
1178
1300
  ),
1179
- /* @__PURE__ */ jsx17("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props.attributes?.errorMessage ?? "" })
1301
+ /* @__PURE__ */ jsx18("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props.attributes?.errorMessage ?? "" })
1180
1302
  ] });
1181
1303
  };
1182
1304
  var Switcher_default = Switcher;
@@ -1207,6 +1329,7 @@ export {
1207
1329
  MultilineTextInput_default,
1208
1330
  LineTextInput_default,
1209
1331
  MoneyInput_default,
1332
+ Select_default,
1210
1333
  PercentageInput_default,
1211
1334
  PhoneInput_default,
1212
1335
  NumberInput_default,