@appquality/unguess-design-system 2.10.64 → 2.10.65
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,16 @@
|
|
|
1
|
+
# v2.10.65 (Fri Jul 29 2022)
|
|
2
|
+
|
|
3
|
+
#### ⚠️ Pushed to `master`
|
|
4
|
+
|
|
5
|
+
- Merge branch 'master' of github.com:AppQuality/unguess-design-system ([@cannarocks](https://github.com/cannarocks))
|
|
6
|
+
- feat(editor): Add validation support ([@cannarocks](https://github.com/cannarocks))
|
|
7
|
+
|
|
8
|
+
#### Authors: 1
|
|
9
|
+
|
|
10
|
+
- Luca Cannarozzo ([@cannarocks](https://github.com/cannarocks))
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
1
14
|
# v2.10.64 (Wed Jul 27 2022)
|
|
2
15
|
|
|
3
16
|
#### ⚠️ Pushed to `master`
|
package/build/index.js
CHANGED
|
@@ -1244,13 +1244,24 @@ var Header$1 = styled__default["default"].div(templateObject_1$T || (templateObj
|
|
|
1244
1244
|
var theme = _a.theme;
|
|
1245
1245
|
return theme.palette.grey[300];
|
|
1246
1246
|
});
|
|
1247
|
-
var Title$2 = styled__default["default"](MD)(templateObject_2$n || (templateObject_2$n = __makeTemplateObject(["\n
|
|
1248
|
-
var theme = _a.theme;
|
|
1249
|
-
|
|
1247
|
+
var Title$2 = styled__default["default"](MD)(templateObject_2$n || (templateObject_2$n = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
|
|
1248
|
+
var validation = _a.validation, theme = _a.theme;
|
|
1249
|
+
if (validation === "success") {
|
|
1250
|
+
return "color: ".concat(theme.colors.successHue, ";");
|
|
1251
|
+
}
|
|
1252
|
+
else if (validation === "warning") {
|
|
1253
|
+
return "color: ".concat(theme.colors.warningHue, ";");
|
|
1254
|
+
}
|
|
1255
|
+
else if (validation === "error") {
|
|
1256
|
+
return "color: ".concat(theme.palette.dangerHue, ";");
|
|
1257
|
+
}
|
|
1258
|
+
else {
|
|
1259
|
+
return "color: ".concat(theme.colors.primaryHue, ";");
|
|
1260
|
+
}
|
|
1250
1261
|
});
|
|
1251
|
-
var EditorHeader = function (
|
|
1252
|
-
var title =
|
|
1253
|
-
return (jsxRuntime.jsx(Header$1, { children: jsxRuntime.jsx(Title$2, __assign({ isBold: true }, { children: title || "Write" })) }));
|
|
1262
|
+
var EditorHeader = function (props) {
|
|
1263
|
+
var title = props.title, validation = props.validation;
|
|
1264
|
+
return (jsxRuntime.jsx(Header$1, { children: jsxRuntime.jsx(Title$2, __assign({ isBold: true, validation: validation }, { children: title || "Write" })) }));
|
|
1254
1265
|
};
|
|
1255
1266
|
var templateObject_1$T, templateObject_2$n;
|
|
1256
1267
|
|
|
@@ -1268,15 +1279,26 @@ var EditorFooter = function (_a) {
|
|
|
1268
1279
|
};
|
|
1269
1280
|
var templateObject_1$S, templateObject_2$m;
|
|
1270
1281
|
|
|
1271
|
-
var EditorContainer = styled__default["default"].div(templateObject_1$R || (templateObject_1$R = __makeTemplateObject(["\n border: 2px solid
|
|
1272
|
-
var theme = _a.theme;
|
|
1273
|
-
return theme.colors.primaryHue;
|
|
1274
|
-
}, function (_a) {
|
|
1282
|
+
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
1283
|
var theme = _a.theme;
|
|
1276
1284
|
return theme.borderRadii.md;
|
|
1277
1285
|
}, function (_a) {
|
|
1278
1286
|
var theme = _a.theme;
|
|
1279
1287
|
return theme.palette.blue["300"];
|
|
1288
|
+
}, function (_a) {
|
|
1289
|
+
var validation = _a.validation, theme = _a.theme;
|
|
1290
|
+
if (validation === "success") {
|
|
1291
|
+
return "border-color: ".concat(theme.colors.successHue, ";");
|
|
1292
|
+
}
|
|
1293
|
+
else if (validation === "warning") {
|
|
1294
|
+
return "border-color: ".concat(theme.colors.warningHue, ";");
|
|
1295
|
+
}
|
|
1296
|
+
else if (validation === "error") {
|
|
1297
|
+
return "border-color: ".concat(theme.colors.dangerHue, ";");
|
|
1298
|
+
}
|
|
1299
|
+
else {
|
|
1300
|
+
return "border-color: ".concat(theme.colors.primaryHue, ";");
|
|
1301
|
+
}
|
|
1280
1302
|
}, function (_a) {
|
|
1281
1303
|
var editable = _a.editable;
|
|
1282
1304
|
return !editable &&
|
|
@@ -1338,7 +1360,7 @@ var Editor = function (_a) {
|
|
|
1338
1360
|
var editor = _a.editor;
|
|
1339
1361
|
return setActiveEditor(editor);
|
|
1340
1362
|
});
|
|
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 })] })));
|
|
1363
|
+
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
1364
|
};
|
|
1343
1365
|
var templateObject_1$R;
|
|
1344
1366
|
|
|
@@ -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
|
-
|
|
2
|
-
|
|
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;
|