@addev-be/ui 3.2.9 → 3.3.0

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 (265) hide show
  1. package/assets/icons/arrow-down-1-9.svg +1 -1
  2. package/assets/icons/arrow-down-a-z.svg +1 -1
  3. package/assets/icons/arrow-up-z-a.svg +1 -1
  4. package/assets/icons/check.svg +1 -1
  5. package/assets/icons/circle-check.svg +1 -1
  6. package/assets/icons/down.svg +1 -1
  7. package/assets/icons/filter-full.svg +1 -1
  8. package/assets/icons/filter.svg +1 -1
  9. package/assets/icons/hashtag.svg +1 -1
  10. package/assets/icons/image-slash.svg +1 -1
  11. package/assets/icons/left.svg +1 -1
  12. package/assets/icons/magnifier.svg +1 -1
  13. package/assets/icons/phone.svg +1 -1
  14. package/assets/icons/right.svg +1 -1
  15. package/assets/icons/sort-calendar-ascending.svg +5 -5
  16. package/assets/icons/spinner-third.svg +1 -1
  17. package/assets/icons/table-columns.svg +1 -1
  18. package/assets/icons/table-footer-slash.svg +4 -4
  19. package/assets/icons/table-footer.svg +3 -3
  20. package/assets/icons/table.svg +1 -1
  21. package/assets/icons/up.svg +1 -1
  22. package/assets/icons/user-tie.svg +1 -1
  23. package/assets/icons/x-bar.svg +3 -3
  24. package/dist/components/auth/PasswordResetForm.js +7 -2
  25. package/dist/components/common/Accordion/Accordion.d.ts +14 -0
  26. package/dist/components/common/Accordion/Accordion.js +81 -0
  27. package/dist/components/common/Accordion/index.d.ts +2 -0
  28. package/dist/components/common/PropertiesList/PropertyInput.d.ts +7 -0
  29. package/dist/components/common/PropertiesList/PropertyInput.js +142 -0
  30. package/dist/components/common/PropertiesList/index.d.ts +8 -0
  31. package/dist/components/common/PropertiesList/index.js +28 -0
  32. package/dist/components/common/PropertiesList/types.d.ts +44 -0
  33. package/dist/components/common/TabsView/styles.js +10 -8
  34. package/dist/components/common/TreeView/TreeContext.d.ts +55 -0
  35. package/dist/components/common/TreeView/TreeContext.js +172 -0
  36. package/dist/components/common/TreeView/TreeView.d.ts +19 -0
  37. package/dist/components/common/TreeView/TreeView.js +202 -0
  38. package/dist/components/common/TreeView/index.d.ts +3 -0
  39. package/dist/components/common/index.d.ts +3 -0
  40. package/dist/components/common/index.js +25 -16
  41. package/dist/components/grid/DataGrid/DataGridCell.js +30 -29
  42. package/dist/components/grid/DataGrid/DataGridEditableCell/index.d.ts +1 -1
  43. package/dist/components/grid/DataGrid/DataGridEditableCell/index.js +37 -27
  44. package/dist/components/grid/DataGrid/DataGridRowTemplate.js +71 -56
  45. package/dist/components/layout/ContextMenu/ContextMenu.d.ts +42 -0
  46. package/dist/components/layout/ContextMenu/ContextMenu.js +252 -0
  47. package/dist/components/layout/ContextMenu/index.d.ts +2 -0
  48. package/dist/components/layout/LeftMenu/LeftMenu.d.ts +22 -0
  49. package/dist/components/layout/LeftMenu/LeftMenu.js +43 -0
  50. package/dist/components/layout/LeftMenu/index.d.ts +2 -0
  51. package/dist/components/layout/PanelContainer/PanelContainer.d.ts +16 -0
  52. package/dist/components/layout/PanelContainer/PanelContainer.js +121 -0
  53. package/dist/components/layout/PanelContainer/index.d.ts +2 -0
  54. package/dist/components/layout/index.d.ts +3 -0
  55. package/dist/components/layout/index.js +30 -15
  56. package/dist/helpers/cn.d.ts +2 -0
  57. package/dist/helpers/cn.js +8 -0
  58. package/dist/helpers/index.d.ts +1 -0
  59. package/dist/helpers/index.js +33 -31
  60. package/eslint.config.js +3 -3
  61. package/package.json +5 -3
  62. package/src/components/auth/LoginForm.tsx +92 -92
  63. package/src/components/auth/LoginPage.tsx +32 -32
  64. package/src/components/auth/PasswordRecoveryForm.tsx +53 -53
  65. package/src/components/auth/PasswordResetForm.tsx +114 -114
  66. package/src/components/auth/index.ts +4 -4
  67. package/src/components/auth/styles.ts +14 -14
  68. package/src/components/common/Accordion/Accordion.tsx +140 -0
  69. package/src/components/common/Accordion/index.ts +2 -0
  70. package/src/components/common/Avatar/index.tsx +54 -54
  71. package/src/components/common/Avatar/styles.ts +61 -61
  72. package/src/components/common/Card/index.tsx +17 -17
  73. package/src/components/common/Card/styles.ts +38 -38
  74. package/src/components/common/ContextMenu/index.tsx +79 -79
  75. package/src/components/common/ContextMenu/styles.ts +119 -119
  76. package/src/components/common/Ellipsis.tsx +33 -33
  77. package/src/components/common/Label.tsx +93 -93
  78. package/src/components/common/Message/index.tsx +57 -57
  79. package/src/components/common/Message/styles.ts +44 -44
  80. package/src/components/common/PropertiesList/PropertyInput.tsx +173 -0
  81. package/src/components/common/PropertiesList/index.tsx +48 -0
  82. package/src/components/common/PropertiesList/types.ts +60 -0
  83. package/src/components/common/TabsView/TabsList.tsx +49 -49
  84. package/src/components/common/TabsView/TabsView.tsx +42 -42
  85. package/src/components/common/TabsView/index.ts +3 -3
  86. package/src/components/common/TabsView/styles.ts +83 -83
  87. package/src/components/common/TabsView/types.ts +12 -12
  88. package/src/components/common/TreeView/TreeContext.tsx +379 -0
  89. package/src/components/common/TreeView/TreeView.tsx +281 -0
  90. package/src/components/common/TreeView/index.ts +3 -0
  91. package/src/components/common/index.ts +10 -7
  92. package/src/components/forms/AutoTextArea.tsx +48 -48
  93. package/src/components/forms/BillitIdentifier/index.tsx +78 -78
  94. package/src/components/forms/BillitIdentifier/styles.tsx +43 -43
  95. package/src/components/forms/Button.tsx +130 -130
  96. package/src/components/forms/Form/Checkbox.tsx +12 -12
  97. package/src/components/forms/Form/CustomSelect.tsx +86 -86
  98. package/src/components/forms/Form/FormGroup.tsx +33 -33
  99. package/src/components/forms/Form/Input.tsx +16 -16
  100. package/src/components/forms/Form/Row.tsx +28 -28
  101. package/src/components/forms/Form/Select.tsx +99 -99
  102. package/src/components/forms/Form/TextArea.tsx +17 -17
  103. package/src/components/forms/Form/index.tsx +48 -48
  104. package/src/components/forms/Form/styles.ts +148 -148
  105. package/src/components/forms/IconButton.tsx +61 -61
  106. package/src/components/forms/IndeterminateCheckbox.tsx +46 -46
  107. package/src/components/forms/NumberInput.tsx +53 -53
  108. package/src/components/forms/Select.tsx +34 -34
  109. package/src/components/forms/VerticalLabel.tsx +20 -20
  110. package/src/components/forms/index.ts +11 -11
  111. package/src/components/forms/styles.ts +42 -42
  112. package/src/components/grid/DataGrid/DataGridCell.tsx +82 -81
  113. package/src/components/grid/DataGrid/DataGridColumnsModal/helpers.ts +9 -9
  114. package/src/components/grid/DataGrid/DataGridColumnsModal/hooks.tsx +59 -59
  115. package/src/components/grid/DataGrid/DataGridColumnsModal/index.tsx +182 -182
  116. package/src/components/grid/DataGrid/DataGridColumnsModal/styles.ts +104 -104
  117. package/src/components/grid/DataGrid/DataGridEditableCell/CheckboxEditableCell.tsx +37 -37
  118. package/src/components/grid/DataGrid/DataGridEditableCell/DateEditableCell.tsx +38 -38
  119. package/src/components/grid/DataGrid/DataGridEditableCell/NumberEditableCell.tsx +71 -71
  120. package/src/components/grid/DataGrid/DataGridEditableCell/TextEditableCell.tsx +37 -37
  121. package/src/components/grid/DataGrid/DataGridEditableCell/index.tsx +112 -106
  122. package/src/components/grid/DataGrid/DataGridEditableCell/styles.ts +35 -35
  123. package/src/components/grid/DataGrid/DataGridEditableCell/types.ts +18 -18
  124. package/src/components/grid/DataGrid/DataGridFilterMenu/FilterValuesScroller.tsx +129 -129
  125. package/src/components/grid/DataGrid/DataGridFilterMenu/helpers.ts +23 -23
  126. package/src/components/grid/DataGrid/DataGridFilterMenu/hooks.tsx +81 -81
  127. package/src/components/grid/DataGrid/DataGridFilterMenu/index.tsx +370 -370
  128. package/src/components/grid/DataGrid/DataGridFilterMenu/styles.ts +97 -97
  129. package/src/components/grid/DataGrid/DataGridFooter.tsx +48 -48
  130. package/src/components/grid/DataGrid/DataGridHeader.tsx +74 -74
  131. package/src/components/grid/DataGrid/DataGridHeaderCell.tsx +112 -112
  132. package/src/components/grid/DataGrid/DataGridRowTemplate.tsx +90 -83
  133. package/src/components/grid/DataGrid/DataGridToolbar.tsx +134 -134
  134. package/src/components/grid/DataGrid/FilterModalContent/index.tsx +137 -137
  135. package/src/components/grid/DataGrid/FilterModalContent/styles.ts +22 -22
  136. package/src/components/grid/DataGrid/constants.ts +6 -6
  137. package/src/components/grid/DataGrid/helpers/columns.tsx +452 -452
  138. package/src/components/grid/DataGrid/helpers/filters.ts +287 -287
  139. package/src/components/grid/DataGrid/helpers/index.ts +2 -2
  140. package/src/components/grid/DataGrid/hooks/index.ts +29 -29
  141. package/src/components/grid/DataGrid/hooks/useDataGrid.tsx +383 -383
  142. package/src/components/grid/DataGrid/hooks/useDataGridChangedRows.ts +97 -97
  143. package/src/components/grid/DataGrid/hooks/useDataGridCopy.ts +174 -174
  144. package/src/components/grid/DataGrid/hooks/useDataGridSettings.ts +48 -48
  145. package/src/components/grid/DataGrid/hooks/useRefreshModal.tsx +48 -48
  146. package/src/components/grid/DataGrid/index.tsx +111 -111
  147. package/src/components/grid/DataGrid/styles.ts +446 -446
  148. package/src/components/grid/DataGrid/types.ts +380 -380
  149. package/src/components/grid/SqlRequestDataGrid/helpers/columns.tsx +526 -526
  150. package/src/components/grid/SqlRequestDataGrid/helpers/index.ts +2 -2
  151. package/src/components/grid/SqlRequestDataGrid/helpers/rows.ts +24 -24
  152. package/src/components/grid/SqlRequestDataGrid/helpers/sqlRequests.ts +17 -17
  153. package/src/components/grid/SqlRequestDataGrid/index.tsx +417 -417
  154. package/src/components/grid/SqlRequestDataGrid/styles.ts +15 -15
  155. package/src/components/grid/SqlRequestDataGrid/types.ts +74 -74
  156. package/src/components/grid/SqlRequestForeignList/index.tsx +254 -254
  157. package/src/components/grid/SqlRequestForeignList/styles.ts +43 -43
  158. package/src/components/grid/SqlRequestForeignList/types.ts +32 -32
  159. package/src/components/grid/SqlRequestGrid/filters/FiltersSidebar.tsx +108 -108
  160. package/src/components/grid/SqlRequestGrid/filters/styles.ts +88 -88
  161. package/src/components/grid/SqlRequestGrid/helpers/index.ts +1 -1
  162. package/src/components/grid/SqlRequestGrid/helpers/sqlRequests.ts +16 -16
  163. package/src/components/grid/SqlRequestGrid/index.tsx +304 -304
  164. package/src/components/grid/SqlRequestGrid/styles.ts +20 -20
  165. package/src/components/grid/SqlRequestGrid/types.ts +73 -73
  166. package/src/components/grid/VirtualScroller/hooks.ts +71 -71
  167. package/src/components/grid/VirtualScroller/index.tsx +89 -89
  168. package/src/components/grid/VirtualScroller/styles.ts +57 -57
  169. package/src/components/grid/VirtualScroller/types.ts +10 -10
  170. package/src/components/grid/index.ts +11 -11
  171. package/src/components/layout/Columns.ts +28 -28
  172. package/src/components/layout/ContextMenu/ContextMenu.tsx +471 -0
  173. package/src/components/layout/ContextMenu/index.ts +23 -0
  174. package/src/components/layout/Dropdown/index.tsx +113 -113
  175. package/src/components/layout/Dropdown/styles.ts +53 -53
  176. package/src/components/layout/Flexbox.ts +21 -21
  177. package/src/components/layout/Grid/index.tsx +8 -8
  178. package/src/components/layout/Grid/styles.ts +34 -34
  179. package/src/components/layout/LeftMenu/LeftMenu.tsx +89 -0
  180. package/src/components/layout/LeftMenu/index.ts +2 -0
  181. package/src/components/layout/Loading/index.tsx +29 -29
  182. package/src/components/layout/Loading/styles.ts +29 -29
  183. package/src/components/layout/Masonry/index.tsx +29 -29
  184. package/src/components/layout/Masonry/styles.ts +20 -20
  185. package/src/components/layout/Modal/index.tsx +51 -51
  186. package/src/components/layout/Modal/styles.ts +125 -125
  187. package/src/components/layout/PanelContainer/PanelContainer.tsx +198 -0
  188. package/src/components/layout/PanelContainer/index.ts +2 -0
  189. package/src/components/layout/index.ts +10 -7
  190. package/src/components/search/HighlightedText.tsx +41 -41
  191. package/src/components/search/QuickSearchBar.tsx +125 -125
  192. package/src/components/search/QuickSearchResults.tsx +90 -90
  193. package/src/components/search/index.ts +5 -5
  194. package/src/components/search/styles.ts +96 -96
  195. package/src/components/search/types.ts +29 -29
  196. package/src/config/index.ts +10 -10
  197. package/src/helpers/cn.ts +6 -0
  198. package/src/helpers/components.ts +9 -9
  199. package/src/helpers/dates.ts +17 -17
  200. package/src/helpers/getScrollbarSize.ts +14 -14
  201. package/src/helpers/index.ts +8 -7
  202. package/src/helpers/numbers.ts +63 -63
  203. package/src/helpers/responsive.ts +83 -83
  204. package/src/helpers/styled/size.ts +24 -24
  205. package/src/helpers/styled/space.ts +111 -111
  206. package/src/helpers/styled/typography.ts +25 -25
  207. package/src/helpers/text.ts +13 -13
  208. package/src/helpers/types.ts +9 -9
  209. package/src/hooks/index.ts +9 -9
  210. package/src/hooks/providers.ts +14 -14
  211. package/src/hooks/useContainerMediaQuery.ts +7 -7
  212. package/src/hooks/useElementSize.ts +24 -24
  213. package/src/hooks/useMediaQuery.ts +9 -9
  214. package/src/hooks/useMediaQueryForWidth.ts +35 -35
  215. package/src/hooks/useMutableState.test.ts +410 -410
  216. package/src/hooks/useMutableState.ts +39 -39
  217. package/src/hooks/useShowArchived.ts +28 -28
  218. package/src/hooks/useWindowSize.ts +20 -20
  219. package/src/icons/index.tsx +138 -138
  220. package/src/providers/AuthenticationProvider/helpers.ts +3 -3
  221. package/src/providers/AuthenticationProvider/index.tsx +303 -303
  222. package/src/providers/LoadingProvider/index.tsx +47 -47
  223. package/src/providers/PortalsProvider/index.tsx +54 -54
  224. package/src/providers/PortalsProvider/styles.ts +31 -31
  225. package/src/providers/SettingsProvider/index.tsx +70 -70
  226. package/src/providers/ToastProvider/index.tsx +93 -93
  227. package/src/providers/TrackingProvider/hooks.ts +14 -14
  228. package/src/providers/TrackingProvider/index.tsx +71 -71
  229. package/src/providers/UiProviders/index.tsx +74 -74
  230. package/src/providers/UiProviders/styles.ts +10 -10
  231. package/src/providers/index.ts +6 -6
  232. package/src/services/HttpService.ts +92 -92
  233. package/src/services/WebSocketService.ts +155 -155
  234. package/src/services/advancedRequests.ts +102 -102
  235. package/src/services/base.ts +23 -23
  236. package/src/services/globalSearch.ts +32 -32
  237. package/src/services/hooks.ts +92 -92
  238. package/src/services/index.ts +20 -20
  239. package/src/services/requests/auth.ts +44 -44
  240. package/src/services/requests/generic.ts +76 -76
  241. package/src/services/requests/printing.ts +12 -12
  242. package/src/services/requests/tracking.ts +12 -12
  243. package/src/services/requests/userProfiles.ts +35 -35
  244. package/src/services/requests/users.ts +28 -28
  245. package/src/services/smartQueries.ts +122 -122
  246. package/src/services/sqlRequests.ts +119 -119
  247. package/src/services/types/auth.ts +98 -98
  248. package/src/services/types/base.ts +10 -10
  249. package/src/services/types/generic.ts +102 -102
  250. package/src/services/types/printing.ts +10 -10
  251. package/src/services/types/tracking.ts +29 -29
  252. package/src/services/types/userProfiles.ts +79 -79
  253. package/src/services/types/users.ts +74 -74
  254. package/src/services/updateSqlRequests.ts +32 -32
  255. package/src/styles/animations.scss +30 -30
  256. package/src/styles/index.scss +42 -42
  257. package/src/theme/ThemeProvider.ts +73 -73
  258. package/src/theme/defaultTheme.ts +471 -471
  259. package/src/theme/helpers.ts +89 -89
  260. package/src/theme/index.ts +4 -4
  261. package/src/theme/types.ts +139 -139
  262. package/src/types/index.ts +8 -8
  263. package/src/typings.d.ts +2 -2
  264. package/tsconfig.json +41 -41
  265. package/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,55 @@
