@knocklabs/react 0.11.3 → 0.11.5

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/cjs/index.css +1 -1
  3. package/dist/cjs/index.js +1 -1
  4. package/dist/cjs/modules/guide/components/Toolbar/KnockButton.js +1 -1
  5. package/dist/cjs/modules/guide/components/Toolbar/KnockButton.js.map +1 -1
  6. package/dist/cjs/modules/guide/components/Toolbar/V2/DragHandle.js +2 -0
  7. package/dist/cjs/modules/guide/components/Toolbar/V2/DragHandle.js.map +1 -0
  8. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideContextDetails.js +1 -1
  9. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideContextDetails.js.map +1 -1
  10. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideHoverCard.js +1 -1
  11. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideHoverCard.js.map +1 -1
  12. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRow.js +1 -1
  13. package/dist/cjs/modules/guide/components/Toolbar/V2/GuideRow.js.map +1 -1
  14. package/dist/cjs/modules/guide/components/Toolbar/V2/V2.js +1 -1
  15. package/dist/cjs/modules/guide/components/Toolbar/V2/V2.js.map +1 -1
  16. package/dist/cjs/modules/guide/components/Toolbar/V2/useDraggable.js +2 -0
  17. package/dist/cjs/modules/guide/components/Toolbar/V2/useDraggable.js.map +1 -0
  18. package/dist/cjs/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.js +1 -1
  19. package/dist/cjs/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.js.map +1 -1
  20. package/dist/esm/index.mjs +98 -97
  21. package/dist/esm/index.mjs.map +1 -1
  22. package/dist/esm/modules/guide/components/Toolbar/KnockButton.mjs +14 -8
  23. package/dist/esm/modules/guide/components/Toolbar/KnockButton.mjs.map +1 -1
  24. package/dist/esm/modules/guide/components/Toolbar/V2/DragHandle.mjs +20 -0
  25. package/dist/esm/modules/guide/components/Toolbar/V2/DragHandle.mjs.map +1 -0
  26. package/dist/esm/modules/guide/components/Toolbar/V2/GuideContextDetails.mjs +26 -11
  27. package/dist/esm/modules/guide/components/Toolbar/V2/GuideContextDetails.mjs.map +1 -1
  28. package/dist/esm/modules/guide/components/Toolbar/V2/GuideHoverCard.mjs +46 -16
  29. package/dist/esm/modules/guide/components/Toolbar/V2/GuideHoverCard.mjs.map +1 -1
  30. package/dist/esm/modules/guide/components/Toolbar/V2/GuideRow.mjs +48 -30
  31. package/dist/esm/modules/guide/components/Toolbar/V2/GuideRow.mjs.map +1 -1
  32. package/dist/esm/modules/guide/components/Toolbar/V2/V2.mjs +53 -36
  33. package/dist/esm/modules/guide/components/Toolbar/V2/V2.mjs.map +1 -1
  34. package/dist/esm/modules/guide/components/Toolbar/V2/useDraggable.mjs +74 -0
  35. package/dist/esm/modules/guide/components/Toolbar/V2/useDraggable.mjs.map +1 -0
  36. package/dist/esm/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.mjs +73 -88
  37. package/dist/esm/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.mjs.map +1 -1
  38. package/dist/index.css +1 -1
  39. package/dist/types/modules/guide/components/Toolbar/KnockButton.d.ts +2 -1
  40. package/dist/types/modules/guide/components/Toolbar/KnockButton.d.ts.map +1 -1
  41. package/dist/types/modules/guide/components/Toolbar/V2/DragHandle.d.ts +9 -0
  42. package/dist/types/modules/guide/components/Toolbar/V2/DragHandle.d.ts.map +1 -0
  43. package/dist/types/modules/guide/components/Toolbar/V2/GuideContextDetails.d.ts.map +1 -1
  44. package/dist/types/modules/guide/components/Toolbar/V2/GuideHoverCard.d.ts.map +1 -1
  45. package/dist/types/modules/guide/components/Toolbar/V2/GuideRow.d.ts.map +1 -1
  46. package/dist/types/modules/guide/components/Toolbar/V2/V2.d.ts.map +1 -1
  47. package/dist/types/modules/guide/components/Toolbar/V2/useDraggable.d.ts +26 -0
  48. package/dist/types/modules/guide/components/Toolbar/V2/useDraggable.d.ts.map +1 -0
  49. package/dist/types/modules/guide/components/Toolbar/V2/useInspectGuideClientStore.d.ts.map +1 -1
  50. package/package.json +11 -10
@@ -1,27 +1,42 @@
1
- import { useGuideContext as m, useStore as p } from "@knocklabs/react-core";
2
- import { Stack as r, Box as s } from "@telegraph/layout";
3
- import { Text as t } from "@telegraph/typography";
4
- import { ChevronDown as d, ChevronRight as g } from "lucide-react";
1
+ import { useGuideContext as E, useStore as y } from "@knocklabs/react-core";
2
+ import { Button as s } from "@telegraph/button";
3
+ import { Icon as m } from "@telegraph/icon";
4
+ import { Stack as t, Box as g } from "@telegraph/layout";
5
+ import { Tooltip as p } from "@telegraph/tooltip";
6
+ import { Text as n } from "@telegraph/typography";
7
+ import { ChevronDown as f, ChevronRight as x, Info as d } from "lucide-react";
5
8
  import * as e from "react";
6
- const z = () => {
9
+ const C = () => {
7
10
  const {
8
11
  client: a
9
- } = m(), [l, i] = e.useState(!1), n = p(a.store, (o) => o.guideGroups[0]), c = (n == null ? void 0 : n.display_interval) ?? null;
10
- return /* @__PURE__ */ e.createElement(r, { direction: "column", borderTop: "px" }, /* @__PURE__ */ e.createElement(r, { h: "5", px: "2", bg: "gray-3", align: "center", gap: "1", style: {
12
+ } = E(), [l, u] = e.useState(!1), {
13
+ defaultGroup: o,
14
+ debugSettings: r
15
+ } = y(a.store, (i) => ({
16
+ defaultGroup: i.guideGroups[0],
17
+ debugSettings: i.debug || {}
18
+ })), c = (o == null ? void 0 : o.display_interval) ?? null;
19
+ return /* @__PURE__ */ e.createElement(t, { direction: "column", borderTop: "px" }, /* @__PURE__ */ e.createElement(t, { h: "5", px: "2", bg: "gray-3", align: "center", gap: "1", style: {
11
20
  cursor: "pointer"
12
- }, onClick: () => i((o) => !o) }, /* @__PURE__ */ e.createElement(t, { as: "span", size: "0", weight: "medium" }, "Details"), l ? /* @__PURE__ */ e.createElement(d, { size: 12 }) : /* @__PURE__ */ e.createElement(g, { size: 12 })), l && /* @__PURE__ */ e.createElement(r, { direction: "column" }, /* @__PURE__ */ e.createElement(r, { direction: "column", gap: "0_5", py: "1", px: "2", borderTop: "px" }, /* @__PURE__ */ e.createElement(t, { as: "span", size: "0", weight: "medium" }, "Throttle"), /* @__PURE__ */ e.createElement(t, { as: "code", size: "0" }, c === null ? "-" : `Every ${c}s`)), /* @__PURE__ */ e.createElement(r, { direction: "column", py: "1", px: "2", borderTop: "px" }, /* @__PURE__ */ e.createElement(t, { as: "span", size: "0", weight: "medium" }, "Target params"), /* @__PURE__ */ e.createElement(r, { direction: "column", gap: "0_5", mt: "1" }, /* @__PURE__ */ e.createElement(t, { as: "span", size: "0", color: "gray" }, "Tenant"), /* @__PURE__ */ e.createElement(t, { as: "code", size: "0" }, a.targetParams.tenant ? /* @__PURE__ */ e.createElement(s, { rounded: "2", overflow: "auto", backgroundColor: "gray-2", border: "px", style: {
21
+ }, onClick: () => u((i) => !i) }, /* @__PURE__ */ e.createElement(n, { as: "span", size: "0", weight: "medium" }, "More"), l ? /* @__PURE__ */ e.createElement(f, { size: 12 }) : /* @__PURE__ */ e.createElement(x, { size: 12 })), l && /* @__PURE__ */ e.createElement(t, { direction: "column" }, /* @__PURE__ */ e.createElement(t, { align: "center", justify: "space-between", py: "1", px: "2", borderTop: "px" }, /* @__PURE__ */ e.createElement(t, { align: "center", gap: "1" }, /* @__PURE__ */ e.createElement(n, { as: "span", size: "0", weight: "medium" }, "Client-only engagement"), /* @__PURE__ */ e.createElement(p, { label: "Contain engagement actions to the client side only while in preview without sending engagement events to the API" }, /* @__PURE__ */ e.createElement(m, { icon: d, size: "0", color: "gray", "aria-hidden": !0 }))), /* @__PURE__ */ e.createElement(s, { size: "0", variant: "soft", color: r.skipEngagementTracking ? "green" : "gray", onClick: () => a.setDebug({
22
+ ...r,
23
+ skipEngagementTracking: !r.skipEngagementTracking
24
+ }) }, r.skipEngagementTracking ? "On" : "Off")), /* @__PURE__ */ e.createElement(t, { direction: "column", py: "1", px: "2" }, /* @__PURE__ */ e.createElement(t, { align: "center", justify: "space-between" }, /* @__PURE__ */ e.createElement(t, { align: "center", gap: "1" }, /* @__PURE__ */ e.createElement(n, { as: "span", size: "0", weight: "medium" }, "Suspend throttling"), /* @__PURE__ */ e.createElement(p, { label: "Suspend throttling during preview, and show next guide immediately" }, /* @__PURE__ */ e.createElement(m, { icon: d, size: "0", color: "gray", "aria-hidden": !0 }))), /* @__PURE__ */ e.createElement(s, { size: "0", variant: "soft", color: r.ignoreDisplayInterval ? "green" : "gray", onClick: () => a.setDebug({
25
+ ...r,
26
+ ignoreDisplayInterval: !r.ignoreDisplayInterval
27
+ }) }, r.ignoreDisplayInterval ? "On" : "Off")), /* @__PURE__ */ e.createElement(t, { direction: "row", gap: "0_5", py: "1" }, /* @__PURE__ */ e.createElement(n, { as: "span", size: "0", color: "gray" }, "Throttle:", " ", r.ignoreDisplayInterval ? "(ignored)" : c === null ? "(none)" : `Every ${c}s`))), /* @__PURE__ */ e.createElement(t, { direction: "column", py: "1", px: "2", borderTop: "px" }, /* @__PURE__ */ e.createElement(n, { as: "span", size: "0", weight: "medium" }, "Target params"), /* @__PURE__ */ e.createElement(t, { direction: "column", gap: "0_5", mt: "1" }, /* @__PURE__ */ e.createElement(n, { as: "span", size: "0", color: "gray" }, "Tenant"), /* @__PURE__ */ e.createElement(n, { as: "code", size: "0" }, a.targetParams.tenant ? /* @__PURE__ */ e.createElement(g, { rounded: "2", overflow: "auto", backgroundColor: "gray-2", border: "px", style: {
13
28
  maxHeight: "200px"
14
29
  } }, /* @__PURE__ */ e.createElement("pre", { style: {
15
30
  fontSize: "11px",
16
31
  margin: 0
17
- } }, /* @__PURE__ */ e.createElement("code", null, a.targetParams.tenant))) : /* @__PURE__ */ e.createElement(t, { as: "code", size: "0" }, "-"))), /* @__PURE__ */ e.createElement(r, { direction: "column", gap: "0_5" }, /* @__PURE__ */ e.createElement(t, { as: "span", size: "0", color: "gray" }, "Data"), a.targetParams.data ? /* @__PURE__ */ e.createElement(s, { rounded: "2", overflow: "auto", backgroundColor: "gray-2", border: "px", style: {
32
+ } }, /* @__PURE__ */ e.createElement("code", null, a.targetParams.tenant))) : /* @__PURE__ */ e.createElement(n, { as: "code", size: "0" }, "-"))), /* @__PURE__ */ e.createElement(t, { direction: "column", gap: "0_5" }, /* @__PURE__ */ e.createElement(n, { as: "span", size: "0", color: "gray" }, "Data"), a.targetParams.data ? /* @__PURE__ */ e.createElement(g, { rounded: "2", overflow: "auto", backgroundColor: "gray-2", border: "px", style: {
18
33
  maxHeight: "200px"
19
34
  } }, /* @__PURE__ */ e.createElement("pre", { style: {
20
35
  fontSize: "11px",
21
36
  margin: 0
22
- } }, /* @__PURE__ */ e.createElement("code", null, JSON.stringify(a.targetParams.data, null, 2)))) : /* @__PURE__ */ e.createElement(t, { as: "code", size: "0" }, "-")))));
37
+ } }, /* @__PURE__ */ e.createElement("code", null, JSON.stringify(a.targetParams.data, null, 2)))) : /* @__PURE__ */ e.createElement(n, { as: "code", size: "0" }, "-")))));
23
38
  };
