@atlaskit/renderer 105.1.0 → 105.1.2

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 (421) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/actions/index.js +19 -71
  3. package/dist/cjs/actions/matches-utils.js +10 -11
  4. package/dist/cjs/actions.js +0 -2
  5. package/dist/cjs/analytics/analyticsContext.js +0 -4
  6. package/dist/cjs/analytics/events.js +0 -5
  7. package/dist/cjs/analytics/unsupported-content.js +14 -27
  8. package/dist/cjs/i18n/cs.js +0 -1
  9. package/dist/cjs/i18n/da.js +0 -1
  10. package/dist/cjs/i18n/de.js +0 -1
  11. package/dist/cjs/i18n/en.js +0 -1
  12. package/dist/cjs/i18n/en_GB.js +0 -1
  13. package/dist/cjs/i18n/en_ZZ.js +0 -1
  14. package/dist/cjs/i18n/es.js +0 -1
  15. package/dist/cjs/i18n/et.js +0 -1
  16. package/dist/cjs/i18n/fi.js +0 -1
  17. package/dist/cjs/i18n/fr.js +0 -1
  18. package/dist/cjs/i18n/hu.js +0 -1
  19. package/dist/cjs/i18n/index.js +0 -26
  20. package/dist/cjs/i18n/it.js +0 -1
  21. package/dist/cjs/i18n/ja.js +0 -1
  22. package/dist/cjs/i18n/ko.js +0 -1
  23. package/dist/cjs/i18n/nb.js +0 -1
  24. package/dist/cjs/i18n/nl.js +0 -1
  25. package/dist/cjs/i18n/pl.js +0 -1
  26. package/dist/cjs/i18n/pt_BR.js +0 -1
  27. package/dist/cjs/i18n/pt_PT.js +0 -1
  28. package/dist/cjs/i18n/ru.js +0 -1
  29. package/dist/cjs/i18n/sk.js +0 -1
  30. package/dist/cjs/i18n/sv.js +0 -1
  31. package/dist/cjs/i18n/th.js +0 -1
  32. package/dist/cjs/i18n/tr.js +0 -1
  33. package/dist/cjs/i18n/uk.js +0 -1
  34. package/dist/cjs/i18n/vi.js +0 -1
  35. package/dist/cjs/i18n/zh.js +0 -1
  36. package/dist/cjs/i18n/zh_TW.js +0 -1
  37. package/dist/cjs/index.js +0 -6
  38. package/dist/cjs/messages.js +0 -2
  39. package/dist/cjs/react/hooks/use-bidi-warnings.js +2 -12
  40. package/dist/cjs/react/hooks/use-in-viewport.js +4 -17
  41. package/dist/cjs/react/hooks/use-observed-width.js +20 -35
  42. package/dist/cjs/react/index.js +27 -114
  43. package/dist/cjs/react/marks/alignment.js +0 -9
  44. package/dist/cjs/react/marks/annotation.js +6 -21
  45. package/dist/cjs/react/marks/breakout.js +0 -9
  46. package/dist/cjs/react/marks/code.js +0 -11
  47. package/dist/cjs/react/marks/confluence-inline-comment.js +2 -19
  48. package/dist/cjs/react/marks/data-consumer.js +0 -4
  49. package/dist/cjs/react/marks/em.js +0 -3
  50. package/dist/cjs/react/marks/fragment.js +0 -4
  51. package/dist/cjs/react/marks/indentation.js +0 -3
  52. package/dist/cjs/react/marks/index.js +1 -24
  53. package/dist/cjs/react/marks/link.js +5 -25
  54. package/dist/cjs/react/marks/strike.js +0 -4
  55. package/dist/cjs/react/marks/strong.js +0 -3
  56. package/dist/cjs/react/marks/subsup.js +0 -5
  57. package/dist/cjs/react/marks/textColor.js +0 -9
  58. package/dist/cjs/react/marks/underline.js +0 -3
  59. package/dist/cjs/react/marks/unsupportedMark.js +0 -3
  60. package/dist/cjs/react/marks/unsupportedNodeAttribute.js +0 -3
  61. package/dist/cjs/react/nodes/blockCard.js +4 -16
  62. package/dist/cjs/react/nodes/blockquote.js +0 -3
  63. package/dist/cjs/react/nodes/bodiedExtension.js +6 -17
  64. package/dist/cjs/react/nodes/bulletList.js +0 -5
  65. package/dist/cjs/react/nodes/caption.js +1 -6
  66. package/dist/cjs/react/nodes/codeBlock/codeBlock.js +5 -14
  67. package/dist/cjs/react/nodes/codeBlock/components/codeBlockContainer.js +3 -16
  68. package/dist/cjs/react/nodes/codeBlock/components/lightWeightCodeBlock.js +6 -23
  69. package/dist/cjs/react/nodes/codeBlock/windowedCodeBlock.js +9 -32
  70. package/dist/cjs/react/nodes/codeBlockCopyButton.js +7 -31
  71. package/dist/cjs/react/nodes/date.js +5 -33
  72. package/dist/cjs/react/nodes/decisionItem.js +1 -5
  73. package/dist/cjs/react/nodes/decisionList.js +0 -20
  74. package/dist/cjs/react/nodes/doc.js +0 -6
  75. package/dist/cjs/react/nodes/embedCard.js +25 -54
  76. package/dist/cjs/react/nodes/emoji.js +6 -24
  77. package/dist/cjs/react/nodes/extension.js +12 -26
  78. package/dist/cjs/react/nodes/fallback.js +2 -24
  79. package/dist/cjs/react/nodes/hardBreak.js +1 -7
  80. package/dist/cjs/react/nodes/heading-anchor.js +1 -46
  81. package/dist/cjs/react/nodes/heading.js +4 -17
  82. package/dist/cjs/react/nodes/index.js +7 -62
  83. package/dist/cjs/react/nodes/inline.js +0 -6
  84. package/dist/cjs/react/nodes/inlineCard.js +6 -23
  85. package/dist/cjs/react/nodes/inlineExtension.js +2 -10
  86. package/dist/cjs/react/nodes/layoutColumn.js +0 -8
  87. package/dist/cjs/react/nodes/layoutSection.js +0 -3
  88. package/dist/cjs/react/nodes/listItem.js +0 -3
  89. package/dist/cjs/react/nodes/media.js +10 -49
  90. package/dist/cjs/react/nodes/mediaGroup.js +6 -47
  91. package/dist/cjs/react/nodes/mediaInline.js +7 -37
  92. package/dist/cjs/react/nodes/mediaSingle/index.js +38 -85
  93. package/dist/cjs/react/nodes/mediaSingle/styles.js +0 -5
  94. package/dist/cjs/react/nodes/mention.js +5 -23
  95. package/dist/cjs/react/nodes/orderedList.js +0 -14
  96. package/dist/cjs/react/nodes/panel.js +10 -38
  97. package/dist/cjs/react/nodes/paragraph.js +1 -5
  98. package/dist/cjs/react/nodes/placeholder.js +0 -4
  99. package/dist/cjs/react/nodes/rule.js +0 -3
  100. package/dist/cjs/react/nodes/status.js +3 -22
  101. package/dist/cjs/react/nodes/table/colgroup.js +12 -26
  102. package/dist/cjs/react/nodes/table/sticky.js +17 -47
  103. package/dist/cjs/react/nodes/table/table.js +5 -10
  104. package/dist/cjs/react/nodes/table.js +19 -102
  105. package/dist/cjs/react/nodes/tableCell.js +26 -79
  106. package/dist/cjs/react/nodes/tableRow.js +4 -33
  107. package/dist/cjs/react/nodes/task-item-with-providers.js +4 -40
  108. package/dist/cjs/react/nodes/taskItem.js +8 -36
  109. package/dist/cjs/react/nodes/taskList.js +2 -22
  110. package/dist/cjs/react/nodes/text-wrapper.js +1 -8
  111. package/dist/cjs/react/nodes/unknownBlock.js +0 -3
  112. package/dist/cjs/react/renderer-node.js +0 -6
  113. package/dist/cjs/react/utils/clipboard.js +0 -3
  114. package/dist/cjs/react/utils/element-selection.js +0 -13
  115. package/dist/cjs/react/utils/getCardClickHandler.js +0 -3
  116. package/dist/cjs/react/utils/inject-props.js +4 -9
  117. package/dist/cjs/react/utils/links.js +2 -6
  118. package/dist/cjs/react/utils/lists.js +0 -1
  119. package/dist/cjs/react/utils/performance/RenderTracking.js +2 -10
  120. package/dist/cjs/react/utils/use-select-all-trap.js +1 -23
  121. package/dist/cjs/render-document.js +42 -83
  122. package/dist/cjs/renderer-context.js +0 -5
  123. package/dist/cjs/steps/index.js +7 -39
  124. package/dist/cjs/text/index.js +0 -9
  125. package/dist/cjs/text/nodes/blockquote.js +0 -3
  126. package/dist/cjs/text/nodes/bulletList.js +0 -3
  127. package/dist/cjs/text/nodes/date.js +0 -4
  128. package/dist/cjs/text/nodes/decisionItem.js +0 -5
  129. package/dist/cjs/text/nodes/hardBreak.js +0 -2
  130. package/dist/cjs/text/nodes/heading.js +0 -3
  131. package/dist/cjs/text/nodes/index.js +0 -21
  132. package/dist/cjs/text/nodes/inlineCard.js +0 -4
  133. package/dist/cjs/text/nodes/listItem.js +0 -3
  134. package/dist/cjs/text/nodes/mediaGroup.js +0 -4
  135. package/dist/cjs/text/nodes/mention.js +0 -3
  136. package/dist/cjs/text/nodes/orderedList.js +0 -4
  137. package/dist/cjs/text/nodes/panel.js +0 -3
  138. package/dist/cjs/text/nodes/paragraph.js +0 -5
  139. package/dist/cjs/text/nodes/rule.js +0 -2
  140. package/dist/cjs/text/nodes/status.js +0 -3
  141. package/dist/cjs/text/nodes/table.js +0 -5
  142. package/dist/cjs/text/nodes/taskItem.js +0 -5
  143. package/dist/cjs/text/nodes/unknown.js +0 -6
  144. package/dist/cjs/text-serializer.js +0 -2
  145. package/dist/cjs/ui/Expand.js +15 -59
  146. package/dist/cjs/ui/ExtensionRenderer.js +10 -43
  147. package/dist/cjs/ui/MediaCard.js +40 -116
  148. package/dist/cjs/ui/Renderer/ErrorBoundary.js +0 -26
  149. package/dist/cjs/ui/Renderer/breakout-ssr.js +6 -32
  150. package/dist/cjs/ui/Renderer/click-to-edit.js +0 -6
  151. package/dist/cjs/ui/Renderer/index.js +47 -149
  152. package/dist/cjs/ui/Renderer/style.js +1 -39
  153. package/dist/cjs/ui/Renderer/truncated-wrapper.js +12 -30
  154. package/dist/cjs/ui/RendererActionsContext/WithRendererActions.js +0 -4
  155. package/dist/cjs/ui/RendererActionsContext/index.js +1 -11
  156. package/dist/cjs/ui/SmartCardStorage.js +0 -20
  157. package/dist/cjs/ui/SortingIcon.js +10 -40
  158. package/dist/cjs/ui/TaskItemsFormatContext/TaskItemsFormatContext.js +0 -11
  159. package/dist/cjs/ui/TaskItemsFormatContext/index.js +0 -1
  160. package/dist/cjs/ui/active-header-id-provider.js +6 -19
  161. package/dist/cjs/ui/annotations/context.js +0 -24
  162. package/dist/cjs/ui/annotations/draft/component.js +5 -42
  163. package/dist/cjs/ui/annotations/draft/dom.js +3 -17
  164. package/dist/cjs/ui/annotations/draft/index.js +0 -2
  165. package/dist/cjs/ui/annotations/draft/position.js +1 -12
  166. package/dist/cjs/ui/annotations/draft/text.js +2 -8
  167. package/dist/cjs/ui/annotations/element/index.js +4 -16
  168. package/dist/cjs/ui/annotations/element/mark.js +8 -26
  169. package/dist/cjs/ui/annotations/hooks/index.js +0 -3
  170. package/dist/cjs/ui/annotations/hooks/use-events.js +13 -45
  171. package/dist/cjs/ui/annotations/hooks/use-inline-comment-subscriber.js +0 -6
  172. package/dist/cjs/ui/annotations/hooks/use-inline-comments-filter.js +1 -8
  173. package/dist/cjs/ui/annotations/hooks/use-load-annotations.js +4 -19
  174. package/dist/cjs/ui/annotations/hooks/user-selection.js +3 -18
  175. package/dist/cjs/ui/annotations/hooks/utils.js +0 -2
  176. package/dist/cjs/ui/annotations/index.js +4 -20
  177. package/dist/cjs/ui/annotations/selection/index.js +0 -1
  178. package/dist/cjs/ui/annotations/selection/mounter.js +13 -42
  179. package/dist/cjs/ui/annotations/selection/range-validator.js +9 -23
  180. package/dist/cjs/ui/annotations/selection/wrapper.js +3 -13
  181. package/dist/cjs/ui/annotations/types.js +0 -1
  182. package/dist/cjs/ui/annotations/view/index.js +1 -12
  183. package/dist/cjs/ui/index.js +0 -2
  184. package/dist/cjs/use-feature-flags.js +0 -4
  185. package/dist/cjs/utils.js +1 -19
  186. package/dist/cjs/version.json +1 -1
  187. package/dist/es2019/actions/index.js +6 -50
  188. package/dist/es2019/actions/matches-utils.js +10 -9
  189. package/dist/es2019/actions.js +2 -1
  190. package/dist/es2019/analytics/events.js +0 -5
  191. package/dist/es2019/analytics/unsupported-content.js +8 -14
  192. package/dist/es2019/react/hooks/use-bidi-warnings.js +0 -2
  193. package/dist/es2019/react/hooks/use-in-viewport.js +0 -1
  194. package/dist/es2019/react/hooks/use-observed-width.js +0 -2
  195. package/dist/es2019/react/index.js +44 -119
  196. package/dist/es2019/react/marks/alignment.js +0 -3
  197. package/dist/es2019/react/marks/annotation.js +2 -5
  198. package/dist/es2019/react/marks/confluence-inline-comment.js +0 -1
  199. package/dist/es2019/react/marks/index.js +2 -1
  200. package/dist/es2019/react/marks/link.js +0 -6
  201. package/dist/es2019/react/marks/subsup.js +0 -3
  202. package/dist/es2019/react/nodes/bodiedExtension.js +2 -5
  203. package/dist/es2019/react/nodes/caption.js +0 -2
  204. package/dist/es2019/react/nodes/codeBlock/codeBlock.js +0 -2
  205. package/dist/es2019/react/nodes/codeBlock/components/codeBlockContainer.js +1 -3
  206. package/dist/es2019/react/nodes/codeBlock/windowedCodeBlock.js +1 -6
  207. package/dist/es2019/react/nodes/codeBlockCopyButton.js +0 -4
  208. package/dist/es2019/react/nodes/date.js +0 -7
  209. package/dist/es2019/react/nodes/decisionList.js +0 -3
  210. package/dist/es2019/react/nodes/embedCard.js +8 -16
  211. package/dist/es2019/react/nodes/emoji.js +0 -1
  212. package/dist/es2019/react/nodes/extension.js +4 -6
  213. package/dist/es2019/react/nodes/fallback.js +0 -8
  214. package/dist/es2019/react/nodes/hardBreak.js +0 -3
  215. package/dist/es2019/react/nodes/heading-anchor.js +0 -15
  216. package/dist/es2019/react/nodes/heading.js +0 -6
  217. package/dist/es2019/react/nodes/index.js +28 -61
  218. package/dist/es2019/react/nodes/inline.js +0 -2
  219. package/dist/es2019/react/nodes/inlineCard.js +0 -5
  220. package/dist/es2019/react/nodes/inlineExtension.js +2 -5
  221. package/dist/es2019/react/nodes/media.js +0 -10
  222. package/dist/es2019/react/nodes/mediaGroup.js +2 -22
  223. package/dist/es2019/react/nodes/mediaInline.js +1 -8
  224. package/dist/es2019/react/nodes/mediaSingle/index.js +8 -29
  225. package/dist/es2019/react/nodes/mention.js +0 -1
  226. package/dist/es2019/react/nodes/orderedList.js +0 -5
  227. package/dist/es2019/react/nodes/panel.js +4 -17
  228. package/dist/es2019/react/nodes/placeholder.js +0 -1
  229. package/dist/es2019/react/nodes/status.js +0 -1
  230. package/dist/es2019/react/nodes/table/colgroup.js +9 -18
  231. package/dist/es2019/react/nodes/table/sticky.js +3 -16
  232. package/dist/es2019/react/nodes/table.js +9 -75
  233. package/dist/es2019/react/nodes/tableCell.js +4 -31
  234. package/dist/es2019/react/nodes/tableRow.js +0 -10
  235. package/dist/es2019/react/nodes/task-item-with-providers.js +0 -6
  236. package/dist/es2019/react/nodes/taskItem.js +0 -7
  237. package/dist/es2019/react/nodes/taskList.js +0 -3
  238. package/dist/es2019/react/nodes/text-wrapper.js +0 -4
  239. package/dist/es2019/react/utils/clipboard.js +0 -1
  240. package/dist/es2019/react/utils/element-selection.js +0 -12
  241. package/dist/es2019/react/utils/inject-props.js +5 -7
  242. package/dist/es2019/react/utils/links.js +2 -4
  243. package/dist/es2019/react/utils/performance/RenderTracking.js +0 -1
  244. package/dist/es2019/react/utils/use-select-all-trap.js +0 -7
  245. package/dist/es2019/render-document.js +16 -33
  246. package/dist/es2019/steps/index.js +4 -33
  247. package/dist/es2019/text/index.js +0 -3
  248. package/dist/es2019/text/nodes/blockquote.js +0 -2
  249. package/dist/es2019/text/nodes/bulletList.js +0 -2
  250. package/dist/es2019/text/nodes/date.js +0 -2
  251. package/dist/es2019/text/nodes/decisionItem.js +0 -4
  252. package/dist/es2019/text/nodes/hardBreak.js +0 -1
  253. package/dist/es2019/text/nodes/heading.js +0 -2
  254. package/dist/es2019/text/nodes/inlineCard.js +0 -3
  255. package/dist/es2019/text/nodes/listItem.js +0 -2
  256. package/dist/es2019/text/nodes/mediaGroup.js +0 -3
  257. package/dist/es2019/text/nodes/mention.js +0 -2
  258. package/dist/es2019/text/nodes/orderedList.js +0 -2
  259. package/dist/es2019/text/nodes/panel.js +0 -2
  260. package/dist/es2019/text/nodes/paragraph.js +0 -4
  261. package/dist/es2019/text/nodes/rule.js +0 -1
  262. package/dist/es2019/text/nodes/status.js +0 -2
  263. package/dist/es2019/text/nodes/table.js +0 -4
  264. package/dist/es2019/text/nodes/taskItem.js +0 -4
  265. package/dist/es2019/text/nodes/unknown.js +0 -4
  266. package/dist/es2019/ui/Expand.js +2 -17
  267. package/dist/es2019/ui/ExtensionRenderer.js +0 -19
  268. package/dist/es2019/ui/MediaCard.js +9 -40
  269. package/dist/es2019/ui/Renderer/ErrorBoundary.js +0 -10
  270. package/dist/es2019/ui/Renderer/breakout-ssr.js +6 -26
  271. package/dist/es2019/ui/Renderer/click-to-edit.js +1 -4
  272. package/dist/es2019/ui/Renderer/index.js +17 -66
  273. package/dist/es2019/ui/Renderer/style.js +0 -14
  274. package/dist/es2019/ui/Renderer/truncated-wrapper.js +2 -6
  275. package/dist/es2019/ui/SmartCardStorage.js +0 -1
  276. package/dist/es2019/ui/SortingIcon.js +3 -20
  277. package/dist/es2019/ui/TaskItemsFormatContext/TaskItemsFormatContext.js +0 -2
  278. package/dist/es2019/ui/active-header-id-provider.js +0 -3
  279. package/dist/es2019/ui/annotations/context.js +0 -6
  280. package/dist/es2019/ui/annotations/draft/component.js +0 -13
  281. package/dist/es2019/ui/annotations/draft/dom.js +0 -6
  282. package/dist/es2019/ui/annotations/draft/position.js +0 -8
  283. package/dist/es2019/ui/annotations/draft/text.js +0 -1
  284. package/dist/es2019/ui/annotations/element/index.js +0 -3
  285. package/dist/es2019/ui/annotations/element/mark.js +4 -6
  286. package/dist/es2019/ui/annotations/hooks/use-events.js +4 -13
  287. package/dist/es2019/ui/annotations/hooks/use-inline-comment-subscriber.js +0 -2
  288. package/dist/es2019/ui/annotations/hooks/use-inline-comments-filter.js +0 -1
  289. package/dist/es2019/ui/annotations/hooks/use-load-annotations.js +4 -8
  290. package/dist/es2019/ui/annotations/hooks/user-selection.js +0 -6
  291. package/dist/es2019/ui/annotations/selection/mounter.js +0 -13
  292. package/dist/es2019/ui/annotations/selection/range-validator.js +0 -2
  293. package/dist/es2019/ui/annotations/selection/wrapper.js +0 -2
  294. package/dist/es2019/ui/annotations/types.js +0 -1
  295. package/dist/es2019/ui/annotations/view/index.js +0 -4
  296. package/dist/es2019/use-feature-flags.js +0 -1
  297. package/dist/es2019/utils.js +1 -8
  298. package/dist/es2019/version.json +1 -1
  299. package/dist/esm/actions/index.js +19 -63
  300. package/dist/esm/actions/matches-utils.js +10 -9
  301. package/dist/esm/actions.js +2 -1
  302. package/dist/esm/analytics/events.js +0 -5
  303. package/dist/esm/analytics/unsupported-content.js +14 -21
  304. package/dist/esm/react/hooks/use-bidi-warnings.js +2 -4
  305. package/dist/esm/react/hooks/use-in-viewport.js +4 -13
  306. package/dist/esm/react/hooks/use-observed-width.js +20 -29
  307. package/dist/esm/react/index.js +27 -111
  308. package/dist/esm/react/marks/alignment.js +0 -4
  309. package/dist/esm/react/marks/annotation.js +6 -14
  310. package/dist/esm/react/marks/breakout.js +0 -2
  311. package/dist/esm/react/marks/confluence-inline-comment.js +2 -12
  312. package/dist/esm/react/marks/index.js +2 -1
  313. package/dist/esm/react/marks/link.js +5 -12
  314. package/dist/esm/react/marks/subsup.js +0 -3
  315. package/dist/esm/react/nodes/blockCard.js +4 -4
  316. package/dist/esm/react/nodes/bodiedExtension.js +6 -10
  317. package/dist/esm/react/nodes/caption.js +1 -3
  318. package/dist/esm/react/nodes/codeBlock/codeBlock.js +4 -6
  319. package/dist/esm/react/nodes/codeBlock/components/codeBlockContainer.js +4 -8
  320. package/dist/esm/react/nodes/codeBlock/components/lightWeightCodeBlock.js +6 -10
  321. package/dist/esm/react/nodes/codeBlock/windowedCodeBlock.js +10 -21
  322. package/dist/esm/react/nodes/codeBlockCopyButton.js +7 -15
  323. package/dist/esm/react/nodes/date.js +5 -20
  324. package/dist/esm/react/nodes/decisionItem.js +1 -1
  325. package/dist/esm/react/nodes/decisionList.js +0 -12
  326. package/dist/esm/react/nodes/embedCard.js +25 -39
  327. package/dist/esm/react/nodes/emoji.js +6 -16
  328. package/dist/esm/react/nodes/extension.js +12 -16
  329. package/dist/esm/react/nodes/fallback.js +2 -18
  330. package/dist/esm/react/nodes/hardBreak.js +1 -5
  331. package/dist/esm/react/nodes/heading-anchor.js +1 -32
  332. package/dist/esm/react/nodes/heading.js +4 -10
  333. package/dist/esm/react/nodes/index.js +26 -64
  334. package/dist/esm/react/nodes/inline.js +0 -2
  335. package/dist/esm/react/nodes/inlineCard.js +6 -12
  336. package/dist/esm/react/nodes/inlineExtension.js +2 -6
  337. package/dist/esm/react/nodes/layoutColumn.js +0 -2
  338. package/dist/esm/react/nodes/media.js +10 -34
  339. package/dist/esm/react/nodes/mediaGroup.js +6 -37
  340. package/dist/esm/react/nodes/mediaInline.js +7 -20
  341. package/dist/esm/react/nodes/mediaSingle/index.js +37 -66
  342. package/dist/esm/react/nodes/mediaSingle/styles.js +0 -2
  343. package/dist/esm/react/nodes/mention.js +5 -15
  344. package/dist/esm/react/nodes/orderedList.js +0 -5
  345. package/dist/esm/react/nodes/panel.js +12 -28
  346. package/dist/esm/react/nodes/paragraph.js +1 -1
  347. package/dist/esm/react/nodes/placeholder.js +0 -1
  348. package/dist/esm/react/nodes/status.js +3 -13
  349. package/dist/esm/react/nodes/table/colgroup.js +12 -21
  350. package/dist/esm/react/nodes/table/sticky.js +17 -32
  351. package/dist/esm/react/nodes/table/table.js +5 -5
  352. package/dist/esm/react/nodes/table.js +19 -95
  353. package/dist/esm/react/nodes/tableCell.js +26 -66
  354. package/dist/esm/react/nodes/tableRow.js +4 -25
  355. package/dist/esm/react/nodes/task-item-with-providers.js +4 -27
  356. package/dist/esm/react/nodes/taskItem.js +8 -24
  357. package/dist/esm/react/nodes/taskList.js +2 -14
  358. package/dist/esm/react/nodes/text-wrapper.js +1 -5
  359. package/dist/esm/react/utils/clipboard.js +0 -1
  360. package/dist/esm/react/utils/element-selection.js +0 -10
  361. package/dist/esm/react/utils/inject-props.js +5 -7
  362. package/dist/esm/react/utils/links.js +2 -4
  363. package/dist/esm/react/utils/performance/RenderTracking.js +2 -4
  364. package/dist/esm/react/utils/use-select-all-trap.js +1 -9
  365. package/dist/esm/render-document.js +42 -70
  366. package/dist/esm/steps/index.js +7 -36
  367. package/dist/esm/text/index.js +0 -6
  368. package/dist/esm/text/nodes/blockquote.js +0 -2
  369. package/dist/esm/text/nodes/bulletList.js +0 -2
  370. package/dist/esm/text/nodes/date.js +0 -2
  371. package/dist/esm/text/nodes/decisionItem.js +0 -4
  372. package/dist/esm/text/nodes/hardBreak.js +0 -1
  373. package/dist/esm/text/nodes/heading.js +0 -2
  374. package/dist/esm/text/nodes/inlineCard.js +0 -3
  375. package/dist/esm/text/nodes/listItem.js +0 -2
  376. package/dist/esm/text/nodes/mediaGroup.js +0 -3
  377. package/dist/esm/text/nodes/mention.js +0 -2
  378. package/dist/esm/text/nodes/orderedList.js +0 -2
  379. package/dist/esm/text/nodes/panel.js +0 -2
  380. package/dist/esm/text/nodes/paragraph.js +0 -4
  381. package/dist/esm/text/nodes/rule.js +0 -1
  382. package/dist/esm/text/nodes/status.js +0 -2
  383. package/dist/esm/text/nodes/table.js +0 -4
  384. package/dist/esm/text/nodes/taskItem.js +0 -4
  385. package/dist/esm/text/nodes/unknown.js +0 -4
  386. package/dist/esm/ui/Expand.js +15 -36
  387. package/dist/esm/ui/ExtensionRenderer.js +10 -39
  388. package/dist/esm/ui/MediaCard.js +42 -99
  389. package/dist/esm/ui/Renderer/ErrorBoundary.js +0 -16
  390. package/dist/esm/ui/Renderer/breakout-ssr.js +7 -27
  391. package/dist/esm/ui/Renderer/click-to-edit.js +1 -4
  392. package/dist/esm/ui/Renderer/index.js +47 -110
  393. package/dist/esm/ui/Renderer/style.js +1 -21
  394. package/dist/esm/ui/Renderer/truncated-wrapper.js +12 -23
  395. package/dist/esm/ui/RendererActionsContext/index.js +1 -1
  396. package/dist/esm/ui/SmartCardStorage.js +0 -9
  397. package/dist/esm/ui/SortingIcon.js +10 -29
  398. package/dist/esm/ui/TaskItemsFormatContext/TaskItemsFormatContext.js +0 -2
  399. package/dist/esm/ui/active-header-id-provider.js +6 -12
  400. package/dist/esm/ui/annotations/context.js +0 -15
  401. package/dist/esm/ui/annotations/draft/component.js +5 -19
  402. package/dist/esm/ui/annotations/draft/dom.js +3 -11
  403. package/dist/esm/ui/annotations/draft/position.js +1 -9
  404. package/dist/esm/ui/annotations/draft/text.js +2 -4
  405. package/dist/esm/ui/annotations/element/index.js +4 -7
  406. package/dist/esm/ui/annotations/element/mark.js +8 -14
  407. package/dist/esm/ui/annotations/hooks/use-events.js +13 -32
  408. package/dist/esm/ui/annotations/hooks/use-inline-comment-subscriber.js +0 -2
  409. package/dist/esm/ui/annotations/hooks/use-inline-comments-filter.js +1 -2
  410. package/dist/esm/ui/annotations/hooks/use-load-annotations.js +4 -12
  411. package/dist/esm/ui/annotations/hooks/user-selection.js +3 -11
  412. package/dist/esm/ui/annotations/index.js +4 -6
  413. package/dist/esm/ui/annotations/selection/mounter.js +13 -29
  414. package/dist/esm/ui/annotations/selection/range-validator.js +9 -12
  415. package/dist/esm/ui/annotations/selection/wrapper.js +3 -5
  416. package/dist/esm/ui/annotations/types.js +0 -1
  417. package/dist/esm/ui/annotations/view/index.js +1 -5
  418. package/dist/esm/use-feature-flags.js +0 -1
  419. package/dist/esm/utils.js +1 -8
  420. package/dist/esm/version.json +1 -1
  421. package/package.json +2 -2
