@dss-kit/ui-kit 1.1.1 → 1.1.2

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.
@@ -8,10 +8,10 @@ import { MarkdownShortcutPlugin as U } from "@lexical/react/LexicalMarkdownShort
8
8
  import { OnChangePlugin as W } from "@lexical/react/LexicalOnChangePlugin";
9
9
  import { TablePlugin as H } from "@lexical/react/LexicalTablePlugin";
10
10
  import { useState as u, useMemo as a, useCallback as p } from "react";
11
- import { MARKDOWN_TOOLBAR_DEFAULT_ACTIONS as K } from "./MarkdownTextEditor.const.js";
12
- import { MarkdownTextEditorLocaleProvider as q } from "./MarkdownTextEditor.locale.js";
11
+ import { getEditorConfig as K } from "./configs/editor.config.js";
12
+ import { MARKDOWN_TOOLBAR_DEFAULT_ACTIONS as q } from "./MarkdownTextEditor.const.js";
13
+ import { MarkdownTextEditorLocaleProvider as z } from "./MarkdownTextEditor.locale.js";
13
14
  import { EDITOR_TRANSFORMERS as g } from "./transformers/index.js";
14
- import { getEditorConfig as z } from "./configs/editor.config.js";
15
15
  import { EditorStateContext as G } from "./contexts/EditorStateContext/EditorStateContext.js";
16
16
  import { ToolbarContext as J } from "./contexts/ToolbarContext/ToolbarContext.js";
17
17
  import { EditorToolbar as Q } from "./components/EditorToolbar/EditorToolbar.js";
