@pixpilot/shadcn-ui 0.4.0 → 0.4.2
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/AbsoluteFill.cjs +24 -1
- package/dist/AbsoluteFill.js +21 -1
- package/dist/Alert.cjs +82 -1
- package/dist/Alert.js +77 -1
- package/dist/Button.cjs +84 -1
- package/dist/Button.d.cts +1 -1
- package/dist/Button.d.ts +1 -1
- package/dist/Button.js +79 -1
- package/dist/CloseButtonAbsolute.cjs +20 -1
- package/dist/CloseButtonAbsolute.js +16 -1
- package/dist/CloseButtonRounded.cjs +22 -1
- package/dist/CloseButtonRounded.js +17 -1
- package/dist/Combobox.cjs +53 -1
- package/dist/Combobox.js +48 -1
- package/dist/CommandOptionList.cjs +29 -1
- package/dist/CommandOptionList.js +25 -1
- package/dist/ContentCard.cjs +27 -1
- package/dist/ContentCard.d.cts +1 -1
- package/dist/ContentCard.js +23 -1
- package/dist/DatePicker.cjs +38 -1
- package/dist/DatePicker.d.cts +1 -1
- package/dist/DatePicker.js +33 -1
- package/dist/LoadingOverlay.cjs +65 -1
- package/dist/LoadingOverlay.js +60 -1
- package/dist/Select.cjs +27 -1
- package/dist/Select.d.cts +1 -1
- package/dist/Select.js +23 -1
- package/dist/Slider.cjs +19 -1
- package/dist/Slider.js +15 -1
- package/dist/ThemeToggle.cjs +98 -1
- package/dist/ThemeToggle.js +94 -1
- package/dist/_virtual/rolldown_runtime.cjs +25 -1
- package/dist/confirmation-dialog/ConfirmationDialog.cjs +46 -1
- package/dist/confirmation-dialog/ConfirmationDialog.d.cts +1 -0
- package/dist/confirmation-dialog/ConfirmationDialog.js +42 -1
- package/dist/confirmation-dialog/DialogProvider.cjs +16 -1
- package/dist/confirmation-dialog/DialogProvider.js +12 -1
- package/dist/confirmation-dialog/confirmation-dialogs.cjs +14 -1
- package/dist/confirmation-dialog/confirmation-dialogs.js +12 -1
- package/dist/confirmation-dialog/index.cjs +6 -1
- package/dist/confirmation-dialog/index.js +6 -1
- package/dist/file-upload/FileUpload.cjs +68 -1
- package/dist/file-upload/FileUpload.d.ts +2 -2
- package/dist/file-upload/FileUpload.js +63 -1
- package/dist/file-upload/FileUploadItems.cjs +36 -1
- package/dist/file-upload/FileUploadItems.js +32 -1
- package/dist/file-upload/FileUploadListItem.cjs +88 -1
- package/dist/file-upload/FileUploadListItem.js +82 -1
- package/dist/file-upload/hooks/index.cjs +3 -1
- package/dist/file-upload/hooks/index.d.cts +2 -0
- package/dist/file-upload/hooks/index.js +3 -1
- package/dist/file-upload/hooks/use-file-error.cjs +15 -1
- package/dist/file-upload/hooks/use-file-error.js +13 -1
- package/dist/file-upload/hooks/use-file-upload-progress-callbacks.cjs +34 -1
- package/dist/file-upload/hooks/use-file-upload-progress-callbacks.d.cts +1 -0
- package/dist/file-upload/hooks/use-file-upload-progress-callbacks.js +31 -1
- package/dist/file-upload/hooks/use-file-upload-store.cjs +77 -1
- package/dist/file-upload/hooks/use-file-upload-store.d.cts +2 -0
- package/dist/file-upload/hooks/use-file-upload-store.js +75 -1
- package/dist/file-upload/index.cjs +5 -1
- package/dist/file-upload/index.d.cts +2 -1
- package/dist/file-upload/index.js +5 -1
- package/dist/file-upload/utils/create-placeholder-file.cjs +11 -1
- package/dist/file-upload/utils/create-placeholder-file.js +10 -1
- package/dist/file-upload/utils/get-file-key.cjs +8 -1
- package/dist/file-upload/utils/get-file-key.d.cts +1 -0
- package/dist/file-upload/utils/get-file-key.js +7 -1
- package/dist/file-upload/utils/get-file-meta.cjs +23 -1
- package/dist/file-upload/utils/get-file-meta.d.cts +1 -0
- package/dist/file-upload/utils/get-file-meta.js +21 -1
- package/dist/file-upload/utils/index.d.cts +4 -0
- package/dist/file-upload/utils/is-file-equal.cjs +9 -1
- package/dist/file-upload/utils/is-file-equal.d.cts +1 -0
- package/dist/file-upload/utils/is-file-equal.js +8 -1
- package/dist/file-upload/utils/merge-file-metadata.cjs +26 -1
- package/dist/file-upload/utils/merge-file-metadata.d.cts +1 -0
- package/dist/file-upload/utils/merge-file-metadata.js +26 -1
- package/dist/file-upload-inline/FileUploadInline.cjs +71 -1
- package/dist/file-upload-inline/FileUploadInline.d.ts +2 -2
- package/dist/file-upload-inline/FileUploadInline.js +66 -1
- package/dist/file-upload-inline/FileUploadInlineItem.cjs +94 -1
- package/dist/file-upload-inline/FileUploadInlineItem.js +88 -1
- package/dist/file-upload-inline/defaults.cjs +11 -1
- package/dist/file-upload-inline/defaults.js +10 -1
- package/dist/file-upload-inline/index.cjs +1 -1
- package/dist/file-upload-inline/index.js +1 -1
- package/dist/file-upload-inline/utils.cjs +36 -1
- package/dist/file-upload-inline/utils.js +34 -1
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/use-media-query.cjs +9 -1
- package/dist/hooks/use-media-query.js +7 -1
- package/dist/icon-selector/IconPicker.cjs +93 -1
- package/dist/icon-selector/IconPicker.d.cts +0 -1
- package/dist/icon-selector/IconPicker.d.ts +0 -1
- package/dist/icon-selector/IconPicker.js +88 -1
- package/dist/icon-selector/constants.cjs +6 -1
- package/dist/icon-selector/constants.js +5 -0
- package/dist/icon-selector/icon-picker-container.cjs +35 -1
- package/dist/icon-selector/icon-picker-container.js +32 -1
- package/dist/icon-selector/icon-picker-content.cjs +146 -1
- package/dist/icon-selector/icon-picker-content.js +141 -1
- package/dist/icon-selector/index.cjs +1 -1
- package/dist/icon-selector/index.d.cts +2 -2
- package/dist/icon-selector/index.d.ts +2 -2
- package/dist/icon-selector/index.js +1 -1
- package/dist/icon-selector/use-async-providers.cjs +69 -1
- package/dist/icon-selector/use-async-providers.js +67 -1
- package/dist/icon-selector/utils/is-valid-provider.cjs +11 -1
- package/dist/icon-selector/utils/is-valid-provider.js +10 -1
- package/dist/icon-selector/virtualized-icon-grid.cjs +137 -1
- package/dist/icon-selector/virtualized-icon-grid.js +132 -1
- package/dist/index.cjs +76 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +37 -1
- package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.cjs +18 -0
- package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.js +17 -0
- package/dist/node_modules/.pnpm/tailwind-merge@3.4.0/node_modules/tailwind-merge/dist/bundle-mjs.cjs +1894 -0
- package/dist/node_modules/.pnpm/tailwind-merge@3.4.0/node_modules/tailwind-merge/dist/bundle-mjs.js +1893 -0
- package/dist/packages/shadcn/src/lib/utils.cjs +10 -1
- package/dist/packages/shadcn/src/lib/utils.js +10 -1
- package/dist/pagination/Pagination.cjs +156 -1
- package/dist/pagination/Pagination.js +151 -1
- package/dist/pagination/index.cjs +1 -1
- package/dist/pagination/index.js +1 -1
- package/dist/rich-text-editor/RichTextEditor.cjs +132 -1
- package/dist/rich-text-editor/RichTextEditor.js +126 -1
- package/dist/rich-text-editor/index.cjs +1 -1
- package/dist/rich-text-editor/index.js +1 -1
- package/dist/rich-text-editor/predefined-toolbar-options.cjs +84 -1
- package/dist/rich-text-editor/predefined-toolbar-options.js +81 -1
- package/dist/spinner/index.cjs +1 -1
- package/dist/spinner/index.js +1 -1
- package/dist/spinner/spinner.cjs +73 -6
- package/dist/spinner/spinner.js +70 -6
- package/dist/spinner/styles.cjs +24 -12
- package/dist/spinner/styles.js +23 -12
- package/dist/tags-input.cjs +226 -1
- package/dist/tags-input.js +222 -1
- package/dist/theme-provider/ThemeProvider.cjs +27 -1
- package/dist/theme-provider/ThemeProvider.js +23 -1
- package/dist/theme-provider/index.cjs +4 -1
- package/dist/theme-provider/index.js +4 -1
- package/dist/toast/AlertToast.cjs +36 -1
- package/dist/toast/AlertToast.js +31 -1
- package/dist/toast/index.cjs +1 -1
- package/dist/toast/index.js +1 -1
- package/dist/toast/toast.cjs +75 -1
- package/dist/toast/toast.js +66 -1
- package/package.json +2 -2
- package/dist/_virtual/rolldown_runtime.js +0 -1
- package/dist/node_modules/.pnpm/@diceui_shared@0.12.0_@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@1_2c51ffe880f01dd537d5b6a13313daf4/node_modules/@diceui/shared/dist/index.cjs +0 -1
- package/dist/node_modules/.pnpm/@diceui_shared@0.12.0_@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@1_2c51ffe880f01dd537d5b6a13313daf4/node_modules/@diceui/shared/dist/index.js +0 -1
- package/dist/node_modules/.pnpm/@diceui_tags-input@0.7.2_@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__reac_e193dc2ff0d426ed009417f8d89778fd/node_modules/@diceui/tags-input/dist/index.cjs +0 -1
- package/dist/node_modules/.pnpm/@diceui_tags-input@0.7.2_@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__reac_e193dc2ff0d426ed009417f8d89778fd/node_modules/@diceui/tags-input/dist/index.js +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.cjs +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.js +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.cjs +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_react-dom@2.1.6_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_react-dom@2.1.6_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react/dist/floating-ui.react.esm.cjs +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react/dist/floating-ui.react.esm.js +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react/dist/floating-ui.react.utils.cjs +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react/dist/floating-ui.react.utils.js +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.cjs +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.cjs +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -1
- package/dist/node_modules/.pnpm/tabbable@6.3.0/node_modules/tabbable/dist/index.cjs +0 -1
- package/dist/node_modules/.pnpm/tabbable@6.3.0/node_modules/tabbable/dist/index.esm.js +0 -1
- package/dist/packages/shadcn/src/components/index.cjs +0 -1
- package/dist/packages/shadcn/src/components/index.js +0 -1
- package/dist/packages/shadcn/src/components/ui/OrContinueWithSeparator.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/OrContinueWithSeparator.js +0 -1
- package/dist/packages/shadcn/src/components/ui/alert-dialog.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/alert-dialog.js +0 -1
- package/dist/packages/shadcn/src/components/ui/alert.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/alert.js +0 -1
- package/dist/packages/shadcn/src/components/ui/avatar.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/avatar.js +0 -1
- package/dist/packages/shadcn/src/components/ui/badge.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/badge.js +0 -1
- package/dist/packages/shadcn/src/components/ui/button.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/button.js +0 -1
- package/dist/packages/shadcn/src/components/ui/calendar.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/calendar.js +0 -1
- package/dist/packages/shadcn/src/components/ui/card.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/card.js +0 -1
- package/dist/packages/shadcn/src/components/ui/checkbox.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/checkbox.js +0 -1
- package/dist/packages/shadcn/src/components/ui/command.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/command.js +0 -1
- package/dist/packages/shadcn/src/components/ui/dialog.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/dialog.js +0 -1
- package/dist/packages/shadcn/src/components/ui/dropdown-menu.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/dropdown-menu.js +0 -1
- package/dist/packages/shadcn/src/components/ui/file-upload.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/file-upload.js +0 -1
- package/dist/packages/shadcn/src/components/ui/form.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/form.js +0 -1
- package/dist/packages/shadcn/src/components/ui/index.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/index.js +0 -1
- package/dist/packages/shadcn/src/components/ui/input.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/input.js +0 -1
- package/dist/packages/shadcn/src/components/ui/label.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/label.js +0 -1
- package/dist/packages/shadcn/src/components/ui/pagination.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/pagination.js +0 -1
- package/dist/packages/shadcn/src/components/ui/popover.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/popover.js +0 -1
- package/dist/packages/shadcn/src/components/ui/radio-group.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/radio-group.js +0 -1
- package/dist/packages/shadcn/src/components/ui/select.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/select.js +0 -1
- package/dist/packages/shadcn/src/components/ui/separator.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/separator.js +0 -1
- package/dist/packages/shadcn/src/components/ui/shadcn-io/tags/index.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/shadcn-io/tags/index.js +0 -1
- package/dist/packages/shadcn/src/components/ui/shadcn-io/tags-input-inline/index.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/shadcn-io/tags-input-inline/index.js +0 -1
- package/dist/packages/shadcn/src/components/ui/sheet.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/sheet.js +0 -1
- package/dist/packages/shadcn/src/components/ui/slider.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/slider.js +0 -1
- package/dist/packages/shadcn/src/components/ui/switch.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/switch.js +0 -1
- package/dist/packages/shadcn/src/components/ui/tabs.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/tabs.js +0 -1
- package/dist/packages/shadcn/src/components/ui/textarea.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/textarea.js +0 -1
- package/dist/packages/shadcn/src/components/ui/tooltip.cjs +0 -1
- package/dist/packages/shadcn/src/components/ui/tooltip.js +0 -1
- package/dist/packages/shadcn/src/lib/index.cjs +0 -1
- package/dist/packages/shadcn/src/lib/index.js +0 -1
|
@@ -1 +1,46 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
3
|
+
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
6
|
+
let __ebay_nice_modal_react = require("@ebay/nice-modal-react");
|
|
7
|
+
__ebay_nice_modal_react = require_rolldown_runtime.__toESM(__ebay_nice_modal_react);
|
|
8
|
+
|
|
9
|
+
//#region src/confirmation-dialog/ConfirmationDialog.tsx
|
|
10
|
+
const ConfirmationDialog = __ebay_nice_modal_react.default.create((props) => {
|
|
11
|
+
const { title = "Confirmation Dialog" } = props;
|
|
12
|
+
const modal = (0, __ebay_nice_modal_react.useModal)();
|
|
13
|
+
const handleConfirm = () => {
|
|
14
|
+
props.onConfirm?.();
|
|
15
|
+
modal.resolve(true);
|
|
16
|
+
modal.hide();
|
|
17
|
+
};
|
|
18
|
+
const handleCancel = () => {
|
|
19
|
+
props.onCancel?.();
|
|
20
|
+
modal.resolve(false);
|
|
21
|
+
modal.hide();
|
|
22
|
+
};
|
|
23
|
+
const onOpenChange = (isOpen) => {
|
|
24
|
+
if (!isOpen) handleCancel();
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Dialog, {
|
|
27
|
+
open: modal.visible,
|
|
28
|
+
onOpenChange,
|
|
29
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.DialogContent, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.DialogHeader, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.DialogTitle, { children: title }), props.description != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.DialogDescription, { children: props.description })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.DialogFooter, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.DialogClose, {
|
|
30
|
+
asChild: true,
|
|
31
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Button, {
|
|
32
|
+
variant: "outline",
|
|
33
|
+
onClick: handleCancel,
|
|
34
|
+
children: props.cancelText ?? "Cancel"
|
|
35
|
+
})
|
|
36
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Button, {
|
|
37
|
+
onClick: handleConfirm,
|
|
38
|
+
children: props.confirmText ?? "Confirm"
|
|
39
|
+
})] })] })
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
ConfirmationDialog.displayName = "ConfirmationDialog";
|
|
43
|
+
var ConfirmationDialog_default = ConfirmationDialog;
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
exports.default = ConfirmationDialog_default;
|
|
@@ -1 +1,42 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { Button, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@pixpilot/shadcn";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import NiceModal, { useModal } from "@ebay/nice-modal-react";
|
|
4
|
+
|
|
5
|
+
//#region src/confirmation-dialog/ConfirmationDialog.tsx
|
|
6
|
+
const ConfirmationDialog = NiceModal.create((props) => {
|
|
7
|
+
const { title = "Confirmation Dialog" } = props;
|
|
8
|
+
const modal = useModal();
|
|
9
|
+
const handleConfirm = () => {
|
|
10
|
+
props.onConfirm?.();
|
|
11
|
+
modal.resolve(true);
|
|
12
|
+
modal.hide();
|
|
13
|
+
};
|
|
14
|
+
const handleCancel = () => {
|
|
15
|
+
props.onCancel?.();
|
|
16
|
+
modal.resolve(false);
|
|
17
|
+
modal.hide();
|
|
18
|
+
};
|
|
19
|
+
const onOpenChange = (isOpen) => {
|
|
20
|
+
if (!isOpen) handleCancel();
|
|
21
|
+
};
|
|
22
|
+
return /* @__PURE__ */ jsx(Dialog, {
|
|
23
|
+
open: modal.visible,
|
|
24
|
+
onOpenChange,
|
|
25
|
+
children: /* @__PURE__ */ jsxs(DialogContent, { children: [/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: title }), props.description != null && /* @__PURE__ */ jsx(DialogDescription, { children: props.description })] }), /* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(DialogClose, {
|
|
26
|
+
asChild: true,
|
|
27
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
28
|
+
variant: "outline",
|
|
29
|
+
onClick: handleCancel,
|
|
30
|
+
children: props.cancelText ?? "Cancel"
|
|
31
|
+
})
|
|
32
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
33
|
+
onClick: handleConfirm,
|
|
34
|
+
children: props.confirmText ?? "Confirm"
|
|
35
|
+
})] })] })
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
ConfirmationDialog.displayName = "ConfirmationDialog";
|
|
39
|
+
var ConfirmationDialog_default = ConfirmationDialog;
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { ConfirmationDialog_default as default };
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let react = require("react");
|
|
3
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
6
|
+
let __ebay_nice_modal_react = require("@ebay/nice-modal-react");
|
|
7
|
+
__ebay_nice_modal_react = require_rolldown_runtime.__toESM(__ebay_nice_modal_react);
|
|
8
|
+
|
|
9
|
+
//#region src/confirmation-dialog/DialogProvider.tsx
|
|
10
|
+
const DialogProvider = (props) => {
|
|
11
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ebay_nice_modal_react.default.Provider, { children: props.children });
|
|
12
|
+
};
|
|
13
|
+
DialogProvider.displayName = "DialogProvider";
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
exports.DialogProvider = DialogProvider;
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import NiceModal from "@ebay/nice-modal-react";
|
|
4
|
+
|
|
5
|
+
//#region src/confirmation-dialog/DialogProvider.tsx
|
|
6
|
+
const DialogProvider = (props) => {
|
|
7
|
+
return /* @__PURE__ */ jsx(NiceModal.Provider, { children: props.children });
|
|
8
|
+
};
|
|
9
|
+
DialogProvider.displayName = "DialogProvider";
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { DialogProvider };
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_ConfirmationDialog = require('./ConfirmationDialog.cjs');
|
|
3
|
+
let __ebay_nice_modal_react = require("@ebay/nice-modal-react");
|
|
4
|
+
__ebay_nice_modal_react = require_rolldown_runtime.__toESM(__ebay_nice_modal_react);
|
|
5
|
+
|
|
6
|
+
//#region src/confirmation-dialog/confirmation-dialogs.tsx
|
|
7
|
+
async function showConfirmDialog(props) {
|
|
8
|
+
const id = crypto.randomUUID();
|
|
9
|
+
__ebay_nice_modal_react.default.register(id, require_ConfirmationDialog.default);
|
|
10
|
+
return __ebay_nice_modal_react.default.show(id, props);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.showConfirmDialog = showConfirmDialog;
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ConfirmationDialog_default from "./ConfirmationDialog.js";
|
|
2
|
+
import NiceModal from "@ebay/nice-modal-react";
|
|
3
|
+
|
|
4
|
+
//#region src/confirmation-dialog/confirmation-dialogs.tsx
|
|
5
|
+
async function showConfirmDialog(props) {
|
|
6
|
+
const id = crypto.randomUUID();
|
|
7
|
+
NiceModal.register(id, ConfirmationDialog_default);
|
|
8
|
+
return NiceModal.show(id, props);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { showConfirmDialog };
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
require('./ConfirmationDialog.cjs');
|
|
5
|
+
const require_confirmation_dialogs = require('./confirmation-dialogs.cjs');
|
|
6
|
+
const require_DialogProvider = require('./DialogProvider.cjs');
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import "./ConfirmationDialog.js";
|
|
5
|
+
import { showConfirmDialog } from "./confirmation-dialogs.js";
|
|
6
|
+
import { DialogProvider } from "./DialogProvider.js";
|
|
@@ -1 +1,68 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
5
|
+
const require_FileUploadItems = require('./FileUploadItems.cjs');
|
|
6
|
+
const require_use_file_upload_store = require('./hooks/use-file-upload-store.cjs');
|
|
7
|
+
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
8
|
+
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
9
|
+
let lucide_react = require("lucide-react");
|
|
10
|
+
lucide_react = require_rolldown_runtime.__toESM(lucide_react);
|
|
11
|
+
let react = require("react");
|
|
12
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
13
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
14
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
15
|
+
|
|
16
|
+
//#region src/file-upload/FileUpload.tsx
|
|
17
|
+
function FileUpload(props) {
|
|
18
|
+
const { value, onChange, className, multiple = true, onAccept, maxFiles, preventDuplicates,...rest } = props;
|
|
19
|
+
const { handleAccept, displayFiles, deleteFile, getFile, orgValue } = require_use_file_upload_store.useFileUploadStore({
|
|
20
|
+
value,
|
|
21
|
+
onChange,
|
|
22
|
+
multiple,
|
|
23
|
+
preventDuplicates
|
|
24
|
+
});
|
|
25
|
+
const handleFileAccept = react.useCallback((files) => {
|
|
26
|
+
onAccept?.(files);
|
|
27
|
+
handleAccept(files);
|
|
28
|
+
}, [handleAccept, onAccept]);
|
|
29
|
+
const itemSize = "size-22";
|
|
30
|
+
const containerClasses = (0, __pixpilot_shadcn.cn)("p-1.5");
|
|
31
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.FileUpload, {
|
|
32
|
+
...rest,
|
|
33
|
+
value: orgValue,
|
|
34
|
+
onAccept: handleFileAccept,
|
|
35
|
+
multiple,
|
|
36
|
+
className: (0, __pixpilot_shadcn.cn)("w-full", className),
|
|
37
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.FileUploadDropzone, {
|
|
38
|
+
className: containerClasses,
|
|
39
|
+
children: displayFiles.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
40
|
+
className: "flex flex-col items-center gap-1 text-center p-2",
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
43
|
+
className: "flex items-center justify-center rounded-full border p-2.5",
|
|
44
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Upload, { className: "size-6 text-muted-foreground" })
|
|
45
|
+
}),
|
|
46
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
47
|
+
className: "font-medium text-sm",
|
|
48
|
+
children: "Drag & drop files here"
|
|
49
|
+
}),
|
|
50
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
51
|
+
className: "text-muted-foreground text-xs",
|
|
52
|
+
children: "Or click to browse (max 10 files, up to 5MB each)"
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FileUploadItems.FileUploadItems, {
|
|
56
|
+
displayFiles,
|
|
57
|
+
deleteFile,
|
|
58
|
+
getFile,
|
|
59
|
+
maxFiles,
|
|
60
|
+
itemSize,
|
|
61
|
+
className: containerClasses
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
exports.FileUpload = FileUpload;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FileUploadProps } from "./types/index.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime7 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/file-upload/FileUpload.d.ts
|
|
5
|
-
declare function FileUpload(props: FileUploadProps):
|
|
5
|
+
declare function FileUpload(props: FileUploadProps): react_jsx_runtime7.JSX.Element;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { FileUpload };
|
|
@@ -1 +1,63 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { FileUploadItems } from "./FileUploadItems.js";
|
|
5
|
+
import { useFileUploadStore } from "./hooks/use-file-upload-store.js";
|
|
6
|
+
import { FileUpload, FileUploadDropzone, cn } from "@pixpilot/shadcn";
|
|
7
|
+
import { Upload } from "lucide-react";
|
|
8
|
+
import * as React$1 from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
|
|
11
|
+
//#region src/file-upload/FileUpload.tsx
|
|
12
|
+
function FileUpload$1(props) {
|
|
13
|
+
const { value, onChange, className, multiple = true, onAccept, maxFiles, preventDuplicates,...rest } = props;
|
|
14
|
+
const { handleAccept, displayFiles, deleteFile, getFile, orgValue } = useFileUploadStore({
|
|
15
|
+
value,
|
|
16
|
+
onChange,
|
|
17
|
+
multiple,
|
|
18
|
+
preventDuplicates
|
|
19
|
+
});
|
|
20
|
+
const handleFileAccept = React$1.useCallback((files) => {
|
|
21
|
+
onAccept?.(files);
|
|
22
|
+
handleAccept(files);
|
|
23
|
+
}, [handleAccept, onAccept]);
|
|
24
|
+
const itemSize = "size-22";
|
|
25
|
+
const containerClasses = cn("p-1.5");
|
|
26
|
+
return /* @__PURE__ */ jsx(FileUpload, {
|
|
27
|
+
...rest,
|
|
28
|
+
value: orgValue,
|
|
29
|
+
onAccept: handleFileAccept,
|
|
30
|
+
multiple,
|
|
31
|
+
className: cn("w-full", className),
|
|
32
|
+
children: /* @__PURE__ */ jsx(FileUploadDropzone, {
|
|
33
|
+
className: containerClasses,
|
|
34
|
+
children: displayFiles.length === 0 ? /* @__PURE__ */ jsxs("div", {
|
|
35
|
+
className: "flex flex-col items-center gap-1 text-center p-2",
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ jsx("div", {
|
|
38
|
+
className: "flex items-center justify-center rounded-full border p-2.5",
|
|
39
|
+
children: /* @__PURE__ */ jsx(Upload, { className: "size-6 text-muted-foreground" })
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ jsx("p", {
|
|
42
|
+
className: "font-medium text-sm",
|
|
43
|
+
children: "Drag & drop files here"
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ jsx("p", {
|
|
46
|
+
className: "text-muted-foreground text-xs",
|
|
47
|
+
children: "Or click to browse (max 10 files, up to 5MB each)"
|
|
48
|
+
})
|
|
49
|
+
]
|
|
50
|
+
}) : /* @__PURE__ */ jsx(FileUploadItems, {
|
|
51
|
+
displayFiles,
|
|
52
|
+
deleteFile,
|
|
53
|
+
getFile,
|
|
54
|
+
maxFiles,
|
|
55
|
+
itemSize,
|
|
56
|
+
className: containerClasses
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
export { FileUpload$1 as FileUpload };
|
|
@@ -1 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
5
|
+
const require_FileUploadListItem = require('./FileUploadListItem.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/file-upload/FileUploadItems.tsx
|
|
14
|
+
function FileUploadItems({ displayFiles, deleteFile, getFile, maxFiles, itemSize, className }) {
|
|
15
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.FileUploadList, {
|
|
16
|
+
orientation: "horizontal",
|
|
17
|
+
forceMount: true,
|
|
18
|
+
className: (0, __pixpilot_shadcn.cn)("flex-wrap gap-4 w-full ", className),
|
|
19
|
+
children: [displayFiles.map((fileMeta) => {
|
|
20
|
+
const { name, lastModified } = fileMeta;
|
|
21
|
+
const key = `${name}-${lastModified}`;
|
|
22
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FileUploadListItem.FileUploadListItem, {
|
|
23
|
+
fileMeta,
|
|
24
|
+
deleteFile,
|
|
25
|
+
getFile,
|
|
26
|
+
itemSize
|
|
27
|
+
}, key);
|
|
28
|
+
}), maxFiles === void 0 || displayFiles.length < maxFiles ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
29
|
+
className: (0, __pixpilot_shadcn.cn)(itemSize, "flex items-center justify-center border-2 border-dashed rounded-md"),
|
|
30
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Plus, { className: "size-6 text-muted-foreground" })
|
|
31
|
+
}) : null]
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
exports.FileUploadItems = FileUploadItems;
|
|
@@ -1 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { FileUploadListItem } from "./FileUploadListItem.js";
|
|
5
|
+
import { FileUploadList, cn } from "@pixpilot/shadcn";
|
|
6
|
+
import { Plus } from "lucide-react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/file-upload/FileUploadItems.tsx
|
|
10
|
+
function FileUploadItems({ displayFiles, deleteFile, getFile, maxFiles, itemSize, className }) {
|
|
11
|
+
return /* @__PURE__ */ jsxs(FileUploadList, {
|
|
12
|
+
orientation: "horizontal",
|
|
13
|
+
forceMount: true,
|
|
14
|
+
className: cn("flex-wrap gap-4 w-full ", className),
|
|
15
|
+
children: [displayFiles.map((fileMeta) => {
|
|
16
|
+
const { name, lastModified } = fileMeta;
|
|
17
|
+
const key = `${name}-${lastModified}`;
|
|
18
|
+
return /* @__PURE__ */ jsx(FileUploadListItem, {
|
|
19
|
+
fileMeta,
|
|
20
|
+
deleteFile,
|
|
21
|
+
getFile,
|
|
22
|
+
itemSize
|
|
23
|
+
}, key);
|
|
24
|
+
}), maxFiles === void 0 || displayFiles.length < maxFiles ? /* @__PURE__ */ jsx("div", {
|
|
25
|
+
className: cn(itemSize, "flex items-center justify-center border-2 border-dashed rounded-md"),
|
|
26
|
+
children: /* @__PURE__ */ jsx(Plus, { className: "size-6 text-muted-foreground" })
|
|
27
|
+
}) : null]
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { FileUploadItems };
|
|
@@ -1 +1,88 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
5
|
+
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
6
|
+
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
7
|
+
let lucide_react = require("lucide-react");
|
|
8
|
+
lucide_react = require_rolldown_runtime.__toESM(lucide_react);
|
|
9
|
+
let react = require("react");
|
|
10
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
11
|
+
let pretty_bytes = require("pretty-bytes");
|
|
12
|
+
pretty_bytes = require_rolldown_runtime.__toESM(pretty_bytes);
|
|
13
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
14
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
15
|
+
|
|
16
|
+
//#region src/file-upload/FileUploadListItem.tsx
|
|
17
|
+
const Backdrop = ({ className, children }) => {
|
|
18
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
19
|
+
className: (0, __pixpilot_shadcn.cn)("bg-black/70 inset-0 absolute", className),
|
|
20
|
+
children
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
const FileUploadListItem = react.default.memo(({ fileMeta, deleteFile, getFile, itemSize }) => {
|
|
24
|
+
const file = getFile(fileMeta);
|
|
25
|
+
const storeFile = (0, __pixpilot_shadcn.useFileUpload)((store) => store.files.get(file));
|
|
26
|
+
const hasError = storeFile?.error != null;
|
|
27
|
+
const url = typeof fileMeta.url === "string" ? fileMeta.url : "";
|
|
28
|
+
const shouldRenderProgress = storeFile?.status !== "idle" && storeFile?.progress !== 100 && !hasError;
|
|
29
|
+
const renderPreview = (_file, fallback) => {
|
|
30
|
+
if (url.length > 0 && fileMeta.type.startsWith("image/")) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
31
|
+
className: "relative size-full",
|
|
32
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
33
|
+
src: url,
|
|
34
|
+
alt: fileMeta.name,
|
|
35
|
+
className: "size-full object-cover"
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
return fallback();
|
|
39
|
+
};
|
|
40
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.FileUploadItem, {
|
|
41
|
+
value: file,
|
|
42
|
+
className: (0, __pixpilot_shadcn.cn)("p-0"),
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.Tooltip, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.TooltipTrigger, {
|
|
45
|
+
asChild: true,
|
|
46
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.FileUploadItemPreview, {
|
|
47
|
+
className: (0, __pixpilot_shadcn.cn)(itemSize, "relative"),
|
|
48
|
+
render: renderPreview,
|
|
49
|
+
children: hasError ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Backdrop, {
|
|
50
|
+
className: "flex items-center justify-center",
|
|
51
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.AlertTriangle, { className: "text-destructive size-9" })
|
|
52
|
+
}) : shouldRenderProgress && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Backdrop, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.FileUploadItemProgress, {
|
|
53
|
+
variant: "circular",
|
|
54
|
+
strokeWidth: 4
|
|
55
|
+
}) })
|
|
56
|
+
})
|
|
57
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.TooltipContent, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", { children: [
|
|
58
|
+
fileMeta.name,
|
|
59
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("br", {}),
|
|
60
|
+
"Size: ",
|
|
61
|
+
(0, pretty_bytes.default)(fileMeta.size)
|
|
62
|
+
] }), hasError && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
63
|
+
className: "text-destructive flex items-center gap-2 mt-2",
|
|
64
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.AlertTriangle, { className: "text-destructive size-4" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
65
|
+
className: "font-bold",
|
|
66
|
+
children: storeFile?.error
|
|
67
|
+
})]
|
|
68
|
+
})] })] }),
|
|
69
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.FileUploadItemMetadata, { className: "sr-only" }),
|
|
70
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Button, {
|
|
71
|
+
type: "button",
|
|
72
|
+
variant: "secondary",
|
|
73
|
+
size: "icon",
|
|
74
|
+
className: "-top-1 -right-1 absolute size-5 rounded-full",
|
|
75
|
+
onClick: (event) => {
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
event.stopPropagation();
|
|
78
|
+
deleteFile(fileMeta);
|
|
79
|
+
},
|
|
80
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, { className: "size-3" })
|
|
81
|
+
})
|
|
82
|
+
]
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
FileUploadListItem.displayName = "FileUploadListItem";
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
exports.FileUploadListItem = FileUploadListItem;
|
|
@@ -1 +1,82 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { Button, FileUploadItem, FileUploadItemMetadata, FileUploadItemPreview, FileUploadItemProgress, Tooltip, TooltipContent, TooltipTrigger, cn, useFileUpload } from "@pixpilot/shadcn";
|
|
5
|
+
import { AlertTriangle, X } from "lucide-react";
|
|
6
|
+
import React from "react";
|
|
7
|
+
import prettyBytes from "pretty-bytes";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
|
|
10
|
+
//#region src/file-upload/FileUploadListItem.tsx
|
|
11
|
+
const Backdrop = ({ className, children }) => {
|
|
12
|
+
return /* @__PURE__ */ jsx("div", {
|
|
13
|
+
className: cn("bg-black/70 inset-0 absolute", className),
|
|
14
|
+
children
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
const FileUploadListItem = React.memo(({ fileMeta, deleteFile, getFile, itemSize }) => {
|
|
18
|
+
const file = getFile(fileMeta);
|
|
19
|
+
const storeFile = useFileUpload((store) => store.files.get(file));
|
|
20
|
+
const hasError = storeFile?.error != null;
|
|
21
|
+
const url = typeof fileMeta.url === "string" ? fileMeta.url : "";
|
|
22
|
+
const shouldRenderProgress = storeFile?.status !== "idle" && storeFile?.progress !== 100 && !hasError;
|
|
23
|
+
const renderPreview = (_file, fallback) => {
|
|
24
|
+
if (url.length > 0 && fileMeta.type.startsWith("image/")) return /* @__PURE__ */ jsx("div", {
|
|
25
|
+
className: "relative size-full",
|
|
26
|
+
children: /* @__PURE__ */ jsx("img", {
|
|
27
|
+
src: url,
|
|
28
|
+
alt: fileMeta.name,
|
|
29
|
+
className: "size-full object-cover"
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
return fallback();
|
|
33
|
+
};
|
|
34
|
+
return /* @__PURE__ */ jsxs(FileUploadItem, {
|
|
35
|
+
value: file,
|
|
36
|
+
className: cn("p-0"),
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
39
|
+
asChild: true,
|
|
40
|
+
children: /* @__PURE__ */ jsx(FileUploadItemPreview, {
|
|
41
|
+
className: cn(itemSize, "relative"),
|
|
42
|
+
render: renderPreview,
|
|
43
|
+
children: hasError ? /* @__PURE__ */ jsx(Backdrop, {
|
|
44
|
+
className: "flex items-center justify-center",
|
|
45
|
+
children: /* @__PURE__ */ jsx(AlertTriangle, { className: "text-destructive size-9" })
|
|
46
|
+
}) : shouldRenderProgress && /* @__PURE__ */ jsx(Backdrop, { children: /* @__PURE__ */ jsx(FileUploadItemProgress, {
|
|
47
|
+
variant: "circular",
|
|
48
|
+
strokeWidth: 4
|
|
49
|
+
}) })
|
|
50
|
+
})
|
|
51
|
+
}), /* @__PURE__ */ jsxs(TooltipContent, { children: [/* @__PURE__ */ jsxs("p", { children: [
|
|
52
|
+
fileMeta.name,
|
|
53
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
54
|
+
"Size: ",
|
|
55
|
+
prettyBytes(fileMeta.size)
|
|
56
|
+
] }), hasError && /* @__PURE__ */ jsxs("div", {
|
|
57
|
+
className: "text-destructive flex items-center gap-2 mt-2",
|
|
58
|
+
children: [/* @__PURE__ */ jsx(AlertTriangle, { className: "text-destructive size-4" }), /* @__PURE__ */ jsx("p", {
|
|
59
|
+
className: "font-bold",
|
|
60
|
+
children: storeFile?.error
|
|
61
|
+
})]
|
|
62
|
+
})] })] }),
|
|
63
|
+
/* @__PURE__ */ jsx(FileUploadItemMetadata, { className: "sr-only" }),
|
|
64
|
+
/* @__PURE__ */ jsx(Button, {
|
|
65
|
+
type: "button",
|
|
66
|
+
variant: "secondary",
|
|
67
|
+
size: "icon",
|
|
68
|
+
className: "-top-1 -right-1 absolute size-5 rounded-full",
|
|
69
|
+
onClick: (event) => {
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
event.stopPropagation();
|
|
72
|
+
deleteFile(fileMeta);
|
|
73
|
+
},
|
|
74
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-3" })
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
FileUploadListItem.displayName = "FileUploadListItem";
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
export { FileUploadListItem };
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_use_file_upload_store = require('./use-file-upload-store.cjs');
|
|
2
|
+
const require_use_file_error = require('./use-file-error.cjs');
|
|
3
|
+
const require_use_file_upload_progress_callbacks = require('./use-file-upload-progress-callbacks.cjs');
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
import{useFileUploadStore
|
|
1
|
+
import { useFileUploadStore } from "./use-file-upload-store.js";
|
|
2
|
+
import { useFileError } from "./use-file-error.js";
|
|
3
|
+
import { useFileUploadProgressCallbacks } from "./use-file-upload-progress-callbacks.js";
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
3
|
+
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
4
|
+
|
|
5
|
+
//#region src/file-upload/hooks/use-file-error.ts
|
|
6
|
+
function useFileError(file) {
|
|
7
|
+
return (0, __pixpilot_shadcn.useFileUpload)((store) => {
|
|
8
|
+
const storeFile = store.files.get(file);
|
|
9
|
+
if (storeFile?.error != null) return storeFile.error;
|
|
10
|
+
return null;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
exports.useFileError = useFileError;
|
|
@@ -1 +1,13 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { useFileUpload } from "@pixpilot/shadcn";
|
|
2
|
+
|
|
3
|
+
//#region src/file-upload/hooks/use-file-error.ts
|
|
4
|
+
function useFileError(file) {
|
|
5
|
+
return useFileUpload((store) => {
|
|
6
|
+
const storeFile = store.files.get(file);
|
|
7
|
+
if (storeFile?.error != null) return storeFile.error;
|
|
8
|
+
return null;
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { useFileError };
|