next-helios-fe 1.9.8 → 1.9.10
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.
package/package.json
CHANGED
@@ -7,6 +7,9 @@ import { Item, type ItemProps } from "./item";
|
|
7
7
|
interface DropdownProps extends Omit<Dp, "label" | "trigger"> {
|
8
8
|
trigger?: React.ReactNode;
|
9
9
|
actionTrigger?: "click" | "hover";
|
10
|
+
options?: {
|
11
|
+
disableMaxHeight?: boolean;
|
12
|
+
};
|
10
13
|
}
|
11
14
|
|
12
15
|
interface DropdownComponent extends React.FC<DropdownProps> {
|
@@ -17,6 +20,7 @@ interface DropdownComponent extends React.FC<DropdownProps> {
|
|
17
20
|
export const Dropdown: DropdownComponent = ({
|
18
21
|
trigger,
|
19
22
|
actionTrigger,
|
23
|
+
options,
|
20
24
|
...rest
|
21
25
|
}) => {
|
22
26
|
const childrenList = React.Children.toArray(rest.children);
|
@@ -30,7 +34,9 @@ export const Dropdown: DropdownComponent = ({
|
|
30
34
|
return (
|
31
35
|
<Dd
|
32
36
|
label=""
|
33
|
-
className=
|
37
|
+
className={`w-min px-1 z-20 rounded-md border-default bg-secondary-bg overflow-x-hidden overflow-y-auto ${
|
38
|
+
options?.disableMaxHeight ? "h-fit" : "max-h-96"
|
39
|
+
}`}
|
34
40
|
dismissOnClick={rest.dismissOnClick ?? true}
|
35
41
|
theme={{
|
36
42
|
floating: {
|
@@ -1,5 +1,6 @@
|
|
1
1
|
"use client";
|
2
|
-
import React
|
2
|
+
import React from "react";
|
3
|
+
import { Dropdown } from "../../../components";
|
3
4
|
import { Icon } from "@iconify/react";
|
4
5
|
import EmojiPicker, { Theme } from "emoji-picker-react";
|
5
6
|
import "../../../styles";
|
@@ -23,51 +24,44 @@ export const Emoji: React.FC<EmojiProps> = ({
|
|
23
24
|
disabled,
|
24
25
|
onChoose,
|
25
26
|
}) => {
|
26
|
-
const [open, setOpen] = useState(false);
|
27
|
-
|
28
|
-
useEffect(() => {
|
29
|
-
if (open) {
|
30
|
-
document.addEventListener("mousedown", (e) => {
|
31
|
-
if (e.target instanceof HTMLElement && !e.target.closest("#emoji")) {
|
32
|
-
setOpen(false);
|
33
|
-
}
|
34
|
-
});
|
35
|
-
}
|
36
|
-
}, [open]);
|
37
|
-
|
38
27
|
return (
|
39
|
-
<
|
40
|
-
|
41
|
-
|
42
|
-
className=
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
28
|
+
<Dropdown
|
29
|
+
placement="top-start"
|
30
|
+
trigger={
|
31
|
+
<div className="flex items-center justify-center">
|
32
|
+
<button
|
33
|
+
type="button"
|
34
|
+
className={
|
35
|
+
options?.buttonVariant === "button"
|
36
|
+
? "hover:text-primary disabled:text-disabled"
|
37
|
+
: "p-2 rounded-full hover:bg-secondary-light disabled:bg-secondary-light disabled:text-disabled"
|
38
|
+
}
|
39
|
+
tabIndex={-1}
|
40
|
+
disabled={disabled ?? false}
|
41
|
+
>
|
42
|
+
<Icon
|
43
|
+
icon="mdi:emoticon-happy-outline"
|
44
|
+
className={
|
45
|
+
options?.buttonVariant === "button" ? "text-2xl" : "text-xl"
|
46
|
+
}
|
47
|
+
/>
|
48
|
+
</button>
|
49
|
+
</div>
|
50
|
+
}
|
51
|
+
options={{ disableMaxHeight: true }}
|
52
|
+
dismissOnClick={false}
|
53
|
+
>
|
54
|
+
<EmojiPicker
|
55
|
+
open={true}
|
56
|
+
theme={theme === "light" ? Theme.LIGHT : Theme.DARK}
|
57
|
+
className="!border-0 !bg-secondary-bg"
|
58
|
+
height={384}
|
59
|
+
searchDisabled
|
60
|
+
previewConfig={{ showPreview: false }}
|
61
|
+
onEmojiClick={(emojiObject) => {
|
62
|
+
onChoose && onChoose({ target: { value: emojiObject.emoji } });
|
63
|
+
}}
|
64
|
+
/>
|
65
|
+
</Dropdown>
|
72
66
|
);
|
73
67
|
};
|