@appquality/unguess-design-system 2.10.62 → 2.10.63

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,15 @@
1
+ # v2.10.63 (Wed Jul 27 2022)
2
+
3
+ #### ⚠️ Pushed to `master`
4
+
5
+ - feat(editor): add read only style ([@cannarocks](https://github.com/cannarocks))
6
+
7
+ #### Authors: 1
8
+
9
+ - Luca Cannarozzo ([@cannarocks](https://github.com/cannarocks))
10
+
11
+ ---
12
+
1
13
  # v2.10.62 (Fri Jul 22 2022)
2
14
 
3
15
  #### ⚠️ Pushed to `master`
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 ";
1291
+ });
1284
1292
  /**
1285
1293
  * Editor is a wrapper around TipTap/ProseMirror
1286
1294
  * <br>
@@ -1295,7 +1303,8 @@ var EditorContainer = styled__default["default"].div(templateObject_1$R || (temp
1295
1303
  */
1296
1304
  var Editor = function (_a) {
1297
1305
  var onSave = _a.onSave, headerTitle = _a.headerTitle, footerSaveText = _a.footerSaveText, placeholderOptions = _a.placeholderOptions, props = __rest(_a, ["onSave", "headerTitle", "footerSaveText", "placeholderOptions"]);
1298
- var children = props.children, hasInlineMenu = props.hasInlineMenu, bubbleOptions = props.bubbleOptions;
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
1310
  if ((event.ctrlKey || event.metaKey) && event.key === "Enter") {
@@ -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
 
@@ -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
+ export declare const ReadOnly: Story<EditorStoryArgs>;
10
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.62",
3
+ "version": "2.10.63",
4
4
  "dependencies": {
5
5
  "@tiptap/extension-bubble-menu": "^2.0.0-beta.61",
6
6
  "@tiptap/extension-placeholder": "^2.0.0-beta.53",