@pareto-engineering/design-system 4.0.0-alpha.79 → 4.0.0-alpha.82
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/People/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/f/fields/SelectInput/common/Multiple/Multiple.js +1 -1
- package/dist/cjs/f/fields/SelectInput/common/Single/Single.js +1 -1
- package/dist/cjs/f/fields/TextInput/TextInput.js +1 -2
- package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +1 -2
- package/dist/cjs/g/DragAndDrop/DragAndDrop.js +99 -0
- package/dist/cjs/g/DragAndDrop/common/DraggableItem/DraggableItem.js +80 -0
- package/dist/cjs/g/DragAndDrop/common/DraggableItem/index.js +13 -0
- package/dist/cjs/g/DragAndDrop/common/DraggableItem/styles.scss +12 -0
- package/dist/cjs/g/DragAndDrop/common/index.js +12 -0
- package/dist/cjs/g/{ExpandableLexicalPreview/common/ExpandButton → DragAndDrop}/index.js +3 -3
- package/dist/cjs/g/DragAndDrop/styles.scss +6 -0
- 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/cjs/g/index.js +8 -1
- package/dist/es/a/Label/styles.scss +1 -1
- package/dist/es/a/People/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/f/fields/SelectInput/common/Multiple/Multiple.js +1 -1
- package/dist/es/f/fields/SelectInput/common/Single/Single.js +1 -1
- package/dist/es/f/fields/TextInput/TextInput.js +1 -2
- package/dist/es/f/fields/TextareaInput/TextareaInput.js +1 -2
- package/dist/es/g/DragAndDrop/DragAndDrop.js +90 -0
- package/dist/es/g/DragAndDrop/common/DraggableItem/DraggableItem.js +72 -0
- package/dist/es/g/DragAndDrop/common/DraggableItem/index.js +2 -0
- package/dist/es/g/DragAndDrop/common/DraggableItem/styles.scss +12 -0
- package/dist/es/g/DragAndDrop/common/index.js +1 -0
- package/dist/es/g/DragAndDrop/index.js +2 -0
- package/dist/es/g/DragAndDrop/styles.scss +6 -0
- 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/dist/es/g/index.js +2 -1
- package/package.json +4 -4
- package/src/stories/a/Tooltip.stories.jsx +7 -12
- package/src/stories/g/DragAndDrop.stories.jsx +114 -0
- package/src/stories/g/ExpandableLexicalPreview.stories.jsx +12 -5
- package/src/ui/a/Label/styles.scss +1 -1
- package/src/ui/a/People/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/f/fields/SelectInput/common/Multiple/Multiple.jsx +16 -14
- package/src/ui/f/fields/SelectInput/common/Single/Single.jsx +9 -7
- package/src/ui/f/fields/TextInput/TextInput.jsx +9 -8
- package/src/ui/f/fields/TextareaInput/TextareaInput.jsx +9 -9
- package/src/ui/g/DragAndDrop/DragAndDrop.jsx +121 -0
- package/src/ui/g/DragAndDrop/common/DraggableItem/DraggableItem.jsx +98 -0
- package/src/ui/g/DragAndDrop/common/DraggableItem/index.js +2 -0
- package/src/ui/g/DragAndDrop/common/DraggableItem/styles.scss +12 -0
- package/src/ui/g/DragAndDrop/common/index.js +1 -0
- package/src/ui/g/DragAndDrop/index.js +2 -0
- package/src/ui/g/DragAndDrop/styles.scss +6 -0
- 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/src/ui/g/index.js +1 -0
- package/tests/__snapshots__/Storyshots.test.js.snap +753 -49
- package/dist/cjs/g/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.js +0 -111
- 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
|
@@ -8,10 +8,11 @@ import styleNames from '@pareto-engineering/bem/exports';
|
|
|
8
8
|
// Local Definitions
|
|
9
9
|
import { EditorInput } from "../../f";
|
|
10
10
|
import { Button } from "../../b";
|
|
11
|
-
import {
|
|
11
|
+
import { NewWindowPortal } from "./common";
|
|
12
12
|
import "./styles.scss";
|
|
13
13
|
const baseClassName = styleNames.base;
|
|
14
14
|
const componentClassName = 'expandable-lexical-preview';
|
|
15
|
+
|
|
15
16
|
/**
|
|
16
17
|
* This is the component description.
|
|
17
18
|
*/
|
|
@@ -23,13 +24,15 @@ const ExpandableLexicalPreview = ({
|
|
|
23
24
|
name,
|
|
24
25
|
color,
|
|
25
26
|
resize,
|
|
26
|
-
|
|
27
|
+
pageTitle,
|
|
28
|
+
onBlock,
|
|
29
|
+
onOpen,
|
|
30
|
+
header
|
|
27
31
|
// ...otherProps
|
|
28
32
|
}) => {
|
|
29
|
-
const [
|
|
30
|
-
const [isExpanded, setIsExpanded] = useState(false);
|
|
33
|
+
const [isCollapsed, setIsCollapsed] = useState(false);
|
|
31
34
|
const handleButtonClick = () => {
|
|
32
|
-
|
|
35
|
+
setIsCollapsed(!isCollapsed);
|
|
33
36
|
};
|
|
34
37
|
return /*#__PURE__*/React.createElement(Formik, {
|
|
35
38
|
initialValues: {
|
|
@@ -37,26 +40,42 @@ const ExpandableLexicalPreview = ({
|
|
|
37
40
|
}
|
|
38
41
|
}, /*#__PURE__*/React.createElement("div", {
|
|
39
42
|
id: id,
|
|
40
|
-
className: [baseClassName, componentClassName, userClassName, `y-${color}`,
|
|
43
|
+
className: [baseClassName, componentClassName, userClassName, `y-${color}`, isCollapsed && 'collapsed'].filter(e => e).join(' '),
|
|
41
44
|
style: style
|
|
42
|
-
}, typeof
|
|
45
|
+
}, typeof header === 'string' ? /*#__PURE__*/React.createElement("p", {
|
|
43
46
|
className: "title h2"
|
|
44
|
-
},
|
|
47
|
+
}, header) : header, isCollapsed ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
45
48
|
onClick: handleButtonClick,
|
|
46
49
|
color: "background-far",
|
|
47
50
|
isCompact: true
|
|
48
51
|
}, /*#__PURE__*/React.createElement("span", {
|
|
49
52
|
className: "ai-icon c-x x-paragraph"
|
|
50
|
-
}, "C"))
|
|
53
|
+
}, "C")), /*#__PURE__*/React.createElement(NewWindowPortal, {
|
|
54
|
+
pageTitle: pageTitle,
|
|
55
|
+
onBlock: () => {
|
|
56
|
+
onBlock?.();
|
|
57
|
+
setIsCollapsed(false);
|
|
58
|
+
},
|
|
59
|
+
onOpen: () => {
|
|
60
|
+
onOpen?.();
|
|
61
|
+
setIsCollapsed(true);
|
|
62
|
+
}
|
|
63
|
+
}, /*#__PURE__*/React.createElement(EditorInput, {
|
|
51
64
|
name: name,
|
|
52
|
-
setEditorState: setEditorState,
|
|
53
65
|
resize: resize,
|
|
54
66
|
disabled: true
|
|
55
|
-
}), /*#__PURE__*/React.createElement(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
67
|
+
}))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EditorInput, {
|
|
68
|
+
name: name,
|
|
69
|
+
resize: resize,
|
|
70
|
+
disabled: true,
|
|
71
|
+
id: "the-bad-ass-input"
|
|
72
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
73
|
+
id: id,
|
|
74
|
+
className: "expand-button ai-icon",
|
|
75
|
+
color: "background-far",
|
|
76
|
+
isCompact: true,
|
|
77
|
+
onClick: handleButtonClick
|
|
78
|
+
}, "D"))));
|
|
60
79
|
};
|
|
61
80
|
ExpandableLexicalPreview.propTypes = {
|
|
62
81
|
/**
|
|
@@ -84,13 +103,21 @@ ExpandableLexicalPreview.propTypes = {
|
|
|
84
103
|
*/
|
|
85
104
|
resize: PropTypes.string,
|
|
86
105
|
/**
|
|
87
|
-
* The
|
|
106
|
+
* The header for the preview component.
|
|
107
|
+
*/
|
|
108
|
+
header: PropTypes.node,
|
|
109
|
+
/**
|
|
110
|
+
* The page title for the expanded preview.
|
|
88
111
|
*/
|
|
89
|
-
|
|
112
|
+
pageTitle: PropTypes.string,
|
|
90
113
|
/**
|
|
91
114
|
* The name used to acces the nodes
|
|
92
115
|
*/
|
|
93
|
-
name: PropTypes.string.isRequired
|
|
116
|
+
name: PropTypes.string.isRequired,
|
|
117
|
+
/**
|
|
118
|
+
* The function to run when a new window portal can be opened
|
|
119
|
+
*/
|
|
120
|
+
onBlock: PropTypes.func.isRequired
|
|
94
121
|
};
|
|
95
122
|
ExpandableLexicalPreview.defaultProps = {
|
|
96
123
|
color: 'paragraph',
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
3
|
+
import { useState, useEffect, useMemo } from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import styleNames from '@pareto-engineering/bem/exports';
|
|
6
|
+
|
|
7
|
+
// Local Definitions
|
|
8
|
+
import { useTheme } from "../../../../a";
|
|
9
|
+
import "./styles.scss";
|
|
10
|
+
const baseClassName = styleNames.base;
|
|
11
|
+
const copyStyles = (sourceDocument, targetDocument) => {
|
|
12
|
+
Array.from(sourceDocument.querySelectorAll('link[rel="stylesheet"], style')).forEach(link => {
|
|
13
|
+
targetDocument.head.appendChild(link.cloneNode(true));
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* This is the component description.
|
|
18
|
+
*/
|
|
19
|
+
const NewWindowPortal = ({
|
|
20
|
+
children,
|
|
21
|
+
pageTitle,
|
|
22
|
+
onBlock,
|
|
23
|
+
onOpen
|
|
24
|
+
}) => {
|
|
25
|
+
const [newWindow, setNewWindow] = useState(null);
|
|
26
|
+
const container = useMemo(() => document.createElement('div'), []);
|
|
27
|
+
const {
|
|
28
|
+
userTheme = 'light'
|
|
29
|
+
} = useTheme();
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (!container) return;
|
|
32
|
+
container.classList.add(baseClassName, 'new-window-portal', `ui-${userTheme}`);
|
|
33
|
+
const newExternalWindow = window.open('', pageTitle, 'width="100%",height="100%"');
|
|
34
|
+
if (newExternalWindow) {
|
|
35
|
+
newExternalWindow.document.title = pageTitle;
|
|
36
|
+
newExternalWindow.document.body.appendChild(container);
|
|
37
|
+
setNewWindow(newExternalWindow);
|
|
38
|
+
onOpen();
|
|
39
|
+
} else {
|
|
40
|
+
console.warn('A new window / tab could not be opened. Check your settings and/or extensions, maybe it was blocked.');
|
|
41
|
+
onBlock();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// eslint-disable-next-line consistent-return
|
|
45
|
+
return () => {
|
|
46
|
+
container.classList.remove(...container.classList);
|
|
47
|
+
newExternalWindow?.close();
|
|
48
|
+
};
|
|
49
|
+
}, [container, pageTitle, userTheme]);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (newWindow) {
|
|
52
|
+
copyStyles(document, newWindow.document);
|
|
53
|
+
}
|
|
54
|
+
}, [newWindow]);
|
|
55
|
+
return /*#__PURE__*/createPortal(children, container);
|
|
56
|
+
};
|
|
57
|
+
NewWindowPortal.propTypes = {
|
|
58
|
+
/**
|
|
59
|
+
* The children JSX
|
|
60
|
+
*/
|
|
61
|
+
children: PropTypes.node,
|
|
62
|
+
/**
|
|
63
|
+
* The new window page title
|
|
64
|
+
*/
|
|
65
|
+
pageTitle: PropTypes.string.isRequired
|
|
66
|
+
};
|
|
67
|
+
NewWindowPortal.defaultProps = {
|
|
68
|
+
// someProp:false
|
|
69
|
+
};
|
|
70
|
+
export default NewWindowPortal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { NewWindowPortal } from "./NewWindowPortal";
|
package/dist/es/g/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { ExpandableLexicalPreview } from "./ExpandableLexicalPreview";
|
|
1
|
+
export { ExpandableLexicalPreview } from "./ExpandableLexicalPreview";
|
|
2
|
+
export { DragAndDrop } from "./DragAndDrop";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pareto-engineering/design-system",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.82",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/es/index.js",
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"@lexical/selection": "0.12.2",
|
|
60
60
|
"@lexical/table": "0.12.2",
|
|
61
61
|
"@lexical/utils": "0.12.2",
|
|
62
|
-
"@pareto-engineering/assets": "^4.0.0-alpha.
|
|
62
|
+
"@pareto-engineering/assets": "^4.0.0-alpha.82",
|
|
63
63
|
"@pareto-engineering/bem": "^4.0.0-alpha.20",
|
|
64
64
|
"@pareto-engineering/styles": "^4.0.0-alpha.73",
|
|
65
|
-
"@pareto-engineering/utils": "^4.0.0-alpha.
|
|
65
|
+
"@pareto-engineering/utils": "^4.0.0-alpha.81",
|
|
66
66
|
"codemirror": "^6.0.1",
|
|
67
67
|
"date-fns": "^2.29.3",
|
|
68
68
|
"downshift": "^6.1.12",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"relay-test-utils": "^15.0.0"
|
|
83
83
|
},
|
|
84
84
|
"browserslist": "> 2%",
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "34526163c76e2018e2e723afd555f85971e50e3a"
|
|
86
86
|
}
|
|
@@ -16,11 +16,14 @@ export default {
|
|
|
16
16
|
},
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
const ariaDescribedby = 'test-tooltip'
|
|
20
|
-
|
|
21
19
|
export const Base = {
|
|
22
20
|
args:{
|
|
23
21
|
children:(
|
|
22
|
+
<Button>
|
|
23
|
+
Hover on me!
|
|
24
|
+
</Button>
|
|
25
|
+
),
|
|
26
|
+
content:(
|
|
24
27
|
<div>
|
|
25
28
|
<ul>
|
|
26
29
|
<li>This is the tooltips content</li>
|
|
@@ -29,7 +32,7 @@ export const Base = {
|
|
|
29
32
|
</ul>
|
|
30
33
|
</div>
|
|
31
34
|
),
|
|
32
|
-
|
|
35
|
+
description:'test-tooltip',
|
|
33
36
|
},
|
|
34
37
|
render:(args) => (
|
|
35
38
|
<div
|
|
@@ -42,15 +45,7 @@ export const Base = {
|
|
|
42
45
|
alignItems :'center',
|
|
43
46
|
}}
|
|
44
47
|
>
|
|
45
|
-
<
|
|
46
|
-
<Button>
|
|
47
|
-
Hover on me!
|
|
48
|
-
</Button>
|
|
49
|
-
<Tooltip {...args} />
|
|
50
|
-
</div>
|
|
51
|
-
<p>
|
|
52
|
-
With some more content around
|
|
53
|
-
</p>
|
|
48
|
+
<Tooltip {...args} />
|
|
54
49
|
</div>
|
|
55
50
|
),
|
|
56
51
|
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
|
|
4
|
+
import { useRef } from 'react'
|
|
5
|
+
|
|
6
|
+
import { TextInput, DragAndDrop, FormDebugger } from 'ui'
|
|
7
|
+
|
|
8
|
+
import { Formik, Form } from 'formik'
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title :'g/DragAndDrop',
|
|
12
|
+
component :DragAndDrop,
|
|
13
|
+
subcomponents:{
|
|
14
|
+
// Item:DragAndDrop.Item
|
|
15
|
+
},
|
|
16
|
+
decorators:[
|
|
17
|
+
// storyfn => <div className="">{ storyfn() }</div>,
|
|
18
|
+
],
|
|
19
|
+
argTypes:{
|
|
20
|
+
backgroundColor:{ control: 'color' },
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const DummyContent = ({ children }) => (
|
|
25
|
+
<div
|
|
26
|
+
style={{
|
|
27
|
+
padding :'1rem',
|
|
28
|
+
backgroundColor:'white',
|
|
29
|
+
border :'1px solid black',
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
32
|
+
{children}
|
|
33
|
+
</div>
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
export const Base = {
|
|
37
|
+
args:{
|
|
38
|
+
items:Array(8).fill().map((_, index) => ({
|
|
39
|
+
disabled:index === 0,
|
|
40
|
+
Content :(
|
|
41
|
+
<DummyContent>
|
|
42
|
+
Item
|
|
43
|
+
{index + 1}
|
|
44
|
+
</DummyContent>
|
|
45
|
+
),
|
|
46
|
+
key:`Item ${index + 1}`,
|
|
47
|
+
})),
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const DummyContentWithInput = ({ index }) => (
|
|
52
|
+
<div
|
|
53
|
+
style={{
|
|
54
|
+
display :'flex',
|
|
55
|
+
alignItems:'center',
|
|
56
|
+
width :'100%',
|
|
57
|
+
gap :'var(--gap)',
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
<span className="ai-icon">H</span>
|
|
61
|
+
<div
|
|
62
|
+
style={{
|
|
63
|
+
borderBottom:'1px solid var(--ui-lines)',
|
|
64
|
+
padding :'calc(var(--theme-default-padding) / 2)',
|
|
65
|
+
display :'flex',
|
|
66
|
+
alignItems :'center',
|
|
67
|
+
width :'100%',
|
|
68
|
+
gap :'var(--gap)',
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
<p
|
|
72
|
+
style={{
|
|
73
|
+
margin:'0',
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
Input
|
|
77
|
+
{index + 1}
|
|
78
|
+
</p>
|
|
79
|
+
<TextInput name={`input-${index + 1}`} />
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
export const WithFormikInputs = {
|
|
85
|
+
render:({ items }) => {
|
|
86
|
+
const formikRef = useRef()
|
|
87
|
+
|
|
88
|
+
const handleReorder = (orderedItems) => {
|
|
89
|
+
const { values, setFieldValue } = formikRef.current || {}
|
|
90
|
+
const orderedInputValues = orderedItems.map(({ identifier }) => values?.[identifier])
|
|
91
|
+
|
|
92
|
+
setFieldValue('items', orderedInputValues)
|
|
93
|
+
}
|
|
94
|
+
return (
|
|
95
|
+
<Formik
|
|
96
|
+
initialValues={{ items: [] }}
|
|
97
|
+
innerRef={formikRef}
|
|
98
|
+
>
|
|
99
|
+
<Form>
|
|
100
|
+
<DragAndDrop onOrderChange={handleReorder} items={items} />
|
|
101
|
+
<FormDebugger />
|
|
102
|
+
</Form>
|
|
103
|
+
</Formik>
|
|
104
|
+
)
|
|
105
|
+
},
|
|
106
|
+
args:{
|
|
107
|
+
items:Array(8).fill().map((_, index) => ({
|
|
108
|
+
Content:(
|
|
109
|
+
<DummyContentWithInput index={index} />
|
|
110
|
+
),
|
|
111
|
+
identifier:`input-${index + 1}`,
|
|
112
|
+
})),
|
|
113
|
+
},
|
|
114
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
import * as React from 'react'
|
|
3
3
|
|
|
4
|
-
import { ExpandableLexicalPreview } from 'ui'
|
|
4
|
+
import { ExpandableLexicalPreview, AppContextProvider } from 'ui'
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
title :'g/ExpandableLexicalPreview',
|
|
@@ -9,8 +9,14 @@ export default {
|
|
|
9
9
|
subcomponents:{
|
|
10
10
|
// Item:TextareaInput.Item
|
|
11
11
|
},
|
|
12
|
-
decorators:[
|
|
13
|
-
|
|
12
|
+
decorators:[
|
|
13
|
+
(storyfn) => (
|
|
14
|
+
<AppContextProvider>
|
|
15
|
+
{ storyfn() }
|
|
16
|
+
</AppContextProvider>
|
|
17
|
+
),
|
|
18
|
+
],
|
|
19
|
+
argTypes:{
|
|
14
20
|
color:{ control: 'text' },
|
|
15
21
|
},
|
|
16
22
|
}
|
|
@@ -25,6 +31,7 @@ const Template = (args) => (
|
|
|
25
31
|
export const Base = Template.bind({})
|
|
26
32
|
Base.args = {
|
|
27
33
|
nodes,
|
|
28
|
-
name
|
|
29
|
-
|
|
34
|
+
name :'taskDescription',
|
|
35
|
+
pageTitle:'Task Instructions',
|
|
36
|
+
header :'Task Instructions',
|
|
30
37
|
}
|
|
@@ -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
|
}
|
|
@@ -11,7 +11,7 @@ $default-padding:var(--u);
|
|
|
11
11
|
$default-horizontal-margin: .5em;
|
|
12
12
|
|
|
13
13
|
$default-grid-gap: 1em;
|
|
14
|
-
$default-margin:
|
|
14
|
+
$default-margin: 1em;
|
|
15
15
|
$default-image-margin: var(--default-image-margin, #{$default-margin});
|
|
16
16
|
$default-color: var(--default-color, var(--paragraph));
|
|
17
17
|
|
|
@@ -22,6 +22,8 @@ const Tooltip = ({
|
|
|
22
22
|
style,
|
|
23
23
|
position,
|
|
24
24
|
color,
|
|
25
|
+
description,
|
|
26
|
+
content,
|
|
25
27
|
children,
|
|
26
28
|
// ...otherProps
|
|
27
29
|
}) => (
|
|
@@ -31,15 +33,26 @@ const Tooltip = ({
|
|
|
31
33
|
baseClassName,
|
|
32
34
|
componentClassName,
|
|
33
35
|
userClassName,
|
|
34
|
-
position,
|
|
35
36
|
`x-${color}`,
|
|
36
37
|
]
|
|
37
38
|
.filter((e) => e)
|
|
38
39
|
.join(' ')}
|
|
39
40
|
style={style}
|
|
40
|
-
|
|
41
|
+
|
|
41
42
|
>
|
|
42
|
-
|
|
43
|
+
<div
|
|
44
|
+
className="tooltip-trigger-wrapper"
|
|
45
|
+
aria-describedby={description}
|
|
46
|
+
>
|
|
47
|
+
{children}
|
|
48
|
+
</div>
|
|
49
|
+
<div
|
|
50
|
+
className={`tooltip-content ${position}`}
|
|
51
|
+
role="tooltip"
|
|
52
|
+
id={description}
|
|
53
|
+
>
|
|
54
|
+
{content}
|
|
55
|
+
</div>
|
|
43
56
|
</div>
|
|
44
57
|
)
|
|
45
58
|
|
|
@@ -60,10 +73,20 @@ Tooltip.propTypes = {
|
|
|
60
73
|
style:PropTypes.objectOf(PropTypes.string),
|
|
61
74
|
|
|
62
75
|
/**
|
|
63
|
-
* The children JSX
|
|
76
|
+
* The children JSX where the tooltip will be applied
|
|
64
77
|
*/
|
|
65
78
|
children:PropTypes.node.isRequired,
|
|
66
79
|
|
|
80
|
+
/**
|
|
81
|
+
* The content JSX that renders the tooltip content
|
|
82
|
+
*/
|
|
83
|
+
content:PropTypes.node.isRequired,
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The text description to identify the element that describes the tooltip
|
|
87
|
+
*/
|
|
88
|
+
description:PropTypes.string.isRequired,
|
|
89
|
+
|
|
67
90
|
/**
|
|
68
91
|
* The position of the tooltip with respect to the trigger element
|
|
69
92
|
*/
|
|
@@ -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
|
}
|
|
@@ -28,11 +28,11 @@ const ColorPicker = ({
|
|
|
28
28
|
className:userClassName,
|
|
29
29
|
style,
|
|
30
30
|
icon,
|
|
31
|
-
|
|
31
|
+
defaultColorHex,
|
|
32
32
|
onChange,
|
|
33
33
|
// ...otherProps
|
|
34
34
|
}) => {
|
|
35
|
-
const [colorValue, setColor] = useColor(
|
|
35
|
+
const [colorValue, setColor] = useColor(defaultColorHex)
|
|
36
36
|
|
|
37
37
|
const parentRef = useRef(null)
|
|
38
38
|
|
|
@@ -101,10 +101,15 @@ ColorPicker.propTypes = {
|
|
|
101
101
|
* The React-written, css properties for this element.
|
|
102
102
|
*/
|
|
103
103
|
style:PropTypes.objectOf(PropTypes.string),
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The required default hex value for the color picker
|
|
107
|
+
*/
|
|
108
|
+
defaultColorHex:PropTypes.string,
|
|
104
109
|
}
|
|
105
110
|
|
|
106
111
|
ColorPicker.defaultProps = {
|
|
107
|
-
|
|
112
|
+
defaultColorHex:'#ffffff',
|
|
108
113
|
}
|
|
109
114
|
|
|
110
115
|
export default ColorPicker
|
|
@@ -98,8 +98,6 @@ const ToolbarPlugin = ({
|
|
|
98
98
|
const [activeEditor, setActiveEditor] = useState(editor)
|
|
99
99
|
const [blockType, setBlockType] = useState('paragraph')
|
|
100
100
|
const [rootType, setRootType] = useState('root')
|
|
101
|
-
const [fontColor, setFontColor] = useState('#000000')
|
|
102
|
-
const [bgColor, setBgColor] = useState('#ffffff')
|
|
103
101
|
const [fontSize, setFontSize] = useState('15px')
|
|
104
102
|
const [isEditable, setIsEditable] = useState(() => editor.isEditable())
|
|
105
103
|
const [isBold, setIsBold] = useState(false)
|
|
@@ -180,16 +178,6 @@ const ToolbarPlugin = ({
|
|
|
180
178
|
setFontSize(
|
|
181
179
|
$getSelectionStyleValueForProperty(selection, 'font-size', '15px'),
|
|
182
180
|
)
|
|
183
|
-
setFontColor(
|
|
184
|
-
$getSelectionStyleValueForProperty(selection, 'color', '#000'),
|
|
185
|
-
)
|
|
186
|
-
setBgColor(
|
|
187
|
-
$getSelectionStyleValueForProperty(
|
|
188
|
-
selection,
|
|
189
|
-
'background-color',
|
|
190
|
-
'#fff',
|
|
191
|
-
),
|
|
192
|
-
)
|
|
193
181
|
}
|
|
194
182
|
}, [activeEditor])
|
|
195
183
|
|
|
@@ -354,12 +342,10 @@ const ToolbarPlugin = ({
|
|
|
354
342
|
<div className="group">
|
|
355
343
|
<ColorPicker
|
|
356
344
|
icon="'"
|
|
357
|
-
color={fontColor}
|
|
358
345
|
onChange={onFontColorSelect}
|
|
359
346
|
/>
|
|
360
347
|
<ColorPicker
|
|
361
348
|
icon="#"
|
|
362
|
-
color={bgColor}
|
|
363
349
|
onChange={onBgColorSelect}
|
|
364
350
|
/>
|
|
365
351
|
</div>
|