@activecollab/components 2.0.586 → 2.0.588

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 (117) hide show
  1. package/dist/cjs/components/Capsule/Capsule.js +41 -0
  2. package/dist/cjs/components/Capsule/Capsule.js.map +1 -0
  3. package/dist/cjs/components/Capsule/CapsuleButton.js +115 -0
  4. package/dist/cjs/components/Capsule/CapsuleButton.js.map +1 -0
  5. package/dist/cjs/components/Capsule/Styles.js +36 -0
  6. package/dist/cjs/components/Capsule/Styles.js.map +1 -0
  7. package/dist/cjs/components/Capsule/index.js +28 -0
  8. package/dist/cjs/components/Capsule/index.js.map +1 -0
  9. package/dist/cjs/components/Icons/collection/Pointer.js +58 -0
  10. package/dist/cjs/components/Icons/collection/Pointer.js.map +1 -0
  11. package/dist/cjs/components/Icons/collection/index.js +7 -0
  12. package/dist/cjs/components/Icons/collection/index.js.map +1 -1
  13. package/dist/cjs/components/index.js +12 -0
  14. package/dist/cjs/components/index.js.map +1 -1
  15. package/dist/cjs/presentation/whiteboard/boardTools.js +45 -0
  16. package/dist/cjs/presentation/whiteboard/boardTools.js.map +1 -0
  17. package/dist/cjs/presentation/whiteboard/canvasElements.js +46 -38
  18. package/dist/cjs/presentation/whiteboard/canvasElements.js.map +1 -1
  19. package/dist/cjs/presentation/whiteboard/elementToolbars.js +166 -0
  20. package/dist/cjs/presentation/whiteboard/elementToolbars.js.map +1 -0
  21. package/dist/cjs/presentation/whiteboard/elements.js +6 -429
  22. package/dist/cjs/presentation/whiteboard/elements.js.map +1 -1
  23. package/dist/cjs/presentation/whiteboard/entityCardActions.js +12 -18
  24. package/dist/cjs/presentation/whiteboard/entityCardActions.js.map +1 -1
  25. package/dist/cjs/presentation/whiteboard/fileElement.js +66 -58
  26. package/dist/cjs/presentation/whiteboard/fileElement.js.map +1 -1
  27. package/dist/cjs/presentation/whiteboard/linkElement.js +22 -45
  28. package/dist/cjs/presentation/whiteboard/linkElement.js.map +1 -1
  29. package/dist/cjs/presentation/whiteboard/paletteReview.js +10 -4
  30. package/dist/cjs/presentation/whiteboard/paletteReview.js.map +1 -1
  31. package/dist/cjs/presentation/whiteboardModern/contextToolbar.js +406 -0
  32. package/dist/cjs/presentation/whiteboardModern/contextToolbar.js.map +1 -0
  33. package/dist/cjs/presentation/whiteboardModern/toolDock.js +275 -0
  34. package/dist/cjs/presentation/whiteboardModern/toolDock.js.map +1 -0
  35. package/dist/cjs/presentation/whiteboardModern/topBars.js +223 -0
  36. package/dist/cjs/presentation/whiteboardModern/topBars.js.map +1 -0
  37. package/dist/esm/components/Capsule/Capsule.d.ts +11 -0
  38. package/dist/esm/components/Capsule/Capsule.d.ts.map +1 -0
  39. package/dist/esm/components/Capsule/Capsule.js +32 -0
  40. package/dist/esm/components/Capsule/Capsule.js.map +1 -0
  41. package/dist/esm/components/Capsule/CapsuleButton.d.ts +31 -0
  42. package/dist/esm/components/Capsule/CapsuleButton.d.ts.map +1 -0
  43. package/dist/esm/components/Capsule/CapsuleButton.js +102 -0
  44. package/dist/esm/components/Capsule/CapsuleButton.js.map +1 -0
  45. package/dist/esm/components/Capsule/Styles.d.ts +10 -0
  46. package/dist/esm/components/Capsule/Styles.d.ts.map +1 -0
  47. package/dist/esm/components/Capsule/Styles.js +29 -0
  48. package/dist/esm/components/Capsule/Styles.js.map +1 -0
  49. package/dist/esm/components/Capsule/index.d.ts +3 -0
  50. package/dist/esm/components/Capsule/index.d.ts.map +1 -0
  51. package/dist/esm/components/Capsule/index.js +3 -0
  52. package/dist/esm/components/Capsule/index.js.map +1 -0
  53. package/dist/esm/components/Icons/collection/Pointer.d.ts +30 -0
  54. package/dist/esm/components/Icons/collection/Pointer.d.ts.map +1 -0
  55. package/dist/esm/components/Icons/collection/Pointer.js +51 -0
  56. package/dist/esm/components/Icons/collection/Pointer.js.map +1 -0
  57. package/dist/esm/components/Icons/collection/index.d.ts +1 -0
  58. package/dist/esm/components/Icons/collection/index.d.ts.map +1 -1
  59. package/dist/esm/components/Icons/collection/index.js +1 -0
  60. package/dist/esm/components/Icons/collection/index.js.map +1 -1
  61. package/dist/esm/components/index.d.ts +1 -0
  62. package/dist/esm/components/index.d.ts.map +1 -1
  63. package/dist/esm/components/index.js +1 -0
  64. package/dist/esm/components/index.js.map +1 -1
  65. package/dist/esm/presentation/whiteboard/boardTools.d.ts +18 -0
  66. package/dist/esm/presentation/whiteboard/boardTools.d.ts.map +1 -0
  67. package/dist/esm/presentation/whiteboard/boardTools.js +37 -0
  68. package/dist/esm/presentation/whiteboard/boardTools.js.map +1 -0
  69. package/dist/esm/presentation/whiteboard/canvasElements.d.ts +5 -2
  70. package/dist/esm/presentation/whiteboard/canvasElements.d.ts.map +1 -1
  71. package/dist/esm/presentation/whiteboard/canvasElements.js +35 -26
  72. package/dist/esm/presentation/whiteboard/canvasElements.js.map +1 -1
  73. package/dist/esm/presentation/whiteboard/elementToolbars.d.ts +22 -0
  74. package/dist/esm/presentation/whiteboard/elementToolbars.d.ts.map +1 -0
  75. package/dist/esm/presentation/whiteboard/elementToolbars.js +130 -0
  76. package/dist/esm/presentation/whiteboard/elementToolbars.js.map +1 -0
  77. package/dist/esm/presentation/whiteboard/elements.d.ts +1 -70
  78. package/dist/esm/presentation/whiteboard/elements.d.ts.map +1 -1
  79. package/dist/esm/presentation/whiteboard/elements.js +7 -369
  80. package/dist/esm/presentation/whiteboard/elements.js.map +1 -1
  81. package/dist/esm/presentation/whiteboard/entityCardActions.d.ts +2 -3
  82. package/dist/esm/presentation/whiteboard/entityCardActions.d.ts.map +1 -1
  83. package/dist/esm/presentation/whiteboard/entityCardActions.js +12 -18
  84. package/dist/esm/presentation/whiteboard/entityCardActions.js.map +1 -1
  85. package/dist/esm/presentation/whiteboard/fileElement.d.ts +1 -1
  86. package/dist/esm/presentation/whiteboard/fileElement.d.ts.map +1 -1
  87. package/dist/esm/presentation/whiteboard/fileElement.js +66 -59
  88. package/dist/esm/presentation/whiteboard/fileElement.js.map +1 -1
  89. package/dist/esm/presentation/whiteboard/linkElement.d.ts +2 -2
  90. package/dist/esm/presentation/whiteboard/linkElement.d.ts.map +1 -1
  91. package/dist/esm/presentation/whiteboard/linkElement.js +24 -47
  92. package/dist/esm/presentation/whiteboard/linkElement.js.map +1 -1
  93. package/dist/esm/presentation/whiteboard/paletteReview.js +11 -5
  94. package/dist/esm/presentation/whiteboard/paletteReview.js.map +1 -1
  95. package/dist/esm/presentation/whiteboardModern/contextToolbar.d.ts +76 -0
  96. package/dist/esm/presentation/whiteboardModern/contextToolbar.d.ts.map +1 -0
  97. package/dist/esm/presentation/whiteboardModern/contextToolbar.js +341 -0
  98. package/dist/esm/presentation/whiteboardModern/contextToolbar.js.map +1 -0
  99. package/dist/esm/presentation/whiteboardModern/toolDock.d.ts +20 -0
  100. package/dist/esm/presentation/whiteboardModern/toolDock.d.ts.map +1 -0
  101. package/dist/esm/presentation/whiteboardModern/toolDock.js +246 -0
  102. package/dist/esm/presentation/whiteboardModern/toolDock.js.map +1 -0
  103. package/dist/esm/presentation/whiteboardModern/topBars.d.ts +42 -0
  104. package/dist/esm/presentation/whiteboardModern/topBars.d.ts.map +1 -0
  105. package/dist/esm/presentation/whiteboardModern/topBars.js +197 -0
  106. package/dist/esm/presentation/whiteboardModern/topBars.js.map +1 -0
  107. package/dist/index.js +1158 -952
  108. package/dist/index.js.map +1 -1
  109. package/dist/index.min.js +1 -1
  110. package/dist/index.min.js.map +1 -1
  111. package/package.json +1 -1
  112. package/dist/cjs/presentation/whiteboard/bottomDock.js +0 -264
  113. package/dist/cjs/presentation/whiteboard/bottomDock.js.map +0 -1
  114. package/dist/esm/presentation/whiteboard/bottomDock.d.ts +0 -75
  115. package/dist/esm/presentation/whiteboard/bottomDock.d.ts.map +0 -1
  116. package/dist/esm/presentation/whiteboard/bottomDock.js +0 -214
  117. package/dist/esm/presentation/whiteboard/bottomDock.js.map +0 -1
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
- import { StyledFormattingToolbar, StyledToolbarButton, ToolbarActions, stopClick } from "./elements";
2
+ import { lockDeleteGroup } from "./elementToolbars";
3
3
  import { InfoIcon } from "../../components/Icons";
4
+ import { ContextToolbar } from "../whiteboardModern/contextToolbar";
4
5
 
5
6
  /* ------------------------------------------------------------------ */
6
7
  /* Selection menu for the person element */
@@ -12,9 +13,8 @@ import { InfoIcon } from "../../components/Icons";
12
13
  * A person is not a page you visit and not a link you copy — it is an avatar
13
14
  * chip — so its bar drops both of the entity card's leading actions and offers
14
15
  * exactly one: Details, which opens the user details dialog. The trailing
