@logora/debate 0.3.35 → 0.3.37

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.
@@ -0,0 +1 @@
1
+ ._sourceListItemContainer_as5dp_3{position:relative;display:inline-flex;align-items:center;max-width:100%}a._sourceListItem_as5dp_3{display:flex;flex-direction:row;justify-content:flex-start;font-size:var(--font-size-extra-small, 14px);margin-top:5px;padding:5px 26px 5px 5px;border:1px solid var(--background-color-secondary, #E8E8E8);border-radius:var(--box-border-radius, 6px);max-width:100%}a._sourceListItem_as5dp_3 svg{margin-right:5px;flex-shrink:0!important;width:16px!important;height:16px!important}a._sourceListItem_as5dp_3{color:var(--text-primary, #222222)!important;text-decoration:none!important;outline:none!important}._removeSourceButton_as5dp_33{position:absolute;top:calc(50% + 2px);right:6px;transform:translateY(-50%);border:none;background:transparent;cursor:pointer;padding:0;display:flex;align-items:center;justify-content:center;color:var(--text-primary, #222222);z-index:2}
@@ -1,171 +1,178 @@
1
- import { jsxs as u, Fragment as X, jsx as t } from "react/jsx-runtime";
2
- import { ListNode as Y, ListItemNode as Z } from "@lexical/list";
3
- import { OverflowNode as tt } from "@lexical/overflow";
4
- import { CharacterLimitPlugin as ot } from "@lexical/react/LexicalCharacterLimitPlugin";
5
- import { LexicalComposer as et } from "@lexical/react/LexicalComposer";
6
- import { ContentEditable as rt } from "@lexical/react/LexicalContentEditable";
7
- import { EditorRefPlugin as it } from "@lexical/react/LexicalEditorRefPlugin";
8
- import { LexicalErrorBoundary as nt } from "@lexical/react/LexicalErrorBoundary";
9
- import { HistoryPlugin as st } from "@lexical/react/LexicalHistoryPlugin";
10
- import { ListPlugin as lt } from "@lexical/react/LexicalListPlugin";
11
- import { OnChangePlugin as ct } from "@lexical/react/LexicalOnChangePlugin";
12
- import { RichTextPlugin as mt } from "@lexical/react/LexicalRichTextPlugin";
13
- import { QuoteNode as at } from "@lexical/rich-text";
1
+ import { jsxs as f, Fragment as Y, jsx as o } from "react/jsx-runtime";
2
+ import { ListNode as Z, ListItemNode as oo } from "@lexical/list";
3
+ import { OverflowNode as to } from "@lexical/overflow";
4
+ import { CharacterLimitPlugin as eo } from "@lexical/react/LexicalCharacterLimitPlugin";
5
+ import { LexicalComposer as ro } from "@lexical/react/LexicalComposer";
6
+ import { ContentEditable as io } from "@lexical/react/LexicalContentEditable";
7
+ import { EditorRefPlugin as no } from "@lexical/react/LexicalEditorRefPlugin";
8
+ import { LexicalErrorBoundary as so } from "@lexical/react/LexicalErrorBoundary";
9
+ import { HistoryPlugin as lo } from "@lexical/react/LexicalHistoryPlugin";
10
+ import { ListPlugin as co } from "@lexical/react/LexicalListPlugin";
11
+ import { OnChangePlugin as mo } from "@lexical/react/LexicalOnChangePlugin";
12
+ import { RichTextPlugin as ao } from "@lexical/react/LexicalRichTextPlugin";
13
+ import { QuoteNode as uo } from "@lexical/rich-text";
14
14
  import I from "classnames";
15
- import { $getRoot as dt } from "lexical";
16
- import { useState as a, useId as ft, useEffect as b } from "react";
17
- import { useIntl as ut } from "react-intl";
18
- import pt from "./EditorTheme.js";
15
+ import { $getRoot as fo } from "lexical";
16
+ import { useState as d, useId as po, useEffect as R } from "react";
17
+ import { useIntl as ho } from "react-intl";
18
+ import go from "./EditorTheme.js";
19
19
  import e from "./TextEditor.module.scss.js";
20
- import { AutoSavePlugin as ht } from "./plugins/AutoSavePlugin.js";
21
- import { FocusPlugin as gt } from "./plugins/FocusPlugin.js";
22
- import { MaxLengthPlugin as xt } from "./plugins/MaxLengthPlugin.js";
23
- import { ResetPlugin as St } from "./plugins/ResetPlugin.js";
24
- import { SetContentPlugin as Ct } from "./plugins/SetContentPlugin.js";
25
- import { SetRichContentPlugin as Pt } from "./plugins/SetRichContentPlugin.js";
26
- import { ToolbarPlugin as Tt } from "./plugins/ToolbarPlugin.js";
27
- import { useModal as vt } from "../../dialog/modal/useModal.js";
28
- import { SourceModal as Nt } from "../../source/source_modal/SourceModal.js";
29
- import { SourceListItem as Et } from "../../source/source_list_item/SourceListItem.js";
30
- const M = (l) => l?.replace(/ /g, " "), to = ({
20
+ import { AutoSavePlugin as xo } from "./plugins/AutoSavePlugin.js";
21
+ import { FocusPlugin as So } from "./plugins/FocusPlugin.js";
22
+ import { MaxLengthPlugin as vo } from "./plugins/MaxLengthPlugin.js";
23
+ import { ResetPlugin as Co } from "./plugins/ResetPlugin.js";
24
+ import { SetContentPlugin as Po } from "./plugins/SetContentPlugin.js";
25
+ import { SetRichContentPlugin as To } from "./plugins/SetRichContentPlugin.js";
26
+ import { ToolbarPlugin as No } from "./plugins/ToolbarPlugin.js";
27
+ import { useModal as Eo } from "../../dialog/modal/useModal.js";
28
+ import { SourceModal as Io } from "../../source/source_modal/SourceModal.js";
29
+ import { SourceListItem as Ro } from "../../source/source_list_item/SourceListItem.js";
30
+ const b = (l) => l?.replace(/ /g, " "), et = ({
31
31
  placeholder: l,
32
32
  onSubmit: p,
33
- sources: r,
34
- hideSubmit: y = !1,
35
- hideSourceAction: R = !1,
33
+ sources: c,
34
+ hideSubmit: M = !1,
35
+ hideSourceAction: y = !1,
36
36
  onActivation: h,
37
37
  disabled: w = !1,
38
38
  handleChange: g,
39
39
  handleSourcesChange: x,
40
40
  shortBar: A = !1,
41
41
  active: S = !1,
42
- maxLength: c,
42
+ maxLength: m,
43
43
  disableRichText: L = !1,
44
44
  editorRef: _,
45
- uid: C,
46
- allowedDomains: P = [],
45
+ uid: v,
46
+ allowedDomains: C = [],
47
47
  hideCharCount: B = !1,
48
48
  disableAutoActivate: F = !1,
49
49
  ...O
50
50
  }) => {
51
- const [n, U] = a(!1), [j, k] = a(""), [z, H] = a(""), [s, d] = a([]), { showModal: J } = vt(), T = ut(), v = ft();
52
- b(() => {
53
- r && r.length > 0 && d(r);
54
- }, [r]), b(() => {
55
- x && s.length > 0 && x(s);
56
- }, [s]);
51
+ const [s, U] = d(!1), [j, k] = d(""), [z, H] = d(""), [r, a] = d([]), { showModal: J } = Eo(), P = ho(), T = po();
52
+ R(() => {
53
+ c && c.length > 0 && a(c);
54
+ }, [c]), R(() => {
55
+ x && r.length > 0 && x(r);
56
+ }, [r]);
57
57
  const N = () => {
58
- n || (U(!0), h && h());
58
+ s || (U(!0), h && h());
59
59
  }, Q = {
60
60
  editable: !w,
61
- theme: pt,
62
- onError(o) {
63
- console.error("TextEditor error:", o);
61
+ theme: go,
62
+ onError(t) {
63
+ console.error("TextEditor error:", t);
64
64
  },
65
- nodes: [Y, Z, at, tt]
65
+ nodes: [Z, oo, uo, to]
66
66
  }, W = () => {
67
67
  N();
68
- }, $ = (o) => {
69
- o.read(() => {
70
- const i = dt().getTextContent(), m = M(i), f = JSON.stringify(o), E = M(f);
71
- k(m), H(E), g && g(m, E);
68
+ }, $ = (t) => {
69
+ t.read(() => {
70
+ const i = fo().getTextContent(), n = b(i), u = JSON.stringify(t), E = b(u);
71
+ k(n), H(E), g && g(n, E);
72
72
  });
73
- }, q = (o) => {
74
- const i = j, m = z, f = s;
75
- p && (o.preventDefault(), p(i, m, f)), d([]);
73
+ }, q = (t) => {
74
+ const i = j, n = z, u = r;
75
+ p && (t.preventDefault(), p(i, n, u)), a([]);
76
76
  }, D = () => {
77
77
  J(
78
- /* @__PURE__ */ t(
79
- Nt,
78
+ /* @__PURE__ */ o(
79
+ Io,
80
80
  {
81
81
  onAddSource: G,
82
- allowedSources: P
82
+ allowedSources: C
83
83
  }
84
84
  )
85
85
  );
86
- }, G = (o) => {
87
- d([...s, o]);
88
- }, K = (o, i) => /* @__PURE__ */ t(
89
- Et,
86
+ }, G = (t) => {
87
+ a([...r, t]);
88
+ }, K = (t) => {
89
+ a(
90
+ (i) => i.filter(
91
+ (n) => n.source_url !== t.source_url
92
+ )
93
+ );
94
+ }, V = (t, i) => /* @__PURE__ */ o(
95
+ Ro,
90
96
  {
91
- publisher: o.publisher,
92
- url: o.source_url,
93
- title: o.title,
94
- index: i
97
+ publisher: t.publisher,
98
+ url: t.source_url,
99
+ title: t.title,
100
+ index: i,
101
+ onRemove: () => K(t)
95
102
  },
96
103
  i
97
- ), V = () => /* @__PURE__ */ t("div", { className: e.editorPlaceholder, children: l });
98
- return /* @__PURE__ */ u(X, { children: [
99
- /* @__PURE__ */ t(et, { initialConfig: Q, children: /* @__PURE__ */ t("div", { className: e.editorContainer, onClick: W, children: /* @__PURE__ */ u(
104
+ ), X = () => /* @__PURE__ */ o("div", { className: e.editorPlaceholder, children: l });
105
+ return /* @__PURE__ */ f(Y, { children: [
106
+ /* @__PURE__ */ o(ro, { initialConfig: Q, children: /* @__PURE__ */ o("div", { className: e.editorContainer, onClick: W, children: /* @__PURE__ */ f(
100
107
  "div",
101
108
  {
102
109
  className: I(e.editorInner, {
103
- [e.editorInnerInactive]: !n && !S
110
+ [e.editorInnerInactive]: !s && !S
104
111
  }),
105
112
  children: [
106
- /* @__PURE__ */ t(
107
- mt,
113
+ /* @__PURE__ */ o(
114
+ ao,
108
115
  {
109
- contentEditable: /* @__PURE__ */ t(
110
- rt,
116
+ contentEditable: /* @__PURE__ */ o(
117
+ io,
111
118
  {
112
119
  className: I(e.editorInput, {
113
- [e.editorInputInactive]: !n
120
+ [e.editorInputInactive]: !s
114
121
  }),
115
122
  ...O
116
123
  }
117
124
  ),
118
- placeholder: l && /* @__PURE__ */ t(V, {}),
119
- ErrorBoundary: nt
125
+ placeholder: l && /* @__PURE__ */ o(X, {}),
126
+ ErrorBoundary: so
120
127
  }
121
128
  ),
122
- /* @__PURE__ */ t(
123
- Tt,
129
+ /* @__PURE__ */ o(
130
+ No,
124
131
  {
125
- hideSourceAction: R,
126
- hideSubmit: y,
132
+ hideSourceAction: y,
133
+ hideSubmit: M,
127
134
  disableRichText: L,
128
135
  shortBar: A,
129
136
  onSubmit: q,
130
137
  onAddSource: D,
131
- isActive: n || S,
132
- sourceTooltip: P?.length > 0 && T.formatMessage({
138
+ isActive: s || S,
139
+ sourceTooltip: C?.length > 0 && P.formatMessage({
133
140
  id: "input.allowed_domains_tooltip",
134
141
  defaultMessage: "With the new source function, you can add links to your article."
135
142
  })
136
143
  }
137
144
  ),
138
- n && c && !B && /* @__PURE__ */ u("div", { className: e.charactersCount, children: [
139
- /* @__PURE__ */ t(ot, { maxLength: c }),
145
+ s && m && !B && /* @__PURE__ */ f("div", { className: e.charactersCount, children: [
146
+ /* @__PURE__ */ o(eo, { maxLength: m }),
140
147
  " ",
141
- T.formatMessage({
148
+ P.formatMessage({
142
149
  id: "input.remaining_chars",
143
150
  defaultMessage: "remaining characters"
144
151
  })
145
152
  ] }),
146
- /* @__PURE__ */ t(lt, {}),
147
- /* @__PURE__ */ t(st, {}),
148
- /* @__PURE__ */ t(ct, { onChange: $, ignoreSelectionChange: !0 }),
149
- /* @__PURE__ */ t(
150
- ht,
153
+ /* @__PURE__ */ o(co, {}),
154
+ /* @__PURE__ */ o(lo, {}),
155
+ /* @__PURE__ */ o(mo, { onChange: $, ignoreSelectionChange: !0 }),
156
+ /* @__PURE__ */ o(
157
+ xo,
151
158
  {
152
159
  onSetContent: F ? () => {
153
160
  } : N,
154
- storageUid: C || v
161
+ storageUid: v || T
155
162
  }
156
163
  ),
157
- /* @__PURE__ */ t(Ct, {}),
158
- /* @__PURE__ */ t(Pt, {}),
159
- /* @__PURE__ */ t(gt, {}),
160
- c && /* @__PURE__ */ t(xt, { maxLength: c }),
161
- /* @__PURE__ */ t(St, { storageUid: C || v }),
162
- /* @__PURE__ */ t(it, { editorRef: _ })
164
+ /* @__PURE__ */ o(Po, {}),
165
+ /* @__PURE__ */ o(To, {}),
166
+ /* @__PURE__ */ o(So, {}),
167
+ m && /* @__PURE__ */ o(vo, { maxLength: m }),
168
+ /* @__PURE__ */ o(Co, { storageUid: v || T }),
169
+ /* @__PURE__ */ o(no, { editorRef: _ })
163
170
  ]
164
171
  }
165
172
  ) }) }),
166
- r && r.length !== 0 ? /* @__PURE__ */ t("div", { className: e.sourcesBox, children: /* @__PURE__ */ t("div", { className: e.sourceList, children: r.map(K) }) }) : null
173
+ r && r.length !== 0 ? /* @__PURE__ */ o("div", { className: e.sourcesBox, children: /* @__PURE__ */ o("div", { className: e.sourceList, children: r.map(V) }) }) : null
167
174
  ] });
168
175
  };
169
176
  export {
170
- to as TextEditor
177
+ et as TextEditor
171
178
  };
@@ -1,34 +1,46 @@
1
- import { jsxs as e, jsx as s } from "react/jsx-runtime";
1
+ import { jsxs as e, jsx as t } from "react/jsx-runtime";
2
2
  import "react";
3
- import t from "./SourceListItem.module.scss.js";
4
- import { Link as m } from "../../action/link/Link.js";
5
- import { Icon as l } from "../../icons/icon/Icon.js";
6
- const h = ({ index: o = 0, url: i, title: n, publisher: r }) => /* @__PURE__ */ e(
7
- m,
8
- {
9
- className: t.sourceListItem,
10
- to: i,
11
- external: !0,
12
- target: "_blank",
13
- rel: "nofollow noreferrer noopener",
14
- "data-tid": "link_view_source",
15
- children: [
16
- /* @__PURE__ */ s(l, { name: "link", width: 16, height: 16 }),
17
- /* @__PURE__ */ e("div", { className: t.sourceListItemLink, children: [
18
- /* @__PURE__ */ e("span", { children: [
19
- "[ ",
20
- o + 1,
21
- " ]"
22
- ] }),
23
- /* @__PURE__ */ e("span", { children: [
24
- r && `${r} `,
25
- " ",
26
- n
3
+ import r from "./SourceListItem.module.scss.js";
4
+ import { Link as l } from "../../action/link/Link.js";
5
+ import { Icon as n } from "../../icons/icon/Icon.js";
6
+ const f = ({ index: s = 0, url: a, title: c, publisher: o, onRemove: i }) => /* @__PURE__ */ e("div", { className: r.sourceListItemContainer, children: [
7
+ /* @__PURE__ */ e(
8
+ l,
9
+ {
10
+ className: r.sourceListItem,
11
+ to: a,
12
+ external: !0,
13
+ target: "_blank",
14
+ rel: "nofollow noreferrer noopener",
15
+ "data-tid": "link_view_source",
16
+ children: [
17
+ /* @__PURE__ */ t(n, { name: "link", width: 16, height: 16 }),
18
+ /* @__PURE__ */ e("div", { className: r.sourceListItemLink, children: [
19
+ /* @__PURE__ */ e("span", { children: [
20
+ "[ ",
21
+ s + 1,
22
+ " ] "
23
+ ] }),
24
+ /* @__PURE__ */ e("span", { children: [
25
+ o && `${o} – `,
26
+ " ",
27
+ c
28
+ ] })
27
29
  ] })
28
- ] })
29
- ]
30
- }
31
- );
30
+ ]
31
+ }
32
+ ),
33
+ i && /* @__PURE__ */ t(
34
+ "button",
35
+ {
36
+ type: "button",
37
+ className: r.removeSourceButton,
38
+ onClick: i,
39
+ "aria-label": "Remove source",
40
+ children: /* @__PURE__ */ t(n, { name: "close", width: 10, height: 10 })
41
+ }
42
+ )
43
+ ] });
32
44
  export {
33
- h as SourceListItem
45
+ f as SourceListItem
34
46
  };
@@ -1,9 +1,11 @@
1
- import '../../../assets/components/source/source_list_item/SourceListItem.module-mTxHhXPV.css';const s = "_sourceListItem_1498g_3", t = "_sourceListItemLink_1498g_26", e = {
2
- sourceListItem: s,
3
- sourceListItemLink: t
1
+ import '../../../assets/components/source/source_list_item/SourceListItem.module-fm_uHuY4.css';const t = "_sourceListItemContainer_as5dp_3", e = "_sourceListItem_as5dp_3", o = "_removeSourceButton_as5dp_33", s = {
2
+ sourceListItemContainer: t,
3
+ sourceListItem: e,
4
+ removeSourceButton: o
4
5
  };
5
6
  export {
6
- e as default,
7
- s as sourceListItem,
8
- t as sourceListItemLink
7
+ s as default,
8
+ o as removeSourceButton,
9
+ e as sourceListItem,
10
+ t as sourceListItemContainer
9
11
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logora/debate",
3
- "version": "0.3.35",
3
+ "version": "0.3.37",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0",
6
6
  "description": "Design system of @Logora made with React",
@@ -1 +0,0 @@
1
- a._sourceListItem_1498g_3{display:flex;flex-direction:row;justify-content:flex-start;font-size:var(--font-size-extra-small, 14px);margin-top:5px;padding:5px;border:1px solid var(--background-color-secondary, #E8E8E8);border-radius:var(--box-border-radius, 6px);max-width:100%}a._sourceListItem_1498g_3 svg{margin-right:5px;flex-shrink:0!important;width:16px!important;height:16px!important}a._sourceListItem_1498g_3{color:var(--text-primary, #222222)!important;text-decoration:none!important;outline:none!important}._sourceListItemLink_1498g_26{display:-webkit-box;word-wrap:break-word;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis}._sourceListItemLink_1498g_26 span{margin-right:5px}