next-helios-fe 1.4.52 → 1.5.1
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/dist/components/chart/index.d.ts +1 -1
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/input/file.d.ts +1 -0
- package/dist/components/form/other/emoji.d.ts +14 -0
- package/dist/components/syntax-highlighter/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -1
- package/src/components/chart/index.tsx +1 -1
- package/src/components/form/index.tsx +3 -0
- package/src/components/form/input/file.tsx +12 -2
- package/src/components/form/other/emoji.tsx +66 -0
- package/src/components/syntax-highlighter/index.tsx +1 -1
- package/src/styles/emoji.scss +18 -0
- package/src/styles/index.css +1 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "next-helios-fe",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.5.1",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
@@ -17,6 +17,7 @@
|
|
17
17
|
"apexcharts": "^3.51.0",
|
18
18
|
"array-move": "^4.0.0",
|
19
19
|
"autoprefixer": "^10.4.19",
|
20
|
+
"emoji-picker-react": "^4.12.0",
|
20
21
|
"file-saver": "^2.0.5",
|
21
22
|
"leaflet": "^1.9.4",
|
22
23
|
"leaflet-defaulticon-compatibility": "^0.1.2",
|
@@ -21,6 +21,7 @@ import {
|
|
21
21
|
type MultipleSelectProps,
|
22
22
|
} from "./other/multipleSelect";
|
23
23
|
import { Autocomplete, type AutocompleteProps } from "./other/autocomplete";
|
24
|
+
import { Emoji, type EmojiProps } from "./other/emoji";
|
24
25
|
|
25
26
|
interface FormProps extends React.FormHTMLAttributes<HTMLFormElement> {
|
26
27
|
children: React.ReactNode;
|
@@ -45,6 +46,7 @@ interface FormComponent extends React.FC<FormProps> {
|
|
45
46
|
Select: React.FC<SelectProps>;
|
46
47
|
MultipleSelect: React.FC<MultipleSelectProps>;
|
47
48
|
Autocomplete: React.FC<AutocompleteProps>;
|
49
|
+
Emoji: React.FC<EmojiProps>;
|
48
50
|
}
|
49
51
|
|
50
52
|
export const Form: FormComponent = ({ children, onSubmit, ...rest }) => {
|
@@ -79,3 +81,4 @@ Form.Textarea = Textarea;
|
|
79
81
|
Form.Select = Select;
|
80
82
|
Form.MultipleSelect = MultipleSelect;
|
81
83
|
Form.Autocomplete = Autocomplete;
|
84
|
+
Form.Emoji = Emoji;
|
@@ -5,6 +5,7 @@ import { Icon } from "@iconify/react";
|
|
5
5
|
export interface FileProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
6
6
|
options?: {
|
7
7
|
variant?: "basic" | "drag&drop";
|
8
|
+
buttonVariant?: "basic" | "button";
|
8
9
|
maxSizeInMb?: number;
|
9
10
|
buttonOnly?: boolean;
|
10
11
|
width?: "full" | "fit";
|
@@ -184,14 +185,23 @@ export const File: React.FC<FileProps> = ({
|
|
184
185
|
{options?.variant !== "drag&drop" && (
|
185
186
|
<button
|
186
187
|
type="button"
|
187
|
-
className=
|
188
|
+
className={
|
189
|
+
options?.buttonVariant === "button"
|
190
|
+
? "hover:text-primary"
|
191
|
+
: "p-2 rounded-full hover:bg-secondary-light"
|
192
|
+
}
|
188
193
|
tabIndex={-1}
|
189
194
|
disabled={rest.disabled}
|
190
195
|
onClick={() => {
|
191
196
|
inputRef.current?.click();
|
192
197
|
}}
|
193
198
|
>
|
194
|
-
<Icon
|
199
|
+
<Icon
|
200
|
+
icon="mi:attachment"
|
201
|
+
className={
|
202
|
+
options?.buttonVariant === "button" ? "text-2xl" : "text-xl"
|
203
|
+
}
|
204
|
+
/>
|
195
205
|
</button>
|
196
206
|
)}
|
197
207
|
</div>
|
@@ -0,0 +1,66 @@
|
|
1
|
+
"use client";
|
2
|
+
import React, { useState, useEffect } from "react";
|
3
|
+
import { Icon } from "@iconify/react";
|
4
|
+
import EmojiPicker, { Theme } from "emoji-picker-react";
|
5
|
+
import "../../../styles";
|
6
|
+
|
7
|
+
export interface EmojiProps {
|
8
|
+
theme?: "light" | "dark";
|
9
|
+
options?: {
|
10
|
+
buttonVariant?: "basic" | "button";
|
11
|
+
};
|
12
|
+
onChoose?: (e: {
|
13
|
+
target: {
|
14
|
+
value: string;
|
15
|
+
};
|
16
|
+
}) => void;
|
17
|
+
}
|
18
|
+
|
19
|
+
export const Emoji: React.FC<EmojiProps> = ({ theme, options, onChoose }) => {
|
20
|
+
const [open, setOpen] = useState(false);
|
21
|
+
|
22
|
+
useEffect(() => {
|
23
|
+
if (open) {
|
24
|
+
document.addEventListener("mousedown", (e) => {
|
25
|
+
if (e.target instanceof HTMLElement && !e.target.closest("#emoji")) {
|
26
|
+
setOpen(false);
|
27
|
+
}
|
28
|
+
});
|
29
|
+
}
|
30
|
+
}, [open]);
|
31
|
+
|
32
|
+
return (
|
33
|
+
<div id="emoji" className="relative flex justify-center items-center">
|
34
|
+
<button
|
35
|
+
type="button"
|
36
|
+
className={
|
37
|
+
options?.buttonVariant === "button"
|
38
|
+
? "hover:text-primary"
|
39
|
+
: "p-2 rounded-full hover:bg-secondary-light"
|
40
|
+
}
|
41
|
+
tabIndex={-1}
|
42
|
+
onClick={() => setOpen(!open)}
|
43
|
+
>
|
44
|
+
<Icon
|
45
|
+
icon="mdi:emoticon-happy-outline"
|
46
|
+
className={
|
47
|
+
options?.buttonVariant === "button" ? "text-2xl" : "text-xl"
|
48
|
+
}
|
49
|
+
/>
|
50
|
+
</button>
|
51
|
+
<div className="absolute bottom-0 left-0 mb-10 -ml-6">
|
52
|
+
<EmojiPicker
|
53
|
+
open={open}
|
54
|
+
theme={theme === "light" ? Theme.LIGHT : Theme.DARK}
|
55
|
+
className="!border-default !bg-secondary-bg"
|
56
|
+
searchPlaceHolder="search.."
|
57
|
+
autoFocusSearch={false}
|
58
|
+
onEmojiClick={(emojiObject) => {
|
59
|
+
onChoose && onChoose({ target: { value: emojiObject.emoji } });
|
60
|
+
setOpen(false);
|
61
|
+
}}
|
62
|
+
/>
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
);
|
66
|
+
};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#emoji {
|
2
|
+
input {
|
3
|
+
border: 1.5px solid var(--border-color-default);
|
4
|
+
background-color: var(--background-secondary);
|
5
|
+
color: var(--color-default);
|
6
|
+
padding-left: 36px;
|
7
|
+
|
8
|
+
&::placeholder{
|
9
|
+
color: rgb(203 213 225);
|
10
|
+
}
|
11
|
+
|
12
|
+
&:focus {
|
13
|
+
box-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
14
|
+
--tw-ring-color: var(--color-primary-dark);
|
15
|
+
border: 1.5px solid var(--color-primary);
|
16
|
+
}
|
17
|
+
};
|
18
|
+
};
|
package/src/styles/index.css
CHANGED