@appquality/unguess-design-system 2.10.61 → 2.10.64

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/CHANGELOG.md CHANGED
@@ -1,3 +1,40 @@
1
+ # v2.10.64 (Wed Jul 27 2022)
2
+
3
+ #### ⚠️ Pushed to `master`
4
+
5
+ - Merge branch 'master' of github.com:AppQuality/unguess-design-system ([@cannarocks](https://github.com/cannarocks))
6
+ - fix(editor): remove min height when editable is false ([@cannarocks](https://github.com/cannarocks))
7
+
8
+ #### Authors: 1
9
+
10
+ - Luca Cannarozzo ([@cannarocks](https://github.com/cannarocks))
11
+
12
+ ---
13
+
14
+ # v2.10.63 (Wed Jul 27 2022)
15
+
16
+ #### ⚠️ Pushed to `master`
17
+
18
+ - feat(editor): add read only style ([@cannarocks](https://github.com/cannarocks))
19
+
20
+ #### Authors: 1
21
+
22
+ - Luca Cannarozzo ([@cannarocks](https://github.com/cannarocks))
23
+
24
+ ---
25
+
26
+ # v2.10.62 (Fri Jul 22 2022)
27
+
28
+ #### ⚠️ Pushed to `master`
29
+
30
+ - fix(editor): Trigger save on ctrl+click or cmd+click ([@cannarocks](https://github.com/cannarocks))
31
+
32
+ #### Authors: 1
33
+
34
+ - Luca Cannarozzo ([@cannarocks](https://github.com/cannarocks))
35
+
36
+ ---
37
+
1
38
  # v2.10.61 (Fri Jul 22 2022)
2
39
 
3
40
  #### 🐛 Bug Fix
package/build/index.js CHANGED
@@ -1268,7 +1268,7 @@ var EditorFooter = function (_a) {
1268
1268
  };
1269
1269
  var templateObject_1$S, templateObject_2$m;
1270
1270
 
1271
- var EditorContainer = styled__default["default"].div(templateObject_1$R || (templateObject_1$R = __makeTemplateObject(["\n border: 2px solid ", ";\n border-radius: ", ";\n &:focus-within {\n outline: ", ";\n outline-style: solid;\n }\n\n .ProseMirror {\n padding: ", ";\n background-color: #fff;\n min-height: 100px;\n outline: none;\n\n ", "\n }\n"], ["\n border: 2px solid ", ";\n border-radius: ", ";\n &:focus-within {\n outline: ", ";\n outline-style: solid;\n }\n\n .ProseMirror {\n padding: ", ";\n background-color: #fff;\n min-height: 100px;\n outline: none;\n\n ", "\n }\n"])), function (_a) {
1271
+ var EditorContainer = styled__default["default"].div(templateObject_1$R || (templateObject_1$R = __makeTemplateObject(["\n border: 2px solid ", ";\n border-radius: ", ";\n &:focus-within {\n outline: ", ";\n outline-style: solid;\n }\n\n ", "\n\n .ProseMirror {\n padding: ", ";\n background-color: #fff;\n min-height: 100px;\n outline: none;\n\n ", "\n\n ", "\n }\n"], ["\n border: 2px solid ", ";\n border-radius: ", ";\n &:focus-within {\n outline: ", ";\n outline-style: solid;\n }\n\n ", "\n\n .ProseMirror {\n padding: ", ";\n background-color: #fff;\n min-height: 100px;\n outline: none;\n\n ", "\n\n ", "\n }\n"])), function (_a) {
1272
1272
  var theme = _a.theme;
1273
1273
  return theme.colors.primaryHue;
1274
1274
  }, function (_a) {
@@ -1277,10 +1277,18 @@ var EditorContainer = styled__default["default"].div(templateObject_1$R || (temp
1277
1277
  }, function (_a) {
1278
1278
  var theme = _a.theme;
1279
1279
  return theme.palette.blue["300"];
1280
+ }, function (_a) {
1281
+ var editable = _a.editable;
1282
+ return !editable &&
1283
+ "\n border: none;\n outline: none;\n \n ";
1280
1284
  }, function (_a) {
1281
1285
  var theme = _a.theme;
1282
1286
  return theme.space.md;
1283
- }, editorStyle);
1287
+ }, editorStyle, function (_a) {
1288
+ var editable = _a.editable;
1289
+ return !editable &&
1290
+ "\n background: transparent;\n border: none;\n outline: none;\n padding: 0;\n min-height: 0;\n ";
1291
+ });
1284
1292
  /**
1285
1293
  * Editor is a wrapper around TipTap/ProseMirror
1286
1294
  * <br>
@@ -1294,11 +1302,12 @@ var EditorContainer = styled__default["default"].div(templateObject_1$R || (temp
1294
1302
  - Simple text input, use textarea instead.
1295
1303
  */
1296
1304
  var Editor = function (_a) {
1297
- var onSave = _a.onSave, headerTitle = _a.headerTitle, footerSaveText = _a.footerSaveText, props = __rest(_a, ["onSave", "headerTitle", "footerSaveText"]);
1298
- var children = props.children, placeholderOptions = props.placeholderOptions, hasInlineMenu = props.hasInlineMenu, bubbleOptions = props.bubbleOptions;
1305
+ var onSave = _a.onSave, headerTitle = _a.headerTitle, footerSaveText = _a.footerSaveText, placeholderOptions = _a.placeholderOptions, props = __rest(_a, ["onSave", "headerTitle", "footerSaveText", "placeholderOptions"]);
1306
+ var children = props.children, hasInlineMenu = props.hasInlineMenu, bubbleOptions = props.bubbleOptions, editable = props.editable;
1307
+ var isEditable = editable !== undefined ? editable : true;
1299
1308
  var _b = React.useState(), activeEditor = _b[0], setActiveEditor = _b[1];
1300
1309
  var onKeyDown = function (event) {
1301
- if (event.ctrlKey && event.key === "Enter") {
1310
+ if ((event.ctrlKey || event.metaKey) && event.key === "Enter") {
1302
1311
  if (onSave && activeEditor)
1303
1312
  onSave(activeEditor);
1304
1313
  }
@@ -1315,7 +1324,7 @@ var Editor = function (_a) {
1315
1324
  } }, placeholderOptions)),
1316
1325
  ], content: children || "", editorProps: {
1317
1326
  handleKeyDown: function (view, event) {
1318
- if (event.ctrlKey && event.key === "Enter") {
1327
+ if ((event.ctrlKey || event.metaKey) && event.key === "Enter") {
1319
1328
  return true;
1320
1329
  }
1321
1330
  return false;
@@ -1329,7 +1338,7 @@ var Editor = function (_a) {
1329
1338
  var editor = _a.editor;
1330
1339
  return setActiveEditor(editor);
1331
1340
  });
1332
- return (jsxRuntime.jsxs(EditorContainer, { children: [jsxRuntime.jsx(EditorHeader, { title: headerTitle }), hasInlineMenu && (jsxRuntime.jsx(FloatingMenu, { editor: ed, tippyOptions: __assign({}, bubbleOptions) })), jsxRuntime.jsx(react.EditorContent, { editor: ed, onKeyDown: onKeyDown }), jsxRuntime.jsx(EditorFooter, { saveText: footerSaveText })] }));
1341
+ return (jsxRuntime.jsxs(EditorContainer, __assign({ editable: isEditable }, { children: [isEditable && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(EditorHeader, { title: headerTitle }), hasInlineMenu && (jsxRuntime.jsx(FloatingMenu, { editor: ed, tippyOptions: __assign({}, bubbleOptions) }))] })), jsxRuntime.jsx(react.EditorContent, { editor: ed, onKeyDown: onKeyDown }), isEditable && jsxRuntime.jsx(EditorFooter, { saveText: footerSaveText })] })));
1333
1342
  };
1334
1343
  var templateObject_1$R;
1335
1344
 
@@ -12,5 +12,5 @@ import { PropsWithChildren } from "react";
12
12
  Not for this:
13
13
  - Simple text input, use textarea instead.
14
14
  */
15
- declare const Editor: ({ onSave, headerTitle, footerSaveText, ...props }: PropsWithChildren<EditorArgs>) => JSX.Element | null;
15
+ declare const Editor: ({ onSave, headerTitle, footerSaveText, placeholderOptions, ...props }: PropsWithChildren<EditorArgs>) => JSX.Element | null;
16
16
  export { Editor };
@@ -7,5 +7,6 @@ interface EditorStoryArgs extends EditorArgs {
7
7
  export declare const Default: Story<EditorStoryArgs>;
8
8
  export declare const Placeholder: Story<EditorStoryArgs>;
9
9
  export declare const BubbleMenu: Story<EditorStoryArgs>;
10
- declare const _default: ComponentMeta<({ onSave, headerTitle, footerSaveText, ...props }: import("react").PropsWithChildren<EditorArgs>) => JSX.Element | null>;
10
+ export declare const ReadOnly: Story<EditorStoryArgs>;
11
+ declare const _default: ComponentMeta<({ onSave, headerTitle, footerSaveText, placeholderOptions, ...props }: import("react").PropsWithChildren<EditorArgs>) => JSX.Element | null>;
11
12
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appquality/unguess-design-system",
3
- "version": "2.10.61",
3
+ "version": "2.10.64",
4
4
  "dependencies": {
5
5
  "@tiptap/extension-bubble-menu": "^2.0.0-beta.61",
6
6
  "@tiptap/extension-placeholder": "^2.0.0-beta.53",