@pareto-engineering/design-system 4.0.0-alpha.78 → 4.0.0-alpha.79

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 (71) hide show
  1. package/dist/cjs/a/Quote/styles.scss +1 -1
  2. package/dist/cjs/a/Tooltip/styles.scss +3 -0
  3. package/dist/cjs/a/index.js +0 -7
  4. package/dist/cjs/b/Page/common/PageHelmet/PageHelmet.js +4 -1
  5. package/dist/cjs/b/index.js +1 -8
  6. package/dist/cjs/f/fields/EditorInput/EditorInput.js +18 -4
  7. package/dist/cjs/f/fields/EditorInput/styles.scss +9 -2
  8. package/dist/cjs/f/fields/SelectInput/SelectInput.js +9 -2
  9. package/dist/cjs/f/fields/SelectInput/common/Single/Single.js +13 -2
  10. package/dist/cjs/f/fields/SelectInput/styles.scss +1 -1
  11. package/dist/cjs/{b → g}/ExpandableLexicalPreview/ExpandableLexicalPreview.js +27 -42
  12. package/dist/cjs/{b → g}/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.js +6 -7
  13. package/dist/cjs/g/ExpandableLexicalPreview/styles.scss +34 -0
  14. package/dist/cjs/g/index.js +12 -0
  15. package/dist/cjs/index.js +11 -0
  16. package/dist/es/a/Quote/styles.scss +1 -1
  17. package/dist/es/a/Tooltip/styles.scss +3 -0
  18. package/dist/es/a/index.js +0 -1
  19. package/dist/es/b/Page/common/PageHelmet/PageHelmet.js +4 -1
  20. package/dist/es/b/index.js +1 -2
  21. package/dist/es/f/fields/EditorInput/EditorInput.js +16 -3
  22. package/dist/es/f/fields/EditorInput/styles.scss +9 -2
  23. package/dist/es/f/fields/SelectInput/SelectInput.js +9 -2
  24. package/dist/es/f/fields/SelectInput/common/Single/Single.js +12 -1
  25. package/dist/es/f/fields/SelectInput/styles.scss +1 -1
  26. package/dist/es/{b → g}/ExpandableLexicalPreview/ExpandableLexicalPreview.js +29 -45
  27. package/dist/es/{b → g}/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.js +18 -21
  28. package/dist/es/g/ExpandableLexicalPreview/styles.scss +34 -0
  29. package/dist/es/g/index.js +1 -0
  30. package/dist/es/index.js +1 -0
  31. package/package.json +3 -3
  32. package/src/stories/f/SelectInput.stories.jsx +18 -2
  33. package/src/stories/{b → g}/ExpandableLexicalPreview.stories.jsx +2 -1
  34. package/src/ui/a/Quote/styles.scss +1 -1
  35. package/src/ui/a/Tooltip/styles.scss +3 -0
  36. package/src/ui/a/index.js +0 -1
  37. package/src/ui/b/Page/common/PageHelmet/PageHelmet.jsx +6 -0
  38. package/src/ui/b/index.js +0 -1
  39. package/src/ui/f/fields/EditorInput/EditorInput.jsx +14 -1
  40. package/src/ui/f/fields/EditorInput/styles.scss +9 -2
  41. package/src/ui/f/fields/SelectInput/SelectInput.jsx +10 -2
  42. package/src/ui/f/fields/SelectInput/common/Single/Single.jsx +13 -1
  43. package/src/ui/f/fields/SelectInput/styles.scss +1 -1
  44. package/src/ui/{b → g}/ExpandableLexicalPreview/ExpandableLexicalPreview.jsx +43 -56
  45. package/src/ui/{b → g}/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.jsx +32 -36
  46. package/src/ui/g/ExpandableLexicalPreview/styles.scss +34 -0
  47. package/src/ui/g/index.js +1 -0
  48. package/src/ui/index.js +1 -0
  49. package/tests/__snapshots__/Storyshots.test.js.snap +164 -51
  50. package/dist/cjs/a/LexicalPreview/LexicalPreview.js +0 -90
  51. package/dist/cjs/a/LexicalPreview/index.js +0 -13
  52. package/dist/cjs/a/LexicalPreview/styles.scss +0 -46
  53. package/dist/cjs/b/ExpandableLexicalPreview/styles.scss +0 -84
  54. package/dist/es/a/LexicalPreview/LexicalPreview.js +0 -80
  55. package/dist/es/a/LexicalPreview/index.js +0 -2
  56. package/dist/es/a/LexicalPreview/styles.scss +0 -46
  57. package/dist/es/b/ExpandableLexicalPreview/styles.scss +0 -84
  58. package/src/stories/a/LexicalPreview.stories.jsx +0 -28
  59. package/src/ui/a/LexicalPreview/LexicalPreview.jsx +0 -109
  60. package/src/ui/a/LexicalPreview/index.js +0 -2
  61. package/src/ui/a/LexicalPreview/styles.scss +0 -46
  62. package/src/ui/b/ExpandableLexicalPreview/styles.scss +0 -84
  63. /package/dist/cjs/{b → g}/ExpandableLexicalPreview/common/ExpandButton/index.js +0 -0
  64. /package/dist/cjs/{b → g}/ExpandableLexicalPreview/common/index.js +0 -0
  65. /package/dist/cjs/{b → g}/ExpandableLexicalPreview/index.js +0 -0
  66. /package/dist/es/{b → g}/ExpandableLexicalPreview/common/ExpandButton/index.js +0 -0
  67. /package/dist/es/{b → g}/ExpandableLexicalPreview/common/index.js +0 -0
  68. /package/dist/es/{b → g}/ExpandableLexicalPreview/index.js +0 -0
  69. /package/src/ui/{b → g}/ExpandableLexicalPreview/common/ExpandButton/index.js +0 -0
  70. /package/src/ui/{b → g}/ExpandableLexicalPreview/common/index.js +0 -0
  71. /package/src/ui/{b → g}/ExpandableLexicalPreview/index.js +0 -0
