@proveanything/smartlinks-utils-ui 0.1.6 → 0.1.8

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.
@@ -1,5 +1,5 @@
1
1
  import { cn } from './chunk-L7FQ52F5.js';
2
- import { useState, useCallback } from 'react';
2
+ import { useState, useCallback, useRef, useMemo, useEffect } from 'react';
3
3
  import { GitBranch, Plus, Filter, ChevronRight, X, RefreshCw, Trash2, ChevronDown, ToggleLeft, Package, MapPin, Tag, Monitor, Calendar, User, Hash, Globe, Tags } from 'lucide-react';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
 
@@ -202,40 +202,442 @@ var ConditionTypePicker = ({ onSelect }) => {
202
202
  }) })
203
203
  ] });
204
204
  };
205
- var ContainsToggle = ({ value = true, onChange, trueLabel = "Is One Of", falseLabel = "Is Not One Of", disabled }) => /* @__PURE__ */ jsx("div", { className: "flex gap-1 bg-gray-100 dark:bg-gray-800 rounded-md p-0.5 w-fit", children: [{ v: true, label: trueLabel }, { v: false, label: falseLabel }].map((opt) => /* @__PURE__ */ jsx(
205
+
206
+ // src/components/ConditionsEditor/countries.ts
207
+ var COUNTRIES = [
208
+ { code: "AF", name: "Afghanistan" },
209
+ { code: "AL", name: "Albania" },
210
+ { code: "DZ", name: "Algeria" },
211
+ { code: "AD", name: "Andorra" },
212
+ { code: "AO", name: "Angola" },
213
+ { code: "AG", name: "Antigua and Barbuda" },
214
+ { code: "AR", name: "Argentina" },
215
+ { code: "AM", name: "Armenia" },
216
+ { code: "AU", name: "Australia" },
217
+ { code: "AT", name: "Austria" },
218
+ { code: "AZ", name: "Azerbaijan" },
219
+ { code: "BS", name: "Bahamas" },
220
+ { code: "BH", name: "Bahrain" },
221
+ { code: "BD", name: "Bangladesh" },
222
+ { code: "BB", name: "Barbados" },
223
+ { code: "BY", name: "Belarus" },
224
+ { code: "BE", name: "Belgium" },
225
+ { code: "BZ", name: "Belize" },
226
+ { code: "BJ", name: "Benin" },
227
+ { code: "BT", name: "Bhutan" },
228
+ { code: "BO", name: "Bolivia" },
229
+ { code: "BA", name: "Bosnia and Herzegovina" },
230
+ { code: "BW", name: "Botswana" },
231
+ { code: "BR", name: "Brazil" },
232
+ { code: "BN", name: "Brunei" },
233
+ { code: "BG", name: "Bulgaria" },
234
+ { code: "BF", name: "Burkina Faso" },
235
+ { code: "BI", name: "Burundi" },
236
+ { code: "CV", name: "Cabo Verde" },
237
+ { code: "KH", name: "Cambodia" },
238
+ { code: "CM", name: "Cameroon" },
239
+ { code: "CA", name: "Canada" },
240
+ { code: "CF", name: "Central African Republic" },
241
+ { code: "TD", name: "Chad" },
242
+ { code: "CL", name: "Chile" },
243
+ { code: "CN", name: "China" },
244
+ { code: "CO", name: "Colombia" },
245
+ { code: "KM", name: "Comoros" },
246
+ { code: "CG", name: "Congo" },
247
+ { code: "CD", name: "Congo (DRC)" },
248
+ { code: "CR", name: "Costa Rica" },
249
+ { code: "CI", name: "C\xF4te d'Ivoire" },
250
+ { code: "HR", name: "Croatia" },
251
+ { code: "CU", name: "Cuba" },
252
+ { code: "CY", name: "Cyprus" },
253
+ { code: "CZ", name: "Czechia" },
254
+ { code: "DK", name: "Denmark" },
255
+ { code: "DJ", name: "Djibouti" },
256
+ { code: "DM", name: "Dominica" },
257
+ { code: "DO", name: "Dominican Republic" },
258
+ { code: "EC", name: "Ecuador" },
259
+ { code: "EG", name: "Egypt" },
260
+ { code: "SV", name: "El Salvador" },
261
+ { code: "GQ", name: "Equatorial Guinea" },
262
+ { code: "ER", name: "Eritrea" },
263
+ { code: "EE", name: "Estonia" },
264
+ { code: "SZ", name: "Eswatini" },
265
+ { code: "ET", name: "Ethiopia" },
266
+ { code: "FJ", name: "Fiji" },
267
+ { code: "FI", name: "Finland" },
268
+ { code: "FR", name: "France" },
269
+ { code: "GA", name: "Gabon" },
270
+ { code: "GM", name: "Gambia" },
271
+ { code: "GE", name: "Georgia" },
272
+ { code: "DE", name: "Germany" },
273
+ { code: "GH", name: "Ghana" },
274
+ { code: "GR", name: "Greece" },
275
+ { code: "GD", name: "Grenada" },
276
+ { code: "GT", name: "Guatemala" },
277
+ { code: "GN", name: "Guinea" },
278
+ { code: "GW", name: "Guinea-Bissau" },
279
+ { code: "GY", name: "Guyana" },
280
+ { code: "HT", name: "Haiti" },
281
+ { code: "HN", name: "Honduras" },
282
+ { code: "HU", name: "Hungary" },
283
+ { code: "IS", name: "Iceland" },
284
+ { code: "IN", name: "India" },
285
+ { code: "ID", name: "Indonesia" },
286
+ { code: "IR", name: "Iran" },
287
+ { code: "IQ", name: "Iraq" },
288
+ { code: "IE", name: "Ireland" },
289
+ { code: "IL", name: "Israel" },
290
+ { code: "IT", name: "Italy" },
291
+ { code: "JM", name: "Jamaica" },
292
+ { code: "JP", name: "Japan" },
293
+ { code: "JO", name: "Jordan" },
294
+ { code: "KZ", name: "Kazakhstan" },
295
+ { code: "KE", name: "Kenya" },
296
+ { code: "KI", name: "Kiribati" },
297
+ { code: "KP", name: "North Korea" },
298
+ { code: "KR", name: "South Korea" },
299
+ { code: "KW", name: "Kuwait" },
300
+ { code: "KG", name: "Kyrgyzstan" },
301
+ { code: "LA", name: "Laos" },
302
+ { code: "LV", name: "Latvia" },
303
+ { code: "LB", name: "Lebanon" },
304
+ { code: "LS", name: "Lesotho" },
305
+ { code: "LR", name: "Liberia" },
306
+ { code: "LY", name: "Libya" },
307
+ { code: "LI", name: "Liechtenstein" },
308
+ { code: "LT", name: "Lithuania" },
309
+ { code: "LU", name: "Luxembourg" },
310
+ { code: "MG", name: "Madagascar" },
311
+ { code: "MW", name: "Malawi" },
312
+ { code: "MY", name: "Malaysia" },
313
+ { code: "MV", name: "Maldives" },
314
+ { code: "ML", name: "Mali" },
315
+ { code: "MT", name: "Malta" },
316
+ { code: "MH", name: "Marshall Islands" },
317
+ { code: "MR", name: "Mauritania" },
318
+ { code: "MU", name: "Mauritius" },
319
+ { code: "MX", name: "Mexico" },
320
+ { code: "FM", name: "Micronesia" },
321
+ { code: "MD", name: "Moldova" },
322
+ { code: "MC", name: "Monaco" },
323
+ { code: "MN", name: "Mongolia" },
324
+ { code: "ME", name: "Montenegro" },
325
+ { code: "MA", name: "Morocco" },
326
+ { code: "MZ", name: "Mozambique" },
327
+ { code: "MM", name: "Myanmar" },
328
+ { code: "NA", name: "Namibia" },
329
+ { code: "NR", name: "Nauru" },
330
+ { code: "NP", name: "Nepal" },
331
+ { code: "NL", name: "Netherlands" },
332
+ { code: "NZ", name: "New Zealand" },
333
+ { code: "NI", name: "Nicaragua" },
334
+ { code: "NE", name: "Niger" },
335
+ { code: "NG", name: "Nigeria" },
336
+ { code: "MK", name: "North Macedonia" },
337
+ { code: "NO", name: "Norway" },
338
+ { code: "OM", name: "Oman" },
339
+ { code: "PK", name: "Pakistan" },
340
+ { code: "PW", name: "Palau" },
341
+ { code: "PS", name: "Palestine" },
342
+ { code: "PA", name: "Panama" },
343
+ { code: "PG", name: "Papua New Guinea" },
344
+ { code: "PY", name: "Paraguay" },
345
+ { code: "PE", name: "Peru" },
346
+ { code: "PH", name: "Philippines" },
347
+ { code: "PL", name: "Poland" },
348
+ { code: "PT", name: "Portugal" },
349
+ { code: "QA", name: "Qatar" },
350
+ { code: "RO", name: "Romania" },
351
+ { code: "RU", name: "Russia" },
352
+ { code: "RW", name: "Rwanda" },
353
+ { code: "KN", name: "Saint Kitts and Nevis" },
354
+ { code: "LC", name: "Saint Lucia" },
355
+ { code: "VC", name: "Saint Vincent and the Grenadines" },
356
+ { code: "WS", name: "Samoa" },
357
+ { code: "SM", name: "San Marino" },
358
+ { code: "ST", name: "S\xE3o Tom\xE9 and Pr\xEDncipe" },
359
+ { code: "SA", name: "Saudi Arabia" },
360
+ { code: "SN", name: "Senegal" },
361
+ { code: "RS", name: "Serbia" },
362
+ { code: "SC", name: "Seychelles" },
363
+ { code: "SL", name: "Sierra Leone" },
364
+ { code: "SG", name: "Singapore" },
365
+ { code: "SK", name: "Slovakia" },
366
+ { code: "SI", name: "Slovenia" },
367
+ { code: "SB", name: "Solomon Islands" },
368
+ { code: "SO", name: "Somalia" },
369
+ { code: "ZA", name: "South Africa" },
370
+ { code: "SS", name: "South Sudan" },
371
+ { code: "ES", name: "Spain" },
372
+ { code: "LK", name: "Sri Lanka" },
373
+ { code: "SD", name: "Sudan" },
374
+ { code: "SR", name: "Suriname" },
375
+ { code: "SE", name: "Sweden" },
376
+ { code: "CH", name: "Switzerland" },
377
+ { code: "SY", name: "Syria" },
378
+ { code: "TW", name: "Taiwan" },
379
+ { code: "TJ", name: "Tajikistan" },
380
+ { code: "TZ", name: "Tanzania" },
381
+ { code: "TH", name: "Thailand" },
382
+ { code: "TL", name: "Timor-Leste" },
383
+ { code: "TG", name: "Togo" },
384
+ { code: "TO", name: "Tonga" },
385
+ { code: "TT", name: "Trinidad and Tobago" },
386
+ { code: "TN", name: "Tunisia" },
387
+ { code: "TR", name: "Turkey" },
388
+ { code: "TM", name: "Turkmenistan" },
389
+ { code: "TV", name: "Tuvalu" },
390
+ { code: "UG", name: "Uganda" },
391
+ { code: "UA", name: "Ukraine" },
392
+ { code: "AE", name: "United Arab Emirates" },
393
+ { code: "GB", name: "United Kingdom" },
394
+ { code: "US", name: "United States" },
395
+ { code: "UY", name: "Uruguay" },
396
+ { code: "UZ", name: "Uzbekistan" },
397
+ { code: "VU", name: "Vanuatu" },
398
+ { code: "VA", name: "Vatican City" },
399
+ { code: "VE", name: "Venezuela" },
400
+ { code: "VN", name: "Vietnam" },
401
+ { code: "YE", name: "Yemen" },
402
+ { code: "ZM", name: "Zambia" },
403
+ { code: "ZW", name: "Zimbabwe" }
404
+ ];
405
+ function getCountryName(code) {
406
+ return COUNTRIES.find((c) => c.code === code.toUpperCase())?.name || code;
407
+ }
408
+ var CountryPicker = ({
409
+ selected,
410
+ onChange,
411
+ disabled,
412
+ placeholder = "Search countries\u2026"
413
+ }) => {
414
+ const [open, setOpen] = useState(false);
415
+ const [search, setSearch] = useState("");
416
+ const containerRef = useRef(null);
417
+ const inputRef = useRef(null);
418
+ const filtered = useMemo(() => {
419
+ if (!search) return COUNTRIES;
420
+ const q = search.toLowerCase();
421
+ return COUNTRIES.filter(
422
+ (c) => c.name.toLowerCase().includes(q) || c.code.toLowerCase().includes(q)
423
+ );
424
+ }, [search]);
425
+ useEffect(() => {
426
+ if (!open) return;
427
+ const handler = (e) => {
428
+ if (containerRef.current && !containerRef.current.contains(e.target)) {
429
+ setOpen(false);
430
+ setSearch("");
431
+ }
432
+ };
433
+ document.addEventListener("mousedown", handler);
434
+ return () => document.removeEventListener("mousedown", handler);
435
+ }, [open]);
436
+ const toggle = (code) => {
437
+ if (disabled) return;
438
+ onChange(
439
+ selected.includes(code) ? selected.filter((c) => c !== code) : [...selected, code]
440
+ );
441
+ };
442
+ const remove = (code) => {
443
+ if (disabled) return;
444
+ onChange(selected.filter((c) => c !== code));
445
+ };
446
+ return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: "relative", children: [
447
+ /* @__PURE__ */ jsxs(
448
+ "div",
449
+ {
450
+ className: cn(
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
+ ),
457
+ onClick: () => {
458
+ if (disabled) return;
459
+ setOpen(true);
460
+ setTimeout(() => inputRef.current?.focus(), 0);
461
+ },
462
+ children: [
463
+ selected.map((code) => /* @__PURE__ */ jsxs(
464
+ "span",
465
+ {
466
+ className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-blue-100 dark:bg-blue-900/40 text-blue-700 dark:text-blue-300 border border-blue-200 dark:border-blue-800",
467
+ children: [
468
+ getCountryName(code),
469
+ " (",
470
+ code,
471
+ ")",
472
+ !disabled && /* @__PURE__ */ jsx(
473
+ "button",
474
+ {
475
+ onClick: (e) => {
476
+ e.stopPropagation();
477
+ remove(code);
478
+ },
479
+ className: "hover:text-blue-900 dark:hover:text-blue-100",
480
+ children: /* @__PURE__ */ jsx(X, { className: "w-3 h-3" })
481
+ }
482
+ )
483
+ ]
484
+ },
485
+ code
486
+ )),
487
+ selected.length === 0 && !open && /* @__PURE__ */ jsx("span", { className: "text-sm text-gray-400", children: placeholder }),
488
+ open && /* @__PURE__ */ jsx(
489
+ "input",
490
+ {
491
+ ref: inputRef,
492
+ value: search,
493
+ onChange: (e) => setSearch(e.target.value),
494
+ className: "flex-1 min-w-[120px] text-sm bg-transparent outline-none text-gray-900 dark:text-gray-100 placeholder:text-gray-400",
495
+ placeholder,
496
+ onClick: (e) => e.stopPropagation()
497
+ }
498
+ ),
499
+ /* @__PURE__ */ jsx(ChevronDown, { className: cn("w-4 h-4 text-gray-400 ml-auto flex-shrink-0 transition-transform", open && "rotate-180") })
500
+ ]
501
+ }
502
+ ),
503
+ open && /* @__PURE__ */ jsx("div", { className: "absolute z-50 mt-1 w-full max-h-[200px] overflow-y-auto rounded-md border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-lg", children: filtered.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-3 py-2 text-sm text-gray-400", children: "No countries found" }) : filtered.map((country) => {
504
+ const isSelected = selected.includes(country.code);
505
+ return /* @__PURE__ */ jsxs(
506
+ "button",
507
+ {
508
+ onClick: () => toggle(country.code),
509
+ className: cn(
510
+ "w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left transition-colors",
511
+ isSelected ? "bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300" : "text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800"
512
+ ),
513
+ children: [
514
+ /* @__PURE__ */ jsx("span", { className: cn(
515
+ "w-4 h-4 rounded border flex items-center justify-center flex-shrink-0 transition-colors",
516
+ isSelected ? "bg-blue-500 border-blue-500 text-white" : "border-gray-300 dark:border-gray-600"
517
+ ), children: isSelected && /* @__PURE__ */ jsx("svg", { className: "w-3 h-3", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M2 6l3 3 5-5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
518
+ /* @__PURE__ */ jsx("span", { className: "flex-1", children: country.name }),
519
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-gray-400 font-mono", children: country.code })
520
+ ]
521
+ },
522
+ country.code
523
+ );
524
+ }) })
525
+ ] });
526
+ };
527
+ 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(
206
528
  "button",
207
529
  {
530
+ type: "button",
208
531
  onClick: () => onChange(opt.v),
209
532
  disabled,
210
- className: cn(
211
- "px-2.5 py-1 text-xs font-medium rounded transition-colors",
212
- value === opt.v ? "bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm" : "text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"
213
- ),
533
+ style: {
534
+ padding: "6px 12px",
535
+ fontSize: 12,
536
+ fontWeight: 600,
537
+ borderRadius: 4,
538
+ border: "none",
539
+ cursor: disabled ? "default" : "pointer",
540
+ transition: "all 0.15s",
541
+ ...value === opt.v ? { backgroundColor: "#3b82f6", color: "#ffffff", boxShadow: "0 1px 2px rgba(0,0,0,0.1)" } : { backgroundColor: "transparent", color: "#6b7280" }
542
+ },
214
543
  children: opt.label
215
544
  },
216
545
  String(opt.v)
217
546
  )) });
218
- var ChipSelect = ({ options, selected, onChange, disabled }) => /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5", children: options.map((opt) => {
547
+ 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: [
548
+ /* @__PURE__ */ jsx(
549
+ "button",
550
+ {
551
+ type: "button",
552
+ onClick: () => onChange(!checked),
553
+ disabled,
554
+ style: {
555
+ width: 36,
556
+ height: 20,
557
+ borderRadius: 10,
558
+ border: "none",
559
+ cursor: disabled ? "default" : "pointer",
560
+ position: "relative",
561
+ flexShrink: 0,
562
+ transition: "background-color 0.2s",
563
+ backgroundColor: checked ? "#3b82f6" : "#d1d5db"
564
+ },
565
+ children: /* @__PURE__ */ jsx("span", { style: {
566
+ position: "absolute",
567
+ top: 2,
568
+ width: 16,
569
+ height: 16,
570
+ borderRadius: "50%",
571
+ backgroundColor: "#ffffff",
572
+ boxShadow: "0 1px 3px rgba(0,0,0,0.2)",
573
+ transition: "transform 0.2s",
574
+ transform: checked ? "translateX(18px)" : "translateX(2px)"
575
+ } })
576
+ }
577
+ ),
578
+ label
579
+ ] });
580
+ var ChipSelect = ({ options, selected, onChange, disabled }) => /* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 }, children: options.map((opt) => {
219
581
  const isSelected = selected.includes(opt.value);
220
582
  return /* @__PURE__ */ jsx(
221
583
  "button",
222
584
  {
585
+ type: "button",
223
586
  onClick: () => {
224
587
  if (disabled) return;
225
588
  onChange(isSelected ? selected.filter((v) => v !== opt.value) : [...selected, opt.value]);
226
589
  },
227
590
  disabled,
228
591
  title: opt.description,
229
- className: cn(
230
- "px-2.5 py-1 text-xs rounded-full border transition-colors",
231
- isSelected ? "bg-blue-100 dark:bg-blue-900/40 border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300" : "border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:border-gray-300 dark:hover:border-gray-600"
232
- ),
592
+ style: {
593
+ padding: "4px 10px",
594
+ fontSize: 12,
595
+ borderRadius: 9999,
596
+ border: "1px solid",
597
+ cursor: disabled ? "default" : "pointer",
598
+ transition: "all 0.15s",
599
+ ...isSelected ? { backgroundColor: "#dbeafe", borderColor: "#93c5fd", color: "#1d4ed8" } : { backgroundColor: "transparent", borderColor: "#e5e7eb", color: "#6b7280" }
600
+ },
233
601
  children: opt.title
234
602
  },
235
603
  opt.value
236
604
  );