24
39
  export {
25
- z as GuideContextDetails
40
+ C as GuideContextDetails
26
41
  };
27
42
  //# sourceMappingURL=GuideContextDetails.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"GuideContextDetails.mjs","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideContextDetails.tsx"],"sourcesContent":["import { useGuideContext, useStore } from \"@knocklabs/react-core\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { Text } from \"@telegraph/typography\";\nimport { ChevronDown, ChevronRight } from \"lucide-react\";\nimport * as React from \"react\";\n\nexport const GuideContextDetails = () => {\n const { client } = useGuideContext();\n const [isExpanded, setIsExpanded] = React.useState(false);\n\n const defaultGroup = useStore(client.store, (state) => state.guideGroups[0]);\n const displayInterval = defaultGroup?.display_interval ?? null;\n\n return (\n <Stack direction=\"column\" borderTop=\"px\">\n <Stack\n h=\"5\"\n px=\"2\"\n bg=\"gray-3\"\n align=\"center\"\n gap=\"1\"\n style={{ cursor: \"pointer\" }}\n onClick={() => setIsExpanded((prev) => !prev)}\n >\n <Text as=\"span\" size=\"0\" weight=\"medium\">\n Details\n </Text>\n {isExpanded ? <ChevronDown size={12} /> : <ChevronRight size={12} />}\n </Stack>\n\n {isExpanded && (\n <Stack direction=\"column\">\n <Stack direction=\"column\" gap=\"0_5\" py=\"1\" px=\"2\" borderTop=\"px\">\n <Text as=\"span\" size=\"0\" weight=\"medium\">\n Throttle\n </Text>\n <Text as=\"code\" size=\"0\">\n {displayInterval === null ? \"-\" : `Every ${displayInterval}s`}\n </Text>\n </Stack>\n\n <Stack direction=\"column\" py=\"1\" px=\"2\" borderTop=\"px\">\n <Text as=\"span\" size=\"0\" weight=\"medium\">\n Target params\n </Text>\n <Stack direction=\"column\" gap=\"0_5\" mt=\"1\">\n <Text as=\"span\" size=\"0\" color=\"gray\">\n Tenant\n </Text>\n <Text as=\"code\" size=\"0\">\n {client.targetParams.tenant ? (\n <Box\n rounded=\"2\"\n overflow=\"auto\"\n backgroundColor=\"gray-2\"\n border=\"px\"\n style={{ maxHeight: \"200px\" }}\n >\n <pre style={{ fontSize: \"11px\", margin: 0 }}>\n <code>{client.targetParams.tenant}</code>\n </pre>\n </Box>\n ) : (\n <Text as=\"code\" size=\"0\">\n -\n </Text>\n )}\n </Text>\n </Stack>\n\n <Stack direction=\"column\" gap=\"0_5\">\n <Text as=\"span\" size=\"0\" color=\"gray\">\n Data\n </Text>\n {client.targetParams.data ? (\n <Box\n rounded=\"2\"\n overflow=\"auto\"\n backgroundColor=\"gray-2\"\n border=\"px\"\n style={{ maxHeight: \"200px\" }}\n >\n <pre style={{ fontSize: \"11px\", margin: 0 }}>\n <code>\n {JSON.stringify(client.targetParams.data, null, 2)}\n </code>\n </pre>\n </Box>\n ) : (\n <Text as=\"code\" size=\"0\">\n -\n </Text>\n )}\n </Stack>\n </Stack>\n </Stack>\n )}\n </Stack>\n );\n};\n"],"names":["GuideContextDetails","client","useGuideContext","isExpanded","setIsExpanded","React","useState","defaultGroup","useStore","store","state","guideGroups","displayInterval","display_interval","Stack","cursor","prev","Text","ChevronDown","ChevronRight","targetParams","tenant","Box","maxHeight","fontSize","margin","data","JSON","stringify"],"mappings":";;;;;AAMO,MAAMA,IAAsBA,MAAM;AACjC,QAAA;AAAA,IAAEC,QAAAA;AAAAA,MAAWC,EAAgB,GAC7B,CAACC,GAAYC,CAAa,IAAIC,EAAMC,SAAS,EAAK,GAElDC,IAAeC,EAASP,EAAOQ,OAAQC,OAAUA,EAAMC,YAAY,CAAC,CAAC,GACrEC,KAAkBL,KAAAA,gBAAAA,EAAcM,qBAAoB;AAE1D,yCACGC,GAAM,EAAA,WAAU,UAAS,WAAU,KAAA,mCACjCA,GACC,EAAA,GAAE,KACF,IAAG,KACH,IAAG,UACH,OAAM,UACN,KAAI,KACJ,OAAO;AAAA,IAAEC,QAAQ;AAAA,EAAA,GACjB,SAAS,MAAMX,EAAeY,CAASA,MAAA,CAACA,CAAI,EAAA,GAE3C,gBAAAX,EAAA,cAAAY,GAAA,EAAK,IAAG,QAAO,MAAK,KAAI,QAAO,YAAQ,SAExC,GACCd,IAAa,gBAAAE,EAAA,cAACa,GAAY,EAAA,MAAM,GAAM,CAAA,IAAI,gBAAAb,EAAA,cAAAc,GAAA,EAAa,MAAM,GAAA,CAAM,CACtE,GAEChB,KACE,gBAAAE,EAAA,cAAAS,GAAA,EAAM,WAAU,SAAA,GACd,gBAAAT,EAAA,cAAAS,GAAA,EAAM,WAAU,UAAS,KAAI,OAAM,IAAG,KAAI,IAAG,KAAI,WAAU,KAAA,GACzD,gBAAAT,EAAA,cAAAY,GAAA,EAAK,IAAG,QAAO,MAAK,KAAI,QAAO,SAAA,GAAQ,UAExC,GACC,gBAAAZ,EAAA,cAAAY,GAAA,EAAK,IAAG,QAAO,MAAK,IAClBL,GAAAA,MAAoB,OAAO,MAAM,SAASA,CAAe,GAC5D,CACF,GAEA,gBAAAP,EAAA,cAACS,GAAM,EAAA,WAAU,UAAS,IAAG,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M,CAAC,CACnD,CACF,CACF,IAEA,gBAAArB,EAAA,cAACY,GAAK,EAAA,IAAG,QAAO,MAAK,OAAG,GAExB,CAEJ,CACF,CACF,CAEJ;AAEJ;"}
