@logora/debate 0.3.76 → 0.3.78

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.
@@ -1,15 +1,15 @@
1
- import { useLexicalComposerContext as a } from "@lexical/react/LexicalComposerContext";
2
- import { $getRoot as c, $createParagraphNode as i, $createTextNode as u } from "lexical";
1
+ import { useLexicalComposerContext as s } from "@lexical/react/LexicalComposerContext";
2
+ import { $getRoot as a, $createParagraphNode as c, $createTextNode as u } from "lexical";
3
3
  import { useEffect as f } from "react";
4
4
  import { useInput as m } from "../../input_provider/useInput.js";
5
- const x = ({ content: o }) => {
6
- const [p] = a(), { inputContent: e, setInputContent: s } = m(), t = o || e;
5
+ const x = ({ content: e }) => {
6
+ const [p] = s(), { inputContent: o, setInputContent: i } = m(), t = e || (typeof o == "string" ? o : void 0);
7
7
  return f(() => {
8
8
  typeof t == "string" && t && p.update(() => {
9
- const n = c();
9
+ const n = a();
10
10
  n.clear();
11
- const r = i();
12
- r.append(u(t)), n.append(r), !o && e && s(null);
11
+ const r = c();
12
+ r.append(u(t)), n.append(r), !e && o && i(null);
13
13
  });
14
14
  }, [t]), null;
15
15
  };
@@ -1,13 +1,13 @@
1
- import { jsxs as a, Fragment as n, jsx as s } from "react/jsx-runtime";
1
+ import { jsxs as a, Fragment as o, 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 }) => {
6
- const o = l();
5
+ const N = ({ title: t, imageUrl: c, date: i, author: r }) => {
6
+ const n = 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: [
10
+ r && /* @__PURE__ */ a(o, { children: [
11
11
  /* @__PURE__ */ s("span", { className: e.sourceAuthor, children: r }),
12
12
  /* @__PURE__ */ s("span", { className: e.separator, children: "·" })
13
13
  ] }),
@@ -27,9 +27,8 @@ const g = ({ title: t, imageUrl: c, date: i, author: r }) => {
27
27
  "img",
28
28
  {
29
29
  src: c,
30
- alt: o.formatMessage({
31
- id: "source.context_source_box.alt",
32
- defaultMessage: "Debate source image"
30
+ alt: n.formatMessage({
31
+ id: "source.context_source_box.alt"
33
32
  }),
34
33
  className: e.image
35
34
  }
@@ -37,5 +36,5 @@ const g = ({ title: t, imageUrl: c, date: i, author: r }) => {
37
36
  ] });
38
37
  };
39
38
  export {
40
- g as ContextSourceBox
39
+ N as ContextSourceBox
41
40
  };
@@ -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
  };
@@ -1,4 +1,4 @@
1
- import { jsx as e, jsxs as a, Fragment as _ } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as a, Fragment as v } from "react/jsx-runtime";
2
2
  import { useState as d } from "react";
3
3
  import { useIntl as B, FormattedMessage as f } from "react-intl";
4
4
  import s from "./SourceModal.module.scss.js";
@@ -6,24 +6,24 @@ import { useDataProvider as x } from "../../data/data_provider/useDataProvider.j
6
6
  import { useModal as y } from "../../dialog/modal/useModal.js";
7
7
  import { Modal as z } from "../../dialog/modal/Modal.js";
8
8
  import { SearchInput as A } from "../../input/search_input/SearchInput.js";
9
- import { AnnouncementDialog as M } from "../../dialog/announcement_dialog/AnnouncementDialog.js";
9
+ import { AnnouncementDialog as w } from "../../dialog/announcement_dialog/AnnouncementDialog.js";
10
10
  import { SourceBox as I } from "../source_box/SourceBox.js";
11
11
  import { Button as C } from "../../action/button/Button.js";
12
12
  import { Loader as j } from "../../progress/loader/Loader.js";
13
13
  const Q = ({
14
- onAddSource: v,
14
+ onAddSource: b,
15
15
  onHideModal: h,
16
16
  allowedSources: t = []
17
17
  }) => {
18
- const [p, u] = d(!1), [r, n] = d(), [w, i] = d(!1), b = x(), [S, g] = d(!1), l = B(), { hideModal: E } = y(), N = () => {
19
- v(r), n(null), E(), h && h();
18
+ const [p, u] = d(!1), [r, n] = d(), [g, i] = d(!1), S = x(), [_, M] = d(!1), l = B(), { hideModal: E } = y(), N = () => {
19
+ b(r), n(null), E(), h && h();
20
20
  }, P = (o) => {
21
21
  if (!t || t.length === 0)
22
22
  return !0;
23
23
  const c = o.hostname.replace("www.", "");
24
24
  return !!t.includes(c);
25
25
  }, U = (o) => {
26
- if (g(!1), n(null), i(!1), !o)
26
+ if (M(!1), n(null), i(!1), !o)
27
27
  return !1;
28
28
  let c;
29
29
  try {
@@ -31,14 +31,14 @@ const Q = ({
31
31
  } catch {
32
32
  return i(!0), !1;
33
33
  }
34
- P(c) ? (u(!0), b.create("sources/fetch", { query: o }).then(
34
+ P(c) ? (u(!0), S.create("sources/fetch", { query: o }).then(
35
35
  (m) => {
36
36
  m.data.success ? (n(m.data.data.resource), u(!1)) : (u(!1), i(!0));
37
37
  },
38
38
  (m) => {
39
39
  u(!1), i(!0);
40
40
  }
41
- )) : g(!0);
41
+ )) : M(!0);
42
42
  };
43
43
  return /* @__PURE__ */ e(
44
44
  z,
@@ -62,14 +62,14 @@ const Q = ({
62
62
  type: "url"
63
63
  }
64
64
  ),
65
- /* @__PURE__ */ e("div", { className: s.sourceInputHelp, children: /* @__PURE__ */ e(
65
+ !r && !g && !_ && /* @__PURE__ */ e("div", { className: s.sourceInputHelp, children: /* @__PURE__ */ e(
66
66
  f,
67
67
  {
68
68
  id: "source.source_modal.input_help",
69
69
  defaultMessage: "Press Enter to add the source"
70
70
  }
71
71
  ) }),
72
- t.length > 0 && /* @__PURE__ */ a(_, { children: [
72
+ t.length > 0 && /* @__PURE__ */ a(v, { children: [
73
73
  /* @__PURE__ */ e("div", { className: s.separator }),
74
74
  /* @__PURE__ */ e("div", { className: s.allowedSourcesInfo, children: /* @__PURE__ */ e(
75
75
  f,
@@ -82,8 +82,8 @@ const Q = ({
82
82
  ] })
83
83
  ] }),
84
84
  /* @__PURE__ */ a("div", { className: s.sourcePreviewBox, children: [
85
- w && /* @__PURE__ */ e(
86
- M,
85
+ g && /* @__PURE__ */ e(
86
+ w,
87
87
  {
88
88
  message: l.formatMessage({
89
89
  id: "source.source_modal.error",
@@ -92,8 +92,8 @@ const Q = ({
92
92
  fullWidth: !0
93
93
  }
94
94
  ),
95
- S && /* @__PURE__ */ e(
96
- M,
95
+ _ && /* @__PURE__ */ e(
96
+ w,
97
97
  {
98
98
  message: l.formatMessage({
99
99
  id: "source.source_modal.error_unauthorized",
@@ -102,7 +102,7 @@ const Q = ({
102
102
  fullWidth: !0
103
103
  }
104
104
  ),
105
- r && /* @__PURE__ */ e("div", { children: p ? /* @__PURE__ */ e(j, {}) : /* @__PURE__ */ a(_, { children: [
105
+ r && /* @__PURE__ */ e("div", { children: p ? /* @__PURE__ */ e(j, {}) : /* @__PURE__ */ a(v, { children: [
106
106
  /* @__PURE__ */ e(
107
107
  I,
108
108
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logora/debate",
3
- "version": "0.3.76",
3
+ "version": "0.3.78",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0",
6
6
  "description": "Design system of @Logora made with React",