@atlaskit/smart-card 34.3.0 → 34.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 +15 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/utils/index.js +201 -263
- package/dist/cjs/view/FlexibleCard/components/blocks/element-group/ElementGroupOld.js +115 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/element-group/index.compiled.css +46 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/element-group/index.js +58 -81
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/TitleBlockOld.js +135 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/errored/TitleBlockErroredViewOld.js +108 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/errored/index.js +10 -57
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/index.compiled.css +2 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/index.js +38 -37
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolved/TitleBlockResolvedViewOld.js +58 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolved/index.compiled.css +1 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolved/index.js +24 -16
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolving/TitleBlockResolvingViewOld.js +48 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolving/index.compiled.css +55 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolving/index.js +23 -19
- package/dist/cjs/view/FlexibleCard/components/common/atlaskit-icon/index.js +14 -9
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/RelatedLinksModal/components/RelatedLinksBaseModal.js +15 -14
- package/dist/cjs/view/RelatedLinksModal/components/RelatedLinksBaseModalOld.js +63 -0
- package/dist/cjs/view/RelatedLinksModal/components/related-link-item/RelatedLinkItemOld.js +61 -0
- package/dist/cjs/view/RelatedLinksModal/components/related-link-item/index.js +20 -19
- package/dist/cjs/view/RelatedLinksModal/components/related-links-list/RelatedLinksListOld.js +51 -0
- package/dist/cjs/view/RelatedLinksModal/components/related-links-list/index.js +24 -24
- package/dist/cjs/view/RelatedLinksModal/views/errored/error-svg/ErrorSvgOld.js +66 -0
- package/dist/cjs/view/RelatedLinksModal/views/errored/error-svg/index.compiled.css +6 -0
- package/dist/cjs/view/RelatedLinksModal/views/errored/error-svg/index.js +31 -25
- package/dist/cjs/view/RelatedLinksModal/views/resolved/ResolvedOld.js +45 -0
- package/dist/cjs/view/RelatedLinksModal/views/resolved/index.js +16 -14
- package/dist/cjs/view/RelatedLinksModal/views/unavailable/unavailable-svg/UnavailableSvgOld.js +141 -0
- package/dist/cjs/view/RelatedLinksModal/views/unavailable/unavailable-svg/index.compiled.css +6 -0
- package/dist/cjs/view/RelatedLinksModal/views/unavailable/unavailable-svg/index.js +56 -50
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/utils/index.js +69 -55
- package/dist/es2019/view/FlexibleCard/components/blocks/element-group/ElementGroupOld.js +113 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/element-group/index.compiled.css +46 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/element-group/index.js +60 -95
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/TitleBlockOld.js +118 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/errored/TitleBlockErroredViewOld.js +102 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/errored/index.js +11 -57
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/index.compiled.css +2 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/index.js +35 -36
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolved/TitleBlockResolvedViewOld.js +50 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolved/index.compiled.css +1 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolved/index.js +15 -11
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolving/TitleBlockResolvingViewOld.js +42 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolving/index.compiled.css +55 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolving/index.js +20 -18
- package/dist/es2019/view/FlexibleCard/components/common/atlaskit-icon/index.js +9 -2
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/RelatedLinksModal/components/RelatedLinksBaseModal.js +15 -14
- package/dist/es2019/view/RelatedLinksModal/components/RelatedLinksBaseModalOld.js +55 -0
- package/dist/es2019/view/RelatedLinksModal/components/related-link-item/RelatedLinkItemOld.js +55 -0
- package/dist/es2019/view/RelatedLinksModal/components/related-link-item/index.js +19 -18
- package/dist/es2019/view/RelatedLinksModal/components/related-links-list/RelatedLinksListOld.js +42 -0
- package/dist/es2019/view/RelatedLinksModal/components/related-links-list/index.js +23 -22
- package/dist/es2019/view/RelatedLinksModal/views/errored/error-svg/ErrorSvgOld.js +58 -0
- package/dist/es2019/view/RelatedLinksModal/views/errored/error-svg/index.compiled.css +6 -0
- package/dist/es2019/view/RelatedLinksModal/views/errored/error-svg/index.js +28 -24
- package/dist/es2019/view/RelatedLinksModal/views/resolved/ResolvedOld.js +36 -0
- package/dist/es2019/view/RelatedLinksModal/views/resolved/index.js +16 -13
- package/dist/es2019/view/RelatedLinksModal/views/unavailable/unavailable-svg/UnavailableSvgOld.js +133 -0
- package/dist/es2019/view/RelatedLinksModal/views/unavailable/unavailable-svg/index.compiled.css +6 -0
- package/dist/es2019/view/RelatedLinksModal/views/unavailable/unavailable-svg/index.js +53 -49
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/utils/index.js +116 -162
- package/dist/esm/view/FlexibleCard/components/blocks/element-group/ElementGroupOld.js +108 -0
- package/dist/esm/view/FlexibleCard/components/blocks/element-group/index.compiled.css +46 -0
- package/dist/esm/view/FlexibleCard/components/blocks/element-group/index.js +54 -79
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/TitleBlockOld.js +127 -0
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/errored/TitleBlockErroredViewOld.js +101 -0
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/errored/index.js +11 -56
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/index.compiled.css +2 -0
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/index.js +36 -37
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolved/TitleBlockResolvedViewOld.js +53 -0
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolved/index.compiled.css +1 -0
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolved/index.js +15 -11
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolving/TitleBlockResolvingViewOld.js +42 -0
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolving/index.compiled.css +55 -0
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolving/index.js +20 -18
- package/dist/esm/view/FlexibleCard/components/common/atlaskit-icon/index.js +14 -9
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/RelatedLinksModal/components/RelatedLinksBaseModal.js +15 -14
- package/dist/esm/view/RelatedLinksModal/components/RelatedLinksBaseModalOld.js +53 -0
- package/dist/esm/view/RelatedLinksModal/components/related-link-item/RelatedLinkItemOld.js +54 -0
- package/dist/esm/view/RelatedLinksModal/components/related-link-item/index.js +19 -18
- package/dist/esm/view/RelatedLinksModal/components/related-links-list/RelatedLinksListOld.js +43 -0
- package/dist/esm/view/RelatedLinksModal/components/related-links-list/index.js +24 -23
- package/dist/esm/view/RelatedLinksModal/views/errored/error-svg/ErrorSvgOld.js +58 -0
- package/dist/esm/view/RelatedLinksModal/views/errored/error-svg/index.compiled.css +6 -0
- package/dist/esm/view/RelatedLinksModal/views/errored/error-svg/index.js +28 -24
- package/dist/esm/view/RelatedLinksModal/views/resolved/ResolvedOld.js +37 -0
- package/dist/esm/view/RelatedLinksModal/views/resolved/index.js +16 -13
- package/dist/esm/view/RelatedLinksModal/views/unavailable/unavailable-svg/UnavailableSvgOld.js +133 -0
- package/dist/esm/view/RelatedLinksModal/views/unavailable/unavailable-svg/index.compiled.css +6 -0
- package/dist/esm/view/RelatedLinksModal/views/unavailable/unavailable-svg/index.js +53 -49
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/blocks/element-group/ElementGroupOld.d.ts +17 -0
- package/dist/types/view/FlexibleCard/components/blocks/element-group/index.d.ts +5 -9
- package/dist/types/view/FlexibleCard/components/blocks/element-group/types.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/blocks/title-block/TitleBlockOld.d.ts +16 -0
- package/dist/types/view/FlexibleCard/components/blocks/title-block/errored/TitleBlockErroredViewOld.d.ts +15 -0
- package/dist/types/view/FlexibleCard/components/blocks/title-block/errored/index.d.ts +5 -7
- package/dist/types/view/FlexibleCard/components/blocks/title-block/index.d.ts +1 -13
- package/dist/types/view/FlexibleCard/components/blocks/title-block/resolved/TitleBlockResolvedViewOld.d.ts +9 -0
- package/dist/types/view/FlexibleCard/components/blocks/title-block/resolved/index.d.ts +8 -2
- package/dist/types/view/FlexibleCard/components/blocks/title-block/resolving/TitleBlockResolvingViewOld.d.ts +14 -0
- package/dist/types/view/FlexibleCard/components/blocks/title-block/resolving/index.d.ts +5 -3
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +1 -0
- package/dist/types/view/RelatedLinksModal/components/RelatedLinksBaseModal.d.ts +3 -7
- package/dist/types/view/RelatedLinksModal/components/RelatedLinksBaseModalOld.d.ts +8 -0
- package/dist/types/view/RelatedLinksModal/components/related-link-item/RelatedLinkItemOld.d.ts +8 -0
- package/dist/types/view/RelatedLinksModal/components/related-link-item/index.d.ts +3 -7
- package/dist/types/view/RelatedLinksModal/components/related-links-list/RelatedLinksListOld.d.ts +8 -0
- package/dist/types/view/RelatedLinksModal/components/related-links-list/index.d.ts +3 -7
- package/dist/types/view/RelatedLinksModal/views/errored/error-svg/ErrorSvgOld.d.ts +6 -0
- package/dist/types/view/RelatedLinksModal/views/errored/error-svg/index.d.ts +2 -6
- package/dist/types/view/RelatedLinksModal/views/resolved/ResolvedOld.d.ts +8 -0
- package/dist/types/view/RelatedLinksModal/views/resolved/index.d.ts +3 -7
- package/dist/types/view/RelatedLinksModal/views/unavailable/unavailable-svg/UnavailableSvgOld.d.ts +6 -0
- package/dist/types/view/RelatedLinksModal/views/unavailable/unavailable-svg/index.d.ts +2 -6
- package/dist/types-ts4.5/utils/index.d.ts +2 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/element-group/ElementGroupOld.d.ts +17 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/element-group/index.d.ts +5 -9
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/element-group/types.d.ts +1 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/TitleBlockOld.d.ts +16 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/errored/TitleBlockErroredViewOld.d.ts +15 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/errored/index.d.ts +5 -7
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/index.d.ts +1 -13
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/resolved/TitleBlockResolvedViewOld.d.ts +9 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/resolved/index.d.ts +8 -2
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/resolving/TitleBlockResolvingViewOld.d.ts +14 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/resolving/index.d.ts +5 -3
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/types.d.ts +1 -0
- package/dist/types-ts4.5/view/RelatedLinksModal/components/RelatedLinksBaseModal.d.ts +3 -7
- package/dist/types-ts4.5/view/RelatedLinksModal/components/RelatedLinksBaseModalOld.d.ts +8 -0
- package/dist/types-ts4.5/view/RelatedLinksModal/components/related-link-item/RelatedLinkItemOld.d.ts +8 -0
- package/dist/types-ts4.5/view/RelatedLinksModal/components/related-link-item/index.d.ts +3 -7
- package/dist/types-ts4.5/view/RelatedLinksModal/components/related-links-list/RelatedLinksListOld.d.ts +8 -0
- package/dist/types-ts4.5/view/RelatedLinksModal/components/related-links-list/index.d.ts +3 -7
- package/dist/types-ts4.5/view/RelatedLinksModal/views/errored/error-svg/ErrorSvgOld.d.ts +6 -0
- package/dist/types-ts4.5/view/RelatedLinksModal/views/errored/error-svg/index.d.ts +2 -6
- package/dist/types-ts4.5/view/RelatedLinksModal/views/resolved/ResolvedOld.d.ts +8 -0
- package/dist/types-ts4.5/view/RelatedLinksModal/views/resolved/index.d.ts +3 -7
- package/dist/types-ts4.5/view/RelatedLinksModal/views/unavailable/unavailable-svg/UnavailableSvgOld.d.ts +6 -0
- package/dist/types-ts4.5/view/RelatedLinksModal/views/unavailable/unavailable-svg/index.d.ts +2 -6
- package/package.json +2 -2
|
@@ -2,6 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import Loadable from 'react-loadable';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
4
|
import { themeObjectToString } from '@atlaskit/tokens';
|
|
5
|
+
import { IconType } from '../constants';
|
|
6
|
+
import extractFileFormatIcon from '../extractors/flexible/icon/extract-file-formatIcon';
|
|
5
7
|
export const isSpecialEvent = evt => evt.isDefaultPrevented() && (isIframe() || isSpecialKey(evt) || isSpecialClick(evt));
|
|
6
8
|
export const isIframe = () => window.parent !== parent;
|
|
7
9
|
|
|
@@ -20,7 +22,7 @@ export const getIconForFileType = fileMimeType => {
|
|
|
20
22
|
if (!fileMimeType) {
|
|
21
23
|
return;
|
|
22
24
|
}
|
|
23
|
-
let icon = fg('platform-smart-card-icon-migration') ? getTypeToIconMap(
|
|
25
|
+
let icon = fg('platform-smart-card-icon-migration') ? getTypeToIconMap(fileMimeType.toLowerCase()) : typeToIcon[fileMimeType.toLowerCase()];
|
|
24
26
|
if (!icon) {
|
|
25
27
|
return;
|
|
26
28
|
}
|
|
@@ -39,7 +41,7 @@ export const getIconForFileType = fileMimeType => {
|
|
|
39
41
|
});
|
|
40
42
|
};
|
|
41
43
|
export const getLabelForFileType = fileMimeType => {
|
|
42
|
-
let icon = fg('platform-smart-card-icon-migration') ? getTypeToIconMap(
|
|
44
|
+
let icon = fg('platform-smart-card-icon-migration') ? getTypeToIconMap(fileMimeType.toLowerCase()) : typeToIcon[fileMimeType.toLowerCase()];
|
|
43
45
|
if (!icon) {
|
|
44
46
|
return;
|
|
45
47
|
}
|
|
@@ -99,59 +101,71 @@ const typeToIcon = {
|
|
|
99
101
|
'application/sketch': ['Sketch', () => import('@atlaskit/icon-file-type/glyph/sketch/16')],
|
|
100
102
|
folder: ['Folder', () => import('@atlaskit/icon-file-type/glyph/folder/16')]
|
|
101
103
|
};
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
})
|
|
104
|
+
export const getLazyIcons = () => {
|
|
105
|
+
return {
|
|
106
|
+
[IconType.Document]: () => import( /* webpackChunkName: "@atlaskit-internal_page-icon" */'../common/ui/icons/page-icon'),
|
|
107
|
+
[IconType.Blog]: () => import( /* webpackChunkName: "@atlaskit-internal_glyphBlock" */'@atlaskit/icon-object/glyph/blog/16'),
|
|
108
|
+
[IconType.Audio]: () => import( /* webpackChunkName: "@atlaskit-internal_audio-icon" */'../common/ui/icons/audio-icon'),
|
|
109
|
+
[IconType.Code]: () => import( /* webpackChunkName: "@atlaskit-internal_angle-brackets-icon" */'../common/ui/icons/angle-brackets-icon'),
|
|
110
|
+
[IconType.File]: () => import( /* webpackChunkName: "@atlaskit-internal_file-icon" */'../common/ui/icons/file-icon'),
|
|
111
|
+
[IconType.Folder]: () => import( /* webpackChunkName: "@atlaskit-internal_folder-icon" */'../common/ui/icons/folder-icon'),
|
|
112
|
+
[IconType.Generic]: () => import( /* webpackChunkName: "@atlaskit-internal_file-icon" */'../common/ui/icons/file-icon'),
|
|
113
|
+
[IconType.Image]: () => import( /* webpackChunkName: "@atlaskit-internal_image-icon" */'../common/ui/icons/image-icon'),
|
|
114
|
+
[IconType.Presentation]: () => import( /* webpackChunkName: "@atlaskit-internal_chart-bar-icon" */'../common/ui/icons/chart-bar-icon'),
|
|
115
|
+
[IconType.Spreadsheet]: () => import( /* webpackChunkName: "@atlaskit-internal_list-bullet-icon" */'../common/ui/icons/list-bullet-icon'),
|
|
116
|
+
[IconType.Video]: () => import( /* webpackChunkName: "@atlaskit-internal_video-icon" */'../common/ui/icons/video-icon'),
|
|
117
|
+
[IconType.Project]: () => import( /* webpackChunkName: "@atlaskit-internal_glyphProject" */'@atlaskit/icon/core/migration/people-group'),
|
|
118
|
+
[IconType.Template]: () => import( /* webpackChunkName: "@atlaskit-internal_glyphTemplate" */'@atlaskit/icon/core/migration/file--document-filled'),
|
|
119
|
+
[IconType.Forbidden]: () => import( /* webpackChunkName: "@atlaskit-internal_glyphForbidden" */'@atlaskit/icon/core/migration/lock-locked--lock-filled'),
|
|
120
|
+
[IconType.Default]: () => import( /* webpackChunkName: "@atlaskit-internal_glyphDefault" */'@atlaskit/icon/core/migration/link'),
|
|
121
|
+
[IconType.Archive]: () => import( /* webpackChunkName: "glyphArchive" */'@atlaskit/icon-file-type/glyph/archive/16'),
|
|
122
|
+
[IconType.Executable]: () => import( /* webpackChunkName: "glyphExecutable" */'@atlaskit/icon-file-type/glyph/executable/16'),
|
|
123
|
+
[IconType.GIF]: () => import( /* webpackChunkName: "glyphGIF" */'@atlaskit/icon-file-type/glyph/gif/16'),
|
|
124
|
+
[IconType.GoogleDocs]: () => import( /* webpackChunkName: "glyphGoogleDocs" */'@atlaskit/icon-file-type/glyph/google-doc/16'),
|
|
125
|
+
[IconType.GoogleForms]: () => import( /* webpackChunkName: "glyphGoogleForms" */'@atlaskit/icon-file-type/glyph/google-form/16'),
|
|
126
|
+
[IconType.GoogleSheets]: () => import( /* webpackChunkName: "glyphGoogleSheets" */'@atlaskit/icon-file-type/glyph/google-sheet/16'),
|
|
127
|
+
[IconType.GoogleSlides]: () => import( /* webpackChunkName: "glyphGoogleSlides" */'@atlaskit/icon-file-type/glyph/google-slide/16'),
|
|
128
|
+
[IconType.MSExcel]: () => import( /* webpackChunkName: "glyphMSExcel" */'@atlaskit/icon-file-type/glyph/excel-spreadsheet/16'),
|
|
129
|
+
[IconType.MSPowerpoint]: () => import( /* webpackChunkName: "glyphMSPowerpoint" */'@atlaskit/icon-file-type/glyph/powerpoint-presentation/16'),
|
|
130
|
+
[IconType.MSWord]: () => import( /* webpackChunkName: "glyphMSWord" */'@atlaskit/icon-file-type/glyph/word-document/16'),
|
|
131
|
+
[IconType.PDF]: () => import( /* webpackChunkName: "glyphPDF" */'@atlaskit/icon-file-type/glyph/pdf-document/16'),
|
|
132
|
+
[IconType.Sketch]: () => import( /* webpackChunkName: "glyphSketch" */'@atlaskit/icon-file-type/glyph/sketch/16'),
|
|
133
|
+
// Bitbucket icons
|
|
134
|
+
[IconType.Branch]: () => import( /* webpackChunkName: "glyphBranch" */'@atlaskit/icon-object/glyph/branch/16'),
|
|
135
|
+
[IconType.Commit]: () => import( /* webpackChunkName: "glyphCommit" */'@atlaskit/icon-object/glyph/commit/16'),
|
|
136
|
+
[IconType.PullRequest]: () => import( /* webpackChunkName: "glyphPullRequest" */'@atlaskit/icon-object/glyph/pull-request/16'),
|
|
137
|
+
[IconType.Repo]: () => import( /* webpackChunkName: "glyphRepo" */'@atlaskit/icon-object/glyph/code/16'),
|
|
138
|
+
// Jira icons
|
|
139
|
+
[IconType.Bug]: () => import( /* webpackChunkName: "glyphBug" */'@atlaskit/icon-object/glyph/bug/16'),
|
|
140
|
+
[IconType.Change]: () => import( /* webpackChunkName: "glyphChange" */'@atlaskit/icon-object/glyph/changes/16'),
|
|
141
|
+
[IconType.Epic]: () => import( /* webpackChunkName: "glyphEpic" */'@atlaskit/icon-object/glyph/epic/16'),
|
|
142
|
+
[IconType.Incident]: () => import( /* webpackChunkName: "glyphIncident" */'@atlaskit/icon-object/glyph/incident/16'),
|
|
143
|
+
[IconType.Problem]: () => import( /* webpackChunkName: "glyphProblem" */'@atlaskit/icon-object/glyph/problem/16'),
|
|
144
|
+
[IconType.ServiceRequest]: () => import( /* webpackChunkName: "glyphServiceRequest" */'@atlaskit/icon-object/glyph/issue/16'),
|
|
145
|
+
[IconType.Story]: () => import( /* webpackChunkName: "glyphStory" */'@atlaskit/icon-object/glyph/story/16'),
|
|
146
|
+
[IconType.SubTask]: () => import( /* webpackChunkName: "glyphSubTask" */'@atlaskit/icon-object/glyph/subtask/16'),
|
|
147
|
+
[IconType.Task]: () => import( /* webpackChunkName: "glyphTask" */'@atlaskit/icon-object/glyph/task/16'),
|
|
148
|
+
// Provider icons
|
|
149
|
+
[IconType.Confluence]: () => import( /* webpackChunkName: "glyphConfluence" */'@atlaskit/logo/confluence-icon').then(({
|
|
150
|
+
ConfluenceIcon
|
|
151
|
+
}) => ({
|
|
152
|
+
default: ConfluenceIcon
|
|
153
|
+
})),
|
|
154
|
+
[IconType.Jira]: () => import( /* webpackChunkName: "glyphJira" */'@atlaskit/logo/jira-icon').then(({
|
|
155
|
+
JiraIcon
|
|
156
|
+
}) => ({
|
|
157
|
+
default: JiraIcon
|
|
158
|
+
}))
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
const getTypeToIconMap = fileFormat => {
|
|
162
|
+
const iconDescriptor = extractFileFormatIcon(fileFormat);
|
|
163
|
+
if (!(iconDescriptor !== null && iconDescriptor !== void 0 && iconDescriptor.icon) || !iconDescriptor.label) {
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
const lazyIcons = getLazyIcons();
|
|
167
|
+
return [iconDescriptor.label, lazyIcons[iconDescriptor.icon]];
|
|
168
|
+
};
|
|
155
169
|
export const getIframeSandboxAttribute = isTrusted => {
|
|
156
170
|
if (isTrusted) {
|
|
157
171
|
return undefined;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
|
+
import { css, jsx } from '@emotion/react';
|
|
7
|
+
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkPosition, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
|
|
8
|
+
import { getMaxLineHeight, getTruncateStyles } from '../../utils';
|
|
9
|
+
import { getBaseStyles, getGapSize, renderChildren } from '../utils';
|
|
10
|
+
const getAlignmentStyles = align => {
|
|
11
|
+
switch (align) {
|
|
12
|
+
case SmartLinkAlignment.Right:
|
|
13
|
+
return css({
|
|
14
|
+
WebkitBoxAlign: 'end',
|
|
15
|
+
MsFlexAlign: 'end',
|
|
16
|
+
justifyContent: 'flex-end',
|
|
17
|
+
textAlign: 'right'
|
|
18
|
+
});
|
|
19
|
+
case SmartLinkAlignment.Left:
|
|
20
|
+
default:
|
|
21
|
+
return css({
|
|
22
|
+
WebkitBoxAlign: 'start',
|
|
23
|
+
MsFlexAlign: 'start',
|
|
24
|
+
justifyContent: 'flex-start',
|
|
25
|
+
textAlign: 'left'
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const getGapStyles = (size, align) => {
|
|
30
|
+
const gap = getGapSize(size);
|
|
31
|
+
if (align === SmartLinkAlignment.Right) {
|
|
32
|
+
return css({
|
|
33
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
34
|
+
'> span': {
|
|
35
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
36
|
+
marginLeft: `${gap}rem`
|
|
37
|
+
},
|
|
38
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
39
|
+
'> span:first-child': {
|
|
40
|
+
marginLeft: 'initial'
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return css({
|
|
45
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
46
|
+
'> span': {
|
|
47
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
48
|
+
marginRight: `${gap}rem`,
|
|
49
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
50
|
+
'&:last-child': {
|
|
51
|
+
marginRight: 'initial'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
const getHorizontalDirectionStyles = (size, align) => {
|
|
57
|
+
const lineHeight = getMaxLineHeight(size);
|
|
58
|
+
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
59
|
+
return css`
|
|
60
|
+
display: block;
|
|
61
|
+
vertical-align: middle;
|
|
62
|
+
${getTruncateStyles(1, lineHeight + 'rem')}
|
|
63
|
+
|
|
64
|
+
> span, > div {
|
|
65
|
+
vertical-align: middle;
|
|
66
|
+
|
|
67
|
+
&[data-smart-element-date-time],
|
|
68
|
+
&[data-smart-element-text] {
|
|
69
|
+
// Show all/wrapped/truncated
|
|
70
|
+
display: inline;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
${getGapStyles(size, align)}
|
|
75
|
+
`;
|
|
76
|
+
};
|
|
77
|
+
export const getElementGroupStyles = (direction, size, align, width, position) => css(
|
|
78
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
79
|
+
getBaseStyles(direction, size),
|
|
80
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
81
|
+
getAlignmentStyles(align), {
|
|
82
|
+
minWidth: '10%'
|
|
83
|
+
},
|
|
84
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
85
|
+
width === SmartLinkWidth.Flexible ? `flex: 1 3;` : '',
|
|
86
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
87
|
+
direction === SmartLinkDirection.Horizontal ? getHorizontalDirectionStyles(size, align) : '',
|
|
88
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
89
|
+
position === SmartLinkPosition.Top ? 'align-self: flex-start;' : '');
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Creates a group of Action components. Accepts an array of Actions, in addition to some styling
|
|
93
|
+
* preferences.
|
|
94
|
+
* @internal
|
|
95
|
+
* @param {ActionGroupProps} ActionGroupProps
|
|
96
|
+
* @see Action
|
|
97
|
+
*/
|
|
98
|
+
const ElementGroup = ({
|
|
99
|
+
align = SmartLinkAlignment.Left,
|
|
100
|
+
children,
|
|
101
|
+
overrideCss,
|
|
102
|
+
direction = SmartLinkDirection.Horizontal,
|
|
103
|
+
size = SmartLinkSize.Medium,
|
|
104
|
+
testId = 'smart-element-group',
|
|
105
|
+
width = SmartLinkWidth.FitToContent,
|
|
106
|
+
position = SmartLinkPosition.Center
|
|
107
|
+
}) => jsx("div", {
|
|
108
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
109
|
+
css: [getElementGroupStyles(direction, size, align, width, position), overrideCss],
|
|
110
|
+
"data-smart-element-group": true,
|
|
111
|
+
"data-testid": testId
|
|
112
|
+
}, renderChildren(children, size));
|
|
113
|
+
export default ElementGroup;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
|
|
2
|
+
._zulp147b{gap:var(--ds-space-250,1.25rem)}
|
|
3
|
+
._zulp1e9d{gap:var(--ds-space-200,1rem)}
|
|
4
|
+
._zulpcxkx{gap:var(--ds-space-100,.5rem)}
|
|
5
|
+
._zulppdf9{gap:var(--ds-space-050,.25rem)}._16jlkb7n{flex-grow:1}
|
|
6
|
+
._18m915vq{overflow-y:hidden}
|
|
7
|
+
._1aaynkob >div, ._15tynkob >span{vertical-align:middle}
|
|
8
|
+
._1bah1y6m{justify-content:flex-start}
|
|
9
|
+
._1bahesu3{justify-content:flex-end}
|
|
10
|
+
._1bto1l2s{text-overflow:ellipsis}
|
|
11
|
+
._1dthh9n0{-webkit-box-align:end}
|
|
12
|
+
._1dthv2br{-webkit-box-align:start}
|
|
13
|
+
._1e0c1txw{display:flex}
|
|
14
|
+
._1e0c1ule{display:block}
|
|
15
|
+
._1iu61nu9 >div[data-smart-element-date-time], ._166k1nu9 >div[data-smart-element-text], ._1div1nu9 >span[data-smart-element-date-time], ._bmfb1nu9 >span[data-smart-element-text]{display:inline}
|
|
16
|
+
._1nmz1hna{word-break:break-word}
|
|
17
|
+
._1o9z11wp{flex-shrink:3}
|
|
18
|
+
._1ouwidpf>*{min-width:0}
|
|
19
|
+
._1reo15vq{overflow-x:hidden}
|
|
20
|
+
._1ul99by0{min-width:10%}
|
|
21
|
+
._1ul9idpf{min-width:0}
|
|
22
|
+
._1wpz1y6m{align-self:flex-start}
|
|
23
|
+
._1yyjkb7n{-webkit-line-clamp:1}
|
|
24
|
+
._24rc147b >span{margin-left:var(--ds-space-250,1.25rem)}
|
|
25
|
+
._24rc1e9d >span{margin-left:var(--ds-space-200,1rem)}
|
|
26
|
+
._24rccxkx >span{margin-left:var(--ds-space-100,.5rem)}
|
|
27
|
+
._24rcpdf9 >span{margin-left:var(--ds-space-050,.25rem)}
|
|
28
|
+
._2lx21bp4{flex-direction:column}
|
|
29
|
+
._2lx2vrvc{flex-direction:row}
|
|
30
|
+
._3dveidpf >span:first-of-type{margin-left:0}
|
|
31
|
+
._4cvr1h6o{align-items:center}
|
|
32
|
+
._4cvr1y6m{align-items:flex-start}
|
|
33
|
+
._7yhb147b >span{margin-right:var(--ds-space-250,1.25rem)}
|
|
34
|
+
._7yhb1e9d >span{margin-right:var(--ds-space-200,1rem)}
|
|
35
|
+
._7yhbcxkx >span{margin-right:var(--ds-space-100,.5rem)}
|
|
36
|
+
._7yhbpdf9 >span{margin-right:var(--ds-space-050,.25rem)}
|
|
37
|
+
._f6ju1ns9>[data-fit-to-content]{min-width:-moz-fit-content;min-width:fit-content}
|
|
38
|
+
._fiawglyw:empty{display:none}
|
|
39
|
+
._i0dlf1ug{flex-basis:0%}
|
|
40
|
+
._m6ukidpf >span:last-child{margin-right:0}
|
|
41
|
+
._r291h9n0{-ms-flex-align:end}
|
|
42
|
+
._r291v2br{-ms-flex-align:start}
|
|
43
|
+
._s7n4nkob{vertical-align:middle}
|
|
44
|
+
._sudp1e54{-webkit-box-orient:vertical}
|
|
45
|
+
._y3gn1e5h{text-align:left}
|
|
46
|
+
._y3gnusic{text-align:right}
|
|
@@ -1,92 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
|
-
import { css, jsx } from '@emotion/react';
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.35.0 */
|
|
2
|
+
import "./index.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
7
5
|
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkPosition, SmartLinkSize, SmartLinkWidth } from '../../../../../constants';
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return css({
|
|
14
|
-
WebkitBoxAlign: 'end',
|
|
15
|
-
MsFlexAlign: 'end',
|
|
16
|
-
justifyContent: 'flex-end',
|
|
17
|
-
textAlign: 'right'
|
|
18
|
-
});
|
|
19
|
-
case SmartLinkAlignment.Left:
|
|
20
|
-
default:
|
|
21
|
-
return css({
|
|
22
|
-
WebkitBoxAlign: 'start',
|
|
23
|
-
MsFlexAlign: 'start',
|
|
24
|
-
justifyContent: 'flex-start',
|
|
25
|
-
textAlign: 'left'
|
|
26
|
-
});
|
|
27
|
-
}
|
|
6
|
+
import { renderChildren } from '../utils';
|
|
7
|
+
import ElementGroupOld from './ElementGroupOld';
|
|
8
|
+
const alignmentStyleMap = {
|
|
9
|
+
right: "_1dthh9n0 _r291h9n0 _1bahesu3 _y3gnusic",
|
|
10
|
+
left: "_1dthv2br _r291v2br _1bah1y6m _y3gn1e5h"
|
|
28
11
|
};
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
'> span': {
|
|
35
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
36
|
-
marginLeft: `${gap}rem`
|
|
37
|
-
},
|
|
38
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
39
|
-
'> span:first-child': {
|
|
40
|
-
marginLeft: 'initial'
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
return css({
|
|
45
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
46
|
-
'> span': {
|
|
47
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
48
|
-
marginRight: `${gap}rem`,
|
|
49
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
50
|
-
'&:last-child': {
|
|
51
|
-
marginRight: 'initial'
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
});
|
|
12
|
+
const baseStyleBySize = {
|
|
13
|
+
xlarge: "_zulp147b _1reo15vq _18m915vq _4cvr1h6o _1e0c1txw _1ul9idpf",
|
|
14
|
+
large: "_zulp1e9d _1reo15vq _18m915vq _4cvr1h6o _1e0c1txw _1ul9idpf",
|
|
15
|
+
medium: "_zulpcxkx _1reo15vq _18m915vq _4cvr1h6o _1e0c1txw _1ul9idpf",
|
|
16
|
+
small: "_zulppdf9 _1reo15vq _18m915vq _4cvr1h6o _1e0c1txw _1ul9idpf"
|
|
55
17
|
};
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
18
|
+
const baseStyleByDirection = {
|
|
19
|
+
horizontal: "_2lx2vrvc _4cvr1h6o",
|
|
20
|
+
vertical: "_2lx21bp4 _4cvr1y6m"
|
|
21
|
+
};
|
|
22
|
+
const baseStyle = null;
|
|
23
|
+
const widthStyle = {
|
|
24
|
+
flexible: "_16jlkb7n _1o9z11wp _i0dlf1ug",
|
|
25
|
+
'fit-to-content': ""
|
|
26
|
+
};
|
|
27
|
+
const positionStyle = {
|
|
28
|
+
top: "_1wpz1y6m",
|
|
29
|
+
center: ""
|
|
30
|
+
};
|
|
31
|
+
const horizontalStyleBase = null;
|
|
32
|
+
const horizontalStyleByHeight = {
|
|
33
|
+
'xlarge': "_1e0ccj1k _102k1m1q",
|
|
34
|
+
'large': "_1e0ccj1k _102k1m1q",
|
|
35
|
+
'medium': "_1e0ccj1k _102k1k8s",
|
|
36
|
+
'small': "_1e0ccj1k _102k1k8s"
|
|
37
|
+
};
|
|
38
|
+
const gapStylesLeft = {
|
|
39
|
+
'xlarge': "_7yhb147b _m6ukidpf",
|
|
40
|
+
'large': "_7yhb1e9d _m6ukidpf",
|
|
41
|
+
'medium': "_7yhbcxkx _m6ukidpf",
|
|
42
|
+
'small': "_7yhbpdf9 _m6ukidpf"
|
|
43
|
+
};
|
|
44
|
+
const gapStylesRight = {
|
|
45
|
+
'xlarge': "_24rc147b _3dveidpf",
|
|
46
|
+
'large': "_24rc1e9d _3dveidpf",
|
|
47
|
+
'medium': "_24rccxkx _3dveidpf",
|
|
48
|
+
'small': "_24rcpdf9 _3dveidpf"
|
|
76
49
|
};
|
|
77
|
-
export const getElementGroupStyles = (direction, size, align, width, position) => css(
|
|
78
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
79
|
-
getBaseStyles(direction, size),
|
|
80
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
81
|
-
getAlignmentStyles(align), {
|
|
82
|
-
minWidth: '10%'
|
|
83
|
-
},
|
|
84
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
85
|
-
width === SmartLinkWidth.Flexible ? `flex: 1 3;` : '',
|
|
86
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
87
|
-
direction === SmartLinkDirection.Horizontal ? getHorizontalDirectionStyles(size, align) : '',
|
|
88
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
89
|
-
position === SmartLinkPosition.Top ? 'align-self: flex-start;' : '');
|
|
90
50
|
|
|
91
51
|
/**
|
|
92
52
|
* Creates a group of Action components. Accepts an array of Actions, in addition to some styling
|
|
@@ -95,19 +55,24 @@ position === SmartLinkPosition.Top ? 'align-self: flex-start;' : '');
|
|
|
95
55
|
* @param {ActionGroupProps} ActionGroupProps
|
|
96
56
|
* @see Action
|
|
97
57
|
*/
|
|
98
|
-
const
|
|
58
|
+
const ElementGroupNew = ({
|
|
99
59
|
align = SmartLinkAlignment.Left,
|
|
100
60
|
children,
|
|
101
|
-
overrideCss,
|
|
102
61
|
direction = SmartLinkDirection.Horizontal,
|
|
103
62
|
size = SmartLinkSize.Medium,
|
|
104
63
|
testId = 'smart-element-group',
|
|
105
64
|
width = SmartLinkWidth.FitToContent,
|
|
106
|
-
position = SmartLinkPosition.Center
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
"
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
65
|
+
position = SmartLinkPosition.Center,
|
|
66
|
+
className
|
|
67
|
+
}) => {
|
|
68
|
+
const totalCss = [baseStyleBySize[size], baseStyleByDirection[direction], baseStyle, alignmentStyleMap[align], null, widthStyle[width], direction === SmartLinkDirection.Horizontal ? horizontalStyleBase : {}, direction === SmartLinkDirection.Horizontal ? horizontalStyleByHeight[size] : {}, direction === SmartLinkDirection.Horizontal ? SmartLinkAlignment.Left ? gapStylesLeft[size] : gapStylesRight[size] : {}, positionStyle[position]];
|
|
69
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
70
|
+
"data-smart-element-group": true,
|
|
71
|
+
"data-testid": testId
|
|
72
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
73
|
+
,
|
|
74
|
+
className: ax([baseStyleBySize[size], baseStyleByDirection[direction], "_fiawglyw _1ouwidpf _f6ju1ns9", alignmentStyleMap[align], "_1ul99by0", widthStyle[width], direction === SmartLinkDirection.Horizontal && "_1reo15vq _18m915vq _1e0c1ule _s7n4nkob _1bto1l2s _1nmz1hna _1yyjkb7n _sudp1e54 _1aaynkob _15tynkob _1iu61nu9 _166k1nu9 _1div1nu9 _bmfb1nu9", direction === SmartLinkDirection.Horizontal && "", SmartLinkAlignment.Left ? gapStylesLeft[size] : gapStylesRight[size], positionStyle[position], className])
|
|
75
|
+
}, renderChildren(children, size));
|
|
76
|
+
};
|
|
77
|
+
export default ElementGroupOld;
|
|
78
|
+
export { ElementGroupNew };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { useCallback, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
5
|
+
import { css } from '@emotion/react';
|
|
6
|
+
import { SmartLinkStatus } from '../../../../../constants';
|
|
7
|
+
import { useMouseDownEvent } from '../../../../../state/analytics/useLinkClicked';
|
|
8
|
+
import { Title } from '../../elements';
|
|
9
|
+
import ActionGroup from '../action-group';
|
|
10
|
+
import TitleBlockErroredView from './errored';
|
|
11
|
+
import TitleBlockResolvedView from './resolved';
|
|
12
|
+
import TitleBlockResolvingView from './resolving';
|
|
13
|
+
const getActionStyles = (showOnHover, isOpen) => {
|
|
14
|
+
if (showOnHover && !isOpen) {
|
|
15
|
+
return css({
|
|
16
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
17
|
+
'.actions-button-group': {
|
|
18
|
+
opacity: 0
|
|
19
|
+
},
|
|
20
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
21
|
+
'&:hover .actions-button-group, .actions-button-group:focus-within': {
|
|
22
|
+
opacity: 1
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const getTitleBlockViewComponent = status => {
|
|
28
|
+
switch (status) {
|
|
29
|
+
case SmartLinkStatus.Pending:
|
|
30
|
+
case SmartLinkStatus.Resolving:
|
|
31
|
+
return TitleBlockResolvingView;
|
|
32
|
+
case SmartLinkStatus.Resolved:
|
|
33
|
+
return TitleBlockResolvedView;
|
|
34
|
+
case SmartLinkStatus.Unauthorized:
|
|
35
|
+
case SmartLinkStatus.Forbidden:
|
|
36
|
+
case SmartLinkStatus.NotFound:
|
|
37
|
+
case SmartLinkStatus.Errored:
|
|
38
|
+
case SmartLinkStatus.Fallback:
|
|
39
|
+
default:
|
|
40
|
+
return TitleBlockErroredView;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Represents a TitleBlock, which is the foundation of Flexible UI.
|
|
46
|
+
* This contains an icon, the link, and any associated metadata and actions in one block.
|
|
47
|
+
* The TitleBlock will also render differently given the state of the smart link.
|
|
48
|
+
* This can be found in the corresponding Resolving, Resolved and Errored views.
|
|
49
|
+
* @public
|
|
50
|
+
* @param {TitleBlockProps} TitleBlockProps
|
|
51
|
+
* @see Block
|
|
52
|
+
* @see TitleBlockResolvingView
|
|
53
|
+
* @see TitleBlockResolvedView
|
|
54
|
+
* @see TitleBlockErroredView
|
|
55
|
+
*/
|
|
56
|
+
const TitleBlock = ({
|
|
57
|
+
actions = [],
|
|
58
|
+
anchorTarget,
|
|
59
|
+
hideTitleTooltip,
|
|
60
|
+
maxLines,
|
|
61
|
+
onActionMenuOpenChange,
|
|
62
|
+
onClick,
|
|
63
|
+
overrideCss,
|
|
64
|
+
status = SmartLinkStatus.Fallback,
|
|
65
|
+
showActionOnHover,
|
|
66
|
+
testId = 'smart-block-title',
|
|
67
|
+
text,
|
|
68
|
+
icon,
|
|
69
|
+
theme,
|
|
70
|
+
hideRetry,
|
|
71
|
+
metadataPosition,
|
|
72
|
+
hideIcon = false,
|
|
73
|
+
...props
|
|
74
|
+
}) => {
|
|
75
|
+
if (hideRetry && props.retry) {
|
|
76
|
+
delete props.retry;
|
|
77
|
+
}
|
|
78
|
+
const [actionDropdownOpen, setActionDropdownOpen] = useState(false);
|
|
79
|
+
const onDropdownOpenChange = useCallback(isOpen => {
|
|
80
|
+
setActionDropdownOpen(isOpen);
|
|
81
|
+
if (onActionMenuOpenChange) {
|
|
82
|
+
onActionMenuOpenChange({
|
|
83
|
+
isOpen
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}, [onActionMenuOpenChange]);
|
|
87
|
+
const actionGroup = actions.length > 0 && /*#__PURE__*/React.createElement(ActionGroup, {
|
|
88
|
+
items: actions,
|
|
89
|
+
visibleButtonsNum: showActionOnHover ? 1 : 2,
|
|
90
|
+
onDropdownOpenChange: onDropdownOpenChange
|
|
91
|
+
});
|
|
92
|
+
const actionStyles = getActionStyles(showActionOnHover, actionDropdownOpen);
|
|
93
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
94
|
+
const combinedCss = css(actionStyles, overrideCss);
|
|
95
|
+
const overrideText = !!text ? {
|
|
96
|
+
text
|
|
97
|
+
} : {};
|
|
98
|
+
const onMouseDown = useMouseDownEvent();
|
|
99
|
+
const title = /*#__PURE__*/React.createElement(Title, _extends({
|
|
100
|
+
hideTooltip: hideTitleTooltip,
|
|
101
|
+
maxLines: maxLines,
|
|
102
|
+
onClick: onClick,
|
|
103
|
+
onMouseDown: onMouseDown,
|
|
104
|
+
target: anchorTarget,
|
|
105
|
+
theme: theme
|
|
106
|
+
}, overrideText));
|
|
107
|
+
const Component = getTitleBlockViewComponent(status);
|
|
108
|
+
return /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
109
|
+
actionGroup: actionGroup,
|
|
110
|
+
overrideCss: combinedCss,
|
|
111
|
+
testId: testId,
|
|
112
|
+
title: title,
|
|
113
|
+
metadataPosition: metadataPosition,
|
|
114
|
+
hideIcon: hideIcon,
|
|
115
|
+
icon: icon
|
|
116
|
+
}));
|
|
117
|
+
};
|
|
118
|
+
export default TitleBlock;
|