Updated
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// components/Fileinput.js
|
||||
import { $, Tag, If, For } from "../sigpro.js";
|
||||
// import { $, Tag, If, For } from "../sigpro.js";
|
||||
import { ui, getIcon } from "../core/utils.js";
|
||||
|
||||
/**
|
||||
@@ -20,7 +20,7 @@ import { ui, getIcon } from "../core/utils.js";
|
||||
* - btn, btn-ghost, btn-xs, btn-circle
|
||||
*/
|
||||
export const Fileinput = (props) => {
|
||||
const { class: className, tooltip, max = 2, accept = "*", onSelect, ...rest } = props;
|
||||
const { class: className, tooltip, max = 2, accept = "*", onselect, ...rest } = props;
|
||||
|
||||
const selectedFiles = $([]);
|
||||
const isDragging = $(false);
|
||||
@@ -38,13 +38,13 @@ export const Fileinput = (props) => {
|
||||
}
|
||||
|
||||
selectedFiles([...selectedFiles(), ...fileList]);
|
||||
onSelect?.(selectedFiles());
|
||||
onselect?.(selectedFiles());
|
||||
};
|
||||
|
||||
const removeFile = (index) => {
|
||||
const updated = selectedFiles().filter((_, i) => i !== index);
|
||||
selectedFiles(updated);
|
||||
onSelect?.(updated);
|
||||
onselect?.(updated);
|
||||
};
|
||||
|
||||
return Tag("fieldset", { ...rest, class: ui('fieldset w-full p-0', className) }, [
|
||||
|
||||
Reference in New Issue
Block a user