@layers-app/shared 0.4.0 → 0.4.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 (156) hide show
  1. package/dist/components/AnimatedFigurePage/AnimatedFigurePage.module.css.js +13 -13
  2. package/dist/components/AnimatedFigurePage/useParallax.d.ts +2 -2
  3. package/dist/components/AppContainer/AppContainer.d.ts +6 -1
  4. package/dist/components/AppContainer/AppContainer.d.ts.map +1 -1
  5. package/dist/components/AppContainer/components/AppSidebarButton.d.ts +4 -1
  6. package/dist/components/AppContainer/components/AppSidebarButton.d.ts.map +1 -1
  7. package/dist/components/AppContainer/components/AppSidebarButton.js +22 -15
  8. package/dist/components/AppContainer/components/AppsSidebar/AppsSection.d.ts.map +1 -1
  9. package/dist/components/AppContainer/components/AppsSidebar/AppsSection.js +22 -21
  10. package/dist/components/AppContainer/components/AppsSidebar/UserSection.d.ts.map +1 -1
  11. package/dist/components/AppContainer/components/AppsSidebar/UserSection.js +48 -91
  12. package/dist/components/AppContainer/components/ToolbarNewButton.d.ts +7 -2
  13. package/dist/components/AppContainer/components/ToolbarNewButton.d.ts.map +1 -1
  14. package/dist/components/AppContainer/components/ToolbarNewButton.js +14 -14
  15. package/dist/components/AttachmentsGalleryModal/components/GallerySlide.d.ts +3 -1
  16. package/dist/components/AttachmentsGalleryModal/components/GallerySlide.d.ts.map +1 -1
  17. package/dist/components/AttachmentsGalleryModal/components/GallerySlide.js +96 -64
  18. package/dist/components/AttachmentsGalleryModal/components/ModalHeader.d.ts.map +1 -1
  19. package/dist/components/AttachmentsGalleryModal/components/ModalHeader.js +76 -67
  20. package/dist/components/AttachmentsGalleryModal/components/ShakePlayer/ShakaPlayer.d.ts +1 -1
  21. package/dist/components/AttachmentsGalleryModal/components/ShakePlayer/ShakaPlayer.d.ts.map +1 -1
  22. package/dist/components/AttachmentsGalleryModal/components/ShakePlayer/ShakaPlayer.js +35 -26
  23. package/dist/components/AttachmentsGalleryModal/components/ShakePlayer/useShakePlayer.d.ts +1 -1
  24. package/dist/components/AttachmentsGalleryModal/components/ShakePlayer/useShakePlayer.d.ts.map +1 -1
  25. package/dist/components/AttachmentsGalleryModal/components/ShakePlayer/useShakePlayer.js +43 -36
  26. package/dist/components/AttachmentsGalleryModal/components/UnsupportedSection.d.ts +7 -0
  27. package/dist/components/AttachmentsGalleryModal/components/UnsupportedSection.d.ts.map +1 -0
  28. package/dist/components/AttachmentsGalleryModal/components/UnsupportedSection.js +17 -0
  29. package/dist/components/AttachmentsGalleryModal/hooks/useGetPreviewUrl.d.ts +4 -0
  30. package/dist/components/AttachmentsGalleryModal/hooks/useGetPreviewUrl.d.ts.map +1 -1
  31. package/dist/components/AttachmentsGalleryModal/hooks/useGetPreviewUrl.js +59 -20
  32. package/dist/components/AttachmentsGalleryModal/styles.module.css.js +34 -22
  33. package/dist/components/AttachmentsPreview/AttachmentsPreview.d.ts.map +1 -1
  34. package/dist/components/AttachmentsPreview/AttachmentsPreview.js +22 -18
  35. package/dist/components/ColorPicker/ColorPicker.d.ts +12 -11
  36. package/dist/components/ColorPicker/ColorPicker.d.ts.map +1 -1
  37. package/dist/components/ColorPicker/ColorPicker.js +109 -83
  38. package/dist/components/ColorPicker/ColorPickerList.d.ts.map +1 -1
  39. package/dist/components/ColorPicker/ColorPickerList.js +62 -63
  40. package/dist/components/ColorPicker/ColorPickerToolbar.d.ts.map +1 -1
  41. package/dist/components/ColorPicker/ColorPickerToolbar.js +128 -120
  42. package/dist/components/ColorPicker/icons.js +3 -3
  43. package/dist/components/ColorPicker/types.d.ts +3 -1
  44. package/dist/components/ColorPicker/types.d.ts.map +1 -1
  45. package/dist/components/ColorPicker/types.js +11 -5
  46. package/dist/components/CommentComposer/CommentEditorHotkeys.d.ts.map +1 -1
  47. package/dist/components/CommentComposer/CommentEditorHotkeys.js +55 -45
  48. package/dist/components/CommentComposer/useVirtualAnchor.d.ts +1 -1
  49. package/dist/components/CommentComposer/useVirtualAnchor.d.ts.map +1 -1
  50. package/dist/components/EmojiPicker/EmojiPicker.d.ts +1 -1
  51. package/dist/components/EmojiPicker/EmojiPicker.d.ts.map +1 -1
  52. package/dist/components/EntityIcon.d.ts.map +1 -1
  53. package/dist/components/EntityIcon.js +43 -33
  54. package/dist/components/FilePicker/FilePicker.d.ts +3 -1
  55. package/dist/components/FilePicker/FilePicker.d.ts.map +1 -1
  56. package/dist/components/FilePicker/FilePicker.js +44 -42
  57. package/dist/components/FilePicker/FilePickerUpload.d.ts +3 -1
  58. package/dist/components/FilePicker/FilePickerUpload.d.ts.map +1 -1
  59. package/dist/components/FilePicker/FilePickerUpload.js +28 -28
  60. package/dist/components/FormViewer/helpers/conditions.d.ts +38 -38
  61. package/dist/components/FormViewer/helpers/helpers.d.ts +38 -38
  62. package/dist/components/FormViewer/helpers/steps.d.ts +38 -38
  63. package/dist/components/FormViewer/hooks/useActiveControl.d.ts +19 -19
  64. package/dist/components/FormViewer/hooks/useActiveStep.d.ts +38 -38
  65. package/dist/components/FormViewer/hooks/useFormGlobalTheme.d.ts +6 -0
  66. package/dist/components/FormViewer/hooks/useFormGlobalTheme.d.ts.map +1 -1
  67. package/dist/components/FormViewer/hooks/useFormGlobalTheme.js +4 -3
  68. package/dist/components/FormViewer/hooks/useFormMobile.d.ts +1 -1
  69. package/dist/components/FormViewer/hooks/useFormMobile.d.ts.map +1 -1
  70. package/dist/components/FormViewer/store/formStore.d.ts +248 -248
  71. package/dist/components/FormViewer/store/formStoreApi.d.ts +124 -124
  72. package/dist/components/FormViewer/store/selectors.d.ts +11655 -11655
  73. package/dist/components/FormViewer/types/form.d.ts +1 -1
  74. package/dist/components/FormViewer/types/form.d.ts.map +1 -1
  75. package/dist/components/FormViewer/types/schemes.d.ts +381 -6358
  76. package/dist/components/FormViewer/types/schemes.d.ts.map +1 -1
  77. package/dist/components/FormViewer/types/schemes.js +1 -1
  78. package/dist/components/GroupAvatar/index.d.ts +3 -1
  79. package/dist/components/GroupAvatar/index.d.ts.map +1 -1
  80. package/dist/components/GroupAvatar/index.js +24 -21
  81. package/dist/components/LanguagePicker/LanguagePicker.d.ts +13 -3
  82. package/dist/components/LanguagePicker/LanguagePicker.d.ts.map +1 -1
  83. package/dist/components/LanguagePicker/LanguagePicker.js +65 -43
  84. package/dist/components/MediaLibrary/MediaLibraryRow.js +7 -7
  85. package/dist/components/NavMenu/NavMenu.d.ts +3 -1
  86. package/dist/components/NavMenu/NavMenu.d.ts.map +1 -1
  87. package/dist/components/NavMenu/components/DnDProvider.d.ts +1 -1
  88. package/dist/components/NavMenu/components/DnDProvider.d.ts.map +1 -1
  89. package/dist/components/NavMenu/components/NavMenuActionIcon.d.ts +7 -1
  90. package/dist/components/NavMenu/components/NavMenuActionIcon.d.ts.map +1 -1
  91. package/dist/components/NavMenu/components/NavMenuActionIcon.js +21 -23
  92. package/dist/components/NewColorPicker/components/Target.d.ts +3 -1
  93. package/dist/components/NewColorPicker/components/Target.d.ts.map +1 -1
  94. package/dist/components/NewColorPicker/components/Target.js +48 -43
  95. package/dist/components/Notification/Notification.js +3 -1
  96. package/dist/components/Notification/NotificationCard.d.ts +3 -1
  97. package/dist/components/Notification/NotificationCard.d.ts.map +1 -1
  98. package/dist/components/Notification/NotificationCard.js +87 -86
  99. package/dist/components/OnboardingTour/OnboardingTourFooter.d.ts +6 -1
  100. package/dist/components/OnboardingTour/OnboardingTourFooter.d.ts.map +1 -1
  101. package/dist/components/OnboardingTour/OnboardingTourFooter.js +39 -21
  102. package/dist/components/OnboardingTour/OnboardingTourWrapper.d.ts +4 -5
  103. package/dist/components/OnboardingTour/OnboardingTourWrapper.d.ts.map +1 -1
  104. package/dist/components/OnboardingTour/OnboardingTourWrapper.js +83 -119
  105. package/dist/components/OnboardingTour/index.d.ts +1 -1
  106. package/dist/components/OnboardingTour/index.d.ts.map +1 -1
  107. package/dist/components/OnboardingTour/useOnboardingTour.d.ts +4 -0
  108. package/dist/components/OnboardingTour/useOnboardingTour.d.ts.map +1 -1
  109. package/dist/components/OnboardingTour/useOnboardingTour.js +65 -36
  110. package/dist/components/ProjectIcon/ProjectIcon.d.ts +7 -12
  111. package/dist/components/ProjectIcon/ProjectIcon.d.ts.map +1 -1
  112. package/dist/components/ProjectIcon/ProjectIcon.js +58 -60
  113. package/dist/components/UserAvatar/index.d.ts +2 -1
  114. package/dist/components/UserAvatar/index.d.ts.map +1 -1
  115. package/dist/components/UserAvatar/index.js +42 -32
  116. package/dist/components/WorkspaceAvatar/WorkspaceAvatar.d.ts +3 -3
  117. package/dist/components/WorkspaceAvatar/WorkspaceAvatar.d.ts.map +1 -1
  118. package/dist/components/WorkspaceAvatar/WorkspaceAvatar.js +19 -18
  119. package/dist/components/WorkspaceMenu/WorkspaceItem.js +17 -17
  120. package/dist/components/WorkspaceMenu/WorkspaceMenu.js +7 -7
  121. package/dist/config/brand.d.ts +2 -0
  122. package/dist/config/brand.d.ts.map +1 -1
  123. package/dist/config/brand.js +28 -22
  124. package/dist/config/envConfig.d.ts +12 -0
  125. package/dist/config/envConfig.d.ts.map +1 -1
  126. package/dist/config/envConfig.js +21 -13
  127. package/dist/helpers/getFileIcons.d.ts.map +1 -1
  128. package/dist/helpers/getFileIcons.js +63 -45
  129. package/dist/helpers/getFileType.d.ts +1 -1
  130. package/dist/helpers/getFileType.d.ts.map +1 -1
  131. package/dist/helpers/getFileType.js +29 -8
  132. package/dist/helpers/getPartOfTheDay.d.ts +1 -1
  133. package/dist/helpers/offlineSuppression.d.ts +3 -0
  134. package/dist/helpers/offlineSuppression.d.ts.map +1 -0
  135. package/dist/helpers/offlineSuppression.js +8 -0
  136. package/dist/helpers/platform.d.ts +1 -1
  137. package/dist/helpers/platform.d.ts.map +1 -1
  138. package/dist/helpers/platform.js +5 -4
  139. package/dist/helpers/showNotifications.d.ts.map +1 -1
  140. package/dist/helpers/showNotifications.js +30 -29
  141. package/dist/hooks/useOutsideClick.d.ts +1 -1
  142. package/dist/hooks/useOutsideClick.d.ts.map +1 -1
  143. package/dist/index.css +1 -1
  144. package/dist/index.d.ts +1 -0
  145. package/dist/index.d.ts.map +1 -1
  146. package/dist/index.js +462 -451
  147. package/dist/lang/locales/ui_en.json.js +1 -1
  148. package/dist/lang/locales/ui_es.json.js +1 -1
  149. package/dist/lang/locales/ui_ru.json.js +1 -1
  150. package/dist/node_modules/countries-and-timezones/esm/index.js +281 -4011
  151. package/dist/store/featureProgress.d.ts +3 -6
  152. package/dist/store/featureProgress.d.ts.map +1 -1
  153. package/dist/store/featureProgress.js +56 -22
  154. package/dist/store/plansModal.d.ts.map +1 -1
  155. package/dist/store/plansModal.js +10 -10
  156. package/package.json +13 -13