237
605
  }) });
238
- var inputClass = "w-full px-2.5 py-1.5 text-sm rounded-md border border-gray-300 dark:border-gray-600 bg-transparent focus:outline-none focus:ring-1 focus:ring-blue-500";
606
+ var inputStyle = {
607
+ width: "100%",
608
+ padding: "6px 10px",
609
+ fontSize: 14,
610
+ borderRadius: 6,
611
+ border: "1px solid #d1d5db",
612
+ backgroundColor: "transparent",
613
+ outline: "none"
614
+ };
615
+ var labelStyle = {
616
+ fontSize: 10,
617
+ color: "#9ca3af",
618
+ marginBottom: 2,
619
+ display: "block"
620
+ };
621
+ 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(
622
+ "button",
623
+ {
624
+ type: "button",
625
+ onClick: () => onChange(opt.value),
626
+ disabled,
627
+ style: {
628
+ padding: "6px 12px",
629
+ fontSize: 12,
630
+ fontWeight: 600,
631
+ borderRadius: 4,
632
+ border: "none",
633
+ cursor: disabled ? "default" : "pointer",
634
+ transition: "all 0.15s",
635
+ ...selected === opt.value ? { backgroundColor: "#3b82f6", color: "#ffffff", boxShadow: "0 1px 2px rgba(0,0,0,0.1)" } : { backgroundColor: "transparent", color: "#6b7280" }
636
+ },
637
+ children: opt.label
638
+ },
639
+ opt.value
640
+ )) });
239
641
  var ConditionConfig = ({
240
642
  condition: cond,
241
643
  onChange,
@@ -246,7 +648,7 @@ var ConditionConfig = ({
246
648
  switch (cond.type) {
247
649
  // ─── VERSION ──────────────────────────────────
248
650
  case "version":
249
- return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
651
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
250
652
  /* @__PURE__ */ jsx(ContainsToggle, { value: cond.contains, onChange: (v) => update({ contains: v }), disabled: readOnly }),
251
653
  editorProps.versions?.length ? /* @__PURE__ */ jsx(
252
654
  ChipSelect,
@@ -256,30 +658,21 @@ var ConditionConfig = ({
256
658
  onChange: (vals) => update({ versions: vals.map((v) => ({ value: v, title: editorProps.versions?.find((o) => o.value === v)?.title || v })) }),
257
659
  disabled: readOnly
258
660
  }
259
- ) : /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-400 italic", children: "No versions available" })
661
+ ) : /* @__PURE__ */ jsx("p", { style: { fontSize: 12, color: "#9ca3af", fontStyle: "italic" }, children: "No versions available" })
260
662
  ] });
261
663
  // ─── COUNTRY ──────────────────────────────────
262
664
  case "country":
263
- return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
665
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
264
666
  /* @__PURE__ */ jsx(ContainsToggle, { value: cond.contains, onChange: (v) => update({ contains: v }), disabled: readOnly }),
265
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
266
- /* @__PURE__ */ jsx("label", { className: "text-xs text-gray-500 dark:text-gray-400", children: "Use regions" }),
267
- /* @__PURE__ */ jsx(
268
- "button",
269
- {
270
- onClick: () => update({ useRegions: !cond.useRegions }),
271
- disabled: readOnly,
272
- className: cn(
273
- "w-8 h-5 rounded-full transition-colors relative",
274
- cond.useRegions ? "bg-blue-500" : "bg-gray-300 dark:bg-gray-600"
275
- ),
276
- children: /* @__PURE__ */ jsx("span", { className: cn(
277
- "absolute top-0.5 w-4 h-4 rounded-full bg-white shadow transition-transform",
278
- cond.useRegions ? "translate-x-3.5" : "translate-x-0.5"
279
- ) })
280
- }
281
- )
282
- ] }),
667
+ /* @__PURE__ */ jsx(
668
+ ToggleSwitch,
669
+ {
670
+ checked: !!cond.useRegions,
671
+ onChange: (v) => update({ useRegions: v }),
672
+ label: "Use regions",
673
+ disabled: readOnly
674
+ }
675
+ ),
283
676
  cond.useRegions ? /* @__PURE__ */ jsx(
284
677
  ChipSelect,
285
678
  {
@@ -289,43 +682,41 @@ var ConditionConfig = ({
289
682
  disabled: readOnly
290
683
  }
291
684
  ) : /* @__PURE__ */ jsx(
292
- "input",
685
+ CountryPicker,
293
686
  {
294
- className: inputClass,
295
- value: (cond.countries || []).join(", "),
296
- onChange: (e) => update({ countries: e.target.value.split(",").map((s) => s.trim()).filter(Boolean) }),
297
- placeholder: "US, GB, DE, \u2026",
687
+ selected: cond.countries || [],
688
+ onChange: (codes) => update({ countries: codes }),
298
689
  disabled: readOnly
299
690
  }
300
691
  )
301
692
  ] });