1
+ import { default as React, ReactNode } from 'react';
2
+ type DropPosition = {
3
+ nodeId: string;
4
+ position: 'before' | 'after' | 'inside';
5
+ } | null;
6
+ export type DragDropType = 'none' | true | 'level';
7
+ interface TreeContextValue {
8
+ idPropertyName?: string;
9
+ childrenPropertyName?: string;
10
+ displayPropertyName?: string;
11
+ ItemComponent?: React.FC<{
12
+ item: any;
13
+ }>;
14
+ expandedIds: Set<string>;
15
+ toggleExpand: (id: string) => void;
16
+ isExpanded: (id: string) => boolean;
17
+ draggedNodeId: string | null;
18
+ draggedNodeLevel: number | null;
19
+ dropPosition: DropPosition;
20
+ dragDropType: DragDropType;
21
+ handleDragStart: (e: React.DragEvent, nodeId: string, content: string, level: number) => void;
22
+ handleDragOver: (e: React.DragEvent, nodeId: string, level: number, isLastChild: boolean, parentId: string | null, hasChildren: boolean) => void;
23
+ handleDragLeave: (e: React.DragEvent) => void;
24
+ handleDrop: (e: React.DragEvent) => void;
25
+ handleDragEnd: () => void;
26
+ handleDrag: (e: React.DragEvent) => void;
27
+ }
28
+ export declare function useTreeContext(): TreeContextValue;
29
+ interface TreeProviderProps {
30
+ children: ReactNode;
31
+ treeId: string;
32
+ items: any[];
33
+ idPropertyName?: string;
34
+ childrenPropertyName?: string;
35
+ displayPropertyName?: string;
36
+ ItemComponent?: React.FC<{
37
+ item: any;
38
+ }>;
39
+ defaultExpanded?: boolean;
40
+ dragDropType?: DragDropType;
41
+ onItemMove?: (draggedId: string, targetId: string, position: 'before' | 'after' | 'inside') => void;
42
+ onItemsChanged?: (items: any[]) => void;
43
+ dragGhost: {
44
+ x: number;
45
+ y: number;
46
+ content: string;
47
+ } | null;
48
+ setDragGhost: (ghost: {
49
+ x: number;
50
+ y: number;
51
+ content: string;
52
+ } | null) => void;
53
+ }
54
+ export declare function TreeProvider({ children, treeId, items, idPropertyName, childrenPropertyName, displayPropertyName, ItemComponent, dragDropType, onItemMove, onItemsChanged, dragGhost, setDragGhost, }: TreeProviderProps): import("react/jsx-runtime").JSX.Element;
55
+ export {};
@@ -0,0 +1,172 @@
1
+ import { jsx as G } from "react/jsx-runtime";
2
+ import { createContext as y, useState as Y, useCallback as s, useContext as nn } from "react";
3
+ const U = y(null);
4
+ function ln() {
5
+ const D = nn(U);
6
+ if (!D)
7
+ throw new Error("TreeNode must be used within TreeView");
8
+ return D;
9
+ }
10
+ function an({
11
+ children: D,
12
+ treeId: d,
13
+ items: Q,
14
+ idPropertyName: x,
15
+ childrenPropertyName: a,
16
+ displayPropertyName: W,
17
+ ItemComponent: q,
18
+ dragDropType: c = "none",
19
+ onItemMove: X,
20
+ onItemsChanged: L,
21
+ dragGhost: R,
22
+ setDragGhost: r
23
+ }) {
24
+ const [F, z] = Y(() => /* @__PURE__ */ new Set()), [u, C] = Y(null), [I, k] = Y(null), [A, l] = Y(null), H = s(
25
+ (n, e, t) => {
26
+ if (!L) return;
27
+ const f = structuredClone(Q), p = (o) => x && o[x] ? String(o[x]) : String(o), v = (o, h) => {
28
+ for (let S = 0; S < o.length; S++) {
29
+ const B = o[S];
30
+ if (p(B) === h)
31
+ return { node: B, parent: o, index: S };
32
+ if (a && B[a]) {
33
+ const j = v(
34
+ B[a],
35
+ h
36
+ );
37
+ if (j) return j;
38
+ }
39
+ }
40
+ return null;
41
+ }, g = v(f, n);
42
+ if (!g || !g.parent) return;
43
+ const {
44
+ node: T,
45
+ parent: b,
46
+ index: E
47
+ } = g;
48
+ b.splice(E, 1);
49
+ const i = v(f, e);
50
+ if (!i) return;
51
+ const {
52
+ node: w,
53
+ parent: O,
54
+ index: V
55
+ } = i;
56
+ if (t === "inside")
57
+ a && (w[a] || (w[a] = []), w[a].push(T));
58
+ else {
59
+ if (!O) return;
60
+ const o = t === "before" ? V : V + 1;
61
+ O.splice(o, 0, T);
62
+ }
63
+ L(f);
64
+ },
65
+ [Q, x, a, L]
66
+ ), J = s((n) => {
67
+ z((e) => {
68
+ const t = new Set(e);
69
+ return t.has(n) ? t.delete(n) : t.add(n), t;
70
+ });
71
+ }, []), K = s(
72
+ (n) => F.has(n),
73
+ [F]
74
+ ), M = s(
75
+ (n, e, t, f) => {
76
+ if (c === "none") {
77
+ n.preventDefault();
78
+ return;
79
+ }
80
+ C(e), k(f), n.dataTransfer.setData("text/plain", d), n.dataTransfer.setData("application/x-tree-id", d);
81
+ const p = new Image();
82
+ p.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=", n.dataTransfer.effectAllowed = "move", n.dataTransfer.setDragImage(p, 0, 0), r({ x: n.clientX, y: n.clientY, content: t });
83
+ },
84
+ [d, r, c]
85
+ ), Z = s(
86
+ (n, e, t, f, p, v) => {
87
+ n.preventDefault(), n.stopPropagation();
88
+ const g = n.dataTransfer.types.includes(
89
+ "application/x-tree-id"
90
+ ) ? n.dataTransfer.getData("application/x-tree-id") || n.dataTransfer.getData("text/plain") : null;
91
+ if (g && g !== d) {
92
+ l(null);
93
+ return;
94
+ }
95
+ if (u === e) {
96
+ l(null);
97
+ return;
98
+ }
99
+ if (u && e.startsWith(u + "-")) {
100
+ l(null);
101
+ return;
102
+ }
103
+ if (c === "level" && I !== null && I !== t) {
104
+ l(null);
105
+ return;
106
+ }
107
+ const T = n.currentTarget.getBoundingClientRect(), b = n.clientY - T.top, E = T.height;
108
+ let i;
109
+ if (v) {
110
+ const w = E * 0.4;
111
+ b < w ? i = "before" : i = "inside";
112
+ } else
113
+ b < E / 2 ? i = "before" : i = "after";
114
+ if (c === "level" && i === "inside") {
115
+ l(null);
116
+ return;
117
+ }
118
+ l({ nodeId: e, position: i });
119
+ },
120
+ [d, u, c, I]
121
+ ), _ = s((n) => {
122
+ n.preventDefault();
123
+ const e = n.relatedTarget;
124
+ (!e || !n.currentTarget.contains(e)) && l(null);
125
+ }, []), $ = s(
126
+ (n) => {
127
+ if (n.preventDefault(), n.stopPropagation(), (n.dataTransfer.getData("application/x-tree-id") || n.dataTransfer.getData("text/plain")) !== d) {
128
+ C(null), l(null), r(null);
129
+ return;
130
+ }
131
+ u && A && (X || H)(u, A.nodeId, A.position), C(null), l(null), r(null);
132
+ },
133
+ [
134
+ d,
135
+ u,
136
+ A,
137
+ X,
138
+ H,
139
+ r
140
+ ]
141
+ ), m = s(() => {
142
+ C(null), k(null), l(null), r(null);
143
+ }, [r]), P = s(
144
+ (n) => {
145
+ n.clientX === 0 && n.clientY === 0 || R && r({ ...R, x: n.clientX, y: n.clientY });
146
+ },
147
+ [R, r]
148
+ ), N = {
149
+ idPropertyName: x,
150
+ childrenPropertyName: a,
151
+ displayPropertyName: W,
152
+ ItemComponent: q,
153
+ expandedIds: F,
154
+ toggleExpand: J,
155
+ isExpanded: K,
156
+ draggedNodeId: u,
157
+ draggedNodeLevel: I,
158
+ dropPosition: A,
159
+ dragDropType: c,
160
+ handleDragStart: M,
161
+ handleDragOver: Z,
162
+ handleDragLeave: _,
163
+ handleDrop: $,
164
+ handleDragEnd: m,
165
+ handleDrag: P
166
+ };
167
+ return /* @__PURE__ */ G(U.Provider, { value: N, children: D });
168
+ }
169
+ export {
170
+ an as TreeProvider,
171
+ ln as useTreeContext
172
+ };
@@ -0,0 +1,19 @@
1
+ import { DragDropType } from './TreeContext';
2
+ import { FC, HTMLAttributes } from 'react';
3
+ export interface TreeViewProps<TItem> extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
4
+ items: TItem[];
5
+ idPropertyName?: keyof TItem & string;
6
+ childrenPropertyName?: keyof TItem & string;
7
+ itemComponent?: FC<{
8
+ item: TItem;
9
+ }>;
10
+ displayPropertyName?: keyof TItem & string;
11
+ defaultExpanded?: boolean;
12
+ dragDropType?: DragDropType;
13
+ onItemMove?: (draggedId: string, targetId: string, position: 'before' | 'after' | 'inside') => void;
14
+ onItemsChanged?: (items: TItem[]) => void;
15
+ }
16
+ export declare function TreeView<TItem>({ items, idPropertyName, childrenPropertyName, itemComponent: ItemComponent, displayPropertyName, defaultExpanded, dragDropType, onItemMove, onItemsChanged, className, ...props }: TreeViewProps<TItem>): import("react/jsx-runtime").JSX.Element;
17
+ export declare namespace TreeView {
18
+ var displayName: string;
19
+ }
@@ -0,0 +1,202 @@
1
+ import { jsxs as C, jsx as n } from "react/jsx-runtime";
2
+ import { TreeProvider as _, useTreeContext as B } from "./TreeContext.js";
3
+ import q, { useState as F } from "react";
4
+ import H from "../../../assets/icons/chevron-right.svg.js";
5
+ import { cn as u } from "../../../helpers/cn.js";
6
+ function J(r, e) {
7
+ if (!e) return [];
8
+ const t = r[e];
9
+ return Array.isArray(t) ? t : [];
10
+ }
11
+ function K(r, e) {
12
+ if (!e) return String(r);
13
+ const t = r[e];
14
+ return t != null ? String(t) : "";
15
+ }
16
+ function z(r, e, t) {
17
+ if (e) {
18
+ const o = r[e];
19
+ if (o != null) return String(o);
20
+ }
21
+ return t || String(r);
22
+ }
23
+ function E({
24
+ item: r,
25
+ id: e,
26
+ parentId: t,
27
+ level: o,
28
+ isLastChild: c,
29
+ verticalLines: f
30
+ }) {
31
+ const {
32
+ idPropertyName: m,
33
+ childrenPropertyName: b,
34
+ displayPropertyName: v,
35
+ ItemComponent: s,
36
+ isExpanded: D,
37
+ toggleExpand: a,
38
+ draggedNodeId: x,
39
+ dropPosition: i,
40
+ dragDropType: d,
41
+ handleDragStart: g,
42
+ handleDragOver: h,
43
+ handleDragLeave: y,
44
+ handleDrop: S,
45
+ handleDragEnd: P,
46
+ handleDrag: V
47
+ } = B(), N = J(r, b), p = N.length > 0, L = D(e), j = x === e, w = i?.nodeId === e, A = w && i?.position === "before", $ = w && i?.position === "after", G = w && i?.position === "inside", I = s ? /* @__PURE__ */ n(s, { item: r }) : K(r, v);
48
+ return /* @__PURE__ */ C("div", { className: o > 1 ? "ml-4" : "", children: [
49
+ /* @__PURE__ */ C(
50
+ "div",
51
+ {
52
+ draggable: d !== "none",
53
+ onDragStart: (l) => g(
54
+ l,
55
+ e,
56
+ typeof I == "string" ? I : String(r),
57
+ o
58
+ ),
59
+ onDragOver: (l) => h(l, e, o, c, t, p),
60
+ onDragLeave: y,
61
+ onDrop: S,
62
+ onDragEnd: P,
63
+ onDrag: V,
64
+ className: u(
65
+ "flex items-center gap-1 py-1.5 pr-theme-sm transition-colors pl-2",
66
+ "hover:bg-accent/50 text-foreground group",
67
+ "font-theme text-theme-sm relative",
68
+ d !== "none" && (j ? "opacity-40 cursor-grabbing" : "cursor-grab"),
69
+ G && "bg-accent/70 ring-2 ring-accent ring-inset"
70
+ ),
71
+ children: [
72
+ A && /* @__PURE__ */ n("div", { className: "absolute right-0 top-0 h-0.5 bg-primary z-20 left-4" }),
73
+ $ && /* @__PURE__ */ n("div", { className: "absolute right-0 bottom-0 h-0.5 bg-primary z-20 left-4" }),
74
+ o > 1 && /* @__PURE__ */ n(
75
+ "div",
76
+ {
77
+ className: u(
78
+ "absolute h-px bg-border/60 left-0 top-1/2",
79
+ p ? "w-2.5" : "w-6"
80
+ )
81
+ }
82
+ ),
83
+ p ? /* @__PURE__ */ n(
84
+ "button",
85
+ {
86
+ type: "button",
87
+ onClick: () => a(e),
88
+ className: "flex items-center justify-center w-5 h-5 hover:bg-accent/50 rounded transition-all shrink-0 relative z-10",
89
+ children: /* @__PURE__ */ n(
90
+ H,
91
+ {
92
+ className: u(
93
+ "w-3.5 h-3.5 text-muted-foreground transition-transform duration-200",
94
+ L && "rotate-90"
95
+ )
96
+ }
97
+ )
98
+ }
99
+ ) : /* @__PURE__ */ n("span", { className: "w-5 shrink-0" }),
100
+ /* @__PURE__ */ n("div", { className: "flex-1 min-w-0", children: s ? /* @__PURE__ */ n(s, { item: r }) : /* @__PURE__ */ n("span", { className: "truncate block", children: I }) })
101
+ ]
102
+ }
103
+ ),
104
+ p && L && /* @__PURE__ */ n("div", { className: "relative before:absolute before:w-px before:top-0 before:left-4 before:bottom-4 before:bg-border/60", children: N.map((l, T) => {
105
+ const k = z(l, m, `${e}-${T}`), O = T === N.length - 1, R = [
106
+ ...f,
107
+ c ? "none" : "line"
108
+ ];
109
+ return /* @__PURE__ */ n(
110
+ E,
111
+ {
112
+ item: l,
113
+ id: k,
114
+ parentId: e,
115
+ level: o + 1,
116
+ isLastChild: O,
117
+ verticalLines: R
118
+ },
119
+ k
120
+ );
121
+ }) })
122
+ ] });
123
+ }
124
+ function M({
125
+ items: r,
126
+ idPropertyName: e,
127
+ childrenPropertyName: t,
128
+ itemComponent: o,
129
+ displayPropertyName: c,
130
+ defaultExpanded: f = !1,
131
+ dragDropType: m = "none",
132
+ onItemMove: b,
133
+ onItemsChanged: v,
134
+ className: s,
135
+ ...D
136
+ }) {
137
+ const [a, x] = F(null), i = q.useId();
138
+ return /* @__PURE__ */ C(
139
+ _,
140
+ {
141
+ treeId: i,
142
+ items: r,
143
+ idPropertyName: e,
144
+ childrenPropertyName: t,
145
+ displayPropertyName: c,
146
+ ItemComponent: o,
147
+ defaultExpanded: f,
148
+ dragDropType: m,
149
+ onItemMove: b,
150
+ onItemsChanged: v,
151
+ dragGhost: a,
152
+ setDragGhost: x,
153
+ children: [
154
+ /* @__PURE__ */ n(
155
+ "div",
156
+ {
157
+ className: u(
158
+ "border border-border bg-card overflow-hidden",
159
+ "py-theme-xs rounded-theme-md",
160
+ s
161
+ ),
162
+ ...D,
163
+ children: r.map((d, g) => {
164
+ const h = z(
165
+ d,
166
+ e,
167
+ `${g}`
168
+ ), y = g === r.length - 1;
169
+ return /* @__PURE__ */ n(
170
+ E,
171
+ {
172
+ item: d,
173
+ id: h,
174
+ parentId: null,
175
+ level: 1,
176
+ isLastChild: y,
177
+ verticalLines: ["none"]
178
+ },
179
+ h
180
+ );
181
+ })
182
+ }
183
+ ),
184
+ a && /* @__PURE__ */ n(
185
+ "div",
186
+ {
187
+ className: "fixed pointer-events-none z-50 bg-card border border-border rounded px-3 py-1.5 shadow-lg opacity-70",
188
+ style: {
189
+ left: a.x + 10,
190
+ top: a.y + 10
191
+ },
192
+ children: /* @__PURE__ */ n("span", { className: "text-sm text-foreground", children: a.content })
193
+ }
194
+ )
195
+ ]
196
+ }
197
+ );
198
+ }
199
+ M.displayName = "TreeView";
200
+ export {
201
+ M as TreeView
202
+ };
@@ -0,0 +1,3 @@
1
+ export { TreeView } from './TreeView';
2
+ export type { TreeViewProps } from './TreeView';
3
+ export { TreeProvider, useTreeContext } from './TreeContext';
@@ -1,7 +1,10 @@
1
+ export * from './Accordion';
1
2
  export * from './Avatar';
