leptos_use_drop_zone/
options.rs1use default_struct_builder::DefaultBuilder;
2use std::fmt::{Debug, Formatter};
3use std::sync::Arc;
4
5#[derive(DefaultBuilder, Clone)]
7#[cfg_attr(feature = "ssr", allow(dead_code))]
8pub struct UseDropZoneOptions {
9 pub(crate) on_drop: Arc<dyn Fn(UseDropZoneEvent) + Send + Sync>,
11 pub(crate) on_enter: Arc<dyn Fn(UseDropZoneEvent) + Send + Sync>,
13 pub(crate) on_leave: Arc<dyn Fn(UseDropZoneEvent) + Send + Sync>,
15 pub(crate) on_over: Arc<dyn Fn(UseDropZoneEvent) + Send + Sync>,
17}
18
19impl Default for UseDropZoneOptions {
20 fn default() -> Self {
21 Self {
22 on_drop: Arc::new(|_| {}),
23 on_enter: Arc::new(|_| {}),
24 on_leave: Arc::new(|_| {}),
25 on_over: Arc::new(|_| {}),
26 }
27 }
28}
29
30impl Debug for UseDropZoneOptions {
31 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
32 write!(f, "UseDropZoneOptions")
33 }
34}
35
36#[derive(Clone, Debug)]
38pub struct UseDropZoneEvent {
39 pub files: Vec<web_sys::File>,
41 pub event: web_sys::DragEvent,
43}