302
693
  // ─── VALUE ────────────────────────────────────
303
694
  case "value":
304
- return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
305
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
695
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
696
+ /* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8 }, children: [
306
697
  /* @__PURE__ */ jsxs("div", { children: [
307
- /* @__PURE__ */ jsx("label", { className: "text-[10px] text-gray-400 mb-0.5 block", children: "Field Name" }),
308
- /* @__PURE__ */ jsx("input", { className: inputClass, value: cond.field || "", onChange: (e) => update({ field: e.target.value }), placeholder: "field_name", disabled: readOnly })
698
+ /* @__PURE__ */ jsx("label", { style: labelStyle, children: "Field Name" }),
699
+ /* @__PURE__ */ jsx("input", { style: inputStyle, value: cond.field || "", onChange: (e) => update({ field: e.target.value }), placeholder: "field_name", disabled: readOnly })
309
700
  ] }),
310
701
  /* @__PURE__ */ jsxs("div", { children: [
311
- /* @__PURE__ */ jsx("label", { className: "text-[10px] text-gray-400 mb-0.5 block", children: "Field Type" }),
312
- /* @__PURE__ */ jsx("select", { className: inputClass, 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)) })
702
+ /* @__PURE__ */ jsx("label", { style: labelStyle, children: "Field Type" }),
703
+ /* @__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)) })
313
704
  ] })
314
705
  ] }),
315
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
706
+ /* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8 }, children: [
316
707
  /* @__PURE__ */ jsxs("div", { children: [
317
- /* @__PURE__ */ jsx("label", { className: "text-[10px] text-gray-400 mb-0.5 block", children: "Operator" }),
318
- /* @__PURE__ */ jsx("select", { className: inputClass, 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)) })
708
+ /* @__PURE__ */ jsx("label", { style: labelStyle, children: "Operator" }),
709
+ /* @__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)) })
319
710
  ] }),
320
711
  /* @__PURE__ */ jsxs("div", { children: [
321
- /* @__PURE__ */ jsx("label", { className: "text-[10px] text-gray-400 mb-0.5 block", children: "Value" }),
322
- /* @__PURE__ */ jsx("input", { className: inputClass, value: String(cond.value ?? ""), onChange: (e) => update({ value: e.target.value }), placeholder: "value", disabled: readOnly })
712
+ /* @__PURE__ */ jsx("label", { style: labelStyle, children: "Value" }),
713
+ /* @__PURE__ */ jsx("input", { style: inputStyle, value: String(cond.value ?? ""), onChange: (e) => update({ value: e.target.value }), placeholder: "value", disabled: readOnly })
323
714
  ] })
324
715
  ] })
