@photoroom/ui 0.1.192 → 0.1.193
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.
|
@@ -8,6 +8,8 @@ export type DropZoneProps = Readonly<({
|
|
|
8
8
|
}) & {
|
|
9
9
|
onFileChange: (files: FileList) => void;
|
|
10
10
|
onClick?: () => void;
|
|
11
|
+
/** Side-effect hook fired right before the picker opens; does not replace it. Ignored when `onClick` is set. */
|
|
12
|
+
onOpenFilePicker?: () => void;
|
|
11
13
|
multiple?: boolean;
|
|
12
14
|
children?: ReactNode;
|
|
13
15
|
title?: ReactNode;
|
|
@@ -16,5 +18,5 @@ export type DropZoneProps = Readonly<({
|
|
|
16
18
|
testId?: string;
|
|
17
19
|
autoFocus?: boolean;
|
|
18
20
|
}>;
|
|
19
|
-
export declare const DropZone: ({ onFileChange, onClick, multiple, children, title, dropTitle, density, ctaLabel, className, testId, autoFocus, }: DropZoneProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare const DropZone: ({ onFileChange, onClick, onOpenFilePicker, multiple, children, title, dropTitle, density, ctaLabel, className, testId, autoFocus, }: DropZoneProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
22
|
//# sourceMappingURL=DropZone.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropZone.d.ts","sourceRoot":"","sources":["../../../../src/components/input/DropZone/DropZone.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAe,MAAM,OAAO,CAAC;AAM/C,MAAM,MAAM,aAAa,GAAG,QAAQ,CAClC,CAAC;IAAE,OAAO,CAAC,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG;IACvF,YAAY,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;IACxC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CACF,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,
|
|
1
|
+
{"version":3,"file":"DropZone.d.ts","sourceRoot":"","sources":["../../../../src/components/input/DropZone/DropZone.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAe,MAAM,OAAO,CAAC;AAM/C,MAAM,MAAM,aAAa,GAAG,QAAQ,CAClC,CAAC;IAAE,OAAO,CAAC,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG;IACvF,YAAY,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;IACxC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,gHAAgH;IAChH,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CACF,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,qIAatB,aAAa,4CA8Ff,CAAC"}
|
package/index.mjs
CHANGED
|
@@ -47536,40 +47536,44 @@ var hfe = (e) => e.isFile === !0, gfe = (e) => e.isDirectory === !0, T3 = async
|
|
|
47536
47536
|
waitForFiles: m,
|
|
47537
47537
|
waitForFile: g
|
|
47538
47538
|
};
|
|
47539
|
-
}, D3 = ({ onFileChange: e, onClick: t,
|
|
47540
|
-
let { isDragging:
|
|
47539
|
+
}, D3 = ({ onFileChange: e, onClick: t, onOpenFilePicker: n, multiple: r, children: i, title: a, dropTitle: o, density: s = "compact", ctaLabel: c, className: l, testId: u, autoFocus: d }) => {
|
|
47540
|
+
let { isDragging: f, inputRef: m, openFilePicker: h, handleChange: g, handleDragEnter: _, handleDragLeave: v, handleDragOver: y, handleDrop: b } = E3({ onFileChange: e }), x = p(() => {
|
|
47541
47541
|
if (typeof t == "function") {
|
|
47542
47542
|
t();
|
|
47543
47543
|
return;
|
|
47544
47544
|
}
|
|
47545
|
-
|
|
47546
|
-
}, [
|
|
47545
|
+
n?.(), h();
|
|
47546
|
+
}, [
|
|
47547
|
+
t,
|
|
47548
|
+
n,
|
|
47549
|
+
h
|
|
47550
|
+
]);
|
|
47547
47551
|
return /* @__PURE__ */ D("div", {
|
|
47548
|
-
className: H("interaction-transition", "relative",
|
|
47549
|
-
"data-testid":
|
|
47552
|
+
className: H("interaction-transition", "relative", l),
|
|
47553
|
+
"data-testid": u,
|
|
47550
47554
|
children: [/* @__PURE__ */ E(x3, {
|
|
47551
|
-
showOverlay:
|
|
47552
|
-
onDragEnter:
|
|
47553
|
-
onDragLeave:
|
|
47554
|
-
onDragOver:
|
|
47555
|
-
onDrop:
|
|
47555
|
+
showOverlay: f,
|
|
47556
|
+
onDragEnter: _,
|
|
47557
|
+
onDragLeave: v,
|
|
47558
|
+
onDragOver: y,
|
|
47559
|
+
onDrop: b,
|
|
47556
47560
|
overlay: /* @__PURE__ */ E("div", {
|
|
47557
47561
|
className: "absolute inset-0 flex bg-white",
|
|
47558
47562
|
children: /* @__PURE__ */ E("div", {
|
|
47559
47563
|
className: V("interaction-transition", "rounded-500 border-content-accent border", "flex flex-1 flex-col items-center justify-center p-6", "component-500 bg-background-accent-subdued text-content-accent"),
|
|
47560
|
-
children:
|
|
47564
|
+
children: o
|
|
47561
47565
|
})
|
|
47562
47566
|
}),
|
|
47563
47567
|
children: /* @__PURE__ */ E("button", {
|
|
47564
47568
|
type: "button",
|
|
47565
|
-
onClick:
|
|
47566
|
-
autoFocus:
|
|
47569
|
+
onClick: x,
|
|
47570
|
+
autoFocus: d,
|
|
47567
47571
|
className: V("interaction-transition", "group/dropzone", "rounded-500", "border-neutral-alpha-400 border border-dashed", "w-full appearance-none select-none", "hover:bg-background-subdued-hover focus-visible:bg-background-subdued-hover active:bg-background-subdued-down", "focus-visible:ring-misc-focus-indicator focus-visible:misc-border-size-focus-ring outline-hidden", "disabled:pointer-events-none disabled:opacity-30"),
|
|
47568
|
-
children:
|
|
47572
|
+
children: i || (s === "compact" ? /* @__PURE__ */ D("div", {
|
|
47569
47573
|
className: "flex items-center justify-center gap-2 p-6",
|
|
47570
47574
|
children: [/* @__PURE__ */ E(Me, { className: "text-content-tertiary size-5 shrink-0" }), /* @__PURE__ */ E("span", {
|
|
47571
47575
|
className: "component-500 text-content-secondary text-start",
|
|
47572
|
-
children:
|
|
47576
|
+
children: a
|
|
47573
47577
|
})]
|
|
47574
47578
|
}) : /* @__PURE__ */ E("div", {
|
|
47575
47579
|
className: "flex items-center justify-center px-4 py-10",
|
|
@@ -47582,18 +47586,18 @@ var hfe = (e) => e.isFile === !0, gfe = (e) => e.isDirectory === !0, T3 = async
|
|
|
47582
47586
|
icon: Me,
|
|
47583
47587
|
tabIndex: -1,
|
|
47584
47588
|
className: V("group-active/dropzone:bg-background-subdued-down", "pointer-events-none"),
|
|
47585
|
-
children:
|
|
47589
|
+
children: c
|
|
47586
47590
|
}), /* @__PURE__ */ E("span", {
|
|
47587
47591
|
className: "component-500 text-content-secondary text-center",
|
|
47588
|
-
children:
|
|
47592
|
+
children: a
|
|
47589
47593
|
})]
|
|
47590
47594
|
})
|
|
47591
47595
|
}))
|
|
47592
47596
|
})
|
|
47593
47597
|
}), /* @__PURE__ */ E(w3, {
|
|
47594
|
-
multiple:
|
|
47595
|
-
onChange:
|
|
47596
|
-
ref:
|
|
47598
|
+
multiple: r,
|
|
47599
|
+
onChange: g,
|
|
47600
|
+
ref: m
|
|
47597
47601
|
})]
|
|
47598
47602
|
});
|
|
47599
47603
|
}, O3 = l(({ icon: e, children: t, className: n, ...r }, i) => /* @__PURE__ */ D("button", {
|