@layers-app/shared 0.3.0 → 0.3.2

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 (142) hide show
  1. package/dist/assets/default-workspace-avatar.jpg.js +4 -0
  2. package/dist/assets/layers-logo-full.svg.js +2 -3
  3. package/dist/assets/layers-logo-full.svg2.js +3 -2
  4. package/dist/assets/layers-logo-icon.svg.js +2 -3
  5. package/dist/assets/layers-logo-icon.svg2.js +3 -2
  6. package/dist/assets/projects/figureA.svg.js +4 -0
  7. package/dist/assets/projects/figureB.svg.js +4 -0
  8. package/dist/assets/qwebchannel.d.ts +15 -0
  9. package/dist/assets/qwebchannel.d.ts.map +1 -0
  10. package/dist/assets/taskPriorities/high.svg.js +5 -0
  11. package/dist/assets/taskPriorities/low.svg.js +5 -0
  12. package/dist/assets/taskPriorities/none.svg.js +5 -0
  13. package/dist/assets/taskPriorities/normal.svg.js +5 -0
  14. package/dist/assets/taskPriorities/urgent.svg.js +5 -0
  15. package/dist/components/AnimatedFigurePage/AnimatedFigurePage.d.ts +3 -0
  16. package/dist/components/AnimatedFigurePage/AnimatedFigurePage.d.ts.map +1 -0
  17. package/dist/components/AnimatedFigurePage/AnimatedFigurePage.js +69 -0
  18. package/dist/components/AnimatedFigurePage/AnimatedFigurePage.module.css.js +27 -0
  19. package/dist/components/AnimatedFigurePage/types.d.ts +15 -0
  20. package/dist/components/AnimatedFigurePage/types.d.ts.map +1 -0
  21. package/dist/components/AnimatedFigurePage/useParallax.d.ts +6 -0
  22. package/dist/components/AnimatedFigurePage/useParallax.d.ts.map +1 -0
  23. package/dist/components/AnimatedFigurePage/useParallax.js +29 -0
  24. package/dist/components/AppContainer/AppContainer.d.ts +1 -1
  25. package/dist/components/AppContainer/AppContainer.d.ts.map +1 -1
  26. package/dist/components/AppContainer/AppContainer.js +37 -36
  27. package/dist/components/AppContainer/components/AppsSidebar/UserSection.d.ts.map +1 -1
  28. package/dist/components/AppContainer/components/AppsSidebar/UserSection.js +80 -45
  29. package/dist/components/AppContainer/components/menus/HelpMenu/HelpMenu.d.ts.map +1 -1
  30. package/dist/components/AppContainer/components/menus/HelpMenu/HelpMenu.js +60 -69
  31. package/dist/components/AppContainer/hooks/useAppContainer.d.ts +1 -1
  32. package/dist/components/AppContainer/hooks/useAppContainer.d.ts.map +1 -1
  33. package/dist/components/AppContainer/hooks/useAppContainer.js +57 -51
  34. package/dist/components/AppContainer/hooks/useAppContainerDataStore.d.ts.map +1 -1
  35. package/dist/components/AppContainer/hooks/useAppContainerDataStore.js +3 -1
  36. package/dist/components/AppContainer/types.d.ts +3 -0
  37. package/dist/components/AppContainer/types.d.ts.map +1 -1
  38. package/dist/components/ColorPicker/ColorPicker.d.ts +9 -1
  39. package/dist/components/ColorPicker/ColorPicker.d.ts.map +1 -1
  40. package/dist/components/ColorPicker/ColorPicker.js +88 -74
  41. package/dist/components/ColorPicker/ColorPicker.module.css.js +31 -0
  42. package/dist/components/ColorPicker/ColorPickerList.d.ts +6 -0
  43. package/dist/components/ColorPicker/ColorPickerList.d.ts.map +1 -0
  44. package/dist/components/ColorPicker/ColorPickerList.js +134 -0
  45. package/dist/components/ColorPicker/ColorPickerPopover.d.ts +6 -6
  46. package/dist/components/ColorPicker/ColorPickerPopover.d.ts.map +1 -1
  47. package/dist/components/ColorPicker/ColorPickerPopover.js +29 -31
  48. package/dist/components/ColorPicker/ColorPickerToolbar.d.ts +13 -0
  49. package/dist/components/ColorPicker/ColorPickerToolbar.d.ts.map +1 -0
  50. package/dist/components/ColorPicker/ColorPickerToolbar.js +132 -0
  51. package/dist/components/ColorPicker/icons.d.ts +11 -0
  52. package/dist/components/ColorPicker/icons.d.ts.map +1 -0
  53. package/dist/components/ColorPicker/icons.js +71 -0
  54. package/dist/components/ColorPicker/types.d.ts +49 -0
  55. package/dist/components/ColorPicker/types.d.ts.map +1 -0
  56. package/dist/components/ColorPicker/types.js +10 -0
  57. package/dist/components/ColorPicker/useRecentColors.d.ts +13 -0
  58. package/dist/components/ColorPicker/useRecentColors.d.ts.map +1 -0
  59. package/dist/components/ColorPicker/useRecentColors.js +39 -0
  60. package/dist/components/CommentComposer/index.d.ts.map +1 -1
  61. package/dist/components/CommentComposer/index.js +115 -111
  62. package/dist/components/EmojiPicker/EmojiPanel.d.ts.map +1 -1
  63. package/dist/components/EmojiPicker/EmojiPanel.js +12 -10
  64. package/dist/components/EmojiPicker/EmojiPicker.d.ts +3 -1
  65. package/dist/components/EmojiPicker/EmojiPicker.d.ts.map +1 -1
  66. package/dist/components/EmojiPicker/EmojiPicker.js +49 -46
  67. package/dist/components/EmojiPicker/IconsPanel.d.ts +2 -1
  68. package/dist/components/EmojiPicker/IconsPanel.d.ts.map +1 -1
  69. package/dist/components/EmojiPicker/IconsPanel.js +47 -45
  70. package/dist/components/EmojiPicker/custom-icons/customIcons.d.ts.map +1 -1
  71. package/dist/components/EmojiPicker/custom-icons/customIcons.js +66 -31
  72. package/dist/components/EntityIcon.d.ts +3 -3
  73. package/dist/components/EntityIcon.d.ts.map +1 -1
  74. package/dist/components/EntityIcon.js +59 -35
  75. package/dist/components/EntityTitle/EntityTitle.d.ts +1 -1
  76. package/dist/components/EntityTitle/EntityTitle.d.ts.map +1 -1
  77. package/dist/components/EntityTitle/EntityTitle.js +34 -34
  78. package/dist/components/EntityTitle/EntityTitle.module.css.js +1 -1
  79. package/dist/components/FilePicker/FilePicker.d.ts.map +1 -1
  80. package/dist/components/FilePicker/FilePicker.js +111 -123
  81. package/dist/components/FilePicker/FilePickerUpload.d.ts.map +1 -1
  82. package/dist/components/FilePicker/FilePickerUpload.js +41 -39
  83. package/dist/components/FormViewer/components/fields/UploadField/UploadField.d.ts.map +1 -1
  84. package/dist/components/FormViewer/components/fields/UploadField/UploadField.js +34 -33
  85. package/dist/components/FormViewer/hooks/useFormGlobalTheme.d.ts +3 -3
  86. package/dist/components/Logotype.d.ts +2 -1
  87. package/dist/components/Logotype.d.ts.map +1 -1
  88. package/dist/components/Logotype.js +58 -49
  89. package/dist/components/NavMenu/components/NavMenuItem.d.ts.map +1 -1
  90. package/dist/components/NavMenu/components/NavMenuItem.js +122 -107
  91. package/dist/components/NavMenu/types.d.ts +1 -0
  92. package/dist/components/NavMenu/types.d.ts.map +1 -1
  93. package/dist/components/ProjectIcon/ProjectIcon.js +13 -13
  94. package/dist/components/TreeIndent/TreeIndent.d.ts +9 -0
  95. package/dist/components/TreeIndent/TreeIndent.d.ts.map +1 -0
  96. package/dist/components/TreeIndent/TreeIndent.js +15 -0
  97. package/dist/components/TreeIndent/TreeIndent.module.css.js +11 -0
  98. package/dist/components/TreeIndent/index.d.ts +2 -0
  99. package/dist/components/TreeIndent/index.d.ts.map +1 -0
  100. package/dist/components/WorkspaceAvatar/WorkspaceAvatar.js +11 -11
  101. package/dist/components/WorkspaceMenu/WorkspaceMenu.d.ts.map +1 -1
  102. package/dist/components/WorkspaceMenu/WorkspaceMenu.js +97 -101
  103. package/dist/components/modals/RemoveConfirmModal.d.ts.map +1 -1
  104. package/dist/config/brand.d.ts +1 -0
  105. package/dist/config/brand.d.ts.map +1 -1
  106. package/dist/config/brand.js +42 -34
  107. package/dist/config/envConfig.d.ts +40 -0
  108. package/dist/config/envConfig.d.ts.map +1 -1
  109. package/dist/config/envConfig.js +29 -10
  110. package/dist/constants.d.ts.map +1 -1
  111. package/dist/constants.js +15 -4
  112. package/dist/helpers/getFileIcons.d.ts.map +1 -1
  113. package/dist/helpers/getFileIcons.js +34 -29
  114. package/dist/helpers/getFileType.d.ts +1 -1
  115. package/dist/helpers/getFileType.d.ts.map +1 -1
  116. package/dist/helpers/getFileType.js +3 -3
  117. package/dist/helpers/hotjar.d.ts.map +1 -1
  118. package/dist/helpers/hotjar.js +11 -7
  119. package/dist/helpers/platform.js +4 -4
  120. package/dist/helpers/showNotifications.d.ts +3 -0
  121. package/dist/helpers/showNotifications.d.ts.map +1 -1
  122. package/dist/helpers/showNotifications.js +79 -44
  123. package/dist/hooks/useDateFnsLocale.d.ts +2 -0
  124. package/dist/hooks/useDateFnsLocale.d.ts.map +1 -1
  125. package/dist/hooks/useDateFnsLocale.js +9 -8
  126. package/dist/hooks/useDateUtils.d.ts.map +1 -1
  127. package/dist/hooks/useDateUtils.js +19 -19
  128. package/dist/hooks/useFormatDistance.d.ts.map +1 -1
  129. package/dist/hooks/useFormatDistance.js +6 -6
  130. package/dist/hooks/useNumberQueryParam.d.ts +1 -1
  131. package/dist/hooks/useNumberQueryParam.d.ts.map +1 -1
  132. package/dist/index.css +1 -1
  133. package/dist/index.d.ts +8 -0
  134. package/dist/index.d.ts.map +1 -1
  135. package/dist/index.js +516 -494
  136. package/dist/lang/locales/ui_en.json.js +7 -7
  137. package/dist/lang/locales/ui_es.json.js +1 -1
  138. package/dist/lang/locales/ui_ru.json.js +11 -11
  139. package/dist/utils/formatStorage.d.ts +9 -0
  140. package/dist/utils/formatStorage.d.ts.map +1 -1
  141. package/dist/utils/formatStorage.js +14 -10
  142. package/package.json +1 -1