1
+ {"version":3,"file":"GuideContextDetails.mjs","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideContextDetails.tsx"],"sourcesContent":["import { useGuideContext, useStore } from \"@knocklabs/react-core\";\nimport { Button } from \"@telegraph/button\";\nimport { Icon } from \"@telegraph/icon\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\nimport { ChevronDown, ChevronRight, Info } from \"lucide-react\";\nimport * as React from \"react\";\n\nexport const GuideContextDetails = () => {\n const { client } = useGuideContext();\n const [isExpanded, setIsExpanded] = React.useState(false);\n\n const { defaultGroup, debugSettings } = useStore(client.store, (state) => {\n return {\n defaultGroup: state.guideGroups[0],\n debugSettings: state.debug || {},\n };\n });\n const displayInterval = defaultGroup?.display_interval ?? null;\n\n return (\n <Stack direction=\"column\" borderTop=\"px\">\n <Stack\n h=\"5\"\n px=\"2\"\n bg=\"gray-3\"\n align=\"center\"\n gap=\"1\"\n style={{ cursor: \"pointer\" }}\n onClick={() => setIsExpanded((prev) => !prev)}\n >\n <Text as=\"span\" size=\"0\" weight=\"medium\">\n More\n </Text>\n {isExpanded ? <ChevronDown size={12} /> : <ChevronRight size={12} />}\n </Stack>\n\n {isExpanded && (\n <Stack direction=\"column\">\n <Stack\n align=\"center\"\n justify=\"space-between\"\n py=\"1\"\n px=\"2\"\n borderTop=\"px\"\n >\n <Stack align=\"center\" gap=\"1\">\n <Text as=\"span\" size=\"0\" weight=\"medium\">\n Client-only engagement\n </Text>\n <Tooltip label=\"Contain engagement actions to the client side only while in preview without sending engagement events to the API\">\n <Icon icon={Info} size=\"0\" color=\"gray\" aria-hidden />\n </Tooltip>\n </Stack>\n <Button\n size=\"0\"\n variant=\"soft\"\n color={debugSettings.skipEngagementTracking ? \"green\" : \"gray\"}\n onClick={() =>\n client.setDebug({\n ...debugSettings,\n skipEngagementTracking: !debugSettings.skipEngagementTracking,\n })\n }\n >\n {debugSettings.skipEngagementTracking ? \"On\" : \"Off\"}\n </Button>\n </Stack>\n\n <Stack direction=\"column\" py=\"1\" px=\"2\">\n <Stack align=\"center\" justify=\"space-between\">\n <Stack align=\"center\" gap=\"1\">\n <Text as=\"span\" size=\"0\" weight=\"medium\">\n Suspend throttling\n </Text>\n <Tooltip label=\"Suspend throttling during preview, and show next guide immediately\">\n <Icon icon={Info} size=\"0\" color=\"gray\" aria-hidden />\n </Tooltip>\n </Stack>\n <Button\n size=\"0\"\n variant=\"soft\"\n color={debugSettings.ignoreDisplayInterval ? \"green\" : \"gray\"}\n onClick={() =>\n client.setDebug({\n ...debugSettings,\n ignoreDisplayInterval: !debugSettings.ignoreDisplayInterval,\n })\n }\n >\n {debugSettings.ignoreDisplayInterval ? \"On\" : \"Off\"}\n </Button>\n </Stack>\n <Stack direction=\"row\" gap=\"0_5\" py=\"1\">\n <Text as=\"span\" size=\"0\" color=\"gray\">\n Throttle:{\" \"}\n {debugSettings.ignoreDisplayInterval\n ? \"(ignored)\"\n : displayInterval === null\n ? \"(none)\"\n : `Every ${displayInterval}s`}\n </Text>\n </Stack>\n </Stack>\n\n <Stack direction=\"column\" py=\"1\" px=\"2\" borderTop=\"px\">\n <Text as=\"span\" size=\"0\" weight=\"medium\">\n Target params\n </Text>\n <Stack direction=\"column\" gap=\"0_5\" mt=\"1\">\n <Text as=\"span\" size=\"0\" color=\"gray\">\n Tenant\n </Text>\n <Text as=\"code\" size=\"0\">\n {client.targetParams.tenant ? (\n <Box\n rounded=\"2\"\n overflow=\"auto\"\n backgroundColor=\"gray-2\"\n border=\"px\"\n style={{ maxHeight: \"200px\" }}\n >\n <pre style={{ fontSize: \"11px\", margin: 0 }}>\n <code>{client.targetParams.tenant}</code>\n </pre>\n </Box>\n ) : (\n <Text as=\"code\" size=\"0\">\n -\n </Text>\n )}\n </Text>\n </Stack>\n\n <Stack direction=\"column\" gap=\"0_5\">\n <Text as=\"span\" size=\"0\" color=\"gray\">\n Data\n </Text>\n {client.targetParams.data ? (\n <Box\n rounded=\"2\"\n overflow=\"auto\"\n backgroundColor=\"gray-2\"\n border=\"px\"\n style={{ maxHeight: \"200px\" }}\n >\n <pre style={{ fontSize: \"11px\", margin: 0 }}>\n <code>\n {JSON.stringify(client.targetParams.data, null, 2)}\n </code>\n </pre>\n </Box>\n ) : (\n <Text as=\"code\" size=\"0\">\n -\n </Text>\n )}\n </Stack>\n </Stack>\n </Stack>\n )}\n </Stack>\n );\n};\n"],"names":["GuideContextDetails","client","useGuideContext","isExpanded","setIsExpanded","React","useState","defaultGroup","debugSettings","useStore","store","state","guideGroups","debug","displayInterval","display_interval","Stack","cursor","prev","Text","ChevronDown","ChevronRight","Tooltip","Icon","Info","Button","skipEngagementTracking","setDebug","ignoreDisplayInterval","targetParams","tenant","Box","maxHeight","fontSize","margin","data","JSON","stringify"],"mappings":";;;;;;;;AASO,MAAMA,IAAsBA,MAAM;AACjC,QAAA;AAAA,IAAEC,QAAAA;AAAAA,MAAWC,EAAgB,GAC7B,CAACC,GAAYC,CAAa,IAAIC,EAAMC,SAAS,EAAK,GAElD;AAAA,IAAEC,cAAAA;AAAAA,IAAcC,eAAAA;AAAAA,EAAkBC,IAAAA,EAASR,EAAOS,OAAQC,CAAUA,OACjE;AAAA,IACLJ,cAAcI,EAAMC,YAAY,CAAC;AAAA,IACjCJ,eAAeG,EAAME,SAAS,CAAA;AAAA,EAChC,EACD,GACKC,KAAkBP,KAAAA,gBAAAA,EAAcQ,qBAAoB;AAE1D,yCACGC,GAAM,EAAA,WAAU,UAAS,WAAU,KAAA,mCACjCA,GACC,EAAA,GAAE,KACF,IAAG,KACH,IAAG,UACH,OAAM,UACN,KAAI,KACJ,OAAO;AAAA,IAAEC,QAAQ;AAAA,EAAU,GAC3B,SAAS,MAAMb,EAAec,OAAS,CA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AK,OAAG,GAExB,CAEJ,CACF,GAEA,gBAAAd,EAAA,cAACW,GAAM,EAAA,WAAU,UAAS,KAAI,SAC3B,gBAAAX,EAAA,cAAAc,GAAA,EAAK,IAAG,QAAO,MAAK,KAAI,OAAM,OAAA,GAAM,MAErC,GACClB,EAAO4B,aAAaM,OAClB,gBAAA9B,EAAA,cAAA0B,GAAA,EACC,SAAQ,KACR,UAAS,QACT,iBAAgB,UAChB,QAAO,MACP,OAAO;AAAA,IAAEC,WAAW;AAAA,EAAQ,EAAA,GAE3B,gBAAA3B,EAAA,cAAA,OAAA,EAAI,OAAO;AAAA,IAAE4B,UAAU;AAAA,IAAQC,QAAQ;AAAA,EAAE,EAAA,GACvC,gBAAA7B,EAAA,cAAA,QAAA,MACE+B,KAAKC,UAAUpC,EAAO4B,aAAaM,MAAM,MAAM,CAAC,CACnD,CACF,CACF,IAEA,gBAAA9B,EAAA,cAACc,GAAK,EAAA,IAAG,QAAO,MAAK,OAAG,GAExB,CAEJ,CACF,CACF,CAEJ;AAEJ;"}
@@ -1,27 +1,57 @@
1
1
  import * as t from "@radix-ui/react-hover-card";
2
- import { Stack as n, Box as l } from "@telegraph/layout";
2
+ import { Button as a } from "@telegraph/button";
3
+ import { Stack as o, Box as i } from "@telegraph/layout";
4
+ import { RotateCcw as c, ExternalLink as m } from "lucide-react";
3
5
  import * as e from "react";
4
- import { isUnknownGuide as i } from "./useInspectGuideClientStore.mjs";
5
- const f = ({
6
- children: r,
7
- guide: o
6
+ import { isUnknownGuide as s } from "./useInspectGuideClientStore.mjs";
7
+ const v = ({
8
+ children: n,
9
+ guide: r
8
10
  }) => {
9
- if (i(o))
10
- return /* @__PURE__ */ e.createElement(n, { align: "center" }, r);
11
+ if (s(r))
12
+ return /* @__PURE__ */ e.createElement(o, { align: "center" }, n);
11
13
  const {
12
- annotation: c,
13
- activation_location_rules: m,
14
- priority: s,
15
- ...a
16
- } = o;
17
- return /* @__PURE__ */ e.createElement(t.Root, null, /* @__PURE__ */ e.createElement(t.Trigger, null, /* @__PURE__ */ e.createElement(n, { align: "center" }, r)), /* @__PURE__ */ e.createElement(t.Portal, null, /* @__PURE__ */ e.createElement(t.Content, { sideOffset: 16, side: "left" }, /* @__PURE__ */ e.createElement(l, { px: "2", shadow: "2", rounded: "3", border: "px", overflow: "auto", backgroundColor: "surface-2", style: {
14
+ annotation: d,
15
+ activation_location_rules: f,
16
+ priority: u,
17
+ ...l
18
+ } = r;
19
+ return /* @__PURE__ */ e.createElement(t.Root, null, /* @__PURE__ */ e.createElement(t.Trigger, null, /* @__PURE__ */ e.createElement(o, { align: "center" }, n)), /* @__PURE__ */ e.createElement(t.Portal, null, /* @__PURE__ */ e.createElement(t.Content, { sideOffset: 16, side: "left" }, /* @__PURE__ */ e.createElement(i, { px: "2", shadow: "2", rounded: "3", border: "px", overflow: "auto", backgroundColor: "surface-2", style: {
18
20
  width: "450px",
19
21
  maxHeight: "600px"
20
- } }, /* @__PURE__ */ e.createElement("pre", { style: {
22
+ } }, /* @__PURE__ */ e.createElement(o, { justify: "flex-end", gap: "1", pt: "2" }, /* @__PURE__ */ e.createElement(
23
+ a,
24
+ {
25
+ size: "0",
26
+ variant: "soft",
27
+ color: "default",
28
+ leadingIcon: {
29
+ icon: c,
30
+ alt: "Reset engagement"
31
+ },
32
+ onClick: () => {
33
+ }
34
+ },
35
+ "Reset engagement"
36
+ ), /* @__PURE__ */ e.createElement(
37
+ a,
38
+ {
39
+ size: "0",
40
+ variant: "soft",
41
+ color: "default",
42
+ leadingIcon: {
43
+ icon: m,
44
+ alt: "Go to dashboard"
45
+ },
46
+ onClick: () => {
47
+ }
48
+ },
49
+ "Go to dashboard"
50
+ )), /* @__PURE__ */ e.createElement("pre", { style: {
21
51
  fontSize: "11px"
22
- } }, /* @__PURE__ */ e.createElement("code", null, JSON.stringify(a, null, 2)))), /* @__PURE__ */ e.createElement(t.Arrow, null))));
52
+ } }, /* @__PURE__ */ e.createElement("code", null, JSON.stringify(l, null, 2)))), /* @__PURE__ */ e.createElement(t.Arrow, null))));
23
53
  };
24
54
  export {
25
- f as GuideHoverCard
55
+ v as GuideHoverCard
26
56
  };
27
57
  //# sourceMappingURL=GuideHoverCard.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"GuideHoverCard.mjs","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideHoverCard.tsx"],"sourcesContent":["import * as HoverCard from \"@radix-ui/react-hover-card\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport * as React from \"react\";\n\nimport {\n AnnotatedGuide,\n UnknownGuide,\n isUnknownGuide,\n} from \"./useInspectGuideClientStore\";\n\ntype Props = {\n guide: AnnotatedGuide | UnknownGuide;\n};\n\nexport const GuideHoverCard = ({\n children,\n guide,\n}: React.PropsWithChildren<Props>) => {\n if (isUnknownGuide(guide)) {\n return <Stack align=\"center\">{children}</Stack>;\n }\n\n // Prune out internal or legacy fields.\n const {\n annotation: _annotation,\n activation_location_rules: _activation_location_rules,\n priority: _priority,\n ...rest\n } = guide;\n\n return (\n <HoverCard.Root>\n <HoverCard.Trigger>\n <Stack align=\"center\">{children}</Stack>\n </HoverCard.Trigger>\n <HoverCard.Portal>\n <HoverCard.Content sideOffset={16} side=\"left\">\n <Box\n px=\"2\"\n shadow=\"2\"\n rounded=\"3\"\n border=\"px\"\n overflow=\"auto\"\n backgroundColor=\"surface-2\"\n style={{\n width: \"450px\",\n maxHeight: \"600px\",\n }}\n >\n <pre\n style={{\n fontSize: \"11px\",\n }}\n >\n <code>{JSON.stringify(rest, null, 2)}</code>\n </pre>\n </Box>\n <HoverCard.Arrow />\n </HoverCard.Content>\n </HoverCard.Portal>\n </HoverCard.Root>\n );\n};\n"],"names":["GuideHoverCard","children","guide","isUnknownGuide","React","Stack","annotation","_annotation","activation_location_rules","_activation_location_rules","priority","_priority","rest","HoverCard","Box","width","maxHeight","fontSize","JSON","stringify"],"mappings":";;;;AAcO,MAAMA,IAAiBA,CAAC;AAAA,EAC7BC,UAAAA;AAAAA,EACAC,OAAAA;AAC8B,MAAM;AAChCC,MAAAA,EAAeD,CAAK;AACtB,WAAQ,gBAAAE,EAAA,cAAAC,GAAA,EAAM,OAAM,SAAA,GAAUJ,CAAS;AAInC,QAAA;AAAA,IACJK,YAAYC;AAAAA,IACZC,2BAA2BC;AAAAA,IAC3BC,UAAUC;AAAAA,IACV,GAAGC;AAAAA,EAAAA,IACDV;AAEJ,yCACGW,EAAU,MAAV,MACE,gBAAAT,EAAA,cAAAS,EAAU,SAAV,MACC,gBAAAT,EAAA,cAACC,GAAM,EAAA,OAAM,YAAUJ,CAAS,CAClC,GACC,gBAAAG,EAAA,cAAAS,EAAU,QAAV,MACC,gBAAAT,EAAA,cAACS,EAAU,SAAV,EAAkB,YAAY,IAAI,MAAK,UACtC,gBAAAT,EAAA,cAACU,KACC,IAAG,KACH,QAAO,KACP,SAAQ,KACR,QAAO,MACP,UAAS,QACT,iBAAgB,aAChB,OAAO;AAAA,IACLC,OAAO;AAAA,IACPC,WAAW;AAAA,EACb,EAAA,GAEC,gBAAAZ,EAAA,cAAA,OAAA,EACC,OAAO;AAAA,IACLa,UAAU;AAAA,EAAA,KAGX,gBAAAb,EAAA,cAAA,QAAA,MAAMc,KAAKC,UAAUP,GAAM,MAAM,CAAC,CAAE,CACvC,CACF,GACC,gBAAAR,EAAA,cAAAS,EAAU,OAAV,IAAe,CAClB,CACF,CACF;AAEJ;"}
1
+ {"version":3,"file":"GuideHoverCard.mjs","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideHoverCard.tsx"],"sourcesContent":["import * as HoverCard from \"@radix-ui/react-hover-card\";\nimport { Button } from \"@telegraph/button\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { ExternalLink, RotateCcw } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport {\n AnnotatedGuide,\n UnknownGuide,\n isUnknownGuide,\n} from \"./useInspectGuideClientStore\";\n\ntype Props = {\n guide: AnnotatedGuide | UnknownGuide;\n};\n\nexport const GuideHoverCard = ({\n children,\n guide,\n}: React.PropsWithChildren<Props>) => {\n if (isUnknownGuide(guide)) {\n return <Stack align=\"center\">{children}</Stack>;\n }\n\n // Prune out internal or legacy fields.\n const {\n annotation: _annotation,\n activation_location_rules: _activation_location_rules,\n priority: _priority,\n ...rest\n } = guide;\n\n return (\n <HoverCard.Root>\n <HoverCard.Trigger>\n <Stack align=\"center\">{children}</Stack>\n </HoverCard.Trigger>\n <HoverCard.Portal>\n <HoverCard.Content sideOffset={16} side=\"left\">\n <Box\n px=\"2\"\n shadow=\"2\"\n rounded=\"3\"\n border=\"px\"\n overflow=\"auto\"\n backgroundColor=\"surface-2\"\n style={{\n width: \"450px\",\n maxHeight: \"600px\",\n }}\n >\n <Stack justify=\"flex-end\" gap=\"1\" pt=\"2\">\n <Button\n size=\"0\"\n variant=\"soft\"\n color=\"default\"\n leadingIcon={{ icon: RotateCcw, alt: \"Reset engagement\" }}\n // TODO(KNO-11468): Placeholder button\n onClick={() => {}}\n >\n Reset engagement\n </Button>\n <Button\n size=\"0\"\n variant=\"soft\"\n color=\"default\"\n leadingIcon={{ icon: ExternalLink, alt: \"Go to dashboard\" }}\n // TODO(KNO-11819): Placeholder button\n onClick={() => {}}\n >\n Go to dashboard\n </Button>\n </Stack>\n <pre\n style={{\n fontSize: \"11px\",\n }}\n >\n <code>{JSON.stringify(rest, null, 2)}</code>\n </pre>\n </Box>\n <HoverCard.Arrow />\n </HoverCard.Content>\n </HoverCard.Portal>\n </HoverCard.Root>\n );\n};\n"],"names":["GuideHoverCard","children","guide","isUnknownGuide","React","Stack","annotation","_annotation","activation_location_rules","_activation_location_rules","priority","_priority","rest","HoverCard","Box","width","maxHeight","Button","icon","RotateCcw","alt","ExternalLink","fontSize","JSON","stringify"],"mappings":";;;;;;AAgBO,MAAMA,IAAiBA,CAAC;AAAA,EAC7BC,UAAAA;AAAAA,EACAC,OAAAA;AAC8B,MAAM;AAChCC,MAAAA,EAAeD,CAAK;AACtB,WAAQ,gBAAAE,EAA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GAAM,MAAM,CAAC,CAAE,CACvC,CACF,GACC,gBAAAR,EAAA,cAAAS,EAAU,OAAV,IAAe,CAClB,CACF,CACF;AAEJ;"}
@@ -1,37 +1,55 @@
1
+ import { useGuideContext as p, useStore as h } from "@knocklabs/react-core";
1
2
  import { Button as n } from "@telegraph/button";
