@layers-app/shared 0.4.5 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/dist/components/AppContainer/AppContainer.d.ts.map +1 -1
  2. package/dist/components/AppContainer/AppContainer.js +72 -79
  3. package/dist/components/AppContainer/AppContainer.module.css.js +6 -6
  4. package/dist/components/AppContainer/components/AppsSidebar/TopSection.d.ts.map +1 -1
  5. package/dist/components/AppContainer/components/AppsSidebar/TopSection.js +24 -22
  6. package/dist/components/AppContainer/components/AppsSidebar/UserSection.d.ts.map +1 -1
  7. package/dist/components/AppContainer/components/AppsSidebar/UserSection.js +46 -37
  8. package/dist/components/AppContainer/components/Header.d.ts.map +1 -1
  9. package/dist/components/AppContainer/components/Header.js +6 -5
  10. package/dist/components/AppContainer/components/Main.js +4 -4
  11. package/dist/components/AppContainer/components/SlideAnimation.js +4 -4
  12. package/dist/components/AppContainer/components/ToolSidebar.d.ts.map +1 -1
  13. package/dist/components/AppContainer/components/ToolSidebar.js +161 -128
  14. package/dist/components/AppContainer/components/menus/HelpMenu/HelpMenu.d.ts.map +1 -1
  15. package/dist/components/AppContainer/components/menus/HelpMenu/HelpMenu.js +131 -121
  16. package/dist/components/AppContainer/hooks/useAppContainer.d.ts +1 -1
  17. package/dist/components/AppContainer/hooks/useAppContainer.d.ts.map +1 -1
  18. package/dist/components/AppContainer/hooks/useAppContainer.js +59 -56
  19. package/dist/components/AppContainer/hooks/useAppContainerDataStore.d.ts.map +1 -1
  20. package/dist/components/AppContainer/hooks/useAppContainerDataStore.js +4 -3
  21. package/dist/components/AppContainer/types.d.ts +1 -0
  22. package/dist/components/AppContainer/types.d.ts.map +1 -1
  23. package/dist/components/AttachmentsGalleryModal/components/ModalHeader.d.ts.map +1 -1
  24. package/dist/components/AttachmentsGalleryModal/components/ModalHeader.js +37 -37
  25. package/dist/components/AttachmentsGalleryModal/components/ShakePlayer/useShakePlayer.d.ts.map +1 -1
  26. package/dist/components/AttachmentsGalleryModal/components/ShakePlayer/useShakePlayer.js +68 -62
  27. package/dist/components/AttachmentsGalleryModal/helpers.d.ts +8 -0
  28. package/dist/components/AttachmentsGalleryModal/helpers.d.ts.map +1 -1
  29. package/dist/components/AttachmentsGalleryModal/helpers.js +22 -17
  30. package/dist/components/AttachmentsGalleryModal/hooks/useDownloadFile.d.ts.map +1 -1
  31. package/dist/components/AttachmentsGalleryModal/hooks/useDownloadFile.js +28 -25
  32. package/dist/components/AttachmentsGalleryModal/hooks/useGetPreviewUrl.d.ts.map +1 -1
  33. package/dist/components/AttachmentsGalleryModal/hooks/useGetPreviewUrl.js +36 -41
  34. package/dist/components/AttachmentsPreview/AttachmentsPreview.d.ts.map +1 -1
  35. package/dist/components/AttachmentsPreview/AttachmentsPreview.js +135 -80
  36. package/dist/components/AttachmentsPreview/AttachmentsPreview.module.css.js +24 -14
  37. package/dist/components/BouncingLogo/BouncingLogo.d.ts +1 -3
  38. package/dist/components/BouncingLogo/BouncingLogo.d.ts.map +1 -1
  39. package/dist/components/BouncingLogo/BouncingLogo.js +14 -20
  40. package/dist/components/BouncingLogo/BouncingLogo.module.css.js +4 -8
  41. package/dist/components/Chat/ChatBubble/ChatBubble.module.css.js +5 -5
  42. package/dist/components/Chat/ChatInput/ChatInput.module.css.js +40 -28
  43. package/dist/components/Chat/ChatInput/index.d.ts +29 -1
  44. package/dist/components/Chat/ChatInput/index.d.ts.map +1 -1
  45. package/dist/components/Chat/ChatInput/index.js +178 -118
  46. package/dist/components/Chat/ChatInput/smilePlusIcon.d.ts +3 -0
  47. package/dist/components/Chat/ChatInput/smilePlusIcon.d.ts.map +1 -0
  48. package/dist/components/Chat/ChatInput/smilePlusIcon.js +49 -0
  49. package/dist/components/Chat/ChatMessage/ChatMessage.module.css.js +9 -9
  50. package/dist/components/Chat/ChatMessage/index.d.ts +2 -0
  51. package/dist/components/Chat/ChatMessage/index.d.ts.map +1 -1
  52. package/dist/components/Chat/ChatMessage/index.js +136 -118
  53. package/dist/components/Chat/MediaDocument/MediaDocument.module.css.js +4 -4
  54. package/dist/components/Chat/MessageActions/index.d.ts +7 -0
  55. package/dist/components/Chat/MessageActions/index.d.ts.map +1 -1
  56. package/dist/components/Chat/MessageActions/index.js +33 -30
  57. package/dist/components/Chat/MessageList/MessageList.module.css.js +14 -10
  58. package/dist/components/Chat/MessageList/index.d.ts +30 -3
  59. package/dist/components/Chat/MessageList/index.d.ts.map +1 -1
  60. package/dist/components/Chat/MessageList/index.js +154 -66
  61. package/dist/components/Chat/MessageReactions/MessageReactions.module.css.js +7 -7
  62. package/dist/components/Chat/MessageReactions/index.d.ts +17 -0
  63. package/dist/components/Chat/MessageReactions/index.d.ts.map +1 -1
  64. package/dist/components/Chat/MessageReactions/index.js +60 -28
  65. package/dist/components/Chat/MessageStatus/MessageStatus.module.css.js +6 -4
  66. package/dist/components/Chat/MessageStatus/index.d.ts +1 -1
  67. package/dist/components/Chat/MessageStatus/index.d.ts.map +1 -1
  68. package/dist/components/Chat/MessageStatus/index.js +49 -34
  69. package/dist/components/CircleColorPicker/CircleColorPicker.d.ts.map +1 -1
  70. package/dist/components/CircleColorPicker/CircleColorPicker.js +17 -15
  71. package/dist/components/ColorPicker/ColorPicker.module.css.js +26 -20
  72. package/dist/components/ColorPicker/ColorPickerList.d.ts.map +1 -1
  73. package/dist/components/ColorPicker/ColorPickerList.js +81 -68
  74. package/dist/components/ColorPicker/ColorPickerToolbar.d.ts.map +1 -1
  75. package/dist/components/ColorPicker/ColorPickerToolbar.js +75 -70
  76. package/dist/components/ColorPicker/icons.js +5 -5
  77. package/dist/components/ColorPicker/types.d.ts +6 -0
  78. package/dist/components/ColorPicker/types.d.ts.map +1 -1
  79. package/dist/components/ColorPicker/types.js +53 -11
  80. package/dist/components/ColorPicker/useRecentColors.d.ts +3 -1
  81. package/dist/components/ColorPicker/useRecentColors.d.ts.map +1 -1
  82. package/dist/components/ColorPicker/useRecentColors.js +43 -20
  83. package/dist/components/EmojiPicker/EmojiPanel.d.ts +2 -1
  84. package/dist/components/EmojiPicker/EmojiPanel.d.ts.map +1 -1
  85. package/dist/components/EmojiPicker/EmojiPanel.js +73 -72
  86. package/dist/components/EmojiPicker/EmojiPicker.d.ts +16 -1
  87. package/dist/components/EmojiPicker/EmojiPicker.d.ts.map +1 -1
  88. package/dist/components/EmojiPicker/EmojiPicker.js +121 -86
  89. package/dist/components/EmojiPicker/IconsPanel.d.ts.map +1 -1
  90. package/dist/components/EmojiPicker/IconsPanel.js +28 -25
  91. package/dist/components/EntityIcon.d.ts +1 -0
  92. package/dist/components/EntityIcon.d.ts.map +1 -1
  93. package/dist/components/EntityIcon.js +80 -32
  94. package/dist/components/ErrorPage/components/Error403.d.ts +5 -1
  95. package/dist/components/ErrorPage/components/Error403.d.ts.map +1 -1
  96. package/dist/components/ErrorPage/components/Error403.js +25 -21
  97. package/dist/components/ErrorPage/index.d.ts +5 -1
  98. package/dist/components/ErrorPage/index.d.ts.map +1 -1
  99. package/dist/components/ErrorPage/index.js +17 -10
  100. package/dist/components/MusicPlayerBar/components/HoverActions.js +28 -28
  101. package/dist/components/NavMenu/NavMenu.d.ts +7 -1
  102. package/dist/components/NavMenu/NavMenu.d.ts.map +1 -1
  103. package/dist/components/NavMenu/NavMenu.js +54 -44
  104. package/dist/components/NavMenu/NavMenu.module.css.js +10 -10
  105. package/dist/components/NavMenu/components/NavMenuItem.d.ts.map +1 -1
  106. package/dist/components/NavMenu/components/NavMenuItem.js +84 -84
  107. package/dist/components/NavMenu/types.d.ts +4 -0
  108. package/dist/components/NavMenu/types.d.ts.map +1 -1
  109. package/dist/components/WorkspaceMenu/WorkspaceItem.d.ts.map +1 -1
  110. package/dist/components/WorkspaceMenu/WorkspaceItem.js +16 -14
  111. package/dist/config/envConfig.d.ts +2 -0
  112. package/dist/config/envConfig.d.ts.map +1 -1
  113. package/dist/config/envConfig.js +41 -37
  114. package/dist/helpers/showNotifications.d.ts +15 -0
  115. package/dist/helpers/showNotifications.d.ts.map +1 -1
  116. package/dist/helpers/showNotifications.js +114 -72
  117. package/dist/helpers/showNotifications.module.css.js +16 -4
  118. package/dist/hooks/useUiPref.d.ts +2 -0
  119. package/dist/hooks/useUiPref.d.ts.map +1 -0
  120. package/dist/hooks/useUiPref.js +80 -0
  121. package/dist/index.css +1 -1
  122. package/dist/index.d.ts +1 -0
  123. package/dist/index.d.ts.map +1 -1
  124. package/dist/index.js +550 -540
  125. package/dist/lang/locales/ui_en.json.js +1 -1
  126. package/dist/lang/locales/ui_es.json.js +1 -1
  127. package/dist/lang/locales/ui_ru.json.js +1 -1
  128. package/package.json +1 -1
