@oliasoft-open-source/react-ui-library 9.1.1-beta-1 → 9.1.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.
@@ -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
@@ -6488,48 +6488,55 @@ var ko = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Ao =
6488
6488
  richTextToolbarContainer: "_richTextToolbarContainer_1gbkk_5"
6489
6489
  }, Yd = /* @__PURE__ */ function(e) {
6490
6490
  return e.BOLD = "bold", e.ITALIC = "italic", e.CODE = "code", e.UL = "ul", e.OL = "ol", e.MENTION = "at", e;
6491
- }({}), Xd = ({ editor: e, disabled: t = !1, showMentionButton: n = !1, toolbarComponent: r = null }) => {
6492
- var i, a, o, s, c;
6493
- let l = [
6491
+ }({}), Xd = ({ editor: e, disabled: t = !1, showMentionButton: n = !1, toolbarComponent: r = null, testId: i }) => {
6492
+ var a, o, s, c, l;
6493
+ let u = [
6494
6494
  {
6495
6495
  icon: Yd.BOLD,
6496
6496
  onClick: () => e == null ? void 0 : e.chain().focus().toggleBold().run(),
6497
- active: (i = e == null ? void 0 : e.isActive("bold")) != null && i
6497
+ active: (a = e == null ? void 0 : e.isActive("bold")) != null && a,
6498
+ testId: "bold"
6498
6499
  },
6499
6500
  {
6500
6501
  icon: Yd.ITALIC,
6501
6502
  onClick: () => e == null ? void 0 : e.chain().focus().toggleItalic().run(),
6502
- active: (a = e == null ? void 0 : e.isActive("italic")) != null && a
6503
+ active: (o = e == null ? void 0 : e.isActive("italic")) != null && o,
6504
+ testId: "italic"
6503
6505
  },
6504
6506
  {
6505
6507
  icon: Yd.CODE,
6506
6508
  onClick: () => e == null ? void 0 : e.chain().focus().toggleCode().run(),
6507
- active: (o = e == null ? void 0 : e.isActive("code")) != null && o
6509
+ active: (s = e == null ? void 0 : e.isActive("code")) != null && s,
6510
+ testId: "code"
6508
6511
  },
6509
6512
  {
6510
6513
  icon: Yd.UL,
6511
6514
  onClick: () => e == null ? void 0 : e.chain().focus().toggleBulletList().run(),
6512
- active: (s = e == null ? void 0 : e.isActive("bulletList")) != null && s
6515
+ active: (c = e == null ? void 0 : e.isActive("bulletList")) != null && c,
6516
+ testId: "bulletList"
6513
6517
  },
6514
6518
  {
6515
6519
  icon: Yd.OL,
6516
6520
  onClick: () => e == null ? void 0 : e.chain().focus().toggleOrderedList().run(),
6517
- active: (c = e == null ? void 0 : e.isActive("orderedList")) != null && c
6521
+ active: (l = e == null ? void 0 : e.isActive("orderedList")) != null && l,
6522
+ testId: "orderedList"
6518
6523
  }
6519
6524
  ];
6520
6525
  if (n) {
6521
- var u;
6522
- l.push({
6526
+ var d;
6527
+ u.push({
6523
6528
  icon: Yd.MENTION,
6524
6529
  onClick: () => e == null ? void 0 : e.chain().focus().insertContent("@").run(),
6525
- active: (u = e == null ? void 0 : e.isActive("mention")) != null && u
6530
+ active: (d = e == null ? void 0 : e.isActive("mention")) != null && d,
6531
+ testId: "mention"
6526
6532
  });
6527
6533
  }
6528
6534
  return /* @__PURE__ */ C("div", {
6529
6535
  className: Jd.richTextToolbarContainer,
6536
+ "data-testid": i,
6530
6537
  children: [/* @__PURE__ */ S("div", {
6531
6538
  className: Jd.richTextToolbar,
6532
- children: l.map((e, n) => /* @__PURE__ */ S(q, {
6539
+ children: u.map((e, n) => /* @__PURE__ */ S(q, {
6533
6540
  small: !0,
6534
6541
  round: !0,
6535
6542
  basic: !0,
@@ -6537,7 +6544,8 @@ var ko = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Ao =
6537
6544
  colored: Ti.MUTED,
6538
6545
  onClick: e.onClick,
6539
6546
  active: e.active,
6540
- disabled: t
6547
+ disabled: t,
6548
+ testId: i && `${i}-${e.testId}`
6541
6549
  }, n))
6542
6550
  }), r]
6543
6551
  });
@@ -6687,63 +6695,68 @@ var ko = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Ao =
6687
6695
  command: t,
6688
6696
  items: r,
6689
6697
  editable: n.view.dom
6690
- }), uf = c(o(({ placeholder: e, onChange: t, value: n, disabled: r, toolbarComponent: i, mentions: a }, o) => {
6691
- var s, c, l, f;
6692
- let m = u(W), g = r || m, y = !!a, b = _(a), x = _(null), w = _(n == null ? "" : n), [T, E] = v(null);
6698
+ }), uf = c(o(({ placeholder: e, onChange: t, value: n, disabled: r, toolbarComponent: i, mentions: a, testId: o }, s) => {
6699
+ var c, l, f, m;
6700
+ let g = u(W), y = r || g, b = !!a, x = _(a), w = _(null), T = _(n == null ? "" : n), [E, D] = v(null);
6693
6701
  d(() => {
6694
- b.current = a;
6702
+ x.current = a;
6695
6703
  }, [a]);
6696
- let D = h(() => [
6704
+ let O = h(() => [
6697
6705
  ci,
6698
6706
  li.configure({ placeholder: e }),
6699
6707
  ui,
6700
- of(() => b.current, () => ({
6701
- onStart: (e) => E(lf(e)),
6702
- onUpdate: (e) => E(lf(e)),
6703
- onExit: () => E(null),
6708
+ of(() => x.current, () => ({
6709
+ onStart: (e) => D(lf(e)),
6710
+ onUpdate: (e) => D(lf(e)),
6711
+ onExit: () => D(null),
6704
6712
  onKeyDown: ({ event: e }) => {
6705
6713
  var t, n;
6706
- return (t = (n = x.current) == null ? void 0 : n.onKeyDown(e)) != null && t;
6714
+ return (t = (n = w.current) == null ? void 0 : n.onKeyDown(e)) != null && t;
6707
6715
  }
6708
6716
  }))
6709
- ], []), O = si({
6710
- extensions: D,
6711
- content: w.current,
6717
+ ], []), k = si({
6718
+ extensions: O,
6719
+ content: T.current,
6712
6720
  contentType: "markdown",
6713
- editable: !g,
6721
+ editable: !y,
6714
6722
  editorProps: { attributes: { class: sf.editable } },
6715
6723
  onUpdate: ({ editor: e }) => {
6716
6724
  t == null || t(e.getMarkdown(), { mentionedIds: rf(e) });
6717
6725
  }
6718
6726
  });
6719
6727
  return d(() => {
6720
- O && n !== void 0 && n !== O.getMarkdown() && O.commands.setContent(n, {
6728
+ k && n !== void 0 && n !== k.getMarkdown() && k.commands.setContent(n, {
6721
6729
  emitUpdate: !1,
6722
6730
  contentType: "markdown"
6723
6731
  });
6724
- }, [n, O]), d(() => {
6725
- O && O.setEditable(!g);
6726
- }, [g, O]), p(o, () => ({
6727
- clearContent: () => O == null ? void 0 : O.commands.clearContent(!1),
6728
- editor: O,
6729
- getMentionedIds: () => rf(O)
6730
- }), [O]), /* @__PURE__ */ C("div", {
6732
+ }, [n, k]), d(() => {
6733
+ k && k.setEditable(!y);
6734
+ }, [y, k]), p(s, () => ({
6735
+ clearContent: () => k == null ? void 0 : k.commands.clearContent(!1),
6736
+ editor: k,
6737
+ getMentionedIds: () => rf(k)
6738
+ }), [k]), /* @__PURE__ */ C("div", {
6731
6739
  className: sf.richTextInput,
6740
+ "data-testid": o,
6732
6741
  children: [
6733
6742
  /* @__PURE__ */ S(Xd, {
6734
- editor: O,
6735
- disabled: g,
6736
- showMentionButton: y && ((s = a == null ? void 0 : a.showMentionButton) == null || s),
6737
- toolbarComponent: i
6743
+ editor: k,
6744
+ disabled: y,
6745
+ showMentionButton: b && ((c = a == null ? void 0 : a.showMentionButton) == null || c),
6746
+ toolbarComponent: i,
6747
+ testId: o && `${o}-toolbar`
6748
+ }),
6749
+ /* @__PURE__ */ S(oi, {
6750
+ editor: k,
6751
+ "data-testid": o && `${o}-editor`
6738
6752
  }),
6739
- /* @__PURE__ */ S(oi, { editor: O }),
6740
- y && /* @__PURE__ */ S(Xi, { children: /* @__PURE__ */ S(cf, {
6741
- ref: x,
6742
- editable: (c = T == null ? void 0 : T.editable) == null ? null : c,
6743
- getRect: (l = T == null ? void 0 : T.clientRect) == null ? null : l,
6744
- items: (f = T == null ? void 0 : T.items) == null ? [] : f,
6745
- onDismiss: () => E(null),
6746
- onSelect: (e) => T == null ? void 0 : T.command(e)
6753
+ b && /* @__PURE__ */ S(Xi, { children: /* @__PURE__ */ S(cf, {
6754
+ ref: w,
6755
+ editable: (l = E == null ? void 0 : E.editable) == null ? null : l,
6756
+ getRect: (f = E == null ? void 0 : E.clientRect) == null ? null : f,
6757
+ items: (m = E == null ? void 0 : E.items) == null ? [] : m,
6758
+ onDismiss: () => D(null),
6759
+ onSelect: (e) => E == null ? void 0 : E.command(e)
6747
6760
  }) })
6748
6761
  ]
6749
6762
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/react-ui-library",
3
- "version": "9.1.1-beta-1",
3
+ "version": "9.1.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": {