2
- import { Stack as a, Box as l } from "@telegraph/layout";
3
- import { Tag as s } from "@telegraph/tag";
4
- import { Tooltip as r } from "@telegraph/tooltip";
5
- import { Text as c } from "@telegraph/typography";
6
- import { Code2 as m, LocateFixed as d, UserCircle2 as p, Eye as u, CheckCircle2 as b, CircleDashed as h } from "lucide-react";
3
+ import { Stack as a, Box as m } from "@telegraph/layout";
4
+ import { Tag as g } from "@telegraph/tag";
5
+ import { Tooltip as o } from "@telegraph/tooltip";
6
+ import { Text as f } from "@telegraph/typography";
7
+ import { Pin as E, Code2 as v, LocateFixed as y, UserCircle2 as x, Eye as T, CheckCircle2 as C, CircleDashed as k } from "lucide-react";
7
8
  import * as e from "react";
8
- import { GuideHoverCard as E } from "./GuideHoverCard.mjs";
9
- import { isUnknownGuide as o } from "./useInspectGuideClientStore.mjs";
10
- const f = ({
9
+ import { GuideHoverCard as w } from "./GuideHoverCard.mjs";
10
+ import { isUnknownGuide as s } from "./useInspectGuideClientStore.mjs";
11
+ const z = ({
11
12
  children: t
12
- }) => /* @__PURE__ */ e.createElement(a, { h: "7", px: "2", borderTop: "px", justify: "space-between", align: "center" }, t), I = ({
13
+ }) => /* @__PURE__ */ e.createElement(a, { h: "7", px: "2", borderTop: "px", justify: "space-between", align: "center" }, t), L = ({
13
14
  guide: t,
14
- orderIndex: i
15
- }) => /* @__PURE__ */ e.createElement(f, null, /* @__PURE__ */ e.createElement(E, { guide: t }, /* @__PURE__ */ e.createElement(a, { h: "6", justify: "flex-start", align: "center", gap: "2" }, /* @__PURE__ */ e.createElement(s, { size: "0", variant: "soft", color: t.bypass_global_group_limit ? "blue" : "default" }, i + 1), /* @__PURE__ */ e.createElement(c, { as: "code", size: "1" }, t.key))), /* @__PURE__ */ e.createElement(a, { justify: "flex-end" }, !o(t) && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(a, { gap: "1" }, /* @__PURE__ */ e.createElement(r, { label: t.annotation.selectable.status === "returned" ? "This guide was queried and can display" : t.annotation.selectable.status === "queried" ? "This guide was queried but cannot display" : t.annotation.selectable.status === "throttled" ? "This guide was queried and can display but is throttled currently" : "No component is present in the current location to display this guide" }, /* @__PURE__ */ e.createElement(n, { px: "1", size: "1", variant: "soft", color: t.annotation.selectable.status === "returned" ? "green" : t.annotation.selectable.status === "queried" ? "gray" : t.annotation.selectable.status === "throttled" ? "yellow" : "red", leadingIcon: {
16
- icon: m,
17
- alt: "Render"
18
- } })), /* @__PURE__ */ e.createElement(r, { label: t.annotation.activatable.status ? "This guide can be activated at the current location" : "This guide cannot be activated at the current location" }, /* @__PURE__ */ e.createElement(n, { px: "1", size: "1", variant: "soft", color: t.annotation.activatable.status ? "green" : "red", leadingIcon: {
19
- icon: d,
20
- alt: "Target"
21
- } }))), /* @__PURE__ */ e.createElement(a, { px: "2", align: "center" }, /* @__PURE__ */ e.createElement(l, { h: "3", borderLeft: "px", borderColor: "gray-6" }))), /* @__PURE__ */ e.createElement(a, { gap: "1" }, !o(t) && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(r, { label: t.annotation.targetable.status ? "This user is being targeted" : t.annotation.targetable.message }, /* @__PURE__ */ e.createElement(n, { px: "1", size: "1", variant: "soft", color: t.annotation.targetable.status ? "green" : "red", leadingIcon: {
22
- icon: p,
23
- alt: "Target"
24
- } })), /* @__PURE__ */ e.createElement(r, { label: t.annotation.archived.status ? "User has already dismissed this guide" : "User has not dismissed this guide" }, /* @__PURE__ */ e.createElement(n, { px: "1", size: "1", variant: "soft", color: t.annotation.archived.status ? "red" : "green", leadingIcon: {
25
- icon: u,
26
- alt: "Not archived"
27
- } }))), /* @__PURE__ */ e.createElement(r, { label: o(t) ? "This guide has never been committed and published yet" : t.active ? "This guide is active" : "This guide is not active" }, /* @__PURE__ */ e.createElement(n, { px: "1", size: "1", variant: "soft", color: t.active ? "green" : "red", leadingIcon: t.active ? {
28
- icon: b,
29
- alt: "Active"
30
- } : {
31
- icon: h,
32
- alt: "Inactive"
33
- } })))));
15
+ orderIndex: u
16
+ }) => {
17
+ const {
18
+ client: l
19
+ } = p(), {
20
+ debugSettings: i
21
+ } = h(l.store, (b) => ({
22
+ debugSettings: b.debug || {}
23
+ })), c = i.focusedGuideKeys || {}, d = Object.keys(c).length > 0, r = !!c[t.key];
24
+ return /* @__PURE__ */ e.createElement(z, null, /* @__PURE__ */ e.createElement(w, { guide: t }, /* @__PURE__ */ e.createElement(a, { h: "6", justify: "flex-start", align: "center", gap: "2" }, /* @__PURE__ */ e.createElement(g, { size: "0", variant: "soft", color: t.bypass_global_group_limit ? "blue" : "default" }, u + 1), /* @__PURE__ */ e.createElement(f, { as: "code", size: "1", color: d ? r ? "blue" : "disabled" : "default" }, t.key))), /* @__PURE__ */ e.createElement(a, { justify: "flex-end" }, !s(t) && /* @__PURE__ */ e.createElement(e.Fragment, null, t.annotation.selectable.status !== void 0 && (!d || r) && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(o, { label: r ? "Unfocus this guide" : "Focus on this guide" }, /* @__PURE__ */ e.createElement(n, { size: "1", variant: "ghost", color: r ? "blue" : "gray", leadingIcon: {
25
+ icon: E,
26
+ alt: "Focus"
27
+ }, onClick: () => l.setDebug({
28
+ ...i,
29
+ focusedGuideKeys: r ? {} : {
30
+ [t.key]: !0
31
+ }
32
+ }) })), /* @__PURE__ */ e.createElement(a, { px: "2", align: "center" }, /* @__PURE__ */ e.createElement(m, { h: "3", borderLeft: "px", borderColor: "gray-6" }))), /* @__PURE__ */ e.createElement(a, { gap: "1" }, /* @__PURE__ */ e.createElement(o, { label: t.annotation.selectable.status === "returned" ? "This guide was queried and can display" : t.annotation.selectable.status === "queried" ? "This guide was queried but cannot display" : t.annotation.selectable.status === "throttled" ? "This guide was queried and can display but is throttled currently" : "No component is present in the current location to display this guide" }, /* @__PURE__ */ e.createElement(n, { px: "1", size: "1", variant: "soft", color: t.annotation.selectable.status === "returned" ? "green" : t.annotation.selectable.status === "queried" ? "gray" : t.annotation.selectable.status === "throttled" ? "yellow" : "red", leadingIcon: {
33
+ icon: v,
34
+ alt: "Render"
35
+ } })), /* @__PURE__ */ e.createElement(o, { label: t.annotation.activatable.status ? "This guide can be activated at the current location" : "This guide cannot be activated at the current location" }, /* @__PURE__ */ e.createElement(n, { px: "1", size: "1", variant: "soft", color: t.annotation.activatable.status ? "green" : "red", leadingIcon: {
36
+ icon: y,
37
+ alt: "Target"
38
+ } }))), /* @__PURE__ */ e.createElement(a, { px: "2", align: "center" }, /* @__PURE__ */ e.createElement(m, { h: "3", borderLeft: "px", borderColor: "gray-6" }))), /* @__PURE__ */ e.createElement(a, { gap: "1" }, !s(t) && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(o, { label: t.annotation.targetable.status ? "This user is being targeted" : t.annotation.targetable.message }, /* @__PURE__ */ e.createElement(n, { px: "1", size: "1", variant: "soft", color: t.annotation.targetable.status ? "green" : "red", leadingIcon: {
39
+ icon: x,
40
+ alt: "Target"
41
+ } })), /* @__PURE__ */ e.createElement(o, { label: t.annotation.archived.status ? "User has already dismissed this guide" : "User has not dismissed this guide" }, /* @__PURE__ */ e.createElement(n, { px: "1", size: "1", variant: "soft", color: t.annotation.archived.status ? "red" : "green", leadingIcon: {
42
+ icon: T,
43
+ alt: "Not archived"
44
+ } }))), /* @__PURE__ */ e.createElement(o, { label: s(t) ? "This guide has never been committed and published yet" : t.active ? "This guide is active" : "This guide is not active" }, /* @__PURE__ */ e.createElement(n, { px: "1", size: "1", variant: "soft", color: t.active ? "green" : "red", leadingIcon: t.active ? {
45
+ icon: C,
46
+ alt: "Active"
47
+ } : {
48
+ icon: k,
49
+ alt: "Inactive"
50
+ } })))));
51
+ };
34
52
  export {
35
- I as GuideRow
53
+ L as GuideRow
36
54
  };
