@arkyn/components 1.4.8 → 1.4.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.
Files changed (50) hide show
  1. package/dist/bundle.js +35452 -11761
  2. package/dist/bundle.umd.cjs +592 -72
  3. package/dist/components/AudioUpload/AudioUploadError/index.d.ts +5 -0
  4. package/dist/components/AudioUpload/AudioUploadError/index.d.ts.map +1 -0
  5. package/dist/components/AudioUpload/AudioUploadError/index.js +10 -0
  6. package/dist/components/AudioUpload/AudioUploadLabel/index.d.ts +5 -0
  7. package/dist/components/AudioUpload/AudioUploadLabel/index.d.ts.map +1 -0
  8. package/dist/components/AudioUpload/AudioUploadLabel/index.js +9 -0
  9. package/dist/components/AudioUpload/HasFileContent/index.d.ts +5 -0
  10. package/dist/components/AudioUpload/HasFileContent/index.d.ts.map +1 -0
  11. package/dist/components/AudioUpload/HasFileContent/index.js +82 -0
  12. package/dist/components/AudioUpload/NoFileContent/index.d.ts +5 -0
  13. package/dist/components/AudioUpload/NoFileContent/index.d.ts.map +1 -0
  14. package/dist/components/AudioUpload/NoFileContent/index.js +29 -0
  15. package/dist/components/AudioUpload/index.d.ts +5 -0
  16. package/dist/components/AudioUpload/index.d.ts.map +1 -0
  17. package/dist/components/AudioUpload/index.js +58 -0
  18. package/dist/components/ImageUpload/HasFileContent/index.d.ts +2 -2
  19. package/dist/components/ImageUpload/HasFileContent/index.d.ts.map +1 -1
  20. package/dist/components/ImageUpload/NoFileContent/index.d.ts +2 -2
  21. package/dist/components/ImageUpload/NoFileContent/index.d.ts.map +1 -1
  22. package/dist/components/Input/CpfCpnjInput/getConfig.d.ts +1 -1
  23. package/dist/components/Input/CurrencyInput/getConfig.d.ts +1 -1
  24. package/dist/components/Input/MaskInput/getConfig.d.ts +1 -1
  25. package/dist/components/Input/SimpleInput/getConfig.d.ts +2 -2
  26. package/dist/components/Select/getConfig.d.ts +1 -1
  27. package/dist/components/Slider/index.d.ts +5 -0
  28. package/dist/components/Slider/index.d.ts.map +1 -0
  29. package/dist/components/Slider/index.js +52 -0
  30. package/dist/index.d.ts +2 -0
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +2 -0
  33. package/dist/style.css +1 -1
  34. package/package.json +1 -1
  35. package/src/components/AudioUpload/AudioUploadError/index.tsx +12 -0
  36. package/src/components/AudioUpload/AudioUploadError/styles.css +6 -0
  37. package/src/components/AudioUpload/AudioUploadLabel/index.tsx +13 -0
  38. package/src/components/AudioUpload/AudioUploadLabel/styles.css +15 -0
  39. package/src/components/AudioUpload/HasFileContent/index.tsx +163 -0
  40. package/src/components/AudioUpload/HasFileContent/styles.css +59 -0
  41. package/src/components/AudioUpload/NoFileContent/index.tsx +59 -0
  42. package/src/components/AudioUpload/NoFileContent/styles.css +19 -0
  43. package/src/components/AudioUpload/index.tsx +121 -0
  44. package/src/components/AudioUpload/styles.css +33 -0
  45. package/src/components/ImageUpload/HasFileContent/index.tsx +2 -2
  46. package/src/components/ImageUpload/NoFileContent/index.tsx +2 -2
  47. package/src/components/ImageUpload/styles.css +1 -1
  48. package/src/components/Slider/index.tsx +73 -0
  49. package/src/components/Slider/styles.css +37 -0
  50. package/src/index.ts +2 -0
