@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.
Files changed (236) hide show
  1. package/dist/AbsoluteFill.cjs +24 -1
  2. package/dist/AbsoluteFill.js +21 -1
  3. package/dist/Alert.cjs +82 -1
  4. package/dist/Alert.js +77 -1
  5. package/dist/Button.cjs +84 -1
  6. package/dist/Button.d.cts +1 -1
  7. package/dist/Button.d.ts +1 -1
  8. package/dist/Button.js +79 -1
  9. package/dist/CloseButtonAbsolute.cjs +20 -1
  10. package/dist/CloseButtonAbsolute.js +16 -1
  11. package/dist/CloseButtonRounded.cjs +22 -1
  12. package/dist/CloseButtonRounded.js +17 -1
  13. package/dist/Combobox.cjs +53 -1
  14. package/dist/Combobox.js +48 -1
  15. package/dist/CommandOptionList.cjs +29 -1
  16. package/dist/CommandOptionList.js +25 -1
  17. package/dist/ContentCard.cjs +27 -1
  18. package/dist/ContentCard.d.cts +1 -1
  19. package/dist/ContentCard.js +23 -1
  20. package/dist/DatePicker.cjs +38 -1
  21. package/dist/DatePicker.d.cts +1 -1
  22. package/dist/DatePicker.js +33 -1
  23. package/dist/LoadingOverlay.cjs +65 -1
  24. package/dist/LoadingOverlay.js +60 -1
  25. package/dist/Select.cjs +27 -1
  26. package/dist/Select.d.cts +1 -1
  27. package/dist/Select.js +23 -1
  28. package/dist/Slider.cjs +19 -1
  29. package/dist/Slider.js +15 -1
  30. package/dist/ThemeToggle.cjs +98 -1
  31. package/dist/ThemeToggle.js +94 -1
  32. package/dist/_virtual/rolldown_runtime.cjs +25 -1
  33. package/dist/confirmation-dialog/ConfirmationDialog.cjs +46 -1
  34. package/dist/confirmation-dialog/ConfirmationDialog.d.cts +1 -0
  35. package/dist/confirmation-dialog/ConfirmationDialog.js +42 -1
  36. package/dist/confirmation-dialog/DialogProvider.cjs +16 -1
  37. package/dist/confirmation-dialog/DialogProvider.js +12 -1
  38. package/dist/confirmation-dialog/confirmation-dialogs.cjs +14 -1
  39. package/dist/confirmation-dialog/confirmation-dialogs.js +12 -1
  40. package/dist/confirmation-dialog/index.cjs +6 -1
  41. package/dist/confirmation-dialog/index.js +6 -1
  42. package/dist/file-upload/FileUpload.cjs +68 -1
  43. package/dist/file-upload/FileUpload.d.ts +2 -2
  44. package/dist/file-upload/FileUpload.js +63 -1
  45. package/dist/file-upload/FileUploadItems.cjs +36 -1
  46. package/dist/file-upload/FileUploadItems.js +32 -1
  47. package/dist/file-upload/FileUploadListItem.cjs +88 -1
  48. package/dist/file-upload/FileUploadListItem.js +82 -1
  49. package/dist/file-upload/hooks/index.cjs +3 -1
  50. package/dist/file-upload/hooks/index.d.cts +2 -0
  51. package/dist/file-upload/hooks/index.js +3 -1
  52. package/dist/file-upload/hooks/use-file-error.cjs +15 -1
  53. package/dist/file-upload/hooks/use-file-error.js +13 -1
  54. package/dist/file-upload/hooks/use-file-upload-progress-callbacks.cjs +34 -1
  55. package/dist/file-upload/hooks/use-file-upload-progress-callbacks.d.cts +1 -0
  56. package/dist/file-upload/hooks/use-file-upload-progress-callbacks.js +31 -1
  57. package/dist/file-upload/hooks/use-file-upload-store.cjs +77 -1
  58. package/dist/file-upload/hooks/use-file-upload-store.d.cts +2 -0
  59. package/dist/file-upload/hooks/use-file-upload-store.js +75 -1
  60. package/dist/file-upload/index.cjs +5 -1
  61. package/dist/file-upload/index.d.cts +2 -1
  62. package/dist/file-upload/index.js +5 -1
  63. package/dist/file-upload/utils/create-placeholder-file.cjs +11 -1
  64. package/dist/file-upload/utils/create-placeholder-file.js +10 -1
  65. package/dist/file-upload/utils/get-file-key.cjs +8 -1
  66. package/dist/file-upload/utils/get-file-key.d.cts +1 -0
  67. package/dist/file-upload/utils/get-file-key.js +7 -1
  68. package/dist/file-upload/utils/get-file-meta.cjs +23 -1
  69. package/dist/file-upload/utils/get-file-meta.d.cts +1 -0
  70. package/dist/file-upload/utils/get-file-meta.js +21 -1
  71. package/dist/file-upload/utils/index.d.cts +4 -0
  72. package/dist/file-upload/utils/is-file-equal.cjs +9 -1
  73. package/dist/file-upload/utils/is-file-equal.d.cts +1 -0
  74. package/dist/file-upload/utils/is-file-equal.js +8 -1
  75. package/dist/file-upload/utils/merge-file-metadata.cjs +26 -1
  76. package/dist/file-upload/utils/merge-file-metadata.d.cts +1 -0
  77. package/dist/file-upload/utils/merge-file-metadata.js +26 -1
  78. package/dist/file-upload-inline/FileUploadInline.cjs +71 -1
  79. package/dist/file-upload-inline/FileUploadInline.d.ts +2 -2
  80. package/dist/file-upload-inline/FileUploadInline.js +66 -1
  81. package/dist/file-upload-inline/FileUploadInlineItem.cjs +94 -1
  82. package/dist/file-upload-inline/FileUploadInlineItem.js +88 -1
  83. package/dist/file-upload-inline/defaults.cjs +11 -1
  84. package/dist/file-upload-inline/defaults.js +10 -1
  85. package/dist/file-upload-inline/index.cjs +1 -1
  86. package/dist/file-upload-inline/index.js +1 -1
  87. package/dist/file-upload-inline/utils.cjs +36 -1
  88. package/dist/file-upload-inline/utils.js +34 -1
  89. package/dist/hooks/index.cjs +1 -1
  90. package/dist/hooks/index.js +1 -1
  91. package/dist/hooks/use-media-query.cjs +9 -1
  92. package/dist/hooks/use-media-query.js +7 -1
  93. package/dist/icon-selector/IconPicker.cjs +93 -1
  94. package/dist/icon-selector/IconPicker.d.cts +0 -1
  95. package/dist/icon-selector/IconPicker.d.ts +0 -1
  96. package/dist/icon-selector/IconPicker.js +88 -1
  97. package/dist/icon-selector/constants.cjs +6 -1
  98. package/dist/icon-selector/constants.js +5 -0
  99. package/dist/icon-selector/icon-picker-container.cjs +35 -1
  100. package/dist/icon-selector/icon-picker-container.js +32 -1
  101. package/dist/icon-selector/icon-picker-content.cjs +146 -1
  102. package/dist/icon-selector/icon-picker-content.js +141 -1
  103. package/dist/icon-selector/index.cjs +1 -1
  104. package/dist/icon-selector/index.d.cts +2 -2
  105. package/dist/icon-selector/index.d.ts +2 -2
  106. package/dist/icon-selector/index.js +1 -1
  107. package/dist/icon-selector/use-async-providers.cjs +69 -1
  108. package/dist/icon-selector/use-async-providers.js +67 -1
  109. package/dist/icon-selector/utils/is-valid-provider.cjs +11 -1
  110. package/dist/icon-selector/utils/is-valid-provider.js +10 -1
  111. package/dist/icon-selector/virtualized-icon-grid.cjs +137 -1
  112. package/dist/icon-selector/virtualized-icon-grid.js +132 -1
  113. package/dist/index.cjs +76 -1
  114. package/dist/index.d.cts +2 -2
  115. package/dist/index.d.ts +2 -2
  116. package/dist/index.js +37 -1
  117. package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.cjs +18 -0
  118. package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.js +17 -0
  119. package/dist/node_modules/.pnpm/tailwind-merge@3.4.0/node_modules/tailwind-merge/dist/bundle-mjs.cjs +1894 -0
  120. package/dist/node_modules/.pnpm/tailwind-merge@3.4.0/node_modules/tailwind-merge/dist/bundle-mjs.js +1893 -0
  121. package/dist/packages/shadcn/src/lib/utils.cjs +10 -1
  122. package/dist/packages/shadcn/src/lib/utils.js +10 -1
  123. package/dist/pagination/Pagination.cjs +156 -1
  124. package/dist/pagination/Pagination.js +151 -1
  125. package/dist/pagination/index.cjs +1 -1
  126. package/dist/pagination/index.js +1 -1
  127. package/dist/rich-text-editor/RichTextEditor.cjs +132 -1
  128. package/dist/rich-text-editor/RichTextEditor.js +126 -1
  129. package/dist/rich-text-editor/index.cjs +1 -1
  130. package/dist/rich-text-editor/index.js +1 -1
  131. package/dist/rich-text-editor/predefined-toolbar-options.cjs +84 -1
  132. package/dist/rich-text-editor/predefined-toolbar-options.js +81 -1
  133. package/dist/spinner/index.cjs +1 -1
  134. package/dist/spinner/index.js +1 -1
  135. package/dist/spinner/spinner.cjs +73 -6
  136. package/dist/spinner/spinner.js +70 -6
  137. package/dist/spinner/styles.cjs +24 -12
  138. package/dist/spinner/styles.js +23 -12
  139. package/dist/tags-input.cjs +226 -1
  140. package/dist/tags-input.js +222 -1
  141. package/dist/theme-provider/ThemeProvider.cjs +27 -1
  142. package/dist/theme-provider/ThemeProvider.js +23 -1
  143. package/dist/theme-provider/index.cjs +4 -1
  144. package/dist/theme-provider/index.js +4 -1
  145. package/dist/toast/AlertToast.cjs +36 -1
  146. package/dist/toast/AlertToast.js +31 -1
  147. package/dist/toast/index.cjs +1 -1
  148. package/dist/toast/index.js +1 -1
  149. package/dist/toast/toast.cjs +75 -1
  150. package/dist/toast/toast.js +66 -1
  151. package/package.json +2 -2
  152. package/dist/_virtual/rolldown_runtime.js +0 -1
  153. 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
  154. 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
  155. 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
  156. 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
  157. package/dist/node_modules/.pnpm/@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.cjs +0 -1
  158. package/dist/node_modules/.pnpm/@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.js +0 -1
  159. package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.cjs +0 -1
  160. package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -1
  161. 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
  162. 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
  163. 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
  164. 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
  165. 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
  166. 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
  167. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.cjs +0 -1
  168. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.cjs +0 -1
  169. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -1
  170. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -1
  171. package/dist/node_modules/.pnpm/tabbable@6.3.0/node_modules/tabbable/dist/index.cjs +0 -1
  172. package/dist/node_modules/.pnpm/tabbable@6.3.0/node_modules/tabbable/dist/index.esm.js +0 -1
  173. package/dist/packages/shadcn/src/components/index.cjs +0 -1
  174. package/dist/packages/shadcn/src/components/index.js +0 -1
  175. package/dist/packages/shadcn/src/components/ui/OrContinueWithSeparator.cjs +0 -1
  176. package/dist/packages/shadcn/src/components/ui/OrContinueWithSeparator.js +0 -1
  177. package/dist/packages/shadcn/src/components/ui/alert-dialog.cjs +0 -1
  178. package/dist/packages/shadcn/src/components/ui/alert-dialog.js +0 -1
  179. package/dist/packages/shadcn/src/components/ui/alert.cjs +0 -1
  180. package/dist/packages/shadcn/src/components/ui/alert.js +0 -1
  181. package/dist/packages/shadcn/src/components/ui/avatar.cjs +0 -1
  182. package/dist/packages/shadcn/src/components/ui/avatar.js +0 -1
  183. package/dist/packages/shadcn/src/components/ui/badge.cjs +0 -1
  184. package/dist/packages/shadcn/src/components/ui/badge.js +0 -1
  185. package/dist/packages/shadcn/src/components/ui/button.cjs +0 -1
  186. package/dist/packages/shadcn/src/components/ui/button.js +0 -1
  187. package/dist/packages/shadcn/src/components/ui/calendar.cjs +0 -1
  188. package/dist/packages/shadcn/src/components/ui/calendar.js +0 -1
  189. package/dist/packages/shadcn/src/components/ui/card.cjs +0 -1
  190. package/dist/packages/shadcn/src/components/ui/card.js +0 -1
  191. package/dist/packages/shadcn/src/components/ui/checkbox.cjs +0 -1
  192. package/dist/packages/shadcn/src/components/ui/checkbox.js +0 -1
  193. package/dist/packages/shadcn/src/components/ui/command.cjs +0 -1
  194. package/dist/packages/shadcn/src/components/ui/command.js +0 -1
  195. package/dist/packages/shadcn/src/components/ui/dialog.cjs +0 -1
  196. package/dist/packages/shadcn/src/components/ui/dialog.js +0 -1
  197. package/dist/packages/shadcn/src/components/ui/dropdown-menu.cjs +0 -1
  198. package/dist/packages/shadcn/src/components/ui/dropdown-menu.js +0 -1
  199. package/dist/packages/shadcn/src/components/ui/file-upload.cjs +0 -1
  200. package/dist/packages/shadcn/src/components/ui/file-upload.js +0 -1
  201. package/dist/packages/shadcn/src/components/ui/form.cjs +0 -1
  202. package/dist/packages/shadcn/src/components/ui/form.js +0 -1
  203. package/dist/packages/shadcn/src/components/ui/index.cjs +0 -1
  204. package/dist/packages/shadcn/src/components/ui/index.js +0 -1
  205. package/dist/packages/shadcn/src/components/ui/input.cjs +0 -1
  206. package/dist/packages/shadcn/src/components/ui/input.js +0 -1
  207. package/dist/packages/shadcn/src/components/ui/label.cjs +0 -1
  208. package/dist/packages/shadcn/src/components/ui/label.js +0 -1
  209. package/dist/packages/shadcn/src/components/ui/pagination.cjs +0 -1
  210. package/dist/packages/shadcn/src/components/ui/pagination.js +0 -1
  211. package/dist/packages/shadcn/src/components/ui/popover.cjs +0 -1
  212. package/dist/packages/shadcn/src/components/ui/popover.js +0 -1
  213. package/dist/packages/shadcn/src/components/ui/radio-group.cjs +0 -1
  214. package/dist/packages/shadcn/src/components/ui/radio-group.js +0 -1
  215. package/dist/packages/shadcn/src/components/ui/select.cjs +0 -1
  216. package/dist/packages/shadcn/src/components/ui/select.js +0 -1
  217. package/dist/packages/shadcn/src/components/ui/separator.cjs +0 -1
  218. package/dist/packages/shadcn/src/components/ui/separator.js +0 -1
  219. package/dist/packages/shadcn/src/components/ui/shadcn-io/tags/index.cjs +0 -1
  220. package/dist/packages/shadcn/src/components/ui/shadcn-io/tags/index.js +0 -1
  221. package/dist/packages/shadcn/src/components/ui/shadcn-io/tags-input-inline/index.cjs +0 -1
  222. package/dist/packages/shadcn/src/components/ui/shadcn-io/tags-input-inline/index.js +0 -1
  223. package/dist/packages/shadcn/src/components/ui/sheet.cjs +0 -1
  224. package/dist/packages/shadcn/src/components/ui/sheet.js +0 -1
  225. package/dist/packages/shadcn/src/components/ui/slider.cjs +0 -1
  226. package/dist/packages/shadcn/src/components/ui/slider.js +0 -1
  227. package/dist/packages/shadcn/src/components/ui/switch.cjs +0 -1
  228. package/dist/packages/shadcn/src/components/ui/switch.js +0 -1
  229. package/dist/packages/shadcn/src/components/ui/tabs.cjs +0 -1
  230. package/dist/packages/shadcn/src/components/ui/tabs.js +0 -1
  231. package/dist/packages/shadcn/src/components/ui/textarea.cjs +0 -1
  232. package/dist/packages/shadcn/src/components/ui/textarea.js +0 -1
  233. package/dist/packages/shadcn/src/components/ui/tooltip.cjs +0 -1
  234. package/dist/packages/shadcn/src/components/ui/tooltip.js +0 -1
  235. package/dist/packages/shadcn/src/lib/index.cjs +0 -1
  236. package/dist/packages/shadcn/src/lib/index.js +0 -1
