@atlaskit/smart-card 23.3.0 → 23.4.0
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/CHANGELOG.md +41 -0
- package/dist/cjs/constants.js +7 -2
- package/dist/cjs/extractors/common/actions/extractActions.js +3 -0
- package/dist/cjs/extractors/flexible/actions/extract-download-action.js +26 -0
- package/dist/cjs/extractors/flexible/actions/extract-preview-action.js +36 -0
- package/dist/cjs/extractors/flexible/actions/extract-view-action.js +26 -0
- package/dist/cjs/extractors/flexible/index.js +9 -0
- package/dist/cjs/messages.js +15 -0
- package/dist/cjs/state/flexible-ui-context/index.js +15 -2
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/{BlockCard/utils → EmbedCard}/constants.js +4 -4
- package/dist/cjs/view/EmbedCard/views/ForbiddenView.js +1 -1
- package/dist/cjs/view/EmbedCard/views/NotFoundView.js +1 -1
- package/dist/cjs/view/EmbedCard/views/UnauthorisedView.js +23 -5
- package/dist/cjs/view/EmbedCard/views/UnresolvedView.js +9 -5
- package/dist/cjs/view/FlexibleCard/components/actions/action/download-action/index.js +110 -0
- package/dist/cjs/view/FlexibleCard/components/actions/action/download-action/types.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/actions/action/preview-action/index.js +167 -0
- package/dist/cjs/view/FlexibleCard/components/actions/action/preview-action/types.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/actions/action/view-action/index.js +92 -0
- package/dist/cjs/view/FlexibleCard/components/actions/action/view-action/types.js +5 -0
- package/dist/cjs/view/FlexibleCard/components/actions/index.js +26 -2
- package/dist/cjs/view/FlexibleCard/components/actions/utils.js +51 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +19 -13
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +9 -4
- package/dist/cjs/view/FlexibleCard/components/elements/media/index.js +1 -1
- package/dist/cjs/view/FlexibleCard/index.js +6 -3
- package/dist/cjs/view/common/Icon.js +25 -13
- package/dist/es2019/constants.js +5 -0
- package/dist/es2019/extractors/common/actions/extractActions.js +1 -2
- package/dist/es2019/extractors/flexible/actions/extract-download-action.js +13 -0
- package/dist/es2019/extractors/flexible/actions/extract-preview-action.js +23 -0
- package/dist/es2019/extractors/flexible/actions/extract-view-action.js +13 -0
- package/dist/es2019/extractors/flexible/index.js +7 -1
- package/dist/es2019/messages.js +15 -0
- package/dist/es2019/state/flexible-ui-context/index.js +8 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/{BlockCard/utils → EmbedCard}/constants.js +2 -2
- package/dist/es2019/view/EmbedCard/views/ForbiddenView.js +1 -1
- package/dist/es2019/view/EmbedCard/views/NotFoundView.js +1 -1
- package/dist/es2019/view/EmbedCard/views/UnauthorisedView.js +19 -5
- package/dist/es2019/view/EmbedCard/views/UnresolvedView.js +9 -5
- package/dist/es2019/view/FlexibleCard/components/actions/action/download-action/index.js +66 -0
- package/dist/es2019/view/FlexibleCard/components/actions/action/download-action/types.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/actions/action/preview-action/index.js +104 -0
- package/dist/es2019/view/FlexibleCard/components/actions/action/preview-action/types.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/actions/action/view-action/index.js +46 -0
- package/dist/es2019/view/FlexibleCard/components/actions/action/view-action/types.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/actions/index.js +23 -2
- package/dist/es2019/view/FlexibleCard/components/actions/utils.js +48 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +12 -9
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +9 -4
- package/dist/es2019/view/FlexibleCard/components/elements/media/index.js +1 -1
- package/dist/es2019/view/FlexibleCard/index.js +7 -4
- package/dist/es2019/view/common/Icon.js +31 -13
- package/dist/esm/constants.js +5 -0
- package/dist/esm/extractors/common/actions/extractActions.js +1 -2
- package/dist/esm/extractors/flexible/actions/extract-download-action.js +15 -0
- package/dist/esm/extractors/flexible/actions/extract-preview-action.js +23 -0
- package/dist/esm/extractors/flexible/actions/extract-view-action.js +15 -0
- package/dist/esm/extractors/flexible/index.js +7 -1
- package/dist/esm/messages.js +15 -0
- package/dist/esm/state/flexible-ui-context/index.js +9 -0
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/{BlockCard/utils → EmbedCard}/constants.js +2 -2
- package/dist/esm/view/EmbedCard/views/ForbiddenView.js +1 -1
- package/dist/esm/view/EmbedCard/views/NotFoundView.js +1 -1
- package/dist/esm/view/EmbedCard/views/UnauthorisedView.js +19 -5
- package/dist/esm/view/EmbedCard/views/UnresolvedView.js +9 -5
- package/dist/esm/view/FlexibleCard/components/actions/action/download-action/index.js +96 -0
- package/dist/esm/view/FlexibleCard/components/actions/action/download-action/types.js +1 -0
- package/dist/esm/view/FlexibleCard/components/actions/action/preview-action/index.js +136 -0
- package/dist/esm/view/FlexibleCard/components/actions/action/preview-action/types.js +1 -0
- package/dist/esm/view/FlexibleCard/components/actions/action/view-action/index.js +77 -0
- package/dist/esm/view/FlexibleCard/components/actions/action/view-action/types.js +1 -0
- package/dist/esm/view/FlexibleCard/components/actions/index.js +23 -2
- package/dist/esm/view/FlexibleCard/components/actions/utils.js +45 -2
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +19 -13
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +9 -4
- package/dist/esm/view/FlexibleCard/components/elements/media/index.js +1 -1
- package/dist/esm/view/FlexibleCard/index.js +7 -4
- package/dist/esm/view/common/Icon.js +27 -13
- package/dist/types/constants.d.ts +4 -0
- package/dist/types/extractors/common/__mocks__/jsonld.d.ts +112 -0
- package/dist/types/extractors/common/actions/extractActions.d.ts +1 -0
- package/dist/types/extractors/flexible/actions/extract-download-action.d.ts +3 -0
- package/dist/types/extractors/flexible/actions/extract-preview-action.d.ts +3 -0
- package/dist/types/extractors/flexible/actions/extract-view-action.d.ts +3 -0
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/state/flexible-ui-context/index.d.ts +76 -0
- package/dist/types/state/flexible-ui-context/types.d.ts +32 -0
- package/dist/types/view/BlockCard/actions/PreviewAction.d.ts +2 -2
- package/dist/types/view/{BlockCard/utils → EmbedCard}/constants.d.ts +1 -1
- package/dist/types/view/EmbedCard/types.d.ts +1 -0
- package/dist/types/view/EmbedModal/index.d.ts +20 -2
- package/dist/types/view/EmbedModal/types.d.ts +1 -2
- package/dist/types/view/FlexibleCard/components/actions/action/download-action/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/actions/action/download-action/types.d.ts +8 -0
- package/dist/types/view/FlexibleCard/components/actions/action/preview-action/index.d.ts +5 -0
- package/dist/types/view/FlexibleCard/components/actions/action/preview-action/types.d.ts +15 -0
- package/dist/types/view/FlexibleCard/components/actions/action/view-action/index.d.ts +5 -0
- package/dist/types/view/FlexibleCard/components/actions/action/view-action/types.d.ts +8 -0
- package/dist/types/view/FlexibleCard/components/actions/index.d.ts +21 -0
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +50 -3
- package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +1 -1
- package/dist/types/view/FlexibleCard/types.d.ts +6 -0
- package/dist/types/view/common/Icon.d.ts +2 -1
- package/package.json +2 -10
- package/report.api.md +30 -2
- package/tmp/api-report-tmp.d.ts +25 -3
- package/dist/types-ts4.0/__fixtures__/flexible-ui-data-context.d.ts +0 -3
- package/dist/types-ts4.0/__tests_external__/index.d.ts +0 -6
- package/dist/types-ts4.0/__tests_external__/page-objects/BaseCard.d.ts +0 -16
- package/dist/types-ts4.0/__tests_external__/page-objects/BlockCard.d.ts +0 -6
- package/dist/types-ts4.0/__tests_external__/page-objects/EmbedCard.d.ts +0 -6
- package/dist/types-ts4.0/__tests_external__/page-objects/InlineCard.d.ts +0 -6
- package/dist/types-ts4.0/__tests_external__/test-cases/card.d.ts +0 -3
- package/dist/types-ts4.0/__tests_external__/test-cases/embed.d.ts +0 -3
- package/dist/types-ts4.0/__tests_external__/test-cases/inline.d.ts +0 -3
- package/dist/types-ts4.0/__tests_external__/test-cases/types.d.ts +0 -5
- package/dist/types-ts4.0/classNames.d.ts +0 -11
- package/dist/types-ts4.0/client/index.d.ts +0 -1
- package/dist/types-ts4.0/constants.d.ts +0 -187
- package/dist/types-ts4.0/extractors/block/index.d.ts +0 -9
- package/dist/types-ts4.0/extractors/block/types.d.ts +0 -12
- package/dist/types-ts4.0/extractors/common/__mocks__/jsonld.d.ts +0 -234
- package/dist/types-ts4.0/extractors/common/__mocks__/render.d.ts +0 -2
- package/dist/types-ts4.0/extractors/common/actions/extractActions.d.ts +0 -4
- package/dist/types-ts4.0/extractors/common/actions/extractPreviewAction.d.ts +0 -9
- package/dist/types-ts4.0/extractors/common/byline/extractByline.d.ts +0 -3
- package/dist/types-ts4.0/extractors/common/context/extractAccessContext.d.ts +0 -7
- package/dist/types-ts4.0/extractors/common/context/index.d.ts +0 -1
- package/dist/types-ts4.0/extractors/common/detail/extractAttachmentCount.d.ts +0 -4
- package/dist/types-ts4.0/extractors/common/detail/extractCommentCount.d.ts +0 -4
- package/dist/types-ts4.0/extractors/common/detail/extractDownloadUrl.d.ts +0 -2
- package/dist/types-ts4.0/extractors/common/detail/extractProgrammingLanguage.d.ts +0 -4
- package/dist/types-ts4.0/extractors/common/detail/extractSubscriberCount.d.ts +0 -4
- package/dist/types-ts4.0/extractors/common/detail/index.d.ts +0 -9
- package/dist/types-ts4.0/extractors/common/detail/types.d.ts +0 -5
- package/dist/types-ts4.0/extractors/common/icon/extractFileFormat.d.ts +0 -2
- package/dist/types-ts4.0/extractors/common/icon/extractIcon.d.ts +0 -14
- package/dist/types-ts4.0/extractors/common/icon/extractIconFromDocument.d.ts +0 -4
- package/dist/types-ts4.0/extractors/common/icon/extractIconFromTask.d.ts +0 -3
- package/dist/types-ts4.0/extractors/common/icon/index.d.ts +0 -4
- package/dist/types-ts4.0/extractors/common/icon/priority.d.ts +0 -4
- package/dist/types-ts4.0/extractors/common/lozenge/extractLozenge.d.ts +0 -3
- package/dist/types-ts4.0/extractors/common/lozenge/extractState.d.ts +0 -3
- package/dist/types-ts4.0/extractors/common/lozenge/extractTag.d.ts +0 -3
- package/dist/types-ts4.0/extractors/common/lozenge/extractTaskStatus.d.ts +0 -3
- package/dist/types-ts4.0/extractors/common/lozenge/extractTaskType.d.ts +0 -7
- package/dist/types-ts4.0/extractors/common/lozenge/index.d.ts +0 -5
- package/dist/types-ts4.0/extractors/common/lozenge/types.d.ts +0 -8
- package/dist/types-ts4.0/extractors/common/lozenge/utils.d.ts +0 -4
- package/dist/types-ts4.0/extractors/common/meta/extractIsTrusted.d.ts +0 -2
- package/dist/types-ts4.0/extractors/common/primitives/extractSummary.d.ts +0 -2
- package/dist/types-ts4.0/extractors/common/primitives/extractTitleTextColor.d.ts +0 -2
- package/dist/types-ts4.0/extractors/common/primitives/extractVisitUrl.d.ts +0 -2
- package/dist/types-ts4.0/extractors/common/primitives/index.d.ts +0 -2
- package/dist/types-ts4.0/extractors/common/title-prefix/extractTitlePrefix.d.ts +0 -5
- package/dist/types-ts4.0/extractors/common/title-prefix/index.d.ts +0 -1
- package/dist/types-ts4.0/extractors/constants.d.ts +0 -12
- package/dist/types-ts4.0/extractors/embed/index.d.ts +0 -3
- package/dist/types-ts4.0/extractors/flexible/collaboratorGroup/index.d.ts +0 -4
- package/dist/types-ts4.0/extractors/flexible/extract-preview.d.ts +0 -4
- package/dist/types-ts4.0/extractors/flexible/extract-priority.d.ts +0 -4
- package/dist/types-ts4.0/extractors/flexible/icon/extract-document-type-icon.d.ts +0 -3
- package/dist/types-ts4.0/extractors/flexible/icon/extract-file-formatIcon.d.ts +0 -3
- package/dist/types-ts4.0/extractors/flexible/icon/extract-icon-renderer.d.ts +0 -4
- package/dist/types-ts4.0/extractors/flexible/icon/extract-jira-task-icon.d.ts +0 -3
- package/dist/types-ts4.0/extractors/flexible/icon/extract-jsonld-data-icon.d.ts +0 -4
- package/dist/types-ts4.0/extractors/flexible/icon/extract-provider-icon.d.ts +0 -4
- package/dist/types-ts4.0/extractors/flexible/icon/extract-url-icon.d.ts +0 -4
- package/dist/types-ts4.0/extractors/flexible/icon/index.d.ts +0 -17
- package/dist/types-ts4.0/extractors/flexible/icon/types.d.ts +0 -6
- package/dist/types-ts4.0/extractors/flexible/index.d.ts +0 -5
- package/dist/types-ts4.0/extractors/flexible/latest-commit/index.d.ts +0 -2
- package/dist/types-ts4.0/extractors/flexible/utils.d.ts +0 -13
- package/dist/types-ts4.0/extractors/hover/extractMetadata.d.ts +0 -3
- package/dist/types-ts4.0/extractors/index.d.ts +0 -14
- package/dist/types-ts4.0/extractors/inline/index.d.ts +0 -6
- package/dist/types-ts4.0/hooks.d.ts +0 -2
- package/dist/types-ts4.0/i18n/cs.d.ts +0 -71
- package/dist/types-ts4.0/i18n/da.d.ts +0 -71
- package/dist/types-ts4.0/i18n/de.d.ts +0 -71
- package/dist/types-ts4.0/i18n/en.d.ts +0 -71
- package/dist/types-ts4.0/i18n/en_GB.d.ts +0 -71
- package/dist/types-ts4.0/i18n/en_ZZ.d.ts +0 -38
- package/dist/types-ts4.0/i18n/es.d.ts +0 -71
- package/dist/types-ts4.0/i18n/et.d.ts +0 -94
- package/dist/types-ts4.0/i18n/fi.d.ts +0 -71
- package/dist/types-ts4.0/i18n/fr.d.ts +0 -71
- package/dist/types-ts4.0/i18n/hu.d.ts +0 -71
- package/dist/types-ts4.0/i18n/index.d.ts +0 -35
- package/dist/types-ts4.0/i18n/is.d.ts +0 -70
- package/dist/types-ts4.0/i18n/it.d.ts +0 -71
- package/dist/types-ts4.0/i18n/ja.d.ts +0 -71
- package/dist/types-ts4.0/i18n/ko.d.ts +0 -71
- package/dist/types-ts4.0/i18n/languages.d.ts +0 -27
- package/dist/types-ts4.0/i18n/nb.d.ts +0 -71
- package/dist/types-ts4.0/i18n/nl.d.ts +0 -71
- package/dist/types-ts4.0/i18n/pl.d.ts +0 -71
- package/dist/types-ts4.0/i18n/pt_BR.d.ts +0 -71
- package/dist/types-ts4.0/i18n/pt_PT.d.ts +0 -94
- package/dist/types-ts4.0/i18n/ro.d.ts +0 -70
- package/dist/types-ts4.0/i18n/ru.d.ts +0 -71
- package/dist/types-ts4.0/i18n/sk.d.ts +0 -94
- package/dist/types-ts4.0/i18n/sv.d.ts +0 -71
- package/dist/types-ts4.0/i18n/th.d.ts +0 -71
- package/dist/types-ts4.0/i18n/tr.d.ts +0 -71
- package/dist/types-ts4.0/i18n/uk.d.ts +0 -71
- package/dist/types-ts4.0/i18n/vi.d.ts +0 -71
- package/dist/types-ts4.0/i18n/zh.d.ts +0 -71
- package/dist/types-ts4.0/i18n/zh_TW.d.ts +0 -71
- package/dist/types-ts4.0/in-product.d.ts +0 -1
- package/dist/types-ts4.0/index.d.ts +0 -22
- package/dist/types-ts4.0/messages.d.ts +0 -8
- package/dist/types-ts4.0/model/invoke-handler.d.ts +0 -3
- package/dist/types-ts4.0/model/invoke-opts.d.ts +0 -17
- package/dist/types-ts4.0/ssr.d.ts +0 -6
- package/dist/types-ts4.0/state/actions/constants.d.ts +0 -6
- package/dist/types-ts4.0/state/actions/index.d.ts +0 -12
- package/dist/types-ts4.0/state/actions/types.d.ts +0 -2
- package/dist/types-ts4.0/state/analytics/index.d.ts +0 -3
- package/dist/types-ts4.0/state/analytics/types.d.ts +0 -9
- package/dist/types-ts4.0/state/analytics/ufoExperiences.d.ts +0 -7
- package/dist/types-ts4.0/state/analytics/useSmartLinkAnalytics.d.ts +0 -195
- package/dist/types-ts4.0/state/config/index.d.ts +0 -2
- package/dist/types-ts4.0/state/flexible-ui-context/index.d.ts +0 -8
- package/dist/types-ts4.0/state/flexible-ui-context/types.d.ts +0 -165
- package/dist/types-ts4.0/state/helpers.d.ts +0 -16
- package/dist/types-ts4.0/state/hooks/index.d.ts +0 -2
- package/dist/types-ts4.0/state/hooks/usePrefetch.d.ts +0 -1
- package/dist/types-ts4.0/state/hooks/useSmartLink.d.ts +0 -50
- package/dist/types-ts4.0/state/hooks-external/useSmartLinkActions.d.ts +0 -49
- package/dist/types-ts4.0/state/hooks-external/useSmartLinkReload.d.ts +0 -19
- package/dist/types-ts4.0/state/index.d.ts +0 -5
- package/dist/types-ts4.0/state/reducers/types.d.ts +0 -4
- package/dist/types-ts4.0/state/renderers/index.d.ts +0 -2
- package/dist/types-ts4.0/state/store/index.d.ts +0 -3
- package/dist/types-ts4.0/state/types.d.ts +0 -1
- package/dist/types-ts4.0/types.d.ts +0 -20
- package/dist/types-ts4.0/utils/analytics/__mocks__/analytics.d.ts +0 -2
- package/dist/types-ts4.0/utils/analytics/analytics.d.ts +0 -32
- package/dist/types-ts4.0/utils/analytics/index.d.ts +0 -4
- package/dist/types-ts4.0/utils/analytics/types.d.ts +0 -93
- package/dist/types-ts4.0/utils/flexible.d.ts +0 -5
- package/dist/types-ts4.0/utils/index.d.ts +0 -12
- package/dist/types-ts4.0/utils/jsonld.d.ts +0 -3
- package/dist/types-ts4.0/utils/mocks.d.ts +0 -75
- package/dist/types-ts4.0/utils/performance.d.ts +0 -8
- package/dist/types-ts4.0/utils/test-utils.d.ts +0 -4
- package/dist/types-ts4.0/utils/token.d.ts +0 -16
- package/dist/types-ts4.0/utils/types.d.ts +0 -14
- package/dist/types-ts4.0/view/BlockCard/actions/AuthorizeAction.d.ts +0 -2
- package/dist/types-ts4.0/view/BlockCard/actions/DownloadAction.d.ts +0 -8
- package/dist/types-ts4.0/view/BlockCard/actions/ForbiddenAction.d.ts +0 -2
- package/dist/types-ts4.0/view/BlockCard/actions/PreviewAction.d.ts +0 -30
- package/dist/types-ts4.0/view/BlockCard/actions/RetryAction.d.ts +0 -2
- package/dist/types-ts4.0/view/BlockCard/actions/ViewAction.d.ts +0 -8
- package/dist/types-ts4.0/view/BlockCard/components/Action.d.ts +0 -13
- package/dist/types-ts4.0/view/BlockCard/components/ActionIcon.d.ts +0 -12
- package/dist/types-ts4.0/view/BlockCard/components/ActionList.d.ts +0 -7
- package/dist/types-ts4.0/view/BlockCard/components/CollaboratorList.d.ts +0 -15
- package/dist/types-ts4.0/view/BlockCard/components/Content.d.ts +0 -9
- package/dist/types-ts4.0/view/BlockCard/components/ContentFooter.d.ts +0 -9
- package/dist/types-ts4.0/view/BlockCard/components/ContentHeader.d.ts +0 -10
- package/dist/types-ts4.0/view/BlockCard/components/Emoji.d.ts +0 -7
- package/dist/types-ts4.0/view/BlockCard/components/Frame.d.ts +0 -16
- package/dist/types-ts4.0/view/BlockCard/components/Link.d.ts +0 -8
- package/dist/types-ts4.0/view/BlockCard/components/Name.d.ts +0 -12
- package/dist/types-ts4.0/view/BlockCard/components/Provider.d.ts +0 -8
- package/dist/types-ts4.0/view/BlockCard/components/Thumbnail.d.ts +0 -10
- package/dist/types-ts4.0/view/BlockCard/components/UnresolvedText.d.ts +0 -8
- package/dist/types-ts4.0/view/BlockCard/index.d.ts +0 -14
- package/dist/types-ts4.0/view/BlockCard/types.d.ts +0 -25
- package/dist/types-ts4.0/view/BlockCard/utils/constants.d.ts +0 -3
- package/dist/types-ts4.0/view/BlockCard/utils/handlers.d.ts +0 -2
- package/dist/types-ts4.0/view/BlockCard/views/ErroredView.d.ts +0 -14
- package/dist/types-ts4.0/view/BlockCard/views/ForbiddenView.d.ts +0 -23
- package/dist/types-ts4.0/view/BlockCard/views/NotFoundView.d.ts +0 -17
- package/dist/types-ts4.0/view/BlockCard/views/ResolvedView.d.ts +0 -34
- package/dist/types-ts4.0/view/BlockCard/views/ResolvingView.d.ts +0 -9
- package/dist/types-ts4.0/view/BlockCard/views/UnauthorizedView.d.ts +0 -19
- package/dist/types-ts4.0/view/Card/index.d.ts +0 -5
- package/dist/types-ts4.0/view/Card/types.d.ts +0 -37
- package/dist/types-ts4.0/view/CardWithData/component.d.ts +0 -5
- package/dist/types-ts4.0/view/CardWithData/loader.d.ts +0 -9
- package/dist/types-ts4.0/view/CardWithData/types.d.ts +0 -15
- package/dist/types-ts4.0/view/CardWithUrl/component-lazy/LazyFallback.d.ts +0 -4
- package/dist/types-ts4.0/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.d.ts +0 -3
- package/dist/types-ts4.0/view/CardWithUrl/component-lazy/LazyLazilyRenderCard.d.ts +0 -3
- package/dist/types-ts4.0/view/CardWithUrl/component-lazy/index.d.ts +0 -3
- package/dist/types-ts4.0/view/CardWithUrl/component.d.ts +0 -3
- package/dist/types-ts4.0/view/CardWithUrl/loader.d.ts +0 -3
- package/dist/types-ts4.0/view/CardWithUrl/types.d.ts +0 -29
- package/dist/types-ts4.0/view/EmbedCard/EmbedResizeMessageListener.d.ts +0 -15
- package/dist/types-ts4.0/view/EmbedCard/components/ExpandedFrame.d.ts +0 -23
- package/dist/types-ts4.0/view/EmbedCard/components/Frame.d.ts +0 -7
- package/dist/types-ts4.0/view/EmbedCard/components/ImageIcon.d.ts +0 -9
- package/dist/types-ts4.0/view/EmbedCard/components/styled.d.ts +0 -45
- package/dist/types-ts4.0/view/EmbedCard/index.d.ts +0 -3
- package/dist/types-ts4.0/view/EmbedCard/types.d.ts +0 -46
- package/dist/types-ts4.0/view/EmbedCard/views/ErroredView.d.ts +0 -9
- package/dist/types-ts4.0/view/EmbedCard/views/ForbiddenView.d.ts +0 -13
- package/dist/types-ts4.0/view/EmbedCard/views/NotFoundView.d.ts +0 -11
- package/dist/types-ts4.0/view/EmbedCard/views/ResolvedView.d.ts +0 -27
- package/dist/types-ts4.0/view/EmbedCard/views/UnauthorisedView.d.ts +0 -12
- package/dist/types-ts4.0/view/EmbedCard/views/UnresolvedView.d.ts +0 -18
- package/dist/types-ts4.0/view/EmbedModal/components/analytics/index.d.ts +0 -5
- package/dist/types-ts4.0/view/EmbedModal/components/analytics/types.d.ts +0 -6
- package/dist/types-ts4.0/view/EmbedModal/components/embed-content/index.d.ts +0 -5
- package/dist/types-ts4.0/view/EmbedModal/components/embed-content/types.d.ts +0 -6
- package/dist/types-ts4.0/view/EmbedModal/components/error-boundary/index.d.ts +0 -4
- package/dist/types-ts4.0/view/EmbedModal/components/link-info/index.d.ts +0 -4
- package/dist/types-ts4.0/view/EmbedModal/components/link-info/link-info-button/index.d.ts +0 -4
- package/dist/types-ts4.0/view/EmbedModal/components/link-info/link-info-button/types.d.ts +0 -9
- package/dist/types-ts4.0/view/EmbedModal/components/link-info/styled.d.ts +0 -4
- package/dist/types-ts4.0/view/EmbedModal/components/link-info/types.d.ts +0 -13
- package/dist/types-ts4.0/view/EmbedModal/constants.d.ts +0 -2
- package/dist/types-ts4.0/view/EmbedModal/index.d.ts +0 -4
- package/dist/types-ts4.0/view/EmbedModal/types.d.ts +0 -31
- package/dist/types-ts4.0/view/FlexibleCard/components/actions/action/action-button/index.d.ts +0 -5
- package/dist/types-ts4.0/view/FlexibleCard/components/actions/action/action-button/types.d.ts +0 -8
- package/dist/types-ts4.0/view/FlexibleCard/components/actions/action/action-dropdown-item/index.d.ts +0 -4
- package/dist/types-ts4.0/view/FlexibleCard/components/actions/action/action-dropdown-item/types.d.ts +0 -8
- package/dist/types-ts4.0/view/FlexibleCard/components/actions/action/action-icon/index.d.ts +0 -5
- package/dist/types-ts4.0/view/FlexibleCard/components/actions/action/action-icon/types.d.ts +0 -7
- package/dist/types-ts4.0/view/FlexibleCard/components/actions/action/index.d.ts +0 -13
- package/dist/types-ts4.0/view/FlexibleCard/components/actions/action/types.d.ts +0 -48
- package/dist/types-ts4.0/view/FlexibleCard/components/actions/index.d.ts +0 -20
- package/dist/types-ts4.0/view/FlexibleCard/components/actions/utils.d.ts +0 -4
- package/dist/types-ts4.0/view/FlexibleCard/components/blocks/action-group/index.d.ts +0 -11
- package/dist/types-ts4.0/view/FlexibleCard/components/blocks/action-group/types.d.ts +0 -37
- package/dist/types-ts4.0/view/FlexibleCard/components/blocks/block/index.d.ts +0 -12
- package/dist/types-ts4.0/view/FlexibleCard/components/blocks/element-group/index.d.ts +0 -15
- package/dist/types-ts4.0/view/FlexibleCard/components/blocks/element-group/types.d.ts +0 -10
- package/dist/types-ts4.0/view/FlexibleCard/components/blocks/footer-block/index.d.ts +0 -11
- package/dist/types-ts4.0/view/FlexibleCard/components/blocks/footer-block/types.d.ts +0 -10
- package/dist/types-ts4.0/view/FlexibleCard/components/blocks/index.d.ts +0 -5
- package/dist/types-ts4.0/view/FlexibleCard/components/blocks/metadata-block/index.d.ts +0 -11
- package/dist/types-ts4.0/view/FlexibleCard/components/blocks/metadata-block/types.d.ts +0 -26
- package/dist/types-ts4.0/view/FlexibleCard/components/blocks/preview-block/index.d.ts +0 -10
- package/dist/types-ts4.0/view/FlexibleCard/components/blocks/preview-block/types.d.ts +0 -8
- package/dist/types-ts4.0/view/FlexibleCard/components/blocks/snippet-block/index.d.ts +0 -10
- package/dist/types-ts4.0/view/FlexibleCard/components/blocks/snippet-block/types.d.ts +0 -8
- package/dist/types-ts4.0/view/FlexibleCard/components/blocks/title-block/errored/index.d.ts +0 -12
- package/dist/types-ts4.0/view/FlexibleCard/components/blocks/title-block/index.d.ts +0 -16
- package/dist/types-ts4.0/view/FlexibleCard/components/blocks/title-block/resolved/index.d.ts +0 -9
- package/dist/types-ts4.0/view/FlexibleCard/components/blocks/title-block/resolving/index.d.ts +0 -11
- package/dist/types-ts4.0/view/FlexibleCard/components/blocks/title-block/types.d.ts +0 -92
- package/dist/types-ts4.0/view/FlexibleCard/components/blocks/types.d.ts +0 -300
- package/dist/types-ts4.0/view/FlexibleCard/components/blocks/utils.d.ts +0 -13
- package/dist/types-ts4.0/view/FlexibleCard/components/common/atlaskit-icon/index.d.ts +0 -4
- package/dist/types-ts4.0/view/FlexibleCard/components/common/atlaskit-icon/types.d.ts +0 -6
- package/dist/types-ts4.0/view/FlexibleCard/components/common/image-icon/index.d.ts +0 -5
- package/dist/types-ts4.0/view/FlexibleCard/components/common/image-icon/types.d.ts +0 -7
- package/dist/types-ts4.0/view/FlexibleCard/components/common/loading-skeleton/index.d.ts +0 -5
- package/dist/types-ts4.0/view/FlexibleCard/components/common/loading-skeleton/types.d.ts +0 -16
- package/dist/types-ts4.0/view/FlexibleCard/components/container/index.d.ts +0 -16
- package/dist/types-ts4.0/view/FlexibleCard/components/container/layered-link/index.d.ts +0 -10
- package/dist/types-ts4.0/view/FlexibleCard/components/container/layered-link/types.d.ts +0 -12
- package/dist/types-ts4.0/view/FlexibleCard/components/container/types.d.ts +0 -25
- package/dist/types-ts4.0/view/FlexibleCard/components/elements/avatar-group/index.d.ts +0 -12
- package/dist/types-ts4.0/view/FlexibleCard/components/elements/avatar-group/types.d.ts +0 -21
- package/dist/types-ts4.0/view/FlexibleCard/components/elements/badge/index.d.ts +0 -18
- package/dist/types-ts4.0/view/FlexibleCard/components/elements/badge/types.d.ts +0 -17
- package/dist/types-ts4.0/view/FlexibleCard/components/elements/date-time/index.d.ts +0 -12
- package/dist/types-ts4.0/view/FlexibleCard/components/elements/date-time/types.d.ts +0 -16
- package/dist/types-ts4.0/view/FlexibleCard/components/elements/icon/index.d.ts +0 -11
- package/dist/types-ts4.0/view/FlexibleCard/components/elements/icon/types.d.ts +0 -27
- package/dist/types-ts4.0/view/FlexibleCard/components/elements/index.d.ts +0 -129
- package/dist/types-ts4.0/view/FlexibleCard/components/elements/link/index.d.ts +0 -11
- package/dist/types-ts4.0/view/FlexibleCard/components/elements/link/types.d.ts +0 -35
- package/dist/types-ts4.0/view/FlexibleCard/components/elements/lozenge/index.d.ts +0 -11
- package/dist/types-ts4.0/view/FlexibleCard/components/elements/lozenge/types.d.ts +0 -13
- package/dist/types-ts4.0/view/FlexibleCard/components/elements/media/index.d.ts +0 -11
- package/dist/types-ts4.0/view/FlexibleCard/components/elements/media/types.d.ts +0 -17
- package/dist/types-ts4.0/view/FlexibleCard/components/elements/text/index.d.ts +0 -11
- package/dist/types-ts4.0/view/FlexibleCard/components/elements/text/types.d.ts +0 -17
- package/dist/types-ts4.0/view/FlexibleCard/components/elements/types.d.ts +0 -24
- package/dist/types-ts4.0/view/FlexibleCard/components/elements/utils.d.ts +0 -3
- package/dist/types-ts4.0/view/FlexibleCard/components/types.d.ts +0 -6
- package/dist/types-ts4.0/view/FlexibleCard/components/utils.d.ts +0 -15
- package/dist/types-ts4.0/view/FlexibleCard/index.d.ts +0 -10
- package/dist/types-ts4.0/view/FlexibleCard/types.d.ts +0 -113
- package/dist/types-ts4.0/view/FlexibleCard/utils.d.ts +0 -7
- package/dist/types-ts4.0/view/HoverCard/components/HoverCardComponent.d.ts +0 -4
- package/dist/types-ts4.0/view/HoverCard/components/HoverCardContent.d.ts +0 -9
- package/dist/types-ts4.0/view/HoverCard/components/HoverCardLoadingView.d.ts +0 -4
- package/dist/types-ts4.0/view/HoverCard/components/SnippetOrPreview.d.ts +0 -4
- package/dist/types-ts4.0/view/HoverCard/index.d.ts +0 -3
- package/dist/types-ts4.0/view/HoverCard/styled.d.ts +0 -12
- package/dist/types-ts4.0/view/HoverCard/types.d.ts +0 -45
- package/dist/types-ts4.0/view/HoverCard/utils.d.ts +0 -3
- package/dist/types-ts4.0/view/InlineCard/ErroredView/index.d.ts +0 -21
- package/dist/types-ts4.0/view/InlineCard/ForbiddenView/index.d.ts +0 -25
- package/dist/types-ts4.0/view/InlineCard/Frame/index.d.ts +0 -16
- package/dist/types-ts4.0/view/InlineCard/Frame/styled.d.ts +0 -8
- package/dist/types-ts4.0/view/InlineCard/Icon.d.ts +0 -4
- package/dist/types-ts4.0/view/InlineCard/IconAndTitleLayout/index.d.ts +0 -19
- package/dist/types-ts4.0/view/InlineCard/IconAndTitleLayout/styled.d.ts +0 -13
- package/dist/types-ts4.0/view/InlineCard/ResolvedView/index.d.ts +0 -30
- package/dist/types-ts4.0/view/InlineCard/ResolvingView/index.d.ts +0 -18
- package/dist/types-ts4.0/view/InlineCard/ResolvingView/styled.d.ts +0 -14
- package/dist/types-ts4.0/view/InlineCard/UnauthorisedView/index.d.ts +0 -20
- package/dist/types-ts4.0/view/InlineCard/index.d.ts +0 -9
- package/dist/types-ts4.0/view/InlineCard/styled.d.ts +0 -9
- package/dist/types-ts4.0/view/InlineCard/types.d.ts +0 -21
- package/dist/types-ts4.0/view/LinkView/index.d.ts +0 -8
- package/dist/types-ts4.0/view/SmartLinkEvents/useSmartLinkEvents.d.ts +0 -2
- package/dist/types-ts4.0/view/__mocks__/intersection-observer.d.ts +0 -26
- package/dist/types-ts4.0/view/__mocks__/intersection-observer.mock.d.ts +0 -12
- package/dist/types-ts4.0/view/common/Byline.d.ts +0 -10
- package/dist/types-ts4.0/view/common/Icon.d.ts +0 -11
- package/dist/types-ts4.0/view/common/Metadata.d.ts +0 -10
- package/dist/types-ts4.0/view/common/MetadataList.d.ts +0 -9
- package/dist/types-ts4.0/view/common/utils.d.ts +0 -5
- package/dist/types-ts4.0/view/types.d.ts +0 -29
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
exports.previewFunction = previewFunction;
|
|
12
|
+
|
|
13
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
14
|
+
|
|
15
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
16
|
+
|
|
17
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
18
|
+
|
|
19
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
20
|
+
|
|
21
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
22
|
+
|
|
23
|
+
var _react = _interopRequireDefault(require("react"));
|
|
24
|
+
|
|
25
|
+
var _index = _interopRequireDefault(require("../index"));
|
|
26
|
+
|
|
27
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
28
|
+
|
|
29
|
+
var _reactIntlNext = require("react-intl-next");
|
|
30
|
+
|
|
31
|
+
var _flexibleUiContext = require("../../../../../../state/flexible-ui-context");
|
|
32
|
+
|
|
33
|
+
var _state = require("../../../../../../state");
|
|
34
|
+
|
|
35
|
+
var _icon = _interopRequireDefault(require("../../../elements/icon"));
|
|
36
|
+
|
|
37
|
+
var _excluded = ["popupMountPointId"];
|
|
38
|
+
|
|
39
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
40
|
+
|
|
41
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
42
|
+
|
|
43
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
44
|
+
|
|
45
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
46
|
+
|
|
47
|
+
var PreviewAction = function PreviewAction(props) {
|
|
48
|
+
var appearance = props.appearance,
|
|
49
|
+
asDropDownItem = props.asDropDownItem,
|
|
50
|
+
testId = props.testId,
|
|
51
|
+
_onClick = props.onClick,
|
|
52
|
+
linkIcon = props.linkIcon,
|
|
53
|
+
src = props.src,
|
|
54
|
+
url = props.url,
|
|
55
|
+
title = props.title,
|
|
56
|
+
providerName = props.providerName,
|
|
57
|
+
downloadUrl = props.downloadUrl;
|
|
58
|
+
var defaultAnalytics = (0, _state.useSmartLinkAnalytics)(url, function () {});
|
|
59
|
+
var analytics = (0, _flexibleUiContext.useFlexibleUiAnalyticsContext)() || defaultAnalytics;
|
|
60
|
+
var EmbedIcon = {
|
|
61
|
+
icon: /*#__PURE__*/_react.default.createElement(_icon.default, linkIcon),
|
|
62
|
+
isFlexibleUi: true
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
if (src && url) {
|
|
66
|
+
var embedModal = function embedModal() {
|
|
67
|
+
return previewFunction({
|
|
68
|
+
popupMountPointId: 'twp-editor-preview-iframe',
|
|
69
|
+
showModal: true,
|
|
70
|
+
iframeName: 'twp-editor-preview-iframe',
|
|
71
|
+
onClose: function onClose() {},
|
|
72
|
+
download: downloadUrl,
|
|
73
|
+
icon: EmbedIcon,
|
|
74
|
+
providerName: providerName || 'Preview',
|
|
75
|
+
src: src,
|
|
76
|
+
title: title,
|
|
77
|
+
url: url,
|
|
78
|
+
analytics: analytics,
|
|
79
|
+
origin: 'smartLinkCard'
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
var action = _objectSpread(_objectSpread({}, props), {}, {
|
|
84
|
+
onClick: function onClick() {
|
|
85
|
+
embedModal();
|
|
86
|
+
|
|
87
|
+
if (_onClick) {
|
|
88
|
+
_onClick();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
return /*#__PURE__*/_react.default.createElement(_index.default, (0, _extends2.default)({}, action, {
|
|
94
|
+
appearance: appearance,
|
|
95
|
+
asDropDownItem: asDropDownItem,
|
|
96
|
+
testId: testId
|
|
97
|
+
}));
|
|
98
|
+
} else {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
/*
|
|
103
|
+
Explanatory note:
|
|
104
|
+
Actions don't have access to the react tree of whatever is rendered them
|
|
105
|
+
(and this concept is fraught inside editor anyway) so we want to ensure
|
|
106
|
+
it is mounting to a new unique place. This function manages that, including
|
|
107
|
+
creating an element if it doesn't exist, as well as tidying up the react tree
|
|
108
|
+
(but not the element) upon closing the modal.
|
|
109
|
+
|
|
110
|
+
This may strike you as really uncomfortable as you read it, so I wanted to note
|
|
111
|
+
that a) this was discussed and agreed upon, and b) it's definitely odd, and if
|
|
112
|
+
you find an elegant solution around this, you should definitely feel free to
|
|
113
|
+
refactor it.
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
function previewFunction(_x) {
|
|
118
|
+
return _previewFunction.apply(this, arguments);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function _previewFunction() {
|
|
122
|
+
_previewFunction = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
|
|
123
|
+
var popupMountPointId, rest, popupMountPoint, Modal;
|
|
124
|
+
return _regenerator.default.wrap(function _callee$(_context2) {
|
|
125
|
+
while (1) {
|
|
126
|
+
switch (_context2.prev = _context2.next) {
|
|
127
|
+
case 0:
|
|
128
|
+
popupMountPointId = _ref.popupMountPointId, rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
129
|
+
popupMountPoint = document.getElementById(popupMountPointId);
|
|
130
|
+
|
|
131
|
+
if (!popupMountPoint) {
|
|
132
|
+
popupMountPoint = document.createElement('div');
|
|
133
|
+
popupMountPoint.id = popupMountPointId;
|
|
134
|
+
popupMountPoint.setAttribute('data-testid', 'preview-modal');
|
|
135
|
+
document.body.appendChild(popupMountPoint);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
_context2.next = 5;
|
|
139
|
+
return Promise.resolve().then(function () {
|
|
140
|
+
return _interopRequireWildcard(require('../../../../../EmbedModal'));
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
case 5:
|
|
144
|
+
Modal = _context2.sent;
|
|
145
|
+
|
|
146
|
+
_reactDom.default.render( /*#__PURE__*/_react.default.createElement(_reactIntlNext.IntlProvider, {
|
|
147
|
+
locale: "en"
|
|
148
|
+
}, /*#__PURE__*/_react.default.createElement(Modal.default, (0, _extends2.default)({}, rest, {
|
|
149
|
+
onClose: function onClose(_context) {
|
|
150
|
+
if (popupMountPoint) {
|
|
151
|
+
_reactDom.default.unmountComponentAtNode(popupMountPoint);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}))), popupMountPoint);
|
|
155
|
+
|
|
156
|
+
case 7:
|
|
157
|
+
case "end":
|
|
158
|
+
return _context2.stop();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}, _callee);
|
|
162
|
+
}));
|
|
163
|
+
return _previewFunction.apply(this, arguments);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
var _default = PreviewAction;
|
|
167
|
+
exports.default = _default;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
exports.viewFunction = viewFunction;
|
|
10
|
+
|
|
11
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
12
|
+
|
|
13
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
14
|
+
|
|
15
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
16
|
+
|
|
17
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
18
|
+
|
|
19
|
+
var _react = _interopRequireDefault(require("react"));
|
|
20
|
+
|
|
21
|
+
var _index = _interopRequireDefault(require("../index"));
|
|
22
|
+
|
|
23
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
24
|
+
|
|
25
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
26
|
+
|
|
27
|
+
var ViewAction = function ViewAction(props) {
|
|
28
|
+
var appearance = props.appearance,
|
|
29
|
+
asDropDownItem = props.asDropDownItem,
|
|
30
|
+
testId = props.testId,
|
|
31
|
+
_onClick = props.onClick,
|
|
32
|
+
viewUrl = props.viewUrl,
|
|
33
|
+
url = props.url;
|
|
34
|
+
|
|
35
|
+
if (viewUrl && url) {
|
|
36
|
+
var action = _objectSpread(_objectSpread({}, props), {}, {
|
|
37
|
+
onClick: function onClick() {
|
|
38
|
+
viewFunction({
|
|
39
|
+
url: viewUrl
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
if (_onClick) {
|
|
43
|
+
_onClick();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
return /*#__PURE__*/_react.default.createElement(_index.default, (0, _extends2.default)({}, action, {
|
|
49
|
+
appearance: appearance,
|
|
50
|
+
asDropDownItem: asDropDownItem,
|
|
51
|
+
testId: testId
|
|
52
|
+
}));
|
|
53
|
+
} else {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
function viewFunction(_x) {
|
|
59
|
+
return _viewFunction.apply(this, arguments);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function _viewFunction() {
|
|
63
|
+
_viewFunction = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
|
|
64
|
+
var url;
|
|
65
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
66
|
+
while (1) {
|
|
67
|
+
switch (_context.prev = _context.next) {
|
|
68
|
+
case 0:
|
|
69
|
+
url = _ref.url;
|
|
70
|
+
|
|
71
|
+
if (url) {
|
|
72
|
+
_context.next = 3;
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return _context.abrupt("return");
|
|
77
|
+
|
|
78
|
+
case 3:
|
|
79
|
+
window.open(url, '_blank', 'noopener=yes');
|
|
80
|
+
|
|
81
|
+
case 4:
|
|
82
|
+
case "end":
|
|
83
|
+
return _context.stop();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}, _callee);
|
|
87
|
+
}));
|
|
88
|
+
return _viewFunction.apply(this, arguments);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
var _default = ViewAction;
|
|
92
|
+
exports.default = _default;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.EditAction = exports.DeleteAction = exports.CustomAction = void 0;
|
|
6
|
+
exports.ViewAction = exports.PreviewAction = exports.EditAction = exports.DownloadAction = exports.DeleteAction = exports.CustomAction = void 0;
|
|
7
7
|
|
|
8
8
|
var _constants = require("../../../../constants");
|
|
9
9
|
|
|
@@ -27,12 +27,36 @@ var DeleteAction = (0, _utils.createUIAction)(_constants.ActionName.DeleteAction
|
|
|
27
27
|
|
|
28
28
|
exports.DeleteAction = DeleteAction;
|
|
29
29
|
var EditAction = (0, _utils.createUIAction)(_constants.ActionName.EditAction);
|
|
30
|
+
/**
|
|
31
|
+
* Creates a PreviewAction component. Accepts default PreviewActionProps, and defaults
|
|
32
|
+
* to the text 'Preview' inside the button.
|
|
33
|
+
* @see Action
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
exports.EditAction = EditAction;
|
|
37
|
+
var PreviewAction = (0, _utils.createDataAction)(_constants.ActionName.PreviewAction);
|
|
38
|
+
/**
|
|
39
|
+
* Creates a ViewAction component. Accepts default ViewActionProps, and defaults
|
|
40
|
+
* to the text 'View' inside the button.
|
|
41
|
+
* @see Action
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
exports.PreviewAction = PreviewAction;
|
|
45
|
+
var ViewAction = (0, _utils.createDataAction)(_constants.ActionName.ViewAction);
|
|
46
|
+
/**
|
|
47
|
+
* Creates a DownloadAction component. Accepts default DownloadActionProps, and defaults
|
|
48
|
+
* to the text 'Download' inside the button.
|
|
49
|
+
* @see Action
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
exports.ViewAction = ViewAction;
|
|
53
|
+
var DownloadAction = (0, _utils.createDataAction)(_constants.ActionName.DownloadAction);
|
|
30
54
|
/**
|
|
31
55
|
* Creates a CustomAction component. Accepts default ActionProps. Required to provide
|
|
32
56
|
* your own icon or text.
|
|
33
57
|
* @see Action
|
|
34
58
|
*/
|
|
35
59
|
|
|
36
|
-
exports.
|
|
60
|
+
exports.DownloadAction = DownloadAction;
|
|
37
61
|
var CustomAction = (0, _utils.createUIAction)(_constants.ActionName.CustomAction);
|
|
38
62
|
exports.CustomAction = CustomAction;
|
|
@@ -29,6 +29,18 @@ var _cross = _interopRequireDefault(require("@atlaskit/icon/glyph/cross"));
|
|
|
29
29
|
|
|
30
30
|
var _edit = _interopRequireDefault(require("@atlaskit/icon/glyph/edit"));
|
|
31
31
|
|
|
32
|
+
var _previewAction = _interopRequireDefault(require("./action/preview-action"));
|
|
33
|
+
|
|
34
|
+
var _vidFullScreenOn = _interopRequireDefault(require("@atlaskit/icon/glyph/vid-full-screen-on"));
|
|
35
|
+
|
|
36
|
+
var _viewAction = _interopRequireDefault(require("./action/view-action"));
|
|
37
|
+
|
|
38
|
+
var _shortcut = _interopRequireDefault(require("@atlaskit/icon/glyph/shortcut"));
|
|
39
|
+
|
|
40
|
+
var _downloadAction = _interopRequireDefault(require("./action/download-action"));
|
|
41
|
+
|
|
42
|
+
var _download = _interopRequireDefault(require("@atlaskit/icon/glyph/download"));
|
|
43
|
+
|
|
32
44
|
var _actionMappings;
|
|
33
45
|
|
|
34
46
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -62,6 +74,36 @@ var actionMappings = (_actionMappings = {}, (0, _defineProperty2.default)(_actio
|
|
|
62
74
|
}),
|
|
63
75
|
tooltipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.edit)
|
|
64
76
|
}
|
|
77
|
+
}), (0, _defineProperty2.default)(_actionMappings, _constants.ActionName.PreviewAction, {
|
|
78
|
+
component: _previewAction.default,
|
|
79
|
+
props: {
|
|
80
|
+
testId: 'smart-action-preview-action',
|
|
81
|
+
content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.preview),
|
|
82
|
+
icon: /*#__PURE__*/_react.default.createElement(_vidFullScreenOn.default, {
|
|
83
|
+
label: "Preview"
|
|
84
|
+
}),
|
|
85
|
+
tooltipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.preview)
|
|
86
|
+
}
|
|
87
|
+
}), (0, _defineProperty2.default)(_actionMappings, _constants.ActionName.ViewAction, {
|
|
88
|
+
component: _viewAction.default,
|
|
89
|
+
props: {
|
|
90
|
+
testId: 'smart-action-view-action',
|
|
91
|
+
content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.view),
|
|
92
|
+
icon: /*#__PURE__*/_react.default.createElement(_shortcut.default, {
|
|
93
|
+
label: "View"
|
|
94
|
+
}),
|
|
95
|
+
tooltipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.view)
|
|
96
|
+
}
|
|
97
|
+
}), (0, _defineProperty2.default)(_actionMappings, _constants.ActionName.DownloadAction, {
|
|
98
|
+
component: _downloadAction.default,
|
|
99
|
+
props: {
|
|
100
|
+
testId: 'smart-action-download-action',
|
|
101
|
+
content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.download),
|
|
102
|
+
icon: /*#__PURE__*/_react.default.createElement(_download.default, {
|
|
103
|
+
label: "Download"
|
|
104
|
+
}),
|
|
105
|
+
tooltipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.download)
|
|
106
|
+
}
|
|
65
107
|
}), _actionMappings);
|
|
66
108
|
|
|
67
109
|
var getContextKey = function getContextKey(name) {
|
|
@@ -78,8 +120,13 @@ var getActionData = function getActionData(actionName, contextKey, context) {
|
|
|
78
120
|
var data = context[contextKey];
|
|
79
121
|
|
|
80
122
|
switch (actionName) {
|
|
81
|
-
|
|
123
|
+
case _constants.ActionName.PreviewAction:
|
|
124
|
+
case _constants.ActionName.ViewAction:
|
|
125
|
+
case _constants.ActionName.DownloadAction:
|
|
82
126
|
return data;
|
|
127
|
+
|
|
128
|
+
default:
|
|
129
|
+
return undefined;
|
|
83
130
|
}
|
|
84
131
|
};
|
|
85
132
|
|
|
@@ -97,7 +144,9 @@ var createDataAction = function createDataAction(name) {
|
|
|
97
144
|
return function (overrides) {
|
|
98
145
|
var context = (0, _react.useContext)(_flexibleUiContext.FlexibleUiContext);
|
|
99
146
|
var data = getActionData(name, contextKey, context);
|
|
100
|
-
return /*#__PURE__*/_react.default.createElement(BaseAction, (0, _extends2.default)({}, props, data, overrides
|
|
147
|
+
return data ? /*#__PURE__*/_react.default.createElement(BaseAction, (0, _extends2.default)({}, props, data, overrides, {
|
|
148
|
+
url: context === null || context === void 0 ? void 0 : context.url
|
|
149
|
+
})) : null;
|
|
101
150
|
};
|
|
102
151
|
};
|
|
103
152
|
|
|
@@ -68,17 +68,7 @@ var ActionGroup = function ActionGroup(_ref) {
|
|
|
68
68
|
var _useState = (0, _react.useState)(false),
|
|
69
69
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
70
70
|
isOpen = _useState2[0],
|
|
71
|
-
setIsOpen = _useState2[1];
|
|
72
|
-
|
|
73
|
-
var _useMemo = (0, _react.useMemo)(function () {
|
|
74
|
-
var isMoreThenTwoItems = items.length > visibleButtonsNum;
|
|
75
|
-
var buttons = isMoreThenTwoItems ? items.slice(0, visibleButtonsNum - 1) : items;
|
|
76
|
-
var dropdownItems = isMoreThenTwoItems ? items.slice(visibleButtonsNum - 1) : [];
|
|
77
|
-
return [buttons, dropdownItems];
|
|
78
|
-
}, [items, visibleButtonsNum]),
|
|
79
|
-
_useMemo2 = (0, _slicedToArray2.default)(_useMemo, 2),
|
|
80
|
-
buttonActions = _useMemo2[0],
|
|
81
|
-
dropdownItemActions = _useMemo2[1]; // Stop AK dropdown menu to propagate event on click.
|
|
71
|
+
setIsOpen = _useState2[1]; // Stop AK dropdown menu to propagate event on click.
|
|
82
72
|
|
|
83
73
|
|
|
84
74
|
var onClick = (0, _react.useCallback)(function (e) {
|
|
@@ -98,11 +88,27 @@ var ActionGroup = function ActionGroup(_ref) {
|
|
|
98
88
|
});
|
|
99
89
|
}
|
|
100
90
|
}, [isOpen, onOpenChange]);
|
|
91
|
+
var renderableActions = items.filter(function (action) {
|
|
92
|
+
return (0, _utils.renderActionItems)([action]);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
var _useMemo = (0, _react.useMemo)(function () {
|
|
96
|
+
var isMoreThenTwoItems = renderableActions && renderableActions.length > visibleButtonsNum;
|
|
97
|
+
var buttons = isMoreThenTwoItems ? renderableActions.slice(0, visibleButtonsNum - 1) : renderableActions;
|
|
98
|
+
var dropdownItems = isMoreThenTwoItems ? renderableActions.slice(visibleButtonsNum - 1) : [];
|
|
99
|
+
return [buttons, dropdownItems];
|
|
100
|
+
}, [renderableActions, visibleButtonsNum]),
|
|
101
|
+
_useMemo2 = (0, _slicedToArray2.default)(_useMemo, 2),
|
|
102
|
+
buttonActions = _useMemo2[0],
|
|
103
|
+
dropdownItemActions = _useMemo2[1];
|
|
104
|
+
|
|
105
|
+
var dropdownMenuElement = (0, _utils.renderActionItems)(dropdownItemActions, size, appearance, true, onActionClick);
|
|
106
|
+
var buttonGroupElement = (0, _utils.renderActionItems)(buttonActions, size, appearance, false, onActionClick);
|
|
101
107
|
return (0, _react2.jsx)("div", {
|
|
102
108
|
css: styles,
|
|
103
109
|
className: "actions-button-group",
|
|
104
110
|
onClick: onClick
|
|
105
|
-
}, (0, _react2.jsx)(_buttonGroup.default, null,
|
|
111
|
+
}, (0, _react2.jsx)(_buttonGroup.default, null, buttonGroupElement, dropdownItemActions.length > 0 && dropdownMenuElement && dropdownMenuElement.length > 0 ? (0, _react2.jsx)(_dropdownMenu.default, {
|
|
106
112
|
isOpen: isOpen,
|
|
107
113
|
onOpenChange: onOpenChange,
|
|
108
114
|
trigger: function trigger(_ref2) {
|
|
@@ -123,7 +129,7 @@ var ActionGroup = function ActionGroup(_ref) {
|
|
|
123
129
|
})));
|
|
124
130
|
},
|
|
125
131
|
testId: "action-group-dropdown"
|
|
126
|
-
},
|
|
132
|
+
}, dropdownMenuElement) : null));
|
|
127
133
|
};
|
|
128
134
|
|
|
129
135
|
var _default = ActionGroup;
|
|
@@ -99,7 +99,7 @@ var isElementDisplayValid = function isElementDisplayValid(name, display) {
|
|
|
99
99
|
return (_ElementDisplaySchema2 = (_ElementDisplaySchema3 = ElementDisplaySchema[name]) === null || _ElementDisplaySchema3 === void 0 ? void 0 : _ElementDisplaySchema3.includes(display)) !== null && _ElementDisplaySchema2 !== void 0 ? _ElementDisplaySchema2 : false;
|
|
100
100
|
};
|
|
101
101
|
|
|
102
|
-
var
|
|
102
|
+
var isJSXElementNull = function isJSXElementNull(children) {
|
|
103
103
|
return Boolean(children.type() === null);
|
|
104
104
|
};
|
|
105
105
|
|
|
@@ -137,7 +137,7 @@ var renderElementItems = function renderElementItems() {
|
|
|
137
137
|
key: idx
|
|
138
138
|
}, typedProps));
|
|
139
139
|
|
|
140
|
-
if (!
|
|
140
|
+
if (!isJSXElementNull(element)) {
|
|
141
141
|
return [].concat((0, _toConsumableArray2.default)(acc), [element]);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
@@ -187,13 +187,18 @@ var renderActionItems = function renderActionItems() {
|
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
|
|
190
|
-
|
|
190
|
+
var action = /*#__PURE__*/_react.default.createElement(Action, (0, _extends2.default)({
|
|
191
|
+
url: '',
|
|
191
192
|
asDropDownItem: asDropDownItems,
|
|
192
193
|
size: size,
|
|
193
194
|
key: idx,
|
|
194
195
|
appearance: appearance,
|
|
195
196
|
onClick: handleOnClick
|
|
196
|
-
}, actionProps))
|
|
197
|
+
}, actionProps));
|
|
198
|
+
|
|
199
|
+
if (!isJSXElementNull(action)) {
|
|
200
|
+
return [].concat((0, _toConsumableArray2.default)(acc), [action]);
|
|
201
|
+
}
|
|
197
202
|
}
|
|
198
203
|
|
|
199
204
|
return acc;
|
|
@@ -51,7 +51,7 @@ var Media = function Media(_ref) {
|
|
|
51
51
|
return (0, _react2.jsx)("div", {
|
|
52
52
|
css: [styles, overrideCss],
|
|
53
53
|
"data-smart-element": name,
|
|
54
|
-
"data-smart-element-media":
|
|
54
|
+
"data-smart-element-media": type,
|
|
55
55
|
"data-testid": testId
|
|
56
56
|
}, (0, _react2.jsx)(_imageIcon.default, {
|
|
57
57
|
testId: "".concat(testId, "-image"),
|
|
@@ -41,7 +41,8 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
41
41
|
ui = _ref.ui,
|
|
42
42
|
url = _ref.url,
|
|
43
43
|
onClick = _ref.onClick,
|
|
44
|
-
testId = _ref.testId
|
|
44
|
+
testId = _ref.testId,
|
|
45
|
+
analytics = _ref.analytics;
|
|
45
46
|
var cardType = cardState.status,
|
|
46
47
|
details = cardState.details;
|
|
47
48
|
var status = cardType;
|
|
@@ -78,7 +79,9 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
78
79
|
break;
|
|
79
80
|
}
|
|
80
81
|
}, [onError, onResolve, status, title, url]);
|
|
81
|
-
return /*#__PURE__*/_react.default.createElement(_flexibleUiContext.
|
|
82
|
+
return /*#__PURE__*/_react.default.createElement(_flexibleUiContext.FlexibleUiAnalyticsContext.Provider, {
|
|
83
|
+
value: analytics
|
|
84
|
+
}, /*#__PURE__*/_react.default.createElement(_flexibleUiContext.FlexibleUiContext.Provider, {
|
|
82
85
|
value: context
|
|
83
86
|
}, /*#__PURE__*/_react.default.createElement(_container.default, (0, _extends2.default)({
|
|
84
87
|
testId: testId
|
|
@@ -86,7 +89,7 @@ var FlexibleCard = function FlexibleCard(_ref) {
|
|
|
86
89
|
onClick: onClick,
|
|
87
90
|
retry: retry,
|
|
88
91
|
status: status
|
|
89
|
-
}), children));
|
|
92
|
+
}), children)));
|
|
90
93
|
};
|
|
91
94
|
|
|
92
95
|
var _default = FlexibleCard;
|
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.blockCardIconImageClassName = exports.Icon = void 0;
|
|
9
9
|
|
|
10
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
+
|
|
10
12
|
var _react = require("@emotion/react");
|
|
11
13
|
|
|
12
14
|
var _react2 = _interopRequireDefault(require("react"));
|
|
@@ -17,16 +19,35 @@ var _link = _interopRequireDefault(require("@atlaskit/icon/glyph/link"));
|
|
|
17
19
|
|
|
18
20
|
var _utils = require("./utils");
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
var _templateObject, _templateObject2;
|
|
23
|
+
|
|
21
24
|
var blockCardIconImageClassName = 'block-card-icon-image';
|
|
22
25
|
exports.blockCardIconImageClassName = blockCardIconImageClassName;
|
|
23
26
|
|
|
27
|
+
var getImageStyles = function getImageStyles(isFlexibleUi) {
|
|
28
|
+
if (isFlexibleUi) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n height: ", ";\n width: ", ";\n "])), (0, _utils.gs)(2), (0, _utils.gs)(2));
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var getSpanStyles = function getSpanStyles(isFlexibleUi) {
|
|
36
|
+
if (isFlexibleUi) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n height: ", ";\n width: ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n "])), (0, _utils.gs)(2.5), (0, _utils.gs)(2));
|
|
41
|
+
};
|
|
42
|
+
|
|
24
43
|
var Icon = function Icon(_ref) {
|
|
25
44
|
var url = _ref.url,
|
|
26
45
|
icon = _ref.icon,
|
|
27
46
|
defaultIcon = _ref.defaultIcon,
|
|
28
47
|
_ref$testId = _ref.testId,
|
|
29
|
-
testId = _ref$testId === void 0 ? 'block-card-icon' : _ref$testId
|
|
48
|
+
testId = _ref$testId === void 0 ? 'block-card-icon' : _ref$testId,
|
|
49
|
+
_ref$isFlexibleUi = _ref.isFlexibleUi,
|
|
50
|
+
isFlexibleUi = _ref$isFlexibleUi === void 0 ? false : _ref$isFlexibleUi;
|
|
30
51
|
var placeholder = defaultIcon || (0, _react.jsx)(_link.default, {
|
|
31
52
|
label: "link",
|
|
32
53
|
size: "small",
|
|
@@ -35,23 +56,14 @@ var Icon = function Icon(_ref) {
|
|
|
35
56
|
var image = url && (0, _react.jsx)(_reactRenderImage.default, {
|
|
36
57
|
src: url,
|
|
37
58
|
loaded: (0, _react.jsx)("img", {
|
|
38
|
-
css:
|
|
39
|
-
height: (0, _utils.gs)(2),
|
|
40
|
-
width: (0, _utils.gs)(2)
|
|
41
|
-
},
|
|
59
|
+
css: getImageStyles(isFlexibleUi),
|
|
42
60
|
src: url,
|
|
43
61
|
"data-testid": "".concat(testId, "-image")
|
|
44
62
|
}),
|
|
45
63
|
errored: placeholder
|
|
46
64
|
});
|
|
47
65
|
return (0, _react.jsx)("span", {
|
|
48
|
-
css:
|
|
49
|
-
height: (0, _utils.gs)(2.5),
|
|
50
|
-
width: (0, _utils.gs)(2),
|
|
51
|
-
display: 'flex',
|
|
52
|
-
alignItems: 'center',
|
|
53
|
-
justifyContent: 'center'
|
|
54
|
-
},
|
|
66
|
+
css: getSpanStyles(isFlexibleUi),
|
|
55
67
|
"data-testid": testId,
|
|
56
68
|
className: blockCardIconImageClassName
|
|
57
69
|
}, icon || image || placeholder);
|
package/dist/es2019/constants.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
export const CONTENT_URL_SECURITY_AND_PERMISSIONS = 'https://support.atlassian.com/confluence-cloud/docs/insert-links-and-anchors/#Smart-links';
|
|
1
2
|
/**
|
|
2
3
|
* The alignment of Flexible UI component.
|
|
3
4
|
*/
|
|
5
|
+
|
|
4
6
|
export let SmartLinkAlignment;
|
|
5
7
|
/**
|
|
6
8
|
* The direction of Flexible UI components. It establish the main-axis
|
|
@@ -140,6 +142,9 @@ export let ActionName;
|
|
|
140
142
|
(function (ActionName) {
|
|
141
143
|
ActionName["DeleteAction"] = "DeleteAction";
|
|
142
144
|
ActionName["EditAction"] = "EditAction";
|
|
145
|
+
ActionName["PreviewAction"] = "PreviewAction";
|
|
146
|
+
ActionName["ViewAction"] = "ViewAction";
|
|
147
|
+
ActionName["DownloadAction"] = "DownloadAction";
|
|
143
148
|
ActionName["CustomAction"] = "CustomAction";
|
|
144
149
|
})(ActionName || (ActionName = {}));
|
|
145
150
|
|
|
@@ -54,7 +54,7 @@ const getServerActionProps = (jsonLd, action, handler) => {
|
|
|
54
54
|
};
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
const getActionsFromJsonLd = jsonLd => {
|
|
57
|
+
export const getActionsFromJsonLd = jsonLd => {
|
|
58
58
|
let actions = jsonLd && jsonLd['schema:potentialAction'];
|
|
59
59
|
|
|
60
60
|
if (!actions) {
|
|
@@ -67,7 +67,6 @@ const getActionsFromJsonLd = jsonLd => {
|
|
|
67
67
|
|
|
68
68
|
return actions;
|
|
69
69
|
};
|
|
70
|
-
|
|
71
70
|
export function extractActions(jsonLd, handler) {
|
|
72
71
|
const actions = getActionsFromJsonLd(jsonLd);
|
|
73
72
|
const clientActions = actions.filter(isClientAction);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getActionsFromJsonLd } from '../../common/actions/extractActions';
|
|
2
|
+
import { extractDownloadUrl } from '../../common/detail';
|
|
3
|
+
export const extractDownloadAction = data => {
|
|
4
|
+
const downloadActionExists = getActionsFromJsonLd(data).find(action => action['@type'] === 'DownloadAction');
|
|
5
|
+
|
|
6
|
+
if (downloadActionExists) {
|
|
7
|
+
return {
|
|
8
|
+
downloadUrl: extractDownloadUrl(data)
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return undefined;
|
|
13
|
+
};
|