@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
@@ -0,0 +1,126 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ import * as React from 'react';
3
+ import { useState } from 'react';
4
+ import { Formik } from 'formik';
5
+ import PropTypes from 'prop-types';
6
+ import styleNames from '@pareto-engineering/bem/exports';
7
+
8
+ // Local Definitions
9
+ import { EditorInput } from "../../f";
10
+ import { Button } from "../../b";
11
+ import { NewWindowPortal } from "./common";
12
+ import "./styles.scss";
13
+ const baseClassName = styleNames.base;
14
+ const componentClassName = 'expandable-lexical-preview';
15
+
16
+ /**
17
+ * This is the component description.
18
+ */
19
+ const ExpandableLexicalPreview = ({
20
+ id,
21
+ className: userClassName,
22
+ style,
23
+ nodes,
24
+ name,
25
+ color,
26
+ resize,
27
+ pageTitle,
28
+ onBlock,
29
+ onOpen,
30
+ header
31
+ // ...otherProps
32
+ }) => {
33
+ const [isCollapsed, setIsCollapsed] = useState(false);
34
+ const handleButtonClick = () => {
35
+ setIsCollapsed(!isCollapsed);
36
+ };
37
+ return /*#__PURE__*/React.createElement(Formik, {
38
+ initialValues: {
39
+ [name]: nodes
40
+ }
41
+ }, /*#__PURE__*/React.createElement("div", {
42
+ id: id,
43
+ className: [baseClassName, componentClassName, userClassName, `y-${color}`, isCollapsed && 'collapsed'].filter(e => e).join(' '),
44
+ style: style
45
+ }, typeof header === 'string' ? /*#__PURE__*/React.createElement("p", {
46
+ className: "title h2"
47
+ }, header) : header, isCollapsed ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
48
+ onClick: handleButtonClick,
49
+ color: "background-far",
50
+ isCompact: true
51
+ }, /*#__PURE__*/React.createElement("span", {
52
+ className: "ai-icon c-x x-paragraph"
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, {
64
+ name: name,
65
+ resize: resize,
66
+ disabled: true
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"))));
79
+ };
80
+ ExpandableLexicalPreview.propTypes = {
81
+ /**
82
+ * The HTML id for this element
83
+ */
84
+ id: PropTypes.string,
85
+ /**
86
+ * The HTML class names for this element
87
+ */
88
+ className: PropTypes.string,
89
+ /**
90
+ * The React-written, css properties for this element.
91
+ */
92
+ style: PropTypes.objectOf(PropTypes.string),
93
+ /**
94
+ * Color of the text
95
+ */
96
+ color: PropTypes.string,
97
+ /**
98
+ * The nodes to render in the form of a json string
99
+ */
100
+ nodes: PropTypes.string,
101
+ /**
102
+ * The resize property of the textarea
103
+ */
104
+ resize: PropTypes.string,
105
+ /**
106
+ * The header for the preview component.
107
+ */
108
+ header: PropTypes.node,
109
+ /**
110
+ * The page title for the expanded preview.
111
+ */
112
+ pageTitle: PropTypes.string,
113
+ /**
114
+ * The name used to acces the nodes
115
+ */
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
121
+ };
122
+ ExpandableLexicalPreview.defaultProps = {
123
+ color: 'paragraph',
124
+ resize: 'vertical'
125
+ };
126
+ export default ExpandableLexicalPreview;
@@ -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;
@@ -0,0 +1,2 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ export { default as NewWindowPortal } from "./NewWindowPortal";
@@ -0,0 +1,9 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+
3
+ @use "@pareto-engineering/bem";
4
+
5
+ .#{bem.$base}.new-window-portal {
6
+ background-color: var(--background-far);
7
+ height: 100%;
8
+ width: 100%;
9
+ }
@@ -0,0 +1 @@
1
+ export { NewWindowPortal } from "./NewWindowPortal";
@@ -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 @@
1
+ export { ExpandableLexicalPreview } from "./ExpandableLexicalPreview";
package/dist/es/index.js CHANGED
@@ -3,5 +3,6 @@ export * from "./b";
3
3
  export * from "./c";
4
4
  export * from "./d";
5
5
  export * from "./f";
6
+ export * from "./g";
6
7
  export * from "./utils";
7
8
  export * from "./test";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pareto-engineering/design-system",
3
- "version": "4.0.0-alpha.78",
3
+ "version": "4.0.0-alpha.81",
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.78",
62
+ "@pareto-engineering/assets": "^4.0.0-alpha.81",
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.73",
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": "2232d74831fee703583d210b9d083f357440b21a"
85
+ "gitHead": "b44cdb0922a67109aaf2fa1dce4943882ce3a512"
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
- id:ariaDescribedby,
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
- <div aria-describedby={ariaDescribedby}>
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
  }
@@ -11,9 +11,9 @@ export default {
11
11
  // Item:SelectInput.Item
12
12
  },
13
13
  decorators:[
14
- (storyfn) => (
14
+ (storyfn, { args }) => (
15
15
  <Formik
16
- initialValues={{ workType: '' }}
16
+ initialValues={{ workType: args?.testOverride ? 'Training' : '' }}
17
17
  >
18
18
  <Form>
19
19
  { storyfn() }
@@ -108,3 +108,19 @@ Multiple.args = {
108
108
  placeholder:'Type to search',
109
109
  multiple :true,
110
110
  }
111
+
112
+ export const WithDefault = {
113
+ args:{
114
+ ...Base.args,
115
+ hasDefault:true,
116
+ options :[...Base.args.options.map((e, i) => (i === 2 ? { ...e, isDefault: true } : e))],
117
+ },
118
+ }
119
+
120
+ export const WithDefaultNoOverride = {
121
+ ...WithDefault,
122
+ args:{
123
+ ...WithDefault.args,
124
+ testOverride:true,
125
+ },
126
+ }
@@ -1,16 +1,22 @@
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
- title :'b/ExpandableLexicalPreview',
7
+ title :'g/ExpandableLexicalPreview',
8
8
  component :ExpandableLexicalPreview,
9
9
  subcomponents:{
10
10
  // Item:TextareaInput.Item
11
11
  },
12
- decorators:[],
13
- argTypes :{
12
+ decorators:[
13
+ (storyfn) => (
14
+ <AppContextProvider>
15
+ { storyfn() }
16
+ </AppContextProvider>
17
+ ),
18
+ ],
19
+ argTypes:{
14
20
  color:{ control: 'text' },
15
21
  },
16
22
  }
@@ -25,5 +31,7 @@ const Template = (args) => (
25
31
  export const Base = Template.bind({})
26
32
  Base.args = {
27
33
  nodes,
28
- title:'Task Instructions',
34
+ name :'taskDescription',
35
+ pageTitle:'Task Instructions',
36
+ header :'Task Instructions',
29
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
  }
@@ -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);
@@ -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
- role="tooltip"
41
+
41
42
  >
42
- {children}
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,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
  }
package/src/ui/a/index.js CHANGED
@@ -26,6 +26,5 @@ export { TextSteps } from './TextSteps'
26
26
  export { Removable } from './Removable'
27
27
  export { ToggleSwitch } from './ToggleSwitch'
28
28
  export { XMLEditor } from './XMLEditor'
29
- export { LexicalPreview } from './LexicalPreview'
30
29
  export { DatePicker } from './DatePicker'
31
30
  export { Tooltip } from './Tooltip'
@@ -172,6 +172,7 @@ const helmetMap = [
172
172
  ]
173
173
 
174
174
  const PageHelmet = ({
175
+ jsonld,
175
176
  ...props
176
177
  }) => {
177
178
  // const intl = useIntl()
@@ -217,6 +218,11 @@ const PageHelmet = ({
217
218
  return (
218
219
  <Helmet key={props.title}>
219
220
  { HelmetContent }
221
+ { jsonld && (
222
+ <script type="application/ld+json">
223
+ {`${JSON.stringify(jsonld)}`}
224
+ </script>
225
+ )}
220
226
  </Helmet>
221
227
  )
222
228
  }
package/src/ui/b/index.js CHANGED
@@ -5,4 +5,3 @@ export { SocialMediaButton } from './SocialMediaButton'
5
5
  export { ThemeSelector } from './ThemeSelector'
6
6
  export { Title } from './Title'
7
7
  export { Card } from './Card'
8
- export { ExpandableLexicalPreview } from './ExpandableLexicalPreview'
@@ -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
 
22
23
  import PropTypes from 'prop-types'
23
24
  import styleNames from '@pareto-engineering/bem/exports'
@@ -32,6 +33,15 @@ import './styles.scss'
32
33
  const baseClassName = styleNames.base
33
34
  const componentClassName = 'editor-input'
34
35
 
36
+ const ExposeEditorStatePlugin = ({ setEditorState }) => {
37
+ const [editor] = useLexicalComposerContext()
38
+ useEffect(() => {
39
+ setEditorState(editor)
40
+ }, [editor])
41
+
42
+ return null
43
+ }
44
+
35
45
  /**
36
46
  * This is the component description.
37
47
  */
@@ -51,12 +61,14 @@ const EditorInput = ({
51
61
  disabled,
52
62
  showDebugger,
53
63
  stopPropagationKeys,
64
+ setEditorState,
54
65
  // ...otherProps
55
66
  }) => {
56
67
  const formik = useFormikContext()
57
68
 
58
69
  const setInitialValue = () => {
59
70
  const value = formik.values[name]
71
+
60
72
  try {
61
73
  JSON.parse(value)
62
74
  return value
@@ -175,6 +187,7 @@ const EditorInput = ({
175
187
  <LinkPlugin />
176
188
  <LexicalClickableLinkPlugin />
177
189
  <TabIndentationPlugin />
190
+ {setEditorState && <ExposeEditorStatePlugin setEditorState={setEditorState} />}
178
191
  <HistoryPlugin />
179
192
  { stopPropagationKeys && (
180
193
  <StopPropagationPlugin stopPropagationKeys={stopPropagationKeys} />