@pareto-engineering/design-system 4.0.0-alpha.78 → 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.
Files changed (98) hide show
  1. package/dist/cjs/a/Label/styles.scss +1 -1
  2. package/dist/cjs/a/Quote/styles.scss +1 -1
  3. package/dist/cjs/a/Tooltip/Tooltip.js +21 -5
  4. package/dist/cjs/a/Tooltip/styles.scss +44 -36
  5. package/dist/cjs/a/index.js +0 -7
  6. package/dist/cjs/b/Page/common/PageHelmet/PageHelmet.js +4 -1
  7. package/dist/cjs/b/index.js +1 -8
  8. package/dist/cjs/f/fields/EditorInput/EditorInput.js +18 -4
  9. package/dist/cjs/f/fields/EditorInput/common/ColorPicker/ColorPicker.js +8 -4
  10. package/dist/cjs/f/fields/EditorInput/common/ToolbarPlugin/ToolbarPlugin.js +0 -6
  11. package/dist/cjs/f/fields/EditorInput/styles.scss +9 -2
  12. package/dist/cjs/f/fields/SelectInput/SelectInput.js +9 -2
  13. package/dist/cjs/f/fields/SelectInput/common/Single/Single.js +13 -2
  14. package/dist/cjs/f/fields/SelectInput/styles.scss +1 -1
  15. package/dist/cjs/{b → g}/ExpandableLexicalPreview/ExpandableLexicalPreview.js +59 -47
  16. package/dist/cjs/g/ExpandableLexicalPreview/common/NewWindowPortal/NewWindowPortal.js +79 -0
  17. package/dist/cjs/g/ExpandableLexicalPreview/common/NewWindowPortal/index.js +13 -0
  18. package/dist/cjs/g/ExpandableLexicalPreview/common/NewWindowPortal/styles.scss +9 -0
  19. package/dist/cjs/g/ExpandableLexicalPreview/common/index.js +12 -0
  20. package/dist/cjs/g/ExpandableLexicalPreview/styles.scss +34 -0
  21. package/dist/cjs/g/index.js +12 -0
  22. package/dist/cjs/index.js +11 -0
  23. package/dist/es/a/Label/styles.scss +1 -1
  24. package/dist/es/a/Quote/styles.scss +1 -1
  25. package/dist/es/a/Tooltip/Tooltip.js +21 -5
  26. package/dist/es/a/Tooltip/styles.scss +44 -36
  27. package/dist/es/a/index.js +0 -1
  28. package/dist/es/b/Page/common/PageHelmet/PageHelmet.js +4 -1
  29. package/dist/es/b/index.js +1 -2
  30. package/dist/es/f/fields/EditorInput/EditorInput.js +16 -3
  31. package/dist/es/f/fields/EditorInput/common/ColorPicker/ColorPicker.js +8 -4
  32. package/dist/es/f/fields/EditorInput/common/ToolbarPlugin/ToolbarPlugin.js +0 -6
  33. package/dist/es/f/fields/EditorInput/styles.scss +9 -2
  34. package/dist/es/f/fields/SelectInput/SelectInput.js +9 -2
  35. package/dist/es/f/fields/SelectInput/common/Single/Single.js +12 -1
  36. package/dist/es/f/fields/SelectInput/styles.scss +1 -1
  37. package/dist/es/g/ExpandableLexicalPreview/ExpandableLexicalPreview.js +126 -0
  38. package/dist/es/g/ExpandableLexicalPreview/common/NewWindowPortal/NewWindowPortal.js +70 -0
  39. package/dist/es/g/ExpandableLexicalPreview/common/NewWindowPortal/index.js +2 -0
  40. package/dist/es/g/ExpandableLexicalPreview/common/NewWindowPortal/styles.scss +9 -0
  41. package/dist/es/g/ExpandableLexicalPreview/common/index.js +1 -0
  42. package/dist/es/g/ExpandableLexicalPreview/styles.scss +34 -0
  43. package/dist/es/g/index.js +1 -0
  44. package/dist/es/index.js +1 -0
  45. package/package.json +4 -4
  46. package/src/stories/a/Tooltip.stories.jsx +7 -12
  47. package/src/stories/f/SelectInput.stories.jsx +18 -2
  48. package/src/stories/{b → g}/ExpandableLexicalPreview.stories.jsx +13 -5
  49. package/src/ui/a/Label/styles.scss +1 -1
  50. package/src/ui/a/Quote/styles.scss +1 -1
  51. package/src/ui/a/Tooltip/Tooltip.jsx +27 -4
  52. package/src/ui/a/Tooltip/styles.scss +44 -36
  53. package/src/ui/a/index.js +0 -1
  54. package/src/ui/b/Page/common/PageHelmet/PageHelmet.jsx +6 -0
  55. package/src/ui/b/index.js +0 -1
  56. package/src/ui/f/fields/EditorInput/EditorInput.jsx +14 -1
  57. package/src/ui/f/fields/EditorInput/common/ColorPicker/ColorPicker.jsx +8 -3
  58. package/src/ui/f/fields/EditorInput/common/ToolbarPlugin/ToolbarPlugin.jsx +0 -14
  59. package/src/ui/f/fields/EditorInput/styles.scss +9 -2
  60. package/src/ui/f/fields/SelectInput/SelectInput.jsx +10 -2
  61. package/src/ui/f/fields/SelectInput/common/Single/Single.jsx +13 -1
  62. package/src/ui/f/fields/SelectInput/styles.scss +1 -1
  63. package/src/ui/g/ExpandableLexicalPreview/ExpandableLexicalPreview.jsx +180 -0
  64. package/src/ui/g/ExpandableLexicalPreview/common/NewWindowPortal/NewWindowPortal.jsx +80 -0
  65. package/src/ui/g/ExpandableLexicalPreview/common/NewWindowPortal/index.js +2 -0
  66. package/src/ui/g/ExpandableLexicalPreview/common/NewWindowPortal/styles.scss +9 -0
  67. package/src/ui/g/ExpandableLexicalPreview/common/index.js +1 -0
  68. package/src/ui/g/ExpandableLexicalPreview/styles.scss +34 -0
  69. package/src/ui/g/index.js +1 -0
  70. package/src/ui/index.js +1 -0
  71. package/tests/__snapshots__/Storyshots.test.js.snap +221 -99
  72. package/dist/cjs/a/LexicalPreview/LexicalPreview.js +0 -90
  73. package/dist/cjs/a/LexicalPreview/index.js +0 -13
  74. package/dist/cjs/a/LexicalPreview/styles.scss +0 -46
  75. package/dist/cjs/b/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.js +0 -112
  76. package/dist/cjs/b/ExpandableLexicalPreview/common/ExpandButton/index.js +0 -13
  77. package/dist/cjs/b/ExpandableLexicalPreview/common/index.js +0 -12
  78. package/dist/cjs/b/ExpandableLexicalPreview/styles.scss +0 -84
  79. package/dist/es/a/LexicalPreview/LexicalPreview.js +0 -80
  80. package/dist/es/a/LexicalPreview/index.js +0 -2
  81. package/dist/es/a/LexicalPreview/styles.scss +0 -46
  82. package/dist/es/b/ExpandableLexicalPreview/ExpandableLexicalPreview.js +0 -115
  83. package/dist/es/b/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.js +0 -102
  84. package/dist/es/b/ExpandableLexicalPreview/common/ExpandButton/index.js +0 -1
  85. package/dist/es/b/ExpandableLexicalPreview/common/index.js +0 -1
  86. package/dist/es/b/ExpandableLexicalPreview/styles.scss +0 -84
  87. package/src/stories/a/LexicalPreview.stories.jsx +0 -28
  88. package/src/ui/a/LexicalPreview/LexicalPreview.jsx +0 -109
  89. package/src/ui/a/LexicalPreview/index.js +0 -2
  90. package/src/ui/a/LexicalPreview/styles.scss +0 -46
  91. package/src/ui/b/ExpandableLexicalPreview/ExpandableLexicalPreview.jsx +0 -157
  92. package/src/ui/b/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.jsx +0 -123
  93. package/src/ui/b/ExpandableLexicalPreview/common/ExpandButton/index.js +0 -1
  94. package/src/ui/b/ExpandableLexicalPreview/common/index.js +0 -1
  95. package/src/ui/b/ExpandableLexicalPreview/styles.scss +0 -84
  96. /package/dist/cjs/{b → g}/ExpandableLexicalPreview/index.js +0 -0
  97. /package/dist/es/{b → g}/ExpandableLexicalPreview/index.js +0 -0
  98. /package/src/ui/{b → g}/ExpandableLexicalPreview/index.js +0 -0