325
716
  ] });
326
717
  // ─── USER ─────────────────────────────────────
327
718
  case "user":
328
- return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
719
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
329
720
  /* @__PURE__ */ jsx(
330
721
  ChipSelect,
331
722
  {
@@ -347,35 +738,32 @@ var ConditionConfig = ({
347
738
  ] });
348
739
  // ─── DATE ─────────────────────────────────────
349
740
  case "date":
350
- return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
351
- /* @__PURE__ */ jsx("div", { className: "flex gap-1 bg-gray-100 dark:bg-gray-800 rounded-md p-0.5 w-fit", children: ["before", "after", "between"].map((dt) => /* @__PURE__ */ jsxs(
352
- "button",
741
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
742
+ /* @__PURE__ */ jsx(
743
+ PillGroup,
353
744
  {
354
- onClick: () => update({ dateTest: dt }),
355
- disabled: readOnly,
356
- className: cn(
357
- "px-2.5 py-1 text-xs font-medium rounded transition-colors capitalize",
358
- cond.dateTest === dt ? "bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm" : "text-gray-500 dark:text-gray-400"
359
- ),
360
- children: [
361
- "Is ",
362
- dt
363
- ]
364
- },
365
- dt
366
- )) }),
745
+ options: [
746
+ { value: "before", label: "Is Before" },
747
+ { value: "after", label: "Is After" },
748
+ { value: "between", label: "Is Between" }
749
+ ],
750
+ selected: cond.dateTest,
751
+ onChange: (v) => update({ dateTest: v }),
752
+ disabled: readOnly
753
+ }
754
+ ),
367
755
  (cond.dateTest === "before" || cond.dateTest === "between") && /* @__PURE__ */ jsxs("div", { children: [
368
- /* @__PURE__ */ jsx("label", { className: "text-[10px] text-gray-400 mb-0.5 block", children: cond.dateTest === "between" ? "Start Date" : "Before Date" }),
369
- /* @__PURE__ */ jsx("input", { type: "date", className: inputClass, value: cond.beforeDate || "", onChange: (e) => update({ beforeDate: e.target.value }), disabled: readOnly })
756
+ /* @__PURE__ */ jsx("label", { style: labelStyle, children: cond.dateTest === "between" ? "Start Date" : "Before Date" }),
757
+ /* @__PURE__ */ jsx("input", { type: "date", style: inputStyle, value: cond.beforeDate || "", onChange: (e) => update({ beforeDate: e.target.value }), disabled: readOnly })
370
758
  ] }),
