@beautinique/frontend-components 1.0.5 → 1.0.6

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.
@@ -1,3 +1,4 @@
1
+ import type { IToaster } from './toaster.js';
1
2
  import type { IUploadGroup, IUploadItem, IUploadItemHandle, TUploadProgressHandler } from './types.js';
2
3
  export declare const isUploadItemSettled: ({ status }: Pick<IUploadItem, "status">) => boolean;
3
4
  /**
@@ -21,7 +22,7 @@ export interface IUploadsSummary {
21
22
  export declare const getUploadsSummary: (items: IUploadItem[]) => IUploadsSummary;
22
23
  /** The files of a FormData, in the order they are sent. */
23
24
  export declare const getFormDataFiles: (data: FormData, key?: string) => File[];
24
- interface IUploadGroupOptions {
25
+ export interface IUploadGroupOptions {
25
26
  title: string;
26
27
  description?: string;
27
28
  items: {
@@ -30,34 +31,24 @@ interface IUploadGroupOptions {
30
31
  files: File[];
31
32
  }[];
32
33
  }
33
- /**
34
- * Opens one toast for the uploads of `items`. It closes by itself a moment after every upload is
35
- * over. Returns nothing when there is nothing to upload, so no empty toast is shown.
36
- */
37
- export declare const createUploadsToast: ({ title, description, items, }: IUploadGroupOptions) => IUploadGroup | undefined;
38
- /** The toast for a single request that uploads several files at once. */
39
- export declare const withUploadsToast: <T>({ title, description, files, request, }: {
40
- title: string;
41
- description?: string;
42
- files: File[];
43
- request: (onProgress: TUploadProgressHandler) => Promise<T>;
44
- }) => Promise<T>;
45
- /**
46
- * Runs the uploads of several fields (e.g. the images of each editor of a form step) behind one
47
- * toast with a row for every field that has files. `run` is called for every field, with the row of
48
- * that field to give to its upload (nothing when the toast has no row for it). Every upload is
49
- * waited for, so none is shown as failed just because another one failed; if any failed, the first
50
- * error is thrown once all are over.
51
- */
52
- export declare const runUploadsInToast: <TId extends string, TResult>({ title, description, uploads, run, }: {
53
- title: string;
54
- description?: string;
55
- uploads: {
56
- id: TId;
57
- label: string;
34
+ /** The helpers that show the toast of uploads, for the `toaster` (so the store) they are given. */
35
+ export declare const createUploadsHelpers: (toaster: IToaster) => {
36
+ createUploadsToast: ({ title, description, items, }: IUploadGroupOptions) => IUploadGroup | undefined;
37
+ withUploadsToast: <T>({ title, description, files, request, }: {
38
+ title: string;
39
+ description?: string;
58
40
  files: File[];
59
- }[];
60
- run: (id: TId, progress: IUploadItemHandle | undefined) => Promise<TResult>;
61
- }) => Promise<Record<TId, TResult>>;
62
- export {};
41
+ request: (onProgress: TUploadProgressHandler) => Promise<T>;
42
+ }) => Promise<T>;
43
+ runUploadsInToast: <TId extends string, TResult>({ title, description, uploads, run, }: {
44
+ title: string;
45
+ description?: string;
46
+ uploads: {
47
+ id: TId;
48
+ label: string;
49
+ files: File[];
50
+ }[];
51
+ run: (id: TId, progress: IUploadItemHandle | undefined) => Promise<TResult>;
52
+ }) => Promise<Record<TId, TResult>>;
53
+ };
63
54
  //# sourceMappingURL=uploads.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["../../src/toast/uploads.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EACX,iBAAiB,EAEjB,sBAAsB,EACvB,MAAM,YAAY,CAAC;AAMpB,eAAO,MAAM,mBAAmB,GAAI,YAAY,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,YAC/B,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GAAI,gCAIpC,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,QAAQ,GAAG,WAAW,CAAC,WAgBtD,CAAC;AAEF,0FAA0F;AAC1F,eAAO,MAAM,oBAAoB,GAAI,4BAIlC,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC,WAKlD,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,qFAAqF;IACrF,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,+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QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,IAAI,EAAE,CAAA;KAAE,EAAE,CAAC;CACvD;AAED,mGAAmG;AACnG,eAAO,MAAM,oBAAoB,GAAI,SAAS,QAAQ;yDASjD,mBAAmB,KAAG,YAAY,GAAG,SAAS;uBAsDjB,CAAC,2CAK9B;QACD,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,IAAI,EAAE,CAAC;QACd,OAAO,EAAE,CAAC,UAAU,EAAE,sBAAsB,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;KAC7D,KAAG,OAAO,CAAC,CAAC,CAAC;wBAuBmB,GAAG,SAAS,MAAM,EAAE,OAAO,yCAKzD;QACD,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,OAAO,EAAE;YAAE,EAAE,EAAE,GAAG,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,IAAI,EAAE,CAAA;SAAE,EAAE,CAAC;QACrD,GAAG,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,iBAAiB,GAAG,SAAS,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;KAC7E,KAAG,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;CA6BlC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beautinique/frontend-components",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Shared React UI components for the Beautinique frontends.",
5
5
  "keywords": [
6
6
  "frontend",
@@ -72,16 +72,14 @@
72
72
  "node": ">=24"
73
73
  },
74
74
  "peerDependencies": {
75
+ "@beautinique/frontend-stores": "^1.0.0",
75
76
  "@beautinique/frontend-styles": "^1.1.0",
76
77
  "@iconify/react": "^6.0.2",
77
78
  "react": "^19.0.0",
78
79
  "react-dom": "^19.0.0"
79
80
  },
80
- "dependencies": {
81
- "nanoid": "^6.0.1",
82
- "zustand": "^5.0.15"
83
- },
84
81
  "devDependencies": {
82
+ "@beautinique/frontend-stores": "^1.0.0",
85
83
  "@beautinique/frontend-styles": "^1.1.0",
86
84
  "@iconify/react": "^6.0.2",
87
85
  "@tailwindcss/typography": "^0.5.20",
@@ -1,4 +0,0 @@
1
- import type { IToastStore } from './types.js';
2
- declare const useToastStore: import("zustand").UseBoundStore<import("zustand").StoreApi<IToastStore>>;
3
- export { useToastStore };
4
- //# sourceMappingURL=toast.store.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"toast.store.d.cts","sourceRoot":"","sources":["../../src/toast/toast.store.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,QAAA,MAAM,aAAa,0EAqChB,CAAC;AAEJ,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -1,4 +0,0 @@
1
- import type { IToastStore } from './types.js';
2
- declare const useToastStore: import("zustand").UseBoundStore<import("zustand").StoreApi<IToastStore>>;
3
- export { useToastStore };
4
- //# sourceMappingURL=toast.store.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"toast.store.d.ts","sourceRoot":"","sources":["../../src/toast/toast.store.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,QAAA,MAAM,aAAa,0EAqChB,CAAC;AAEJ,OAAO,EAAE,aAAa,EAAE,CAAC"}