@@ -6,11 +6,8 @@ import _inherits from "@babel/runtime/helpers/inherits";
6
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
7
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
-
10
9
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
-
12
10
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
-
14
11
  import React from 'react';
15
12
  import { calcTableWidth, TableSharedCssClassName, tableMarginTop } from '@atlaskit/editor-common/styles';
16
13
  import { WidthConsumer, overflowShadow } from '@atlaskit/editor-common/ui';
@@ -22,23 +19,19 @@ import { withSmartCardStorage } from '../../ui/SmartCardStorage';
22
19
  import { StickyTable, tableStickyPadding, OverflowParent } from './table/sticky';
23
20
  import { Table } from './table/table';
24
21
  import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
25
-
26
22
  var orderChildren = function orderChildren(children, tableNode, smartCardStorage, tableOrderStatus) {
27
23
  if (!tableOrderStatus || tableOrderStatus.order === SortOrder.NO_ORDER) {
28
24
  return children;
29
25
  }
30
-
31
26
  var order = tableOrderStatus.order,
32
- columnIndex = tableOrderStatus.columnIndex;
27
+ columnIndex = tableOrderStatus.columnIndex;
33
28
  var compareNodesInOrder = createCompareNodes({
34
29
  getInlineCardTextFromStore: function getInlineCardTextFromStore(attrs) {
35
30
  var _ref = attrs,
36
- url = _ref.url;
37
-
31
+ url = _ref.url;
38
32
  if (!url) {
39
33
  return null;
40
34
  }
41
-
42
35
  return smartCardStorage.get(url) || null;
43
36
  }
44
37
  }, order);
@@ -53,16 +46,13 @@ var orderChildren = function orderChildren(children, tableNode, smartCardStorage
53
46
  var sortedTable = tableArrayWithChildren.sort(function (rowA, rowB) {
54
47
  return compareNodesInOrder(rowA.rowNodes[columnIndex], rowB.rowNodes[columnIndex]);
55
48
  });
56
-
57
49
  if (headerRow) {
58
50
  sortedTable.unshift(headerRow);
59
51
  }
60
-
61
52
  return sortedTable.map(function (elem) {
62
53
  return elem.rowReact;
63
54
  });
64
55
  };
65
-
66
56
  var hasRowspan = function hasRowspan(row) {
67
57
  var hasRowspan = false;
68
58
  row.forEach(function (cell) {
@@ -70,19 +60,15 @@ var hasRowspan = function hasRowspan(row) {
70
60
  });
71
61
  return hasRowspan;
72
62
  };
73
-
74
63
  var getRefTop = function getRefTop(refElement) {
75
64
  return Math.round(refElement.getBoundingClientRect().top);
76
65
  };
77
-
78
66
  var shouldHeaderStick = function shouldHeaderStick(scrollTop, tableTop, tableBottom, rowHeight) {
79
67
  return tableTop <= scrollTop && !(tableBottom - rowHeight <= scrollTop);
80
68
  };
81
-
82
69
  var shouldHeaderPinBottom = function shouldHeaderPinBottom(scrollTop, tableBottom, rowHeight) {
83
70
  return tableBottom - rowHeight <= scrollTop && !(tableBottom < scrollTop);
84
71
  };
85
-
86
72
  var addSortableColumn = function addSortableColumn(rows, tableOrderStatus, onSorting) {
87
73
  return React.Children.map(rows, function (row, index) {
88
74
  if (index === 0) {
@@ -91,129 +77,96 @@ var addSortableColumn = function addSortableColumn(rows, tableOrderStatus, onSor
91
77
  onSorting: onSorting
92
78
  });
93
79
  }
94
-
95
80
  return row;
96
81
  });
97
82
  };
98
-
99
83
  var isHeaderRowEnabled = function isHeaderRowEnabled(rows) {
100
84
  if (!rows.length) {
101
85
  return false;
102
86
  }
103
-
104
87
  var children = rows[0].props.children;
105
-
106
88
  if (!children.length) {
107
89
  return false;
108
90
  }
109
-
110
91
  if (children.length === 1) {
111
92
  return children[0].type === TableHeader;
112
93
  }
113
-
114
94
  return children.every(function (node) {
115
95
  return node.type === TableHeader;
116
96
  });
117
97
  };
118
-
119
98
  var tableCanBeSticky = function tableCanBeSticky(node, children) {
120
99
  return isHeaderRowEnabled(children) && node && node.firstChild && !hasRowspan(node.firstChild);
121
100
  };
122
-
123
101
  var canUseLinelength = function canUseLinelength(appearance) {
124
102
  return appearance === 'full-page' || appearance === 'mobile';
125
103
  };
126
-
127
104
  export var TableContainer = /*#__PURE__*/function (_React$Component) {
128
105
  _inherits(TableContainer, _React$Component);
129
-
130
106
  var _super = _createSuper(TableContainer);
131
-
132
107
  function TableContainer() {
133
108
  var _this;
134
-
135
109
  _classCallCheck(this, TableContainer);
136
-
137
110
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
138
111
  args[_key] = arguments[_key];
139
112
  }
140
-
141
113
  _this = _super.call.apply(_super, [this].concat(args));
142
-
143
114
  _defineProperty(_assertThisInitialized(_this), "state", {
144
115
  stickyMode: 'none'
145
116
  });
146
-
147
117
  _defineProperty(_assertThisInitialized(_this), "tableRef", /*#__PURE__*/React.createRef());
148
-
149
118
  _defineProperty(_assertThisInitialized(_this), "stickyHeaderRef", /*#__PURE__*/React.createRef());
150
-
151
119
  _defineProperty(_assertThisInitialized(_this), "stickyWrapperRef", /*#__PURE__*/React.createRef());
152
-
153
120
  _defineProperty(_assertThisInitialized(_this), "wrapperRef", /*#__PURE__*/React.createRef());
154
-
155
121
  _defineProperty(_assertThisInitialized(_this), "overflowParent", null);
156
-
157
122
  _defineProperty(_assertThisInitialized(_this), "componentWillUnmount", function () {
158
123
  if (_this.overflowParent) {
159
124
  _this.overflowParent.removeEventListener('scroll', _this.onScroll);
160
125
  }
161
-
162
126
  if (_this.nextFrame) {
163
127
  cancelAnimationFrame(_this.nextFrame);
164
128
  }
165
129
  });
166
-
167
130
  _defineProperty(_assertThisInitialized(_this), "getScrollTop", function () {
168
131
  var stickyHeaders = _this.props.stickyHeaders;
169
132
  var offsetTop = stickyHeaders && stickyHeaders.offsetTop || 0;
170
133
  return (_this.overflowParent ? _this.overflowParent.top : 0) + offsetTop;
171
134
  });
172
-
173
135
  _defineProperty(_assertThisInitialized(_this), "updateSticky", function () {
174
136
  var tableElem = _this.tableRef.current;
175
137
  var refElem = _this.stickyHeaderRef.current;
176
-
177
138
  if (!tableElem || !refElem) {
178
139
  return;
179
140
  }
180
-
181
141
  var scrollTop = _this.getScrollTop() + tableStickyPadding;
182
142
  var tableTop = getRefTop(tableElem);
183
143
  var tableBottom = tableTop + tableElem.clientHeight;
184
144
  var shouldSticky = shouldHeaderStick(scrollTop, tableTop, tableBottom, refElem.clientHeight);
185
145
  var shouldPin = shouldHeaderPinBottom(scrollTop, tableBottom, refElem.clientHeight);
186
146
  var stickyMode = 'none';
187
-
188
147
  if (shouldPin) {
189
148
  stickyMode = 'pin-bottom';
190
149
  } else if (shouldSticky) {
191
150
  stickyMode = 'stick';
192
151
  }
193
-
194
152
  if (_this.state.stickyMode !== stickyMode) {
195
153
  _this.setState({
196
154
  stickyMode: stickyMode
197
155
  });
198
156
  }
199
-
200
157
  _this.nextFrame = undefined;
201
158
  });
202
-
203
159
  _defineProperty(_assertThisInitialized(_this), "onScroll", function () {
204
160
  if (!_this.nextFrame) {
205
161
  _this.nextFrame = requestAnimationFrame(_this.updateSticky);
206
162
  }
207
163
  });
208
-
209
164
  _defineProperty(_assertThisInitialized(_this), "onWrapperScrolled", function () {
210
165
  if (!_this.wrapperRef.current || !_this.stickyWrapperRef.current) {
211
166
  return;
212
167
  }
213
-
214
168
  _this.stickyWrapperRef.current.scrollLeft = _this.wrapperRef.current.scrollLeft;
215
169
  });
216
-
217
170
  _defineProperty(_assertThisInitialized(_this), "grabFirstRowRef", function (children) {
218
171
  return React.Children.map(children, function (child, idx) {
219
172
  if (idx === 0 && /*#__PURE__*/React.isValidElement(child)) {
@@ -221,14 +174,11 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
221
174
  innerRef: _this.stickyHeaderRef
222
175
  });
223
176
  }
224
-
225
177
  return child;
226
178
  });
227
179
  });
