@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
|
@@ -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
|
|
|
@@ -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"
|
|
@@ -160,7 +160,7 @@ const Multiple = _ref => {
|
|
|
160
160
|
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
161
161
|
style: style,
|
|
162
162
|
ref: parentRef
|
|
163
|
-
}, getComboboxProps()), /*#__PURE__*/React.createElement(_.FormLabel, _extends({
|
|
163
|
+
}, getComboboxProps()), label && /*#__PURE__*/React.createElement(_.FormLabel, _extends({
|
|
164
164
|
className: [baseClassName, componentClassName].filter(e => e).join(' ')
|
|
165
165
|
}, getLabelProps(), {
|
|
166
166
|
name: name,
|
|
@@ -59,7 +59,7 @@ const Single = _ref => {
|
|
|
59
59
|
id: id,
|
|
60
60
|
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
61
61
|
style: style
|
|
62
|
-
}, /*#__PURE__*/React.createElement(_.FormLabel, {
|
|
62
|
+
}, label && /*#__PURE__*/React.createElement(_.FormLabel, {
|
|
63
63
|
name: name,
|
|
64
64
|
color: labelColor,
|
|
65
65
|
optional: optional
|
|
@@ -58,11 +58,10 @@ const TextInput = _ref => {
|
|
|
58
58
|
...symbolStyle,
|
|
59
59
|
...style
|
|
60
60
|
}
|
|
61
|
-
}, /*#__PURE__*/React.createElement(_common.FormLabel, {
|
|
61
|
+
}, label && /*#__PURE__*/React.createElement(_common.FormLabel, {
|
|
62
62
|
name: name,
|
|
63
63
|
color: labelColor,
|
|
64
64
|
optional: optional
|
|
65
|
-
// {...otherProps}
|
|
66
65
|
}, label), /*#__PURE__*/React.createElement(InputWrapper, inputWrapperProps, /*#__PURE__*/React.createElement("input", _extends({
|
|
67
66
|
id: name,
|
|
68
67
|
className: "input",
|
|
@@ -48,11 +48,10 @@ const TextareaInput = _ref => {
|
|
|
48
48
|
id: id,
|
|
49
49
|
className: [baseClassName, componentClassName, userClassName, `y-${color}`].filter(e => e).join(' '),
|
|
50
50
|
style: style
|
|
51
|
-
}, /*#__PURE__*/React.createElement(_common.FormLabel, {
|
|
51
|
+
}, label && /*#__PURE__*/React.createElement(_common.FormLabel, {
|
|
52
52
|
name: name,
|
|
53
53
|
color: labelColor,
|
|
54
54
|
optional: optional
|
|
55
|
-
// {...otherProps}
|
|
56
55
|
}, label), /*#__PURE__*/React.createElement("textarea", _extends({
|
|
57
56
|
id: name,
|
|
58
57
|
className: "textarea"
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var React = _react;
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
|
|
11
|
+
var _common = require("./common");
|
|
12
|
+
require("./styles.scss");
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } /* @pareto-engineering/generator-front 1.0.12 */ // Local Definitions
|
|
17
|
+
const baseClassName = _exports.default.base;
|
|
18
|
+
const componentClassName = 'drag-and-drop';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* This is the component description.
|
|
22
|
+
*/
|
|
23
|
+
const DragAndDrop = _ref => {
|
|
24
|
+
let {
|
|
25
|
+
id,
|
|
26
|
+
className: userClassName,
|
|
27
|
+
style,
|
|
28
|
+
as: Wrapper,
|
|
29
|
+
onOrderChange,
|
|
30
|
+
items
|
|
31
|
+
// ...otherProps
|
|
32
|
+
} = _ref;
|
|
33
|
+
const [draggableItems, setDraggableItems] = (0, _react.useState)(items);
|
|
34
|
+
const handleDrop = (e, dragOverItemIndex) => {
|
|
35
|
+
e.preventDefault();
|
|
36
|
+
const dragItemIndex = e.dataTransfer.getData('text');
|
|
37
|
+
const orderedItems = [...draggableItems];
|
|
38
|
+
const [reorderedItem] = orderedItems.splice(dragItemIndex, 1);
|
|
39
|
+
orderedItems.splice(dragOverItemIndex, 0, reorderedItem);
|
|
40
|
+
setDraggableItems(orderedItems);
|
|
41
|
+
};
|
|
42
|
+
(0, _react.useEffect)(() => {
|
|
43
|
+
onOrderChange?.(draggableItems);
|
|
44
|
+
}, [draggableItems, onOrderChange]);
|
|
45
|
+
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
46
|
+
id: id,
|
|
47
|
+
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
48
|
+
style: style
|
|
49
|
+
// {...otherProps}
|
|
50
|
+
}, draggableItems.map((_ref2, index) => {
|
|
51
|
+
let {
|
|
52
|
+
identifier,
|
|
53
|
+
disabled,
|
|
54
|
+
Content,
|
|
55
|
+
...rest
|
|
56
|
+
} = _ref2;
|
|
57
|
+
return /*#__PURE__*/React.createElement(_common.DraggableItem, _extends({
|
|
58
|
+
draggable: true,
|
|
59
|
+
onDrop: e => handleDrop(e, index),
|
|
60
|
+
index: index,
|
|
61
|
+
key: identifier
|
|
62
|
+
}, rest), Content);
|
|
63
|
+
}));
|
|
64
|
+
};
|
|
65
|
+
DragAndDrop.propTypes = {
|
|
66
|
+
/**
|
|
67
|
+
* The HTML id for this element
|
|
68
|
+
*/
|
|
69
|
+
id: _propTypes.default.string,
|
|
70
|
+
/**
|
|
71
|
+
* The HTML class names for this element
|
|
72
|
+
*/
|
|
73
|
+
className: _propTypes.default.string,
|
|
74
|
+
/**
|
|
75
|
+
* The React-written, css properties for this element.
|
|
76
|
+
*/
|
|
77
|
+
style: _propTypes.default.objectOf(_propTypes.default.string),
|
|
78
|
+
/**
|
|
79
|
+
* The html element to use to display this component.
|
|
80
|
+
*/
|
|
81
|
+
as: _propTypes.default.string,
|
|
82
|
+
/**
|
|
83
|
+
* The node list of items to be dragged around
|
|
84
|
+
*/
|
|
85
|
+
items: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
86
|
+
Content: _propTypes.default.node.isRequired,
|
|
87
|
+
identifier: _propTypes.default.string.isRequired,
|
|
88
|
+
as: _propTypes.default.string
|
|
89
|
+
})).isRequired,
|
|
90
|
+
/*
|
|
91
|
+
* A function to be called when the draggable items are re-ordered
|
|
92
|
+
*/
|
|
93
|
+
onOrderChange: _propTypes.default.func
|
|
94
|
+
};
|
|
95
|
+
DragAndDrop.defaultProps = {
|
|
96
|
+
as: 'ul'
|
|
97
|
+
};
|
|
98
|
+
DragAndDrop.DraggableItem = _common.DraggableItem;
|
|
99
|
+
var _default = exports.default = DragAndDrop;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var React = _react;
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
|
|
11
|
+
require("./styles.scss");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } /* @pareto-engineering/generator-front 1.0.12 */
|
|
16
|
+
// Local Definitions
|
|
17
|
+
|
|
18
|
+
const baseClassName = _exports.default.base;
|
|
19
|
+
const componentClassName = 'draggable-item';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* This is the component description.
|
|
23
|
+
*/
|
|
24
|
+
const DraggableItem = _ref => {
|
|
25
|
+
let {
|
|
26
|
+
id,
|
|
27
|
+
className: userClassName,
|
|
28
|
+
style,
|
|
29
|
+
as: Wrapper,
|
|
30
|
+
children,
|
|
31
|
+
index,
|
|
32
|
+
...otherProps
|
|
33
|
+
} = _ref;
|
|
34
|
+
const [isDragging, setIsDragging] = (0, _react.useState)(false);
|
|
35
|
+
const handleDragStart = e => {
|
|
36
|
+
setIsDragging(true);
|
|
37
|
+
e.dataTransfer.effectAllowed = 'move';
|
|
38
|
+
e.dataTransfer.setData('text/plain', index);
|
|
39
|
+
};
|
|
40
|
+
const handleDragEnd = () => {
|
|
41
|
+
setIsDragging(false);
|
|
42
|
+
};
|
|
43
|
+
const handleDragOver = e => {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
};
|
|
46
|
+
return /*#__PURE__*/React.createElement(Wrapper, _extends({
|
|
47
|
+
id: id,
|
|
48
|
+
className: [baseClassName, componentClassName, userClassName, isDragging && 'dragging'].filter(e => e).join(' '),
|
|
49
|
+
style: style,
|
|
50
|
+
onDragStart: e => handleDragStart(e),
|
|
51
|
+
onDragOver: e => handleDragOver(e),
|
|
52
|
+
onDragEnd: e => handleDragEnd(e)
|
|
53
|
+
}, otherProps), children);
|
|
54
|
+
};
|
|
55
|
+
DraggableItem.propTypes = {
|
|
56
|
+
/**
|
|
57
|
+
* The HTML id for this element
|
|
58
|
+
*/
|
|
59
|
+
id: _propTypes.default.string,
|
|
60
|
+
/**
|
|
61
|
+
* The HTML class names for this element
|
|
62
|
+
*/
|
|
63
|
+
className: _propTypes.default.string,
|
|
64
|
+
/**
|
|
65
|
+
* The React-written, css properties for this element.
|
|
66
|
+
*/
|
|
67
|
+
style: _propTypes.default.objectOf(_propTypes.default.string),
|
|
68
|
+
/**
|
|
69
|
+
* The children JSX
|
|
70
|
+
*/
|
|
71
|
+
children: _propTypes.default.node,
|
|
72
|
+
/**
|
|
73
|
+
* The html element to use to display this component.
|
|
74
|
+
*/
|
|
75
|
+
as: _propTypes.default.string
|
|
76
|
+
};
|
|
77
|
+
DraggableItem.defaultProps = {
|
|
78
|
+
as: 'li'
|
|
79
|
+
};
|
|
80
|
+
var _default = exports.default = DraggableItem;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "DraggableItem", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _DraggableItem.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _DraggableItem = _interopRequireDefault(require("./DraggableItem"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "DraggableItem", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _DraggableItem.DraggableItem;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _DraggableItem = require("./DraggableItem");
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "DragAndDrop", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return
|
|
9
|
+
return _DragAndDrop.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
var
|
|
12
|
+
var _DragAndDrop = _interopRequireDefault(require("./DragAndDrop"));
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -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',
|