@oneplatformdev/ui 0.0.1-beta.87 → 0.0.1-beta.89
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/Dialog/Dialog.d.ts +3 -1
- package/Dialog/Dialog.mjs +25 -25
- package/Dropzone/Dropzone.d.ts +2 -2
- package/Dropzone/Dropzone.mjs +39 -38
- package/Dropzone/Dropzone.types.d.ts +4 -0
- package/package.json +1 -1
package/Dialog/Dialog.d.ts
CHANGED
@@ -5,7 +5,9 @@ declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.Dia
|
|
5
5
|
declare const DialogPortal: React.FC<DialogPrimitive.DialogPortalProps>;
|
6
6
|
declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
7
7
|
declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
8
|
-
declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> &
|
8
|
+
declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
9
|
+
showCloseButton?: boolean;
|
10
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
9
11
|
declare const DialogHeader: {
|
10
12
|
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
11
13
|
displayName: string;
|
package/Dialog/Dialog.mjs
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
import { jsx as o, jsxs as d } from "react/jsx-runtime";
|
2
2
|
import * as l from "react";
|
3
3
|
import * as e from "@radix-ui/react-dialog";
|
4
|
-
import { X as
|
4
|
+
import { X as m } from "lucide-react";
|
5
5
|
import { cn as i } from "@oneplatformdev/utils";
|
6
|
-
const
|
6
|
+
const h = e.Root, w = e.Trigger, f = e.Portal, v = e.Close, n = l.forwardRef(({ className: a, ...t }, s) => /* @__PURE__ */ o(
|
7
7
|
e.Overlay,
|
8
8
|
{
|
9
9
|
ref: s,
|
@@ -15,12 +15,12 @@ const b = e.Root, h = e.Trigger, m = e.Portal, w = e.Close, n = l.forwardRef(({
|
|
15
15
|
}
|
16
16
|
));
|
17
17
|
n.displayName = e.Overlay.displayName;
|
18
|
-
const
|
18
|
+
const p = l.forwardRef(({ className: a, children: t, showCloseButton: s = !0, ...r }, c) => /* @__PURE__ */ d(f, { children: [
|
19
19
|
/* @__PURE__ */ o(n, {}),
|
20
20
|
/* @__PURE__ */ d(
|
21
21
|
e.Content,
|
22
22
|
{
|
23
|
-
ref:
|
23
|
+
ref: c,
|
24
24
|
className: i(
|
25
25
|
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg",
|
26
26
|
"duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
@@ -28,19 +28,19 @@ const f = l.forwardRef(({ className: a, children: t, ...s }, r) => /* @__PURE__
|
|
28
28
|
"bg-[#FCFCFC] border border-[#E8E9EB] rounded-[16px]",
|
29
29
|
a
|
30
30
|
),
|
31
|
-
...
|
31
|
+
...r,
|
32
32
|
children: [
|
33
33
|
t,
|
34
|
-
/* @__PURE__ */ d(e.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
|
35
|
-
/* @__PURE__ */ o(
|
34
|
+
s && /* @__PURE__ */ d(e.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground w-10 aspect-square", children: [
|
35
|
+
/* @__PURE__ */ o(m, { className: "h-4 w-4" }),
|
36
36
|
/* @__PURE__ */ o("span", { className: "sr-only", children: "Close" })
|
37
37
|
] })
|
38
38
|
]
|
39
39
|
}
|
40
40
|
)
|
41
41
|
] }));
|
42
|
-
|
43
|
-
const
|
42
|
+
p.displayName = e.Content.displayName;
|
43
|
+
const g = ({
|
44
44
|
className: a,
|
45
45
|
...t
|
46
46
|
}) => /* @__PURE__ */ o(
|
@@ -53,8 +53,8 @@ const p = ({
|
|
53
53
|
...t
|
54
54
|
}
|
55
55
|
);
|
56
|
-
|
57
|
-
const
|
56
|
+
g.displayName = "DialogHeader";
|
57
|
+
const u = ({
|
58
58
|
className: a,
|
59
59
|
...t
|
60
60
|
}) => /* @__PURE__ */ o(
|
@@ -67,8 +67,8 @@ const g = ({
|
|
67
67
|
...t
|
68
68
|
}
|
69
69
|
);
|
70
|
-
|
71
|
-
const
|
70
|
+
u.displayName = "DialogFooter";
|
71
|
+
const x = l.forwardRef(({ className: a, ...t }, s) => /* @__PURE__ */ o(
|
72
72
|
e.Title,
|
73
73
|
{
|
74
74
|
ref: s,
|
@@ -79,8 +79,8 @@ const u = l.forwardRef(({ className: a, ...t }, s) => /* @__PURE__ */ o(
|
|
79
79
|
...t
|
80
80
|
}
|
81
81
|
));
|
82
|
-
|
83
|
-
const
|
82
|
+
x.displayName = e.Title.displayName;
|
83
|
+
const y = l.forwardRef(({ className: a, ...t }, s) => /* @__PURE__ */ o(
|
84
84
|
e.Description,
|
85
85
|
{
|
86
86
|
ref: s,
|
@@ -88,16 +88,16 @@ const x = l.forwardRef(({ className: a, ...t }, s) => /* @__PURE__ */ o(
|
|
88
88
|
...t
|
89
89
|
}
|
90
90
|
));
|
91
|
-
|
91
|
+
y.displayName = e.Description.displayName;
|
92
92
|
export {
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
93
|
+
h as Dialog,
|
94
|
+
v as DialogClose,
|
95
|
+
p as DialogContent,
|
96
|
+
y as DialogDescription,
|
97
|
+
u as DialogFooter,
|
98
|
+
g as DialogHeader,
|
99
99
|
n as DialogOverlay,
|
100
|
-
|
101
|
-
|
102
|
-
|
100
|
+
f as DialogPortal,
|
101
|
+
x as DialogTitle,
|
102
|
+
w as DialogTrigger
|
103
103
|
};
|
package/Dropzone/Dropzone.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { DropzoneProps } from './Dropzone.types';
|
1
|
+
import { DropzoneControl, DropzoneProps } from './Dropzone.types';
|
2
2
|
|
3
3
|
/**
|
4
4
|
* Dropzone component - A drag-and-drop file upload area with image previews, error handling, and localization.
|
@@ -19,4 +19,4 @@ import { DropzoneProps } from './Dropzone.types';
|
|
19
19
|
* @param {React.Ref<HTMLDivElement>} ref - Ref for the root dropzone container.
|
20
20
|
* @returns {JSX.Element} The rendered Dropzone component.
|
21
21
|
*/
|
22
|
-
export declare const Dropzone: import('react').ForwardRefExoticComponent<DropzoneProps & import('react').RefAttributes<
|
22
|
+
export declare const Dropzone: import('react').ForwardRefExoticComponent<DropzoneProps & import('react').RefAttributes<DropzoneControl>>;
|
package/Dropzone/Dropzone.mjs
CHANGED
@@ -1,56 +1,57 @@
|
|
1
1
|
import { jsxs as r, jsx as i, Fragment as U } from "react/jsx-runtime";
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import { X as Y } from "lucide-react";
|
2
|
+
import { X as j } from "lucide-react";
|
3
|
+
import { forwardRef as H, useState as w, useImperativeHandle as O } from "react";
|
4
|
+
import { useDropzone as X } from "react-dropzone";
|
6
5
|
import { cn as f } from "@oneplatformdev/utils";
|
6
|
+
import { Card as Y } from "../Card/Card.mjs";
|
7
7
|
import { F as q, D as G } from "../DropzoneFilePreview-Dhtv8F4u.js";
|
8
|
-
import {
|
9
|
-
import {
|
10
|
-
const
|
8
|
+
import { DropzoneSinglePickPreview as J } from "./DropzoneSinglePickPreview.mjs";
|
9
|
+
import { DefaultFileIcon as K, isFile as g, extractName as Q } from "./DropzoneUtils.mjs";
|
10
|
+
const R = H(
|
11
11
|
({
|
12
12
|
acceptTypes: y = G,
|
13
13
|
maxSizeMB: F,
|
14
|
-
maxFiles:
|
14
|
+
maxFiles: v = 1,
|
15
15
|
onErrors: a,
|
16
16
|
hideErrors: D = !1,
|
17
17
|
disabled: p = !1,
|
18
18
|
classNames: o,
|
19
19
|
value: z = [],
|
20
20
|
onChangeValue: s,
|
21
|
-
className:
|
22
|
-
labelDropzonePrompt:
|
21
|
+
className: I,
|
22
|
+
labelDropzonePrompt: E = "Drop files here or click to select",
|
23
23
|
labelDropzoneSubPrompt: b = "",
|
24
|
-
labelOrClickToSelect:
|
24
|
+
labelOrClickToSelect: Z = "Click to select files",
|
25
25
|
labelSelectedFiles: S = "Selected Files",
|
26
26
|
labelUploadErrors: N = "Upload Errors",
|
27
27
|
labelFileTooLarge: W = "File is too large",
|
28
28
|
labelInvalidFileType: k = "Invalid file type",
|
29
29
|
singlePick: c = !1,
|
30
|
-
...
|
31
|
-
},
|
32
|
-
const [n,
|
33
|
-
|
34
|
-
const t = c ? e.slice(0, 1) : [...n, ...e].slice(0,
|
35
|
-
|
36
|
-
},
|
30
|
+
...B
|
31
|
+
}, T) => {
|
32
|
+
const [n, x] = w(z), [m, _] = w([]), A = (e, l) => {
|
33
|
+
_(l), a == null || a(l);
|
34
|
+
const t = c ? e.slice(0, 1) : [...n, ...e].slice(0, v);
|
35
|
+
x(t), s == null || s(t);
|
36
|
+
}, u = (e, l) => {
|
37
37
|
if (p) return;
|
38
38
|
e.stopPropagation();
|
39
|
-
const t = n.filter((d,
|
40
|
-
|
41
|
-
}, { getRootProps: L, getInputProps: M, isDragActive: P } =
|
42
|
-
onDrop:
|
39
|
+
const t = n.filter((d, h) => h !== l);
|
40
|
+
x(t), s == null || s(t);
|
41
|
+
}, { getRootProps: L, getInputProps: M, isDragActive: P } = X({
|
42
|
+
onDrop: A,
|
43
43
|
accept: y.reduce((e, l) => (e[l] = [], e), {}),
|
44
44
|
maxSize: F * 1024 * 1024,
|
45
|
-
maxFiles: c ? 1 :
|
45
|
+
maxFiles: c ? 1 : v,
|
46
46
|
disabled: p
|
47
47
|
});
|
48
|
-
return
|
49
|
-
|
48
|
+
return O(T, () => ({
|
49
|
+
setItems: x
|
50
|
+
}), []), /* @__PURE__ */ r(
|
51
|
+
Y,
|
50
52
|
{
|
51
53
|
...L(),
|
52
|
-
...
|
53
|
-
ref: _,
|
54
|
+
...B,
|
54
55
|
className: f(
|
55
56
|
"border-dashed p-2 text-center flex flex-col items-center justify-center cursor-pointer",
|
56
57
|
p && "border-[#E4E4E7] pointer-events-none",
|
@@ -58,7 +59,7 @@ const Q = j(
|
|
58
59
|
P && "bg-gray-100",
|
59
60
|
c && "!shadow-none",
|
60
61
|
c && n.length > 0 && "!p-0 !shadow-none",
|
61
|
-
|
62
|
+
I
|
62
63
|
),
|
63
64
|
children: [
|
64
65
|
/* @__PURE__ */ i("input", { ...M() }),
|
@@ -70,9 +71,9 @@ const Q = j(
|
|
70
71
|
o == null ? void 0 : o.idleWrapper
|
71
72
|
),
|
72
73
|
children: [
|
73
|
-
/* @__PURE__ */ i(
|
74
|
+
/* @__PURE__ */ i(K, {}),
|
74
75
|
!p && /* @__PURE__ */ r(U, { children: [
|
75
|
-
/* @__PURE__ */ i("span", { className: "font-medium text-md text-foreground max-w-[200px]", children:
|
76
|
+
/* @__PURE__ */ i("span", { className: "font-medium text-md text-foreground max-w-[200px]", children: E }),
|
76
77
|
/* @__PURE__ */ i("span", { className: "font-normal text-xs text-foreground max-w-[250px]", children: b })
|
77
78
|
] })
|
78
79
|
]
|
@@ -95,11 +96,11 @@ const Q = j(
|
|
95
96
|
] }, d)) })
|
96
97
|
] }, l)) })
|
97
98
|
] }),
|
98
|
-
c && n.length
|
99
|
-
|
99
|
+
!!(c && n.length) && /* @__PURE__ */ i(
|
100
|
+
J,
|
100
101
|
{
|
101
102
|
item: n[0],
|
102
|
-
onRemoveClick: (e) =>
|
103
|
+
onRemoveClick: (e) => u(e, 0),
|
103
104
|
disabled: p
|
104
105
|
}
|
105
106
|
),
|
@@ -109,7 +110,7 @@ const Q = j(
|
|
109
110
|
":"
|
110
111
|
] }),
|
111
112
|
/* @__PURE__ */ i("ul", { className: "mt-2 text-sm text-gray-500 flex flex-wrap gap-4 items-start justify-center", children: n.map((e, l) => {
|
112
|
-
const t =
|
113
|
+
const t = g(e) ? e.name : Q(e), d = g(e) ? (e.size / (1024 * 1024)).toFixed(2) + " MB" : "";
|
113
114
|
return /* @__PURE__ */ r(
|
114
115
|
"li",
|
115
116
|
{
|
@@ -121,8 +122,8 @@ const Q = j(
|
|
121
122
|
"div",
|
122
123
|
{
|
123
124
|
className: "absolute top-0 right-0 cursor-pointer bg-gray-300 rounded-sm",
|
124
|
-
onClick: (
|
125
|
-
children: /* @__PURE__ */ i(
|
125
|
+
onClick: (h) => u(h, l),
|
126
|
+
children: /* @__PURE__ */ i(j, { size: 16, strokeWidth: 1, color: "black" })
|
126
127
|
}
|
127
128
|
)
|
128
129
|
] }),
|
@@ -145,7 +146,7 @@ const Q = j(
|
|
145
146
|
);
|
146
147
|
}
|
147
148
|
);
|
148
|
-
|
149
|
+
R.displayName = "Dropzone";
|
149
150
|
export {
|
150
|
-
|
151
|
+
R as Dropzone
|
151
152
|
};
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
1
2
|
import { FileRejection } from 'react-dropzone';
|
2
3
|
|
3
4
|
export type DropzoneValueItem = File | string;
|
@@ -36,3 +37,6 @@ export interface DropzoneStyles {
|
|
36
37
|
}
|
37
38
|
export declare const DEFAULT_FILE_TYPES: string[];
|
38
39
|
export declare const DEFAULT_IMAGES_TYPES: string[];
|
40
|
+
export interface DropzoneControl {
|
41
|
+
setItems: Dispatch<SetStateAction<DropzoneValueItem[]>>;
|
42
|
+
}
|