@@ -1,21 +1,21 @@
1
- import { jsx as e, jsxs as t } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as c } from "react/jsx-runtime";
2
2
  import { useState as x, useMemo as y } from "react";
3
- import { useTranslation as Q } from "react-i18next";
3
+ import { useTranslation as J } from "react-i18next";
4
4
  import { ImageAdd02Icon as F } from "@hugeicons/core-free-icons";
5
- import { HugeiconsIcon as M } from "@hugeicons/react";
6
- import { Flex as a, ActionIcon as W, Button as P, Text as X, Popover as m, Tabs as g, Stack as Y } from "@mantine/core";
5
+ import { HugeiconsIcon as P } from "@hugeicons/react";
6
+ import { Flex as a, ActionIcon as K, Button as M, Text as Q, Popover as u, Tabs as f, Stack as W } from "@mantine/core";
7
7
  import { getEnvConfig as S } from "../../config/envConfig.js";
8
- import { isFeature as I } from "../../helpers/feature.js";
9
- import { useMenu as Z } from "../../hooks/useMenu.js";
10
- import { usePlatform as $ } from "../../hooks/usePlatform.js";
11
- import { MediaLibraryBrowser as D } from "../MediaLibrary/MediaLibraryBrowser.js";
12
- import { FilePickerGallery as w } from "./FilePickerGallery.js";
8
+ import { isFeature as X } from "../../helpers/feature.js";
9
+ import { useMenu as Y } from "../../hooks/useMenu.js";
10
+ import { usePlatform as Z } from "../../hooks/usePlatform.js";
11
+ import { MediaLibraryBrowser as $ } from "../MediaLibrary/MediaLibraryBrowser.js";
12
+ import { FilePickerGallery as D } from "./FilePickerGallery.js";
13
13
  import { FilePickerGiphy as ee } from "./FilePickerGiphy.js";