371
759
  (cond.dateTest === "after" || cond.dateTest === "between") && /* @__PURE__ */ jsxs("div", { children: [
372
- /* @__PURE__ */ jsx("label", { className: "text-[10px] text-gray-400 mb-0.5 block", children: cond.dateTest === "between" ? "End Date" : "After Date" }),
373
- /* @__PURE__ */ jsx("input", { type: "date", className: inputClass, value: cond.afterDate || "", onChange: (e) => update({ afterDate: e.target.value }), disabled: readOnly })
760
+ /* @__PURE__ */ jsx("label", { style: labelStyle, children: cond.dateTest === "between" ? "End Date" : "After Date" }),
761
+ /* @__PURE__ */ jsx("input", { type: "date", style: inputStyle, value: cond.afterDate || "", onChange: (e) => update({ afterDate: e.target.value }), disabled: readOnly })
374
762
  ] })
375
763
  ] });
376
764
  // ─── DEVICE ───────────────────────────────────
377
765
  case "device":
378
- return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
766
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
379
767
  /* @__PURE__ */ jsx(ContainsToggle, { value: cond.contains, onChange: (v) => update({ contains: v }), disabled: readOnly }),
380
768
  /* @__PURE__ */ jsx(
381
769
  ChipSelect,
@@ -389,7 +777,7 @@ var ConditionConfig = ({
389
777
  ] });
