@oliasoft-open-source/react-ui-library 9.2.0-beta-8 → 9.2.0-beta-9

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.
@@ -15,6 +15,7 @@ export interface IRichTextInputProps {
15
15
  placeholder?: string;
16
16
  value?: string;
17
17
  toolbarComponent?: ReactNode;
18
+ testId?: string;
18
19
  }
19
20
  export declare const RichTextInput: import('react').NamedExoticComponent<IRichTextInputProps & import('react').RefAttributes<IRichTextInputHandle>>;
20
21
  //# sourceMappingURL=rich-text-input.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rich-text-input.d.ts","sourceRoot":"","sources":["../../../src/components/rich-text-input/rich-text-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EASL,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,EAA4B,MAAM,EAAE,MAAM,eAAe,CAAC;AAUjE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAmB9D,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,eAAe,EAAE,MAAM,MAAM,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,EAAE,CAAA;KAAE,KAAK,IAAI,CAAC;IACxE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,SAAS,CAAC;CAC9B;AAED,eAAO,MAAM,aAAa,iHAuGzB,CAAC"}
1
+ {"version":3,"file":"rich-text-input.d.ts","sourceRoot":"","sources":["../../../src/components/rich-text-input/rich-text-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EASL,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,EAA4B,MAAM,EAAE,MAAM,eAAe,CAAC;AAUjE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAmB9D,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,eAAe,EAAE,MAAM,MAAM,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,EAAE,CAAA;KAAE,KAAK,IAAI,CAAC;IACxE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,aAAa,iHAwGzB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"rich-text-input.stories.d.ts","sourceRoot":"","sources":["../../../src/components/rich-text-input/rich-text-input.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAW,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAwB,mBAAmB,EAAiB,MAAM,mBAAmB,CAAC;wBASxF,IAAI;AAJT,wBAIU;AAcV,eAAO,MAAM,OAAO,uHAAoB,CAAC;AAEzC,eAAO,MAAM,MAAM,uHAAoB,CAAC;AAMxC,eAAO,MAAM,WAAW,uHAAoB,CAAC;AAK7C,eAAO,MAAM,QAAQ,uHAAoB,CAAC;AAK1C,eAAO,MAAM,8BAA8B,+CAmB1C,CAAC;AAmBF,eAAO,MAAM,YAAY,+CA0CxB,CAAC;AA4BF,eAAO,MAAM,oBAAoB,uHAAoB,CAAC"}
1
+ {"version":3,"file":"rich-text-input.stories.d.ts","sourceRoot":"","sources":["../../../src/components/rich-text-input/rich-text-input.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAW,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAwB,mBAAmB,EAAiB,MAAM,mBAAmB,CAAC;wBAWxF,IAAI;AANT,wBAMU;AAcV,eAAO,MAAM,OAAO,uHAAoB,CAAC;AAEzC,eAAO,MAAM,MAAM,uHAAoB,CAAC;AAMxC,eAAO,MAAM,WAAW,uHAAoB,CAAC;AAK7C,eAAO,MAAM,QAAQ,uHAAoB,CAAC;AAK1C,eAAO,MAAM,8BAA8B,+CAmB1C,CAAC;AAmBF,eAAO,MAAM,YAAY,+CA0CxB,CAAC;AA4BF,eAAO,MAAM,oBAAoB,uHAAoB,CAAC"}
@@ -5,6 +5,7 @@ export interface IRichTextToolbarProps {
5
5
  disabled?: boolean;
6
6
  showMentionButton?: boolean;
7
7
  toolbarComponent?: ReactNode;
8
+ testId?: string;
8
9
  }
9
- export declare const RichTextToolbar: ({ editor, disabled, showMentionButton, toolbarComponent, }: IRichTextToolbarProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const RichTextToolbar: ({ editor, disabled, showMentionButton, toolbarComponent, testId, }: IRichTextToolbarProps) => import("react/jsx-runtime").JSX.Element;
10
11
  //# sourceMappingURL=rich-text-toolbar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rich-text-toolbar.d.ts","sourceRoot":"","sources":["../../../../src/components/rich-text-input/rich-text-toolbar/rich-text-toolbar.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAMvC,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB,CAAC,EAAE,SAAS,CAAC;CAC9B;AAED,eAAO,MAAM,eAAe,GAAI,4DAK7B,qBAAqB,4CAyDvB,CAAC"}
1
+ {"version":3,"file":"rich-text-toolbar.d.ts","sourceRoot":"","sources":["../../../../src/components/rich-text-input/rich-text-toolbar/rich-text-toolbar.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAMvC,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,eAAe,GAAI,oEAM7B,qBAAqB,4CAgEvB,CAAC"}
package/dist/index.js CHANGED
@@ -6502,48 +6502,55 @@ var ko = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Ao =
6502
6502
  richTextToolbarContainer: "_richTextToolbarContainer_1gbkk_5"
6503
6503
  }, Zd = /* @__PURE__ */ function(e) {
6504
6504
  return e.BOLD = "bold", e.ITALIC = "italic", e.CODE = "code", e.UL = "ul", e.OL = "ol", e.MENTION = "at", e;
6505
- }({}), Qd = ({ editor: e, disabled: t = !1, showMentionButton: n = !1, toolbarComponent: r = null }) => {
6506
- var i, a, o, s, c;
6507
- let l = [
6505
+ }({}), Qd = ({ editor: e, disabled: t = !1, showMentionButton: n = !1, toolbarComponent: r = null, testId: i }) => {
6506
+ var a, o, s, c, l;
6507
+ let u = [
6508
6508
  {
6509
6509
  icon: Zd.BOLD,
6510
6510
  onClick: () => e == null ? void 0 : e.chain().focus().toggleBold().run(),
6511
- active: (i = e == null ? void 0 : e.isActive("bold")) != null && i
6511
+ active: (a = e == null ? void 0 : e.isActive("bold")) != null && a,
6512
+ testId: "bold"
6512
6513
  },
6513
6514
  {
6514
6515
  icon: Zd.ITALIC,
6515
6516
  onClick: () => e == null ? void 0 : e.chain().focus().toggleItalic().run(),
6516
- active: (a = e == null ? void 0 : e.isActive("italic")) != null && a
6517
+ active: (o = e == null ? void 0 : e.isActive("italic")) != null && o,
6518
+ testId: "italic"
6517
6519
  },
6518
6520
  {
6519
6521
  icon: Zd.CODE,
6520
6522
  onClick: () => e == null ? void 0 : e.chain().focus().toggleCode().run(),
6521
- active: (o = e == null ? void 0 : e.isActive("code")) != null && o
6523
+ active: (s = e == null ? void 0 : e.isActive("code")) != null && s,
6524
+ testId: "code"
6522
6525
  },
6523
6526
  {
6524
6527
  icon: Zd.UL,
6525
6528
  onClick: () => e == null ? void 0 : e.chain().focus().toggleBulletList().run(),
6526
- active: (s = e == null ? void 0 : e.isActive("bulletList")) != null && s
6529
+ active: (c = e == null ? void 0 : e.isActive("bulletList")) != null && c,
6530
+ testId: "bulletList"
6527
6531
  },
6528
6532
  {
6529
6533
  icon: Zd.OL,
6530
6534
  onClick: () => e == null ? void 0 : e.chain().focus().toggleOrderedList().run(),
6531
- active: (c = e == null ? void 0 : e.isActive("orderedList")) != null && c
6535
+ active: (l = e == null ? void 0 : e.isActive("orderedList")) != null && l,
6536
+ testId: "orderedList"
6532
6537
  }
6533
6538
  ];
6534
6539
  if (n) {
6535
- var u;
6536
- l.push({
6540
+ var d;
6541
+ u.push({
6537
6542
  icon: Zd.MENTION,
6538
6543
  onClick: () => e == null ? void 0 : e.chain().focus().insertContent("@").run(),
6539
- active: (u = e == null ? void 0 : e.isActive("mention")) != null && u
6544
+ active: (d = e == null ? void 0 : e.isActive("mention")) != null && d,
6545
+ testId: "mention"
6540
6546
  });
6541
6547
  }
6542
6548
  return /* @__PURE__ */ C("div", {
6543
6549
  className: Xd.richTextToolbarContainer,
6550
+ "data-testid": i,
6544
6551
  children: [/* @__PURE__ */ S("div", {
6545
6552
  className: Xd.richTextToolbar,
6546
- children: l.map((e, n) => /* @__PURE__ */ S(q, {
6553
+ children: u.map((e, n) => /* @__PURE__ */ S(q, {
6547
6554
  small: !0,
6548
6555
  round: !0,
6549
6556
  basic: !0,
@@ -6551,7 +6558,8 @@ var ko = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Ao =
6551
6558
  colored: Ti.MUTED,
6552
6559
  onClick: e.onClick,
6553
6560
  active: e.active,
6554
- disabled: t
6561
+ disabled: t,
6562
+ testId: i && `${i}-${e.testId}`
6555
6563
  }, n))
6556
6564
  }), r]
6557
6565
  });
@@ -6701,63 +6709,68 @@ var ko = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Ao =
6701
6709
  command: t,
6702
6710
  items: r,
6703
6711
  editable: n.view.dom
6704
- }), ff = c(o(({ placeholder: e, onChange: t, value: n, disabled: r, toolbarComponent: i, mentions: a }, o) => {
6705
- var s, c, l, f;
6706
- let m = u(W), g = r || m, y = !!a, b = _(a), x = _(null), w = _(n == null ? "" : n), [T, E] = v(null);
6712
+ }), ff = c(o(({ placeholder: e, onChange: t, value: n, disabled: r, toolbarComponent: i, mentions: a, testId: o }, s) => {
6713
+ var c, l, f, m;
6714
+ let g = u(W), y = r || g, b = !!a, x = _(a), w = _(null), T = _(n == null ? "" : n), [E, D] = v(null);
6707
6715
  d(() => {
6708
- b.current = a;
6716
+ x.current = a;
6709
6717
  }, [a]);
6710
- let D = h(() => [
6718
+ let O = h(() => [
6711
6719
  ci,
6712
6720
  li.configure({ placeholder: e }),
6713
6721
  ui,
6714
- cf(() => b.current, () => ({
6715
- onStart: (e) => E(df(e)),
6716
- onUpdate: (e) => E(df(e)),
6717
- onExit: () => E(null),
6722
+ cf(() => x.current, () => ({
6723
+ onStart: (e) => D(df(e)),
6724
+ onUpdate: (e) => D(df(e)),
6725
+ onExit: () => D(null),
6718
6726
  onKeyDown: ({ event: e }) => {
6719
6727
  var t, n;
6720
- return (t = (n = x.current) == null ? void 0 : n.onKeyDown(e)) != null && t;
6728
+ return (t = (n = w.current) == null ? void 0 : n.onKeyDown(e)) != null && t;
6721
6729
  }
6722
6730
  }))
6723
- ], []), O = si({
6724
- extensions: D,
6725
- content: w.current,
6731
+ ], []), k = si({
6732
+ extensions: O,
6733
+ content: T.current,
6726
6734
  contentType: "markdown",
6727
- editable: !g,
6735
+ editable: !y,
6728
6736
  editorProps: { attributes: { class: lf.editable } },
6729
6737
  onUpdate: ({ editor: e }) => {
6730
6738
  t == null || t(e.getMarkdown(), { mentionedIds: of(e) });
6731
6739
  }
6732
6740
  });
6733
6741
  return d(() => {
6734
- O && n !== void 0 && n !== O.getMarkdown() && O.commands.setContent(n, {
6742
+ k && n !== void 0 && n !== k.getMarkdown() && k.commands.setContent(n, {
6735
6743
  emitUpdate: !1,
6736
6744
  contentType: "markdown"
6737
6745
  });
6738
- }, [n, O]), d(() => {
6739
- O && O.setEditable(!g);
6740
- }, [g, O]), p(o, () => ({
6741
- clearContent: () => O == null ? void 0 : O.commands.clearContent(!1),
6742
- editor: O,
6743
- getMentionedIds: () => of(O)
6744
- }), [O]), /* @__PURE__ */ C("div", {
6746
+ }, [n, k]), d(() => {
6747
+ k && k.setEditable(!y);
6748
+ }, [y, k]), p(s, () => ({
6749
+ clearContent: () => k == null ? void 0 : k.commands.clearContent(!1),
6750
+ editor: k,
6751
+ getMentionedIds: () => of(k)
6752
+ }), [k]), /* @__PURE__ */ C("div", {
6745
6753
  className: lf.richTextInput,
6754
+ "data-testid": o,
6746
6755
  children: [
6747
6756
  /* @__PURE__ */ S(Qd, {
6748
- editor: O,
6749
- disabled: g,
6750
- showMentionButton: y && ((s = a == null ? void 0 : a.showMentionButton) == null || s),
6751
- toolbarComponent: i
6757
+ editor: k,
6758
+ disabled: y,
6759
+ showMentionButton: b && ((c = a == null ? void 0 : a.showMentionButton) == null || c),
6760
+ toolbarComponent: i,
6761
+ testId: o && `${o}-toolbar`
6762
+ }),
6763
+ /* @__PURE__ */ S(oi, {
6764
+ editor: k,
6765
+ "data-testid": o && `${o}-editor`
6752
6766
  }),
6753
- /* @__PURE__ */ S(oi, { editor: O }),
6754
- y && /* @__PURE__ */ S(Xi, { children: /* @__PURE__ */ S(uf, {
6755
- ref: x,
6756
- editable: (c = T == null ? void 0 : T.editable) == null ? null : c,
6757
- getRect: (l = T == null ? void 0 : T.clientRect) == null ? null : l,
6758
- items: (f = T == null ? void 0 : T.items) == null ? [] : f,
6759
- onDismiss: () => E(null),
6760
- onSelect: (e) => T == null ? void 0 : T.command(e)
6767
+ b && /* @__PURE__ */ S(Xi, { children: /* @__PURE__ */ S(uf, {
6768
+ ref: w,
6769
+ editable: (l = E == null ? void 0 : E.editable) == null ? null : l,
6770
+ getRect: (f = E == null ? void 0 : E.clientRect) == null ? null : f,
6771
+ items: (m = E == null ? void 0 : E.items) == null ? [] : m,
6772
+ onDismiss: () => D(null),
6773
+ onSelect: (e) => E == null ? void 0 : E.command(e)
6761
6774
  }) })
6762
6775
  ]
6763
6776
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/react-ui-library",
3
- "version": "9.2.0-beta-8",
3
+ "version": "9.2.0-beta-9",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
6
6
  "bugs": {