@layers-app/shared 0.2.5 → 0.2.7

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 (183) hide show
  1. package/dist/assets/svg/flags/es.svg.js +4 -0
  2. package/dist/assets/svg/flags/ru.svg.js +4 -0
  3. package/dist/assets/svg/flags/us.svg.js +4 -0
  4. package/dist/assets/svg/globeIcon.svg.js +5 -0
  5. package/dist/assets/svg/socials/github.svg.js +5 -0
  6. package/dist/assets/svg/socials/instagram.svg.js +5 -0
  7. package/dist/assets/svg/socials/x.svg.js +5 -0
  8. package/dist/assets/svg/socials/youtube.svg.js +5 -0
  9. package/dist/components/AppContainer/components/AppSidebarButton.d.ts +1 -1
  10. package/dist/components/AppContainer/components/AppSidebarButton.d.ts.map +1 -1
  11. package/dist/components/AppContainer/components/AppSidebarButton.js +4 -4
  12. package/dist/components/AppContainer/components/AppsSidebar/AppsSection.js +22 -22
  13. package/dist/components/AppContainer/components/AppsSidebar/TopSection.d.ts.map +1 -1
  14. package/dist/components/AppContainer/components/AppsSidebar/TopSection.js +25 -25
  15. package/dist/components/AppContainer/components/AppsSidebar/UserSection.d.ts.map +1 -1
  16. package/dist/components/AppContainer/components/AppsSidebar/UserSection.js +40 -40
  17. package/dist/components/AppContainer/components/menus/HelpMenu/HelpMenu.js +1 -1
  18. package/dist/components/AppContainer/hooks/useAppContainer.d.ts +1 -1
  19. package/dist/components/AppContainer/hooks/useAppContainer.d.ts.map +1 -1
  20. package/dist/components/AppContainer/hooks/useAppContainer.js +49 -43
  21. package/dist/components/AppContainer/hooks/useAppContainerDataStore.d.ts.map +1 -1
  22. package/dist/components/AppContainer/hooks/useAppContainerDataStore.js +4 -2
  23. package/dist/components/AppContainer/types.d.ts +2 -0
  24. package/dist/components/AppContainer/types.d.ts.map +1 -1
  25. package/dist/components/AttachmentsGalleryModal/components/ShakePlayer/ShakaPlayer.d.ts.map +1 -1
  26. package/dist/components/FilePicker/FilePicker.d.ts +33 -2
  27. package/dist/components/FilePicker/FilePicker.d.ts.map +1 -1
  28. package/dist/components/FilePicker/FilePicker.js +161 -110
  29. package/dist/components/FilePicker/FilePicker.module.css.js +9 -7
  30. package/dist/components/FilePicker/FilePickerGoogleDrive.d.ts +22 -0
  31. package/dist/components/FilePicker/FilePickerGoogleDrive.d.ts.map +1 -0
  32. package/dist/components/FilePicker/FilePickerGoogleDrive.js +86 -0
  33. package/dist/components/FilePicker/FilePickerUnsplash.d.ts.map +1 -1
  34. package/dist/components/FilePicker/FilePickerUnsplash.js +69 -52
  35. package/dist/components/FormViewer/components/OneSlideLayput.js +39 -37
  36. package/dist/components/FormViewer/hooks/useCreateFormContext.d.ts.map +1 -1
  37. package/dist/components/FormViewer/hooks/useCreateFormContext.js +10 -10
  38. package/dist/components/FormViewer/hooks/useFormGlobalTheme.js +15 -15
  39. package/dist/components/FormViewer/hooks/useInterpolateText.js +3 -3
  40. package/dist/components/FormViewer/store/formStore.js +3 -3
  41. package/dist/components/FormViewer/store/formStoreApi.js +13 -13
  42. package/dist/components/FormViewer/store/selectors.js +1 -1
  43. package/dist/components/GroupAvatar/index.d.ts +1 -0
  44. package/dist/components/GroupAvatar/index.d.ts.map +1 -1
  45. package/dist/components/GroupAvatar/index.js +9 -8
  46. package/dist/components/ImageCropper/ImageCropper.d.ts +19 -0
  47. package/dist/components/ImageCropper/ImageCropper.d.ts.map +1 -0
  48. package/dist/components/ImageCropper/ImageCropper.js +358 -0
  49. package/dist/components/ImageCropper/ImageCropper.module.css.js +51 -0
  50. package/dist/components/ImageCropper/cropUtils.d.ts +22 -0
  51. package/dist/components/ImageCropper/cropUtils.d.ts.map +1 -0
  52. package/dist/components/ImageCropper/cropUtils.js +42 -0
  53. package/dist/components/ImageCropper/index.d.ts +4 -0
  54. package/dist/components/ImageCropper/index.d.ts.map +1 -0
  55. package/dist/components/ImageCropper/useCropInteraction.d.ts +28 -0
  56. package/dist/components/ImageCropper/useCropInteraction.d.ts.map +1 -0
  57. package/dist/components/ImageCropper/useCropInteraction.js +76 -0
  58. package/dist/components/IntegrationFlowAnimation/IntegrationFlowAnimation.d.ts +21 -0
  59. package/dist/components/IntegrationFlowAnimation/IntegrationFlowAnimation.d.ts.map +1 -0
  60. package/dist/components/IntegrationFlowAnimation/IntegrationFlowAnimation.js +73 -0
  61. package/dist/components/IntegrationFlowAnimation/IntegrationFlowAnimation.module.css.js +19 -0
  62. package/dist/components/IntegrationFlowAnimation/icons/GoogleDriveIcon.d.ts +6 -0
  63. package/dist/components/IntegrationFlowAnimation/icons/GoogleDriveIcon.d.ts.map +1 -0
  64. package/dist/components/IntegrationFlowAnimation/icons/GoogleDriveIcon.js +60 -0
  65. package/dist/components/IntegrationFlowAnimation/icons/LayersCubeIcon.d.ts +6 -0
  66. package/dist/components/IntegrationFlowAnimation/icons/LayersCubeIcon.d.ts.map +1 -0
  67. package/dist/components/IntegrationFlowAnimation/icons/LayersCubeIcon.js +21 -0
  68. package/dist/components/IntegrationFlowAnimation/icons/NotionIcon.d.ts +6 -0
  69. package/dist/components/IntegrationFlowAnimation/icons/NotionIcon.d.ts.map +1 -0
  70. package/dist/components/IntegrationFlowAnimation/icons/NotionIcon.js +35 -0
  71. package/dist/components/IntegrationFlowAnimation/icons/index.d.ts +4 -0
  72. package/dist/components/IntegrationFlowAnimation/icons/index.d.ts.map +1 -0
  73. package/dist/components/IntegrationFlowAnimation/index.d.ts +5 -0
  74. package/dist/components/IntegrationFlowAnimation/index.d.ts.map +1 -0
  75. package/dist/components/LanguagePicker/LanguagePicker.d.ts +2 -1
  76. package/dist/components/LanguagePicker/LanguagePicker.d.ts.map +1 -1
  77. package/dist/components/LanguagePicker/LanguagePicker.js +44 -31
  78. package/dist/components/LanguagePicker/LanguagePicker.module.css.js +6 -4
  79. package/dist/components/MediaLibrary/MediaLibrary.d.ts +3 -0
  80. package/dist/components/MediaLibrary/MediaLibrary.d.ts.map +1 -0
  81. package/dist/components/MediaLibrary/MediaLibrary.js +93 -0
  82. package/dist/components/MediaLibrary/MediaLibrary.module.css.js +17 -0
  83. package/dist/components/MediaLibrary/MediaLibraryBreadcrumbs.d.ts +8 -0
  84. package/dist/components/MediaLibrary/MediaLibraryBreadcrumbs.d.ts.map +1 -0
  85. package/dist/components/MediaLibrary/MediaLibraryBreadcrumbs.js +22 -0
  86. package/dist/components/MediaLibrary/MediaLibraryBrowser.d.ts +12 -0
  87. package/dist/components/MediaLibrary/MediaLibraryBrowser.d.ts.map +1 -0
  88. package/dist/components/MediaLibrary/MediaLibraryBrowser.js +52 -0
  89. package/dist/components/MediaLibrary/MediaLibraryRow.d.ts +9 -0
  90. package/dist/components/MediaLibrary/MediaLibraryRow.d.ts.map +1 -0
  91. package/dist/components/MediaLibrary/MediaLibraryRow.js +29 -0
  92. package/dist/components/MediaLibrary/index.d.ts +4 -0
  93. package/dist/components/MediaLibrary/index.d.ts.map +1 -0
  94. package/dist/components/MediaLibrary/types.d.ts +31 -0
  95. package/dist/components/MediaLibrary/types.d.ts.map +1 -0
  96. package/dist/components/NavMenu/components/NavMenuItem.d.ts.map +1 -1
  97. package/dist/components/NavMenu/components/NavMenuItem.js +53 -50
  98. package/dist/components/NavMenu/types.d.ts +1 -0
  99. package/dist/components/NavMenu/types.d.ts.map +1 -1
  100. package/dist/components/NoData/NoData.d.ts +6 -1
  101. package/dist/components/NoData/NoData.d.ts.map +1 -1
  102. package/dist/components/NoData/NoData.js +85 -82
  103. package/dist/components/SettingsSection/index.d.ts +12 -0
  104. package/dist/components/SettingsSection/index.d.ts.map +1 -0
  105. package/dist/components/SettingsSection/index.js +36 -0
  106. package/dist/components/SettingsSection/styles.module.css.js +7 -0
  107. package/dist/components/SocialLinkRow/index.d.ts +11 -0
  108. package/dist/components/SocialLinkRow/index.d.ts.map +1 -0
  109. package/dist/components/SocialLinkRow/index.js +131 -0
  110. package/dist/components/SortableList/components/SortableItem/SortableItem.js +3 -3
  111. package/dist/components/StorageUsageProgress/index.js +26 -24
  112. package/dist/components/TimezonePicker/index.d.ts +9 -0
  113. package/dist/components/TimezonePicker/index.d.ts.map +1 -0
  114. package/dist/components/TimezonePicker/index.js +91 -0
  115. package/dist/components/UserAvatar/index.d.ts.map +1 -1
  116. package/dist/components/UserAvatar/index.js +11 -10
  117. package/dist/components/WorkspaceMenu/WorkspaceItem.d.ts.map +1 -1
  118. package/dist/components/WorkspaceMenu/WorkspaceItem.js +18 -17
  119. package/dist/components/WorkspaceMenu/WorkspaceMenu.d.ts.map +1 -1
  120. package/dist/components/WorkspaceMenu/WorkspaceMenu.js +70 -69
  121. package/dist/components/modals/RemoveConfirmModal.js +1 -1
  122. package/dist/components/table/components/TableHeaders.js +3 -3
  123. package/dist/components/table/components/TablePanel.js +1 -1
  124. package/dist/components/table/helpers/columns.js +3 -3
  125. package/dist/components/table/hooks/TableProvider.js +3 -3
  126. package/dist/components/table/selectors.js +6 -6
  127. package/dist/helpers/getFileType.d.ts +1 -2
  128. package/dist/helpers/getFileType.d.ts.map +1 -1
  129. package/dist/helpers/getFileType.js +5 -6
  130. package/dist/helpers/showFeatureFeedback.d.ts +16 -0
  131. package/dist/helpers/showFeatureFeedback.d.ts.map +1 -0
  132. package/dist/helpers/showFeatureFeedback.js +109 -0
  133. package/dist/helpers/showFeatureFeedback.module.css.js +9 -0
  134. package/dist/helpers/showNotifications.d.ts +14 -3
  135. package/dist/helpers/showNotifications.d.ts.map +1 -1
  136. package/dist/helpers/showNotifications.js +120 -61
  137. package/dist/helpers/showNotifications.module.css.js +29 -0
  138. package/dist/helpers/timezones.d.ts +12 -0
  139. package/dist/helpers/timezones.d.ts.map +1 -0
  140. package/dist/helpers/timezones.js +59 -0
  141. package/dist/hooks/useFeatureFeedback.d.ts +23 -0
  142. package/dist/hooks/useFeatureFeedback.d.ts.map +1 -0
  143. package/dist/hooks/useFeatureFeedback.js +48 -0
  144. package/dist/hooks/useNumberQueryParam.js +3 -3
  145. package/dist/hooks/useVideoUploadGuard.d.ts +2 -0
  146. package/dist/hooks/useVideoUploadGuard.d.ts.map +1 -0
  147. package/dist/hooks/useVideoUploadGuard.js +24 -0
  148. package/dist/index.css +1 -1
  149. package/dist/index.d.ts +13 -1
  150. package/dist/index.d.ts.map +1 -1
  151. package/dist/index.js +461 -406
  152. package/dist/lang/locales/ui_en.json.js +24 -22
  153. package/dist/lang/locales/ui_es.json.js +20 -18
  154. package/dist/lang/locales/ui_ru.json.js +20 -18
  155. package/dist/lib/contentImport/index.d.ts +4 -0
  156. package/dist/lib/contentImport/index.d.ts.map +1 -0
  157. package/dist/lib/contentImport/lexicalSerializer.d.ts +19 -0
  158. package/dist/lib/contentImport/lexicalSerializer.d.ts.map +1 -0
  159. package/dist/lib/contentImport/lexicalSerializer.js +215 -0
  160. package/dist/lib/contentImport/types.d.ts +161 -0
  161. package/dist/lib/contentImport/types.d.ts.map +1 -0
  162. package/dist/lib/contentImport/utils.d.ts +35 -0
  163. package/dist/lib/contentImport/utils.d.ts.map +1 -0
  164. package/dist/lib/contentImport/utils.js +145 -0
  165. package/dist/lib/layersVisitData.d.ts +13 -0
  166. package/dist/lib/layersVisitData.d.ts.map +1 -0
  167. package/dist/lib/layersVisitData.js +37 -0
  168. package/dist/node_modules/countries-and-timezones/esm/index.js +4031 -0
  169. package/dist/store/plansModal.d.ts.map +1 -1
  170. package/dist/store/plansModal.js +8 -7
  171. package/dist/utils/formatStorage.d.ts +7 -1
  172. package/dist/utils/formatStorage.d.ts.map +1 -1
  173. package/dist/utils/formatStorage.js +10 -5
  174. package/dist/utils/getCroppedBlob.d.ts +3 -0
  175. package/dist/utils/getCroppedBlob.d.ts.map +1 -0
  176. package/dist/utils/getCroppedBlob.js +21 -0
  177. package/package.json +1 -1
  178. package/dist/assets/images/flags/es.svg.js +0 -4
  179. package/dist/assets/images/flags/ru.svg.js +0 -4
  180. package/dist/assets/images/flags/us.svg.js +0 -4
  181. package/dist/components/PaymentSuccess/PaymentSuccess.d.ts +0 -2
  182. package/dist/components/PaymentSuccess/PaymentSuccess.d.ts.map +0 -1
  183. package/dist/components/PaymentSuccess/PaymentSuccess.js +0 -41