228
-
229
180
  return _this;
230
181
  }
231
-
232
182
  _createClass(TableContainer, [{
233
183
  key: "componentDidMount",
234
184
  value: function componentDidMount() {
@@ -246,14 +196,14 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
246
196
  } else if (!this.props.stickyHeaders && this.overflowParent) {
247
197
  this.overflowParent.removeEventListener('scroll', this.onScroll);
248
198
  this.overflowParent = null;
249
- } // offsetTop might have changed, re-position sticky header
250
-
199
+ }
251
200
 
201
+ // offsetTop might have changed, re-position sticky header
252
202
  if (this.props.stickyHeaders !== prevProps.stickyHeaders) {
253
203
  this.updateSticky();
254
- } // sync horizontal scroll in floating div when toggling modes
255
-
204
+ }
256
205
 
206
+ // sync horizontal scroll in floating div when toggling modes
257
207
  if (prevState.stickyMode !== this.state.stickyMode) {
258
208
  this.onWrapperScrolled();
259
209
  }
@@ -264,7 +214,6 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
264
214
  if (!this.tableRef.current || !this.stickyHeaderRef.current) {
265
215
  return;
266
216
  }
267
-
268
217
  return this.tableRef.current.offsetHeight - this.stickyHeaderRef.current.offsetHeight + tableMarginTop - tableStickyPadding;
269
218
  }
