@pixpilot/shadcn-ui 0.5.0 → 0.6.0
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/dist/DatePicker.d.cts +3 -3
- package/dist/DatePicker.d.ts +3 -3
- package/dist/avatar-upload/AvatarUpload.cjs +83 -0
- package/dist/avatar-upload/AvatarUpload.d.cts +16 -0
- package/dist/avatar-upload/AvatarUpload.d.ts +16 -0
- package/dist/avatar-upload/AvatarUpload.js +78 -0
- package/dist/avatar-upload/AvatarUploadComponents.cjs +42 -0
- package/dist/avatar-upload/AvatarUploadComponents.js +35 -0
- package/dist/avatar-upload/AvatarUploadItem.cjs +58 -0
- package/dist/avatar-upload/AvatarUploadItem.js +54 -0
- package/dist/avatar-upload/index.cjs +1 -0
- package/dist/avatar-upload/index.d.cts +1 -0
- package/dist/avatar-upload/index.d.ts +1 -0
- package/dist/avatar-upload/index.js +1 -0
- package/dist/avatar-upload/types.d.cts +14 -0
- package/dist/avatar-upload/types.d.ts +14 -0
- package/dist/index.cjs +3 -0
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -1
- package/package.json +1 -1
package/dist/DatePicker.d.cts
CHANGED
|
@@ -3,14 +3,14 @@ import { Calendar } from "@pixpilot/shadcn";
|
|
|
3
3
|
import { ComponentProps } from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/DatePicker.d.ts
|
|
6
|
-
type
|
|
6
|
+
type DatePickerProps = {
|
|
7
7
|
value?: Date;
|
|
8
8
|
onChange?: (date: Date | undefined) => void;
|
|
9
9
|
placeholder?: string;
|
|
10
10
|
} & Omit<ComponentProps<typeof Calendar>, 'selected' | 'onSelect' | 'mode'>;
|
|
11
|
-
declare function DatePicker(props:
|
|
11
|
+
declare function DatePicker(props: DatePickerProps): react_jsx_runtime2.JSX.Element;
|
|
12
12
|
declare namespace DatePicker {
|
|
13
13
|
var displayName: string;
|
|
14
14
|
}
|
|
15
15
|
//#endregion
|
|
16
|
-
export { DatePicker };
|
|
16
|
+
export { DatePicker, DatePickerProps };
|
package/dist/DatePicker.d.ts
CHANGED
|
@@ -3,14 +3,14 @@ import { ComponentProps } from "react";
|
|
|
3
3
|
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/DatePicker.d.ts
|
|
6
|
-
type
|
|
6
|
+
type DatePickerProps = {
|
|
7
7
|
value?: Date;
|
|
8
8
|
onChange?: (date: Date | undefined) => void;
|
|
9
9
|
placeholder?: string;
|
|
10
10
|
} & Omit<ComponentProps<typeof Calendar>, 'selected' | 'onSelect' | 'mode'>;
|
|
11
|
-
declare function DatePicker(props:
|
|
11
|
+
declare function DatePicker(props: DatePickerProps): react_jsx_runtime2.JSX.Element;
|
|
12
12
|
declare namespace DatePicker {
|
|
13
13
|
var displayName: string;
|
|
14
14
|
}
|
|
15
15
|
//#endregion
|
|
16
|
-
export { DatePicker };
|
|
16
|
+
export { DatePicker, DatePickerProps };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_utils = require('../shadcn/src/lib/utils.cjs');
|
|
3
|
+
require('../shadcn/src/lib/index.cjs');
|
|
4
|
+
const require_AvatarUploadComponents = require('./AvatarUploadComponents.cjs');
|
|
5
|
+
const require_AvatarUploadItem = require('./AvatarUploadItem.cjs');
|
|
6
|
+
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
7
|
+
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
8
|
+
let lucide_react = require("lucide-react");
|
|
9
|
+
lucide_react = require_rolldown_runtime.__toESM(lucide_react);
|
|
10
|
+
let react = require("react");
|
|
11
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
12
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
13
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
14
|
+
|
|
15
|
+
//#region src/avatar-upload/AvatarUpload.tsx
|
|
16
|
+
const sizeClasses = {
|
|
17
|
+
sm: {
|
|
18
|
+
avatar: "h-20 w-20",
|
|
19
|
+
icon: "h-5 w-5",
|
|
20
|
+
dropZone: "p-3",
|
|
21
|
+
main: "space-y-2"
|
|
22
|
+
},
|
|
23
|
+
md: {
|
|
24
|
+
main: "space-y-2.5",
|
|
25
|
+
avatar: "h-28 w-28",
|
|
26
|
+
icon: "h-6 w-6 bottom-1 right-1",
|
|
27
|
+
dropZone: "p-4"
|
|
28
|
+
},
|
|
29
|
+
lg: {
|
|
30
|
+
avatar: "h-40 w-40",
|
|
31
|
+
icon: "h-7 w-7 bottom-1.5 right-1.5",
|
|
32
|
+
dropZone: "p-5",
|
|
33
|
+
main: "space-y-3"
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const AvatarUpload = (props) => {
|
|
37
|
+
const { className, messages, value, onAccept, onChange, size = "md",...rest } = props;
|
|
38
|
+
const { upload = "Upload", change = "Change" } = messages || {};
|
|
39
|
+
const currentSize = sizeClasses[size];
|
|
40
|
+
const [files, setFiles] = react.default.useState([]);
|
|
41
|
+
const imageUrl = value?.url;
|
|
42
|
+
const handleAccept = react.default.useCallback((acceptedFiles) => {
|
|
43
|
+
setFiles(acceptedFiles.map((file) => {
|
|
44
|
+
return {
|
|
45
|
+
file,
|
|
46
|
+
id: `${file.name}-${file.lastModified.toString()}`
|
|
47
|
+
};
|
|
48
|
+
}));
|
|
49
|
+
onAccept?.(acceptedFiles);
|
|
50
|
+
}, [onAccept]);
|
|
51
|
+
const hasImageUrl = imageUrl != null;
|
|
52
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.FileUpload, {
|
|
53
|
+
...rest,
|
|
54
|
+
onAccept: handleAccept,
|
|
55
|
+
className: require_utils.cn("w-fit", className),
|
|
56
|
+
accept: "image/*",
|
|
57
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.FileUploadDropzone, {
|
|
58
|
+
className: currentSize.dropZone,
|
|
59
|
+
children: files.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.FileUploadList, { children: files.map(({ file, id }, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AvatarUploadItem.AvatarUploadItem, {
|
|
60
|
+
file,
|
|
61
|
+
index: i,
|
|
62
|
+
currentSize,
|
|
63
|
+
change,
|
|
64
|
+
onChange
|
|
65
|
+
}, id)) }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_AvatarUploadComponents.MainWrapper, {
|
|
66
|
+
currentSize,
|
|
67
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AvatarUploadComponents.AvatarWrap, {
|
|
68
|
+
className: currentSize.avatar,
|
|
69
|
+
iconClass: currentSize.icon,
|
|
70
|
+
showChangeIcon: hasImageUrl,
|
|
71
|
+
children: hasImageUrl ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AvatarUploadComponents.Image, { src: imageUrl }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.UserCircle2, {
|
|
72
|
+
className: "text-muted-foreground w-full h-full",
|
|
73
|
+
strokeWidth: 1
|
|
74
|
+
})
|
|
75
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AvatarUploadComponents.MessageComponent, { message: hasImageUrl != null ? change : upload })]
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
AvatarUpload.displayName = "AvatarUpload";
|
|
81
|
+
|
|
82
|
+
//#endregion
|
|
83
|
+
exports.AvatarUpload = AvatarUpload;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SingleFileUploadProps } from "../file-upload/types/index.cjs";
|
|
2
|
+
import "../file-upload/index.cjs";
|
|
3
|
+
import { ComponentSizes } from "./types.cjs";
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/avatar-upload/AvatarUpload.d.ts
|
|
7
|
+
interface AvatarUploadProps extends SingleFileUploadProps {
|
|
8
|
+
messages?: {
|
|
9
|
+
upload?: string;
|
|
10
|
+
change?: string;
|
|
11
|
+
};
|
|
12
|
+
size?: keyof ComponentSizes;
|
|
13
|
+
}
|
|
14
|
+
declare const AvatarUpload: React.FC<AvatarUploadProps>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { AvatarUpload, AvatarUploadProps };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SingleFileUploadProps } from "../file-upload/types/index.js";
|
|
2
|
+
import "../file-upload/index.js";
|
|
3
|
+
import { ComponentSizes } from "./types.js";
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/avatar-upload/AvatarUpload.d.ts
|
|
7
|
+
interface AvatarUploadProps extends SingleFileUploadProps {
|
|
8
|
+
messages?: {
|
|
9
|
+
upload?: string;
|
|
10
|
+
change?: string;
|
|
11
|
+
};
|
|
12
|
+
size?: keyof ComponentSizes;
|
|
13
|
+
}
|
|
14
|
+
declare const AvatarUpload: React.FC<AvatarUploadProps>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { AvatarUpload, AvatarUploadProps };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { cn as cn$1 } from "../shadcn/src/lib/utils.js";
|
|
2
|
+
import "../shadcn/src/lib/index.js";
|
|
3
|
+
import { AvatarWrap, Image, MainWrapper, MessageComponent } from "./AvatarUploadComponents.js";
|
|
4
|
+
import { AvatarUploadItem } from "./AvatarUploadItem.js";
|
|
5
|
+
import { FileUpload, FileUploadDropzone, FileUploadList } from "@pixpilot/shadcn";
|
|
6
|
+
import { UserCircle2 } from "lucide-react";
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
|
|
10
|
+
//#region src/avatar-upload/AvatarUpload.tsx
|
|
11
|
+
const sizeClasses = {
|
|
12
|
+
sm: {
|
|
13
|
+
avatar: "h-20 w-20",
|
|
14
|
+
icon: "h-5 w-5",
|
|
15
|
+
dropZone: "p-3",
|
|
16
|
+
main: "space-y-2"
|
|
17
|
+
},
|
|
18
|
+
md: {
|
|
19
|
+
main: "space-y-2.5",
|
|
20
|
+
avatar: "h-28 w-28",
|
|
21
|
+
icon: "h-6 w-6 bottom-1 right-1",
|
|
22
|
+
dropZone: "p-4"
|
|
23
|
+
},
|
|
24
|
+
lg: {
|
|
25
|
+
avatar: "h-40 w-40",
|
|
26
|
+
icon: "h-7 w-7 bottom-1.5 right-1.5",
|
|
27
|
+
dropZone: "p-5",
|
|
28
|
+
main: "space-y-3"
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const AvatarUpload = (props) => {
|
|
32
|
+
const { className, messages, value, onAccept, onChange, size = "md",...rest } = props;
|
|
33
|
+
const { upload = "Upload", change = "Change" } = messages || {};
|
|
34
|
+
const currentSize = sizeClasses[size];
|
|
35
|
+
const [files, setFiles] = React.useState([]);
|
|
36
|
+
const imageUrl = value?.url;
|
|
37
|
+
const handleAccept = React.useCallback((acceptedFiles) => {
|
|
38
|
+
setFiles(acceptedFiles.map((file) => {
|
|
39
|
+
return {
|
|
40
|
+
file,
|
|
41
|
+
id: `${file.name}-${file.lastModified.toString()}`
|
|
42
|
+
};
|
|
43
|
+
}));
|
|
44
|
+
onAccept?.(acceptedFiles);
|
|
45
|
+
}, [onAccept]);
|
|
46
|
+
const hasImageUrl = imageUrl != null;
|
|
47
|
+
return /* @__PURE__ */ jsx(FileUpload, {
|
|
48
|
+
...rest,
|
|
49
|
+
onAccept: handleAccept,
|
|
50
|
+
className: cn$1("w-fit", className),
|
|
51
|
+
accept: "image/*",
|
|
52
|
+
children: /* @__PURE__ */ jsx(FileUploadDropzone, {
|
|
53
|
+
className: currentSize.dropZone,
|
|
54
|
+
children: files.length > 0 ? /* @__PURE__ */ jsx(FileUploadList, { children: files.map(({ file, id }, i) => /* @__PURE__ */ jsx(AvatarUploadItem, {
|
|
55
|
+
file,
|
|
56
|
+
index: i,
|
|
57
|
+
currentSize,
|
|
58
|
+
change,
|
|
59
|
+
onChange
|
|
60
|
+
}, id)) }) : /* @__PURE__ */ jsxs(MainWrapper, {
|
|
61
|
+
currentSize,
|
|
62
|
+
children: [/* @__PURE__ */ jsx(AvatarWrap, {
|
|
63
|
+
className: currentSize.avatar,
|
|
64
|
+
iconClass: currentSize.icon,
|
|
65
|
+
showChangeIcon: hasImageUrl,
|
|
66
|
+
children: hasImageUrl ? /* @__PURE__ */ jsx(Image, { src: imageUrl }) : /* @__PURE__ */ jsx(UserCircle2, {
|
|
67
|
+
className: "text-muted-foreground w-full h-full",
|
|
68
|
+
strokeWidth: 1
|
|
69
|
+
})
|
|
70
|
+
}), /* @__PURE__ */ jsx(MessageComponent, { message: hasImageUrl != null ? change : upload })]
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
AvatarUpload.displayName = "AvatarUpload";
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
export { AvatarUpload };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_utils = require('../shadcn/src/lib/utils.cjs');
|
|
3
|
+
require('../shadcn/src/lib/index.cjs');
|
|
4
|
+
let lucide_react = require("lucide-react");
|
|
5
|
+
lucide_react = require_rolldown_runtime.__toESM(lucide_react);
|
|
6
|
+
let react = require("react");
|
|
7
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
10
|
+
|
|
11
|
+
//#region src/avatar-upload/AvatarUploadComponents.tsx
|
|
12
|
+
const MessageComponent = ({ message, className }) => {
|
|
13
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
14
|
+
className: require_utils.cn("text-sm text-muted-foreground", className),
|
|
15
|
+
children: message
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
const AvatarWrap = ({ children, className, iconClass, showChangeIcon }) => {
|
|
19
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
20
|
+
className: require_utils.cn("relative", className),
|
|
21
|
+
children: [children, showChangeIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Pencil, { className: require_utils.cn(`absolute bottom-0 right-0 bg-secondary text-secondary-foreground rounded-full p-1.5 shadow-md`, iconClass) })]
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
const Image = ({ src, className }) => {
|
|
25
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
26
|
+
src,
|
|
27
|
+
alt: "Avatar preview",
|
|
28
|
+
className: require_utils.cn("rounded-full object-cover w-full h-full", className)
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
const MainWrapper = ({ children, className, currentSize }) => {
|
|
32
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
33
|
+
className: require_utils.cn("flex flex-col items-center relative", className, currentSize.main),
|
|
34
|
+
children
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
exports.AvatarWrap = AvatarWrap;
|
|
40
|
+
exports.Image = Image;
|
|
41
|
+
exports.MainWrapper = MainWrapper;
|
|
42
|
+
exports.MessageComponent = MessageComponent;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { cn } from "../shadcn/src/lib/utils.js";
|
|
2
|
+
import "../shadcn/src/lib/index.js";
|
|
3
|
+
import { Pencil } from "lucide-react";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/avatar-upload/AvatarUploadComponents.tsx
|
|
8
|
+
const MessageComponent = ({ message, className }) => {
|
|
9
|
+
return /* @__PURE__ */ jsx("p", {
|
|
10
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
11
|
+
children: message
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
const AvatarWrap = ({ children, className, iconClass, showChangeIcon }) => {
|
|
15
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
16
|
+
className: cn("relative", className),
|
|
17
|
+
children: [children, showChangeIcon && /* @__PURE__ */ jsx(Pencil, { className: cn(`absolute bottom-0 right-0 bg-secondary text-secondary-foreground rounded-full p-1.5 shadow-md`, iconClass) })]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
const Image = ({ src, className }) => {
|
|
21
|
+
return /* @__PURE__ */ jsx("img", {
|
|
22
|
+
src,
|
|
23
|
+
alt: "Avatar preview",
|
|
24
|
+
className: cn("rounded-full object-cover w-full h-full", className)
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
const MainWrapper = ({ children, className, currentSize }) => {
|
|
28
|
+
return /* @__PURE__ */ jsx("div", {
|
|
29
|
+
className: cn("flex flex-col items-center relative", className, currentSize.main),
|
|
30
|
+
children
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { AvatarWrap, Image, MainWrapper, MessageComponent };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_use_file_error = require('../file-upload/hooks/use-file-error.cjs');
|
|
3
|
+
const require_use_file_upload_progress_callbacks = require('../file-upload/hooks/use-file-upload-progress-callbacks.cjs');
|
|
4
|
+
require('../file-upload/index.cjs');
|
|
5
|
+
const require_AvatarUploadComponents = require('./AvatarUploadComponents.cjs');
|
|
6
|
+
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
7
|
+
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
8
|
+
let lucide_react = require("lucide-react");
|
|
9
|
+
lucide_react = require_rolldown_runtime.__toESM(lucide_react);
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
12
|
+
|
|
13
|
+
//#region src/avatar-upload/AvatarUploadItem.tsx
|
|
14
|
+
const AvatarUploadItem = (props) => {
|
|
15
|
+
const { file, currentSize, change } = props;
|
|
16
|
+
require_use_file_upload_progress_callbacks.useFileUploadProgressCallbacks(file, props);
|
|
17
|
+
const fileError = require_use_file_error.useFileError(file);
|
|
18
|
+
const isUploading = (0, __pixpilot_shadcn.useFileUpload)((store) => {
|
|
19
|
+
if (fileError != null) return false;
|
|
20
|
+
if (store.files.get(file)?.status === "uploading") return true;
|
|
21
|
+
return false;
|
|
22
|
+
});
|
|
23
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.FileUploadItem, {
|
|
24
|
+
value: file,
|
|
25
|
+
className: "p-0 border-0 m-0",
|
|
26
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_AvatarUploadComponents.MainWrapper, {
|
|
27
|
+
currentSize,
|
|
28
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
29
|
+
className: (0, __pixpilot_shadcn.cn)("relative"),
|
|
30
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AvatarUploadComponents.AvatarWrap, {
|
|
31
|
+
className: currentSize.avatar,
|
|
32
|
+
showChangeIcon: true,
|
|
33
|
+
iconClass: currentSize.icon,
|
|
34
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AvatarUploadComponents.Image, { src: URL.createObjectURL(file) })
|
|
35
|
+
}), fileError != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.TooltipProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.Tooltip, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.TooltipTrigger, {
|
|
36
|
+
asChild: true,
|
|
37
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
38
|
+
type: "button",
|
|
39
|
+
className: "absolute -top-2 -right-2 p-1",
|
|
40
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.AlertCircle, { className: "h-5 w-5 text-red-500" })
|
|
41
|
+
})
|
|
42
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.TooltipContent, { children: fileError })] }) })]
|
|
43
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
44
|
+
className: "w-full flex items-center justify-center relative",
|
|
45
|
+
children: [fileError == null && isUploading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.FileUploadItemProgress, {
|
|
46
|
+
variant: "linear",
|
|
47
|
+
className: "absolute"
|
|
48
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AvatarUploadComponents.MessageComponent, {
|
|
49
|
+
message: change,
|
|
50
|
+
className: (0, __pixpilot_shadcn.cn)({ "opacity-0": isUploading })
|
|
51
|
+
})]
|
|
52
|
+
})]
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
exports.AvatarUploadItem = AvatarUploadItem;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useFileError } from "../file-upload/hooks/use-file-error.js";
|
|
2
|
+
import { useFileUploadProgressCallbacks } from "../file-upload/hooks/use-file-upload-progress-callbacks.js";
|
|
3
|
+
import "../file-upload/index.js";
|
|
4
|
+
import { AvatarWrap, Image, MainWrapper, MessageComponent } from "./AvatarUploadComponents.js";
|
|
5
|
+
import { FileUploadItem, FileUploadItemProgress, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, cn, useFileUpload } from "@pixpilot/shadcn";
|
|
6
|
+
import { AlertCircle } from "lucide-react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/avatar-upload/AvatarUploadItem.tsx
|
|
10
|
+
const AvatarUploadItem = (props) => {
|
|
11
|
+
const { file, currentSize, change } = props;
|
|
12
|
+
useFileUploadProgressCallbacks(file, props);
|
|
13
|
+
const fileError = useFileError(file);
|
|
14
|
+
const isUploading = useFileUpload((store) => {
|
|
15
|
+
if (fileError != null) return false;
|
|
16
|
+
if (store.files.get(file)?.status === "uploading") return true;
|
|
17
|
+
return false;
|
|
18
|
+
});
|
|
19
|
+
return /* @__PURE__ */ jsx(FileUploadItem, {
|
|
20
|
+
value: file,
|
|
21
|
+
className: "p-0 border-0 m-0",
|
|
22
|
+
children: /* @__PURE__ */ jsxs(MainWrapper, {
|
|
23
|
+
currentSize,
|
|
24
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
25
|
+
className: cn("relative"),
|
|
26
|
+
children: [/* @__PURE__ */ jsx(AvatarWrap, {
|
|
27
|
+
className: currentSize.avatar,
|
|
28
|
+
showChangeIcon: true,
|
|
29
|
+
iconClass: currentSize.icon,
|
|
30
|
+
children: /* @__PURE__ */ jsx(Image, { src: URL.createObjectURL(file) })
|
|
31
|
+
}), fileError != null && /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
32
|
+
asChild: true,
|
|
33
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
34
|
+
type: "button",
|
|
35
|
+
className: "absolute -top-2 -right-2 p-1",
|
|
36
|
+
children: /* @__PURE__ */ jsx(AlertCircle, { className: "h-5 w-5 text-red-500" })
|
|
37
|
+
})
|
|
38
|
+
}), /* @__PURE__ */ jsx(TooltipContent, { children: fileError })] }) })]
|
|
39
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
40
|
+
className: "w-full flex items-center justify-center relative",
|
|
41
|
+
children: [fileError == null && isUploading && /* @__PURE__ */ jsx(FileUploadItemProgress, {
|
|
42
|
+
variant: "linear",
|
|
43
|
+
className: "absolute"
|
|
44
|
+
}), /* @__PURE__ */ jsx(MessageComponent, {
|
|
45
|
+
message: change,
|
|
46
|
+
className: cn({ "opacity-0": isUploading })
|
|
47
|
+
})]
|
|
48
|
+
})]
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { AvatarUploadItem };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const require_AvatarUpload = require('./AvatarUpload.cjs');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { AvatarUpload, AvatarUploadProps } from "./AvatarUpload.cjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { AvatarUpload, AvatarUploadProps } from "./AvatarUpload.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { AvatarUpload } from "./AvatarUpload.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/avatar-upload/types.d.ts
|
|
2
|
+
interface ComponentSize {
|
|
3
|
+
avatar: string;
|
|
4
|
+
icon: string;
|
|
5
|
+
dropZone: string;
|
|
6
|
+
main: string;
|
|
7
|
+
}
|
|
8
|
+
interface ComponentSizes {
|
|
9
|
+
sm: ComponentSize;
|
|
10
|
+
md: ComponentSize;
|
|
11
|
+
lg: ComponentSize;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { ComponentSizes };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/avatar-upload/types.d.ts
|
|
2
|
+
interface ComponentSize {
|
|
3
|
+
avatar: string;
|
|
4
|
+
icon: string;
|
|
5
|
+
dropZone: string;
|
|
6
|
+
main: string;
|
|
7
|
+
}
|
|
8
|
+
interface ComponentSizes {
|
|
9
|
+
sm: ComponentSize;
|
|
10
|
+
md: ComponentSize;
|
|
11
|
+
lg: ComponentSize;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { ComponentSizes };
|
package/dist/index.cjs
CHANGED
|
@@ -3,6 +3,8 @@ const require_FileUpload = require('./file-upload/FileUpload.cjs');
|
|
|
3
3
|
require('./file-upload/index.cjs');
|
|
4
4
|
const require_AbsoluteFill = require('./AbsoluteFill.cjs');
|
|
5
5
|
const require_Alert = require('./Alert.cjs');
|
|
6
|
+
const require_AvatarUpload = require('./avatar-upload/AvatarUpload.cjs');
|
|
7
|
+
require('./avatar-upload/index.cjs');
|
|
6
8
|
const require_Button = require('./Button.cjs');
|
|
7
9
|
const require_CloseButtonRounded = require('./CloseButtonRounded.cjs');
|
|
8
10
|
const require_CloseButtonAbsolute = require('./CloseButtonAbsolute.cjs');
|
|
@@ -40,6 +42,7 @@ next_themes = require_rolldown_runtime.__toESM(next_themes);
|
|
|
40
42
|
|
|
41
43
|
exports.AbsoluteFill = require_AbsoluteFill.AbsoluteFill;
|
|
42
44
|
exports.Alert = require_Alert.Alert;
|
|
45
|
+
exports.AvatarUpload = require_AvatarUpload.AvatarUpload;
|
|
43
46
|
exports.Button = require_Button.Button;
|
|
44
47
|
exports.CloseButtonAbsolute = require_CloseButtonAbsolute.CloseButtonAbsolute;
|
|
45
48
|
exports.CloseButtonRounded = require_CloseButtonRounded.CloseButtonRounded;
|
package/dist/index.d.cts
CHANGED
|
@@ -3,6 +3,8 @@ import { FileUpload } from "./file-upload/FileUpload.cjs";
|
|
|
3
3
|
import "./file-upload/index.cjs";
|
|
4
4
|
import { AbsoluteFill } from "./AbsoluteFill.cjs";
|
|
5
5
|
import { Alert, AlertBaseProps, AlertProps, AlertVariant } from "./Alert.cjs";
|
|
6
|
+
import { AvatarUpload, AvatarUploadProps } from "./avatar-upload/AvatarUpload.cjs";
|
|
7
|
+
import "./avatar-upload/index.cjs";
|
|
6
8
|
import { Button, ButtonLoaderProps, ButtonProps } from "./Button.cjs";
|
|
7
9
|
import { CloseButtonRounded, CloseButtonRoundedProps } from "./CloseButtonRounded.cjs";
|
|
8
10
|
import { CloseButtonAbsolute, PopoverCloseButtonProps } from "./CloseButtonAbsolute.cjs";
|
|
@@ -12,7 +14,7 @@ import { showConfirmDialog } from "./confirmation-dialog/confirmation-dialogs.cj
|
|
|
12
14
|
import { DialogProvider, DialogProviderProps } from "./confirmation-dialog/DialogProvider.cjs";
|
|
13
15
|
import "./confirmation-dialog/index.cjs";
|
|
14
16
|
import { ContentCard } from "./ContentCard.cjs";
|
|
15
|
-
import { DatePicker } from "./DatePicker.cjs";
|
|
17
|
+
import { DatePicker, DatePickerProps } from "./DatePicker.cjs";
|
|
16
18
|
import { FileUploadInlineBaseProps, FileUploadInlineProps } from "./file-upload-inline/types.cjs";
|
|
17
19
|
import { FileUploadInline } from "./file-upload-inline/FileUploadInline.cjs";
|
|
18
20
|
import "./file-upload-inline/index.cjs";
|
|
@@ -36,4 +38,4 @@ import { ThemeToggle } from "./ThemeToggle.cjs";
|
|
|
36
38
|
import { DEFAULT_ALERT_DURATION, ToastMessage, toast, toastError, toastInfo, toastSuccess, toastWarning } from "./toast/toast.cjs";
|
|
37
39
|
import "./toast/index.cjs";
|
|
38
40
|
import { cn } from "@pixpilot/shadcn";
|
|
39
|
-
export { AbsoluteFill, Alert, AlertBaseProps, AlertProps, AlertVariant, Button, ButtonLoaderProps, ButtonProps, CloseButtonAbsolute, CloseButtonRounded, CloseButtonRoundedProps, Combobox, ConfirmationDialogProps, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DialogProvider, DialogProviderProps, type FileMetadata, FileUpload, FileUploadBaseProps, FileUploadInline, FileUploadInlineBaseProps, FileUploadInlineProps, type FileUploadProgressCallBacks, type FileUploadProps, IconPicker, IconPickerProps, IconPickerVariant, IconProvider, IconProviderLoader, IconProviderProps, LoaderProps, LoadingOverlay, MultiFileUploadProps, OnChangeMultipleFiles, OnChangeSingleFile, Pagination, PaginationProps, PopoverCloseButtonProps, RichTextEditor, RichTextEditorProps, Select, SelectOption, SingleFileUploadProps, Slider, SliderProps, Spinner, SpinnerProps, TagsInput, TagsInputProps, ThemeProvider, ThemeProviderProps, ThemeToggle, ToastMessage, ToolbarOption, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useMediaQuery, useTheme };
|
|
41
|
+
export { AbsoluteFill, Alert, AlertBaseProps, AlertProps, AlertVariant, AvatarUpload, AvatarUploadProps, Button, ButtonLoaderProps, ButtonProps, CloseButtonAbsolute, CloseButtonRounded, CloseButtonRoundedProps, Combobox, ConfirmationDialogProps, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DatePickerProps, DialogProvider, DialogProviderProps, type FileMetadata, FileUpload, FileUploadBaseProps, FileUploadInline, FileUploadInlineBaseProps, FileUploadInlineProps, type FileUploadProgressCallBacks, type FileUploadProps, IconPicker, IconPickerProps, IconPickerVariant, IconProvider, IconProviderLoader, IconProviderProps, LoaderProps, LoadingOverlay, MultiFileUploadProps, OnChangeMultipleFiles, OnChangeSingleFile, Pagination, PaginationProps, PopoverCloseButtonProps, RichTextEditor, RichTextEditorProps, Select, SelectOption, SingleFileUploadProps, Slider, SliderProps, Spinner, SpinnerProps, TagsInput, TagsInputProps, ThemeProvider, ThemeProviderProps, ThemeToggle, ToastMessage, ToolbarOption, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useMediaQuery, useTheme };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { FileUpload } from "./file-upload/FileUpload.js";
|
|
|
3
3
|
import "./file-upload/index.js";
|
|
4
4
|
import { AbsoluteFill } from "./AbsoluteFill.js";
|
|
5
5
|
import { Alert, AlertBaseProps, AlertProps, AlertVariant } from "./Alert.js";
|
|
6
|
+
import { AvatarUpload, AvatarUploadProps } from "./avatar-upload/AvatarUpload.js";
|
|
7
|
+
import "./avatar-upload/index.js";
|
|
6
8
|
import { Button, ButtonLoaderProps, ButtonProps } from "./Button.js";
|
|
7
9
|
import { CloseButtonRounded, CloseButtonRoundedProps } from "./CloseButtonRounded.js";
|
|
8
10
|
import { CloseButtonAbsolute, PopoverCloseButtonProps } from "./CloseButtonAbsolute.js";
|
|
@@ -12,7 +14,7 @@ import { showConfirmDialog } from "./confirmation-dialog/confirmation-dialogs.js
|
|
|
12
14
|
import { DialogProvider, DialogProviderProps } from "./confirmation-dialog/DialogProvider.js";
|
|
13
15
|
import "./confirmation-dialog/index.js";
|
|
14
16
|
import { ContentCard } from "./ContentCard.js";
|
|
15
|
-
import { DatePicker } from "./DatePicker.js";
|
|
17
|
+
import { DatePicker, DatePickerProps } from "./DatePicker.js";
|
|
16
18
|
import { FileUploadInlineBaseProps, FileUploadInlineProps } from "./file-upload-inline/types.js";
|
|
17
19
|
import { FileUploadInline } from "./file-upload-inline/FileUploadInline.js";
|
|
18
20
|
import "./file-upload-inline/index.js";
|
|
@@ -37,4 +39,4 @@ import { ThemeToggle } from "./ThemeToggle.js";
|
|
|
37
39
|
import { DEFAULT_ALERT_DURATION, ToastMessage, toast, toastError, toastInfo, toastSuccess, toastWarning } from "./toast/toast.js";
|
|
38
40
|
import "./toast/index.js";
|
|
39
41
|
import { cn } from "@pixpilot/shadcn";
|
|
40
|
-
export { AbsoluteFill, Alert, AlertBaseProps, AlertProps, AlertVariant, Button, ButtonLoaderProps, ButtonProps, CloseButtonAbsolute, CloseButtonRounded, CloseButtonRoundedProps, Combobox, ConfirmationDialogProps, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DialogProvider, DialogProviderProps, type FileMetadata, FileUpload, FileUploadBaseProps, FileUploadInline, FileUploadInlineBaseProps, FileUploadInlineProps, type FileUploadProgressCallBacks, type FileUploadProps, IconPicker, IconPickerProps, IconPickerVariant, IconProvider, IconProviderLoader, IconProviderProps, LoaderProps, LoadingOverlay, MultiFileUploadProps, OnChangeMultipleFiles, OnChangeSingleFile, Pagination, PaginationProps, PopoverCloseButtonProps, RichTextEditor, RichTextEditorProps, Select, SelectOption, SingleFileUploadProps, Slider, SliderProps, Spinner, SpinnerProps, TagsInput, TagsInputProps, ThemeProvider, ThemeProviderProps, ThemeToggle, ToastMessage, ToolbarOption, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useMediaQuery, useTheme };
|
|
42
|
+
export { AbsoluteFill, Alert, AlertBaseProps, AlertProps, AlertVariant, AvatarUpload, AvatarUploadProps, Button, ButtonLoaderProps, ButtonProps, CloseButtonAbsolute, CloseButtonRounded, CloseButtonRoundedProps, Combobox, ConfirmationDialogProps, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DatePickerProps, DialogProvider, DialogProviderProps, type FileMetadata, FileUpload, FileUploadBaseProps, FileUploadInline, FileUploadInlineBaseProps, FileUploadInlineProps, type FileUploadProgressCallBacks, type FileUploadProps, IconPicker, IconPickerProps, IconPickerVariant, IconProvider, IconProviderLoader, IconProviderProps, LoaderProps, LoadingOverlay, MultiFileUploadProps, OnChangeMultipleFiles, OnChangeSingleFile, Pagination, PaginationProps, PopoverCloseButtonProps, RichTextEditor, RichTextEditorProps, Select, SelectOption, SingleFileUploadProps, Slider, SliderProps, Spinner, SpinnerProps, TagsInput, TagsInputProps, ThemeProvider, ThemeProviderProps, ThemeToggle, ToastMessage, ToolbarOption, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useMediaQuery, useTheme };
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,8 @@ import { FileUpload } from "./file-upload/FileUpload.js";
|
|
|
2
2
|
import "./file-upload/index.js";
|
|
3
3
|
import { AbsoluteFill } from "./AbsoluteFill.js";
|
|
4
4
|
import { Alert } from "./Alert.js";
|
|
5
|
+
import { AvatarUpload } from "./avatar-upload/AvatarUpload.js";
|
|
6
|
+
import "./avatar-upload/index.js";
|
|
5
7
|
import { Button } from "./Button.js";
|
|
6
8
|
import { CloseButtonRounded } from "./CloseButtonRounded.js";
|
|
7
9
|
import { CloseButtonAbsolute } from "./CloseButtonAbsolute.js";
|
|
@@ -34,4 +36,4 @@ import { DEFAULT_ALERT_DURATION, toast, toastError, toastInfo, toastSuccess, toa
|
|
|
34
36
|
import "./toast/index.js";
|
|
35
37
|
import { cn } from "@pixpilot/shadcn";
|
|
36
38
|
|
|
37
|
-
export { AbsoluteFill, Alert, Button, CloseButtonAbsolute, CloseButtonRounded, Combobox, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DialogProvider, FileUpload, FileUploadInline, IconPicker, LoadingOverlay, Pagination, RichTextEditor, Select, Slider, Spinner, TagsInput, ThemeProvider, ThemeToggle, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useMediaQuery, useTheme };
|
|
39
|
+
export { AbsoluteFill, Alert, AvatarUpload, Button, CloseButtonAbsolute, CloseButtonRounded, Combobox, ContentCard, DEFAULT_ALERT_DURATION, DatePicker, DialogProvider, FileUpload, FileUploadInline, IconPicker, LoadingOverlay, Pagination, RichTextEditor, Select, Slider, Spinner, TagsInput, ThemeProvider, ThemeToggle, cn, showConfirmDialog, toast, toastError, toastInfo, toastSuccess, toastWarning, useMediaQuery, useTheme };
|
package/package.json
CHANGED