14
- import { FilePickerGoogleDrive as le } from "./FilePickerGoogleDrive.js";
14
+ import { FilePickerGoogleDrive as ne } from "./FilePickerGoogleDrive.js";
15
15
  import { FilePickerLink as ie } from "./FilePickerLink.js";
16
- import { FilePickerUnsplash as ne } from "./FilePickerUnsplash.js";
16
+ import { FilePickerUnsplash as le } from "./FilePickerUnsplash.js";
17
17
  import { FilePickerUpload as ae } from "./FilePickerUpload.js";
18
- import z from "./FilePicker.module.css.js";
18
+ import I from "./FilePicker.module.css.js";
19
19
  const re = [
20
20
  "gallery",
21
21
  "upload",
@@ -25,127 +25,115 @@ const re = [
25
25
  "googleDrive",
26
26
  "media"
27
27
  ], Se = ({
28
- onChange: G,
29
- onRemove: V,
30
- onUpload: u,
31
- uploading: B = !1,
32
- showTabs: r = re,
33
- children: E,
34
- width: j = 610,
35
- position: A = "bottom-end",
36
- readOnly: L = !1,
37
- hasImage: N,
28
+ onChange: z,
29
+ onRemove: B,
30
+ onUpload: m,
31
+ uploading: E = !1,
32
+ showTabs: s = re,
33
+ children: G,
34
+ width: T = 610,
35
+ position: V = "bottom-end",
36
+ readOnly: j = !1,
37
+ hasImage: L,
38
38
  giphyToken: se,
39
39
  unsplashClientId: oe,
40
- type: f = "image",
40
+ type: g = "image",
41
41
  galleryCollection: d = [],
42
- isValidMediaUrl: T,
43
- popoverProps: U,
44
- dropZoneProps: _,
45
- targetProps: H,
46
- onOpenedChange: O,
42
+ isValidMediaUrl: A,
43
+ popoverProps: N,
44
+ dropZoneProps: U,
45
+ targetProps: _,
46
+ onOpenedChange: H,
47
47
  googleDrive: i,
48
- mediaLibrary: s
48
+ mediaLibrary: r
49
49
  }) => {
50
- const { t: n } = Q("ui"), [v, h] = x(!1), { isMobile: b } = Z(), C = $(), p = y(
50
+ const { t: l } = J("ui"), [v, p] = x(!1), { isMobile: b } = Y(), k = Z(), h = y(
51
51
  () => [
52
52
  {
53
53
  value: "gallery",
54
- label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: n("changeCover.gallery") }) }),
55
- visible: r.includes("gallery") && !!d.length
54
+ label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: l("changeCover.gallery") }) }),
55
+ visible: s.includes("gallery") && !!d.length
56
56
  },
57
57
  {
58
58
  value: "upload",
59
- label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: n("changeCover.upload") }) }),
60
- visible: r.includes("upload") && !!u
59
+ label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: l("changeCover.upload") }) }),
60
+ visible: s.includes("upload") && !!m
61
61
  },
62
62
  {
63
63
  value: "link",
64
- label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: n("changeCover.link") }) }),
65
- visible: r.includes("link")
64
+ label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: l("changeCover.link") }) }),
65
+ visible: s.includes("link")
66
66
  },