@@ -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
  }
@@ -4,7 +4,7 @@
4
4
  @use "@pareto-engineering/styles/src/mixins";
5
5
  @use "@pareto-engineering/styles/src/globals" as *;
6
6
 
7
- $default-gap: 1.5rem;
7
+ $default-gap: 3rem;
8
8
 
9
9
  .#{bem.$base}.quote {
10
10
  border-left: 3px solid var(--x);
@@ -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, position, `x-${color}`].filter(e => e).join(' '),
37
- style: style,
38
- role: "tooltip"
39
- }, children);
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,47 +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
- background: var(--x);
11
- border: var(--theme-default-border-style) var(--ui-lines);
12
- border-radius: calc(var(--theme-default-border-radius) / 2);
13
- opacity: 0;
14
- padding: $default-block-padding $default-inline-padding;
15
- position: absolute;
16
- transform: translateX(var(--horizontal, 0)) translateY(var(--vertical, 0));
17
- transition: opacity .2s ease, transform .2s ease;
18
- width: $default-width;
19
- z-index: 10;
20
-
21
- :has(> &) {
22
- position: relative;
23
-
24
- &:is(:hover, :focus-visible, :active) > .#{bem.$base}.tooltip {
25
- opacity: 1;
26
- transition-delay: 200ms;
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%;
27
31
  }
