@uniformdev/context-ui 20.6.2-alpha.11 → 20.7.1-alpha.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -46,7 +46,6 @@ __export(src_exports, {
46
46
  addEnrichmentLink: () => addEnrichmentLink,
47
47
  contextCriteriaMenuOperators: () => contextCriteriaMenuOperators,
48
48
  convertErrorsToObj: () => convertErrorsToObj,
49
- enrichmentCriteriaMenuOperators: () => enrichmentCriteriaMenuOperators,
50
49
  isEnrichmentTagData: () => isEnrichmentTagData,
51
50
  isPersonalizationCriteriaData: () => isPersonalizationCriteriaData,
52
51
  opHasRhs: () => opHasRhs,
@@ -342,39 +341,23 @@ var contextCriteriaMenuOperators = [
342
341
  {
343
342
  name: "has the weakest score",
344
343
  value: "-"
345
- }
346
- ];
347
- var enrichmentCriteriaMenuOperators = [
348
- ...contextCriteriaMenuOperators,
344
+ },
349
345
  {
350
346
  name: "has strongest category score",
351
347
  value: "^"
352
348
  }
353
349
  ];
354
- var quirkCriteriaMenuOperators = [
355
- {
356
- name: "=",
357
- description: "equals",
358
- value: "="
359
- },
360
- {
361
- name: "\u2260",
362
- description: "not equal",
363
- value: "!="
364
- }
365
- ];
366
- function CriteriaOperatorMenu({ onChange, value, rhsType, ...props }) {
350
+ function CriteriaOperatorMenu({ onChange, value, ...props }) {
367
351
  var _a, _b;
368
- const operators = rhsType === "QUIRK" ? quirkCriteriaMenuOperators : rhsType === "ENR" ? enrichmentCriteriaMenuOperators : contextCriteriaMenuOperators;
369
352
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
370
353
  import_design_system2.InputComboBox,
371
354
  {
372
355
  ...props,
373
356
  value: {
374
- label: (_b = (_a = operators.find((e) => e.value === value)) == null ? void 0 : _a.name) != null ? _b : value,
357
+ label: (_b = (_a = contextCriteriaMenuOperators.find((e) => e.value === value)) == null ? void 0 : _a.name) != null ? _b : value,
375
358
  value
376
359
  },
377
- options: operators.map((option) => ({
360
+ options: contextCriteriaMenuOperators.map((option) => ({
378
361
  label: option.description ? `${option.name}:${option.description}` : option.name,
379
362
  value: option.value
380
363
  })),
@@ -606,29 +589,24 @@ function useDimensionsDataContext() {
606
589
 
607
590
  // src/components/DimensionMenu/CriteriaMatchMenu.tsx
608
591
  var import_design_system6 = require("@uniformdev/design-system");
609
- var import_react11 = require("react");
592
+ var import_react10 = require("react");
610
593
 
611
594
  // src/components/DimensionMenu/DimensionGroupHeading.tsx
612
595
  var import_design_system4 = require("@uniformdev/design-system");
613
596
 
614
597
  // src/components/DimensionMenu/utils.ts
615
- var import_react9 = require("react");
616
598
  function dimensionToMenuOption(dimension) {
617
- if ("dim" in dimension) {
618
- return {
619
- label: dimension.displayName,
620
- value: dimension.dim,
621
- original: dimension
622
- };
623
- }
624
- const quirk = dimension;
625
599
  return {
626
- label: `Quirk:${quirk.name}`,
627
- value: quirk.id,
628
- original: quirk
600
+ label: dimension.displayName,
601
+ value: dimension.dim,
602
+ isDisabled: false
629
603
  };
630
604
  }
631
- function dimensionIcon(type) {
605
+ function dimensionIcon(displayName) {
606
+ if (!displayName) {
607
+ return "unavailable";
608
+ }
609
+ const [type] = displayName.split(":");
632
610
  switch (type.toLowerCase()) {
633
611
  case "signal":
634
612
  return "data";
@@ -640,42 +618,25 @@ function dimensionIcon(type) {
640
618
  return "user-list";
641
619
  }
642
620
  }
643
- function useGroupedDimensions(dimensions, quirks) {
644
- return (0, import_react9.useMemo)(() => {
645
- const result = [];
646
- let lastType = "";
647
- for (const dim of dimensions) {
648
- const { type } = dimensionDisplayName(dim.displayName);
649
- if (lastType !== type) {
650
- result.push({ label: type != null ? type : "", options: [] });
651
- lastType = type != null ? type : "";
652
- }
653
- result[result.length - 1].options.push(dimensionToMenuOption(dim));
621
+ function groupDimensions(dimensions) {
622
+ const result = [];
623
+ let lastType = "";
624
+ for (const dim of dimensions) {
625
+ const [type] = dim.displayName.split(":");
626
+ if (lastType !== type) {
627
+ result.push({ label: type, options: [] });
628
+ lastType = type;
654
629
  }
655
- if (quirks == null ? void 0 : quirks.length) {
656
- result.push({
657
- label: "Quirks",
658
- options: quirks.map(dimensionToMenuOption)
659
- });
660
- }
661
- return result;
662
- }, [dimensions, quirks]);
663
- }
664
- function dimensionDisplayName(displayName) {
665
- if (!displayName) {
666
- return {};
630
+ result[result.length - 1].options.push(dimensionToMenuOption(dim));
667
631
  }
668
- const colonIndex = displayName.indexOf(":");
669
- const type = colonIndex >= 0 ? displayName.substring(0, colonIndex) : void 0;
670
- const name = colonIndex >= 0 ? displayName.substring(colonIndex + 1) : displayName;
671
- return { type, name };
632
+ return result;
672
633
  }
673
634
 
674
635
  // src/components/DimensionMenu/DimensionGroupHeading.tsx
675
636
  var import_jsx_runtime7 = require("@emotion/react/jsx-runtime");
676
637
  var DimensionGroupHeading = (props) => {
638
+ var _a;
677
639
  const { data, getStyles, className } = props;
678
- const { type } = dimensionDisplayName(data.label);
679
640
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
680
641
  "div",
681
642
  {
@@ -690,7 +651,7 @@ var DimensionGroupHeading = (props) => {
690
651
  {
691
652
  css: { color: "var(--gray-500)", display: "flex", alignItems: "center", gap: "var(--spacing-xs)" },
692
653
  children: [
693
- type ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system4.Icon, { icon: dimensionIcon(type), iconColor: "currentColor", size: 16 }) : null,
654
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_design_system4.Icon, { icon: dimensionIcon((_a = data.label) != null ? _a : ""), iconColor: "currentColor", size: 16 }),
694
655
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: data.label })
695
656
  ]
696
657
  }
@@ -700,14 +661,14 @@ var DimensionGroupHeading = (props) => {
700
661
  };
701
662
 
702
663
  // src/components/DimensionMenu/DimensionMenuErrorMessage.tsx
703
- var import_react10 = require("@emotion/react");
664
+ var import_react9 = require("@emotion/react");
704
665
  var import_jsx_runtime8 = require("@emotion/react/jsx-runtime");
705
666
  function DimensionMenuErrorMessage({ message }) {
706
667
  if (!message) return null;
707
668
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
708
669
  "div",
709
670
  {
710
- css: import_react10.css`
671
+ css: import_react9.css`
711
672
  color: var(--brand-primary-2);
712
673
  font-size: var(--fs-xs);
713
674
  position: absolute;
@@ -721,8 +682,9 @@ function DimensionMenuErrorMessage({ message }) {
721
682
  // src/components/DimensionMenu/DimensionOption.tsx
722
683
  var import_jsx_runtime9 = require("@emotion/react/jsx-runtime");
723
684
  var DimensionOption = (props) => {
685
+ var _a, _b;
724
686
  const { data, getStyles, cx, isDisabled, isFocused, isSelected, className, innerRef, innerProps } = props;
725
- const { name } = dimensionDisplayName(data.label);
687
+ const [, value] = (_b = (_a = data.label) == null ? void 0 : _a.split(":")) != null ? _b : [];
726
688
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
727
689
  "div",
728
690
  {
@@ -739,7 +701,7 @@ var DimensionOption = (props) => {
739
701
  ref: innerRef,
740
702
  "aria-disabled": isDisabled,
741
703
  ...innerProps,
742
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { css: { color: "var(--gray-700)" }, children: name != null ? name : data.label })
704
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { css: { color: "var(--gray-700)" }, children: value != null ? value : data.label })
743
705
  }
744
706
  );
745
707
  };
@@ -748,7 +710,7 @@ var DimensionOption = (props) => {
748
710
  var import_design_system5 = require("@uniformdev/design-system");
749
711
  var import_jsx_runtime10 = require("@emotion/react/jsx-runtime");
750
712
  function DimensionValue({ displayName }) {
751
- const { type, name } = dimensionDisplayName(displayName);
713
+ const [type, name] = displayName.split(":");
752
714
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
753
715
  "div",
754
716
  {
@@ -757,7 +719,7 @@ function DimensionValue({ displayName }) {
757
719
  overflow: "hidden"
758
720
  },
759
721
  children: [
760
- type ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
722
+ name ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
761
723
  "small",
762
724
  {
763
725
  css: { color: "var(--gray-500)", display: "flex", alignItems: "center", gap: "var(--spacing-xs)" },
@@ -790,12 +752,11 @@ function CriteriaMatchMenu({
790
752
  ...props
791
753
  }) {
792
754
  var _a, _b;
793
- const [inputValue, setInputValue] = (0, import_react11.useState)(
755
+ const [inputValue, setInputValue] = (0, import_react10.useState)(
794
756
  typeof criteriaMatch.r !== "undefined" && isInt(criteriaMatch.r) !== null ? criteriaMatch.r.toString(10) : ""
795
757
  );
796
758
  const rDim = criteriaMatch.rDim;
797
759
  const targetDim = criteriaMatch.rDim ? dimensions.dimIndex[criteriaMatch.rDim] : void 0;
798
- const groupedDimensions = useGroupedDimensions(dimensions.dimensions, void 0);
799
760
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
800
761
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
801
762
  import_design_system6.InputComboBox,
@@ -814,7 +775,7 @@ function CriteriaMatchMenu({
814
775
  value: "",
815
776
  isDisabled: true
816
777
  },
817
- ...groupedDimensions
778
+ ...groupDimensions(dimensions.dimensions)
818
779
  ],
819
780
  styles: {
820
781
  ...props.styles,
@@ -893,23 +854,14 @@ function isInt(value) {
893
854
  // src/components/DimensionMenu/DimensionMenu.tsx
894
855
  var import_design_system7 = require("@uniformdev/design-system");
895
856
  var import_jsx_runtime13 = require("@emotion/react/jsx-runtime");
896
- function DimensionMenu({
897
- onChange,
898
- value,
899
- dimensions,
900
- errorMessage,
901
- quirks,
902
- ...props
903
- }) {
904
- const groupedDimensions = useGroupedDimensions(dimensions, quirks);
905
- const valueAsMenuOption = value ? dimensionToMenuOption(value) : void 0;
857
+ function DimensionMenu({ onChange, value, dimensions, errorMessage, ...props }) {
906
858
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
907
859
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
908
860
  import_design_system7.InputComboBox,
909
861
  {
910
862
  ...props,
911
- value: valueAsMenuOption,
912
- options: groupedDimensions,
863
+ value: value ? dimensionToMenuOption(value) : void 0,
864
+ options: groupDimensions(dimensions),
913
865
  styles: {
914
866
  ...props.styles,
915
867
  valueContainer: (provided, state) => {
@@ -922,10 +874,8 @@ function DimensionMenu({
922
874
  }
923
875
  },
924
876
  onChange: (e) => {
925
- if (e == null ? void 0 : e.original) {
926
- onChange(e.original);
927
- } else {
928
- onChange(void 0);
877
+ if (e) {
878
+ onChange(dimensions.find((d) => d.dim === e.value));
929
879
  }
930
880
  },
931
881
  components: {
@@ -945,8 +895,8 @@ var import_CgChevronRight = require("@react-icons/all-files/cg/CgChevronRight");
945
895
  var import_design_system8 = require("@uniformdev/design-system");
946
896
 
947
897
  // src/components/EditLink/EditLink.styles.ts
948
- var import_react12 = require("@emotion/react");
949
- var editLink = import_react12.css`
898
+ var import_react11 = require("@emotion/react");
899
+ var editLink = import_react11.css`
950
900
  display: flex;
951
901
  align-items: center;
952
902
  font-weight: var(--fw-bold);
@@ -979,16 +929,16 @@ var EditLink = ({ linkTo, name, linkText = `Edit ${name} Component` }) => {
979
929
  };
980
930
 
981
931
  // src/components/EnrichmentTag/EnrichmentTag.tsx
982
- var import_react13 = require("@emotion/react");
932
+ var import_react12 = require("@emotion/react");
983
933
  var import_CgCloseO = require("@react-icons/all-files/cg/CgCloseO");
984
934
  var import_CgMathMinus = require("@react-icons/all-files/cg/CgMathMinus");
985
935
  var import_CgMathPlus = require("@react-icons/all-files/cg/CgMathPlus");
986
936
  var import_context = require("@uniformdev/context");
987
937
  var import_design_system9 = require("@uniformdev/design-system");
988
938
  var import_immer = require("immer");
989
- var import_react14 = require("react");
939
+ var import_react13 = require("react");
990
940
  var import_jsx_runtime15 = require("@emotion/react/jsx-runtime");
991
- var addEnrichmentLink = import_react13.css`
941
+ var addEnrichmentLink = import_react12.css`
992
942
  flex: 2;
993
943
  display: flex;
994
944
  width: 50%;
@@ -1007,19 +957,19 @@ var EnrichmentTag = ({
1007
957
  displayTitle = true
1008
958
  }) => {
1009
959
  const { loading, result: dimensions, error } = useDimensions(contextConfig);
1010
- const allEnrichments = (0, import_react14.useMemo)(() => {
960
+ const allEnrichments = (0, import_react13.useMemo)(() => {
1011
961
  if (dimensions) return dimensions.dimensions.filter((dimension) => dimension.category === "ENR");
1012
962
  }, [dimensions]);
1013
- const remainingEnrichments = (0, import_react14.useMemo)(() => {
963
+ const remainingEnrichments = (0, import_react13.useMemo)(() => {
1014
964
  if (!value) return allEnrichments;
1015
965
  if (allEnrichments)
1016
966
  return allEnrichments.filter(
1017
967
  (enr) => !value.some((val) => (0, import_context.getEnrichmentVectorKey)(val.cat, val.key) === enr.dim)
1018
968
  );
1019
969
  }, [allEnrichments, value]);
1020
- const [selectValue, setSelectValue] = (0, import_react14.useState)("");
1021
- const [score, setScore] = (0, import_react14.useState)(50);
1022
- const [showAddNewEnrichmentTagPanel, setShowAddNewEnrichmentTagPanel] = (0, import_react14.useState)(false);
970
+ const [selectValue, setSelectValue] = (0, import_react13.useState)("");
971
+ const [score, setScore] = (0, import_react13.useState)(50);
972
+ const [showAddNewEnrichmentTagPanel, setShowAddNewEnrichmentTagPanel] = (0, import_react13.useState)(false);
1023
973
  const selectedEnrichment = allEnrichments == null ? void 0 : allEnrichments.find((dimension) => dimension.dim === selectValue);
1024
974
  const addEnrichment = () => {
1025
975
  const [cat, key] = selectValue.split("_");
@@ -1177,7 +1127,7 @@ var NoEnrichmentsView = ({ contextConfig }) => /* @__PURE__ */ (0, import_jsx_ru
1177
1127
  var getCappedValue = (value, maxCap = 100, minCap = 0) => {
1178
1128
  return Math.max(Math.min(value, maxCap), minCap);
1179
1129
  };
1180
- var scoreCounterMinusButtonStyles = import_react13.css`
1130
+ var scoreCounterMinusButtonStyles = import_react12.css`
1181
1131
  position: absolute;
1182
1132
  bottom: 0.875rem;
1183
1133
  left: var(--spacing-sm);
@@ -1190,7 +1140,7 @@ var scoreCounterMinusButtonStyles = import_react13.css`
1190
1140
  border: 1px solid var(--gray-300);
1191
1141
  border-radius: var(--rounded-full);
1192
1142
  `;
1193
- var scoreCounterPlusButtonStyles = import_react13.css`
1143
+ var scoreCounterPlusButtonStyles = import_react12.css`
1194
1144
  ${scoreCounterMinusButtonStyles}
1195
1145
  left: auto;
1196
1146
  right: var(--spacing-sm);
@@ -1338,7 +1288,7 @@ var SelectedEnrichments = ({ list, setList, dimIndex }) => {
1338
1288
 
1339
1289
  // src/components/PersonalizationCriteria/PersonalizationCriteria.tsx
1340
1290
  var import_design_system11 = require("@uniformdev/design-system");
1341
- var import_react17 = require("react");
1291
+ var import_react16 = require("react");
1342
1292
  var import_react_use = require("react-use");
1343
1293
  var yup = __toESM(require("yup"));
1344
1294
 
@@ -1354,15 +1304,15 @@ function opHasRhs(op) {
1354
1304
  }
1355
1305
 
1356
1306
  // src/components/PersonalizationCriteria/PersonalizationCriteriaStatic.tsx
1357
- var import_react16 = require("@emotion/react");
1307
+ var import_react15 = require("@emotion/react");
1358
1308
  var import_CgCloseO2 = require("@react-icons/all-files/cg/CgCloseO");
1359
1309
  var import_design_system10 = require("@uniformdev/design-system");
1360
1310
  var import_immer2 = require("immer");
1361
1311
 
1362
1312
  // src/components/PersonalizationCriteria/PersonalizationCriteriaStatic.styles.ts
1363
- var import_react15 = require("@emotion/react");
1313
+ var import_react14 = require("@emotion/react");
1364
1314
  var spaceBetweenCriteriaItems = "6rem";
1365
- var criteriaItem = import_react15.css`
1315
+ var criteriaItem = import_react14.css`
1366
1316
  position: relative;
1367
1317
  padding: var(--spacing-md) var(--spacing-base);
1368
1318
  border: 1px solid var(--gray-300);
@@ -1390,31 +1340,29 @@ var criteriaItem = import_react15.css`
1390
1340
  }
1391
1341
  }
1392
1342
  `;
1393
- var criteriaItemInner = import_react15.css`
1343
+ var criteriaItemInner = import_react14.css`
1394
1344
  display: flex;
1395
- row-gap: var(--spacing-base);
1396
- column-gap: var(--spacing-xs);
1345
+ gap: var(--spacing-base);
1397
1346
  flex-grow: 1;
1398
1347
  flex-wrap: wrap;
1399
1348
  margin-right: var(--spacing-base);
1400
1349
  `;
1401
- var criteriaWrapper = import_react15.css`
1350
+ var criteriaWrapper = import_react14.css`
1402
1351
  width: 100%;
1403
1352
  display: flex;
1404
1353
  align-items: stretch;
1405
1354
  position: relative;
1406
1355
  `;
1407
- var criteriaOperandWrapper = import_react15.css`
1356
+ var criteriaOperandWrapper = import_react14.css`
1408
1357
  flex: 2;
1409
1358
  height: 52px;
1410
1359
  min-width: 200px;
1411
1360
  `;
1412
- var criteriaOperatorWrapper = import_react15.css`
1361
+ var criteriaOperatorWrapper = import_react14.css`
1413
1362
  flex: 1;
1414
- flex-wrap: nowrap;
1415
1363
  min-width: 80px;
1416
1364
  `;
1417
- var expand = import_react15.css`
1365
+ var expand = import_react14.css`
1418
1366
  height: 100%;
1419
1367
  width: 100%;
1420
1368
  `;
@@ -1425,7 +1373,6 @@ var PersonalizationCriteriaStatic = ({
1425
1373
  value,
1426
1374
  setValue,
1427
1375
  dimensions,
1428
- quirks,
1429
1376
  onMenuOpen,
1430
1377
  onMenuClose,
1431
1378
  onAddCriteria,
@@ -1475,146 +1422,100 @@ var PersonalizationCriteriaStatic = ({
1475
1422
  fontSize: "var(--fs-md)",
1476
1423
  fontWeight: "var(--fw-bold)"
1477
1424
  },
1478
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system10.Heading, { level: 5, withMarginBottom: false, children: "Personalization Variation" })
1425
+ children: "Personalize This"
1479
1426
  }
1480
1427
  ) : null,
1481
1428
  (components == null ? void 0 : components.CustomVariantName) ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(components.CustomVariantName, {}) : null,
1482
1429
  (components == null ? void 0 : components.ControlPercentage) ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(components.ControlPercentage, {}) : null,
1483
1430
  !currentValue.crit.length ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system10.Callout, { title: "Default variant", type: "info", css: { marginBlock: "var(--spacing-base)" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_design_system10.Paragraph, { children: 'This personalized variant has no match criteria and will be shown to any visitor that does not match any preceding variants. Ensure that default variants come last in the variant list. Personalize this variant by clicking "Add Criteria" to get started.' }) }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { children: currentValue.crit.map((currentCriteria, index) => {
1484
- var _a2, _b, _c, _d, _e, _f, _g, _h;
1431
+ var _a2, _b, _c, _d;
1485
1432
  const critHasLhs = ((_a2 = currentCriteria.l) == null ? void 0 : _a2.length) > 0;
1486
1433
  const critHasRhs = opHasRhs(currentCriteria.op);
1487
- const currentDimension = dimensions.dimIndex[currentCriteria.l];
1488
- const currentQuirk = quirks == null ? void 0 : quirks.find((q) => q.id === currentCriteria.l);
1489
1434
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { css: criteriaItem, "data-testid": "criteria-container", children: [
1490
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { css: criteriaItemInner, className: "criteriaItemInner", children: [
1491
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1492
- "div",
1493
- {
1494
- css: [criteriaWrapper, criteriaOperandWrapper],
1495
- className: "criteria-wrapper",
1496
- "data-testid": "select-criteria",
1497
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1498
- DimensionMenu,
1435
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
1436
+ "div",
1437
+ {
1438
+ css: import_react15.css`
1439
+ ${criteriaItemInner}/* grid-template-columns: minmax(0, 1fr) ${critHasRhs ? "minmax(0, 79px) minmax(0, 1fr)" : "minmax(0, 1fr)"} */
1440
+ `,
1441
+ className: "criteriaItemInner",
1442
+ children: [
1443
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1444
+ "div",
1499
1445
  {
1500
- errorMessage: (_b = errors.lhs) == null ? void 0 : _b[index],
1501
- css: expand,
1502
- styles: { control: (base) => ({ ...base, height: "100%" }) },
1503
- dimensions: dimensions.dimensions,
1504
- quirks,
1505
- onChange: (selection) => {
1506
- if (!selection) {
1507
- return;
1508
- }
1509
- if ("dim" in selection) {
1510
- const newCriteria = {
1511
- ...currentCriteria,
1512
- l: selection.dim,
1513
- t: void 0,
1514
- op: ">",
1515
- r: 0
1516
- };
1517
- update(newCriteria, index);
1518
- } else {
1519
- update({ ...currentCriteria, l: selection.id, t: "q", op: "=", r: "" }, index);
1446
+ css: [criteriaWrapper, criteriaOperandWrapper],
1447
+ className: "criteria-wrapper",
1448
+ "data-testid": "select-criteria",
1449
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1450
+ DimensionMenu,
1451
+ {
1452
+ errorMessage: (_b = errors.lhs) == null ? void 0 : _b[index],
1453
+ css: expand,
1454
+ styles: { control: (base) => ({ ...base, height: "100%" }) },
1455
+ dimensions: dimensions.dimensions,
1456
+ onChange: (dim) => {
1457
+ update({ ...currentCriteria, l: dim.dim }, index);
1458
+ },
1459
+ value: dimensions.dimIndex[currentCriteria.l],
1460
+ onMenuOpen,
1461
+ onMenuClose
1520
1462
  }
1521
- },
1522
- value: currentDimension != null ? currentDimension : currentQuirk,
1523
- onMenuOpen,
1524
- onMenuClose
1463
+ )
1525
1464
  }
1526
- )
1527
- }
1528
- ),
1529
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1530
- "div",
1531
- {
1532
- css: [criteriaWrapper, criteriaOperatorWrapper],
1533
- className: "criteria-wrapper",
1534
- "data-testid": "select-operator",
1535
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1536
- CriteriaOperatorMenu,
1465
+ ),
1466
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1467
+ "div",
1537
1468
  {
1538
- name: `op-${index}`,
1539
- css: expand,
1540
- styles: { control: (base) => ({ ...base, height: "100%" }) },
1541
- value: currentCriteria.op,
1542
- rhsType: currentQuirk ? "QUIRK" : currentDimension == null ? void 0 : currentDimension.category,
1543
- onChange: (op) => {
1544
- if (op === "+" || op === "-") {
1545
- update({ ...currentCriteria, op, r: void 0, rDim: void 0 }, index);
1546
- } else {
1547
- update({ ...currentCriteria, op }, index);
1469
+ css: [criteriaWrapper, criteriaOperatorWrapper],
1470
+ className: "criteria-wrapper",
1471
+ "data-testid": "select-operator",
1472
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1473
+ CriteriaOperatorMenu,
1474
+ {
1475
+ name: `op-${index}`,
1476
+ css: expand,
1477
+ styles: { control: (base) => ({ ...base, height: "100%" }) },
1478
+ value: currentCriteria.op,
1479
+ onChange: (op) => {
1480
+ if (op === "+" || op === "-") {
1481
+ update({ ...currentCriteria, op, r: void 0, rDim: void 0 }, index);
1482
+ } else {
1483
+ update({ ...currentCriteria, op }, index);
1484
+ }
1485
+ },
1486
+ onMenuOpen,
1487
+ onMenuClose
1548
1488
  }
1549
- },
1550
- onMenuOpen,
1551
- onMenuClose
1489
+ )
1552
1490
  }
1553
- )
1554
- }
1555
- ),
1556
- critHasRhs ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1557
- "div",
1558
- {
1559
- css: [criteriaWrapper, criteriaOperandWrapper],
1560
- className: "criteria-wrapper",
1561
- "data-testid": "select-match-criteria",
1562
- children: currentQuirk ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1491
+ ),
1492
+ critHasRhs ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1563
1493
  "div",
1564
1494
  {
1565
- css: import_react16.css`
1566
- width: 100%;
1567
- // InputSelect wrapper is unstylable so need a descendant selector
1568
- // to full-width it
1569
- & > * {
1570
- width: 100%;
1571
- }
1572
- `,
1573
- children: currentQuirk.options ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1574
- import_design_system10.InputSelect,
1575
- {
1576
- label: "quirk match value",
1577
- showLabel: false,
1578
- value: (_c = currentCriteria.r) != null ? _c : "",
1579
- errorMessage: (_d = errors.rhs) == null ? void 0 : _d[index],
1580
- onChange: (e) => update({ ...currentCriteria, r: e.currentTarget.value }, index),
1581
- options: [
1582
- { label: "Select\u2026", value: "" },
1583
- ...currentQuirk.options.map((o) => ({ label: o.name, value: o.value }))
1584
- ]
1585
- }
1586
- ) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1587
- import_design_system10.Input,
1495
+ css: [criteriaWrapper, criteriaOperandWrapper],
1496
+ className: "criteria-wrapper",
1497
+ "data-testid": "select-match-criteria",
1498
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1499
+ CriteriaMatchMenu,
1588
1500
  {
1589
- type: "text",
1590
- label: "quirk match value",
1591
- showLabel: false,
1592
- value: (_e = currentCriteria.r) != null ? _e : "",
1593
- errorMessage: (_f = errors.rhs) == null ? void 0 : _f[index],
1594
- onChange: (e) => update({ ...currentCriteria, r: e.currentTarget.value }, index),
1595
- placeholder: "Enter a value"
1501
+ errorMessage: (_c = errors.rhs) == null ? void 0 : _c[index],
1502
+ css: expand,
1503
+ styles: { control: (base) => ({ ...base, height: "100%" }) },
1504
+ criteriaMatch: currentCriteria,
1505
+ onChange: (match) => {
1506
+ update(match, index);
1507
+ },
1508
+ isDisabled: !critHasLhs,
1509
+ dimensions,
1510
+ onMenuOpen,
1511
+ onMenuClose
1596
1512
  }
1597
1513
  )
1598
1514
  }
1599
- ) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1600
- CriteriaMatchMenu,
1601
- {
1602
- errorMessage: (_g = errors.rhs) == null ? void 0 : _g[index],
1603
- css: expand,
1604
- styles: { control: (base) => ({ ...base, height: "100%" }) },
1605
- criteriaMatch: currentCriteria,
1606
- onChange: (match) => {
1607
- update(match, index);
1608
- },
1609
- isDisabled: !critHasLhs,
1610
- dimensions,
1611
- onMenuOpen,
1612
- onMenuClose
1613
- }
1614
- )
1615
- }
1616
- ) : null
1617
- ] }),
1515
+ ) : null
1516
+ ]
1517
+ }
1518
+ ),
1618
1519
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1619
1520
  "button",
1620
1521
  {
@@ -1640,7 +1541,7 @@ var PersonalizationCriteriaStatic = ({
1640
1541
  {
1641
1542
  "data-testid": "dropdown-button-combine",
1642
1543
  disabled: index > 1,
1643
- value: (_h = currentValue.op) != null ? _h : "&",
1544
+ value: (_d = currentValue.op) != null ? _d : "&",
1644
1545
  options: [
1645
1546
  { label: "AND", value: "&" },
1646
1547
  { label: "OR", value: "|" }
@@ -1727,7 +1628,7 @@ var PersonalizationCriteria = ({
1727
1628
  ...staticProps
1728
1629
  }) => {
1729
1630
  var _a, _b;
1730
- const [validationError, setValidationError] = (0, import_react17.useState)(void 0);
1631
+ const [validationError, setValidationError] = (0, import_react16.useState)(void 0);
1731
1632
  const { loading, result: dimensions, error } = useDimensions(contextConfig);
1732
1633
  (0, import_react_use.useAsync)(async () => {
1733
1634
  if (value && dimensions) {
@@ -1791,7 +1692,7 @@ function ProjectUIVersion({ children, versionMap, contextConfig }) {
1791
1692
  }
1792
1693
 
1793
1694
  // src/hooks/useValidateContextConfig.ts
1794
- var import_react18 = require("react");
1695
+ var import_react17 = require("react");
1795
1696
 
1796
1697
  // src/utils/validateContextConfig.ts
1797
1698
  var import_api4 = require("@uniformdev/context/api");
@@ -1827,12 +1728,12 @@ var validateContextConfig = async (contextConfig) => {
1827
1728
 
1828
1729
  // src/hooks/useValidateContextConfig.ts
1829
1730
  var useValidateContextConfig = (contextConfig) => {
1830
- const [state, setState] = (0, import_react18.useState)({
1731
+ const [state, setState] = (0, import_react17.useState)({
1831
1732
  validating: false,
1832
1733
  error: void 0
1833
1734
  });
1834
1735
  const { apiKey, apiHost, projectId } = contextConfig || {};
1835
- (0, import_react18.useEffect)(() => {
1736
+ (0, import_react17.useEffect)(() => {
1836
1737
  if (!apiKey || !apiHost) {
1837
1738
  return;
1838
1739
  }
@@ -1873,7 +1774,6 @@ __reExport(src_exports, require("@uniformdev/design-system"), module.exports);
1873
1774
  addEnrichmentLink,
1874
1775
  contextCriteriaMenuOperators,
1875
1776
  convertErrorsToObj,
1876
- enrichmentCriteriaMenuOperators,
1877
1777
  isEnrichmentTagData,
1878
1778
  isPersonalizationCriteriaData,
1879
1779
  opHasRhs,