@pareto-engineering/design-system 4.0.0-alpha.79 → 4.0.0-alpha.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/a/Label/styles.scss +1 -1
- package/dist/cjs/a/Tooltip/Tooltip.js +21 -5
- package/dist/cjs/a/Tooltip/styles.scss +44 -39
- package/dist/cjs/f/fields/EditorInput/common/ColorPicker/ColorPicker.js +8 -4
- package/dist/cjs/f/fields/EditorInput/common/ToolbarPlugin/ToolbarPlugin.js +0 -6
- package/dist/cjs/g/ExpandableLexicalPreview/ExpandableLexicalPreview.js +44 -17
- package/dist/cjs/g/ExpandableLexicalPreview/common/NewWindowPortal/NewWindowPortal.js +79 -0
- package/dist/cjs/g/ExpandableLexicalPreview/common/NewWindowPortal/index.js +13 -0
- package/dist/cjs/g/ExpandableLexicalPreview/common/NewWindowPortal/styles.scss +9 -0
- package/dist/cjs/g/ExpandableLexicalPreview/common/index.js +3 -3
- package/dist/es/a/Label/styles.scss +1 -1
- package/dist/es/a/Tooltip/Tooltip.js +21 -5
- package/dist/es/a/Tooltip/styles.scss +44 -39
- package/dist/es/f/fields/EditorInput/common/ColorPicker/ColorPicker.js +8 -4
- package/dist/es/f/fields/EditorInput/common/ToolbarPlugin/ToolbarPlugin.js +0 -6
- package/dist/es/g/ExpandableLexicalPreview/ExpandableLexicalPreview.js +45 -18
- package/dist/es/g/ExpandableLexicalPreview/common/NewWindowPortal/NewWindowPortal.js +70 -0
- package/dist/es/g/ExpandableLexicalPreview/common/NewWindowPortal/index.js +2 -0
- package/dist/es/g/ExpandableLexicalPreview/common/NewWindowPortal/styles.scss +9 -0
- package/dist/es/g/ExpandableLexicalPreview/common/index.js +1 -1
- package/package.json +4 -4
- package/src/stories/a/Tooltip.stories.jsx +7 -12
- package/src/stories/g/ExpandableLexicalPreview.stories.jsx +12 -5
- package/src/ui/a/Label/styles.scss +1 -1
- package/src/ui/a/Tooltip/Tooltip.jsx +27 -4
- package/src/ui/a/Tooltip/styles.scss +44 -39
- package/src/ui/f/fields/EditorInput/common/ColorPicker/ColorPicker.jsx +8 -3
- package/src/ui/f/fields/EditorInput/common/ToolbarPlugin/ToolbarPlugin.jsx +0 -14
- package/src/ui/g/ExpandableLexicalPreview/ExpandableLexicalPreview.jsx +61 -25
- package/src/ui/g/ExpandableLexicalPreview/common/NewWindowPortal/NewWindowPortal.jsx +80 -0
- package/src/ui/g/ExpandableLexicalPreview/common/NewWindowPortal/index.js +2 -0
- package/src/ui/g/ExpandableLexicalPreview/common/NewWindowPortal/styles.scss +9 -0
- package/src/ui/g/ExpandableLexicalPreview/common/index.js +1 -1
- package/tests/__snapshots__/Storyshots.test.js.snap +58 -49
- package/dist/cjs/g/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.js +0 -111
- package/dist/cjs/g/ExpandableLexicalPreview/common/ExpandButton/index.js +0 -13
- package/dist/es/g/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.js +0 -99
- package/dist/es/g/ExpandableLexicalPreview/common/ExpandButton/index.js +0 -1
- package/src/ui/g/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.jsx +0 -119
- package/src/ui/g/ExpandableLexicalPreview/common/ExpandButton/index.js +0 -1
|
@@ -20,9 +20,9 @@ $default-font-size: calc(1em * var(--s-1));
|
|
|
20
20
|
color: var(--on-x, var(--on-#{$default-color}));
|
|
21
21
|
display: inline-flex;
|
|
22
22
|
font-size: $default-font-size;
|
|
23
|
+
gap: calc(var(--gap) / 2);
|
|
23
24
|
padding: $default-padding;
|
|
24
25
|
white-space: nowrap;
|
|
25
|
-
|
|
26
26
|
&.#{bem.$modifier-compact} {
|
|
27
27
|
padding: $compact-padding;
|
|
28
28
|
}
|
|
@@ -28,15 +28,23 @@ const Tooltip = _ref => {
|
|
|
28
28
|
style,
|
|
29
29
|
position,
|
|
30
30
|
color,
|
|
31
|
+
description,
|
|
32
|
+
content,
|
|
31
33
|
children
|
|
32
34
|
// ...otherProps
|
|
33
35
|
} = _ref;
|
|
34
36
|
return /*#__PURE__*/React.createElement("div", {
|
|
35
37
|
id: id,
|
|
36
|
-
className: [baseClassName, componentClassName, userClassName,
|
|
37
|
-
style: style
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
className: [baseClassName, componentClassName, userClassName, `x-${color}`].filter(e => e).join(' '),
|
|
39
|
+
style: style
|
|
40
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
41
|
+
className: "tooltip-trigger-wrapper",
|
|
42
|
+
"aria-describedby": description
|
|
43
|
+
}, children), /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
className: `tooltip-content ${position}`,
|
|
45
|
+
role: "tooltip",
|
|
46
|
+
id: description
|
|
47
|
+
}, content));
|
|
40
48
|
};
|
|
41
49
|
Tooltip.propTypes = {
|
|
42
50
|
/**
|
|
@@ -52,9 +60,17 @@ Tooltip.propTypes = {
|
|
|
52
60
|
*/
|
|
53
61
|
style: _propTypes.default.objectOf(_propTypes.default.string),
|
|
54
62
|
/**
|
|
55
|
-
* The children JSX
|
|
63
|
+
* The children JSX where the tooltip will be applied
|
|
56
64
|
*/
|
|
57
65
|
children: _propTypes.default.node.isRequired,
|
|
66
|
+
/**
|
|
67
|
+
* The content JSX that renders the tooltip content
|
|
68
|
+
*/
|
|
69
|
+
content: _propTypes.default.node.isRequired,
|
|
70
|
+
/**
|
|
71
|
+
* The text description to identify the element that describes the tooltip
|
|
72
|
+
*/
|
|
73
|
+
description: _propTypes.default.string.isRequired,
|
|
58
74
|
/**
|
|
59
75
|
* The position of the tooltip with respect to the trigger element
|
|
60
76
|
*/
|
|
@@ -7,50 +7,55 @@ $default-inline-padding: var(--theme-default-padding);
|
|
|
7
7
|
$default-width: var(--tooltip-width, 20rem);
|
|
8
8
|
|
|
9
9
|
.#{bem.$base}.tooltip {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
10
|
+
display: inline-block;
|
|
11
|
+
position: relative;
|
|
12
|
+
|
|
13
|
+
> .tooltip-content {
|
|
14
|
+
background: var(--x);
|
|
15
|
+
border: var(--theme-default-border-style) var(--ui-lines);
|
|
16
|
+
border-radius: calc(var(--theme-default-border-radius) / 2);
|
|
17
|
+
opacity: 0;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
padding: $default-block-padding $default-inline-padding;
|
|
20
|
+
position: absolute;
|
|
21
|
+
transform: translateX(var(--horizontal, 0)) translateY(var(--vertical, 0));
|
|
22
|
+
transition: opacity .2s ease, transform .2s ease;
|
|
23
|
+
visibility: hidden;
|
|
24
|
+
width: $default-width;
|
|
25
|
+
z-index: 10;
|
|
26
|
+
|
|
27
|
+
&.top {
|
|
28
|
+
--horizontal: -50%;
|
|
29
|
+
bottom: calc(100% + $default-block-padding);
|
|
30
|
+
left: 50%;
|
|
30
31
|
}
|
|
31
|
-
}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
&.right {
|
|
34
|
+
--vertical: 50%;
|
|
35
|
+
bottom: 50%;
|
|
36
|
+
left: calc(100% + $default-inline-padding);
|
|
37
|
+
}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
&.bottom {
|
|
40
|
+
--horizontal: -50%;
|
|
41
|
+
left: 50%;
|
|
42
|
+
top: calc(100% + $default-block-padding);
|
|
43
|
+
}
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
&.left {
|
|
46
|
+
--vertical: 50%;
|
|
47
|
+
bottom: 50%;
|
|
48
|
+
right: calc(100% + $default-inline-padding);
|
|
49
|
+
}
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
> .tooltip-trigger-wrapper {
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
|
|
55
|
+
&:is(:hover, :focus-visible, :active) + .tooltip-content {
|
|
56
|
+
opacity: 1;
|
|
57
|
+
transition-delay: 200ms;
|
|
58
|
+
visibility: visible;
|
|
59
|
+
}
|
|
55
60
|
}
|
|
56
61
|
}
|
|
@@ -31,11 +31,11 @@ const ColorPicker = _ref => {
|
|
|
31
31
|
className: userClassName,
|
|
32
32
|
style,
|
|
33
33
|
icon,
|
|
34
|
-
|
|
34
|
+
defaultColorHex,
|
|
35
35
|
onChange
|
|
36
36
|
// ...otherProps
|
|
37
37
|
} = _ref;
|
|
38
|
-
const [colorValue, setColor] = (0, _reactColorPalette.useColor)(
|
|
38
|
+
const [colorValue, setColor] = (0, _reactColorPalette.useColor)(defaultColorHex);
|
|
39
39
|
const parentRef = (0, _react.useRef)(null);
|
|
40
40
|
const [isOpen, setIsOpen] = (0, _react.useState)(false);
|
|
41
41
|
(0, _utils.useOutsideClick)(parentRef, () => setIsOpen(false));
|
|
@@ -86,9 +86,13 @@ ColorPicker.propTypes = {
|
|
|
86
86
|
/**
|
|
87
87
|
* The React-written, css properties for this element.
|
|
88
88
|
*/
|
|
89
|
-
style: _propTypes.default.objectOf(_propTypes.default.string)
|
|
89
|
+
style: _propTypes.default.objectOf(_propTypes.default.string),
|
|
90
|
+
/**
|
|
91
|
+
* The required default hex value for the color picker
|
|
92
|
+
*/
|
|
93
|
+
defaultColorHex: _propTypes.default.string
|
|
90
94
|
};
|
|
91
95
|
ColorPicker.defaultProps = {
|
|
92
|
-
|
|
96
|
+
defaultColorHex: '#ffffff'
|
|
93
97
|
};
|
|
94
98
|
var _default = exports.default = ColorPicker;
|
|
@@ -72,8 +72,6 @@ const ToolbarPlugin = _ref => {
|
|
|
72
72
|
const [activeEditor, setActiveEditor] = (0, _react.useState)(editor);
|
|
73
73
|
const [blockType, setBlockType] = (0, _react.useState)('paragraph');
|
|
74
74
|
const [rootType, setRootType] = (0, _react.useState)('root');
|
|
75
|
-
const [fontColor, setFontColor] = (0, _react.useState)('#000000');
|
|
76
|
-
const [bgColor, setBgColor] = (0, _react.useState)('#ffffff');
|
|
77
75
|
const [fontSize, setFontSize] = (0, _react.useState)('15px');
|
|
78
76
|
const [isEditable, setIsEditable] = (0, _react.useState)(() => editor.isEditable());
|
|
79
77
|
const [isBold, setIsBold] = (0, _react.useState)(false);
|
|
@@ -139,8 +137,6 @@ const ToolbarPlugin = _ref => {
|
|
|
139
137
|
}
|
|
140
138
|
}
|
|
141
139
|
setFontSize((0, _selection.$getSelectionStyleValueForProperty)(selection, 'font-size', '15px'));
|
|
142
|
-
setFontColor((0, _selection.$getSelectionStyleValueForProperty)(selection, 'color', '#000'));
|
|
143
|
-
setBgColor((0, _selection.$getSelectionStyleValueForProperty)(selection, 'background-color', '#fff'));
|
|
144
140
|
}
|
|
145
141
|
}, [activeEditor]);
|
|
146
142
|
(0, _react.useEffect)(() => editor.registerCommand(_lexical.SELECTION_CHANGE_COMMAND, (_payload, newEditor) => {
|
|
@@ -241,11 +237,9 @@ const ToolbarPlugin = _ref => {
|
|
|
241
237
|
className: "group"
|
|
242
238
|
}, /*#__PURE__*/React.createElement(_ColorPicker.ColorPicker, {
|
|
243
239
|
icon: "'",
|
|
244
|
-
color: fontColor,
|
|
245
240
|
onChange: onFontColorSelect
|
|
246
241
|
}), /*#__PURE__*/React.createElement(_ColorPicker.ColorPicker, {
|
|
247
242
|
icon: "#",
|
|
248
|
-
color: bgColor,
|
|
249
243
|
onChange: onBgColorSelect
|
|
250
244
|
})), /*#__PURE__*/React.createElement("div", {
|
|
251
245
|
className: "group"
|
|
@@ -22,6 +22,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
22
22
|
|
|
23
23
|
const baseClassName = _exports.default.base;
|
|
24
24
|
const componentClassName = 'expandable-lexical-preview';
|
|
25
|
+
|
|
25
26
|
/**
|
|
26
27
|
* This is the component description.
|
|
27
28
|
*/
|
|
@@ -34,13 +35,15 @@ const ExpandableLexicalPreview = _ref => {
|
|
|
34
35
|
name,
|
|
35
36
|
color,
|
|
36
37
|
resize,
|
|
37
|
-
|
|
38
|
+
pageTitle,
|
|
39
|
+
onBlock,
|
|
40
|
+
onOpen,
|
|
41
|
+
header
|
|
38
42
|
// ...otherProps
|
|
39
43
|
} = _ref;
|
|
40
|
-
const [
|
|
41
|
-
const [isExpanded, setIsExpanded] = (0, _react.useState)(false);
|
|
44
|
+
const [isCollapsed, setIsCollapsed] = (0, _react.useState)(false);
|
|
42
45
|
const handleButtonClick = () => {
|
|
43
|
-
|
|
46
|
+
setIsCollapsed(!isCollapsed);
|
|
44
47
|
};
|
|
45
48
|
return /*#__PURE__*/React.createElement(_formik.Formik, {
|
|
46
49
|
initialValues: {
|
|
@@ -48,26 +51,42 @@ const ExpandableLexicalPreview = _ref => {
|
|
|
48
51
|
}
|
|
49
52
|
}, /*#__PURE__*/React.createElement("div", {
|
|
50
53
|
id: id,
|
|
51
|
-
className: [baseClassName, componentClassName, userClassName, `y-${color}`,
|
|
54
|
+
className: [baseClassName, componentClassName, userClassName, `y-${color}`, isCollapsed && 'collapsed'].filter(e => e).join(' '),
|
|
52
55
|
style: style
|
|
53
|
-
}, typeof
|
|
56
|
+
}, typeof header === 'string' ? /*#__PURE__*/React.createElement("p", {
|
|
54
57
|
className: "title h2"
|
|
55
|
-
},
|
|
58
|
+
}, header) : header, isCollapsed ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_b.Button, {
|
|
56
59
|
onClick: handleButtonClick,
|
|
57
60
|
color: "background-far",
|
|
58
61
|
isCompact: true
|
|
59
62
|
}, /*#__PURE__*/React.createElement("span", {
|
|
60
63
|
className: "ai-icon c-x x-paragraph"
|
|
61
|
-
}, "C"))
|
|
64
|
+
}, "C")), /*#__PURE__*/React.createElement(_common.NewWindowPortal, {
|
|
65
|
+
pageTitle: pageTitle,
|
|
66
|
+
onBlock: () => {
|
|
67
|
+
onBlock?.();
|
|
68
|
+
setIsCollapsed(false);
|
|
69
|
+
},
|
|
70
|
+
onOpen: () => {
|
|
71
|
+
onOpen?.();
|
|
72
|
+
setIsCollapsed(true);
|
|
73
|
+
}
|
|
74
|
+
}, /*#__PURE__*/React.createElement(_f.EditorInput, {
|
|
62
75
|
name: name,
|
|
63
|
-
setEditorState: setEditorState,
|
|
64
76
|
resize: resize,
|
|
65
77
|
disabled: true
|
|
66
|
-
}), /*#__PURE__*/React.createElement(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
78
|
+
}))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_f.EditorInput, {
|
|
79
|
+
name: name,
|
|
80
|
+
resize: resize,
|
|
81
|
+
disabled: true,
|
|
82
|
+
id: "the-bad-ass-input"
|
|
83
|
+
}), /*#__PURE__*/React.createElement(_b.Button, {
|
|
84
|
+
id: id,
|
|
85
|
+
className: "expand-button ai-icon",
|
|
86
|
+
color: "background-far",
|
|
87
|
+
isCompact: true,
|
|
88
|
+
onClick: handleButtonClick
|
|
89
|
+
}, "D"))));
|
|
71
90
|
};
|
|
72
91
|
ExpandableLexicalPreview.propTypes = {
|
|
73
92
|
/**
|
|
@@ -95,13 +114,21 @@ ExpandableLexicalPreview.propTypes = {
|
|
|
95
114
|
*/
|
|
96
115
|
resize: _propTypes.default.string,
|
|
97
116
|
/**
|
|
98
|
-
* The
|
|
117
|
+
* The header for the preview component.
|
|
118
|
+
*/
|
|
119
|
+
header: _propTypes.default.node,
|
|
120
|
+
/**
|
|
121
|
+
* The page title for the expanded preview.
|
|
99
122
|
*/
|
|
100
|
-
|
|
123
|
+
pageTitle: _propTypes.default.string,
|
|
101
124
|
/**
|
|
102
125
|
* The name used to acces the nodes
|
|
103
126
|
*/
|
|
104
|
-
name: _propTypes.default.string.isRequired
|
|
127
|
+
name: _propTypes.default.string.isRequired,
|
|
128
|
+
/**
|
|
129
|
+
* The function to run when a new window portal can be opened
|
|
130
|
+
*/
|
|
131
|
+
onBlock: _propTypes.default.func.isRequired
|
|
105
132
|
};
|
|
106
133
|
ExpandableLexicalPreview.defaultProps = {
|
|
107
134
|
color: 'paragraph',
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactDom = require("react-dom");
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
|
|
11
|
+
var _a = require("../../../../a");
|
|
12
|
+
require("./styles.scss");
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
15
|
+
|
|
16
|
+
// Local Definitions
|
|
17
|
+
|
|
18
|
+
const baseClassName = _exports.default.base;
|
|
19
|
+
const copyStyles = (sourceDocument, targetDocument) => {
|
|
20
|
+
Array.from(sourceDocument.querySelectorAll('link[rel="stylesheet"], style')).forEach(link => {
|
|
21
|
+
targetDocument.head.appendChild(link.cloneNode(true));
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* This is the component description.
|
|
26
|
+
*/
|
|
27
|
+
const NewWindowPortal = _ref => {
|
|
28
|
+
let {
|
|
29
|
+
children,
|
|
30
|
+
pageTitle,
|
|
31
|
+
onBlock,
|
|
32
|
+
onOpen
|
|
33
|
+
} = _ref;
|
|
34
|
+
const [newWindow, setNewWindow] = (0, _react.useState)(null);
|
|
35
|
+
const container = (0, _react.useMemo)(() => document.createElement('div'), []);
|
|
36
|
+
const {
|
|
37
|
+
userTheme = 'light'
|
|
38
|
+
} = (0, _a.useTheme)();
|
|
39
|
+
(0, _react.useEffect)(() => {
|
|
40
|
+
if (!container) return;
|
|
41
|
+
container.classList.add(baseClassName, 'new-window-portal', `ui-${userTheme}`);
|
|
42
|
+
const newExternalWindow = window.open('', pageTitle, 'width="100%",height="100%"');
|
|
43
|
+
if (newExternalWindow) {
|
|
44
|
+
newExternalWindow.document.title = pageTitle;
|
|
45
|
+
newExternalWindow.document.body.appendChild(container);
|
|
46
|
+
setNewWindow(newExternalWindow);
|
|
47
|
+
onOpen();
|
|
48
|
+
} else {
|
|
49
|
+
console.warn('A new window / tab could not be opened. Check your settings and/or extensions, maybe it was blocked.');
|
|
50
|
+
onBlock();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// eslint-disable-next-line consistent-return
|
|
54
|
+
return () => {
|
|
55
|
+
container.classList.remove(...container.classList);
|
|
56
|
+
newExternalWindow?.close();
|
|
57
|
+
};
|
|
58
|
+
}, [container, pageTitle, userTheme]);
|
|
59
|
+
(0, _react.useEffect)(() => {
|
|
60
|
+
if (newWindow) {
|
|
61
|
+
copyStyles(document, newWindow.document);
|
|
62
|
+
}
|
|
63
|
+
}, [newWindow]);
|
|
64
|
+
return /*#__PURE__*/(0, _reactDom.createPortal)(children, container);
|
|
65
|
+
};
|
|
66
|
+
NewWindowPortal.propTypes = {
|
|
67
|
+
/**
|
|
68
|
+
* The children JSX
|
|
69
|
+
*/
|
|
70
|
+
children: _propTypes.default.node,
|
|
71
|
+
/**
|
|
72
|
+
* The new window page title
|
|
73
|
+
*/
|
|
74
|
+
pageTitle: _propTypes.default.string.isRequired
|
|
75
|
+
};
|
|
76
|
+
NewWindowPortal.defaultProps = {
|
|
77
|
+
// someProp:false
|
|
78
|
+
};
|
|
79
|
+
var _default = exports.default = NewWindowPortal;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "NewWindowPortal", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _NewWindowPortal.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _NewWindowPortal = _interopRequireDefault(require("./NewWindowPortal"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "NewWindowPortal", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return
|
|
9
|
+
return _NewWindowPortal.NewWindowPortal;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
var
|
|
12
|
+
var _NewWindowPortal = require("./NewWindowPortal");
|
|
@@ -20,9 +20,9 @@ $default-font-size: calc(1em * var(--s-1));
|
|
|
20
20
|
color: var(--on-x, var(--on-#{$default-color}));
|
|
21
21
|
display: inline-flex;
|
|
22
22
|
font-size: $default-font-size;
|
|
23
|
+
gap: calc(var(--gap) / 2);
|
|
23
24
|
padding: $default-padding;
|
|
24
25
|
white-space: nowrap;
|
|
25
|
-
|
|
26
26
|
&.#{bem.$modifier-compact} {
|
|
27
27
|
padding: $compact-padding;
|
|
28
28
|
}
|
|
@@ -18,14 +18,22 @@ const Tooltip = ({
|
|
|
18
18
|
style,
|
|
19
19
|
position,
|
|
20
20
|
color,
|
|
21
|
+
description,
|
|
22
|
+
content,
|
|
21
23
|
children
|
|
22
24
|
// ...otherProps
|
|
23
25
|
}) => /*#__PURE__*/React.createElement("div", {
|
|
24
26
|
id: id,
|
|
25
|
-
className: [baseClassName, componentClassName, userClassName,
|
|
26
|
-
style: style
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
className: [baseClassName, componentClassName, userClassName, `x-${color}`].filter(e => e).join(' '),
|
|
28
|
+
style: style
|
|
29
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
30
|
+
className: "tooltip-trigger-wrapper",
|
|
31
|
+
"aria-describedby": description
|
|
32
|
+
}, children), /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
className: `tooltip-content ${position}`,
|
|
34
|
+
role: "tooltip",
|
|
35
|
+
id: description
|
|
36
|
+
}, content));
|
|
29
37
|
Tooltip.propTypes = {
|
|
30
38
|
/**
|
|
31
39
|
* The HTML id for this element
|
|
@@ -40,9 +48,17 @@ Tooltip.propTypes = {
|
|
|
40
48
|
*/
|
|
41
49
|
style: PropTypes.objectOf(PropTypes.string),
|
|
42
50
|
/**
|
|
43
|
-
* The children JSX
|
|
51
|
+
* The children JSX where the tooltip will be applied
|
|
44
52
|
*/
|
|
45
53
|
children: PropTypes.node.isRequired,
|
|
54
|
+
/**
|
|
55
|
+
* The content JSX that renders the tooltip content
|
|
56
|
+
*/
|
|
57
|
+
content: PropTypes.node.isRequired,
|
|
58
|
+
/**
|
|
59
|
+
* The text description to identify the element that describes the tooltip
|
|
60
|
+
*/
|
|
61
|
+
description: PropTypes.string.isRequired,
|
|
46
62
|
/**
|
|
47
63
|
* The position of the tooltip with respect to the trigger element
|
|
48
64
|
*/
|
|
@@ -7,50 +7,55 @@ $default-inline-padding: var(--theme-default-padding);
|
|
|
7
7
|
$default-width: var(--tooltip-width, 20rem);
|
|
8
8
|
|
|
9
9
|
.#{bem.$base}.tooltip {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
10
|
+
display: inline-block;
|
|
11
|
+
position: relative;
|
|
12
|
+
|
|
13
|
+
> .tooltip-content {
|
|
14
|
+
background: var(--x);
|
|
15
|
+
border: var(--theme-default-border-style) var(--ui-lines);
|
|
16
|
+
border-radius: calc(var(--theme-default-border-radius) / 2);
|
|
17
|
+
opacity: 0;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
padding: $default-block-padding $default-inline-padding;
|
|
20
|
+
position: absolute;
|
|
21
|
+
transform: translateX(var(--horizontal, 0)) translateY(var(--vertical, 0));
|
|
22
|
+
transition: opacity .2s ease, transform .2s ease;
|
|
23
|
+
visibility: hidden;
|
|
24
|
+
width: $default-width;
|
|
25
|
+
z-index: 10;
|
|
26
|
+
|
|
27
|
+
&.top {
|
|
28
|
+
--horizontal: -50%;
|
|
29
|
+
bottom: calc(100% + $default-block-padding);
|
|
30
|
+
left: 50%;
|
|
30
31
|
}
|
|
31
|
-
}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
&.right {
|
|
34
|
+
--vertical: 50%;
|
|
35
|
+
bottom: 50%;
|
|
36
|
+
left: calc(100% + $default-inline-padding);
|
|
37
|
+
}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
&.bottom {
|
|
40
|
+
--horizontal: -50%;
|
|
41
|
+
left: 50%;
|
|
42
|
+
top: calc(100% + $default-block-padding);
|
|
43
|
+
}
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
&.left {
|
|
46
|
+
--vertical: 50%;
|
|
47
|
+
bottom: 50%;
|
|
48
|
+
right: calc(100% + $default-inline-padding);
|
|
49
|
+
}
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
> .tooltip-trigger-wrapper {
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
|
|
55
|
+
&:is(:hover, :focus-visible, :active) + .tooltip-content {
|
|
56
|
+
opacity: 1;
|
|
57
|
+
transition-delay: 200ms;
|
|
58
|
+
visibility: visible;
|
|
59
|
+
}
|
|
55
60
|
}
|
|
56
61
|
}
|
|
@@ -20,11 +20,11 @@ const ColorPicker = ({
|
|
|
20
20
|
className: userClassName,
|
|
21
21
|
style,
|
|
22
22
|
icon,
|
|
23
|
-
|
|
23
|
+
defaultColorHex,
|
|
24
24
|
onChange
|
|
25
25
|
// ...otherProps
|
|
26
26
|
}) => {
|
|
27
|
-
const [colorValue, setColor] = useColor(
|
|
27
|
+
const [colorValue, setColor] = useColor(defaultColorHex);
|
|
28
28
|
const parentRef = useRef(null);
|
|
29
29
|
const [isOpen, setIsOpen] = useState(false);
|
|
30
30
|
useOutsideClick(parentRef, () => setIsOpen(false));
|
|
@@ -75,9 +75,13 @@ ColorPicker.propTypes = {
|
|
|
75
75
|
/**
|
|
76
76
|
* The React-written, css properties for this element.
|
|
77
77
|
*/
|
|
78
|
-
style: PropTypes.objectOf(PropTypes.string)
|
|
78
|
+
style: PropTypes.objectOf(PropTypes.string),
|
|
79
|
+
/**
|
|
80
|
+
* The required default hex value for the color picker
|
|
81
|
+
*/
|
|
82
|
+
defaultColorHex: PropTypes.string
|
|
79
83
|
};
|
|
80
84
|
ColorPicker.defaultProps = {
|
|
81
|
-
|
|
85
|
+
defaultColorHex: '#ffffff'
|
|
82
86
|
};
|
|
83
87
|
export default ColorPicker;
|
|
@@ -61,8 +61,6 @@ const ToolbarPlugin = ({
|
|
|
61
61
|
const [activeEditor, setActiveEditor] = useState(editor);
|
|
62
62
|
const [blockType, setBlockType] = useState('paragraph');
|
|
63
63
|
const [rootType, setRootType] = useState('root');
|
|
64
|
-
const [fontColor, setFontColor] = useState('#000000');
|
|
65
|
-
const [bgColor, setBgColor] = useState('#ffffff');
|
|
66
64
|
const [fontSize, setFontSize] = useState('15px');
|
|
67
65
|
const [isEditable, setIsEditable] = useState(() => editor.isEditable());
|
|
68
66
|
const [isBold, setIsBold] = useState(false);
|
|
@@ -128,8 +126,6 @@ const ToolbarPlugin = ({
|
|
|
128
126
|
}
|
|
129
127
|
}
|
|
130
128
|
setFontSize($getSelectionStyleValueForProperty(selection, 'font-size', '15px'));
|
|
131
|
-
setFontColor($getSelectionStyleValueForProperty(selection, 'color', '#000'));
|
|
132
|
-
setBgColor($getSelectionStyleValueForProperty(selection, 'background-color', '#fff'));
|
|
133
129
|
}
|
|
134
130
|
}, [activeEditor]);
|
|
135
131
|
useEffect(() => editor.registerCommand(SELECTION_CHANGE_COMMAND, (_payload, newEditor) => {
|
|
@@ -229,11 +225,9 @@ const ToolbarPlugin = ({
|
|
|
229
225
|
className: "group"
|
|
230
226
|
}, /*#__PURE__*/React.createElement(ColorPicker, {
|
|
231
227
|
icon: "'",
|
|
232
|
-
color: fontColor,
|
|
233
228
|
onChange: onFontColorSelect
|
|
234
229
|
}), /*#__PURE__*/React.createElement(ColorPicker, {
|
|
235
230
|
icon: "#",
|
|
236
|
-
color: bgColor,
|
|
237
231
|
onChange: onBgColorSelect
|
|
238
232
|
})), /*#__PURE__*/React.createElement("div", {
|
|
239
233
|
className: "group"
|