@logora/debate 0.3.88 → 0.3.90

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.
Files changed (67) hide show
  1. package/dist/assets/components/argument/argument/Argument.module-gLfNRLks.css +1 -0
  2. package/dist/assets/components/consultation/consultation_box/ConsultationBox.module-BnTr5IaF.css +1 -0
  3. package/dist/assets/components/follow/follow_button/FollowButton.module-Da-cPgwT.css +1 -0
  4. package/dist/assets/components/input/text_editor/{TextEditor.module-CxuSL3l3.css → TextEditor.module-DePSfOvG.css} +1 -1
  5. package/dist/assets/components/list/paginated_list/action_bar/ActionBar.module-pxwFC_Y2.css +1 -0
  6. package/dist/assets/components/proposal/proposal_box/ProposalBox.module-T4ms_LQ7.css +1 -0
  7. package/dist/assets/components/section/section_box/SectionBox.module-DUeUtdWr.css +1 -0
  8. package/dist/assets/components/source/context_source_list/ContextSourceList.module-D6X_0dB7.css +1 -0
  9. package/dist/assets/components/source/source_list_item/SourceListItem.module-mTxHhXPV.css +1 -0
  10. package/dist/assets/components/summary/summary/Summary.module-DjfmUlkW.css +1 -0
  11. package/dist/assets/components/summary/summary_box/SummaryBox.module-DQVkA8l7.css +1 -0
  12. package/dist/assets/components/vote/vote_box/VoteBox.module-CDrqb2SZ.css +1 -0
  13. package/dist/components/argument/argument/Argument.js +106 -111
  14. package/dist/components/argument/argument/Argument.module.scss.js +31 -31
  15. package/dist/components/consultation/consultation_box/ConsultationBox.js +111 -80
  16. package/dist/components/consultation/consultation_box/ConsultationBox.module.scss.js +29 -31
  17. package/dist/components/dialog/dropdown/Dropdown.js +28 -35
  18. package/dist/components/follow/follow_button/FollowButton.js +16 -17
  19. package/dist/components/follow/follow_button/FollowButton.module.scss.js +4 -6
  20. package/dist/components/icons/bild_icons/index.js +56 -58
  21. package/dist/components/icons/hero_icons/index.js +18 -20
  22. package/dist/components/icons/krone_icons/index.js +46 -48
  23. package/dist/components/icons/regular_icons/index.js +18 -20
  24. package/dist/components/icons/spiegel_icons/index.js +52 -54
  25. package/dist/components/icons/stern_icons/index.js +70 -102
  26. package/dist/components/input/argument_input/ArgumentInput.js +197 -201
  27. package/dist/components/input/select/Select.js +19 -19
  28. package/dist/components/input/text_editor/TextEditor.js +129 -143
  29. package/dist/components/input/text_editor/TextEditor.module.scss.js +5 -5
  30. package/dist/components/input/text_editor/plugins/FocusPlugin.js +8 -12
  31. package/dist/components/input/text_editor/plugins/SetContentPlugin.js +13 -13
  32. package/dist/components/input/text_editor/plugins/SetRichContentPlugin.js +10 -10
  33. package/dist/components/input/text_editor/plugins/ToolbarPlugin.js +72 -70
  34. package/dist/components/list/paginated_list/PaginatedList.js +125 -131
  35. package/dist/components/list/paginated_list/action_bar/ActionBar.js +50 -53
  36. package/dist/components/list/paginated_list/action_bar/ActionBar.module.scss.js +16 -18
  37. package/dist/components/notification/notification_menu/NotificationMenu.js +22 -23
  38. package/dist/components/proposal/proposal_box/ProposalBox.js +59 -70
  39. package/dist/components/proposal/proposal_box/ProposalBox.module.scss.js +10 -14
  40. package/dist/components/section/section_box/SectionBox.js +10 -10
  41. package/dist/components/section/section_box/SectionBox.module.scss.js +9 -9
  42. package/dist/components/source/context_source_box/ContextSourceBox.js +7 -7
  43. package/dist/components/source/context_source_list/ContextSourceList.js +13 -10
  44. package/dist/components/source/context_source_list/ContextSourceList.module.scss.js +12 -14
  45. package/dist/components/source/source_list_item/SourceListItem.js +28 -42
  46. package/dist/components/source/source_list_item/SourceListItem.module.scss.js +6 -8
  47. package/dist/components/source/source_modal/SourceModal.js +15 -15
  48. package/dist/components/summary/summary/Summary.js +63 -41
  49. package/dist/components/summary/summary/Summary.module.scss.js +6 -10
  50. package/dist/components/summary/summary_box/SummaryBox.module.scss.js +9 -9
  51. package/dist/components/vote/vote_box/VoteBox.js +143 -122
  52. package/dist/components/vote/vote_box/VoteBox.module.scss.js +48 -50
  53. package/package.json +1 -1
  54. package/dist/assets/components/argument/argument/Argument.module-QZdPjj_i.css +0 -1
  55. package/dist/assets/components/consultation/consultation_box/ConsultationBox.module-DjNiVt-p.css +0 -1
  56. package/dist/assets/components/follow/follow_button/FollowButton.module-C9YXM8AM.css +0 -1
  57. package/dist/assets/components/list/paginated_list/action_bar/ActionBar.module-DvwCbS9k.css +0 -1
  58. package/dist/assets/components/proposal/proposal_box/ProposalBox.module-Dm8XDnr1.css +0 -1
  59. package/dist/assets/components/section/section_box/SectionBox.module-qQs4B6bf.css +0 -1
  60. package/dist/assets/components/source/context_source_list/ContextSourceList.module-DUPbI-wb.css +0 -1
  61. package/dist/assets/components/source/source_list_item/SourceListItem.module-fm_uHuY4.css +0 -1
  62. package/dist/assets/components/summary/summary/Summary.module-2bnx3egy.css +0 -1
  63. package/dist/assets/components/summary/summary_box/SummaryBox.module-Dr9PevSJ.css +0 -1
  64. package/dist/assets/components/vote/vote_box/VoteBox.module-D5sSSHpi.css +0 -1
  65. package/dist/components/icons/regular_icons/Follow.js +0 -6
  66. package/dist/components/icons/spiegel_icons/Downvote.js +0 -6
  67. package/dist/components/icons/spiegel_icons/Upvote.js +0 -6