@@ -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);
@@ -11,10 +11,12 @@ $default-width: var(--tooltip-width, 20rem);
11
11
  border: var(--theme-default-border-style) var(--ui-lines);
12
12
  border-radius: calc(var(--theme-default-border-radius) / 2);
13
13
  opacity: 0;
14
+ overflow: hidden;
14
15
  padding: $default-block-padding $default-inline-padding;
15
16
  position: absolute;
16
17
  transform: translateX(var(--horizontal, 0)) translateY(var(--vertical, 0));
17
18
  transition: opacity .2s ease, transform .2s ease;
19
+ visibility: hidden;
18
20
  width: $default-width;
19
21
  z-index: 10;
20
22
 
@@ -24,6 +26,7 @@ $default-width: var(--tooltip-width, 20rem);
24
26
  &:is(:hover, :focus-visible, :active) > .#{bem.$base}.tooltip {
25
27
  opacity: 1;
26
28
  transition-delay: 200ms;
29
+ visibility: visible;
27
30
  }
28
31
  }
29
32
 
@@ -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",
@@ -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,27 +6,22 @@ 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
 
27
23
  const baseClassName = _exports.default.base;
28
24
  const componentClassName = 'expandable-lexical-preview';
29
-
30
25
  /**
31
26
  * This is the component description.
32
27
  */
@@ -36,57 +31,43 @@ const ExpandableLexicalPreview = _ref => {
36
31
  className: userClassName,
37
32
  style,
38
33
  nodes,
34
+ name,
39
35
  color,
40
36
  resize,
41
37
  title
42
38
  // ...otherProps
43
39
  } = _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
- };
40
+ const [editorState, setEditorState] = (0, _react.useState)();
57
41
  const [isExpanded, setIsExpanded] = (0, _react.useState)(false);
