@frontify/guideline-blocks-settings 3.0.1 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.es.js +17 -0
- package/dist/components/Attachments/AttachmentItem.es.js +116 -168
- package/dist/components/Attachments/AttachmentItem.es.js.map +1 -1
- package/dist/components/Attachments/Attachments.es.js +145 -137
- package/dist/components/Attachments/Attachments.es.js.map +1 -1
- package/dist/components/Attachments/AttachmentsButtonTrigger.es.js +25 -28
- package/dist/components/Attachments/AttachmentsButtonTrigger.es.js.map +1 -1
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js +114 -126
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js +53 -74
- package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.es.js +26 -31
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.es.js +22 -25
- package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/BaseToolbarButton.es.js +17 -28
- package/dist/components/BlockItemWrapper/Toolbar/BaseToolbarButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js +25 -35
- package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.es.js +41 -34
- package/dist/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.es.js +41 -36
- package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/Toolbar.es.js +24 -33
- package/dist/components/BlockItemWrapper/Toolbar/Toolbar.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.es.js +20 -11
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.es.js +18 -10
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarSegment.es.js +10 -12
- package/dist/components/BlockItemWrapper/Toolbar/ToolbarSegment.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.es.js +13 -13
- package/dist/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.es.js +21 -19
- package/dist/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/helpers.es.js +18 -25
- package/dist/components/BlockItemWrapper/Toolbar/helpers.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.es.js +18 -17
- package/dist/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/constants.es.js +6 -6
- package/dist/components/BlockItemWrapper/constants.es.js.map +1 -1
- package/dist/components/Link/LinkInput.es.js +63 -63
- package/dist/components/Link/LinkInput.es.js.map +1 -1
- package/dist/components/Link/LinkSelector/DocumentLink.es.js +46 -63
- package/dist/components/Link/LinkSelector/DocumentLink.es.js.map +1 -1
- package/dist/components/Link/LinkSelector/DocumentLinks.es.js +50 -64
- package/dist/components/Link/LinkSelector/DocumentLinks.es.js.map +1 -1
- package/dist/components/Link/LinkSelector/LinkSelector2.es.js +77 -0
- package/dist/components/Link/LinkSelector/LinkSelector2.es.js.map +1 -0
- package/dist/components/Link/LinkSelector/LoadingIndicator.es.js +10 -6
- package/dist/components/Link/LinkSelector/LoadingIndicator.es.js.map +1 -1
- package/dist/components/Link/LinkSelector/PageLink.es.js +53 -67
- package/dist/components/Link/LinkSelector/PageLink.es.js.map +1 -1
- package/dist/components/Link/LinkSelector/PageLinks.es.js +28 -37
- package/dist/components/Link/LinkSelector/PageLinks.es.js.map +1 -1
- package/dist/components/Link/LinkSelector/SectionLink.es.js +31 -24
- package/dist/components/Link/LinkSelector/SectionLink.es.js.map +1 -1
- package/dist/components/Link/helpers/filterDocumentSectionsWithUnreadableTitles.es.js +6 -5
- package/dist/components/Link/helpers/filterDocumentSectionsWithUnreadableTitles.es.js.map +1 -1
- package/dist/components/Link/utils/getUrl.es.js +10 -12
- package/dist/components/Link/utils/getUrl.es.js.map +1 -1
- package/dist/components/Link/utils/relativeUrlRegex.es.js +6 -5
- package/dist/components/Link/utils/relativeUrlRegex.es.js.map +1 -1
- package/dist/components/Link/utils/url.es.js +21 -17
- package/dist/components/Link/utils/url.es.js.map +1 -1
- package/dist/components/RichTextEditor/RichTextEditor.es.js +61 -68
- package/dist/components/RichTextEditor/RichTextEditor.es.js.map +1 -1
- package/dist/components/RichTextEditor/SerializedText.es.js +25 -22
- package/dist/components/RichTextEditor/SerializedText.es.js.map +1 -1
- package/dist/components/RichTextEditor/constants.es.js +6 -5
- package/dist/components/RichTextEditor/constants.es.js.map +1 -1
- package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js +30 -37
- package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js +31 -39
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.es.js +12 -11
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js +19 -23
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js +24 -26
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js +46 -53
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js +52 -54
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js +68 -68
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js +91 -103
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js +26 -32
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js +47 -53
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.es.js +12 -18
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.es.js +21 -25
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js +29 -37
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.es.js +13 -17
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js +56 -62
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js +9 -12
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js +23 -24
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js +28 -33
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js +61 -80
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js +23 -23
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js +18 -18
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js +13 -12
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js +9 -8
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.es.js +11 -10
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.es.js +85 -84
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js +13 -16
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js +13 -16
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js +10 -13
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js +45 -51
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/ColumnBreakPlugin.es.js +20 -22
- package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/ColumnBreakPlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/helpers.es.js +12 -12
- package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/helpers.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js +48 -57
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js +46 -48
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js +12 -8
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js +62 -71
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js +76 -77
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js +17 -21
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js +17 -10
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js +11 -10
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkToolbarButton.es.js +22 -26
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkToolbarButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/id.es.js +6 -5
- package/dist/components/RichTextEditor/plugins/LinkPlugin/id.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js +39 -40
- package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js +10 -10
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/OrderedListPlugin/index.es.js +26 -26
- package/dist/components/RichTextEditor/plugins/OrderedListPlugin/index.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js +40 -46
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js +40 -46
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js +40 -46
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js +41 -47
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js +41 -47
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js +41 -47
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js +41 -47
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/helpers.es.js +44 -38
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/helpers.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js +41 -47
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js +40 -46
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js +45 -41
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js +40 -48
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/UnorderedListPlugin/index.es.js +29 -29
- package/dist/components/RichTextEditor/plugins/UnorderedListPlugin/index.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/styles.es.js +167 -166
- package/dist/components/RichTextEditor/plugins/styles.es.js.map +1 -1
- package/dist/helpers/addHttps.es.js +12 -12
- package/dist/helpers/addHttps.es.js.map +1 -1
- package/dist/helpers/convertToRichTextValue.es.js +14 -6
- package/dist/helpers/convertToRichTextValue.es.js.map +1 -1
- package/dist/helpers/hasRichTextValue.es.js +13 -14
- package/dist/helpers/hasRichTextValue.es.js.map +1 -1
- package/dist/helpers/isDownloadable.es.js +6 -5
- package/dist/helpers/isDownloadable.es.js.map +1 -1
- package/dist/hooks/useAttachments.es.js +65 -73
- package/dist/hooks/useAttachments.es.js.map +1 -1
- package/dist/hooks/useIsInViewport.es.js +20 -21
- package/dist/hooks/useIsInViewport.es.js.map +1 -1
- package/dist/index.cjs.js +6 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +9 -8
- package/dist/index.es.js +221 -213
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +6 -8
- package/dist/index.umd.js.map +1 -1
- package/dist/settings/background.es.js +20 -21
- package/dist/settings/background.es.js.map +1 -1
- package/dist/settings/border.es.js +62 -64
- package/dist/settings/border.es.js.map +1 -1
- package/dist/settings/borderRadius.es.js +49 -52
- package/dist/settings/borderRadius.es.js.map +1 -1
- package/dist/settings/borderRadiusExtended.es.js +58 -60
- package/dist/settings/borderRadiusExtended.es.js.map +1 -1
- package/dist/settings/defaultValues.es.js +16 -19
- package/dist/settings/defaultValues.es.js.map +1 -1
- package/dist/settings/gutter.es.js +48 -52
- package/dist/settings/gutter.es.js.map +1 -1
- package/dist/settings/margin.es.js +49 -52
- package/dist/settings/margin.es.js.map +1 -1
- package/dist/settings/marginExtended.es.js +62 -64
- package/dist/settings/marginExtended.es.js.map +1 -1
- package/dist/settings/padding.es.js +49 -52
- package/dist/settings/padding.es.js.map +1 -1
- package/dist/settings/paddingExtended.es.js +62 -64
- package/dist/settings/paddingExtended.es.js.map +1 -1
- package/dist/settings/securityDownloadable.es.js +16 -16
- package/dist/settings/securityDownloadable.es.js.map +1 -1
- package/dist/settings/securityGlobalControl.es.js +26 -32
- package/dist/settings/securityGlobalControl.es.js.map +1 -1
- package/dist/settings/types.es.js +41 -47
- package/dist/settings/types.es.js.map +1 -1
- package/dist/styles.css +2 -1
- package/dist/utilities/color/getReadableColor.es.js +15 -13
- package/dist/utilities/color/getReadableColor.es.js.map +1 -1
- package/dist/utilities/color/isDark.es.js +14 -9
- package/dist/utilities/color/isDark.es.js.map +1 -1
- package/dist/utilities/color/setAlpha.es.js +7 -6
- package/dist/utilities/color/setAlpha.es.js.map +1 -1
- package/dist/utilities/color/toColorObject.es.js +14 -8
- package/dist/utilities/color/toColorObject.es.js.map +1 -1
- package/dist/utilities/color/toHex8String.es.js +7 -6
- package/dist/utilities/color/toHex8String.es.js.map +1 -1
- package/dist/utilities/color/toHexString.es.js +7 -6
- package/dist/utilities/color/toHexString.es.js.map +1 -1
- package/dist/utilities/color/toRgbaString.es.js +7 -6
- package/dist/utilities/color/toRgbaString.es.js.map +1 -1
- package/dist/utilities/color/toShortRgba.es.js +18 -11
- package/dist/utilities/color/toShortRgba.es.js.map +1 -1
- package/dist/utilities/react/getBackgroundColorStyles.es.js +7 -8
- package/dist/utilities/react/getBackgroundColorStyles.es.js.map +1 -1
- package/dist/utilities/react/getBorderStyles.es.js +12 -11
- package/dist/utilities/react/getBorderStyles.es.js.map +1 -1
- package/dist/utilities/react/getRadiusStyles.es.js +7 -8
- package/dist/utilities/react/getRadiusStyles.es.js.map +1 -1
- package/dist/utilities/react/joinClassNames.es.js +6 -5
- package/dist/utilities/react/joinClassNames.es.js.map +1 -1
- package/package.json +19 -20
- package/dist/components/Link/LinkSelector/LinkSelector.es.js +0 -72
- package/dist/components/Link/LinkSelector/LinkSelector.es.js.map +0 -1
|
@@ -1,65 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
63
|
-
|
|
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 //
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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"],"
|
|
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 {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
${
|
|
31
|
-
${
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
67
|
-
|
|
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 //
|
|
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 {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
36
|
-
|
|
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 //
|
|
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 {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
${
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
24
|
-
|
|
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"],"
|
|
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"}
|