@atlaskit/editor-plugin-card 7.0.10 → 7.2.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 +30 -0
- package/dist/cjs/nodeviews/genericCard.js +2 -19
- package/dist/cjs/nodeviews/inlineCard.js +1 -45
- package/dist/cjs/nodeviews/inlineCardWithAwareness.js +34 -18
- package/dist/cjs/pm-plugins/main.js +4 -24
- package/dist/cjs/ui/{OpenButtonOverlay → HoverLinkOverlay}/index.js +26 -14
- package/dist/es2019/nodeviews/genericCard.js +2 -19
- package/dist/es2019/nodeviews/inlineCard.js +2 -42
- package/dist/es2019/nodeviews/inlineCardWithAwareness.js +34 -18
- package/dist/es2019/pm-plugins/main.js +1 -23
- package/dist/es2019/ui/{OpenButtonOverlay → HoverLinkOverlay}/index.js +25 -14
- package/dist/esm/nodeviews/genericCard.js +2 -19
- package/dist/esm/nodeviews/inlineCard.js +2 -46
- package/dist/esm/nodeviews/inlineCardWithAwareness.js +34 -18
- package/dist/esm/pm-plugins/main.js +3 -23
- package/dist/esm/ui/{OpenButtonOverlay → HoverLinkOverlay}/index.js +26 -14
- package/dist/types/index.d.ts +1 -1
- package/dist/types/nodeviews/inlineCard.d.ts +1 -1
- package/dist/types/pm-plugins/main.d.ts +0 -2
- package/dist/types/ui/HoverLinkOverlay/index.d.ts +9 -0
- package/dist/types/ui/{OpenButtonOverlay → HoverLinkOverlay}/types.d.ts +3 -1
- package/dist/types/ui/datasourceErrorBoundary.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/inlineCard.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +0 -2
- package/dist/types-ts4.5/ui/HoverLinkOverlay/index.d.ts +9 -0
- package/dist/types-ts4.5/ui/{OpenButtonOverlay → HoverLinkOverlay}/types.d.ts +3 -1
- package/dist/types-ts4.5/ui/datasourceErrorBoundary.d.ts +1 -1
- package/package.json +9 -12
- package/dist/cjs/ui/PanelButtonOverlay/index.js +0 -171
- package/dist/cjs/ui/PanelButtonOverlay/types.js +0 -5
- package/dist/es2019/ui/PanelButtonOverlay/index.js +0 -148
- package/dist/esm/ui/OpenButtonOverlay/types.js +0 -1
- package/dist/esm/ui/PanelButtonOverlay/index.js +0 -158
- package/dist/esm/ui/PanelButtonOverlay/types.js +0 -1
- package/dist/types/ui/OpenButtonOverlay/index.d.ts +0 -9
- package/dist/types/ui/PanelButtonOverlay/index.d.ts +0 -9
- package/dist/types/ui/PanelButtonOverlay/types.d.ts +0 -7
- package/dist/types-ts4.5/ui/OpenButtonOverlay/index.d.ts +0 -9
- package/dist/types-ts4.5/ui/PanelButtonOverlay/index.d.ts +0 -9
- package/dist/types-ts4.5/ui/PanelButtonOverlay/types.d.ts +0 -7
- /package/dist/cjs/ui/{OpenButtonOverlay → HoverLinkOverlay}/types.js +0 -0
- /package/dist/es2019/ui/{OpenButtonOverlay → HoverLinkOverlay}/types.js +0 -0
- /package/dist/{es2019/ui/PanelButtonOverlay → esm/ui/HoverLinkOverlay}/types.js +0 -0
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
/* eslint-disable @atlaskit/design-system/no-nested-styles */
|
|
3
|
-
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
4
|
-
/**
|
|
5
|
-
* @jsxRuntime classic
|
|
6
|
-
* @jsx jsx
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import React, { useLayoutEffect, useRef, useState } from 'react';
|
|
10
|
-
import { css, jsx } from '@emotion/react'; // eslint-disable-line @atlaskit/ui-styling-standard/use-compiled
|
|
11
|
-
import { useIntl } from 'react-intl-next';
|
|
12
|
-
import { cardMessages } from '@atlaskit/editor-common/messages';
|
|
13
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
14
|
-
import PanelRightIcon from '@atlaskit/icon/core/panel-right';
|
|
15
|
-
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
16
|
-
import { Box, Pressable, Text, xcss } from '@atlaskit/primitives';
|
|
17
|
-
var containerStyles = css({
|
|
18
|
-
position: 'relative'
|
|
19
|
-
});
|
|
20
|
-
var iconWrapperStyles = xcss({
|
|
21
|
-
display: 'inline-flex',
|
|
22
|
-
justifyContent: 'center',
|
|
23
|
-
alignItems: 'center',
|
|
24
|
-
height: '17px',
|
|
25
|
-
width: '17px'
|
|
26
|
-
});
|
|
27
|
-
var hiddenTextStyle = css({
|
|
28
|
-
overflow: 'hidden',
|
|
29
|
-
whiteSpace: 'nowrap',
|
|
30
|
-
position: 'absolute',
|
|
31
|
-
visibility: 'hidden'
|
|
32
|
-
});
|
|
33
|
-
var iconAndLabelWrapperStyles = xcss({
|
|
34
|
-
position: 'absolute',
|
|
35
|
-
left: 'space.025',
|
|
36
|
-
top: '-1px',
|
|
37
|
-
cursor: 'pointer',
|
|
38
|
-
display: 'inline-flex',
|
|
39
|
-
alignItems: 'center',
|
|
40
|
-
verticalAlign: 'middle',
|
|
41
|
-
paddingInline: 'space.050',
|
|
42
|
-
gap: 'space.025',
|
|
43
|
-
overflow: 'hidden',
|
|
44
|
-
zIndex: 'card',
|
|
45
|
-
backgroundColor: 'color.background.accent.gray.subtlest',
|
|
46
|
-
borderRadius: "var(--ds-border-radius, 3px)",
|
|
47
|
-
color: 'color.text.subtle',
|
|
48
|
-
textDecoration: 'none',
|
|
49
|
-
whiteSpace: 'nowrap',
|
|
50
|
-
':hover': {
|
|
51
|
-
backgroundColor: 'elevation.surface.hovered',
|
|
52
|
-
color: 'color.text.subtle',
|
|
53
|
-
textDecoration: 'none'
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
var MIN_AVAILABLE_SPACE_WITH_LABEL_OVERLAY = 45;
|
|
57
|
-
var ICON_WIDTH = 16;
|
|
58
|
-
var DEFAULT_PANEL_TEXT_WIDTH = 28; // Default panel text width in English
|
|
59
|
-
|
|
60
|
-
var PanelButtonOverlay = function PanelButtonOverlay(_ref) {
|
|
61
|
-
var children = _ref.children,
|
|
62
|
-
_ref$isVisible = _ref.isVisible,
|
|
63
|
-
isVisible = _ref$isVisible === void 0 ? false : _ref$isVisible,
|
|
64
|
-
editorAppearance = _ref.editorAppearance,
|
|
65
|
-
onClick = _ref.onClick;
|
|
66
|
-
var _useIntl = useIntl(),
|
|
67
|
-
formatMessage = _useIntl.formatMessage;
|
|
68
|
-
var label = formatMessage(cardMessages.panelButtonTitle);
|
|
69
|
-
var containerRef = useRef(null);
|
|
70
|
-
var panelButtonRef = useRef(null);
|
|
71
|
-
var hiddenTextRef = useRef(null);
|
|
72
|
-
var _useState = useState(true),
|
|
73
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
74
|
-
showLabel = _useState2[0],
|
|
75
|
-
setShowLabel = _useState2[1];
|
|
76
|
-
var _useState3 = useState(false),
|
|
77
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
78
|
-
isHovered = _useState4[0],
|
|
79
|
-
setHovered = _useState4[1];
|
|
80
|
-
var panelTextWidthRef = useRef(null);
|
|
81
|
-
useLayoutEffect(function () {
|
|
82
|
-
var _containerRef$current, _panelButtonRef$curre;
|
|
83
|
-
if (!isVisible || !isHovered) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
var cardWidth = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.offsetWidth;
|
|
87
|
-
var panelButtonWidth = (_panelButtonRef$curre = panelButtonRef.current) === null || _panelButtonRef$curre === void 0 ? void 0 : _panelButtonRef$curre.offsetWidth;
|
|
88
|
-
|
|
89
|
-
// Get the hidden text width
|
|
90
|
-
if (!panelTextWidthRef.current) {
|
|
91
|
-
var hiddenText = hiddenTextRef.current;
|
|
92
|
-
if (hiddenText) {
|
|
93
|
-
// Measure the width of the hidden text
|
|
94
|
-
// Temporarily make the element visible to measure its width
|
|
95
|
-
hiddenText.style.visibility = 'hidden';
|
|
96
|
-
hiddenText.style.display = 'inline';
|
|
97
|
-
panelTextWidthRef.current = hiddenText.offsetWidth;
|
|
98
|
-
|
|
99
|
-
// Reset the hiddenText's display property
|
|
100
|
-
hiddenText.style.display = 'none';
|
|
101
|
-
hiddenText.style.visibility = 'inherit';
|
|
102
|
-
} else {
|
|
103
|
-
panelTextWidthRef.current = DEFAULT_PANEL_TEXT_WIDTH;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
if (!cardWidth || !panelButtonWidth) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
var panelTextWidth = panelTextWidthRef.current || DEFAULT_PANEL_TEXT_WIDTH;
|
|
110
|
-
var canShowLabel = cardWidth - panelTextWidth > MIN_AVAILABLE_SPACE_WITH_LABEL_OVERLAY + ICON_WIDTH;
|
|
111
|
-
setShowLabel(canShowLabel);
|
|
112
|
-
}, [isVisible, isHovered]);
|
|
113
|
-
var handleOverlayChange = function handleOverlayChange(isHovered) {
|
|
114
|
-
setHovered(isHovered);
|
|
115
|
-
};
|
|
116
|
-
var handleClick = function handleClick() {
|
|
117
|
-
if (onClick) {
|
|
118
|
-
onClick();
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
return (
|
|
122
|
-
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
123
|
-
jsx("span", {
|
|
124
|
-
ref: containerRef,
|
|
125
|
-
css: containerStyles,
|
|
126
|
-
onMouseEnter: function onMouseEnter() {
|
|
127
|
-
return handleOverlayChange(true);
|
|
128
|
-
},
|
|
129
|
-
onMouseLeave: function onMouseLeave() {
|
|
130
|
-
return handleOverlayChange(false);
|
|
131
|
-
}
|
|
132
|
-
}, children, jsx("span", {
|
|
133
|
-
css: hiddenTextStyle,
|
|
134
|
-
"aria-hidden": "true"
|
|
135
|
-
}, jsx(Text, {
|
|
136
|
-
ref: hiddenTextRef,
|
|
137
|
-
size: "small",
|
|
138
|
-
maxLines: 1
|
|
139
|
-
}, label)), isHovered && jsx(Pressable, {
|
|
140
|
-
ref: panelButtonRef,
|
|
141
|
-
xcss: iconAndLabelWrapperStyles,
|
|
142
|
-
style: {
|
|
143
|
-
paddingBlock: editorAppearance === 'comment' || editorAppearance === 'chromeless' ? '1px' : "var(--ds-space-025, 2px)"
|
|
144
|
-
},
|
|
145
|
-
onClick: handleClick
|
|
146
|
-
}, jsx(Box, {
|
|
147
|
-
xcss: iconWrapperStyles,
|
|
148
|
-
"data-inlinecard-button-overlay": "icon-wrapper-line-height"
|
|
149
|
-
}, jsx(PanelRightIcon, {
|
|
150
|
-
label: ""
|
|
151
|
-
})), showLabel && jsx(Text, {
|
|
152
|
-
size: "small",
|
|
153
|
-
color: "color.text.subtle",
|
|
154
|
-
maxLines: 1
|
|
155
|
-
}, label)))
|
|
156
|
-
);
|
|
157
|
-
};
|
|
158
|
-
export default PanelButtonOverlay;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { jsx } from '@emotion/react';
|
|
7
|
-
import type { OpenButtonOverlayProps } from './types';
|
|
8
|
-
declare const OpenButtonOverlay: ({ children, isVisible, url, editorAppearance, editorAnalyticsApi, view, }: React.PropsWithChildren<OpenButtonOverlayProps>) => jsx.JSX.Element;
|
|
9
|
-
export default OpenButtonOverlay;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { jsx } from '@emotion/react';
|
|
7
|
-
import type { PanelButtonOverlayProps } from '../PanelButtonOverlay/types';
|
|
8
|
-
declare const PanelButtonOverlay: ({ children, isVisible, editorAppearance, onClick, }: React.PropsWithChildren<PanelButtonOverlayProps>) => jsx.JSX.Element;
|
|
9
|
-
export default PanelButtonOverlay;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { EditorAppearance } from '@atlaskit/editor-common/types';
|
|
3
|
-
export type PanelButtonOverlayProps = React.HTMLAttributes<HTMLSpanElement> & {
|
|
4
|
-
isVisible?: boolean;
|
|
5
|
-
editorAppearance?: EditorAppearance;
|
|
6
|
-
onClick?: () => void;
|
|
7
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { jsx } from '@emotion/react';
|
|
7
|
-
import type { OpenButtonOverlayProps } from './types';
|
|
8
|
-
declare const OpenButtonOverlay: ({ children, isVisible, url, editorAppearance, editorAnalyticsApi, view, }: React.PropsWithChildren<OpenButtonOverlayProps>) => jsx.JSX.Element;
|
|
9
|
-
export default OpenButtonOverlay;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { jsx } from '@emotion/react';
|
|
7
|
-
import type { PanelButtonOverlayProps } from '../PanelButtonOverlay/types';
|
|
8
|
-
declare const PanelButtonOverlay: ({ children, isVisible, editorAppearance, onClick, }: React.PropsWithChildren<PanelButtonOverlayProps>) => jsx.JSX.Element;
|
|
9
|
-
export default PanelButtonOverlay;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { EditorAppearance } from '@atlaskit/editor-common/types';
|
|
3
|
-
export type PanelButtonOverlayProps = React.HTMLAttributes<HTMLSpanElement> & {
|
|
4
|
-
isVisible?: boolean;
|
|
5
|
-
editorAppearance?: EditorAppearance;
|
|
6
|
-
onClick?: () => void;
|
|
7
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|