390
778
  // ─── TAG ──────────────────────────────────────
391
779
  case "tag":
392
- return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
780
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
393
781
  /* @__PURE__ */ jsx(ContainsToggle, { value: cond.contains, onChange: (v) => update({ contains: v }), disabled: readOnly }),
394
782
  editorProps.tags?.length ? /* @__PURE__ */ jsx(
395
783
  ChipSelect,
@@ -399,25 +787,25 @@ var ConditionConfig = ({
399
787
  onChange: (vals) => update({ tags: vals }),
400
788
  disabled: readOnly
401
789
  }
402
- ) : /* @__PURE__ */ jsx("input", { className: inputClass, value: (cond.tags || []).join(", "), onChange: (e) => update({ tags: e.target.value.split(",").map((s) => s.trim()).filter(Boolean) }), placeholder: "tag1, tag2, \u2026", disabled: readOnly })
790
+ ) : /* @__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 })
403
791
  ] });
404
792
  // ─── GEOFENCE ─────────────────────────────────
405
793
  case "geofence":
406
- return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
794
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
407
795
  /* @__PURE__ */ jsx(ContainsToggle, { value: cond.contains, onChange: (v) => update({ contains: v }), trueLabel: "Is Inside Of", falseLabel: "Is Outside Of", disabled: readOnly }),