270
219
  }, {
@@ -273,10 +222,8 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
273
222
  switch (this.state.stickyMode) {
274
223
  case 'pin-bottom':
275
224
  return this.pinTop;
276
-
277
225
  case 'stick':
278
226
  return this.props.stickyHeaders && this.props.stickyHeaders.offsetTop;
279
-
280
227
  default:
281
228
  return undefined;
282
229
  }
@@ -290,22 +237,20 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
290
237
  key: "render",
291
238
  value: function render() {
292
239
  var _this$props = this.props,
293
- isNumberColumnEnabled = _this$props.isNumberColumnEnabled,
294
- layout = _this$props.layout,
295
- renderWidth = _this$props.renderWidth,
296
- columnWidths = _this$props.columnWidths,
297
- stickyHeaders = _this$props.stickyHeaders,
298
- tableNode = _this$props.tableNode;
240
+ isNumberColumnEnabled = _this$props.isNumberColumnEnabled,
241
+ layout = _this$props.layout,
242
+ renderWidth = _this$props.renderWidth,
243
+ columnWidths = _this$props.columnWidths,
244
+ stickyHeaders = _this$props.stickyHeaders,
245
+ tableNode = _this$props.tableNode;
299
246
  var stickyMode = this.state.stickyMode;
300
247
  var tableWidth = calcTableWidth(layout, renderWidth, false);
301
248
  var lineLength = akEditorDefaultLayoutWidth;
302
249
  var left;
303
-
304
250
  if (canUseLinelength(this.props.rendererAppearance) && tableWidth !== 'inherit') {
305
251
  var tableWidthPx = Number(tableWidth.substring(0, tableWidth.length - 2));
306
252
  left = lineLength / 2 - tableWidthPx / 2;
307
253
  }
308
-
309
254
  var wrapperWidth = this.wrapperRef.current ? this.wrapperRef.current.clientWidth : 0;
310
255
  var children = React.Children.toArray(this.props.children);
311
256
  return /*#__PURE__*/React.createElement(React.Fragment, null, stickyHeaders && tableCanBeSticky(tableNode, children) && /*#__PURE__*/React.createElement(StickyTable, {
@@ -343,43 +288,32 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
343
288
  }, this.grabFirstRowRef(children)))));