67
67
  {
68
68
  value: "unsplash",
69
- label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: n("changeCover.searchImages") }) }),
70
- visible: r.includes("unsplash") && S().media?.unsplashEnabled !== !1
69
+ label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: l("changeCover.searchImages") }) }),
70
+ visible: s.includes("unsplash") && S().media?.unsplashEnabled !== !1
71
71
  },
72
72
  {
73
73
  value: "giphy",
74
74
  label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: "GIFs" }) }),
75
- visible: r.includes("giphy") && C.has("giphy") && S().media?.giphyEnabled !== !1
75
+ visible: s.includes("giphy") && k.has("giphy") && S().media?.giphyEnabled !== !1
76
76
  },
77
77
  {
78
78
  value: "googleDrive",
79
- label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: n("changeCover.googleDrive", {
79
+ label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: l("changeCover.googleDrive", {
80
80
  defaultValue: "Google Drive"
81
81
  }) }) }),
82
- visible: r.includes("googleDrive") && !!i
82
+ visible: s.includes("googleDrive") && !!i
83
83
  },
84
84
  {
85
85
  value: "media",
86
- label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: n("changeCover.media", { defaultValue: "Media" }) }) }),
87
- visible: r.includes("media") && !!s && I()
88
- },
89
- {
90
- value: "googleDrive",
91
- label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: n("changeCover.googleDrive", {
92
- defaultValue: "Google Drive"
93
- }) }) }),
94
- visible: r.includes("googleDrive") && !!i
95
- },
96
- {
97
- value: "media",
98
- label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: n("changeCover.media", { defaultValue: "Media" }) }) }),
99
- visible: r.includes("media") && !!s && I()
86
+ label: /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e("span", { children: l("changeCover.media", { defaultValue: "Media" }) }) }),
87
+ visible: s.includes("media") && !!r && X()
100
88
  }
101
- ].filter((l) => l.visible),
89
+ ].filter((n) => n.visible),
102
90
  [
103
- r,
104
- C,
105
- n,
91
+ s,
92
+ k,
93
+ l,
106
94
  d.length,
107
- u,
95
+ m,
108
96
  i,
109
- s
97
+ r
110
98
  ]