@@ -0,0 +1,5 @@
1
+ import { AudioUploadErrorProps } from "@arkyn/types";
2
+ import "./styles.css";
3
+ declare function AudioUploadError(props: AudioUploadErrorProps): import("react/jsx-runtime").JSX.Element;
4
+ export { AudioUploadError };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/AudioUpload/AudioUploadError/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,cAAc,CAAC;AAEtB,iBAAS,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,2CAMrD;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import "./styles.css";
3
+ function AudioUploadError(props) {
4
+ const { error } = props;
5
+ const className = `arkynAudioUploadError`;
6
+ if (error)
7
+ return _jsx("strong", { className: className, children: error });
8
+ return _jsx(_Fragment, {});
9
+ }
10
+ export { AudioUploadError };
@@ -0,0 +1,5 @@
1
+ import { AudioUploadLabelProps } from "@arkyn/types";
2
+ import "./styles.css";
3
+ declare function AudioUploadLabel(props: AudioUploadLabelProps): import("react/jsx-runtime").JSX.Element;
4
+ export { AudioUploadLabel };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/AudioUpload/AudioUploadLabel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,cAAc,CAAC;AAEtB,iBAAS,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,2CAOrD;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "./styles.css";
3
+ function AudioUploadLabel(props) {
4
+ const { label, showAsterisk } = props;
5
+ const show = showAsterisk ? "asteriskTrue" : "asteriskFalse";
6
+ const className = `arkynAudioUploadLabel ${show}`;
7
+ return _jsx("strong", { className: className.trim(), children: label });
8
+ }
9
+ export { AudioUploadLabel };
@@ -0,0 +1,5 @@
1
+ import { AudioUploadHasFileContentProps } from "@arkyn/types";
2
+ import "./styles.css";
3
+ declare function HasFileContent(props: AudioUploadHasFileContentProps): import("react/jsx-runtime").JSX.Element;
4
+ export { HasFileContent };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/AudioUpload/HasFileContent/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,cAAc,CAAC;AAM9D,OAAO,cAAc,CAAC;AAEtB,iBAAS,cAAc,CAAC,KAAK,EAAE,8BAA8B,2CAuJ5D;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,82 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, Divider, IconButton, Tooltip } from "@arkyn/components";
3
+ import { Pause, Play, RefreshCw } from "lucide-react";
4
+ import { useEffect, useRef, useState } from "react";
5
+ import { Slider } from "../../Slider";
6
+ import "./styles.css";
7
+ function HasFileContent(props) {
8
+ const { filePath, disabled, acceptAudio, handleSelectFile, isLoading, reSendAudio, changeAudioButtonText, } = props;
9
+ const [sliderValue, setSliderValue] = useState(0);
10
+ const audioReference = useRef(null);
11
+ const [isDragging, setIsDragging] = useState(false);
12
+ const [isPlaying, setIsPlaying] = useState(false);
13
+ useEffect(() => {
14
+ const audioElement = audioReference.current;
15
+ if (!audioElement)
16
+ return;
17
+ const handleTimeUpdate = () => {
18
+ const totalTime = audioElement.duration;
19
+ const currentTime = audioElement.currentTime;
20
+ const value = (currentTime / totalTime) * 100;
21
+ setSliderValue(value);
22
+ };
23
+ audioElement.addEventListener("timeupdate", handleTimeUpdate);
24
+ return () => {
25
+ audioElement.removeEventListener("timeupdate", handleTimeUpdate);
26
+ };
27
+ }, []);
28
+ function handleSliderChange(value) {
29
+ const audioElement = audioReference.current;
30
+ if (!audioElement)
31
+ return;
32
+ const totalTime = audioElement.duration;
33
+ const currentTime = (value / 100) * totalTime;
34
+ audioElement.currentTime = currentTime;
35
+ }
36
+ function handlePlayAudio() {
37
+ audioReference.current?.play();
38
+ setIsPlaying(true);
39
+ }
40
+ function handlePauseAudio() {
41
+ audioReference.current?.pause();
42
+ setIsPlaying(false);
43
+ }
44
+ function handleToggleAudio() {
45
+ if (isPlaying)
46
+ handlePauseAudio();
47
+ else
48
+ handlePlayAudio();
49
+ }
50
+ const currentTime = audioReference.current?.currentTime;
51
+ const totalTime = audioReference.current?.duration;
52
+ function formatTime(time) {
53
+ if (!time)
54
+ return "00:00";
55
+ const minutes = Math.floor(time / 60);
56
+ const seconds = Math.floor(time % 60);
57
+ const formattedMinutes = String(minutes).padStart(2, "0");
58
+ const formattedSeconds = String(seconds).padStart(2, "0");
59
+ return `${formattedMinutes}:${formattedSeconds}`;
60
+ }
61
+ if (isDragging || !isPlaying) {
62
+ audioReference.current?.pause();
63
+ }
64
+ else if (isPlaying) {
65
+ audioReference.current?.play();
66
+ }
67
+ function handleClick() {
68
+ if (disabled)
69
+ return;
70
+ const input = document.createElement("input");
71
+ input.type = "file";
72
+ input.accept = acceptAudio;
73
+ input.onchange = (event) => {
74
+ const file = event.target.files?.[0];
75
+ if (file)
76
+ handleSelectFile(file);
77
+ };
78
+ input.click();
79
+ }
80
+ return (_jsxs("div", { className: "arkynAudioUploadHasFileContentContainer", children: [_jsx("audio", { ref: audioReference, src: filePath, onEnded: handlePauseAudio }), _jsxs("div", { className: "arkynAudioUploadAudioPlayer", children: [_jsxs("button", { type: "button", onClick: handleToggleAudio, children: [isPlaying && _jsx(Pause, {}), !isPlaying && _jsx(Play, {})] }), _jsx("p", { children: formatTime(currentTime) }), _jsx(Slider, { value: sliderValue, onChange: handleSliderChange, onDragging: setIsDragging }), _jsx("p", { children: formatTime(totalTime) })] }), _jsx(Divider, {}), _jsxs("div", { className: "arkynAudioUploadButtonsContainer", children: [!!reSendAudio && (_jsx(Tooltip, { orientation: "bottom", text: "Reenviar imagem", children: _jsx(IconButton, { type: "button", "aria-label": "resend image", variant: "outline", scheme: "danger", size: "sm", isLoading: isLoading, onClick: reSendAudio, icon: RefreshCw, disabled: disabled }) })), _jsx(Button, { isLoading: isLoading, onClick: handleClick, variant: "outline", size: "sm", type: "button", disabled: disabled, children: changeAudioButtonText })] })] }));
81
+ }
82
+ export { HasFileContent };
@@ -0,0 +1,5 @@
1
+ import { AudioUploadNoFileContentProps } from "@arkyn/types";
2
+ import "./styles.css";
3
+ declare function NoFileContent(props: AudioUploadNoFileContentProps): import("react/jsx-runtime").JSX.Element;
4
+ export { NoFileContent };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/AudioUpload/NoFileContent/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AAG7D,OAAO,cAAc,CAAC;AAEtB,iBAAS,aAAa,CAAC,KAAK,EAAE,6BAA6B,2CAkD1D;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button } from "@arkyn/components";
3
+ import "./styles.css";
4
+ function NoFileContent(props) {
5
+ const { dropAudioText, isLoading, acceptAudio, handleSelectFile, selectAudioButtonText, disabled, } = props;
6
+ function handleDrop(event) {
7
+ if (disabled)
8
+ return;
9
+ event.preventDefault();
10
+ const file = event.dataTransfer.files[0];
11
+ if (file)
12
+ handleSelectFile(file);
13
+ }
14
+ function handleClick() {
15
+ if (disabled)
16
+ return;
17
+ const input = document.createElement("input");
18
+ input.type = "file";
19
+ input.accept = acceptAudio;
20
+ input.onchange = (event) => {
21
+ const file = event.target.files?.[0];
22
+ if (file)
23
+ handleSelectFile(file);
24
+ };
25
+ input.click();
26
+ }
27
+ return (_jsxs("div", { onDrop: handleDrop, className: "arkynAudioUploadNoFileContent", children: [_jsx(Button, { isLoading: isLoading, onClick: handleClick, variant: "ghost", size: "sm", type: "button", disabled: disabled, children: selectAudioButtonText }), _jsx("p", { children: dropAudioText })] }));
28
+ }
29
+ export { NoFileContent };
@@ -0,0 +1,5 @@
1
+ import { AudioUploadProps } from "@arkyn/types";
2
+ import "./styles.css";
3
+ declare function AudioUpload(props: AudioUploadProps): import("react/jsx-runtime").JSX.Element;
4
+ export { AudioUpload };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/AudioUpload/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAQhD,OAAO,cAAc,CAAC;AAEtB,iBAAS,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CA2G3C;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,58 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useFieldErrors } from "@arkyn/components";
3
+ import { useState } from "react";
4
+ import { AudioUploadError } from "./AudioUploadError";
5
+ import { AudioUploadLabel } from "./AudioUploadLabel";
6
+ import { HasFileContent } from "./HasFileContent";
7
+ import { NoFileContent } from "./NoFileContent";
8
+ import "./styles.css";
9
+ function AudioUpload(props) {
10
+ const { name, label, fileName = "file", method = "POST", onUpload, fileResponseName = "url", selectAudioButtonText = "Selecionar arquivo de áudio", dropAudioText = "Ou arraste e solte um arquivo de áudio aqui", changeAudioButtonText = "Trocar arquivo de áudio", acceptAudio = "audio/*", action, defaultValue = "", showAsterisk = false, disabled = false, } = props;
11
+ const fieldErrors = useFieldErrors();
12
+ const fieldError = fieldErrors[name];
13
+ const [value, setValue] = useState(defaultValue);
14
+ const [error, setError] = useState("");
15
+ const [file, setFile] = useState(null);
16
+ const [filePath, setFilePath] = useState(defaultValue);
17
+ const [isLoading, setIsLoading] = useState(false);
18
+ async function handleUploadAudio(file) {
19
+ if (disabled)
20
+ return;
21
+ setIsLoading(true);
22
+ setFile(file);
23
+ setError("");
24
+ const formData = new FormData();
25
+ formData.append(fileName, file);
26
+ await fetch(action, { method: method, body: formData })
27
+ .then(async (response) => await response.json())
28
+ .then((response) => {
29
+ if (!!response?.error)
30
+ setError(response.error);
31
+ else
32
+ setValue(response?.[fileResponseName]);
33
+ onUpload && onUpload(response?.[fileResponseName]);
34
+ })
35
+ .catch((error) => {
36
+ console.error(error);
37
+ setError("Erro ao enviar audio");
38
+ })
39
+ .finally(() => setIsLoading(false));
40
+ }
41
+ function handleSelectFile(file) {
42
+ if (disabled)
43
+ return;
44
+ console.log(file.type);
45
+ if (file.type.indexOf("audio") === -1) {
46
+ setError("O arquivo selecionado não é um arquivo de áudio");
47
+ return;
48
+ }
49
+ setFilePath(URL.createObjectURL(file));
50
+ handleUploadAudio(file);
51
+ }
52
+ const errorMessage = fieldError || error;
53
+ const hasErrorClassName = errorMessage ? "hasError" : "noHasError";
54
+ const hasImageClassName = filePath ? "hasAudio" : "noHasAudio";
55
+ const className = `arkynAudioUpload ${hasErrorClassName} ${hasImageClassName}`;
56
+ return (_jsxs("div", { className: "arkynAudioUploadContainer", children: [label && _jsx(AudioUploadLabel, { label: label, showAsterisk: showAsterisk }), _jsxs("div", { className: className, children: [_jsx("input", { type: "hidden", name: name, value: value || "" }), !filePath && (_jsx(NoFileContent, { disabled: disabled, isLoading: isLoading, acceptAudio: acceptAudio, dropAudioText: dropAudioText, handleSelectFile: handleSelectFile, selectAudioButtonText: selectAudioButtonText })), filePath && (_jsx(HasFileContent, { filePath: filePath, acceptAudio: acceptAudio, changeAudioButtonText: changeAudioButtonText, disabled: disabled, handleSelectFile: handleSelectFile, isLoading: isLoading, reSendAudio: !!errorMessage && file ? () => handleUploadAudio(file) : undefined }))] }), errorMessage && _jsx(AudioUploadError, { error: errorMessage })] }));
57
+ }
58
+ export { AudioUpload };
@@ -1,5 +1,5 @@
1
- import { HasFileContentProps } from "@arkyn/types";
1
+ import { ImageUploadHasFileContentProps } from "@arkyn/types";
2
2
  import "./styles.css";
