@multiplatform.one/frappe-ui 7.86.0 → 7.87.0
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/cjs/insights/InsightsRecords.cjs +2 -7
- package/dist/cjs/insights/InsightsRecords.native.js +2 -7
- package/dist/cjs/insights/InsightsRecords.native.js.map +1 -1
- package/dist/esm/insights/InsightsRecords.mjs +3 -8
- package/dist/esm/insights/InsightsRecords.mjs.map +1 -1
- package/dist/esm/insights/InsightsRecords.native.js +3 -8
- package/dist/esm/insights/InsightsRecords.native.js.map +1 -1
- package/dist/jsx/insights/InsightsRecords.mjs +3 -8
- package/dist/jsx/insights/InsightsRecords.mjs.map +1 -1
- package/dist/jsx/insights/InsightsRecords.native.js +2 -7
- package/dist/jsx/insights/InsightsRecords.native.js.map +1 -1
- package/package.json +16 -16
- package/src/FrappeInsights.spec.tsx +9 -0
- package/src/insights/InsightsRecords.tsx +3 -5
- package/src/list/FacetList.spec.tsx +128 -0
- package/src/list/ListControlsSheet.behaviour.spec.tsx +283 -0
- package/types/insights/InsightsRecords.d.ts.map +1 -1
|
@@ -37,13 +37,9 @@ function InsightsRecords({
|
|
|
37
37
|
const {
|
|
38
38
|
knobProps
|
|
39
39
|
} = (0, import_theme.useResolvedKnobs)();
|
|
40
|
-
const {
|
|
41
|
-
knobProps: pageKnobs
|
|
42
|
-
} = (0, import_theme.useResolvedKnobs)();
|
|
43
40
|
const wellPx = knobProps.nestedControl.px * 2;
|
|
44
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_components.
|
|
45
|
-
|
|
46
|
-
flexWrap: "wrap",
|
|
41
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_components.CardGrid, {
|
|
42
|
+
minCardWidth: "sm",
|
|
47
43
|
testID,
|
|
48
44
|
children: tiles.map(tile => {
|
|
49
45
|
const title = record.title(tile.doc);
|
|
@@ -53,7 +49,6 @@ function InsightsRecords({
|
|
|
53
49
|
...knobProps.cardSurface,
|
|
54
50
|
backgroundColor: "$color2",
|
|
55
51
|
flexGrow: 1,
|
|
56
|
-
flexBasis: 220,
|
|
57
52
|
alignItems: "center",
|
|
58
53
|
minWidth: 0,
|
|
59
54
|
...knobProps.gap,
|
|
@@ -40,13 +40,9 @@ function InsightsRecords(param) {
|
|
|
40
40
|
var {
|
|
41
41
|
knobProps
|
|
42
42
|
} = (0, import_theme.useResolvedKnobs)();
|
|
43
|
-
var {
|
|
44
|
-
knobProps: pageKnobs
|
|
45
|
-
} = (0, import_theme.useResolvedKnobs)();
|
|
46
43
|
var wellPx = knobProps.nestedControl.px * 2;
|
|
47
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_components.
|
|
48
|
-
|
|
49
|
-
flexWrap: "wrap",
|
|
44
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_components.CardGrid, {
|
|
45
|
+
minCardWidth: "sm",
|
|
50
46
|
testID,
|
|
51
47
|
children: tiles.map(function (tile) {
|
|
52
48
|
var title = record.title(tile.doc);
|
|
@@ -56,7 +52,6 @@ function InsightsRecords(param) {
|
|
|
56
52
|
...knobProps.cardSurface,
|
|
57
53
|
backgroundColor: "$color2",
|
|
58
54
|
flexGrow: 1,
|
|
59
|
-
flexBasis: 220,
|
|
60
55
|
alignItems: "center",
|
|
61
56
|
minWidth: 0,
|
|
62
57
|
...knobProps.gap,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","InsightsRecords_exports","__export","InsightsRecords","module","exports","import_jsx_runtime","require","import_components","import_theme","import_ImageWell","param","tiles","record","testID","knobProps","useResolvedKnobs","
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","InsightsRecords_exports","__export","InsightsRecords","module","exports","import_jsx_runtime","require","import_components","import_theme","import_ImageWell","param","tiles","record","testID","knobProps","useResolvedKnobs","wellPx","nestedControl","px","jsx","CardGrid","minCardWidth","children","map","tile","title","doc","code","tint","jsxs","XStack","cardSurface","backgroundColor","flexGrow","alignItems","minWidth","gap","YStack","width","flexShrink","ImageWell","sources","images","alt","inset"],"sources":["../../../src/insights/InsightsRecords.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,uBAAA;AAAAC,QAAA,CAAAD,uBAAA;EAAAE,eAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAA+C,CAAAK,uBAAA;AAC/C,IAAAK,kBAAiC,GAAAC,OAAA;AACjC,IAAAC,iBAAA,GAA0BD,OAAA;AAyCZ,IAAAE,YAAA,GAAAF,OAAA;AApBP,IAAAG,gBAAS,GAAAH,OAAwB,8BAAsB;AAC5D,SAAMJ,eAAYA,CAAAQ,KAAI;EACtB;IAAMC,KAAA;IAAAC,MAAS;IAAAC;EAAU,IAAAH,KAAA;EACzB;IAAAI;EACE,QAAAN,YAAA,CAAAO,gBAAC;EAEG,IAAAC,MAAM,GAAAF,SAAQ,CAAOG,aAAW,CAAGC,EAAA;EACnC,sBAAoB,IAAKb,kBAAQ,CAAAc,GAAA,EAAAZ,iBAAA,CAAAa,QAAA;IACjCC,YAAM,EAAO;IACbR,MAAA;IACES,QAAC,EAAAX,KAAA,CAAAY,GAAA,WAAAC,IAAA;MAAA,IAAAC,KAAA,GAAAb,MAAA,CAAAa,KAAA,CAAAD,IAAA,CAAAE,GAAA;MAAA,IAEEC,IAAG,GAAAf,MAAU,CAAAe,IAAA,CAAAH,IAAA,CAAAE,GAAA;MAAA,IACdE,IAAA,GAAAhB,MAAA,CAAAgB,IAAgB,CAAAJ,IAAA,CAAAE,GAAA;MAAA,OAChB,eAAU,IAAArB,kBAAA,CAAAwB,IAAA,EAAAtB,iBAAA,CAAAuB,MAAA;QACV,GAAAhB,SAAW,CAAAiB,WAAA;QACXC,eAAU;QACTC,QAAG;QAEJC,UAAA;QAAAC,QAAA;QAEA,GACArB,SAAA,CAAAsB,GAAA;QACEd,QAAA,GAEA,eACA,IAAAjB,kBAAA,CAAAc,GAAA,EAAAZ,iBAAC,CAAA8B,MAAA;UACCC,KAAA,EAAAtB,MAAA;UAEAuB,UAEE;UAGE,gBACN,EAAAzB,SAAA,CAAAG,aAAA,CAAAC,EAAA;UACAI,QAAA,qBAAAjB,kBAAC,CAAAc,GAAA,EAAAV,gBAAK,CAAA+B,SAAS;YAGjBC,OAAA,EAAA7B,MAAA,CAAA8B,MAAA,CAAAlB,IAAA,CAAAE,GAAA;YAAAiB,GAAA,EAAAlB,KAAA;YAAAG,IAAA;YA5BUgB,KAAA;UA6BZ;QAGN,IAEJ,mBAAAvC,kBAAA,CAAAwB,IAAA,EAAAtB,iBAAA,CAAA8B,MAAA","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Text, XStack, YStack } from "@multiplatform.one/components";
|
|
1
|
+
import { CardGrid, Text, XStack, YStack } from "@multiplatform.one/components";
|
|
2
2
|
import { useResolvedKnobs } from "@multiplatform.one/theme";
|
|
3
3
|
import { ImageWell } from "../list/ImageWell.mjs";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -10,13 +10,9 @@ function InsightsRecords({
|
|
|
10
10
|
const {
|
|
11
11
|
knobProps
|
|
12
12
|
} = useResolvedKnobs();
|
|
13
|
-
const {
|
|
14
|
-
knobProps: pageKnobs
|
|
15
|
-
} = useResolvedKnobs();
|
|
16
13
|
const wellPx = knobProps.nestedControl.px * 2;
|
|
17
|
-
return /* @__PURE__ */jsx(
|
|
18
|
-
|
|
19
|
-
flexWrap: "wrap",
|
|
14
|
+
return /* @__PURE__ */jsx(CardGrid, {
|
|
15
|
+
minCardWidth: "sm",
|
|
20
16
|
testID,
|
|
21
17
|
children: tiles.map(tile => {
|
|
22
18
|
const title = record.title(tile.doc);
|
|
@@ -26,7 +22,6 @@ function InsightsRecords({
|
|
|
26
22
|
...knobProps.cardSurface,
|
|
27
23
|
backgroundColor: "$color2",
|
|
28
24
|
flexGrow: 1,
|
|
29
|
-
flexBasis: 220,
|
|
30
25
|
alignItems: "center",
|
|
31
26
|
minWidth: 0,
|
|
32
27
|
...knobProps.gap,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Text","XStack","YStack","useResolvedKnobs","ImageWell","jsx","jsxs","InsightsRecords","tiles","record","testID","knobProps","
|
|
1
|
+
{"version":3,"names":["CardGrid","Text","XStack","YStack","useResolvedKnobs","ImageWell","jsx","jsxs","InsightsRecords","tiles","record","testID","knobProps","wellPx","nestedControl","px","minCardWidth","children","map","tile","title","doc","code","tint","cardSurface","backgroundColor","flexGrow","alignItems","minWidth","gap","width","flexShrink","sources","images","alt","inset","label","color","flexWrap","fontWeight","numberOfLines","fontSize","value","id"],"sources":["../../../src/insights/InsightsRecords.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,QAAA,EAAUC,IAAA,EAAMC,MAAA,EAAQC,MAAA,QAAc;AAC/C,SAASC,gBAAA,QAAwB;AACjC,SAASC,SAAA,QAAiB;AAyCZ,SAAAC,GAAA,EAMAC,IAAA,QANA;AApBP,SAASC,gBAAsB;EAAEC,KAAA;EAAOC,MAAA;EAAQC;AAAO,GAA+B;EAC3F,MAAM;IAAEC;EAAU,IAAIR,gBAAA,CAAiB;EACvC,MAAMS,MAAA,GAASD,SAAA,CAAUE,aAAA,CAAcC,EAAA,GAAK;EAC5C,OACE,eAAAT,GAAA,CAACN,QAAA;IAASgB,YAAA,EAAa;IAAKL,MAAA;IACzBM,QAAA,EAAAR,KAAA,CAAMS,GAAA,CAAKC,IAAA,IAAS;MACnB,MAAMC,KAAA,GAAQV,MAAA,CAAOU,KAAA,CAAMD,IAAA,CAAKE,GAAG;MACnC,MAAMC,IAAA,GAAOZ,MAAA,CAAOY,IAAA,CAAKH,IAAA,CAAKE,GAAG;MACjC,MAAME,IAAA,GAAOb,MAAA,CAAOa,IAAA,CAAKJ,IAAA,CAAKE,GAAG;MACjC,OACE,eAAAd,IAAA,CAACL,MAAA;QAEE,GAAGU,SAAA,CAAUY,WAAA;QACdC,eAAA,EAAgB;QAChBC,QAAA,EAAU;QACVC,UAAA,EAAW;QACXC,QAAA,EAAU;QACT,GAAGhB,SAAA,CAAUiB,GAAA;QAEdZ,QAAA,kBAAAX,GAAA,CAACH,MAAA;UAAO2B,KAAA,EAAOjB,MAAA;UAAQkB,UAAA,EAAY;UAAG,kBAAgBnB,SAAA,CAAUE,aAAA,CAAcC,EAAA;UAC5EE,QAAA,iBAAAX,GAAA,CAACD,SAAA;YAAU2B,OAAA,EAAStB,MAAA,CAAOuB,MAAA,CAAOd,IAAA,CAAKE,GAAG;YAAGa,GAAA,EAAKd,KAAA;YAAOG,IAAA;YAAYY,KAAA,EAAO;UAAA,CAAM;QAAA,CACpF,GACA,eAAA5B,IAAA,CAACJ,MAAA;UAAO0B,GAAA,EAAI;UAAKE,UAAA,EAAY;UAAGH,QAAA,EAAU;UACxCX,QAAA,kBAAAX,GAAA,CAACL,IAAA;YAAM,GAAGW,SAAA,CAAUwB,KAAA;YAAOC,KAAA,EAAM;YAC9BpB,QAAA,EAAAE,IAAA,CAAKiB;UAAA,CACR,GACA,eAAA7B,IAAA,CAACL,MAAA;YAAO2B,GAAA,EAAI;YAAOF,UAAA,EAAW;YAAWW,QAAA,EAAS;YAAOV,QAAA,EAAU;YACjEX,QAAA,kBAAAX,GAAA,CAACL,IAAA;cAAKsC,UAAA,EAAW;cAAMC,aAAA,EAAe;cAAGT,UAAA,EAAY;cAClDd,QAAA,EAAAG;YAAA,CACH,GACCE,IAAA,GACC,eAAAhB,GAAA,CAACL,IAAA;cAAM,GAAGW,SAAA,CAAUwB,KAAA;cAAOC,KAAA,EAAM;cAC9BpB,QAAA,EAAAK;YAAA,CACH,IACE;UAAA,CACN,GACA,eAAAhB,GAAA,CAACL,IAAA;YAAKwC,QAAA,EAAS;YAAKF,UAAA,EAAW;YAC5BtB,QAAA,EAAAE,IAAA,CAAKuB;UAAA,CACR;QAAA,CACF;MAAA,GA5BKvB,IAAA,CAAKwB,EA6BZ;IAEJ,CAAC;EAAA,CACH;AAEJ","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Text, XStack, YStack } from "@multiplatform.one/components";
|
|
2
|
+
import { CardGrid, Text, XStack, YStack } from "@multiplatform.one/components";
|
|
3
3
|
import { useResolvedKnobs } from "@multiplatform.one/theme";
|
|
4
4
|
import { ImageWell } from "../list/ImageWell.native.js";
|
|
5
5
|
function InsightsRecords(param) {
|
|
@@ -11,13 +11,9 @@ function InsightsRecords(param) {
|
|
|
11
11
|
var {
|
|
12
12
|
knobProps
|
|
13
13
|
} = useResolvedKnobs();
|
|
14
|
-
var {
|
|
15
|
-
knobProps: pageKnobs
|
|
16
|
-
} = useResolvedKnobs();
|
|
17
14
|
var wellPx = knobProps.nestedControl.px * 2;
|
|
18
|
-
return /* @__PURE__ */_jsx(
|
|
19
|
-
|
|
20
|
-
flexWrap: "wrap",
|
|
15
|
+
return /* @__PURE__ */_jsx(CardGrid, {
|
|
16
|
+
minCardWidth: "sm",
|
|
21
17
|
testID,
|
|
22
18
|
children: tiles.map(function (tile) {
|
|
23
19
|
var title = record.title(tile.doc);
|
|
@@ -27,7 +23,6 @@ function InsightsRecords(param) {
|
|
|
27
23
|
...knobProps.cardSurface,
|
|
28
24
|
backgroundColor: "$color2",
|
|
29
25
|
flexGrow: 1,
|
|
30
|
-
flexBasis: 220,
|
|
31
26
|
alignItems: "center",
|
|
32
27
|
minWidth: 0,
|
|
33
28
|
...knobProps.gap,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["jsx","_jsx","jsxs","_jsxs","Text","XStack","YStack","useResolvedKnobs","ImageWell","InsightsRecords","param","tiles","record","testID","knobProps","
|
|
1
|
+
{"version":3,"names":["jsx","_jsx","jsxs","_jsxs","CardGrid","Text","XStack","YStack","useResolvedKnobs","ImageWell","InsightsRecords","param","tiles","record","testID","knobProps","wellPx","nestedControl","px","minCardWidth","children","map","tile","title","doc","code","tint","cardSurface","backgroundColor","flexGrow","alignItems","minWidth","gap","width","flexShrink","sources","images","alt","inset"],"sources":["../../../src/insights/InsightsRecords.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,GAAA,IAAAC,IAAU,EAAAC,IAAM,IAAAC,KAAQ,2BAAc;AAC/C,SAASC,QAAA,EAAAC,IAAA,EAAAC,MAAA,EAAwBC,MAAA;AACjC,SAASC,gBAAA,QAAiB;AAyCZ,SAAAC,SAMA,QANA;AApBP,SAASC,gBAAsBC,KAAE;EACtC;IAAMC,KAAE;IAAAC,MAAU;IAAAC;EAAI,IAAAH,KAAA;EACtB;IAAMI;EAAS,IAAAP,gBAAU;EACzB,IAAAQ,MACE,GAAAD,SAAA,CAAAE,aAAC,CAAAC,EAAS;EAEN,sBAAqBjB,IAAA,CAAAG,QAAW,EAAG;IACnCe,YAAM,EAAO;IACbL,MAAM;IACNM,QACE,EAAAR,KAAA,CAAAS,GAAA,WAAAC,IAAA;MAAC,IAAAC,KAAA,GAAAV,MAAA,CAAAU,KAAA,CAAAD,IAAA,CAAAE,GAAA;MAAA,IAAAC,IAAA,GAAAZ,MAAA,CAAAY,IAAA,CAAAH,IAAA,CAAAE,GAAA;MAAA,IAEEE,IAAG,GAAAb,MAAU,CAAAa,IAAA,CAAAJ,IAAA,CAAAE,GAAA;MAAA,OACd,eAAgBrB,KAAA,CAAAG,MAAA;QAChB,GAAAS,SAAU,CAAAY,WAAA;QACVC,eAAW;QACXC,QAAA,EAAU;QACTC,UAAG,UAAU;QAEdC,QAAA;QAAA,GAAAhB,SAAA,CAAAiB,GAAA;QAEAZ,QACA,GACE,eAAAnB,IAAA,CAAAM,MAAC;UAGD0B,KAAA,EAAAjB,MAAA;UACEkB,UAAA;UAEA,gBAEE,EAAAnB,SAAA,CAAAE,aAAU,CAAAC,EAAA;UAGRE,QACN,iBAAAnB,IAAA,CAAAQ,SAAA;YACA0B,OAAA,EAAAtB,MAAA,CAAAuB,MAAC,CAAAd,IAAK,CAAAE,GAAA;YAGRa,GAAA,EAAAd,KAAA;YAAAG,IAAA;YAAAY,KAAA;UA5BU;QA6BZ,IAGN,eAAAnC,KAAA,CAAAI,MAAA;UAEJyB,GAAA","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Text, XStack, YStack } from "@multiplatform.one/components";
|
|
1
|
+
import { CardGrid, Text, XStack, YStack } from "@multiplatform.one/components";
|
|
2
2
|
import { useResolvedKnobs } from "@multiplatform.one/theme";
|
|
3
3
|
import { ImageWell } from "../list/ImageWell.mjs";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -10,13 +10,9 @@ function InsightsRecords({
|
|
|
10
10
|
const {
|
|
11
11
|
knobProps
|
|
12
12
|
} = useResolvedKnobs();
|
|
13
|
-
const {
|
|
14
|
-
knobProps: pageKnobs
|
|
15
|
-
} = useResolvedKnobs();
|
|
16
13
|
const wellPx = knobProps.nestedControl.px * 2;
|
|
17
|
-
return /* @__PURE__ */jsx(
|
|
18
|
-
|
|
19
|
-
flexWrap: "wrap",
|
|
14
|
+
return /* @__PURE__ */jsx(CardGrid, {
|
|
15
|
+
minCardWidth: "sm",
|
|
20
16
|
testID,
|
|
21
17
|
children: tiles.map(tile => {
|
|
22
18
|
const title = record.title(tile.doc);
|
|
@@ -26,7 +22,6 @@ function InsightsRecords({
|
|
|
26
22
|
...knobProps.cardSurface,
|
|
27
23
|
backgroundColor: "$color2",
|
|
28
24
|
flexGrow: 1,
|
|
29
|
-
flexBasis: 220,
|
|
30
25
|
alignItems: "center",
|
|
31
26
|
minWidth: 0,
|
|
32
27
|
...knobProps.gap,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Text","XStack","YStack","useResolvedKnobs","ImageWell","jsx","jsxs","InsightsRecords","tiles","record","testID","knobProps","
|
|
1
|
+
{"version":3,"names":["CardGrid","Text","XStack","YStack","useResolvedKnobs","ImageWell","jsx","jsxs","InsightsRecords","tiles","record","testID","knobProps","wellPx","nestedControl","px","minCardWidth","children","map","tile","title","doc","code","tint","cardSurface","backgroundColor","flexGrow","alignItems","minWidth","gap","width","flexShrink","sources","images","alt","inset","label","color","flexWrap","fontWeight","numberOfLines","fontSize","value","id"],"sources":["../../../src/insights/InsightsRecords.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,QAAA,EAAUC,IAAA,EAAMC,MAAA,EAAQC,MAAA,QAAc;AAC/C,SAASC,gBAAA,QAAwB;AACjC,SAASC,SAAA,QAAiB;AAyCZ,SAAAC,GAAA,EAMAC,IAAA,QANA;AApBP,SAASC,gBAAsB;EAAEC,KAAA;EAAOC,MAAA;EAAQC;AAAO,GAA+B;EAC3F,MAAM;IAAEC;EAAU,IAAIR,gBAAA,CAAiB;EACvC,MAAMS,MAAA,GAASD,SAAA,CAAUE,aAAA,CAAcC,EAAA,GAAK;EAC5C,OACE,eAAAT,GAAA,CAACN,QAAA;IAASgB,YAAA,EAAa;IAAKL,MAAA;IACzBM,QAAA,EAAAR,KAAA,CAAMS,GAAA,CAAKC,IAAA,IAAS;MACnB,MAAMC,KAAA,GAAQV,MAAA,CAAOU,KAAA,CAAMD,IAAA,CAAKE,GAAG;MACnC,MAAMC,IAAA,GAAOZ,MAAA,CAAOY,IAAA,CAAKH,IAAA,CAAKE,GAAG;MACjC,MAAME,IAAA,GAAOb,MAAA,CAAOa,IAAA,CAAKJ,IAAA,CAAKE,GAAG;MACjC,OACE,eAAAd,IAAA,CAACL,MAAA;QAEE,GAAGU,SAAA,CAAUY,WAAA;QACdC,eAAA,EAAgB;QAChBC,QAAA,EAAU;QACVC,UAAA,EAAW;QACXC,QAAA,EAAU;QACT,GAAGhB,SAAA,CAAUiB,GAAA;QAEdZ,QAAA,kBAAAX,GAAA,CAACH,MAAA;UAAO2B,KAAA,EAAOjB,MAAA;UAAQkB,UAAA,EAAY;UAAG,kBAAgBnB,SAAA,CAAUE,aAAA,CAAcC,EAAA;UAC5EE,QAAA,iBAAAX,GAAA,CAACD,SAAA;YAAU2B,OAAA,EAAStB,MAAA,CAAOuB,MAAA,CAAOd,IAAA,CAAKE,GAAG;YAAGa,GAAA,EAAKd,KAAA;YAAOG,IAAA;YAAYY,KAAA,EAAO;UAAA,CAAM;QAAA,CACpF,GACA,eAAA5B,IAAA,CAACJ,MAAA;UAAO0B,GAAA,EAAI;UAAKE,UAAA,EAAY;UAAGH,QAAA,EAAU;UACxCX,QAAA,kBAAAX,GAAA,CAACL,IAAA;YAAM,GAAGW,SAAA,CAAUwB,KAAA;YAAOC,KAAA,EAAM;YAC9BpB,QAAA,EAAAE,IAAA,CAAKiB;UAAA,CACR,GACA,eAAA7B,IAAA,CAACL,MAAA;YAAO2B,GAAA,EAAI;YAAOF,UAAA,EAAW;YAAWW,QAAA,EAAS;YAAOV,QAAA,EAAU;YACjEX,QAAA,kBAAAX,GAAA,CAACL,IAAA;cAAKsC,UAAA,EAAW;cAAMC,aAAA,EAAe;cAAGT,UAAA,EAAY;cAClDd,QAAA,EAAAG;YAAA,CACH,GACCE,IAAA,GACC,eAAAhB,GAAA,CAACL,IAAA;cAAM,GAAGW,SAAA,CAAUwB,KAAA;cAAOC,KAAA,EAAM;cAC9BpB,QAAA,EAAAK;YAAA,CACH,IACE;UAAA,CACN,GACA,eAAAhB,GAAA,CAACL,IAAA;YAAKwC,QAAA,EAAS;YAAKF,UAAA,EAAW;YAC5BtB,QAAA,EAAAE,IAAA,CAAKuB;UAAA,CACR;QAAA,CACF;MAAA,GA5BKvB,IAAA,CAAKwB,EA6BZ;IAEJ,CAAC;EAAA,CACH;AAEJ","ignoreList":[]}
|
|
@@ -40,13 +40,9 @@ function InsightsRecords(param) {
|
|
|
40
40
|
var {
|
|
41
41
|
knobProps
|
|
42
42
|
} = (0, import_theme.useResolvedKnobs)();
|
|
43
|
-
var {
|
|
44
|
-
knobProps: pageKnobs
|
|
45
|
-
} = (0, import_theme.useResolvedKnobs)();
|
|
46
43
|
var wellPx = knobProps.nestedControl.px * 2;
|
|
47
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_components.
|
|
48
|
-
|
|
49
|
-
flexWrap: "wrap",
|
|
44
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_components.CardGrid, {
|
|
45
|
+
minCardWidth: "sm",
|
|
50
46
|
testID,
|
|
51
47
|
children: tiles.map(function (tile) {
|
|
52
48
|
var title = record.title(tile.doc);
|
|
@@ -56,7 +52,6 @@ function InsightsRecords(param) {
|
|
|
56
52
|
...knobProps.cardSurface,
|
|
57
53
|
backgroundColor: "$color2",
|
|
58
54
|
flexGrow: 1,
|
|
59
|
-
flexBasis: 220,
|
|
60
55
|
alignItems: "center",
|
|
61
56
|
minWidth: 0,
|
|
62
57
|
...knobProps.gap,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","InsightsRecords_exports","InsightsRecords","module","exports","import_jsx_runtime","require","import_components","import_theme","import_ImageWell","param","tiles","record","testID","knobProps","useResolvedKnobs","
|
|
1
|
+
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","InsightsRecords_exports","InsightsRecords","module","exports","import_jsx_runtime","require","import_components","import_theme","import_ImageWell","param","tiles","record","testID","knobProps","useResolvedKnobs","wellPx","nestedControl","px","jsx","CardGrid","minCardWidth","children","map","tile","title","doc"],"sources":["../../../src/insights/InsightsRecords.tsx"],"sourcesContent":[null],"mappings":"AAAA,YAAS;;AACT,IAAAA,SAAS,GAAAC,MAAA,CAAAC,cAAwB;AACjC,IAAAC,gBAAS,GAAAF,MAAiB,CAAAG,wBAAA;AAyCZ,IAAAC,iBAMA,GAAAJ,MANA,CAAAK,mBAAA;AApBP,IAAAC,YAAS,GAAAN,MAAsB,CAAAO,SAAS,CAAAC,cAAe;AAC5D,IAAAC,QAAQ,GAAAA,CAAAC,MAAU,EAAIC,GAAA;EACtB,SAAMC,IAAA,IAASD,GAAA,EACfZ,SACE,CAAAW,MAAA,EAAAE,IAAA;IAACC,GAAA,EAAAF,GAAA,CAAAC,IAAS;IAAAE,UAAa;EAAK;AAExB;AACA,IAAAC,WAAM,GAAOA,CAAAC,EAAA,EAAAC,IAAO,EAAKC,MAAK,EAAGC,IAAA;EACjC,IAAAF,IAAM,WAAOA,IAAO,KAAK,QAAQ,WAAAA,IAAA;IACjC,SACEG,GAAA,IAAAhB,iBAAA,CAAAa,IAAA,GAAC,KAAAX,YAAA,CAAAe,IAAA,CAAAL,EAAA,EAAAI,GAAA,KAAAA,GAAA,KAAAF,MAAA,EAAAnB,SAAA,CAAAiB,EAAA,EAAAI,GAAA;MAAAP,GAAA,EAAAA,CAAA,KAAAI,IAAA,CAAAG,GAAA;MAAAN,UAAA,IAAAK,IAAA,GAAAjB,gBAAA,CAAAe,IAAA,EAAAG,GAAA,MAAAD,IAAA,CAAAL;IAAA;EAAA;EAEe,OACdE,EAAA;AAAgB;AACN,IAAAM,YACV,GAAWC,GAAA,IAAAR,WAAA,CAAAhB,SAAA;EAAAyB,KAAA;AAAA,IAAAD,GAAA;AAAA,IAAAE,uBACD;AAAAhB,QACT,CAAAgB,uBAAa;EAAAC,eAEd,EAAAA,CAAA,KAAAA;AAAA;AAEAC,MAAA,CAAAC,OACA,GAAAN,YAAA,CAAAG,uBAAiB;AACf,IAAAI,kBAAA,GAAAC,OAAC,oBAAS,CAAU;AAEpB,IAAAC,iBACA,GAAAD,OAAA,gCAAmB;AACjB,IAAAE,YAAA,GAAAF,OAAA,2BAAM,CAAW;AAEjB,IAAAG,gBACC,GACCH,OAAA,8BAAO;AAGL,SAAAJ,eACNA,CAAAQ,KAAA;EAAA;IAAAC,KACA;IAAAC,MAAA;IAAAC;EAAA,IAACH,KAAA;EAED;IAAAI;EACF,QAAAN,YAAA,CAAAO,gBAAA;EAAA,IAAAC,MAAA,GAAAF,SAAA,CAAAG,aAAA,CAAAC,EAAA;EAAA,0BAAAb,kBAAA,CAAAc,GAAA,EAAAZ,iBAAA,CAAAa,QAAA;IAAAC,YA5BU;IA6BZR,MAAA;IAEHS,QACH,EAAAX,KAAA,CAAAY,GAAA,WAAAC,IAAA;MAEJ,IAAAC,KAAA,GAAAb,MAAA,CAAAa,KAAA,CAAAD,IAAA,CAAAE,GAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/frappe-ui",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.87.0",
|
|
4
4
|
"description": "Pre-wired Tamagui components for Frappe doctypes with live data",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cross-platform",
|
|
@@ -72,18 +72,18 @@
|
|
|
72
72
|
"access": "public"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@multiplatform.one/components": "^7.
|
|
76
|
-
"@multiplatform.one/desktop": "^7.
|
|
77
|
-
"@multiplatform.one/forms": "^7.
|
|
78
|
-
"@multiplatform.one/frappe": "^7.
|
|
79
|
-
"@multiplatform.one/i18n": "^7.
|
|
80
|
-
"@multiplatform.one/markdown": "^7.
|
|
81
|
-
"@multiplatform.one/platform": "^7.
|
|
82
|
-
"@multiplatform.one/rich-text": "^7.
|
|
83
|
-
"@multiplatform.one/router": "^7.
|
|
84
|
-
"@multiplatform.one/store": "^7.
|
|
85
|
-
"@multiplatform.one/table": "^7.
|
|
86
|
-
"@multiplatform.one/theme": "^7.
|
|
75
|
+
"@multiplatform.one/components": "^7.87.0",
|
|
76
|
+
"@multiplatform.one/desktop": "^7.87.0",
|
|
77
|
+
"@multiplatform.one/forms": "^7.87.0",
|
|
78
|
+
"@multiplatform.one/frappe": "^7.87.0",
|
|
79
|
+
"@multiplatform.one/i18n": "^7.87.0",
|
|
80
|
+
"@multiplatform.one/markdown": "^7.87.0",
|
|
81
|
+
"@multiplatform.one/platform": "^7.87.0",
|
|
82
|
+
"@multiplatform.one/rich-text": "^7.87.0",
|
|
83
|
+
"@multiplatform.one/router": "^7.87.0",
|
|
84
|
+
"@multiplatform.one/store": "^7.87.0",
|
|
85
|
+
"@multiplatform.one/table": "^7.87.0",
|
|
86
|
+
"@multiplatform.one/theme": "^7.87.0",
|
|
87
87
|
"@phosphor-icons/react": "^2.1.10",
|
|
88
88
|
"@tamagui/colors": "2.7.6",
|
|
89
89
|
"@tanstack/db": "0.11.3",
|
|
@@ -100,9 +100,9 @@
|
|
|
100
100
|
"tamagui": "2.7.6"
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
|
-
"@multiplatform.one/config": "7.
|
|
104
|
-
"@multiplatform.one/storybook": "7.
|
|
105
|
-
"@multiplatform.one/test-utils": "7.
|
|
103
|
+
"@multiplatform.one/config": "7.87.0",
|
|
104
|
+
"@multiplatform.one/storybook": "7.87.0",
|
|
105
|
+
"@multiplatform.one/test-utils": "7.87.0",
|
|
106
106
|
"@tamagui/build": "2.7.6",
|
|
107
107
|
"@testing-library/jest-dom": "^7.0.1",
|
|
108
108
|
"@testing-library/react": "^16.3.3",
|
|
@@ -137,6 +137,15 @@ describe("FrappeInsights records and leaders", () => {
|
|
|
137
137
|
expect(records.textContent).toContain("250 xp");
|
|
138
138
|
});
|
|
139
139
|
|
|
140
|
+
it("lays the record tiles in the MPO card grid (LC-179)", async () => {
|
|
141
|
+
renderInsights();
|
|
142
|
+
const records = await screen.findByTestId("insights-records", {}, { timeout: 5000 });
|
|
143
|
+
expect(records.hasAttribute("data-card-grid")).toBe(true);
|
|
144
|
+
const cells = records.querySelectorAll("[data-card-grid-cell]");
|
|
145
|
+
expect(cells.length).toBeGreaterThan(0);
|
|
146
|
+
for (const cell of cells) expect(cell.textContent).toMatch(/\S/);
|
|
147
|
+
});
|
|
148
|
+
|
|
140
149
|
it("ranks the leaders by the picked metric and opens a row's record", async () => {
|
|
141
150
|
const navigate = vi.fn();
|
|
142
151
|
renderInsights({}, navigate);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Text, XStack, YStack } from "@multiplatform.one/components";
|
|
1
|
+
import { CardGrid, Text, XStack, YStack } from "@multiplatform.one/components";
|
|
2
2
|
import { useResolvedKnobs } from "@multiplatform.one/theme";
|
|
3
3
|
import { ImageWell } from "../list/ImageWell";
|
|
4
4
|
import type { InsightsRecordView } from "./insightsRecord";
|
|
@@ -23,10 +23,9 @@ export interface InsightsRecordsProps<TDoc> {
|
|
|
23
23
|
*/
|
|
24
24
|
export function InsightsRecords<TDoc>({ tiles, record, testID }: InsightsRecordsProps<TDoc>) {
|
|
25
25
|
const { knobProps } = useResolvedKnobs();
|
|
26
|
-
const { knobProps: pageKnobs } = useResolvedKnobs();
|
|
27
26
|
const wellPx = knobProps.nestedControl.px * 2;
|
|
28
27
|
return (
|
|
29
|
-
<
|
|
28
|
+
<CardGrid minCardWidth="sm" testID={testID}>
|
|
30
29
|
{tiles.map((tile) => {
|
|
31
30
|
const title = record.title(tile.doc);
|
|
32
31
|
const code = record.code(tile.doc);
|
|
@@ -37,7 +36,6 @@ export function InsightsRecords<TDoc>({ tiles, record, testID }: InsightsRecords
|
|
|
37
36
|
{...knobProps.cardSurface}
|
|
38
37
|
backgroundColor="$color2"
|
|
39
38
|
flexGrow={1}
|
|
40
|
-
flexBasis={220}
|
|
41
39
|
alignItems="center"
|
|
42
40
|
minWidth={0}
|
|
43
41
|
{...knobProps.gap}
|
|
@@ -66,6 +64,6 @@ export function InsightsRecords<TDoc>({ tiles, record, testID }: InsightsRecords
|
|
|
66
64
|
</XStack>
|
|
67
65
|
);
|
|
68
66
|
})}
|
|
69
|
-
</
|
|
67
|
+
</CardGrid>
|
|
70
68
|
);
|
|
71
69
|
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
2
|
+
import { cleanup, fireEvent } from "@testing-library/react";
|
|
3
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
4
|
+
import { FacetList } from "./FacetList";
|
|
5
|
+
|
|
6
|
+
afterEach(cleanup);
|
|
7
|
+
|
|
8
|
+
const options = [
|
|
9
|
+
{ value: "", label: "All types", count: 9 },
|
|
10
|
+
{ value: "fire", label: "Fire", tint: "red", count: 4 },
|
|
11
|
+
{ value: "water", label: "Water", tint: "blue", count: 3 },
|
|
12
|
+
{ value: "grass", label: "Grass", count: 2 },
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
function renderList(value = "", props: Partial<Parameters<typeof FacetList>[0]> = {}) {
|
|
16
|
+
const onChange = vi.fn();
|
|
17
|
+
const result = renderWithProviders(
|
|
18
|
+
<FacetList
|
|
19
|
+
label="Type"
|
|
20
|
+
value={value}
|
|
21
|
+
options={options}
|
|
22
|
+
onChange={onChange}
|
|
23
|
+
testID="type"
|
|
24
|
+
{...props}
|
|
25
|
+
/>,
|
|
26
|
+
);
|
|
27
|
+
return { ...result, onChange, radio: (name: RegExp) => result.getByRole("radio", { name }) };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
describe("FacetList", () => {
|
|
31
|
+
it("is a named vertical radiogroup with a row, label and count per value", () => {
|
|
32
|
+
const { getByRole, getAllByRole, container } = renderList("water");
|
|
33
|
+
const group = getByRole("radiogroup", { name: "Type" });
|
|
34
|
+
expect(group.getAttribute("aria-orientation")).toBe("vertical");
|
|
35
|
+
expect(getAllByRole("radio")).toHaveLength(4);
|
|
36
|
+
expect([...container.querySelectorAll("[data-facet-count]")].map((n) => n.textContent)).toEqual(
|
|
37
|
+
["9", "4", "3", "2"],
|
|
38
|
+
);
|
|
39
|
+
expect(getByRole("radio", { name: /Water/ }).getAttribute("aria-checked")).toBe("true");
|
|
40
|
+
expect(getByRole("radio", { name: /Fire/ }).getAttribute("aria-checked")).toBe("false");
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("drops the count when an option has none", () => {
|
|
44
|
+
const { container } = renderList("", { options: [{ value: "", label: "All" }] });
|
|
45
|
+
expect(container.querySelector("[data-facet-count]")).toBeNull();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("narrows on a tap and clears on a second tap of the active row", () => {
|
|
49
|
+
const { radio, onChange, rerender } = renderList("");
|
|
50
|
+
fireEvent.click(radio(/Fire/));
|
|
51
|
+
expect(onChange).toHaveBeenLastCalledWith("fire");
|
|
52
|
+
rerender(
|
|
53
|
+
<FacetList label="Type" value="fire" options={options} onChange={onChange} testID="type" />,
|
|
54
|
+
);
|
|
55
|
+
fireEvent.click(radio(/Fire/));
|
|
56
|
+
expect(onChange).toHaveBeenLastCalledWith("");
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("keeps the clearing row selected when it is tapped again", () => {
|
|
60
|
+
const { radio, onChange } = renderList("");
|
|
61
|
+
fireEvent.click(radio(/All types/));
|
|
62
|
+
expect(onChange).toHaveBeenLastCalledWith("");
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("is one tab stop, on the active row", () => {
|
|
66
|
+
const { radio } = renderList("water");
|
|
67
|
+
expect(radio(/Water/).getAttribute("tabindex")).toBe("0");
|
|
68
|
+
expect(radio(/Fire/).getAttribute("tabindex")).toBe("-1");
|
|
69
|
+
expect(radio(/All types/).getAttribute("tabindex")).toBe("-1");
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("moves the tab stop to the row that takes focus", () => {
|
|
73
|
+
const { radio } = renderList("water");
|
|
74
|
+
fireEvent.focus(radio(/Grass/));
|
|
75
|
+
expect(radio(/Grass/).getAttribute("tabindex")).toBe("0");
|
|
76
|
+
expect(radio(/Water/).getAttribute("tabindex")).toBe("-1");
|
|
77
|
+
fireEvent.blur(radio(/Grass/));
|
|
78
|
+
expect(radio(/Grass/).getAttribute("tabindex")).toBe("0");
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it.each([
|
|
82
|
+
["ArrowDown", "water", "grass"],
|
|
83
|
+
["ArrowDown", "grass", ""],
|
|
84
|
+
["ArrowUp", "fire", ""],
|
|
85
|
+
["ArrowUp", "", "grass"],
|
|
86
|
+
["Home", "water", ""],
|
|
87
|
+
["End", "fire", "grass"],
|
|
88
|
+
])("%s from %j selects %j, wrapping at the ends", (key, from, to) => {
|
|
89
|
+
const { radio, onChange } = renderList(from);
|
|
90
|
+
const row = radio(new RegExp(options.find((option) => option.value === from)!.label));
|
|
91
|
+
const event = fireEvent.keyDown(row, { key });
|
|
92
|
+
expect(onChange).toHaveBeenLastCalledWith(to);
|
|
93
|
+
expect(event).toBe(false);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it("moves the tab stop with the arrow selection", () => {
|
|
97
|
+
const { radio } = renderList("fire");
|
|
98
|
+
fireEvent.keyDown(radio(/Fire/), { key: "ArrowDown" });
|
|
99
|
+
expect(radio(/Water/).getAttribute("tabindex")).toBe("0");
|
|
100
|
+
expect(radio(/Fire/).getAttribute("tabindex")).toBe("-1");
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it.each(["Enter", " "])("%j toggles the focused row like a tap", (key) => {
|
|
104
|
+
const { radio, onChange } = renderList("fire");
|
|
105
|
+
expect(fireEvent.keyDown(radio(/Water/), { key })).toBe(false);
|
|
106
|
+
expect(onChange).toHaveBeenLastCalledWith("water");
|
|
107
|
+
fireEvent.keyDown(radio(/Fire/), { key });
|
|
108
|
+
expect(onChange).toHaveBeenLastCalledWith("");
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it("ignores keys a radiogroup does not handle", () => {
|
|
112
|
+
const { radio, onChange } = renderList("fire");
|
|
113
|
+
expect(fireEvent.keyDown(radio(/Fire/), { key: "a" })).toBe(true);
|
|
114
|
+
expect(onChange).not.toHaveBeenCalled();
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it("lays values out two per row with the clearing row full width", () => {
|
|
118
|
+
const { radio } = renderList("", { columns: 2 });
|
|
119
|
+
expect(getComputedStyle(radio(/All types/)).width).toBe("100%");
|
|
120
|
+
expect(getComputedStyle(radio(/Fire/)).width).toBe("50%");
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it("names each row's test id after its value", () => {
|
|
124
|
+
const { getByTestId } = renderList("");
|
|
125
|
+
expect(getByTestId("type-all").getAttribute("role")).toBe("radio");
|
|
126
|
+
expect(getByTestId("type-fire").getAttribute("role")).toBe("radio");
|
|
127
|
+
});
|
|
128
|
+
});
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
2
|
+
import { cleanup, fireEvent, screen, waitFor, within } from "@testing-library/react";
|
|
3
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
4
|
+
import { ListControlsSheet, type ListControlsSheetProps } from "./ListControlsSheet";
|
|
5
|
+
import { fixtureControls, fixtureList } from "./listControls.fixture";
|
|
6
|
+
import type { FrappeListState } from "./listState";
|
|
7
|
+
|
|
8
|
+
vi.mock("./RangeFilter", async (importOriginal) => {
|
|
9
|
+
const actual = await importOriginal<typeof import("./RangeFilter")>();
|
|
10
|
+
return {
|
|
11
|
+
...actual,
|
|
12
|
+
RangeFilter: ({
|
|
13
|
+
label,
|
|
14
|
+
value,
|
|
15
|
+
max,
|
|
16
|
+
onChange,
|
|
17
|
+
}: {
|
|
18
|
+
label: string;
|
|
19
|
+
value: number;
|
|
20
|
+
max: number;
|
|
21
|
+
onChange: (value: number) => void;
|
|
22
|
+
}) => (
|
|
23
|
+
<button type="button" data-max={max} data-value={value} onClick={() => onChange(50)}>
|
|
24
|
+
{label}
|
|
25
|
+
</button>
|
|
26
|
+
),
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
afterEach(cleanup);
|
|
31
|
+
|
|
32
|
+
const controls = {
|
|
33
|
+
...fixtureControls,
|
|
34
|
+
facets: fixtureControls.facets!.map((facet) =>
|
|
35
|
+
facet.param === "type"
|
|
36
|
+
? { ...facet, optionLabel: (value: string) => value.toUpperCase() }
|
|
37
|
+
: facet,
|
|
38
|
+
),
|
|
39
|
+
views: ["grid", "list", "table"] as const,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
function renderSheet(
|
|
43
|
+
state: Partial<FrappeListState> = {},
|
|
44
|
+
props: Partial<ListControlsSheetProps> = {},
|
|
45
|
+
listPatch: Partial<ReturnType<typeof fixtureList>> = {},
|
|
46
|
+
) {
|
|
47
|
+
const update = vi.fn();
|
|
48
|
+
const list = {
|
|
49
|
+
...fixtureList(state, update),
|
|
50
|
+
facets: { type: { counts: { fire: 5, water: 7 } } },
|
|
51
|
+
...listPatch,
|
|
52
|
+
} as ReturnType<typeof fixtureList>;
|
|
53
|
+
const result = renderWithProviders(
|
|
54
|
+
<ListControlsSheet
|
|
55
|
+
controls={controls as ListControlsSheetProps["controls"]}
|
|
56
|
+
list={list}
|
|
57
|
+
searchId="roster-search"
|
|
58
|
+
showSearch={false}
|
|
59
|
+
showFavorites
|
|
60
|
+
separator={false}
|
|
61
|
+
noun="Pokemon"
|
|
62
|
+
testID="roster"
|
|
63
|
+
{...props}
|
|
64
|
+
/>,
|
|
65
|
+
);
|
|
66
|
+
return { ...result, update, list };
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async function openSheet() {
|
|
70
|
+
fireEvent.click(screen.getByTestId("roster-filters"));
|
|
71
|
+
return screen.findByTestId("roster-filters-sheet");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const confirmLabel = () =>
|
|
75
|
+
screen.getByTestId("roster-filters-header-confirm").getAttribute("aria-label");
|
|
76
|
+
const counted = "Show {{count}} {{noun}}";
|
|
77
|
+
|
|
78
|
+
describe("ListControlsSheet: the filters in force as chips", () => {
|
|
79
|
+
it("shows a facet chip by its option label and drops the facet on a tap", () => {
|
|
80
|
+
const { update } = renderSheet({ facets: { type: "fire" } });
|
|
81
|
+
fireEvent.click(screen.getByRole("button", { name: "FIRE" }));
|
|
82
|
+
expect(update).toHaveBeenCalledWith({ facets: { type: "" } });
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("shows a facet chip by its raw value when the facet has no option label", () => {
|
|
86
|
+
renderSheet({ facets: { region: "kanto" } });
|
|
87
|
+
const chip = screen
|
|
88
|
+
.getAllByRole("button", { name: "kanto" })
|
|
89
|
+
.find((node) => !node.closest('[role="radiogroup"]'));
|
|
90
|
+
expect(chip).toBeTruthy();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it("shows a range chip as its minimum and drops it on a tap", () => {
|
|
94
|
+
const { update } = renderSheet({ ranges: { xp: 120 } });
|
|
95
|
+
fireEvent.click(screen.getByRole("button", { name: "Min XP 120+" }));
|
|
96
|
+
expect(update).toHaveBeenCalledWith({ ranges: { xp: 0 } });
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it("shows a Favorites chip and turns favorites-only off on a tap", () => {
|
|
100
|
+
const { update } = renderSheet({ favoritesOnly: true });
|
|
101
|
+
fireEvent.click(screen.getByRole("button", { name: "Favorites" }));
|
|
102
|
+
expect(update).toHaveBeenCalledWith({ favoritesOnly: false });
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it("draws no chip row with no filter, view or shuffle", () => {
|
|
106
|
+
renderSheet();
|
|
107
|
+
expect(screen.queryByRole("button", { name: "Favorites" })).toBeNull();
|
|
108
|
+
expect(screen.queryByTestId("roster-views")).toBeNull();
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
describe("ListControlsSheet: view switch and shuffle", () => {
|
|
113
|
+
it("switches views from icon segments named Cards, List and Table", () => {
|
|
114
|
+
const onChange = vi.fn();
|
|
115
|
+
renderSheet({}, { view: { current: "grid", onChange } });
|
|
116
|
+
const views = screen.getByTestId("roster-views");
|
|
117
|
+
expect(
|
|
118
|
+
[...views.querySelectorAll("[aria-label]")]
|
|
119
|
+
.map((node) => node.getAttribute("aria-label"))
|
|
120
|
+
.filter((name) => ["Cards", "List", "Table"].includes(name ?? "")),
|
|
121
|
+
).toEqual(["Cards", "List", "Table"]);
|
|
122
|
+
fireEvent.click(within(views).getByLabelText("Table"));
|
|
123
|
+
expect(onChange).toHaveBeenCalledWith("table");
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it("toggles the shuffle panel from a dice button wired to the panel", () => {
|
|
127
|
+
const toggle = vi.fn();
|
|
128
|
+
renderSheet({}, { shuffle: { open: true, toggle, panelId: "roster-shuffle" } });
|
|
129
|
+
const dice = screen.getByTestId("roster-shuffle-toggle");
|
|
130
|
+
expect(dice.getAttribute("aria-label")).toBe("Surprise me");
|
|
131
|
+
expect(dice.getAttribute("aria-expanded")).toBe("true");
|
|
132
|
+
expect(dice.getAttribute("aria-controls")).toBe("roster-shuffle");
|
|
133
|
+
fireEvent.click(dice);
|
|
134
|
+
expect(toggle).toHaveBeenCalled();
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
describe("ListControlsSheet: the sheet", () => {
|
|
139
|
+
it("counts its confirm for the whole list when nothing filters it", async () => {
|
|
140
|
+
renderSheet();
|
|
141
|
+
await openSheet();
|
|
142
|
+
expect(confirmLabel()).toBe(counted);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it("counts its confirm for the one active facet", async () => {
|
|
146
|
+
renderSheet({ facets: { type: "water" } });
|
|
147
|
+
await openSheet();
|
|
148
|
+
expect(confirmLabel()).toBe(counted);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it("counts its confirm for the one active band", async () => {
|
|
152
|
+
renderSheet({ bands: { generation: "2" } });
|
|
153
|
+
await openSheet();
|
|
154
|
+
expect(confirmLabel()).toBe(counted);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it("counts its confirm for favorites under favorites-only", async () => {
|
|
158
|
+
renderSheet({ favoritesOnly: true });
|
|
159
|
+
await openSheet();
|
|
160
|
+
expect(confirmLabel()).toBe(counted);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it("names Show results when the one active facet has no count yet", async () => {
|
|
164
|
+
renderSheet({ facets: { region: "kanto" } });
|
|
165
|
+
await openSheet();
|
|
166
|
+
expect(confirmLabel()).toBe("Show results");
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
it("falls back to Show results when two filters are in force", async () => {
|
|
170
|
+
renderSheet({ facets: { type: "fire" }, favoritesOnly: true });
|
|
171
|
+
await openSheet();
|
|
172
|
+
expect(confirmLabel()).toBe("Show results");
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
it("falls back to Show results when a range alone has no count", async () => {
|
|
176
|
+
renderSheet({ ranges: { xp: 50 } });
|
|
177
|
+
await openSheet();
|
|
178
|
+
expect(confirmLabel()).toBe("Show results");
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
it("closes on the confirm and on Escape", async () => {
|
|
182
|
+
renderSheet();
|
|
183
|
+
const expanded = () => screen.getByTestId("roster-filters").getAttribute("aria-expanded");
|
|
184
|
+
await openSheet();
|
|
185
|
+
expect(expanded()).toBe("true");
|
|
186
|
+
fireEvent.click(screen.getByTestId("roster-filters-header-confirm"));
|
|
187
|
+
await waitFor(() => expect(expanded()).toBe("false"));
|
|
188
|
+
await openSheet();
|
|
189
|
+
fireEvent.keyDown(document, { key: "Tab" });
|
|
190
|
+
expect(expanded()).toBe("true");
|
|
191
|
+
fireEvent.keyDown(document, { key: "Escape" });
|
|
192
|
+
await waitFor(() => expect(expanded()).toBe("false"));
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
it("resets sort to the first, favorites off, and every facet, range and band", async () => {
|
|
196
|
+
const { update } = renderSheet({ sort: "xp", favoritesOnly: true });
|
|
197
|
+
await openSheet();
|
|
198
|
+
fireEvent.click(screen.getByTestId("roster-reset"));
|
|
199
|
+
expect(update).toHaveBeenCalledWith({
|
|
200
|
+
sort: "number",
|
|
201
|
+
favoritesOnly: false,
|
|
202
|
+
facets: { type: "", region: "" },
|
|
203
|
+
ranges: { xp: 0 },
|
|
204
|
+
bands: { generation: "" },
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
it("sorts from the Sort by select", async () => {
|
|
209
|
+
const { update } = renderSheet();
|
|
210
|
+
const sheet = await openSheet();
|
|
211
|
+
const trigger = within(sheet).getByRole("combobox", { name: "Sort by" });
|
|
212
|
+
trigger.focus();
|
|
213
|
+
fireEvent.keyDown(trigger, { key: "Enter" });
|
|
214
|
+
await screen.findByRole("option", { name: "XP" });
|
|
215
|
+
fireEvent.keyDown(document.activeElement!, { key: "ArrowDown" });
|
|
216
|
+
fireEvent.keyDown(document.activeElement!, { key: "Enter" });
|
|
217
|
+
expect(update).toHaveBeenCalledWith({ sort: "xp" });
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
it("turns favorites-only on from its switch", async () => {
|
|
221
|
+
const { update } = renderSheet();
|
|
222
|
+
const sheet = await openSheet();
|
|
223
|
+
fireEvent.click(within(sheet).getByRole("switch", { name: "Favorites only" }));
|
|
224
|
+
expect(update).toHaveBeenCalledWith({ favoritesOnly: true });
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
it("lists each facet as chips with All first and the counts read so far", async () => {
|
|
228
|
+
renderSheet({ facets: { type: "fire" } });
|
|
229
|
+
const sheet = await openSheet();
|
|
230
|
+
const type = within(sheet).getByRole("radiogroup", { name: "Type" });
|
|
231
|
+
const chips = within(type).getAllByRole("button");
|
|
232
|
+
expect(chips.map((chip) => chip.textContent)).toEqual(["All types 12", "FIRE 5", "WATER 7"]);
|
|
233
|
+
const region = within(sheet).getByRole("radiogroup", { name: "Region" });
|
|
234
|
+
expect(
|
|
235
|
+
within(region)
|
|
236
|
+
.getAllByRole("button")
|
|
237
|
+
.map((chip) => chip.textContent),
|
|
238
|
+
).toEqual(["All 12", "kanto", "johto"]);
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
it("narrows on a facet chip, clears on the active one, and All clears", async () => {
|
|
242
|
+
const { update } = renderSheet({ facets: { type: "fire" } });
|
|
243
|
+
const sheet = await openSheet();
|
|
244
|
+
const type = within(sheet).getByRole("radiogroup", { name: "Type" });
|
|
245
|
+
fireEvent.click(within(type).getByRole("button", { name: /^WATER/ }));
|
|
246
|
+
expect(update).toHaveBeenLastCalledWith({ facets: { type: "water" } });
|
|
247
|
+
fireEvent.click(within(type).getByRole("button", { name: /^FIRE/ }));
|
|
248
|
+
expect(update).toHaveBeenLastCalledWith({ facets: { type: "" } });
|
|
249
|
+
fireEvent.click(within(type).getByRole("button", { name: /^All types/ }));
|
|
250
|
+
expect(update).toHaveBeenLastCalledWith({ facets: { type: "" } });
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
it("caps each range at the list's highest value and commits a move as a range patch", async () => {
|
|
254
|
+
const { update } = renderSheet();
|
|
255
|
+
const sheet = await openSheet();
|
|
256
|
+
const range = within(sheet).getByRole("button", { name: "Min XP" });
|
|
257
|
+
expect(Number(range.getAttribute("data-max"))).toBeGreaterThanOrEqual(300);
|
|
258
|
+
expect(within(sheet).getByText(`0–${range.getAttribute("data-max")}`)).toBeTruthy();
|
|
259
|
+
fireEvent.click(range);
|
|
260
|
+
expect(update).toHaveBeenCalledWith({ ranges: { xp: 50 } });
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
it("caps a range with no reading at the floor ceiling", async () => {
|
|
264
|
+
renderSheet({}, {}, { highest: {} });
|
|
265
|
+
const sheet = await openSheet();
|
|
266
|
+
const range = within(sheet).getByRole("button", { name: "Min XP" });
|
|
267
|
+
expect(range.getAttribute("data-value")).toBe("0");
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
it("has no Filters button when there is nothing to put in the sheet", () => {
|
|
271
|
+
renderSheet({}, { controls: {}, showFavorites: false });
|
|
272
|
+
expect(screen.queryByTestId("roster-filters")).toBeNull();
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
describe("ListControlsSheet: search", () => {
|
|
277
|
+
it("searches as the text settles", async () => {
|
|
278
|
+
const { update } = renderSheet({}, { showSearch: true, searchPlaceholder: "Find Pokemon" });
|
|
279
|
+
const input = screen.getByLabelText("Find Pokemon") as HTMLInputElement;
|
|
280
|
+
fireEvent.change(input, { target: { value: "pika" } });
|
|
281
|
+
await waitFor(() => expect(update).toHaveBeenCalledWith({ search: "pika" }));
|
|
282
|
+
});
|
|
283
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InsightsRecords.d.ts","sourceRoot":"","sources":["../../src/insights/InsightsRecords.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,WAAW,kBAAkB,CAAC,IAAI;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,IAAI,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB,CAAC,IAAI;IACxC,KAAK,EAAE,SAAS,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC3C,MAAM,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,oBAAoB,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"InsightsRecords.d.ts","sourceRoot":"","sources":["../../src/insights/InsightsRecords.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,WAAW,kBAAkB,CAAC,IAAI;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,IAAI,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB,CAAC,IAAI;IACxC,KAAK,EAAE,SAAS,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC3C,MAAM,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,oBAAoB,CAAC,IAAI,CAAC,2CA6C1F"}
|