@frontify/guideline-blocks-settings 3.0.2 → 3.0.4

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 (262) hide show
  1. package/dist/_virtual/_rolldown/runtime.es.js +17 -0
  2. package/dist/components/Attachments/AttachmentItem.es.js +116 -168
  3. package/dist/components/Attachments/AttachmentItem.es.js.map +1 -1
  4. package/dist/components/Attachments/Attachments.es.js +145 -137
  5. package/dist/components/Attachments/Attachments.es.js.map +1 -1
  6. package/dist/components/Attachments/AttachmentsButtonTrigger.es.js +25 -28
  7. package/dist/components/Attachments/AttachmentsButtonTrigger.es.js.map +1 -1
  8. package/dist/components/BlockInjectButton/BlockInjectButton.es.js +114 -126
  9. package/dist/components/BlockInjectButton/BlockInjectButton.es.js.map +1 -1
  10. package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js +53 -74
  11. package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js.map +1 -1
  12. package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.es.js +26 -31
  13. package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.es.js.map +1 -1
  14. package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.es.js +22 -25
  15. package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.es.js.map +1 -1
  16. package/dist/components/BlockItemWrapper/Toolbar/BaseToolbarButton.es.js +17 -28
  17. package/dist/components/BlockItemWrapper/Toolbar/BaseToolbarButton.es.js.map +1 -1
  18. package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js +25 -35
  19. package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js.map +1 -1
  20. package/dist/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.es.js +41 -34
  21. package/dist/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.es.js.map +1 -1
  22. package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.es.js +41 -36
  23. package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.es.js.map +1 -1
  24. package/dist/components/BlockItemWrapper/Toolbar/Toolbar.es.js +24 -33
  25. package/dist/components/BlockItemWrapper/Toolbar/Toolbar.es.js.map +1 -1
  26. package/dist/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.es.js +20 -11
  27. package/dist/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.es.js.map +1 -1
  28. package/dist/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.es.js +18 -10
  29. package/dist/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.es.js.map +1 -1
  30. package/dist/components/BlockItemWrapper/Toolbar/ToolbarSegment.es.js +10 -12
  31. package/dist/components/BlockItemWrapper/Toolbar/ToolbarSegment.es.js.map +1 -1
  32. package/dist/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.es.js +13 -13
  33. package/dist/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.es.js.map +1 -1
  34. package/dist/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.es.js +21 -19
  35. package/dist/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.es.js.map +1 -1
  36. package/dist/components/BlockItemWrapper/Toolbar/helpers.es.js +18 -25
  37. package/dist/components/BlockItemWrapper/Toolbar/helpers.es.js.map +1 -1
  38. package/dist/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.es.js +18 -17
  39. package/dist/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.es.js.map +1 -1
  40. package/dist/components/BlockItemWrapper/constants.es.js +6 -6
  41. package/dist/components/BlockItemWrapper/constants.es.js.map +1 -1
  42. package/dist/components/Link/LinkInput.es.js +63 -63
  43. package/dist/components/Link/LinkInput.es.js.map +1 -1
  44. package/dist/components/Link/LinkSelector/DocumentLink.es.js +46 -63
  45. package/dist/components/Link/LinkSelector/DocumentLink.es.js.map +1 -1
  46. package/dist/components/Link/LinkSelector/DocumentLinks.es.js +50 -64
  47. package/dist/components/Link/LinkSelector/DocumentLinks.es.js.map +1 -1
  48. package/dist/components/Link/LinkSelector/LinkSelector2.es.js +77 -0
  49. package/dist/components/Link/LinkSelector/LinkSelector2.es.js.map +1 -0
  50. package/dist/components/Link/LinkSelector/LoadingIndicator.es.js +10 -6
  51. package/dist/components/Link/LinkSelector/LoadingIndicator.es.js.map +1 -1
  52. package/dist/components/Link/LinkSelector/PageLink.es.js +53 -67
  53. package/dist/components/Link/LinkSelector/PageLink.es.js.map +1 -1
  54. package/dist/components/Link/LinkSelector/PageLinks.es.js +28 -37
  55. package/dist/components/Link/LinkSelector/PageLinks.es.js.map +1 -1
  56. package/dist/components/Link/LinkSelector/SectionLink.es.js +31 -24
  57. package/dist/components/Link/LinkSelector/SectionLink.es.js.map +1 -1
  58. package/dist/components/Link/helpers/filterDocumentSectionsWithUnreadableTitles.es.js +6 -5
  59. package/dist/components/Link/helpers/filterDocumentSectionsWithUnreadableTitles.es.js.map +1 -1
  60. package/dist/components/Link/utils/getUrl.es.js +10 -12
  61. package/dist/components/Link/utils/getUrl.es.js.map +1 -1
  62. package/dist/components/Link/utils/relativeUrlRegex.es.js +6 -5
  63. package/dist/components/Link/utils/relativeUrlRegex.es.js.map +1 -1
  64. package/dist/components/Link/utils/url.es.js +21 -17
  65. package/dist/components/Link/utils/url.es.js.map +1 -1
  66. package/dist/components/RichTextEditor/RichTextEditor.es.js +61 -68
  67. package/dist/components/RichTextEditor/RichTextEditor.es.js.map +1 -1
  68. package/dist/components/RichTextEditor/SerializedText.es.js +25 -22
  69. package/dist/components/RichTextEditor/SerializedText.es.js.map +1 -1
  70. package/dist/components/RichTextEditor/constants.es.js +6 -5
  71. package/dist/components/RichTextEditor/constants.es.js.map +1 -1
  72. package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js +30 -37
  73. package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js.map +1 -1
  74. package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js +31 -39
  75. package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js.map +1 -1
  76. package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.es.js +12 -11
  77. package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.es.js.map +1 -1
  78. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js +19 -23
  79. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js.map +1 -1
  80. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js +24 -26
  81. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js.map +1 -1
  82. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js +46 -53
  83. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js.map +1 -1
  84. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js +52 -54
  85. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js.map +1 -1
  86. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js +68 -68
  87. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js.map +1 -1
  88. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js +91 -103
  89. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js.map +1 -1
  90. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js +26 -32
  91. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js.map +1 -1
  92. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js +47 -53
  93. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js.map +1 -1
  94. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.es.js +12 -18
  95. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.es.js.map +1 -1
  96. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.es.js +21 -25
  97. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.es.js.map +1 -1
  98. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js +29 -37
  99. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js.map +1 -1
  100. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.es.js +13 -17
  101. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.es.js.map +1 -1
  102. package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js +56 -62
  103. package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js.map +1 -1
  104. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js +9 -12
  105. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js.map +1 -1
  106. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js +23 -24
  107. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js.map +1 -1
  108. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js +28 -33
  109. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js.map +1 -1
  110. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js +61 -80
  111. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js.map +1 -1
  112. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js +23 -23
  113. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js.map +1 -1
  114. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js +18 -18
  115. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js.map +1 -1
  116. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js +13 -12
  117. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js.map +1 -1
  118. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js +9 -8
  119. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js.map +1 -1
  120. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.es.js +11 -10
  121. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.es.js.map +1 -1
  122. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.es.js +85 -84
  123. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.es.js.map +1 -1
  124. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js +13 -16
  125. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js.map +1 -1
  126. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js +13 -16
  127. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js.map +1 -1
  128. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js +10 -13
  129. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js.map +1 -1
  130. package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js +45 -51
  131. package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js.map +1 -1
  132. package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/ColumnBreakPlugin.es.js +20 -22
  133. package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/ColumnBreakPlugin.es.js.map +1 -1
  134. package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/helpers.es.js +12 -12
  135. package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/helpers.es.js.map +1 -1
  136. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js +48 -57
  137. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js.map +1 -1
  138. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js +46 -48
  139. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js.map +1 -1
  140. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js +12 -8
  141. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js.map +1 -1
  142. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js +62 -71
  143. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js.map +1 -1
  144. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js +76 -77
  145. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js.map +1 -1
  146. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js +17 -21
  147. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js.map +1 -1
  148. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js +17 -10
  149. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js.map +1 -1
  150. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js +11 -10
  151. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js.map +1 -1
  152. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkToolbarButton.es.js +22 -26
  153. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkToolbarButton.es.js.map +1 -1
  154. package/dist/components/RichTextEditor/plugins/LinkPlugin/id.es.js +6 -5
  155. package/dist/components/RichTextEditor/plugins/LinkPlugin/id.es.js.map +1 -1
  156. package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js +39 -40
  157. package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js.map +1 -1
  158. package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js +10 -10
  159. package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js.map +1 -1
  160. package/dist/components/RichTextEditor/plugins/OrderedListPlugin/index.es.js +26 -26
  161. package/dist/components/RichTextEditor/plugins/OrderedListPlugin/index.es.js.map +1 -1
  162. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js +40 -46
  163. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js.map +1 -1
  164. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js +40 -46
  165. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js.map +1 -1
  166. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js +40 -46
  167. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js.map +1 -1
  168. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js +41 -47
  169. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js.map +1 -1
  170. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js +41 -47
  171. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js.map +1 -1
  172. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js +41 -47
  173. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js.map +1 -1
  174. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js +41 -47
  175. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js.map +1 -1
  176. package/dist/components/RichTextEditor/plugins/TextStylePlugins/helpers.es.js +44 -38
  177. package/dist/components/RichTextEditor/plugins/TextStylePlugins/helpers.es.js.map +1 -1
  178. package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js +41 -47
  179. package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js.map +1 -1
  180. package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js +40 -46
  181. package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js.map +1 -1
  182. package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js +45 -41
  183. package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js.map +1 -1
  184. package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js +40 -48
  185. package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js.map +1 -1
  186. package/dist/components/RichTextEditor/plugins/UnorderedListPlugin/index.es.js +29 -29
  187. package/dist/components/RichTextEditor/plugins/UnorderedListPlugin/index.es.js.map +1 -1
  188. package/dist/components/RichTextEditor/plugins/styles.es.js +167 -166
  189. package/dist/components/RichTextEditor/plugins/styles.es.js.map +1 -1
  190. package/dist/helpers/addHttps.es.js +12 -12
  191. package/dist/helpers/addHttps.es.js.map +1 -1
  192. package/dist/helpers/convertToRichTextValue.es.js +14 -6
  193. package/dist/helpers/convertToRichTextValue.es.js.map +1 -1
  194. package/dist/helpers/hasRichTextValue.es.js +13 -14
  195. package/dist/helpers/hasRichTextValue.es.js.map +1 -1
  196. package/dist/helpers/isDownloadable.es.js +6 -5
  197. package/dist/helpers/isDownloadable.es.js.map +1 -1
  198. package/dist/hooks/useAttachments.es.js +65 -73
  199. package/dist/hooks/useAttachments.es.js.map +1 -1
  200. package/dist/hooks/useIsInViewport.es.js +20 -21
  201. package/dist/hooks/useIsInViewport.es.js.map +1 -1
  202. package/dist/index.cjs.js +6 -8
  203. package/dist/index.cjs.js.map +1 -1
  204. package/dist/index.d.ts +8 -7
  205. package/dist/index.es.js +221 -213
  206. package/dist/index.es.js.map +1 -1
  207. package/dist/index.umd.js +6 -8
  208. package/dist/index.umd.js.map +1 -1
  209. package/dist/settings/background.es.js +20 -21
  210. package/dist/settings/background.es.js.map +1 -1
  211. package/dist/settings/border.es.js +62 -64
  212. package/dist/settings/border.es.js.map +1 -1
  213. package/dist/settings/borderRadius.es.js +49 -52
  214. package/dist/settings/borderRadius.es.js.map +1 -1
  215. package/dist/settings/borderRadiusExtended.es.js +58 -60
  216. package/dist/settings/borderRadiusExtended.es.js.map +1 -1
  217. package/dist/settings/defaultValues.es.js +16 -19
  218. package/dist/settings/defaultValues.es.js.map +1 -1
  219. package/dist/settings/gutter.es.js +48 -52
  220. package/dist/settings/gutter.es.js.map +1 -1
  221. package/dist/settings/margin.es.js +49 -52
  222. package/dist/settings/margin.es.js.map +1 -1
  223. package/dist/settings/marginExtended.es.js +62 -64
  224. package/dist/settings/marginExtended.es.js.map +1 -1
  225. package/dist/settings/padding.es.js +49 -52
  226. package/dist/settings/padding.es.js.map +1 -1
  227. package/dist/settings/paddingExtended.es.js +62 -64
  228. package/dist/settings/paddingExtended.es.js.map +1 -1
  229. package/dist/settings/securityDownloadable.es.js +16 -16
  230. package/dist/settings/securityDownloadable.es.js.map +1 -1
  231. package/dist/settings/securityGlobalControl.es.js +26 -32
  232. package/dist/settings/securityGlobalControl.es.js.map +1 -1
  233. package/dist/settings/types.es.js +41 -47
  234. package/dist/settings/types.es.js.map +1 -1
  235. package/dist/styles.css +2 -1
  236. package/dist/utilities/color/getReadableColor.es.js +15 -13
  237. package/dist/utilities/color/getReadableColor.es.js.map +1 -1
  238. package/dist/utilities/color/isDark.es.js +14 -9
  239. package/dist/utilities/color/isDark.es.js.map +1 -1
  240. package/dist/utilities/color/setAlpha.es.js +7 -6
  241. package/dist/utilities/color/setAlpha.es.js.map +1 -1
  242. package/dist/utilities/color/toColorObject.es.js +14 -8
  243. package/dist/utilities/color/toColorObject.es.js.map +1 -1
  244. package/dist/utilities/color/toHex8String.es.js +7 -6
  245. package/dist/utilities/color/toHex8String.es.js.map +1 -1
  246. package/dist/utilities/color/toHexString.es.js +7 -6
  247. package/dist/utilities/color/toHexString.es.js.map +1 -1
  248. package/dist/utilities/color/toRgbaString.es.js +7 -6
  249. package/dist/utilities/color/toRgbaString.es.js.map +1 -1
  250. package/dist/utilities/color/toShortRgba.es.js +18 -11
  251. package/dist/utilities/color/toShortRgba.es.js.map +1 -1
  252. package/dist/utilities/react/getBackgroundColorStyles.es.js +7 -8
  253. package/dist/utilities/react/getBackgroundColorStyles.es.js.map +1 -1
  254. package/dist/utilities/react/getBorderStyles.es.js +12 -11
  255. package/dist/utilities/react/getBorderStyles.es.js.map +1 -1
  256. package/dist/utilities/react/getRadiusStyles.es.js +7 -8
  257. package/dist/utilities/react/getRadiusStyles.es.js.map +1 -1
  258. package/dist/utilities/react/joinClassNames.es.js +6 -5
  259. package/dist/utilities/react/joinClassNames.es.js.map +1 -1
  260. package/package.json +8 -10
  261. package/dist/components/Link/LinkSelector/LinkSelector.es.js +0 -72
  262. package/dist/components/Link/LinkSelector/LinkSelector.es.js.map +0 -1