37
55
  //# sourceMappingURL=GuideRow.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"GuideRow.mjs","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideRow.tsx"],"sourcesContent":["import { Button } from \"@telegraph/button\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { Tag } from \"@telegraph/tag\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\nimport {\n CheckCircle2,\n CircleDashed,\n Code2,\n Eye,\n LocateFixed,\n UserCircle2,\n} from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { GuideHoverCard } from \"./GuideHoverCard\";\nimport {\n AnnotatedGuide,\n UnknownGuide,\n isUnknownGuide,\n} from \"./useInspectGuideClientStore\";\n\nconst Row = ({ children }: React.PropsWithChildren) => (\n <Stack h=\"7\" px=\"2\" borderTop=\"px\" justify=\"space-between\" align=\"center\">\n {children}\n </Stack>\n);\n\ntype Props = {\n guide: UnknownGuide | AnnotatedGuide;\n orderIndex: number;\n};\n\nexport const GuideRow = ({ guide, orderIndex }: Props) => {\n return (\n <Row>\n <GuideHoverCard guide={guide}>\n <Stack h=\"6\" justify=\"flex-start\" align=\"center\" gap=\"2\">\n <Tag\n size=\"0\"\n variant=\"soft\"\n color={guide.bypass_global_group_limit ? \"blue\" : \"default\"}\n >\n {orderIndex + 1}\n </Tag>\n <Text as=\"code\" size=\"1\">\n {guide.key}\n </Text>\n </Stack>\n </GuideHoverCard>\n\n <Stack justify=\"flex-end\">\n {!isUnknownGuide(guide) && (\n <>\n <Stack gap=\"1\">\n <Tooltip\n label={\n guide.annotation.selectable.status === \"returned\"\n ? \"This guide was queried and can display\"\n : guide.annotation.selectable.status === \"queried\"\n ? \"This guide was queried but cannot display\"\n : guide.annotation.selectable.status === \"throttled\"\n ? \"This guide was queried and can display but is throttled currently\"\n : \"No component is present in the current location to display this guide\"\n }\n >\n <Button\n px=\"1\"\n size=\"1\"\n variant=\"soft\"\n color={\n guide.annotation.selectable.status === \"returned\"\n ? \"green\"\n : guide.annotation.selectable.status === \"queried\"\n ? \"gray\"\n : guide.annotation.selectable.status === \"throttled\"\n ? \"yellow\"\n : \"red\"\n }\n leadingIcon={{ icon: Code2, alt: \"Render\" }}\n />\n </Tooltip>\n <Tooltip\n label={\n guide.annotation.activatable.status\n ? \"This guide can be activated at the current location\"\n : \"This guide cannot be activated at the current location\"\n }\n >\n <Button\n px=\"1\"\n size=\"1\"\n variant=\"soft\"\n color={guide.annotation.activatable.status ? \"green\" : \"red\"}\n leadingIcon={{ icon: LocateFixed, alt: \"Target\" }}\n />\n </Tooltip>\n </Stack>\n <Stack px=\"2\" align=\"center\">\n <Box h=\"3\" borderLeft=\"px\" borderColor=\"gray-6\" />\n </Stack>\n </>\n )}\n <Stack gap=\"1\">\n {!isUnknownGuide(guide) && (\n <>\n <Tooltip\n label={\n guide.annotation.targetable.status\n ? \"This user is being targeted\"\n : guide.annotation.targetable.message\n }\n >\n <Button\n px=\"1\"\n size=\"1\"\n variant=\"soft\"\n color={guide.annotation.targetable.status ? \"green\" : \"red\"}\n leadingIcon={{ icon: UserCircle2, alt: \"Target\" }}\n />\n </Tooltip>\n <Tooltip\n label={\n guide.annotation.archived.status\n ? \"User has already dismissed this guide\"\n : \"User has not dismissed this guide\"\n }\n >\n <Button\n px=\"1\"\n size=\"1\"\n variant=\"soft\"\n color={guide.annotation.archived.status ? \"red\" : \"green\"}\n leadingIcon={{ icon: Eye, alt: \"Not archived\" }}\n />\n </Tooltip>\n </>\n )}\n <Tooltip\n label={\n isUnknownGuide(guide)\n ? \"This guide has never been committed and published yet\"\n : !guide.active\n ? \"This guide is not active\"\n : \"This guide is active\"\n }\n >\n <Button\n px=\"1\"\n size=\"1\"\n variant=\"soft\"\n color={guide.active ? \"green\" : \"red\"}\n leadingIcon={\n guide.active\n ? { icon: CheckCircle2, alt: \"Active\" }\n : { icon: CircleDashed, alt: \"Inactive\" }\n }\n />\n </Tooltip>\n </Stack>\n </Stack>\n </Row>\n );\n};\n"],"names":["Row","children","React","Stack","GuideRow","guide","orderIndex","GuideHoverCard","Tag","bypass_global_group_limit","Text","key","isUnknownGuide","Tooltip","annotation","selectable","status","Button","icon","Code2","alt","activatable","LocateFixed","Box","targetable","message","UserCircle2","archived","Eye","active","CheckCircle2","CircleDashed"],"mappings":";;;;;;;;;AAsBA,MAAMA,IAAMA,CAAC;AAAA,EAAEC,UAAAA;AAAkC,MAC9C,gBAAAC,EAAA,cAAAC,GAAA,EAAM,GAAE,KAAI,IAAG,KAAI,WAAU,MAAK,SAAQ,iBAAgB,OAAM,SAAA,GAC9DF,CACH,GAQWG,IAAWA,CAAC;AAAA,EAAEC,OAAAA;AAAAA,EAAOC,YAAAA;AAAkB,MAEhD,gBAAAJ,EAAA,cAACF,SACE,gBAAAE,EAAA,cAAAK,GAAA,EAAe,OAAAF,KACb,gBAAAH,EAAA,cAAAC,GAAA,EAAM,GAAE,KAAI,SAAQ,cAAa,OAAM,UAAS,KAAI,OAClD,gBAAAD,EAAA,cAAAM,GAAA,EACC,MAAK,KACL,SAAQ,QACR,OAAOH,EAAMI,4BAA4B,SAAS,UAEjDH,GAAAA,IAAa,CAChB,GACA,gBAAAJ,EAAA,cAACQ,KAAK,IAAG,QAAO,MAAK,IAAA,GAClBL,EAAMM,GACT,CACF,CACF,GAEC,gBAAAT,EAAA,cAAAC,GAAA,EAAM,SAAQ,WAAA,GACZ,CAACS,EAAeP,CAAK,KACpB,gBAAAH,EAAA,cAAAA,EAAA,UAAA,MACG,gBAAAA,EAAA,cAAAC,GAAA,EAAM,KAAI,IACT,GAAA,gBAAAD,EAAA,cAACW,KACC,OACER,EAAMS,WAAWC,WAAWC,WAAW,aACnC,2CACAX,EAAMS,WAAWC,WAAWC,WAAW,YACrC,8CACAX,EAAMS,WAAWC,WAAWC,WAAW,cACrC,sEACA,wEAGV,GAAA,gBAAAd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KACH,MAAK,KACL,SAAQ,QACR,OAAOZ,EAAMS,WAAWa,SAASX,SAAS,QAAQ,SAClD,aAAa;AAAA,EAAEE,MAAMU;AAAAA,EAAKR,KAAK;AAAA,EAAiB,CAAA,CAEpD,CACF,GAED,gBAAAlB,EAAA,cAAAW,GAAA,EACC,OACED,EAAeP,CAAK,IAChB,0DACCA,EAAMwB,SAEL,yBADA,8BAIR,gBAAA3B,EAAA,cAACe,GACC,EAAA,IAAG,KACH,MAAK,KACL,SAAQ,QACR,OAAOZ,EAAMwB,SAAS,UAAU,OAChC,aACExB,EAAMwB,SACF;AAAA,EAAEX,MAAMY;AAAAA,EAAcV,KAAK;AAAA,IAC3B;AAAA,EAAEF,MAAMa;AAAAA,EAAcX,KAAK;AAAA,EAChC,CAAA,CAEL,CACF,CACF,CACF;"}
