@appquality/unguess-design-system 2.10.64 → 2.10.67

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,41 @@
1
+ # v2.10.67 (Fri Jul 29 2022)
2
+
3
+ #### ⚠️ Pushed to `master`
4
+
5
+ - feat(editor): Add characters count feature ([@cannarocks](https://github.com/cannarocks))
6
+
7
+ #### Authors: 1
8
+
9
+ - Luca Cannarozzo ([@cannarocks](https://github.com/cannarocks))
10
+
11
+ ---
12
+
13
+ # v2.10.66 (Fri Jul 29 2022)
14
+
15
+ #### ⚠️ Pushed to `master`
16
+
17
+ - Merge branch 'master' of github.com:AppQuality/unguess-design-system ([@cannarocks](https://github.com/cannarocks))
18
+ - chore(theme): update dangerHue shade ([@cannarocks](https://github.com/cannarocks))
19
+
20
+ #### Authors: 1
21
+
22
+ - Luca Cannarozzo ([@cannarocks](https://github.com/cannarocks))
23
+
24
+ ---
25
+
26
+ # v2.10.65 (Fri Jul 29 2022)
27
+
28
+ #### ⚠️ Pushed to `master`
29
+
30
+ - Merge branch 'master' of github.com:AppQuality/unguess-design-system ([@cannarocks](https://github.com/cannarocks))
31
+ - feat(editor): Add validation support ([@cannarocks](https://github.com/cannarocks))
32
+
33
+ #### Authors: 1
34
+
35
+ - Luca Cannarozzo ([@cannarocks](https://github.com/cannarocks))
36
+
37
+ ---
38
+
1
39
  # v2.10.64 (Wed Jul 27 2022)
2
40
 
3
41
  #### ⚠️ Pushed to `master`
package/build/index.js CHANGED
@@ -22,6 +22,7 @@ var react = require('@tiptap/react');
22
22
  var Typography = require('@tiptap/extension-typography');
23
23
  var StarterKit = require('@tiptap/starter-kit');
24
24
  var Placeholder = require('@tiptap/extension-placeholder');
25
+ var CharacterCount = require('@tiptap/extension-character-count');
25
26
  var reactForms = require('@zendeskgarden/react-forms');
26
27
  var reactGrid = require('@zendeskgarden/react-grid');
27
28
  var reactChrome = require('@zendeskgarden/react-chrome');
@@ -56,6 +57,7 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
56
57
  var Typography__default = /*#__PURE__*/_interopDefaultLegacy(Typography);
57
58
  var StarterKit__default = /*#__PURE__*/_interopDefaultLegacy(StarterKit);
58
59
  var Placeholder__default = /*#__PURE__*/_interopDefaultLegacy(Placeholder);
60
+ var CharacterCount__default = /*#__PURE__*/_interopDefaultLegacy(CharacterCount);
59
61
 
60
62
  /******************************************************************************
61
63
  Copyright (c) Microsoft Corporation.
@@ -257,7 +259,7 @@ var components = __assign(__assign({}, reactTheming.DEFAULT_THEME.components), {
257
259
  imgMaxHeight: "214px",
258
260
  } });
259
261
 
260
- var theme = __assign(__assign({}, reactTheming.DEFAULT_THEME), { colors: __assign(__assign({}, reactTheming.DEFAULT_THEME.colors), { primaryHue: palette.blue[600], warningHue: palette.yellow[600], successHue: palette.teal["M600"], dangerHue: palette.red[400], accentHue: palette.water[600] }), palette: palette, fonts: __assign(__assign({}, reactTheming.DEFAULT_THEME.fonts), { system: '"Poppins",sans-serif,Helvetica,Arial,sans-serif' }), fontWeights: __assign(__assign({}, reactTheming.DEFAULT_THEME.fontWeights), { semibold: 500 }), gradients: gradients, borderRadii: __assign(__assign({}, reactTheming.DEFAULT_THEME.borderRadii), { lg: "8px", xl: "16px", xxl: "32px" }), components: components, shadows: __assign(__assign({}, reactTheming.DEFAULT_THEME.shadows), { boxShadow: boxShadow }) });
262
+ var theme = __assign(__assign({}, reactTheming.DEFAULT_THEME), { colors: __assign(__assign({}, reactTheming.DEFAULT_THEME.colors), { primaryHue: palette.blue[600], warningHue: palette.yellow[600], successHue: palette.teal["M600"], dangerHue: palette.red[600], accentHue: palette.water[600] }), palette: palette, fonts: __assign(__assign({}, reactTheming.DEFAULT_THEME.fonts), { system: '"Poppins",sans-serif,Helvetica,Arial,sans-serif' }), fontWeights: __assign(__assign({}, reactTheming.DEFAULT_THEME.fontWeights), { semibold: 500 }), gradients: gradients, borderRadii: __assign(__assign({}, reactTheming.DEFAULT_THEME.borderRadii), { lg: "8px", xl: "16px", xxl: "32px" }), components: components, shadows: __assign(__assign({}, reactTheming.DEFAULT_THEME.shadows), { boxShadow: boxShadow }) });
261
263
 
262
264
  var GlobalStyle = styled.createGlobalStyle(templateObject_1$1e || (templateObject_1$1e = __makeTemplateObject(["\n ::-webkit-scrollbar-track:hover {\n border-left: solid 1px ", ";\n border-right: solid 1px ", ";\n }\n\n ::-webkit-scrollbar {\n width: 10px;\n }\n\n ::-webkit-scrollbar-track {\n border: solid 2px transparent;\n }\n\n ::-webkit-scrollbar-thumb {\n box-shadow: inset 0 0 10px 10px ", ";\n border: solid 2px transparent;\n border-radius: 25px;\n }\n\n /* This stuff is for Firefox */\n * {\n scrollbar-color: ", " #FFFFFF;\n scrollbar-width: thin;\n }\n\n html {\n overflow-y: auto;\n }\n\n body {\n font-family: ", ";\n margin: 0;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n }\n \n svg {\n max-height: 100%;\n }\n\n"], ["\n ::-webkit-scrollbar-track:hover {\n border-left: solid 1px ", ";\n border-right: solid 1px ", ";\n }\n\n ::-webkit-scrollbar {\n width: 10px;\n }\n\n ::-webkit-scrollbar-track {\n border: solid 2px transparent;\n }\n\n ::-webkit-scrollbar-thumb {\n box-shadow: inset 0 0 10px 10px ", ";\n border: solid 2px transparent;\n border-radius: 25px;\n }\n\n /* This stuff is for Firefox */\n * {\n scrollbar-color: ", " #FFFFFF;\n scrollbar-width: thin;\n }\n\n html {\n overflow-y: auto;\n }\n\n body {\n font-family: ", ";\n margin: 0;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n }\n \n svg {\n max-height: 100%;\n }\n\n"])), theme.palette.grey["200"], theme.palette.grey["200"], theme.palette.blue["200"], theme.palette.blue["200"], theme.fonts.system);
263
265
  var templateObject_1$1e;
@@ -1244,13 +1246,24 @@ var Header$1 = styled__default["default"].div(templateObject_1$T || (templateObj
1244
1246
  var theme = _a.theme;
1245
1247
  return theme.palette.grey[300];
1246
1248
  });
1247
- var Title$2 = styled__default["default"](MD)(templateObject_2$n || (templateObject_2$n = __makeTemplateObject(["\n color: ", ";\n"], ["\n color: ", ";\n"])), function (_a) {
1248
- var theme = _a.theme;
1249
- return theme.colors.primaryHue;
1249
+ var Title$2 = styled__default["default"](MD)(templateObject_2$n || (templateObject_2$n = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
1250
+ var validation = _a.validation, theme = _a.theme;
1251
+ if (validation === "success") {
1252
+ return "color: ".concat(theme.colors.successHue, ";");
1253
+ }
1254
+ else if (validation === "warning") {
1255
+ return "color: ".concat(theme.colors.warningHue, ";");
1256
+ }
1257
+ else if (validation === "error") {
1258
+ return "color: ".concat(theme.palette.dangerHue, ";");
1259
+ }
1260
+ else {
1261
+ return "color: ".concat(theme.colors.primaryHue, ";");
1262
+ }
1250
1263
  });
1251
- var EditorHeader = function (_a) {
1252
- var title = _a.title;
1253
- return (jsxRuntime.jsx(Header$1, { children: jsxRuntime.jsx(Title$2, __assign({ isBold: true }, { children: title || "Write" })) }));
1264
+ var EditorHeader = function (props) {
1265
+ var title = props.title, validation = props.validation;
1266
+ return (jsxRuntime.jsx(Header$1, { children: jsxRuntime.jsx(Title$2, __assign({ isBold: true, validation: validation }, { children: title || "Write" })) }));
1254
1267
  };
1255
1268
  var templateObject_1$T, templateObject_2$n;
1256
1269
 
@@ -1268,15 +1281,26 @@ var EditorFooter = function (_a) {
1268
1281
  };
1269
1282
  var templateObject_1$S, templateObject_2$m;
1270
1283
 
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
- var theme = _a.theme;
1273
- return theme.colors.primaryHue;
1274
- }, function (_a) {
1284
+ 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 ", "\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 ", "\n\n .ProseMirror {\n padding: ", ";\n background-color: #fff;\n min-height: 100px;\n outline: none;\n\n ", "\n\n ", "\n }\n"])), function (_a) {
1275
1285
  var theme = _a.theme;
1276
1286
  return theme.borderRadii.md;
1277
1287
  }, function (_a) {
1278
1288
  var theme = _a.theme;
1279
1289
  return theme.palette.blue["300"];
1290
+ }, function (_a) {
1291
+ var validation = _a.validation, theme = _a.theme;
1292
+ if (validation === "success") {
1293
+ return "border-color: ".concat(theme.colors.successHue, ";");
1294
+ }
1295
+ else if (validation === "warning") {
1296
+ return "border-color: ".concat(theme.colors.warningHue, ";");
1297
+ }
1298
+ else if (validation === "error") {
1299
+ return "border-color: ".concat(theme.colors.dangerHue, ";");
1300
+ }
1301
+ else {
1302
+ return "border-color: ".concat(theme.colors.primaryHue, ";");
1303
+ }
1280
1304
  }, function (_a) {
1281
1305
  var editable = _a.editable;
1282
1306
  return !editable &&
@@ -1322,6 +1346,7 @@ var Editor = function (_a) {
1322
1346
  }
1323
1347
  return "Can you add some further context?";
1324
1348
  } }, placeholderOptions)),
1349
+ CharacterCount__default["default"],
1325
1350
  ], content: children || "", editorProps: {
1326
1351
  handleKeyDown: function (view, event) {
1327
1352
  if ((event.ctrlKey || event.metaKey) && event.key === "Enter") {
@@ -1338,7 +1363,7 @@ var Editor = function (_a) {
1338
1363
  var editor = _a.editor;
1339
1364
  return setActiveEditor(editor);
1340
1365
  });
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 })] })));
1366
+ return (jsxRuntime.jsxs(EditorContainer, __assign({ editable: isEditable, validation: props.validation }, { children: [isEditable && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(EditorHeader, { title: headerTitle, validation: props.validation }), hasInlineMenu && (jsxRuntime.jsx(FloatingMenu, { editor: ed, tippyOptions: __assign({}, bubbleOptions) }))] })), jsxRuntime.jsx(react.EditorContent, { editor: ed, onKeyDown: onKeyDown }), isEditable && jsxRuntime.jsx(EditorFooter, { saveText: footerSaveText })] })));
1342
1367
  };
1343
1368
  var templateObject_1$R;
1344
1369
 
@@ -1,12 +1,20 @@
1
1
  import { PlaceholderOptions } from "@tiptap/extension-placeholder";
2
2
  import { BubbleMenuProps, Editor, EditorOptions } from "@tiptap/react";
3
+ declare type validationStatus = "success" | "warning" | "error";
3
4
  export interface EditorArgs extends Partial<EditorOptions> {
4
5
  placeholderOptions?: Partial<PlaceholderOptions>;
5
6
  hasInlineMenu?: boolean;
6
7
  bubbleOptions?: any;
7
8
  headerTitle?: string;
8
9
  footerSaveText?: string;
10
+ /** Applies validation state styling */
11
+ validation?: validationStatus;
9
12
  onSave?: (editor: Editor) => void;
10
13
  }
14
+ export interface EditorHeaderArgs {
15
+ title?: string;
16
+ validation?: validationStatus;
17
+ }
11
18
  export interface FloatingMenuArgs extends Partial<BubbleMenuProps> {
12
19
  }
20
+ export {};
@@ -1,3 +1,2 @@
1
- export declare const EditorHeader: ({ title }: {
2
- title?: string | undefined;
3
- }) => JSX.Element;
1
+ import { EditorHeaderArgs } from "./_types";
2
+ export declare const EditorHeader: (props: EditorHeaderArgs) => JSX.Element;
@@ -8,5 +8,6 @@ export declare const Default: Story<EditorStoryArgs>;
8
8
  export declare const Placeholder: Story<EditorStoryArgs>;
9
9
  export declare const BubbleMenu: Story<EditorStoryArgs>;
10
10
  export declare const ReadOnly: Story<EditorStoryArgs>;
11
+ export declare const Validation: Story<EditorStoryArgs>;
11
12
  declare const _default: ComponentMeta<({ onSave, headerTitle, footerSaveText, placeholderOptions, ...props }: import("react").PropsWithChildren<EditorArgs>) => JSX.Element | null>;
12
13
  export default _default;
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@appquality/unguess-design-system",
3
- "version": "2.10.64",
3
+ "version": "2.10.67",
4
4
  "dependencies": {
5
5
  "@tiptap/extension-bubble-menu": "^2.0.0-beta.61",
6
+ "@tiptap/extension-character-count": "^2.0.0-beta.31",
6
7
  "@tiptap/extension-placeholder": "^2.0.0-beta.53",
7
8
  "@tiptap/extension-typography": "^2.0.0-beta.22",
8
9
  "@tiptap/react": "^2.0.0-beta.114",