@@ -0,0 +1,19 @@
1
+ export interface ImageCropperProps {
2
+ src: string;
3
+ variant?: 'square' | 'rounded';
4
+ aspectRatio?: number;
5
+ minSize?: number;
6
+ maxSize?: number;
7
+ onCropComplete?: (croppedImage: Blob) => void;
8
+ onCropDataChange?: (data: CropData) => void;
9
+ }
10
+ export interface CropData {
11
+ x: number;
12
+ y: number;
13
+ width: number;
14
+ height: number;
15
+ scale: number;
16
+ }
17
+ export declare const ImageCropper: ({ src, variant, aspectRatio, minSize, maxSize, onCropComplete, onCropDataChange, }: ImageCropperProps) => import("react/jsx-runtime").JSX.Element;
18
+ export default ImageCropper;
19
+ //# sourceMappingURL=ImageCropper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageCropper.d.ts","sourceRoot":"","sources":["../../../src/components/ImageCropper/ImageCropper.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,CAAC,YAAY,EAAE,IAAI,KAAK,IAAI,CAAC;IAC9C,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;CAC7C;AAED,MAAM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AASD,eAAO,MAAM,YAAY,GAAI,oFAQ1B,iBAAiB,4CAujBnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,358 @@
1
+ import { jsxs as b, jsx as a, Fragment as O } from "react/jsx-runtime";
2
+ import { useRef as ne, useState as H, useMemo as ce, useEffect as j, useCallback as G } from "react";
3
+ import { Box as oe } from "@mantine/core";
4
+ import { useElementSize as ae } from "@mantine/hooks";
5
+ import h from "./ImageCropper.module.css.js";
6
+ const fe = ({
7
+ src: ie,
8
+ variant: I = "square",
9
+ aspectRatio: o = 1,
10
+ minSize: m = 50,
11
+ maxSize: X,
12
+ onCropComplete: J,
13
+ onCropDataChange: K
14
+ }) => {
15
+ const {
16
+ ref: he,
17
+ width: v,
18
+ height: M
19
+ } = ae(), W = ne(null), Q = ne(null), [Y, se] = H(!1), [f, de] = H({ width: 0, height: 0 }), r = ce(() => {
20
+ if (!Y || v === 0 || M === 0 || f.width === 0)
21
+ return { x: 0, y: 0, width: v, height: M };
22
+ const n = v / M, i = f.width / f.height;
23
+ if (i > n) {
24
+ const s = v / i;
25
+ return {
26
+ x: 0,
27
+ y: (M - s) / 2,
28
+ width: v,
29
+ height: s
30
+ };
31
+ } else {
32
+ const s = M * i;
33
+ return {
34
+ x: (v - s) / 2,
35
+ y: 0,
36
+ width: s,
37
+ height: M
38
+ };
39
+ }
40
+ }, [Y, v, M, f]), [t, U] = H({
41
+ x: 0,
42
+ y: 0,
43
+ width: 200,
44
+ height: 200
45
+ }), [P, Z] = H(!1), [T, _] = H(!1), [l, S] = H(null), [V, R] = H({ x: 0, y: 0 }), [e, z] = H({
46
+ x: 0,
47
+ y: 0,
48
+ width: 0,
49
+ height: 0
50
+ });
51
+ j(() => {
52
+ if (!Y || v === 0 || M === 0 || r.width === 0)
53
+ return;
54
+ let n, i, s = Math.min(r.width, r.height) * 0.8;
55
+ X && (s = Math.min(s, X)), o >= 1 ? (n = s, i = s / o) : (i = s, n = s * o);
56
+ const u = r.x + (r.width - n) / 2, k = r.y + (r.height - i) / 2;
57
+ U({ x: u, y: k, width: n, height: i });
58
+ }, [
59
+ Y,
60
+ o,
61
+ v,
62
+ M,
63
+ r,
64
+ X
65
+ ]);
66
+ const re = G(() => {
67
+ W.current && (de({
68
+ width: W.current.naturalWidth,
69
+ height: W.current.naturalHeight
70
+ }), se(!0));
71
+ }, []), ee = G(
72
+ (n) => {
73
+ n.preventDefault(), n.stopPropagation();
74
+ const i = "touches" in n ? n.touches[0].clientX : n.clientX, s = "touches" in n ? n.touches[0].clientY : n.clientY;
75
+ Z(!0), R({ x: i, y: s }), z({ ...t });
76
+ },
77
+ [t]
78
+ ), q = G(
79
+ (n) => (i) => {
80
+ i.preventDefault(), i.stopPropagation();
81
+ const s = "touches" in i ? i.touches[0].clientX : i.clientX, u = "touches" in i ? i.touches[0].clientY : i.clientY;
82
+ _(!0), S(n), R({ x: s, y: u }), z({ ...t });
83
+ },
84
+ [t]
85
+ );
86
+ j(() => {
87
+ const n = (s) => {
88
+ if (!P && !T) return;
89
+ const u = "touches" in s ? s.touches[0].clientX : s.clientX, k = "touches" in s ? s.touches[0].clientY : s.clientY, y = u - V.x, D = k - V.y, B = r.x, L = r.y, N = r.x + r.width, A = r.y + r.height;
90
+ if (P) {
91
+ let g = e.x + y, w = e.y + D;
92
+ g = Math.max(B, Math.min(g, N - t.width)), w = Math.max(L, Math.min(w, A - t.height)), U((d) => ({ ...d, x: g, y: w }));
93
+ }
94
+ if (T && l) {
95
+ let g = e.x, w = e.y, d = e.width, c = e.height;
96
+ switch (l) {
97
+ case "se":
98
+ d = Math.max(m, e.width + y), c = d / o;
99
+ break;
100
+ case "sw":
101
+ d = Math.max(m, e.width - y), c = d / o, g = e.x + e.width - d;
102
+ break;
103
+ case "ne":
104
+ d = Math.max(m, e.width + y), c = d / o, w = e.y + e.height - c;
105
+ break;
106
+ case "nw":
107
+ d = Math.max(m, e.width - y), c = d / o, g = e.x + e.width - d, w = e.y + e.height - c;
108
+ break;
109
+ case "e":
110
+ d = Math.max(m, e.width + y), c = d / o, w = e.y + (e.height - c) / 2;
111
+ break;
112
+ case "w":
113
+ d = Math.max(m, e.width - y), c = d / o, g = e.x + e.width - d, w = e.y + (e.height - c) / 2;
114
+ break;
115
+ case "s":
116
+ c = Math.max(m, e.height + D), d = c * o, g = e.x + (e.width - d) / 2;
117
+ break;
118
+ case "n":
119
+ c = Math.max(m, e.height - D), d = c * o, g = e.x + (e.width - d) / 2, w = e.y + e.height - c;
120
+ break;
121
+ }
122
+ const p = l.includes("w") ? e.x + e.width : l.includes("e") ? e.x : e.x + e.width / 2, $ = l.includes("n") ? e.y + e.height : l.includes("s") ? e.y : e.y + e.height / 2;
123
+ let x, E;
124
+ l.includes("w") ? x = p - B : l.includes("e") ? x = N - p : x = Math.min(p - B, N - p) * 2, l.includes("n") ? E = $ - L : l.includes("s") ? E = A - $ : E = Math.min($ - L, A - $) * 2, X && (o >= 1 ? x = Math.min(x, X) : E = Math.min(E, X)), x / o < E ? E = x / o : x = E * o, d > x && (d = x, c = d / o), l.includes("w") ? g = p - d : l.includes("e") ? g = p : g = p - d / 2, l.includes("n") ? w = $ - c : l.includes("s") ? w = $ : w = $ - c / 2, d >= m && c >= m && U({ x: g, y: w, width: d, height: c });
125
+ }
126
+ }, i = () => {
127
+ Z(!1), _(!1), S(null);
128
+ };
129
+ return (P || T) && (window.addEventListener("mousemove", n), window.addEventListener("mouseup", i), window.addEventListener("touchmove", n), window.addEventListener("touchend", i)), () => {
130
+ window.removeEventListener("mousemove", n), window.removeEventListener("mouseup", i), window.removeEventListener("touchmove", n), window.removeEventListener("touchend", i);
131
+ };
132
+ }, [
133
+ P,
134
+ T,
135
+ l,
136
+ V,
137
+ e,
138
+ r,
139
+ t.width,
140
+ t.height,
141
+ o,
142
+ m,
143
+ X
144
+ ]), j(() => {
145
+ if (K && Y && r.width > 0) {
146
+ const n = f.width / r.width, i = f.height / r.height;
147
+ K({
148
+ x: (t.x - r.x) * n,
149
+ y: (t.y - r.y) * i,
150
+ width: t.width * n,
151
+ height: t.height * i,
152
+ scale: n
153
+ });
154
+ }
155
+ }, [t, f, r, Y, K]);
156
+ const te = G(() => new Promise((n, i) => {
157
+ if (!W.current || !Q.current) {
158
+ i(new Error("Image or canvas not ready"));
159
+ return;
160
+ }
161
+ const s = Q.current, u = s.getContext("2d");
162
+ if (!u) {
163
+ i(new Error("Could not get canvas context"));
164
+ return;
165
+ }
166
+ const k = f.width / r.width, y = f.height / r.height, D = (t.x - r.x) * k, B = (t.y - r.y) * y, L = t.width * k, N = t.height * y;
167
+ s.width = L, s.height = N, I === "rounded" && (u.beginPath(), u.arc(
168
+ L / 2,
169
+ N / 2,
170
+ Math.min(L, N) / 2,
171
+ 0,
172
+ Math.PI * 2
173
+ ), u.closePath(), u.clip()), u.drawImage(
174
+ W.current,
175
+ D,
176
+ B,
177
+ L,
178
+ N,
179
+ 0,
180
+ 0,
181
+ L,
182
+ N
183
+ ), s.toBlob(
184
+ (A) => {
185
+ A ? n(A) : i(new Error("Failed to create blob"));
186
+ },
187
+ "image/png",
188
+ 1
189
+ );
190
+ }), [t, f, r, I]);
191
+ j(() => {
192
+ J && te().then(J).catch(() => {
193
+ });
194
+ }, [te, J]);
195
+ const C = (n) => {
196
+ const i = {
197
+ nw: h.handleNW,
198
+ ne: h.handleNE,
199
+ sw: h.handleSW,
200
+ se: h.handleSE
201
+ };
202
+ return /* @__PURE__ */ b(
203
+ "div",
204
+ {
205
+ className: `${h.cornerHandle} ${i[n]}`,
206
+ onMouseDown: q(n),
207
+ onTouchStart: q(n),
208
+ children: [
209
+ /* @__PURE__ */ a("div", { className: h.cornerHandleArm, "data-direction": "horizontal" }),
210
+ /* @__PURE__ */ a("div", { className: h.cornerHandleArm, "data-direction": "vertical" })
211
+ ]
212
+ }
213
+ );
214
+ }, F = (n) => {
215
+ const i = {
216
+ n: h.handleN,
217
+ s: h.handleS,
218
+ e: h.handleE,
219
+ w: h.handleW
220
+ };
221
+ return /* @__PURE__ */ a(
222
+ "div",
223
+ {
224
+ className: `${h.edgeHandle} ${i[n]}`,
225
+ onMouseDown: q(n),
226
+ onTouchStart: q(n),
227
+ children: /* @__PURE__ */ a("div", { className: h.edgeHandleBar })
228
+ }
229
+ );
230
+ };
231
+ return /* @__PURE__ */ b(oe, { className: h.container, ref: he, children: [
232
+ /* @__PURE__ */ a("canvas", { ref: Q, style: { display: "none" } }),
233
+ /* @__PURE__ */ a(
234
+ "img",
235
+ {
236
+ ref: W,
237
+ src: ie,
238
+ alt: "Crop preview",
239
+ className: h.image,
240
+ onLoad: re,
241
+ draggable: !1
242
+ }
243
+ ),
244
+ Y && /* @__PURE__ */ b(O, { children: [
245
+ I === "square" ? /* @__PURE__ */ b(O, { children: [
246
+ /* @__PURE__ */ a(
247
+ "div",
248
+ {
249
+ className: h.overlay,
250
+ style: {
251
+ top: 0,
252
+ left: 0,
253
+ right: 0,
254
+ height: t.y
255
+ }
256
+ }
257
+ ),
258
+ /* @__PURE__ */ a(
259
+ "div",
260
+ {
261
+ className: h.overlay,
262
+ style: {
263
+ top: t.y + t.height,
264
+ left: 0,
265
+ right: 0,
266
+ bottom: 0
267
+ }
268
+ }
269
+ ),
270
+ /* @__PURE__ */ a(
271
+ "div",
272
+ {
273
+ className: h.overlay,
274
+ style: {
275
+ top: t.y,
276
+ left: 0,
277
+ width: t.x,
278
+ height: t.height
279
+ }
280
+ }
281
+ ),
282
+ /* @__PURE__ */ a(
283
+ "div",
284
+ {
285
+ className: h.overlay,
286
+ style: {
287
+ top: t.y,
288
+ left: t.x + t.width,
289
+ right: 0,
290
+ height: t.height
291
+ }
292
+ }
293
+ )
294
+ ] }) : /* @__PURE__ */ a(
295
+ "div",
296
+ {
297
+ className: h.circularOverlay,
298
+ style: {
299
+ left: t.x + t.width / 2,
300
+ top: t.y + t.height / 2,
301
+ width: t.width - 4,
302
+ height: t.height - 4
303
+ }
304
+ }
305
+ ),
306
+ /* @__PURE__ */ b(
307
+ "div",
308
+ {
309
+ className: `${h.cropArea} ${I === "rounded" ? h.cropAreaRounded : ""}`,
310
+ style: {
311
+ left: t.x,
312
+ top: t.y,
313
+ width: t.width,
314
+ height: t.height
315
+ },
316
+ onMouseDown: ee,
317
+ onTouchStart: ee,
318
+ children: [
319
+ I === "square" ? /* @__PURE__ */ a("div", { className: h.dashedBorder }) : /* @__PURE__ */ b(O, { children: [
320
+ /* @__PURE__ */ a("div", { className: `${h.edgeLine} ${h.edgeLineTop}` }),
321
+ /* @__PURE__ */ a(
322
+ "div",
323
+ {
324
+ className: `${h.edgeLine} ${h.edgeLineBottom}`
325
+ }
326
+ ),
327
+ /* @__PURE__ */ a(
328
+ "div",
329
+ {
330
+ className: `${h.edgeLine} ${h.edgeLineLeft}`
331
+ }
332
+ ),
333
+ /* @__PURE__ */ a(
334
+ "div",
335
+ {
336
+ className: `${h.edgeLine} ${h.edgeLineRight}`
337
+ }
338
+ )
339
+ ] }),
340
+ C("nw"),
341
+ C("ne"),
342
+ C("sw"),
343
+ C("se"),
344
+ I === "square" && /* @__PURE__ */ b(O, { children: [
345
+ F("n"),
346
+ F("s"),
347
+ F("e"),
348
+ F("w")
349
+ ] })
350
+ ]
351
+ }
352
+ )
353
+ ] })
354
+ ] });
355
+ };
356
+ export {
357
+ fe as ImageCropper
358
+ };
@@ -0,0 +1,51 @@
1
+ const e = "_container_z996o_1", n = "_image_z996o_12", o = "_overlay_z996o_19", _ = "_circularOverlay_z996o_25", d = "_cropArea_z996o_33", a = "_dashedBorder_z996o_39", l = "_edgeLine_z996o_46", r = "_edgeLineTop_z996o_52", c = "_edgeLineBottom_z996o_60", t = "_edgeLineLeft_z996o_68", s = "_edgeLineRight_z996o_76", h = "_cornerHandle_z996o_84", g = "_cornerHandleArm_z996o_92", i = "_handleNW_z996o_107", z = "_handleNE_z996o_123", L = "_handleSW_z996o_139", H = "_handleSE_z996o_156", m = "_edgeHandle_z996o_172", B = "_edgeHandleBar_z996o_181", E = "_handleN_z996o_107", N = "_handleS_z996o_139", S = "_handleE_z996o_213", W = "_handleW_z996o_227", p = {
2
+ container: e,
3
+ image: n,
4
+ overlay: o,
5
+ circularOverlay: _,
6
+ cropArea: d,
7
+ dashedBorder: a,
8
+ edgeLine: l,
9
+ edgeLineTop: r,
10
+ edgeLineBottom: c,
11
+ edgeLineLeft: t,
12
+ edgeLineRight: s,
13
+ cornerHandle: h,
14
+ cornerHandleArm: g,
15
+ handleNW: i,
16
+ handleNE: z,
17
+ handleSW: L,
18
+ handleSE: H,
19
+ edgeHandle: m,
20
+ edgeHandleBar: B,
21
+ handleN: E,
22
+ handleS: N,
23
+ handleE: S,
24
+ handleW: W
25
+ };
26
+ export {
27
+ _ as circularOverlay,
28
+ e as container,
29
+ h as cornerHandle,
30
+ g as cornerHandleArm,
31
+ d as cropArea,
32
+ a as dashedBorder,
33
+ p as default,
34
+ m as edgeHandle,
35
+ B as edgeHandleBar,
36
+ l as edgeLine,
37
+ c as edgeLineBottom,
38
+ t as edgeLineLeft,
39
+ s as edgeLineRight,
40
+ r as edgeLineTop,
41
+ S as handleE,
42
+ E as handleN,
43
+ z as handleNE,
44
+ i as handleNW,
45
+ N as handleS,
46
+ H as handleSE,
47
+ L as handleSW,
48
+ W as handleW,
49
+ n as image,
50
+ o as overlay
51
+ };
@@ -0,0 +1,22 @@
1
+ export interface CropBounds {
2
+ x: number;
3
+ y: number;
4
+ width: number;
5
+ height: number;
6
+ }
7
+ export type CropShape = 'square' | 'rounded';
8
+ export interface CropImageOptions {
9
+ image: HTMLImageElement;
10
+ bounds: CropBounds;
11
+ shape: CropShape;
12
+ outputWidth?: number;
13
+ outputHeight?: number;
14
+ quality?: number;
15
+ mimeType?: 'image/png' | 'image/jpeg' | 'image/webp';
16
+ }
17
+ export declare const cropImage: ({ image, bounds, shape, outputWidth, outputHeight, quality, mimeType, }: CropImageOptions) => Promise<Blob>;
18
+ export declare const blobToBase64: (blob: Blob) => Promise<string>;
19
+ export declare const scaleCropBounds: (cropBounds: CropBounds, containerWidth: number, containerHeight: number, imageWidth: number, imageHeight: number) => CropBounds;
20
+ export declare const getInitialCropBounds: (containerWidth: number, containerHeight: number, aspectRatio: number, sizePercent?: number) => CropBounds;
21
+ export declare const constrainCropBounds: (bounds: CropBounds, containerWidth: number, containerHeight: number, minSize: number) => CropBounds;
22
+ //# sourceMappingURL=cropUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cropUtils.d.ts","sourceRoot":"","sources":["../../../src/components/ImageCropper/cropUtils.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE7C,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,gBAAgB,CAAC;IACxB,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,WAAW,GAAG,YAAY,GAAG,YAAY,CAAC;CACtD;AAED,eAAO,MAAM,SAAS,GAAU,yEAQ7B,gBAAgB,KAAG,OAAO,CAAC,IAAI,CAuDjC,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,MAAM,IAAI,KAAG,OAAO,CAAC,MAAM,CAavD,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,YAAY,UAAU,EACtB,gBAAgB,MAAM,EACtB,iBAAiB,MAAM,EACvB,YAAY,MAAM,EAClB,aAAa,MAAM,KAClB,UAUF,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,gBAAgB,MAAM,EACtB,iBAAiB,MAAM,EACvB,aAAa,MAAM,EACnB,oBAAiB,KAChB,UAkBF,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,QAAQ,UAAU,EAClB,gBAAgB,MAAM,EACtB,iBAAiB,MAAM,EACvB,SAAS,MAAM,KACd,UAiBF,CAAC"}
@@ -0,0 +1,42 @@
1
+ const d = async ({
2
+ image: h,
3
+ bounds: t,
4
+ shape: o,
5
+ outputWidth: g,
6
+ outputHeight: l,
7
+ quality: m = 1,
8
+ mimeType: s = "image/png"
9
+ }) => new Promise((w, c) => {
10
+ const a = document.createElement("canvas"), e = a.getContext("2d");
11
+ if (!e) {
12
+ c(new Error("Could not get canvas context"));
13
+ return;
14
+ }
15
+ const n = g ?? t.width, i = l ?? t.height;
16
+ a.width = n, a.height = i, o === "rounded" && (e.beginPath(), e.arc(
17
+ n / 2,
18
+ i / 2,
19
+ Math.min(n, i) / 2,
20
+ 0,
21
+ Math.PI * 2
22
+ ), e.closePath(), e.clip()), e.drawImage(
23
+ h,
24
+ t.x,
25
+ t.y,
26
+ t.width,
27
+ t.height,
28
+ 0,
29
+ 0,
30
+ n,
31
+ i
32
+ ), a.toBlob(
33
+ (r) => {
34
+ r ? w(r) : c(new Error("Failed to create blob"));
35
+ },
36
+ s,
37
+ m
38
+ );
39
+ });
40
+ export {
41
+ d as cropImage
42
+ };
@@ -0,0 +1,4 @@
1
+ export { ImageCropper, type ImageCropperProps, type CropData } from './ImageCropper';
2
+ export { useCropInteraction } from './useCropInteraction';
3
+ export { cropImage } from './cropUtils';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ImageCropper/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,28 @@
1
+ interface CropBounds {
2
+ x: number;
3
+ y: number;
4
+ width: number;
5
+ height: number;
6
+ }
7
+ interface ContainerSize {
8
+ width: number;
9
+ height: number;
10
+ }
11
+ type ResizeHandle = 'nw' | 'ne' | 'sw' | 'se' | null;
12
+ interface UseCropInteractionOptions {
13
+ initialCrop: CropBounds;
14
+ containerSize: ContainerSize;
15
+ aspectRatio: number;
16
+ minSize: number;
17
+ onCropChange: (crop: CropBounds) => void;
18
+ }
19
+ interface UseCropInteractionReturn {
20
+ isDragging: boolean;
21
+ isResizing: boolean;
22
+ activeHandle: ResizeHandle;
23
+ handleCropMouseDown: (e: React.MouseEvent | React.TouchEvent) => void;
24
+ handleResizeMouseDown: (handle: Exclude<ResizeHandle, null>) => (e: React.MouseEvent | React.TouchEvent) => void;
25
+ }
26
+ export declare const useCropInteraction: ({ initialCrop, containerSize, aspectRatio, minSize, onCropChange, }: UseCropInteractionOptions) => UseCropInteractionReturn;
27
+ export {};
28
+ //# sourceMappingURL=useCropInteraction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCropInteraction.d.ts","sourceRoot":"","sources":["../../../src/components/ImageCropper/useCropInteraction.ts"],"names":[],"mappings":"AAOA,UAAU,UAAU;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,KAAK,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAErD,UAAU,yBAAyB;IACjC,WAAW,EAAE,UAAU,CAAC;IACxB,aAAa,EAAE,aAAa,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;CAC1C;AAED,UAAU,wBAAwB;IAChC,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,YAAY,CAAC;IAC3B,mBAAmB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACtE,qBAAqB,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;CAClH;AAED,eAAO,MAAM,kBAAkB,GAAI,qEAMhC,yBAAyB,KAAG,wBAwJ9B,CAAC"}
@@ -0,0 +1,76 @@
1
+ import { useState as g, useCallback as D, useEffect as P } from "react";
2
+ const W = ({
3
+ initialCrop: u,
4
+ containerSize: l,
5
+ aspectRatio: d,
6
+ minSize: w,
7
+ onCropChange: x
8
+ }) => {
9
+ const [r, Y] = g(!1), [a, M] = g(!1), [f, y] = g(null), [m, E] = g({ x: 0, y: 0 }), [t, L] = g(u), b = D(
10
+ (n) => {
11
+ n.preventDefault(), n.stopPropagation();
12
+ const s = "touches" in n ? n.touches[0].clientX : n.clientX, i = "touches" in n ? n.touches[0].clientY : n.clientY;
13
+ Y(!0), E({ x: s, y: i }), L(u);
14
+ },
15
+ [u]
16
+ ), k = D(
17
+ (n) => (s) => {
18
+ s.preventDefault(), s.stopPropagation();
19
+ const i = "touches" in s ? s.touches[0].clientX : s.clientX, X = "touches" in s ? s.touches[0].clientY : s.clientY;
20
+ M(!0), y(n), E({ x: i, y: X }), L(u);
21
+ },
22
+ [u]
23
+ );
24
+ return P(() => {
25
+ const n = (i) => {
26
+ if (!r && !a) return;
27
+ const X = "touches" in i ? i.touches[0].clientX : i.clientX, H = "touches" in i ? i.touches[0].clientY : i.clientY, v = X - m.x, I = H - m.y;
28
+ if (r) {
29
+ let o = t.x + v, c = t.y + I;
30
+ o = Math.max(0, Math.min(o, l.width - t.width)), c = Math.max(0, Math.min(c, l.height - t.height)), x({ ...t, x: o, y: c });
31
+ }
32
+ if (a && f) {
33
+ let o = t.x, c = t.y, e = t.width, h = t.height;
34
+ switch (f) {
35
+ case "se":
36
+ e = Math.max(w, t.width + v), h = e / d;
37
+ break;
38
+ case "sw":
39
+ e = Math.max(w, t.width - v), h = e / d, o = t.x + t.width - e;
40
+ break;
41
+ case "ne":
42
+ e = Math.max(w, t.width + v), h = e / d, c = t.y + t.height - h;
43
+ break;
44
+ case "nw":
45
+ e = Math.max(w, t.width - v), h = e / d, o = t.x + t.width - e, c = t.y + t.height - h;
46
+ break;
47
+ }
48
+ o < 0 && (e += o, h = e / d, o = 0), c < 0 && (h += c, e = h * d, c = 0), o + e > l.width && (e = l.width - o, h = e / d), c + h > l.height && (h = l.height - c, e = h * d), e >= w && h >= w && x({ x: o, y: c, width: e, height: h });
49
+ }
50
+ }, s = () => {
51
+ Y(!1), M(!1), y(null);
52
+ };
53
+ return (r || a) && (window.addEventListener("mousemove", n), window.addEventListener("mouseup", s), window.addEventListener("touchmove", n), window.addEventListener("touchend", s)), () => {
54
+ window.removeEventListener("mousemove", n), window.removeEventListener("mouseup", s), window.removeEventListener("touchmove", n), window.removeEventListener("touchend", s);
55
+ };
56
+ }, [
57
+ r,
58
+ a,
59
+ f,
60
+ m,
61
+ t,
62
+ l,
63
+ d,
64
+ w,
65
+ x
66
+ ]), {
67
+ isDragging: r,
68
+ isResizing: a,
69
+ activeHandle: f,
70
+ handleCropMouseDown: b,
71
+ handleResizeMouseDown: k
72
+ };
73
+ };
74
+ export {
75
+ W as useCropInteraction
76
+ };
@@ -0,0 +1,21 @@
1
+ import { type ReactNode } from 'react';
2
+ export interface IntegrationFlowAnimationProps {
3
+ /** Icon component to display on the left (source) */
4
+ leftIcon: ReactNode;
5
+ /** Icon component to display on the right (destination) */
6
+ rightIcon: ReactNode;
7
+ /** Height of the component */
8
+ height?: number | string;
9
+ /** Number of particles to animate */
10
+ particleCount?: number;
11
+ /** Custom colors for particles (defaults to blue, green, yellow-orange distribution) */
12
+ colors?: string[];
13
+ /** Background image URL */
14
+ backgroundImage?: string;
15
+ }
16
+ /**
17
+ * A reusable animation component showing data flow between two integration icons.
18
+ * Displays animated particles flowing from left icon to right icon.
19
+ */
20
+ export declare const IntegrationFlowAnimation: ({ leftIcon, rightIcon, height, particleCount, colors, backgroundImage, }: IntegrationFlowAnimationProps) => ReactNode;
21
+ //# sourceMappingURL=IntegrationFlowAnimation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntegrationFlowAnimation.d.ts","sourceRoot":"","sources":["../../../src/components/IntegrationFlowAnimation/IntegrationFlowAnimation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAiD1D,MAAM,WAAW,6BAA6B;IAC5C,qDAAqD;IACrD,QAAQ,EAAE,SAAS,CAAC;IACpB,2DAA2D;IAC3D,SAAS,EAAE,SAAS,CAAC;IACrB,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,qCAAqC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wFAAwF;IACxF,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,2BAA2B;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GAAI,0EAOtC,6BAA6B,KAAG,SAqElC,CAAC"}