@uniformdev/context-ui 20.7.1-alpha.4 → 20.7.1-alpha.42
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 +226 -116
- package/dist/index.js +243 -141
- package/dist/index.mjs +226 -116
- package/package.json +13 -16
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,24 @@ 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,
|
|
860
|
+
getOptionValue: (option) => option.label,
|
|
813
861
|
styles: {
|
|
814
862
|
...props.styles,
|
|
815
863
|
valueContainer: (provided, state) => {
|
|
@@ -822,8 +870,10 @@ function DimensionMenu({ onChange, value, dimensions, errorMessage, ...props })
|
|
|
822
870
|
}
|
|
823
871
|
},
|
|
824
872
|
onChange: (e) => {
|
|
825
|
-
if (e) {
|
|
826
|
-
onChange(
|
|
873
|
+
if (e == null ? void 0 : e.original) {
|
|
874
|
+
onChange(e.original);
|
|
875
|
+
} else {
|
|
876
|
+
onChange(void 0);
|
|
827
877
|
}
|
|
828
878
|
},
|
|
829
879
|
components: {
|
|
@@ -892,7 +942,7 @@ import {
|
|
|
892
942
|
LoadingIndicator as LoadingIndicator3
|
|
893
943
|
} from "@uniformdev/design-system";
|
|
894
944
|
import { produce } from "immer";
|
|
895
|
-
import { useMemo, useState as useState6 } from "react";
|
|
945
|
+
import { useMemo as useMemo2, useState as useState6 } from "react";
|
|
896
946
|
import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs8 } from "@emotion/react/jsx-runtime";
|
|
897
947
|
var addEnrichmentLink = css5`
|
|
898
948
|
flex: 2;
|
|
@@ -913,10 +963,10 @@ var EnrichmentTag = ({
|
|
|
913
963
|
displayTitle = true
|
|
914
964
|
}) => {
|
|
915
965
|
const { loading, result: dimensions, error } = useDimensions(contextConfig);
|
|
916
|
-
const allEnrichments =
|
|
966
|
+
const allEnrichments = useMemo2(() => {
|
|
917
967
|
if (dimensions) return dimensions.dimensions.filter((dimension) => dimension.category === "ENR");
|
|
918
968
|
}, [dimensions]);
|
|
919
|
-
const remainingEnrichments =
|
|
969
|
+
const remainingEnrichments = useMemo2(() => {
|
|
920
970
|
if (!value) return allEnrichments;
|
|
921
971
|
if (allEnrichments)
|
|
922
972
|
return allEnrichments.filter(
|
|
@@ -1262,7 +1312,16 @@ function opHasRhs(op) {
|
|
|
1262
1312
|
// src/components/PersonalizationCriteria/PersonalizationCriteriaStatic.tsx
|
|
1263
1313
|
import { css as css7 } from "@emotion/react";
|
|
1264
1314
|
import { CgCloseO as CgCloseO2 } from "@react-icons/all-files/cg/CgCloseO";
|
|
1265
|
-
import {
|
|
1315
|
+
import {
|
|
1316
|
+
AddListButton as AddListButton3,
|
|
1317
|
+
Callout as Callout3,
|
|
1318
|
+
Heading as Heading2,
|
|
1319
|
+
Icon as Icon5,
|
|
1320
|
+
Input as Input2,
|
|
1321
|
+
InputInlineSelect,
|
|
1322
|
+
InputSelect as InputSelect2,
|
|
1323
|
+
Paragraph
|
|
1324
|
+
} from "@uniformdev/design-system";
|
|
1266
1325
|
import { produce as produce2 } from "immer";
|
|
1267
1326
|
|
|
1268
1327
|
// src/components/PersonalizationCriteria/PersonalizationCriteriaStatic.styles.ts
|
|
@@ -1298,7 +1357,8 @@ var criteriaItem = css6`
|
|
|
1298
1357
|
`;
|
|
1299
1358
|
var criteriaItemInner = css6`
|
|
1300
1359
|
display: flex;
|
|
1301
|
-
gap: var(--spacing-base);
|
|
1360
|
+
row-gap: var(--spacing-base);
|
|
1361
|
+
column-gap: var(--spacing-xs);
|
|
1302
1362
|
flex-grow: 1;
|
|
1303
1363
|
flex-wrap: wrap;
|
|
1304
1364
|
margin-right: var(--spacing-base);
|
|
@@ -1316,6 +1376,7 @@ var criteriaOperandWrapper = css6`
|
|
|
1316
1376
|
`;
|
|
1317
1377
|
var criteriaOperatorWrapper = css6`
|
|
1318
1378
|
flex: 1;
|
|
1379
|
+
flex-wrap: nowrap;
|
|
1319
1380
|
min-width: 80px;
|
|
1320
1381
|
`;
|
|
1321
1382
|
var expand = css6`
|
|
@@ -1329,6 +1390,7 @@ var PersonalizationCriteriaStatic = ({
|
|
|
1329
1390
|
value,
|
|
1330
1391
|
setValue,
|
|
1331
1392
|
dimensions,
|
|
1393
|
+
quirks,
|
|
1332
1394
|
onMenuOpen,
|
|
1333
1395
|
onMenuClose,
|
|
1334
1396
|
onAddCriteria,
|
|
@@ -1378,100 +1440,147 @@ var PersonalizationCriteriaStatic = ({
|
|
|
1378
1440
|
fontSize: "var(--fs-md)",
|
|
1379
1441
|
fontWeight: "var(--fw-bold)"
|
|
1380
1442
|
},
|
|
1381
|
-
children: "
|
|
1443
|
+
children: /* @__PURE__ */ jsx17(Heading2, { level: 5, withMarginBottom: false, children: "Personalization Variation" })
|
|
1382
1444
|
}
|
|
1383
1445
|
) : null,
|
|
1384
1446
|
(components == null ? void 0 : components.CustomVariantName) ? /* @__PURE__ */ jsx17(components.CustomVariantName, {}) : null,
|
|
1385
1447
|
(components == null ? void 0 : components.ControlPercentage) ? /* @__PURE__ */ jsx17(components.ControlPercentage, {}) : null,
|
|
1386
1448
|
!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;
|
|
1449
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
1388
1450
|
const critHasLhs = ((_a2 = currentCriteria.l) == null ? void 0 : _a2.length) > 0;
|
|
1389
1451
|
const critHasRhs = opHasRhs(currentCriteria.op);
|
|
1452
|
+
const selectedValueIsQuirk = "t" in currentCriteria && currentCriteria.t === "q";
|
|
1453
|
+
const currentDimension = selectedValueIsQuirk ? void 0 : dimensions.dimIndex[currentCriteria.l];
|
|
1454
|
+
const currentQuirk = selectedValueIsQuirk ? quirks == null ? void 0 : quirks.find((q) => q.id === currentCriteria.l) : void 0;
|
|
1390
1455
|
return /* @__PURE__ */ jsxs9("div", { css: criteriaItem, "data-testid": "criteria-container", children: [
|
|
1391
|
-
/* @__PURE__ */ jsxs9(
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
"div",
|
|
1456
|
+
/* @__PURE__ */ jsxs9("div", { css: criteriaItemInner, className: "criteriaItemInner", children: [
|
|
1457
|
+
/* @__PURE__ */ jsx17(
|
|
1458
|
+
"div",
|
|
1459
|
+
{
|
|
1460
|
+
css: [criteriaWrapper, criteriaOperandWrapper],
|
|
1461
|
+
className: "criteria-wrapper",
|
|
1462
|
+
"data-testid": "select-criteria",
|
|
1463
|
+
children: /* @__PURE__ */ jsx17(
|
|
1464
|
+
DimensionMenu,
|
|
1401
1465
|
{
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
styles: { control: (base) => ({ ...base, height: "100%" }) },
|
|
1411
|
-
dimensions: dimensions.dimensions,
|
|
1412
|
-
onChange: (dim) => {
|
|
1413
|
-
update({ ...currentCriteria, l: dim.dim }, index);
|
|
1414
|
-
},
|
|
1415
|
-
value: dimensions.dimIndex[currentCriteria.l],
|
|
1416
|
-
onMenuOpen,
|
|
1417
|
-
onMenuClose
|
|
1466
|
+
errorMessage: (_b = errors.lhs) == null ? void 0 : _b[index],
|
|
1467
|
+
css: expand,
|
|
1468
|
+
styles: { control: (base) => ({ ...base, height: "100%" }) },
|
|
1469
|
+
dimensions: dimensions.dimensions,
|
|
1470
|
+
quirks,
|
|
1471
|
+
onChange: (selection) => {
|
|
1472
|
+
if (!selection) {
|
|
1473
|
+
return;
|
|
1418
1474
|
}
|
|
1419
|
-
|
|
1475
|
+
if ("dim" in selection) {
|
|
1476
|
+
const newCriteria = {
|
|
1477
|
+
...currentCriteria,
|
|
1478
|
+
l: selection.dim,
|
|
1479
|
+
t: void 0,
|
|
1480
|
+
op: ">",
|
|
1481
|
+
r: 0
|
|
1482
|
+
};
|
|
1483
|
+
update(newCriteria, index);
|
|
1484
|
+
} else {
|
|
1485
|
+
update({ ...currentCriteria, l: selection.id, t: "q", op: "=", r: "" }, index);
|
|
1486
|
+
}
|
|
1487
|
+
},
|
|
1488
|
+
value: currentDimension != null ? currentDimension : currentQuirk,
|
|
1489
|
+
onMenuOpen,
|
|
1490
|
+
onMenuClose
|
|
1420
1491
|
}
|
|
1421
|
-
)
|
|
1422
|
-
|
|
1423
|
-
|
|
1492
|
+
)
|
|
1493
|
+
}
|
|
1494
|
+
),
|
|
1495
|
+
/* @__PURE__ */ jsx17(
|
|
1496
|
+
"div",
|
|
1497
|
+
{
|
|
1498
|
+
css: [criteriaWrapper, criteriaOperatorWrapper],
|
|
1499
|
+
className: "criteria-wrapper",
|
|
1500
|
+
"data-testid": "select-operator",
|
|
1501
|
+
children: /* @__PURE__ */ jsx17(
|
|
1502
|
+
CriteriaOperatorMenu,
|
|
1424
1503
|
{
|
|
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
|
|
1504
|
+
name: `op-${index}`,
|
|
1505
|
+
css: expand,
|
|
1506
|
+
styles: { control: (base) => ({ ...base, height: "100%" }) },
|
|
1507
|
+
value: currentCriteria.op,
|
|
1508
|
+
rhsType: currentQuirk ? "QUIRK" : currentDimension == null ? void 0 : currentDimension.category,
|
|
1509
|
+
onChange: (op) => {
|
|
1510
|
+
if (op === "+" || op === "-") {
|
|
1511
|
+
update({ ...currentCriteria, op, r: void 0, rDim: void 0 }, index);
|
|
1512
|
+
} else {
|
|
1513
|
+
update({ ...currentCriteria, op }, index);
|
|
1444
1514
|
}
|
|
1445
|
-
|
|
1515
|
+
},
|
|
1516
|
+
onMenuOpen,
|
|
1517
|
+
onMenuClose
|
|
1446
1518
|
}
|
|
1447
|
-
)
|
|
1448
|
-
|
|
1519
|
+
)
|
|
1520
|
+
}
|
|
1521
|
+
),
|
|
1522
|
+
critHasRhs ? /* @__PURE__ */ jsx17(
|
|
1523
|
+
"div",
|
|
1524
|
+
{
|
|
1525
|
+
css: [criteriaWrapper, criteriaOperandWrapper],
|
|
1526
|
+
className: "criteria-wrapper",
|
|
1527
|
+
"data-testid": "select-match-criteria",
|
|
1528
|
+
children: currentQuirk ? /* @__PURE__ */ jsx17(
|
|
1449
1529
|
"div",
|
|
1450
1530
|
{
|
|
1451
|
-
css:
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1531
|
+
css: css7`
|
|
1532
|
+
width: 100%;
|
|
1533
|
+
// InputSelect wrapper is unstylable so need a descendant selector
|
|
1534
|
+
// to full-width it
|
|
1535
|
+
& > * {
|
|
1536
|
+
width: 100%;
|
|
1537
|
+
}
|
|
1538
|
+
`,
|
|
1539
|
+
children: currentQuirk.options ? /* @__PURE__ */ jsx17(
|
|
1540
|
+
InputSelect2,
|
|
1541
|
+
{
|
|
1542
|
+
label: "quirk match value",
|
|
1543
|
+
showLabel: false,
|
|
1544
|
+
value: (_c = currentCriteria.r) != null ? _c : "",
|
|
1545
|
+
errorMessage: (_d = errors.rhs) == null ? void 0 : _d[index],
|
|
1546
|
+
onChange: (e) => update({ ...currentCriteria, r: e.currentTarget.value }, index),
|
|
1547
|
+
options: [
|
|
1548
|
+
{ label: "Select\u2026", value: "" },
|
|
1549
|
+
...currentQuirk.options.map((o) => ({ label: o.name, value: o.value }))
|
|
1550
|
+
]
|
|
1551
|
+
}
|
|
1552
|
+
) : /* @__PURE__ */ jsx17(
|
|
1553
|
+
Input2,
|
|
1456
1554
|
{
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
isDisabled: !critHasLhs,
|
|
1465
|
-
dimensions,
|
|
1466
|
-
onMenuOpen,
|
|
1467
|
-
onMenuClose
|
|
1555
|
+
type: "text",
|
|
1556
|
+
label: "quirk match value",
|
|
1557
|
+
showLabel: false,
|
|
1558
|
+
value: (_e = currentCriteria.r) != null ? _e : "",
|
|
1559
|
+
errorMessage: (_f = errors.rhs) == null ? void 0 : _f[index],
|
|
1560
|
+
onChange: (e) => update({ ...currentCriteria, r: e.currentTarget.value }, index),
|
|
1561
|
+
placeholder: "Enter a value"
|
|
1468
1562
|
}
|
|
1469
1563
|
)
|
|
1470
1564
|
}
|
|
1471
|
-
) :
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1565
|
+
) : /* @__PURE__ */ jsx17(
|
|
1566
|
+
CriteriaMatchMenu,
|
|
1567
|
+
{
|
|
1568
|
+
errorMessage: (_g = errors.rhs) == null ? void 0 : _g[index],
|
|
1569
|
+
css: expand,
|
|
1570
|
+
styles: { control: (base) => ({ ...base, height: "100%" }) },
|
|
1571
|
+
criteriaMatch: currentCriteria,
|
|
1572
|
+
onChange: (match) => {
|
|
1573
|
+
update(match, index);
|
|
1574
|
+
},
|
|
1575
|
+
isDisabled: !critHasLhs,
|
|
1576
|
+
dimensions,
|
|
1577
|
+
onMenuOpen,
|
|
1578
|
+
onMenuClose
|
|
1579
|
+
}
|
|
1580
|
+
)
|
|
1581
|
+
}
|
|
1582
|
+
) : null
|
|
1583
|
+
] }),
|
|
1475
1584
|
/* @__PURE__ */ jsx17(
|
|
1476
1585
|
"button",
|
|
1477
1586
|
{
|
|
@@ -1497,7 +1606,7 @@ var PersonalizationCriteriaStatic = ({
|
|
|
1497
1606
|
{
|
|
1498
1607
|
"data-testid": "dropdown-button-combine",
|
|
1499
1608
|
disabled: index > 1,
|
|
1500
|
-
value: (
|
|
1609
|
+
value: (_h = currentValue.op) != null ? _h : "&",
|
|
1501
1610
|
options: [
|
|
1502
1611
|
{ label: "AND", value: "&" },
|
|
1503
1612
|
{ label: "OR", value: "|" }
|
|
@@ -1511,7 +1620,7 @@ var PersonalizationCriteriaStatic = ({
|
|
|
1511
1620
|
) : null
|
|
1512
1621
|
] }, index);
|
|
1513
1622
|
}) }),
|
|
1514
|
-
dimensions.dimensions.length === 0 ? (components == null ? void 0 : components.NoDimensionsDefined) ? /* @__PURE__ */ jsx17(components.NoDimensionsDefined, {}) : /* @__PURE__ */ jsx17(Callout3, { title: "Dimensions", type: "info", css: { marginBlock: "var(--spacing-base)" }, children: /* @__PURE__ */ jsx17("p", { children: "You do not have any dimensions configured." }) }) : /* @__PURE__ */ jsx17(
|
|
1623
|
+
dimensions.dimensions.length === 0 && !(quirks == null ? void 0 : quirks.length) ? (components == null ? void 0 : components.NoDimensionsDefined) ? /* @__PURE__ */ jsx17(components.NoDimensionsDefined, {}) : /* @__PURE__ */ jsx17(Callout3, { title: "Dimensions", type: "info", css: { marginBlock: "var(--spacing-base)" }, children: /* @__PURE__ */ jsx17("p", { children: "You do not have any dimensions configured." }) }) : /* @__PURE__ */ jsx17(
|
|
1515
1624
|
AddListButton3,
|
|
1516
1625
|
{
|
|
1517
1626
|
"data-testid": "button-add-criteria",
|
|
@@ -1729,6 +1838,7 @@ export {
|
|
|
1729
1838
|
addEnrichmentLink,
|
|
1730
1839
|
contextCriteriaMenuOperators,
|
|
1731
1840
|
convertErrorsToObj,
|
|
1841
|
+
enrichmentCriteriaMenuOperators,
|
|
1732
1842
|
isEnrichmentTagData,
|
|
1733
1843
|
isPersonalizationCriteriaData,
|
|
1734
1844
|
opHasRhs,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/context-ui",
|
|
3
|
-
"version": "20.7.1-alpha.
|
|
3
|
+
"version": "20.7.1-alpha.42+580f8a1849",
|
|
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",
|
|
@@ -18,27 +18,25 @@
|
|
|
18
18
|
"types": "./dist/index.d.ts",
|
|
19
19
|
"sideEffects": false,
|
|
20
20
|
"scripts": {
|
|
21
|
-
"build": "
|
|
22
|
-
"build:esm": "tsup",
|
|
21
|
+
"build": "tsup",
|
|
23
22
|
"dev": "tsup --watch",
|
|
24
23
|
"clean": "rimraf dist",
|
|
25
24
|
"test": "jest --maxWorkers=1 --passWithNoTests",
|
|
26
25
|
"lint": "eslint \"src/**/*.{js,ts,tsx}\"",
|
|
27
26
|
"format": "prettier --write \"src/**/*.{js,ts,tsx}\"",
|
|
28
27
|
"storybook": "pnpm build && storybook dev -p 9011 -c ./.storybook",
|
|
29
|
-
"
|
|
30
|
-
"deploy
|
|
31
|
-
"
|
|
32
|
-
"document": "api-extractor run --local"
|
|
28
|
+
"document:build": "pnpm build && storybook build -o ./out",
|
|
29
|
+
"document:deploy": "tsx ../../scripts/deploy-to-netlify.ts",
|
|
30
|
+
"document:prebuild": "api-extractor run --local"
|
|
33
31
|
},
|
|
34
32
|
"dependencies": {
|
|
35
33
|
"@emotion/react": "11.13.5",
|
|
36
|
-
"@react-icons/all-files": "https://github.com/react-icons/react-icons/releases/download/v5.
|
|
37
|
-
"@uniformdev/context": "20.7.1-alpha.
|
|
38
|
-
"@uniformdev/design-system": "20.7.1-alpha.
|
|
34
|
+
"@react-icons/all-files": "https://github.com/react-icons/react-icons/releases/download/v5.5.0/react-icons-all-files-5.5.0.tgz",
|
|
35
|
+
"@uniformdev/context": "20.7.1-alpha.42+580f8a1849",
|
|
36
|
+
"@uniformdev/design-system": "20.7.1-alpha.42+580f8a1849",
|
|
39
37
|
"immer": "10.1.1",
|
|
40
38
|
"react-beautiful-dnd": "13.1.1",
|
|
41
|
-
"react-select": "5.
|
|
39
|
+
"react-select": "5.10.0",
|
|
42
40
|
"react-use": "17.5.1",
|
|
43
41
|
"timeago.js": "4.0.2",
|
|
44
42
|
"uuid": "9.0.1",
|
|
@@ -61,14 +59,13 @@
|
|
|
61
59
|
"@types/react-dom": "18.2.22",
|
|
62
60
|
"@types/uuid": "9.0.4",
|
|
63
61
|
"@vitejs/plugin-react": "4.2.1",
|
|
64
|
-
"autoprefixer": "10.4.
|
|
65
|
-
"postcss": "8.
|
|
62
|
+
"autoprefixer": "10.4.21",
|
|
63
|
+
"postcss": "8.5.3",
|
|
66
64
|
"postcss-import": "16.1.0",
|
|
67
65
|
"react": "18.3.1",
|
|
68
66
|
"react-dom": "18.3.1",
|
|
69
67
|
"storybook": "8.3.3",
|
|
70
|
-
"
|
|
71
|
-
"vite": "5.4.12"
|
|
68
|
+
"vite": "5.4.15"
|
|
72
69
|
},
|
|
73
70
|
"files": [
|
|
74
71
|
"/dist"
|
|
@@ -76,5 +73,5 @@
|
|
|
76
73
|
"publishConfig": {
|
|
77
74
|
"access": "public"
|
|
78
75
|
},
|
|
79
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "580f8a1849984760d11edb936da050eb05e28313"
|
|
80
77
|
}
|