@oliasoft-open-source/react-ui-library 10.2.3 → 10.3.0-beta-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1375,6 +1375,7 @@ export declare interface IRichTextInputProps {
1375
1375
  onChange?: (markdown: string, meta: {
1376
1376
  mentionedIds: string[];
1377
1377
  }) => void;
1378
+ onMention?: (item: IMentionItem) => void;
1378
1379
  placeholder?: string;
1379
1380
  value?: string;
1380
1381
  toolbarComponent?: ReactNode;
package/dist/index.js CHANGED
@@ -6757,68 +6757,70 @@ var ko = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Ao =
6757
6757
  command: t,
6758
6758
  items: r,
6759
6759
  editable: n.view.dom
6760
- }), pf = c(o(({ placeholder: e, onChange: t, value: n, disabled: r, toolbarComponent: i, mentions: a, testId: o }, s) => {
6761
- var c, l, f, m;
6762
- let g = u(W), y = r || g, b = !!a, x = _(a), w = _(null), T = _(n == null ? "" : n), [E, D] = v(null);
6760
+ }), pf = c(o(({ placeholder: e, onChange: t, onMention: n, value: r, disabled: i, toolbarComponent: a, mentions: o, testId: s }, c) => {
6761
+ var l, f, m, g;
6762
+ let y = u(W), b = i || y, x = !!o, w = _(o), T = _(null), E = _(r == null ? "" : r), [D, O] = v(null);
6763
6763
  d(() => {
6764
- x.current = a;
6765
- }, [a]);
6766
- let O = h(() => [
6764
+ w.current = o;
6765
+ }, [o]);
6766
+ let k = h(() => [
6767
6767
  di,
6768
6768
  fi.configure({ placeholder: e }),
6769
6769
  pi,
6770
- lf(() => x.current, () => ({
6771
- onStart: (e) => D(ff(e)),
6772
- onUpdate: (e) => D(ff(e)),
6773
- onExit: () => D(null),
6770
+ lf(() => w.current, () => ({
6771
+ onStart: (e) => O(ff(e)),
6772
+ onUpdate: (e) => O(ff(e)),
6773
+ onExit: () => O(null),
6774
6774
  onKeyDown: ({ event: e }) => {
6775
6775
  var t, n;
6776
- return (t = (n = w.current) == null ? void 0 : n.onKeyDown(e)) != null && t;
6776
+ return (t = (n = T.current) == null ? void 0 : n.onKeyDown(e)) != null && t;
6777
6777
  }
6778
6778
  }))
6779
- ], []), k = ui({
6780
- extensions: O,
6781
- content: T.current,
6779
+ ], []), A = ui({
6780
+ extensions: k,
6781
+ content: E.current,
6782
6782
  contentType: "markdown",
6783
- editable: !y,
6783
+ editable: !b,
6784
6784
  editorProps: { attributes: { class: uf.editable } },
6785
6785
  onUpdate: ({ editor: e }) => {
6786
6786
  t == null || t(e.getMarkdown(), { mentionedIds: sf(e) });
6787
6787
  }
6788
6788
  });
6789
6789
  return d(() => {
6790
- k && n !== void 0 && n !== k.getMarkdown() && k.commands.setContent(n, {
6790
+ A && r !== void 0 && r !== A.getMarkdown() && A.commands.setContent(r, {
6791
6791
  emitUpdate: !1,
6792
6792
  contentType: "markdown"
6793
6793
  });
6794
- }, [n, k]), d(() => {
6795
- k && k.setEditable(!y);
6796
- }, [y, k]), p(s, () => ({
6797
- clearContent: () => k == null ? void 0 : k.commands.clearContent(!1),
6798
- editor: k,
6799
- getMentionedIds: () => sf(k)
6800
- }), [k]), /* @__PURE__ */ C("div", {
6794
+ }, [r, A]), d(() => {
6795
+ A && A.setEditable(!b);
6796
+ }, [b, A]), p(c, () => ({
6797
+ clearContent: () => A == null ? void 0 : A.commands.clearContent(!1),
6798
+ editor: A,
6799
+ getMentionedIds: () => sf(A)
6800
+ }), [A]), /* @__PURE__ */ C("div", {
6801
6801
  className: uf.richTextInput,
6802
- "data-testid": o,
6802
+ "data-testid": s,
6803
6803
  children: [
6804
6804
  /* @__PURE__ */ S($d, {
6805
- editor: k,
6806
- disabled: y,
6807
- showMentionButton: b && ((c = a == null ? void 0 : a.showMentionButton) == null || c),
6808
- toolbarComponent: i,
6809
- testId: o && `${o}-toolbar`
6805
+ editor: A,
6806
+ disabled: b,
6807
+ showMentionButton: x && ((l = o == null ? void 0 : o.showMentionButton) == null || l),
6808
+ toolbarComponent: a,
6809
+ testId: s && `${s}-toolbar`
6810
6810
  }),
6811
6811
  /* @__PURE__ */ S(li, {
6812
- editor: k,
6813
- "data-testid": o && `${o}-editor`
6812
+ editor: A,
6813
+ "data-testid": s && `${s}-editor`
6814
6814
  }),
6815
- b && /* @__PURE__ */ S($i, { children: /* @__PURE__ */ S(df, {
6816
- ref: w,
6817
- editable: (l = E == null ? void 0 : E.editable) == null ? null : l,
6818
- getRect: (f = E == null ? void 0 : E.clientRect) == null ? null : f,
6819
- items: (m = E == null ? void 0 : E.items) == null ? [] : m,
6820
- onDismiss: () => D(null),
6821
- onSelect: (e) => E == null ? void 0 : E.command(e)
6815
+ x && /* @__PURE__ */ S($i, { children: /* @__PURE__ */ S(df, {
6816
+ ref: T,
6817
+ editable: (f = D == null ? void 0 : D.editable) == null ? null : f,
6818
+ getRect: (m = D == null ? void 0 : D.clientRect) == null ? null : m,
6819
+ items: (g = D == null ? void 0 : D.items) == null ? [] : g,
6820
+ onDismiss: () => O(null),
6821
+ onSelect: (e) => {
6822
+ n == null || n(e), D == null || D.command(e);
6823
+ }
6822
6824
  }) })
6823
6825
  ]
6824
6826
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/react-ui-library",
3
- "version": "10.2.3",
3
+ "version": "10.3.0-beta-1",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
6
6
  "bugs": {