@photoroom/ui 0.1.566 → 0.1.567

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,14 +1,22 @@
1
1
  import React, { ComponentPropsWithoutRef } from "react";
2
2
  export type NotificationProps = {
3
3
  label: React.ReactNode;
4
+ description?: React.ReactNode;
4
5
  action?: React.ReactNode;
5
6
  preview?: React.ReactNode;
6
7
  className?: string;
7
- type?: "success" | "danger" | "info" | "warning" | "loading";
8
+ type?: "success" | "danger" | "info" | "warning" | "loading" | "progress";
9
+ /** 0–100 for a determinate `progress` toast. Pair it with a `description` that states the
10
+ * progress ("6/9 images"); the percentage is only rendered when no description is given. */
11
+ progress?: number;
8
12
  isStacked?: boolean;
13
+ /** `false` hides the close button; the store then also blocks swipe and auto-dismiss unless an
14
+ * explicit `duration` is given. It is kept across `update()`, so pass `dismissible: true` when a
15
+ * result should become dismissible again. */
16
+ dismissible?: boolean;
9
17
  closeLabel: string;
10
18
  onClose?: () => void;
11
19
  };
12
20
  export declare const NotificationImage: (props: ComponentPropsWithoutRef<"img">) => React.JSX.Element;
13
- export declare const Notification: ({ type, preview, label, action, className, isStacked, closeLabel, onClose, }: NotificationProps) => React.JSX.Element;
21
+ export declare const Notification: ({ type, preview, label, description, action, className, progress, isStacked, dismissible, closeLabel, onClose, }: NotificationProps) => React.JSX.Element;
14
22
  //# sourceMappingURL=Notification.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Notification.d.ts","sourceRoot":"","sources":["../../../../src/components/status/Notification/Notification.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,EAAE,wBAAwB,EAAW,MAAM,OAAO,CAAC;AAmBjE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SA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iBAAiB,sBAiFnB,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import { Toaster } from "sonner";
2
- export declare const NotificationStack: ({ duration, position, className, ...props }: React.ComponentProps<typeof Toaster>) => import("react").JSX.Element;
2
+ export declare const NotificationStack: ({ duration, position, visibleToasts, className, ...props }: React.ComponentProps<typeof Toaster>) => import("react").JSX.Element;
3
3
  //# sourceMappingURL=NotificationStack.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationStack.d.ts","sourceRoot":"","sources":["../../../../src/components/status/Notification/NotificationStack.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAIjC,eAAO,MAAM,iBAAiB,GAAI,6CAK/B,KAAK,CAAC,cAAc,CAAC,OAAO,OAAO,CAAC,gCAOtC,CAAC"}
1
+ {"version":3,"file":"NotificationStack.d.ts","sourceRoot":"","sources":["../../../../src/components/status/Notification/NotificationStack.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAIjC,eAAO,MAAM,iBAAiB,GAAI,4DAM/B,KAAK,CAAC,cAAc,CAAC,OAAO,OAAO,CAAC,gCAQtC,CAAC"}
@@ -1,6 +1,8 @@
1
- import { ExternalToast } from "sonner";
1
+ import { ExternalToast, ToastT } from "sonner";
2
2
  import { Notification, NotificationProps } from "./Notification";
3
- type AddNotificationProps = Omit<NotificationProps, "closeLabel">;
3
+ export type AddNotificationProps = Omit<NotificationProps, "closeLabel"> & {
4
+ duration?: number;
5
+ };
4
6
  /**
5
7
  * `closeLabel` may be a thunk, resolved once per notification rather than when the store is built.
6
8
  * Consumers that construct this store during app startup can otherwise capture a translation before
@@ -14,7 +16,9 @@ export type NotificationStoreDependencies = {
14
16
  };
15
17
  type Notification = {
16
18
  id: number | string;
17
- update: (partialProps: AddNotificationProps) => void;
19
+ /** Merges into the previous props rather than replacing them, so a progress tick keeps the title
20
+ * and a result keeps the action, preview and `dismissible`. Pass a field as `undefined` to clear it. */
21
+ update: (partialProps: Partial<AddNotificationProps>) => void;
18
22
  dismiss: () => void;
19
23
  };
20
24
  export declare class NotificationsStore {
@@ -23,6 +27,7 @@ export declare class NotificationsStore {
23
27
  addNotification: (partialProps: AddNotificationProps) => Notification;
24
28
  addCustomNotification: (jsx: (id: number | string) => React.ReactElement, data?: ExternalToast) => string | number;
25
29
  dismissNotification: (id?: number | string) => string | number;
30
+ getNotifications: () => ToastT[];
26
31
  confirm: (options: {
27
32
  label: string;
28
33
  confirmLabel: string;
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationsStore.d.ts","sourceRoot":"","sources":["../../../../src/components/status/Notification/NotificationsStore.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAS,MAAM,QAAQ,CAAC;AAK9C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEjE,KAAK,oBAAoB,GAAG,IAAI,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;AAElE;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,YAAY,CAAC,GAAG;IACtF,UAAU,EAAE,iBAAiB,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAC;CACvF,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,wBAAwB,EAAE,wBAAwB,CAAC;CACpD,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,MAAM,EAAE,CAAC,YAAY,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACrD,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,qBAAa,kBAAkB;;gBAGjB,YAAY,EAAE,6BAA6B;IAIvD,eAAe,GAAI,cAAc,oBAAoB,KAAG,YAAY,CAUlE;IACF,qBAAqB,8FAAgB;IACrC,mBAAmB,4CAAiB;IA4BpC,OAAO,GAAI,SAAS;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;QACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,KAAG,OAAO,CAAC,OAAO,CAAC,CA4BlB;CACH"}
1
+ {"version":3,"file":"NotificationsStore.d.ts","sourceRoot":"","sources":["../../../../src/components/status/Notification/NotificationsStore.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAS,MAAM,QAAQ,CAAC;AAKtD,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEjE,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,iBAAiB,EAAE,YAAY,CAAC,GAAG;IACzE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,YAAY,CAAC,GAAG;IACtF,UAAU,EAAE,iBAAiB,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAC;CACvF,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,wBAAwB,EAAE,wBAAwB,CAAC;CACpD,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB;4GACwG;IACxG,MAAM,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAC;IAC9D,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAoBF,qBAAa,kBAAkB;;gBAGjB,YAAY,EAAE,6BAA6B;IAIvD,eAAe,GAAI,cAAc,oBAAoB,KAAG,YAAY,CAiBlE;IACF,qB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