@jobber/components 6.24.0 → 6.25.0
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/Typography/Typography.d.ts +18 -2
- package/dist/Typography-cjs.js +21 -20
- package/dist/Typography-es.js +21 -20
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import { CSSProperties, ReactNode } from "react";
|
|
2
2
|
import fontSizes from "./css/FontSizes.module.css";
|
|
3
3
|
import fontWeights from "./css/FontWeights.module.css";
|
|
4
4
|
import textCases from "./css/TextCases.module.css";
|
|
@@ -42,6 +42,22 @@ export interface TypographyProps {
|
|
|
42
42
|
* @example "double color-invoice" for a double underline in the specified color
|
|
43
43
|
*/
|
|
44
44
|
readonly underline?: UnderlineStyle | UnderlineStyleWithColor | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* **Use at your own risk:** Custom classNames for specific elements. This should only be used as a
|
|
47
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
48
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
49
|
+
*/
|
|
50
|
+
readonly UNSAFE_className?: {
|
|
51
|
+
textStyle?: string;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* **Use at your own risk:** Custom style for specific elements. This should only be used as a
|
|
55
|
+
* **last resort**. Using this may result in unexpected side effects.
|
|
56
|
+
* More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
|
|
57
|
+
*/
|
|
58
|
+
readonly UNSAFE_style?: {
|
|
59
|
+
textStyle?: CSSProperties;
|
|
60
|
+
};
|
|
45
61
|
}
|
|
46
62
|
export type TypographyOptions = Omit<TypographyProps, "children">;
|
|
47
|
-
export declare function Typography({ id, children, element: Tag, size, align, fontWeight, textCase, textColor, emphasisType, numberOfLines, fontFamily, underline, }: TypographyProps): JSX.Element;
|
|
63
|
+
export declare function Typography({ id, children, element: Tag, size, align, fontWeight, textCase, textColor, emphasisType, numberOfLines, fontFamily, underline, UNSAFE_className, UNSAFE_style, }: TypographyProps): JSX.Element;
|
package/dist/Typography-cjs.js
CHANGED
|
@@ -23,32 +23,33 @@ var fontFamilies = {"base":"V9SSKxs15xE-","display":"dvw7zxC9s9g-","spinning":"N
|
|
|
23
23
|
|
|
24
24
|
var underlineStyles = {"basicUnderline":"qp8E5e4q-so-","spinning":"F-Ybr7sJi6Q-"};
|
|
25
25
|
|
|
26
|
-
function Typography({ id, children, element: Tag = "p", size, align, fontWeight = "regular", textCase, textColor, emphasisType, numberOfLines, fontFamily, underline, }) {
|
|
26
|
+
function Typography({ id, children, element: Tag = "p", size, align, fontWeight = "regular", textCase, textColor, emphasisType, numberOfLines, fontFamily, underline, UNSAFE_className, UNSAFE_style, }) {
|
|
27
27
|
const shouldTruncateText = numberOfLines && numberOfLines > 0;
|
|
28
|
-
const className = classnames(styles.base, fontWeights[fontWeight], size && fontSizes[size], textCase && textCases[textCase], textColor && textColors[textColor], emphasisType && emphasis[emphasisType], fontFamily && fontFamilies[fontFamily], shouldTruncateText && truncate.textTruncate, underline && underlineStyles.basicUnderline, Object.assign({}, (align && { [alignment[align]]: align !== `start` })));
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
stylesOverrides = {
|
|
28
|
+
const className = classnames(styles.base, fontWeights[fontWeight], size && fontSizes[size], textCase && textCases[textCase], textColor && textColors[textColor], emphasisType && emphasis[emphasisType], fontFamily && fontFamilies[fontFamily], shouldTruncateText && truncate.textTruncate, underline && underlineStyles.basicUnderline, Object.assign({}, (align && { [alignment[align]]: align !== `start` })), UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.textStyle);
|
|
29
|
+
const truncateStyles = shouldTruncateText
|
|
30
|
+
? {
|
|
32
31
|
WebkitLineClamp: numberOfLines,
|
|
33
32
|
WebkitBoxOrient: "vertical",
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
stylesOverrides.textDecorationStyle = underlineStyle;
|
|
39
|
-
stylesOverrides.textDecorationColor = computeUnderlineColor(underlineColor, textColor);
|
|
40
|
-
}
|
|
41
|
-
return (React.createElement(Tag, { id: id, className: className, style: stylesOverrides }, children));
|
|
33
|
+
}
|
|
34
|
+
: {};
|
|
35
|
+
const underlineInlineStyles = computeUnderlineStyles(underline, textColor);
|
|
36
|
+
return (React.createElement(Tag, { id: id, className: className, style: Object.assign(Object.assign(Object.assign({}, truncateStyles), underlineInlineStyles), UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.textStyle) }, children));
|
|
42
37
|
}
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
function computeUnderlineStyles(underline, textColor) {
|
|
39
|
+
if (!underline) {
|
|
40
|
+
return {};
|
|
41
|
+
}
|
|
42
|
+
const [underlineStyle, underlineColor] = underline.split(" ");
|
|
43
|
+
const underlineInlineStyles = {
|
|
44
|
+
textDecorationStyle: underlineStyle,
|
|
45
|
+
};
|
|
46
|
+
if (underlineColor) {
|
|
47
|
+
underlineInlineStyles.textDecorationColor = `var(--${underlineColor})`;
|
|
48
48
|
}
|
|
49
|
-
if (textColor) {
|
|
50
|
-
|
|
49
|
+
else if (textColor) {
|
|
50
|
+
underlineInlineStyles.textDecorationColor = textColors[textColor];
|
|
51
51
|
}
|
|
52
|
+
return underlineInlineStyles;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
exports.Typography = Typography;
|
package/dist/Typography-es.js
CHANGED
|
@@ -21,32 +21,33 @@ var fontFamilies = {"base":"V9SSKxs15xE-","display":"dvw7zxC9s9g-","spinning":"N
|
|
|
21
21
|
|
|
22
22
|
var underlineStyles = {"basicUnderline":"qp8E5e4q-so-","spinning":"F-Ybr7sJi6Q-"};
|
|
23
23
|
|
|
24
|
-
function Typography({ id, children, element: Tag = "p", size, align, fontWeight = "regular", textCase, textColor, emphasisType, numberOfLines, fontFamily, underline, }) {
|
|
24
|
+
function Typography({ id, children, element: Tag = "p", size, align, fontWeight = "regular", textCase, textColor, emphasisType, numberOfLines, fontFamily, underline, UNSAFE_className, UNSAFE_style, }) {
|
|
25
25
|
const shouldTruncateText = numberOfLines && numberOfLines > 0;
|
|
26
|
-
const className = classnames(styles.base, fontWeights[fontWeight], size && fontSizes[size], textCase && textCases[textCase], textColor && textColors[textColor], emphasisType && emphasis[emphasisType], fontFamily && fontFamilies[fontFamily], shouldTruncateText && truncate.textTruncate, underline && underlineStyles.basicUnderline, Object.assign({}, (align && { [alignment[align]]: align !== `start` })));
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
stylesOverrides = {
|
|
26
|
+
const className = classnames(styles.base, fontWeights[fontWeight], size && fontSizes[size], textCase && textCases[textCase], textColor && textColors[textColor], emphasisType && emphasis[emphasisType], fontFamily && fontFamilies[fontFamily], shouldTruncateText && truncate.textTruncate, underline && underlineStyles.basicUnderline, Object.assign({}, (align && { [alignment[align]]: align !== `start` })), UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.textStyle);
|
|
27
|
+
const truncateStyles = shouldTruncateText
|
|
28
|
+
? {
|
|
30
29
|
WebkitLineClamp: numberOfLines,
|
|
31
30
|
WebkitBoxOrient: "vertical",
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
stylesOverrides.textDecorationStyle = underlineStyle;
|
|
37
|
-
stylesOverrides.textDecorationColor = computeUnderlineColor(underlineColor, textColor);
|
|
38
|
-
}
|
|
39
|
-
return (React.createElement(Tag, { id: id, className: className, style: stylesOverrides }, children));
|
|
31
|
+
}
|
|
32
|
+
: {};
|
|
33
|
+
const underlineInlineStyles = computeUnderlineStyles(underline, textColor);
|
|
34
|
+
return (React.createElement(Tag, { id: id, className: className, style: Object.assign(Object.assign(Object.assign({}, truncateStyles), underlineInlineStyles), UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.textStyle) }, children));
|
|
40
35
|
}
|
|
41
|
-
function
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
function computeUnderlineStyles(underline, textColor) {
|
|
37
|
+
if (!underline) {
|
|
38
|
+
return {};
|
|
39
|
+
}
|
|
40
|
+
const [underlineStyle, underlineColor] = underline.split(" ");
|
|
41
|
+
const underlineInlineStyles = {
|
|
42
|
+
textDecorationStyle: underlineStyle,
|
|
43
|
+
};
|
|
44
|
+
if (underlineColor) {
|
|
45
|
+
underlineInlineStyles.textDecorationColor = `var(--${underlineColor})`;
|
|
46
46
|
}
|
|
47
|
-
if (textColor) {
|
|
48
|
-
|
|
47
|
+
else if (textColor) {
|
|
48
|
+
underlineInlineStyles.textDecorationColor = textColors[textColor];
|
|
49
49
|
}
|
|
50
|
+
return underlineInlineStyles;
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
export { Typography as T };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.25.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -489,5 +489,5 @@
|
|
|
489
489
|
"> 1%",
|
|
490
490
|
"IE 10"
|
|
491
491
|
],
|
|
492
|
-
"gitHead": "
|
|
492
|
+
"gitHead": "b5aa4ca87e9b0899c7aeacb09056bd8c6f10d13a"
|
|
493
493
|
}
|