@logora/debate 0.3.77 → 0.3.79

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
+ ._proposalBoxContainer_5d6lc_3{display:flex!important;flex-direction:column!important;justify-content:space-between!important;position:relative;box-shadow:var(--box-shadow, 0px 2px 5px rgba(7, 42, 68, .1));border:var(--box-border, 1px solid rgba(7, 42, 68, .1));color:var(--text-primary, #222222);border-radius:var(--box-border-radius, 6px);background-color:var(--background-color-primary, white);scroll-margin-top:150px;padding:var(--box-spacing, var(--space-unit, 1em));gap:var(--box-spacing, var(--space-unit, 1em))}._proposalBoxContainer_5d6lc_3._flash_5d6lc_17{-webkit-transition:box-shadow .8s ease-in-out;-moz-transition:box-shadow .8s ease-in-out;-o-transition:box-shadow .8s ease-in-out;transition:box-shadow .8s ease-in-out;box-shadow:0 0 15px var(--call-primary-color, #434343)}._edited_5d6lc_25{font-size:var(--font-size-extra-small, 14px);color:var(--text-secondary, #5F5F5F);line-height:var(--line-height-loose, 1.38em);margin-bottom:var(--spacer-xs, calc(var(--space-unit, 1em) * .325))!important}._proposalBoxContent_5d6lc_32{text-align:left;white-space:pre-line;line-height:var(--line-height-loose, 1.38em);font-size:var(--font-size-small, 16px)}@container (min-width: 768px){._proposalBoxContent_5d6lc_32{min-height:185px}}._proposalBoxContent_5d6lc_32 ._proposalTitle_5d6lc_44{font-size:var(--font-size-normal, 16px);font-weight:var(--font-weight-bold, 700);padding-bottom:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important}._proposalBoxContent_5d6lc_32 ._proposalTitle_5d6lc_44:first-letter{text-transform:uppercase}._proposalBoxContent_5d6lc_32 ._proposalContent_5d6lc_52 *{font-size:var(--font-size-small, 16px)}._proposalSourcesList_5d6lc_56{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;font-size:var(--font-size-extra-small, 14px);font-weight:var(--font-weight-normal, 400)}._proposalSourcesList_5d6lc_56 a{text-decoration:none}._fixedHeight_5d6lc_68{height:200px;overflow:hidden;position:relative}._fixedHeight_5d6lc_68:after{content:"";position:absolute;z-index:1;bottom:0;left:0;right:0;pointer-events:none;background-image:linear-gradient(to bottom,#fff0,#fff 90%);width:100%;height:5em}
@@ -279,6 +279,7 @@ const Ne = ce(() => import("../../input/argument_input/index.js").then((e) => ({
279
279
  X.add(a, [t]), L(), b(!0);
280
280
  },
281
281
  isReply: !0,
282
+ activeOnInit: !0,
282
283
  avatarSize: 40,
283
284
  placeholder: i.formatMessage({
284
285
  id: "input.reply_input.your_answer",
@@ -1,113 +1,113 @@
1
- import { jsxs as M, jsx as i } from "react/jsx-runtime";
2
- import $e from "@rooks/use-sessionstorage-state";
3
- import { useRef as qe, useState as c, useEffect as v, Suspense as De, lazy as We } from "react";
4
- import { useIntl as Ye, FormattedMessage as me } from "react-intl";
5
- import { useLocation as ke } from "react-router";
1
+ import { jsxs as M, jsx as s } from "react/jsx-runtime";
2
+ import De from "@rooks/use-sessionstorage-state";
3
+ import { useRef as We, useState as l, useEffect as v, Suspense as Ye, lazy as ke } from "react";
4
+ import { useIntl as Re, FormattedMessage as fe } from "react-intl";
5
+ import { useLocation as je } from "react-router";
6
6
  import I from "classnames";
7
7
  import n from "./ArgumentInput.module.scss.js";
8
- import { useDataProvider as Re } from "../../data/data_provider/useDataProvider.js";
9
- import { useList as je } from "../../list/list_provider/useList.js";
10
- import { useConfig as ze } from "../../data/config_provider/useConfig.js";
11
- import { useInput as Oe } from "../input_provider/useInput.js";
12
- import { useAuth as Je } from "../../auth/use_auth/useAuth.js";
13
- import { useFormValidation as Ke } from "../../forms/use_form_validation/useFormValidation.js";
14
- import { useResponsive as Ge } from "../../hooks/use_responsive/useResponsive.js";
15
- import { useAuthRequired as He } from "../../hooks/use_auth_required/useAuthRequired.js";
16
- import { useModal as Qe } from "../../dialog/modal/useModal.js";
17
- import { useToast as Xe } from "../../dialog/toast_provider/useToast.js";
18
- import { TogglePosition as Ze } from "../toggle_position/TogglePosition.js";
19
- import { Avatar as et } from "../../user/avatar/Avatar.js";
20
- import { AuthorBox as tt } from "../../user/author_box/AuthorBox.js";
21
- import { TextEditor as nt } from "../text_editor/TextEditor.js";
22
- import { Icon as at } from "../../icons/icon/Icon.js";
23
- const it = We(() => import("../../modal/side_modal/index.js").then((S) => ({ default: S.SideModal }))), Nt = ({
8
+ import { useDataProvider as ze } from "../../data/data_provider/useDataProvider.js";
9
+ import { useList as Oe } from "../../list/list_provider/useList.js";
10
+ import { useConfig as Je } from "../../data/config_provider/useConfig.js";
11
+ import { useInput as Ke } from "../input_provider/useInput.js";
12
+ import { useAuth as Ge } from "../../auth/use_auth/useAuth.js";
13
+ import { useFormValidation as He } from "../../forms/use_form_validation/useFormValidation.js";
14
+ import { useResponsive as Qe } from "../../hooks/use_responsive/useResponsive.js";
15
+ import { useAuthRequired as Xe } from "../../hooks/use_auth_required/useAuthRequired.js";
16
+ import { useModal as Ze } from "../../dialog/modal/useModal.js";
17
+ import { useToast as et } from "../../dialog/toast_provider/useToast.js";
18
+ import { TogglePosition as tt } from "../toggle_position/TogglePosition.js";
19
+ import { Avatar as nt } from "../../user/avatar/Avatar.js";
20
+ import { AuthorBox as at } from "../../user/author_box/AuthorBox.js";
21
+ import { TextEditor as st } from "../text_editor/TextEditor.js";
22
+ import { Icon as it } from "../../icons/icon/Icon.js";
23
+ const ot = ke(() => import("../../modal/side_modal/index.js").then((S) => ({ default: S.SideModal }))), yt = ({
24
24
  argumentListId: S,
25
- avatarSize: fe = 48,
26
- disabled: z = !1,
25
+ avatarSize: ge = 48,
26
+ disabled: j = !1,
27
27
  positions: a = [],
28
28
  disabledPositions: x = [],
29
29
  groupId: b,
30
- groupName: ge,
31
- groupType: O,
32
- hideSourceAction: he = !1,
30
+ groupName: he,
31
+ groupType: z,
32
+ hideSourceAction: pe = !1,
33
33
  isReply: r = !1,
34
- onSubmit: J,
34
+ onSubmit: O,
35
35
  parentId: F,
36
- placeholder: pe,
36
+ placeholder: _e,
37
37
  positionId: A,
38
- focusOnInit: _e = !1,
38
+ focusOnInit: Me = !1,
39
39
  activeOnInit: P = !1,
40
- userGuideUrl: K,
41
- hideUserGuideLink: Me = !1,
42
- hideCharCount: ve = !1,
43
- disableAutoActivate: be = !1
40
+ userGuideUrl: J,
41
+ hideUserGuideLink: ve = !1,
42
+ hideCharCount: be = !1,
43
+ disableAutoActivate: Ae = !1
44
44
  }) => {
45
- const o = Ye(), G = Re(), N = je(), h = ze(), {
46
- focus: H,
47
- setFocus: T,
48
- setReset: Ae,
45
+ const o = Re(), K = ze(), N = Oe(), h = Je(), {
46
+ focus: G,
47
+ setFocus: H,
48
+ setReset: Ce,
49
49
  inputContent: B,
50
50
  setInputContent: Q,
51
- setInputRichContent: Ce
52
- } = Oe(), { isLoggedIn: C, currentUser: u } = Je(), { errors: E, validate: V } = Ke(), { isMobile: m } = Ge(), we = ke(), X = qe(null), [U, $] = c([]), [q, D] = c(""), [Z, W] = c(null), [d, p] = c(null), [ee, te] = c(null), [ne, ae] = c(!1), [w, ie] = c(!1), [_, se] = c({}), [f, Ie] = $e(
51
+ setInputRichContent: we
52
+ } = Ke(), { isLoggedIn: C, currentUser: u } = Ge(), { errors: E, validate: V } = He(), { isMobile: m } = Qe(), Ie = je(), X = We(null), [U, $] = l([]), [q, D] = l(""), [Z, W] = l(null), [d, p] = l(null), [ee, te] = l(null), [ne, ae] = l(!1), [w, se] = l(!1), [_, ie] = l({}), [Se, oe] = l(!1), [f, xe] = De(
53
53
  "userSide",
54
54
  {}
55
- ), [g, Se] = c(
55
+ ), [g, Ne] = l(
56
56
  !C && h?.actions?.disableInputForVisitor
57
- ), Y = He(), { showModal: xe } = Qe(), { toast: k } = Xe() || {}, oe = new URLSearchParams(
58
- typeof window < "u" ? window.location.search : we.search
57
+ ), Y = Xe(), { showModal: Te } = Ze(), { toast: k } = et() || {}, re = new URLSearchParams(
58
+ typeof window < "u" ? window.location.search : Ie.search
59
59
  );
60
60
  v(() => {
61
- Se(
61
+ Ne(
62
62
  !C && h?.actions?.disableInputForVisitor
63
63
  );
64
64
  }, [C, h]);
65
- const R = u?.role === "editor" || u?.role === "moderator", re = u?.moderation_status === "banned";
65
+ const R = u?.role === "editor" || u?.role === "moderator", ue = u?.moderation_status === "banned";
66
66
  v(() => {
67
67
  let e = null;
68
- typeof window < "u" && (e = oe.get("positionId")), A && A != a[2]?.id && a?.find((t) => t.id === A) ? p(A) : e && e != a[2]?.id ? p(e) : f && f.groupId == b && f.positionId != a[2]?.id && p(f.positionId);
68
+ typeof window < "u" && (e = re.get("positionId")), A && A != a[2]?.id && a?.find((t) => t.id === A) ? p(A) : e && e != a[2]?.id ? p(e) : f && f.groupId == b && f.positionId != a[2]?.id && p(f.positionId);
69
69
  }, [A]), v(() => {
70
- P && (j(), T(!0));
70
+ P && (oe(!0), T());
71
71
  }, [P]), v(() => {
72
72
  if (typeof window < "u") {
73
- const e = _e || oe.get("initArgument");
74
- (e === !0 || e === "true") && (T(!0), Ee());
73
+ const e = Me || re.get("initArgument");
74
+ (e === !0 || e === "true") && (oe(!0), T(), Ue());
75
75
  }
76
76
  }, []), v(() => {
77
- H && (ue(), T(!1));
78
- }, [H]), v(() => {
79
- B?.id && (Ne(B), T(!0));
77
+ G && (T(), H(!1));
78
+ }, [G]), v(() => {
79
+ B?.id && (ye(B), H(!0));
80
80
  }, [B]);
81
- const Ne = (e) => {
82
- se(e), ie(!0), $(e.sources), D(e.content), W(e.rich_content), te(e.id), ue(), p(e.position?.id), JSON.parse(e.rich_content).hasOwnProperty("root") ? Ce(e.rich_content) : Q(e.content);
83
- }, ue = () => {
81
+ const ye = (e) => {
82
+ ie(e), se(!0), $(e.sources), D(e.content), W(e.rich_content), te(e.id), T(), p(e.position?.id), JSON.parse(e.rich_content).hasOwnProperty("root") ? we(e.rich_content) : Q(e.content);
83
+ }, T = () => {
84
84
  X.current.scrollIntoView(!1);
85
85
  }, de = () => {
86
- D(""), W(null), se({}), te(null), $([]), Ae(!0), Q(null);
87
- }, Te = (e) => {
86
+ D(""), W(null), ie({}), te(null), $([]), Ce(!0), Q(null);
87
+ }, Le = (e) => {
88
88
  p(e), ce(e);
89
- }, ye = () => {
90
- xe(
91
- /* @__PURE__ */ i(De, { fallback: null, children: /* @__PURE__ */ i(
92
- it,
89
+ }, Fe = () => {
90
+ Te(
91
+ /* @__PURE__ */ s(Ye, { fallback: null, children: /* @__PURE__ */ s(
92
+ ot,
93
93
  {
94
94
  modalTitle: o.formatMessage({
95
95
  id: "modal.side_modal.modal_title",
96
96
  defaultMessage: "Choose your side"
97
97
  }),
98
- onChooseSide: Te,
98
+ onChooseSide: Le,
99
99
  positions: a,
100
- title: ge,
100
+ title: he,
101
101
  disabledPositions: !r && x,
102
102
  isNeutral: f && f.groupId == b && f.positionId === a[2]?.id
103
103
  }
104
104
  ) })
105
105
  );
106
- }, Le = () => {
107
- C ? ee ? Be() : !a || a?.length === 0 || !x?.find((e) => e?.id === d) && d || R && r ? ce(r && R && a[0]?.id) : ye() : Y({ loginAction: "argument" });
108
- }, Fe = (e, t) => {
106
+ }, Pe = () => {
107
+ C ? ee ? Ve() : !a || a?.length === 0 || !x?.find((e) => e?.id === d) && d || R && r ? ce(r && R && a[0]?.id) : Fe() : Y({ loginAction: "argument" });
108
+ }, Be = (e, t) => {
109
109
  g ? Y({ loginAction: "argument" }) : (D(e), W(t), V({ content: e }, [{ content: ["url", null] }]));
110
- }, Pe = (e) => {
110
+ }, Ee = (e) => {
111
111
  $(e);
112
112
  }, le = [
113
113
  { content: ["length", 3] },
@@ -115,23 +115,23 @@ const it = We(() => import("../../modal/side_modal/index.js").then((S) => ({ def
115
115
  { content: ["url", null] },
116
116
  ...!a || a?.length === 0 ? [] : [{ position_id: ["required", null] }]
117
117
  ], ce = (e) => {
118
- const t = e || d, l = {
118
+ const t = e || d, c = {
119
119
  content: q,
120
120
  rich_content: Z,
121
121
  group_id: b,
122
- ...O && { group_type: O },
122
+ ...z && { group_type: z },
123
123
  ...t && { position_id: t },
124
124
  is_reply: !!F,
125
125
  message_id: F || null,
126
- source_ids: U?.map((s) => s.id)
126
+ source_ids: U?.map((i) => i.id)
127
127
  };
128
- V(l, le) && (t && a && a.map((s) => s.id).includes(t) && Ie({
128
+ V(c, le) && (t && a && a.map((i) => i.id).includes(t) && xe({
129
129
  groupId: b,
130
130
  positionId: t
131
- }), de(), G.create("messages", l).then((s) => {
132
- if (s.data.success) {
131
+ }), de(), K.create("messages", c).then((i) => {
132
+ if (i.data.success) {
133
133
  if (F)
134
- J(s.data.data.resource), k(
134
+ O(i.data.data.resource), k(
135
135
  o.formatMessage({
136
136
  id: "alert.argument_create",
137
137
  defaultMessage: "Your contribution has been sent !"
@@ -145,11 +145,11 @@ const it = We(() => import("../../modal/side_modal/index.js").then((S) => ({ def
145
145
  }
146
146
  );
147
147
  else {
148
- const y = s.data.data.resource;
148
+ const y = i.data.data.resource;
149
149
  let L = S;
150
- t && !m && (L = `argumentList${y.position.id}`), J?.(
150
+ t && !m && (L = `argumentList${y.position.id}`), O?.(
151
151
  q,
152
- a.find((Ue) => Ue.id === t) || null
152
+ a.find((qe) => qe.id === t) || null
153
153
  ), N.add(L, [y]), k(
154
154
  o.formatMessage({
155
155
  id: "alert.argument_create",
@@ -169,34 +169,34 @@ const it = We(() => import("../../modal/side_modal/index.js").then((S) => ({ def
169
169
  typeof window < "u" && window.dispatchEvent(
170
170
  new CustomEvent("logora:user_content:created", {
171
171
  detail: {
172
- content: s.data.data?.resource
172
+ content: i.data.data?.resource
173
173
  }
174
174
  })
175
175
  );
176
176
  }
177
177
  }));
178
- }, Be = () => {
178
+ }, Ve = () => {
179
179
  const e = {
180
180
  content: q,
181
181
  rich_content: Z,
182
182
  source_ids: U?.map((t) => t.id),
183
183
  ...d && { position_id: d }
184
184
  };
185
- V(e, le) && G.update("messages", ee, e).then((t) => {
185
+ V(e, le) && K.update("messages", ee, e).then((t) => {
186
186
  if (t.data.success) {
187
- const l = t.data.data.resource;
188
- let s = S;
189
- if (_?.is_reply && _?.message_id ? s = `argument_${_.message_id}_reply_list` : d && !m && (s = `argumentList${l.position?.id}`), !_?.is_reply && _?.position?.id != l.position?.id && !m) {
190
- const y = `argumentList${_.position.id}`, L = `argumentList${l.position.id}`;
191
- N.remove(y, [l]), N.add(L, [l]);
187
+ const c = t.data.data.resource;
188
+ let i = S;
189
+ if (_?.is_reply && _?.message_id ? i = `argument_${_.message_id}_reply_list` : d && !m && (i = `argumentList${c.position?.id}`), !_?.is_reply && _?.position?.id != c.position?.id && !m) {
190
+ const y = `argumentList${_.position.id}`, L = `argumentList${c.position.id}`;
191
+ N.remove(y, [c]), N.add(L, [c]);
192
192
  } else
193
- N.update(s, [l]);
193
+ N.update(i, [c]);
194
194
  k(o.formatMessage({ id: "alert.argument_modify" }), {
195
195
  type: "success"
196
196
  }), de();
197
197
  }
198
198
  });
199
- }, Ee = () => {
199
+ }, Ue = () => {
200
200
  if (!ne) {
201
201
  ae(!0);
202
202
  const e = setTimeout(() => {
@@ -204,9 +204,9 @@ const it = We(() => import("../../modal/side_modal/index.js").then((S) => ({ def
204
204
  }, 2e3);
205
205
  return () => clearTimeout(e);
206
206
  }
207
- }, j = () => {
208
- g ? Y({ loginAction: "argument" }) : ie(!0);
209
- }, Ve = () => {
207
+ }, me = () => {
208
+ g ? Y({ loginAction: "argument" }) : se(!0);
209
+ }, $e = () => {
210
210
  const e = x.find(
211
211
  (t) => t.id === d
212
212
  );
@@ -220,28 +220,28 @@ const it = We(() => import("../../modal/side_modal/index.js").then((S) => ({ def
220
220
  );
221
221
  };
222
222
  return /* @__PURE__ */ M("div", { className: n.inputContainer, children: [
223
- z && /* @__PURE__ */ i("div", { className: n.disabledInputMask, children: re ? o.formatMessage({
223
+ j && /* @__PURE__ */ s("div", { className: n.disabledInputMask, children: ue ? o.formatMessage({
224
224
  id: "input.argument_input.user_banned",
225
225
  defaultMessage: "You are banned from the debate space."
226
226
  }) : o.formatMessage({
227
227
  id: "info.debate_is_inactive",
228
228
  defaultMessage: "Debate is closed"
229
229
  }) }),
230
- /* @__PURE__ */ i(
230
+ /* @__PURE__ */ s(
231
231
  "div",
232
232
  {
233
233
  className: I(n.argumentInput, {
234
234
  [n.flash]: ne,
235
235
  [n.replyInputContainer]: r
236
236
  }),
237
- children: /* @__PURE__ */ i("div", { "data-tid": "action_add_argument", ref: X, children: /* @__PURE__ */ M("div", { className: n.argumentInputBox, children: [
237
+ children: /* @__PURE__ */ s("div", { "data-tid": "action_add_argument", ref: X, children: /* @__PURE__ */ M("div", { className: n.argumentInputBox, children: [
238
238
  a.length > 0 && C && (!r || !R) && /* @__PURE__ */ M("div", { className: n.userPosition, children: [
239
- /* @__PURE__ */ i("div", { children: o.formatMessage({
239
+ /* @__PURE__ */ s("div", { children: o.formatMessage({
240
240
  id: "input.position",
241
241
  defaultMessage: "Your position"
242
242
  }) }),
243
- /* @__PURE__ */ i(
244
- Ze,
243
+ /* @__PURE__ */ s(
244
+ tt,
245
245
  {
246
246
  activeLabel: d === a[0].id ? 0 : d === a[1].id ? 1 : null,
247
247
  firstLabel: a[0],
@@ -258,22 +258,22 @@ const it = We(() => import("../../modal/side_modal/index.js").then((S) => ({ def
258
258
  [n.replyEditorRow]: r
259
259
  }),
260
260
  children: [
261
- /* @__PURE__ */ i(
261
+ /* @__PURE__ */ s(
262
262
  "div",
263
263
  {
264
264
  className: I(n.argumentAuthorContainer, {
265
265
  [n.argumentAuthorContainerMobile]: m,
266
266
  [n.argumentAuthorContainerActivated]: !m && w || r
267
267
  }),
268
- children: !m && w || r ? /* @__PURE__ */ i(
269
- et,
268
+ children: !m && w || r ? /* @__PURE__ */ s(
269
+ nt,
270
270
  {
271
271
  avatarUrl: u.image_url,
272
272
  userName: u.full_name,
273
- size: fe
273
+ size: ge
274
274
  }
275
- ) : /* @__PURE__ */ i(
276
- tt,
275
+ ) : /* @__PURE__ */ s(
276
+ at,
277
277
  {
278
278
  fullName: u?.full_name || o.formatMessage({ id: "default_author.full_name" }),
279
279
  avatarUrl: u?.image_url,
@@ -286,44 +286,45 @@ const it = We(() => import("../../modal/side_modal/index.js").then((S) => ({ def
286
286
  /* @__PURE__ */ M(
287
287
  "div",
288
288
  {
289
- onClick: j,
289
+ onClick: me,
290
290
  "data-testid": "argument-input",
291
291
  className: I(n.textEditorBox, {
292
292
  [n.replyTextEditorBox]: r
293
293
  }),
294
294
  children: [
295
- /* @__PURE__ */ i(
296
- nt,
295
+ /* @__PURE__ */ s(
296
+ st,
297
297
  {
298
298
  handleChange: (e, t) => {
299
- Fe(e, t);
299
+ Be(e, t);
300
300
  },
301
301
  handleSourcesChange: (e) => {
302
- Pe(e);
302
+ Ee(e);
303
303
  },
304
- placeholder: pe,
304
+ placeholder: _e,
305
305
  "aria-label": o.formatMessage({
306
306
  id: "input.argument_input.aria_label",
307
307
  defaultMessage: "Message input field"
308
308
  }),
309
- onSubmit: Le,
309
+ onSubmit: Pe,
310
310
  sources: U,
311
- hideSourceAction: he || g,
311
+ hideSourceAction: pe || g,
312
312
  uid: `Argument${b}`,
313
- onActivation: j,
313
+ onActivation: me,
314
314
  showStylesControls: w,
315
- disabled: z || g || re,
315
+ disabled: j || g || ue,
316
316
  maxLength: g ? !1 : h?.actions?.argumentMaxLength,
317
317
  disableRichText: h?.actions?.disableRichText || g,
318
318
  shortBar: r,
319
319
  hideSubmit: g,
320
320
  allowedDomains: h?.allowed_sources,
321
321
  active: P,
322
- hideCharCount: ve,
323
- disableAutoActivate: be
322
+ autoFocus: Se,
323
+ hideCharCount: be,
324
+ disableAutoActivate: Ae
324
325
  }
325
326
  ),
326
- E?.content && /* @__PURE__ */ i("div", { className: n.argumentInputWarning, children: E && Object.values(E).map((e, t) => /* @__PURE__ */ i("div", { children: e }, t)) }),
327
+ E?.content && /* @__PURE__ */ s("div", { className: n.argumentInputWarning, children: E && Object.values(E).map((e, t) => /* @__PURE__ */ s("div", { children: e }, t)) }),
327
328
  w && x?.find(
328
329
  (e) => e.id === d
329
330
  ) && /* @__PURE__ */ M(
@@ -334,8 +335,8 @@ const it = We(() => import("../../modal/side_modal/index.js").then((S) => ({ def
334
335
  n.disabledPositionWarning
335
336
  ),
336
337
  children: [
337
- /* @__PURE__ */ i(
338
- at,
338
+ /* @__PURE__ */ s(
339
+ it,
339
340
  {
340
341
  name: "announcement",
341
342
  className: n.warningIcon,
@@ -343,25 +344,25 @@ const it = We(() => import("../../modal/side_modal/index.js").then((S) => ({ def
343
344
  width: 20
344
345
  }
345
346
  ),
346
- /* @__PURE__ */ i("div", { className: n.argumentInputWarningText, children: Ve() })
347
+ /* @__PURE__ */ s("div", { className: n.argumentInputWarningText, children: $e() })
347
348
  ]
348
349
  }
349
350
  ),
350
- w && K && !Me && /* @__PURE__ */ i("div", { className: n.guideMessage, children: /* @__PURE__ */ i(
351
- me,
351
+ w && J && !ve && /* @__PURE__ */ s("div", { className: n.guideMessage, children: /* @__PURE__ */ s(
352
+ fe,
352
353
  {
353
354
  id: "alert.guide_message",
354
355
  defaultMessage: "Contributions must comply with our {userCharter}.",
355
356
  values: {
356
- userCharter: /* @__PURE__ */ i(
357
+ userCharter: /* @__PURE__ */ s(
357
358
  "a",
358
359
  {
359
360
  className: n.guideMessage,
360
- href: K,
361
+ href: J,
361
362
  target: "_blank",
362
363
  rel: "noreferrer",
363
- children: /* @__PURE__ */ i(
364
- me,
364
+ children: /* @__PURE__ */ s(
365
+ fe,
365
366
  {
366
367
  id: "alert.user_charter",
367
368
  defaultMessage: "user charter"
@@ -384,5 +385,5 @@ const it = We(() => import("../../modal/side_modal/index.js").then((S) => ({ def
384
385
  ] });
385
386
  };
386
387
  export {
387
- Nt as ArgumentInput
388
+ yt as ArgumentInput
388
389
  };
@@ -1,182 +1,185 @@
1
- import { jsxs as p, Fragment as Z, jsx as o } from "react/jsx-runtime";
2
- import { ListNode as oo, ListItemNode as to } from "@lexical/list";
3
- import { OverflowNode as eo } from "@lexical/overflow";
4
- import { CharacterLimitPlugin as ro } from "@lexical/react/LexicalCharacterLimitPlugin";
5
- import { LexicalComposer as io } from "@lexical/react/LexicalComposer";
6
- import { ContentEditable as no } from "@lexical/react/LexicalContentEditable";
7
- import { EditorRefPlugin as so } from "@lexical/react/LexicalEditorRefPlugin";
8
- import { LexicalErrorBoundary as co } from "@lexical/react/LexicalErrorBoundary";
9
- import { HistoryPlugin as lo } from "@lexical/react/LexicalHistoryPlugin";
10
- import { ListPlugin as mo } from "@lexical/react/LexicalListPlugin";
11
- import { OnChangePlugin as ao } from "@lexical/react/LexicalOnChangePlugin";
12
- import { RichTextPlugin as uo } from "@lexical/react/LexicalRichTextPlugin";
13
- import { QuoteNode as fo } from "@lexical/rich-text";
14
- import I from "classnames";
15
- import { $getRoot as po } from "lexical";
16
- import { useState as d, useId as ho, useEffect as go } from "react";
17
- import { useIntl as So } from "react-intl";
18
- import xo from "./EditorTheme.js";
1
+ import { jsxs as S, Fragment as oe, jsx as e } from "react/jsx-runtime";
2
+ import { ListNode as re, ListItemNode as ie } from "@lexical/list";
3
+ import { OverflowNode as ne } from "@lexical/overflow";
4
+ import { CharacterLimitPlugin as se } from "@lexical/react/LexicalCharacterLimitPlugin";
5
+ import { LexicalComposer as ce } from "@lexical/react/LexicalComposer";
6
+ import { ContentEditable as le } from "@lexical/react/LexicalContentEditable";
7
+ import { EditorRefPlugin as me } from "@lexical/react/LexicalEditorRefPlugin";
8
+ import { LexicalErrorBoundary as ae } from "@lexical/react/LexicalErrorBoundary";
9
+ import { HistoryPlugin as de } from "@lexical/react/LexicalHistoryPlugin";
10
+ import { ListPlugin as ue } from "@lexical/react/LexicalListPlugin";
11
+ import { OnChangePlugin as fe } from "@lexical/react/LexicalOnChangePlugin";
12
+ import { RichTextPlugin as pe } from "@lexical/react/LexicalRichTextPlugin";
13
+ import { QuoteNode as he } from "@lexical/rich-text";
14
+ import b from "classnames";
15
+ import { $getRoot as ge } from "lexical";
16
+ import { useState as f, useId as Se, useRef as xe, useEffect as M } from "react";
17
+ import { useIntl as Ce } from "react-intl";
18
+ import Pe from "./EditorTheme.js";
19
19
  import i from "./TextEditor.module.scss.js";
20
- import { AutoSavePlugin as vo } from "./plugins/AutoSavePlugin.js";
21
- import { FocusPlugin as Co } from "./plugins/FocusPlugin.js";
22
- import { MaxLengthPlugin as Po } from "./plugins/MaxLengthPlugin.js";
23
- import { ResetPlugin as To } from "./plugins/ResetPlugin.js";
24
- import { SetContentPlugin as No } from "./plugins/SetContentPlugin.js";
25
- import { SetRichContentPlugin as Eo } from "./plugins/SetRichContentPlugin.js";
26
- import { ToolbarPlugin as Io } from "./plugins/ToolbarPlugin.js";
27
- import { useModal as Ro } from "../../dialog/modal/useModal.js";
28
- import { SourceModal as bo } from "../../source/source_modal/SourceModal.js";
29
- import { SourceListItem as Mo } from "../../source/source_list_item/SourceListItem.js";
30
- const R = (c) => c?.replace(/&nbsp;/g, " "), it = ({
31
- placeholder: c,
32
- initialContent: b,
33
- initialRichContent: M,
34
- onSubmit: h,
35
- sources: u,
36
- hideSubmit: y = !1,
37
- hideSourceAction: w = !1,
38
- onActivation: g,
39
- disabled: A = !1,
40
- handleChange: S,
41
- handleSourcesChange: f,
42
- shortBar: L = !1,
43
- active: x = !1,
44
- maxLength: l,
45
- disableRichText: _ = !1,
46
- editorRef: B,
47
- uid: v,
48
- allowedDomains: C = [],
49
- hideCharCount: F = !1,
50
- disableAutoActivate: O = !1,
51
- ...U
20
+ import { AutoSavePlugin as Te } from "./plugins/AutoSavePlugin.js";
21
+ import { FocusPlugin as Ne } from "./plugins/FocusPlugin.js";
22
+ import { MaxLengthPlugin as ve } from "./plugins/MaxLengthPlugin.js";
23
+ import { ResetPlugin as Ee } from "./plugins/ResetPlugin.js";
24
+ import { SetContentPlugin as Ie } from "./plugins/SetContentPlugin.js";
25
+ import { SetRichContentPlugin as Re } from "./plugins/SetRichContentPlugin.js";
26
+ import { ToolbarPlugin as be } from "./plugins/ToolbarPlugin.js";
27
+ import { useModal as Me } from "../../dialog/modal/useModal.js";
28
+ import { SourceModal as ye } from "../../source/source_modal/SourceModal.js";
29
+ import { SourceListItem as we } from "../../source/source_list_item/SourceListItem.js";
30
+ const y = (l) => l?.replace(/&nbsp;/g, " "), st = ({
31
+ placeholder: l,
32
+ initialContent: w,
33
+ initialRichContent: L,
34
+ onSubmit: x,
35
+ sources: p,
36
+ hideSubmit: _ = !1,
37
+ hideSourceAction: A = !1,
38
+ onActivation: n,
39
+ disabled: B = !1,
40
+ handleChange: C,
41
+ handleSourcesChange: h,
42
+ shortBar: O = !1,
43
+ active: g = !1,
44
+ maxLength: m,
45
+ disableRichText: U = !1,
46
+ editorRef: j,
47
+ uid: P,
48
+ allowedDomains: T = [],
49
+ hideCharCount: k = !1,
50
+ disableAutoActivate: z = !1,
51
+ autoFocus: a = !1,
52
+ ...H
52
53
  }) => {
53
- const [n, j] = d(!1), [k, z] = d(""), [H, J] = d(""), [m, a] = d([]), { showModal: Q } = Ro(), P = So(), T = ho();
54
- go(() => {
55
- u && a(u);
56
- }, [u]);
57
- const N = () => {
58
- n || (j(!0), g && g());
59
- }, W = {
60
- editable: !A,
61
- theme: xo,
54
+ const [s, J] = f(a || g), [Q, W] = f(""), [$, q] = f(""), [d, u] = f([]), { showModal: D } = Me(), N = Ce(), v = Se(), E = xe(!1);
55
+ M(() => {
56
+ a && !E.current && n && (E.current = !0, n());
57
+ }, [a, n]), M(() => {
58
+ p && u(p);
59
+ }, [p]);
60
+ const I = () => {
61
+ s || (J(!0), n && n());
62
+ }, F = {
63
+ editable: !B,
64
+ theme: Pe,
62
65
  onError(t) {
63
66
  console.error("TextEditor error:", t);
64
67
  },
65
- nodes: [oo, to, fo, eo]
66
- }, $ = () => {
67
- N();
68
- }, q = (t) => {
68
+ nodes: [re, ie, he, ne]
69
+ }, G = () => {
70
+ I();
71
+ }, K = (t) => {
69
72
  t.read(() => {
70
- const e = po().getTextContent(), r = R(e), s = JSON.stringify(t), E = R(s);
71
- z(r), J(E), S && S(r, E);
73
+ const o = ge().getTextContent(), r = y(o), c = JSON.stringify(t), R = y(c);
74
+ W(r), q(R), C && C(r, R);
72
75
  });
73
- }, D = (t) => {
74
- const e = k, r = H, s = m;
75
- h && (t.preventDefault(), h(e, r, s)), a([]), f?.([]);
76
- }, G = () => {
77
- Q(
78
- /* @__PURE__ */ o(
79
- bo,
76
+ }, V = (t) => {
77
+ const o = Q, r = $, c = d;
78
+ x && (t.preventDefault(), x(o, r, c)), u([]), h?.([]);
79
+ }, X = () => {
80
+ D(
81
+ /* @__PURE__ */ e(
82
+ ye,
80
83
  {
81
- onAddSource: K,
82
- allowedSources: C
84
+ onAddSource: Y,
85
+ allowedSources: T
83
86
  }
84
87
  )
85
88
  );
86
- }, K = (t) => {
87
- a((e) => {
88
- const r = [...e, t];
89
- return f?.(r), r;
89
+ }, Y = (t) => {
90
+ u((o) => {
91
+ const r = [...o, t];
92
+ return h?.(r), r;
90
93
  });
91
- }, V = (t) => {
92
- a((e) => {
93
- const r = e.filter(
94
- (s) => s.source_url !== t.source_url
94
+ }, Z = (t) => {
95
+ u((o) => {
96
+ const r = o.filter(
97
+ (c) => c.source_url !== t.source_url
95
98
  );
96
- return f?.(r), r;
99
+ return h?.(r), r;
97
100
  });
98
- }, X = (t, e) => /* @__PURE__ */ o(
99
- Mo,
101
+ }, ee = (t, o) => /* @__PURE__ */ e(
102
+ we,
100
103
  {
101
104
  publisher: t.publisher,
102
105
  url: t.source_url,
103
106
  title: t.title,
104
- index: e,
105
- onRemove: () => V(t)
107
+ index: o,
108
+ onRemove: () => Z(t)
106
109
  },
107
- e
108
- ), Y = () => /* @__PURE__ */ o("div", { className: i.editorPlaceholder, children: c });
109
- return /* @__PURE__ */ p(Z, { children: [
110
- /* @__PURE__ */ o(io, { initialConfig: W, children: /* @__PURE__ */ o("div", { className: i.editorContainer, onClick: $, children: /* @__PURE__ */ p(
110
+ o
111
+ ), te = () => /* @__PURE__ */ e("div", { className: i.editorPlaceholder, children: l });
112
+ return /* @__PURE__ */ S(oe, { children: [
113
+ /* @__PURE__ */ e(ce, { initialConfig: F, children: /* @__PURE__ */ e("div", { className: i.editorContainer, onClick: G, children: /* @__PURE__ */ S(
111
114
  "div",
112
115
  {
113
- className: I(i.editorInner, {
114
- [i.editorInnerInactive]: !n && !x
116
+ className: b(i.editorInner, {
117
+ [i.editorInnerInactive]: !s && !g
115
118
  }),
116
119
  children: [
117
- /* @__PURE__ */ o(
118
- uo,
120
+ /* @__PURE__ */ e(
121
+ pe,
119
122
  {
120
- contentEditable: /* @__PURE__ */ o(
121
- no,
123
+ contentEditable: /* @__PURE__ */ e(
124
+ le,
122
125
  {
123
- className: I(i.editorInput, {
124
- [i.editorInputInactive]: !n
126
+ className: b(i.editorInput, {
127
+ [i.editorInputInactive]: !s
125
128
  }),
126
- ...U
129
+ ...H
127
130
  }
128
131
  ),
129
- placeholder: c && /* @__PURE__ */ o(Y, {}),
130
- ErrorBoundary: co
132
+ placeholder: l && /* @__PURE__ */ e(te, {}),
133
+ ErrorBoundary: ae
131
134
  }
132
135
  ),
133
- /* @__PURE__ */ o(
134
- Io,
136
+ /* @__PURE__ */ e(
137
+ be,
135
138
  {
136
- hideSourceAction: w,
137
- hideSubmit: y,
138
- disableRichText: _,
139
- shortBar: L,
140
- onSubmit: D,
141
- onAddSource: G,
142
- isActive: n || x,
143
- sourceTooltip: C?.length > 0 && P.formatMessage({
139
+ hideSourceAction: A,
140
+ hideSubmit: _,
141
+ disableRichText: U,
142
+ shortBar: O,
143
+ onSubmit: V,
144
+ onAddSource: X,
145
+ isActive: s || g,
146
+ sourceTooltip: T?.length > 0 && N.formatMessage({
144
147
  id: "input.allowed_domains_tooltip",
145
148
  defaultMessage: "With the new source function, you can add links to your article."
146
149
  })
147
150
  }
148
151
  ),
149
- n && l && !F && /* @__PURE__ */ p("div", { className: i.charactersCount, children: [
150
- /* @__PURE__ */ o(ro, { maxLength: l }),
152
+ s && m && !k && /* @__PURE__ */ S("div", { className: i.charactersCount, children: [
153
+ /* @__PURE__ */ e(se, { maxLength: m }),
151
154
  " ",
152
- P.formatMessage({
155
+ N.formatMessage({
153
156
  id: "input.remaining_chars",
154
157
  defaultMessage: "remaining characters"
155
158
  })
156
159
  ] }),
157
- /* @__PURE__ */ o(mo, {}),
158
- /* @__PURE__ */ o(lo, {}),
159
- /* @__PURE__ */ o(ao, { onChange: q, ignoreSelectionChange: !0 }),
160
- /* @__PURE__ */ o(
161
- vo,
160
+ /* @__PURE__ */ e(ue, {}),
161
+ /* @__PURE__ */ e(de, {}),
162
+ /* @__PURE__ */ e(fe, { onChange: K, ignoreSelectionChange: !0 }),
163
+ /* @__PURE__ */ e(
164
+ Te,
162
165
  {
163
- onSetContent: O ? () => {
164
- } : N,
165
- storageUid: v || T
166
+ onSetContent: z ? () => {
167
+ } : I,
168
+ storageUid: P || v
166
169
  }
167
170
  ),
168
- /* @__PURE__ */ o(No, { content: b }),
169
- /* @__PURE__ */ o(Eo, { richContent: M }),
170
- /* @__PURE__ */ o(Co, {}),
171
- l && /* @__PURE__ */ o(Po, { maxLength: l }),
172
- /* @__PURE__ */ o(To, { storageUid: v || T }),
173
- /* @__PURE__ */ o(so, { editorRef: B })
171
+ /* @__PURE__ */ e(Ie, { content: w }),
172
+ /* @__PURE__ */ e(Re, { richContent: L }),
173
+ /* @__PURE__ */ e(Ne, { autoFocus: a }),
174
+ m && /* @__PURE__ */ e(ve, { maxLength: m }),
175
+ /* @__PURE__ */ e(Ee, { storageUid: P || v }),
176
+ /* @__PURE__ */ e(me, { editorRef: j })
174
177
  ]
175
178
  }
176
179
  ) }) }),
177
- m && m.length !== 0 ? /* @__PURE__ */ o("div", { className: i.sourcesBox, children: /* @__PURE__ */ o("div", { className: i.sourceList, children: m.map(X) }) }) : null
180
+ d && d.length !== 0 ? /* @__PURE__ */ e("div", { className: i.sourcesBox, children: /* @__PURE__ */ e("div", { className: i.sourceList, children: d.map(ee) }) }) : null
178
181
  ] });
179
182
  };
180
183
  export {
181
- it as TextEditor
184
+ st as TextEditor
182
185
  };
@@ -1,14 +1,18 @@
1
- import { useLexicalComposerContext as e } from "@lexical/react/LexicalComposerContext";
2
- import { useEffect as r } from "react";
3
- import { useInput as n } from "../../input_provider/useInput.js";
4
- const f = () => {
5
- const [o] = e(), { focus: t } = n();
6
- return r(() => {
7
- t && o.focus(() => {
1
+ import { useLexicalComposerContext as u } from "@lexical/react/LexicalComposerContext";
2
+ import { useRef as c, useEffect as s } from "react";
3
+ import { useInput as f } from "../../input_provider/useInput.js";
4
+ const E = ({ autoFocus: t = !1 }) => {
5
+ const [o] = u(), { focus: e } = f(), r = c(!1);
6
+ return s(() => {
7
+ e && o.focus(() => {
8
8
  o.getRootElement().focus();
9
9
  });
10
+ }, [e, o]), s(() => {
11
+ t && !r.current && (r.current = !0, o.focus(() => {
12
+ o.getRootElement().focus();
13
+ }));
10
14
  }, [t, o]), null;
11
15
  };
12
16
  export {
13
- f as FocusPlugin
17
+ E as FocusPlugin
14
18
  };
@@ -1,31 +1,32 @@
1
- import { jsx as t, jsxs as f, Fragment as y } from "react/jsx-runtime";
2
- import { useState as u, useEffect as I } from "react";
3
- import g from "classnames";
1
+ import { jsx as t, jsxs as u, Fragment as S } from "react/jsx-runtime";
2
+ import { useState as g, useEffect as I } from "react";
3
+ import p from "classnames";
4
4
  import { useIntl as N } from "react-intl";
5
5
  import o from "./ProposalBox.module.scss.js";
6
- import { useConfig as S } from "../../data/config_provider/useConfig.js";
7
- import { useAuth as B } from "../../auth/use_auth/useAuth.js";
8
- import { useTranslatedContent as p } from "../../translation/translated_content/useTranslatedContent.js";
9
- import { lexicalToHtml as H } from "../../input/text_editor/lexicalToHtml.js";
10
- import { HashScroll as L } from "../../tools/hash_scroll/HashScroll.js";
6
+ import { useConfig as y } from "../../data/config_provider/useConfig.js";
7
+ import { useAuth as L } from "../../auth/use_auth/useAuth.js";
8
+ import { useTranslatedContent as C } from "../../translation/translated_content/useTranslatedContent.js";
9
+ import { lexicalToHtml as B } from "../../input/text_editor/lexicalToHtml.js";
10
+ import { HashScroll as H } from "../../tools/hash_scroll/HashScroll.js";
11
11
  import { ContentHeader as U } from "../../user_content/content_header/ContentHeader.js";
12
12
  import { ReadMore as D } from "../../text/read_more/ReadMore.js";
13
13
  import { TranslationButton as P } from "../../translation/translation_button/TranslationButton.js";
14
- import { ContentFooter as R } from "../../user_content/content_footer/ContentFooter.js";
15
- import { UpDownVoteBox as $ } from "../../vote/up_down_vote_box/UpDownVoteBox.js";
16
- const Y = ({
14
+ import { SourceListItem as R } from "../../source/source_list_item/SourceListItem.js";
15
+ import { ContentFooter as $ } from "../../user_content/content_footer/ContentFooter.js";
16
+ import { UpDownVoteBox as F } from "../../vote/up_down_vote_box/UpDownVoteBox.js";
17
+ const ee = ({
17
18
  proposal: e,
18
- disabled: i = !1,
19
- fixedContentHeight: C,
19
+ disabled: d = !1,
20
+ fixedContentHeight: _,
20
21
  enableEdition: T = !0,
21
- hideFooter: _ = !1
22
+ hideFooter: v = !1
22
23
  }) => {
23
- const [d, v] = u(null), [x, M] = u(!1), a = N(), r = S(), { currentUser: l } = B(), c = l?.moderation_status === "banned", m = `proposal_${e.id}`, s = p(
24
+ const [c, x] = g(null), [M, w] = g(!1), s = N(), n = y(), { currentUser: m } = L(), h = m?.moderation_status === "banned", f = `proposal_${e.id}`, i = C(
24
25
  e.title,
25
26
  e.language,
26
27
  "title",
27
28
  e.translation_entries
28
- ), n = p(
29
+ ), a = C(
29
30
  e.content,
30
31
  e.language,
31
32
  "content",
@@ -33,21 +34,21 @@ const Y = ({
33
34
  );
34
35
  I(() => {
35
36
  if (e.rich_content) {
36
- const h = JSON.parse(e.rich_content);
37
- if (h.hasOwnProperty("root")) {
38
- const b = H(h);
39
- v(b);
37
+ const r = JSON.parse(e.rich_content);
38
+ if (r.hasOwnProperty("root")) {
39
+ const l = B(r);
40
+ x(l);
40
41
  }
41
42
  }
42
43
  }, [e.rich_content]);
43
- const w = () => {
44
- s.toggleContent(), n.toggleContent();
44
+ const b = () => {
45
+ i.toggleContent(), a.toggleContent();
45
46
  };
46
- return /* @__PURE__ */ t(L, { elementId: m, onScroll: () => M(!0), children: /* @__PURE__ */ f(
47
+ return /* @__PURE__ */ t(H, { elementId: f, onScroll: () => w(!0), children: /* @__PURE__ */ u(
47
48
  "div",
48
49
  {
49
- className: g(o.proposalBoxContainer, { [o.flash]: x }),
50
- id: m,
50
+ className: p(o.proposalBoxContainer, { [o.flash]: M }),
51
+ id: f,
51
52
  children: [
52
53
  /* @__PURE__ */ t(
53
54
  U,
@@ -61,39 +62,39 @@ const Y = ({
61
62
  /* @__PURE__ */ t(
62
63
  "div",
63
64
  {
64
- className: g(o.proposalBoxContent, {
65
- [o.fixedHeight]: C
65
+ className: p(o.proposalBoxContent, {
66
+ [o.fixedHeight]: _
66
67
  }),
67
68
  children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
68
69
  D,
69
70
  {
70
- content: /* @__PURE__ */ f(y, { children: [
71
- e.is_edited && /* @__PURE__ */ t("div", { className: o.edited, children: a.formatMessage({
71
+ content: /* @__PURE__ */ u(S, { children: [
72
+ e.is_edited && /* @__PURE__ */ t("div", { className: o.edited, children: s.formatMessage({
72
73
  id: "proposal.updated",
73
74
  defaultMessage: "Updated proposal"
74
75
  }) }),
75
- /* @__PURE__ */ t("div", { className: o.proposalTitle, children: s.translatedContent }),
76
- d && !n.isTranslated ? /* @__PURE__ */ t(
76
+ /* @__PURE__ */ t("div", { className: o.proposalTitle, children: i.translatedContent }),
77
+ c && !a.isTranslated ? /* @__PURE__ */ t(
77
78
  "div",
78
79
  {
79
80
  className: o.proposalContent,
80
- dangerouslySetInnerHTML: { __html: d }
81
+ dangerouslySetInnerHTML: { __html: c }
81
82
  }
82
- ) : /* @__PURE__ */ t("div", { className: o.proposalContent, children: n.translatedContent }),
83
- (n.isTranslated || s.isTranslated) && /* @__PURE__ */ t(
83
+ ) : /* @__PURE__ */ t("div", { className: o.proposalContent, children: a.translatedContent }),
84
+ (a.isTranslated || i.isTranslated) && /* @__PURE__ */ t(
84
85
  P,
85
86
  {
86
87
  language: e.language,
87
- callback: () => w()
88
+ callback: () => b()
88
89
  }
89
90
  )
90
91
  ] }),
91
92
  lineCount: 7,
92
- readMoreText: a.formatMessage({
93
+ readMoreText: s.formatMessage({
93
94
  id: "action.read_more",
94
95
  defaultMessage: "Read more"
95
96
  }),
96
- readLessText: a.formatMessage({
97
+ readLessText: s.formatMessage({
97
98
  id: "action.read_less",
98
99
  defaultMessage: "Read less"
99
100
  })
@@ -101,31 +102,41 @@ const Y = ({
101
102
  ) })
102
103
  }
103
104
  ),
104
- !_ && /* @__PURE__ */ t(
105
+ e.sources?.length > 0 && /* @__PURE__ */ t("div", { className: o.proposalSourcesList, children: e.sources.map((r, l) => /* @__PURE__ */ t(
105
106
  R,
107
+ {
108
+ publisher: r.publisher,
109
+ url: r.source_url,
110
+ title: r.title,
111
+ index: l
112
+ },
113
+ r.id
114
+ )) }),
115
+ !v && /* @__PURE__ */ t(
116
+ $,
106
117
  {
107
118
  resource: e,
108
- disabled: i || c,
119
+ disabled: d || h,
109
120
  reportType: "Proposal",
110
121
  deleteType: "proposals",
111
122
  deleteListId: "proposalsList",
112
- shareModalTitle: a.formatMessage({ id: "share.proposal" }),
123
+ shareModalTitle: s.formatMessage({ id: "share.proposal" }),
113
124
  shareUrl: `https://app.logora.fr/share/p/${e.id}`,
114
- shareTitle: a.formatMessage({ id: "share.proposal.title" }),
115
- shareText: a.formatMessage({ id: "share.proposal.text" }),
116
- shareCode: `<iframe src="https://cdn.logora.com/embed.html?shortname=${r.shortname}&id=${e.id}&resource=proposal" frameborder="0" width="100%" height="335px" scrolling="no"></iframe>`,
117
- showShareCode: r?.actions?.hideCodeShare !== !0,
125
+ shareTitle: s.formatMessage({ id: "share.proposal.title" }),
126
+ shareText: s.formatMessage({ id: "share.proposal.text" }),
127
+ shareCode: `<iframe src="https://cdn.logora.com/embed.html?shortname=${n.shortname}&id=${e.id}&resource=proposal" frameborder="0" width="100%" height="335px" scrolling="no"></iframe>`,
128
+ showShareCode: n?.actions?.hideCodeShare !== !0,
118
129
  showActions: !e.author.consultation_id,
119
130
  enableEdition: T,
120
131
  children: /* @__PURE__ */ t(
121
- $,
132
+ F,
122
133
  {
123
134
  voteableType: "Proposal",
124
135
  voteableId: e.id,
125
136
  totalUpvote: e.total_upvotes,
126
137
  totalDownvote: e.total_downvotes,
127
- disabled: i || l?.id === e?.author?.id || c,
128
- hideDownvotes: r?.actions?.hideDownvotes
138
+ disabled: d || m?.id === e?.author?.id || h,
139
+ hideDownvotes: n?.actions?.hideDownvotes
129
140
  }
130
141
  )
131
142
  }
@@ -135,5 +146,5 @@ const Y = ({
135
146
  ) });
136
147
  };
137
148
  export {
138
- Y as ProposalBox
149
+ ee as ProposalBox
139
150
  };
@@ -1,19 +1,21 @@
1
- import '../../../assets/components/proposal/proposal_box/ProposalBox.module-T4ms_LQ7.css';const o = "_proposalBoxContainer_awwcm_3", t = "_flash_awwcm_17", a = "_edited_awwcm_25", e = "_proposalBoxContent_awwcm_32", n = "_proposalTitle_awwcm_44", s = "_proposalContent_awwcm_52", p = "_fixedHeight_awwcm_56", _ = {
1
+ import '../../../assets/components/proposal/proposal_box/ProposalBox.module-C9BaTFDH.css';const o = "_proposalBoxContainer_5d6lc_3", t = "_flash_5d6lc_17", s = "_edited_5d6lc_25", l = "_proposalBoxContent_5d6lc_32", p = "_proposalTitle_5d6lc_44", e = "_proposalContent_5d6lc_52", n = "_proposalSourcesList_5d6lc_56", _ = "_fixedHeight_5d6lc_68", a = {
2
2
  proposalBoxContainer: o,
3
3
  flash: t,
4
- edited: a,
5
- proposalBoxContent: e,
6
- proposalTitle: n,
7
- proposalContent: s,
8
- fixedHeight: p
4
+ edited: s,
5
+ proposalBoxContent: l,
6
+ proposalTitle: p,
7
+ proposalContent: e,
8
+ proposalSourcesList: n,
9
+ fixedHeight: _
9
10
  };
10
11
  export {
11
- _ as default,
12
- a as edited,
13
- p as fixedHeight,
12
+ a as default,
13
+ s as edited,
14
+ _ as fixedHeight,
14
15
  t as flash,
15
16
  o as proposalBoxContainer,
16
- e as proposalBoxContent,
17
- s as proposalContent,
18
- n as proposalTitle
17
+ l as proposalBoxContent,
18
+ e as proposalContent,
19
+ n as proposalSourcesList,
20
+ p as proposalTitle
19
21
  };
@@ -2,13 +2,13 @@ import { jsxs as a, Fragment as n, jsx as s } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import { useIntl as l, FormattedDate as m } from "react-intl";
4
4
  import e from "./ContextSourceBox.module.scss.js";
5
- const g = ({ title: t, imageUrl: c, date: i, author: r }) => {
5
+ const x = ({ title: r, imageUrl: c, date: i, author: t }) => {
6
6
  const o = l();
7
7
  return /* @__PURE__ */ a("div", { className: e.container, children: [
8
8
  /* @__PURE__ */ a("div", { className: e.content, children: [
9
9
  /* @__PURE__ */ a("div", { className: e.infos, children: [
10
- r && /* @__PURE__ */ a(n, { children: [
11
- /* @__PURE__ */ s("span", { className: e.sourceAuthor, children: r }),
10
+ t && /* @__PURE__ */ a(n, { children: [
11
+ /* @__PURE__ */ s("span", { className: e.sourceAuthor, children: t }),
12
12
  /* @__PURE__ */ s("span", { className: e.separator, children: "·" })
13
13
  ] }),
14
14
  /* @__PURE__ */ s("span", { className: e.sourcePublishedDate, children: /* @__PURE__ */ s(
@@ -21,21 +21,21 @@ const g = ({ title: t, imageUrl: c, date: i, author: r }) => {
21
21
  }
22
22
  ) })
23
23
  ] }),
24
- /* @__PURE__ */ s("div", { className: e.sourceTitle, children: t })
24
+ /* @__PURE__ */ s("div", { className: e.sourceTitle, children: r })
25
25
  ] }),
26
26
  /* @__PURE__ */ s(
27
27
  "img",
28
28
  {
29
29
  src: c,
30
30
  alt: o.formatMessage({
31
- id: "source.context_source_box.alt",
32
- defaultMessage: "Debate source image"
31
+ id: "source.context_source_box.alt"
33
32
  }),
33
+ "data-testid": "context-source-image",
34
34
  className: e.image
35
35
  }
36
36
  )
37
37
  ] });
38
38
  };
39
39
  export {
40
- g as ContextSourceBox
40
+ x as ContextSourceBox
41
41
  };
@@ -1,14 +1,13 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import m from "classnames";
3
3
  import "react";
4
- import { useIntl as c } from "react-intl";
5
4
  import e from "./ContextSourceList.module.scss.js";
6
5
  import { useResponsive as p } from "../../hooks/use_responsive/useResponsive.js";
7
- import { SectionBox as u } from "../../section/section_box/SectionBox.js";
6
+ import { SectionBox as c } from "../../section/section_box/SectionBox.js";
8
7
  import { Link as d } from "../../action/link/Link.js";
9
- import { ContextSourceBox as f } from "../context_source_box/ContextSourceBox.js";
10
- const M = ({ sources: i = [] }) => {
11
- const r = c(), { isMobile: s, isTablet: l, isDesktop: n } = p(), a = (t) => /* @__PURE__ */ o(
8
+ import { ContextSourceBox as u } from "../context_source_box/ContextSourceBox.js";
9
+ const C = ({ sources: i = [], title: r = "" }) => {
10
+ const { isMobile: l, isTablet: s, isDesktop: n } = p(), a = (t) => /* @__PURE__ */ o(
12
11
  d,
13
12
  {
14
13
  className: e.listItem,
@@ -16,7 +15,7 @@ const M = ({ sources: i = [] }) => {
16
15
  target: "_blank",
17
16
  external: !0,
18
17
  children: /* @__PURE__ */ o(
19
- f,
18
+ u,
20
19
  {
21
20
  imageUrl: t.origin_image_url,
22
21
  author: t.publisher,
@@ -28,22 +27,19 @@ const M = ({ sources: i = [] }) => {
28
27
  t.id
29
28
  );
30
29
  return /* @__PURE__ */ o(
31
- u,
30
+ c,
32
31
  {
33
32
  className: e.sectionBox,
34
33
  isCollapsible: !0,
35
34
  isCollapsedByDefault: !1,
36
- title: r.formatMessage({
37
- id: "source.context_source_list.title",
38
- defaultMessage: "Debate context"
39
- }),
35
+ title: r,
40
36
  children: /* @__PURE__ */ o(
41
37
  "div",
42
38
  {
43
39
  className: m(e.content, {
44
40
  [e.contentDesktop]: n,
45
- [e.contentTablet]: l,
46
- [e.contentMobile]: s
41
+ [e.contentTablet]: s,
42
+ [e.contentMobile]: l
47
43
  }),
48
44
  children: i.map(a)
49
45
  }
@@ -52,5 +48,5 @@ const M = ({ sources: i = [] }) => {
52
48
  );
53
49
  };
54
50
  export {
55
- M as ContextSourceList
51
+ C as ContextSourceList
56
52
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logora/debate",
3
- "version": "0.3.77",
3
+ "version": "0.3.79",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0",
6
6
  "description": "Design system of @Logora made with React",
@@ -1 +0,0 @@
1
- ._proposalBoxContainer_awwcm_3{display:flex!important;flex-direction:column!important;justify-content:space-between!important;position:relative;box-shadow:var(--box-shadow, 0px 2px 5px rgba(7, 42, 68, .1));border:var(--box-border, 1px solid rgba(7, 42, 68, .1));color:var(--text-primary, #222222);border-radius:var(--box-border-radius, 6px);background-color:var(--background-color-primary, white);scroll-margin-top:150px;padding:var(--box-spacing, var(--space-unit, 1em));gap:var(--box-spacing, var(--space-unit, 1em))}._proposalBoxContainer_awwcm_3._flash_awwcm_17{-webkit-transition:box-shadow .8s ease-in-out;-moz-transition:box-shadow .8s ease-in-out;-o-transition:box-shadow .8s ease-in-out;transition:box-shadow .8s ease-in-out;box-shadow:0 0 15px var(--call-primary-color, #434343)}._edited_awwcm_25{font-size:var(--font-size-extra-small, 14px);color:var(--text-secondary, #5F5F5F);line-height:var(--line-height-loose, 1.38em);margin-bottom:var(--spacer-xs, calc(var(--space-unit, 1em) * .325))!important}._proposalBoxContent_awwcm_32{text-align:left;white-space:pre-line;line-height:var(--line-height-loose, 1.38em);font-size:var(--font-size-small, 16px)}@container (min-width: 768px){._proposalBoxContent_awwcm_32{min-height:185px}}._proposalBoxContent_awwcm_32 ._proposalTitle_awwcm_44{font-size:var(--font-size-normal, 16px);font-weight:var(--font-weight-bold, 700);padding-bottom:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important}._proposalBoxContent_awwcm_32 ._proposalTitle_awwcm_44:first-letter{text-transform:uppercase}._proposalBoxContent_awwcm_32 ._proposalContent_awwcm_52 *{font-size:var(--font-size-small, 16px)}._fixedHeight_awwcm_56{height:200px;overflow:hidden;position:relative}._fixedHeight_awwcm_56:after{content:"";position:absolute;z-index:1;bottom:0;left:0;right:0;pointer-events:none;background-image:linear-gradient(to bottom,#fff0,#fff 90%);width:100%;height:5em}