408
- /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-2", children: [
796
+ /* @__PURE__ */ jsx("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8 }, children: [
409
797
  { label: "Latitude 1 (NW)", key: "lat1" },
410
798
  { label: "Longitude 1 (NW)", key: "lng1" },
411
799
  { label: "Latitude 2 (SE)", key: "lat2" },
412
800
  { label: "Longitude 2 (SE)", key: "lng2" }
413
801
  ].map((f) => /* @__PURE__ */ jsxs("div", { children: [
414
- /* @__PURE__ */ jsx("label", { className: "text-[10px] text-gray-400 mb-0.5 block", children: f.label }),
802
+ /* @__PURE__ */ jsx("label", { style: labelStyle, children: f.label }),
415
803
  /* @__PURE__ */ jsx(
416
804
  "input",
417
805
  {
418
806
  type: "number",
419
807
  step: "any",
420
- className: inputClass,
808
+ style: inputStyle,
421
809
  value: cond[f.key] ?? "",
422
810
  onChange: (e) => update({ [f.key]: e.target.value ? parseFloat(e.target.value) : void 0 }),
423
811
  disabled: readOnly
@@ -427,7 +815,7 @@ var ConditionConfig = ({
427
815
  ] });
428
816
  // ─── PRODUCT ──────────────────────────────────
429
817
  case "product":
430
- return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
818
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
431
819
  /* @__PURE__ */ jsx(ContainsToggle, { value: cond.contains, onChange: (v) => update({ contains: v }), disabled: readOnly }),
432
820
  editorProps.products?.length ? /* @__PURE__ */ jsx(
433
821
  ChipSelect,
@@ -437,7 +825,7 @@ var ConditionConfig = ({
437
825
  onChange: (vals) => update({ productIds: vals }),
438
826
  disabled: readOnly
439
827
  }
440
- ) : /* @__PURE__ */ jsx("input", { className: inputClass, 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 })
828
+ ) : /* @__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 })
441
829
  ] });
442
830
  // ─── ITEM STATUS ──────────────────────────────
443
831
  case "itemStatus":
@@ -452,27 +840,26 @@ var ConditionConfig = ({
452
840
  );
453
841
  // ─── CONDITION REFERENCE ──────────────────────
454
842
  case "condition":
455
- return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
456
- editorProps.savedConditions?.length ? /* @__PURE__ */ jsxs("select", { className: inputClass, value: cond.conditionId || "", onChange: (e) => update({ conditionId: e.target.value }), disabled: readOnly, children: [
843
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
844
+ editorProps.savedConditions?.length ? /* @__PURE__ */ jsxs("select", { style: inputStyle, value: cond.conditionId || "", onChange: (e) => update({ conditionId: e.target.value }), disabled: readOnly, children: [
457
845
  /* @__PURE__ */ jsx("option", { value: "", children: "Select a condition\u2026" }),
458
846
  editorProps.savedConditions.map((c) => /* @__PURE__ */ jsx("option", { value: c.value, children: c.title }, c.value))
459
- ] }) : /* @__PURE__ */ jsx("input", { className: inputClass, value: cond.conditionId || "", onChange: (e) => update({ conditionId: e.target.value }), placeholder: "Condition ID", disabled: readOnly }),
460
- /* @__PURE__ */ jsx("div", { className: "flex gap-1 bg-gray-100 dark:bg-gray-800 rounded-md p-0.5 w-fit", children: [{ v: true, l: "Passes" }, { v: false, l: "Fails" }].map((opt) => /* @__PURE__ */ jsx(
461
- "button",
847
+ ] }) : /* @__PURE__ */ jsx("input", { style: inputStyle, value: cond.conditionId || "", onChange: (e) => update({ conditionId: e.target.value }), placeholder: "Condition ID", disabled: readOnly }),
848
+ /* @__PURE__ */ jsx(
849
+ PillGroup,
462
850
  {
463
- onClick: () => update({ passes: opt.v }),
464
- disabled: readOnly,
465
- className: cn(
466
- "px-2.5 py-1 text-xs font-medium rounded transition-colors",
467
- cond.passes === opt.v ? "bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm" : "text-gray-500 dark:text-gray-400"
468
- ),
469
- children: opt.l
470
- },
471
- String(opt.v)
472
- )) })
851
+ options: [
852
+ { value: "true", label: "Passes" },
853
+ { value: "false", label: "Fails" }
854
+ ],
855
+ selected: cond.passes === true ? "true" : cond.passes === false ? "false" : void 0,
856
+ onChange: (v) => update({ passes: v === "true" }),
857
+ disabled: readOnly
858
+ }
859
+ )
473
860
  ] });
474
861
  default:
475
- return /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-400 italic", children: "Unknown condition type" });
862
+ return /* @__PURE__ */ jsx("p", { style: { fontSize: 12, color: "#9ca3af", fontStyle: "italic" }, children: "Unknown condition type" });
476
863
  }