344
289
  }
345
290
  }]);
346
-
347
291
  return TableContainer;
348
292
  }(React.Component);
349
293
  export var TableProcessor = /*#__PURE__*/function (_React$Component2) {
350
294
  _inherits(TableProcessor, _React$Component2);
351
-
352
295
  var _super2 = _createSuper(TableProcessor);
353
-
354
296
  function TableProcessor() {
355
297
  var _this2;
356
-
357
298
  _classCallCheck(this, TableProcessor);
358
-
359
299
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
360
300
  args[_key2] = arguments[_key2];
361
301
  }
362
-
363
302
  _this2 = _super2.call.apply(_super2, [this].concat(args));
364
-
365
303
  _defineProperty(_assertThisInitialized(_this2), "state", {
366
304
  tableOrderStatus: undefined
367
305
  });
368
-
369
306
  _defineProperty(_assertThisInitialized(_this2), "addSortableColumn", function (childrenArray) {
370
307
  var _this2$props = _this2.props,
371
- tableNode = _this2$props.tableNode,
372
- allowColumnSorting = _this2$props.allowColumnSorting,
373
- smartCardStorage = _this2$props.smartCardStorage;
308
+ tableNode = _this2$props.tableNode,
309
+ allowColumnSorting = _this2$props.allowColumnSorting,
310
+ smartCardStorage = _this2$props.smartCardStorage;
374
311
  var tableOrderStatus = _this2.state.tableOrderStatus;
375
-
376
312
  if (allowColumnSorting && isHeaderRowEnabled(childrenArray) && tableNode && !hasMergedCell(tableNode)) {
377
313
  return addSortableColumn(orderChildren(childrenArray, tableNode, smartCardStorage, tableOrderStatus), tableOrderStatus, _this2.changeSortOrder);
378
314
  }
379
-
380
315
  return childrenArray;
381
316
  });
382
-
383
317
  _defineProperty(_assertThisInitialized(_this2), "changeSortOrder", function (columnIndex, sortOrder) {
384
318
  _this2.setState({
385
319
  tableOrderStatus: {
@@ -388,7 +322,6 @@ export var TableProcessor = /*#__PURE__*/function (_React$Component2) {
388
322
  }
389
323
  });
390
324
  });
391
-
392
325
  _defineProperty(_assertThisInitialized(_this2), "addNumberColumnIndexes", function (rows) {
393
326
  var isNumberColumnEnabled = _this2.props.isNumberColumnEnabled;
394
327
  var headerRowEnabled = isHeaderRowEnabled(rows);
@@ -399,54 +332,45 @@ export var TableProcessor = /*#__PURE__*/function (_React$Component2) {
399
332
  });
400
333
  });
401
334
  });
