@odigos/ui-kit 0.0.48 → 0.0.50

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.
Files changed (128) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/eslint.config.mjs +16 -2
  3. package/lib/components/data-card/data-card-fields/index.d.ts +3 -6
  4. package/lib/components/data-card/data-card.stories.d.ts +4 -4
  5. package/lib/components/data-finger/data-finger.stories.d.ts +9 -0
  6. package/lib/components/data-finger/index.d.ts +12 -0
  7. package/lib/components/error-boundary/error-boundary.stories.d.ts +3 -1
  8. package/lib/components/error-boundary/index.d.ts +1 -2
  9. package/lib/components/field-error/field-error.stories.d.ts +3 -1
  10. package/lib/components/field-error/index.d.ts +1 -2
  11. package/lib/components/icon-button/index.d.ts +2 -0
  12. package/lib/components/index.d.ts +5 -0
  13. package/lib/components/popup/index.d.ts +17 -0
  14. package/lib/components/popup/popup.stories.d.ts +9 -0
  15. package/lib/components/popup-form/index.d.ts +18 -0
  16. package/lib/components/popup-form/popup-form.stories.d.ts +10 -0
  17. package/lib/components/segment/index.d.ts +8 -7
  18. package/lib/components/styled.d.ts +5 -1
  19. package/lib/components/tag/index.d.ts +8 -0
  20. package/lib/components/tag/tag.stories.d.ts +13 -0
  21. package/lib/components.js +9 -9
  22. package/lib/constants.js +1 -1
  23. package/lib/containers/await-pipeline/await-pipeline.stories.d.ts +1 -1
  24. package/lib/containers/await-pipeline/index.d.ts +1 -2
  25. package/lib/containers/data-flow-actions-menu/add-entity/index.d.ts +2 -3
  26. package/lib/containers/data-flow-actions-menu/filters/index.d.ts +2 -3
  27. package/lib/containers/data-flow-actions-menu/search/index.d.ts +2 -3
  28. package/lib/containers/data-stream-modal/data-stream-modal.stories.d.ts +2 -2
  29. package/lib/containers/data-stream-modal/index.d.ts +1 -2
  30. package/lib/containers/index.d.ts +1 -0
  31. package/lib/containers/notification-manager/index.d.ts +1 -2
  32. package/lib/containers/notification-manager/notification-manager.stories.d.ts +1 -1
  33. package/lib/containers/service-map/helpers/build-edges.d.ts +10 -0
  34. package/lib/containers/service-map/helpers/build-map-nodes.d.ts +11 -0
  35. package/lib/containers/service-map/helpers/generate-dag-positions.d.ts +5 -0
  36. package/lib/containers/service-map/helpers/generate-spiral-grid-position.d.ts +2 -0
  37. package/lib/containers/service-map/index.d.ts +8 -0
  38. package/lib/containers/service-map/service-map.stories.d.ts +9 -0
  39. package/lib/containers/slack-invite/index.d.ts +1 -2
  40. package/lib/containers/slack-invite/slack-invite.stories.d.ts +1 -1
  41. package/lib/containers/system-overview/describe/index.d.ts +1 -1
  42. package/lib/containers/toast-list/index.d.ts +1 -2
  43. package/lib/containers/toast-list/toast-list.stories.d.ts +1 -1
  44. package/lib/containers/toggle-dark-mode/index.d.ts +1 -2
  45. package/lib/containers/toggle-dark-mode/toggle-dark-mode.stories.d.ts +1 -1
  46. package/lib/containers.js +468 -12672
  47. package/lib/functions/clean-object-empty-strings-values/index.d.ts +2 -1
  48. package/lib/functions/compare-condition/index.d.ts +1 -1
  49. package/lib/functions/flatten-object-keys/index.d.ts +2 -1
  50. package/lib/functions/get-entity-id/index.d.ts +2 -2
  51. package/lib/functions/get-entity-label/index.d.ts +2 -2
  52. package/lib/functions/has-unhealthy-instances/index.d.ts +2 -0
  53. package/lib/functions/index.d.ts +2 -0
  54. package/lib/functions/map-destination-fields-for-display/index.d.ts +1 -1
  55. package/lib/functions/remove-empty-values-from-object/index.d.ts +2 -1
  56. package/lib/functions/safe-json-parse/index.d.ts +2 -1
  57. package/lib/functions/safe-json-stringify/index.d.ts +2 -1
  58. package/lib/functions/stringify-non-string-values/index.d.ts +2 -1
  59. package/lib/functions.js +35 -9
  60. package/lib/hooks/index.d.ts +1 -0
  61. package/lib/hooks/useGenericForm.d.ts +2 -1
  62. package/lib/hooks/useInstrumentationRuleFormData.d.ts +1 -4
  63. package/lib/hooks/usePopup.d.ts +17 -0
  64. package/lib/hooks/useSessionStorage.d.ts +2 -2
  65. package/lib/hooks/useSourceFormData.d.ts +1 -4
  66. package/lib/hooks.js +4 -4
  67. package/lib/icons/common/avatar-icon/avatar-icon.stories.d.ts +8 -0
  68. package/lib/icons/common/avatar-icon/index.d.ts +2 -0
  69. package/lib/icons/common/index.d.ts +3 -0
  70. package/lib/icons/common/user-group-icon/index.d.ts +2 -0
  71. package/lib/icons/common/user-group-icon/user-group-icon.stories.d.ts +8 -0
  72. package/lib/icons/common/user-icon/index.d.ts +2 -0
  73. package/lib/icons/common/user-icon/user-icon.stories.d.ts +8 -0
  74. package/lib/icons/math/index.d.ts +2 -0
  75. package/lib/icons/math/minus-circled-icon/index.d.ts +2 -0
  76. package/lib/icons/math/minus-circled-icon/minus-circled-icon.stories.d.ts +8 -0
  77. package/lib/icons/math/plus-circled-icon/index.d.ts +2 -0
  78. package/lib/icons/math/plus-circled-icon/plus-circled-icon.stories.d.ts +8 -0
  79. package/lib/icons.js +35 -7
  80. package/lib/{index-Bw7RE2T2.js → index-BC03UmY5.js} +8 -1
  81. package/lib/{index-BV85P9UP.js → index-BnvrwbRB.js} +4 -0
  82. package/lib/{index-ZTzxu5fz.js → index-CMsBAVAn.js} +2 -2
  83. package/lib/{index-D_SG1Qp0.js → index-CPMIZB66.js} +19 -9
  84. package/lib/{index-DXBePB-r.js → index-CgdNGqvh.js} +12871 -441
  85. package/lib/{index-CkTdd3MS.js → index-CyHOJpMl.js} +1 -1
  86. package/lib/{index-CrXEzEGw.js → index-Dbs7YARA.js} +3 -3
  87. package/lib/{index-DHHUJe_a.js → index-DnhO-nLH.js} +2 -2
  88. package/lib/{index-DxR7e2Cq.js → index-H8TwBQHm.js} +1 -1
  89. package/lib/{index-BIYXaOIt.js → index-LgzkJ05H.js} +10 -2
  90. package/lib/{index-BWIOWlkS.js → index-r72g3gV5.js} +4 -4
  91. package/lib/mock-data/index.d.ts +1 -0
  92. package/lib/mock-data/service-map/index.d.ts +2 -0
  93. package/lib/snippets/copy-text/index.d.ts +6 -0
  94. package/lib/snippets/index.d.ts +6 -2
  95. package/lib/snippets/pod-container/index.d.ts +5 -0
  96. package/lib/{containers/data-flow → snippets/react-flow}/edges/labeled-edge.d.ts +4 -4
  97. package/lib/{containers/data-flow → snippets/react-flow}/flow.d.ts +2 -0
  98. package/lib/snippets/react-flow/index.d.ts +13 -0
  99. package/lib/{containers/data-flow → snippets/react-flow}/nodes/add-node.d.ts +4 -4
  100. package/lib/{containers/data-flow → snippets/react-flow}/nodes/base-node.d.ts +4 -4
  101. package/lib/{containers/data-flow → snippets/react-flow}/nodes/edged-node.d.ts +4 -4
  102. package/lib/{containers/data-flow → snippets/react-flow}/nodes/frame-node.d.ts +4 -4
  103. package/lib/{containers/data-flow → snippets/react-flow}/nodes/header-node.d.ts +4 -4
  104. package/lib/snippets/react-flow/nodes/map-item-node.d.ts +12 -0
  105. package/lib/snippets/react-flow/nodes/no-data-node.d.ts +9 -0
  106. package/lib/{containers/data-flow → snippets/react-flow}/nodes/scroll-node.d.ts +4 -4
  107. package/lib/snippets/react-flow/nodes/skeleton-node.d.ts +8 -0
  108. package/lib/snippets/source-container/index.d.ts +7 -0
  109. package/lib/snippets.js +8 -8
  110. package/lib/store/index.d.ts +1 -0
  111. package/lib/store/useActiveNodeStore.d.ts +11 -0
  112. package/lib/store.js +1 -1
  113. package/lib/theme.js +1 -1
  114. package/lib/types/common/index.d.ts +1 -0
  115. package/lib/types/data-flow/index.d.ts +3 -1
  116. package/lib/types/describe/index.d.ts +3 -3
  117. package/lib/types/index.d.ts +1 -0
  118. package/lib/types/service-map/index.d.ts +10 -0
  119. package/lib/types/sources/index.d.ts +10 -9
  120. package/lib/types.js +2 -0
  121. package/lib/{useSourceSelectionFormData-BP-O55O3.js → useSourceSelectionFormData-CwggurLH.js} +13 -48
  122. package/lib/{useTransition-DanOnTji.js → useTransition-DmHfJSEP.js} +75 -9
  123. package/package.json +3 -2
  124. package/lib/containers/data-flow/nodes/skeleton-node.d.ts +0 -8
  125. package/lib/containers/data-flow-actions-menu/search/recent-searches/index.d.ts +0 -2
  126. /package/lib/{containers/data-flow/helpers/get-main-container-language.d.ts → functions/get-main-container-language/index.d.ts} +0 -0
  127. /package/lib/{containers/data-flow/helpers → snippets/react-flow}/node-config.d.ts +0 -0
  128. /package/lib/{components/data-card/data-card-fields → snippets/source-container}/override-runtime.d.ts +0 -0