15
- * `ToolbarActions` block (separator → Lock → Delete) is the same one every other
16
- * element on this board carries, so the bar reads as: Details | (sep) Lock |
17
- * Delete.
16
+ * Lock · Delete group is the same one every other lockable element on this
17
+ * board carries, so the bar reads as: Details | Lock · Delete.
18
18
  *
19
19
  * Which STATES get a toolbar is the caller's business (the canvas layer already
20
20
  * knows every element's status): only a resolved, non-limited person does. A
@@ -27,20 +27,14 @@ export const PersonCardToolbar = _ref => {
27
27
  locked = _ref.locked,
28
28
  onToggleLock = _ref.onToggleLock,
29
29
  onDelete = _ref.onDelete;
30
- return /*#__PURE__*/React.createElement(StyledFormattingToolbar, {
31
- "data-testid": "wb-person-toolbar",
32
- onMouseDown: stopClick,
33
- onClick: stopClick
34
- }, /*#__PURE__*/React.createElement(StyledToolbarButton, {
35
- type: "button",
36
- onClick: onDetails
37
- }, /*#__PURE__*/React.createElement(InfoIcon, {
38
- className: "i16"
39
- }), "Details"), /*#__PURE__*/React.createElement(ToolbarActions, {
40
- locked: locked,
41
- onToggleLock: onToggleLock,
42
- onDelete: onDelete
43
- }));
30
+ return /*#__PURE__*/React.createElement(ContextToolbar, {
31
+ groups: [[{
32
+ kind: "action",
33
+ label: "Details",
34
+ icon: /*#__PURE__*/React.createElement(InfoIcon, null),
35
+ onClick: onDetails
36
+ }], lockDeleteGroup(locked, onToggleLock, onDelete)]
37
+ });
44
38
  };
45
39
 
46
40
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"entityCardActions.js","names":["React","StyledFormattingToolbar","StyledToolbarButton","ToolbarActions","stopClick","InfoIcon","PersonCardToolbar","_ref","onDetails","locked","onToggleLock","onDelete","createElement","onMouseDown","onClick","type","className","personDetailsProps","person","firstName","name","split","toLowerCase","replace","avatar","color","initials","hoursLabel","email","extraContactsCount","joinedDate","onSendMessage","undefined","onSeeFullProfile"],"sources":["../../../../src/presentation/whiteboard/entityCardActions.tsx"],"sourcesContent":["import React, { ReactElement } from \"react\";\n\nimport {\n StyledFormattingToolbar,\n StyledToolbarButton,\n ToolbarActions,\n stopClick,\n} from \"./elements\";\nimport { PickerPerson } from \"./projectElements\";\nimport { InfoIcon } from \"../../components/Icons\";\nimport type { UserDetailsDialogProps } from \"../shared\";\n\n/* ------------------------------------------------------------------ */\n/* Selection menu for the person element */\n/* ------------------------------------------------------------------ */\n\n/**\n * The selection toolbar for a PERSON element.\n *\n * A person is not a page you visit and not a link you copy — it is an avatar\n * chip — so its bar drops both of the entity card's leading actions and offers\n * exactly one: Details, which opens the user details dialog. The trailing\n * `ToolbarActions` block (separator → Lock → Delete) is the same one every other\n * element on this board carries, so the bar reads as: Details | (sep) Lock |\n * Delete.\n *\n * Which STATES get a toolbar is the caller's business (the canvas layer already\n * knows every element's status): only a resolved, non-limited person does. A\n * limited person must not offer a single one of these, and a placeholder or a\n * resolving skeleton has no person to act on yet.\n */\nexport interface PersonCardToolbarProps {\n onDetails: () => void;\n locked: boolean;\n onToggleLock: () => void;\n onDelete: () => void;\n}\n\nexport const PersonCardToolbar = ({\n onDetails,\n locked,\n onToggleLock,\n onDelete,\n}: PersonCardToolbarProps): ReactElement => (\n <StyledFormattingToolbar\n data-testid=\"wb-person-toolbar\"\n onMouseDown={stopClick}\n onClick={stopClick}\n >\n <StyledToolbarButton type=\"button\" onClick={onDetails}>\n <InfoIcon className=\"i16\" />\n Details\n </StyledToolbarButton>\n <ToolbarActions\n locked={locked}\n onToggleLock={onToggleLock}\n onDelete={onDelete}\n />\n </StyledFormattingToolbar>\n);\n\n/**\n * The person data the whiteboard feeds the reusable `UserDetailsDialog` when a\n * person's Details button is clicked.\n *\n * The board only knows a person's name / initials / avatar colour, so the rest\n * of the dialog's fields are representative sample data (a working-hours pill, a\n * derived email with one extra contact, and a joined date) — the dialog itself\n * takes everything as props and hardcodes none of it. `open` and `onClose` are\n * supplied by the caller that renders the dialog.\n */\nexport const personDetailsProps = (\n person: PickerPerson\n): Omit<UserDetailsDialogProps, \"open\" | \"onClose\"> => {\n const firstName = person.name\n .split(\" \")[0]\n .toLowerCase()\n .replace(/[^a-z]/g, \"\");\n\n return {\n avatar: { color: person.color, initials: person.initials },\n name: person.name,\n hoursLabel: \"40 h/w\",\n email: `${firstName || person.initials.toLowerCase()}@activecollab.com`,\n extraContactsCount: 1,\n joinedDate: \"Joined: Feb 7. 2009\",\n onSendMessage: () => undefined,\n onSeeFullProfile: () => undefined,\n };\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAwB,OAAO;AAE3C,SACEC,uBAAuB,EACvBC,mBAAmB,EACnBC,cAAc,EACdC,SAAS,QACJ,YAAY;AAEnB,SAASC,QAAQ,QAAQ,wBAAwB;;AAGjD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,OAAO,MAAMC,iBAAiB,GAAGC,IAAA;EAAA,IAC/BC,SAAS,GAAAD,IAAA,CAATC,SAAS;IACTC,MAAM,GAAAF,IAAA,CAANE,MAAM;IACNC,YAAY,GAAAH,IAAA,CAAZG,YAAY;IACZC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;EAAA,oBAERX,KAAA,CAAAY,aAAA,CAACX,uBAAuB;IACtB,eAAY,mBAAmB;IAC/BY,WAAW,EAAET,SAAU;IACvBU,OAAO,EAAEV;EAAU,gBAEnBJ,KAAA,CAAAY,aAAA,CAACV,mBAAmB;IAACa,IAAI,EAAC,QAAQ;IAACD,OAAO,EAAEN;EAAU,gBACpDR,KAAA,CAAAY,aAAA,CAACP,QAAQ;IAACW,SAAS,EAAC;EAAK,CAAE,CAAC,WAET,CAAC,eACtBhB,KAAA,CAAAY,aAAA,CAACT,cAAc;IACbM,MAAM,EAAEA,MAAO;IACfC,YAAY,EAAEA,YAAa;IAC3BC,QAAQ,EAAEA;EAAS,CACpB,CACsB,CAAC;AAAA,CAC3B;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMM,kBAAkB,GAC7BC,MAAoB,IACiC;EACrD,MAAMC,SAAS,GAAGD,MAAM,CAACE,IAAI,CAC1BC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CACbC,WAAW,CAAC,CAAC,CACbC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;EAEzB,OAAO;IACLC,MAAM,EAAE;MAAEC,KAAK,EAAEP,MAAM,CAACO,KAAK;MAAEC,QAAQ,EAAER,MAAM,CAACQ;IAAS,CAAC;IAC1DN,IAAI,EAAEF,MAAM,CAACE,IAAI;IACjBO,UAAU,EAAE,QAAQ;IACpBC,KAAK,GAAKT,SAAS,IAAID,MAAM,CAACQ,QAAQ,CAACJ,WAAW,CAAC,CAAC,uBAAmB;IACvEO,kBAAkB,EAAE,CAAC;IACrBC,UAAU,EAAE,qBAAqB;IACjCC,aAAa,EAAEA,CAAA,KAAMC,SAAS;IAC9BC,gBAAgB,EAAEA,CAAA,KAAMD;EAC1B,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"entityCardActions.js","names":["React","lockDeleteGroup","InfoIcon","ContextToolbar","PersonCardToolbar","_ref","onDetails","locked","onToggleLock","onDelete","createElement","groups","kind","label","icon","onClick","personDetailsProps","person","firstName","name","split","toLowerCase","replace","avatar","color","initials","hoursLabel","email","extraContactsCount","joinedDate","onSendMessage","undefined","onSeeFullProfile"],"sources":["../../../../src/presentation/whiteboard/entityCardActions.tsx"],"sourcesContent":["import React, { ReactElement } from \"react\";\n\nimport { lockDeleteGroup } from \"./elementToolbars\";\nimport { PickerPerson } from \"./projectElements\";\nimport { InfoIcon } from \"../../components/Icons\";\nimport type { UserDetailsDialogProps } from \"../shared\";\nimport { ContextToolbar } from \"../whiteboardModern/contextToolbar\";\n\n/* ------------------------------------------------------------------ */\n/* Selection menu for the person element */\n/* ------------------------------------------------------------------ */\n\n/**\n * The selection toolbar for a PERSON element.\n *\n * A person is not a page you visit and not a link you copy — it is an avatar\n * chip — so its bar drops both of the entity card's leading actions and offers\n * exactly one: Details, which opens the user details dialog. The trailing\n * Lock · Delete group is the same one every other lockable element on this\n * board carries, so the bar reads as: Details | Lock · Delete.\n *\n * Which STATES get a toolbar is the caller's business (the canvas layer already\n * knows every element's status): only a resolved, non-limited person does. A\n * limited person must not offer a single one of these, and a placeholder or a\n * resolving skeleton has no person to act on yet.\n */\nexport interface PersonCardToolbarProps {\n onDetails: () => void;\n locked: boolean;\n onToggleLock: () => void;\n onDelete: () => void;\n}\n\nexport const PersonCardToolbar = ({\n onDetails,\n locked,\n onToggleLock,\n onDelete,\n}: PersonCardToolbarProps): ReactElement => (\n <ContextToolbar\n groups={[\n [\n {\n kind: \"action\",\n label: \"Details\",\n icon: <InfoIcon />,\n onClick: onDetails,\n },\n ],\n lockDeleteGroup(locked, onToggleLock, onDelete),\n ]}\n />\n);\n\n/**\n * The person data the whiteboard feeds the reusable `UserDetailsDialog` when a\n * person's Details button is clicked.\n *\n * The board only knows a person's name / initials / avatar colour, so the rest\n * of the dialog's fields are representative sample data (a working-hours pill, a\n * derived email with one extra contact, and a joined date) — the dialog itself\n * takes everything as props and hardcodes none of it. `open` and `onClose` are\n * supplied by the caller that renders the dialog.\n */\nexport const personDetailsProps = (\n person: PickerPerson\n): Omit<UserDetailsDialogProps, \"open\" | \"onClose\"> => {\n const firstName = person.name\n .split(\" \")[0]\n .toLowerCase()\n .replace(/[^a-z]/g, \"\");\n\n return {\n avatar: { color: person.color, initials: person.initials },\n name: person.name,\n hoursLabel: \"40 h/w\",\n email: `${firstName || person.initials.toLowerCase()}@activecollab.com`,\n extraContactsCount: 1,\n joinedDate: \"Joined: Feb 7. 2009\",\n onSendMessage: () => undefined,\n onSeeFullProfile: () => undefined,\n };\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAwB,OAAO;AAE3C,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,SAASC,QAAQ,QAAQ,wBAAwB;AAEjD,SAASC,cAAc,QAAQ,oCAAoC;;AAEnE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,OAAO,MAAMC,iBAAiB,GAAGC,IAAA;EAAA,IAC/BC,SAAS,GAAAD,IAAA,CAATC,SAAS;IACTC,MAAM,GAAAF,IAAA,CAANE,MAAM;IACNC,YAAY,GAAAH,IAAA,CAAZG,YAAY;IACZC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;EAAA,oBAERT,KAAA,CAAAU,aAAA,CAACP,cAAc;IACbQ,MAAM,EAAE,CACN,CACE;MACEC,IAAI,EAAE,QAAQ;MACdC,KAAK,EAAE,SAAS;MAChBC,IAAI,eAAEd,KAAA,CAAAU,aAAA,CAACR,QAAQ,MAAE,CAAC;MAClBa,OAAO,EAAET;IACX,CAAC,CACF,EACDL,eAAe,CAACM,MAAM,EAAEC,YAAY,EAAEC,QAAQ,CAAC;EAC/C,CACH,CAAC;AAAA,CACH;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMO,kBAAkB,GAC7BC,MAAoB,IACiC;EACrD,MAAMC,SAAS,GAAGD,MAAM,CAACE,IAAI,CAC1BC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CACbC,WAAW,CAAC,CAAC,CACbC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;EAEzB,OAAO;IACLC,MAAM,EAAE;MAAEC,KAAK,EAAEP,MAAM,CAACO,KAAK;MAAEC,QAAQ,EAAER,MAAM,CAACQ;IAAS,CAAC;IAC1DN,IAAI,EAAEF,MAAM,CAACE,IAAI;IACjBO,UAAU,EAAE,QAAQ;IACpBC,KAAK,GAAKT,SAAS,IAAID,MAAM,CAACQ,QAAQ,CAACJ,WAAW,CAAC,CAAC,uBAAmB;IACvEO,kBAAkB,EAAE,CAAC;IACrBC,UAAU,EAAE,qBAAqB;IACjCC,aAAa,EAAEA,CAAA,KAAMC,SAAS;IAC9BC,gBAAgB,EAAEA,CAAA,KAAMD;EAC1B,CAAC;AACH,CAAC","ignoreList":[]}
@@ -77,7 +77,7 @@ export interface FileToolbarProps {
77
77
  onRetry?: () => void;
78
78
  onDelete: () => void;
79
79
  }