@@ -1 +1,46 @@
1
- const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../packages/shadcn/src/components/ui/dialog.cjs`);let n=require(`@pixpilot/shadcn`);n=e.__toESM(n);let r=require(`react/jsx-runtime`);r=e.__toESM(r);let i=require(`@ebay/nice-modal-react`);i=e.__toESM(i);const a=i.default.create(e=>{let{title:a=`Confirmation Dialog`}=e,o=(0,i.useModal)(),s=()=>{e.onConfirm?.(),o.resolve(!0),o.hide()},c=()=>{e.onCancel?.(),o.resolve(!1),o.hide()};return(0,r.jsx)(t.Dialog,{open:o.visible,onOpenChange:e=>{e||c()},children:(0,r.jsxs)(t.DialogContent,{children:[(0,r.jsxs)(t.DialogHeader,{children:[(0,r.jsx)(t.DialogTitle,{children:a}),e.description!=null&&(0,r.jsx)(t.DialogDescription,{children:e.description})]}),(0,r.jsxs)(t.DialogFooter,{children:[(0,r.jsx)(t.DialogClose,{asChild:!0,children:(0,r.jsx)(n.Button,{variant:`outline`,onClick:c,children:e.cancelText??`Cancel`})}),(0,r.jsx)(n.Button,{onClick:s,children:e.confirmText??`Confirm`})]})]})})});a.displayName=`ConfirmationDialog`;var o=a;exports.default=o;
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,4 +1,5 @@
1
1
  import "react";
2
+ import "@ebay/nice-modal-react";
2
3
 
3
4
  //#region src/confirmation-dialog/ConfirmationDialog.d.ts
4
5
  interface ConfirmationDialogProps {
@@ -1 +1,42 @@
1
- import{Dialog as e,DialogClose as t,DialogContent as n,DialogDescription as r,DialogFooter as i,DialogHeader as a,DialogTitle as o}from"../packages/shadcn/src/components/ui/dialog.js";import{Button as s}from"@pixpilot/shadcn";import{jsx as c,jsxs as l}from"react/jsx-runtime";import u,{useModal as d}from"@ebay/nice-modal-react";const f=u.create(u=>{let{title:f=`Confirmation Dialog`}=u,p=d(),m=()=>{u.onConfirm?.(),p.resolve(!0),p.hide()},h=()=>{u.onCancel?.(),p.resolve(!1),p.hide()};return c(e,{open:p.visible,onOpenChange:e=>{e||h()},children:l(n,{children:[l(a,{children:[c(o,{children:f}),u.description!=null&&c(r,{children:u.description})]}),l(i,{children:[c(t,{asChild:!0,children:c(s,{variant:`outline`,onClick:h,children:u.cancelText??`Cancel`})}),c(s,{onClick:m,children:u.confirmText??`Confirm`})]})]})})});f.displayName=`ConfirmationDialog`;var p=f;export{p as default};
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 e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`react`);t=e.__toESM(t);let n=require(`react/jsx-runtime`);n=e.__toESM(n);let r=require(`@ebay/nice-modal-react`);r=e.__toESM(r);const i=e=>(0,n.jsx)(r.default.Provider,{children:e.children});i.displayName=`DialogProvider`,exports.DialogProvider=i;
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 e from"react";import{jsx as t}from"react/jsx-runtime";import n from"@ebay/nice-modal-react";const r=e=>t(n.Provider,{children:e.children});r.displayName=`DialogProvider`;export{r as DialogProvider};
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 e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`./ConfirmationDialog.cjs`);let n=require(`@ebay/nice-modal-react`);n=e.__toESM(n);async function r(e){let r=crypto.randomUUID();return n.default.register(r,t.default),n.default.show(r,e)}exports.showConfirmDialog=r;
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 e from"./ConfirmationDialog.js";import t from"@ebay/nice-modal-react";async function n(n){let r=crypto.randomUUID();return t.register(r,e),t.show(r,n)}export{n as showConfirmDialog};
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
- "use client";const e=require(`../_virtual/rolldown_runtime.cjs`);require(`./ConfirmationDialog.cjs`);const t=require(`./confirmation-dialogs.cjs`),n=require(`./DialogProvider.cjs`);
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
- "use client";import"./ConfirmationDialog.js";import{showConfirmDialog as e}from"./confirmation-dialogs.js";import{DialogProvider as t}from"./DialogProvider.js";
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
- "use client";const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`./FileUploadItems.cjs`),n=require(`./hooks/use-file-upload-store.cjs`);let r=require(`@pixpilot/shadcn`);r=e.__toESM(r);let i=require(`lucide-react`);i=e.__toESM(i);let a=require(`react`);a=e.__toESM(a);let o=require(`react/jsx-runtime`);o=e.__toESM(o);function s(e){let{value:s,onChange:c,className:l,multiple:u=!0,onAccept:d,maxFiles:f,preventDuplicates:p,...m}=e,{handleAccept:h,displayFiles:g,deleteFile:_,getFile:v,orgValue:y}=n.useFileUploadStore({value:s,onChange:c,multiple:u,preventDuplicates:p}),b=a.useCallback(e=>{d?.(e),h(e)},[h,d]),x=(0,r.cn)(`p-1.5`);return(0,o.jsx)(r.FileUpload,{...m,value:y,onAccept:b,multiple:u,className:(0,r.cn)(`w-full`,l),children:(0,o.jsx)(r.FileUploadDropzone,{className:x,children:g.length===0?(0,o.jsxs)(`div`,{className:`flex flex-col items-center gap-1 text-center p-2`,children:[(0,o.jsx)(`div`,{className:`flex items-center justify-center rounded-full border p-2.5`,children:(0,o.jsx)(i.Upload,{className:`size-6 text-muted-foreground`})}),(0,o.jsx)(`p`,{className:`font-medium text-sm`,children:`Drag & drop files here`}),(0,o.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Or click to browse (max 10 files, up to 5MB each)`})]}):(0,o.jsx)(t.FileUploadItems,{displayFiles:g,deleteFile:_,getFile:v,maxFiles:f,itemSize:`size-22`,className:x})})})}exports.FileUpload=s;
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 react_jsx_runtime6 from "react/jsx-runtime";
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): react_jsx_runtime6.JSX.Element;
5
+ declare function FileUpload(props: FileUploadProps): react_jsx_runtime7.JSX.Element;
6
6
  //#endregion