402
-
403
335
  return _this2;
404
336
  }
405
-
406
337
  _createClass(TableProcessor, [{
407
338
  key: "render",
408
339
  value: function render() {
409
340
  var children = this.props.children;
410
-
411
341
  if (!children) {
412
342
  return null;
413
343
  }
414
-
415
344
  var childrenArray = React.Children.toArray(children);
416
345
  var orderedChildren = compose(this.addNumberColumnIndexes, this.addSortableColumn)(childrenArray);
417
346
  return /*#__PURE__*/React.createElement(TableContainer, this.props, orderedChildren);
418
- } // adds sortable + re-orders children
347
+ }
419
348
 
349
+ // adds sortable + re-orders children
420
350
  }]);
421
-
422
351
  return TableProcessor;
423
352
  }(React.Component);
424
353
  var TableWithShadows = overflowShadow(TableProcessor, {
425
354
  overflowSelector: ".".concat(TableSharedCssClassName.TABLE_NODE_WRAPPER),
426
355
  useShadowObserver: true
427
356
  });
428
-
429
357
  var TableWithWidth = function TableWithWidth(props) {
430
358
  return /*#__PURE__*/React.createElement(WidthConsumer, null, function (_ref2) {
431
359
  var _props$columnWidths;
432
-
433
360
  var width = _ref2.width;
434
361
  var renderWidth = props.rendererAppearance === 'full-page' ? width - FullPagePadding * 2 : width;
435
362
  var colWidthsSum = ((_props$columnWidths = props.columnWidths) === null || _props$columnWidths === void 0 ? void 0 : _props$columnWidths.reduce(function (total, val) {
436
363
  return total + val;
437
364
  }, 0)) || 0;
438
-
439
365
  if (colWidthsSum) {
440
366
  return /*#__PURE__*/React.createElement(TableWithShadows, _extends({
441
367
  renderWidth: renderWidth
442
368
  }, props));
443
- } // there should not be a case when colWidthsSum is 0 and table is in overflow state - so no need to render shadows in this case
444
-
445
-
369
+ }
370
+ // there should not be a case when colWidthsSum is 0 and table is in overflow state - so no need to render shadows in this case
446
371
  return /*#__PURE__*/React.createElement(TableProcessor, _extends({
447
372
  renderWidth: renderWidth
448
373
  }, props));
449
374
  });
