@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.
@@ -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
- var 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'];
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
- var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'rs-text-1';
12
-
13
- var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
14
- _ref$paragraphOffsetA = _ref.paragraphOffsetAuto,
15
- paragraphOffsetAuto = _ref$paragraphOffsetA === void 0 ? false : _ref$paragraphOffsetA,
16
- _ref$hardness = _ref.hardness,
17
- hardness = _ref$hardness === void 0 ? undefined : _ref$hardness,
18
- _ref$external = _ref.external,
19
- external = _ref$external === void 0 ? false : _ref$external,
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("'rs-digits' style is deprecated, please use 'rs-digits-1' instead");
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["rs-typography_theme_".concat(theme)], styles["rs-text_hardness_".concat(hardness !== null && hardness !== void 0 ? hardness : 'auto')], paragraphOffsetAuto && styles['rs-text_paragraph-offset-auto']);
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["rs-link_mode_".concat(mode)], hardness && styles["rs-link_hardness_".concat(hardness)], external && styles["rs-link_external"], theme && styles["rs-typography_theme_".concat(theme)]);
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
- var _context;
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["rs-typography_theme_".concat(theme)]);
38
+ return cn(styles[type], theme && styles[`rs-typography_theme_${theme}`]);
48
39
  }
49
40
 
50
41
  return textCn;
51
42
  }
52
43
 
53
- var textCn = createTextCn();
44
+ const textCn = createTextCn();
54
45
 
55
- var useTextStyles = function useTextStyles() {
56
- return createTextCn(useThemeWithUndefined());
57
- };
46
+ const useTextStyles = () => createTextCn(useThemeWithUndefined());
58
47
 
59
- var colorCn = function colorCn(color) {
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 };