@appquality/unguess-design-system 3.1.114 → 3.1.115

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/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # v3.1.115 (Thu Oct 10 2024)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - Add start - end attrs to observation [#423](https://github.com/AppQuality/unguess-design-system/pull/423) ([@d-beezee](https://github.com/d-beezee))
6
+
7
+ #### Authors: 1
8
+
9
+ - [@d-beezee](https://github.com/d-beezee)
10
+
11
+ ---
12
+
1
13
  # v3.1.114 (Mon Oct 07 2024)
2
14
 
3
15
  #### 🐛 Bug Fix
package/build/index.js CHANGED
@@ -782,6 +782,11 @@ Used for this
782
782
  **/
783
783
  const IconButton = React.forwardRef((props, ref) => jsxRuntime.jsx(reactButtons.IconButton, Object.assign({ ref: ref }, props)));
784
784
 
785
+ const SplitButtonWrapper = styled__default["default"].div `
786
+ [data-garden-id="buttons.button"] {
787
+ margin-right: -1px;
788
+ }
789
+ `;
785
790
  /**
786
791
  A Split button is a hybrid between a Dropdown Menu and a Button. It lets users choose from parallel actions and take action on their choice.
787
792
  <hr>
@@ -789,7 +794,7 @@ Used for this:
789
794
  - To let users select from multiple parallel actions. Actions are parallel when each represents a path forward for the user and none cancel the action.
790
795
  - To reduce visual complexity when there are multiple actions a user can take
791
796
  **/
792
- const SplitButton = React.forwardRef((props, ref) => jsxRuntime.jsx(reactButtons.SplitButton, Object.assign({ ref: ref }, props)));
797
+ const SplitButton = React.forwardRef((props, ref) => (jsxRuntime.jsx(SplitButtonWrapper, { children: jsxRuntime.jsx(reactButtons.SplitButton, Object.assign({ ref: ref }, props)) })));
793
798
 
794
799
  /**
795
800
  * Use Span to style and format inline text elements.
@@ -7363,7 +7368,9 @@ const DefaultWordWrapper = ({ children }) => {
7363
7368
  };
7364
7369
  const DefaultObservationWrapper = ({ title, color, children, observations, }) => {
7365
7370
  const background = color + "50";
7366
- return (jsxRuntime.jsx("span", Object.assign({ "data-title": title, style: { background } }, { children: jsxRuntime.jsx(Tooltip, Object.assign({ content: observations.map((o) => o.title).join(" and ") }, { children: jsxRuntime.jsx("span", { children: children }) })) })));
7371
+ return (jsxRuntime.jsx("span", Object.assign({ "data-title": title, style: { background } }, { children: jsxRuntime.jsx(Tooltip, Object.assign({ content: observations.map((o) => (jsxRuntime.jsx("div", Object.assign({ onClick: () => {
7372
+ alert(`Clicked on observation ${o.id} - start: ${o.start}`);
7373
+ } }, { children: o.title })))) }, { children: jsxRuntime.jsx("span", { children: children }) })) })));
7367
7374
  };
7368
7375
  const DefaultParagraphWrapper = ({ children }) => {
7369
7376
  return jsxRuntime.jsx("p", Object.assign({ style: { marginBottom: "20px" } }, { children: children }));
@@ -7525,6 +7532,8 @@ class ContentParser {
7525
7532
  {
7526
7533
  type: "Observation",
7527
7534
  attrs: {
7535
+ start: observation.start,
7536
+ end: observation.end,
7528
7537
  id: observation.id,
7529
7538
  title: observation.text,
7530
7539
  color: observation.color,
@@ -7698,6 +7707,7 @@ const Component$2 = ({ node, editor, }) => {
7698
7707
  const ancestors = findAllAncestorsOfType(editor.state, nodePos, editor.state.schema.nodes.Observation);
7699
7708
  const observationsNodes = ancestors.length ? [node, ...ancestors] : [node];
7700
7709
  return (jsxRuntime.jsx(react.NodeViewWrapper, Object.assign({ as: "div", style: { display: "inline" } }, { children: jsxRuntime.jsx(ObservationWrapper, Object.assign({ title: node.attrs["title"], color: node.attrs["color"], observations: observationsNodes.map((o) => ({
7710
+ start: o.attrs["start"],
7701
7711
  id: o.attrs["id"],
7702
7712
  title: o.attrs["title"],
7703
7713
  color: o.attrs["color"],
@@ -7710,6 +7720,12 @@ const Observation = core.Node.create({
7710
7720
  inline: true,
7711
7721
  addAttributes() {
7712
7722
  return {
7723
+ start: {
7724
+ default: 0,
7725
+ },
7726
+ end: {
7727
+ default: 0,
7728
+ },
7713
7729
  id: {
7714
7730
  default: 0,
7715
7731
  },
@@ -7732,9 +7748,20 @@ const Observation = core.Node.create({
7732
7748
  return {
7733
7749
  addObservation: ({ id, title, color }) => ({ tr, state, view }) => {
7734
7750
  const { from, to } = state.selection;
7751
+ let firstWord, lastWord;
7752
+ state.doc.nodesBetween(from, to, (node, pos) => {
7753
+ if (node.type.name === "Word") {
7754
+ if (!firstWord) {
7755
+ firstWord = node;
7756
+ }
7757
+ lastWord = node;
7758
+ }
7759
+ });
7735
7760
  state.doc.nodesBetween(from, to, (node, pos) => {
7736
7761
  if (node.type.name === "Word") {
7737
7762
  const annotationNode = state.schema.nodes.Observation.create({
7763
+ start: firstWord.attrs["data-start"],
7764
+ end: lastWord.attrs["data-end"],
7738
7765
  id,
7739
7766
  title,
7740
7767
  color,
@@ -12,6 +12,7 @@ declare const DefaultObservationWrapper: ({ title, color, children, observations
12
12
  color: string;
13
13
  children: ReactNode;
14
14
  observations: {
15
+ start: number;
15
16
  id: number;
16
17
  title: string;
17
18
  color: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appquality/unguess-design-system",
3
- "version": "3.1.114",
3
+ "version": "3.1.115",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",