450
375
  };
451
-
452
376
  export default withSmartCardStorage(TableWithWidth);
@@ -6,11 +6,8 @@ import _createClass from "@babel/runtime/helpers/createClass";
6
6
  import _inherits from "@babel/runtime/helpers/inherits";
7
7
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
8
8
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
9
-
10
9
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
-
12
10
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
-
14
11
  import React from 'react';
15
12
  import { tableBackgroundColorPalette } from '@atlaskit/adf-schema';
16
13
  import { compose } from '@atlaskit/editor-common/utils';
@@ -22,98 +19,77 @@ import { RendererCssClassName } from '../../consts';
22
19
  import { injectIntl } from 'react-intl-next';
23
20
  import { tableCellMessages } from '../../messages';
24
21
  var IgnoreSorting = ['LABEL', 'INPUT'];
25
-
26
22
  var nextStatusOrder = function nextStatusOrder(currentSortOrder) {
27
23
  switch (currentSortOrder) {
28
24
  case SortOrder.NO_ORDER:
29
25
  return SortOrder.ASC;
30
-
31
26
  case SortOrder.ASC:
32
27
  return SortOrder.DESC;
33
-
34
28
  case SortOrder.DESC:
35
29
  return SortOrder.NO_ORDER;
36
30
  }
37
-
38
31
  return SortOrder.NO_ORDER;
39
32
  };
40
-
41
33
  var getSortOrderLabel = function getSortOrderLabel(intl, currentSortOrder) {
42
34
  var noneSortingLabel = tableCellMessages.noneSortingLabel,
43
- ascSortingLabel = tableCellMessages.ascSortingLabel,
44
- descSortingLabel = tableCellMessages.descSortingLabel;
45
-
35
+ ascSortingLabel = tableCellMessages.ascSortingLabel,
36
+ descSortingLabel = tableCellMessages.descSortingLabel;
46
37
  switch (currentSortOrder) {
47
38
  case SortOrder.NO_ORDER:
48
39
  return intl.formatMessage(noneSortingLabel);
49
-
50
40
  case SortOrder.ASC:
51
41
  return intl.formatMessage(ascSortingLabel);
52
-
53
42
  case SortOrder.DESC:
54
43
  return intl.formatMessage(descSortingLabel);
55
-
56
44
  default:
57
45
  return intl.formatMessage(noneSortingLabel);
58
46
  }
59
47
  };