28
- }
29
32
 
30
- &.top {
31
- --horizontal: -50%;
32
- bottom: calc(100% + $default-block-padding);
33
- left: 50%;
34
- }
33
+ &.right {
34
+ --vertical: 50%;
35
+ bottom: 50%;
36
+ left: calc(100% + $default-inline-padding);
37
+ }
35
38
 
36
- &.right {
37
- --vertical: 50%;
38
- bottom: 50%;
39
- left: calc(100% + $default-inline-padding);
40
- }
39
+ &.bottom {
40
+ --horizontal: -50%;
41
+ left: 50%;
42
+ top: calc(100% + $default-block-padding);
43
+ }
41
44
 
42
- &.bottom {
43
- --horizontal: -50%;
44
- left: 50%;
45
- top: calc(100% + $default-block-padding);
45
+ &.left {
46
+ --vertical: 50%;
47
+ bottom: 50%;
48
+ right: calc(100% + $default-inline-padding);
49
+ }
46
50
  }
47
51
 
48
- &.left {
49
- --vertical: 50%;
50
- bottom: 50%;
51
- right: calc(100% + $default-inline-padding);
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
+ }
52
60
  }
53
61
  }
@@ -81,12 +81,6 @@ Object.defineProperty(exports, "Label", {
81
81
  return _Label.Label;
82
82
  }
83
83
  });
84
- Object.defineProperty(exports, "LexicalPreview", {
85
- enumerable: true,
86
- get: function () {
87
- return _LexicalPreview.LexicalPreview;
88
- }
89
- });
90
84
  Object.defineProperty(exports, "LoadingCircle", {
91
85
  enumerable: true,
92
86
  get: function () {
@@ -221,6 +215,5 @@ var _TextSteps = require("./TextSteps");
221
215
  var _Removable = require("./Removable");
222
216
  var _ToggleSwitch = require("./ToggleSwitch");
223
217
  var _XMLEditor = require("./XMLEditor");
224
- var _LexicalPreview = require("./LexicalPreview");
225
218
  var _DatePicker = require("./DatePicker");
226
219
  var _Tooltip = require("./Tooltip");
@@ -121,6 +121,7 @@ const helmetMap = [{
121
121
  }];
122
122
  const PageHelmet = _ref => {
123
123
  let {
124
+ jsonld,
124
125
  ...props
125
126
  } = _ref;
126
127
  // const intl = useIntl()
@@ -162,7 +163,9 @@ const PageHelmet = _ref => {
162
163
  }, []), [props, context]);
163
164
  return /*#__PURE__*/React.createElement(_reactHelmetAsync.Helmet, {
164
165
  key: props.title
165
- }, HelmetContent);
166
+ }, HelmetContent, jsonld && /*#__PURE__*/React.createElement("script", {
167
+ type: "application/ld+json"
168
+ }, `${JSON.stringify(jsonld)}`));
166
169
  };
167
170
  PageHelmet.propTypes = {
168
171
  robots: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
@@ -15,12 +15,6 @@ Object.defineProperty(exports, "Card", {
15
15
  return _Card.Card;
16
16
  }
17
17
  });