111
- ), [o, R] = x(() => {
112
- if (p[0]) return p[0].value;
113
- const l = p.find((K) => K.visible);
114
- return l ? l.value : "";
115
- }), q = (l) => {
116
- u?.(l, h);
117
- }, c = (l) => {
118
- G?.(l), h(!1);
119
- }, J = y(() => b ? /* @__PURE__ */ t(W, { size: "lg", children: [
120
- /* @__PURE__ */ e(M, { icon: F, size: 22 }),
99
+ ), [o, O] = x(() => {
100
+ if (h[0]) return h[0].value;
101
+ const n = h.find((w) => w.visible);
102
+ return n ? n.value : "";
103
+ }), R = (n) => {
104
+ m?.(n, p);
105
+ }, t = (n) => {
106
+ z?.(n), p(!1);
107
+ }, q = y(() => b ? /* @__PURE__ */ c(K, { size: "lg", children: [
108
+ /* @__PURE__ */ e(P, { icon: F, size: 22 }),
121
109
  " "
122
110
  ] }) : /* @__PURE__ */ e(
123
- P,
111
+ M,
124
112
  {
125
113
  variant: "default",
126
114
  size: "xs",
127
- leftSection: /* @__PURE__ */ e(M, { icon: F, size: 16 }),
128
- children: /* @__PURE__ */ e(X, { fw: 600, size: "sm", children: n("changeCover.change") })
115
+ leftSection: /* @__PURE__ */ e(P, { icon: F, size: 16 }),
116
+ children: /* @__PURE__ */ e(Q, { fw: 600, size: "sm", children: l("changeCover.change") })
129
117
  }
130
- ), [n, b]), k = (l) => {
131
- h(l), O?.(l);
118
+ ), [l, b]), C = (n) => {
119
+ p(n), H?.(n);
132
120
  };
133
- return /* @__PURE__ */ t(
134
- m,
121
+ return /* @__PURE__ */ c(
122
+ u,
135
123
  {
136
- width: j,
124
+ width: T,
137
125
  radius: "var(--mantine-spacing-sm)",
138
- position: A,
126
+ position: V,
139
127
  shadow: "md",
140
128
  opened: v,
141
- onChange: k,
129
+ onChange: C,
142
130
  withinPortal: !0,
143
- ...U || {},
131
+ ...N || {},
144
132
  children: [
145
- /* @__PURE__ */ e(m.Target, { children: /* @__PURE__ */ e(a, { onClick: () => k(!v), ...H, children: E ?? J }) }),
146
- /* @__PURE__ */ t(m.Dropdown, { p: 0, children: [
133
+ /* @__PURE__ */ e(u.Target, { children: /* @__PURE__ */ e(a, { onClick: () => C(!v), ..._, children: G ?? q }) }),
134
+ /* @__PURE__ */ c(u.Dropdown, { p: 0, children: [
147
135
  /* @__PURE__ */ e(a, { justify: "space-between", align: "center", children: /* @__PURE__ */ e(
148
- g,
136
+ f,
149
137
  {
150
138
  defaultValue: "gallery",
151
139
  value: o,
@@ -156,8 +144,8 @@ const re = [
156
144
  }
157
145
  },
158
146
  w: "100%",
159
- children: /* @__PURE__ */ t(
160
- g.List,
147
+ children: /* @__PURE__ */ c(
148
+ f.List,
161
149
  {
162
150
  style: {
163
151
  gap: "4px"
@@ -165,21 +153,21 @@ const re = [
165
153
  px: 8,
166
154
  h: 54,
167
155
  children: [
168
- p.map((l) => /* @__PURE__ */ e(
169
- g.Tab,
156
+ h.map((n) => /* @__PURE__ */ e(
157
+ f.Tab,
170
158
  {
171
- className: z.originalTab,
172
- disabled: L,
159
+ className: I.originalTab,
160
+ disabled: j,
173
161
  h: "100%",
174
162
  p: 0,
175
- value: l.value,
176
- onClick: () => R(l.value),
177
- children: /* @__PURE__ */ e(a, { className: z.customTab, px: "sm", h: 36, children: l.label })
163
+ value: n.value,
164
+ onClick: () => O(n.value),
165
+ children: /* @__PURE__ */ e(a, { className: I.customTab, px: "sm", h: 36, children: n.label })
178
166
  },
179
- l.value
167
+ n.value
180
168
  )),
181
- N && /* @__PURE__ */ e(
182
- P,
169
+ L && /* @__PURE__ */ e(
170
+ M,
183
171
  {
184
172
  variant: "subtle",
185
173
  fz: "sm",
@@ -187,10 +175,10 @@ const re = [
187
175
  fw: 500,
188
176
  px: "sm",
189
177
  size: "30px",
190
- onClick: V,
178
+ onClick: B,
191
179
  color: "var(--mantine-color-gray-light-color)",
192
180
  style: { marginLeft: "auto" },
193
- children: n("remove")
181
+ children: l("remove")
194
182
  }
195
183
  )
196
184
  ]
@@ -198,35 +186,35 @@ const re = [
198
186
  )
199
187
  }
200
188
  ) }),
201
- /* @__PURE__ */ t(Y, { gap: 0, px: 8, pb: 8, pt: "sm", children: [
189
+ /* @__PURE__ */ c(W, { gap: 0, px: 8, pb: 8, pt: "sm", children: [
202
190
  o === "gallery" && !!d.length && /* @__PURE__ */ e(
203
- w,
191
+ D,
204
192
  {
205
193
  galleryCollection: d,
206
- onChange: c
194
+ onChange: t
207
195
  }
208
196
  ),
209
197
  o === "upload" && /* @__PURE__ */ e(
210
198
  ae,
211
199
  {
212
- type: f || "image",
213
- uploading: B,
214
- dropZoneProps: _,
215
- onUpload: q
200
+ type: g || "image",
201
+ uploading: E,
202
+ dropZoneProps: U,
203
+ onUpload: R
216
204
  }
217
205
  ),
218
206
  o === "link" && /* @__PURE__ */ e(
219
207
  ie,
220
208
  {
221
- type: f || "image",
222
- onChange: c,
223
- isValidMediaUrl: T
209
+ type: g || "image",
210
+ onChange: t,
211
+ isValidMediaUrl: A
224
212
  }
225
213
  ),
226
- o === "unsplash" && /* @__PURE__ */ e(ne, { onChange: c }),
227
- o === "giphy" && /* @__PURE__ */ e(ee, { onChange: c }),
214
+ o === "unsplash" && /* @__PURE__ */ e(le, { onChange: t }),
215
+ o === "giphy" && /* @__PURE__ */ e(ee, { onChange: t }),
228
216
  o === "googleDrive" && i && /* @__PURE__ */ e(
229
- le,
217
+ ne,
230
218
  {
231
219
  isConnected: i.isConnected,
232
220
  connectedEmail: i.connectedEmail,
@@ -236,22 +224,22 @@ const re = [
236
224
  isImporting: i.isImporting,
237
225
  onSearch: i.onSearch,
238
226
  onLoadMore: i.onLoadMore,
239
- onSelect: (l) => {
240
- i.onSelect(l, c);
227
+ onSelect: (n) => {
228
+ i.onSelect(n, t);
241
229
  },
242
230
  error: i.error
243
231
  }
244
232
  ),
245
- o === "media" && s && /* @__PURE__ */ e(
246
- D,
233
+ o === "media" && r && /* @__PURE__ */ e(
234
+ $,
247
235
  {
248
- items: s.items,
249
- isLoading: s.isLoading,
250
- breadcrumbs: s.breadcrumbs,
251
- onFolderClick: s.onFolderClick,
252
- onBreadcrumbClick: s.onBreadcrumbClick,
253
- onSelect: (l) => {
254
- s.onSelect?.(l), h(!1);
236
+ items: r.items,
237
+ isLoading: r.isLoading,
238
+ breadcrumbs: r.breadcrumbs,
239
+ onFolderClick: r.onFolderClick,
240
+ onBreadcrumbClick: r.onBreadcrumbClick,
241
+ onSelect: (n) => {
242
+ r.onSelect?.(n), p(!1);
255
243
  }
256
244
  }
257
245
  )
@@ -1 +1 @@
1
- {"version":3,"file":"FilePickerUpload.d.ts","sourceRoot":"","sources":["../../../src/components/FilePicker/FilePickerUpload.tsx"],"names":[],"mappings":"AAMA,OAAO,EAEL,aAAa,EAEb,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,OAAO,8BAA8B,CAAC;AAEtC,eAAO,MAAM,gBAAgB,GAAI,+CAK9B;IACD,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IAC9C,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;CAC3C,4CAkGA,CAAC"}
1
+ {"version":3,"file":"FilePickerUpload.d.ts","sourceRoot":"","sources":["../../../src/components/FilePicker/FilePickerUpload.tsx"],"names":[],"mappings":"AAMA,OAAO,EAEL,aAAa,EAEb,YAAY,EAEb,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,OAAO,8BAA8B,CAAC;AAEtC,eAAO,MAAM,gBAAgB,GAAI,+CAK9B;IACD,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IAC9C,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;CAC3C,4CAqGA,CAAC"}
@@ -1,28 +1,29 @@
1
- import { jsx as n, jsxs as m } from "react/jsx-runtime";
2
- import { useCallback as f } from "react";
3
- import { useTranslation as M } from "react-i18next";
4
- import { Image02Icon as k } from "@hugeicons/core-free-icons";
5
- import { HugeiconsIcon as v } from "@hugeicons/react";
6
- import { Stack as d, Text as p } from "@mantine/core";
7
- import { Dropzone as E, IMAGE_MIME_TYPE as I } from "@mantine/dropzone";
1
+ import { jsx as n, jsxs as f } from "react/jsx-runtime";
2
+ import { useCallback as d } from "react";
3
+ import { useTranslation as k } from "react-i18next";
4
+ import { Image02Icon as v } from "@hugeicons/core-free-icons";
5
+ import { HugeiconsIcon as E } from "@hugeicons/react";
6
+ import { Stack as p, Text as x } from "@mantine/core";
7
+ import { Dropzone as I, IMAGE_MIME_TYPE as T } from "@mantine/dropzone";
8
8
  import { showNotification as h } from "@mantine/notifications";
9
- import { showErrorNotification as S } from "../../helpers/showNotifications.js";
9
+ import { getMaxUploadSize as g } from "../../config/envConfig.js";
10
+ import { showErrorNotification as b } from "../../helpers/showNotifications.js";
10
11
  import "@mantine/dropzone/styles.css";
11
- const $ = ({
12
- type: l = "image",
13
- uploading: g,
14
- dropZoneProps: t,
15
- onUpload: s
12
+ const C = ({
13
+ type: s = "image",
14
+ uploading: u,
15
+ dropZoneProps: i,
16
+ onUpload: a
16
17
  }) => {
17
- const { t: e } = M("ui"), u = t?.maxSize != null ? Math.round(t.maxSize / (1024 * 1024)) : 5, x = `filePicker.dropFileHere.${l}`, c = `filePicker.description.${l}`, F = e(x, {
18
+ const { t: e } = k("ui"), l = i?.maxSize != null ? Math.round(i.maxSize / (1024 * 1024)) : Math.round((g() ?? 5 * 1024 * 1024) / (1024 * 1024)), z = `filePicker.dropFileHere.${s}`, c = `filePicker.description.${s}`, F = e(z, {
18
19
  defaultValue: e("dropFileHere")
19
- }), a = (() => {
20
- const r = e(c, { maxSize: u });
20
+ }), m = (() => {
21
+ const r = e(c, { maxSize: l });
21
22
  return r !== c ? r : null;
22
- })(), y = f(
23
+ })(), M = d(
23
24
  (r) => {
24
25
  if (r.filter(
25
- (o) => o.errors.some((i) => i.code === "file-invalid-type")
26
+ (o) => o.errors.some((t) => t.code === "file-invalid-type")
26
27
  ).length > 0) {
27
28
  h({
28
29
  color: "blue",
@@ -30,15 +31,15 @@ const $ = ({
30
31
  });
31
32
  return;
32
33
  }
33
- if (r.some((o) => o.errors.some((i) => i.code === "file-too-large"))) {
34
- S({
34
+ if (r.some((o) => o.errors.some((t) => t.code === "file-too-large"))) {
35
+ b({
35
36
  title: e("errorMessage"),
36
- message: e("filePicker.errors.shouldNotExceed")
37
+ message: e("filePicker.errors.shouldNotExceed", { maxSize: l })
37
38
  });
38
39
  return;
39
40
  }
40
41
  if (r.filter(
41
- (o) => o.errors.some((i) => i.code === "too-many-files")
42
+ (o) => o.errors.some((t) => t.code === "too-many-files")
42
43
  ).length > 0) {
43
44
  h({
44
45
  color: "blue",
@@ -47,21 +48,22 @@ const $ = ({
47
48
  return;
48
49
  }
49
50
  },
50
- [e]
51
- ), z = f(s, [s]);
51
+ [e, l]
52
+ ), S = d(a, [a]), y = i?.maxSize ?? g() ?? 5 * 1024 * 1024;
52
53
  return /* @__PURE__ */ n(
53
- E,
54
+ I,
54
55
  {
55
- loading: g,
56
- onDrop: z,
57
- onReject: y,
58
- maxFiles: t?.maxFiles || 1,
59
- accept: I,
56
+ loading: u,
57
+ onDrop: S,
58
+ onReject: M,
59
+ maxFiles: i?.maxFiles || 1,
60
+ maxSize: y,
61
+ accept: T,
60
62
  px: 60,
61
63
  py: "xl",
62
- ...t || {},
63
- children: /* @__PURE__ */ m(
64
- d,
64
+ ...i || {},
65
+ children: /* @__PURE__ */ f(
66
+ p,
65
67
  {
66
68
  justify: "center",
67
69
  gap: "var(--mantine-font-size-xs",
@@ -70,16 +72,16 @@ const $ = ({
70
72
  style: { pointerEvents: "none" },
71
73
  children: [
72
74
  /* @__PURE__ */ n(
73
- v,
75
+ E,
74
76
  {
75
77
  size: 32,
76
78
  color: "var(--mantine-color-bright)",
77
- icon: k
79
+ icon: v
78
80
  }
79
81
  ),
80
- /* @__PURE__ */ m(d, { gap: 8, align: "center", children: [
81
- /* @__PURE__ */ n(p, { fw: 500, fz: "sm", c: "bright", lh: "sm", ta: "center", children: F }),
82
- a && /* @__PURE__ */ n(p, { fz: "xs", fw: 400, lh: "140%", c: "dimmed", ta: "center", children: a })
82
+ /* @__PURE__ */ f(p, { gap: 8, align: "center", children: [
83
+ /* @__PURE__ */ n(x, { fw: 500, fz: "sm", c: "bright", lh: "sm", ta: "center", children: F }),
84
+ m && /* @__PURE__ */ n(x, { fz: "xs", fw: 400, lh: "140%", c: "dimmed", ta: "center", children: m })
83
85
  ] })
84
86
  ]
85
87
  }
@@ -88,5 +90,5 @@ const $ = ({
88
90
  );
89
91
  };
90
92
  export {
91
- $ as FilePickerUpload
93
+ C as FilePickerUpload
92
94
  };
@@ -1 +1 @@
1
- {"version":3,"file":"UploadField.d.ts","sourceRoot":"","sources":["../../../../../../src/components/FormViewer/components/fields/UploadField/UploadField.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA2B,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAS1E,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAK/D,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAIF,eAAO,MAAM,WAAW,GAAI,qBAGzB;IACD,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,4CAsNA,CAAC"}
1
+ {"version":3,"file":"UploadField.d.ts","sourceRoot":"","sources":["../../../../../../src/components/FormViewer/components/fields/UploadField/UploadField.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA2B,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAW1E,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAK/D,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAIF,eAAO,MAAM,WAAW,GAAI,qBAGzB;IACD,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,4CAsNA,CAAC"}
@@ -1,29 +1,30 @@
1
1
  import { jsxs as v, jsx as i } from "react/jsx-runtime";
2
- import { useCallback as S, useMemo as D } from "react";
2
+ import { useCallback as S, useMemo as B } from "react";
3
3
  import { useTranslation as V } from "react-i18next";
4
4
  import { useMantineTheme as W, parseThemeColor as A, alpha as _, Stack as M, Group as $, Box as G, Text as L, InputError as X } from "@mantine/core";
5
5
  import { Dropzone as h } from "@mantine/dropzone";
6
+ import { getMaxUploadSize as q } from "../../../../../config/envConfig.js";
6
7
  import { showNotification as f } from "@mantine/notifications";
7
- import { IconUpload as q, IconX as H, IconCloudUpload as J } from "@tabler/icons-react";
8
+ import { IconUpload as H, IconX as J, IconCloudUpload as K } from "@tabler/icons-react";
8
9
  import { formatBytes as C } from "../../../../../helpers/formatBytes.js";
9
- import { useEvent as K } from "../../../../../hooks/useEvent.js";
10
- import { getRandomId as P } from "../../../helpers/steps.js";
11
- import { useSteps as Q } from "../../../hooks/useCreateFormContext.js";
12
- import { useFormViewerStore as Y } from "../../../store/formStore.js";
13
- import { UploadFile as Z } from "./UploadFile/UploadFile.js";
14
- import ee from "../../../FormViewer.module.css.js";
15
- const oe = 25 * 1024 * 1024, ye = ({
16
- control: r,
10
+ import { useEvent as P } from "../../../../../hooks/useEvent.js";
11
+ import { getRandomId as Q } from "../../../helpers/steps.js";
12
+ import { useSteps as Y } from "../../../hooks/useCreateFormContext.js";
13
+ import { useFormViewerStore as Z } from "../../../store/formStore.js";
14
+ import { UploadFile as ee } from "./UploadFile/UploadFile.js";
15
+ import oe from "../../../FormViewer.module.css.js";
16
+ const te = () => q() ?? 25 * 1024 * 1024, Fe = ({
17
+ control: s,
17
18
  theme: d
18
19
  }) => {
19
- const { t: o } = V("forms"), { form: a } = Q(), { id: s } = r, T = a.values[s], I = a.errors[s], m = r.maxSize || oe, t = r.maxFiles ?? 1, y = r.minFiles ?? 0, E = !!r.multiple || t > 1, l = r.accept && r.accept.length ? r.accept : void 0, { useStore: g } = Y(), R = g((e) => e.editing), U = g((e) => e.preview), b = W(), O = A({
20
+ const { t: o } = V("forms"), { form: a } = Y(), { id: r } = s, T = a.values[r], I = a.errors[r], m = s.maxSize || te(), t = s.maxFiles ?? 1, g = s.minFiles ?? 0, U = !!s.multiple || t > 1, l = s.accept && s.accept.length ? s.accept : void 0, { useStore: y } = Z(), E = y((e) => e.editing), R = y((e) => e.preview), b = W(), O = A({
20
21
  color: d?.primaryColor || "",
21
22
  theme: b
22
- }), j = g((e) => e.uploadFileFn), F = K((e) => {
23
- const c = a.values[s]?.findIndex(
23
+ }), j = y((e) => e.uploadFileFn), F = P((e) => {
24
+ const c = a.values[r]?.findIndex(
24
25
  (u) => u.id === e.id
25
26
  );
26
- c !== -1 && a.setFieldValue(`${s}.${c}`, e);
27
+ c !== -1 && a.setFieldValue(`${r}.${c}`, e);
27
28
  }), k = S(
28
29
  (e) => {
29
30
  if (e.some(
@@ -79,7 +80,7 @@ const oe = 25 * 1024 * 1024, ye = ({
79
80
  [F, j]
80
81
  ), w = S(
81
82
  (e) => {
82
- const c = a.values[s]?.length || 0, u = typeof t == "number" ? Math.max(0, t - c) : 1 / 0;
83
+ const c = a.values[r]?.length || 0, u = typeof t == "number" ? Math.max(0, t - c) : 1 / 0;
83
84
  if (u === 0) {
84
85
  f({
85
86
  message: o("uploadOption.tooManyFiles", { count: t })
@@ -89,59 +90,59 @@ const oe = 25 * 1024 * 1024, ye = ({
89
90
  const z = e.slice(0, u);
90
91
  z.forEach((p) => {
91
92
  const n = {
92
- id: P(),
93
+ id: Q(),
93
94
  file: p,
94
95
  isError: !1,
95
96
  isLoading: !0,
96
97
  isSuccess: !1
97
98
  };
98
- a.insertListItem(s, n), x(n);
99
+ a.insertListItem(r, n), x(n);
99
100
  }), z.length < e.length && f({
100
101
  message: o("uploadOption.tooManyFiles", { count: t })
101
102
  });
102
103
  },
103
- [a, x, s, t, o]
104
- ), N = D(() => [
104
+ [a, x, r, t, o]
105
+ ), D = B(() => [
105
106
  o("uploadOption.maxSize", { size: C(m) }),
106
- y ? o("uploadOption.minFilesWithCount", { count: y }) : "",
107
+ g ? o("uploadOption.minFilesWithCount", { count: g }) : "",
107
108
  t ? o("uploadOption.maxFilesWithCount", { count: t }) : "",
108
109
  l ? o("uploadOption.accept", { types: l.join(", ") }) : ""
109
- ].filter(Boolean).join(" · "), [y, t, l, o, m]), B = {
110
+ ].filter(Boolean).join(" · "), [g, t, l, o, m]), N = {
110
111
  "--primary-color": O.value,
111
112
  "--primary-color-hover": _(O.value, 0.05)
112
113
  };
113
- return /* @__PURE__ */ v(M, { gap: 8, "data-control-id": s, w: "100%", children: [
114
+ return /* @__PURE__ */ v(M, { gap: 8, "data-control-id": r, w: "100%", children: [
114
115
  (T?.length ?? 0) < t && /* @__PURE__ */ i(
115
116
  h,
116
117
  {
117
118
  radius: d?.borderRadius,
118
119
  __size: d?.size,
119
- disabled: R || U,
120
+ disabled: E || R,
120
121
  onDrop: w,
121
122
  onReject: k,
122
123
  maxFiles: t,
123
124
  maxSize: m,
124
125
  accept: l,
125
- multiple: E,
126
+ multiple: U,
126
127
  unstyled: !0,
127
- className: ee.dropzone,
128
- style: B,
128
+ className: oe.dropzone,
129
+ style: N,
129
130
  children: /* @__PURE__ */ i($, { justify: "center", py: 24, children: /* @__PURE__ */ v(M, { justify: "center", align: "center", gap: 8, children: [
130
131
  /* @__PURE__ */ v(G, { c: "var(--primary-color)", children: [
131
- /* @__PURE__ */ i(h.Accept, { children: /* @__PURE__ */ i(q, { size: 70, stroke: 1.2 }) }),
132
- /* @__PURE__ */ i(h.Reject, { children: /* @__PURE__ */ i(H, { size: 70, stroke: 1.2 }) }),
133
- /* @__PURE__ */ i(h.Idle, { children: /* @__PURE__ */ i(J, { size: 70, stroke: 1.2 }) })
132
+ /* @__PURE__ */ i(h.Accept, { children: /* @__PURE__ */ i(H, { size: 70, stroke: 1.2 }) }),
133
+ /* @__PURE__ */ i(h.Reject, { children: /* @__PURE__ */ i(J, { size: 70, stroke: 1.2 }) }),
134
+ /* @__PURE__ */ i(h.Idle, { children: /* @__PURE__ */ i(K, { size: 70, stroke: 1.2 }) })
134
135
  ] }),
135
136
  /* @__PURE__ */ i(L, { size: "xl", inline: !0, ta: "center", c: d?.title?.color, children: o("uploadOption.title") }),
136
- /* @__PURE__ */ i(L, { size: "sm", c: d?.description?.color, mt: 4, children: N })
137
+ /* @__PURE__ */ i(L, { size: "sm", c: d?.description?.color, mt: 4, children: D })
137
138
  ] }) })
138
139
  }
139
140
  ),
140
141
  T?.map((e) => /* @__PURE__ */ i(
141
- Z,
142
+ ee,
142
143
  {
143
144
  file: e,
144
- id: s,
145
+ id: r,
145
146
  onReload: x,
146
147
  theme: d
147
148
  },
@@ -151,5 +152,5 @@ const oe = 25 * 1024 * 1024, ye = ({
151
152
  ] });
152
153
  };
153
154
  export {
154
- ye as UploadField
155
+ Fe as UploadField
155
156
  };