2
3
  export * from './Card';
3
4
  export * from './ContextMenu';
4
5
  export * from './Ellipsis';
5
6
  export * from './Label';
6
7
  export * from './Message';
8
+ export * from './PropertiesList';
7
9
  export * from './TabsView';
10
+ export * from './TreeView';
@@ -1,20 +1,29 @@
1
- import { Avatar as o } from "./Avatar/index.js";
2
- import { Card as a } from "./Card/index.js";
3
- import { ContextMenu as p, ParentMenuItem as x } from "./ContextMenu/index.js";
4
- import { Ellipsis as s } from "./Ellipsis.js";
5
- import { Label as b, StyledLabel as i } from "./Label.js";
1
+ import { Accordion as o } from "./Accordion/Accordion.js";
2
+ import { Avatar as p } from "./Avatar/index.js";
3
+ import { Card as m } from "./Card/index.js";
4
+ import { ContextMenu as s, ParentMenuItem as a } from "./ContextMenu/index.js";
5
+ import { Ellipsis as n } from "./Ellipsis.js";
6
+ import { Label as T, StyledLabel as b } from "./Label.js";
6
7
  import { Message as L } from "./Message/index.js";
7
- import { TabsView as d } from "./TabsView/TabsView.js";
8
- import { TabsList as C } from "./TabsView/TabsList.js";
8
+ import { PropertiesList as C } from "./PropertiesList/index.js";
9
+ import { TabsView as P } from "./TabsView/TabsView.js";
10
+ import { TabsList as v } from "./TabsView/TabsList.js";
11
+ import { TreeView as A } from "./TreeView/TreeView.js";
12
+ import { TreeProvider as g, useTreeContext as y } from "./TreeView/TreeContext.js";
9
13
  export {
10
- o as Avatar,
11
- a as Card,
12
- p as ContextMenu,
13
- s as Ellipsis,
14
- b as Label,
14
+ o as Accordion,
15
+ p as Avatar,
16
+ m as Card,
17
+ s as ContextMenu,
18
+ n as Ellipsis,
19
+ T as Label,
15
20
  L as Message,
16
- x as ParentMenuItem,
17
- i as StyledLabel,
18
- C as TabsList,
19
- d as TabsView
21
+ a as ParentMenuItem,
22
+ C as PropertiesList,
23
+ b as StyledLabel,
24
+ v as TabsList,
25
+ P as TabsView,
26
+ g as TreeProvider,
27
+ A as TreeView,
28
+ y as useTreeContext
20
29
  };
