@atlaskit/media-card 77.12.0 → 77.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/compass.yml +6 -3
- package/dist/cjs/card/card.js +5 -5
- package/dist/cjs/card/cardView.js +1 -1
- package/dist/cjs/card/inlinePlayerWrapper.js +4 -1
- package/dist/cjs/card/inlinePlayerWrapperStyles.js +2 -2
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/card/ui/actionsBar/actionsBarWrapper.js +4 -1
- package/dist/cjs/card/ui/actionsBar/cardActions/cardActionButton.js +5 -1
- package/dist/cjs/card/ui/actionsBar/cardActions/cardActionsView.js +1 -1
- package/dist/cjs/card/ui/actionsBar/cardActions/styles.js +14 -2
- package/dist/cjs/card/ui/actionsBar/styles.js +13 -8
- package/dist/cjs/card/ui/blanket/blanket.js +2 -0
- package/dist/cjs/card/ui/blanket/styles.js +8 -2
- package/dist/cjs/card/ui/iconMessage/iconMessageWrapper.js +3 -0
- package/dist/cjs/card/ui/iconWrapper/iconWrapper.js +4 -1
- package/dist/cjs/card/ui/iconWrapper/styles.js +3 -0
- package/dist/cjs/card/ui/openMediaViewerButton/openMediaViewerButton.js +9 -20
- package/dist/cjs/card/ui/playButton/playButtonBackground.js +2 -1
- package/dist/cjs/card/ui/playButton/playButtonWrapper.js +2 -1
- package/dist/cjs/card/ui/playButton/styles.js +7 -0
- package/dist/cjs/card/ui/progressBar/styledBar.js +4 -1
- package/dist/cjs/card/ui/progressBar/styles.js +3 -0
- package/dist/cjs/card/ui/tickBox/tickBoxWrapper.js +14 -3
- package/dist/cjs/card/ui/titleBox/styles.js +24 -4
- package/dist/cjs/card/ui/titleBox/titleBoxComponents.js +30 -17
- package/dist/cjs/card/ui/unhandledErrorCard/index.js +22 -11
- package/dist/cjs/card/ui/wrapper/imageContainer.js +1 -0
- package/dist/cjs/card/ui/wrapper/styles.js +2 -2
- package/dist/cjs/card/ui/wrapper/wrapper.js +4 -1
- package/dist/cjs/card/v2/cardV2.js +1 -1
- package/dist/cjs/card/v2/cardViewV2.js +1 -1
- package/dist/cjs/card/v2/cardviews/cardViewWrapper.js +1 -0
- package/dist/cjs/card/v2/cardviews/errorCardView.js +1 -0
- package/dist/cjs/card/v2/cardviews/iconCardView.js +1 -0
- package/dist/cjs/card/v2/cardviews/imageCardView.js +1 -0
- package/dist/cjs/card/v2/cardviews/index.js +1 -0
- package/dist/cjs/card/v2/cardviews/loadingCardView.js +1 -0
- package/dist/cjs/card/v2/cardviews/processingCardView.js +1 -0
- package/dist/cjs/card/v2/cardviews/videoCardView.js +1 -0
- package/dist/cjs/card/v2/fileCard.js +1 -1
- package/dist/cjs/card/v2/svgView/svgView.js +1 -0
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/inline/mediaInlineAnalyticsErrorBoundary.js +11 -11
- package/dist/cjs/utils/lightCards/errorIcon/index.js +10 -7
- package/dist/cjs/utils/lightCards/errorIcon/styles.js +3 -0
- package/dist/cjs/utils/lightCards/lightCardWrappers.js +9 -5
- package/dist/cjs/utils/lightCards/styles.js +10 -2
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/es2019/card/card.js +5 -5
- package/dist/es2019/card/cardView.js +1 -0
- package/dist/es2019/card/inlinePlayerWrapper.js +4 -1
- package/dist/es2019/card/inlinePlayerWrapperStyles.js +13 -12
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/card/ui/actionsBar/actionsBarWrapper.js +4 -1
- package/dist/es2019/card/ui/actionsBar/cardActions/cardActionButton.js +4 -1
- package/dist/es2019/card/ui/actionsBar/cardActions/cardActionsView.js +1 -0
- package/dist/es2019/card/ui/actionsBar/cardActions/styles.js +14 -2
- package/dist/es2019/card/ui/actionsBar/styles.js +4 -1
- package/dist/es2019/card/ui/blanket/blanket.js +2 -0
- package/dist/es2019/card/ui/blanket/styles.js +7 -2
- package/dist/es2019/card/ui/iconMessage/iconMessageWrapper.js +2 -0
- package/dist/es2019/card/ui/iconWrapper/iconWrapper.js +4 -1
- package/dist/es2019/card/ui/iconWrapper/styles.js +2 -0
- package/dist/es2019/card/ui/openMediaViewerButton/openMediaViewerButton.js +7 -18
- package/dist/es2019/card/ui/playButton/playButtonBackground.js +2 -1
- package/dist/es2019/card/ui/playButton/playButtonWrapper.js +2 -1
- package/dist/es2019/card/ui/playButton/styles.js +6 -0
- package/dist/es2019/card/ui/progressBar/styledBar.js +4 -1
- package/dist/es2019/card/ui/progressBar/styles.js +2 -0
- package/dist/es2019/card/ui/tickBox/tickBoxWrapper.js +13 -3
- package/dist/es2019/card/ui/titleBox/styles.js +23 -4
- package/dist/es2019/card/ui/titleBox/titleBoxComponents.js +30 -17
- package/dist/es2019/card/ui/unhandledErrorCard/index.js +22 -10
- package/dist/es2019/card/ui/wrapper/imageContainer.js +1 -0
- package/dist/es2019/card/ui/wrapper/styles.js +22 -21
- package/dist/es2019/card/ui/wrapper/wrapper.js +4 -1
- package/dist/es2019/card/v2/cardV2.js +1 -1
- package/dist/es2019/card/v2/cardViewV2.js +1 -0
- package/dist/es2019/card/v2/cardviews/cardViewWrapper.js +1 -0
- package/dist/es2019/card/v2/cardviews/errorCardView.js +1 -0
- package/dist/es2019/card/v2/cardviews/iconCardView.js +1 -0
- package/dist/es2019/card/v2/cardviews/imageCardView.js +1 -0
- package/dist/es2019/card/v2/cardviews/index.js +1 -0
- package/dist/es2019/card/v2/cardviews/loadingCardView.js +1 -0
- package/dist/es2019/card/v2/cardviews/processingCardView.js +1 -0
- package/dist/es2019/card/v2/cardviews/videoCardView.js +1 -0
- package/dist/es2019/card/v2/fileCard.js +1 -1
- package/dist/es2019/card/v2/svgView/svgView.js +1 -0
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/inline/mediaInlineAnalyticsErrorBoundary.js +11 -11
- package/dist/es2019/utils/lightCards/errorIcon/index.js +10 -6
- package/dist/es2019/utils/lightCards/errorIcon/styles.js +3 -0
- package/dist/es2019/utils/lightCards/lightCardWrappers.js +9 -5
- package/dist/es2019/utils/lightCards/styles.js +9 -2
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/esm/card/card.js +5 -5
- package/dist/esm/card/cardView.js +1 -0
- package/dist/esm/card/inlinePlayerWrapper.js +4 -1
- package/dist/esm/card/inlinePlayerWrapperStyles.js +2 -1
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/card/ui/actionsBar/actionsBarWrapper.js +4 -1
- package/dist/esm/card/ui/actionsBar/cardActions/cardActionButton.js +4 -1
- package/dist/esm/card/ui/actionsBar/cardActions/cardActionsView.js +1 -0
- package/dist/esm/card/ui/actionsBar/cardActions/styles.js +14 -2
- package/dist/esm/card/ui/actionsBar/styles.js +12 -8
- package/dist/esm/card/ui/blanket/blanket.js +2 -0
- package/dist/esm/card/ui/blanket/styles.js +7 -2
- package/dist/esm/card/ui/iconMessage/iconMessageWrapper.js +2 -0
- package/dist/esm/card/ui/iconWrapper/iconWrapper.js +4 -1
- package/dist/esm/card/ui/iconWrapper/styles.js +2 -0
- package/dist/esm/card/ui/openMediaViewerButton/openMediaViewerButton.js +7 -18
- package/dist/esm/card/ui/playButton/playButtonBackground.js +2 -1
- package/dist/esm/card/ui/playButton/playButtonWrapper.js +2 -1
- package/dist/esm/card/ui/playButton/styles.js +6 -0
- package/dist/esm/card/ui/progressBar/styledBar.js +4 -1
- package/dist/esm/card/ui/progressBar/styles.js +2 -0
- package/dist/esm/card/ui/tickBox/tickBoxWrapper.js +13 -3
- package/dist/esm/card/ui/titleBox/styles.js +23 -4
- package/dist/esm/card/ui/titleBox/titleBoxComponents.js +30 -17
- package/dist/esm/card/ui/unhandledErrorCard/index.js +22 -10
- package/dist/esm/card/ui/wrapper/imageContainer.js +1 -0
- package/dist/esm/card/ui/wrapper/styles.js +2 -1
- package/dist/esm/card/ui/wrapper/wrapper.js +4 -1
- package/dist/esm/card/v2/cardV2.js +1 -1
- package/dist/esm/card/v2/cardViewV2.js +1 -0
- package/dist/esm/card/v2/cardviews/cardViewWrapper.js +1 -0
- package/dist/esm/card/v2/cardviews/errorCardView.js +1 -0
- package/dist/esm/card/v2/cardviews/iconCardView.js +1 -0
- package/dist/esm/card/v2/cardviews/imageCardView.js +1 -0
- package/dist/esm/card/v2/cardviews/index.js +1 -0
- package/dist/esm/card/v2/cardviews/loadingCardView.js +1 -0
- package/dist/esm/card/v2/cardviews/processingCardView.js +1 -0
- package/dist/esm/card/v2/cardviews/videoCardView.js +1 -0
- package/dist/esm/card/v2/fileCard.js +1 -1
- package/dist/esm/card/v2/svgView/svgView.js +1 -0
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/inline/mediaInlineAnalyticsErrorBoundary.js +11 -11
- package/dist/esm/utils/lightCards/errorIcon/index.js +10 -6
- package/dist/esm/utils/lightCards/errorIcon/styles.js +3 -0
- package/dist/esm/utils/lightCards/lightCardWrappers.js +9 -5
- package/dist/esm/utils/lightCards/styles.js +9 -2
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/types/card/ui/iconWrapper/styles.d.ts +1 -1
- package/dist/types/card/ui/openMediaViewerButton/openMediaViewerButton.d.ts +0 -1
- package/dist/types/card/ui/titleBox/styles.d.ts +1 -1
- package/dist/types/utils/preventClickThrough.d.ts +1 -1
- package/dist/types/utils/viewportDetector.d.ts +1 -1
- package/dist/types-ts4.5/card/ui/iconWrapper/styles.d.ts +1 -1
- package/dist/types-ts4.5/card/ui/openMediaViewerButton/openMediaViewerButton.d.ts +0 -1
- package/dist/types-ts4.5/card/ui/titleBox/styles.d.ts +1 -1
- package/dist/types-ts4.5/utils/preventClickThrough.d.ts +1 -1
- package/dist/types-ts4.5/utils/viewportDetector.d.ts +1 -1
- package/example-helpers/DelayedRender.tsx +19 -19
- package/example-helpers/cardViewWrapper.tsx +20 -22
- package/example-helpers/cards.tsx +268 -331
- package/example-helpers/developmentUseMessage.tsx +8 -9
- package/example-helpers/index.tsx +100 -124
- package/example-helpers/selectableCard.tsx +32 -35
- package/example-helpers/ssrHelpers.tsx +19 -29
- package/example-helpers/styles.ts +97 -73
- package/example-helpers/svg-helpers/cardContainer.tsx +22 -21
- package/example-helpers/svg-helpers/controls.tsx +11 -11
- package/example-helpers/svg-helpers/dimensionPicker.tsx +85 -93
- package/example-helpers/svg-helpers/svgContainer.tsx +19 -18
- package/example-helpers/svg-helpers/toggle.tsx +28 -29
- package/example-helpers/svg-helpers/uploader.ts +33 -33
- package/package.json +121 -120
- package/report.api.md +227 -232
|
@@ -2,14 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import InlineMessage from '@atlaskit/inline-message';
|
|
3
3
|
|
|
4
4
|
const DevelopmentUseMessage: React.FC = () => (
|
|
5
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
</div>
|
|
5
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
6
|
+
<div style={{ textAlign: 'center' }}>
|
|
7
|
+
<InlineMessage appearance="warning" title="Development use only">
|
|
8
|
+
The purpose of this example is to explore on edge cases for this component's feature. Some
|
|
9
|
+
ways of using the component in here might not be the standard way. It is discouraged to use
|
|
10
|
+
this code as a base for consumers.
|
|
11
|
+
</InlineMessage>
|
|
12
|
+
</div>
|
|
14
13
|
);
|
|
15
14
|
export default DevelopmentUseMessage;
|
|
@@ -3,16 +3,14 @@
|
|
|
3
3
|
import React, { type PropsWithChildren } from 'react';
|
|
4
4
|
import { type FileItem, type Identifier } from '@atlaskit/media-client';
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
createPollingMaxAttemptsError,
|
|
7
|
+
createRateLimitedError,
|
|
8
|
+
createStorybookMediaClientConfig,
|
|
9
|
+
enableMediaUfoLogger,
|
|
10
|
+
FeatureFlagsWrapper,
|
|
11
11
|
} from '@atlaskit/media-test-helpers';
|
|
12
12
|
import CrossIcon from '@atlaskit/icon/glyph/cross';
|
|
13
|
-
import FabricAnalyticsListeners, {
|
|
14
|
-
type AnalyticsWebClient,
|
|
15
|
-
} from '@atlaskit/analytics-listeners';
|
|
13
|
+
import FabricAnalyticsListeners, { type AnalyticsWebClient } from '@atlaskit/analytics-listeners';
|
|
16
14
|
import { payloadPublisher } from '@atlassian/ufo';
|
|
17
15
|
|
|
18
16
|
import AnnotateIcon from '@atlaskit/icon/glyph/media-services/annotate';
|
|
@@ -24,159 +22,137 @@ import DevelopmentUseMessage from './developmentUseMessage';
|
|
|
24
22
|
const mediaClientConfig = createStorybookMediaClientConfig();
|
|
25
23
|
|
|
26
24
|
export const clickHandler = (result: CardEvent) => {
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
result.event.preventDefault();
|
|
26
|
+
console.log('click', result.mediaItemDetails);
|
|
29
27
|
};
|
|
30
28
|
|
|
31
29
|
export const mouseEnterHandler = (result: CardEvent) => {
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
result.event.preventDefault();
|
|
31
|
+
console.log('mouseEnter', result.mediaItemDetails);
|
|
34
32
|
};
|
|
35
33
|
|
|
36
|
-
export const createApiCards = (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
),
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
if (appearance === 'image') {
|
|
67
|
-
return [...apiCards, selectableCard];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return apiCards;
|
|
34
|
+
export const createApiCards = (appearance: CardAppearance, identifier: Identifier) => {
|
|
35
|
+
// API methods
|
|
36
|
+
const apiCards = [
|
|
37
|
+
{
|
|
38
|
+
title: 'not selectable',
|
|
39
|
+
content: (
|
|
40
|
+
<Card
|
|
41
|
+
mediaClientConfig={mediaClientConfig}
|
|
42
|
+
appearance={appearance}
|
|
43
|
+
identifier={identifier}
|
|
44
|
+
onClick={clickHandler}
|
|
45
|
+
onMouseEnter={mouseEnterHandler}
|
|
46
|
+
/>
|
|
47
|
+
),
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
const selectableCard = {
|
|
52
|
+
title: 'selectable',
|
|
53
|
+
content: <SelectableCard mediaClientConfig={mediaClientConfig} identifier={identifier} />,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
if (appearance === 'image') {
|
|
57
|
+
return [...apiCards, selectableCard];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return apiCards;
|
|
71
61
|
};
|
|
72
62
|
|
|
73
63
|
export const openAction = {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
64
|
+
label: 'Open',
|
|
65
|
+
handler: () => {
|
|
66
|
+
console.log('open');
|
|
67
|
+
},
|
|
78
68
|
};
|
|
79
69
|
export const closeAction = {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
70
|
+
label: 'Close',
|
|
71
|
+
handler: () => {
|
|
72
|
+
console.log('close');
|
|
73
|
+
},
|
|
84
74
|
};
|
|
85
75
|
export const deleteAction = {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
76
|
+
label: 'Delete',
|
|
77
|
+
handler: () => {
|
|
78
|
+
console.log('delete');
|
|
79
|
+
},
|
|
80
|
+
icon: <CrossIcon size="small" label="delete" />,
|
|
91
81
|
};
|
|
92
82
|
|
|
93
83
|
export const annotateCardAction: CardAction = {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
84
|
+
label: 'Annotate',
|
|
85
|
+
handler: () => {
|
|
86
|
+
console.log('annotate');
|
|
87
|
+
},
|
|
88
|
+
icon: <AnnotateIcon size="small" label="annotate" />,
|
|
99
89
|
};
|
|
100
90
|
|
|
101
|
-
export const actions = [
|
|
102
|
-
openAction,
|
|
103
|
-
closeAction,
|
|
104
|
-
annotateCardAction,
|
|
105
|
-
deleteAction,
|
|
106
|
-
];
|
|
91
|
+
export const actions = [openAction, closeAction, annotateCardAction, deleteAction];
|
|
107
92
|
|
|
108
93
|
export const anotherAction: CardAction = {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
94
|
+
label: 'Some other action',
|
|
95
|
+
handler: (item?: FileItem) => {
|
|
96
|
+
console.log('Some other action', item);
|
|
97
|
+
},
|
|
113
98
|
};
|
|
114
99
|
|
|
115
100
|
export const annotateAction: CardAction = {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
101
|
+
label: 'Annotate',
|
|
102
|
+
handler: (item?: FileItem) => {
|
|
103
|
+
console.log('annotate', item);
|
|
104
|
+
},
|
|
120
105
|
};
|
|
121
106
|
|
|
122
107
|
export const cardsActions = [anotherAction, annotateAction];
|
|
123
108
|
export const wrongMediaClientConfig = createStorybookMediaClientConfig({
|
|
124
|
-
|
|
109
|
+
authType: 'client',
|
|
125
110
|
});
|
|
126
111
|
export const wrongCollection = 'adfasdf';
|
|
127
112
|
|
|
128
113
|
export type MainWrapperProps = PropsWithChildren<{
|
|
129
|
-
|
|
130
|
-
|
|
114
|
+
developmentOnly?: boolean;
|
|
115
|
+
disableFeatureFlagWrapper?: boolean;
|
|
131
116
|
}>;
|
|
132
117
|
|
|
133
118
|
export const MainWrapper = ({
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
119
|
+
children,
|
|
120
|
+
developmentOnly,
|
|
121
|
+
disableFeatureFlagWrapper = false,
|
|
137
122
|
}: MainWrapperProps) => {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
123
|
+
enableMediaUfoLogger(payloadPublisher);
|
|
124
|
+
return (
|
|
125
|
+
<>
|
|
126
|
+
{developmentOnly && <DevelopmentUseMessage />}
|
|
127
|
+
{!disableFeatureFlagWrapper ? (
|
|
128
|
+
<FeatureFlagsWrapper>{children}</FeatureFlagsWrapper>
|
|
129
|
+
) : (
|
|
130
|
+
<>{children}</>
|
|
131
|
+
)}
|
|
132
|
+
</>
|
|
133
|
+
);
|
|
149
134
|
};
|
|
150
135
|
|
|
151
|
-
export const mediaCardErrorState = (
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
case 'uploadError':
|
|
163
|
-
return new MediaCardError('upload');
|
|
164
|
-
default:
|
|
165
|
-
return undefined;
|
|
166
|
-
}
|
|
136
|
+
export const mediaCardErrorState = (error?: string): MediaCardError | undefined => {
|
|
137
|
+
switch (error) {
|
|
138
|
+
case 'rateLimitedError':
|
|
139
|
+
return new MediaCardError('error-file-state', createRateLimitedError());
|
|
140
|
+
case 'pollingMaxAttemptsError':
|
|
141
|
+
return new MediaCardError('error-file-state', createPollingMaxAttemptsError());
|
|
142
|
+
case 'uploadError':
|
|
143
|
+
return new MediaCardError('upload');
|
|
144
|
+
default:
|
|
145
|
+
return undefined;
|
|
146
|
+
}
|
|
167
147
|
};
|
|
168
148
|
|
|
169
149
|
export const SSRAnalyticsWrapper = ({ children }: PropsWithChildren<{}>) => {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
<FabricAnalyticsListeners client={mockClient}>
|
|
179
|
-
{children}
|
|
180
|
-
</FabricAnalyticsListeners>
|
|
181
|
-
);
|
|
150
|
+
const mockClient: AnalyticsWebClient = {
|
|
151
|
+
sendUIEvent: (e) => console.debug('UI event', e),
|
|
152
|
+
sendOperationalEvent: (e) => console.debug('Operational event', e),
|
|
153
|
+
sendTrackEvent: (e) => console.debug('Track event', e),
|
|
154
|
+
sendScreenEvent: (e) => console.debug('Screen event', e),
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
return <FabricAnalyticsListeners client={mockClient}>{children}</FabricAnalyticsListeners>;
|
|
182
158
|
};
|
|
@@ -5,45 +5,42 @@ import { type Identifier } from '@atlaskit/media-client';
|
|
|
5
5
|
import { Card } from '../src';
|
|
6
6
|
|
|
7
7
|
export interface SelectableCardProps {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
mediaClientConfig: MediaClientConfig;
|
|
9
|
+
identifier: Identifier;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export class SelectableCard extends Component<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
super(props);
|
|
18
|
-
this.state = { selected: false };
|
|
19
|
-
}
|
|
12
|
+
export class SelectableCard extends Component<SelectableCardProps, { selected: boolean }> {
|
|
13
|
+
constructor(props: SelectableCardProps) {
|
|
14
|
+
super(props);
|
|
15
|
+
this.state = { selected: false };
|
|
16
|
+
}
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
render() {
|
|
19
|
+
const { mediaClientConfig, identifier } = this.props;
|
|
20
|
+
const { selected } = this.state;
|
|
24
21
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
if (!mediaClientConfig) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
28
25
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
return (
|
|
27
|
+
<Card
|
|
28
|
+
mediaClientConfig={mediaClientConfig}
|
|
29
|
+
identifier={identifier}
|
|
30
|
+
appearance="image"
|
|
31
|
+
selectable={true}
|
|
32
|
+
selected={selected}
|
|
33
|
+
onClick={this.onClick}
|
|
34
|
+
actions={[{ label: 'add', handler: () => {} }]}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
41
38
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
private onClick = (): void => {
|
|
40
|
+
this.setState((prevState) => {
|
|
41
|
+
return {
|
|
42
|
+
selected: !prevState.selected,
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
};
|
|
49
46
|
}
|
|
@@ -4,40 +4,30 @@ import ReactDOMServer from 'react-dom/server';
|
|
|
4
4
|
import { SSRAnalyticsWrapper } from '.';
|
|
5
5
|
|
|
6
6
|
export interface SimulateSsrParams
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
> {
|
|
11
|
-
serverPage: React.ReactNode;
|
|
12
|
-
hydratePage?: React.ReactNode;
|
|
7
|
+
extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
|
|
8
|
+
serverPage: React.ReactNode;
|
|
9
|
+
hydratePage?: React.ReactNode;
|
|
13
10
|
}
|
|
14
11
|
|
|
15
12
|
const randomStr = () => Math.random().toString(36).substr(2, 9);
|
|
16
13
|
const generateSsrPageId = () => `media-ssr-page-${randomStr()}-${randomStr()}`;
|
|
17
14
|
|
|
18
|
-
export const SimulateSsr = ({
|
|
19
|
-
|
|
20
|
-
hydratePage,
|
|
21
|
-
...divProps
|
|
22
|
-
}: SimulateSsrParams) => {
|
|
23
|
-
const id = useMemo(generateSsrPageId, []);
|
|
15
|
+
export const SimulateSsr = ({ serverPage, hydratePage, ...divProps }: SimulateSsrParams) => {
|
|
16
|
+
const id = useMemo(generateSsrPageId, []);
|
|
24
17
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}, [id, hydratePage, serverPage]);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const txt = ReactDOMServer.renderToString(
|
|
20
|
+
<SSRAnalyticsWrapper>{serverPage}</SSRAnalyticsWrapper>,
|
|
21
|
+
);
|
|
22
|
+
const elem = document.querySelector(`#${id}`);
|
|
23
|
+
if (elem) {
|
|
24
|
+
elem.innerHTML = txt;
|
|
25
|
+
if (hydratePage) {
|
|
26
|
+
ReactDOM.hydrate(<SSRAnalyticsWrapper>{hydratePage}</SSRAnalyticsWrapper>, elem);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}, [id, hydratePage, serverPage]);
|
|
40
30
|
|
|
41
|
-
|
|
42
|
-
|
|
31
|
+
// eslint-disable-next-line @atlaskit/design-system/prefer-primitives
|
|
32
|
+
return <div id={id} {...divProps}></div>;
|
|
43
33
|
};
|
|
@@ -1,122 +1,146 @@
|
|
|
1
1
|
import { token } from '@atlaskit/tokens';
|
|
2
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
2
3
|
import { css } from '@emotion/react';
|
|
3
4
|
|
|
5
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
4
6
|
export const editableCardOptionsStyles = css({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
padding: token('space.250', '20px'),
|
|
8
|
+
borderBottom: `1px solid ${token('color.border', '#ccc')}`,
|
|
9
|
+
maxWidth: '700px',
|
|
8
10
|
});
|
|
9
11
|
|
|
12
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
10
13
|
export const sliderWrapperStyles = css({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
display: 'flex',
|
|
15
|
+
width: '50%',
|
|
16
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
17
|
+
'> *': {
|
|
18
|
+
flex: 1,
|
|
19
|
+
margin: token('space.100', '8px'),
|
|
20
|
+
},
|
|
17
21
|
});
|
|
18
22
|
|
|
23
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
19
24
|
export const editableCardContentStyles = css({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
padding: token('space.250', '20px'),
|
|
26
|
+
border: '2px dashed',
|
|
27
|
+
margin: `${token('space.0', '0px')} ${token('space.150', '12px')} ${token(
|
|
28
|
+
'space.600',
|
|
29
|
+
'48px',
|
|
30
|
+
)} ${token('space.150', '12px')}`,
|
|
31
|
+
overflow: 'hidden',
|
|
32
|
+
background: token('color.background.accent.orange.subtlest', 'antiquewhite'),
|
|
33
|
+
boxSizing: 'border-box',
|
|
29
34
|
});
|
|
30
35
|
|
|
36
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
31
37
|
export const optionsWrapperStyles = css({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
display: 'flex',
|
|
39
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
40
|
+
'> *': {
|
|
41
|
+
flex: 1,
|
|
42
|
+
margin: token('space.100', '8px'),
|
|
43
|
+
},
|
|
37
44
|
});
|
|
38
45
|
|
|
46
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
39
47
|
export const cardDimensionsWrapperStyles = css({
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
margin: `${token('space.100', '8px')} ${token('space.100', '8px')} ${token(
|
|
49
|
+
'space.250',
|
|
50
|
+
'20px',
|
|
51
|
+
)} ${token('space.100', '8px')}`,
|
|
52
|
+
display: 'flex',
|
|
53
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
54
|
+
'> div': {
|
|
55
|
+
border: `1px solid ${token('color.border.bold', 'black')}`,
|
|
56
|
+
margin: token('space.075', '6px'),
|
|
57
|
+
padding: token('space.075', '6px'),
|
|
58
|
+
borderRadius: '3px',
|
|
59
|
+
},
|
|
51
60
|
});
|
|
52
61
|
|
|
62
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
53
63
|
export const flexWrapperStyles = css({
|
|
54
|
-
|
|
64
|
+
display: 'flex',
|
|
55
65
|
});
|
|
66
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
56
67
|
export const cardPreviewWrapperStyles = css({
|
|
57
|
-
|
|
68
|
+
flex: 1,
|
|
58
69
|
});
|
|
59
70
|
|
|
71
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
60
72
|
export const cardWrapperStyles = css({
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
73
|
+
border: `1px solid ${token('color.border.bold', 'black')}`,
|
|
74
|
+
padding: token('space.150', '12px'),
|
|
75
|
+
margin: token('space.075', '6px'),
|
|
76
|
+
flexDirection: 'column',
|
|
77
|
+
width: '310px',
|
|
78
|
+
height: '280px',
|
|
79
|
+
overflow: 'auto',
|
|
80
|
+
display: 'inline-block',
|
|
69
81
|
});
|
|
70
82
|
|
|
83
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
71
84
|
export const cardFlowHeaderStyles = css({
|
|
72
|
-
|
|
73
|
-
|
|
85
|
+
margin: `${token('space.250', '20px')} auto`,
|
|
86
|
+
padding: `${token('space.150', '12px')} ${token('space.0', '0px')}`,
|
|
74
87
|
});
|
|
75
88
|
|
|
89
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
76
90
|
export const externalIdentifierWrapperStyles = css({
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
91
|
+
display: 'flex',
|
|
92
|
+
justifyContent: 'space-around',
|
|
93
|
+
margin: `${token('space.0', '0px')} auto`,
|
|
94
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
95
|
+
h2: {
|
|
96
|
+
marginBottom: token('space.150', '12px'),
|
|
97
|
+
},
|
|
83
98
|
});
|
|
84
99
|
|
|
100
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
85
101
|
export const unhandledErrorCardWrapperStyles = css({
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
102
|
+
padding: token('space.250', '20px'),
|
|
103
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
104
|
+
'> div:first-child': {
|
|
105
|
+
display: 'flex',
|
|
106
|
+
marginBottom: token('space.250', '20px'),
|
|
107
|
+
},
|
|
108
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
109
|
+
label: {
|
|
110
|
+
marginRight: token('space.250', '20px'),
|
|
111
|
+
},
|
|
94
112
|
});
|
|
95
113
|
|
|
114
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
96
115
|
export const inlineCardVideoWrapperItemStyles = css({
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
116
|
+
padding: token('space.150', '12px'),
|
|
117
|
+
border: `1px solid ${token('color.border.bold', 'black')}`,
|
|
118
|
+
margin: token('space.150', '12px'),
|
|
100
119
|
});
|
|
101
120
|
|
|
121
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
102
122
|
export const mediaViewerExampleColumnStyles = css({
|
|
103
|
-
|
|
123
|
+
flex: 1,
|
|
104
124
|
});
|
|
105
125
|
|
|
126
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
106
127
|
export const mediaViewerExampleWrapperStyles = css({
|
|
107
|
-
|
|
128
|
+
display: 'flex',
|
|
108
129
|
});
|
|
109
130
|
|
|
131
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
110
132
|
export const mediaInlineWrapperStyles = css({
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
133
|
+
display: 'flex',
|
|
134
|
+
alignItems: 'center',
|
|
135
|
+
flexDirection: 'column',
|
|
136
|
+
margin: token('space.1000', '80px'),
|
|
115
137
|
});
|
|
116
138
|
|
|
139
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
117
140
|
export const mediaInlineTableStyles = css({
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
141
|
+
width: '800px',
|
|
142
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
143
|
+
'tr, td': {
|
|
144
|
+
border: `1px solid ${token('color.border', '#ddd')}`,
|
|
145
|
+
},
|
|
122
146
|
});
|