@@ -1,6 +1,6 @@
1
+ import { g as useModalStore, c as useDrawerStore, u as useActiveNodeStore } from './index-BC03UmY5.js';
2
+ import { AddNodeTypes, EntityTypes, CustomInstrumentationsKeyTypes, CodeAttributesKeyTypes, PayloadCollectionKeyTypes } from './types.js';
1
3
  import React, { useState, useRef, useEffect, useCallback } from 'react';
2
- import { g as useNotificationStore } from './index-Bw7RE2T2.js';
3
- import { CustomInstrumentationsKeyTypes, CodeAttributesKeyTypes, PayloadCollectionKeyTypes } from './types.js';
4
4
  import styled from 'styled-components';
5
5
 
6
6
  const useGenericForm = (initialFormData) => {
@@ -12,6 +12,7 @@ const useGenericForm = (initialFormData) => {
12
12
  }
13
13
  const [formData, setFormData] = useState(copyInitial());
14
14
  const [formErrors, setFormErrors] = useState({});
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
16
  const handleFormChange = (key, val, obj) => {
16
17
  if (key) {
17
18
  // this is for cases where the form contains objects such as "exportedSignals",
@@ -60,6 +61,42 @@ const useGenericForm = (initialFormData) => {
60
61
  };
61
62
  };
62
63
 
64
+ const useClickNode = () => {
65
+ const { setCurrentModal } = useModalStore();
66
+ const { setDrawerType, setDrawerEntityId } = useDrawerStore();
67
+ const { setActiveNodeType, setActiveNodeId } = useActiveNodeStore();
68
+ const onClickNode = (_, object) => {
69
+ const { id: nodeId, type: nodeType, data: { id: entityId, type: entityType }, } = object;
70
+ setActiveNodeType(nodeType);
71
+ setActiveNodeId(nodeId);
72
+ switch (entityType) {
73
+ case EntityTypes.Source:
74
+ case EntityTypes.Destination:
75
+ case EntityTypes.Action:
76
+ case EntityTypes.InstrumentationRule:
77
+ setDrawerType(entityType);
78
+ setDrawerEntityId(entityId);
79
+ break;
80
+ case AddNodeTypes.AddSource:
81
+ setCurrentModal(EntityTypes.Source);
82
+ break;
83
+ case AddNodeTypes.AddDestination:
84
+ setCurrentModal(EntityTypes.Destination);
85
+ break;
86
+ case AddNodeTypes.AddAction:
87
+ setCurrentModal(EntityTypes.Action);
88
+ break;
89
+ case AddNodeTypes.AddRule:
90
+ setCurrentModal(EntityTypes.InstrumentationRule);
91
+ break;
92
+ default:
93
+ console.warn('Unhandled node click', object);
94
+ break;
95
+ }
96
+ };
97
+ return { onClickNode };
98
+ };
99
+
63
100
  const useContainerSize = () => {
64
101
  const ref = useRef(null);
65
102
  const [width, setWidth] = useState(0);
@@ -148,13 +185,11 @@ const INITIAL = {
148
185
  },
149
186
  };
150
187
  const useInstrumentationRuleFormData = () => {
151
- const { addNotification } = useNotificationStore();
152
188
  const { formData, formErrors, handleFormChange, handleErrorChange, resetFormData } = useGenericForm(INITIAL);
153
- const validateForm = (params) => {
154
- const errors = {};
155
- let ok = true;
156
- handleErrorChange(undefined, undefined, errors);
157
- return ok;
189
+ const validateForm = () => {
190
+ // We don't have any specific validations for this form yet
191
+ handleErrorChange(undefined, undefined, {});
192
+ return true;
158
193
  };
159
194
  const loadFormWithDrawerItem = ({ ruleName, notes, disabled, payloadCollection, codeAttributes, headersCollection, customInstrumentations }) => {
160
195
  const updatedData = {
@@ -241,6 +276,35 @@ const useOnClickOutside = (ref, handler) => {
241
276
  }, [ref, handler]);
242
277
  };
243
278
 
279
+ const usePopup = ({ defaultClientHeight = 0, defaultClientwidth = 0, onClickOutside } = {}) => {
280
+ const popupRef = useRef(null);
281
+ const [popupOpen, setPopupOpen] = useState(false);
282
+ const [popupPosition, setPopupPosition] = useState({ top: 0, left: 0 });
283
+ useOnClickOutside(popupRef, () => {
284
+ if (popupOpen) {
285
+ setPopupOpen(false);
286
+ onClickOutside?.();
287
+ }
288
+ });
289
+ const handlePosition = (clientX, clientY) => {
290
+ const { innerWidth, innerHeight } = window;
291
+ let top = clientY;
292
+ let left = clientX;
293
+ if (top >= innerHeight / 2)
294
+ top += -(popupRef.current?.clientHeight || defaultClientHeight);
295
+ if (left >= innerWidth / 2)
296
+ left += -(popupRef.current?.clientWidth || defaultClientwidth);
297
+ setPopupPosition({ top, left });
298
+ };
299
+ return {
300
+ popupRef,
301
+ popupOpen,
302
+ setPopupOpen,
303
+ popupPosition,
304
+ handlePosition,
305
+ };
306
+ };
307
+
244
308
  // Fallback locale.
245
309
  // (when not a single one of the supplied "preferred" locales is available)
246
310
  var defaultLocale$1 = 'en'; // For all locales added
@@ -3487,7 +3551,9 @@ const useTransition = ({ container, animateIn, animateOut, duration = 300 }) =>
3487
3551
  `;
3488
3552
  // !! Do not deprecate this "useCallback" hook, it is necessary for the transition to work properly
3489
3553
  const Transition = useCallback(({ children, enter, ...props }) => {
3554
+ // eslint-disable-next-line react-hooks/rules-of-hooks
3490
3555
  const [mounted, setMounted] = useState(false);
3556
+ // eslint-disable-next-line react-hooks/rules-of-hooks
3491
3557
  useEffect(() => {
3492
3558
  const t = setTimeout(() => setMounted(enter), duration + 50); // +50ms to ensure the animation is finished
3493
3559
  return () => clearTimeout(t);
@@ -3501,4 +3567,4 @@ const useTransition = ({ container, animateIn, animateOut, duration = 300 }) =>
3501
3567
  return Transition;
3502
3568
  };
3503
3569
 
3504
- export { useCopy as a, useGenericForm as b, useInstrumentationRuleFormData as c, useKeyDown as d, useOnClickOutside as e, useTimeAgo as f, useTransition as g, useContainerSize as u };
3570
+ export { useContainerSize as a, useCopy as b, useGenericForm as c, useInstrumentationRuleFormData as d, useKeyDown as e, useOnClickOutside as f, usePopup as g, useTimeAgo as h, useTransition as i, useClickNode as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odigos/ui-kit",
3
- "version": "0.0.48",
3
+ "version": "0.0.50",
4
4
  "author": "Odigos",
5
5
  "repository": {
6
6
  "type": "git",
@@ -10,7 +10,8 @@
10
10
  "dev": "storybook dev -p 6006",
11
11
  "prebuild": "rm -rf lib",
12
12
  "build": "rollup -c --bundleConfigAsCjs",
13
- "watch": "rollup -c --bundleConfigAsCjs -w"
13
+ "watch": "rollup -c --bundleConfigAsCjs -w",
14
+ "lint": "eslint . --ext .js,.jsx,.ts,.tsx"
14
15
  },
15
16
  "release": {
16
17
  "branches": [
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import { NodeTypes } from '@/types';
3
- import { type Node, type NodeProps } from '@xyflow/react';
4
- export interface SkeletonNodeProps extends NodeProps<Node<{
5
- nodeWidth: number;
6
- }, NodeTypes.Skeleton>> {
7
- }
8
- export declare const SkeletonNode: React.FC<SkeletonNodeProps>;
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const RecentSearches: () => React.JSX.Element;