58
42
  const handleButtonClick = () => {
59
43
  setIsExpanded(!isExpanded);
60
44
  };
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
45
+ return /*#__PURE__*/React.createElement(_formik.Formik, {
46
+ initialValues: {
47
+ [name]: nodes
48
+ }
74
49
  }, /*#__PURE__*/React.createElement("div", {
75
50
  id: id,
76
51
  className: [baseClassName, componentClassName, userClassName, `y-${color}`, isExpanded && 'collapsed'].filter(e => e).join(' '),
77
- style: {
78
- '--resize': resize,
79
- ...style
80
- }
52
+ style: style
81
53
  }, typeof title === 'string' ? /*#__PURE__*/React.createElement("p", {
82
54
  className: "title h2"
83
- }, title) : title, isExpanded && /*#__PURE__*/React.createElement(_Button.Button, {
55
+ }, title) : title, isExpanded ? /*#__PURE__*/React.createElement(_b.Button, {
84
56
  onClick: handleButtonClick,
85
57
  color: "background-far",
86
58
  isCompact: true
87
59
  }, /*#__PURE__*/React.createElement("span", {
88
60
  className: "ai-icon c-x x-paragraph"
89
- }, "C")), !isExpanded && Content));
61
+ }, "C")) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_f.EditorInput, {
62
+ name: name,
63
+ setEditorState: setEditorState,
64
+ resize: resize,
65
+ disabled: true
66
+ }), /*#__PURE__*/React.createElement(_common.ExpandButton, {
67
+ title: title,
68
+ onResolve: handleButtonClick,
69
+ editorState: editorState
70
+ }))));
90
71
  };
91
72
  ExpandableLexicalPreview.propTypes = {
92
73
  /**
@@ -116,7 +97,11 @@ ExpandableLexicalPreview.propTypes = {
116
97
  /**
117
98
  * The title for the preview.
118
99
  */
119
- title: _propTypes.default.string
100
+ title: _propTypes.default.string,
101
+ /**
102
+ * The name used to acces the nodes
103
+ */
104
+ name: _propTypes.default.string.isRequired
120
105
  };
121
106
  ExpandableLexicalPreview.defaultProps = {
122
107
  color: 'paragraph',
@@ -6,10 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var React = _interopRequireWildcard(require("react"));
8
8
  var _html = require("@lexical/html");
9
- var _LexicalComposerContext = require("@lexical/react/LexicalComposerContext");
10
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
10
  var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
12
- var _Button = require("../../../Button");
11
+ var _b = require("../../../../b");
13
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
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); }
15
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; }
@@ -30,19 +29,19 @@ const ExpandButton = _ref => {
30
29
  className: userClassName,
31
30
  style,
32
31
  onResolve,
33
- title
32
+ title,
33
+ editorState
34
34
  // ...otherProps
35
35
  } = _ref;