@@ -1,57 +1,58 @@
1
- import { jsx as f } from "react/jsx-runtime";
1
+ import { jsx as $ } from "react/jsx-runtime";
2
2
  import { DataGridCell as S } from "./styles.js";
3
- import { useMemo as A, useCallback as R } from "react";
4
- import { DataGridEditableCell as c } from "./DataGridEditableCell/index.js";
3
+ import { useMemo as c, useCallback as A } from "react";
4
+ import { DataGridEditableCell as R } from "./DataGridEditableCell/index.js";
5
5
  import { useDataGridContext as j } from "./hooks/index.js";
6
- const v = (e) => e ? String(e) : "", z = ({
6
+ const v = (e) => e ? String(e) : "", B = ({
7
7
  row: e,
8
8
  rowIndex: i,
9
- columnKey: D,
9
+ columnKey: b,
10
10
  columnIndex: a,
11
11
  column: t,
12
12
  context: s,
13
- style: b
13
+ style: f
14
14
  }) => {
15
15
  const {
16
- name: o,
16
+ name: D,
17
17
  editable: g,
18
- editingCell: C = [-1, -1],
19
- setEditingCell: p,
18
+ editingCell: o = [-1, -1],
19
+ setEditingCell: C,
20
20
  onRowDoubleClick: d,
21
- userSelect: $,
22
- headerColor: n
23
- } = j(s), r = !!g && "editable" in t && !!t.editable && !!t.editComponent, G = r && C[0] === i && C[1] === a, E = t.component ?? S, h = A(() => t.getter(e), [t, e]), k = R(
24
- (l) => {
25
- l.stopPropagation(), l.preventDefault(), r ? p([i, a]) : d?.(e, l);
21
+ userSelect: p,
22
+ headerColor: G
23
+ } = j(s), l = !!g && "editable" in t && !!t.editable && !!t.editComponent, E = l && o[0] === i && o[1] === a, h = t.component ?? S, k = c(() => t.getter(e), [t, e]), n = A(
24
+ (r) => {
25
+ r.stopPropagation(), r.preventDefault(), l ? C([i, a]) : d?.(e, r);
26
26
  },
27
- [a, r, d, e, i, p]
27
+ [a, l, d, e, i, C]
28
28
  );
29
- return G ? /* @__PURE__ */ f(
30
- c,
29
+ return E ? /* @__PURE__ */ $(
30
+ R,
31
31
  {
32
32
  row: e,
33
33
  rowIndex: i,
34
- columnKey: D,
34
+ columnKey: b,
35
35
  columnIndex: a,
36
36
  column: t,
37
37
  context: s,
38
- userSelect: $
38
+ userSelect: p
39
39
  },
40
- `${o}-${i}-${a}`
41
- ) : /* @__PURE__ */ f(
42
- E,
40
+ `editable-cell-${i}-${a}`
41
+ ) : /* @__PURE__ */ $(
42
+ h,
43
43
  {
44
- onDoubleClick: k,
45
- style: b,
46
- $userSelect: $,
44
+ "data-testid": `cell-${i}-${a}`,
45
+ onDoubleClick: n,
46
+ style: f,
47
+ $userSelect: p,
47
48
  $color: t.color,
48
49
  $textAlign: t.textAlign,
49
- $headerColor: n,
50
- children: (t.render ?? v)(h, e, t)
50
+ $headerColor: G,
51
+ children: (t.render ?? v)(k, e, t)
51
52
  },
52
- `${o}-${i}-${a}`
53
+ `${D}-${i}-${a}`
53
54
  );
54
55
  };
55
56
  export {
56
- z as DataGridCell
57
+ B as DataGridCell
57
58
  };
@@ -1,2 +1,2 @@
1
1
  import { EditableDataGridCellProps } from '../types';
2
- export declare const DataGridEditableCell: <R, T>({ row, columnKey, column, context, }: EditableDataGridCellProps<R, T>) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const DataGridEditableCell: <R, T>({ row, columnKey, column, context, rowIndex, columnIndex, }: EditableDataGridCellProps<R, T>) => import("react/jsx-runtime").JSX.Element;