3
- declare function HasFileContent(props: HasFileContentProps): import("react/jsx-runtime").JSX.Element;
3
+ declare function HasFileContent(props: ImageUploadHasFileContentProps): import("react/jsx-runtime").JSX.Element;
4
4
  export { HasFileContent };
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ImageUpload/HasFileContent/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAOnD,OAAO,cAAc,CAAC;AAEtB,iBAAS,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CA4DjD;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ImageUpload/HasFileContent/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,cAAc,CAAC;AAO9D,OAAO,cAAc,CAAC;AAEtB,iBAAS,cAAc,CAAC,KAAK,EAAE,8BAA8B,2CA4D5D;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -1,5 +1,5 @@
1
- import { NoFileContentProps } from "@arkyn/types";
1
+ import { ImageUploadNoFileContentProps } from "@arkyn/types";
2
2
  import "./styles.css";
3
- declare function NoFileContent(props: NoFileContentProps): import("react/jsx-runtime").JSX.Element;
3
+ declare function NoFileContent(props: ImageUploadNoFileContentProps): import("react/jsx-runtime").JSX.Element;
4
4
  export { NoFileContent };
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ImageUpload/NoFileContent/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAKlD,OAAO,cAAc,CAAC;AAEtB,iBAAS,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CAkD/C;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ImageUpload/NoFileContent/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AAK7D,OAAO,cAAc,CAAC;AAEtB,iBAAS,aAAa,CAAC,KAAK,EAAE,6BAA6B,2CAkD1D;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -267,6 +267,7 @@ declare function getConfig(props: CpfCnpjInputProps, isFocused: boolean): {
267
267
  name: string;
268
268
  width?: number | string | undefined;
269
269
  step?: number | string | undefined;
270
+ src?: string | undefined;
270
271
  formAction?: string | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS] | undefined;