@@ -1,65 +1,51 @@
1
- import { jsx as s, Fragment as x } from "react/jsx-runtime";
2
- import { useState as d, useEffect as m } from "react";
3
- import { filterDocumentSectionsWithUnreadableTitles as v } from "../helpers/filterDocumentSectionsWithUnreadableTitles.es.js";
4
- import { DocumentLink as E } from "./DocumentLink.es.js";
5
- import { LoadingIndicator as S } from "./LoadingIndicator.es.js";
6
- const O = ({
7
- selectedUrl: n,
8
- onSelectUrl: f,
9
- getAllDocuments: l,
10
- getDocumentPagesByDocumentId: r,
11
- getDocumentSectionsByDocumentPageId: a
12
- }) => {
13
- const [p, u] = d(!0), [e, I] = d([]), [g, L] = d({
14
- documentId: void 0,
15
- pageId: void 0
16
- });
17
- m(() => {
18
- n && e.length > 0 && h().then((t) => {
19
- L(t);
20
- });
21
- }, [e.length]), m(() => {
22
- l().then((t) => {
23
- I(t);
24
- }).finally(() => {
25
- u(!1);
26
- });
27
- }, []);
28
- const h = async () => {
29
- const t = {
30
- documentId: void 0,
31
- pageId: void 0
32
- };
33
- if (e.find((i) => i.permanentLink === n))
34
- return t;
35
- for (const i of e) {
36
- const c = await r(i.id);
37
- if (!!c.find((o) => o.permanentLink === n))
38
- return t.documentId = i.id, t;
39
- for (const o of c) {
40
- const T = await a(o.id);
41
- if (!!v(T).find(
42
- (k) => k.permanentLink === n
43
- ))
44
- return t.documentId = i.id, t.pageId = o.id, t;
45
- }
46
- }
47
- return t;
48
- };
49
- return p ? /* @__PURE__ */ s(S, {}) : /* @__PURE__ */ s(x, { children: e.map((t) => /* @__PURE__ */ s(
50
- E,
51
- {
52
- document: t,
53
- selectedUrl: n,
54
- onSelectUrl: f,
55
- itemsToExpandInitially: g,
56
- getDocumentSectionsByDocumentPageId: a,
57
- getDocumentPagesByDocumentId: r
58
- },
59
- t.id
60
- )) });
1
+ import { filterDocumentSectionsWithUnreadableTitles as e } from "../helpers/filterDocumentSectionsWithUnreadableTitles.es.js";
2
+ import { LoadingIndicator as t } from "./LoadingIndicator.es.js";
3
+ import { DocumentLink as n } from "./DocumentLink.es.js";
4
+ import { useEffect as r, useState as i } from "react";
5
+ import { Fragment as a, jsx as o } from "react/jsx-runtime";
6
+ //#region src/components/Link/LinkSelector/DocumentLinks.tsx
7
+ var s = ({ selectedUrl: s, onSelectUrl: c, getAllDocuments: l, getDocumentPagesByDocumentId: u, getDocumentSectionsByDocumentPageId: d }) => {
8
+ let [f, p] = i(!0), [m, h] = i([]), [g, _] = i({
9
+ documentId: void 0,
10
+ pageId: void 0
11
+ });
12
+ r(() => {
13
+ s && m.length > 0 && v().then((e) => {
14
+ _(e);
15
+ });
16
+ }, [m.length]), r(() => {
17
+ l().then((e) => {
18
+ h(e);
19
+ }).finally(() => {
20
+ p(!1);
21
+ });
22
+ }, []);
23
+ let v = async () => {
24
+ let t = {
25
+ documentId: void 0,
26
+ pageId: void 0
27
+ };
28
+ if (m.find((e) => e.permanentLink === s)) return t;
29
+ for (let n of m) {
30
+ let r = await u(n.id);
31
+ if (r.find((e) => e.permanentLink === s)) return t.documentId = n.id, t;
32
+ for (let i of r) {
33
+ let r = await d(i.id);
34
+ if (e(r).find((e) => e.permanentLink === s)) return t.documentId = n.id, t.pageId = i.id, t;
35
+ }
36
+ }
37
+ return t;
38
+ };
39
+ return f ? /* @__PURE__ */ o(t, {}) : /* @__PURE__ */ o(a, { children: m.map((e) => /* @__PURE__ */ o(n, {
40
+ document: e,
41
+ selectedUrl: s,
42
+ onSelectUrl: c,
43
+ itemsToExpandInitially: g,
44
+ getDocumentSectionsByDocumentPageId: d,
45
+ getDocumentPagesByDocumentId: u
46
+ }, e.id)) });
61
47
  };
62
- export {
63
- O as DocumentLinks
64
- };
65
- //# sourceMappingURL=DocumentLinks.es.js.map
48
+ //#endregion
49
+ export { s as DocumentLinks };
50
+
51
+ //# sourceMappingURL=DocumentLinks.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentLinks.es.js","sources":["../../../../src/components/Link/LinkSelector/DocumentLinks.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Document, type DocumentPage, type DocumentSection } from '@frontify/app-bridge';\nimport { type ReactElement, useEffect, useState } from 'react';\n\nimport { filterDocumentSectionsWithUnreadableTitles } from '../helpers/filterDocumentSectionsWithUnreadableTitles';\nimport { type InitiallyExpandedItems } from '../types';\n\nimport { DocumentLink } from './DocumentLink';\nimport { LoadingIndicator } from './LoadingIndicator';\n\ntype DocumentLinksProps = {\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n getAllDocuments: () => Promise<Document[]>;\n getDocumentSectionsByDocumentPageId: (documentPageId: number) => Promise<DocumentSection[]>;\n getDocumentPagesByDocumentId: (documentId: number) => Promise<DocumentPage[]>;\n};\n\nexport const DocumentLinks = ({\n selectedUrl,\n onSelectUrl,\n getAllDocuments,\n getDocumentPagesByDocumentId,\n getDocumentSectionsByDocumentPageId,\n}: DocumentLinksProps): ReactElement => {\n const [isLoading, setIsLoading] = useState(true);\n const [documents, setDocuments] = useState<Document[]>([]);\n const [itemsToExpandInitially, setItemsToExpandInitially] = useState<InitiallyExpandedItems>({\n documentId: undefined,\n pageId: undefined,\n });\n\n useEffect(() => {\n if (selectedUrl && documents.length > 0) {\n findLocationOfSelectedUrl().then((items) => {\n setItemsToExpandInitially(items);\n });\n }\n // oxlint-disable-next-line @eslint-react/exhaustive-deps\n }, [documents.length]);\n\n useEffect(() => {\n getAllDocuments()\n .then((_documents) => {\n setDocuments(_documents);\n })\n .finally(() => {\n setIsLoading(false);\n });\n // oxlint-disable-next-line @eslint-react/exhaustive-deps\n }, []);\n\n const findLocationOfSelectedUrl = async () => {\n const itemsToExpand: InitiallyExpandedItems = {\n documentId: undefined,\n pageId: undefined,\n };\n const selectedUrlIsDocument = documents.find((document) => document.permanentLink === selectedUrl);\n if (selectedUrlIsDocument) {\n return itemsToExpand;\n }\n for (const document of documents) {\n const pages = await getDocumentPagesByDocumentId(document.id);\n const selectedUrlIsPage = !!pages.find((page) => page.permanentLink === selectedUrl);\n if (selectedUrlIsPage) {\n itemsToExpand.documentId = document.id;\n return itemsToExpand;\n }\n for (const page of pages) {\n const sections = await getDocumentSectionsByDocumentPageId(page.id);\n const sectionsWithReadableTitles = filterDocumentSectionsWithUnreadableTitles(sections);\n const selectedUrlIsSection = !!sectionsWithReadableTitles.find(\n (section) => section.permanentLink === selectedUrl,\n );\n if (selectedUrlIsSection) {\n itemsToExpand.documentId = document.id;\n itemsToExpand.pageId = page.id;\n return itemsToExpand;\n }\n }\n }\n return itemsToExpand;\n };\n\n return isLoading ? (\n <LoadingIndicator />\n ) : (\n <>\n {documents.map((document) => {\n return (\n <DocumentLink\n key={document.id}\n document={document}\n selectedUrl={selectedUrl}\n onSelectUrl={onSelectUrl}\n itemsToExpandInitially={itemsToExpandInitially}\n getDocumentSectionsByDocumentPageId={getDocumentSectionsByDocumentPageId}\n getDocumentPagesByDocumentId={getDocumentPagesByDocumentId}\n />\n );\n })}\n </>\n );\n};\n"],"names":["DocumentLinks","selectedUrl","onSelectUrl","getAllDocuments","getDocumentPagesByDocumentId","getDocumentSectionsByDocumentPageId","isLoading","setIsLoading","useState","documents","setDocuments","itemsToExpandInitially","setItemsToExpandInitially","useEffect","findLocationOfSelectedUrl","items","_documents","itemsToExpand","document","pages","page","sections","filterDocumentSectionsWithUnreadableTitles","section","LoadingIndicator","jsx","DocumentLink"],"mappings":";;;;;AAmBO,MAAMA,IAAgB,CAAC;AAAA,EAC1B,aAAAC;AAAA,EACA,aAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,8BAAAC;AAAA,EACA,qCAAAC;AACJ,MAAwC;AACpC,QAAM,CAACC,GAAWC,CAAY,IAAIC,EAAS,EAAI,GACzC,CAACC,GAAWC,CAAY,IAAIF,EAAqB,CAAA,CAAE,GACnD,CAACG,GAAwBC,CAAyB,IAAIJ,EAAiC;AAAA,IACzF,YAAY;AAAA,IACZ,QAAQ;AAAA,EAAA,CACX;AAED,EAAAK,EAAU,MAAM;AACZ,IAAIZ,KAAeQ,EAAU,SAAS,KAClCK,EAAA,EAA4B,KAAK,CAACC,MAAU;AACxC,MAAAH,EAA0BG,CAAK;AAAA,IACnC,CAAC;AAAA,EAGT,GAAG,CAACN,EAAU,MAAM,CAAC,GAErBI,EAAU,MAAM;AACZ,IAAAV,EAAA,EACK,KAAK,CAACa,MAAe;AAClB,MAAAN,EAAaM,CAAU;AAAA,IAC3B,CAAC,EACA,QAAQ,MAAM;AACX,MAAAT,EAAa,EAAK;AAAA,IACtB,CAAC;AAAA,EAET,GAAG,CAAA,CAAE;AAEL,QAAMO,IAA4B,YAAY;AAC1C,UAAMG,IAAwC;AAAA,MAC1C,YAAY;AAAA,MACZ,QAAQ;AAAA,IAAA;AAGZ,QAD8BR,EAAU,KAAK,CAACS,MAAaA,EAAS,kBAAkBjB,CAAW;AAE7F,aAAOgB;AAEX,eAAWC,KAAYT,GAAW;AAC9B,YAAMU,IAAQ,MAAMf,EAA6Bc,EAAS,EAAE;AAE5D,UAD0B,CAAC,CAACC,EAAM,KAAK,CAACC,MAASA,EAAK,kBAAkBnB,CAAW;AAE/E,eAAAgB,EAAc,aAAaC,EAAS,IAC7BD;AAEX,iBAAWG,KAAQD,GAAO;AACtB,cAAME,IAAW,MAAMhB,EAAoCe,EAAK,EAAE;AAKlE,YAH6B,CAAC,CADKE,EAA2CD,CAAQ,EAC5B;AAAA,UACtD,CAACE,MAAYA,EAAQ,kBAAkBtB;AAAA,QAAA;AAGvC,iBAAAgB,EAAc,aAAaC,EAAS,IACpCD,EAAc,SAASG,EAAK,IACrBH;AAAA,MAEf;AAAA,IACJ;AACA,WAAOA;AAAA,EACX;AAEA,SAAOX,sBACFkB,GAAA,CAAA,CAAiB,2BAGb,UAAAf,EAAU,IAAI,CAACS,MAER,gBAAAO;AAAA,IAACC;AAAA,IAAA;AAAA,MAEG,UAAAR;AAAA,MACA,aAAAjB;AAAA,MACA,aAAAC;AAAA,MACA,wBAAAS;AAAA,MACA,qCAAAN;AAAA,MACA,8BAAAD;AAAA,IAAA;AAAA,IANKc,EAAS;AAAA,EAAA,CASzB,EAAA,CACL;AAER;"}
1
+ {"version":3,"file":"DocumentLinks.es.js","names":[],"sources":["../../../../src/components/Link/LinkSelector/DocumentLinks.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Document, type DocumentPage, type DocumentSection } from '@frontify/app-bridge';\nimport { type ReactElement, useEffect, useState } from 'react';\n\nimport { filterDocumentSectionsWithUnreadableTitles } from '../helpers/filterDocumentSectionsWithUnreadableTitles';\nimport { type InitiallyExpandedItems } from '../types';\n\nimport { DocumentLink } from './DocumentLink';\nimport { LoadingIndicator } from './LoadingIndicator';\n\ntype DocumentLinksProps = {\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n getAllDocuments: () => Promise<Document[]>;\n getDocumentSectionsByDocumentPageId: (documentPageId: number) => Promise<DocumentSection[]>;\n getDocumentPagesByDocumentId: (documentId: number) => Promise<DocumentPage[]>;\n};\n\nexport const DocumentLinks = ({\n selectedUrl,\n onSelectUrl,\n getAllDocuments,\n getDocumentPagesByDocumentId,\n getDocumentSectionsByDocumentPageId,\n}: DocumentLinksProps): ReactElement => {\n const [isLoading, setIsLoading] = useState(true);\n const [documents, setDocuments] = useState<Document[]>([]);\n const [itemsToExpandInitially, setItemsToExpandInitially] = useState<InitiallyExpandedItems>({\n documentId: undefined,\n pageId: undefined,\n });\n\n useEffect(() => {\n if (selectedUrl && documents.length > 0) {\n findLocationOfSelectedUrl().then((items) => {\n setItemsToExpandInitially(items);\n });\n }\n // oxlint-disable-next-line @eslint-react/exhaustive-deps\n }, [documents.length]);\n\n useEffect(() => {\n getAllDocuments()\n .then((_documents) => {\n setDocuments(_documents);\n })\n .finally(() => {\n setIsLoading(false);\n });\n // oxlint-disable-next-line @eslint-react/exhaustive-deps\n }, []);\n\n const findLocationOfSelectedUrl = async () => {\n const itemsToExpand: InitiallyExpandedItems = {\n documentId: undefined,\n pageId: undefined,\n };\n const selectedUrlIsDocument = documents.find((document) => document.permanentLink === selectedUrl);\n if (selectedUrlIsDocument) {\n return itemsToExpand;\n }\n for (const document of documents) {\n const pages = await getDocumentPagesByDocumentId(document.id);\n const selectedUrlIsPage = !!pages.find((page) => page.permanentLink === selectedUrl);\n if (selectedUrlIsPage) {\n itemsToExpand.documentId = document.id;\n return itemsToExpand;\n }\n for (const page of pages) {\n const sections = await getDocumentSectionsByDocumentPageId(page.id);\n const sectionsWithReadableTitles = filterDocumentSectionsWithUnreadableTitles(sections);\n const selectedUrlIsSection = !!sectionsWithReadableTitles.find(\n (section) => section.permanentLink === selectedUrl,\n );\n if (selectedUrlIsSection) {\n itemsToExpand.documentId = document.id;\n itemsToExpand.pageId = page.id;\n return itemsToExpand;\n }\n }\n }\n return itemsToExpand;\n };\n\n return isLoading ? (\n <LoadingIndicator />\n ) : (\n <>\n {documents.map((document) => {\n return (\n <DocumentLink\n key={document.id}\n document={document}\n selectedUrl={selectedUrl}\n onSelectUrl={onSelectUrl}\n itemsToExpandInitially={itemsToExpandInitially}\n getDocumentSectionsByDocumentPageId={getDocumentSectionsByDocumentPageId}\n getDocumentPagesByDocumentId={getDocumentPagesByDocumentId}\n />\n );\n })}\n </>\n );\n};\n"],"mappings":";;;;;;AAmBA,IAAa,KAAiB,EAC1B,gBACA,gBACA,oBACA,iCACA,6CACoC;CACpC,IAAM,CAAC,GAAW,KAAgB,EAAS,EAAI,GACzC,CAAC,GAAW,KAAgB,EAAqB,CAAC,CAAC,GACnD,CAAC,GAAwB,KAA6B,EAAiC;EACzF,YAAY,KAAA;EACZ,QAAQ,KAAA;CACZ,CAAC;CAWD,AATA,QAAgB;EACZ,AAAI,KAAe,EAAU,SAAS,KAClC,EAA0B,CAAC,CAAC,MAAM,MAAU;GACxC,EAA0B,CAAK;EACnC,CAAC;CAGT,GAAG,CAAC,EAAU,MAAM,CAAC,GAErB,QAAgB;EACZ,EAAgB,CAAC,CACZ,MAAM,MAAe;GAClB,EAAa,CAAU;EAC3B,CAAC,CAAC,CACD,cAAc;GACX,EAAa,EAAK;EACtB,CAAC;CAET,GAAG,CAAC,CAAC;CAEL,IAAM,IAA4B,YAAY;EAC1C,IAAM,IAAwC;GAC1C,YAAY,KAAA;GACZ,QAAQ,KAAA;EACZ;EAEA,IAD8B,EAAU,MAAM,MAAa,EAAS,kBAAkB,CAClF,GACA,OAAO;EAEX,KAAK,IAAM,KAAY,GAAW;GAC9B,IAAM,IAAQ,MAAM,EAA6B,EAAS,EAAE;GAE5D,IAD4B,EAAM,MAAM,MAAS,EAAK,kBAAkB,CAAW,GAG/E,OADA,EAAc,aAAa,EAAS,IAC7B;GAEX,KAAK,IAAM,KAAQ,GAAO;IACtB,IAAM,IAAW,MAAM,EAAoC,EAAK,EAAE;IAKlE,IAJmC,EAA2C,CAC/C,CAAA,CAA2B,MACrD,MAAY,EAAQ,kBAAkB,CAC3C,GAII,OAFA,EAAc,aAAa,EAAS,IACpC,EAAc,SAAS,EAAK,IACrB;GAEf;EACJ;EACA,OAAO;CACX;CAEA,OAAO,IACH,kBAAC,GAAD,CAAmB,CAAA,IAEnB,kBAAA,GAAA,EAAA,UACK,EAAU,KAAK,MAER,kBAAC,GAAD;EAEc;EACG;EACA;EACW;EACa;EACP;CACjC,GAPQ,EAAS,EAOjB,CAER,EACH,CAAA;AAEV"}
@@ -0,0 +1,77 @@
1
+ /* empty css */
2
+ import { DocumentLinks as e } from "./DocumentLinks.es.js";
3
+ import { Button as t, Dialog as n, ScrollArea as r } from "@frontify/fondue/components";
4
+ import { IconLink as i } from "@frontify/fondue/icons";
5
+ import { useEffect as a, useState as o } from "react";
6
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
+ //#region src/components/Link/LinkSelector/LinkSelector.tsx
8
+ var l = ({ url: l, onUrlChange: u, buttonSize: d = "medium", getAllDocuments: f, getDocumentPagesByDocumentId: p, getDocumentSectionsByDocumentPageId: m }) => {
9
+ let [h, g] = o(!1), [_, v] = o(l), y = (e) => {
10
+ v(e);
11
+ }, b = (e) => {
12
+ e.key === "Enter" && (e.preventDefault(), x());
13
+ };
14
+ a(() => {
15
+ l && !_ && v(l);
16
+ }, [l, _]);
17
+ let x = () => {
18
+ u?.(_), g(!1);
19
+ };
20
+ return /* @__PURE__ */ s("div", {
21
+ onPointerDown: (e) => {
22
+ e.preventDefault();
23
+ },
24
+ "data-test-id": "internal-link-selector",
25
+ onKeyDown: b,
26
+ children: /* @__PURE__ */ c(n.Root, {
27
+ modal: !0,
28
+ open: h,
29
+ onOpenChange: g,
30
+ children: [/* @__PURE__ */ s(n.Trigger, {
31
+ asChild: !0,
32
+ children: /* @__PURE__ */ c(t, {
33
+ size: d,
34
+ emphasis: "default",
35
+ children: [/* @__PURE__ */ s(i, { size: "20" }), "Internal link"]
36
+ })
37
+ }), /* @__PURE__ */ c(n.Content, {
38
+ onOpenAutoFocus: () => {},
39
+ showUnderlay: !0,
40
+ "data-is-underlay": !0,
41
+ minWidth: "800px",
42
+ children: [
43
+ /* @__PURE__ */ s(n.Header, { children: /* @__PURE__ */ s(n.Title, { children: "Select internal link" }) }),
44
+ /* @__PURE__ */ s(n.Body, {
45
+ padding: "none",
46
+ children: /* @__PURE__ */ s(r, {
47
+ padding: "compact",
48
+ children: /* @__PURE__ */ s(e, {
49
+ selectedUrl: _,
50
+ onSelectUrl: y,
51
+ getAllDocuments: f,
52
+ getDocumentPagesByDocumentId: p,
53
+ getDocumentSectionsByDocumentPageId: m
54
+ })
55
+ })
56
+ }),
57
+ /* @__PURE__ */ c(n.Footer, { children: [/* @__PURE__ */ s(t, {
58
+ size: d,
59
+ emphasis: "default",
60
+ onPress: () => g(!1),
61
+ children: "Cancel"
62
+ }), /* @__PURE__ */ s(t, {
63
+ size: d,
64
+ disabled: !_,
65
+ emphasis: "strong",
66
+ onPress: () => x(),
67
+ children: "Choose"
68
+ })] })
69
+ ]
70
+ })]
71
+ })
72
+ });
73
+ };
74
+ //#endregion
75
+ export { l as LinkSelector };
76
+
77
+ //# sourceMappingURL=LinkSelector2.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinkSelector2.es.js","names":[],"sources":["../../../../src/components/Link/LinkSelector/LinkSelector.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Document, type DocumentPage, type DocumentSection } from '@frontify/app-bridge';\nimport { Button, Dialog, ScrollArea } from '@frontify/fondue/components';\nimport { IconLink } from '@frontify/fondue/icons';\nimport { type KeyboardEvent, type ReactElement, useEffect, useState } from 'react';\n\nimport './LinkSelector.css';\nimport { DocumentLinks } from './DocumentLinks';\n\ntype LinkSelectorProps = {\n url: string;\n onUrlChange?: (value: string) => void;\n buttonSize?: 'small' | 'medium' | 'large';\n getAllDocuments: () => Promise<Document[]>;\n getDocumentSectionsByDocumentPageId: (documentPageId: number) => Promise<DocumentSection[]>;\n getDocumentPagesByDocumentId: (documentId: number) => Promise<DocumentPage[]>;\n};\n\nexport const LinkSelector = ({\n url,\n onUrlChange,\n buttonSize = 'medium',\n getAllDocuments,\n getDocumentPagesByDocumentId,\n getDocumentSectionsByDocumentPageId,\n}: LinkSelectorProps): ReactElement => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n const [selectedUrl, setSelectedUrl] = useState<string>(url);\n\n const onSelectUrl = (url: string) => {\n setSelectedUrl(url);\n };\n\n const onPressEnter = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n event.preventDefault();\n saveLink();\n }\n };\n\n useEffect(() => {\n if (url && !selectedUrl) {\n // oxlint-disable-next-line @eslint-react/set-state-in-effect\n setSelectedUrl(url);\n }\n }, [url, selectedUrl]);\n\n const saveLink = () => {\n onUrlChange?.(selectedUrl);\n setIsModalOpen(false);\n };\n\n const dialogProps = {\n onOpenAutoFocus: () => {},\n showUnderlay: true,\n 'data-is-underlay': true,\n minWidth: '800px',\n };\n\n return (\n // oxlint-disable-next-line jsx-a11y-x/no-static-element-interactions\n <div\n onPointerDown={(event) => {\n event.preventDefault();\n }}\n data-test-id=\"internal-link-selector\"\n onKeyDown={onPressEnter}\n >\n <Dialog.Root modal open={isModalOpen} onOpenChange={setIsModalOpen}>\n <Dialog.Trigger asChild>\n <Button size={buttonSize} emphasis=\"default\">\n <IconLink size=\"20\" />\n Internal link\n </Button>\n </Dialog.Trigger>\n <Dialog.Content {...dialogProps}>\n <Dialog.Header>\n <Dialog.Title>Select internal link</Dialog.Title>\n </Dialog.Header>\n <Dialog.Body padding=\"none\">\n <ScrollArea padding=\"compact\">\n <DocumentLinks\n selectedUrl={selectedUrl}\n onSelectUrl={onSelectUrl}\n getAllDocuments={getAllDocuments}\n getDocumentPagesByDocumentId={getDocumentPagesByDocumentId}\n getDocumentSectionsByDocumentPageId={getDocumentSectionsByDocumentPageId}\n />\n </ScrollArea>\n </Dialog.Body>\n <Dialog.Footer>\n <Button size={buttonSize} emphasis=\"default\" onPress={() => setIsModalOpen(false)}>\n Cancel\n </Button>\n <Button size={buttonSize} disabled={!selectedUrl} emphasis=\"strong\" onPress={() => saveLink()}>\n Choose\n </Button>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog.Root>\n </div>\n );\n};\n"],"mappings":";;;;;;;AAmBA,IAAa,KAAgB,EACzB,QACA,gBACA,gBAAa,UACb,oBACA,iCACA,6CACmC;CACnC,IAAM,CAAC,GAAa,KAAkB,EAAS,EAAK,GAC9C,CAAC,GAAa,KAAkB,EAAiB,CAAG,GAEpD,KAAe,MAAgB;EACjC,EAAe,CAAG;CACtB,GAEM,KAAgB,MAA2C;EAC7D,AAAI,EAAM,QAAQ,YACd,EAAM,eAAe,GACrB,EAAS;CAEjB;CAEA,QAAgB;EACZ,AAAI,KAAO,CAAC,KAER,EAAe,CAAG;CAE1B,GAAG,CAAC,GAAK,CAAW,CAAC;CAErB,IAAM,UAAiB;EAEnB,AADA,IAAc,CAAW,GACzB,EAAe,EAAK;CACxB;CASA,OAEI,kBAAC,OAAD;EACI,gBAAgB,MAAU;GACtB,EAAM,eAAe;EACzB;EACA,gBAAa;EACb,WAAW;EAEX,UAAA,kBAAC,EAAO,MAAR;GAAa,OAAA;GAAM,MAAM;GAAa,cAAc;GAApD,UAAA,CACI,kBAAC,EAAO,SAAR;IAAgB,SAAA;IACZ,UAAA,kBAAC,GAAD;KAAQ,MAAM;KAAY,UAAS;KAAnC,UAAA,CACI,kBAAC,GAAD,EAAU,MAAK,KAAM,CAAA,GAAC,eAElB;;GACI,CAAA,GAChB,kBAAC,EAAO,SAAR;IAtBR,uBAAuB,CAAC;IACxB,cAAc;IACd,oBAAoB;IACpB,UAAU;IAmBF,UAAA;KACI,kBAAC,EAAO,QAAR,EAAA,UACI,kBAAC,EAAO,OAAR,EAAA,UAAc,uBAAkC,CAAA,EACrC,CAAA;KACf,kBAAC,EAAO,MAAR;MAAa,SAAQ;MACjB,UAAA,kBAAC,GAAD;OAAY,SAAQ;OAChB,UAAA,kBAAC,GAAD;QACiB;QACA;QACI;QACa;QACO;OACxC,CAAA;MACO,CAAA;KACH,CAAA;KACb,kBAAC,EAAO,QAAR,EAAA,UAAA,CACI,kBAAC,GAAD;MAAQ,MAAM;MAAY,UAAS;MAAU,eAAe,EAAe,EAAK;MAAG,UAAA;KAE3E,CAAA,GACR,kBAAC,GAAD;MAAQ,MAAM;MAAY,UAAU,CAAC;MAAa,UAAS;MAAS,eAAe,EAAS;MAAG,UAAA;KAEvF,CAAA,CACG,EAAA,CAAA;IACH;GACP,CAAA,CAAA;;CACZ,CAAA;AAEb"}
@@ -1,7 +1,11 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
1
  import { LoadingCircle as e } from "@frontify/fondue/components";
3
- const o = () => /* @__PURE__ */ t("div", { className: "tw-flex tw-justify-center tw-h-10 tw-items-center", children: /* @__PURE__ */ t(e, { size: "small" }) });
4
- export {
5
- o as LoadingIndicator
6
- };
7
- //# sourceMappingURL=LoadingIndicator.es.js.map
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ //#region src/components/Link/LinkSelector/LoadingIndicator.tsx
4
+ var n = () => /* @__PURE__ */ t("div", {
5
+ className: "tw-flex tw-justify-center tw-h-10 tw-items-center",
6
+ children: /* @__PURE__ */ t(e, { size: "small" })
7
+ });
8
+ //#endregion
9
+ export { n as LoadingIndicator };
10
+
11
+ //# sourceMappingURL=LoadingIndicator.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LoadingIndicator.es.js","sources":["../../../../src/components/Link/LinkSelector/LoadingIndicator.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { LoadingCircle } from '@frontify/fondue/components';\n\nexport const LoadingIndicator = () => {\n return (\n <div className=\"tw-flex tw-justify-center tw-h-10 tw-items-center\">\n <LoadingCircle size=\"small\" />\n </div>\n );\n};\n"],"names":["LoadingIndicator","jsx","LoadingCircle"],"mappings":";;AAIO,MAAMA,IAAmB,MAExB,gBAAAC,EAAC,SAAI,WAAU,qDACX,4BAACC,GAAA,EAAc,MAAK,SAAQ,EAAA,CAChC;"}
1
+ {"version":3,"file":"LoadingIndicator.es.js","names":[],"sources":["../../../../src/components/Link/LinkSelector/LoadingIndicator.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { LoadingCircle } from '@frontify/fondue/components';\n\nexport const LoadingIndicator = () => {\n return (\n <div className=\"tw-flex tw-justify-center tw-h-10 tw-items-center\">\n <LoadingCircle size=\"small\" />\n </div>\n );\n};\n"],"mappings":";;;AAIA,IAAa,UAEL,kBAAC,OAAD;CAAK,WAAU;CACX,UAAA,kBAAC,GAAD,EAAe,MAAK,QAAS,CAAA;AAC5B,CAAA"}
@@ -1,69 +1,55 @@
1
- import { jsxs as l, Fragment as x, jsx as n } from "react/jsx-runtime";
2
- import { useState as d, useEffect as m } from "react";
3
- import { filterDocumentSectionsWithUnreadableTitles as g } from "../helpers/filterDocumentSectionsWithUnreadableTitles.es.js";
4
- import { SectionLink as v } from "./SectionLink.es.js";
5
- const L = ({
6
- page: t,
7
- selectedUrl: s,
8
- onSelectUrl: c,
9
- itemsToExpandInitially: r,
10
- getDocumentSectionsByDocumentPageId: w
11
- }) => {
12
- const [o, a] = d(t.id === r.documentId), [i, p] = d([]), f = t.permanentLink === s;
13
- m(() => {
14
- (async () => {
15
- const b = await w(t.id), u = g(b);
16
- p(u);
17
- })();
18
- }, [t.id, w]), m(() => {
19
- t.id === r.pageId && a(!0);
20
- }, [r, t.id]);
21
- const h = i.length > 0;
22
- return /* @__PURE__ */ l(x, { children: [
23
- /* @__PURE__ */ n(
24
- "button",
25
- {
26
- type: "button",
27
- "data-test-id": "internal-link-selector-page-link",
28
- className: `
1
+ import { filterDocumentSectionsWithUnreadableTitles as e } from "../helpers/filterDocumentSectionsWithUnreadableTitles.es.js";
2
+ import { SectionLink as t } from "./SectionLink.es.js";
3
+ import { useEffect as n, useState as r } from "react";
4
+ import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
5
+ //#region src/components/Link/LinkSelector/PageLink.tsx
6
+ var s = ({ page: s, selectedUrl: c, onSelectUrl: l, itemsToExpandInitially: u, getDocumentSectionsByDocumentPageId: d }) => {
7
+ let [f, p] = r(s.id === u.documentId), [m, h] = r([]), g = s.permanentLink === c;
8
+ n(() => {
9
+ (async () => {
10
+ let t = await d(s.id), n = e(t);
11
+ h(n);
12
+ })();
13
+ }, [s.id, d]), n(() => {
14
+ s.id === u.pageId && p(!0);
15
+ }, [u, s.id]);
16
+ let _ = m.length > 0;
17
+ return /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a("button", {
18
+ type: "button",
19
+ "data-test-id": "internal-link-selector-page-link",
20
+ className: `
29
21
  tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-flex tw-w-full
30
- ${h ? "tw-pl-7 " : "tw-pl-12 "}
31
- ${f ? "tw-bg-highlight tw-text-highlight-on-highlight hover:tw-bg-highlight-hover:hover hover:tw-text-highlight-on-highlight:hover " : "hover:tw-bg-container-secondary-hover hover:tw-text-container-secondary-on-secondary-container "}`,
32
- onClick: () => c(t.permanentLink),
33
- children: /* @__PURE__ */ l("div", { className: "tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6", children: [
34
- h && /* @__PURE__ */ n(
35
- "button",
36
- {
37
- type: "button",
38
- className: "tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer",
39
- onClick: () => a(!o),
40
- onKeyDown: (e) => e.key === "Enter" && e.stopPropagation(),
41
- children: /* @__PURE__ */ n(
42
- "div",
43
- {
44
- className: `tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong
45
- ${o ? "tw-rotate-90 " : ""}`
46
- }
47
- )
48
- }
49
- ),
50
- /* @__PURE__ */ n("span", { className: "tw-text-small", children: t.title }),
51
- /* @__PURE__ */ n("span", { className: "tw-flex-auto tw-font-sans tw-text-x-small tw-text-right", children: "Page" })
52
- ] }, t.id)
53
- }
54
- ),
55
- o && i.length > 0 && i.map((e) => /* @__PURE__ */ n(
56
- v,
57
- {
58
- section: e,
59
- selectedUrl: s,
60
- onSelectUrl: c
61
- },
62
- e.id
63
- ))
64
- ] });
22
+ ${_ ? "tw-pl-7 " : "tw-pl-12 "}
23
+ ${g ? "tw-bg-highlight tw-text-highlight-on-highlight hover:tw-bg-highlight-hover:hover hover:tw-text-highlight-on-highlight:hover " : "hover:tw-bg-container-secondary-hover hover:tw-text-container-secondary-on-secondary-container "}`,
24
+ onClick: () => l(s.permanentLink),
25
+ children: /* @__PURE__ */ o("div", {
26
+ className: "tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6",
27
+ children: [
28
+ _ && /* @__PURE__ */ a("button", {
29
+ type: "button",
30
+ className: "tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer",
31
+ onClick: () => p(!f),
32
+ onKeyDown: (e) => e.key === "Enter" && e.stopPropagation(),
33
+ children: /* @__PURE__ */ a("div", { className: `tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong
34
+ ${f ? "tw-rotate-90 " : ""}` })
35
+ }),
36
+ /* @__PURE__ */ a("span", {
37
+ className: "tw-text-small",
38
+ children: s.title
39
+ }),
40
+ /* @__PURE__ */ a("span", {
41
+ className: "tw-flex-auto tw-font-sans tw-text-x-small tw-text-right",
42
+ children: "Page"
43
+ })
44
+ ]
45
+ }, s.id)
46
+ }), f && m.length > 0 && m.map((e) => /* @__PURE__ */ a(t, {
47
+ section: e,
48
+ selectedUrl: c,
49
+ onSelectUrl: l
50
+ }, e.id))] });
65
51
  };
66
- export {
67
- L as PageLink
68
- };
69
- //# sourceMappingURL=PageLink.es.js.map
52
+ //#endregion
53
+ export { s as PageLink };
54
+
55
+ //# sourceMappingURL=PageLink.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PageLink.es.js","sources":["../../../../src/components/Link/LinkSelector/PageLink.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type DocumentSection } from '@frontify/app-bridge';\nimport { useEffect, useState } from 'react';\n\nimport { filterDocumentSectionsWithUnreadableTitles } from '../helpers/filterDocumentSectionsWithUnreadableTitles';\nimport { type DocumentSectionWithTitle, type InitiallyExpandedItems } from '../types';\n\nimport { SectionLink } from './SectionLink';\n\ntype PageLinkProps = {\n page: {\n id: number;\n title: string;\n permanentLink: string;\n };\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n itemsToExpandInitially: InitiallyExpandedItems;\n getDocumentSectionsByDocumentPageId: (documentPageId: number) => Promise<DocumentSection[]>;\n};\n\nexport const PageLink = ({\n page,\n selectedUrl,\n onSelectUrl,\n itemsToExpandInitially,\n getDocumentSectionsByDocumentPageId,\n}: PageLinkProps) => {\n const [isExpanded, setIsExpanded] = useState(page.id === itemsToExpandInitially.documentId);\n const [documentSections, setDocumentSections] = useState<DocumentSectionWithTitle[]>([]);\n const isActive = page.permanentLink === selectedUrl;\n\n useEffect(() => {\n const fetchDocumentSections = async () => {\n const sections = await getDocumentSectionsByDocumentPageId(page.id);\n const sectionsWithReadableTitles = filterDocumentSectionsWithUnreadableTitles(sections);\n setDocumentSections(sectionsWithReadableTitles);\n };\n\n fetchDocumentSections();\n }, [page.id, getDocumentSectionsByDocumentPageId]);\n\n useEffect(() => {\n if (page.id === itemsToExpandInitially.pageId) {\n // oxlint-disable-next-line @eslint-react/set-state-in-effect\n setIsExpanded(true);\n }\n }, [itemsToExpandInitially, page.id]);\n\n const hasSections = documentSections.length > 0;\n\n return (\n <>\n <button\n type=\"button\"\n data-test-id=\"internal-link-selector-page-link\"\n className={`\n tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-flex tw-w-full \n ${hasSections ? 'tw-pl-7 ' : 'tw-pl-12 '}\n ${\n isActive\n ? 'tw-bg-highlight tw-text-highlight-on-highlight hover:tw-bg-highlight-hover:hover hover:tw-text-highlight-on-highlight:hover '\n : 'hover:tw-bg-container-secondary-hover hover:tw-text-container-secondary-on-secondary-container '\n }`}\n onClick={() => onSelectUrl(page.permanentLink)}\n >\n <div key={page.id} className=\"tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6\">\n {hasSections && (\n <button\n type=\"button\"\n className=\"tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer\"\n onClick={() => setIsExpanded(!isExpanded)}\n onKeyDown={(event) => event.key === 'Enter' && event.stopPropagation()}\n >\n <div\n className={`tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong \n ${isExpanded ? 'tw-rotate-90 ' : ''}`}\n />\n </button>\n )}\n <span className=\"tw-text-small\">{page.title}</span>\n <span className=\"tw-flex-auto tw-font-sans tw-text-x-small tw-text-right\">Page</span>\n </div>\n </button>\n {isExpanded &&\n documentSections.length > 0 &&\n documentSections.map((section) => {\n return (\n <SectionLink\n key={section.id}\n section={section}\n selectedUrl={selectedUrl}\n onSelectUrl={onSelectUrl}\n />\n );\n })}\n </>\n );\n};\n"],"names":["PageLink","page","selectedUrl","onSelectUrl","itemsToExpandInitially","getDocumentSectionsByDocumentPageId","isExpanded","setIsExpanded","useState","documentSections","setDocumentSections","isActive","useEffect","sections","sectionsWithReadableTitles","filterDocumentSectionsWithUnreadableTitles","hasSections","jsxs","Fragment","jsx","event","section","SectionLink"],"mappings":";;;;AAsBO,MAAMA,IAAW,CAAC;AAAA,EACrB,MAAAC;AAAA,EACA,aAAAC;AAAA,EACA,aAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,qCAAAC;AACJ,MAAqB;AACjB,QAAM,CAACC,GAAYC,CAAa,IAAIC,EAASP,EAAK,OAAOG,EAAuB,UAAU,GACpF,CAACK,GAAkBC,CAAmB,IAAIF,EAAqC,CAAA,CAAE,GACjFG,IAAWV,EAAK,kBAAkBC;AAExC,EAAAU,EAAU,MAAM;AAOZ,KAN8B,YAAY;AACtC,YAAMC,IAAW,MAAMR,EAAoCJ,EAAK,EAAE,GAC5Da,IAA6BC,EAA2CF,CAAQ;AACtF,MAAAH,EAAoBI,CAA0B;AAAA,IAClD,GAEA;AAAA,EACJ,GAAG,CAACb,EAAK,IAAII,CAAmC,CAAC,GAEjDO,EAAU,MAAM;AACZ,IAAIX,EAAK,OAAOG,EAAuB,UAEnCG,EAAc,EAAI;AAAA,EAE1B,GAAG,CAACH,GAAwBH,EAAK,EAAE,CAAC;AAEpC,QAAMe,IAAcP,EAAiB,SAAS;AAE9C,SACI,gBAAAQ,EAAAC,GAAA,EACI,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,MAAK;AAAA,QACL,gBAAa;AAAA,QACb,WAAW;AAAA;AAAA,sBAELH,IAAc,aAAa,WAAW;AAAA,sBAEpCL,IACM,iIACA,iGACV;AAAA,QACJ,SAAS,MAAMR,EAAYF,EAAK,aAAa;AAAA,QAE7C,UAAA,gBAAAgB,EAAC,OAAA,EAAkB,WAAU,yDACxB,UAAA;AAAA,UAAAD,KACG,gBAAAG;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,MAAK;AAAA,cACL,WAAU;AAAA,cACV,SAAS,MAAMZ,EAAc,CAACD,CAAU;AAAA,cACxC,WAAW,CAACc,MAAUA,EAAM,QAAQ,WAAWA,EAAM,gBAAA;AAAA,cAErD,UAAA,gBAAAD;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACG,WAAW;AAAA,kCACTb,IAAa,kBAAkB,EAAE;AAAA,gBAAA;AAAA,cAAA;AAAA,YACvC;AAAA,UAAA;AAAA,UAGR,gBAAAa,EAAC,QAAA,EAAK,WAAU,iBAAiB,YAAK,OAAM;AAAA,UAC5C,gBAAAA,EAAC,QAAA,EAAK,WAAU,2DAA0D,UAAA,OAAA,CAAI;AAAA,QAAA,EAAA,GAfxElB,EAAK,EAgBf;AAAA,MAAA;AAAA,IAAA;AAAA,IAEHK,KACGG,EAAiB,SAAS,KAC1BA,EAAiB,IAAI,CAACY,MAEd,gBAAAF;AAAA,MAACG;AAAA,MAAA;AAAA,QAEG,SAAAD;AAAA,QACA,aAAAnB;AAAA,QACA,aAAAC;AAAA,MAAA;AAAA,MAHKkB,EAAQ;AAAA,IAAA,CAMxB;AAAA,EAAA,GACT;AAER;"}
1
+ {"version":3,"file":"PageLink.es.js","names":[],"sources":["../../../../src/components/Link/LinkSelector/PageLink.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type DocumentSection } from '@frontify/app-bridge';\nimport { useEffect, useState } from 'react';\n\nimport { filterDocumentSectionsWithUnreadableTitles } from '../helpers/filterDocumentSectionsWithUnreadableTitles';\nimport { type DocumentSectionWithTitle, type InitiallyExpandedItems } from '../types';\n\nimport { SectionLink } from './SectionLink';\n\ntype PageLinkProps = {\n page: {\n id: number;\n title: string;\n permanentLink: string;\n };\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n itemsToExpandInitially: InitiallyExpandedItems;\n getDocumentSectionsByDocumentPageId: (documentPageId: number) => Promise<DocumentSection[]>;\n};\n\nexport const PageLink = ({\n page,\n selectedUrl,\n onSelectUrl,\n itemsToExpandInitially,\n getDocumentSectionsByDocumentPageId,\n}: PageLinkProps) => {\n const [isExpanded, setIsExpanded] = useState(page.id === itemsToExpandInitially.documentId);\n const [documentSections, setDocumentSections] = useState<DocumentSectionWithTitle[]>([]);\n const isActive = page.permanentLink === selectedUrl;\n\n useEffect(() => {\n const fetchDocumentSections = async () => {\n const sections = await getDocumentSectionsByDocumentPageId(page.id);\n const sectionsWithReadableTitles = filterDocumentSectionsWithUnreadableTitles(sections);\n setDocumentSections(sectionsWithReadableTitles);\n };\n\n fetchDocumentSections();\n }, [page.id, getDocumentSectionsByDocumentPageId]);\n\n useEffect(() => {\n if (page.id === itemsToExpandInitially.pageId) {\n // oxlint-disable-next-line @eslint-react/set-state-in-effect\n setIsExpanded(true);\n }\n }, [itemsToExpandInitially, page.id]);\n\n const hasSections = documentSections.length > 0;\n\n return (\n <>\n <button\n type=\"button\"\n data-test-id=\"internal-link-selector-page-link\"\n className={`\n tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-flex tw-w-full \n ${hasSections ? 'tw-pl-7 ' : 'tw-pl-12 '}\n ${\n isActive\n ? 'tw-bg-highlight tw-text-highlight-on-highlight hover:tw-bg-highlight-hover:hover hover:tw-text-highlight-on-highlight:hover '\n : 'hover:tw-bg-container-secondary-hover hover:tw-text-container-secondary-on-secondary-container '\n }`}\n onClick={() => onSelectUrl(page.permanentLink)}\n >\n <div key={page.id} className=\"tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6\">\n {hasSections && (\n <button\n type=\"button\"\n className=\"tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer\"\n onClick={() => setIsExpanded(!isExpanded)}\n onKeyDown={(event) => event.key === 'Enter' && event.stopPropagation()}\n >\n <div\n className={`tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong \n ${isExpanded ? 'tw-rotate-90 ' : ''}`}\n />\n </button>\n )}\n <span className=\"tw-text-small\">{page.title}</span>\n <span className=\"tw-flex-auto tw-font-sans tw-text-x-small tw-text-right\">Page</span>\n </div>\n </button>\n {isExpanded &&\n documentSections.length > 0 &&\n documentSections.map((section) => {\n return (\n <SectionLink\n key={section.id}\n section={section}\n selectedUrl={selectedUrl}\n onSelectUrl={onSelectUrl}\n />\n );\n })}\n </>\n );\n};\n"],"mappings":";;;;;AAsBA,IAAa,KAAY,EACrB,SACA,gBACA,gBACA,2BACA,6CACiB;CACjB,IAAM,CAAC,GAAY,KAAiB,EAAS,EAAK,OAAO,EAAuB,UAAU,GACpF,CAAC,GAAkB,KAAuB,EAAqC,CAAC,CAAC,GACjF,IAAW,EAAK,kBAAkB;CAYxC,AAVA,QAAgB;EAOZ,aAN0C;GACtC,IAAM,IAAW,MAAM,EAAoC,EAAK,EAAE,GAC5D,IAA6B,EAA2C,CAAQ;GACtF,EAAoB,CAA0B;EAClD,EAEA,CAAsB;CAC1B,GAAG,CAAC,EAAK,IAAI,CAAmC,CAAC,GAEjD,QAAgB;EACZ,AAAI,EAAK,OAAO,EAAuB,UAEnC,EAAc,EAAI;CAE1B,GAAG,CAAC,GAAwB,EAAK,EAAE,CAAC;CAEpC,IAAM,IAAc,EAAiB,SAAS;CAE9C,OACI,kBAAA,GAAA,EAAA,UAAA,CACI,kBAAC,UAAD;EACI,MAAK;EACL,gBAAa;EACb,WAAW;;sBAEL,IAAc,aAAa,YAAY;sBAErC,IACM,iIACA;EAEd,eAAe,EAAY,EAAK,aAAa;EAE7C,UAAA,kBAAC,OAAD;GAAmB,WAAU;GAA7B,UAAA;IACK,KACG,kBAAC,UAAD;KACI,MAAK;KACL,WAAU;KACV,eAAe,EAAc,CAAC,CAAU;KACxC,YAAY,MAAU,EAAM,QAAQ,WAAW,EAAM,gBAAgB;KAErE,UAAA,kBAAC,OAAD,EACI,WAAW;kCACT,IAAa,kBAAkB,KACpC,CAAA;IACG,CAAA;IAEZ,kBAAC,QAAD;KAAM,WAAU;KAAiB,UAAA,EAAK;IAAY,CAAA;IAClD,kBAAC,QAAD;KAAM,WAAU;KAA0D,UAAA;IAAU,CAAA;GACnF;EAhBK,GAAA,EAAK,EAgBV;CACD,CAAA,GACP,KACG,EAAiB,SAAS,KAC1B,EAAiB,KAAK,MAEd,kBAAC,GAAD;EAEa;EACI;EACA;CAChB,GAJQ,EAAQ,EAIhB,CAER,CACP,EAAA,CAAA;AAEV"}
@@ -1,38 +1,29 @@
1
- import { jsx as o, Fragment as x } from "react/jsx-runtime";
2
- import { useState as n, useEffect as L } from "react";
3
- import { LoadingIndicator as P } from "./LoadingIndicator.es.js";
4
- import { PageLink as k } from "./PageLink.es.js";
5
- const j = ({
6
- documentId: i,
7
- selectedUrl: c,
8
- onSelectUrl: g,
9
- itemsToExpandInitially: l,
10
- getDocumentSectionsByDocumentPageId: m,
11
- getDocumentPagesByDocumentId: d
12
- }) => {
13
- const [f, p] = n([]), [s, y] = n(!0), a = [...f.values()], h = !s && a.length > 0;
14
- return L(() => {
15
- d(i).then((e) => {
16
- const u = e.filter((t) => !!t.category).sort(
17
- (t, r) => t.category.sort === r.category.sort ? t.sort - r.sort : t.category.sort - r.category.sort
18
- ), w = e.filter((t) => !t.category).sort((t, r) => t.sort - r.sort);
19
- p([...u, ...w]);
20
- }).finally(() => {
21
- y(!1);
22
- });
23
- }, []), s ? /* @__PURE__ */ o(P, {}) : h ? /* @__PURE__ */ o(x, { children: a.map((e) => /* @__PURE__ */ o(
24
- k,
25
- {
26
- page: e,
27
- selectedUrl: c,
28
- onSelectUrl: g,
29
- itemsToExpandInitially: l,
30
- getDocumentSectionsByDocumentPageId: m
31
- },
32
- e.id
33
- )) }) : /* @__PURE__ */ o("div", { className: "tw-h-10 tw-flex tw-items-center tw-pr-2.5 tw-pl-7 tw-leading-5 tw-text-small tw-text-secondary", children: "This document does not contain any pages." });
1
+ import { LoadingIndicator as e } from "./LoadingIndicator.es.js";
2
+ import { PageLink as t } from "./PageLink.es.js";
3
+ import { useEffect as n, useState as r } from "react";
4
+ import { Fragment as i, jsx as a } from "react/jsx-runtime";
5
+ //#region src/components/Link/LinkSelector/PageLinks.tsx
6
+ var o = ({ documentId: o, selectedUrl: s, onSelectUrl: c, itemsToExpandInitially: l, getDocumentSectionsByDocumentPageId: u, getDocumentPagesByDocumentId: d }) => {
7
+ let [f, p] = r([]), [m, h] = r(!0), g = [...f.values()], _ = !m && g.length > 0;
8
+ return n(() => {
9
+ d(o).then((e) => {
10
+ let t = e.filter((e) => !!e.category).sort((e, t) => e.category.sort === t.category.sort ? e.sort - t.sort : e.category.sort - t.category.sort), n = e.filter((e) => !e.category).sort((e, t) => e.sort - t.sort);
11
+ p([...t, ...n]);
12
+ }).finally(() => {
13
+ h(!1);
14
+ });
15
+ }, []), m ? /* @__PURE__ */ a(e, {}) : _ ? /* @__PURE__ */ a(i, { children: g.map((e) => /* @__PURE__ */ a(t, {
16
+ page: e,
17
+ selectedUrl: s,
18
+ onSelectUrl: c,
19
+ itemsToExpandInitially: l,
20
+ getDocumentSectionsByDocumentPageId: u
21
+ }, e.id)) }) : /* @__PURE__ */ a("div", {
22
+ className: "tw-h-10 tw-flex tw-items-center tw-pr-2.5 tw-pl-7 tw-leading-5 tw-text-small tw-text-secondary",
23
+ children: "This document does not contain any pages."
24
+ });
34
25
  };
35
- export {
36
- j as PageLinks
37
- };
38
- //# sourceMappingURL=PageLinks.es.js.map
26
+ //#endregion
27
+ export { o as PageLinks };
28
+
29
+ //# sourceMappingURL=PageLinks.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PageLinks.es.js","sources":["../../../../src/components/Link/LinkSelector/PageLinks.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type DocumentPage, type DocumentSection } from '@frontify/app-bridge';\nimport { type ReactElement, useEffect, useState } from 'react';\n\nimport { type InitiallyExpandedItems } from '../types';\n\nimport { LoadingIndicator } from './LoadingIndicator';\nimport { PageLink } from './PageLink';\n\ntype PageLinksProps = {\n documentId: number;\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n itemsToExpandInitially: InitiallyExpandedItems;\n getDocumentSectionsByDocumentPageId: (documentPageId: number) => Promise<DocumentSection[]>;\n getDocumentPagesByDocumentId: (documentId: number) => Promise<DocumentPage[]>;\n};\n\nexport const PageLinks = ({\n documentId,\n selectedUrl,\n onSelectUrl,\n itemsToExpandInitially,\n getDocumentSectionsByDocumentPageId,\n getDocumentPagesByDocumentId,\n}: PageLinksProps): ReactElement => {\n const [pages, setPages] = useState<DocumentPage[]>([]);\n const [isLoading, setIsLoading] = useState(true);\n const pagesArray = [...pages.values()];\n const hasPages = !isLoading && pagesArray.length > 0;\n\n useEffect(() => {\n getDocumentPagesByDocumentId(documentId)\n .then((_pages) => {\n const pagesWithCategories = _pages\n .filter((page) => !!page.category)\n .sort((a, b) =>\n a.category.sort === b.category.sort ? a.sort - b.sort : a.category.sort - b.category.sort,\n );\n const pagesWithoutCategories = _pages.filter((page) => !page.category).sort((a, b) => a.sort - b.sort);\n setPages([...pagesWithCategories, ...pagesWithoutCategories]);\n })\n .finally(() => {\n setIsLoading(false);\n });\n // oxlint-disable-next-line @eslint-react/exhaustive-deps\n }, []);\n\n if (isLoading) {\n return <LoadingIndicator />;\n }\n\n return hasPages ? (\n <>\n {pagesArray.map((page) => {\n return (\n <PageLink\n key={page.id}\n page={page}\n selectedUrl={selectedUrl}\n onSelectUrl={onSelectUrl}\n itemsToExpandInitially={itemsToExpandInitially}\n getDocumentSectionsByDocumentPageId={getDocumentSectionsByDocumentPageId}\n />\n );\n })}\n </>\n ) : (\n <div className=\"tw-h-10 tw-flex tw-items-center tw-pr-2.5 tw-pl-7 tw-leading-5 tw-text-small tw-text-secondary\">\n This document does not contain any pages.\n </div>\n );\n};\n"],"names":["PageLinks","documentId","selectedUrl","onSelectUrl","itemsToExpandInitially","getDocumentSectionsByDocumentPageId","getDocumentPagesByDocumentId","pages","setPages","useState","isLoading","setIsLoading","pagesArray","hasPages","useEffect","_pages","pagesWithCategories","page","a","b","pagesWithoutCategories","LoadingIndicator","jsx","Fragment","PageLink"],"mappings":";;;;AAmBO,MAAMA,IAAY,CAAC;AAAA,EACtB,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,aAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,qCAAAC;AAAA,EACA,8BAAAC;AACJ,MAAoC;AAChC,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAyB,CAAA,CAAE,GAC/C,CAACC,GAAWC,CAAY,IAAIF,EAAS,EAAI,GACzCG,IAAa,CAAC,GAAGL,EAAM,QAAQ,GAC/BM,IAAW,CAACH,KAAaE,EAAW,SAAS;AAmBnD,SAjBAE,EAAU,MAAM;AACZ,IAAAR,EAA6BL,CAAU,EAClC,KAAK,CAACc,MAAW;AACd,YAAMC,IAAsBD,EACvB,OAAO,CAACE,MAAS,CAAC,CAACA,EAAK,QAAQ,EAChC;AAAA,QAAK,CAACC,GAAGC,MACND,EAAE,SAAS,SAASC,EAAE,SAAS,OAAOD,EAAE,OAAOC,EAAE,OAAOD,EAAE,SAAS,OAAOC,EAAE,SAAS;AAAA,MAAA,GAEvFC,IAAyBL,EAAO,OAAO,CAACE,MAAS,CAACA,EAAK,QAAQ,EAAE,KAAK,CAACC,GAAGC,MAAMD,EAAE,OAAOC,EAAE,IAAI;AACrG,MAAAX,EAAS,CAAC,GAAGQ,GAAqB,GAAGI,CAAsB,CAAC;AAAA,IAChE,CAAC,EACA,QAAQ,MAAM;AACX,MAAAT,EAAa,EAAK;AAAA,IACtB,CAAC;AAAA,EAET,GAAG,CAAA,CAAE,GAEDD,sBACQW,GAAA,EAAiB,IAGtBR,IACH,gBAAAS,EAAAC,GAAA,EACK,UAAAX,EAAW,IAAI,CAACK,MAET,gBAAAK;AAAA,IAACE;AAAA,IAAA;AAAA,MAEG,MAAAP;AAAA,MACA,aAAAf;AAAA,MACA,aAAAC;AAAA,MACA,wBAAAC;AAAA,MACA,qCAAAC;AAAA,IAAA;AAAA,IALKY,EAAK;AAAA,EAAA,CAQrB,EAAA,CACL,sBAEC,OAAA,EAAI,WAAU,kGAAiG,UAAA,6CAEhH;AAER;"}
1
+ {"version":3,"file":"PageLinks.es.js","names":[],"sources":["../../../../src/components/Link/LinkSelector/PageLinks.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type DocumentPage, type DocumentSection } from '@frontify/app-bridge';\nimport { type ReactElement, useEffect, useState } from 'react';\n\nimport { type InitiallyExpandedItems } from '../types';\n\nimport { LoadingIndicator } from './LoadingIndicator';\nimport { PageLink } from './PageLink';\n\ntype PageLinksProps = {\n documentId: number;\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n itemsToExpandInitially: InitiallyExpandedItems;\n getDocumentSectionsByDocumentPageId: (documentPageId: number) => Promise<DocumentSection[]>;\n getDocumentPagesByDocumentId: (documentId: number) => Promise<DocumentPage[]>;\n};\n\nexport const PageLinks = ({\n documentId,\n selectedUrl,\n onSelectUrl,\n itemsToExpandInitially,\n getDocumentSectionsByDocumentPageId,\n getDocumentPagesByDocumentId,\n}: PageLinksProps): ReactElement => {\n const [pages, setPages] = useState<DocumentPage[]>([]);\n const [isLoading, setIsLoading] = useState(true);\n const pagesArray = [...pages.values()];\n const hasPages = !isLoading && pagesArray.length > 0;\n\n useEffect(() => {\n getDocumentPagesByDocumentId(documentId)\n .then((_pages) => {\n const pagesWithCategories = _pages\n .filter((page) => !!page.category)\n .sort((a, b) =>\n a.category.sort === b.category.sort ? a.sort - b.sort : a.category.sort - b.category.sort,\n );\n const pagesWithoutCategories = _pages.filter((page) => !page.category).sort((a, b) => a.sort - b.sort);\n setPages([...pagesWithCategories, ...pagesWithoutCategories]);\n })\n .finally(() => {\n setIsLoading(false);\n });\n // oxlint-disable-next-line @eslint-react/exhaustive-deps\n }, []);\n\n if (isLoading) {\n return <LoadingIndicator />;\n }\n\n return hasPages ? (\n <>\n {pagesArray.map((page) => {\n return (\n <PageLink\n key={page.id}\n page={page}\n selectedUrl={selectedUrl}\n onSelectUrl={onSelectUrl}\n itemsToExpandInitially={itemsToExpandInitially}\n getDocumentSectionsByDocumentPageId={getDocumentSectionsByDocumentPageId}\n />\n );\n })}\n </>\n ) : (\n <div className=\"tw-h-10 tw-flex tw-items-center tw-pr-2.5 tw-pl-7 tw-leading-5 tw-text-small tw-text-secondary\">\n This document does not contain any pages.\n </div>\n );\n};\n"],"mappings":";;;;;AAmBA,IAAa,KAAa,EACtB,eACA,gBACA,gBACA,2BACA,wCACA,sCACgC;CAChC,IAAM,CAAC,GAAO,KAAY,EAAyB,CAAC,CAAC,GAC/C,CAAC,GAAW,KAAgB,EAAS,EAAI,GACzC,IAAa,CAAC,GAAG,EAAM,OAAO,CAAC,GAC/B,IAAW,CAAC,KAAa,EAAW,SAAS;CAuBnD,OArBA,QAAgB;EACZ,EAA6B,CAAU,CAAC,CACnC,MAAM,MAAW;GACd,IAAM,IAAsB,EACvB,QAAQ,MAAS,CAAC,CAAC,EAAK,QAAQ,CAAC,CACjC,MAAM,GAAG,MACN,EAAE,SAAS,SAAS,EAAE,SAAS,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,OAAO,EAAE,SAAS,IACzF,GACE,IAAyB,EAAO,QAAQ,MAAS,CAAC,EAAK,QAAQ,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,EAAE,IAAI;GACrG,EAAS,CAAC,GAAG,GAAqB,GAAG,CAAsB,CAAC;EAChE,CAAC,CAAC,CACD,cAAc;GACX,EAAa,EAAK;EACtB,CAAC;CAET,GAAG,CAAC,CAAC,GAED,IACO,kBAAC,GAAD,CAAmB,CAAA,IAGvB,IACH,kBAAA,GAAA,EAAA,UACK,EAAW,KAAK,MAET,kBAAC,GAAD;EAEU;EACO;EACA;EACW;EACa;CACxC,GANQ,EAAK,EAMb,CAER,EACH,CAAA,IAEF,kBAAC,OAAD;EAAK,WAAU;EAAiG,UAAA;CAE3G,CAAA;AAEb"}
@@ -1,26 +1,33 @@
1
- import { jsx as t, jsxs as r } from "react/jsx-runtime";
2
- import { IconDocumentText as h } from "@frontify/fondue/icons";
3
- const s = ({ section: e, selectedUrl: i, onSelectUrl: o }) => {
4
- const n = e.permanentLink === i;
5
- return /* @__PURE__ */ t(
6
- "button",
7
- {
8
- "data-test-id": "internal-link-selector-section-link",
9
- type: "button",
10
- "data-is-active": n,
11
- className: `
1
+ import { IconDocumentText as e } from "@frontify/fondue/icons";
2
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
+ //#region src/components/Link/LinkSelector/SectionLink.tsx
4
+ var r = ({ section: r, selectedUrl: i, onSelectUrl: a }) => {
5
+ let o = r.permanentLink === i;
6
+ return /* @__PURE__ */ t("button", {
7
+ "data-test-id": "internal-link-selector-section-link",
8
+ type: "button",
9
+ "data-is-active": o,
10
+ className: `
12
11
  tw-py-2 tw-pr-2.5 tw-pl-14 tw-leading-5 tw-cursor-pointer tw-w-full
13
- ${n ? "tw-bg-highlight tw-text-highlight-on-highlight hover:tw-bg-highlight-hover:hover hover:tw-text-highlight-on-highlight:hover" : "hover:tw-bg-container-secondary-hover hover:tw-text-container-secondary-on-secondary-container"}`,
14
- onClick: () => o(e.permanentLink),
15
- children: /* @__PURE__ */ r("div", { className: "tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6", children: [
16
- /* @__PURE__ */ t(h, { size: 16 }),
17
- /* @__PURE__ */ t("span", { className: "tw-text-small", children: e.title }),
18
- /* @__PURE__ */ t("span", { className: "tw-flex-auto tw-font-sans tw-text-x-small tw-text-right", children: "Section" })
19
- ] })
20
- }
21
- );
12
+ ${o ? "tw-bg-highlight tw-text-highlight-on-highlight hover:tw-bg-highlight-hover:hover hover:tw-text-highlight-on-highlight:hover" : "hover:tw-bg-container-secondary-hover hover:tw-text-container-secondary-on-secondary-container"}`,
13
+ onClick: () => a(r.permanentLink),
14
+ children: /* @__PURE__ */ n("div", {
15
+ className: "tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6",
16
+ children: [
17
+ /* @__PURE__ */ t(e, { size: 16 }),
18
+ /* @__PURE__ */ t("span", {
19
+ className: "tw-text-small",
20
+ children: r.title
21
+ }),
22
+ /* @__PURE__ */ t("span", {
23
+ className: "tw-flex-auto tw-font-sans tw-text-x-small tw-text-right",
24
+ children: "Section"
25
+ })
26
+ ]
27
+ })
28
+ });
22
29
  };
23
- export {
24
- s as SectionLink
25
- };
26
- //# sourceMappingURL=SectionLink.es.js.map
30
+ //#endregion
31
+ export { r as SectionLink };
32
+
33
+ //# sourceMappingURL=SectionLink.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SectionLink.es.js","sources":["../../../../src/components/Link/LinkSelector/SectionLink.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconDocumentText } from '@frontify/fondue/icons';\n\ntype SectionLinkProps = {\n section: {\n id: number;\n title: string;\n permanentLink: string;\n };\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n};\n\nexport const SectionLink = ({ section, selectedUrl, onSelectUrl }: SectionLinkProps) => {\n const isActive = section.permanentLink === selectedUrl;\n\n return (\n <button\n data-test-id=\"internal-link-selector-section-link\"\n type=\"button\"\n data-is-active={isActive}\n className={`\n tw-py-2 tw-pr-2.5 tw-pl-14 tw-leading-5 tw-cursor-pointer tw-w-full \n ${\n isActive\n ? 'tw-bg-highlight tw-text-highlight-on-highlight hover:tw-bg-highlight-hover:hover hover:tw-text-highlight-on-highlight:hover'\n : 'hover:tw-bg-container-secondary-hover hover:tw-text-container-secondary-on-secondary-container'\n }`}\n onClick={() => onSelectUrl(section.permanentLink)}\n >\n <div className=\"tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6\">\n <IconDocumentText size={16} />\n <span className=\"tw-text-small\">{section.title}</span>\n <span className=\"tw-flex-auto tw-font-sans tw-text-x-small tw-text-right\">Section</span>\n </div>\n </button>\n );\n};\n"],"names":["SectionLink","section","selectedUrl","onSelectUrl","isActive","jsx","jsxs","IconDocumentText"],"mappings":";;AAcO,MAAMA,IAAc,CAAC,EAAE,SAAAC,GAAS,aAAAC,GAAa,aAAAC,QAAoC;AACpF,QAAMC,IAAWH,EAAQ,kBAAkBC;AAE3C,SACI,gBAAAG;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,gBAAa;AAAA,MACb,MAAK;AAAA,MACL,kBAAgBD;AAAA,MAChB,WAAW;AAAA;AAAA,kBAGHA,IACM,gIACA,gGACV;AAAA,MACJ,SAAS,MAAMD,EAAYF,EAAQ,aAAa;AAAA,MAEhD,UAAA,gBAAAK,EAAC,OAAA,EAAI,WAAU,yDACX,UAAA;AAAA,QAAA,gBAAAD,EAACE,GAAA,EAAiB,MAAM,GAAA,CAAI;AAAA,QAC5B,gBAAAF,EAAC,QAAA,EAAK,WAAU,iBAAiB,YAAQ,OAAM;AAAA,QAC/C,gBAAAA,EAAC,QAAA,EAAK,WAAU,2DAA0D,UAAA,UAAA,CAAO;AAAA,MAAA,EAAA,CACrF;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
1
+ {"version":3,"file":"SectionLink.es.js","names":[],"sources":["../../../../src/components/Link/LinkSelector/SectionLink.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconDocumentText } from '@frontify/fondue/icons';\n\ntype SectionLinkProps = {\n section: {\n id: number;\n title: string;\n permanentLink: string;\n };\n selectedUrl: string;\n onSelectUrl: (url: string) => void;\n};\n\nexport const SectionLink = ({ section, selectedUrl, onSelectUrl }: SectionLinkProps) => {\n const isActive = section.permanentLink === selectedUrl;\n\n return (\n <button\n data-test-id=\"internal-link-selector-section-link\"\n type=\"button\"\n data-is-active={isActive}\n className={`\n tw-py-2 tw-pr-2.5 tw-pl-14 tw-leading-5 tw-cursor-pointer tw-w-full \n ${\n isActive\n ? 'tw-bg-highlight tw-text-highlight-on-highlight hover:tw-bg-highlight-hover:hover hover:tw-text-highlight-on-highlight:hover'\n : 'hover:tw-bg-container-secondary-hover hover:tw-text-container-secondary-on-secondary-container'\n }`}\n onClick={() => onSelectUrl(section.permanentLink)}\n >\n <div className=\"tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6\">\n <IconDocumentText size={16} />\n <span className=\"tw-text-small\">{section.title}</span>\n <span className=\"tw-flex-auto tw-font-sans tw-text-x-small tw-text-right\">Section</span>\n </div>\n </button>\n );\n};\n"],"mappings":";;;AAcA,IAAa,KAAe,EAAE,YAAS,gBAAa,qBAAoC;CACpF,IAAM,IAAW,EAAQ,kBAAkB;CAE3C,OACI,kBAAC,UAAD;EACI,gBAAa;EACb,MAAK;EACL,kBAAgB;EAChB,WAAW;;kBAGH,IACM,gIACA;EAEd,eAAe,EAAY,EAAQ,aAAa;EAEhD,UAAA,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA;IACI,kBAAC,GAAD,EAAkB,MAAM,GAAK,CAAA;IAC7B,kBAAC,QAAD;KAAM,WAAU;KAAiB,UAAA,EAAQ;IAAY,CAAA;IACrD,kBAAC,QAAD;KAAM,WAAU;KAA0D,UAAA;IAAa,CAAA;GACtF;;CACD,CAAA;AAEhB"}