80
- export declare const FileFormattingToolbar: ({ status, onPick, onCancel, onRetry, onDelete, }: FileToolbarProps) => ReactElement;
80
+ export declare const FileFormattingToolbar: ({ onDelete, ...phase }: FileToolbarProps) => ReactElement;
81
81
  export interface FileUploadCardProps {
82
82
  element: FileElementDef;
83
83
  selected: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"fileElement.d.ts","sourceRoot":"","sources":["../../../../src/presentation/whiteboard/fileElement.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,YAAY,EAKb,MAAM,OAAO,CAAC;AASf,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAwBnD;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAItC,eAAO,MAAM,gBAAgB,QAAmB,CAAC;AAEjD,eAAO,MAAM,cAAc,MAAM,CAAC;AAClC,eAAO,MAAM,WAAW,IAAI,CAAC;AAE7B,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC,+CAA+C;AAC/C,MAAM,WAAW,UAAU;IACzB,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EA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3D,CAAC;AAEJ,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,yEAAyE;IACzE,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACjC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,GAAI,0EAQzB,gBAAgB,KAAG,YAyGrB,CAAC"}
@@ -1,14 +1,16 @@
1
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
1
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
+ const _excluded = ["onDelete"];
2
4
  import React, { useCallback, useEffect, useRef, useState } from "react";
3
5
  import styled from "styled-components";
4
- import { StyledFormattingToolbar, StyledToolbarButton, stopClick } from "./elements";
5
- import { ArrowRefreshIcon, AttachmentIcon, CloseIcon, DownloadIcon, TrashIcon, UploadIcon } from "../../components/Icons";
6
+ import { trashGroup } from "./elementToolbars";
7
+ import { ArrowRefreshIcon, AttachmentIcon, CloseIcon, DownloadIcon, UploadIcon } from "../../components/Icons";
6
8
  import { SpinnerLoader } from "../../components/Loaders";
7
9
  import { ProgressRing } from "../../components/ProgressRing";
8
10
  import { StackedCard, StackedCardCover, StackedCardRow } from "../../components/StackedCard";
9
- import { Tooltip } from "../../components/Tooltip";
10
11
  import { Body2, Caption1, Caption2 } from "../../components/Typography";
11
12
  import { COVER_RATIO_IMAGE, Placeholder } from "../stackedCard/content";
13
+ import { ContextToolbar } from "../whiteboardModern/contextToolbar";
12
14
 
13
15
  /* ------------------------------------------------------------------ */
14
16
  /* File element — the upload lifecycle + the file card */
@@ -222,63 +224,68 @@ export const FilePlaceholder = props => /*#__PURE__*/React.createElement(StyledP
222
224
  dashed: true,
223
225
  "data-drag-through": ""
224
226
  }, props)));
225
- /* The file element's floating toolbar. The leading action is whatever the
226
- current phase makes meaningful; Move to Trash is always available. */
227
- export const FileFormattingToolbar = _ref2 => {
227
+ /* The leading action is whatever the current phase makes meaningful. */
228
+ const fileActions = _ref2 => {
228
229
  let status = _ref2.status,
229
230
  onPick = _ref2.onPick,
230
231
  onCancel = _ref2.onCancel,
231
- onRetry = _ref2.onRetry,
232
- onDelete = _ref2.onDelete;
233
- return /*#__PURE__*/React.createElement(StyledFormattingToolbar, {
234
- onMouseDown: stopClick,
235
- onClick: stopClick
236
- }, status === "placeholder" ? /*#__PURE__*/React.createElement(StyledToolbarButton, {
237
- type: "button",
238
- onClick: onPick
239
- }, /*#__PURE__*/React.createElement(UploadIcon, {
240
- className: "i16"
241
- }), "Upload") : null, status === "uploading" || status === "preparing" ? /*#__PURE__*/React.createElement(StyledToolbarButton, {
242
- type: "button",
232
+ onRetry = _ref2.onRetry;
233
+ const cancel = {
234
+ kind: "action",
235
+ label: "Cancel",
236
+ icon: /*#__PURE__*/React.createElement(CloseIcon, null),
243
237
  onClick: onCancel
244
- }, /*#__PURE__*/React.createElement(CloseIcon, {
245
- className: "i16"
246
- }), "Cancel") : null, status === "error" ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledToolbarButton, {
247
- type: "button",
248
- onClick: onRetry
249
- }, /*#__PURE__*/React.createElement(ArrowRefreshIcon, {
250
- className: "i16"
251
- }), "Retry"), /*#__PURE__*/React.createElement(StyledToolbarButton, {
252
- type: "button",
253
- onClick: onCancel
254
- }, /*#__PURE__*/React.createElement(CloseIcon, {
255
- className: "i16"
256
- }), "Cancel")) : null, status === "ready" ? /*#__PURE__*/React.createElement(StyledToolbarButton, {
257
- type: "button"
258
- }, /*#__PURE__*/React.createElement(DownloadIcon, {
259
- className: "i16"
260
- }), "Download") : null, /*#__PURE__*/React.createElement("span", {
261
- className: "divider"
262
- }), /*#__PURE__*/React.createElement(Tooltip, {
263
- title: "Move to Trash"
264
- }, /*#__PURE__*/React.createElement(StyledToolbarButton, {
265
- type: "button",
266
- className: "icon-only",
267
- onClick: onDelete
268
- }, /*#__PURE__*/React.createElement(TrashIcon, {
269
- className: "i16"
270
- }))));
238
+ };
239
+ switch (status) {
240
+ case "placeholder":
241
+ return [{
242
+ kind: "action",
243
+ label: "Upload",
244
+ icon: /*#__PURE__*/React.createElement(UploadIcon, null),
245
+ onClick: onPick
246
+ }];
247
+ case "uploading":
248
+ case "preparing":
249
+ return [cancel];
250
+ /* A failed upload needs a way back to the placeholder too — otherwise a
251
+ file that can never succeed leaves trashing the card as the only exit. */
252
+ case "error":
253
+ return [{
254
+ kind: "action",
255
+ label: "Retry",
256
+ icon: /*#__PURE__*/React.createElement(ArrowRefreshIcon, null),
257
+ onClick: onRetry
258
+ }, cancel];
259
+ /* Inert, like the board's other export-shaped actions — there is no real
260
+ stored file behind a mock. */
261
+ case "ready":
262
+ return [{
263
+ kind: "action",
264
+ label: "Download",
265
+ icon: /*#__PURE__*/React.createElement(DownloadIcon, null)
266
+ }];
267
+ }
268
+ };
269
+
270
+ /* The file element's floating toolbar: the phase's action, then Move to
271
+ Trash, which is always available. */
272
+ export const FileFormattingToolbar = _ref3 => {
273
+ let onDelete = _ref3.onDelete,
274
+ phase = _objectWithoutPropertiesLoose(_ref3, _excluded);
275
+ return /*#__PURE__*/React.createElement(ContextToolbar, {
276
+ groups: [fileActions(phase), trashGroup(onDelete)]
277
+ });
271
278
  };
272
279
  /**
273
280
  * A file element with a file attached: the card runs the upload lifecycle and
274
281
  * then renders the finished preview.
275
282
  */