@@ -40,7 +40,7 @@ function Ao({
40
40
  fieldClassName: R,
41
41
  previewClassName: v
42
42
  }) {
43
- const [d, N] = u(""), [i, A] = u(!1), { availableActions: s, onImagesUpload: _ } = b || {}, O = a(() => z(), []), I = a(
43
+ const [d, N] = u(""), [i, A] = u(!1), { availableActions: s, onImagesUpload: _ } = b || {}, O = a(() => K(), []), I = a(
44
44
  () => ({
45
45
  isEditable: !m,
46
46
  isPreviewMode: i,
@@ -49,7 +49,7 @@ function Ao({
49
49
  }),
50
50
  [m, i, d]
51
51
  ), L = a(() => ({
52
- availableActions: s || K
52
+ availableActions: s || q
53
53
  }), [s]), f = p(
54
54
  (t) => {
55
55
  N(t), r.onMarkdownChange && r.onMarkdownChange(t);
@@ -64,7 +64,7 @@ function Ao({
64
64
  },
65
65
  [f, r]
66
66
  );
67
- return /* @__PURE__ */ o(q, { locale: M, children: /* @__PURE__ */ o(V, { initialConfig: O, children: /* @__PURE__ */ o(G.Provider, { value: I, children: /* @__PURE__ */ c(J.Provider, { value: L, children: [
67
+ return /* @__PURE__ */ o(z, { locale: M, children: /* @__PURE__ */ o(V, { initialConfig: O, children: /* @__PURE__ */ o(G.Provider, { value: I, children: /* @__PURE__ */ c(J.Provider, { value: L, children: [
68
68
  /* @__PURE__ */ c(
69
69
  h,
70
70
  {
@@ -6,11 +6,11 @@ import { ContentEditable as f } from "@lexical/react/LexicalContentEditable";
6
6
  import { LexicalErrorBoundary as c } from "@lexical/react/LexicalErrorBoundary";
7
7
  import { RichTextPlugin as p } from "@lexical/react/LexicalRichTextPlugin";
8
8
  import { useMemo as s } from "react";
9
- import { EDITOR_TRANSFORMERS as u } from "../../controls/MarkdownTextEditor/transformers/index.js";
10
- import { markdownTextStyle as x } from "./MarkdownText.styles.js";
11
- import { Text as w } from "../../builders/Text/Text.js";
12
- import { EditorStateContext as E } from "../../controls/MarkdownTextEditor/contexts/EditorStateContext/EditorStateContext.js";
13
- import { getEditorConfig as k } from "../../controls/MarkdownTextEditor/configs/editor.config.js";
9
+ import { getEditorConfig as u } from "../../controls/MarkdownTextEditor/configs/editor.config.js";
10
+ import { EDITOR_TRANSFORMERS as x } from "../../controls/MarkdownTextEditor/transformers/index.js";
11
+ import { markdownTextStyle as w } from "./MarkdownText.styles.js";
12
+ import { Text as E } from "../../builders/Text/Text.js";
13
+ import { EditorStateContext as k } from "../../controls/MarkdownTextEditor/contexts/EditorStateContext/EditorStateContext.js";
14
14
  function F({
15
15
  markdown: t,
16
16
  className: i,
@@ -27,15 +27,15 @@ function F({
27
27
  }),
28
28
  [r]
29
29
  );
30
- return r ? /* @__PURE__ */ o(E.Provider, { value: a, children: /* @__PURE__ */ o(
30
+ return r ? /* @__PURE__ */ o(k.Provider, { value: a, children: /* @__PURE__ */ o(
31
31
  d,
32
32
  {
33
33
  initialConfig: {
34
- ...k(),
34
+ ...u(),
35
35
  editable: !1,
36
36
  namespace: "ui-kit-markdown-text-viewer",
37
37
  editorState: () => {
38
- l(r, u);
38
+ l(r, x);
39
39
  }
40
40
  },
41
41
  children: /* @__PURE__ */ o(
@@ -44,7 +44,7 @@ function F({
44
44
  contentEditable: /* @__PURE__ */ o(
45
45
  f,
46
46
  {
47
- className: m(x, i),
47
+ className: m(w, i),
48
48
  "aria-placeholder": "markdown text",
49
49
  placeholder: () => null
50
50
  }
@@ -56,7 +56,7 @@ function F({
56
56
  },
57
57
  r
58
58
  ) }) : typeof e == "string" ? /* @__PURE__ */ o(
59
- w,
59
+ E,
60
60
  {
61
61
  variant: "body-2",
62
62
  colorName: "tertiary",
@@ -1,90 +1,74 @@
1
- import { css as i } from "@emotion/css";
1
+ import { css as r } from "@emotion/css";
2
2
  import { typography as e } from "../../../styles/utils/typography.js";
3
3
  import { theme as l } from "../../../utils/theme/index.js";
4
- const { color: o, cornerRadius: n, spacing: t } = l, h = i({
4
+ const { color: t, cornerRadius: a, spacing: o } = l, c = r({
5
5
  width: "100%",
6
6
  cursor: "default",
7
7
  userSelect: "text",
8
8
  outline: "none",
9
9
  ...e.body2,
10
- color: o.text.primary,
10
+ color: t.text.primary,
11
11
  overflowWrap: "anywhere",
12
12
  "p, ul, ol, pre, blockquote, table": {
13
- margin: `${t.sm} 0`
13
+ margin: `${o.sm} 0`
14
14
  },
15
15
  "h1, h2, h3, h4, h5, h6": {
16
- margin: `${t.md} 0 ${t.sm}`,
16
+ margin: `${o.md} 0 ${o.sm}`,
17
17
  fontWeight: 600
18
18
  },
19
- h1: {
20
- fontSize: e.title1.fontSize,
21
- lineHeight: e.title1.lineHeight
22
- },
23
- h2: {
24
- fontSize: e.title2.fontSize,
25
- lineHeight: e.title2.lineHeight
26
- },
27
- h3: {
28
- fontSize: e.title3.fontSize,
29
- lineHeight: e.title3.lineHeight
30
- },
31
- h4: {
32
- fontSize: e.headline2.fontSize,
33
- lineHeight: e.headline2.lineHeight
34
- },
35
- h5: {
36
- fontSize: e.headline3.fontSize,
37
- lineHeight: e.headline3.lineHeight
38
- },
39
- h6: {
40
- fontSize: e.body1.fontSize,
41
- lineHeight: e.body1.lineHeight
42
- },
19
+ // Токены целиком, а не только fontSize/lineHeight: вместе с ними приходят и адаптивные
20
+ // размеры (title-1 ниже 768px), как у <Text variant>.
21
+ h1: { ...e.title1 },
22
+ h2: { ...e.title2 },
23
+ h3: { ...e.title3 },
24
+ h4: { ...e.headline2 },
25
+ h5: { ...e.headline3 },
26
+ h6: { ...e.body1 },
43
27
  ul: {
44
- paddingLeft: t.xl,
28
+ paddingLeft: o.xl,
45
29
  listStyleType: "disc"
46
30
  },
47
31
  ol: {
48
- paddingLeft: t.xl,
32
+ paddingLeft: o.xl,
49
33
  listStyleType: "decimal"
50
34
  },
51
35
  li: {
52
- margin: `${t.xs} 0`
36
+ margin: `${o.xs} 0`
53
37
  },
54
38
  a: {
55
- color: o.text.accent,
39
+ color: t.text.accent,
56
40
  textDecoration: "underline"
57
41
  },
58
42
  code: {
59
- padding: `0 ${t.xs}`,
60
- borderRadius: n.xs,
61
- backgroundColor: o.fill.neutral_secondary,
43
+ padding: `0 ${o.xs}`,
44
+ borderRadius: a.xs,
45
+ backgroundColor: t.fill.neutral_secondary,
62
46
  fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'
63
47
  },
64
48
  "pre code": {
65
49
  display: "block",
66
- padding: t.md,
50
+ padding: o.md,
67
51
  overflowX: "auto"
68
52
  },
69
53
  blockquote: {
70
54
  marginLeft: 0,
71
- paddingLeft: t.md,
72
- borderLeft: `3px solid ${o.border.neutral_alpha_basic}`,
73
- color: o.text.secondary
55
+ paddingLeft: o.md,
56
+ borderLeft: `3px solid ${t.border.neutral_alpha_basic}`,
57
+ color: t.text.secondary
74
58
  },
75
59
  table: {
76
60
  width: "100%",
77
61
  borderCollapse: "collapse"
78
62
  },
79
63
  "th, td": {
80
- border: `1px solid ${o.border.neutral_alpha_basic}`,
81
- padding: t.sm,
64
+ border: `1px solid ${t.border.neutral_alpha_basic}`,
65
+ padding: o.sm,
82
66
  textAlign: "left"
83
67
  },
84
68
  th: {
85
- backgroundColor: o.fill.neutral_secondary
69
+ backgroundColor: t.fill.neutral_secondary
86
70
  }
87
71
  });
88
72
  export {
89
- h as markdownTextStyle
73
+ c as markdownTextStyle
90
74
  };
@@ -14,36 +14,23 @@
14
14
  }
15
15
 
16
16
  /* ==== Titles ==== */
17
+ // От ширины экрана зависит только title-1, ссылка на макет со шкалой — в
18
+ // styles/utils/typography.ts (TM-4108). Значения синхронны с typography.ts.
17
19
  @mixin title-1 {
18
20
  @include text-size(32px, 36px);
19
21
 
20
22
  // md = 768px
21
23
  @include breakpoints.bp-md() {
22
- font-size: 24px;
24
+ @include text-size(28px, 32px);
23
25
  }
24
26
  }
25
27
 
26
28
  @mixin title-2 {
27
29
  @include text-size(24px, 28px);
28
-
29
- // md = 768px
30
- @include breakpoints.bp-md() {
31
- font-size: 20px;
32
- }
33
30
  }
34
31
 
35
32
  @mixin title-3 {
36
33
  @include text-size(20px, 28px);
37
-
38
- // md = 768px
39
- @include breakpoints.bp-md() {
40
- font-size: 18px;
41
- }
42
-
43
- // xs = 480px
44
- @include breakpoints.bp-xs() {
45
- font-size: 16px;
46
- }
47
34
  }
48
35
 
49
36
  /* ==== Headline ==== */
@@ -4,24 +4,25 @@ const e = {
4
4
  wordBreak: "break-word"
5
5
  }, n = {
6
6
  common: e,
7
+ // От ширины экрана зависит только title-1: ниже 768px — 28/32. Остальные варианты
8
+ // одинаковы на всех ширинах. Шкала согласована с дизайнером (TM-4108):
9
+ // https://www.figma.com/design/OL4CCm8EL0IpsfoEeykNHi/?node-id=6408-661
10
+ // Значения синхронны с styles/utils/typography/_variants.scss.
7
11
  title1: {
8
12
  ...e,
9
13
  fontSize: 32,
10
14
  lineHeight: "36px",
11
- [i.md()]: { fontSize: 24 }
15
+ [i.md()]: { fontSize: 28, lineHeight: "32px" }
12
16
  },
13
17
  title2: {
14
18
  ...e,
15
19
  fontSize: 24,
16
- lineHeight: "28px",
17
- [i.md()]: { fontSize: 20 }
20
+ lineHeight: "28px"
18
21
  },
19
22
  title3: {
20
23
  ...e,
21
24
  fontSize: 20,
22
- lineHeight: "28px",
23
- [i.md()]: { fontSize: 18 },
24
- [i.xs()]: { fontSize: 16 }
25
+ lineHeight: "28px"
25
26
  },
26
27
  headline1: {
27
28
  ...e,
@@ -8,26 +8,27 @@ const common = {
8
8
  export const typography = {
9
9
  common,
10
10
 
11
+ // От ширины экрана зависит только title-1: ниже 768px — 28/32. Остальные варианты
12
+ // одинаковы на всех ширинах. Шкала согласована с дизайнером (TM-4108):
13
+ // https://www.figma.com/design/OL4CCm8EL0IpsfoEeykNHi/?node-id=6408-661
14
+ // Значения синхронны с styles/utils/typography/_variants.scss.
11
15
  title1: {
12
16
  ...common,
13
17
  fontSize: 32,
14
18
  lineHeight: "36px",
15
- [bp.md()]: { fontSize: 24 },
19
+ [bp.md()]: { fontSize: 28, lineHeight: "32px" },
16
20
  },
17
21
 
18
22
  title2: {
19
23
  ...common,
20
24
  fontSize: 24,
21
25
  lineHeight: "28px",
22
- [bp.md()]: { fontSize: 20 },
23
26
  },
24
27
 
25
28
  title3: {
26
29
  ...common,
27
30
  fontSize: 20,
28
31
  lineHeight: "28px",
29
- [bp.md()]: { fontSize: 18 },
30
- [bp.xs()]: { fontSize: 16 },
31
32
  },
32
33
 
33
34
  headline1: {