60
-
61
48
  var getDataAttributes = function getDataAttributes(colwidth) {
62
49
  var attrs = {};
63
-
64
50
  if (colwidth) {
65
51
  attrs['data-colwidth'] = colwidth.join(',');
66
52
  }
67
-
68
53
  return attrs;
69
54
  };
70
-
71
55
  var getStyle = function getStyle(background, colGroupWidth, offsetTop) {
72
56
  var style = {};
73
-
74
- if (background && // ignore setting inline styles if ds neutral token is detected
57
+ if (background &&
58
+ // ignore setting inline styles if ds neutral token is detected
75
59
  !background.includes('--ds-background-neutral')) {
76
60
  style.backgroundColor = background;
77
61
  }
78
-
79
62
  if (colGroupWidth) {
80
63
  style.width = colGroupWidth;
81
64
  style.minWidth = colGroupWidth;
82
65
  }
83
-
84
66
  if (offsetTop !== undefined) {
85
67
  style.top = offsetTop;
86
68
  }
87
-
88
69
  return style;
89
70
  };
90
-
91
71
  var withCellProps = function withCellProps(WrapperComponent) {
92
72
  return /*#__PURE__*/function (_React$Component) {
93
73
  _inherits(WithCellProps, _React$Component);
94
-
95
74
  var _super = _createSuper(WithCellProps);
96
-
97
75
  function WithCellProps() {
98
76
  _classCallCheck(this, WithCellProps);
99
-
100
77
  return _super.apply(this, arguments);
101
78
  }
102
-
103
79
  _createClass(WithCellProps, [{
104
80
  key: "render",
105
81
  value: function render() {
106
82
  var _this$props = this.props,
107
- children = _this$props.children,
108
- className = _this$props.className,
109
- onClick = _this$props.onClick,
110
- colwidth = _this$props.colwidth,
111
- colGroupWidth = _this$props.colGroupWidth,
112
- rowspan = _this$props.rowspan,
113
- colspan = _this$props.colspan,
114
- background = _this$props.background,
115
- offsetTop = _this$props.offsetTop,
116
- ariaSort = _this$props.ariaSort;
83
+ children = _this$props.children,
84
+ className = _this$props.className,
85
+ onClick = _this$props.onClick,
86
+ colwidth = _this$props.colwidth,
87
+ colGroupWidth = _this$props.colGroupWidth,
88
+ rowspan = _this$props.rowspan,
89
+ colspan = _this$props.colspan,
90
+ background = _this$props.background,
91
+ offsetTop = _this$props.offsetTop,
92
+ ariaSort = _this$props.ariaSort;
117
93
  var colorName = background ? tableBackgroundColorPalette.get(background) : '';
118
94
  return /*#__PURE__*/React.createElement(WrapperComponent, _extends({
119
95
  rowSpan: rowspan,
@@ -127,43 +103,33 @@ var withCellProps = function withCellProps(WrapperComponent) {
127
103
  }), children);
128
104
  }
129
105
  }]);
130
-
131
106
  return WithCellProps;
132
107
  }(React.Component);
133
108
  };
134
-
135
109
  export var withSortableColumn = function withSortableColumn(WrapperComponent) {
136
110
  var WithSortableColumn = /*#__PURE__*/function (_React$Component2) {
137
111
  _inherits(WithSortableColumn, _React$Component2);
138
-
139
112
  var _super2 = _createSuper(WithSortableColumn);
140
-
141
113
  function WithSortableColumn(props) {
142
114
  var _this;
143
-
144
115
  _classCallCheck(this, WithSortableColumn);
145
-
146
116
  _this = _super2.call(this, props);
147
-
148
117
  _defineProperty(_assertThisInitialized(_this), "onKeyPress", function (event) {
149
118
  var keys = [' ', 'Enter', 'Spacebar'];
150
119
  var _ref = event.target,
151
- tagName = _ref.tagName; // trigger sorting if space or enter are clicked but not when in an input field (template variables)
152
-
120
+ tagName = _ref.tagName;
121
+ // trigger sorting if space or enter are clicked but not when in an input field (template variables)
153
122
  if (keys.includes(event.key) && !IgnoreSorting.includes(tagName)) {
154
123
  event.preventDefault();
155
-
156
124
  _this.sort();
157
125
  }
158
126
  });
159
-
160
127
  _defineProperty(_assertThisInitialized(_this), "sort", function () {
161
128
  var _this$props2 = _this.props,
162
- fireAnalyticsEvent = _this$props2.fireAnalyticsEvent,
163
- onSorting = _this$props2.onSorting,
164
- columnIndex = _this$props2.columnIndex,
165
- sortOrdered = _this$props2.sortOrdered;
166
-
129
+ fireAnalyticsEvent = _this$props2.fireAnalyticsEvent,
130
+ onSorting = _this$props2.onSorting,
131
+ columnIndex = _this$props2.columnIndex,
132
+ sortOrdered = _this$props2.sortOrdered;
167
133
  if (onSorting && columnIndex != null) {
168
134
  var sortOrder = nextStatusOrder(sortOrdered);
169
135
  onSorting(columnIndex, sortOrder);
@@ -190,26 +156,22 @@ export var withSortableColumn = function withSortableColumn(WrapperComponent) {
190
156
  });
191
157
  }
192
158
  });
193
-
194
159
  return _this;
195
160
  }
196
-
197
161
  _createClass(WithSortableColumn, [{
198
162
  key: "render",
199
163
  value: function render() {
200
164
  var _this$props3 = this.props,
201
- allowColumnSorting = _this$props3.allowColumnSorting,
202
- onSorting = _this$props3.onSorting,
203
- children = _this$props3.children,
204
- sortOrdered = _this$props3.sortOrdered,
205
- isHeaderRow = _this$props3.isHeaderRow,
206
- intl = _this$props3.intl;
165
+ allowColumnSorting = _this$props3.allowColumnSorting,
166
+ onSorting = _this$props3.onSorting,
167
+ children = _this$props3.children,
168
+ sortOrdered = _this$props3.sortOrdered,
169
+ isHeaderRow = _this$props3.isHeaderRow,
170
+ intl = _this$props3.intl;
207
171
  var sortOrderedClassName = sortOrdered === SortOrder.NO_ORDER ? RendererCssClassName.SORTABLE_COLUMN_NO_ORDER : '';
208
-
209
172
  if (!allowColumnSorting || !isHeaderRow) {
210
173
  return /*#__PURE__*/React.createElement(WrapperComponent, this.props);
211
174
  }
212
-
213
175
  return /*#__PURE__*/React.createElement(WrapperComponent, _extends({}, this.props, {
214
176
  className: RendererCssClassName.SORTABLE_COLUMN_WRAPPER,
215
177
  ariaSort: getSortOrderLabel(intl, sortOrdered)
@@ -225,10 +187,8 @@ export var withSortableColumn = function withSortableColumn(WrapperComponent) {
225
187
  }))));
226
188
  }
227
189
  }]);
228
-
229
190
  return WithSortableColumn;
230
191
  }(React.Component);
231
-
232
192
  return injectIntl(WithSortableColumn);
233
193
  };
234
194
  export var TableHeader = compose(withSortableColumn, withCellProps)('th');