7
7
  export { FileUpload };
@@ -1 +1,63 @@
1
- "use client";import{FileUploadItems as e}from"./FileUploadItems.js";import{useFileUploadStore as t}from"./hooks/use-file-upload-store.js";import{FileUpload as n,FileUploadDropzone as r,cn as i}from"@pixpilot/shadcn";import{Upload as a}from"lucide-react";import*as o from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";function l(l){let{value:u,onChange:d,className:f,multiple:p=!0,onAccept:m,maxFiles:h,preventDuplicates:g,..._}=l,{handleAccept:v,displayFiles:y,deleteFile:b,getFile:x,orgValue:S}=t({value:u,onChange:d,multiple:p,preventDuplicates:g}),C=o.useCallback(e=>{m?.(e),v(e)},[v,m]),w=i(`p-1.5`);return s(n,{..._,value:S,onAccept:C,multiple:p,className:i(`w-full`,f),children:s(r,{className:w,children:y.length===0?c(`div`,{className:`flex flex-col items-center gap-1 text-center p-2`,children:[s(`div`,{className:`flex items-center justify-center rounded-full border p-2.5`,children:s(a,{className:`size-6 text-muted-foreground`})}),s(`p`,{className:`font-medium text-sm`,children:`Drag & drop files here`}),s(`p`,{className:`text-muted-foreground text-xs`,children:`Or click to browse (max 10 files, up to 5MB each)`})]}):s(e,{displayFiles:y,deleteFile:b,getFile:x,maxFiles:h,itemSize:`size-22`,className:w})})})}export{l as FileUpload};
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
- "use client";const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`./FileUploadListItem.cjs`);let n=require(`@pixpilot/shadcn`);n=e.__toESM(n);let r=require(`lucide-react`);r=e.__toESM(r);let i=require(`react/jsx-runtime`);i=e.__toESM(i);function a({displayFiles:e,deleteFile:a,getFile:o,maxFiles:s,itemSize:c,className:l}){return(0,i.jsxs)(n.FileUploadList,{orientation:`horizontal`,forceMount:!0,className:(0,n.cn)(`flex-wrap gap-4 w-full `,l),children:[e.map(e=>{let{name:n,lastModified:r}=e,s=`${n}-${r}`;return(0,i.jsx)(t.FileUploadListItem,{fileMeta:e,deleteFile:a,getFile:o,itemSize:c},s)}),s===void 0||e.length<s?(0,i.jsx)(`div`,{className:(0,n.cn)(c,`flex items-center justify-center border-2 border-dashed rounded-md`),children:(0,i.jsx)(r.Plus,{className:`size-6 text-muted-foreground`})}):null]})}exports.FileUploadItems=a;
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
- "use client";import{FileUploadListItem as e}from"./FileUploadListItem.js";import{FileUploadList as t,cn as n}from"@pixpilot/shadcn";import{Plus as r}from"lucide-react";import{jsx as i,jsxs as a}from"react/jsx-runtime";function o({displayFiles:o,deleteFile:s,getFile:c,maxFiles:l,itemSize:u,className:d}){return a(t,{orientation:`horizontal`,forceMount:!0,className:n(`flex-wrap gap-4 w-full `,d),children:[o.map(t=>{let{name:n,lastModified:r}=t,a=`${n}-${r}`;return i(e,{fileMeta:t,deleteFile:s,getFile:c,itemSize:u},a)}),l===void 0||o.length<l?i(`div`,{className:n(u,`flex items-center justify-center border-2 border-dashed rounded-md`),children:i(r,{className:`size-6 text-muted-foreground`})}):null]})}export{o as FileUploadItems};
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
- "use client";const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../packages/shadcn/src/components/ui/button.cjs`);let n=require(`@pixpilot/shadcn`);n=e.__toESM(n);let r=require(`lucide-react`);r=e.__toESM(r);let i=require(`react`);i=e.__toESM(i);let a=require(`pretty-bytes`);a=e.__toESM(a);let o=require(`react/jsx-runtime`);o=e.__toESM(o);const s=({className:e,children:t})=>(0,o.jsx)(`div`,{className:(0,n.cn)(`bg-black/70 inset-0 absolute`,e),children:t}),c=i.default.memo(({fileMeta:e,deleteFile:i,getFile:c,itemSize:l})=>{let u=c(e),d=(0,n.useFileUpload)(e=>e.files.get(u)),f=d?.error!=null,p=typeof e.url==`string`?e.url:``,m=d?.status!==`idle`&&d?.progress!==100&&!f;return(0,o.jsxs)(n.FileUploadItem,{value:u,className:(0,n.cn)(`p-0`),children:[(0,o.jsxs)(n.Tooltip,{children:[(0,o.jsx)(n.TooltipTrigger,{asChild:!0,children:(0,o.jsx)(n.FileUploadItemPreview,{className:(0,n.cn)(l,`relative`),render:(t,n)=>p.length>0&&e.type.startsWith(`image/`)?(0,o.jsx)(`div`,{className:`relative size-full`,children:(0,o.jsx)(`img`,{src:p,alt:e.name,className:`size-full object-cover`})}):n(),children:f?(0,o.jsx)(s,{className:`flex items-center justify-center`,children:(0,o.jsx)(r.AlertTriangle,{className:`text-destructive size-9`})}):m&&(0,o.jsx)(s,{children:(0,o.jsx)(n.FileUploadItemProgress,{variant:`circular`,strokeWidth:4})})})}),(0,o.jsxs)(n.TooltipContent,{children:[(0,o.jsxs)(`p`,{children:[e.name,(0,o.jsx)(`br`,{}),`Size: `,(0,a.default)(e.size)]}),f&&(0,o.jsxs)(`div`,{className:`text-destructive flex items-center gap-2 mt-2`,children:[(0,o.jsx)(r.AlertTriangle,{className:`text-destructive size-4`}),(0,o.jsx)(`p`,{className:`font-bold`,children:d?.error})]})]})]}),(0,o.jsx)(n.FileUploadItemMetadata,{className:`sr-only`}),(0,o.jsx)(t.Button,{type:`button`,variant:`secondary`,size:`icon`,className:`-top-1 -right-1 absolute size-5 rounded-full`,onClick:t=>{t.preventDefault(),t.stopPropagation(),i(e)},children:(0,o.jsx)(r.X,{className:`size-3`})})]})});c.displayName=`FileUploadListItem`,exports.FileUploadListItem=c;
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
- "use client";import{Button as e}from"../packages/shadcn/src/components/ui/button.js";import{FileUploadItem as t,FileUploadItemMetadata as n,FileUploadItemPreview as r,FileUploadItemProgress as i,Tooltip as a,TooltipContent as o,TooltipTrigger as s,cn as c,useFileUpload as l}from"@pixpilot/shadcn";import{AlertTriangle as u,X as d}from"lucide-react";import f from"react";import p from"pretty-bytes";import{jsx as m,jsxs as h}from"react/jsx-runtime";const g=({className:e,children:t})=>m(`div`,{className:c(`bg-black/70 inset-0 absolute`,e),children:t}),_=f.memo(({fileMeta:f,deleteFile:_,getFile:v,itemSize:y})=>{let b=v(f),x=l(e=>e.files.get(b)),S=x?.error!=null,C=typeof f.url==`string`?f.url:``,w=x?.status!==`idle`&&x?.progress!==100&&!S;return h(t,{value:b,className:c(`p-0`),children:[h(a,{children:[m(s,{asChild:!0,children:m(r,{className:c(y,`relative`),render:(e,t)=>C.length>0&&f.type.startsWith(`image/`)?m(`div`,{className:`relative size-full`,children:m(`img`,{src:C,alt:f.name,className:`size-full object-cover`})}):t(),children:S?m(g,{className:`flex items-center justify-center`,children:m(u,{className:`text-destructive size-9`})}):w&&m(g,{children:m(i,{variant:`circular`,strokeWidth:4})})})}),h(o,{children:[h(`p`,{children:[f.name,m(`br`,{}),`Size: `,p(f.size)]}),S&&h(`div`,{className:`text-destructive flex items-center gap-2 mt-2`,children:[m(u,{className:`text-destructive size-4`}),m(`p`,{className:`font-bold`,children:x?.error})]})]})]}),m(n,{className:`sr-only`}),m(e,{type:`button`,variant:`secondary`,size:`icon`,className:`-top-1 -right-1 absolute size-5 rounded-full`,onClick:e=>{e.preventDefault(),e.stopPropagation(),_(f)},children:m(d,{className:`size-3`})})]})});_.displayName=`FileUploadListItem`;export{_ as FileUploadListItem};
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 e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`./use-file-upload-store.cjs`),n=require(`./use-file-error.cjs`),r=require(`./use-file-upload-progress-callbacks.cjs`);
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');
@@ -0,0 +1,2 @@
1
+ import "./use-file-upload-progress-callbacks.cjs";
2
+ import "./use-file-upload-store.cjs";
@@ -1 +1,3 @@
1
- import{useFileUploadStore as e}from"./use-file-upload-store.js";import{useFileError as t}from"./use-file-error.js";import{useFileUploadProgressCallbacks as n}from"./use-file-upload-progress-callbacks.js";
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 e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`../../packages/shadcn/src/components/ui/file-upload.cjs`);require(`../../packages/shadcn/src/components/index.cjs`);function n(e){return t.useStore(t=>{let n=t.files.get(e);return n?.error==null?null:n.error})}exports.useFileError=n;
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{useStore as e}from"../../packages/shadcn/src/components/ui/file-upload.js";import"../../packages/shadcn/src/components/index.js";function t(t){return e(e=>{let n=e.files.get(t);return n?.error==null?null:n.error})}export{t as useFileError};
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 };