@rescui/typography 0.19.0 → 0.19.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/lib/create-text-cn.js +18 -31
- package/lib/index-moduled.css +115 -123
- package/lib/index-moduled.p.module.css.js +120 -120
- package/lib/index.css +0 -8
- package/lib/mixins.p.css +0 -39
- package/lib/mixins.pcss +0 -39
- package/lib/public-api.p.css +5 -39
- package/lib/public-api.pcss +5 -39
- package/package.json +5 -5
package/lib/create-text-cn.js
CHANGED
|
@@ -1,63 +1,50 @@
|
|
|
1
1
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
2
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
3
2
|
import { useThemeWithUndefined } from '@rescui/ui-contexts';
|
|
4
3
|
import cn from 'classnames';
|
|
5
4
|
import styles from './index-moduled.p.module.css.js';
|
|
6
|
-
|
|
5
|
+
const TEXT_BASES = ['rs-digits-1', 'rs-digits-2', 'rs-super-hero', 'rs-middle-hero', 'rs-hero', 'rs-subtitle-1', 'rs-subtitle-2', 'rs-h1', 'rs-h2', 'rs-h3', 'rs-h4', 'rs-h5', 'rs-overline', 'rs-text-1', 'rs-text-2', 'rs-text-3'];
|
|
7
6
|
|
|
8
7
|
function createTextCn(theme) {
|
|
9
8
|
// eslint-disable-next-line complexity
|
|
10
9
|
function textCn() {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
_ref$mode = _ref.mode,
|
|
21
|
-
mode = _ref$mode === void 0 ? 'classic' : _ref$mode,
|
|
22
|
-
_ref$alpha = _ref.alpha,
|
|
23
|
-
alpha = _ref$alpha === void 0 ? undefined : _ref$alpha,
|
|
24
|
-
_ref$offsetItems = _ref.offsetItems,
|
|
25
|
-
offsetItems = _ref$offsetItems === void 0 ? undefined : _ref$offsetItems;
|
|
10
|
+
let type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'rs-text-1';
|
|
11
|
+
let {
|
|
12
|
+
paragraphOffsetAuto = false,
|
|
13
|
+
hardness = undefined,
|
|
14
|
+
external = false,
|
|
15
|
+
mode = 'classic',
|
|
16
|
+
alpha = undefined,
|
|
17
|
+
offsetItems = undefined
|
|
18
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
26
19
|
|
|
27
20
|
if (type === 'rs-digits') {
|
|
28
21
|
// eslint-disable-next-line no-param-reassign
|
|
29
22
|
type = 'rs-digits-1';
|
|
30
|
-
console.warn(
|
|
23
|
+
console.warn(`'rs-digits' style is deprecated, please use 'rs-digits-1' instead`);
|
|
31
24
|
}
|
|
32
25
|
|
|
33
26
|
if (_includesInstanceProperty(TEXT_BASES).call(TEXT_BASES, type)) {
|
|
34
|
-
return cn(styles[type], theme && styles[
|
|
27
|
+
return cn(styles[type], theme && styles[`rs-typography_theme_${theme}`], styles[`rs-text_hardness_${hardness ?? 'auto'}`], paragraphOffsetAuto && styles['rs-text_paragraph-offset-auto']);
|
|
35
28
|
}
|
|
36
29
|
|
|
37
30
|
if (type === 'rs-link') {
|
|
38
|
-
return cn(styles[type], styles[
|
|
31
|
+
return cn(styles[type], styles[`rs-link_mode_${mode}`], hardness && styles[`rs-link_hardness_${hardness}`], external && styles[`rs-link_external`], theme && styles[`rs-typography_theme_${theme}`]);
|
|
39
32
|
}
|
|
40
33
|
|
|
41
34
|
if (type === 'rs-ul' || type === 'rs-ol') {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return cn(styles[type], alpha && styles["rs-ol_alpha_".concat(alpha)], offsetItems && styles[_concatInstanceProperty(_context = "".concat(type, "_offset-items_")).call(_context, offsetItems)]);
|
|
35
|
+
return cn(styles[type], alpha && styles[`rs-ol_alpha_${alpha}`], offsetItems && styles[`${type}_offset-items_${offsetItems}`]);
|
|
45
36
|
}
|
|
46
37
|
|
|
47
|
-
return cn(styles[type], theme && styles[
|
|
38
|
+
return cn(styles[type], theme && styles[`rs-typography_theme_${theme}`]);
|
|
48
39
|
}
|
|
49
40
|
|
|
50
41
|
return textCn;
|
|
51
42
|
}
|
|
52
43
|
|
|
53
|
-
|
|
44
|
+
const textCn = createTextCn();
|
|
54
45
|
|
|
55
|
-
|
|
56
|
-
return createTextCn(useThemeWithUndefined());
|
|
57
|
-
};
|
|
46
|
+
const useTextStyles = () => createTextCn(useThemeWithUndefined());
|
|
58
47
|
|
|
59
|
-
|
|
60
|
-
return styles["rs-text_color_".concat(color)];
|
|
61
|
-
};
|
|
48
|
+
const colorCn = color => styles[`rs-text_color_${color}`];
|
|
62
49
|
|
|
63
50
|
export { colorCn, createTextCn, textCn, useTextStyles };
|