36
- const [editor] = (0, _LexicalComposerContext.useLexicalComposerContext)();
37
- return /*#__PURE__*/React.createElement(_Button.Button, {
36
+ return /*#__PURE__*/React.createElement(_b.Button, {
38
37
  id: id,
39
38
  className: [baseClassName, componentClassName, userClassName, 'ai-icon'].filter(e => e).join(' '),
40
39
  style: style,
41
40
  color: "background-far",
42
41
  isCompact: true,
43
42
  onClick: () => {
44
- editor.getEditorState().read(() => {
45
- const rawHtml = (0, _html.$generateHtmlFromNodes)(editor);
43
+ editorState.getEditorState().read(() => {
44
+ const rawHtml = (0, _html.$generateHtmlFromNodes)(editorState);
46
45
  const preview = window.open('', '_blank', 'width=600,height=600');
47
46
  preview.document.write(`<html>
48
47
  <title>${title || 'Preview'}</title>
@@ -0,0 +1,34 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+
3
+ @use "@pareto-engineering/bem";
4
+
5
+ .#{bem.$base}.expandable-lexical-preview {
6
+ display: flex;
7
+ flex-direction: column;
8
+ flex-wrap: wrap;
9
+ gap: var(--gap);
10
+ position: relative;
11
+ width: 100%;
12
+
13
+
14
+ &.collapsed {
15
+ flex-direction: row;
16
+ }
17
+
18
+ > .title {
19
+ margin: 0;
20
+ }
21
+
22
+ > .#{bem.$base}.button {
23
+ align-items: center;
24
+ border: 1px solid var(--outline-inputs);
25
+ display: flex;
26
+ }
27
+
28
+ > .#{bem.$base}.expand-button {
29
+ border: 1px solid var(--outline-inputs);
30
+ position: absolute;
31
+ right: 1em;
32
+ top: 5.5rem;
33
+ }
34
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "ExpandableLexicalPreview", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _ExpandableLexicalPreview.ExpandableLexicalPreview;
10
+ }
11
+ });
12
+ var _ExpandableLexicalPreview = require("./ExpandableLexicalPreview");
package/dist/cjs/index.js CHANGED
@@ -58,6 +58,17 @@ Object.keys(_f).forEach(function (key) {
58
58
  }
59
59
  });
60
60
  });
61
+ var _g = require("./g");
62
+ Object.keys(_g).forEach(function (key) {
63
+ if (key === "default" || key === "__esModule") return;
64
+ if (key in exports && exports[key] === _g[key]) return;
65
+ Object.defineProperty(exports, key, {
66
+ enumerable: true,
67
+ get: function () {
68
+ return _g[key];
69
+ }
70
+ });
71
+ });
61
72
  var _utils = require("./utils");
62
73
  Object.keys(_utils).forEach(function (key) {
63
74
  if (key === "default" || key === "__esModule") return;
@@ -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);
@@ -11,10 +11,12 @@ $default-width: var(--tooltip-width, 20rem);
11
11
  border: var(--theme-default-border-style) var(--ui-lines);
12
12
  border-radius: calc(var(--theme-default-border-radius) / 2);
13
13
  opacity: 0;
14
+ overflow: hidden;
14
15
  padding: $default-block-padding $default-inline-padding;
15
16
  position: absolute;
16
17
  transform: translateX(var(--horizontal, 0)) translateY(var(--vertical, 0));
17
18
  transition: opacity .2s ease, transform .2s ease;
19
+ visibility: hidden;
18
20
  width: $default-width;
19
21
  z-index: 10;
20
22
 
@@ -24,6 +26,7 @@ $default-width: var(--tooltip-width, 20rem);
24
26
  &:is(:hover, :focus-visible, :active) > .#{bem.$base}.tooltip {
25
27
  opacity: 1;
26
28
  transition-delay: 200ms;
29
+ visibility: visible;
27
30
  }
28
31
  }
29
32
 
@@ -24,6 +24,5 @@ export { TextSteps } from "./TextSteps";
24
24
  export { Removable } from "./Removable";
25
25
  export { ToggleSwitch } from "./ToggleSwitch";
26
26
  export { XMLEditor } from "./XMLEditor";
27
- export { LexicalPreview } from "./LexicalPreview";
28
27
  export { DatePicker } from "./DatePicker";
29
28
  export { Tooltip } from "./Tooltip";
@@ -110,6 +110,7 @@ const helmetMap = [{
110
110
  })
111
111
  }];
112
112
  const PageHelmet = ({
113
+ jsonld,
113
114
  ...props
114
115
  }) => {
115
116
  // const intl = useIntl()
@@ -150,7 +151,9 @@ const PageHelmet = ({
150
151
  }, []), [props, context]);
151
152
  return /*#__PURE__*/React.createElement(Helmet, {
152
153
  key: props.title
153
- }, HelmetContent);
154
+ }, HelmetContent, jsonld && /*#__PURE__*/React.createElement("script", {
155
+ type: "application/ld+json"
156
+ }, `${JSON.stringify(jsonld)}`));
154
157
  };
155
158
  PageHelmet.propTypes = {
156
159
  robots: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
@@ -4,5 +4,4 @@ export { Page } from "./Page";
4
4
  export { SocialMediaButton } from "./SocialMediaButton";
5
5
  export { ThemeSelector } from "./ThemeSelector";
6
6
  export { Title } from "./Title";
7
- export { Card } from "./Card";
8
- export { ExpandableLexicalPreview } from "./ExpandableLexicalPreview";
7
+ export { Card } from "./Card";
@@ -1,7 +1,7 @@
1
1
  /* @pareto-engineering/generator-front 1.0.12 */
2
2
  /* eslint-disable import/no-extraneous-dependencies -- required here */
3
3
  import * as React from 'react';
4
- import { memo } from 'react';
4
+ import { memo, useEffect } from 'react';
5
5
  import { useFormikContext } from 'formik';
6
6
  import { LexicalComposer } from '@lexical/react/LexicalComposer';
7
7
  import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin';
@@ -18,6 +18,7 @@ import { ListItemNode, ListNode } from '@lexical/list';
18
18
  import { CheckListPlugin } from '@lexical/react/LexicalCheckListPlugin';
19
19
  import { HeadingNode, QuoteNode } from '@lexical/rich-text';
20
20
  import { CodeHighlightNode, CodeNode } from '@lexical/code';
21
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
21
22
  import PropTypes from 'prop-types';
22
23
  import styleNames from '@pareto-engineering/bem/exports';
23
24
 
@@ -28,6 +29,15 @@ import { ToolbarPlugin, TreeViewPlugin, StopPropagationPlugin } from "./common";
28
29
  import "./styles.scss";
29
30
  const baseClassName = styleNames.base;
30
31
  const componentClassName = 'editor-input';
32
+ const ExposeEditorStatePlugin = ({
33
+ setEditorState
34
+ }) => {
35
+ const [editor] = useLexicalComposerContext();
36
+ useEffect(() => {
37
+ setEditorState(editor);
38
+ }, [editor]);
39
+ return null;
40
+ };
31
41
 
32
42
  /**
33
43
  * This is the component description.
@@ -47,7 +57,8 @@ const EditorInput = ({
47
57
  description,
48
58
  disabled,
49
59
  showDebugger,
50
- stopPropagationKeys
60
+ stopPropagationKeys,
61
+ setEditorState
51
62
  // ...otherProps
52
63
  }) => {
53
64
  const formik = useFormikContext();
@@ -132,7 +143,9 @@ const EditorInput = ({
132
143
  ErrorBoundary: LexicalErrorBoundary
133
144
  }), /*#__PURE__*/React.createElement(ListPlugin, null), /*#__PURE__*/React.createElement(CheckListPlugin, null), /*#__PURE__*/React.createElement(OnChangePlugin, {
134
145
  onChange: onChange
135
- }), /*#__PURE__*/React.createElement(LinkPlugin, null), /*#__PURE__*/React.createElement(LexicalClickableLinkPlugin, null), /*#__PURE__*/React.createElement(TabIndentationPlugin, null), /*#__PURE__*/React.createElement(HistoryPlugin, null), stopPropagationKeys && /*#__PURE__*/React.createElement(StopPropagationPlugin, {
146
+ }), /*#__PURE__*/React.createElement(LinkPlugin, null), /*#__PURE__*/React.createElement(LexicalClickableLinkPlugin, null), /*#__PURE__*/React.createElement(TabIndentationPlugin, null), setEditorState && /*#__PURE__*/React.createElement(ExposeEditorStatePlugin, {
147
+ setEditorState: setEditorState
148
+ }), /*#__PURE__*/React.createElement(HistoryPlugin, null), stopPropagationKeys && /*#__PURE__*/React.createElement(StopPropagationPlugin, {
136
149
  stopPropagationKeys: stopPropagationKeys
137
150
  }), /*#__PURE__*/React.createElement(FormDescription, {
138
151
  className: "s-1",
@@ -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;