@@ -1,78 +1,80 @@
1
- import { jsxs as N, jsx as t } from "react/jsx-runtime";
2
- import { $isListNode as R, ListNode as w, INSERT_ORDERED_LIST_COMMAND as B, REMOVE_LIST_COMMAND as D } from "@lexical/list";
3
- import { useLexicalComposerContext as $ } from "@lexical/react/LexicalComposerContext";
4
- import { $isHeadingNode as q, $createQuoteNode as K } from "@lexical/rich-text";
5
- import { $setBlocksType as M } from "@lexical/selection";
6
- import { $getNearestNodeOfType as F, mergeRegister as U } from "@lexical/utils";
7
- import a from "classnames";
8
- import { $getSelection as g, $isRangeSelection as P, SELECTION_CHANGE_COMMAND as j, FORMAT_TEXT_COMMAND as h, $createParagraphNode as H } from "lexical";
9
- import { useRef as Q, useState as c, useCallback as G, useEffect as V } from "react";
1
+ import { jsxs as _, jsx as t } from "react/jsx-runtime";
2
+ import { $isListNode as R, ListNode as D, INSERT_ORDERED_LIST_COMMAND as $ } from "@lexical/list";
3
+ import { useLexicalComposerContext as K } from "@lexical/react/LexicalComposerContext";
4
+ import { $isHeadingNode as q, $createQuoteNode as F } from "@lexical/rich-text";
5
+ import { $setBlocksType as y } from "@lexical/selection";
6
+ import { $getNearestNodeOfType as P, mergeRegister as U } from "@lexical/utils";
7
+ import o from "classnames";
8
+ import { $getSelection as b, $isRangeSelection as M, SELECTION_CHANGE_COMMAND as j, FORMAT_TEXT_COMMAND as g } from "lexical";
9
+ import { useRef as H, useState as c, useCallback as Q, useEffect as G } from "react";
10
10
  import { useIntl as X } from "react-intl";
11
11
  import e from "./ToolbarPlugin.module.scss.js";
12
12
  import { Icon as s } from "../../../icons/icon/Icon.js";
13
13
  import { Button as z } from "../../../action/button/Button.js";
