@overmap-ai/blocks 0.0.1-alpha.51 → 0.0.1

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/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # overmap-ai blocks
2
-
3
- Contains basic components used by overmap-ai libraries.
1
+ # overmap-ai blocks
2
+
3
+ Contains basic components used by overmap-ai libraries.
@@ -1,6 +1,3 @@
1
1
  import { FC } from "react";
2
- import * as RadixToast from "@radix-ui/react-toast";
3
- import { ToastProps, ToastProviderProps } from "./typings.ts";
4
- export declare const ToastProvider: FC<ToastProviderProps>;
2
+ import { ToastProps } from "./typings";
5
3
  export declare const Toast: FC<ToastProps>;
6
- export declare const ToastViewport: FC<RadixToast.ToastViewportProps>;
@@ -1,4 +1,4 @@
1
- import { FC } from "react";
2
- import { IToastContext, ToastContextProviderProps } from "./typings.ts";
1
+ /// <reference types="react" />
2
+ import { IToastContext } from "./typings";
3
3
  export declare const ToastContext: import("react").Context<IToastContext>;
4
- export declare const ToastContextProvider: FC<ToastContextProviderProps>;
4
+ export declare const useToast: () => IToastContext;
@@ -0,0 +1,4 @@
1
+ import { FC } from "react";
2
+ import { ToastContextProviderProps } from "./typings";
3
+ /** Toasts will be displayed in the top-right handle corner of the screen */
4
+ export declare const ToastProvider: FC<ToastContextProviderProps>;
@@ -1,3 +1,4 @@
1
- export * from "./Toast.tsx";
2
- export * from "./ToastContext.tsx";
3
- export * from "./typings.ts";
1
+ export * from "./Toast";
2
+ export * from "./ToastContext";
3
+ export * from "./ToastProvider";
4
+ export * from "./typings";
@@ -1,45 +1,45 @@
1
1
  import { ComponentProps, ReactNode } from "react";
2
- import * as RadixToast from "@radix-ui/react-toast";
2
+ import { ToastProps as RadixToastProps, ToastProviderProps, ToastViewportProps } from "@radix-ui/react-toast";
3
3
  import { Callout } from "@radix-ui/themes";
4
4
  import { Severity } from "../typings.ts";
5
- export interface ToastProviderProps {
6
- /** a global duration that will be applied to each Toast rendered within the provider*/
7
- duration?: RadixToast.ToastProviderProps["duration"];
8
- /** label for each toast. Used to help screen reader users associate the interruption with a toast. */
9
- label?: RadixToast.ToastProviderProps["label"];
10
- children?: RadixToast.ToastProviderProps["children"];
11
- }
12
5
  export interface ToastProps {
13
6
  size?: ComponentProps<typeof Callout.Root>["size"];
14
- /** to indicate the severity of each Toast*/
7
+ /**
8
+ * to indicate the severity of each Toast
9
+ * @default "primary"
10
+ */
15
11
  severity?: Severity;
16
12
  /** the title of the Toast*/
17
13
  title: string;
18
14
  /** description of the Toast located underneath the title*/
19
15
  description: string;
20
- /** the icon located to the left of the Toast*/
16
+ /**
17
+ * the icon located to the left of the Toast
18
+ * @default "an 'i' in a circle"
19
+ */
21
20
  icon?: ReactNode;
22
- /** if toast generated by user action, set type to foreground, otherwise set type to background*/
23
- type?: RadixToast.ToastProps["type"];
24
- /** duration that the specific instance of Toast is visible for*/
25
- duration?: RadixToast.ToastProps["duration"];
21
+ /**
22
+ * duration that the specific instance of Toast is visible for (in milliseconds)
23
+ * @default 5000
24
+ */
25
+ duration?: RadixToastProps["duration"];
26
26
  /** a callback that will trigger when the Toast is closed */
27
27
  onClose?: () => void;
28
+ /**
29
+ * Control the sensitivity of the toast for screen readers.
30
+ * For toasts that are the result of a user action, choose `foreground`.
31
+ * Toasts generated from background tasks (ex: Update available) should use `background`.
32
+ * @default "foreground"
33
+ */
34
+ sensitivity?: RadixToastProps["type"];
28
35
  }
29
- export interface ToastContextProviderProps extends ToastProviderProps, Omit<RadixToast.ToastViewportProps, "label" | "asChild"> {
30
- /** a class that will be applied to the ol element responsible for listing the Toasts */
31
- viewportClass?: string;
32
- }
33
- export interface SimpleToastMessage {
34
- title: string;
35
- description: string;
36
- type?: RadixToast.ToastProps["type"];
37
- duration?: number;
36
+ export interface ToastContextProviderProps extends ToastProviderProps, Omit<ToastViewportProps, "label" | "asChild"> {
38
37
  }
38
+ export type SimpleToastProps = Omit<ToastProps, "severity">;
39
39
  export interface IToastContext {
40
40
  showToast: (toastMessage: ToastProps) => void;
41
- showPrimary: (simpleMessage: SimpleToastMessage) => void;
42
- showSuccess: (simpleMessage: SimpleToastMessage) => void;
43
- showInfo: (simpleMessage: SimpleToastMessage) => void;
44
- showError: (simpleMessage: SimpleToastMessage) => void;
41
+ showPrimary: (simpleMessage: SimpleToastProps) => void;
42
+ showSuccess: (simpleMessage: SimpleToastProps) => void;
43
+ showInfo: (simpleMessage: SimpleToastProps) => void;
44
+ showError: (simpleMessage: SimpleToastProps) => void;
45
45
  }