1
+ {"version":3,"file":"GuideRow.mjs","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/GuideRow.tsx"],"sourcesContent":["import { useGuideContext, useStore } from \"@knocklabs/react-core\";\nimport { Button } from \"@telegraph/button\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { Tag } from \"@telegraph/tag\";\nimport { Tooltip } from \"@telegraph/tooltip\";\nimport { Text } from \"@telegraph/typography\";\nimport {\n CheckCircle2,\n CircleDashed,\n Code2,\n Eye,\n LocateFixed,\n Pin,\n UserCircle2,\n} from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { GuideHoverCard } from \"./GuideHoverCard\";\nimport {\n AnnotatedGuide,\n UnknownGuide,\n isUnknownGuide,\n} from \"./useInspectGuideClientStore\";\n\nconst Row = ({ children }: React.PropsWithChildren) => (\n <Stack h=\"7\" px=\"2\" borderTop=\"px\" justify=\"space-between\" align=\"center\">\n {children}\n </Stack>\n);\n\ntype Props = {\n guide: UnknownGuide | AnnotatedGuide;\n orderIndex: number;\n};\n\nexport const GuideRow = ({ guide, orderIndex }: Props) => {\n const { client } = useGuideContext();\n const { debugSettings } = useStore(client.store, (state) => ({\n debugSettings: state.debug || {},\n }));\n\n const focusedGuideKeys = debugSettings.focusedGuideKeys || {};\n const hasFocus = Object.keys(focusedGuideKeys).length > 0;\n const isFocused = !!focusedGuideKeys[guide.key];\n\n return (\n <Row>\n <GuideHoverCard guide={guide}>\n <Stack h=\"6\" justify=\"flex-start\" align=\"center\" gap=\"2\">\n <Tag\n size=\"0\"\n variant=\"soft\"\n color={guide.bypass_global_group_limit ? \"blue\" : \"default\"}\n >\n {orderIndex + 1}\n </Tag>\n <Text\n as=\"code\"\n size=\"1\"\n color={!hasFocus ? \"default\" : isFocused ? \"blue\" : \"disabled\"}\n >\n {guide.key}\n </Text>\n </Stack>\n </GuideHoverCard>\n\n <Stack justify=\"flex-end\">\n {!isUnknownGuide(guide) && (\n <>\n {guide.annotation.selectable.status !== undefined &&\n (!hasFocus || isFocused) && (\n <>\n <Tooltip\n label={\n isFocused ? \"Unfocus this guide\" : \"Focus on this guide\"\n }\n >\n <Button\n size=\"1\"\n variant=\"ghost\"\n color={isFocused ? \"blue\" : \"gray\"}\n leadingIcon={{ icon: Pin, alt: \"Focus\" }}\n onClick={() =>\n client.setDebug({\n ...debugSettings,\n focusedGuideKeys: isFocused\n ? {}\n : { [guide.key]: true },\n })\n }\n />\n </Tooltip>\n <Stack px=\"2\" align=\"center\">\n <Box h=\"3\" borderLeft=\"px\" borderColor=\"gray-6\" />\n </Stack>\n </>\n )}\n <Stack gap=\"1\">\n <Tooltip\n label={\n guide.annotation.selectable.status === \"returned\"\n ? \"This guide was queried and can display\"\n : guide.annotation.selectable.status === \"queried\"\n ? \"This guide was queried but cannot display\"\n : guide.annotation.selectable.status === \"throttled\"\n ? \"This guide was queried and can display but is throttled currently\"\n : \"No component is present in the current location to display this guide\"\n }\n >\n <Button\n px=\"1\"\n size=\"1\"\n variant=\"soft\"\n color={\n guide.annotation.selectable.status === \"returned\"\n ? \"green\"\n : guide.annotation.selectable.status === \"queried\"\n ? \"gray\"\n : guide.annotation.selectable.status === \"throttled\"\n ? \"yellow\"\n : \"red\"\n }\n leadingIcon={{ icon: Code2, alt: \"Render\" }}\n />\n </Tooltip>\n <Tooltip\n label={\n guide.annotation.activatable.status\n ? \"This guide can be activated at the current location\"\n : \"This guide cannot be activated at the current location\"\n }\n >\n <Button\n px=\"1\"\n size=\"1\"\n variant=\"soft\"\n color={guide.annotation.activatable.status ? \"green\" : \"red\"}\n leadingIcon={{ icon: LocateFixed, alt: \"Target\" }}\n />\n </Tooltip>\n </Stack>\n <Stack px=\"2\" align=\"center\">\n <Box h=\"3\" borderLeft=\"px\" borderColor=\"gray-6\" />\n </Stack>\n </>\n )}\n <Stack gap=\"1\">\n {!isUnknownGuide(guide) && (\n <>\n <Tooltip\n label={\n guide.annotation.targetable.status\n ? \"This user is being targeted\"\n : guide.annotation.targetable.message\n }\n >\n <Button\n px=\"1\"\n size=\"1\"\n variant=\"soft\"\n color={guide.annotation.targetable.status ? \"green\" : \"red\"}\n leadingIcon={{ icon: UserCircle2, alt: \"Target\" }}\n />\n </Tooltip>\n <Tooltip\n label={\n guide.annotation.archived.status\n ? \"User has already dismissed this guide\"\n : \"User has not dismissed this guide\"\n }\n >\n <Button\n px=\"1\"\n size=\"1\"\n variant=\"soft\"\n color={guide.annotation.archived.status ? \"red\" : \"green\"}\n leadingIcon={{ icon: Eye, alt: \"Not archived\" }}\n />\n </Tooltip>\n </>\n )}\n <Tooltip\n label={\n isUnknownGuide(guide)\n ? \"This guide has never been committed and published yet\"\n : !guide.active\n ? \"This guide is not active\"\n : \"This guide is active\"\n }\n >\n <Button\n px=\"1\"\n size=\"1\"\n variant=\"soft\"\n color={guide.active ? \"green\" : \"red\"}\n leadingIcon={\n guide.active\n ? { icon: CheckCircle2, alt: \"Active\" }\n : { icon: CircleDashed, alt: \"Inactive\" }\n }\n />\n </Tooltip>\n </Stack>\n </Stack>\n </Row>\n );\n};\n"],"names":["Row","children","React","Stack","GuideRow","guide","orderIndex","client","useGuideContext","debugSettings","useStore","store","state","debug","focusedGuideKeys","hasFocus","Object","keys","length","isFocused","key","GuideHoverCard","Tag","bypass_global_group_limit","Text","isUnknownGuide","annotation","selectable","status","undefined","Tooltip","Button","icon","Pin","alt","setDebug","Box","Code2","activatable","LocateFixed","targetable","message","UserCircle2","archived","Eye","active","CheckCircle2","CircleDashed"],"mappings":";;;;;;;;;;AAwBA,MAAMA,IAAMA,CAAC;AAAA,EAAEC,UAAAA;AAAkC,MAC9C,gBAAAC,EAAA,cAAAC,GAAA,EAAM,GAAE,KAAI,IAAG,KAAI,WAAU,MAAK,SAAQ,iBAAgB,OAAM,SAAA,GAC9DF,CACH,GAQWG,IAAWA,CAAC;AAAA,EAAEC,OAAAA;AAAAA,EAAOC,YAAAA;AAAkB,MAAM;AAClD,QAAA;AAAA,IAAEC,QAAAA;AAAAA,MAAWC,EAAgB,GAC7B;AAAA,IAAEC,eAAAA;AAAAA,EAAkBC,IAAAA,EAASH,EAAOI,OAAQC,CAAWA,OAAA;AAAA,IAC3DH,eAAeG,EAAMC,SAAS,CAAA;AAAA,EAAC,EAC/B,GAEIC,IAAmBL,EAAcK,oBAAoB,CAAC,GACtDC,IAAWC,OAAOC,KAAKH,CAAgB,EAAEI,SAAS,GAClDC,IAAY,CAAC,CAACL,EAAiBT,EAAMe,GAAG;AAE9C,yCACGpB,GACC,MAAA,gBAAAE,EAAA,cAACmB,GAAe,EAAA,OAAAhB,qCACbF,GAAM,EAAA,GAAE,KAAI,SAAQ,cAAa,OAAM,UAAS,KAAI,IACnD,GAAA,gBAAAD,EAAA,cAACoB,KACC,MAAK,KACL,SAAQ,QACR,OAAOjB,EAAMkB,4BAA4B,SAAS,UAAA,GAEjDjB,IAAa,CAChB,GACC,gBAAAJ,EAAA,cAAAsB,GAAA,EACC,IAAG,QACH,MAAK,KACL,OAAQT,IAAuBI,IAAY,SAAS,aAAjC,UAAiC,GAEnDd,EAAMe,GACT,CACF,CACF,mCAECjB,GAAM,EAAA,SAAQ,WACZ,GAAA,CAACsB,EAAepB,CAAK,uDAEjBA,E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Q,QACR,OAAO1B,EAAMwC,SAAS,UAAU,OAChC,aACExC,EAAMwC,SACF;AAAA,IAAEb,MAAMc;AAAAA,IAAcZ,KAAK;AAAA,EAAA,IAC3B;AAAA,IAAEF,MAAMe;AAAAA,IAAcb,KAAK;AAAA,EAAA,EAChC,CAAA,CAEL,CACF,CACF,CACF;AAEJ;"}
@@ -1,54 +1,71 @@
1
- import { useGuideContext as p } from "@knocklabs/react-core";
1
+ import { useGuideContext as b } from "@knocklabs/react-core";
2
2
  import { Button as d } from "@telegraph/button";
3
- import { Box as a, Stack as m } from "@telegraph/layout";
4
- import { Undo2 as f, Minimize2 as b } from "lucide-react";
3
+ import { Box as c, Stack as p } from "@telegraph/layout";
4
+ import { Text as x } from "@telegraph/typography";
5
+ import { Undo2 as y, Minimize2 as D } from "lucide-react";
5
6
  import e from "react";
6
- import { KnockButton as E } from "../KnockButton.mjs";
7
- import { TOOLBAR_Z_INDEX as y } from "../shared.mjs";
7
+ import { KnockButton as h } from "../KnockButton.mjs";
8
+ import { TOOLBAR_Z_INDEX as w } from "../shared.mjs";
8
9
  /* empty css */