14
- const me = (l) => {
15
- const n = X(), y = 1, [o] = $(), C = Q(null), [m, f] = c("paragraph"), [J, T] = c(null), [k, I] = c(!1), [x, A] = c(!1), [S, E] = c(!1), p = l.hideSubmit && l.hideSourceAction && l.disableRichText, b = G(() => {
16
- const i = g();
17
- if (P(i)) {
18
- const d = i.anchor.getNode(), r = d.getKey() === "root" ? d : d.getTopLevelElementOrThrow(), _ = r.getKey();
19
- if (o.getElementByKey(_) !== null)
20
- if (T(_), R(r)) {
21
- const u = F(d, w), O = u ? u.getTag() : r.getTag();
22
- f(O);
14
+ const ce = (i) => {
15
+ const n = X(), T = 1, [l] = K(), k = H(null), [f, h] = c("paragraph"), [J, C] = c(null), [x, I] = c(!1), [A, S] = c(!1), [E, L] = c(!1), p = i.hideSubmit && i.hideSourceAction && i.disableRichText, u = Q(() => {
16
+ const a = b();
17
+ if (M(a)) {
18
+ const d = a.anchor.getNode(), r = d.getKey() === "root" ? d : d.getTopLevelElementOrThrow(), N = r.getKey();
19
+ if (l.getElementByKey(N) !== null)
20
+ if (C(N), R(r)) {
21
+ const m = P(d, D), O = m ? m.getTag() : r.getTag();
22
+ h(O);
23
23
  } else {
24
- const u = q(r) ? r.getTag() : r.getType();
25
- f(u);
24
+ const m = q(r) ? r.getTag() : r.getType();
25
+ h(m);
26
26
  }
27
- I(i.hasFormat("bold")), A(i.hasFormat("italic")), E(i.hasFormat("underline"));
27
+ I(a.hasFormat("bold")), S(a.hasFormat("italic")), L(a.hasFormat("underline"));
28
28
  }
29
- }, [o]);
30
- V(() => U(
31
- o.registerUpdateListener(({ editorState: i }) => {
32
- i.read(() => {
33
- b();
29
+ }, [l]);
30
+ G(() => U(
31
+ l.registerUpdateListener(({ editorState: a }) => {
32
+ a.read(() => {
33
+ u();
34
34
  });
35
35
  }),
36
- o.registerCommand(
36
+ l.registerCommand(
37
37
  j,
38
- (i, d) => (b(), !1),
39
- y
38
+ (a, d) => (u(), !1),
39
+ T
40
40
  )
41
- ), [o, b]);
42
- const L = () => {
43
- m !== "ol" ? o.dispatchCommand(B) : o.dispatchCommand(D);
44
- }, v = () => {
45
- m !== "quote" ? o.update(() => {
46
- const i = g();
47
- M(i, () => K());
48
- }) : o.update(() => {
49
- const i = g();
50
- M(i, () => H());
41
+ ), [l, u]);
42
+ const v = () => {
43
+ l.update(() => {
44
+ const a = b();
45
+ M(a) && y(a, () => $createParagraphNode());
46
+ });
47
+ }, w = () => {
48
+ f !== "number" ? l.dispatchCommand($) : v();
49
+ }, B = () => {
50
+ f !== "quote" && l.update(() => {
51
+ const a = b();
52
+ y(a, () => F());
51
53
  });
52
54
  };
53
- return p ? null : /* @__PURE__ */ N(
55
+ return p ? null : /* @__PURE__ */ _(
54
56
  "div",
55
57
  {
56
- className: a(e.toolbar, {
57
- [e.toolbarIsActive]: p ? !1 : l.isActive
58
+ className: o(e.toolbar, {
59
+ [e.toolbarIsActive]: p ? !1 : i.isActive
58
60
  }),
59
- ref: C,
61
+ ref: k,
60
62
  children: [
61
- l.isActive ? !l.disableRichText && /* @__PURE__ */ N(
63
+ i.isActive ? !i.disableRichText && /* @__PURE__ */ _(
62
64
  "div",
63
65
  {
64
- className: a(e.iconToolbar, {
65
- [e.shortBar]: l.shortBar
66
+ className: o(e.iconToolbar, {
67
+ [e.shortBar]: i.shortBar
66
68
  }),
67
69
  children: [
68
70
  /* @__PURE__ */ t(
69
71
  "button",
70
72
  {
71
73
  onClick: () => {
72
- o.dispatchCommand(h, "bold");
74
+ l.dispatchCommand(g, "bold");
73
75
  },
74
76
  type: "button",
75
- className: a(e.toolbarItem, { [e.active]: k }),
77
+ className: o(e.toolbarItem, { [e.active]: x }),
76
78
  "data-testid": "format-bold",
77
79
  "aria-label": n.formatMessage({
78
80
  id: "input.text_editor.plugins.toolbar_plugin.bold.aria_label",
@@ -84,7 +86,7 @@ const me = (l) => {
84
86
  name: "bold",
85
87
  width: 24,
86
88
  height: 24,
87
- className: a(e.format, e.bold)
89
+ className: o(e.format, e.bold)
88
90
  }
89
91
  )
90
92
  }
@@ -93,11 +95,11 @@ const me = (l) => {
93
95
  "button",
94
96
  {
95
97
  onClick: () => {
96
- o.dispatchCommand(h, "italic");
98
+ l.dispatchCommand(g, "italic");
97
99
  },
98
100
  type: "button",
99
- className: a(e.toolbarItem, {
100
- [e.active]: x
101
+ className: o(e.toolbarItem, {
102
+ [e.active]: A
101
103
  }),
102
104
  "aria-label": n.formatMessage({
103
105
  id: "input.text_editor.plugins.toolbar_plugin.italic.aria_label",
@@ -109,7 +111,7 @@ const me = (l) => {
109
111
  name: "italic",
110
112
  width: 24,
111
113
  height: 24,
112
- className: a(e.format, e.italic)
114
+ className: o(e.format, e.italic)
113
115
  }
114
116
  )
115
117
  }
@@ -118,11 +120,11 @@ const me = (l) => {
118
120
  "button",
119
121
  {
120
122
  onClick: () => {
121
- o.dispatchCommand(h, "underline");
123
+ l.dispatchCommand(g, "underline");
122
124
  },
123
125
  type: "button",
124
- className: a(e.toolbarItem, {
125
- [e.active]: S
126
+ className: o(e.toolbarItem, {
127
+ [e.active]: E
126
128
  }),
127
129
  "aria-label": n.formatMessage({
128
130
  id: "input.text_editor.plugins.toolbar_plugin.underline.aria_label",
@@ -134,7 +136,7 @@ const me = (l) => {
134
136
  name: "underline",
135
137
  width: 24,
136
138
  height: 24,
137
- className: a(e.format, e.underline)
139
+ className: o(e.format, e.underline)
138
140
  }
139
141
  )
140
142
  }
@@ -142,9 +144,9 @@ const me = (l) => {
142
144
  /* @__PURE__ */ t(
143
145
  "button",
144
146
  {
145
- onClick: () => v(),
147
+ onClick: () => B(),
146
148
  type: "button",
147
- className: a(e.toolbarItem, { [e.active]: m === "quote" }),
149
+ className: e.toolbarItem,
148
150
  "aria-label": n.formatMessage({
149
151
  id: "input.text_editor.plugins.toolbar_plugin.blockquote.aria_label",
150
152
  defaultMessage: "Add a blockquote"
@@ -155,7 +157,7 @@ const me = (l) => {
155
157
  name: "blockquote",
156
158
  width: 24,
157
159
  height: 24,
158
- className: a(e.format, e.quote)
160
+ className: o(e.format, e.quote)
159
161
  }
160
162
  )
161
163
  }
@@ -163,9 +165,9 @@ const me = (l) => {
163
165
  /* @__PURE__ */ t(
164
166
  "button",
165
167
  {
166
- onClick: () => L(),
168
+ onClick: () => w(),
167
169
  type: "button",
168
- className: a(e.toolbarItem, { [e.active]: m === "ol" }),
170
+ className: e.toolbarItem,
169
171
  "aria-label": n.formatMessage({
170
172
  id: "input.text_editor.plugins.toolbar_plugin.numbered_list.aria_label",
171
173
  defaultMessage: "Insert a numbered list"
@@ -176,15 +178,15 @@ const me = (l) => {
176
178
  name: "orderedList",
177
179
  width: 24,
178
180
  height: 24,
179
- className: a(e.format, e.numberedList)
181
+ className: o(e.format, e.numberedList)
180
182
  }
181
183
  )
182
184
  }
183
185
  ),
184
- !l.hideSourceAction && /* @__PURE__ */ t(
186
+ !i.hideSourceAction && /* @__PURE__ */ t(
185
187
  "button",
186
188
  {
187
- onClick: l.onAddSource,
189
+ onClick: i.onAddSource,
188
190
  type: "button",
189
191
  className: e.toolbarItem,
190
192
  "aria-label": n.formatMessage({
@@ -197,7 +199,7 @@ const me = (l) => {
197
199
  name: "link",
198
200
  width: 20,
199
201
  height: 20,
200
- className: a(e.format, e.link)
202
+ className: o(e.format, e.link)
201
203
  }
202
204
  )
203
205
  }
@@ -205,13 +207,13 @@ const me = (l) => {
205
207
  ]
206
208
  }
207
209
  ) : null,
208
- /* @__PURE__ */ t("div", { className: e.actionButton, children: l.hideSubmit ? null : /* @__PURE__ */ t(
210
+ /* @__PURE__ */ t("div", { className: e.actionButton, children: i.hideSubmit ? null : /* @__PURE__ */ t(
209
211
  z,
210
212
  {
211
213
  type: "button",
212
214
  "data-testid": "submit-button",
213
- handleClick: l.onSubmit,
214
- className: a(e.inputSubmitActionButton, e.submitAction),
215
+ handleClick: i.onSubmit,
216
+ className: o(e.inputSubmitActionButton, e.submitAction),
215
217
  "aria-label": n.formatMessage({
216
218
  id: "input.text_editor.plugins.toolbar_plugin.submit_button.aria_label",
217
219
  defaultMessage: "Send message"
@@ -224,5 +226,5 @@ const me = (l) => {
224
226
  );
225
227
  };
226
228
  export {
227
- me as ToolbarPlugin
229
+ ce as ToolbarPlugin
228
230
  };
@@ -1,243 +1,237 @@
1
- import { jsxs as $, jsx as c, Fragment as Le } from "react/jsx-runtime";
2
- import Qe from "@rooks/use-previous";
3
- import $e from "classnames";
4
- import Pe, { useState as m, useEffect as h } from "react";
1
+ import { jsxs as U, jsx as d, Fragment as Le } from "react/jsx-runtime";
2
+ import je from "@rooks/use-previous";
3
+ import Be from "classnames";
4
+ import Qe, { useState as m, useEffect as g } from "react";
5
5
  import { useIntl as Ue } from "react-intl";
6
6
  import { useLocation as We } from "react-router";
7
7
  import a from "./PaginatedList.module.scss.js";
8
8
  import { ActionBar as ze } from "./action_bar/ActionBar.js";
9
9
  import { useList as Ge } from "../list_provider/useList.js";
10
- import { useDataProvider as Ve } from "../../data/data_provider/useDataProvider.js";
11
- import { useResponsive as Xe } from "../../hooks/use_responsive/useResponsive.js";
12
- import { useData as Ye } from "../../data/data_provider/useData.js";
13
- import { uniqueBy as x } from "../../util/unique_by/uniqueBy.js";
14
- import { Pagination as Ze } from "../pagination/Pagination.js";
15
- import { StandardErrorBoundary as He } from "../../error/standard_error_boundary/StandardErrorBoundary.js";
16
- const ft = ({
10
+ import { useDataProvider as Pe } from "../../data/data_provider/useDataProvider.js";
11
+ import { useResponsive as Ve } from "../../hooks/use_responsive/useResponsive.js";
12
+ import { useData as Xe } from "../../data/data_provider/useData.js";
13
+ import { uniqueBy as A } from "../../util/unique_by/uniqueBy.js";
14
+ import { Pagination as Ye } from "../pagination/Pagination.js";
15
+ import { StandardErrorBoundary as Ze } from "../../error/standard_error_boundary/StandardErrorBoundary.js";
16
+ const rt = ({
17
17
  query: w,
18
18
  sortOptions: i,
19
19
  sort: N,
20
20
  filters: o,
21
21
  tagList: ne,
22
22
  currentPage: M,
23
- resource: A,
23
+ resource: _,
24
24
  currentListId: n,
25
25
  withToken: ae,
26
- perPage: p,
26
+ perPage: h,
27
27
  perPageParam: le = "per_page",
28
28
  pageParam: ie = "page",
29
29
  sortParam: oe = "sort",
30
30
  queryParam: me = "query",
31
- tagParam: de = "tag_id",
31
+ tagParam: re = "tag_id",
32
32
  totalHeaderParam: D = "total",
33
- onUpdateTotal: P,
33
+ onUpdateTotal: W,
34
34
  onElementsLoad: R,
35
- transformData: U,
36
- uniqueIdKey: v = "id",
37
- children: re,
35
+ transformData: z,
36
+ uniqueIdKey: p = "id",
37
+ children: de,
38
38
  resourcePropName: fe,
39
- loadingComponent: W,
39
+ loadingComponent: G,
40
40
  searchBar: ce = !1,
41
41
  title: ue,
42
- subtitle: Ee,
43
- showDebateConsultationSubtitle: ge = !1,
44
- emptyListComponent: z,
45
- emptyText: G,
46
- display: V,
47
- elementsPerLine: X,
48
- indexLayout: he = !1,
49
- gap: pe = "1em",
50
- withPagination: ve = !0,
51
- numberElements: Y,
52
- countless: Se,
53
- onElementClick: ye,
54
- withUrlParams: we = !1,
55
- onLoadNewPage: Z
42
+ emptyListComponent: P,
43
+ emptyText: V,
44
+ display: X,
45
+ elementsPerLine: Y,
46
+ indexLayout: Ee = !1,
47
+ gap: ge = "1em",
48
+ withPagination: he = !0,
49
+ numberElements: Z,
50
+ countless: pe,
51
+ onElementClick: ve,
52
+ withUrlParams: Se = !1,
53
+ onLoadNewPage: $
56
54
  }) => {
57
- const J = Ue(), t = Ge(), H = Ve(), I = We(), { isMobile: K, isTablet: Ne, isDesktop: j } = Xe(), [b, u] = m(!1), [Me, Re] = m(!1), [k, S] = Ye(n, []), [O, be] = m(
58
- k?.length || 0
59
- ), [E, B] = m(M || 1), [y, L] = m(w || null), [C, q] = m(null), [ke, ee] = m(null), d = new URLSearchParams(
55
+ const J = Ue(), t = Ge(), H = Pe(), I = We(), { isMobile: K, isTablet: ye, isDesktop: L } = Ve(), [b, f] = m(!1), [we, Ne] = m(!1), [v, S] = Xe(n, []), [O, Me] = m(
56
+ v?.length || 0
57
+ ), [c, j] = m(M || 1), [y, B] = m(w || null), [k, q] = m(null), [Re, ee] = m(null), r = new URLSearchParams(
60
58
  typeof window < "u" ? window.location.search : I.search
61
- ), Ce = () => i && i[0].type === "sort" && i[0].value || N || "", Fe = () => {
59
+ ), be = () => i && i[0].type === "sort" && i[0].value || N || "", ke = () => {
62
60
  let e = {};
63
61
  return i && i[0].type === "filter" && (e[i[0].name] = i[0].value), o && (e = Object.assign({}, e, o)), e;
64
- }, [F, T] = m(Ce()), [Q, _] = m(Fe()), te = Qe(o);
65
- M && M !== E && B(M), w !== void 0 && w !== y && L(w), N !== void 0 && N !== F && T(N), te && JSON.stringify(o) !== JSON.stringify(te) && JSON.stringify(o) !== JSON.stringify(Q) && _(o), h(() => {
66
- if (d.get("tagId") && q(Number.parseInt(d.get("tagId"))), d.get("search") && L(d.get("search")), d.get("sort")) {
67
- T(d.get("sort"));
68
- for (const e of d.values()) {
62
+ }, [C, F] = m(be()), [Q, T] = m(ke()), te = je(o);
63
+ M && M !== c && j(M), w !== void 0 && w !== y && B(w), N !== void 0 && N !== C && F(N), te && JSON.stringify(o) !== JSON.stringify(te) && JSON.stringify(o) !== JSON.stringify(Q) && T(o), g(() => {
64
+ if (r.get("tagId") && q(Number.parseInt(r.get("tagId"))), r.get("search") && B(r.get("search")), r.get("sort")) {
65
+ F(r.get("sort"));
66
+ for (const e of r.values()) {
69
67
  i?.map((s) => {
70
68
  s.value === e && ee(s.name);
71
69
  });
72
70
  break;
73
71
  }
74
72
  }
75
- for (const e of d.keys()) {
73
+ for (const e of r.keys()) {
76
74
  i?.map((s) => {
77
- s.name === e && (_({
75
+ s.name === e && (T({
78
76
  ...o,
79
77
  [s.name]: s.value
80
78
  }), ee(s.name));
81
79
  });
82
80
  break;
83
81
  }
84
- }, [I.search]), h(() => {
85
- A ? (B(1), S([]), u(!0), se(1)) : u(!1);
82
+ }, [I.search]), g(() => {
83
+ _ ? (j(1), S([]), f(!0), se(1)) : f(!1);
86
84
  }, [
87
- F,
85
+ C,
88
86
  Q,
89
87
  y,
90
- A,
91
- C,
92
- p
93
- ]), h(() => {
94
- E > 1 && (u(!0), se(E));
95
- }, [E]), h(() => {
88
+ _,
89
+ k,
90
+ h
91
+ ]), g(() => {
92
+ c > 1 && (f(!0), se(c));
93
+ }, [c]), g(() => {
96
94
  if (t.addElements && n in t.addElements && t.addElements[n].length > 0) {
97
- xe(t.addElements[n]);
95
+ Te(t.addElements[n]);
98
96
  const e = t.addElements;
99
97
  delete e[n], t.setAddElements(e);
100
98
  }
101
- }, [t.addElements]), h(() => {
102
- if (t.updateElements && n in t.updateElements && (console.log("[PaginatedList] update received for listId:", n, t.updateElements[n]), t.updateElements[n].length > 0)) {
103
- Ae(t.updateElements[n]);
99
+ }, [t.addElements]), g(() => {
100
+ if (t.updateElements && n in t.updateElements && t.updateElements[n].length > 0) {
101
+ xe(t.updateElements[n]);
104
102
  const e = t.updateElements;
105
103
  delete e[n], t.setUpdateElements(e);
106
104
  }
107
- }, [t.updateElements]), h(() => {
105
+ }, [t.updateElements]), g(() => {
108
106
  if (t.removeElements && n in t.removeElements && t.removeElements[n].length > 0) {
109
- De(t.removeElements[n]);
107
+ Ae(t.removeElements[n]);
110
108
  const e = t.removeElements;
111
109
  delete e[n], t.setRemoveElements(e);
112
110
  }
113
111
  }, [t.removeElements]);
114
- const Te = (e) => {
115
- e.type === "filter" ? (T(""), _({
112
+ const Ce = (e) => {
113
+ e.type === "filter" ? (F(""), T({
116
114
  ...o,
117
115
  [e.name]: e.value
118
- })) : (T(e.value), _(o ? { ...o } : {}));
119
- }, _e = () => {
120
- typeof Z == "function" && Z() !== null || B(E + 1);
116
+ })) : (F(e.value), T(o ? { ...o } : {}));
117
+ }, Fe = () => {
118
+ typeof $ == "function" && $() !== null || j(c + 1);
121
119
  }, se = (e) => {
122
120
  const s = ae ? H.getListWithToken : H.getList;
123
- if ((e - 1) * p <= (Y || O) || e === 1) {
124
- const r = {
121
+ if ((e - 1) * h <= (Z || O) || e === 1) {
122
+ const u = {
125
123
  [ie]: e,
126
- [le]: p,
127
- ...F && !y && { [oe]: F },
124
+ [le]: h,
125
+ ...C && !y && { [oe]: C },
128
126
  ...y && { [me]: y },
129
- ...Se === !0 && { countless: !0 },
127
+ ...pe === !0 && { countless: !0 },
130
128
  ...Q,
131
- ...C && { [de]: C }
129
+ ...k && { [re]: k }
132
130
  };
133
- s(A, r).then((l) => {
134
- const f = l.headers;
135
- f && D in f && (be(
136
- Number.parseInt(f[D || "total"], 10)
137
- ), P && P(f[D || "total"]));
138
- let g = l?.data?.data;
139
- R && R(g), U && (g = g.filter(U)), t.addElements && n in t.addElements && t.addElements[n].length > 0 && (g = [...t.addElements[n], g]), Je(g), u(!1);
131
+ s(_, u).then((l) => {
132
+ const x = l.headers;
133
+ x && D in x && (Me(
134
+ Number.parseInt(x[D || "total"], 10)
135
+ ), W && W(x[D || "total"]));
136
+ let E = l?.data?.data;
137
+ R && R(E), z && (E = E.filter(z)), t.addElements && n in t.addElements && t.addElements[n].length > 0 && (E = [...t.addElements[n], E]), _e(E), f(!1);
140
138
  }).catch((l) => {
141
- console.error(l), l?.response?.status !== 404 && Re(!0), u(!1);
139
+ console.error(l), l?.response?.status !== 404 && Ne(!0), f(!1);
142
140
  });
143
141
  } else
144
- u(!1);
145
- }, xe = (e) => {
142
+ f(!1);
143
+ }, Te = (e) => {
146
144
  S(
147
- (s) => x([...e, ...s], v || "id")
145
+ (s) => A([...e, ...s], p || "id")
148
146
  ), R && R(e);
147
+ }, xe = (e) => {
148
+ let s = v;
149
+ e.forEach(
150
+ (u) => s = s.map(
151
+ (l) => l.id === u.id ? u : l
152
+ )
153
+ ), S(A(s, p || "id"));
149
154
  }, Ae = (e) => {
150
- S((s) => {
151
- let r = s;
152
- return e.forEach(
153
- (l) => r = r.map(
154
- (f) => f.id === l.id ? l : f
155
- )
156
- ), x(r, v || "id");
157
- });
158
- }, De = (e) => {
159
- const s = e.map((l) => l.id), r = k.filter(
155
+ const s = e.map((l) => l.id), u = v.filter(
160
156
  (l) => s.indexOf(l.id) === -1
161
157
  );
162
- S(x(r, v || "id"));
163
- }, Je = (e) => {
158
+ S(A(u, p || "id"));
159
+ }, _e = (e) => {
164
160
  S(
165
- (s) => x([...s, ...e], v || "id")
161
+ (s) => A([...s, ...e], p || "id")
166
162
  );
167
- }, je = (e, s) => e !== void 0 ? /* @__PURE__ */ c(
163
+ }, De = (e, s) => e !== void 0 ? /* @__PURE__ */ d(
168
164
  "li",
169
165
  {
170
166
  className: a.paginatedListItem,
171
167
  "data-testid": "list-item",
172
- onClick: ye,
173
- children: /* @__PURE__ */ c(He, { hideMessage: !0, children: Pe.cloneElement(re, {
168
+ onClick: ve,
169
+ children: /* @__PURE__ */ d(Ze, { hideMessage: !0, children: Qe.cloneElement(de, {
174
170
  index: s,
175
171
  [fe]: e
176
172
  }) })
177
173
  },
178
- `${e[v || "id"]}_${e.updated_at || e.content}`
179
- ) : null, Be = (e) => W ? /* @__PURE__ */ c("li", { className: a.paginatedListItem, children: W }, e) : null;
180
- if (Me)
174
+ e[p || "id"]
175
+ ) : null, Je = (e) => G ? /* @__PURE__ */ d("li", { className: a.paginatedListItem, children: G }, e) : null;
176
+ if (we)
181
177
  throw new Error(
182
178
  J.formatMessage({
183
179
  id: "error.list",
184
180
  defaultMessage: "Error when loading content."
185
181
  })
186
182
  );
187
- return /* @__PURE__ */ $("div", { className: a.listContainer, children: [
188
- /* @__PURE__ */ c(
183
+ return /* @__PURE__ */ U("div", { className: a.listContainer, children: [
184
+ /* @__PURE__ */ d(
189
185
  ze,
190
186
  {
191
187
  title: ue,
192
- subtitle: Ee,
193
- showDebateConsultationSubtitle: ge,
194
188
  sortOptions: i,
195
- defaultSelectOption: ke,
189
+ defaultSelectOption: Re,
196
190
  searchBar: ce,
197
191
  tagList: ne,
198
- activeTagId: C,
199
- onSearch: (e) => L(e),
200
- onSortChange: Te,
192
+ activeTagId: k,
193
+ onSearch: (e) => B(e),
194
+ onSortChange: Ce,
201
195
  onTagChange: (e) => q(e),
202
- withUrlParams: we
196
+ withUrlParams: Se
203
197
  }
204
198
  ),
205
- !b && k.length === 0 ? z ? /* @__PURE__ */ c("div", { className: a.emptyListElement, children: z }) : /* @__PURE__ */ c("div", { className: a.emptyList, children: G || J.formatMessage({
199
+ !b && v.length === 0 ? P ? /* @__PURE__ */ d("div", { className: a.emptyListElement, children: P }) : /* @__PURE__ */ d("div", { className: a.emptyList, children: V || J.formatMessage({
206
200
  id: "info.emptyList",
207
201
  defaultMessage: "No items for now."
208
- }) }) : /* @__PURE__ */ $(Le, { children: [
209
- /* @__PURE__ */ $(
202
+ }) }) : /* @__PURE__ */ U(Le, { children: [
203
+ /* @__PURE__ */ U(
210
204
  "ul",
211
205
  {
212
- className: $e(a.paginatedList, {
213
- [a.paginatedListIsTablet]: !K && !j,
214
- [a.centeredList]: V === "column",
215
- [a.column]: V === "column",
216
- [a.twoElementsPerLine]: X === 2,
217
- [a.oneElementPerLine]: X === 1,
218
- [a.indexLayoutList]: he,
219
- [a.listIsDesktop]: j,
220
- [a.listIsTablet]: Ne && !j,
206
+ className: Be(a.paginatedList, {
207
+ [a.paginatedListIsTablet]: !K && !L,
208
+ [a.centeredList]: X === "column",
209
+ [a.column]: X === "column",
210
+ [a.twoElementsPerLine]: Y === 2,
211
+ [a.oneElementPerLine]: Y === 1,
212
+ [a.indexLayoutList]: Ee,
213
+ [a.listIsDesktop]: L,
214
+ [a.listIsTablet]: ye && !L,
221
215
  [a.listIsMobile]: K
222
216
  }),
223
- style: { gap: pe },
217
+ style: { gap: ge },
224
218
  children: [
225
- k.map(je),
226
- b ? Array(p).fill().map((e, s) => s).map(Be) : null
219
+ v.map(De),
220
+ b ? Array(h).fill().map((e, s) => s).map(Je) : null
227
221
  ]
228
222
  }
229
223
  ),
230
- !b && ve !== !1 && /* @__PURE__ */ c(
231
- Ze,
224
+ !b && he !== !1 && /* @__PURE__ */ d(
225
+ Ye,
232
226
  {
233
227
  buttonText: J.formatMessage({
234
228
  id: "action.see_more",
235
229
  defaultMessage: "See more"
236
230
  }),
237
- currentPage: E,
238
- perPage: p,
239
- totalElements: Y || O,
240
- onLoad: _e,
231
+ currentPage: c,
232
+ perPage: h,
233
+ totalElements: Z || O,
234
+ onLoad: Fe,
241
235
  isLoading: b,
242
236
  hideLoader: !0,
243
237
  "data-tid": "list_read_more"
@@ -247,5 +241,5 @@ const ft = ({
247
241
  ] });
248
242
  };
249
243
  export {
250
- ft as PaginatedList
244
+ rt as PaginatedList
251
245
  };