@proveanything/smartlinks-utils-ui 0.1.7 → 0.1.9
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/{chunk-YVHF5JBL.js → chunk-4EEUXIP3.js} +291 -166
- package/dist/chunk-4EEUXIP3.js.map +1 -0
- package/dist/components/ConditionsEditor/index.js +1 -1
- package/dist/index.css +21 -107
- package/dist/index.css.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-YVHF5JBL.js.map +0 -1
|
@@ -443,80 +443,143 @@ var CountryPicker = ({
|
|
|
443
443
|
if (disabled) return;
|
|
444
444
|
onChange(selected.filter((c) => c !== code));
|
|
445
445
|
};
|
|
446
|
-
|
|
446
|
+
const triggerStyle = {
|
|
447
|
+
minHeight: 38,
|
|
448
|
+
width: "100%",
|
|
449
|
+
display: "flex",
|
|
450
|
+
flexWrap: "wrap",
|
|
451
|
+
alignItems: "center",
|
|
452
|
+
gap: 6,
|
|
453
|
+
padding: "6px 10px",
|
|
454
|
+
borderRadius: 6,
|
|
455
|
+
border: `1px solid ${open ? "#3b82f6" : "#d1d5db"}`,
|
|
456
|
+
backgroundColor: "transparent",
|
|
457
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
458
|
+
opacity: disabled ? 0.5 : 1,
|
|
459
|
+
outline: open ? "1px solid #3b82f6" : "none",
|
|
460
|
+
transition: "border-color 0.15s"
|
|
461
|
+
};
|
|
462
|
+
const chipStyle = {
|
|
463
|
+
display: "inline-flex",
|
|
464
|
+
alignItems: "center",
|
|
465
|
+
gap: 4,
|
|
466
|
+
padding: "2px 8px",
|
|
467
|
+
borderRadius: 9999,
|
|
468
|
+
fontSize: 12,
|
|
469
|
+
fontWeight: 500,
|
|
470
|
+
backgroundColor: "#dbeafe",
|
|
471
|
+
color: "#1d4ed8",
|
|
472
|
+
border: "1px solid #bfdbfe"
|
|
473
|
+
};
|
|
474
|
+
const dropdownStyle = {
|
|
475
|
+
position: "absolute",
|
|
476
|
+
zIndex: 50,
|
|
477
|
+
marginTop: 4,
|
|
478
|
+
width: "100%",
|
|
479
|
+
maxHeight: 200,
|
|
480
|
+
overflowY: "auto",
|
|
481
|
+
borderRadius: 6,
|
|
482
|
+
border: "1px solid #e5e7eb",
|
|
483
|
+
backgroundColor: "#ffffff",
|
|
484
|
+
boxShadow: "0 4px 12px rgba(0,0,0,0.12)"
|
|
485
|
+
};
|
|
486
|
+
const inputStyle2 = {
|
|
487
|
+
flex: 1,
|
|
488
|
+
minWidth: 120,
|
|
489
|
+
fontSize: 14,
|
|
490
|
+
backgroundColor: "transparent",
|
|
491
|
+
outline: "none",
|
|
492
|
+
color: "#111827",
|
|
493
|
+
border: "none"
|
|
494
|
+
};
|
|
495
|
+
return /* @__PURE__ */ jsxs("div", { ref: containerRef, style: { position: "relative" }, children: [
|
|
447
496
|
/* @__PURE__ */ jsxs(
|
|
448
497
|
"div",
|
|
449
498
|
{
|
|
450
|
-
|
|
451
|
-
"min-h-[38px] w-full flex flex-wrap items-center gap-1.5 px-2.5 py-1.5",
|
|
452
|
-
"rounded-md border border-gray-300 dark:border-gray-600 bg-transparent",
|
|
453
|
-
"cursor-pointer transition-colors",
|
|
454
|
-
open && "ring-1 ring-blue-500 border-blue-500",
|
|
455
|
-
disabled && "opacity-50 cursor-not-allowed"
|
|
456
|
-
),
|
|
499
|
+
style: triggerStyle,
|
|
457
500
|
onClick: () => {
|
|
458
501
|
if (disabled) return;
|
|
459
502
|
setOpen(true);
|
|
460
503
|
setTimeout(() => inputRef.current?.focus(), 0);
|
|
461
504
|
},
|
|
462
505
|
children: [
|
|
463
|
-
selected.map((code) => /* @__PURE__ */ jsxs(
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
"
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
)
|
|
483
|
-
]
|
|
484
|
-
},
|
|
485
|
-
code
|
|
486
|
-
)),
|
|
487
|
-
selected.length === 0 && !open && /* @__PURE__ */ jsx("span", { className: "text-sm text-gray-400", children: placeholder }),
|
|
506
|
+
selected.map((code) => /* @__PURE__ */ jsxs("span", { style: chipStyle, children: [
|
|
507
|
+
getCountryName(code),
|
|
508
|
+
" (",
|
|
509
|
+
code,
|
|
510
|
+
")",
|
|
511
|
+
!disabled && /* @__PURE__ */ jsx(
|
|
512
|
+
"button",
|
|
513
|
+
{
|
|
514
|
+
type: "button",
|
|
515
|
+
onClick: (e) => {
|
|
516
|
+
e.stopPropagation();
|
|
517
|
+
remove(code);
|
|
518
|
+
},
|
|
519
|
+
style: { background: "none", border: "none", cursor: "pointer", padding: 0, color: "#1d4ed8", fontSize: 14, lineHeight: 1 },
|
|
520
|
+
children: "\u2715"
|
|
521
|
+
}
|
|
522
|
+
)
|
|
523
|
+
] }, code)),
|
|
524
|
+
selected.length === 0 && !open && /* @__PURE__ */ jsx("span", { style: { fontSize: 14, color: "#9ca3af" }, children: placeholder }),
|
|
488
525
|
open && /* @__PURE__ */ jsx(
|
|
489
526
|
"input",
|
|
490
527
|
{
|
|
491
528
|
ref: inputRef,
|
|
492
529
|
value: search,
|
|
493
530
|
onChange: (e) => setSearch(e.target.value),
|
|
494
|
-
|
|
531
|
+
style: inputStyle2,
|
|
495
532
|
placeholder,
|
|
496
533
|
onClick: (e) => e.stopPropagation()
|
|
497
534
|
}
|
|
498
535
|
),
|
|
499
|
-
/* @__PURE__ */ jsx(
|
|
536
|
+
/* @__PURE__ */ jsx("span", { style: { marginLeft: "auto", flexShrink: 0, fontSize: 12, color: "#9ca3af", transition: "transform 0.15s", transform: open ? "rotate(180deg)" : "none" }, children: "\u25BC" })
|
|
500
537
|
]
|
|
501
538
|
}
|
|
502
539
|
),
|
|
503
|
-
open && /* @__PURE__ */ jsx("div", {
|
|
540
|
+
open && /* @__PURE__ */ jsx("div", { style: dropdownStyle, children: filtered.length === 0 ? /* @__PURE__ */ jsx("div", { style: { padding: "8px 12px", fontSize: 14, color: "#9ca3af" }, children: "No countries found" }) : filtered.map((country) => {
|
|
504
541
|
const isSelected = selected.includes(country.code);
|
|
505
542
|
return /* @__PURE__ */ jsxs(
|
|
506
543
|
"button",
|
|
507
544
|
{
|
|
545
|
+
type: "button",
|
|
508
546
|
onClick: () => toggle(country.code),
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
547
|
+
style: {
|
|
548
|
+
width: "100%",
|
|
549
|
+
display: "flex",
|
|
550
|
+
alignItems: "center",
|
|
551
|
+
gap: 8,
|
|
552
|
+
padding: "6px 12px",
|
|
553
|
+
fontSize: 14,
|
|
554
|
+
textAlign: "left",
|
|
555
|
+
border: "none",
|
|
556
|
+
cursor: "pointer",
|
|
557
|
+
transition: "background-color 0.1s",
|
|
558
|
+
backgroundColor: isSelected ? "#eff6ff" : "transparent",
|
|
559
|
+
color: isSelected ? "#1d4ed8" : "#374151"
|
|
560
|
+
},
|
|
561
|
+
onMouseEnter: (e) => {
|
|
562
|
+
if (!isSelected) e.currentTarget.style.backgroundColor = "#f9fafb";
|
|
563
|
+
},
|
|
564
|
+
onMouseLeave: (e) => {
|
|
565
|
+
e.currentTarget.style.backgroundColor = isSelected ? "#eff6ff" : "transparent";
|
|
566
|
+
},
|
|
513
567
|
children: [
|
|
514
|
-
/* @__PURE__ */ jsx("span", {
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
568
|
+
/* @__PURE__ */ jsx("span", { style: {
|
|
569
|
+
width: 16,
|
|
570
|
+
height: 16,
|
|
571
|
+
borderRadius: 3,
|
|
572
|
+
border: `1px solid ${isSelected ? "#3b82f6" : "#d1d5db"}`,
|
|
573
|
+
backgroundColor: isSelected ? "#3b82f6" : "transparent",
|
|
574
|
+
display: "flex",
|
|
575
|
+
alignItems: "center",
|
|
576
|
+
justifyContent: "center",
|
|
577
|
+
flexShrink: 0,
|
|
578
|
+
color: "#ffffff",
|
|
579
|
+
fontSize: 10
|
|
580
|
+
}, children: isSelected && "\u2713" }),
|
|
581
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1 }, children: country.name }),
|
|
582
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: 12, color: "#9ca3af", fontFamily: "monospace" }, children: country.code })
|
|
520
583
|
]
|
|
521
584
|
},
|
|
522
585
|
country.code
|
|
@@ -524,40 +587,120 @@ var CountryPicker = ({
|
|
|
524
587
|
}) })
|
|
525
588
|
] });
|
|
526
589
|
};
|
|
527
|
-
var ContainsToggle = ({ value = true, onChange, trueLabel = "Is One Of", falseLabel = "Is Not One Of", disabled }) => /* @__PURE__ */ jsx("div", {
|
|
590
|
+
var ContainsToggle = ({ value = true, onChange, trueLabel = "Is One Of", falseLabel = "Is Not One Of", disabled }) => /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: 4, backgroundColor: "#f3f4f6", borderRadius: 6, padding: 4, width: "fit-content" }, children: [{ v: true, label: trueLabel }, { v: false, label: falseLabel }].map((opt) => /* @__PURE__ */ jsx(
|
|
528
591
|
"button",
|
|
529
592
|
{
|
|
593
|
+
type: "button",
|
|
530
594
|
onClick: () => onChange(opt.v),
|
|
531
595
|
disabled,
|
|
532
|
-
|
|
533
|
-
"
|
|
534
|
-
|
|
535
|
-
|
|
596
|
+
style: {
|
|
597
|
+
padding: "6px 12px",
|
|
598
|
+
fontSize: 12,
|
|
599
|
+
fontWeight: 600,
|
|
600
|
+
borderRadius: 4,
|
|
601
|
+
border: "none",
|
|
602
|
+
cursor: disabled ? "default" : "pointer",
|
|
603
|
+
transition: "all 0.15s",
|
|
604
|
+
...value === opt.v ? { backgroundColor: "#3b82f6", color: "#ffffff", boxShadow: "0 1px 2px rgba(0,0,0,0.1)" } : { backgroundColor: "transparent", color: "#6b7280" }
|
|
605
|
+
},
|
|
536
606
|
children: opt.label
|
|
537
607
|
},
|
|
538
608
|
String(opt.v)
|
|
539
609
|
)) });
|
|
540
|
-
var
|
|
610
|
+
var ToggleSwitch = ({ checked, onChange, label, disabled }) => /* @__PURE__ */ jsxs("label", { style: { display: "flex", alignItems: "center", gap: 8, fontSize: 12, fontWeight: 500, color: "#4b5563", cursor: "pointer", userSelect: "none" }, children: [
|
|
611
|
+
/* @__PURE__ */ jsx(
|
|
612
|
+
"button",
|
|
613
|
+
{
|
|
614
|
+
type: "button",
|
|
615
|
+
onClick: () => onChange(!checked),
|
|
616
|
+
disabled,
|
|
617
|
+
style: {
|
|
618
|
+
width: 36,
|
|
619
|
+
height: 20,
|
|
620
|
+
borderRadius: 10,
|
|
621
|
+
border: "none",
|
|
622
|
+
cursor: disabled ? "default" : "pointer",
|
|
623
|
+
position: "relative",
|
|
624
|
+
flexShrink: 0,
|
|
625
|
+
transition: "background-color 0.2s",
|
|
626
|
+
backgroundColor: checked ? "#3b82f6" : "#d1d5db"
|
|
627
|
+
},
|
|
628
|
+
children: /* @__PURE__ */ jsx("span", { style: {
|
|
629
|
+
position: "absolute",
|
|
630
|
+
top: 2,
|
|
631
|
+
width: 16,
|
|
632
|
+
height: 16,
|
|
633
|
+
borderRadius: "50%",
|
|
634
|
+
backgroundColor: "#ffffff",
|
|
635
|
+
boxShadow: "0 1px 3px rgba(0,0,0,0.2)",
|
|
636
|
+
transition: "transform 0.2s",
|
|
637
|
+
transform: checked ? "translateX(18px)" : "translateX(2px)"
|
|
638
|
+
} })
|
|
639
|
+
}
|
|
640
|
+
),
|
|
641
|
+
label
|
|
642
|
+
] });
|
|
643
|
+
var ChipSelect = ({ options, selected, onChange, disabled }) => /* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 }, children: options.map((opt) => {
|
|
541
644
|
const isSelected = selected.includes(opt.value);
|
|
542
645
|
return /* @__PURE__ */ jsx(
|
|
543
646
|
"button",
|
|
544
647
|
{
|
|
648
|
+
type: "button",
|
|
545
649
|
onClick: () => {
|
|
546
650
|
if (disabled) return;
|
|
547
651
|
onChange(isSelected ? selected.filter((v) => v !== opt.value) : [...selected, opt.value]);
|
|
548
652
|
},
|
|
549
653
|
disabled,
|
|
550
654
|
title: opt.description,
|
|
551
|
-
|
|
552
|
-
"
|
|
553
|
-
|
|
554
|
-
|
|
655
|
+
style: {
|
|
656
|
+
padding: "4px 10px",
|
|
657
|
+
fontSize: 12,
|
|
658
|
+
borderRadius: 9999,
|
|
659
|
+
border: "1px solid",
|
|
660
|
+
cursor: disabled ? "default" : "pointer",
|
|
661
|
+
transition: "all 0.15s",
|
|
662
|
+
...isSelected ? { backgroundColor: "#dbeafe", borderColor: "#93c5fd", color: "#1d4ed8" } : { backgroundColor: "transparent", borderColor: "#e5e7eb", color: "#6b7280" }
|
|
663
|
+
},
|
|
555
664
|
children: opt.title
|
|
556
665
|
},
|
|
557
666
|
opt.value
|
|
558
667
|
);
|
|
559
668
|
}) });
|
|
560
|
-
var
|
|
669
|
+
var inputStyle = {
|
|
670
|
+
width: "100%",
|
|
671
|
+
padding: "6px 10px",
|
|
672
|
+
fontSize: 14,
|
|
673
|
+
borderRadius: 6,
|
|
674
|
+
border: "1px solid #d1d5db",
|
|
675
|
+
backgroundColor: "transparent",
|
|
676
|
+
outline: "none"
|
|
677
|
+
};
|
|
678
|
+
var labelStyle = {
|
|
679
|
+
fontSize: 10,
|
|
680
|
+
color: "#9ca3af",
|
|
681
|
+
marginBottom: 2,
|
|
682
|
+
display: "block"
|
|
683
|
+
};
|
|
684
|
+
var PillGroup = ({ options, selected, onChange, disabled }) => /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: 4, backgroundColor: "#f3f4f6", borderRadius: 6, padding: 4, width: "fit-content" }, children: options.map((opt) => /* @__PURE__ */ jsx(
|
|
685
|
+
"button",
|
|
686
|
+
{
|
|
687
|
+
type: "button",
|
|
688
|
+
onClick: () => onChange(opt.value),
|
|
689
|
+
disabled,
|
|
690
|
+
style: {
|
|
691
|
+
padding: "6px 12px",
|
|
692
|
+
fontSize: 12,
|
|
693
|
+
fontWeight: 600,
|
|
694
|
+
borderRadius: 4,
|
|
695
|
+
border: "none",
|
|
696
|
+
cursor: disabled ? "default" : "pointer",
|
|
697
|
+
transition: "all 0.15s",
|
|
698
|
+
...selected === opt.value ? { backgroundColor: "#3b82f6", color: "#ffffff", boxShadow: "0 1px 2px rgba(0,0,0,0.1)" } : { backgroundColor: "transparent", color: "#6b7280" }
|
|
699
|
+
},
|
|
700
|
+
children: opt.label
|
|
701
|
+
},
|
|
702
|
+
opt.value
|
|
703
|
+
)) });
|
|
561
704
|
var ConditionConfig = ({
|
|
562
705
|
condition: cond,
|
|
563
706
|
onChange,
|
|
@@ -568,7 +711,7 @@ var ConditionConfig = ({
|
|
|
568
711
|
switch (cond.type) {
|
|
569
712
|
// ─── VERSION ──────────────────────────────────
|
|
570
713
|
case "version":
|
|
571
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
714
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
572
715
|
/* @__PURE__ */ jsx(ContainsToggle, { value: cond.contains, onChange: (v) => update({ contains: v }), disabled: readOnly }),
|
|
573
716
|
editorProps.versions?.length ? /* @__PURE__ */ jsx(
|
|
574
717
|
ChipSelect,
|
|
@@ -578,30 +721,21 @@ var ConditionConfig = ({
|
|
|
578
721
|
onChange: (vals) => update({ versions: vals.map((v) => ({ value: v, title: editorProps.versions?.find((o) => o.value === v)?.title || v })) }),
|
|
579
722
|
disabled: readOnly
|
|
580
723
|
}
|
|
581
|
-
) : /* @__PURE__ */ jsx("p", {
|
|
724
|
+
) : /* @__PURE__ */ jsx("p", { style: { fontSize: 12, color: "#9ca3af", fontStyle: "italic" }, children: "No versions available" })
|
|
582
725
|
] });
|
|
583
726
|
// ─── COUNTRY ──────────────────────────────────
|
|
584
727
|
case "country":
|
|
585
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
728
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
586
729
|
/* @__PURE__ */ jsx(ContainsToggle, { value: cond.contains, onChange: (v) => update({ contains: v }), disabled: readOnly }),
|
|
587
|
-
/* @__PURE__ */
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
),
|
|
597
|
-
children: /* @__PURE__ */ jsx("span", { className: cn(
|
|
598
|
-
"absolute top-0.5 w-4 h-4 rounded-full bg-white shadow transition-transform",
|
|
599
|
-
cond.useRegions ? "translate-x-4" : "translate-x-0.5"
|
|
600
|
-
) })
|
|
601
|
-
}
|
|
602
|
-
),
|
|
603
|
-
"Use regions"
|
|
604
|
-
] }),
|
|
730
|
+
/* @__PURE__ */ jsx(
|
|
731
|
+
ToggleSwitch,
|
|
732
|
+
{
|
|
733
|
+
checked: !!cond.useRegions,
|
|
734
|
+
onChange: (v) => update({ useRegions: v }),
|
|
735
|
+
label: "Use regions",
|
|
736
|
+
disabled: readOnly
|
|
737
|
+
}
|
|
738
|
+
),
|
|
605
739
|
cond.useRegions ? /* @__PURE__ */ jsx(
|
|
606
740
|
ChipSelect,
|
|
607
741
|
{
|
|
@@ -621,31 +755,31 @@ var ConditionConfig = ({
|
|
|
621
755
|
] });
|
|
622
756
|
// ─── VALUE ────────────────────────────────────
|
|
623
757
|
case "value":
|
|
624
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
625
|
-
/* @__PURE__ */ jsxs("div", {
|
|
758
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
759
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8 }, children: [
|
|
626
760
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
627
|
-
/* @__PURE__ */ jsx("label", {
|
|
628
|
-
/* @__PURE__ */ jsx("input", {
|
|
761
|
+
/* @__PURE__ */ jsx("label", { style: labelStyle, children: "Field Name" }),
|
|
762
|
+
/* @__PURE__ */ jsx("input", { style: inputStyle, value: cond.field || "", onChange: (e) => update({ field: e.target.value }), placeholder: "field_name", disabled: readOnly })
|
|
629
763
|
] }),
|
|
630
764
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
631
|
-
/* @__PURE__ */ jsx("label", {
|
|
632
|
-
/* @__PURE__ */ jsx("select", {
|
|
765
|
+
/* @__PURE__ */ jsx("label", { style: labelStyle, children: "Field Type" }),
|
|
766
|
+
/* @__PURE__ */ jsx("select", { style: inputStyle, value: cond.fieldType || "text", onChange: (e) => update({ fieldType: e.target.value }), disabled: readOnly, children: FIELD_TYPES.map((ft) => /* @__PURE__ */ jsx("option", { value: ft.value, children: ft.title }, ft.value)) })
|
|
633
767
|
] })
|
|
634
768
|
] }),
|
|
635
|
-
/* @__PURE__ */ jsxs("div", {
|
|
769
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8 }, children: [
|
|
636
770
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
637
|
-
/* @__PURE__ */ jsx("label", {
|
|
638
|
-
/* @__PURE__ */ jsx("select", {
|
|
771
|
+
/* @__PURE__ */ jsx("label", { style: labelStyle, children: "Operator" }),
|
|
772
|
+
/* @__PURE__ */ jsx("select", { style: inputStyle, value: cond.validationType || "equal", onChange: (e) => update({ validationType: e.target.value }), disabled: readOnly, children: VALUE_OPERATORS.map((op) => /* @__PURE__ */ jsx("option", { value: op.value, children: op.title }, op.value)) })
|
|
639
773
|
] }),
|
|
640
774
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
641
|
-
/* @__PURE__ */ jsx("label", {
|
|
642
|
-
/* @__PURE__ */ jsx("input", {
|
|
775
|
+
/* @__PURE__ */ jsx("label", { style: labelStyle, children: "Value" }),
|
|
776
|
+
/* @__PURE__ */ jsx("input", { style: inputStyle, value: String(cond.value ?? ""), onChange: (e) => update({ value: e.target.value }), placeholder: "value", disabled: readOnly })
|
|
643
777
|
] })
|
|
644
778
|
] })
|
|
645
779
|
] });
|
|
646
780
|
// ─── USER ─────────────────────────────────────
|
|
647
781
|
case "user":
|
|
648
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
782
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
649
783
|
/* @__PURE__ */ jsx(
|
|
650
784
|
ChipSelect,
|
|
651
785
|
{
|
|
@@ -667,35 +801,32 @@ var ConditionConfig = ({
|
|
|
667
801
|
] });
|
|
668
802
|
// ─── DATE ─────────────────────────────────────
|
|
669
803
|
case "date":
|
|
670
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
671
|
-
/* @__PURE__ */ jsx(
|
|
672
|
-
|
|
804
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
805
|
+
/* @__PURE__ */ jsx(
|
|
806
|
+
PillGroup,
|
|
673
807
|
{
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
},
|
|
685
|
-
dt
|
|
686
|
-
)) }),
|
|
808
|
+
options: [
|
|
809
|
+
{ value: "before", label: "Is Before" },
|
|
810
|
+
{ value: "after", label: "Is After" },
|
|
811
|
+
{ value: "between", label: "Is Between" }
|
|
812
|
+
],
|
|
813
|
+
selected: cond.dateTest,
|
|
814
|
+
onChange: (v) => update({ dateTest: v }),
|
|
815
|
+
disabled: readOnly
|
|
816
|
+
}
|
|
817
|
+
),
|
|
687
818
|
(cond.dateTest === "before" || cond.dateTest === "between") && /* @__PURE__ */ jsxs("div", { children: [
|
|
688
|
-
/* @__PURE__ */ jsx("label", {
|
|
689
|
-
/* @__PURE__ */ jsx("input", { type: "date",
|
|
819
|
+
/* @__PURE__ */ jsx("label", { style: labelStyle, children: cond.dateTest === "between" ? "Start Date" : "Before Date" }),
|
|
820
|
+
/* @__PURE__ */ jsx("input", { type: "date", style: inputStyle, value: cond.beforeDate || "", onChange: (e) => update({ beforeDate: e.target.value }), disabled: readOnly })
|
|
690
821
|
] }),
|
|
691
822
|
(cond.dateTest === "after" || cond.dateTest === "between") && /* @__PURE__ */ jsxs("div", { children: [
|
|
692
|
-
/* @__PURE__ */ jsx("label", {
|
|
693
|
-
/* @__PURE__ */ jsx("input", { type: "date",
|
|
823
|
+
/* @__PURE__ */ jsx("label", { style: labelStyle, children: cond.dateTest === "between" ? "End Date" : "After Date" }),
|
|
824
|
+
/* @__PURE__ */ jsx("input", { type: "date", style: inputStyle, value: cond.afterDate || "", onChange: (e) => update({ afterDate: e.target.value }), disabled: readOnly })
|
|
694
825
|
] })
|
|
695
826
|
] });
|
|
696
827
|
// ─── DEVICE ───────────────────────────────────
|
|
697
828
|
case "device":
|
|
698
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
829
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
699
830
|
/* @__PURE__ */ jsx(ContainsToggle, { value: cond.contains, onChange: (v) => update({ contains: v }), disabled: readOnly }),
|
|
700
831
|
/* @__PURE__ */ jsx(
|
|
701
832
|
ChipSelect,
|
|
@@ -709,7 +840,7 @@ var ConditionConfig = ({
|
|
|
709
840
|
] });
|
|
710
841
|
// ─── TAG ──────────────────────────────────────
|
|
711
842
|
case "tag":
|
|
712
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
843
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
713
844
|
/* @__PURE__ */ jsx(ContainsToggle, { value: cond.contains, onChange: (v) => update({ contains: v }), disabled: readOnly }),
|
|
714
845
|
editorProps.tags?.length ? /* @__PURE__ */ jsx(
|
|
715
846
|
ChipSelect,
|
|
@@ -719,25 +850,25 @@ var ConditionConfig = ({
|
|
|
719
850
|
onChange: (vals) => update({ tags: vals }),
|
|
720
851
|
disabled: readOnly
|
|
721
852
|
}
|
|
722
|
-
) : /* @__PURE__ */ jsx("input", {
|
|
853
|
+
) : /* @__PURE__ */ jsx("input", { style: inputStyle, value: (cond.tags || []).join(", "), onChange: (e) => update({ tags: e.target.value.split(",").map((s) => s.trim()).filter(Boolean) }), placeholder: "tag1, tag2, \u2026", disabled: readOnly })
|
|
723
854
|
] });
|
|
724
855
|
// ─── GEOFENCE ─────────────────────────────────
|
|
725
856
|
case "geofence":
|
|
726
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
857
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
727
858
|
/* @__PURE__ */ jsx(ContainsToggle, { value: cond.contains, onChange: (v) => update({ contains: v }), trueLabel: "Is Inside Of", falseLabel: "Is Outside Of", disabled: readOnly }),
|
|
728
|
-
/* @__PURE__ */ jsx("div", {
|
|
859
|
+
/* @__PURE__ */ jsx("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8 }, children: [
|
|
729
860
|
{ label: "Latitude 1 (NW)", key: "lat1" },
|
|
730
861
|
{ label: "Longitude 1 (NW)", key: "lng1" },
|
|
731
862
|
{ label: "Latitude 2 (SE)", key: "lat2" },
|
|
732
863
|
{ label: "Longitude 2 (SE)", key: "lng2" }
|
|
733
864
|
].map((f) => /* @__PURE__ */ jsxs("div", { children: [
|
|
734
|
-
/* @__PURE__ */ jsx("label", {
|
|
865
|
+
/* @__PURE__ */ jsx("label", { style: labelStyle, children: f.label }),
|
|
735
866
|
/* @__PURE__ */ jsx(
|
|
736
867
|
"input",
|
|
737
868
|
{
|
|
738
869
|
type: "number",
|
|
739
870
|
step: "any",
|
|
740
|
-
|
|
871
|
+
style: inputStyle,
|
|
741
872
|
value: cond[f.key] ?? "",
|
|
742
873
|
onChange: (e) => update({ [f.key]: e.target.value ? parseFloat(e.target.value) : void 0 }),
|
|
743
874
|
disabled: readOnly
|
|
@@ -747,7 +878,7 @@ var ConditionConfig = ({
|
|
|
747
878
|
] });
|
|
748
879
|
// ─── PRODUCT ──────────────────────────────────
|
|
749
880
|
case "product":
|
|
750
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
881
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
751
882
|
/* @__PURE__ */ jsx(ContainsToggle, { value: cond.contains, onChange: (v) => update({ contains: v }), disabled: readOnly }),
|
|
752
883
|
editorProps.products?.length ? /* @__PURE__ */ jsx(
|
|
753
884
|
ChipSelect,
|
|
@@ -757,7 +888,7 @@ var ConditionConfig = ({
|
|
|
757
888
|
onChange: (vals) => update({ productIds: vals }),
|
|
758
889
|
disabled: readOnly
|
|
759
890
|
}
|
|
760
|
-
) : /* @__PURE__ */ jsx("input", {
|
|
891
|
+
) : /* @__PURE__ */ jsx("input", { style: inputStyle, value: (cond.productIds || []).join(", "), onChange: (e) => update({ productIds: e.target.value.split(",").map((s) => s.trim()).filter(Boolean) }), placeholder: "product-id-1, product-id-2, \u2026", disabled: readOnly })
|
|
761
892
|
] });
|
|
762
893
|
// ─── ITEM STATUS ──────────────────────────────
|
|
763
894
|
case "itemStatus":
|
|
@@ -772,27 +903,26 @@ var ConditionConfig = ({
|
|
|
772
903
|
);
|
|
773
904
|
// ─── CONDITION REFERENCE ──────────────────────
|
|
774
905
|
case "condition":
|
|
775
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
776
|
-
editorProps.savedConditions?.length ? /* @__PURE__ */ jsxs("select", {
|
|
906
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
907
|
+
editorProps.savedConditions?.length ? /* @__PURE__ */ jsxs("select", { style: inputStyle, value: cond.conditionId || "", onChange: (e) => update({ conditionId: e.target.value }), disabled: readOnly, children: [
|
|
777
908
|
/* @__PURE__ */ jsx("option", { value: "", children: "Select a condition\u2026" }),
|
|
778
909
|
editorProps.savedConditions.map((c) => /* @__PURE__ */ jsx("option", { value: c.value, children: c.title }, c.value))
|
|
779
|
-
] }) : /* @__PURE__ */ jsx("input", {
|
|
780
|
-
/* @__PURE__ */ jsx(
|
|
781
|
-
|
|
910
|
+
] }) : /* @__PURE__ */ jsx("input", { style: inputStyle, value: cond.conditionId || "", onChange: (e) => update({ conditionId: e.target.value }), placeholder: "Condition ID", disabled: readOnly }),
|
|
911
|
+
/* @__PURE__ */ jsx(
|
|
912
|
+
PillGroup,
|
|
782
913
|
{
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
),
|
|
789
|
-
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
)) })
|
|
914
|
+
options: [
|
|
915
|
+
{ value: "true", label: "Passes" },
|
|
916
|
+
{ value: "false", label: "Fails" }
|
|
917
|
+
],
|
|
918
|
+
selected: cond.passes === true ? "true" : cond.passes === false ? "false" : void 0,
|
|
919
|
+
onChange: (v) => update({ passes: v === "true" }),
|
|
920
|
+
disabled: readOnly
|
|
921
|
+
}
|
|
922
|
+
)
|
|
793
923
|
] });
|
|
794
924
|
default:
|
|
795
|
-
return /* @__PURE__ */ jsx("p", {
|
|
925
|
+
return /* @__PURE__ */ jsx("p", { style: { fontSize: 12, color: "#9ca3af", fontStyle: "italic" }, children: "Unknown condition type" });
|
|
796
926
|
}
|
|
797
927
|
};
|
|
798
928
|
var ConditionCard = ({
|
|
@@ -811,7 +941,7 @@ var ConditionCard = ({
|
|
|
811
941
|
onChange({ ...condition, type });
|
|
812
942
|
setExpanded(true);
|
|
813
943
|
};
|
|
814
|
-
return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-gray-200 dark:border-gray-700
|
|
944
|
+
return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-gray-200 dark:border-gray-700 shadow-sm transition-shadow hover:shadow-md", children: [
|
|
815
945
|
/* @__PURE__ */ jsxs(
|
|
816
946
|
"div",
|
|
817
947
|
{
|
|
@@ -1006,37 +1136,32 @@ var ConditionsEditorContent = ({
|
|
|
1006
1136
|
"Disabled / Hidden"
|
|
1007
1137
|
] })
|
|
1008
1138
|
] }),
|
|
1009
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1010
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1139
|
+
/* @__PURE__ */ jsxs("div", { style: { borderRadius: 8, border: "1px solid #e5e7eb", padding: 16 }, children: [
|
|
1140
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 12, fontWeight: 500, color: "#6b7280", marginBottom: 12 }, children: [
|
|
1011
1141
|
/* @__PURE__ */ jsx(GitBranch, { className: "w-3.5 h-3.5" }),
|
|
1012
1142
|
"Logic Type"
|
|
1013
1143
|
] }),
|
|
1014
|
-
/* @__PURE__ */
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
),
|
|
1036
|
-
children: "Match ANY (OR)"
|
|
1037
|
-
}
|
|
1038
|
-
)
|
|
1039
|
-
] })
|
|
1144
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", gap: 4, backgroundColor: "#f3f4f6", borderRadius: 6, padding: 4 }, children: [{ v: "and", l: "Match ALL (AND)" }, { v: "or", l: "Match ANY (OR)" }].map((opt) => /* @__PURE__ */ jsx(
|
|
1145
|
+
"button",
|
|
1146
|
+
{
|
|
1147
|
+
type: "button",
|
|
1148
|
+
onClick: () => toggleLogic(opt.v),
|
|
1149
|
+
disabled: readOnly,
|
|
1150
|
+
style: {
|
|
1151
|
+
flex: 1,
|
|
1152
|
+
padding: "8px 12px",
|
|
1153
|
+
fontSize: 14,
|
|
1154
|
+
fontWeight: 600,
|
|
1155
|
+
borderRadius: 4,
|
|
1156
|
+
border: "none",
|
|
1157
|
+
cursor: readOnly ? "default" : "pointer",
|
|
1158
|
+
transition: "all 0.15s",
|
|
1159
|
+
...value.type === opt.v ? { backgroundColor: "#3b82f6", color: "#ffffff", boxShadow: "0 1px 2px rgba(0,0,0,0.1)" } : { backgroundColor: "transparent", color: "#6b7280" }
|
|
1160
|
+
},
|
|
1161
|
+
children: opt.l
|
|
1162
|
+
},
|
|
1163
|
+
opt.v
|
|
1164
|
+
)) })
|
|
1040
1165
|
] }),
|
|
1041
1166
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1042
1167
|
/* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-gray-700 dark:text-gray-300", children: "Conditions" }),
|
|
@@ -1096,5 +1221,5 @@ var ConditionsEditor = (props) => {
|
|
|
1096
1221
|
};
|
|
1097
1222
|
|
|
1098
1223
|
export { ConditionsEditor };
|
|
1099
|
-
//# sourceMappingURL=chunk-
|
|
1100
|
-
//# sourceMappingURL=chunk-
|
|
1224
|
+
//# sourceMappingURL=chunk-4EEUXIP3.js.map
|
|
1225
|
+
//# sourceMappingURL=chunk-4EEUXIP3.js.map
|