@uniformdev/context-ui 20.3.1 → 20.4.1-alpha.15
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.d.mts +23 -11
- package/dist/index.d.ts +23 -11
- package/dist/index.esm.js +218 -115
- package/dist/index.js +235 -140
- package/dist/index.mjs +218 -115
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -289,23 +289,39 @@ var contextCriteriaMenuOperators = [
|
|
|
289
289
|
{
|
|
290
290
|
name: "has the weakest score",
|
|
291
291
|
value: "-"
|
|
292
|
-
}
|
|
292
|
+
}
|
|
293
|
+
];
|
|
294
|
+
var enrichmentCriteriaMenuOperators = [
|
|
295
|
+
...contextCriteriaMenuOperators,
|
|
293
296
|
{
|
|
294
297
|
name: "has strongest category score",
|
|
295
298
|
value: "^"
|
|
296
299
|
}
|
|
297
300
|
];
|
|
298
|
-
|
|
301
|
+
var quirkCriteriaMenuOperators = [
|
|
302
|
+
{
|
|
303
|
+
name: "=",
|
|
304
|
+
description: "equals",
|
|
305
|
+
value: "="
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
name: "\u2260",
|
|
309
|
+
description: "not equal",
|
|
310
|
+
value: "!="
|
|
311
|
+
}
|
|
312
|
+
];
|
|
313
|
+
function CriteriaOperatorMenu({ onChange, value, rhsType, ...props }) {
|
|
299
314
|
var _a, _b;
|
|
315
|
+
const operators = rhsType === "QUIRK" ? quirkCriteriaMenuOperators : rhsType === "ENR" ? enrichmentCriteriaMenuOperators : contextCriteriaMenuOperators;
|
|
300
316
|
return /* @__PURE__ */ jsx6(
|
|
301
317
|
InputComboBox,
|
|
302
318
|
{
|
|
303
319
|
...props,
|
|
304
320
|
value: {
|
|
305
|
-
label: (_b = (_a =
|
|
321
|
+
label: (_b = (_a = operators.find((e) => e.value === value)) == null ? void 0 : _a.name) != null ? _b : value,
|
|
306
322
|
value
|
|
307
323
|
},
|
|
308
|
-
options:
|
|
324
|
+
options: operators.map((option) => ({
|
|
309
325
|
label: option.description ? `${option.name}:${option.description}` : option.name,
|
|
310
326
|
value: option.value
|
|
311
327
|
})),
|
|
@@ -543,18 +559,23 @@ import { useState as useState5 } from "react";
|
|
|
543
559
|
import { Icon } from "@uniformdev/design-system";
|
|
544
560
|
|
|
545
561
|
// src/components/DimensionMenu/utils.ts
|
|
562
|
+
import { useMemo } from "react";
|
|
546
563
|
function dimensionToMenuOption(dimension) {
|
|
564
|
+
if ("dim" in dimension) {
|
|
565
|
+
return {
|
|
566
|
+
label: dimension.displayName,
|
|
567
|
+
value: dimension.dim,
|
|
568
|
+
original: dimension
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
const quirk = dimension;
|
|
547
572
|
return {
|
|
548
|
-
label:
|
|
549
|
-
value:
|
|
550
|
-
|
|
573
|
+
label: `Quirk:${quirk.name}`,
|
|
574
|
+
value: quirk.id,
|
|
575
|
+
original: quirk
|
|
551
576
|
};
|
|
552
577
|
}
|
|
553
|
-
function dimensionIcon(
|
|
554
|
-
if (!displayName) {
|
|
555
|
-
return "unavailable";
|
|
556
|
-
}
|
|
557
|
-
const [type] = displayName.split(":");
|
|
578
|
+
function dimensionIcon(type) {
|
|
558
579
|
switch (type.toLowerCase()) {
|
|
559
580
|
case "signal":
|
|
560
581
|
return "data";
|
|
@@ -566,25 +587,42 @@ function dimensionIcon(displayName) {
|
|
|
566
587
|
return "user-list";
|
|
567
588
|
}
|
|
568
589
|
}
|
|
569
|
-
function
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
const
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
590
|
+
function useGroupedDimensions(dimensions, quirks) {
|
|
591
|
+
return useMemo(() => {
|
|
592
|
+
const result = [];
|
|
593
|
+
let lastType = "";
|
|
594
|
+
for (const dim of dimensions) {
|
|
595
|
+
const { type } = dimensionDisplayName(dim.displayName);
|
|
596
|
+
if (lastType !== type) {
|
|
597
|
+
result.push({ label: type != null ? type : "", options: [] });
|
|
598
|
+
lastType = type != null ? type : "";
|
|
599
|
+
}
|
|
600
|
+
result[result.length - 1].options.push(dimensionToMenuOption(dim));
|
|
601
|
+
}
|
|
602
|
+
if (quirks == null ? void 0 : quirks.length) {
|
|
603
|
+
result.push({
|
|
604
|
+
label: "Quirks",
|
|
605
|
+
options: quirks.map(dimensionToMenuOption)
|
|
606
|
+
});
|
|
577
607
|
}
|
|
578
|
-
result
|
|
608
|
+
return result;
|
|
609
|
+
}, [dimensions, quirks]);
|
|
610
|
+
}
|
|
611
|
+
function dimensionDisplayName(displayName) {
|
|
612
|
+
if (!displayName) {
|
|
613
|
+
return {};
|
|
579
614
|
}
|
|
580
|
-
|
|
615
|
+
const colonIndex = displayName.indexOf(":");
|
|
616
|
+
const type = colonIndex >= 0 ? displayName.substring(0, colonIndex) : void 0;
|
|
617
|
+
const name = colonIndex >= 0 ? displayName.substring(colonIndex + 1) : displayName;
|
|
618
|
+
return { type, name };
|
|
581
619
|
}
|
|
582
620
|
|
|
583
621
|
// src/components/DimensionMenu/DimensionGroupHeading.tsx
|
|
584
622
|
import { jsx as jsx8, jsxs as jsxs3 } from "@emotion/react/jsx-runtime";
|
|
585
623
|
var DimensionGroupHeading = (props) => {
|
|
586
|
-
var _a;
|
|
587
624
|
const { data, getStyles, className } = props;
|
|
625
|
+
const { type } = dimensionDisplayName(data.label);
|
|
588
626
|
return /* @__PURE__ */ jsx8(
|
|
589
627
|
"div",
|
|
590
628
|
{
|
|
@@ -599,7 +637,7 @@ var DimensionGroupHeading = (props) => {
|
|
|
599
637
|
{
|
|
600
638
|
css: { color: "var(--gray-500)", display: "flex", alignItems: "center", gap: "var(--spacing-xs)" },
|
|
601
639
|
children: [
|
|
602
|
-
/* @__PURE__ */ jsx8(Icon, { icon: dimensionIcon(
|
|
640
|
+
type ? /* @__PURE__ */ jsx8(Icon, { icon: dimensionIcon(type), iconColor: "currentColor", size: 16 }) : null,
|
|
603
641
|
/* @__PURE__ */ jsx8("span", { children: data.label })
|
|
604
642
|
]
|
|
605
643
|
}
|
|
@@ -630,9 +668,8 @@ function DimensionMenuErrorMessage({ message }) {
|
|
|
630
668
|
// src/components/DimensionMenu/DimensionOption.tsx
|
|
631
669
|
import { jsx as jsx10 } from "@emotion/react/jsx-runtime";
|
|
632
670
|
var DimensionOption = (props) => {
|
|
633
|
-
var _a, _b;
|
|
634
671
|
const { data, getStyles, cx, isDisabled, isFocused, isSelected, className, innerRef, innerProps } = props;
|
|
635
|
-
const
|
|
672
|
+
const { name } = dimensionDisplayName(data.label);
|
|
636
673
|
return /* @__PURE__ */ jsx10(
|
|
637
674
|
"div",
|
|
638
675
|
{
|
|
@@ -649,7 +686,7 @@ var DimensionOption = (props) => {
|
|
|
649
686
|
ref: innerRef,
|
|
650
687
|
"aria-disabled": isDisabled,
|
|
651
688
|
...innerProps,
|
|
652
|
-
children: /* @__PURE__ */ jsx10("div", { css: { color: "var(--gray-700)" }, children:
|
|
689
|
+
children: /* @__PURE__ */ jsx10("div", { css: { color: "var(--gray-700)" }, children: name != null ? name : data.label })
|
|
653
690
|
}
|
|
654
691
|
);
|
|
655
692
|
};
|
|
@@ -658,7 +695,7 @@ var DimensionOption = (props) => {
|
|
|
658
695
|
import { Icon as Icon2 } from "@uniformdev/design-system";
|
|
659
696
|
import { jsx as jsx11, jsxs as jsxs4 } from "@emotion/react/jsx-runtime";
|
|
660
697
|
function DimensionValue({ displayName }) {
|
|
661
|
-
const
|
|
698
|
+
const { type, name } = dimensionDisplayName(displayName);
|
|
662
699
|
return /* @__PURE__ */ jsxs4(
|
|
663
700
|
"div",
|
|
664
701
|
{
|
|
@@ -667,7 +704,7 @@ function DimensionValue({ displayName }) {
|
|
|
667
704
|
overflow: "hidden"
|
|
668
705
|
},
|
|
669
706
|
children: [
|
|
670
|
-
|
|
707
|
+
type ? /* @__PURE__ */ jsxs4(
|
|
671
708
|
"small",
|
|
672
709
|
{
|
|
673
710
|
css: { color: "var(--gray-500)", display: "flex", alignItems: "center", gap: "var(--spacing-xs)" },
|
|
@@ -705,6 +742,7 @@ function CriteriaMatchMenu({
|
|
|
705
742
|
);
|
|
706
743
|
const rDim = criteriaMatch.rDim;
|
|
707
744
|
const targetDim = criteriaMatch.rDim ? dimensions.dimIndex[criteriaMatch.rDim] : void 0;
|
|
745
|
+
const groupedDimensions = useGroupedDimensions(dimensions.dimensions, void 0);
|
|
708
746
|
return /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
709
747
|
/* @__PURE__ */ jsx13(
|
|
710
748
|
InputComboBox3,
|
|
@@ -723,7 +761,7 @@ function CriteriaMatchMenu({
|
|
|
723
761
|
value: "",
|
|
724
762
|
isDisabled: true
|
|
725
763
|
},
|
|
726
|
-
...
|
|
764
|
+
...groupedDimensions
|
|
727
765
|
],
|
|
728
766
|
styles: {
|
|
729
767
|
...props.styles,
|
|
@@ -802,14 +840,23 @@ function isInt(value) {
|
|
|
802
840
|
// src/components/DimensionMenu/DimensionMenu.tsx
|
|
803
841
|
import { InputComboBox as InputComboBox4 } from "@uniformdev/design-system";
|
|
804
842
|
import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs6 } from "@emotion/react/jsx-runtime";
|
|
805
|
-
function DimensionMenu({
|
|
843
|
+
function DimensionMenu({
|
|
844
|
+
onChange,
|
|
845
|
+
value,
|
|
846
|
+
dimensions,
|
|
847
|
+
errorMessage,
|
|
848
|
+
quirks,
|
|
849
|
+
...props
|
|
850
|
+
}) {
|
|
851
|
+
const groupedDimensions = useGroupedDimensions(dimensions, quirks);
|
|
852
|
+
const valueAsMenuOption = value ? dimensionToMenuOption(value) : void 0;
|
|
806
853
|
return /* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
807
854
|
/* @__PURE__ */ jsx14(
|
|
808
855
|
InputComboBox4,
|
|
809
856
|
{
|
|
810
857
|
...props,
|
|
811
|
-
value:
|
|
812
|
-
options:
|
|
858
|
+
value: valueAsMenuOption,
|
|
859
|
+
options: groupedDimensions,
|
|
813
860
|
styles: {
|
|
814
861
|
...props.styles,
|
|
815
862
|
valueContainer: (provided, state) => {
|
|
@@ -822,8 +869,8 @@ function DimensionMenu({ onChange, value, dimensions, errorMessage, ...props })
|
|
|
822
869
|
}
|
|
823
870
|
},
|
|
824
871
|
onChange: (e) => {
|
|
825
|
-
if (e) {
|
|
826
|
-
onChange(
|
|
872
|
+
if (e == null ? void 0 : e.original) {
|
|
873
|
+
onChange(e.original);
|
|
827
874
|
}
|
|
828
875
|
},
|
|
829
876
|
components: {
|
|
@@ -892,7 +939,7 @@ import {
|
|
|
892
939
|
LoadingIndicator as LoadingIndicator3
|
|
893
940
|
} from "@uniformdev/design-system";
|
|
894
941
|
import { produce } from "immer";
|
|
895
|
-
import { useMemo, useState as useState6 } from "react";
|
|
942
|
+
import { useMemo as useMemo2, useState as useState6 } from "react";
|
|
896
943
|
import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs8 } from "@emotion/react/jsx-runtime";
|
|
897
944
|
var addEnrichmentLink = css5`
|
|
898
945
|
flex: 2;
|
|
@@ -913,10 +960,10 @@ var EnrichmentTag = ({
|
|
|
913
960
|
displayTitle = true
|
|
914
961
|
}) => {
|
|
915
962
|
const { loading, result: dimensions, error } = useDimensions(contextConfig);
|
|
916
|
-
const allEnrichments =
|
|
963
|
+
const allEnrichments = useMemo2(() => {
|
|
917
964
|
if (dimensions) return dimensions.dimensions.filter((dimension) => dimension.category === "ENR");
|
|
918
965
|
}, [dimensions]);
|
|
919
|
-
const remainingEnrichments =
|
|
966
|
+
const remainingEnrichments = useMemo2(() => {
|
|
920
967
|
if (!value) return allEnrichments;
|
|
921
968
|
if (allEnrichments)
|
|
922
969
|
return allEnrichments.filter(
|
|
@@ -1262,7 +1309,16 @@ function opHasRhs(op) {
|
|
|
1262
1309
|
// src/components/PersonalizationCriteria/PersonalizationCriteriaStatic.tsx
|
|
1263
1310
|
import { css as css7 } from "@emotion/react";
|
|
1264
1311
|
import { CgCloseO as CgCloseO2 } from "@react-icons/all-files/cg/CgCloseO";
|
|
1265
|
-
import {
|
|
1312
|
+
import {
|
|
1313
|
+
AddListButton as AddListButton3,
|
|
1314
|
+
Callout as Callout3,
|
|
1315
|
+
Heading as Heading2,
|
|
1316
|
+
Icon as Icon5,
|
|
1317
|
+
Input as Input2,
|
|
1318
|
+
InputInlineSelect,
|
|
1319
|
+
InputSelect as InputSelect2,
|
|
1320
|
+
Paragraph
|
|
1321
|
+
} from "@uniformdev/design-system";
|
|
1266
1322
|
import { produce as produce2 } from "immer";
|
|
1267
1323
|
|
|
1268
1324
|
// src/components/PersonalizationCriteria/PersonalizationCriteriaStatic.styles.ts
|
|
@@ -1298,7 +1354,8 @@ var criteriaItem = css6`
|
|
|
1298
1354
|
`;
|
|
1299
1355
|
var criteriaItemInner = css6`
|
|
1300
1356
|
display: flex;
|
|
1301
|
-
gap: var(--spacing-base);
|
|
1357
|
+
row-gap: var(--spacing-base);
|
|
1358
|
+
column-gap: var(--spacing-xs);
|
|
1302
1359
|
flex-grow: 1;
|
|
1303
1360
|
flex-wrap: wrap;
|
|
1304
1361
|
margin-right: var(--spacing-base);
|
|
@@ -1316,6 +1373,7 @@ var criteriaOperandWrapper = css6`
|
|
|
1316
1373
|
`;
|
|
1317
1374
|
var criteriaOperatorWrapper = css6`
|
|
1318
1375
|
flex: 1;
|
|
1376
|
+
flex-wrap: nowrap;
|
|
1319
1377
|
min-width: 80px;
|
|
1320
1378
|
`;
|
|
1321
1379
|
var expand = css6`
|
|
@@ -1329,6 +1387,7 @@ var PersonalizationCriteriaStatic = ({
|
|
|
1329
1387
|
value,
|
|
1330
1388
|
setValue,
|
|
1331
1389
|
dimensions,
|
|
1390
|
+
quirks,
|
|
1332
1391
|
onMenuOpen,
|
|
1333
1392
|
onMenuClose,
|
|
1334
1393
|
onAddCriteria,
|
|
@@ -1378,100 +1437,143 @@ var PersonalizationCriteriaStatic = ({
|
|
|
1378
1437
|
fontSize: "var(--fs-md)",
|
|
1379
1438
|
fontWeight: "var(--fw-bold)"
|
|
1380
1439
|
},
|
|
1381
|
-
children: "
|
|
1440
|
+
children: /* @__PURE__ */ jsx17(Heading2, { level: 5, withMarginBottom: false, children: "Personalization Variation" })
|
|
1382
1441
|
}
|
|
1383
1442
|
) : null,
|
|
1384
1443
|
(components == null ? void 0 : components.CustomVariantName) ? /* @__PURE__ */ jsx17(components.CustomVariantName, {}) : null,
|
|
1385
1444
|
(components == null ? void 0 : components.ControlPercentage) ? /* @__PURE__ */ jsx17(components.ControlPercentage, {}) : null,
|
|
1386
1445
|
!currentValue.crit.length ? /* @__PURE__ */ jsx17(Callout3, { title: "Default variant", type: "info", css: { marginBlock: "var(--spacing-base)" }, children: /* @__PURE__ */ jsx17(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__ */ jsx17("div", { children: currentValue.crit.map((currentCriteria, index) => {
|
|
1387
|
-
var _a2, _b, _c, _d;
|
|
1446
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
1388
1447
|
const critHasLhs = ((_a2 = currentCriteria.l) == null ? void 0 : _a2.length) > 0;
|
|
1389
1448
|
const critHasRhs = opHasRhs(currentCriteria.op);
|
|
1449
|
+
const currentDimension = dimensions.dimIndex[currentCriteria.l];
|
|
1450
|
+
const currentQuirk = quirks == null ? void 0 : quirks.find((q) => q.id === currentCriteria.l);
|
|
1390
1451
|
return /* @__PURE__ */ jsxs9("div", { css: criteriaItem, "data-testid": "criteria-container", children: [
|
|
1391
|
-
/* @__PURE__ */ jsxs9(
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
"div",
|
|
1452
|
+
/* @__PURE__ */ jsxs9("div", { css: criteriaItemInner, className: "criteriaItemInner", children: [
|
|
1453
|
+
/* @__PURE__ */ jsx17(
|
|
1454
|
+
"div",
|
|
1455
|
+
{
|
|
1456
|
+
css: [criteriaWrapper, criteriaOperandWrapper],
|
|
1457
|
+
className: "criteria-wrapper",
|
|
1458
|
+
"data-testid": "select-criteria",
|
|
1459
|
+
children: /* @__PURE__ */ jsx17(
|
|
1460
|
+
DimensionMenu,
|
|
1401
1461
|
{
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1462
|
+
errorMessage: (_b = errors.lhs) == null ? void 0 : _b[index],
|
|
1463
|
+
css: expand,
|
|
1464
|
+
styles: { control: (base) => ({ ...base, height: "100%" }) },
|
|
1465
|
+
dimensions: dimensions.dimensions,
|
|
1466
|
+
quirks,
|
|
1467
|
+
onChange: (selection) => {
|
|
1468
|
+
if ("dim" in selection) {
|
|
1469
|
+
const newCriteria = {
|
|
1470
|
+
...currentCriteria,
|
|
1471
|
+
l: selection.dim,
|
|
1472
|
+
t: void 0,
|
|
1473
|
+
op: ">",
|
|
1474
|
+
r: 0
|
|
1475
|
+
};
|
|
1476
|
+
update(newCriteria, index);
|
|
1477
|
+
} else {
|
|
1478
|
+
update({ ...currentCriteria, l: selection.id, t: "q", op: "=", r: "" }, index);
|
|
1418
1479
|
}
|
|
1419
|
-
|
|
1480
|
+
},
|
|
1481
|
+
value: currentDimension != null ? currentDimension : currentQuirk,
|
|
1482
|
+
onMenuOpen,
|
|
1483
|
+
onMenuClose
|
|
1420
1484
|
}
|
|
1421
|
-
)
|
|
1422
|
-
|
|
1423
|
-
|
|
1485
|
+
)
|
|
1486
|
+
}
|
|
1487
|
+
),
|
|
1488
|
+
/* @__PURE__ */ jsx17(
|
|
1489
|
+
"div",
|
|
1490
|
+
{
|
|
1491
|
+
css: [criteriaWrapper, criteriaOperatorWrapper],
|
|
1492
|
+
className: "criteria-wrapper",
|
|
1493
|
+
"data-testid": "select-operator",
|
|
1494
|
+
children: /* @__PURE__ */ jsx17(
|
|
1495
|
+
CriteriaOperatorMenu,
|
|
1424
1496
|
{
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
onChange: (op) => {
|
|
1436
|
-
if (op === "+" || op === "-") {
|
|
1437
|
-
update({ ...currentCriteria, op, r: void 0, rDim: void 0 }, index);
|
|
1438
|
-
} else {
|
|
1439
|
-
update({ ...currentCriteria, op }, index);
|
|
1440
|
-
}
|
|
1441
|
-
},
|
|
1442
|
-
onMenuOpen,
|
|
1443
|
-
onMenuClose
|
|
1497
|
+
name: `op-${index}`,
|
|
1498
|
+
css: expand,
|
|
1499
|
+
styles: { control: (base) => ({ ...base, height: "100%" }) },
|
|
1500
|
+
value: currentCriteria.op,
|
|
1501
|
+
rhsType: currentQuirk ? "QUIRK" : currentDimension == null ? void 0 : currentDimension.category,
|
|
1502
|
+
onChange: (op) => {
|
|
1503
|
+
if (op === "+" || op === "-") {
|
|
1504
|
+
update({ ...currentCriteria, op, r: void 0, rDim: void 0 }, index);
|
|
1505
|
+
} else {
|
|
1506
|
+
update({ ...currentCriteria, op }, index);
|
|
1444
1507
|
}
|
|
1445
|
-
|
|
1508
|
+
},
|
|
1509
|
+
onMenuOpen,
|
|
1510
|
+
onMenuClose
|
|
1446
1511
|
}
|
|
1447
|
-
)
|
|
1448
|
-
|
|
1512
|
+
)
|
|
1513
|
+
}
|
|
1514
|
+
),
|
|
1515
|
+
critHasRhs ? /* @__PURE__ */ jsx17(
|
|
1516
|
+
"div",
|
|
1517
|
+
{
|
|
1518
|
+
css: [criteriaWrapper, criteriaOperandWrapper],
|
|
1519
|
+
className: "criteria-wrapper",
|
|
1520
|
+
"data-testid": "select-match-criteria",
|
|
1521
|
+
children: currentQuirk ? /* @__PURE__ */ jsx17(
|
|
1449
1522
|
"div",
|
|
1450
1523
|
{
|
|
1451
|
-
css:
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1524
|
+
css: css7`
|
|
1525
|
+
width: 100%;
|
|
1526
|
+
// InputSelect wrapper is unstylable so need a descendant selector
|
|
1527
|
+
// to full-width it
|
|
1528
|
+
& > * {
|
|
1529
|
+
width: 100%;
|
|
1530
|
+
}
|
|
1531
|
+
`,
|
|
1532
|
+
children: currentQuirk.options ? /* @__PURE__ */ jsx17(
|
|
1533
|
+
InputSelect2,
|
|
1534
|
+
{
|
|
1535
|
+
label: "quirk match value",
|
|
1536
|
+
showLabel: false,
|
|
1537
|
+
value: (_c = currentCriteria.r) != null ? _c : "",
|
|
1538
|
+
errorMessage: (_d = errors.rhs) == null ? void 0 : _d[index],
|
|
1539
|
+
onChange: (e) => update({ ...currentCriteria, r: e.currentTarget.value }, index),
|
|
1540
|
+
options: [
|
|
1541
|
+
{ label: "Select\u2026", value: "" },
|
|
1542
|
+
...currentQuirk.options.map((o) => ({ label: o.name, value: o.value }))
|
|
1543
|
+
]
|
|
1544
|
+
}
|
|
1545
|
+
) : /* @__PURE__ */ jsx17(
|
|
1546
|
+
Input2,
|
|
1456
1547
|
{
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
isDisabled: !critHasLhs,
|
|
1465
|
-
dimensions,
|
|
1466
|
-
onMenuOpen,
|
|
1467
|
-
onMenuClose
|
|
1548
|
+
type: "text",
|
|
1549
|
+
label: "quirk match value",
|
|
1550
|
+
showLabel: false,
|
|
1551
|
+
value: (_e = currentCriteria.r) != null ? _e : "",
|
|
1552
|
+
errorMessage: (_f = errors.rhs) == null ? void 0 : _f[index],
|
|
1553
|
+
onChange: (e) => update({ ...currentCriteria, r: e.currentTarget.value }, index),
|
|
1554
|
+
placeholder: "Enter a value"
|
|
1468
1555
|
}
|
|
1469
1556
|
)
|
|
1470
1557
|
}
|
|
1471
|
-
) :
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1558
|
+
) : /* @__PURE__ */ jsx17(
|
|
1559
|
+
CriteriaMatchMenu,
|
|
1560
|
+
{
|
|
1561
|
+
errorMessage: (_g = errors.rhs) == null ? void 0 : _g[index],
|
|
1562
|
+
css: expand,
|
|
1563
|
+
styles: { control: (base) => ({ ...base, height: "100%" }) },
|
|
1564
|
+
criteriaMatch: currentCriteria,
|
|
1565
|
+
onChange: (match) => {
|
|
1566
|
+
update(match, index);
|
|
1567
|
+
},
|
|
1568
|
+
isDisabled: !critHasLhs,
|
|
1569
|
+
dimensions,
|
|
1570
|
+
onMenuOpen,
|
|
1571
|
+
onMenuClose
|
|
1572
|
+
}
|
|
1573
|
+
)
|
|
1574
|
+
}
|
|
1575
|
+
) : null
|
|
1576
|
+
] }),
|
|
1475
1577
|
/* @__PURE__ */ jsx17(
|
|
1476
1578
|
"button",
|
|
1477
1579
|
{
|
|
@@ -1497,7 +1599,7 @@ var PersonalizationCriteriaStatic = ({
|
|
|
1497
1599
|
{
|
|
1498
1600
|
"data-testid": "dropdown-button-combine",
|
|
1499
1601
|
disabled: index > 1,
|
|
1500
|
-
value: (
|
|
1602
|
+
value: (_h = currentValue.op) != null ? _h : "&",
|
|
1501
1603
|
options: [
|
|
1502
1604
|
{ label: "AND", value: "&" },
|
|
1503
1605
|
{ label: "OR", value: "|" }
|
|
@@ -1729,6 +1831,7 @@ export {
|
|
|
1729
1831
|
addEnrichmentLink,
|
|
1730
1832
|
contextCriteriaMenuOperators,
|
|
1731
1833
|
convertErrorsToObj,
|
|
1834
|
+
enrichmentCriteriaMenuOperators,
|
|
1732
1835
|
isEnrichmentTagData,
|
|
1733
1836
|
isPersonalizationCriteriaData,
|
|
1734
1837
|
opHasRhs,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/context-ui",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.4.1-alpha.15+73b27bfcce",
|
|
4
4
|
"description": "React-based functionality and components for Uniform Context",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@emotion/react": "11.13.5",
|
|
36
36
|
"@react-icons/all-files": "https://github.com/react-icons/react-icons/releases/download/v5.2.1/react-icons-all-files-5.2.1.tgz",
|
|
37
|
-
"@uniformdev/context": "20.
|
|
38
|
-
"@uniformdev/design-system": "20.
|
|
37
|
+
"@uniformdev/context": "20.4.1-alpha.15+73b27bfcce",
|
|
38
|
+
"@uniformdev/design-system": "20.4.1-alpha.15+73b27bfcce",
|
|
39
39
|
"immer": "10.1.1",
|
|
40
40
|
"react-beautiful-dnd": "13.1.1",
|
|
41
41
|
"react-select": "5.8.0",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "73b27bfcce749c31e7ab50bdc9bb86ac1294903d"
|
|
80
80
|
}
|