@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,94 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
5
|
+
const require_use_file_error = require('../file-upload/hooks/use-file-error.cjs');
|
|
6
|
+
const require_use_file_upload_progress_callbacks = require('../file-upload/hooks/use-file-upload-progress-callbacks.cjs');
|
|
7
|
+
require('../file-upload/hooks/index.cjs');
|
|
8
|
+
let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
9
|
+
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
10
|
+
let lucide_react = require("lucide-react");
|
|
11
|
+
lucide_react = require_rolldown_runtime.__toESM(lucide_react);
|
|
12
|
+
let react = require("react");
|
|
13
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
14
|
+
let pretty_bytes = require("pretty-bytes");
|
|
15
|
+
pretty_bytes = require_rolldown_runtime.__toESM(pretty_bytes);
|
|
16
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
17
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
18
|
+
|
|
19
|
+
//#region src/file-upload-inline/FileUploadInlineItem.tsx
|
|
20
|
+
const FileMetaDataDisplay = ({ size, name, children }) => {
|
|
21
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
22
|
+
className: (0, __pixpilot_shadcn.cn)("min-w-0 flex-1 flex flex-col"),
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
25
|
+
className: (0, __pixpilot_shadcn.cn)("truncate font-medium text-sm"),
|
|
26
|
+
children: name
|
|
27
|
+
}),
|
|
28
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
29
|
+
className: (0, __pixpilot_shadcn.cn)("truncate text-muted-foreground text-xs"),
|
|
30
|
+
children: (0, pretty_bytes.default)(size)
|
|
31
|
+
}),
|
|
32
|
+
children
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
const DeleteIconButton = ({ onClick }) => {
|
|
37
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.Button, {
|
|
38
|
+
variant: "ghost",
|
|
39
|
+
size: "icon",
|
|
40
|
+
className: "size-7 shrink-0",
|
|
41
|
+
"aria-label": "Remove file",
|
|
42
|
+
onClick,
|
|
43
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.XIcon, { className: "h-3.5 w-3.5" })
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
const FileItemWrapper = ({ children }) => {
|
|
47
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
48
|
+
className: "flex flex-col gap-2 rounded-md border border-input bg-background px-3 py-2 m-0 w-full",
|
|
49
|
+
children
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
const FileItemInnerWrapper = ({ children }) => {
|
|
53
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
54
|
+
className: "flex w-full gap-2",
|
|
55
|
+
children
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
const FileUploadInlineItem = react.default.memo(({ file, name = "", size = 0, type = "", lastModified = 0, disabled = false, onDelete }) => {
|
|
59
|
+
require_use_file_upload_progress_callbacks.useFileUploadProgressCallbacks(file, { onChange: () => {} });
|
|
60
|
+
const fileError = require_use_file_error.useFileError(file);
|
|
61
|
+
const isUploading = (0, __pixpilot_shadcn.useFileUpload)((store) => {
|
|
62
|
+
return store.files.get(file)?.status === "uploading";
|
|
63
|
+
});
|
|
64
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.FileUploadItem, {
|
|
65
|
+
className: "p-0 m-0 border-none",
|
|
66
|
+
value: file,
|
|
67
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(FileItemWrapper, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(FileItemInnerWrapper, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FileMetaDataDisplay, {
|
|
68
|
+
name,
|
|
69
|
+
size,
|
|
70
|
+
lastModified,
|
|
71
|
+
type,
|
|
72
|
+
children: fileError != null && isUploading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
73
|
+
className: "text-destructive text-xs",
|
|
74
|
+
children: fileError
|
|
75
|
+
})
|
|
76
|
+
}), !disabled && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DeleteIconButton, { onClick: (e) => {
|
|
77
|
+
e.stopPropagation();
|
|
78
|
+
e.preventDefault();
|
|
79
|
+
onDelete({
|
|
80
|
+
name,
|
|
81
|
+
size,
|
|
82
|
+
type,
|
|
83
|
+
lastModified,
|
|
84
|
+
file
|
|
85
|
+
});
|
|
86
|
+
} })] }), isUploading && fileError == null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.FileUploadItemProgress, {
|
|
87
|
+
variant: "linear",
|
|
88
|
+
className: "h-1 w-full"
|
|
89
|
+
})] })
|
|
90
|
+
}, `${name}-${size}-${lastModified}`);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
exports.FileUploadInlineItem = FileUploadInlineItem;
|
|
@@ -1 +1,88 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { useFileError } from "../file-upload/hooks/use-file-error.js";
|
|
5
|
+
import { useFileUploadProgressCallbacks } from "../file-upload/hooks/use-file-upload-progress-callbacks.js";
|
|
6
|
+
import "../file-upload/hooks/index.js";
|
|
7
|
+
import { Button, FileUploadItem, FileUploadItemProgress, cn, useFileUpload } from "@pixpilot/shadcn";
|
|
8
|
+
import { XIcon } from "lucide-react";
|
|
9
|
+
import React from "react";
|
|
10
|
+
import prettyBytes from "pretty-bytes";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
|
|
13
|
+
//#region src/file-upload-inline/FileUploadInlineItem.tsx
|
|
14
|
+
const FileMetaDataDisplay = ({ size, name, children }) => {
|
|
15
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
16
|
+
className: cn("min-w-0 flex-1 flex flex-col"),
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ jsx("span", {
|
|
19
|
+
className: cn("truncate font-medium text-sm"),
|
|
20
|
+
children: name
|
|
21
|
+
}),
|
|
22
|
+
/* @__PURE__ */ jsx("span", {
|
|
23
|
+
className: cn("truncate text-muted-foreground text-xs"),
|
|
24
|
+
children: prettyBytes(size)
|
|
25
|
+
}),
|
|
26
|
+
children
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
const DeleteIconButton = ({ onClick }) => {
|
|
31
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
32
|
+
variant: "ghost",
|
|
33
|
+
size: "icon",
|
|
34
|
+
className: "size-7 shrink-0",
|
|
35
|
+
"aria-label": "Remove file",
|
|
36
|
+
onClick,
|
|
37
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "h-3.5 w-3.5" })
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const FileItemWrapper = ({ children }) => {
|
|
41
|
+
return /* @__PURE__ */ jsx("div", {
|
|
42
|
+
className: "flex flex-col gap-2 rounded-md border border-input bg-background px-3 py-2 m-0 w-full",
|
|
43
|
+
children
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
const FileItemInnerWrapper = ({ children }) => {
|
|
47
|
+
return /* @__PURE__ */ jsx("div", {
|
|
48
|
+
className: "flex w-full gap-2",
|
|
49
|
+
children
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
const FileUploadInlineItem = React.memo(({ file, name = "", size = 0, type = "", lastModified = 0, disabled = false, onDelete }) => {
|
|
53
|
+
useFileUploadProgressCallbacks(file, { onChange: () => {} });
|
|
54
|
+
const fileError = useFileError(file);
|
|
55
|
+
const isUploading = useFileUpload((store) => {
|
|
56
|
+
return store.files.get(file)?.status === "uploading";
|
|
57
|
+
});
|
|
58
|
+
return /* @__PURE__ */ jsx(FileUploadItem, {
|
|
59
|
+
className: "p-0 m-0 border-none",
|
|
60
|
+
value: file,
|
|
61
|
+
children: /* @__PURE__ */ jsxs(FileItemWrapper, { children: [/* @__PURE__ */ jsxs(FileItemInnerWrapper, { children: [/* @__PURE__ */ jsx(FileMetaDataDisplay, {
|
|
62
|
+
name,
|
|
63
|
+
size,
|
|
64
|
+
lastModified,
|
|
65
|
+
type,
|
|
66
|
+
children: fileError != null && isUploading && /* @__PURE__ */ jsx("div", {
|
|
67
|
+
className: "text-destructive text-xs",
|
|
68
|
+
children: fileError
|
|
69
|
+
})
|
|
70
|
+
}), !disabled && /* @__PURE__ */ jsx(DeleteIconButton, { onClick: (e) => {
|
|
71
|
+
e.stopPropagation();
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
onDelete({
|
|
74
|
+
name,
|
|
75
|
+
size,
|
|
76
|
+
type,
|
|
77
|
+
lastModified,
|
|
78
|
+
file
|
|
79
|
+
});
|
|
80
|
+
} })] }), isUploading && fileError == null && /* @__PURE__ */ jsx(FileUploadItemProgress, {
|
|
81
|
+
variant: "linear",
|
|
82
|
+
className: "h-1 w-full"
|
|
83
|
+
})] })
|
|
84
|
+
}, `${name}-${size}-${lastModified}`);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
export { FileUploadInlineItem };
|
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/file-upload-inline/defaults.ts
|
|
3
|
+
const defaultOptions = {
|
|
4
|
+
buttonText: "Browse file",
|
|
5
|
+
showIcon: true,
|
|
6
|
+
disabled: false,
|
|
7
|
+
multiple: false
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.defaultOptions = defaultOptions;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/file-upload-inline/defaults.ts
|
|
2
|
+
const defaultOptions = {
|
|
3
|
+
buttonText: "Browse file",
|
|
4
|
+
showIcon: true,
|
|
5
|
+
disabled: false,
|
|
6
|
+
multiple: false
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { defaultOptions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_FileUploadInline = require('./FileUploadInline.cjs');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FileUploadInline
|
|
1
|
+
import { FileUploadInline } from "./FileUploadInline.js";
|
|
@@ -1 +1,36 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_merge_file_metadata = require('../file-upload/utils/merge-file-metadata.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/file-upload-inline/utils.ts
|
|
4
|
+
function normalizeToArray(value) {
|
|
5
|
+
if (value == null) return [];
|
|
6
|
+
return Array.isArray(value) ? value : [value];
|
|
7
|
+
}
|
|
8
|
+
function callOnChange(value, multiple, onChange) {
|
|
9
|
+
const fileMetaDataOnly = value.map(({ file,...metaData }) => metaData);
|
|
10
|
+
if (multiple) onChange?.(fileMetaDataOnly);
|
|
11
|
+
else onChange?.(fileMetaDataOnly[0] ?? null);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Handles file value change for FileUploadInline component
|
|
15
|
+
* Normalizes files, merges metadata, and calls appropriate onChange callback
|
|
16
|
+
*
|
|
17
|
+
* @param value - The current file value
|
|
18
|
+
* @param acceptedFiles - Files accepted from file input
|
|
19
|
+
* @param multiple - Whether multiple files are allowed
|
|
20
|
+
* @param onChange - onChange callback
|
|
21
|
+
* @returns Object containing merged files and fileMetadataOnly arrays
|
|
22
|
+
*/
|
|
23
|
+
function handleFileValueChange(value, acceptedFiles, multiple, onChange) {
|
|
24
|
+
const mergedFiles = require_merge_file_metadata.mergeFileMetadata(normalizeToArray(value), acceptedFiles);
|
|
25
|
+
const fileMetaDataOnly = mergedFiles.map(({ file,...metaData }) => metaData);
|
|
26
|
+
callOnChange(mergedFiles, multiple, onChange);
|
|
27
|
+
return {
|
|
28
|
+
mergedFiles,
|
|
29
|
+
fileMetaDataOnly
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
exports.callOnChange = callOnChange;
|
|
35
|
+
exports.handleFileValueChange = handleFileValueChange;
|
|
36
|
+
exports.normalizeToArray = normalizeToArray;
|
|
@@ -1 +1,34 @@
|
|
|
1
|
-
import{mergeFileMetadata
|
|
1
|
+
import { mergeFileMetadata } from "../file-upload/utils/merge-file-metadata.js";
|
|
2
|
+
|
|
3
|
+
//#region src/file-upload-inline/utils.ts
|
|
4
|
+
function normalizeToArray(value) {
|
|
5
|
+
if (value == null) return [];
|
|
6
|
+
return Array.isArray(value) ? value : [value];
|
|
7
|
+
}
|
|
8
|
+
function callOnChange(value, multiple, onChange) {
|
|
9
|
+
const fileMetaDataOnly = value.map(({ file,...metaData }) => metaData);
|
|
10
|
+
if (multiple) onChange?.(fileMetaDataOnly);
|
|
11
|
+
else onChange?.(fileMetaDataOnly[0] ?? null);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Handles file value change for FileUploadInline component
|
|
15
|
+
* Normalizes files, merges metadata, and calls appropriate onChange callback
|
|
16
|
+
*
|
|
17
|
+
* @param value - The current file value
|
|
18
|
+
* @param acceptedFiles - Files accepted from file input
|
|
19
|
+
* @param multiple - Whether multiple files are allowed
|
|
20
|
+
* @param onChange - onChange callback
|
|
21
|
+
* @returns Object containing merged files and fileMetadataOnly arrays
|
|
22
|
+
*/
|
|
23
|
+
function handleFileValueChange(value, acceptedFiles, multiple, onChange) {
|
|
24
|
+
const mergedFiles = mergeFileMetadata(normalizeToArray(value), acceptedFiles);
|
|
25
|
+
const fileMetaDataOnly = mergedFiles.map(({ file,...metaData }) => metaData);
|
|
26
|
+
callOnChange(mergedFiles, multiple, onChange);
|
|
27
|
+
return {
|
|
28
|
+
mergedFiles,
|
|
29
|
+
fileMetaDataOnly
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { callOnChange, handleFileValueChange, normalizeToArray };
|
package/dist/hooks/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_use_media_query = require('./use-media-query.cjs');
|
package/dist/hooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useMediaQuery
|
|
1
|
+
import { useMediaQuery } from "./use-media-query.js";
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let react_responsive = require("react-responsive");
|
|
3
|
+
react_responsive = require_rolldown_runtime.__toESM(react_responsive);
|
|
4
|
+
|
|
5
|
+
//#region src/hooks/use-media-query.ts
|
|
6
|
+
const useMediaQuery = react_responsive.useMediaQuery;
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
exports.useMediaQuery = useMediaQuery;
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
import{useMediaQuery
|
|
1
|
+
import { useMediaQuery } from "react-responsive";
|
|
2
|
+
|
|
3
|
+
//#region src/hooks/use-media-query.ts
|
|
4
|
+
const useMediaQuery$1 = useMediaQuery;
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
export { useMediaQuery$1 as useMediaQuery };
|
|
@@ -1 +1,93 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_Button = require('../Button.cjs');
|
|
3
|
+
const require_use_media_query = require('../hooks/use-media-query.cjs');
|
|
4
|
+
require('../hooks/index.cjs');
|
|
5
|
+
const require_constants = require('./constants.cjs');
|
|
6
|
+
const require_icon_picker_container = require('./icon-picker-container.cjs');
|
|
7
|
+
const require_icon_picker_content = require('./icon-picker-content.cjs');
|
|
8
|
+
let react = require("react");
|
|
9
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
12
|
+
let __iconify_react = require("@iconify/react");
|
|
13
|
+
__iconify_react = require_rolldown_runtime.__toESM(__iconify_react);
|
|
14
|
+
|
|
15
|
+
//#region src/icon-selector/IconPicker.tsx
|
|
16
|
+
const IconPicker = ({ value, onChange, onOpenChange, pickerMode = "dialog", popover, variant = "default", providers: providersProp }) => {
|
|
17
|
+
const [isOpen, setIsOpen] = (0, react.useState)(false);
|
|
18
|
+
const isMobile = require_use_media_query.useMediaQuery({ maxWidth: 768 });
|
|
19
|
+
const handleSelectIcon = (0, react.useCallback)((iconName) => {
|
|
20
|
+
onChange?.(iconName);
|
|
21
|
+
setIsOpen(false);
|
|
22
|
+
onOpenChange?.(false);
|
|
23
|
+
}, [onChange, onOpenChange]);
|
|
24
|
+
const hasValue = typeof value === "string" && value.length > 0;
|
|
25
|
+
const displayIcon = hasValue ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__iconify_react.Icon, {
|
|
26
|
+
icon: value,
|
|
27
|
+
width: "20",
|
|
28
|
+
height: "20"
|
|
29
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
30
|
+
className: "text-sm text-muted-foreground",
|
|
31
|
+
children: "No icon selected"
|
|
32
|
+
});
|
|
33
|
+
const selectorContent = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icon_picker_content.default, {
|
|
34
|
+
providers: providersProp,
|
|
35
|
+
onChange: handleSelectIcon,
|
|
36
|
+
onSelect: () => setIsOpen(false)
|
|
37
|
+
});
|
|
38
|
+
if (providersProp.length === 0) if (process.env.NODE_ENV === "development") throw new Error(require_constants.ICON_SELECTOR_ERROR_MESSAGE);
|
|
39
|
+
else return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: "No icons configured" });
|
|
40
|
+
let effectiveMode;
|
|
41
|
+
if (pickerMode === "popover") effectiveMode = isMobile ? "dialog" : "popover";
|
|
42
|
+
else effectiveMode = pickerMode;
|
|
43
|
+
const isIconButtonVariant = variant === "icon-button";
|
|
44
|
+
const iconButtonLabel = hasValue ? `Change selected icon (${value})` : "Select an icon";
|
|
45
|
+
const iconButtonContent = hasValue ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__iconify_react.Icon, {
|
|
46
|
+
icon: value,
|
|
47
|
+
width: "20",
|
|
48
|
+
height: "20"
|
|
49
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
50
|
+
"aria-hidden": "true",
|
|
51
|
+
className: "text-muted-foreground text-lg",
|
|
52
|
+
children: "+"
|
|
53
|
+
});
|
|
54
|
+
if (isIconButtonVariant) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icon_picker_container.IconPickerContainer, {
|
|
55
|
+
effectiveMode,
|
|
56
|
+
isOpen,
|
|
57
|
+
setIsOpen,
|
|
58
|
+
selectorContent,
|
|
59
|
+
popover,
|
|
60
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Button.Button, {
|
|
61
|
+
type: "button",
|
|
62
|
+
variant: "outline",
|
|
63
|
+
className: "p-2",
|
|
64
|
+
"aria-label": iconButtonLabel,
|
|
65
|
+
children: iconButtonContent
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
69
|
+
className: "flex items-center gap-2",
|
|
70
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
71
|
+
className: "flex items-center gap-2 rounded-md border border-input bg-background px-3 py-2",
|
|
72
|
+
children: [displayIcon, hasValue && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
73
|
+
className: "text-sm text-muted-foreground",
|
|
74
|
+
children: value
|
|
75
|
+
})]
|
|
76
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icon_picker_container.IconPickerContainer, {
|
|
77
|
+
effectiveMode,
|
|
78
|
+
isOpen,
|
|
79
|
+
setIsOpen,
|
|
80
|
+
selectorContent,
|
|
81
|
+
popover,
|
|
82
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Button.Button, {
|
|
83
|
+
type: "button",
|
|
84
|
+
variant: "outline",
|
|
85
|
+
className: "whitespace-nowrap",
|
|
86
|
+
children: hasValue ? "Change Icon" : "Select Icon"
|
|
87
|
+
})
|
|
88
|
+
})]
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
//#endregion
|
|
93
|
+
exports.IconPicker = IconPicker;
|
|
@@ -1 +1,88 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { Button } from "../Button.js";
|
|
2
|
+
import { useMediaQuery } from "../hooks/use-media-query.js";
|
|
3
|
+
import "../hooks/index.js";
|
|
4
|
+
import { ICON_SELECTOR_ERROR_MESSAGE } from "./constants.js";
|
|
5
|
+
import { IconPickerContainer } from "./icon-picker-container.js";
|
|
6
|
+
import icon_picker_content_default from "./icon-picker-content.js";
|
|
7
|
+
import { useCallback, useState } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { Icon } from "@iconify/react";
|
|
10
|
+
|
|
11
|
+
//#region src/icon-selector/IconPicker.tsx
|
|
12
|
+
const IconPicker = ({ value, onChange, onOpenChange, pickerMode = "dialog", popover, variant = "default", providers: providersProp }) => {
|
|
13
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
14
|
+
const isMobile = useMediaQuery({ maxWidth: 768 });
|
|
15
|
+
const handleSelectIcon = useCallback((iconName) => {
|
|
16
|
+
onChange?.(iconName);
|
|
17
|
+
setIsOpen(false);
|
|
18
|
+
onOpenChange?.(false);
|
|
19
|
+
}, [onChange, onOpenChange]);
|
|
20
|
+
const hasValue = typeof value === "string" && value.length > 0;
|
|
21
|
+
const displayIcon = hasValue ? /* @__PURE__ */ jsx(Icon, {
|
|
22
|
+
icon: value,
|
|
23
|
+
width: "20",
|
|
24
|
+
height: "20"
|
|
25
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
26
|
+
className: "text-sm text-muted-foreground",
|
|
27
|
+
children: "No icon selected"
|
|
28
|
+
});
|
|
29
|
+
const selectorContent = /* @__PURE__ */ jsx(icon_picker_content_default, {
|
|
30
|
+
providers: providersProp,
|
|
31
|
+
onChange: handleSelectIcon,
|
|
32
|
+
onSelect: () => setIsOpen(false)
|
|
33
|
+
});
|
|
34
|
+
if (providersProp.length === 0) throw new Error(ICON_SELECTOR_ERROR_MESSAGE);
|
|
35
|
+
let effectiveMode;
|
|
36
|
+
if (pickerMode === "popover") effectiveMode = isMobile ? "dialog" : "popover";
|
|
37
|
+
else effectiveMode = pickerMode;
|
|
38
|
+
const isIconButtonVariant = variant === "icon-button";
|
|
39
|
+
const iconButtonLabel = hasValue ? `Change selected icon (${value})` : "Select an icon";
|
|
40
|
+
const iconButtonContent = hasValue ? /* @__PURE__ */ jsx(Icon, {
|
|
41
|
+
icon: value,
|
|
42
|
+
width: "20",
|
|
43
|
+
height: "20"
|
|
44
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
45
|
+
"aria-hidden": "true",
|
|
46
|
+
className: "text-muted-foreground text-lg",
|
|
47
|
+
children: "+"
|
|
48
|
+
});
|
|
49
|
+
if (isIconButtonVariant) return /* @__PURE__ */ jsx(IconPickerContainer, {
|
|
50
|
+
effectiveMode,
|
|
51
|
+
isOpen,
|
|
52
|
+
setIsOpen,
|
|
53
|
+
selectorContent,
|
|
54
|
+
popover,
|
|
55
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
56
|
+
type: "button",
|
|
57
|
+
variant: "outline",
|
|
58
|
+
className: "p-2",
|
|
59
|
+
"aria-label": iconButtonLabel,
|
|
60
|
+
children: iconButtonContent
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
64
|
+
className: "flex items-center gap-2",
|
|
65
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
66
|
+
className: "flex items-center gap-2 rounded-md border border-input bg-background px-3 py-2",
|
|
67
|
+
children: [displayIcon, hasValue && /* @__PURE__ */ jsx("span", {
|
|
68
|
+
className: "text-sm text-muted-foreground",
|
|
69
|
+
children: value
|
|
70
|
+
})]
|
|
71
|
+
}), /* @__PURE__ */ jsx(IconPickerContainer, {
|
|
72
|
+
effectiveMode,
|
|
73
|
+
isOpen,
|
|
74
|
+
setIsOpen,
|
|
75
|
+
selectorContent,
|
|
76
|
+
popover,
|
|
77
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
78
|
+
type: "button",
|
|
79
|
+
variant: "outline",
|
|
80
|
+
className: "whitespace-nowrap",
|
|
81
|
+
children: hasValue ? "Change Icon" : "Select Icon"
|
|
82
|
+
})
|
|
83
|
+
})]
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
export { IconPicker };
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/icon-selector/constants.ts
|
|
3
|
+
const ICON_SELECTOR_ERROR_MESSAGE = `IconSelector requires icon providers configured in <Form fields={{iconSelector: {providers: [{prefix, icons, name}, ...]}}}>`;
|
|
4
|
+
|
|
5
|
+
//#endregion
|
|
6
|
+
exports.ICON_SELECTOR_ERROR_MESSAGE = ICON_SELECTOR_ERROR_MESSAGE;
|
|
@@ -1 +1,35 @@
|
|
|
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
|
+
|
|
7
|
+
//#region src/icon-selector/icon-picker-container.tsx
|
|
8
|
+
const IconPickerContainer = ({ effectiveMode, isOpen, setIsOpen, selectorContent, children, popover }) => {
|
|
9
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [effectiveMode === "dialog" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.Dialog, {
|
|
10
|
+
open: isOpen,
|
|
11
|
+
onOpenChange: setIsOpen,
|
|
12
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.DialogTrigger, {
|
|
13
|
+
asChild: true,
|
|
14
|
+
children
|
|
15
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.DialogContent, {
|
|
16
|
+
className: "max-h-[80vh] w-full overflow-hidden",
|
|
17
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.DialogHeader, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.DialogTitle, { children: "Select an Icon" }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: selectorContent })]
|
|
18
|
+
})]
|
|
19
|
+
}), effectiveMode === "popover" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.Popover, {
|
|
20
|
+
open: isOpen,
|
|
21
|
+
onOpenChange: setIsOpen,
|
|
22
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.PopoverTrigger, {
|
|
23
|
+
asChild: true,
|
|
24
|
+
children
|
|
25
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.PopoverContent, {
|
|
26
|
+
side: "right",
|
|
27
|
+
...popover,
|
|
28
|
+
className: (0, __pixpilot_shadcn.cn)("w-full min-w-sm lg:min-w-lg p-4", "max-h-dvh md:max-h-auto", popover?.className),
|
|
29
|
+
children: selectorContent
|
|
30
|
+
})]
|
|
31
|
+
})] });
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
exports.IconPickerContainer = IconPickerContainer;
|
|
@@ -1 +1,32 @@
|
|
|
1
|
-
import{Dialog
|
|
1
|
+
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger, Popover, PopoverContent, PopoverTrigger, cn } from "@pixpilot/shadcn";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/icon-selector/icon-picker-container.tsx
|
|
5
|
+
const IconPickerContainer = ({ effectiveMode, isOpen, setIsOpen, selectorContent, children, popover }) => {
|
|
6
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [effectiveMode === "dialog" && /* @__PURE__ */ jsxs(Dialog, {
|
|
7
|
+
open: isOpen,
|
|
8
|
+
onOpenChange: setIsOpen,
|
|
9
|
+
children: [/* @__PURE__ */ jsx(DialogTrigger, {
|
|
10
|
+
asChild: true,
|
|
11
|
+
children
|
|
12
|
+
}), /* @__PURE__ */ jsxs(DialogContent, {
|
|
13
|
+
className: "max-h-[80vh] w-full overflow-hidden",
|
|
14
|
+
children: [/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: "Select an Icon" }) }), /* @__PURE__ */ jsx("div", { children: selectorContent })]
|
|
15
|
+
})]
|
|
16
|
+
}), effectiveMode === "popover" && /* @__PURE__ */ jsxs(Popover, {
|
|
17
|
+
open: isOpen,
|
|
18
|
+
onOpenChange: setIsOpen,
|
|
19
|
+
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
20
|
+
asChild: true,
|
|
21
|
+
children
|
|
22
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
23
|
+
side: "right",
|
|
24
|
+
...popover,
|
|
25
|
+
className: cn("w-full min-w-sm lg:min-w-lg p-4", "max-h-dvh md:max-h-auto", popover?.className),
|
|
26
|
+
children: selectorContent
|
|
27
|
+
})]
|
|
28
|
+
})] });
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { IconPickerContainer };
|