@@ -1,28 +1,67 @@
1
- import { useState as t, useEffect as w, useMemo as U } from "react";
2
- import { isVideoFile as E } from "../../../helpers/fileUtils.js";
3
- const p = (e) => {
4
- const [l, c] = t(null), [n, s] = t(!1), [f, o] = t(!1);
5
- async function u(d) {
6
- s(!0);
7
- const i = await fetch(`/v1/attachments/${d}`, {
8
- method: "GET"
1
+ import { useState as p, useEffect as F, useMemo as T } from "react";
2
+ import { getEnvConfig as L } from "../../../config/envConfig.js";
3
+ import { isVideoFile as v } from "../../../helpers/fileUtils.js";
4
+ const h = () => {
5
+ const e = L().apiBaseUrl || "";
6
+ return e.endsWith("/") ? e.slice(0, -1) : e;
7
+ }, B = (e) => {
8
+ const [u, y] = p(null), [d, n] = p(!1), [w, a] = p(!1);
9
+ async function g(i) {
10
+ return fetch(`${h()}/v1/attachments/${i}`, {
11
+ method: "GET",
12
+ credentials: "include"
9
13
  });
10
- if (!i.ok)
11
- throw s(!1), o(!0), new Error(`Error loading: ${i.statusText}`);
12
- const a = await i.blob();
13
- c(window.URL.createObjectURL(a)), s(!1), o(!1);
14
14
  }
15
- const r = E(
15
+ async function m() {
16
+ try {
17
+ return (await fetch(`${h()}/v1/auth/refresh`, {
18
+ method: "POST",
19
+ credentials: "include"
20
+ })).ok;
21
+ } catch {
22
+ return !1;
23
+ }
24
+ }
25
+ async function U(i, b) {
26
+ n(!0);
27
+ let s = await g(i);
28
+ if ((s.status === 401 || s.status === 403) && await m() && (s = await g(i)), !s.ok)
29
+ throw n(!1), a(!0), new Error(`Error loading: ${s.statusText}`);
30
+ const f = await s.blob(), E = b && f.type !== "application/pdf" ? new Blob([f], { type: "application/pdf" }) : f;
31
+ y(window.URL.createObjectURL(E)), n(!1), a(!1);
32
+ }
33
+ const t = v(
16
34
  e.contentType,
17
35
  e.originalFileName
18
- );
19
- return w(() => {
20
- e.id && !r && !e.Url && u(e.id);
21
- }, [e.Url, e.id, r]), U(
22
- () => ({ fileUrl: l, isFetching: n, isError: f, setIsError: o, isVideo: r }),
23
- [l, f, n, r]
36
+ ), o = (e.contentType || "").toLowerCase() === "application/pdf" || (e.originalFileName || "").toLowerCase().endsWith(".pdf"), c = (e.contentType || "").toLowerCase().startsWith("image/"), l = (e.contentType || "").toLowerCase().startsWith("audio/") || /\.(mp3|wav|ogg|flac|m4a|aac|opus|weba)$/i.test(
37
+ e.originalFileName || ""
38
+ ), r = c || t || o || l;
39
+ return F(() => {
40
+ e.id && !t && r && !e.Url && U(e.id, o);
41
+ }, [e.Url, e.id, t, o, r]), T(
42
+ () => ({
43
+ fileUrl: u,
44
+ isFetching: d,
45
+ isError: w,
46
+ setIsError: a,
47
+ isVideo: t,
48
+ isPdf: o,
49
+ isImage: c,
50
+ isAudio: l,
51
+ isSupported: r
52
+ }),
53
+ [
54
+ u,
55
+ w,
56
+ d,
57
+ t,
58
+ o,
59
+ c,
60
+ l,
61
+ r
62
+ ]
24
63
  );
25
64
  };
26
65
  export {
27
- p as useGetPreviewUrl
66
+ B as useGetPreviewUrl
28
67
  };
@@ -1,29 +1,41 @@
1
- const o = "_container_sq5v9_1", t = "_root_sq5v9_13", n = "_carouselRoot_sq5v9_27", e = "_carouselViewport_sq5v9_35", a = "_carouselSlide_sq5v9_43", s = "_navButton_sq5v9_57", _ = "_navButtonPrev_sq5v9_83", r = "_navButtonNext_sq5v9_91", v = "_modalContent_sq5v9_99", c = "_modalBody_sq5v9_109", i = "_videoContainer_sq5v9_121", l = "_imageContainer_sq5v9_131", u = {
2
- container: o,
3
- root: t,
4
- carouselRoot: n,
1
+ const n = "_container_nqf56_1", o = "_root_nqf56_13", t = "_carouselRoot_nqf56_27", e = "_carouselViewport_nqf56_35", a = "_carouselSlide_nqf56_43", _ = "_navButton_nqf56_57", r = "_navButtonPrev_nqf56_83", i = "_navButtonNext_nqf56_91", c = "_headerAction_nqf56_99", d = "_modalContent_nqf56_127", s = "_modalBody_nqf56_137", u = "_videoContainer_nqf56_149", f = "_imageContainer_nqf56_159", l = "_pdfContainer_nqf56_173", m = "_pdfFrame_nqf56_189", q = "_audioContainer_nqf56_203", v = "_audioName_nqf56_233", C = "_audioElement_nqf56_249", B = {
2
+ container: n,
3
+ root: o,
4
+ carouselRoot: t,
5
5
  carouselViewport: e,
6
6
  carouselSlide: a,
7
- navButton: s,
8
- navButtonPrev: _,
9
- navButtonNext: r,
10
- modalContent: v,
11
- modalBody: c,
12
- videoContainer: i,
13
- imageContainer: l
7
+ navButton: _,
8
+ navButtonPrev: r,
9
+ navButtonNext: i,
10
+ headerAction: c,
11
+ modalContent: d,
12
+ modalBody: s,
13
+ videoContainer: u,
14
+ imageContainer: f,
15
+ pdfContainer: l,
16
+ pdfFrame: m,
17
+ audioContainer: q,
18
+ audioName: v,
19
+ audioElement: C
14
20
  };
15
21
  export {
16
- n as carouselRoot,
22
+ q as audioContainer,
23
+ C as audioElement,
24
+ v as audioName,
25
+ t as carouselRoot,
17
26
  a as carouselSlide,
18
27
  e as carouselViewport,
19
- o as container,
20
- u as default,
21
- l as imageContainer,
22
- c as modalBody,
23
- v as modalContent,
24
- s as navButton,
25
- r as navButtonNext,
26
- _ as navButtonPrev,
27
- t as root,
28
- i as videoContainer
28
+ n as container,
29
+ B as default,
30
+ c as headerAction,
31
+ f as imageContainer,
32
+ s as modalBody,
33
+ d as modalContent,
34
+ _ as navButton,
35
+ i as navButtonNext,
36
+ r as navButtonPrev,
37
+ l as pdfContainer,
38
+ m as pdfFrame,
39
+ o as root,
40
+ u as videoContainer
29
41
  };
@@ -1 +1 @@
1
- {"version":3,"file":"AttachmentsPreview.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentsPreview/AttachmentsPreview.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAIhE,UAAU,8BAA8B;IACtC,KAAK,EAAE,oBAAoB,CAAC,cAAc,EAAE,CAAC;IAC7C,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,kBAAkB,GAAI,8CAKhC,8BAA8B,mDAgNhC,CAAC"}
1
+ {"version":3,"file":"AttachmentsPreview.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentsPreview/AttachmentsPreview.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAIhE,UAAU,8BAA8B;IACtC,KAAK,EAAE,oBAAoB,CAAC,cAAc,EAAE,CAAC;IAC7C,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,kBAAkB,GAAI,8CAKhC,8BAA8B,mDAoNhC,CAAC"}
@@ -6,11 +6,11 @@ import { useDisclosure as M } from "@mantine/hooks";
6
6
  import { getFileIcons as P } from "../../helpers/getFileIcons.js";
7
7
  import { getFileType as A } from "../../helpers/getFileType.js";
8
8
  import { AttachmentsGalleryModal as B } from "../AttachmentsGalleryModal/AttachmentsGalleryModal.js";
9
- import t from "./AttachmentsPreview.module.css.js";
9
+ import a from "./AttachmentsPreview.module.css.js";
10
10
  const U = ({
11
11
  files: o,
12
12
  onRemove: i,
13
- mode: a,
13
+ mode: t,
14
14
  parentIsExisting: u
15
15
  }) => {
16
16
  const [T, { open: w, close: b }] = M(!1), s = o.filter((e) => e.isImage), d = o.filter((e) => !e.isImage), D = s.map((e) => ({
@@ -35,7 +35,7 @@ const U = ({
35
35
  };
36
36
  return o.length === 0 ? null : /* @__PURE__ */ n(C, { children: [
37
37
  /* @__PURE__ */ n(v, { gap: "10px", w: "100%", tabIndex: 0, children: [
38
- s.length > 0 && /* @__PURE__ */ r(z, { gutter: "xs", children: s.map((e) => {
38
+ s.length > 0 && /* @__PURE__ */ r(z, { gap: "xs", children: s.map((e) => {
39
39
  const l = o.indexOf(e);
40
40
  return /* @__PURE__ */ r(z.Col, { span: "content", children: /* @__PURE__ */ n(
41
41
  h,
@@ -43,7 +43,7 @@ const U = ({
43
43
  w: 56,
44
44
  h: 56,
45
45
  pos: "relative",
46
- className: t.imagePreviewWrapper,
46
+ className: a.imagePreviewWrapper,
47
47
  children: [
48
48
  /* @__PURE__ */ r(
49
49
  F,
@@ -62,11 +62,11 @@ const U = ({
62
62
  /* @__PURE__ */ r(
63
63
  f,
64
64
  {
65
- visible: e.isTemp && a === "view" && u,
65
+ visible: e.isTemp && t === "view" && u,
66
66
  loaderProps: { size: 20 }
67
67
  }
68
68
  ),
69
- a === "view" && !e.isTemp && /* @__PURE__ */ r(
69
+ t === "view" && !e.isTemp && /* @__PURE__ */ r(
70
70
  c,
71
71
  {
72
72
  component: "a",
@@ -79,11 +79,11 @@ const U = ({
79
79
  top: 2,
80
80
  right: 2,
81
81
  bg: "var(--mantine-color-dark-filled, #2E2E2E)",
82
- className: t.downloadButton,
82
+ className: a.downloadButton,
83
83
  children: /* @__PURE__ */ r(x, { size: 16, icon: g })
84
84
  }
85
85
  ),
86
- a === "draft" && i && /* @__PURE__ */ r(
86
+ t === "draft" && i && /* @__PURE__ */ r(
87
87
  c,
88
88
  {
89
89
  size: "20px",
@@ -93,7 +93,7 @@ const U = ({
93
93
  pos: "absolute",
94
94
  color: "dark",
95
95
  onClick: () => i(l),
96
- className: t.deleteButton,
96
+ className: a.deleteButton,
97
97
  children: /* @__PURE__ */ r(I, { size: "12px" })
98
98
  }
99
99
  )
@@ -105,15 +105,15 @@ const U = ({
105
105
  h,
106
106
  {
107
107
  w: "100%",
108
- className: t.filePreviewList,
108
+ className: a.filePreviewList,
109
109
  "data-many": d.length >= 4,
110
110
  children: d.map((e) => {
111
111
  const l = o.indexOf(e);
112
- return /* @__PURE__ */ n(h, { className: t.filePreviewWrapper, children: [
112
+ return /* @__PURE__ */ n(h, { className: a.filePreviewWrapper, children: [
113
113
  /* @__PURE__ */ r(
114
114
  f,
115
115
  {
116
- visible: e.isTemp && a === "view" && u,
116
+ visible: e.isTemp && t === "view" && u,
117
117
  loaderProps: { size: 20 }
118
118
  }
119
119
  ),
@@ -134,7 +134,11 @@ const U = ({
134
134
  flex: 1,
135
135
  miw: 0,
136
136
  children: [
137
- P(A(e.type), !1, 36),
137
+ P(
138
+ A(e.type, !1, e.name),
139
+ !1,
140
+ 36
141
+ ),
138
142
  /* @__PURE__ */ n(v, { gap: 0, flex: 1, miw: 0, children: [
139
143
  /* @__PURE__ */ r(
140
144
  N,
@@ -142,7 +146,7 @@ const U = ({
142
146
  size: "sm",
143
147
  truncate: !0,
144
148
  title: e.name,
145
- className: t.fileDownloadName,
149
+ className: a.fileDownloadName,
146
150
  component: "a",
147
151
  href: e.url,
148
152
  download: e.name,
@@ -159,7 +163,7 @@ const U = ({
159
163
  ]
160
164
  }
161
165
  ),
162
- a === "view" && !e.isTemp && /* @__PURE__ */ r(
166
+ t === "view" && !e.isTemp && /* @__PURE__ */ r(
163
167
  c,
164
168
  {
165
169
  component: "a",
@@ -169,14 +173,14 @@ const U = ({
169
173
  variant: "subtle",
170
174
  color: "gray",
171
175
  size: "sm",
172
- className: t.downloadButton,
176
+ className: a.downloadButton,
173
177
  children: /* @__PURE__ */ r(x, { size: 16, icon: g })
174
178
  }
175
179
  )
176
180
  ]
177
181
  }
178
182
  ),
179
- a === "draft" && i && /* @__PURE__ */ r(
183
+ t === "draft" && i && /* @__PURE__ */ r(
180
184
  c,
181
185
  {
182
186
  size: "xs",
@@ -185,7 +189,7 @@ const U = ({
185
189
  variant: "filled",
186
190
  color: "dark",
187
191
  onClick: () => i(l),
188
- className: t.deleteButton,
192
+ className: a.deleteButton,
189
193
  children: /* @__PURE__ */ r(I, { size: "12px" })
190
194
  }
191
195
  )
@@ -1,6 +1,17 @@
1
1
  import { ColorSwatchProps, FlexProps } from '@mantine/core';
2
2
  import { ColorPickerList } from './ColorPickerList';
3
3
  import type { ColorItem } from './types';
4
+ type ColorPickerProps = {
5
+ value?: string | null;
6
+ onChange?: (v: string) => void;
7
+ allowCustomColor?: boolean;
8
+ colors?: ColorItem[];
9
+ swatchShape?: 'circle' | 'square';
10
+ swatchVariant?: 'filled' | 'outline';
11
+ withTick?: boolean;
12
+ fullWidth?: boolean;
13
+ swatchSize?: number;
14
+ } & Omit<FlexProps, 'onChange'>;
4
15
  interface ColorCircleProps extends Omit<ColorSwatchProps, 'color'>, Omit<React.ComponentPropsWithoutRef<'div'>, keyof Omit<ColorSwatchProps, 'color'>> {
5
16
  value?: string | null;
6
17
  label?: string;
@@ -12,17 +23,7 @@ interface ColorCircleProps extends Omit<ColorSwatchProps, 'color'>, Omit<React.C
12
23
  bgColor?: string;
13
24
  }
14
25
  export declare const ColorCircle: import("react").ForwardRefExoticComponent<ColorCircleProps & import("react").RefAttributes<HTMLDivElement>>;
15
- export declare const ColorPicker: import("react").ForwardRefExoticComponent<{
16
- value?: string | null;
17
- onChange?: (v: string) => void;
18
- allowCustomColor?: boolean;
19
- colors?: ColorItem[];
20
- swatchShape?: "circle" | "square";
21
- swatchVariant?: "filled" | "outline";
22
- withTick?: boolean;
23
- fullWidth?: boolean;
24
- swatchSize?: number;
25
- } & Omit<FlexProps, "onChange"> & import("react").RefAttributes<HTMLDivElement>> & {
26
+ export declare const ColorPicker: import("react").ForwardRefExoticComponent<Omit<ColorPickerProps, "ref"> & import("react").RefAttributes<HTMLDivElement>> & {
26
27
  ColorCircle: import("react").ForwardRefExoticComponent<ColorCircleProps & import("react").RefAttributes<HTMLDivElement>>;
27
28
  List: typeof ColorPickerList;
28
29
  Toolbar: import("react").ForwardRefExoticComponent<import("./ColorPickerToolbar").ColorPickerToolbarProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPicker.d.ts","sourceRoot":"","sources":["../../../src/components/ColorPicker/ColorPicker.tsx"],"names":[],"mappings":"AAIA,OAAO,EAIL,gBAAgB,EAEhB,SAAS,EAKV,MAAM,eAAe,CAAC;AAMvB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAiHzC,UAAU,gBACR,SAAQ,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,EACrC,IAAI,CACF,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,EACrC,MAAM,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,CACtC;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAClC,aAAa,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,WAAW,6GAmDvB,CAAC;AASF,eAAO,MAAM,WAAW;YAzLd,MAAM,GAAG,IAAI;eACV,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;uBACX,OAAO;aACjB,SAAS,EAAE;kBACN,QAAQ,GAAG,QAAQ;oBACjB,QAAQ,GAAG,SAAS;eACzB,OAAO;gBACN,OAAO;iBACN,MAAM;;;;;CAqLnB,CAAC"}
1
+ {"version":3,"file":"ColorPicker.d.ts","sourceRoot":"","sources":["../../../src/components/ColorPicker/ColorPicker.tsx"],"names":[],"mappings":"AAKA,OAAO,EAIL,gBAAgB,EAEhB,SAAS,EAKV,MAAM,eAAe,CAAC;AAKvB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGzC,KAAK,gBAAgB,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAClC,aAAa,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;AAyGhC,UAAU,gBACR,SAAQ,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,EACrC,IAAI,CACF,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,EACrC,MAAM,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,CACtC;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAClC,aAAa,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,WAAW,6GAiFvB,CAAC;AASF,eAAO,MAAM,WAAW;;;;CAItB,CAAC"}
@@ -1,34 +1,35 @@
1
- import { jsx as e, jsxs as h } from "react/jsx-runtime";
2
- import { forwardRef as y, useState as x } from "react";
3
- import { Tick02Icon as j } from "@hugeicons/core-free-icons";
4
- import { HugeiconsIcon as A } from "@hugeicons/react";
5
- import { useMantineTheme as w, getThemeColor as E, Flex as C, Tooltip as R, ColorSwatch as D, parseThemeColor as F, ColorInput as H, ActionIcon as v } from "@mantine/core";
6
- import { IconPalette as M, IconPencil as U } from "@tabler/icons-react";
7
- import V from "styled-components";
8
- import { DEFAULT_VALUES as g } from "../../constants.js";
9
- import { ColorPickerToolbar as q } from "./ColorPickerToolbar.js";
1
+ import { jsx as e, jsxs as b } from "react/jsx-runtime";
2
+ import { forwardRef as k, useState as g } from "react";
3
+ import { useTranslation as j } from "react-i18next";
4
+ import { Tick02Icon as A } from "@hugeicons/core-free-icons";
5
+ import { HugeiconsIcon as E } from "@hugeicons/react";
6
+ import { useMantineTheme as z, getThemeColor as R, Flex as x, Tooltip as D, ColorSwatch as F, parseThemeColor as H, ColorInput as M, ActionIcon as y } from "@mantine/core";
7
+ import { IconPalette as U, IconPencil as V } from "@tabler/icons-react";
8
+ import q from "styled-components";
9
+ import { DEFAULT_VALUES as w } from "../../constants.js";
10
10
  import { ColorPickerList as _ } from "./ColorPickerList.js";
11
- import { normalizeColorItem as B } from "./types.js";
12
- const G = y(
11
+ import { ColorPickerToolbar as B } from "./ColorPickerToolbar.js";
12
+ import { resolveColorLabel as G, normalizeColorItem as J } from "./types.js";
13
+ const K = k(
13
14
  ({
14
15
  value: o,
15
16
  onChange: l,
16
17
  allowCustomColor: n,
17
18
  colors: s,
18
- swatchShape: a = "circle",
19
+ swatchShape: c = "circle",
19
20
  swatchVariant: m = "filled",
20
21
  withTick: d = !1,
21
22
  fullWidth: p = !1,
22
23
  swatchSize: i = 30,
23
24
  ...u
24
25
  }, f) => {
25
- const r = w(), t = F({
26
- color: o || g.COLORS[0],
27
- theme: r
28
- }), [z, I] = x(t.value), [O, b] = x(!1);
29
- return O ? /* @__PURE__ */ h(C, { align: "center", mih: 30, children: [
26
+ const h = z(), r = H({
27
+ color: o || w.COLORS[0],
28
+ theme: h
29
+ }), [t, C] = g(r.value), [L, v] = g(!1);
30
+ return L ? /* @__PURE__ */ b(x, { align: "center", mih: 30, children: [
30
31
  /* @__PURE__ */ e(
31
- H,
32
+ M,
32
33
  {
33
34
  w: "100%",
34
35
  popoverProps: {
@@ -38,57 +39,62 @@ const G = y(
38
39
  maxLength: 7,
39
40
  withEyeDropper: !1,
40
41
  size: "xs",
41
- value: z,
42
- onChange: I,
42
+ value: t,
43
+ onChange: C,
43
44
  onChangeEnd: l,
44
45
  placeholder: "Select custom color"
45
46
  }
46
47
  ),
47
48
  /* @__PURE__ */ e(
48
- v,
49
+ y,
49
50
  {
50
51
  radius: "xl",
51
52
  variant: "default",
52
53
  color: "gray",
53
- onClick: () => b(!1),
54
- children: /* @__PURE__ */ e(M, { size: 16 })
54
+ onClick: () => v(!1),
55
+ children: /* @__PURE__ */ e(U, { size: 16 })
55
56
  }
56
57
  )
57
- ] }, 1) : /* @__PURE__ */ h(
58
- C,
58
+ ] }, 1) : /* @__PURE__ */ b(
59
+ x,
59
60
  {
60
61
  ref: f,
61
62
  ...u,
62
63
  justify: p ? "space-between" : "flex-start",
63
64
  align: "center",
64
65
  children: [
65
- (s || g.COLORS).map((P, S) => {
66
- const { value: c, border: T, bg: L, label: $ } = B(P);
66
+ (s || w.COLORS).map((O, T) => {
67
+ const {
68
+ value: a,
69
+ border: P,
70
+ bg: S,
71
+ label: $
72
+ } = J(O);
67
73
  return /* @__PURE__ */ e(
68
- J,
74
+ N,
69
75
  {
70
- value: c,
76
+ value: a,
71
77
  label: $,
72
- isActive: c === o,
78
+ isActive: a === o,
73
79
  size: i - 4,
74
- swatchShape: a,
80
+ swatchShape: c,
75
81
  swatchVariant: m,
76
82
  withTick: d,
77
- borderColor: T,
78
- bgColor: L,
79
- onClick: () => l?.(c)
83
+ borderColor: P,
84
+ bgColor: S,
85
+ onClick: () => l?.(a)
80
86
  },
81
- c || S
87
+ a || T
82
88
  );
83
89
  }),
84
90
  n && /* @__PURE__ */ e(
85
- v,
91
+ y,
86
92
  {
87
93
  radius: "xl",
88
94
  variant: "default",
89
95
  color: "gray",
90
- onClick: () => b(!0),
91
- children: /* @__PURE__ */ e(U, { size: 16 })
96
+ onClick: () => v(!0),
97
+ children: /* @__PURE__ */ e(V, { size: 16 })
92
98
  }
93
99
  )
94
100
  ]
@@ -96,58 +102,78 @@ const G = y(
96
102
  2
97
103
  );
98
104
  }
99
- ), k = y(
100
- ({ value: o, label: l, isActive: n, swatchShape: s, swatchVariant: a = "filled", withTick: m, borderColor: d, bgColor: p, ...i }, u) => {
101
- const f = w(), r = o ? E(o, f) : "", t = a === "outline";
102
- return /* @__PURE__ */ e(C, { w: i.size || 24, h: i.size || 24, justify: "center", align: "center", style: { position: "relative" }, children: /* @__PURE__ */ e(R, { label: l || o || "", withArrow: !0, children: /* @__PURE__ */ h(
103
- D,
105
+ ), I = k(
106
+ ({
107
+ value: o,
108
+ label: l,
109
+ isActive: n,
110
+ swatchShape: s,
111
+ swatchVariant: c = "filled",
112
+ withTick: m,
113
+ borderColor: d,
114
+ bgColor: p,
115
+ ...i
116
+ }, u) => {
117
+ const f = z(), { t: h } = j("ui"), r = o ? R(o, f) : "", t = c === "outline", C = G(h, o, l);
118
+ return /* @__PURE__ */ e(
119
+ x,
104
120
  {
105
- ref: u,
106
- color: t ? "transparent" : r,
107
- radius: s === "circle" ? "xl" : "sm",
108
- styles: t ? {
109
- alphaOverlay: { display: "none" },
110
- shadowOverlay: { display: "none" }
111
- } : void 0,
112
- style: {
113
- cursor: "pointer",
114
- color: "var(--mantine-color-white)",
115
- background: t ? p || `var(--mantine-color-${o}-light, ${r}20)` : void 0,
116
- border: t ? `2px solid ${d || `var(--mantine-color-${o}-outline, ${r})`}` : void 0
117
- },
118
- ...i,
119
- children: [
120
- n && /* @__PURE__ */ e(
121
- "span",
122
- {
123
- style: {
124
- position: "absolute",
125
- top: -4,
126
- left: -4,
127
- right: -4,
128
- bottom: -4,
129
- border: `2px solid ${r}`,
130
- borderRadius: s === "circle" ? "var(--mantine-radius-xl)" : "var(--mantine-radius-sm)",
131
- pointerEvents: "none",
132
- boxSizing: "border-box"
133
- }
134
- }
135
- ),
136
- m && n && /* @__PURE__ */ e(A, { size: 20, icon: j })
137
- ]
121
+ w: i.size || 24,
122
+ h: i.size || 24,
123
+ justify: "center",
124
+ align: "center",
125
+ style: { position: "relative" },
126
+ children: /* @__PURE__ */ e(D, { label: C, withArrow: !0, zIndex: 300, children: /* @__PURE__ */ b(
127
+ F,
128
+ {
129
+ ref: u,
130
+ color: t ? "transparent" : r,
131
+ radius: s === "circle" ? "xl" : "sm",
132
+ styles: t ? {
133
+ alphaOverlay: { display: "none" },
134
+ shadowOverlay: { display: "none" }
135
+ } : void 0,
136
+ style: {
137
+ cursor: "pointer",
138
+ color: "var(--mantine-color-white)",
139
+ background: t ? p || `var(--mantine-color-${o}-light, ${r}20)` : void 0,
140
+ border: t ? `2px solid ${d || `var(--mantine-color-${o}-outline, ${r})`}` : void 0
141
+ },
142
+ ...i,
143
+ children: [
144
+ n && /* @__PURE__ */ e(
145
+ "span",
146
+ {
147
+ style: {
148
+ position: "absolute",
149
+ top: -4,
150
+ left: -4,
151
+ right: -4,
152
+ bottom: -4,
153
+ border: `2px solid ${r}`,
154
+ borderRadius: s === "circle" ? "var(--mantine-radius-xl)" : "var(--mantine-radius-sm)",
155
+ pointerEvents: "none",
156
+ boxSizing: "border-box"
157
+ }
158
+ }
159
+ ),
160
+ m && n && /* @__PURE__ */ e(E, { size: 20, icon: A })
161
+ ]
162
+ }
163
+ ) })
138
164
  }
139
- ) }) });
165
+ );
140
166
  }
141
- ), J = V(k)`
167
+ ), N = q(I)`
142
168
  .mantine-ColorSwatch-colorOverlay {
143
169
  border-radius: ${({ swatchShape: o }) => o === "square" ? "3px" : "50%"};
144
170
  }
145
- `, lo = Object.assign(G, {
146
- ColorCircle: k,
171
+ `, ao = Object.assign(K, {
172
+ ColorCircle: I,
147
173
  List: _,
148
- Toolbar: q
174
+ Toolbar: B
149
175
  });
150
176
  export {
151
- k as ColorCircle,
152
- lo as ColorPicker
177
+ I as ColorCircle,
178
+ ao as ColorPicker
153
179
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPickerList.d.ts","sourceRoot":"","sources":["../../../src/components/ColorPicker/ColorPickerList.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,oBAAoB,EAAgB,MAAM,SAAS,CAAC;AA8GlE;;oEAEoE;AACpE,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,MAAM,EACN,KAAK,EACL,QAAQ,EACR,OAAW,EACX,gBAAgB,GACjB,EAAE,oBAAoB,2CA4CtB"}
1
+ {"version":3,"file":"ColorPickerList.d.ts","sourceRoot":"","sources":["../../../src/components/ColorPicker/ColorPickerList.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,oBAAoB,EAAgB,MAAM,SAAS,CAAC;AAqHlE;;oEAEoE;AACpE,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,MAAM,EACN,KAAK,EACL,QAAQ,EACR,OAAW,EACX,gBAAgB,GACjB,EAAE,oBAAoB,2CA4CtB"}