9
- import { GuideContextDetails as g } from "./GuideContextDetails.mjs";
10
- import { GuideRow as x } from "./GuideRow.mjs";
11
- import { GuidesListDisplaySelect as C } from "./GuidesListDisplaySelect.mjs";
12
- import { detectToolbarParam as w } from "./helpers.mjs";
13
- import { useInspectGuideClientStore as D } from "./useInspectGuideClientStore.mjs";
14
- const k = ({
15
- guides: r,
16
- displayOption: i
17
- }) => r.map((o, n) => {
10
+ import { DragHandle as C, DRAG_HANDLE_OVERHANG as G } from "./DragHandle.mjs";
11
+ import { GuideContextDetails as R } from "./GuideContextDetails.mjs";
12
+ import { GuideRow as k } from "./GuideRow.mjs";
13
+ import { GuidesListDisplaySelect as I } from "./GuidesListDisplaySelect.mjs";
14
+ import { detectToolbarParam as S } from "./helpers.mjs";
15
+ import { useDraggable as z } from "./useDraggable.mjs";
16
+ import { useInspectGuideClientStore as L } from "./useInspectGuideClientStore.mjs";
17
+ const _ = ({
18
+ guides: i,
19
+ displayOption: t
20
+ }) => i.map((o, n) => {
18
21
  const {
19
22
  isEligible: l,
20
- isQualified: u,
21
- selectable: s
22
- } = o.annotation, t = l && u, c = t && s.status === "returned";
23
- return i === "only-displaying" && !c || i === "only-displayable" && !t || i === "all-eligible" && !l ? null : /* @__PURE__ */ e.createElement(x, { key: o.key, guide: o, orderIndex: n });
24
- }), j = () => {
23
+ isQualified: s,
24
+ selectable: a
25
+ } = o.annotation, r = l && s, m = r && a.status === "returned";
26
+ return t === "only-displaying" && !m || t === "only-displayable" && !r || t === "all-eligible" && !l ? null : /* @__PURE__ */ e.createElement(k, { key: o.key, guide: o, orderIndex: n });
27
+ }), q = () => {
25
28
  const {
26
- client: r
27
- } = p(), [i, o] = e.useState("only-displayable"), [n, l] = e.useState(w()), [u, s] = e.useState(!0);
29
+ client: i
30
+ } = b(), [t, o] = e.useState("only-displayable"), [n, l] = e.useState(S()), [s, a] = e.useState(!0);
28
31
  e.useEffect(() => {
29
32
  if (n)
30
- return r.setDebug(), () => {
31
- r.unsetDebug();
33
+ return i.setDebug(), () => {
34
+ i.unsetDebug();
32
35
  };
33
- }, [n, r]);
34
- const t = D();
35
- return t ? /* @__PURE__ */ e.createElement(a, { position: "fixed", top: "4", right: "4", style: {
36
- zIndex: y
37
- } }, u ? /* @__PURE__ */ e.createElement(E, { onClick: () => s(!1) }) : /* @__PURE__ */ e.createElement(m, { direction: "column", backgroundColor: "surface-2", shadow: "2", rounded: "3", border: "px", overflow: "hidden", style: {
36
+ }, [n, i]);
37
+ const r = e.useRef(null), {
38
+ position: m,
39
+ isDragging: f,
40
+ handlePointerDown: g
41
+ } = z({
42
+ elementRef: r,
43
+ reclampDeps: [s],
44
+ rightPadding: G,
45
+ initialPosition: {
46
+ top: 16,
47
+ right: 16
48
+ }
49
+ }), u = L();
50
+ return u ? /* @__PURE__ */ e.createElement(c, { tgphRef: r, position: "fixed", style: {
51
+ top: m.top + "px",
52
+ right: m.right + "px",
53
+ zIndex: w
54
+ } }, /* @__PURE__ */ e.createElement(C, { onPointerDown: g, isDragging: f }), s ? /* @__PURE__ */ e.createElement(h, { onClick: () => a(!1), positioned: !1 }) : /* @__PURE__ */ e.createElement(p, { direction: "column", backgroundColor: "surface-2", shadow: "2", rounded: "3", border: "px", overflow: "hidden", style: {
38
55
  width: "400px"
39
- } }, /* @__PURE__ */ e.createElement(m, { w: "full", p: "2", justify: "space-between", direction: "row", style: {
56
+ } }, /* @__PURE__ */ e.createElement(p, { w: "full", p: "2", justify: "space-between", direction: "row", style: {
40
57
  boxSizing: "border-box"
41
- } }, /* @__PURE__ */ e.createElement(a, { style: {
58
+ } }, /* @__PURE__ */ e.createElement(c, { style: {
42
59
  width: "220px"
43
- } }, /* @__PURE__ */ e.createElement(C, { value: i, onChange: (c) => o(c) })), /* @__PURE__ */ e.createElement(m, { gap: "2" }, /* @__PURE__ */ e.createElement(d, { onClick: () => l(!1), size: "1", variant: "soft", trailingIcon: {
44
- icon: f,
60
+ } }, /* @__PURE__ */ e.createElement(I, { value: t, onChange: (E) => o(E) })), /* @__PURE__ */ e.createElement(p, { gap: "2" }, /* @__PURE__ */ e.createElement(d, { onClick: () => l(!1), size: "1", variant: "soft", trailingIcon: {
61
+ icon: y,
45
62
  "aria-hidden": !0
46
- } }, "Exit"), /* @__PURE__ */ e.createElement(d, { onClick: () => s(!0), size: "1", variant: "soft", leadingIcon: {
47
- icon: b,
63
+ } }, "Exit"), /* @__PURE__ */ e.createElement(d, { onClick: () => a(!0), size: "1", variant: "soft", leadingIcon: {
64
+ icon: D,
48
65
  alt: "Collapse guide toolbar"
49
- } }))), /* @__PURE__ */ e.createElement(a, { w: "full" }, t.error && /* @__PURE__ */ e.createElement(a, null, t.error), /* @__PURE__ */ e.createElement(g, null), /* @__PURE__ */ e.createElement(k, { guides: t.guides, displayOption: i })))) : null;
66
+ } }))), /* @__PURE__ */ e.createElement(c, { w: "full" }, /* @__PURE__ */ e.createElement(R, null), u.error && /* @__PURE__ */ e.createElement(c, { px: "2", pb: "1" }, /* @__PURE__ */ e.createElement(x, { as: "span", size: "0", weight: "medium", color: "red" }, u.error)), /* @__PURE__ */ e.createElement(_, { guides: u.guides, displayOption: t })))) : null;
50
67
  };
51
68
  export {
52
- j as V2
69
+ q as V2
53
70
  };
