@dss-kit/ui-kit 0.3.10 → 1.0.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/components/builders/Modal/Modal.js +3 -3
- package/dist/components/builders/Modal/ModalFooter/ModalFooter.js +7 -7
- package/dist/components/builders/Modal/ModalHeader/ModalHeader.js +15 -15
- package/dist/components/builders/Modal/ModalMain/styles.js +3 -3
- package/dist/components/builders/Modal/styles.js +2 -2
- package/dist/components/builders/Table/Table.js +66 -58
- package/dist/components/builders/Table/Table.utils.js +5 -5
- package/dist/components/builders/Table/TableBodyRow/TableBodyRow.js +5 -5
- package/dist/components/builders/Table/TableHeadRow/TableHeadRow.js +4 -4
- package/dist/components/builders/Table/TablePagination/TablePagination.js +44 -44
- package/dist/components/builders/Table/TableWrapper/TableWrapper.js +19 -19
- package/dist/components/charts/LineChart/constants.js +16 -16
- package/dist/components/charts/LineChart/utils.js +2 -2
- package/dist/components/charts/PieProgressChart/constants.js +16 -10
- package/dist/components/controls/Button/Button.js +35 -35
- package/dist/components/controls/Button/styles.js +4 -4
- package/dist/components/controls/Checkbox/styles.js +7 -7
- package/dist/components/controls/IconButton/styles.js +27 -27
- package/dist/components/controls/Input/styles.js +10 -10
- package/dist/components/controls/MarkdownTextEditor/MarkdownTextEditor.js +32 -32
- package/dist/components/controls/MarkdownTextEditor/components/EditorToolbar/ActionMenuButton/ActionMenuButton.js +13 -13
- package/dist/components/controls/MarkdownTextEditor/components/EditorToolbar/ActionMenuButton/ActionMenuButton.styles.js +2 -2
- package/dist/components/controls/MarkdownTextEditor/components/EditorToolbar/EditorToolbar.js +43 -43
- package/dist/components/controls/MarkdownTextEditor/nodes/CustomLinkNode/parts/CustomLinkNodeComponent/CustomLinkNodeComponent.styles.js +3 -3
- package/dist/components/controls/MarkdownTextEditor/nodes/ImageRowNode/parts/ImageRowNodeComponent/ImageRowNodeComponent.styles.js +2 -2
- package/dist/components/controls/MarkdownTextEditor/themes/editor.theme.js +1 -1
- package/dist/components/controls/OtpInput/styles.js +11 -11
- package/dist/components/controls/RadioGroup/Radio.js +48 -48
- package/dist/components/controls/SegmentControl/SegmentControl.js +12 -12
- package/dist/components/controls/SegmentControl/styles.js +8 -8
- package/dist/components/controls/Select/styles.js +19 -19
- package/dist/components/controls/Switch/styles.js +12 -12
- package/dist/components/controls/Tabs/Tabs.js +10 -10
- package/dist/components/shared/Avatar/Avatar.js +8 -8
- package/dist/components/shared/Badge/Badge.js +40 -40
- package/dist/components/shared/Hint/styles.js +6 -6
- package/dist/components/shared/MarkdownText/MarkdownText.js +10 -10
- package/dist/components/shared/MarkdownText/MarkdownText.styles.js +4 -4
- package/dist/components/shared/Popover/PopoverContent/PopoverContent.js +2 -2
- package/dist/components/shared/Skeleton/Skeleton.js +11 -11
- package/dist/components/shared/Tag/Tag.js +14 -14
- package/dist/components/shared/Toast/Toast.js +30 -30
- package/dist/components/shared/Tooltip/Tooltip.js +28 -28
- package/dist/components/shared/Tooltip/constants.js +3 -3
- package/dist/index.js +37 -34
- package/dist/providers/ThemeProviderScoped/ThemeProviderScoped.const.d.ts +8 -0
- package/dist/providers/ThemeProviderScoped/ThemeProviderScoped.context.d.ts +12 -0
- package/dist/providers/ThemeProviderScoped/ThemeProviderScoped.context.js +12 -0
- package/dist/providers/ThemeProviderScoped/ThemeProviderScoped.d.ts +1 -1
- package/dist/providers/ThemeProviderScoped/ThemeProviderScoped.js +37 -26
- package/dist/providers/ThemeProviderScoped/ThemeProviderScoped.types.d.ts +30 -5
- package/dist/providers/ThemeProviderScoped/index.d.ts +1 -0
- package/dist/root.css +1 -1
- package/dist/ui-kit.cjs +8 -8
- package/dist/ui-kit.css +1 -1
- package/dist/utils/theme/index.d.ts +141 -141
- package/dist/utils/theme/index.js +14 -14
- package/dist/utils/theme/palette.d.ts +184 -0
- package/dist/utils/theme/palette.js +187 -0
- package/package.json +1 -1
- package/dist/providers/ThemeProviderScoped/styles.module.scss.js +0 -7
- package/dist/utils/theme/color.d.ts +0 -184
- package/dist/utils/theme/color.js +0 -187
|
@@ -44,75 +44,75 @@ const c = r({
|
|
|
44
44
|
custom: r({})
|
|
45
45
|
}, n = {
|
|
46
46
|
primary: r({
|
|
47
|
-
backgroundColor: o.color.fill.
|
|
48
|
-
":where(&) svg": { color: o.color.icon.
|
|
47
|
+
backgroundColor: o.color.fill.accent_primary,
|
|
48
|
+
":where(&) svg": { color: o.color.icon.primary_inverse },
|
|
49
49
|
"&:hover:not(:disabled), &:active:not(:disabled)": {
|
|
50
|
-
backgroundColor: o.color.fill.
|
|
51
|
-
":where(&) svg": { color: o.color.icon.
|
|
50
|
+
backgroundColor: o.color.fill.accent_primary_hover,
|
|
51
|
+
":where(&) svg": { color: o.color.icon.primary_inverse }
|
|
52
52
|
}
|
|
53
53
|
}),
|
|
54
54
|
secondary: r({
|
|
55
|
-
backgroundColor: o.color.fill.
|
|
55
|
+
backgroundColor: o.color.fill.accent_secondary,
|
|
56
56
|
":where(&) svg": { color: o.color.icon.primary },
|
|
57
57
|
"&:hover:not(:disabled), &:active:not(:disabled)": {
|
|
58
|
-
backgroundColor: o.color.fill.
|
|
59
|
-
":where(&) svg": { color: o.color.icon.
|
|
58
|
+
backgroundColor: o.color.fill.accent_secondary_hover,
|
|
59
|
+
":where(&) svg": { color: o.color.icon.primary_hover }
|
|
60
60
|
}
|
|
61
61
|
}),
|
|
62
62
|
negative: r({
|
|
63
|
-
backgroundColor: o.color.fill.
|
|
63
|
+
backgroundColor: o.color.fill.negative_secondary,
|
|
64
64
|
":where(&) svg": { color: o.color.icon.primary },
|
|
65
65
|
"&:hover:not(:disabled), &:active:not(:disabled)": {
|
|
66
|
-
backgroundColor: o.color.fill.
|
|
67
|
-
":where(&) svg": { color: o.color.icon.
|
|
66
|
+
backgroundColor: o.color.fill.negative_secondary_hover,
|
|
67
|
+
":where(&) svg": { color: o.color.icon.primary_hover }
|
|
68
68
|
}
|
|
69
69
|
}),
|
|
70
70
|
positive: r({
|
|
71
|
-
backgroundColor: o.color.fill.
|
|
71
|
+
backgroundColor: o.color.fill.positive_secondary,
|
|
72
72
|
":where(&) svg": { color: o.color.icon.primary },
|
|
73
73
|
"&:hover:not(:disabled), &:active:not(:disabled)": {
|
|
74
|
-
backgroundColor: o.color.fill.
|
|
75
|
-
":where(&) svg": { color: o.color.icon.
|
|
74
|
+
backgroundColor: o.color.fill.positive_secondary_hover,
|
|
75
|
+
":where(&) svg": { color: o.color.icon.primary_hover }
|
|
76
76
|
}
|
|
77
77
|
}),
|
|
78
78
|
warning: r({
|
|
79
|
-
backgroundColor: o.color.fill.
|
|
79
|
+
backgroundColor: o.color.fill.warning_secondary,
|
|
80
80
|
":where(&) svg": { color: o.color.icon.primary },
|
|
81
81
|
"&:hover:not(:disabled), &:active:not(:disabled)": {
|
|
82
|
-
backgroundColor: o.color.fill.
|
|
83
|
-
":where(&) svg": { color: o.color.icon.
|
|
82
|
+
backgroundColor: o.color.fill.warning_secondary_hover,
|
|
83
|
+
":where(&) svg": { color: o.color.icon.primary_hover }
|
|
84
84
|
}
|
|
85
85
|
}),
|
|
86
86
|
neutral: r({
|
|
87
|
-
backgroundColor: o.color.fill.
|
|
87
|
+
backgroundColor: o.color.fill.neutral_secondary,
|
|
88
88
|
":where(&) svg": { color: o.color.icon.primary },
|
|
89
89
|
"&:hover:not(:disabled), &:active:not(:disabled)": {
|
|
90
|
-
backgroundColor: o.color.fill.
|
|
91
|
-
":where(&) svg": { color: o.color.icon.
|
|
90
|
+
backgroundColor: o.color.fill.neutral_secondary_hover,
|
|
91
|
+
":where(&) svg": { color: o.color.icon.primary_hover }
|
|
92
92
|
}
|
|
93
93
|
}),
|
|
94
94
|
transfer: r({
|
|
95
|
-
backgroundColor: o.color.fill.
|
|
95
|
+
backgroundColor: o.color.fill.transfer_secondary,
|
|
96
96
|
":where(&) svg": { color: o.color.icon.primary },
|
|
97
97
|
"&:hover:not(:disabled), &:active:not(:disabled)": {
|
|
98
|
-
backgroundColor: o.color.fill.
|
|
99
|
-
":where(&) svg": { color: o.color.icon.
|
|
98
|
+
backgroundColor: o.color.fill.transfer_secondary_hover,
|
|
99
|
+
":where(&) svg": { color: o.color.icon.primary_hover }
|
|
100
100
|
}
|
|
101
101
|
}),
|
|
102
102
|
"neutral-white": r({
|
|
103
|
-
backgroundColor: o.color.fill.
|
|
103
|
+
backgroundColor: o.color.fill.bg_primary,
|
|
104
104
|
":where(&) svg": { color: o.color.icon.primary },
|
|
105
105
|
"&:hover:not(:disabled), &:active:not(:disabled)": {
|
|
106
|
-
backgroundColor: o.color.fill.
|
|
107
|
-
":where(&) svg": { color: o.color.icon.
|
|
106
|
+
backgroundColor: o.color.fill.bg_secondary,
|
|
107
|
+
":where(&) svg": { color: o.color.icon.primary_hover }
|
|
108
108
|
}
|
|
109
109
|
}),
|
|
110
110
|
"no-bg": r({
|
|
111
111
|
backgroundColor: "transparent",
|
|
112
112
|
":where(&) svg": { color: o.color.icon.primary },
|
|
113
113
|
"&:hover:not(:disabled), &:active:not(:disabled)": {
|
|
114
|
-
backgroundColor: o.color.fill.
|
|
115
|
-
":where(&) svg": { color: o.color.icon.
|
|
114
|
+
backgroundColor: o.color.fill.bg_secondary,
|
|
115
|
+
":where(&) svg": { color: o.color.icon.primary_hover }
|
|
116
116
|
}
|
|
117
117
|
}),
|
|
118
118
|
custom: r({})
|
|
@@ -11,12 +11,12 @@ const { color: o, spacing: e } = i, a = r({
|
|
|
11
11
|
}
|
|
12
12
|
}), l = r({
|
|
13
13
|
"&:hover": {
|
|
14
|
-
backgroundColor: o.fill.
|
|
14
|
+
backgroundColor: o.fill.neutral_primary_hover
|
|
15
15
|
}
|
|
16
|
-
}),
|
|
16
|
+
}), p = {
|
|
17
17
|
"input-container": r({
|
|
18
|
-
backgroundColor: o.fill.
|
|
19
|
-
border: `1px solid ${o.border.
|
|
18
|
+
backgroundColor: o.fill.accent_secondary,
|
|
19
|
+
border: `1px solid ${o.border.neutral_alpha_basic}`,
|
|
20
20
|
padding: `${e.md} ${e.lg}`,
|
|
21
21
|
borderRadius: 12,
|
|
22
22
|
minHeight: 40,
|
|
@@ -26,9 +26,9 @@ const { color: o, spacing: e } = i, a = r({
|
|
|
26
26
|
resize: "none"
|
|
27
27
|
},
|
|
28
28
|
"&:focus-within": {
|
|
29
|
-
borderColor: o.border.
|
|
29
|
+
borderColor: o.border.accent_primary,
|
|
30
30
|
"&:hover": {
|
|
31
|
-
borderColor: o.border.
|
|
31
|
+
borderColor: o.border.accent_primary
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}),
|
|
@@ -57,7 +57,7 @@ const { color: o, spacing: e } = i, a = r({
|
|
|
57
57
|
padding: `14px ${e.lg} 14px ${e.lg}`
|
|
58
58
|
}),
|
|
59
59
|
error: r({
|
|
60
|
-
borderColor: o.border.
|
|
60
|
+
borderColor: o.border.negative_primary
|
|
61
61
|
}),
|
|
62
62
|
disabled: a,
|
|
63
63
|
readOnly: n,
|
|
@@ -66,10 +66,10 @@ const { color: o, spacing: e } = i, a = r({
|
|
|
66
66
|
height: "auto"
|
|
67
67
|
}),
|
|
68
68
|
primary: r({
|
|
69
|
-
background: o.fill.
|
|
69
|
+
background: o.fill.bg_primary
|
|
70
70
|
}),
|
|
71
71
|
secondary: r({
|
|
72
|
-
background: o.fill.
|
|
72
|
+
background: o.fill.bg_secondary
|
|
73
73
|
}),
|
|
74
74
|
"clear-button": r({
|
|
75
75
|
cursor: "pointer",
|
|
@@ -81,5 +81,5 @@ const { color: o, spacing: e } = i, a = r({
|
|
|
81
81
|
})
|
|
82
82
|
};
|
|
83
83
|
export {
|
|
84
|
-
|
|
84
|
+
p as styles
|
|
85
85
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx as o, jsxs as c } from "react/jsx-runtime";
|
|
2
2
|
import { $convertToMarkdownString as y } from "@lexical/markdown";
|
|
3
|
-
import { AutoFocusPlugin as
|
|
4
|
-
import { LexicalComposer as
|
|
5
|
-
import { HashtagPlugin as
|
|
6
|
-
import { ListPlugin as
|
|
3
|
+
import { AutoFocusPlugin as D } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
4
|
+
import { LexicalComposer as V } from "@lexical/react/LexicalComposer";
|
|
5
|
+
import { HashtagPlugin as j } from "@lexical/react/LexicalHashtagPlugin";
|
|
6
|
+
import { ListPlugin as B } from "@lexical/react/LexicalListPlugin";
|
|
7
7
|
import { MarkdownShortcutPlugin as U } from "@lexical/react/LexicalMarkdownShortcutPlugin";
|
|
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 {
|
|
12
|
-
import {
|
|
13
|
-
import { MarkdownTextEditorLocaleProvider as z } from "./MarkdownTextEditor.locale.js";
|
|
11
|
+
import { MARKDOWN_TOOLBAR_DEFAULT_ACTIONS as K } from "./MarkdownTextEditor.const.js";
|
|
12
|
+
import { MarkdownTextEditorLocaleProvider as q } from "./MarkdownTextEditor.locale.js";
|
|
14
13
|
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";
|
|
@@ -24,38 +24,38 @@ import { Box as h } from "../../builders/Box/Box.js";
|
|
|
24
24
|
import { theme as to } from "../../../utils/theme/index.js";
|
|
25
25
|
import { Text as eo } from "../../builders/Text/Text.js";
|
|
26
26
|
const { color: n, cornerRadius: w, spacing: e } = to;
|
|
27
|
-
function
|
|
27
|
+
function Ao({
|
|
28
28
|
label: l,
|
|
29
29
|
plugins: C,
|
|
30
30
|
field: k,
|
|
31
31
|
disabled: m = !1,
|
|
32
32
|
locale: M,
|
|
33
|
-
toolbar:
|
|
34
|
-
defaultMarkdown:
|
|
33
|
+
toolbar: b,
|
|
34
|
+
defaultMarkdown: P,
|
|
35
35
|
events: r = {},
|
|
36
36
|
className: x,
|
|
37
|
-
labelClassName:
|
|
38
|
-
toolbarClassName:
|
|
39
|
-
editorClassName:
|
|
37
|
+
labelClassName: T,
|
|
38
|
+
toolbarClassName: E,
|
|
39
|
+
editorClassName: S,
|
|
40
40
|
fieldClassName: R,
|
|
41
41
|
previewClassName: v
|
|
42
42
|
}) {
|
|
43
|
-
const [d,
|
|
43
|
+
const [d, N] = u(""), [i, A] = u(!1), { availableActions: s, onImagesUpload: _ } = b || {}, O = a(() => z(), []), I = a(
|
|
44
44
|
() => ({
|
|
45
45
|
isEditable: !m,
|
|
46
46
|
isPreviewMode: i,
|
|
47
|
-
setPreviewMode:
|
|
47
|
+
setPreviewMode: A,
|
|
48
48
|
markdownText: d
|
|
49
49
|
}),
|
|
50
50
|
[m, i, d]
|
|
51
|
-
),
|
|
52
|
-
availableActions: s ||
|
|
51
|
+
), L = a(() => ({
|
|
52
|
+
availableActions: s || K
|
|
53
53
|
}), [s]), f = p(
|
|
54
54
|
(t) => {
|
|
55
|
-
|
|
55
|
+
N(t), r.onMarkdownChange && r.onMarkdownChange(t);
|
|
56
56
|
},
|
|
57
57
|
[r]
|
|
58
|
-
),
|
|
58
|
+
), F = p(
|
|
59
59
|
(t) => {
|
|
60
60
|
t.read(() => {
|
|
61
61
|
const $ = y(g);
|
|
@@ -64,7 +64,7 @@ function No({
|
|
|
64
64
|
},
|
|
65
65
|
[f, r]
|
|
66
66
|
);
|
|
67
|
-
return /* @__PURE__ */ o(
|
|
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: [
|
|
68
68
|
/* @__PURE__ */ c(
|
|
69
69
|
h,
|
|
70
70
|
{
|
|
@@ -73,7 +73,7 @@ function No({
|
|
|
73
73
|
borderRadius: w.lg,
|
|
74
74
|
p: e.lg,
|
|
75
75
|
gap: e.sm,
|
|
76
|
-
backgroundColor: n.fill.
|
|
76
|
+
backgroundColor: n.fill.neutral_secondary,
|
|
77
77
|
className: x,
|
|
78
78
|
children: [
|
|
79
79
|
l ? /* @__PURE__ */ o(
|
|
@@ -81,46 +81,46 @@ function No({
|
|
|
81
81
|
{
|
|
82
82
|
variant: "headline-3",
|
|
83
83
|
fontWeight: "semibold",
|
|
84
|
-
className:
|
|
84
|
+
className: T,
|
|
85
85
|
children: l
|
|
86
86
|
}
|
|
87
87
|
) : null,
|
|
88
88
|
/* @__PURE__ */ o(
|
|
89
89
|
Q,
|
|
90
90
|
{
|
|
91
|
-
onImagesUpload:
|
|
92
|
-
className:
|
|
91
|
+
onImagesUpload: _,
|
|
92
|
+
className: E
|
|
93
93
|
}
|
|
94
94
|
),
|
|
95
95
|
/* @__PURE__ */ o(
|
|
96
96
|
h,
|
|
97
97
|
{
|
|
98
|
-
backgroundColor: n.fill.
|
|
99
|
-
border: `1px solid ${n.border.
|
|
98
|
+
backgroundColor: n.fill.neutral_primary,
|
|
99
|
+
border: `1px solid ${n.border.neutral_alpha_basic}`,
|
|
100
100
|
borderRadius: w.md,
|
|
101
101
|
p: `${e.md} ${e.lg}`,
|
|
102
102
|
w: "full",
|
|
103
103
|
h: 144,
|
|
104
104
|
overflow: "auto",
|
|
105
|
-
className:
|
|
105
|
+
className: S,
|
|
106
106
|
children: i ? /* @__PURE__ */ o(X, { className: v }) : /* @__PURE__ */ o(Y, { ...k, className: R })
|
|
107
107
|
}
|
|
108
108
|
)
|
|
109
109
|
]
|
|
110
110
|
}
|
|
111
111
|
),
|
|
112
|
+
/* @__PURE__ */ o(D, {}),
|
|
112
113
|
/* @__PURE__ */ o(B, {}),
|
|
113
|
-
/* @__PURE__ */ o(j, {}),
|
|
114
114
|
/* @__PURE__ */ o(H, {}),
|
|
115
|
-
/* @__PURE__ */ o(
|
|
115
|
+
/* @__PURE__ */ o(j, {}),
|
|
116
116
|
/* @__PURE__ */ o(U, { transformers: g }),
|
|
117
|
-
/* @__PURE__ */ o(W, { onChange:
|
|
117
|
+
/* @__PURE__ */ o(W, { onChange: F }),
|
|
118
118
|
/* @__PURE__ */ o(Z, {}),
|
|
119
|
-
/* @__PURE__ */ o(oo, { defaultValue:
|
|
119
|
+
/* @__PURE__ */ o(oo, { defaultValue: P }),
|
|
120
120
|
/* @__PURE__ */ o(ro, {}),
|
|
121
121
|
C
|
|
122
122
|
] }) }) }) });
|
|
123
123
|
}
|
|
124
124
|
export {
|
|
125
|
-
|
|
125
|
+
Ao as MarkdownTextEditor
|
|
126
126
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsxs as u, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { cx as k } from "@emotion/css";
|
|
3
|
-
import { useState as y, useCallback as h, useMemo as
|
|
4
|
-
import
|
|
5
|
-
import { rowStyle as
|
|
6
|
-
import { IconButton as
|
|
3
|
+
import { useState as y, useCallback as h, useMemo as I, Fragment as P } from "react";
|
|
4
|
+
import S from "../../../../../../assets/svg/markdown/dots-horizontal.svg.js";
|
|
5
|
+
import { rowStyle as j, rowStyleInteractive as B } from "./ActionMenuButton.styles.js";
|
|
6
|
+
import { IconButton as b } from "../../../../IconButton/IconButton.js";
|
|
7
7
|
import { Box as c } from "../../../../../builders/Box/Box.js";
|
|
8
|
-
import { theme as
|
|
8
|
+
import { theme as z } from "../../../../../../utils/theme/index.js";
|
|
9
9
|
import { Text as O } from "../../../../../builders/Text/Text.js";
|
|
10
10
|
import { Popover as T } from "../../../../../shared/Popover/Popover.js";
|
|
11
|
-
const { color: x, spacing: v } =
|
|
12
|
-
function
|
|
11
|
+
const { color: x, spacing: v } = z;
|
|
12
|
+
function J({
|
|
13
13
|
groups: n,
|
|
14
14
|
toolbarVisibleActionsCount: m,
|
|
15
15
|
onAction: s,
|
|
@@ -24,7 +24,7 @@ function K({
|
|
|
24
24
|
({ IconComponent: t, ...o }, l) => /* @__PURE__ */ u(
|
|
25
25
|
c,
|
|
26
26
|
{
|
|
27
|
-
className: k(
|
|
27
|
+
className: k(j, !r && B),
|
|
28
28
|
p: v.sm,
|
|
29
29
|
alignItems: "center",
|
|
30
30
|
flex: !0,
|
|
@@ -46,7 +46,7 @@ function K({
|
|
|
46
46
|
o.id
|
|
47
47
|
),
|
|
48
48
|
[r, s, p]
|
|
49
|
-
), g =
|
|
49
|
+
), g = I(() => n.map((t, o) => {
|
|
50
50
|
const l = o === n.length - 1;
|
|
51
51
|
if (!t.length)
|
|
52
52
|
return null;
|
|
@@ -54,14 +54,14 @@ function K({
|
|
|
54
54
|
const M = (o ? n.slice(0, o).flat().length : 0) + d + m;
|
|
55
55
|
return f(i, M);
|
|
56
56
|
});
|
|
57
|
-
return /* @__PURE__ */ u(
|
|
57
|
+
return /* @__PURE__ */ u(P, { children: [
|
|
58
58
|
C,
|
|
59
59
|
l ? null : /* @__PURE__ */ e(
|
|
60
60
|
c,
|
|
61
61
|
{
|
|
62
62
|
w: "full",
|
|
63
63
|
h: 1,
|
|
64
|
-
backgroundColor: x.border.
|
|
64
|
+
backgroundColor: x.border.neutral_alpha_basic
|
|
65
65
|
}
|
|
66
66
|
)
|
|
67
67
|
] }, t.flatMap((i) => i.id).join("-"));
|
|
@@ -73,10 +73,10 @@ function K({
|
|
|
73
73
|
placement: "bottom",
|
|
74
74
|
open: w,
|
|
75
75
|
onChange: a,
|
|
76
|
-
children: /* @__PURE__ */ e(
|
|
76
|
+
children: /* @__PURE__ */ e(b, { size: "xs", color: "no-bg", disabled: r, children: /* @__PURE__ */ e(S, {}) })
|
|
77
77
|
}
|
|
78
78
|
);
|
|
79
79
|
}
|
|
80
80
|
export {
|
|
81
|
-
|
|
81
|
+
J as ActionMenuButton
|
|
82
82
|
};
|
|
@@ -4,10 +4,10 @@ const { color: o } = t, l = r({
|
|
|
4
4
|
cursor: "pointer"
|
|
5
5
|
}), n = r({
|
|
6
6
|
":hover": {
|
|
7
|
-
backgroundColor: o.fill.
|
|
7
|
+
backgroundColor: o.fill.bg_secondary
|
|
8
8
|
},
|
|
9
9
|
":active": {
|
|
10
|
-
backgroundColor: o.fill.
|
|
10
|
+
backgroundColor: o.fill.bg_secondary
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
13
|
export {
|
package/dist/components/controls/MarkdownTextEditor/components/EditorToolbar/EditorToolbar.js
CHANGED
|
@@ -2,21 +2,21 @@ import { jsx as o, jsxs as w } from "react/jsx-runtime";
|
|
|
2
2
|
import { INSERT_ORDERED_LIST_COMMAND as ie, INSERT_UNORDERED_LIST_COMMAND as se } from "@lexical/list";
|
|
3
3
|
import { useLexicalComposerContext as ce } from "@lexical/react/LexicalComposerContext";
|
|
4
4
|
import { INSERT_TABLE_COMMAND as le } from "@lexical/table";
|
|
5
|
-
import { $getSelection as ae, $isRangeSelection as ue, $createTextNode as de, $insertNodes as me, FORMAT_ELEMENT_COMMAND as
|
|
5
|
+
import { $getSelection as ae, $isRangeSelection as ue, $createTextNode as de, $insertNodes as me, FORMAT_ELEMENT_COMMAND as P, FORMAT_TEXT_COMMAND as x } from "lexical";
|
|
6
6
|
import pe from "lodash.debounce";
|
|
7
|
-
import { useState as
|
|
7
|
+
import { useState as B, useRef as V, useMemo as p, useCallback as b, Fragment as fe, useEffect as he } from "react";
|
|
8
8
|
import be from "../../../../../assets/svg/markdown/eye.svg.js";
|
|
9
9
|
import { useMarkdownTextEditorLocale as ve } from "../../MarkdownTextEditor.locale.js";
|
|
10
10
|
import { previewStyles as Ce } from "./EditorToolbar.styles.js";
|
|
11
11
|
import { defaultOnImagesUpload as ge } from "./EditorToolbar.utils.js";
|
|
12
12
|
import { TextSizeSelect as Ee } from "./TextSizeSelect/TextSizeSelect.js";
|
|
13
13
|
import { useToolbarActions as Te } from "../../hooks/useToolbarActions/useToolbarActions.js";
|
|
14
|
-
import { createCustomLinkNode as
|
|
15
|
-
import { createImageRowNode as
|
|
14
|
+
import { createCustomLinkNode as Le } from "../../nodes/CustomLinkNode/CustomLinkNode.utils.js";
|
|
15
|
+
import { createImageRowNode as Ne } from "../../nodes/ImageRowNode/ImageRowNode.utils.js";
|
|
16
16
|
import { MarkdownToolbarAction as c } from "../../hooks/useToolbarActions/useToolbarActions.const.js";
|
|
17
17
|
import { LinkPopoverContent as q } from "./LinkPopoverContent/LinkPopoverContent.js";
|
|
18
18
|
import { TablePopoverContent as X } from "./TablePopoverContent/TablePopoverContent.js";
|
|
19
|
-
import { ActionMenuButton as
|
|
19
|
+
import { ActionMenuButton as Ae } from "./ActionMenuButton/ActionMenuButton.js";
|
|
20
20
|
import { useEditorStates as Me } from "../../contexts/EditorStateContext/EditorStateContext.hook.js";
|
|
21
21
|
import { Popover as I } from "../../../../shared/Popover/Popover.js";
|
|
22
22
|
import { IconButton as W } from "../../../IconButton/IconButton.js";
|
|
@@ -28,12 +28,12 @@ function eo({
|
|
|
28
28
|
onImagesUpload: U = ge,
|
|
29
29
|
className: J
|
|
30
30
|
}) {
|
|
31
|
-
const [d, Q] =
|
|
31
|
+
const [d, Q] = B(11), [v, T] = B(null), [C, L] = B(
|
|
32
32
|
null
|
|
33
|
-
),
|
|
33
|
+
), N = V(null), { toolbar: Y } = ve(), _ = Y.preview, [r] = ce(), { isEditable: F, isPreviewMode: f, setPreviewMode: Z } = Me(), { availableActionGroups: A } = Te(), S = V(null), m = p(() => !F || f, [F, f]), ee = p(() => f ? _.hide : _.show, [f, _]), { toolbarGroups: k, menuGroups: $ } = p(() => {
|
|
34
34
|
const e = [], t = [];
|
|
35
35
|
let s = 0;
|
|
36
|
-
for (const i of
|
|
36
|
+
for (const i of A) {
|
|
37
37
|
const l = [], n = [];
|
|
38
38
|
for (const a of i)
|
|
39
39
|
s += 1, s <= d ? l.push(a) : n.push(a);
|
|
@@ -43,13 +43,13 @@ function eo({
|
|
|
43
43
|
toolbarGroups: e,
|
|
44
44
|
menuGroups: t
|
|
45
45
|
};
|
|
46
|
-
}, [
|
|
46
|
+
}, [A, d]), oe = p(() => typeof v == "number" && v > d - 1, [v, d]), te = p(() => typeof C == "number" && C > d - 1, [C, d]), y = b(
|
|
47
47
|
(e) => {
|
|
48
48
|
const { text: t, url: s } = e;
|
|
49
49
|
r.update(() => {
|
|
50
50
|
const i = ae();
|
|
51
51
|
if (ue(i)) {
|
|
52
|
-
const l =
|
|
52
|
+
const l = Le({
|
|
53
53
|
text: t,
|
|
54
54
|
url: s
|
|
55
55
|
});
|
|
@@ -60,17 +60,17 @@ function eo({
|
|
|
60
60
|
}), T(null);
|
|
61
61
|
},
|
|
62
62
|
[r]
|
|
63
|
-
),
|
|
63
|
+
), G = b(
|
|
64
64
|
(e) => {
|
|
65
65
|
const { rows: t, columns: s } = e;
|
|
66
66
|
r.dispatchCommand(le, {
|
|
67
67
|
rows: t,
|
|
68
68
|
columns: s
|
|
69
|
-
}),
|
|
69
|
+
}), L(null);
|
|
70
70
|
},
|
|
71
71
|
[r]
|
|
72
72
|
), j = b(() => {
|
|
73
|
-
|
|
73
|
+
S.current && S.current.click();
|
|
74
74
|
}, []), ne = b(
|
|
75
75
|
async (e) => {
|
|
76
76
|
try {
|
|
@@ -79,7 +79,7 @@ function eo({
|
|
|
79
79
|
return;
|
|
80
80
|
const s = await U(t);
|
|
81
81
|
r.update(() => {
|
|
82
|
-
const i =
|
|
82
|
+
const i = Ne(s);
|
|
83
83
|
i && me([i]);
|
|
84
84
|
});
|
|
85
85
|
} catch (t) {
|
|
@@ -105,13 +105,13 @@ function eo({
|
|
|
105
105
|
r.dispatchCommand(x, "strikethrough");
|
|
106
106
|
},
|
|
107
107
|
[c.ALIGN_LEFT]: () => {
|
|
108
|
-
r.dispatchCommand(
|
|
108
|
+
r.dispatchCommand(P, "left");
|
|
109
109
|
},
|
|
110
110
|
[c.ALIGN_CENTER]: () => {
|
|
111
|
-
r.dispatchCommand(
|
|
111
|
+
r.dispatchCommand(P, "center");
|
|
112
112
|
},
|
|
113
113
|
[c.ALIGN_RIGHT]: () => {
|
|
114
|
-
r.dispatchCommand(
|
|
114
|
+
r.dispatchCommand(P, "right");
|
|
115
115
|
},
|
|
116
116
|
[c.LINK]: () => {
|
|
117
117
|
T(t);
|
|
@@ -120,7 +120,7 @@ function eo({
|
|
|
120
120
|
j();
|
|
121
121
|
},
|
|
122
122
|
[c.TABLE]: () => {
|
|
123
|
-
|
|
123
|
+
L(t);
|
|
124
124
|
},
|
|
125
125
|
[c.BULLET_LIST]: () => {
|
|
126
126
|
r.dispatchCommand(se, void 0);
|
|
@@ -131,8 +131,8 @@ function eo({
|
|
|
131
131
|
})[e]();
|
|
132
132
|
},
|
|
133
133
|
[j, r]
|
|
134
|
-
), re = p(() =>
|
|
135
|
-
const s =
|
|
134
|
+
), re = p(() => k.map((e, t) => {
|
|
135
|
+
const s = k.slice(0, t).reduce((n, a) => n + a.length, 0);
|
|
136
136
|
if (!e.length)
|
|
137
137
|
return null;
|
|
138
138
|
const i = e.map(
|
|
@@ -141,11 +141,11 @@ function eo({
|
|
|
141
141
|
return u === c.LINK ? /* @__PURE__ */ o(
|
|
142
142
|
I,
|
|
143
143
|
{
|
|
144
|
-
content: /* @__PURE__ */ o(q, { onSave:
|
|
144
|
+
content: /* @__PURE__ */ o(q, { onSave: y }),
|
|
145
145
|
placement: "bottom",
|
|
146
146
|
open: v === h,
|
|
147
|
-
onChange: (
|
|
148
|
-
T(
|
|
147
|
+
onChange: (D) => {
|
|
148
|
+
T(D ? h : null);
|
|
149
149
|
},
|
|
150
150
|
children: /* @__PURE__ */ o(W, { size: "xs", color: "no-bg", disabled: m, children: /* @__PURE__ */ o(n, {}) })
|
|
151
151
|
},
|
|
@@ -153,11 +153,11 @@ function eo({
|
|
|
153
153
|
) : u === c.TABLE ? /* @__PURE__ */ o(
|
|
154
154
|
I,
|
|
155
155
|
{
|
|
156
|
-
content: /* @__PURE__ */ o(X, { onSave:
|
|
156
|
+
content: /* @__PURE__ */ o(X, { onSave: G }),
|
|
157
157
|
placement: "bottom",
|
|
158
158
|
open: C === h,
|
|
159
|
-
onChange: (
|
|
160
|
-
|
|
159
|
+
onChange: (D) => {
|
|
160
|
+
L(D ? h : null);
|
|
161
161
|
},
|
|
162
162
|
children: /* @__PURE__ */ o(
|
|
163
163
|
W,
|
|
@@ -190,25 +190,25 @@ function eo({
|
|
|
190
190
|
{
|
|
191
191
|
w: 1,
|
|
192
192
|
h: 32,
|
|
193
|
-
backgroundColor: E.border.
|
|
193
|
+
backgroundColor: E.border.neutral_alpha_basic
|
|
194
194
|
}
|
|
195
195
|
)
|
|
196
196
|
] }, e.flatMap((n) => n.id).join("-"));
|
|
197
197
|
}), [
|
|
198
|
-
|
|
198
|
+
k,
|
|
199
199
|
O,
|
|
200
200
|
v,
|
|
201
201
|
m,
|
|
202
202
|
C,
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
y,
|
|
204
|
+
G
|
|
205
205
|
]), H = b(() => {
|
|
206
|
-
const e =
|
|
206
|
+
const e = N.current;
|
|
207
207
|
if (!e)
|
|
208
208
|
return;
|
|
209
209
|
const t = e.clientWidth, s = 40, i = 4, l = 1, n = i + l + i + s + i;
|
|
210
210
|
let a = t - n, u = 0;
|
|
211
|
-
for (const M of
|
|
211
|
+
for (const M of A)
|
|
212
212
|
if (M.length) {
|
|
213
213
|
for (const h of M) {
|
|
214
214
|
const g = s + i;
|
|
@@ -220,19 +220,19 @@ function eo({
|
|
|
220
220
|
a -= l + i;
|
|
221
221
|
}
|
|
222
222
|
Q(u);
|
|
223
|
-
}, [
|
|
223
|
+
}, [A]), K = p(() => pe(H, 20, {}), [H]);
|
|
224
224
|
return he(() => {
|
|
225
|
-
if (!
|
|
225
|
+
if (!N.current)
|
|
226
226
|
return;
|
|
227
227
|
const e = new ResizeObserver(() => {
|
|
228
228
|
K();
|
|
229
229
|
});
|
|
230
|
-
return e.observe(
|
|
230
|
+
return e.observe(N.current), () => e.disconnect();
|
|
231
231
|
}, [K]), /* @__PURE__ */ w(
|
|
232
232
|
R,
|
|
233
233
|
{
|
|
234
|
-
backgroundColor: E.fill.
|
|
235
|
-
border: `1px solid ${E.border.
|
|
234
|
+
backgroundColor: E.fill.neutral_primary,
|
|
235
|
+
border: `1px solid ${E.border.neutral_alpha_basic}`,
|
|
236
236
|
borderRadius: Ie.md,
|
|
237
237
|
flex: !0,
|
|
238
238
|
row: !0,
|
|
@@ -245,7 +245,7 @@ function eo({
|
|
|
245
245
|
/* @__PURE__ */ o(
|
|
246
246
|
"input",
|
|
247
247
|
{
|
|
248
|
-
ref:
|
|
248
|
+
ref: S,
|
|
249
249
|
type: "file",
|
|
250
250
|
accept: "image/*",
|
|
251
251
|
hidden: !0,
|
|
@@ -258,7 +258,7 @@ function eo({
|
|
|
258
258
|
/* @__PURE__ */ o(
|
|
259
259
|
I,
|
|
260
260
|
{
|
|
261
|
-
content: /* @__PURE__ */ o(q, { onSave:
|
|
261
|
+
content: /* @__PURE__ */ o(q, { onSave: y }),
|
|
262
262
|
placement: "bottom",
|
|
263
263
|
open: oe,
|
|
264
264
|
onChange: (e) => {
|
|
@@ -270,11 +270,11 @@ function eo({
|
|
|
270
270
|
/* @__PURE__ */ o(
|
|
271
271
|
I,
|
|
272
272
|
{
|
|
273
|
-
content: /* @__PURE__ */ o(X, { onSave:
|
|
273
|
+
content: /* @__PURE__ */ o(X, { onSave: G }),
|
|
274
274
|
placement: "bottom",
|
|
275
275
|
open: te,
|
|
276
276
|
onChange: (e) => {
|
|
277
|
-
e ||
|
|
277
|
+
e || L(null);
|
|
278
278
|
},
|
|
279
279
|
children: /* @__PURE__ */ o("div", {})
|
|
280
280
|
}
|
|
@@ -289,11 +289,11 @@ function eo({
|
|
|
289
289
|
w: "full",
|
|
290
290
|
ml: z.xs,
|
|
291
291
|
overflow: "hidden",
|
|
292
|
-
ref:
|
|
292
|
+
ref: N,
|
|
293
293
|
children: [
|
|
294
294
|
re,
|
|
295
295
|
$.length ? /* @__PURE__ */ o(
|
|
296
|
-
|
|
296
|
+
Ae,
|
|
297
297
|
{
|
|
298
298
|
disabled: m,
|
|
299
299
|
onAction: O,
|