@toptal/picasso-rich-text-editor 13.0.16 → 14.0.1
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/dist-package/src/LexicalEditor/hooks/useTypographyClasses/use-typography-classes.d.ts +1 -1
- package/dist-package/src/LexicalEditor/hooks/useTypographyClasses/use-typography-classes.d.ts.map +1 -1
- package/dist-package/src/LexicalEditor/hooks/useTypographyClasses/use-typography-classes.js +1 -1
- package/dist-package/src/LexicalEditor/hooks/useTypographyClasses/use-typography-classes.js.map +1 -1
- package/dist-package/src/RichTextEditor/hooks/useTypographyClasses/use-typography-classes.d.ts +1 -1
- package/dist-package/src/RichTextEditor/hooks/useTypographyClasses/use-typography-classes.d.ts.map +1 -1
- package/dist-package/src/RichTextEditor/hooks/useTypographyClasses/use-typography-classes.js +1 -1
- package/dist-package/src/RichTextEditor/hooks/useTypographyClasses/use-typography-classes.js.map +1 -1
- package/dist-package/src/RichTextEditorButton/RichTextEditorButton.js +1 -1
- package/dist-package/src/RichTextEditorButton/RichTextEditorButton.js.map +1 -1
- package/dist-package/src/RichTextEditorToolbar/styles.d.ts.map +1 -1
- package/dist-package/src/RichTextEditorToolbar/styles.js +2 -1
- package/dist-package/src/RichTextEditorToolbar/styles.js.map +1 -1
- package/dist-package/src/utils/index.d.ts +2 -0
- package/dist-package/src/utils/index.d.ts.map +1 -1
- package/dist-package/src/utils/index.js +2 -0
- package/dist-package/src/utils/index.js.map +1 -1
- package/dist-package/src/utils/typography/get-typography-classnames.d.ts +14 -0
- package/dist-package/src/utils/typography/get-typography-classnames.d.ts.map +1 -0
- package/dist-package/src/utils/typography/get-typography-classnames.js +16 -0
- package/dist-package/src/utils/typography/get-typography-classnames.js.map +1 -0
- package/dist-package/src/utils/typography/typographyStyles.d.ts +3 -0
- package/dist-package/src/utils/typography/typographyStyles.d.ts.map +1 -0
- package/dist-package/src/utils/typography/typographyStyles.js +107 -0
- package/dist-package/src/utils/typography/typographyStyles.js.map +1 -0
- package/package.json +19 -19
- package/src/LexicalEditor/hooks/useTypographyClasses/test.ts +3 -3
- package/src/LexicalEditor/hooks/useTypographyClasses/use-typography-classes.ts +3 -5
- package/src/RichTextEditor/hooks/useTypographyClasses/use-typography-classes.ts +3 -5
- package/src/RichTextEditorButton/RichTextEditorButton.tsx +1 -1
- package/src/RichTextEditorToolbar/styles.ts +2 -1
- package/src/utils/index.ts +3 -0
- package/src/utils/typography/get-typography-classnames.ts +52 -0
- package/src/utils/typography/typographyStyles.ts +114 -0
package/dist-package/src/LexicalEditor/hooks/useTypographyClasses/use-typography-classes.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TypographyOptions } from '
|
|
1
|
+
import type { TypographyOptions } from '../../../utils';
|
|
2
2
|
declare const useTypographyClasses: (options: TypographyOptions) => string;
|
|
3
3
|
export default useTypographyClasses;
|
|
4
4
|
//# sourceMappingURL=use-typography-classes.d.ts.map
|
package/dist-package/src/LexicalEditor/hooks/useTypographyClasses/use-typography-classes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-typography-classes.d.ts","sourceRoot":"","sources":["../../../../../src/LexicalEditor/hooks/useTypographyClasses/use-typography-classes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-typography-classes.d.ts","sourceRoot":"","sources":["../../../../../src/LexicalEditor/hooks/useTypographyClasses/use-typography-classes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAOvD,QAAA,MAAM,oBAAoB,YAAa,iBAAiB,KAAG,MAI1D,CAAA;AAED,eAAe,oBAAoB,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { makeStyles } from '@material-ui/core/styles';
|
|
2
|
-
import { typographyStyles, getTypographyClassName
|
|
2
|
+
import { typographyStyles, getTypographyClassName } from '../../../utils';
|
|
3
3
|
const useCreateTypographyClasses = makeStyles(typographyStyles, {
|
|
4
4
|
name: 'TextEditorTypography',
|
|
5
5
|
});
|
package/dist-package/src/LexicalEditor/hooks/useTypographyClasses/use-typography-classes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-typography-classes.js","sourceRoot":"","sources":["../../../../../src/LexicalEditor/hooks/useTypographyClasses/use-typography-classes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"use-typography-classes.js","sourceRoot":"","sources":["../../../../../src/LexicalEditor/hooks/useTypographyClasses/use-typography-classes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAGrD,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAEzE,MAAM,0BAA0B,GAAG,UAAU,CAAQ,gBAAgB,EAAE;IACrE,IAAI,EAAE,sBAAsB;CAC7B,CAAC,CAAA;AAEF,MAAM,oBAAoB,GAAG,CAAC,OAA0B,EAAU,EAAE;IAClE,MAAM,OAAO,GAAG,0BAA0B,EAAE,CAAA;IAE5C,OAAO,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AACjD,CAAC,CAAA;AAED,eAAe,oBAAoB,CAAA"}
|
package/dist-package/src/RichTextEditor/hooks/useTypographyClasses/use-typography-classes.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TypographyOptions } from '
|
|
1
|
+
import type { TypographyOptions } from '../../../utils';
|
|
2
2
|
declare const useTypographyClasses: (options: TypographyOptions) => string;
|
|
3
3
|
export default useTypographyClasses;
|
|
4
4
|
//# sourceMappingURL=use-typography-classes.d.ts.map
|
package/dist-package/src/RichTextEditor/hooks/useTypographyClasses/use-typography-classes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-typography-classes.d.ts","sourceRoot":"","sources":["../../../../../src/RichTextEditor/hooks/useTypographyClasses/use-typography-classes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-typography-classes.d.ts","sourceRoot":"","sources":["../../../../../src/RichTextEditor/hooks/useTypographyClasses/use-typography-classes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAOvD,QAAA,MAAM,oBAAoB,YAAa,iBAAiB,KAAG,MAI1D,CAAA;AAED,eAAe,oBAAoB,CAAA"}
|
package/dist-package/src/RichTextEditor/hooks/useTypographyClasses/use-typography-classes.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { makeStyles } from '@material-ui/core';
|
|
2
|
-
import { typographyStyles, getTypographyClassName
|
|
2
|
+
import { typographyStyles, getTypographyClassName } from '../../../utils';
|
|
3
3
|
const useCreateTypographyClasses = makeStyles(typographyStyles, {
|
|
4
4
|
name: 'TextEditorTypography',
|
|
5
5
|
});
|
package/dist-package/src/RichTextEditor/hooks/useTypographyClasses/use-typography-classes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-typography-classes.js","sourceRoot":"","sources":["../../../../../src/RichTextEditor/hooks/useTypographyClasses/use-typography-classes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"use-typography-classes.js","sourceRoot":"","sources":["../../../../../src/RichTextEditor/hooks/useTypographyClasses/use-typography-classes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAG9C,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAEzE,MAAM,0BAA0B,GAAG,UAAU,CAAQ,gBAAgB,EAAE;IACrE,IAAI,EAAE,sBAAsB;CAC7B,CAAC,CAAA;AAEF,MAAM,oBAAoB,GAAG,CAAC,OAA0B,EAAU,EAAE;IAClE,MAAM,OAAO,GAAG,0BAA0B,EAAE,CAAA;IAE5C,OAAO,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AACjD,CAAC,CAAA;AAED,eAAe,oBAAoB,CAAA"}
|
|
@@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import React from 'react';
|
|
13
|
-
import { twMerge } from 'tailwind-merge';
|
|
13
|
+
import { twMerge } from '@toptal/picasso-tailwind-merge';
|
|
14
14
|
import { ButtonCircular } from '@toptal/picasso-button';
|
|
15
15
|
const RichTextEditorButton = (props) => {
|
|
16
16
|
const { icon, onClick, active, className, style, disabled } = props, rest = __rest(props, ["icon", "onClick", "active", "className", "style", "disabled"]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextEditorButton.js","sourceRoot":"","sources":["../../../src/RichTextEditorButton/RichTextEditorButton.tsx"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"RichTextEditorButton.js","sourceRoot":"","sources":["../../../src/RichTextEditorButton/RichTextEditorButton.tsx"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAA;AAExD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAUvD,MAAM,oBAAoB,GAAG,CAAC,KAAY,EAAE,EAAE;IAC5C,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAAtE,+DAA8D,CAAQ,CAAA;IAE5E,OAAO,CACL,oBAAC,cAAc,kBACb,OAAO,EAAC,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,OAAO,CAChB,uBAAuB,EACvB,MAAM,IAAI,gDAAgD,EAC1D,SAAS,CACV,EACD,QAAQ,EAAE,QAAQ,IACd,IAAI,EACR,CACH,CAAA;AACH,CAAC,CAAA;AAED,oBAAoB,CAAC,YAAY,GAAG;IAClC,MAAM,EAAE,KAAK;IACb,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;CAClB,CAAA;AAED,oBAAoB,CAAC,WAAW,GAAG,sBAAsB,CAAA;AAEzD,eAAe,oBAAoB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/RichTextEditorToolbar/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;sCAGxB,KAAK;AAAlC,
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/RichTextEditorToolbar/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;sCAGxB,KAAK;AAAlC,wBA+BI"}
|
|
@@ -21,7 +21,8 @@ export default ({ palette }) => createStyles({
|
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
23
|
select: {
|
|
24
|
-
|
|
24
|
+
// XXX: Using important to override Tailwind styles, remove when migrating RTE to Tailwind
|
|
25
|
+
width: '7.125em !important',
|
|
25
26
|
},
|
|
26
27
|
groupDisabled: {
|
|
27
28
|
pointerEvents: 'none',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/RichTextEditorToolbar/styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,eAAe,CAAC,EAAE,OAAO,EAAS,EAAE,EAAE,CACpC,YAAY,CAAC;IACX,OAAO,EAAE;QACP,OAAO,EAAE,MAAM;QACf,YAAY,EAAE,aAAa,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE;QAChD,aAAa,EAAE,OAAO;KACvB;IACD,KAAK,EAAE;QACL,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,QAAQ;QACpB,QAAQ,EAAE,UAAU;QACpB,aAAa,EAAE,OAAO;QAEtB,uCAAuC,EAAE;YACvC,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,KAAK;YACZ,QAAQ,EAAE,UAAU;YACpB,UAAU,EAAE,OAAO;YACnB,WAAW,EAAE,OAAO;YACpB,eAAe,EAAE,OAAO,CAAC,IAAI,CAAC,QAAQ;SACvC;KACF;IACD,MAAM,EAAE;QACN,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/RichTextEditorToolbar/styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,eAAe,CAAC,EAAE,OAAO,EAAS,EAAE,EAAE,CACpC,YAAY,CAAC;IACX,OAAO,EAAE;QACP,OAAO,EAAE,MAAM;QACf,YAAY,EAAE,aAAa,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE;QAChD,aAAa,EAAE,OAAO;KACvB;IACD,KAAK,EAAE;QACL,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,QAAQ;QACpB,QAAQ,EAAE,UAAU;QACpB,aAAa,EAAE,OAAO;QAEtB,uCAAuC,EAAE;YACvC,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,KAAK;YACZ,QAAQ,EAAE,UAAU;YACpB,UAAU,EAAE,OAAO;YACnB,WAAW,EAAE,OAAO;YACpB,eAAe,EAAE,OAAO,CAAC,IAAI,CAAC,QAAQ;SACvC;KACF;IACD,MAAM,EAAE;QACN,0FAA0F;QAC1F,KAAK,EAAE,oBAAoB;KAC5B;IAED,aAAa,EAAE;QACb,aAAa,EAAE,MAAM;KACtB;CACF,CAAC,CAAA"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { default as htmlToHast, hastSanitizeSchema } from './html-to-hast';
|
|
2
2
|
export { default as isCustomEmoji } from './is-custom-emoji';
|
|
3
|
+
export * from './typography/typographyStyles';
|
|
4
|
+
export * from './typography/get-typography-classnames';
|
|
3
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAC1E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAC1E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAE5D,cAAc,+BAA+B,CAAA;AAC7C,cAAc,wCAAwC,CAAA"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { default as htmlToHast, hastSanitizeSchema } from './html-to-hast';
|
|
2
2
|
export { default as isCustomEmoji } from './is-custom-emoji';
|
|
3
|
+
export * from './typography/typographyStyles';
|
|
4
|
+
export * from './typography/get-typography-classnames';
|
|
3
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAC1E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAC1E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAE5D,cAAc,+BAA+B,CAAA;AAC7C,cAAc,wCAAwC,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { SizeType, ColorType } from '@toptal/picasso-shared';
|
|
3
|
+
export declare type TypographyOptions = {
|
|
4
|
+
variant: 'heading' | 'body';
|
|
5
|
+
size: SizeType<'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge'> | 'inherit';
|
|
6
|
+
color?: ColorType;
|
|
7
|
+
weight?: 'regular' | 'semibold' | 'inherit';
|
|
8
|
+
underline?: 'solid' | 'dashed';
|
|
9
|
+
invert?: boolean;
|
|
10
|
+
lineThrough?: boolean;
|
|
11
|
+
as?: React.ElementType<React.HTMLAttributes<HTMLElement>>;
|
|
12
|
+
};
|
|
13
|
+
export declare const getTypographyClassName: (classes: Record<string, string>, { variant, size, color, weight, underline, invert, lineThrough, as, }: TypographyOptions) => string;
|
|
14
|
+
//# sourceMappingURL=get-typography-classnames.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-typography-classnames.d.ts","sourceRoot":"","sources":["../../../../src/utils/typography/get-typography-classnames.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAGjE,oBAAY,iBAAiB,GAAG;IAC9B,OAAO,EAAE,SAAS,GAAG,MAAM,CAAA;IAC3B,IAAI,EACA,QAAQ,CAAC,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC,GACxE,SAAS,CAAA;IACb,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,MAAM,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,CAAA;IAC3C,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAA;CAC1D,CAAA;AAED,eAAO,MAAM,sBAAsB,YACxB,OAAO,MAAM,EAAE,MAAM,CAAC,yEAU5B,iBAAiB,WAuBrB,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import cx from 'classnames';
|
|
2
|
+
import { kebabToCamelCase } from '@toptal/picasso-utils';
|
|
3
|
+
export const getTypographyClassName = (classes, { variant, size, color, weight, underline, invert, lineThrough, as, }) => {
|
|
4
|
+
const variantClassName = kebabToCamelCase(`${variant}-${size}`);
|
|
5
|
+
const colorClassName = kebabToCamelCase(`${color}`);
|
|
6
|
+
const weightVariantClass = weight ? classes[weight] : undefined;
|
|
7
|
+
const weightClass = weight === 'inherit' || as === 'em'
|
|
8
|
+
? classes.inheritWeight
|
|
9
|
+
: weightVariantClass;
|
|
10
|
+
const underlineClass = underline ? classes[underline] : undefined;
|
|
11
|
+
return cx(classes[variantClassName], classes[colorClassName], weightClass, underlineClass, {
|
|
12
|
+
[classes.invert]: invert,
|
|
13
|
+
[classes.lineThrough]: lineThrough,
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=get-typography-classnames.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-typography-classnames.js","sourceRoot":"","sources":["../../../../src/utils/typography/get-typography-classnames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAexD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,OAA+B,EAC/B,EACE,OAAO,EACP,IAAI,EACJ,KAAK,EACL,MAAM,EACN,SAAS,EACT,MAAM,EACN,WAAW,EACX,EAAE,GACgB,EACpB,EAAE;IACF,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,GAAG,OAAO,IAAI,IAAI,EAAE,CAAC,CAAA;IAC/D,MAAM,cAAc,GAAG,gBAAgB,CAAC,GAAG,KAAK,EAAE,CAAC,CAAA;IAEnD,MAAM,kBAAkB,GAAG,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC/D,MAAM,WAAW,GACf,MAAM,KAAK,SAAS,IAAI,EAAE,KAAK,IAAI;QACjC,CAAC,CAAC,OAAO,CAAC,aAAa;QACvB,CAAC,CAAC,kBAAkB,CAAA;IAExB,MAAM,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAEjE,OAAO,EAAE,CACP,OAAO,CAAC,gBAAgB,CAAC,EACzB,OAAO,CAAC,cAAc,CAAC,EACvB,WAAW,EACX,cAAc,EACd;QACE,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM;QACxB,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,WAAW;KACnC,CACF,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Theme } from '@material-ui/core/styles';
|
|
2
|
+
export declare const typographyStyles: (theme: Theme) => import("@material-ui/styles").StyleRules<{}, "inherit" | "black" | "blue" | "green" | "grey" | "red" | "yellow" | "dashed" | "solid" | "invert" | "bodyXxsmall" | "bodyXsmall" | "bodySmall" | "bodyMedium" | "bodyLarge" | "bodyInherit" | "headingMedium" | "regular" | "semibold" | "inheritWeight" | "lightGrey" | "greyMain-2" | "darkGrey" | "lightBlue" | "lineThrough">;
|
|
3
|
+
//# sourceMappingURL=typographyStyles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typographyStyles.d.ts","sourceRoot":"","sources":["../../../../src/utils/typography/typographyStyles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAUrD,eAAO,MAAM,gBAAgB,UAAW,KAAK,oXAuG5C,CAAA"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { createStyles } from '@material-ui/core/styles';
|
|
2
|
+
const getHeadingMedium = (theme) => ({
|
|
3
|
+
color: theme.palette.common.black,
|
|
4
|
+
fontWeight: theme.typography.fontWeights.semibold,
|
|
5
|
+
fontSize: '16px',
|
|
6
|
+
lineHeight: '24px',
|
|
7
|
+
});
|
|
8
|
+
export const typographyStyles = (theme) => {
|
|
9
|
+
const { palette, typography } = theme;
|
|
10
|
+
// All the body variants are mapped to the same MUI variant (body1) -> declaring styles via custom class names
|
|
11
|
+
return createStyles({
|
|
12
|
+
bodyXxsmall: {
|
|
13
|
+
color: palette.text.primary,
|
|
14
|
+
fontWeight: typography.fontWeights.regular,
|
|
15
|
+
fontSize: typography.fontSizes.xxsmall,
|
|
16
|
+
lineHeight: '16px',
|
|
17
|
+
},
|
|
18
|
+
bodyXsmall: {
|
|
19
|
+
color: palette.text.primary,
|
|
20
|
+
fontWeight: typography.fontWeights.regular,
|
|
21
|
+
fontSize: typography.fontSizes.xsmall,
|
|
22
|
+
lineHeight: '18px',
|
|
23
|
+
},
|
|
24
|
+
bodySmall: {
|
|
25
|
+
color: palette.text.primary,
|
|
26
|
+
fontWeight: typography.fontWeights.regular,
|
|
27
|
+
fontSize: typography.fontSizes.small,
|
|
28
|
+
lineHeight: '20px',
|
|
29
|
+
},
|
|
30
|
+
bodyMedium: {
|
|
31
|
+
color: palette.text.primary,
|
|
32
|
+
fontWeight: typography.fontWeights.regular,
|
|
33
|
+
fontSize: typography.fontSizes.medium,
|
|
34
|
+
lineHeight: '22px',
|
|
35
|
+
},
|
|
36
|
+
bodyLarge: {
|
|
37
|
+
color: palette.common.black,
|
|
38
|
+
fontWeight: typography.fontWeights.regular,
|
|
39
|
+
fontSize: typography.fontSizes.large,
|
|
40
|
+
lineHeight: '24px',
|
|
41
|
+
},
|
|
42
|
+
bodyInherit: {
|
|
43
|
+
fontSize: '1em',
|
|
44
|
+
lineHeight: '1.5em',
|
|
45
|
+
fontWeight: typography.fontWeights.regular,
|
|
46
|
+
color: palette.text.primary,
|
|
47
|
+
},
|
|
48
|
+
headingMedium: getHeadingMedium(theme),
|
|
49
|
+
regular: {
|
|
50
|
+
fontWeight: typography.fontWeights.regular,
|
|
51
|
+
},
|
|
52
|
+
semibold: {
|
|
53
|
+
fontWeight: typography.fontWeights.semibold,
|
|
54
|
+
},
|
|
55
|
+
inheritWeight: {
|
|
56
|
+
fontWeight: 'inherit',
|
|
57
|
+
},
|
|
58
|
+
green: {
|
|
59
|
+
color: palette.green.dark,
|
|
60
|
+
},
|
|
61
|
+
red: {
|
|
62
|
+
color: palette.red.main,
|
|
63
|
+
},
|
|
64
|
+
yellow: {
|
|
65
|
+
color: palette.yellow.main,
|
|
66
|
+
},
|
|
67
|
+
lightGrey: {
|
|
68
|
+
color: palette.grey.light2,
|
|
69
|
+
},
|
|
70
|
+
grey: {
|
|
71
|
+
color: palette.grey.main,
|
|
72
|
+
},
|
|
73
|
+
'greyMain-2': {
|
|
74
|
+
color: palette.grey.main2,
|
|
75
|
+
},
|
|
76
|
+
darkGrey: {
|
|
77
|
+
color: palette.text.primary,
|
|
78
|
+
},
|
|
79
|
+
black: {
|
|
80
|
+
color: palette.common.black,
|
|
81
|
+
},
|
|
82
|
+
lightBlue: {
|
|
83
|
+
color: palette.blue.light,
|
|
84
|
+
},
|
|
85
|
+
invert: {
|
|
86
|
+
color: palette.common.white,
|
|
87
|
+
},
|
|
88
|
+
inherit: {
|
|
89
|
+
color: 'inherit',
|
|
90
|
+
},
|
|
91
|
+
blue: {
|
|
92
|
+
color: palette.blue.main,
|
|
93
|
+
},
|
|
94
|
+
solid: {
|
|
95
|
+
textDecoration: 'underline',
|
|
96
|
+
textDecorationStyle: 'solid',
|
|
97
|
+
},
|
|
98
|
+
dashed: {
|
|
99
|
+
textDecoration: 'underline',
|
|
100
|
+
textDecorationStyle: 'dashed',
|
|
101
|
+
},
|
|
102
|
+
lineThrough: {
|
|
103
|
+
textDecoration: 'line-through',
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
//# sourceMappingURL=typographyStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typographyStyles.js","sourceRoot":"","sources":["../../../../src/utils/typography/typographyStyles.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toptal/picasso-rich-text-editor",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.1",
|
|
4
4
|
"description": "Picasso rich text editor",
|
|
5
5
|
"author": "Toptal",
|
|
6
6
|
"homepage": "https://github.com/toptal/picasso/tree/master/packages/picasso-rich-text-editor#readme",
|
|
@@ -33,27 +33,28 @@
|
|
|
33
33
|
"react": ">=16.12.0 < 19.0.0",
|
|
34
34
|
"react-dom": ">=16.12.0 < 19.0.0",
|
|
35
35
|
"typescript": "~4.7.0",
|
|
36
|
-
"@toptal/picasso-tailwind": "
|
|
36
|
+
"@toptal/picasso-tailwind-merge": "^1.0.1",
|
|
37
|
+
"@toptal/picasso-tailwind": ">=2.7"
|
|
37
38
|
},
|
|
38
39
|
"dependencies": {
|
|
39
40
|
"@emoji-mart/data": "^1.2.1",
|
|
40
41
|
"@emoji-mart/react": "^1.1.1",
|
|
41
42
|
"@lexical/html": "0.11.2",
|
|
42
43
|
"@lexical/react": "0.11.2",
|
|
43
|
-
"@toptal/picasso-container": "
|
|
44
|
-
"@toptal/picasso-button": "
|
|
45
|
-
"@toptal/picasso-icons": "1.
|
|
46
|
-
"@toptal/picasso-file-input": "
|
|
44
|
+
"@toptal/picasso-container": "2.0.0",
|
|
45
|
+
"@toptal/picasso-button": "3.0.1",
|
|
46
|
+
"@toptal/picasso-icons": "1.6.0",
|
|
47
|
+
"@toptal/picasso-file-input": "2.0.1",
|
|
47
48
|
"@toptal/picasso-image": "1.0.3",
|
|
48
|
-
"@toptal/picasso-outlined-input": "
|
|
49
|
-
"@toptal/picasso-list": "
|
|
50
|
-
"@toptal/picasso-link": "
|
|
51
|
-
"@toptal/picasso-select": "
|
|
52
|
-
"@toptal/picasso-input-adornment": "
|
|
53
|
-
"@toptal/picasso-typography": "
|
|
54
|
-
"@toptal/picasso-modal": "
|
|
55
|
-
"@toptal/picasso-form": "
|
|
56
|
-
"@toptal/picasso-input": "
|
|
49
|
+
"@toptal/picasso-outlined-input": "2.0.1",
|
|
50
|
+
"@toptal/picasso-list": "3.0.1",
|
|
51
|
+
"@toptal/picasso-link": "2.0.0",
|
|
52
|
+
"@toptal/picasso-select": "2.0.1",
|
|
53
|
+
"@toptal/picasso-input-adornment": "2.0.1",
|
|
54
|
+
"@toptal/picasso-typography": "3.0.0",
|
|
55
|
+
"@toptal/picasso-modal": "3.0.1",
|
|
56
|
+
"@toptal/picasso-form": "4.0.1",
|
|
57
|
+
"@toptal/picasso-input": "3.0.1",
|
|
57
58
|
"@toptal/picasso-utils": "1.0.3",
|
|
58
59
|
"classnames": "^2.5.1",
|
|
59
60
|
"emoji-mart": "^5.5.2",
|
|
@@ -62,15 +63,14 @@
|
|
|
62
63
|
"hast-util-sanitize": "^3.0.2",
|
|
63
64
|
"hast-util-to-dom": "^3.1.1",
|
|
64
65
|
"hast-util-to-html": "^7.1.3",
|
|
65
|
-
"lexical": "0.11.2"
|
|
66
|
-
"tailwind-merge": "^2.2.2"
|
|
66
|
+
"lexical": "0.11.2"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@material-ui/core": "4.12.4",
|
|
70
70
|
"@testing-library/react-hooks": "^8.0.1",
|
|
71
71
|
"@toptal/picasso-test-utils": "1.1.1",
|
|
72
|
-
"@
|
|
73
|
-
"
|
|
72
|
+
"@toptal/picasso-tailwind-merge": "1.2.0",
|
|
73
|
+
"@types/classnames": "^2.3.1"
|
|
74
74
|
},
|
|
75
75
|
"sideEffects": false,
|
|
76
76
|
"exports": {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { renderHook } from '@testing-library/react-hooks'
|
|
2
|
-
import { getTypographyClassName } from '@toptal/picasso-typography'
|
|
3
|
-
import type { TypographyOptions } from '@toptal/picasso-typography'
|
|
4
2
|
|
|
3
|
+
import type { TypographyOptions } from '../../../utils'
|
|
4
|
+
import { getTypographyClassName } from '../../../utils'
|
|
5
5
|
import useTypographyClasses from './use-typography-classes'
|
|
6
6
|
|
|
7
7
|
jest.mock('@material-ui/core/styles', () => ({
|
|
8
8
|
makeStyles: jest.fn(() => () => ({ root: 'TEST_CLASS_NAME+1' })),
|
|
9
9
|
}))
|
|
10
10
|
|
|
11
|
-
jest.mock('
|
|
11
|
+
jest.mock('../../../utils', () => ({
|
|
12
12
|
__esModule: true,
|
|
13
13
|
typographyStyles: { root: 'TEST_CLASS_NAME' },
|
|
14
14
|
getTypographyClassName: jest.fn(() => 'TEST_CLASS_NAME'),
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { Theme } from '@material-ui/core/styles'
|
|
2
2
|
import { makeStyles } from '@material-ui/core/styles'
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from '@toptal/picasso-typography'
|
|
7
|
-
import type { TypographyOptions } from '@toptal/picasso-typography'
|
|
3
|
+
|
|
4
|
+
import type { TypographyOptions } from '../../../utils'
|
|
5
|
+
import { typographyStyles, getTypographyClassName } from '../../../utils'
|
|
8
6
|
|
|
9
7
|
const useCreateTypographyClasses = makeStyles<Theme>(typographyStyles, {
|
|
10
8
|
name: 'TextEditorTypography',
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { Theme } from '@material-ui/core'
|
|
2
2
|
import { makeStyles } from '@material-ui/core'
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from '@toptal/picasso-typography'
|
|
7
|
-
import type { TypographyOptions } from '@toptal/picasso-typography'
|
|
3
|
+
|
|
4
|
+
import type { TypographyOptions } from '../../../utils'
|
|
5
|
+
import { typographyStyles, getTypographyClassName } from '../../../utils'
|
|
8
6
|
|
|
9
7
|
const useCreateTypographyClasses = makeStyles<Theme>(typographyStyles, {
|
|
10
8
|
name: 'TextEditorTypography',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactElement } from 'react'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import { twMerge } from 'tailwind-merge'
|
|
3
|
+
import { twMerge } from '@toptal/picasso-tailwind-merge'
|
|
4
4
|
import type { BaseProps } from '@toptal/picasso-shared'
|
|
5
5
|
import { ButtonCircular } from '@toptal/picasso-button'
|
|
6
6
|
|
package/src/utils/index.ts
CHANGED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import cx from 'classnames'
|
|
2
|
+
import type { SizeType, ColorType } from '@toptal/picasso-shared'
|
|
3
|
+
import { kebabToCamelCase } from '@toptal/picasso-utils'
|
|
4
|
+
|
|
5
|
+
export type TypographyOptions = {
|
|
6
|
+
variant: 'heading' | 'body'
|
|
7
|
+
size:
|
|
8
|
+
| SizeType<'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge'>
|
|
9
|
+
| 'inherit'
|
|
10
|
+
color?: ColorType
|
|
11
|
+
weight?: 'regular' | 'semibold' | 'inherit'
|
|
12
|
+
underline?: 'solid' | 'dashed'
|
|
13
|
+
invert?: boolean
|
|
14
|
+
lineThrough?: boolean
|
|
15
|
+
as?: React.ElementType<React.HTMLAttributes<HTMLElement>>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const getTypographyClassName = (
|
|
19
|
+
classes: Record<string, string>,
|
|
20
|
+
{
|
|
21
|
+
variant,
|
|
22
|
+
size,
|
|
23
|
+
color,
|
|
24
|
+
weight,
|
|
25
|
+
underline,
|
|
26
|
+
invert,
|
|
27
|
+
lineThrough,
|
|
28
|
+
as,
|
|
29
|
+
}: TypographyOptions
|
|
30
|
+
) => {
|
|
31
|
+
const variantClassName = kebabToCamelCase(`${variant}-${size}`)
|
|
32
|
+
const colorClassName = kebabToCamelCase(`${color}`)
|
|
33
|
+
|
|
34
|
+
const weightVariantClass = weight ? classes[weight] : undefined
|
|
35
|
+
const weightClass =
|
|
36
|
+
weight === 'inherit' || as === 'em'
|
|
37
|
+
? classes.inheritWeight
|
|
38
|
+
: weightVariantClass
|
|
39
|
+
|
|
40
|
+
const underlineClass = underline ? classes[underline] : undefined
|
|
41
|
+
|
|
42
|
+
return cx(
|
|
43
|
+
classes[variantClassName],
|
|
44
|
+
classes[colorClassName],
|
|
45
|
+
weightClass,
|
|
46
|
+
underlineClass,
|
|
47
|
+
{
|
|
48
|
+
[classes.invert]: invert,
|
|
49
|
+
[classes.lineThrough]: lineThrough,
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { Theme } from '@material-ui/core/styles'
|
|
2
|
+
import { createStyles } from '@material-ui/core/styles'
|
|
3
|
+
|
|
4
|
+
const getHeadingMedium = (theme: Theme) => ({
|
|
5
|
+
color: theme.palette.common.black,
|
|
6
|
+
fontWeight: theme.typography.fontWeights.semibold,
|
|
7
|
+
fontSize: '16px',
|
|
8
|
+
lineHeight: '24px',
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export const typographyStyles = (theme: Theme) => {
|
|
12
|
+
const { palette, typography } = theme
|
|
13
|
+
|
|
14
|
+
// All the body variants are mapped to the same MUI variant (body1) -> declaring styles via custom class names
|
|
15
|
+
return createStyles({
|
|
16
|
+
bodyXxsmall: {
|
|
17
|
+
color: palette.text.primary,
|
|
18
|
+
fontWeight: typography.fontWeights.regular,
|
|
19
|
+
fontSize: typography.fontSizes.xxsmall,
|
|
20
|
+
lineHeight: '16px',
|
|
21
|
+
},
|
|
22
|
+
bodyXsmall: {
|
|
23
|
+
color: palette.text.primary,
|
|
24
|
+
fontWeight: typography.fontWeights.regular,
|
|
25
|
+
fontSize: typography.fontSizes.xsmall,
|
|
26
|
+
lineHeight: '18px',
|
|
27
|
+
},
|
|
28
|
+
bodySmall: {
|
|
29
|
+
color: palette.text.primary,
|
|
30
|
+
fontWeight: typography.fontWeights.regular,
|
|
31
|
+
fontSize: typography.fontSizes.small,
|
|
32
|
+
lineHeight: '20px',
|
|
33
|
+
},
|
|
34
|
+
bodyMedium: {
|
|
35
|
+
color: palette.text.primary,
|
|
36
|
+
fontWeight: typography.fontWeights.regular,
|
|
37
|
+
fontSize: typography.fontSizes.medium,
|
|
38
|
+
lineHeight: '22px',
|
|
39
|
+
},
|
|
40
|
+
bodyLarge: {
|
|
41
|
+
color: palette.common.black,
|
|
42
|
+
fontWeight: typography.fontWeights.regular,
|
|
43
|
+
fontSize: typography.fontSizes.large,
|
|
44
|
+
lineHeight: '24px',
|
|
45
|
+
},
|
|
46
|
+
bodyInherit: {
|
|
47
|
+
fontSize: '1em',
|
|
48
|
+
lineHeight: '1.5em',
|
|
49
|
+
fontWeight: typography.fontWeights.regular,
|
|
50
|
+
color: palette.text.primary,
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
headingMedium: getHeadingMedium(theme),
|
|
54
|
+
|
|
55
|
+
regular: {
|
|
56
|
+
fontWeight: typography.fontWeights.regular,
|
|
57
|
+
},
|
|
58
|
+
semibold: {
|
|
59
|
+
fontWeight: typography.fontWeights.semibold,
|
|
60
|
+
},
|
|
61
|
+
inheritWeight: {
|
|
62
|
+
fontWeight: 'inherit',
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
green: {
|
|
66
|
+
color: palette.green.dark,
|
|
67
|
+
},
|
|
68
|
+
red: {
|
|
69
|
+
color: palette.red.main,
|
|
70
|
+
},
|
|
71
|
+
yellow: {
|
|
72
|
+
color: palette.yellow.main,
|
|
73
|
+
},
|
|
74
|
+
lightGrey: {
|
|
75
|
+
color: palette.grey.light2,
|
|
76
|
+
},
|
|
77
|
+
grey: {
|
|
78
|
+
color: palette.grey.main,
|
|
79
|
+
},
|
|
80
|
+
'greyMain-2': {
|
|
81
|
+
color: palette.grey.main2,
|
|
82
|
+
},
|
|
83
|
+
darkGrey: {
|
|
84
|
+
color: palette.text.primary,
|
|
85
|
+
},
|
|
86
|
+
black: {
|
|
87
|
+
color: palette.common.black,
|
|
88
|
+
},
|
|
89
|
+
lightBlue: {
|
|
90
|
+
color: palette.blue.light,
|
|
91
|
+
},
|
|
92
|
+
invert: {
|
|
93
|
+
color: palette.common.white,
|
|
94
|
+
},
|
|
95
|
+
inherit: {
|
|
96
|
+
color: 'inherit',
|
|
97
|
+
},
|
|
98
|
+
blue: {
|
|
99
|
+
color: palette.blue.main,
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
solid: {
|
|
103
|
+
textDecoration: 'underline',
|
|
104
|
+
textDecorationStyle: 'solid',
|
|
105
|
+
},
|
|
106
|
+
dashed: {
|
|
107
|
+
textDecoration: 'underline',
|
|
108
|
+
textDecorationStyle: 'dashed',
|
|
109
|
+
},
|
|
110
|
+
lineThrough: {
|
|
111
|
+
textDecoration: 'line-through',
|
|
112
|
+
},
|
|
113
|
+
})
|
|
114
|
+
}
|