@appcorp/stellar-solutions-modules 0.1.48 → 0.1.50

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.
@@ -15,6 +15,8 @@ export type EnhancedDropzoneProps = {
15
15
  initial?: Array<File | string>;
16
16
  /** Called when selected File[] changes */
17
17
  onChange?: (files: File[]) => void;
18
+ /** Called when the rendered previews (string[]) change */
19
+ onPreviewsChange?: (previews: string[]) => void;
18
20
  /** Called when a provided remote URL preview is removed (if provided) */
19
21
  onRemoveUrl?: (url: string) => void;
20
22
  };
@@ -63,7 +63,7 @@ var button_1 = require("./button");
63
63
  var lucide_react_1 = require("lucide-react");
64
64
  var dropzone_1 = require("./shadcn-io/dropzone");
65
65
  var EnhancedDropzone = function (_a) {
66
- var id = _a.id, label = _a.label, info = _a.info, error = _a.error, accept = _a.accept, _b = _a.maxFiles, maxFiles = _b === void 0 ? 10 : _b, maxSize = _a.maxSize, minSize = _a.minSize, disabled = _a.disabled, _c = _a.initial, initial = _c === void 0 ? [] : _c, onChange = _a.onChange, onRemoveUrl = _a.onRemoveUrl, className = _a.className;
66
+ var id = _a.id, label = _a.label, info = _a.info, error = _a.error, accept = _a.accept, _b = _a.maxFiles, maxFiles = _b === void 0 ? 10 : _b, maxSize = _a.maxSize, minSize = _a.minSize, disabled = _a.disabled, _c = _a.initial, initial = _c === void 0 ? [] : _c, onChange = _a.onChange, onPreviewsChange = _a.onPreviewsChange, onRemoveUrl = _a.onRemoveUrl, className = _a.className;
67
67
  // Files selected locally (File objects)
68
68
  var _d = (0, react_1.useState)([]), files = _d[0], setFiles = _d[1];
69
69
  // Previews array contains strings (object URLs or provided URLs) in display order
@@ -139,6 +139,8 @@ var EnhancedDropzone = function (_a) {
139
139
  });
140
140
  setPreviews(next);
141
141
  setRemotePreviews(remoteMap);
142
+ // notify parent about the current rendered previews (object URLs and remote URLs)
143
+ onPreviewsChange === null || onPreviewsChange === void 0 ? void 0 : onPreviewsChange(next);
142
144
  return function () {
143
145
  (createdUrlsRef.current || []).forEach(function (u) {
144
146
  try {
@@ -149,7 +151,7 @@ var EnhancedDropzone = function (_a) {
149
151
  createdUrlsRef.current = [];
150
152
  };
151
153
  // files and initial are the dependencies
152
- }, [files, initial]);
154
+ }, [files, initial, onPreviewsChange]);
153
155
  // Remove a local file by index (index relative to files slice after initial length)
154
156
  var handleRemoveLocal = function (index) {
155
157
  var next = files.filter(function (_, i) { return i !== index; });
@@ -31,8 +31,8 @@ var lucide_react_1 = require("lucide-react");
31
31
  var react_1 = __importDefault(require("react"));
32
32
  var react_2 = require("react");
33
33
  var react_dropzone_1 = require("react-dropzone");
34
- var button_1 = require("@/components/ui/button");
35
- var utils_1 = require("@/lib/utils");
34
+ var button_1 = require("../../button");
35
+ var utils_1 = require("../../../../lib/utils");
36
36
  var renderBytes = function (bytes) {
37
37
  var units = ["B", "KB", "MB", "GB", "TB", "PB"];
38
38
  var size = bytes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/stellar-solutions-modules",
3
- "version": "0.1.48",
3
+ "version": "0.1.50",
4
4
  "scripts": {
5
5
  "automate": "./automate.sh",
6
6
  "build": "yarn clean && yarn build:ts && cp package.json lib && cp README.md lib && cp yarn.lock lib",