@@ -1,16 +1,58 @@
1
- function f(r) {
2
- return typeof r == "string" ? { value: r } : r;
1
+ function f(t) {
2
+ return t === "textColor" || t === "color";
3
3
  }
4
- function e(r) {
5
- return r === "inherit" || r === "" || r === "default";
4
+ function g(t) {
5
+ return f(t) ? "text" : "highlight";
6
6
  }
7
- const s = (r, o, n) => {
8
- if (n) return n;
9
- const t = !o || e(o) ? "standard" : o;
10
- return r(`colorPicker.colors.${t}`, { defaultValue: o || "" });
7
+ const h = typeof navigator < "u" && /Mac|iPhone|iPod|iPad/i.test(navigator.platform || navigator.userAgent), d = h ? "⌘⇧H" : "Ctrl+Shift+H";
8
+ function $(t) {
9
+ return typeof t == "string" ? { value: t } : t;
10
+ }
11
+ function p(t) {
12
+ return t === "inherit" || t === "" || t === "default";
13
+ }
14
+ function c(t) {
15
+ if (!t) return null;
16
+ const r = t.trim().toLowerCase();
17
+ if (r === "" || r === "inherit" || r === "default" || r === "transparent")
18
+ return "default";
19
+ const o = r.match(/^#([0-9a-f]{3,8})$/);
20
+ if (o) {
21
+ let n = o[1];
22
+ if ((n.length === 3 || n.length === 4) && (n = n.split("").map((e) => e + e).join("")), n.length === 6 || n.length === 8) {
23
+ const e = parseInt(n.slice(0, 2), 16), a = parseInt(n.slice(2, 4), 16), i = parseInt(n.slice(4, 6), 16), l = n.length === 8 ? parseInt(n.slice(6, 8), 16) / 255 : 1;
24
+ return `${e},${a},${i},${Math.round(l * 1e3) / 1e3}`;
25
+ }
26
+ }
27
+ const s = r.match(/^rgba?\(([^)]+)\)$/);
28
+ if (s) {
29
+ const n = s[1].split(",").map((e) => e.trim());
30
+ if (n.length >= 3) {
31
+ const e = parseInt(n[0], 10), a = parseInt(n[1], 10), i = parseInt(n[2], 10), l = n[3] !== void 0 ? parseFloat(n[3]) : 1;
32
+ if (![e, a, i].some(Number.isNaN)) {
33
+ const u = Number.isNaN(l) ? 1 : l;
34
+ return `${e},${a},${i},${Math.round(u * 1e3) / 1e3}`;
35
+ }
36
+ }
37
+ }
38
+ return r;
39
+ }
40
+ function m(t, r) {
41
+ const o = c(t), s = c(r);
42
+ return o !== null && s !== null && o === s;
43
+ }
44
+ const C = (t, r, o) => {
45
+ if (o) return o;
46
+ const s = !r || p(r) ? "standard" : r;
47
+ return t(`colorPicker.colors.${s}`, { defaultValue: r || "" });
11
48
  };
12
49
  export {
13
- e as isDefaultColor,
14
- f as normalizeColorItem,
15
- s as resolveColorLabel
50
+ h as IS_APPLE,
51
+ d as RECENT_COLOR_HOTKEY,
52
+ m as colorsEqual,
53
+ p as isDefaultColor,
54
+ f as isTextSectionKey,
55
+ $ as normalizeColorItem,
56
+ C as resolveColorLabel,
57
+ g as resolveRecentKind
16
58
  };
@@ -1,7 +1,9 @@
1
- import type { RecentColorEntry } from './types';
1
+ import type { RecentColorEntry, RecentColorKind } from './types';
2
2
  interface UseRecentColorsOptions {
3
3
  storageKey?: string;
4
4
  maxItems?: number;
5
+ onApplyShortcut?: (color: string, kind: RecentColorKind) => void;
6
+ shortcutScoped?: boolean;
5
7
  }
6
8
  export declare function useRecentColors(options?: UseRecentColorsOptions): {
7
9
  recentColors: RecentColorEntry[];
@@ -1 +1 @@
1
- {"version":3,"file":"useRecentColors.d.ts","sourceRoot":"","sources":["../../../src/components/ColorPicker/useRecentColors.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAKhD,UAAU,sBAAsB;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAmBD,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,sBAAsB;;uBAYpD,MAAM,eAAe,MAAM,WAAW,MAAM;;;EAsBvD"}
1
+ {"version":3,"file":"useRecentColors.d.ts","sourceRoot":"","sources":["../../../src/components/ColorPicker/useRecentColors.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAQjE,UAAU,sBAAsB;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC;IACjE,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AA2BD,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,sBAAsB;;uBAepD,MAAM,eAAe,MAAM,WAAW,MAAM;;;EAkDvD"}
@@ -1,6 +1,8 @@
1
- import { useState as I, useCallback as c } from "react";
2
- const d = "color-picker-recent", p = 11;
3
- function n(e) {
1
+ import { useState as R, useCallback as f, useRef as A, useEffect as w } from "react";
2
+ import { resolveRecentKind as I, IS_APPLE as C } from "./types.js";
3
+ const k = "color-picker-recent", L = 11;
4
+ let i = 0;
5
+ function a(e) {
4
6
  try {
5
7
  const t = localStorage.getItem(e);
6
8
  return t ? JSON.parse(t) : [];
@@ -8,32 +10,53 @@ function n(e) {
8
10
  return [];
9
11
  }
10
12
  }
11
- function E(e, t, o) {
13
+ function T(e, t, r) {
12
14
  try {
13
- localStorage.setItem(e, JSON.stringify(t.slice(0, o)));
15
+ localStorage.setItem(e, JSON.stringify(t.slice(0, r)));
14
16
  } catch {
15
17
  }
16
18
  }
17
- function v(e) {
18
- const t = e?.storageKey ?? d, o = e?.maxItems ?? p, [i, r] = I(() => n(t)), S = c(() => {
19
- r(n(t));
20
- }, [t]), g = c(
21
- (s, a, f) => {
22
- const y = n(t).filter(
23
- (m) => !(m.value === s && m.sectionKey === a)
24
- ), l = [{ value: s, sectionKey: a, border: f }, ...y].slice(0, o);
25
- E(t, l, o), r(l);
19
+ function _(e) {
20
+ return e.code !== "KeyH" || !e.shiftKey || e.altKey ? !1 : C ? e.metaKey && !e.ctrlKey : e.ctrlKey && !e.metaKey;
21
+ }
22
+ function F(e) {
23
+ const t = e?.storageKey ?? k, r = e?.maxItems ?? L, l = e?.onApplyShortcut, s = e?.shortcutScoped ?? !1, [p, u] = R(
24
+ () => a(t)
25
+ ), h = f(() => {
26
+ u(a(t));
27
+ }, [t]), K = f(
28
+ (o, c, n) => {
29
+ const g = a(t).filter(
30
+ (S) => !(S.value === o && S.sectionKey === c)
31
+ ), m = [{ value: o, sectionKey: c, border: n }, ...g].slice(
32
+ 0,
33
+ r
34
+ );
35
+ T(t, m, r), u(m);
26
36
  },
27
- [t, o]
28
- ), u = c(() => {
37
+ [t, r]
38
+ ), E = f(() => {
29
39
  try {
30
40
  localStorage.removeItem(t);
31
41
  } catch {
32
42
  }
33
- r([]);
34
- }, [t]);
35
- return { recentColors: i, addRecent: g, clearRecent: u, reload: S };
43
+ u([]);
44
+ }, [t]), y = A(l);
45
+ y.current = l;
46
+ const d = !!l;
47
+ return w(() => {
48
+ if (!d) return;
49
+ s && (i += 1);
50
+ const o = (c) => {
51
+ if (!_(c) || !s && i > 0) return;
52
+ const n = a(t)[0];
53
+ n && (c.preventDefault(), y.current?.(n.value, I(n.sectionKey)));
54
+ };
55
+ return window.addEventListener("keydown", o), () => {
56
+ window.removeEventListener("keydown", o), s && (i -= 1);
57
+ };
58
+ }, [d, s, t]), { recentColors: p, addRecent: K, clearRecent: E, reload: h };
36
59
  }
37
60
  export {
38
- v as useRecentColors
61
+ F as useRecentColors
39
62
  };
@@ -1,6 +1,7 @@
1
1
  import { EmojiPickerProps } from './EmojiPicker';
2
- export declare const EmojiPanel: ({ locales, onChange, onClose, setRandomIcon, querySearch, }: Pick<EmojiPickerProps, "locales" | "value" | "onChange" | "querySearch"> & {
2
+ export declare const EmojiPanel: ({ locales, onChange, onClose, setRandomIcon, querySearch, showRandomButton, }: Pick<EmojiPickerProps, "locales" | "value" | "onChange" | "querySearch"> & {
3
3
  onClose: () => void;
4
4
  setRandomIcon: (icon: string) => void;
5
+ showRandomButton?: boolean;
5
6
  }) => import("react/jsx-runtime").JSX.Element;
6
7
  //# sourceMappingURL=EmojiPanel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmojiPanel.d.ts","sourceRoot":"","sources":["../../../src/components/EmojiPicker/EmojiPanel.tsx"],"names":[],"mappings":"AAyCA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAsBjD,eAAO,MAAM,UAAU,GAAI,6DAMxB,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,aAAa,CAAC,GAAG;IAC5E,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC,4CAiTA,CAAC"}
1
+ {"version":3,"file":"EmojiPanel.d.ts","sourceRoot":"","sources":["../../../src/components/EmojiPicker/EmojiPanel.tsx"],"names":[],"mappings":"AAyCA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAsBjD,eAAO,MAAM,UAAU,GAAI,+EAOxB,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,aAAa,CAAC,GAAG;IAC5E,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,4CAqTA,CAAC"}
@@ -1,61 +1,62 @@
1
1
  import { jsxs as y, jsx as t } from "react/jsx-runtime";
2
- import { useState as d, useRef as p, useEffect as R, useCallback as K } from "react";
3
- import { useTranslation as L } from "react-i18next";
4
- import { Search01Icon as U, ShuffleIcon as V, Clock01Icon as W, SmileIcon as X, Pizza01Icon as Z, FootballIcon as _, Airplane01Icon as ee, BulbIcon as te, Asterisk02Icon as oe, Flag02Icon as re } from "@hugeicons/core-free-icons";
2
+ import { useState as d, useRef as p, useEffect as A, useCallback as L } from "react";
3
+ import { useTranslation as U } from "react-i18next";
4
+ import { Search01Icon as V, ShuffleIcon as W, Clock01Icon as X, SmileIcon as Z, Pizza01Icon as _, FootballIcon as ee, Airplane01Icon as te, BulbIcon as oe, Asterisk02Icon as re, Flag02Icon as ne } from "@hugeicons/core-free-icons";
5
5
  import { HugeiconsIcon as c } from "@hugeicons/react";
6
- import { useEvent as ne } from "@layers-app/draggable-ui";
7
- import { Stack as v, FocusTrap as ie, Flex as z, TextInput as ce, Tooltip as se, ActionIcon as A, Paper as F, Text as q, SimpleGrid as N } from "@mantine/core";
8
- import ae from "fuse.js";
9
- import le from "../../assets/svg/dog.svg.js";
10
- import { pickRandomEmoji as fe } from "../../helpers/pickRandomEmoji.js";
11
- import { NoData as ue } from "../NoData/NoData.js";
12
- import { IconEntity as de } from "../ProjectIcon/ProjectIcon.js";
13
- import { frequentEmoji as pe } from "./constants.js";
14
- import { getEmojis as me } from "./utils.js";
6
+ import { useEvent as ie } from "@layers-app/draggable-ui";
7
+ import { Stack as v, FocusTrap as ce, Flex as z, TextInput as se, Tooltip as ae, ActionIcon as F, Paper as q, Text as N, SimpleGrid as M } from "@mantine/core";
8
+ import le from "fuse.js";
9
+ import fe from "../../assets/svg/dog.svg.js";
10
+ import { pickRandomEmoji as ue } from "../../helpers/pickRandomEmoji.js";
11
+ import { NoData as de } from "../NoData/NoData.js";
12
+ import { IconEntity as pe } from "../ProjectIcon/ProjectIcon.js";
13
+ import { frequentEmoji as me } from "./constants.js";
14
+ import { getEmojis as he } from "./utils.js";
15
15
  import T from "./EmojiPicker.module.css.js";
16
- const he = [
17
- { i: "frequent", icon: /* @__PURE__ */ t(c, { size: 20, icon: W }) },
18
- { i: "people", icon: /* @__PURE__ */ t(c, { size: 20, icon: X }) },
16
+ const ge = [
17
+ { i: "frequent", icon: /* @__PURE__ */ t(c, { size: 20, icon: X }) },
18
+ { i: "people", icon: /* @__PURE__ */ t(c, { size: 20, icon: Z }) },
19
19
  {
20
20
  i: "nature",
21
- icon: /* @__PURE__ */ t(le, { width: 20, height: 20 })
21
+ icon: /* @__PURE__ */ t(fe, { width: 20, height: 20 })
22
22
  },
23
- { i: "foods", icon: /* @__PURE__ */ t(c, { size: 20, icon: Z }) },
24
- { i: "activity", icon: /* @__PURE__ */ t(c, { size: 20, icon: _ }) },
25
- { i: "places", icon: /* @__PURE__ */ t(c, { size: 20, icon: ee }) },
26
- { i: "objects", icon: /* @__PURE__ */ t(c, { size: 20, icon: te }) },
27
- { i: "symbols", icon: /* @__PURE__ */ t(c, { size: 20, icon: oe }) },
28
- { i: "flags", icon: /* @__PURE__ */ t(c, { size: 20, icon: re }) }
29
- ], Re = ({
23
+ { i: "foods", icon: /* @__PURE__ */ t(c, { size: 20, icon: _ }) },
24
+ { i: "activity", icon: /* @__PURE__ */ t(c, { size: 20, icon: ee }) },
25
+ { i: "places", icon: /* @__PURE__ */ t(c, { size: 20, icon: te }) },
26
+ { i: "objects", icon: /* @__PURE__ */ t(c, { size: 20, icon: oe }) },
27
+ { i: "symbols", icon: /* @__PURE__ */ t(c, { size: 20, icon: re }) },
28
+ { i: "flags", icon: /* @__PURE__ */ t(c, { size: 20, icon: ne }) }
29
+ ], Ae = ({
30
30
  locales: u,
31
31
  onChange: C,
32
- onClose: M,
33
- setRandomIcon: P,
34
- querySearch: m
32
+ onClose: P,
33
+ setRandomIcon: Q,
34
+ querySearch: m,
35
+ showRandomButton: w = !0
35
36
  }) => {
36
- const [b, k] = d("frequent"), x = p("frequent"), h = p({}), I = p(null), [S, w] = d(""), [Q, O] = d([]), [a, B] = d(null), [E, j] = d([]), { t: G } = L(), g = p(!1), l = p(null);
37
- R(() => {
37
+ const [b, k] = d("frequent"), x = p("frequent"), h = p({}), I = p(null), [S, E] = d(""), [O, G] = d([]), [a, H] = d(null), [j, D] = d([]), { t: Y } = U(), g = p(!1), l = p(null);
38
+ A(() => {
38
39
  if (typeof m == "string") {
39
40
  const e = m.slice(1);
40
- if (w(e), a) {
41
+ if (E(e), a) {
41
42
  const o = a.search(e);
42
- j(o.map((r) => r.item.e));
43
+ D(o.map((r) => r.item.e));
43
44
  }
44
45
  }
45
- }, [m, a]), R(() => {
46
+ }, [m, a]), A(() => {
46
47
  (async () => {
47
- const o = await me(), r = o.flatMap(
48
+ const o = await he(), r = o.flatMap(
48
49
  (i) => i.e.map((n) => ({
49
50
  e: n.e,
50
51
  n: n.n,
51
52
  k: n.k
52
53
  // категория
53
54
  }))
54
- ), s = pe.map(
55
+ ), s = me.map(
55
56
  (i) => r.find((n) => n.e === i)
56
57
  );
57
- O([{ i: "frequent", e: s }, ...o]);
58
- const f = new ae(
58
+ G([{ i: "frequent", e: s }, ...o]);
59
+ const f = new le(
59
60
  o.flatMap(
60
61
  (i) => i.e.map((n) => ({
61
62
  e: n.e,
@@ -68,32 +69,32 @@ const he = [
68
69
  threshold: 0.3
69
70
  }
70
71
  );
71
- B(f);
72
+ H(f);
72
73
  })();
73
74
  }, []);
74
- const H = K(
75
+ const $ = L(
75
76
  (e) => {
76
77
  const o = e.currentTarget.value;
77
- if (w(o), a) {
78
+ if (E(o), a) {
78
79
  const r = a.search(o);
79
- j(r.map((s) => s.item.e));
80
+ D(r.map((s) => s.item.e));
80
81
  }
81
82
  },
82
83
  [a]
83
- ), D = ne((e) => {
84
+ ), R = ie((e) => {
84
85
  const o = e.currentTarget.getAttribute("data-icon");
85
86
  o && (C?.(
86
- de.stringify({
87
+ pe.stringify({
87
88
  emoji: o.replace("e:", "")
88
89
  })
89
- ), M());
90
- }), Y = (e) => {
90
+ ), P());
91
+ }), B = (e) => {
91
92
  const o = I.current, r = h.current[e.i];
92
93
  if (!o || !r) return;
93
94
  g.current = !0, l.current = e.i, k(e.i);
94
95
  const s = r.offsetTop - o.offsetTop;
95
96
  o.scrollTo({ top: s, behavior: "smooth" });
96
- }, $ = () => {
97
+ }, J = () => {
97
98
  const e = I.current;
98
99
  if (!e) return;
99
100
  const o = e.scrollTop;
@@ -112,9 +113,9 @@ const he = [
112
113
  n < s && (s = n, r = f);
113
114
  }
114
115
  }), r !== x.current && (x.current = r, k(r));
115
- }, J = typeof m == "string";
116
+ }, K = typeof m == "string";
116
117
  return /* @__PURE__ */ y(v, { gap: 0, h: "100%", children: [
117
- /* @__PURE__ */ t(ie, { active: !0, children: /* @__PURE__ */ y(
118
+ /* @__PURE__ */ t(ce, { active: !0, children: /* @__PURE__ */ y(
118
119
  z,
119
120
  {
120
121
  my: "sm",
@@ -125,9 +126,9 @@ const he = [
125
126
  h: 38,
126
127
  children: [
127
128
  /* @__PURE__ */ t(
128
- ce,
129
+ se,
129
130
  {
130
- leftSection: /* @__PURE__ */ t(c, { size: 16, icon: U }),
131
+ leftSection: /* @__PURE__ */ t(c, { size: 16, icon: V }),
131
132
  value: S,
132
133
  placeholder: `${u?.search}...`,
133
134
  "data-autofocus": !0,
@@ -137,26 +138,26 @@ const he = [
137
138
  borderRadius: "var(--mantine-radius-default)"
138
139
  }
139
140
  },
140
- w: 320,
141
- onChange: H,
141
+ w: w ? 320 : "100%",
142
+ onChange: $,
142
143
  radius: "var(--mantine-radius-default)"
143
144
  }
144
145
  ),
145
- /* @__PURE__ */ t(se, { withArrow: !0, label: u?.random || G("random"), children: /* @__PURE__ */ t(
146
- A,
146
+ w && /* @__PURE__ */ t(ae, { withArrow: !0, label: u?.random || Y("random"), children: /* @__PURE__ */ t(
147
+ F,
147
148
  {
148
149
  h: 36,
149
150
  w: 36,
150
151
  variant: "outline",
151
152
  color: "var(--mantine-color-default-border)",
152
- onClick: () => fe(P, C),
153
+ onClick: () => ue(Q, C),
153
154
  className: T.randomIcon,
154
155
  children: /* @__PURE__ */ t(
155
156
  c,
156
157
  {
157
158
  color: "var(--mantine-color-default-color)",
158
159
  size: 20,
159
- icon: V
160
+ icon: W
160
161
  }
161
162
  )
162
163
  }
@@ -174,10 +175,10 @@ const he = [
174
175
  overflowY: "auto"
175
176
  },
176
177
  ref: I,
177
- onScroll: $,
178
- children: S ? /* @__PURE__ */ y(v, { flex: 1, align: "stretch", children: [
179
- !J && /* @__PURE__ */ t(
180
- F,
178
+ onScroll: J,
179
+ children: S ? /* @__PURE__ */ y(v, { flex: 1, align: "stretch", gap: 0, children: [
180
+ !K && /* @__PURE__ */ t(
181
+ q,
181
182
  {
182
183
  py: 6,
183
184
  px: 6,
@@ -185,20 +186,20 @@ const he = [
185
186
  top: -1,
186
187
  style: { zIndex: 1 },
187
188
  bg: "light-dark(var(--mantine-color-white), var(--mantine-color-dark-6))",
188
- children: /* @__PURE__ */ t(q, { fz: "sm", c: "dimmed", children: u?.searchResults })
189
+ children: /* @__PURE__ */ t(N, { fz: "xs", fw: 500, lh: "140%", c: "dimmed", children: u?.searchResults })
189
190
  }
190
191
  ),
191
- E.length ? /* @__PURE__ */ t(N, { cols: 10, spacing: 0, children: E.map((e) => /* @__PURE__ */ t(
192
+ j.length ? /* @__PURE__ */ t(M, { cols: 10, spacing: 0, children: j.map((e) => /* @__PURE__ */ t(
192
193
  "div",
193
194
  {
194
195
  className: T.item,
195
196
  "data-icon": e,
196
- onClick: D,
197
+ onClick: R,
197
198
  children: e
198
199
  },
199
200
  e
200
201
  )) }) : /* @__PURE__ */ t(z, { flex: 1, justify: "center", align: "stretch", children: /* @__PURE__ */ t(
201
- ue,
202
+ de,
202
203
  {
203
204
  size: 100,
204
205
  description: u?.searchNoResults,
@@ -207,7 +208,7 @@ const he = [
207
208
  }
208
209
  }
209
210
  ) })
210
- ] }) : Q.map((e) => /* @__PURE__ */ y(
211
+ ] }) : O.map((e) => /* @__PURE__ */ y(
211
212
  "div",
212
213
  {
213
214
  ref: (o) => {
@@ -215,24 +216,24 @@ const he = [
215
216
  },
216
217
  children: [
217
218
  /* @__PURE__ */ t(
218
- F,
219
+ q,
219
220
  {
220
- bg: "transparent",
221
+ bg: "light-dark(var(--mantine-color-white), var(--mantine-color-dark-6))",
221
222
  py: 2,
222
223
  px: 6,
223
224
  pos: "sticky",
224
225
  top: -1,
225
226
  h: 23,
226
227
  style: { zIndex: 1 },
227
- children: /* @__PURE__ */ t(q, { fz: "xs", c: "dimmed", children: u?.emojiCategory?.[e.i] })
228
+ children: /* @__PURE__ */ t(N, { fz: "xs", fw: 500, lh: "140%", c: "dimmed", children: u?.emojiCategory?.[e.i] })
228
229
  }
229
230
  ),
230
- /* @__PURE__ */ t(N, { cols: 10, spacing: 0, children: e.e.map((o) => /* @__PURE__ */ t(
231
+ /* @__PURE__ */ t(M, { cols: 10, spacing: 0, children: e.e.map((o) => /* @__PURE__ */ t(
231
232
  "div",
232
233
  {
233
234
  className: T.item,
234
235
  "data-icon": o.e,
235
- onClick: D,
236
+ onClick: R,
236
237
  children: o.e
237
238
  },
238
239
  o.e
@@ -252,14 +253,14 @@ const he = [
252
253
  justify: "space-between",
253
254
  h: "56px",
254
255
  px: 8,
255
- children: he.map((e) => /* @__PURE__ */ t(
256
- A,
256
+ children: ge.map((e) => /* @__PURE__ */ t(
257
+ F,
257
258
  {
258
259
  variant: b === e.i ? "light" : "subtle",
259
260
  color: b === e.i ? "var(--mantine-color-default-color)" : "var(--mantine-color-dimmed)",
260
261
  radius: "default",
261
262
  size: 32,
262
- onClick: () => Y(e),
263
+ onClick: () => B(e),
263
264
  "data-active": b === e.i,
264
265
  children: e.icon
265
266
  },
@@ -270,5 +271,5 @@ const he = [
270
271
  ] });
271
272
  };
272
273
  export {
273
- Re as EmojiPanel
274
+ Ae as EmojiPanel
274
275
  };
@@ -12,6 +12,14 @@ export type EmojiPickerProps = {
12
12
  showIcons?: boolean;
13
13
  showColors?: boolean;
14
14
  showEmojis?: boolean;
15
+ showGifs?: boolean;
16
+ /**
17
+ * Called when a GIF is picked from the GIF tab. Receives the GIF's URL.
18
+ * Distinct from {@link onChange} because hosts treat a GIF differently from
19
+ * an emoji/icon — chat composers send it as a message rather than inserting
20
+ * it into the text.
21
+ */
22
+ onSelectGif?: (url: string) => void;
15
23
  querySearch?: string;
16
24
  defaultActiveTab?: string | null;
17
25
  /** Controls how the popover opens. 'click' preserves current behavior; 'realtime' opens only when typing matches triggerRegex. */
@@ -22,6 +30,12 @@ export type EmojiPickerProps = {
22
30
  typingSeq?: number;
23
31
  /** If true, clicking the random icon button will not close the popover. Default: false */
24
32
  keepOpenOnRandom?: boolean;
33
+ /**
34
+ * Show the "Random" (shuffle) button next to the search field. Default: true.
35
+ * Connect chat composer + message reactions pass false — a random emoji is
36
+ * meaningless there.
37
+ */
38
+ showRandomButton?: boolean;
25
39
  /**
26
40
  * If false, picking an emoji does NOT close the popover — useful for chat
27
41
  * composers where users typically want to insert several emoji at once.
@@ -39,7 +53,8 @@ export type EmojiPickerLocales = {
39
53
  remove?: string;
40
54
  random?: string;
41
55
  icons?: string;
56
+ gifs?: string;
42
57
  emojiCategory?: Record<string, string>;
43
58
  };
44
- export declare const EmojiPicker: ({ project, value, querySearch, children, onChange, position, popoverProps, showIcons, showColors, defaultActiveTab, showEmojis, withinPortal, locales: _locales, openWhen, triggerRegex, typingSeq, showRemoveButton, keepOpenOnRandom, closeOnSelect, }: PropsWithChildren<EmojiPickerProps>) => import("react/jsx-runtime").JSX.Element;
59
+ export declare const EmojiPicker: ({ project, value, querySearch, children, onChange, position, popoverProps, showIcons, showColors, showGifs, onSelectGif, defaultActiveTab, showEmojis, withinPortal, locales: _locales, openWhen, triggerRegex, typingSeq, showRemoveButton, keepOpenOnRandom, showRandomButton, closeOnSelect, }: PropsWithChildren<EmojiPickerProps>) => import("react/jsx-runtime").JSX.Element;
45
60
  //# sourceMappingURL=EmojiPicker.d.ts.map
@@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