18
- Object.defineProperty(exports, "ExpandableLexicalPreview", {
19
- enumerable: true,
20
- get: function () {
21
- return _ExpandableLexicalPreview.ExpandableLexicalPreview;
22
- }
23
- });
24
18
  Object.defineProperty(exports, "Logo", {
25
19
  enumerable: true,
26
20
  get: function () {
@@ -57,5 +51,4 @@ var _Page = require("./Page");
57
51
  var _SocialMediaButton = require("./SocialMediaButton");
58
52
  var _ThemeSelector = require("./ThemeSelector");
59
53
  var _Title = require("./Title");
60
- var _Card = require("./Card");
61
- var _ExpandableLexicalPreview = require("./ExpandableLexicalPreview");
54
+ var _Card = require("./Card");
@@ -22,6 +22,7 @@ var _list = require("@lexical/list");
22
22
  var _LexicalCheckListPlugin = require("@lexical/react/LexicalCheckListPlugin");
23
23
  var _richText = require("@lexical/rich-text");
24
24
  var _code = require("@lexical/code");
25
+ var _LexicalComposerContext = require("@lexical/react/LexicalComposerContext");
25
26
  var _propTypes = _interopRequireDefault(require("prop-types"));
26
27
  var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
27
28
  var _common = require("../../common");
@@ -37,11 +38,21 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
37
38
 
38
39
  const baseClassName = _exports.default.base;
39
40
  const componentClassName = 'editor-input';
41
+ const ExposeEditorStatePlugin = _ref => {
42
+ let {
43
+ setEditorState
44
+ } = _ref;
45
+ const [editor] = (0, _LexicalComposerContext.useLexicalComposerContext)();
46
+ (0, _react.useEffect)(() => {
47
+ setEditorState(editor);
48
+ }, [editor]);
49
+ return null;
50
+ };
40
51
 
41
52
  /**
42
53
  * This is the component description.
43
54
  */
44
- const EditorInput = _ref => {
55
+ const EditorInput = _ref2 => {
45
56
  let {
46
57
  id,
47
58
  className: userClassName,
@@ -57,9 +68,10 @@ const EditorInput = _ref => {
57
68
  description,
58
69
  disabled,
59
70
  showDebugger,
60
- stopPropagationKeys
71
+ stopPropagationKeys,
72
+ setEditorState
61
73
  // ...otherProps
62
- } = _ref;
74
+ } = _ref2;
63
75
  const formik = (0, _formik.useFormikContext)();
64
76
  const setInitialValue = () => {
65
77
  const value = formik.values[name];
@@ -142,7 +154,9 @@ const EditorInput = _ref => {
142
154
  ErrorBoundary: _LexicalErrorBoundary.default
143
155
  }), /*#__PURE__*/React.createElement(_LexicalListPlugin.ListPlugin, null), /*#__PURE__*/React.createElement(_LexicalCheckListPlugin.CheckListPlugin, null), /*#__PURE__*/React.createElement(_LexicalOnChangePlugin.OnChangePlugin, {
144
156
  onChange: onChange
145
- }), /*#__PURE__*/React.createElement(_LexicalLinkPlugin.LinkPlugin, null), /*#__PURE__*/React.createElement(_LexicalClickableLinkPlugin.default, null), /*#__PURE__*/React.createElement(_LexicalTabIndentationPlugin.TabIndentationPlugin, null), /*#__PURE__*/React.createElement(_LexicalHistoryPlugin.HistoryPlugin, null), stopPropagationKeys && /*#__PURE__*/React.createElement(_common2.StopPropagationPlugin, {
157
+ }), /*#__PURE__*/React.createElement(_LexicalLinkPlugin.LinkPlugin, null), /*#__PURE__*/React.createElement(_LexicalClickableLinkPlugin.default, null), /*#__PURE__*/React.createElement(_LexicalTabIndentationPlugin.TabIndentationPlugin, null), setEditorState && /*#__PURE__*/React.createElement(ExposeEditorStatePlugin, {
158
+ setEditorState: setEditorState
159
+ }), /*#__PURE__*/React.createElement(_LexicalHistoryPlugin.HistoryPlugin, null), stopPropagationKeys && /*#__PURE__*/React.createElement(_common2.StopPropagationPlugin, {
146
160
  stopPropagationKeys: stopPropagationKeys
147
161
  }), /*#__PURE__*/React.createElement(_common.FormDescription, {
148
162
  className: "s-1",
@@ -31,11 +31,11 @@ const ColorPicker = _ref => {
31
31
  className: userClassName,
32
32
  style,
33
33
  icon,
34
- color,
34
+ defaultColorHex,
35
35
  onChange
36
36
  // ...otherProps
37
37
  } = _ref;
38
- const [colorValue, setColor] = (0, _reactColorPalette.useColor)(color);
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
- // someProp:false
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"
@@ -32,6 +32,11 @@ $default-check-mark-dimensions: 1rem;
32
32
  border: $focus-border;
33
33
  }
34
34
  }
35
+
36
+ > .content-editable {
37
+ border-bottom-left-radius: $default-input-border-radius;
38
+ border-bottom-right-radius: $default-input-border-radius;
39
+ }
35
40
  }
36
41
 
37
42
  &.disabled {
@@ -40,6 +45,10 @@ $default-check-mark-dimensions: 1rem;
40
45
  color: var(--metadata);
41
46
  cursor: not-allowed;
42
47
  }
48
+
49
+ > .content-editable {
50
+ border-radius: $default-input-border-radius;
51
+ }
43
52
  }
44
53
 
45
54
  .color-menu-button {
@@ -70,8 +79,6 @@ $default-check-mark-dimensions: 1rem;
70
79
  > .content-editable {
71
80
  background: $default-background;
72
81
  border: $default-border;
73
- border-bottom-left-radius: $default-input-border-radius;
74
- border-bottom-right-radius: $default-input-border-radius;
75
82
  color: var(--y);
76
83
  height: var(--rows);
77
84
  outline: none;
@@ -33,6 +33,7 @@ const SelectInput = _ref => {
33
33
  labelColor,
34
34
  color,
35
35
  options,
36
+ hasDefault,
36
37
  validate,
37
38
  optional,
38
39
  description,
@@ -50,6 +51,7 @@ const SelectInput = _ref => {
50
51
  labelColor,
51
52
  color,
52
53
  options,
54
+ hasDefault,
53
55
  validate,
54
56
  optional,
55
57
  description,
@@ -134,10 +136,15 @@ SelectInput.propTypes = {
134
136
  /**
135
137
  * The placeholder of the select input
136
138
  */
137
- placeholder: _propTypes.default.string
139
+ placeholder: _propTypes.default.string,
140
+ /**
141
+ * Whether this select input has a default value(s)
142
+ */
143
+ hasDefault: _propTypes.default.bool
138
144
  };
139
145
  SelectInput.defaultProps = {
140
146
  disabled: false,
141
- multiple: false
147
+ multiple: false,
148
+ hasDefault: false
142
149
  };
143
150
  var _default = exports.default = /*#__PURE__*/(0, _react.memo)(SelectInput);
@@ -4,7 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var React = _interopRequireWildcard(require("react"));
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var React = _react;
8
9
  var _formik = require("formik");
9
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
10
11
  var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
@@ -32,6 +33,7 @@ const Single = _ref => {
32
33
  labelColor,
33
34
  color,
34
35
  options,
36
+ hasDefault,
35
37
  validate,
36
38
  optional,
37
39
  description,
@@ -40,10 +42,19 @@ const Single = _ref => {
40
42
  autoComplete
41
43
  // ...otherProps
42
44
  } = _ref;
43
- const [field] = (0, _formik.useField)({
45
+ const [field,, helpers] = (0, _formik.useField)({
44
46
  name,
45
47
  validate
46
48
  });
49
+ const {
50
+ setValue
51
+ } = helpers;
52
+ (0, _react.useEffect)(() => {
53
+ if (hasDefault && !field.value) {
54
+ const defaultOption = options.find(option => option.isDefault);
55
+ setValue(defaultOption?.value);
56
+ }
57
+ }, [hasDefault]);
47
58
  return /*#__PURE__*/React.createElement("div", {
48
59
  id: id,
49
60
  className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
@@ -83,7 +83,7 @@ $default-gap: var(--gap);
83
83
 
84
84
  /* stylelint-disable-next-line max-nesting-depth -- required */
85
85
  &:disabled {
86
- opacity: 0%;
86
+ background: transparent;
87
87
  }
88
88
  }
89
89
  }
@@ -6,21 +6,17 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var React = _react;
9
- var _LexicalComposer = require("@lexical/react/LexicalComposer");
10
- var _LexicalRichTextPlugin = require("@lexical/react/LexicalRichTextPlugin");
11
- var _LexicalContentEditable = require("@lexical/react/LexicalContentEditable");
12
- var _link = require("@lexical/link");
13
- var _list = require("@lexical/list");
9
+ var _formik = require("formik");
14
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
15
11
  var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
16
- var _Button = require("../Button");
17
- require("./styles.scss");
12
+ var _f = require("../../f");
13
+ var _b = require("../../b");
18
14
  var _common = require("./common");
15
+ require("./styles.scss");
19
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
17
  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); }
21
18
  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; }
22
19
  /* @pareto-engineering/generator-front 1.0.12 */
23
- /* eslint-disable import/no-extraneous-dependencies -- required here */
24
20
 
25
21
  // Local Definitions
26
22
 
@@ -36,57 +32,61 @@ const ExpandableLexicalPreview = _ref => {
36
32
  className: userClassName,
37
33
  style,
38
34
  nodes,
35
+ name,
39
36
  color,
40
37
  resize,
41
- title
38
+ pageTitle,
39
+ onBlock,
40
+ onOpen,
41
+ header
42
42
  // ...otherProps
43
43
  } = _ref;
44
- const initialConfig = {
45
- nameSpace: id,
46
- editable: false,
47
- editorState: nodes,
48
- theme: {
49
- text: {
50
- italic: 'italic',
51
- strikethrough: 'strikethrough',
52
- underline: 'underlined'
53
- }
54
- },
55
- nodes: [_link.AutoLinkNode, _link.LinkNode, _list.ListNode, _list.ListItemNode]
56
- };
57
- const [isExpanded, setIsExpanded] = (0, _react.useState)(false);
44
+ const [isCollapsed, setIsCollapsed] = (0, _react.useState)(false);
58
45
  const handleButtonClick = () => {
59
- setIsExpanded(!isExpanded);
46
+ setIsCollapsed(!isCollapsed);
60
47
  };
61
- const Content = (0, _react.useMemo)(() => /*#__PURE__*/React.createElement("div", {
62
- className: "lexical-content"
63
- }, /*#__PURE__*/React.createElement(_LexicalRichTextPlugin.RichTextPlugin, {
64
- contentEditable: /*#__PURE__*/React.createElement(_LexicalContentEditable.ContentEditable, {
65
- id: id,
66
- className: "content-editable"
67
- })
68
- }), /*#__PURE__*/React.createElement(_common.ExpandButton, {
69
- title: title,
70
- onResolve: handleButtonClick
71
- })), [id]);
72
- return /*#__PURE__*/React.createElement(_LexicalComposer.LexicalComposer, {
73
- initialConfig: initialConfig
48
+ return /*#__PURE__*/React.createElement(_formik.Formik, {
49
+ initialValues: {
50
+ [name]: nodes
51
+ }
74
52
  }, /*#__PURE__*/React.createElement("div", {
75
53
  id: id,
76
- className: [baseClassName, componentClassName, userClassName, `y-${color}`, isExpanded && 'collapsed'].filter(e => e).join(' '),
77
- style: {
78
- '--resize': resize,
79
- ...style
80
- }
81
- }, typeof title === 'string' ? /*#__PURE__*/React.createElement("p", {
54
+ className: [baseClassName, componentClassName, userClassName, `y-${color}`, isCollapsed && 'collapsed'].filter(e => e).join(' '),
55
+ style: style
56
+ }, typeof header === 'string' ? /*#__PURE__*/React.createElement("p", {
82
57
  className: "title h2"
83
- }, title) : title, isExpanded && /*#__PURE__*/React.createElement(_Button.Button, {
58
+ }, header) : header, isCollapsed ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_b.Button, {
84
59
  onClick: handleButtonClick,
85
60
  color: "background-far",
86
61
  isCompact: true
87
62
  }, /*#__PURE__*/React.createElement("span", {
88
63
  className: "ai-icon c-x x-paragraph"
89
- }, "C")), !isExpanded && Content));
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, {
75
+ name: name,
76
+ resize: resize,
77
+ disabled: true
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"))));
90
90
  };
91
91
  ExpandableLexicalPreview.propTypes = {
92
92
  /**
@@ -114,9 +114,21 @@ ExpandableLexicalPreview.propTypes = {
114
114
  */
115
115
  resize: _propTypes.default.string,
116
116
  /**
117
- * The title for the preview.
117
+ * The header for the preview component.
118
+ */
119
+ header: _propTypes.default.node,
120
+ /**
121
+ * The page title for the expanded preview.
122
+ */
123
+ pageTitle: _propTypes.default.string,
124
+ /**
125
+ * The name used to acces the nodes
126
+ */
127
+ name: _propTypes.default.string.isRequired,
128
+ /**
129
+ * The function to run when a new window portal can be opened
118
130
  */
119
- title: _propTypes.default.string
131
+ onBlock: _propTypes.default.func.isRequired
120
132
  };
121
133
  ExpandableLexicalPreview.defaultProps = {
122
134
  color: 'paragraph',