54
71
  //# sourceMappingURL=V2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"V2.mjs","sources":["../../../../../../../src/modules/guide/components/Toolbar/V2/V2.tsx"],"sourcesContent":["import { useGuideContext } from \"@knocklabs/react-core\";\nimport { Button } from \"@telegraph/button\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { Minimize2, Undo2 } from \"lucide-react\";\nimport React from \"react\";\n\nimport { KnockButton } from \"../KnockButton\";\nimport { TOOLBAR_Z_INDEX } from \"../shared\";\nimport \"../styles.css\";\n\nimport { GuideContextDetails } from \"./GuideContextDetails\";\nimport { GuideRow } from \"./GuideRow\";\nimport {\n DisplayOption,\n GuidesListDisplaySelect,\n} from \"./GuidesListDisplaySelect\";\nimport { detectToolbarParam } from \"./helpers\";\nimport {\n InspectionResult,\n useInspectGuideClientStore,\n} from \"./useInspectGuideClientStore\";\n\nconst GuidesList = ({\n guides,\n displayOption,\n}: {\n guides: InspectionResult[\"guides\"];\n displayOption: DisplayOption;\n}) => {\n return guides.map((guide, idx) => {\n const { isEligible, isQualified, selectable } = guide.annotation;\n const isDisplayable = isEligible && isQualified;\n const isDisplaying = isDisplayable && selectable.status === \"returned\";\n\n if (displayOption === \"only-displaying\" && !isDisplaying) {\n return null;\n }\n if (displayOption === \"only-displayable\" && !isDisplayable) {\n return null;\n }\n if (displayOption === \"all-eligible\" && !isEligible) {\n return null;\n }\n\n return <GuideRow key={guide.key} guide={guide} orderIndex={idx} />;\n });\n};\n\nexport const V2 = () => {\n const { client } = useGuideContext();\n\n const [guidesListDisplayOption, setGuidesListDisplayOption] =\n React.useState<DisplayOption>(\"only-displayable\");\n\n const [isVisible, setIsVisible] = React.useState(detectToolbarParam());\n const [isCollapsed, setIsCollapsed] = React.useState(true);\n\n React.useEffect(() => {\n if (!isVisible) {\n return;\n }\n\n client.setDebug();\n\n return () => {\n client.unsetDebug();\n };\n }, [isVisible, client]);\n\n const result = useInspectGuideClientStore();\n if (!result) {\n return null;\n }\n\n return (\n <Box position=\"fixed\" top=\"4\" right=\"4\" style={{ zIndex: TOOLBAR_Z_INDEX }}>\n {isCollapsed ? (\n <KnockButton onClick={() => setIsCollapsed(false)} />\n ) : (\n <Stack\n direction=\"column\"\n backgroundColor=\"surface-2\"\n shadow=\"2\"\n rounded=\"3\"\n border=\"px\"\n overflow=\"hidden\"\n style={{ width: \"400px\" }}\n >\n <Stack\n w=\"full\"\n p=\"2\"\n justify=\"space-between\"\n direction=\"row\"\n style={{ boxSizing: \"border-box\" }}\n >\n <Box style={{ width: \"220px\" }}>\n <GuidesListDisplaySelect\n value={guidesListDisplayOption}\n onChange={(opt) => setGuidesListDisplayOption(opt)}\n />\n </Box>\n\n <Stack gap=\"2\">\n <Button\n onClick={() => setIsVisible(false)}\n size=\"1\"\n variant=\"soft\"\n trailingIcon={{ icon: Undo2, \"aria-hidden\": true }}\n >\n Exit\n </Button>\n <Button\n onClick={() => setIsCollapsed(true)}\n size=\"1\"\n variant=\"soft\"\n leadingIcon={{ icon: Minimize2, alt: \"Collapse guide toolbar\" }}\n />\n </Stack>\n </Stack>\n\n <Box w=\"full\">\n {result.error && <Box>{result.error}</Box>}\n <GuideContextDetails />\n <GuidesList\n guides={result.guides}\n displayOption={guidesListDisplayOption}\n />\n </Box>\n </Stack>\n )}\n </Box>\n );\n};\n"],"names":["GuidesList","guides","displayOption","map","guide","idx","isEligible","isQualified","selectable","annotation","isDisplayable","isDisplaying","status","GuideRow","key","V2","client","useGuideContext","guidesListDisplayOption","setGuidesListDisplayOption","React","useState","isVisible","setIsVisible","detectToolbarParam","isCollapsed","setIsCollapsed","useEffect","setDebug","unsetDebug","result","useInspectGuideClientStore","Box","zIndex","TOOLBAR_Z_INDEX","KnockButton","Stack","width","boxSizing","GuidesListDisplaySelect","opt","Button","icon","Undo2","Minimize2","alt","error","GuideContextDetails"],"mappings":";;;;;;;;;;;;;AAsBA,MAAMA,IAAaA,CAAC;AAAA,EAClBC,QAAAA;AAAAA,EACAC,eAAAA;AAIF,MACSD,EAAOE,IAAI,CAACC,GAAOC,MAAQ;AAC1B,QAAA;AAAA,IAAEC,YAAAA;AAAAA,IAAYC,aAAAA;AAAAA,IAAaC,YAAAA;AAAAA,MAAeJ,EAAMK,YAChDC,IAAgBJ,KAAcC,GAC9BI,IAAeD,KAAiBF,EAAWI,WAAW;AAQxDV,SANAA,MAAkB,qBAAqB,CAACS,KAGxCT,MAAkB,sBAAsB,CAACQ,KAGzCR,MAAkB,kBAAkB,CAACI,IAChC,uCAGDO,GAAS,EAAA,KAAKT,EAAMU,KAAK,OAAAV,GAAc,YAAYC,GAAO;AAAA,CACnE,GAGUU,IAAKA,MAAM;AAChB,QAAA;AAAA,IAAEC,QAAAA;AAAAA,MAAWC,EAAgB,GAE7B,CAACC,GAAyBC,CAA0B,IACxDC,EAAMC,SAAwB,kBAAkB,GAE5C,CAACC,GAAWC,CAAY,IAAIH,EAAMC,SAASG,GAAoB,GAC/D,CAACC,GAAaC,CAAc,IAAIN,EAAMC,SAAS,EAAI;AAEzDD,EAAAA,EAAMO,UAAU,MAAM;AACpB,QAAKL;AAILN,aAAAA,EAAOY,SAAS,GAET,MAAM;AACXZ,QAAAA,EAAOa,WAAW;AAAA,MACpB;AAAA,EAAA,GACC,CAACP,GAAWN,CAAM,CAAC;AAEtB,QAAMc,IAASC,EAA2B;AAC1C,SAAKD,IAKHV,gBAAAA,EAAA,cAACY,KAAI,UAAS,SAAQ,KAAI,KAAI,OAAM,KAAI,OAAO;AAAA,IAAEC,QAAQC;AAAAA,EAAgB,EAAA,GACtET,IACCL,gBAAAA,EAAA,cAACe,GAAY,EAAA,SAAS,MAAMT,EAAe,EAAK,EAAE,CA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guide/components/Toolbar/V2/V2.tsx"],"sourcesContent":["import { useGuideContext } from \"@knocklabs/react-core\";\nimport { Button } from \"@telegraph/button\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { Text } from \"@telegraph/typography\";\nimport { Minimize2, Undo2 } from \"lucide-react\";\nimport React from \"react\";\n\nimport { KnockButton } from \"../KnockButton\";\nimport { TOOLBAR_Z_INDEX } from \"../shared\";\nimport \"../styles.css\";\n\nimport { DRAG_HANDLE_OVERHANG, DragHandle } from \"./DragHandle\";\nimport { GuideContextDetails } from \"./GuideContextDetails\";\nimport { GuideRow } from \"./GuideRow\";\nimport {\n DisplayOption,\n GuidesListDisplaySelect,\n} from \"./GuidesListDisplaySelect\";\nimport { detectToolbarParam } from \"./helpers\";\nimport { useDraggable } from \"./useDraggable\";\nimport {\n InspectionResult,\n useInspectGuideClientStore,\n} from \"./useInspectGuideClientStore\";\n\nconst GuidesList = ({\n guides,\n displayOption,\n}: {\n guides: InspectionResult[\"guides\"];\n displayOption: DisplayOption;\n}) => {\n return guides.map((guide, idx) => {\n const { isEligible, isQualified, selectable } = guide.annotation;\n const isDisplayable = isEligible && isQualified;\n const isDisplaying = isDisplayable && selectable.status === \"returned\";\n\n if (displayOption === \"only-displaying\" && !isDisplaying) {\n return null;\n }\n if (displayOption === \"only-displayable\" && !isDisplayable) {\n return null;\n }\n if (displayOption === \"all-eligible\" && !isEligible) {\n return null;\n }\n\n return <GuideRow key={guide.key} guide={guide} orderIndex={idx} />;\n });\n};\n\nexport const V2 = () => {\n const { client } = useGuideContext();\n\n const [guidesListDisplayOption, setGuidesListDisplayOption] =\n React.useState<DisplayOption>(\"only-displayable\");\n\n const [isVisible, setIsVisible] = React.useState(detectToolbarParam());\n const [isCollapsed, setIsCollapsed] = React.useState(true);\n\n React.useEffect(() => {\n if (!isVisible) {\n return;\n }\n\n client.setDebug();\n\n return () => {\n client.unsetDebug();\n };\n }, [isVisible, client]);\n\n const containerRef = React.useRef<HTMLDivElement>(null);\n const { position, isDragging, handlePointerDown } = useDraggable({\n elementRef: containerRef,\n reclampDeps: [isCollapsed],\n rightPadding: DRAG_HANDLE_OVERHANG,\n initialPosition: { top: 16, right: 16 },\n });\n\n const result = useInspectGuideClientStore();\n if (!result) {\n return null;\n }\n\n return (\n <Box\n tgphRef={containerRef}\n position=\"fixed\"\n style={{\n top: position.top + \"px\",\n right: position.right + \"px\",\n zIndex: TOOLBAR_Z_INDEX,\n }}\n >\n <DragHandle onPointerDown={handlePointerDown} isDragging={isDragging} />\n {isCollapsed ? (\n <KnockButton onClick={() => setIsCollapsed(false)} positioned={false} />\n ) : (\n <Stack\n direction=\"column\"\n backgroundColor=\"surface-2\"\n shadow=\"2\"\n rounded=\"3\"\n border=\"px\"\n overflow=\"hidden\"\n style={{ width: \"400px\" }}\n >\n <Stack\n w=\"full\"\n p=\"2\"\n justify=\"space-between\"\n direction=\"row\"\n style={{ boxSizing: \"border-box\" }}\n >\n <Box style={{ width: \"220px\" }}>\n <GuidesListDisplaySelect\n value={guidesListDisplayOption}\n onChange={(opt) => setGuidesListDisplayOption(opt)}\n />\n </Box>\n\n <Stack gap=\"2\">\n <Button\n onClick={() => setIsVisible(false)}\n size=\"1\"\n variant=\"soft\"\n trailingIcon={{ icon: Undo2, \"aria-hidden\": true }}\n >\n Exit\n </Button>\n <Button\n onClick={() => setIsCollapsed(true)}\n size=\"1\"\n variant=\"soft\"\n leadingIcon={{ icon: Minimize2, alt: \"Collapse guide toolbar\" }}\n />\n </Stack>\n </Stack>\n\n <Box w=\"full\">\n <GuideContextDetails />\n {result.error && (\n <Box px=\"2\" pb=\"1\">\n <Text as=\"span\" size=\"0\" weight=\"medium\" color=\"red\">\n {result.error}\n </Text>\n </Box>\n )}\n <GuidesList\n guides={result.guides}\n displayOption={guidesListDisplayOption}\n />\n </Box>\n </Stack>\n )}\n </Box>\n );\n};\n"],"names":["GuidesList","guides","displayOption","map","guide","idx","isEligible","isQualified","selectable","annotation","isDisplayable","isDisplaying","status","GuideRow","key","V2","client","useGuideContext","guidesListDisplayOption","setGuidesListDisplayOption","React","useState","isVisible","setIsVisible","detectToolbarParam","isCollapsed","setIsCollapsed","useEffect","setDebug","unsetDebug","containerRef","useRef","position","isDragging","handlePointerDown","useDraggable","elementRef","reclampDeps","rightPadding","DRAG_HANDLE_OVERHANG","initialPosition","top","right","result","useInspectGuideClientStore","Box","zIndex","TOOLBAR_Z_INDEX","DragHandle","KnockButton","Stack","width","boxSizing","GuidesListDisplaySelect","opt","Button","icon","Undo2","Minimize2","alt","GuideContextDetails","error","Text"],"mappings":";;;;;;;;;;;;;;;;AAyBA,MAAMA,IAAaA,CAAC;AAAA,EAClBC,QAAAA;AAAAA,EACAC,eAAAA;AAIF,MACSD,EAAOE,IAAI,CAACC,GAAOC,MAAQ;AAC1B,QAAA;AAAA,IAAEC,YAAAA;AAAAA,IAAYC,aAAAA;AAAAA,IAAaC,YAAAA;AAAAA,MAAeJ,EAAMK,YAChDC,IAAgBJ,KAAcC,GAC9BI,IAAeD,KAAiBF,EAAWI,WAAW;AAQxDV,SANAA,MAAkB,qBAAqB,CAACS,KAGxCT,MAAkB,sBAAsB,CAACQ,KAGzCR,MAAkB,kBAAkB,CAACI,IAChC,uCAGDO,GAAS,EAAA,KAAKT,EAAMU,KAAK,OAAAV,GAAc,YAAYC,GAAO;AAAA,CACnE,GAGUU,IAAKA,MAAM;AAChB,QAAA;AAAA,IAAEC,QAAAA;AAAAA,MAAWC,EAAgB,GAE7B,CAACC,GAAyBC,CAA0B,IACxDC,EAAMC,SAAwB,kBAAkB,GAE5C,CAACC,GAAWC,CAAY,IAAIH,EAAMC,SAASG,GAAoB,GAC/D,CAACC,GAAaC,CAAc,IAAIN,EAAMC,SAAS,EAAI;AAEzDD,EAAAA,EAAMO,UAAU,MAAM;AACpB,QAAKL;AAILN,aAAAA,EAAOY,SAAS,GAET,MAAM;AACXZ,QAAAA,EAAOa,WAAW;AAAA,MACpB;AAAA,EAAA,GACC,CAACP,GAAWN,CAAM,C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AACmC,GACC,EAAA,SAAS,MAAMhC,EAAa,EAAK,GACjC,MAAK,KACL,SAAQ,QACR,cAAc;AAAA,IAAEiC,MAAMC;AAAAA,IAAO,eAAe;AAAA,EAAA,EAAO,GAAA,MAGrD,GACArC,gBAAAA,EAAA,cAACmC,KACC,SAAS,MAAM7B,EAAe,EAAI,GAClC,MAAK,KACL,SAAQ,QACR,aAAa;AAAA,IAAE8B,MAAME;AAAAA,IAAWC,KAAK;AAAA,KAA2B,CAEpE,CACF,GAECvC,gBAAAA,EAAA,cAAAyB,GAAA,EAAI,GAAE,OACL,GAAAzB,gBAAAA,EAAA,cAACwC,OAAmB,GACnBjB,EAAOkB,SACLzC,gBAAAA,EAAA,cAAAyB,GAAA,EAAI,IAAG,KAAI,IAAG,OACZzB,gBAAAA,EAAA,cAAA0C,GAAA,EAAK,IAAG,QAAO,MAAK,KAAI,QAAO,UAAS,OAAM,MAAA,GAC5CnB,EAAOkB,KACV,CACF,GAEDzC,gBAAAA,EAAA,cAAApB,GAAA,EACC,QAAQ2C,EAAO1C,QACf,eAAeiB,EAAwB,CAAA,CAE3C,CACF,CAEJ,IA1EO;AA4EX;"}
@@ -0,0 +1,74 @@
1
+ import e from "react";
2
+ const C = {
3
+ top: 16,
4
+ right: 16
5
+ };
6
+ function L(n, i, h, o = 0) {
7
+ const r = window.innerWidth, f = window.innerHeight, w = i + o, p = r - n.right - i, d = Math.max(0, Math.min(p, r - w)), s = Math.max(0, Math.min(n.top, f - h)), u = r - d - i;
8
+ return {
9
+ top: s,
10
+ right: u
11
+ };
12
+ }
13
+ function b({
14
+ elementRef: n,
15
+ initialPosition: i = C,
16
+ reclampDeps: h = [],
17
+ rightPadding: o = 0
18
+ }) {
19
+ const [r, f] = e.useState(i), [w, p] = e.useState(!1), d = e.useRef(r);
20
+ d.current = r;
21
+ const s = e.useRef({
22
+ x: 0,
23
+ y: 0
24
+ }), u = e.useRef({
25
+ top: 0,
26
+ right: 0
27
+ }), c = e.useRef(null), m = e.useRef(!1), a = e.useRef(null), v = e.useCallback(() => {
28
+ const t = n.current;
29
+ if (!t) return;
30
+ const l = t.getBoundingClientRect();
31
+ f((g) => L(g, l.width, l.height, o));
32
+ }, [n, o]), P = e.useCallback((t) => {
33
+ t.preventDefault(), s.current = {
34
+ x: t.clientX,
35
+ y: t.clientY
36
+ }, u.current = {
37
+ ...d.current
38
+ }, m.current = !0, p(!0);
39
+ const l = (E) => {
40
+ m.current && c.current === null && (c.current = requestAnimationFrame(() => {
41
+ if (c.current = null, !m.current) return;
42
+ const A = E.clientX - s.current.x, F = E.clientY - s.current.y, M = {
43
+ top: u.current.top + F,
44
+ right: u.current.right - A
45
+ }, x = n.current;
46
+ if (!x) return;
47
+ const D = x.getBoundingClientRect(), y = L(M, D.width, D.height, o);
48
+ f(y);
49
+ }));
50
+ }, g = () => {
51
+ m.current = !1, p(!1), c.current !== null && (cancelAnimationFrame(c.current), c.current = null), document.removeEventListener("pointermove", l), document.removeEventListener("pointerup", R), a.current = null;
52
+ }, R = () => g();
53
+ document.addEventListener("pointermove", l), document.addEventListener("pointerup", R), a.current = g;
54
+ }, [n, o]);
55
+ return e.useEffect(() => () => {
56
+ var t;
57
+ (t = a.current) == null || t.call(a);
58
+ }, []), e.useEffect(() => {
59
+ const t = () => v();
60
+ return window.addEventListener("resize", t), () => window.removeEventListener("resize", t);
61
+ }, [v]), e.useEffect(() => {
62
+ const t = requestAnimationFrame(() => v());
63
+ return () => cancelAnimationFrame(t);
64
+ }, h), {
65
+ position: r,
66
+ isDragging: w,
67
+ handlePointerDown: P
68
+ };
69
+ }
70
+ export {
71
+ L as clampPosition,
72
+ b as useDraggable
73
+ };
74
+ //# sourceMappingURL=useDraggable.mjs.map