271
272
  formEncType?: string | undefined;
272
273
  formMethod?: string | undefined;
@@ -283,7 +284,6 @@ declare function getConfig(props: CpfCnpjInputProps, isFocused: boolean): {
283
284
  pattern?: string | undefined;
284
285
  placeholder?: string | undefined;
285
286
  required?: boolean | undefined;
286
- src?: string | undefined;
287
287
  value?: string;
288
288
  isLoading: boolean;
289
289
  className: string;
@@ -266,6 +266,7 @@ declare function getConfig(props: CurrencyInputProps, isFocused: boolean): {
266
266
  name: string;
267
267
  width?: number | string | undefined;
268
268
  step?: number | string | undefined;
269
+ src?: string | undefined;
269
270
  formAction?: string | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS] | undefined;
270
271
  formEncType?: string | undefined;
271
272
  formMethod?: string | undefined;
@@ -282,7 +283,6 @@ declare function getConfig(props: CurrencyInputProps, isFocused: boolean): {
282
283
  pattern?: string | undefined;
283
284
  placeholder?: string | undefined;
284
285
  required?: boolean | undefined;
285
- src?: string | undefined;
286
286
  defaultValue?: string | number | null;
287
287
  onChangeValue?: (event: import("react").ChangeEvent<HTMLInputElement>, originalValue: string, maskedValue: string) => void;
288
288
  value?: string;
@@ -268,6 +268,7 @@ declare function getConfig(props: MaskedInputProps, isFocused: boolean): {
268
268
  min?: number | string | undefined;
269
269
  width?: number | string | undefined;
270
270
  step?: number | string | undefined;
271
+ src?: string | undefined;
271
272
  formAction?: string | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS] | undefined;
272
273
  formEncType?: string | undefined;
273
274
  formMethod?: string | undefined;
@@ -284,7 +285,6 @@ declare function getConfig(props: MaskedInputProps, isFocused: boolean): {
284
285
  pattern?: string | undefined;
285
286
  placeholder?: string | undefined;
286
287
  required?: boolean | undefined;
287
- src?: string | undefined;
288
288
  mask: string;
289
289
  separate?: boolean;
290
290
  replacement?: string | import("@react-input/mask").Replacement;
@@ -1,6 +1,6 @@
1
1
  import type { SimpleInputProps } from "@arkyn/types";
2
2
  declare function getConfig(props: SimpleInputProps, isFocused: boolean): {
3
- type: "number" | "hidden" | "color" | "search" | "button" | "text" | "tel" | "url" | "email" | "date" | "time" | "image" | "submit" | "reset" | "datetime-local" | "file" | "month" | "password" | "range" | "week";
3
+ type: "number" | "hidden" | "color" | "search" | "button" | "text" | "tel" | "url" | "email" | "date" | "time" | "image" | "reset" | "submit" | "file" | "datetime-local" | "month" | "password" | "range" | "week";
4
4
  name: string;
5
5
  defaultChecked?: boolean | undefined;
6
6
  defaultValue?: string | number | readonly string[] | undefined;
@@ -269,6 +269,7 @@ declare function getConfig(props: SimpleInputProps, isFocused: boolean): {
269
269
  min?: number | string | undefined;
270
270
  width?: number | string | undefined;
271
271
  step?: number | string | undefined;
272
+ src?: string | undefined;
272
273
  formAction?: string | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS] | undefined;
273
274
  formEncType?: string | undefined;
274
275
  formMethod?: string | undefined;
@@ -285,7 +286,6 @@ declare function getConfig(props: SimpleInputProps, isFocused: boolean): {
285
286
  pattern?: string | undefined;
286
287
  placeholder?: string | undefined;
287
288
  required?: boolean | undefined;
288
- src?: string | undefined;
289
289
  isLoading: boolean;
290
290
  className: string;
291
291
  prefix: import("react/jsx-runtime").JSX.Element;
@@ -278,6 +278,7 @@ declare function getConfig(props: SelectProps, isFocused: boolean): {
278
278
  min?: number | string | undefined;
279
279
  width?: number | string | undefined;
280
280
  step?: number | string | undefined;
281
+ src?: string | undefined;
281
282
  formAction?: string | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS] | undefined;
282
283
  formEncType?: string | undefined;
283
284
  formMethod?: string | undefined;
@@ -294,7 +295,6 @@ declare function getConfig(props: SelectProps, isFocused: boolean): {
294
295
  pattern?: string | undefined;
295
296
  placeholder?: string | undefined;
296
297
  required?: boolean | undefined;
297
- src?: string | undefined;
298
298
  isLoading: boolean;
299
299
  className: string;
300
300
  prefix: import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { SliderProps } from "@arkyn/types";
2
+ import "./styles.css";
3
+ declare function Slider(props: SliderProps): import("react/jsx-runtime").JSX.Element;
4
+ export { Slider };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Slider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,cAAc,CAAC;AAEtB,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,2CAiEjC;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from "react";
3
+ import "./styles.css";
4
+ function Slider(props) {
5
+ const { onChange, value, disableDrag = false, onDragging } = props;
6
+ const [isDragging, setIsDragging] = useState(false);
7
+ const sliderRef = useRef(null);
8
+ const handleMouseDown = () => {
9
+ setIsDragging(true);
10
+ };
11
+ const handleMouseUp = () => {
12
+ setIsDragging(false);
13
+ };
14
+ const handleMouseMove = (event) => {
15
+ if (disableDrag)
16
+ return;
17
+ if (!isDragging || !sliderRef.current)
18
+ return;
19
+ const rect = sliderRef.current.getBoundingClientRect();
20
+ const offsetX = event.clientX - rect.left;
21
+ const newValue = Math.min(Math.max((offsetX / rect.width) * 100, 0), 100);
22
+ onChange(newValue);
23
+ };
24
+ const handleSliderClick = (event) => {
25
+ if (!sliderRef.current)
26
+ return;
27
+ const rect = sliderRef.current.getBoundingClientRect();
28
+ const offsetX = event.clientX - rect.left;
29
+ const newValue = Math.min(Math.max((offsetX / rect.width) * 100, 0), 100);
30
+ onChange(newValue);
31
+ };
32
+ useEffect(() => {
33
+ if (isDragging) {
34
+ onDragging && onDragging(true);
35
+ document.addEventListener("mousemove", handleMouseMove);
36
+ document.addEventListener("mouseup", handleMouseUp);
37
+ }
38
+ else {
39
+ onDragging && onDragging(false);
40
+ document.removeEventListener("mousemove", handleMouseMove);
41
+ document.removeEventListener("mouseup", handleMouseUp);
42
+ }
43
+ return () => {
44
+ document.removeEventListener("mousemove", handleMouseMove);
45
+ document.removeEventListener("mouseup", handleMouseUp);
46
+ };
47
+ }, [isDragging]);
48
+ const isDraggingClass = isDragging ? "isDragging" : "isNotDragging";
49
+ const sliderClassname = `arkynSliderTrack ${isDraggingClass}`;
50
+ return (_jsxs("div", { className: sliderClassname, ref: sliderRef, onMouseDown: handleMouseDown, onClick: handleSliderClick, children: [_jsx("div", { className: "arkynSliderFill", style: { width: `${value}%` } }), _jsx("div", { className: "arkynSliderThumb", style: { left: `${value}%` } })] }));
51
+ }
52
+ export { Slider };
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export { Card } from "./components/Card";
4
4
  export { Divider } from "./components/Divider";
5
5
  export { Skeleton } from "./components/Skeleton";
6
6
  export { TableBody, TableCaption, TableContainer, TableFooter, TableHeader, } from "./components/Table";
7
+ export { AudioUpload } from "./components/AudioUpload";
7
8
  export { Button } from "./components/Button";
8
9
  export { Checkbox } from "./components/Checkbox";
9
10
  export { FormController, FormError, FormLabel } from "./components/Form";
@@ -14,6 +15,7 @@ export { MultiSelect } from "./components/MultiSelect";
14
15
  export { RadioBox, RadioGroup } from "./components/Radio";
15
16
  export { RichText } from "./components/RichText";
16
17
  export { Select } from "./components/Select";
18
+ export { Slider } from "./components/Slider";
17
19
  export { Switch } from "./components/Switch";
18
20
  export { Textarea } from "./components/Textarea";
19
21
  export { BreadcrumbContainer, BreadcrumbLink } from "./components/Breadcrumb";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,UAAU,GACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EACL,SAAS,EACT,YAAY,EACZ,cAAc,EACd,WAAW,EACX,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC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,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ export { Divider } from "./components/Divider";
6
6
  export { Skeleton } from "./components/Skeleton";
7
7
  export { TableBody, TableCaption, TableContainer, TableFooter, TableHeader, } from "./components/Table";
8
8
  // Form
9
+ export { AudioUpload } from "./components/AudioUpload";
9
10
  export { Button } from "./components/Button";
10
11
  export { Checkbox } from "./components/Checkbox";
11
12
  export { FormController, FormError, FormLabel } from "./components/Form";
@@ -16,6 +17,7 @@ export { MultiSelect } from "./components/MultiSelect";
16
17
  export { RadioBox, RadioGroup } from "./components/Radio";
17
18
  export { RichText } from "./components/RichText";
18
19
  export { Select } from "./components/Select";
20
+ export { Slider } from "./components/Slider";
19
21
  export { Switch } from "./components/Switch";
20
22
  export { Textarea } from "./components/Textarea";
21
23
  // Navigation