276
- export const FileUploadCard = _ref3 => {
277
- let element = _ref3.element,
278
- selected = _ref3.selected,
279
- resize = _ref3.resize,
280
- onCancel = _ref3.onCancel,
281
- onDelete = _ref3.onDelete;
283
+ export const FileUploadCard = _ref4 => {
284
+ let element = _ref4.element,
285
+ selected = _ref4.selected,
286
+ resize = _ref4.resize,
287
+ onCancel = _ref4.onCancel,
288
+ onDelete = _ref4.onDelete;
282
289
  const file = element.file;
283
290
  const upload = useMockUpload(file);
284
291
  const ready = upload.status === "ready";
@@ -341,14 +348,14 @@ export const renderFileThumbnail = file => file != null && file.thumbnailUrl ? /
341
348
  * picker fires no change, so the card simply stays a placeholder — which is what
342
349
  * makes Esc a no-op by construction rather than by handling.
343
350
  */
344
- export const FileElement = _ref4 => {
345
- let element = _ref4.element,
346
- selected = _ref4.selected,
347
- autoOpen = _ref4.autoOpen,
348
- onPickFile = _ref4.onPickFile,
349
- resize = _ref4.resize,
350
- onCancel = _ref4.onCancel,
351
- onDelete = _ref4.onDelete;
351
+ export const FileElement = _ref5 => {
352
+ let element = _ref5.element,
353
+ selected = _ref5.selected,
354
+ autoOpen = _ref5.autoOpen,
355
+ onPickFile = _ref5.onPickFile,
356
+ resize = _ref5.resize,
357
+ onCancel = _ref5.onCancel,
358
+ onDelete = _ref5.onDelete;
352
359
  const inputRef = useRef(null);
353
360
  const _useState3 = useState(false),
354
361
  dropping = _useState3[0],
@@ -1 +1 @@
1
- {"version":3,"file":"fileElement.js","names":["React","useCallback","useEffect","useRef","useState","styled","StyledFormattingToolbar","StyledToolbarButton","stopClick","ArrowRefreshIcon","AttachmentIcon","CloseIcon","DownloadIcon","TrashIcon","UploadIcon","SpinnerLoader","ProgressRing","StackedCard","StackedCardCover","StackedCardRow","Tooltip","Body2","Caption1","Caption2","COVER_RATIO_IMAGE","Placeholder","FILE_DEFAULT_WIDTH","MAX_UPLOAD_BYTES","UPLOAD_TICK_MS","UPLOAD_STEP","PREPARING_MS","FILE_SIZE_UNITS","formatFileSize","value","_ref","unit","bytes","inUnit","toFixed","Math","trunc","describeFile","file","dot","name","lastIndexOf","hasExtension","base","slice","extension","size","mimeType","type","thumbnailUrl","startsWith","URL","createObjectURL","revokeThumbnail","revokeObjectURL","binaryFrom","data","files","length","item","Array","from","_data$items","items","kind","picked","getAsFile","useMockUpload","_useState","status","setStatus","_useState2","progress","setProgress","timers","ticker","progressRef","clearAll","current","forEach","clearTimeout","clearInterval","retry","push","setTimeout","setInterval","min","StyledFileCard","withConfig","displayName","componentId","StyledUploadCover","div","StyledFileFallback","StyledFileName","StyledDropOverlay","StyledHiddenFileInput","input","StyledPlaceholderBox","FilePlaceholder","props","createElement","_extends","icon","label","dashed","FileFormattingToolbar","_ref2","onPick","onCancel","onRetry","onDelete","onMouseDown","onClick","className","Fragment","title","FileUploadCard","_ref3","element","selected","resize","upload","ready","resizable","resizeAxis","resizeLabel","aspectRatio","renderFileThumbnail","radius","stroke","weight","color","style","cursor","role","src","alt","toUpperCase","FileElement","_ref4","autoOpen","onPickFile","inputRef","_useState3","dropping","setDropping","openPicker","_inputRef$current","click","handleInputChange","event","_event$target$files","target","handleDrop","preventDefault","stopPropagation","dropped","dataTransfer","ref","onChange","bleed","onDragEnter","onDragOver","onDragLeave","currentTarget","contains","relatedTarget","onDrop"],"sources":["../../../../src/presentation/whiteboard/fileElement.tsx"],"sourcesContent":["import React, {\n ReactElement,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\n\nimport styled from \"styled-components\";\n\nimport {\n StyledFormattingToolbar,\n StyledToolbarButton,\n stopClick,\n} from \"./elements\";\nimport { CardResizeHandlers } from \"./linkElement\";\nimport {\n ArrowRefreshIcon,\n AttachmentIcon,\n CloseIcon,\n DownloadIcon,\n TrashIcon,\n UploadIcon,\n} from \"../../components/Icons\";\nimport { SpinnerLoader } from \"../../components/Loaders\";\nimport { ProgressRing } from \"../../components/ProgressRing\";\nimport {\n StackedCard,\n StackedCardCover,\n StackedCardRow,\n} from \"../../components/StackedCard\";\nimport { Tooltip } from \"../../components/Tooltip\";\nimport { Body2, Caption1, Caption2 } from \"../../components/Typography\";\nimport { COVER_RATIO_IMAGE, Placeholder } from \"../stackedCard/content\";\n\n/* ------------------------------------------------------------------ */\n/* File element — the upload lifecycle + the file card */\n/* ------------------------------------------------------------------ */\n\n/**\n * The file card is the second element built on `StackedCard`, and it mirrors the\n * card in a project's Files tab (`Folders/GridView/Items/File.js`): a thumbnail\n * over a strip with the name, then size · date.\n *\n * Its lifecycle is the app's real upload lifecycle, which is two phases and not\n * one — the distinction the ring alone doesn't tell you:\n *\n * uploading XHR progress 0–100. `ProgressRing radius={22} stroke={4}` with\n * the percentage, exactly as `Items/FileUpload.js` does it.\n * preparing bytes are in, the server is generating the thumbnail. Progress\n * is no longer knowable, so the ring gives way to the\n * indeterminate `SpinnerLoader` at the same size — again as the\n * real card does at `progress === 100`.\n * ready the thumbnail exists; the card renders it.\n * error the upload failed: retry, same as the app's `ArrowRefreshIcon`.\n *\n * Both phases reserve the same box as the finished cover, so a card never\n * reflows as it climbs — the discipline the unfurl ladder established.\n */\n\n/* The Files-tab card is a fixed 208×208. On a canvas the width is the host's,\n so 208 is only the default a click-placed card takes. */\nexport const FILE_DEFAULT_WIDTH = 208;\n\n/* Big enough to be worth refusing, so the error state is reachable: the server\n enforces the real limits (and answers StorageOverusedError when full). */\nexport const MAX_UPLOAD_BYTES = 25 * 1024 * 1024;\n\nexport const UPLOAD_TICK_MS = 110;\nexport const UPLOAD_STEP = 9;\n/* How long the server spends making a thumbnail once the bytes have landed. */\nexport const PREPARING_MS = 1100;\n\n/** What the mock keeps about a picked file. */\nexport interface PickedFile {\n /** Name without the extension — truncates on its own. */\n base: string;\n /** Extension without the dot; never truncated, as in the real card. */\n extension: string;\n size: number;\n mimeType: string;\n /** An object URL, so an image really renders. Null for everything else. */\n thumbnailUrl: string | null;\n}\n\n/** A file element on the board. Position lives in the shared positions map. */\nexport interface FileElementDef {\n id: string;\n width: number;\n /** null while the card is an empty placeholder waiting for a file. */\n file: PickedFile | null;\n}\n\n/* Angie.functions.format_file_size — two decimals, no space, lower-case k.\n \"1.20MB\", not \"1.2 MB\". Reproduced exactly so the mock reads like the app. */\nexport const FILE_SIZE_UNITS: [string, number][] = [\n [\"TB\", 1099511627776],\n [\"GB\", 1073741824],\n [\"MB\", 1048576],\n [\"kB\", 1024],\n];\n\nexport const formatFileSize = (value: number): string => {\n for (const [unit, bytes] of FILE_SIZE_UNITS) {\n const inUnit = value / bytes;\n if (inUnit > 0.9) {\n return `${inUnit.toFixed(2)}${unit}`;\n }\n }\n\n return `${Math.trunc(value)}B`;\n};\n\nexport const describeFile = (file: File): PickedFile => {\n const dot = file.name.lastIndexOf(\".\");\n const hasExtension = dot > 0;\n\n return {\n base: hasExtension ? file.name.slice(0, dot) : file.name,\n extension: hasExtension ? file.name.slice(dot + 1) : \"\",\n size: file.size,\n mimeType: file.type,\n // Images get a real thumbnail; the server would generate one for every type,\n // but the mock can only show what the browser can already decode.\n thumbnailUrl: file.type.startsWith(\"image/\")\n ? URL.createObjectURL(file)\n : null,\n };\n};\n\n/* Object URLs are a manual allocation — release one whenever the file it stands\n for stops being on the board. */\nexport const revokeThumbnail = (file: PickedFile | null): void => {\n if (file?.thumbnailUrl) {\n URL.revokeObjectURL(file.thumbnailUrl);\n }\n};\n\n/** The first actual file on a clipboard or a drop, or null if there is none. */\nexport const binaryFrom = (data: DataTransfer | null): File | null => {\n if (!data) {\n return null;\n }\n\n if (data.files && data.files.length > 0) {\n return data.files[0];\n }\n\n // A screenshot paste arrives as an item, not in `files`.\n for (const item of Array.from(data.items ?? [])) {\n if (item.kind === \"file\") {\n const picked = item.getAsFile();\n if (picked) {\n return picked;\n }\n }\n }\n\n return null;\n};\n\nexport type UploadStatus = \"uploading\" | \"preparing\" | \"ready\" | \"error\";\n\nexport interface UploadController {\n status: UploadStatus;\n /** 0–100, as the app's XHR reports it. Only meaningful while uploading. */\n progress: number;\n retry: () => void;\n}\n\n/**\n * Drives one file through the upload lifecycle. Stands in for\n * `useFileHandler` + the XHR in `utils/upload.jsx`: ticks progress to 100,\n * hands over to the thumbnail phase, then resolves.\n */\nexport const useMockUpload = (file: PickedFile | null): UploadController => {\n const [status, setStatus] = useState<UploadStatus>(\"uploading\");\n const [progress, setProgress] = useState(0);\n\n const timers = useRef<ReturnType<typeof setTimeout>[]>([]);\n const ticker = useRef<ReturnType<typeof setInterval> | null>(null);\n const progressRef = useRef(0);\n\n const clearAll = useCallback(() => {\n timers.current.forEach(clearTimeout);\n timers.current = [];\n if (ticker.current) {\n clearInterval(ticker.current);\n ticker.current = null;\n }\n }, []);\n\n const retry = useCallback(() => {\n clearAll();\n progressRef.current = 0;\n setProgress(0);\n setStatus(\"uploading\");\n\n if (!file) {\n return;\n }\n\n if (file.size > MAX_UPLOAD_BYTES) {\n timers.current.push(setTimeout(() => setStatus(\"error\"), 700));\n\n return;\n }\n\n ticker.current = setInterval(() => {\n progressRef.current = Math.min(100, progressRef.current + UPLOAD_STEP);\n setProgress(progressRef.current);\n\n if (progressRef.current >= 100) {\n clearAll();\n // The bytes are up; the thumbnail is the server's job now.\n setStatus(\"preparing\");\n timers.current.push(setTimeout(() => setStatus(\"ready\"), PREPARING_MS));\n }\n }, UPLOAD_TICK_MS);\n }, [clearAll, file]);\n\n useEffect(() => {\n retry();\n\n return clearAll;\n }, [retry, clearAll]);\n\n return { status, progress, retry };\n};\n\n/* The card fills the box the board drew; height stays auto. */\nexport const StyledFileCard = styled(StackedCard)`\n && {\n width: 100%;\n }\n\n user-select: none;\n`;\n\n/* The cover while uploading or preparing — the ring/spinner centred in the box\n the finished thumbnail will occupy, so resolving never reflows the card. */\nexport const StyledUploadCover = styled.div`\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 10px;\n width: 100%;\n height: 100%;\n background-color: var(--color-theme-200);\n`;\n\n/* No thumbnail (the browser can't decode a .zip): the clip plus the extension.\n The real card has NO type-icon fallback — it renders a bare <img> and trusts\n the server — so this is net-new and worth a decision. */\nexport const StyledFileFallback = styled.div`\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 8px;\n width: 100%;\n height: 100%;\n background-color: var(--color-theme-200);\n color: var(--color-theme-600);\n\n > svg {\n width: 36px;\n height: 36px;\n fill: var(--color-theme-500);\n }\n`;\n\n/* Name row: the base name truncates, the extension never does — the same split\n the real card makes with removeExtensionFromFileName. */\nexport const StyledFileName = styled.div`\n display: flex;\n align-items: baseline;\n min-width: 0;\n width: 100%;\n\n .file-base {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .file-ext {\n flex-shrink: 0;\n }\n`;\n\n/* The drop overlay, from directive.ang_drop_files.less: a near-opaque cover\n with a 2px dashed primary border and \"Drop here\". The app sets 24px type for\n a full-page target; on a card it reads at Body2. */\nexport const StyledDropOverlay = styled.div`\n position: absolute;\n inset: 0;\n z-index: 3;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 8px;\n box-sizing: border-box;\n background-color: var(--page-paper-main);\n\n .drop-box {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n border: 2px dashed var(--color-primary);\n border-radius: 6px;\n }\n`;\n\nexport const StyledHiddenFileInput = styled.input`\n display: none;\n`;\n\n/* The placeholder reserves the same box the finished cover will occupy — the\n cover's ratio, not a pixel height — so attaching a file does not resize the\n card under the pointer. Placeholder's own fixed height is overridden here;\n the descendant selector outranks its class. */\nexport const StyledPlaceholderBox = styled.div`\n width: 100%;\n aspect-ratio: ${COVER_RATIO_IMAGE};\n\n > button {\n height: 100%;\n }\n`;\n\n/* The interactive empty state, in the shared placeholder frame the other card\n types use. Doubles as the drop target, like its copy promises. */\nexport const FilePlaceholder = (\n props: React.ButtonHTMLAttributes<HTMLButtonElement>\n): ReactElement => (\n <StyledPlaceholderBox>\n {/* Fills the card, so it has to be draggable as well as clickable. */}\n <Placeholder\n icon={<AttachmentIcon />}\n label=\"Drop a file or click to upload\"\n dashed\n data-drag-through=\"\"\n {...props}\n />\n </StyledPlaceholderBox>\n);\n\nexport interface FileToolbarProps {\n status: UploadStatus | \"placeholder\";\n /* Each phase only supplies the actions its own buttons need. */\n onPick?: () => void;\n onCancel?: () => void;\n onRetry?: () => void;\n onDelete: () => void;\n}\n\n/* The file element's floating toolbar. The leading action is whatever the\n current phase makes meaningful; Move to Trash is always available. */\nexport const FileFormattingToolbar = ({\n status,\n onPick,\n onCancel,\n onRetry,\n onDelete,\n}: FileToolbarProps): ReactElement => (\n <StyledFormattingToolbar onMouseDown={stopClick} onClick={stopClick}>\n {status === \"placeholder\" ? (\n <StyledToolbarButton type=\"button\" onClick={onPick}>\n <UploadIcon className=\"i16\" />\n Upload\n </StyledToolbarButton>\n ) : null}\n {status === \"uploading\" || status === \"preparing\" ? (\n <StyledToolbarButton type=\"button\" onClick={onCancel}>\n <CloseIcon className=\"i16\" />\n Cancel\n </StyledToolbarButton>\n ) : null}\n {status === \"error\" ? (\n <>\n <StyledToolbarButton type=\"button\" onClick={onRetry}>\n <ArrowRefreshIcon className=\"i16\" />\n Retry\n </StyledToolbarButton>\n {/* A failed upload needs a way back to the placeholder too — otherwise\n a file that can never succeed leaves trashing the card as the only\n exit. */}\n <StyledToolbarButton type=\"button\" onClick={onCancel}>\n <CloseIcon className=\"i16\" />\n Cancel\n </StyledToolbarButton>\n </>\n ) : null}\n {/* Inert, like the board's other export-shaped actions — there is no real\n stored file behind a mock. */}\n {status === \"ready\" ? (\n <StyledToolbarButton type=\"button\">\n <DownloadIcon className=\"i16\" />\n Download\n </StyledToolbarButton>\n ) : null}\n <span className=\"divider\" />\n <Tooltip title=\"Move to Trash\">\n <StyledToolbarButton\n type=\"button\"\n className=\"icon-only\"\n onClick={onDelete}\n >\n <TrashIcon className=\"i16\" />\n </StyledToolbarButton>\n </Tooltip>\n </StyledFormattingToolbar>\n);\n\nexport interface FileUploadCardProps {\n element: FileElementDef;\n selected: boolean;\n resize: CardResizeHandlers;\n onCancel: () => void;\n onDelete: () => void;\n}\n\n/**\n * A file element with a file attached: the card runs the upload lifecycle and\n * then renders the finished preview.\n */\nexport const FileUploadCard = ({\n element,\n selected,\n resize,\n onCancel,\n onDelete,\n}: FileUploadCardProps): ReactElement => {\n const file = element.file;\n const upload = useMockUpload(file);\n const ready = upload.status === \"ready\";\n\n return (\n <>\n <StyledFileCard\n selected={selected}\n resizable={selected}\n resizeAxis=\"width\"\n resizeLabel=\"Resize file card\"\n {...resize}\n >\n <StackedCardCover aspectRatio={COVER_RATIO_IMAGE}>\n {ready ? (\n renderFileThumbnail(file)\n ) : (\n <StyledUploadCover>\n {/* Determinate while the bytes move, indeterminate once they have\n landed — the app's own switch at progress === 100. */}\n {upload.status === \"uploading\" ? (\n <ProgressRing progress={upload.progress} radius={22} stroke={4}>\n <Caption2 weight=\"bold\" color=\"secondary\">\n {upload.progress}%\n </Caption2>\n </ProgressRing>\n ) : null}\n {upload.status === \"preparing\" ? (\n <SpinnerLoader radius={22} stroke={4} />\n ) : null}\n {upload.status === \"error\" ? (\n <ArrowRefreshIcon\n style={{ cursor: \"pointer\" }}\n onClick={upload.retry}\n />\n ) : null}\n <Caption2 color=\"tertiary\">\n {upload.status === \"uploading\" ? \"Uploading…\" : null}\n {upload.status === \"preparing\" ? \"Preparing preview…\" : null}\n {upload.status === \"error\" ? \"Upload failed\" : null}\n </Caption2>\n </StyledUploadCover>\n )}\n </StackedCardCover>\n\n <StackedCardRow role=\"title\">\n <StyledFileName>\n <Caption1 weight=\"bold\" className=\"file-base\">\n {file?.base}\n </Caption1>\n {file?.extension ? (\n <Caption1 weight=\"bold\" className=\"file-ext\">\n .{file.extension}\n </Caption1>\n ) : null}\n </StyledFileName>\n </StackedCardRow>\n\n {/* The real card hides its metadata until hover (max-height 0 → 55px).\n On a canvas the card is the object, not a row in a dense grid, so the\n line stays up — but it only says anything once the file exists. */}\n <StackedCardRow role=\"meta\">\n <Caption2 color=\"tertiary\">\n {ready && file ? `${formatFileSize(file.size)} · Just now` : \" \"}\n </Caption2>\n </StackedCardRow>\n </StyledFileCard>\n {selected ? (\n <FileFormattingToolbar\n status={upload.status}\n onCancel={onCancel}\n onRetry={upload.retry}\n onDelete={onDelete}\n />\n ) : null}\n </>\n );\n};\n\n/* An image renders for real; anything else falls back to the clip + extension. */\nexport const renderFileThumbnail = (file: PickedFile | null): ReactElement =>\n file?.thumbnailUrl ? (\n <img src={file.thumbnailUrl} alt=\"\" />\n ) : (\n <StyledFileFallback>\n <AttachmentIcon />\n <Caption2 color=\"tertiary\">\n {file?.extension ? file.extension.toUpperCase() : \"FILE\"}\n </Caption2>\n </StyledFileFallback>\n );\n\nexport interface FileElementProps {\n element: FileElementDef;\n selected: boolean;\n /** Open the file picker as soon as a freshly drawn placeholder lands. */\n autoOpen: boolean;\n onPickFile: (file: File) => void;\n resize: CardResizeHandlers;\n onCancel: () => void;\n onDelete: () => void;\n}\n\n/**\n * The two shapes of a file element: an empty placeholder that can be clicked or\n * dropped onto, and the uploading/ready card.\n *\n * A box drawn with the File tool opens the picker immediately. Dismissing the\n * picker fires no change, so the card simply stays a placeholder — which is what\n * makes Esc a no-op by construction rather than by handling.\n */\nexport const FileElement = ({\n element,\n selected,\n autoOpen,\n onPickFile,\n resize,\n onCancel,\n onDelete,\n}: FileElementProps): ReactElement => {\n const inputRef = useRef<HTMLInputElement | null>(null);\n const [dropping, setDropping] = useState(false);\n\n const openPicker = useCallback(() => {\n inputRef.current?.click();\n }, []);\n\n useEffect(() => {\n if (autoOpen) {\n openPicker();\n }\n }, [autoOpen, openPicker]);\n\n const handleInputChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>): void => {\n const picked = event.target.files?.[0];\n if (picked) {\n onPickFile(picked);\n }\n // Let the same file be chosen again after a cancel or a delete.\n event.target.value = \"\";\n },\n [onPickFile]\n );\n\n const handleDrop = useCallback(\n (event: React.DragEvent): void => {\n event.preventDefault();\n event.stopPropagation();\n setDropping(false);\n\n const dropped = binaryFrom(event.dataTransfer);\n if (dropped) {\n onPickFile(dropped);\n }\n },\n [onPickFile]\n );\n\n const input = (\n <StyledHiddenFileInput\n ref={inputRef}\n type=\"file\"\n onChange={handleInputChange}\n />\n );\n\n if (element.file != null) {\n return (\n <>\n {input}\n <FileUploadCard\n element={element}\n selected={selected}\n resize={resize}\n onCancel={onCancel}\n onDelete={onDelete}\n />\n </>\n );\n }\n\n return (\n <>\n {input}\n <StyledFileCard selected={selected} aria-label=\"Empty file card\">\n <StackedCardRow\n role=\"custom\"\n bleed\n /* Marks this row as owning its own drops, so the board-level handler\n stands aside and lets the card take the file. */\n data-file-dropzone=\"\"\n onDragEnter={(event) => {\n event.preventDefault();\n setDropping(true);\n }}\n onDragOver={(event) => event.preventDefault()}\n onDragLeave={(event) => {\n // Ignore the leaves fired when crossing onto a child.\n if (!event.currentTarget.contains(event.relatedTarget as Node)) {\n setDropping(false);\n }\n }}\n onDrop={handleDrop}\n >\n <FilePlaceholder onClick={openPicker} />\n {dropping ? (\n <StyledDropOverlay>\n <span className=\"drop-box\">\n <Body2 color=\"secondary\">Drop here</Body2>\n </span>\n </StyledDropOverlay>\n ) : null}\n </StackedCardRow>\n </StyledFileCard>\n {selected ? (\n <FileFormattingToolbar\n status=\"placeholder\"\n onPick={openPicker}\n onDelete={onDelete}\n />\n ) : null}\n </>\n );\n};\n"],"mappings":";AAAA,OAAOA,KAAK,IAEVC,WAAW,EACXC,SAAS,EACTC,MAAM,EACNC,QAAQ,QACH,OAAO;AAEd,OAAOC,MAAM,MAAM,mBAAmB;AAEtC,SACEC,uBAAuB,EACvBC,mBAAmB,EACnBC,SAAS,QACJ,YAAY;AAEnB,SACEC,gBAAgB,EAChBC,cAAc,EACdC,SAAS,EACTC,YAAY,EACZC,SAAS,EACTC,UAAU,QACL,wBAAwB;AAC/B,SAASC,aAAa,QAAQ,0BAA0B;AACxD,SAASC,YAAY,QAAQ,+BAA+B;AAC5D,SACEC,WAAW,EACXC,gBAAgB,EAChBC,cAAc,QACT,8BAA8B;AACrC,SAASC,OAAO,QAAQ,0BAA0B;AAClD,SAASC,KAAK,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,6BAA6B;AACvE,SAASC,iBAAiB,EAAEC,WAAW,QAAQ,wBAAwB;;AAEvE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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MAAM,EAAC,aAAa;IACpBuC,MAAM,EAAEuC,UAAW;IACnBpC,QAAQ,EAAEA;EAAS,CACpB,CAAC,GACA,IACJ,CAAC;AAEP,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"fileElement.js","names":["React","useCallback","useEffect","useRef","useState","styled","trashGroup","ArrowRefreshIcon","AttachmentIcon","CloseIcon","DownloadIcon","UploadIcon","SpinnerLoader","ProgressRing","StackedCard","StackedCardCover","StackedCardRow","Body2","Caption1","Caption2","COVER_RATIO_IMAGE","Placeholder","ContextToolbar","FILE_DEFAULT_WIDTH","MAX_UPLOAD_BYTES","UPLOAD_TICK_MS","UPLOAD_STEP","PREPARING_MS","FILE_SIZE_UNITS","formatFileSize","value","_ref","unit","bytes","inUnit","toFixed","Math","trunc","describeFile","file","dot","name","lastIndexOf","hasExtension","base","slice","extension","size","mimeType","type","thumbnailUrl","startsWith","URL","createObjectURL","revokeThumbnail","revokeObjectURL","binaryFrom","data","files","length","item","Array","from","_data$items","items","kind","picked","getAsFile","useMockUpload","_useState","status","setStatus","_useState2","progress","setProgress","timers","ticker","progressRef","clearAll","current","forEach","clearTimeout","clearInterval","retry","push","setTimeout","setInterval","min","StyledFileCard","withConfig","displayName","componentId","StyledUploadCover","div","StyledFileFallback","StyledFileName","StyledDropOverlay","StyledHiddenFileInput","input","StyledPlaceholderBox","FilePlaceholder","props","createElement","_extends","icon","label","dashed","fileActions","_ref2","onPick","onCancel","onRetry","cancel","onClick","FileFormattingToolbar","_ref3","onDelete","phase","_objectWithoutPropertiesLoose","_excluded","groups","FileUploadCard","_ref4","element","selected","resize","upload","ready","Fragment","resizable","resizeAxis","resizeLabel","aspectRatio","renderFileThumbnail","radius","stroke","weight","color","style","cursor","role","className","src","alt","toUpperCase","FileElement","_ref5","autoOpen","onPickFile","inputRef","_useState3","dropping","setDropping","openPicker","_inputRef$current","click","handleInputChange","event","_event$target$files","target","handleDrop","preventDefault","stopPropagation","dropped","dataTransfer","ref","onChange","bleed","onDragEnter","onDragOver","onDragLeave","currentTarget","contains","relatedTarget","onDrop"],"sources":["../../../../src/presentation/whiteboard/fileElement.tsx"],"sourcesContent":["import React, {\n ReactElement,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\n\nimport styled from \"styled-components\";\n\nimport { trashGroup } from \"./elementToolbars\";\nimport { CardResizeHandlers } from \"./linkElement\";\nimport {\n ArrowRefreshIcon,\n AttachmentIcon,\n CloseIcon,\n DownloadIcon,\n UploadIcon,\n} from \"../../components/Icons\";\nimport { SpinnerLoader } from \"../../components/Loaders\";\nimport { ProgressRing } from \"../../components/ProgressRing\";\nimport {\n StackedCard,\n StackedCardCover,\n StackedCardRow,\n} from \"../../components/StackedCard\";\nimport { Body2, Caption1, Caption2 } from \"../../components/Typography\";\nimport { COVER_RATIO_IMAGE, Placeholder } from \"../stackedCard/content\";\nimport {\n ContextToolbar,\n ContextToolbarGroup,\n} from \"../whiteboardModern/contextToolbar\";\n\n/* ------------------------------------------------------------------ */\n/* File element — the upload lifecycle + the file card */\n/* ------------------------------------------------------------------ */\n\n/**\n * The file card is the second element built on `StackedCard`, and it mirrors the\n * card in a project's Files tab (`Folders/GridView/Items/File.js`): a thumbnail\n * over a strip with the name, then size · date.\n *\n * Its lifecycle is the app's real upload lifecycle, which is two phases and not\n * one — the distinction the ring alone doesn't tell you:\n *\n * uploading XHR progress 0–100. `ProgressRing radius={22} stroke={4}` with\n * the percentage, exactly as `Items/FileUpload.js` does it.\n * preparing bytes are in, the server is generating the thumbnail. Progress\n * is no longer knowable, so the ring gives way to the\n * indeterminate `SpinnerLoader` at the same size — again as the\n * real card does at `progress === 100`.\n * ready the thumbnail exists; the card renders it.\n * error the upload failed: retry, same as the app's `ArrowRefreshIcon`.\n *\n * Both phases reserve the same box as the finished cover, so a card never\n * reflows as it climbs — the discipline the unfurl ladder established.\n */\n\n/* The Files-tab card is a fixed 208×208. On a canvas the width is the host's,\n so 208 is only the default a click-placed card takes. */\nexport const FILE_DEFAULT_WIDTH = 208;\n\n/* Big enough to be worth refusing, so the error state is reachable: the server\n enforces the real limits (and answers StorageOverusedError when full). */\nexport const MAX_UPLOAD_BYTES = 25 * 1024 * 1024;\n\nexport const UPLOAD_TICK_MS = 110;\nexport const UPLOAD_STEP = 9;\n/* How long the server spends making a thumbnail once the bytes have landed. */\nexport const PREPARING_MS = 1100;\n\n/** What the mock keeps about a picked file. */\nexport interface PickedFile {\n /** Name without the extension — truncates on its own. */\n base: string;\n /** Extension without the dot; never truncated, as in the real card. */\n extension: string;\n size: number;\n mimeType: string;\n /** An object URL, so an image really renders. Null for everything else. */\n thumbnailUrl: string | null;\n}\n\n/** A file element on the board. Position lives in the shared positions map. */\nexport interface FileElementDef {\n id: string;\n width: number;\n /** null while the card is an empty placeholder waiting for a file. */\n file: PickedFile | null;\n}\n\n/* Angie.functions.format_file_size — two decimals, no space, lower-case k.\n \"1.20MB\", not \"1.2 MB\". Reproduced exactly so the mock reads like the app. */\nexport const FILE_SIZE_UNITS: [string, number][] = [\n [\"TB\", 1099511627776],\n [\"GB\", 1073741824],\n [\"MB\", 1048576],\n [\"kB\", 1024],\n];\n\nexport const formatFileSize = (value: number): string => {\n for (const [unit, bytes] of FILE_SIZE_UNITS) {\n const inUnit = value / bytes;\n if (inUnit > 0.9) {\n return `${inUnit.toFixed(2)}${unit}`;\n }\n }\n\n return `${Math.trunc(value)}B`;\n};\n\nexport const describeFile = (file: File): PickedFile => {\n const dot = file.name.lastIndexOf(\".\");\n const hasExtension = dot > 0;\n\n return {\n base: hasExtension ? file.name.slice(0, dot) : file.name,\n extension: hasExtension ? file.name.slice(dot + 1) : \"\",\n size: file.size,\n mimeType: file.type,\n // Images get a real thumbnail; the server would generate one for every type,\n // but the mock can only show what the browser can already decode.\n thumbnailUrl: file.type.startsWith(\"image/\")\n ? URL.createObjectURL(file)\n : null,\n };\n};\n\n/* Object URLs are a manual allocation — release one whenever the file it stands\n for stops being on the board. */\nexport const revokeThumbnail = (file: PickedFile | null): void => {\n if (file?.thumbnailUrl) {\n URL.revokeObjectURL(file.thumbnailUrl);\n }\n};\n\n/** The first actual file on a clipboard or a drop, or null if there is none. */\nexport const binaryFrom = (data: DataTransfer | null): File | null => {\n if (!data) {\n return null;\n }\n\n if (data.files && data.files.length > 0) {\n return data.files[0];\n }\n\n // A screenshot paste arrives as an item, not in `files`.\n for (const item of Array.from(data.items ?? [])) {\n if (item.kind === \"file\") {\n const picked = item.getAsFile();\n if (picked) {\n return picked;\n }\n }\n }\n\n return null;\n};\n\nexport type UploadStatus = \"uploading\" | \"preparing\" | \"ready\" | \"error\";\n\nexport interface UploadController {\n status: UploadStatus;\n /** 0–100, as the app's XHR reports it. Only meaningful while uploading. */\n progress: number;\n retry: () => void;\n}\n\n/**\n * Drives one file through the upload lifecycle. Stands in for\n * `useFileHandler` + the XHR in `utils/upload.jsx`: ticks progress to 100,\n * hands over to the thumbnail phase, then resolves.\n */\nexport const useMockUpload = (file: PickedFile | null): UploadController => {\n const [status, setStatus] = useState<UploadStatus>(\"uploading\");\n const [progress, setProgress] = useState(0);\n\n const timers = useRef<ReturnType<typeof setTimeout>[]>([]);\n const ticker = useRef<ReturnType<typeof setInterval> | null>(null);\n const progressRef = useRef(0);\n\n const clearAll = useCallback(() => {\n timers.current.forEach(clearTimeout);\n timers.current = [];\n if (ticker.current) {\n clearInterval(ticker.current);\n ticker.current = null;\n }\n }, []);\n\n const retry = useCallback(() => {\n clearAll();\n progressRef.current = 0;\n setProgress(0);\n setStatus(\"uploading\");\n\n if (!file) {\n return;\n }\n\n if (file.size > MAX_UPLOAD_BYTES) {\n timers.current.push(setTimeout(() => setStatus(\"error\"), 700));\n\n return;\n }\n\n ticker.current = setInterval(() => {\n progressRef.current = Math.min(100, progressRef.current + UPLOAD_STEP);\n setProgress(progressRef.current);\n\n if (progressRef.current >= 100) {\n clearAll();\n // The bytes are up; the thumbnail is the server's job now.\n setStatus(\"preparing\");\n timers.current.push(setTimeout(() => setStatus(\"ready\"), PREPARING_MS));\n }\n }, UPLOAD_TICK_MS);\n }, [clearAll, file]);\n\n useEffect(() => {\n retry();\n\n return clearAll;\n }, [retry, clearAll]);\n\n return { status, progress, retry };\n};\n\n/* The card fills the box the board drew; height stays auto. */\nexport const StyledFileCard = styled(StackedCard)`\n && {\n width: 100%;\n }\n\n user-select: none;\n`;\n\n/* The cover while uploading or preparing — the ring/spinner centred in the box\n the finished thumbnail will occupy, so resolving never reflows the card. */\nexport const StyledUploadCover = styled.div`\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 10px;\n width: 100%;\n height: 100%;\n background-color: var(--color-theme-200);\n`;\n\n/* No thumbnail (the browser can't decode a .zip): the clip plus the extension.\n The real card has NO type-icon fallback — it renders a bare <img> and trusts\n the server — so this is net-new and worth a decision. */\nexport const StyledFileFallback = styled.div`\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 8px;\n width: 100%;\n height: 100%;\n background-color: var(--color-theme-200);\n color: var(--color-theme-600);\n\n > svg {\n width: 36px;\n height: 36px;\n fill: var(--color-theme-500);\n }\n`;\n\n/* Name row: the base name truncates, the extension never does — the same split\n the real card makes with removeExtensionFromFileName. */\nexport const StyledFileName = styled.div`\n display: flex;\n align-items: baseline;\n min-width: 0;\n width: 100%;\n\n .file-base {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .file-ext {\n flex-shrink: 0;\n }\n`;\n\n/* The drop overlay, from directive.ang_drop_files.less: a near-opaque cover\n with a 2px dashed primary border and \"Drop here\". The app sets 24px type for\n a full-page target; on a card it reads at Body2. */\nexport const StyledDropOverlay = styled.div`\n position: absolute;\n inset: 0;\n z-index: 3;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 8px;\n box-sizing: border-box;\n background-color: var(--page-paper-main);\n\n .drop-box {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n border: 2px dashed var(--color-primary);\n border-radius: 6px;\n }\n`;\n\nexport const StyledHiddenFileInput = styled.input`\n display: none;\n`;\n\n/* The placeholder reserves the same box the finished cover will occupy — the\n cover's ratio, not a pixel height — so attaching a file does not resize the\n card under the pointer. Placeholder's own fixed height is overridden here;\n the descendant selector outranks its class. */\nexport const StyledPlaceholderBox = styled.div`\n width: 100%;\n aspect-ratio: ${COVER_RATIO_IMAGE};\n\n > button {\n height: 100%;\n }\n`;\n\n/* The interactive empty state, in the shared placeholder frame the other card\n types use. Doubles as the drop target, like its copy promises. */\nexport const FilePlaceholder = (\n props: React.ButtonHTMLAttributes<HTMLButtonElement>\n): ReactElement => (\n <StyledPlaceholderBox>\n {/* Fills the card, so it has to be draggable as well as clickable. */}\n <Placeholder\n icon={<AttachmentIcon />}\n label=\"Drop a file or click to upload\"\n dashed\n data-drag-through=\"\"\n {...props}\n />\n </StyledPlaceholderBox>\n);\n\nexport interface FileToolbarProps {\n status: UploadStatus | \"placeholder\";\n /* Each phase only supplies the actions its own buttons need. */\n onPick?: () => void;\n onCancel?: () => void;\n onRetry?: () => void;\n onDelete: () => void;\n}\n\n/* The leading action is whatever the current phase makes meaningful. */\nconst fileActions = ({\n status,\n onPick,\n onCancel,\n onRetry,\n}: Omit<FileToolbarProps, \"onDelete\">): ContextToolbarGroup => {\n const cancel = {\n kind: \"action\" as const,\n label: \"Cancel\",\n icon: <CloseIcon />,\n onClick: onCancel,\n };\n\n switch (status) {\n case \"placeholder\":\n return [\n {\n kind: \"action\",\n label: \"Upload\",\n icon: <UploadIcon />,\n onClick: onPick,\n },\n ];\n case \"uploading\":\n case \"preparing\":\n return [cancel];\n /* A failed upload needs a way back to the placeholder too — otherwise a\n file that can never succeed leaves trashing the card as the only exit. */\n case \"error\":\n return [\n {\n kind: \"action\",\n label: \"Retry\",\n icon: <ArrowRefreshIcon />,\n onClick: onRetry,\n },\n cancel,\n ];\n /* Inert, like the board's other export-shaped actions — there is no real\n stored file behind a mock. */\n case \"ready\":\n return [{ kind: \"action\", label: \"Download\", icon: <DownloadIcon /> }];\n }\n};\n\n/* The file element's floating toolbar: the phase's action, then Move to\n Trash, which is always available. */\nexport const FileFormattingToolbar = ({\n onDelete,\n ...phase\n}: FileToolbarProps): ReactElement => (\n <ContextToolbar groups={[fileActions(phase), trashGroup(onDelete)]} />\n);\n\nexport interface FileUploadCardProps {\n element: FileElementDef;\n selected: boolean;\n resize: CardResizeHandlers;\n onCancel: () => void;\n onDelete: () => void;\n}\n\n/**\n * A file element with a file attached: the card runs the upload lifecycle and\n * then renders the finished preview.\n */\nexport const FileUploadCard = ({\n element,\n selected,\n resize,\n onCancel,\n onDelete,\n}: FileUploadCardProps): ReactElement => {\n const file = element.file;\n const upload = useMockUpload(file);\n const ready = upload.status === \"ready\";\n\n return (\n <>\n <StyledFileCard\n selected={selected}\n resizable={selected}\n resizeAxis=\"width\"\n resizeLabel=\"Resize file card\"\n {...resize}\n >\n <StackedCardCover aspectRatio={COVER_RATIO_IMAGE}>\n {ready ? (\n renderFileThumbnail(file)\n ) : (\n <StyledUploadCover>\n {/* Determinate while the bytes move, indeterminate once they have\n landed — the app's own switch at progress === 100. */}\n {upload.status === \"uploading\" ? (\n <ProgressRing progress={upload.progress} radius={22} stroke={4}>\n <Caption2 weight=\"bold\" color=\"secondary\">\n {upload.progress}%\n </Caption2>\n </ProgressRing>\n ) : null}\n {upload.status === \"preparing\" ? (\n <SpinnerLoader radius={22} stroke={4} />\n ) : null}\n {upload.status === \"error\" ? (\n <ArrowRefreshIcon\n style={{ cursor: \"pointer\" }}\n onClick={upload.retry}\n />\n ) : null}\n <Caption2 color=\"tertiary\">\n {upload.status === \"uploading\" ? \"Uploading…\" : null}\n {upload.status === \"preparing\" ? \"Preparing preview…\" : null}\n {upload.status === \"error\" ? \"Upload failed\" : null}\n </Caption2>\n </StyledUploadCover>\n )}\n </StackedCardCover>\n\n <StackedCardRow role=\"title\">\n <StyledFileName>\n <Caption1 weight=\"bold\" className=\"file-base\">\n {file?.base}\n </Caption1>\n {file?.extension ? (\n <Caption1 weight=\"bold\" className=\"file-ext\">\n .{file.extension}\n </Caption1>\n ) : null}\n </StyledFileName>\n </StackedCardRow>\n\n {/* The real card hides its metadata until hover (max-height 0 → 55px).\n On a canvas the card is the object, not a row in a dense grid, so the\n line stays up — but it only says anything once the file exists. */}\n <StackedCardRow role=\"meta\">\n <Caption2 color=\"tertiary\">\n {ready && file ? `${formatFileSize(file.size)} · Just now` : \" \"}\n </Caption2>\n </StackedCardRow>\n </StyledFileCard>\n {selected ? (\n <FileFormattingToolbar\n status={upload.status}\n onCancel={onCancel}\n onRetry={upload.retry}\n onDelete={onDelete}\n />\n ) : null}\n </>\n );\n};\n\n/* An image renders for real; anything else falls back to the clip + extension. */\nexport const renderFileThumbnail = (file: PickedFile | null): ReactElement =>\n file?.thumbnailUrl ? (\n <img src={file.thumbnailUrl} alt=\"\" />\n ) : (\n <StyledFileFallback>\n <AttachmentIcon />\n <Caption2 color=\"tertiary\">\n {file?.extension ? file.extension.toUpperCase() : \"FILE\"}\n </Caption2>\n </StyledFileFallback>\n );\n\nexport interface FileElementProps {\n element: FileElementDef;\n selected: boolean;\n /** Open the file picker as soon as a freshly drawn placeholder lands. */\n autoOpen: boolean;\n onPickFile: (file: File) => void;\n resize: CardResizeHandlers;\n onCancel: () => void;\n onDelete: () => void;\n}\n\n/**\n * The two shapes of a file element: an empty placeholder that can be clicked or\n * dropped onto, and the uploading/ready card.\n *\n * A box drawn with the File tool opens the picker immediately. Dismissing the\n * picker fires no change, so the card simply stays a placeholder — which is what\n * makes Esc a no-op by construction rather than by handling.\n */\nexport const FileElement = ({\n element,\n selected,\n autoOpen,\n onPickFile,\n resize,\n onCancel,\n onDelete,\n}: FileElementProps): ReactElement => {\n const inputRef = useRef<HTMLInputElement | null>(null);\n const [dropping, setDropping] = useState(false);\n\n const openPicker = useCallback(() => {\n inputRef.current?.click();\n }, []);\n\n useEffect(() => {\n if (autoOpen) {\n openPicker();\n }\n }, [autoOpen, openPicker]);\n\n const handleInputChange = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>): void => {\n const picked = event.target.files?.[0];\n if (picked) {\n onPickFile(picked);\n }\n // Let the same file be chosen again after a cancel or a delete.\n event.target.value = \"\";\n },\n [onPickFile]\n );\n\n const handleDrop = useCallback(\n (event: React.DragEvent): void => {\n event.preventDefault();\n event.stopPropagation();\n setDropping(false);\n\n const dropped = binaryFrom(event.dataTransfer);\n if (dropped) {\n onPickFile(dropped);\n }\n },\n [onPickFile]\n );\n\n const input = (\n <StyledHiddenFileInput\n ref={inputRef}\n type=\"file\"\n onChange={handleInputChange}\n />\n );\n\n if (element.file != null) {\n return (\n <>\n {input}\n <FileUploadCard\n element={element}\n selected={selected}\n resize={resize}\n onCancel={onCancel}\n onDelete={onDelete}\n />\n </>\n );\n }\n\n return (\n <>\n {input}\n <StyledFileCard selected={selected} aria-label=\"Empty file card\">\n <StackedCardRow\n role=\"custom\"\n bleed\n /* Marks this row as owning its own drops, so the board-level handler\n stands aside and lets the card take the file. */\n data-file-dropzone=\"\"\n onDragEnter={(event) => {\n event.preventDefault();\n setDropping(true);\n }}\n onDragOver={(event) => event.preventDefault()}\n onDragLeave={(event) => {\n // Ignore the leaves fired when crossing onto a child.\n if (!event.currentTarget.contains(event.relatedTarget as Node)) {\n setDropping(false);\n }\n }}\n onDrop={handleDrop}\n >\n <FilePlaceholder onClick={openPicker} />\n {dropping ? (\n <StyledDropOverlay>\n <span className=\"drop-box\">\n <Body2 color=\"secondary\">Drop here</Body2>\n </span>\n </StyledDropOverlay>\n ) : null}\n </StackedCardRow>\n </StyledFileCard>\n {selected ? (\n <FileFormattingToolbar\n status=\"placeholder\"\n onPick={openPicker}\n onDelete={onDelete}\n />\n ) : null}\n </>\n );\n};\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAEVC,WAAW,EACXC,SAAS,EACTC,MAAM,EACNC,QAAQ,QACH,OAAO;AAEd,OAAOC,MAAM,MAAM,mBAAmB;AAEtC,SAASC,UAAU,QAAQ,mBAAmB;AAE9C,SACEC,gBA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C","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import React, { ReactElement } from "react";
2
- import { ShapeTool } from "./bottomDock";
2
+ import { ShapeTool } from "./boardTools";
3
3
  import { IStackedCardProps } from "../../components/StackedCard";
4
4
  import { LinkDisplay, MockLink } from "../stackedCard/content";
5
5
  /**
@@ -49,7 +49,7 @@ export declare const StyledShapePreview: import("styled-components").StyledCompo
49
49
  export declare const shapePreviewGlyph: (tool: ShapeTool, width: number, height: number) => ReactElement;
50
50
  export declare const StyledLinkDraft: import("styled-components").StyledComponent<"div", any, {}, never>;
51
51
  export interface LinkFormattingToolbarProps {
52
- url: string;
52
+ url: string | null;
53
53
  onEditUrl: () => void;
54
54
  onDelete: () => void;
55
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"linkElement.d.ts","sourceRoot":"","sources":["../../../../src/presentation/whiteboard/linkElement.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,YAAY,EAAsB,MAAM,OAAO,CAAC;AAIhE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAczC,OAAO,EAAE,iBAAiB,EAAe,MAAM,8BAA8B,CAAC;AAG9E,OAAO,EAEL,WAAW,EAGX,QAAQ,EAET,MAAM,wBAAwB,CAAC;AAShC;;;;;;;;;GASG;AAGH,eAAO,MAAM,cAAc,MAAM,CAAC;AAClC,eAAO,MAAM,cAAc,MAAM,CAAC;AAGlC,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,KAAG,MACwB,CAAC;AAExE,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAKtC,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,KAAG,OACO,CAAC;AAGvD,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,KAAG,MAKd,CAAC;AAK5B,eAAO,MAAM,YAAY,UAOxB,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,QAAQ,MAAM,EAAE,QAAQ,M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W,oBAAoB;IACnC,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,qDAM7B,oBAAoB,KAAG,YA6BzB,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,oEAAoE;IACpE,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,GAAI,iEAOzB,gBAAgB,KAAG,YA2ErB,CAAC"}
@@ -1,15 +1,16 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import React, { useEffect, useMemo } from "react";
3
3
  import styled from "styled-components";
4
- import { SELECTION_BLUE, SELECTION_WASH, StyledFormattingToolbar, StyledToolbarButton, StyledToolbarLink, stopClick } from "./elements";
5
- import { InsertLinkIcon, OpenExpandedIcon, TrashIcon } from "../../components/Icons";
4
+ import { SELECTION_BLUE, SELECTION_WASH } from "./elements";
5
+ import { trashGroup } from "./elementToolbars";
6
+ import { InsertLinkIcon, OpenExpandedIcon } from "../../components/Icons";
6
7
  import { StackedCard } from "../../components/StackedCard";
7
- import { Tooltip } from "../../components/Tooltip";
8
8
  import { Caption2 } from "../../components/Typography";
9
9
  import { LinkCard, LinkPlaceholder, MOCK_LINKS, useUnfurl } from "../stackedCard/content";
10
10
  import { useInlineEdit } from "../stackedCard/useInlineEdit";
11
11
  import linkCoverPhoto from "../static/stacked-card-cover.png";
12
12
  import linkHeroPhoto from "../static/stacked-card-hero.png";
13
+ import { ContextToolbar } from "../whiteboardModern/contextToolbar";
13
14
 
14
15
  /* ------------------------------------------------------------------ */
15
16
  /* Link element — StackedCard + the URL unfurl lifecycle */
@@ -165,31 +166,21 @@ export const LinkFormattingToolbar = _ref2 => {
165
166
  let url = _ref2.url,
166
167
  onEditUrl = _ref2.onEditUrl,
167
168
  onDelete = _ref2.onDelete;
168
- return /*#__PURE__*/React.createElement(StyledFormattingToolbar, {
169
- onMouseDown: stopClick,
170
- onClick: stopClick
171
- }, /*#__PURE__*/React.createElement(StyledToolbarLink, {
172
- href: url,
173
- target: "_blank",
174
- rel: "noopener noreferrer"
175
- }, /*#__PURE__*/React.createElement(OpenExpandedIcon, {
176
- className: "i16"
177
- }), "Visit"), /*#__PURE__*/React.createElement(StyledToolbarButton, {
178
- type: "button",
179
- onClick: onEditUrl
180
- }, /*#__PURE__*/React.createElement(InsertLinkIcon, {
181
- className: "i16"
182
- }), "Edit"), /*#__PURE__*/React.createElement("span", {
183
- className: "divider"
184
- }), /*#__PURE__*/React.createElement(Tooltip, {
185
- title: "Move to Trash"
186
- }, /*#__PURE__*/React.createElement(StyledToolbarButton, {
187
- type: "button",
188
- className: "icon-only",
189
- onClick: onDelete
190
- }, /*#__PURE__*/React.createElement(TrashIcon, {
191
- className: "i16"
192
- }))));
169
+ return /*#__PURE__*/React.createElement(ContextToolbar, {
170
+ groups: [[...(url ? [{
171
+ kind: "action",
172
+ label: "Visit",
173
+ icon: /*#__PURE__*/React.createElement(OpenExpandedIcon, null),
174
+ onClick: () => {
175
+ window.open(url, "_blank", "noopener,noreferrer");
176
+ }
177
+ }] : []), {
178
+ kind: "action",
179
+ label: "Edit",
180
+ icon: /*#__PURE__*/React.createElement(InsertLinkIcon, null),
181
+ onClick: onEditUrl
182
+ }], trashGroup(onDelete)]
183
+ });
193
184
  };
194
185
 
195
186
  /**
@@ -304,24 +295,10 @@ export const LinkElement = _ref4 => {
304
295
  }, /*#__PURE__*/React.createElement(LinkPlaceholder, {
305
296
  "data-drag-through": "",
306
297
  onClick: edit.begin
307
- })), selected ? /*#__PURE__*/React.createElement(StyledFormattingToolbar, {
308
- onMouseDown: stopClick,
309
- onClick: stopClick
310
- }, /*#__PURE__*/React.createElement(StyledToolbarButton, {
311
- type: "button",
312
- onClick: edit.begin
313
- }, /*#__PURE__*/React.createElement(InsertLinkIcon, {
314
- className: "i16"
315
- }), "Edit"), /*#__PURE__*/React.createElement("span", {
316
- className: "divider"
317
- }), /*#__PURE__*/React.createElement(Tooltip, {
318
- title: "Move to Trash"
319
- }, /*#__PURE__*/React.createElement(StyledToolbarButton, {
320
- type: "button",
321
- className: "icon-only",
322
- onClick: onDelete
323
- }, /*#__PURE__*/React.createElement(TrashIcon, {
324
- className: "i16"
325
- })))) : null);
298
+ })), selected ? /*#__PURE__*/React.createElement(LinkFormattingToolbar, {
299
+ url: null,
300
+ onEditUrl: edit.begin,
301
+ onDelete: onDelete
302
+ }) : null);
326
303
  };
327
304
  //# sourceMappingURL=linkElement.js.map