477
864
  };
478
865
  var ConditionCard = ({
@@ -686,37 +1073,32 @@ var ConditionsEditorContent = ({
686
1073
  "Disabled / Hidden"
687
1074
  ] })
688
1075
  ] }),
689
- /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-gray-200 dark:border-gray-700 p-4", children: [
690
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-xs font-medium text-gray-500 dark:text-gray-400 mb-3", children: [
1076
+ /* @__PURE__ */ jsxs("div", { style: { borderRadius: 8, border: "1px solid #e5e7eb", padding: 16 }, children: [
1077
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 12, fontWeight: 500, color: "#6b7280", marginBottom: 12 }, children: [
691
1078
  /* @__PURE__ */ jsx(GitBranch, { className: "w-3.5 h-3.5" }),
692
1079
  "Logic Type"
693
1080
  ] }),
694
- /* @__PURE__ */ jsxs("div", { className: "flex gap-1 bg-gray-100 dark:bg-gray-800 rounded-md p-0.5", children: [
695
- /* @__PURE__ */ jsx(
696
- "button",
697
- {
698
- onClick: () => toggleLogic("and"),
699
- disabled: readOnly,
700
- className: cn(
701
- "flex-1 px-3 py-2 text-sm font-medium rounded transition-colors",
702
- value.type === "and" ? "bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm" : "text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"
703
- ),
704
- children: "Match ALL (AND)"
705
- }
706
- ),
707
- /* @__PURE__ */ jsx(
708
- "button",
709
- {
710
- onClick: () => toggleLogic("or"),
711
- disabled: readOnly,
712
- className: cn(
713
- "flex-1 px-3 py-2 text-sm font-medium rounded transition-colors",
714
- value.type === "or" ? "bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm" : "text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"
715
- ),
716
- children: "Match ANY (OR)"
717
- }
718
- )
719
- ] })
1081
+ /* @__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(
1082
+ "button",
1083
+ {
1084
+ type: "button",
1085
+ onClick: () => toggleLogic(opt.v),
1086
+ disabled: readOnly,
1087
+ style: {
1088
+ flex: 1,
1089
+ padding: "8px 12px",
1090
+ fontSize: 14,
1091
+ fontWeight: 600,
1092
+ borderRadius: 4,
1093
+ border: "none",
1094
+ cursor: readOnly ? "default" : "pointer",
1095
+ transition: "all 0.15s",
1096
+ ...value.type === opt.v ? { backgroundColor: "#3b82f6", color: "#ffffff", boxShadow: "0 1px 2px rgba(0,0,0,0.1)" } : { backgroundColor: "transparent", color: "#6b7280" }
1097
+ },
1098
+ children: opt.l
1099
+ },
1100
+ opt.v
1101
+ )) })
720
1102
  ] }),
721
1103
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
722
1104
  /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-gray-700 dark:text-gray-300", children: "Conditions" }),
@@ -776,5 +1158,5 @@ var ConditionsEditor = (props) => {
776
1158
  };
777
1159
 
778
1160
  export { ConditionsEditor };
779
- //# sourceMappingURL=chunk-IVUFK6SS.js.map
780
- //# sourceMappingURL=chunk-IVUFK6SS.js.map
1161
+ //# sourceMappingURL=chunk-ILQNQN27.js.map
1162
+ //# sourceMappingURL=chunk-ILQNQN27.js.map