@cybertools/grommet 0.0.0-stage → 1.0.0
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/LICENSE +201 -0
- package/README.md +42 -2
- package/dist/Alert.cjs +58 -0
- package/dist/Alert.d.cts +11 -0
- package/dist/Alert.d.mts +11 -0
- package/dist/Alert.mjs +54 -0
- package/dist/BoxDirection.cjs +17 -0
- package/dist/BoxDirection.d.cts +6 -0
- package/dist/BoxDirection.d.mts +6 -0
- package/dist/BoxDirection.mjs +14 -0
- package/dist/ContactUs.cjs +39 -0
- package/dist/ContactUs.d.cts +10 -0
- package/dist/ContactUs.d.mts +10 -0
- package/dist/ContactUs.mjs +36 -0
- package/dist/ExternalLink.cjs +24 -0
- package/dist/ExternalLink.d.cts +9 -0
- package/dist/ExternalLink.d.mts +9 -0
- package/dist/ExternalLink.mjs +20 -0
- package/dist/Image.cjs +20 -0
- package/dist/Image.d.cts +81 -0
- package/dist/Image.d.mts +81 -0
- package/dist/Image.mjs +16 -0
- package/dist/Loader.cjs +21 -0
- package/dist/Loader.d.cts +8 -0
- package/dist/Loader.d.mts +8 -0
- package/dist/Loader.mjs +18 -0
- package/dist/MockNextRouterProvider.cjs +25 -0
- package/dist/MockNextRouterProvider.d.cts +8 -0
- package/dist/MockNextRouterProvider.d.mts +8 -0
- package/dist/MockNextRouterProvider.mjs +23 -0
- package/dist/Notification.cjs +54 -0
- package/dist/Notification.d.cts +13 -0
- package/dist/Notification.d.mts +13 -0
- package/dist/Notification.mjs +51 -0
- package/dist/NotificationsProvider.cjs +40 -0
- package/dist/NotificationsProvider.d.cts +18 -0
- package/dist/NotificationsProvider.d.mts +18 -0
- package/dist/NotificationsProvider.mjs +35 -0
- package/dist/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/index.cjs +26 -0
- package/dist/index.d.cts +12 -0
- package/dist/index.d.mts +12 -0
- package/dist/index.mjs +12 -0
- package/dist/interop.cjs +9 -0
- package/dist/interop.mjs +9 -0
- package/dist/testing.cjs +3 -0
- package/dist/testing.d.cts +2 -0
- package/dist/testing.d.mts +2 -0
- package/dist/testing.mjs +2 -0
- package/dist/useIsLarge.cjs +8 -0
- package/dist/useIsLarge.d.cts +3 -0
- package/dist/useIsLarge.d.mts +3 -0
- package/dist/useIsLarge.mjs +7 -0
- package/dist/useResponsive.cjs +9 -0
- package/dist/useResponsive.d.cts +3 -0
- package/dist/useResponsive.d.mts +3 -0
- package/dist/useResponsive.mjs +8 -0
- package/dist/useTrackEvents.cjs +39 -0
- package/dist/useTrackEvents.d.cts +9 -0
- package/dist/useTrackEvents.d.mts +9 -0
- package/dist/useTrackEvents.mjs +37 -0
- package/package.json +112 -3
package/dist/Image.d.cts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
//#region src/Image.d.ts
|
|
2
|
+
type Dimension = number | `${number}`;
|
|
3
|
+
export declare const Image: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components/dist/types").Merged<Omit<Omit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "src" | "height" | "width" | "loading" | "ref" | "alt" | "srcSet"> & {
|
|
4
|
+
src: string | import("next/dist/shared/lib/get-img-props").StaticImport;
|
|
5
|
+
alt: string;
|
|
6
|
+
width?: number | `${number}`;
|
|
7
|
+
height?: number | `${number}`;
|
|
8
|
+
fill?: boolean;
|
|
9
|
+
loader?: import("next/image").ImageLoader;
|
|
10
|
+
quality?: number | `${number}`;
|
|
11
|
+
preload?: boolean;
|
|
12
|
+
priority?: boolean;
|
|
13
|
+
loading?: "eager" | "lazy" | undefined;
|
|
14
|
+
placeholder?: import("next/dist/shared/lib/get-img-props").PlaceholderValue;
|
|
15
|
+
blurDataURL?: string;
|
|
16
|
+
unoptimized?: boolean;
|
|
17
|
+
overrideSrc?: string;
|
|
18
|
+
onLoadingComplete?: import("next/dist/shared/lib/get-img-props").OnLoadingComplete;
|
|
19
|
+
layout?: string;
|
|
20
|
+
objectFit?: string;
|
|
21
|
+
objectPosition?: string;
|
|
22
|
+
lazyBoundary?: string;
|
|
23
|
+
lazyRoot?: string;
|
|
24
|
+
} & import("react").RefAttributes<HTMLImageElement | null>, "style"> & {
|
|
25
|
+
style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
|
|
26
|
+
}, {
|
|
27
|
+
size?: Dimension;
|
|
28
|
+
radius?: string;
|
|
29
|
+
brightness?: number;
|
|
30
|
+
grayscale?: number;
|
|
31
|
+
}>, "height" | "width"> & Partial<Pick<import("styled-components/dist/types").Merged<Omit<Omit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "src" | "height" | "width" | "loading" | "ref" | "alt" | "srcSet"> & {
|
|
32
|
+
src: string | import("next/dist/shared/lib/get-img-props").StaticImport;
|
|
33
|
+
alt: string;
|
|
34
|
+
width?: number | `${number}`;
|
|
35
|
+
height?: number | `${number}`;
|
|
36
|
+
fill?: boolean;
|
|
37
|
+
loader?: import("next/image").ImageLoader;
|
|
38
|
+
quality?: number | `${number}`;
|
|
39
|
+
preload?: boolean;
|
|
40
|
+
priority?: boolean;
|
|
41
|
+
loading?: "eager" | "lazy" | undefined;
|
|
42
|
+
placeholder?: import("next/dist/shared/lib/get-img-props").PlaceholderValue;
|
|
43
|
+
blurDataURL?: string;
|
|
44
|
+
unoptimized?: boolean;
|
|
45
|
+
overrideSrc?: string;
|
|
46
|
+
onLoadingComplete?: import("next/dist/shared/lib/get-img-props").OnLoadingComplete;
|
|
47
|
+
layout?: string;
|
|
48
|
+
objectFit?: string;
|
|
49
|
+
objectPosition?: string;
|
|
50
|
+
lazyBoundary?: string;
|
|
51
|
+
lazyRoot?: string;
|
|
52
|
+
} & import("react").RefAttributes<HTMLImageElement | null>, "style"> & {
|
|
53
|
+
style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
|
|
54
|
+
}, {
|
|
55
|
+
size?: Dimension;
|
|
56
|
+
radius?: string;
|
|
57
|
+
brightness?: number;
|
|
58
|
+
grayscale?: number;
|
|
59
|
+
}>, "height" | "width">>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "src" | "height" | "width" | "loading" | "ref" | "alt" | "srcSet"> & {
|
|
60
|
+
src: string | import("next/dist/shared/lib/get-img-props").StaticImport;
|
|
61
|
+
alt: string;
|
|
62
|
+
width?: number | `${number}`;
|
|
63
|
+
height?: number | `${number}`;
|
|
64
|
+
fill?: boolean;
|
|
65
|
+
loader?: import("next/image").ImageLoader;
|
|
66
|
+
quality?: number | `${number}`;
|
|
67
|
+
preload?: boolean;
|
|
68
|
+
priority?: boolean;
|
|
69
|
+
loading?: "eager" | "lazy" | undefined;
|
|
70
|
+
placeholder?: import("next/dist/shared/lib/get-img-props").PlaceholderValue;
|
|
71
|
+
blurDataURL?: string;
|
|
72
|
+
unoptimized?: boolean;
|
|
73
|
+
overrideSrc?: string;
|
|
74
|
+
onLoadingComplete?: import("next/dist/shared/lib/get-img-props").OnLoadingComplete;
|
|
75
|
+
layout?: string;
|
|
76
|
+
objectFit?: string;
|
|
77
|
+
objectPosition?: string;
|
|
78
|
+
lazyBoundary?: string;
|
|
79
|
+
lazyRoot?: string;
|
|
80
|
+
} & import("react").RefAttributes<HTMLImageElement | null>>, keyof import("react").Component<any, {}, any>>;
|
|
81
|
+
//#endregion
|
package/dist/Image.d.mts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
//#region src/Image.d.ts
|
|
2
|
+
type Dimension = number | `${number}`;
|
|
3
|
+
export declare const Image: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components/dist/types").Merged<Omit<Omit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "src" | "height" | "width" | "loading" | "ref" | "alt" | "srcSet"> & {
|
|
4
|
+
src: string | import("next/dist/shared/lib/get-img-props").StaticImport;
|
|
5
|
+
alt: string;
|
|
6
|
+
width?: number | `${number}`;
|
|
7
|
+
height?: number | `${number}`;
|
|
8
|
+
fill?: boolean;
|
|
9
|
+
loader?: import("next/image").ImageLoader;
|
|
10
|
+
quality?: number | `${number}`;
|
|
11
|
+
preload?: boolean;
|
|
12
|
+
priority?: boolean;
|
|
13
|
+
loading?: "eager" | "lazy" | undefined;
|
|
14
|
+
placeholder?: import("next/dist/shared/lib/get-img-props").PlaceholderValue;
|
|
15
|
+
blurDataURL?: string;
|
|
16
|
+
unoptimized?: boolean;
|
|
17
|
+
overrideSrc?: string;
|
|
18
|
+
onLoadingComplete?: import("next/dist/shared/lib/get-img-props").OnLoadingComplete;
|
|
19
|
+
layout?: string;
|
|
20
|
+
objectFit?: string;
|
|
21
|
+
objectPosition?: string;
|
|
22
|
+
lazyBoundary?: string;
|
|
23
|
+
lazyRoot?: string;
|
|
24
|
+
} & import("react").RefAttributes<HTMLImageElement | null>, "style"> & {
|
|
25
|
+
style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
|
|
26
|
+
}, {
|
|
27
|
+
size?: Dimension;
|
|
28
|
+
radius?: string;
|
|
29
|
+
brightness?: number;
|
|
30
|
+
grayscale?: number;
|
|
31
|
+
}>, "height" | "width"> & Partial<Pick<import("styled-components/dist/types").Merged<Omit<Omit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "src" | "height" | "width" | "loading" | "ref" | "alt" | "srcSet"> & {
|
|
32
|
+
src: string | import("next/dist/shared/lib/get-img-props").StaticImport;
|
|
33
|
+
alt: string;
|
|
34
|
+
width?: number | `${number}`;
|
|
35
|
+
height?: number | `${number}`;
|
|
36
|
+
fill?: boolean;
|
|
37
|
+
loader?: import("next/image").ImageLoader;
|
|
38
|
+
quality?: number | `${number}`;
|
|
39
|
+
preload?: boolean;
|
|
40
|
+
priority?: boolean;
|
|
41
|
+
loading?: "eager" | "lazy" | undefined;
|
|
42
|
+
placeholder?: import("next/dist/shared/lib/get-img-props").PlaceholderValue;
|
|
43
|
+
blurDataURL?: string;
|
|
44
|
+
unoptimized?: boolean;
|
|
45
|
+
overrideSrc?: string;
|
|
46
|
+
onLoadingComplete?: import("next/dist/shared/lib/get-img-props").OnLoadingComplete;
|
|
47
|
+
layout?: string;
|
|
48
|
+
objectFit?: string;
|
|
49
|
+
objectPosition?: string;
|
|
50
|
+
lazyBoundary?: string;
|
|
51
|
+
lazyRoot?: string;
|
|
52
|
+
} & import("react").RefAttributes<HTMLImageElement | null>, "style"> & {
|
|
53
|
+
style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
|
|
54
|
+
}, {
|
|
55
|
+
size?: Dimension;
|
|
56
|
+
radius?: string;
|
|
57
|
+
brightness?: number;
|
|
58
|
+
grayscale?: number;
|
|
59
|
+
}>, "height" | "width">>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "src" | "height" | "width" | "loading" | "ref" | "alt" | "srcSet"> & {
|
|
60
|
+
src: string | import("next/dist/shared/lib/get-img-props").StaticImport;
|
|
61
|
+
alt: string;
|
|
62
|
+
width?: number | `${number}`;
|
|
63
|
+
height?: number | `${number}`;
|
|
64
|
+
fill?: boolean;
|
|
65
|
+
loader?: import("next/image").ImageLoader;
|
|
66
|
+
quality?: number | `${number}`;
|
|
67
|
+
preload?: boolean;
|
|
68
|
+
priority?: boolean;
|
|
69
|
+
loading?: "eager" | "lazy" | undefined;
|
|
70
|
+
placeholder?: import("next/dist/shared/lib/get-img-props").PlaceholderValue;
|
|
71
|
+
blurDataURL?: string;
|
|
72
|
+
unoptimized?: boolean;
|
|
73
|
+
overrideSrc?: string;
|
|
74
|
+
onLoadingComplete?: import("next/dist/shared/lib/get-img-props").OnLoadingComplete;
|
|
75
|
+
layout?: string;
|
|
76
|
+
objectFit?: string;
|
|
77
|
+
objectPosition?: string;
|
|
78
|
+
lazyBoundary?: string;
|
|
79
|
+
lazyRoot?: string;
|
|
80
|
+
} & import("react").RefAttributes<HTMLImageElement | null>>, keyof import("react").Component<any, {}, any>>;
|
|
81
|
+
//#endregion
|
package/dist/Image.mjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { unwrapCjsDefault } from "./interop.mjs";
|
|
2
|
+
import NextImageImport from "next/image.js";
|
|
3
|
+
import styledImport from "styled-components";
|
|
4
|
+
//#region src/Image.tsx
|
|
5
|
+
const NextImage = unwrapCjsDefault(NextImageImport);
|
|
6
|
+
const Image = unwrapCjsDefault(styledImport)(NextImage).attrs(({ size, width = size, height = size, ...rest }) => ({
|
|
7
|
+
width,
|
|
8
|
+
height,
|
|
9
|
+
...rest
|
|
10
|
+
}))`
|
|
11
|
+
${({ radius }) => radius && `border-radius: ${radius};`}
|
|
12
|
+
${({ brightness }) => brightness && `filter: brightness(${brightness}%);`}
|
|
13
|
+
${({ grayscale }) => grayscale && `filter: grayscale(${grayscale}%);`}
|
|
14
|
+
`;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Image };
|
package/dist/Loader.cjs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
let react = require("react");
|
|
4
|
+
react = require_runtime.__toESM(react, 1);
|
|
5
|
+
let grommet = require("grommet");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
//#region src/Loader.tsx
|
|
8
|
+
function Loader({ children = "Loading...", ...rest }) {
|
|
9
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(grommet.Box, {
|
|
10
|
+
align: "center",
|
|
11
|
+
direction: "row",
|
|
12
|
+
gap: "small",
|
|
13
|
+
...rest,
|
|
14
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(grommet.Spinner, { size: "small" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(grommet.Text, {
|
|
15
|
+
color: "status-disabled",
|
|
16
|
+
children
|
|
17
|
+
})]
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.Loader = Loader;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BoxExtendedProps } from "grommet";
|
|
3
|
+
//#region src/Loader.d.ts
|
|
4
|
+
export type LoaderProps = BoxExtendedProps & {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export declare function Loader({ children, ...rest }: LoaderProps): React.JSX.Element;
|
|
8
|
+
//#endregion
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BoxExtendedProps } from "grommet";
|
|
3
|
+
//#region src/Loader.d.ts
|
|
4
|
+
export type LoaderProps = BoxExtendedProps & {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export declare function Loader({ children, ...rest }: LoaderProps): React.JSX.Element;
|
|
8
|
+
//#endregion
|
package/dist/Loader.mjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { Box, Spinner, Text } from "grommet";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/Loader.tsx
|
|
5
|
+
function Loader({ children = "Loading...", ...rest }) {
|
|
6
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
7
|
+
align: "center",
|
|
8
|
+
direction: "row",
|
|
9
|
+
gap: "small",
|
|
10
|
+
...rest,
|
|
11
|
+
children: [/* @__PURE__ */ jsx(Spinner, { size: "small" }), /* @__PURE__ */ jsx(Text, {
|
|
12
|
+
color: "status-disabled",
|
|
13
|
+
children
|
|
14
|
+
})]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Loader };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
let react = require("react");
|
|
3
|
+
react = require_runtime.__toESM(react, 1);
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
let next_dist_shared_lib_router_context_shared_runtime_js = require("next/dist/shared/lib/router-context.shared-runtime.js");
|
|
6
|
+
//#region src/MockNextRouterProvider.tsx
|
|
7
|
+
const mock = {
|
|
8
|
+
path: "/",
|
|
9
|
+
asPath: "/",
|
|
10
|
+
query: {},
|
|
11
|
+
push() {},
|
|
12
|
+
replace: () => {},
|
|
13
|
+
pathname: ""
|
|
14
|
+
};
|
|
15
|
+
function MockNextRouterProvider({ value, ...rest }) {
|
|
16
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(next_dist_shared_lib_router_context_shared_runtime_js.RouterContext.Provider, {
|
|
17
|
+
value: {
|
|
18
|
+
...mock,
|
|
19
|
+
...value
|
|
20
|
+
},
|
|
21
|
+
...rest
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.MockNextRouterProvider = MockNextRouterProvider;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NextRouter } from "next/router.js";
|
|
3
|
+
//#region src/MockNextRouterProvider.d.ts
|
|
4
|
+
export declare function MockNextRouterProvider({ value, ...rest }: {
|
|
5
|
+
value?: Partial<NextRouter>;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}): React.JSX.Element;
|
|
8
|
+
//#endregion
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NextRouter } from "next/router.js";
|
|
3
|
+
//#region src/MockNextRouterProvider.d.ts
|
|
4
|
+
export declare function MockNextRouterProvider({ value, ...rest }: {
|
|
5
|
+
value?: Partial<NextRouter>;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}): React.JSX.Element;
|
|
8
|
+
//#endregion
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { RouterContext } from "next/dist/shared/lib/router-context.shared-runtime.js";
|
|
4
|
+
//#region src/MockNextRouterProvider.tsx
|
|
5
|
+
const mock = {
|
|
6
|
+
path: "/",
|
|
7
|
+
asPath: "/",
|
|
8
|
+
query: {},
|
|
9
|
+
push() {},
|
|
10
|
+
replace: () => {},
|
|
11
|
+
pathname: ""
|
|
12
|
+
};
|
|
13
|
+
function MockNextRouterProvider({ value, ...rest }) {
|
|
14
|
+
return /* @__PURE__ */ jsx(RouterContext.Provider, {
|
|
15
|
+
value: {
|
|
16
|
+
...mock,
|
|
17
|
+
...value
|
|
18
|
+
},
|
|
19
|
+
...rest
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { MockNextRouterProvider };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
let react = require("react");
|
|
4
|
+
react = require_runtime.__toESM(react, 1);
|
|
5
|
+
let grommet = require("grommet");
|
|
6
|
+
let grommet_icons_icons_Alert_js = require("grommet-icons/icons/Alert.js");
|
|
7
|
+
let grommet_icons_icons_CircleInformation_js = require("grommet-icons/icons/CircleInformation.js");
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
let grommet_icons_icons_StatusGood_js = require("grommet-icons/icons/StatusGood.js");
|
|
10
|
+
let grommet_icons_icons_StatusCritical_js = require("grommet-icons/icons/StatusCritical.js");
|
|
11
|
+
//#region src/Notification.tsx
|
|
12
|
+
const bgByType = {
|
|
13
|
+
success: "status-ok",
|
|
14
|
+
error: "status-warning",
|
|
15
|
+
info: "neutral-3",
|
|
16
|
+
warning: "status-warning"
|
|
17
|
+
};
|
|
18
|
+
const iconByType = {
|
|
19
|
+
success: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(grommet_icons_icons_StatusGood_js.StatusGood, {}),
|
|
20
|
+
error: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(grommet_icons_icons_StatusCritical_js.StatusCritical, {}),
|
|
21
|
+
info: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(grommet_icons_icons_CircleInformation_js.CircleInformation, {}),
|
|
22
|
+
warning: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(grommet_icons_icons_Alert_js.Alert, {})
|
|
23
|
+
};
|
|
24
|
+
const getMessage = (message) => {
|
|
25
|
+
if (typeof message === "string" || message instanceof Error) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(grommet.Text, { children: message.toString() });
|
|
26
|
+
if (typeof message === "function") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(message, {});
|
|
27
|
+
return message;
|
|
28
|
+
};
|
|
29
|
+
function Notification({ type, message, options }) {
|
|
30
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(grommet.Layer, {
|
|
31
|
+
position: "bottom",
|
|
32
|
+
modal: false,
|
|
33
|
+
margin: { vertical: "large" },
|
|
34
|
+
responsive: false,
|
|
35
|
+
plain: true,
|
|
36
|
+
...options,
|
|
37
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(grommet.Box, {
|
|
38
|
+
align: "center",
|
|
39
|
+
direction: "row",
|
|
40
|
+
gap: "small",
|
|
41
|
+
round: "medium",
|
|
42
|
+
elevation: "medium",
|
|
43
|
+
pad: {
|
|
44
|
+
vertical: "small",
|
|
45
|
+
horizontal: "medium"
|
|
46
|
+
},
|
|
47
|
+
background: bgByType[type],
|
|
48
|
+
width: { min: "320px" },
|
|
49
|
+
children: [iconByType[type], getMessage(message)]
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
exports.Notification = Notification;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { LayerExtendedProps } from "grommet";
|
|
3
|
+
//#region src/Notification.d.ts
|
|
4
|
+
export type NotificationType = "success" | "error" | "info" | "warning";
|
|
5
|
+
export type NotificationMessage = React.ReactNode | Error | React.ComponentType;
|
|
6
|
+
export type NotificationOptions = Partial<LayerExtendedProps>;
|
|
7
|
+
export type NotificationProps = {
|
|
8
|
+
type: NotificationType;
|
|
9
|
+
message: NotificationMessage;
|
|
10
|
+
options?: NotificationOptions;
|
|
11
|
+
};
|
|
12
|
+
export declare function Notification({ type, message, options }: NotificationProps): React.JSX.Element;
|
|
13
|
+
//#endregion
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { LayerExtendedProps } from "grommet";
|
|
3
|
+
//#region src/Notification.d.ts
|
|
4
|
+
export type NotificationType = "success" | "error" | "info" | "warning";
|
|
5
|
+
export type NotificationMessage = React.ReactNode | Error | React.ComponentType;
|
|
6
|
+
export type NotificationOptions = Partial<LayerExtendedProps>;
|
|
7
|
+
export type NotificationProps = {
|
|
8
|
+
type: NotificationType;
|
|
9
|
+
message: NotificationMessage;
|
|
10
|
+
options?: NotificationOptions;
|
|
11
|
+
};
|
|
12
|
+
export declare function Notification({ type, message, options }: NotificationProps): React.JSX.Element;
|
|
13
|
+
//#endregion
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { Box, Layer, Text } from "grommet";
|
|
3
|
+
import { Alert } from "grommet-icons/icons/Alert.js";
|
|
4
|
+
import { CircleInformation } from "grommet-icons/icons/CircleInformation.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { StatusGood } from "grommet-icons/icons/StatusGood.js";
|
|
7
|
+
import { StatusCritical } from "grommet-icons/icons/StatusCritical.js";
|
|
8
|
+
//#region src/Notification.tsx
|
|
9
|
+
const bgByType = {
|
|
10
|
+
success: "status-ok",
|
|
11
|
+
error: "status-warning",
|
|
12
|
+
info: "neutral-3",
|
|
13
|
+
warning: "status-warning"
|
|
14
|
+
};
|
|
15
|
+
const iconByType = {
|
|
16
|
+
success: /* @__PURE__ */ jsx(StatusGood, {}),
|
|
17
|
+
error: /* @__PURE__ */ jsx(StatusCritical, {}),
|
|
18
|
+
info: /* @__PURE__ */ jsx(CircleInformation, {}),
|
|
19
|
+
warning: /* @__PURE__ */ jsx(Alert, {})
|
|
20
|
+
};
|
|
21
|
+
const getMessage = (message) => {
|
|
22
|
+
if (typeof message === "string" || message instanceof Error) return /* @__PURE__ */ jsx(Text, { children: message.toString() });
|
|
23
|
+
if (typeof message === "function") return /* @__PURE__ */ jsx(message, {});
|
|
24
|
+
return message;
|
|
25
|
+
};
|
|
26
|
+
function Notification({ type, message, options }) {
|
|
27
|
+
return /* @__PURE__ */ jsx(Layer, {
|
|
28
|
+
position: "bottom",
|
|
29
|
+
modal: false,
|
|
30
|
+
margin: { vertical: "large" },
|
|
31
|
+
responsive: false,
|
|
32
|
+
plain: true,
|
|
33
|
+
...options,
|
|
34
|
+
children: /* @__PURE__ */ jsxs(Box, {
|
|
35
|
+
align: "center",
|
|
36
|
+
direction: "row",
|
|
37
|
+
gap: "small",
|
|
38
|
+
round: "medium",
|
|
39
|
+
elevation: "medium",
|
|
40
|
+
pad: {
|
|
41
|
+
vertical: "small",
|
|
42
|
+
horizontal: "medium"
|
|
43
|
+
},
|
|
44
|
+
background: bgByType[type],
|
|
45
|
+
width: { min: "320px" },
|
|
46
|
+
children: [iconByType[type], getMessage(message)]
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { Notification };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_interop = require("./interop.cjs");
|
|
4
|
+
let react = require("react");
|
|
5
|
+
react = require_runtime.__toESM(react, 1);
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
let next_dynamic_js = require("next/dynamic.js");
|
|
8
|
+
next_dynamic_js = require_runtime.__toESM(next_dynamic_js, 1);
|
|
9
|
+
//#region src/NotificationsProvider.tsx
|
|
10
|
+
const Notification = require_interop.unwrapCjsDefault(next_dynamic_js.default)(() => Promise.resolve().then(() => require("./Notification.cjs")).then((m) => m.Notification));
|
|
11
|
+
const context = (0, react.createContext)(void 0);
|
|
12
|
+
const defaultDuration = 5e3;
|
|
13
|
+
function NotificationsProvider({ children }) {
|
|
14
|
+
const timeoutRef = (0, react.useRef)(void 0);
|
|
15
|
+
const [notification, setNotification] = (0, react.useState)();
|
|
16
|
+
const makeNotification = (type, message, { duration = defaultDuration, ...options } = {}) => {
|
|
17
|
+
clearTimeout(timeoutRef.current);
|
|
18
|
+
setNotification({
|
|
19
|
+
type,
|
|
20
|
+
message,
|
|
21
|
+
options
|
|
22
|
+
});
|
|
23
|
+
timeoutRef.current = setTimeout(() => setNotification(null), duration);
|
|
24
|
+
};
|
|
25
|
+
const actions = (0, react.useMemo)(() => ({
|
|
26
|
+
success: (message, options) => makeNotification("success", message, options),
|
|
27
|
+
generalError: (options) => makeNotification("error", "Oops, Something went wrong!", options),
|
|
28
|
+
error: (message, options) => makeNotification("error", message, options),
|
|
29
|
+
info: (message, options) => makeNotification("info", message, options),
|
|
30
|
+
warning: (message, options) => makeNotification("warning", message, options)
|
|
31
|
+
}), []);
|
|
32
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(context.Provider, {
|
|
33
|
+
value: actions,
|
|
34
|
+
children
|
|
35
|
+
}), notification && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Notification, { ...notification })] });
|
|
36
|
+
}
|
|
37
|
+
const useNotifications = () => (0, react.useContext)(context);
|
|
38
|
+
//#endregion
|
|
39
|
+
exports.NotificationsProvider = NotificationsProvider;
|
|
40
|
+
exports.useNotifications = useNotifications;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NotificationMessage, NotificationOptions } from "./Notification.cjs";
|
|
2
|
+
import React from "react";
|
|
3
|
+
//#region src/NotificationsProvider.d.ts
|
|
4
|
+
export type MakeNotificationOptions = NotificationOptions & {
|
|
5
|
+
duration?: number;
|
|
6
|
+
};
|
|
7
|
+
export type NotificationActions = {
|
|
8
|
+
success: (message: NotificationMessage, options?: MakeNotificationOptions) => void;
|
|
9
|
+
generalError: (options?: MakeNotificationOptions) => void;
|
|
10
|
+
error: (message: NotificationMessage, options?: MakeNotificationOptions) => void;
|
|
11
|
+
info: (message: NotificationMessage, options?: MakeNotificationOptions) => void;
|
|
12
|
+
warning: (message: NotificationMessage, options?: MakeNotificationOptions) => void;
|
|
13
|
+
};
|
|
14
|
+
export declare function NotificationsProvider({ children }: {
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
}): React.JSX.Element;
|
|
17
|
+
export declare const useNotifications: () => NotificationActions | undefined;
|
|
18
|
+
//#endregion
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NotificationMessage, NotificationOptions } from "./Notification.mjs";
|
|
2
|
+
import React from "react";
|
|
3
|
+
//#region src/NotificationsProvider.d.ts
|
|
4
|
+
export type MakeNotificationOptions = NotificationOptions & {
|
|
5
|
+
duration?: number;
|
|
6
|
+
};
|
|
7
|
+
export type NotificationActions = {
|
|
8
|
+
success: (message: NotificationMessage, options?: MakeNotificationOptions) => void;
|
|
9
|
+
generalError: (options?: MakeNotificationOptions) => void;
|
|
10
|
+
error: (message: NotificationMessage, options?: MakeNotificationOptions) => void;
|
|
11
|
+
info: (message: NotificationMessage, options?: MakeNotificationOptions) => void;
|
|
12
|
+
warning: (message: NotificationMessage, options?: MakeNotificationOptions) => void;
|
|
13
|
+
};
|
|
14
|
+
export declare function NotificationsProvider({ children }: {
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
}): React.JSX.Element;
|
|
17
|
+
export declare const useNotifications: () => NotificationActions | undefined;
|
|
18
|
+
//#endregion
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { unwrapCjsDefault } from "./interop.mjs";
|
|
2
|
+
import { Fragment, createContext, useContext, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import dynamicImport from "next/dynamic.js";
|
|
5
|
+
//#region src/NotificationsProvider.tsx
|
|
6
|
+
const Notification = unwrapCjsDefault(dynamicImport)(() => import("./Notification.mjs").then((m) => m.Notification));
|
|
7
|
+
const context = createContext(void 0);
|
|
8
|
+
const defaultDuration = 5e3;
|
|
9
|
+
function NotificationsProvider({ children }) {
|
|
10
|
+
const timeoutRef = useRef(void 0);
|
|
11
|
+
const [notification, setNotification] = useState();
|
|
12
|
+
const makeNotification = (type, message, { duration = defaultDuration, ...options } = {}) => {
|
|
13
|
+
clearTimeout(timeoutRef.current);
|
|
14
|
+
setNotification({
|
|
15
|
+
type,
|
|
16
|
+
message,
|
|
17
|
+
options
|
|
18
|
+
});
|
|
19
|
+
timeoutRef.current = setTimeout(() => setNotification(null), duration);
|
|
20
|
+
};
|
|
21
|
+
const actions = useMemo(() => ({
|
|
22
|
+
success: (message, options) => makeNotification("success", message, options),
|
|
23
|
+
generalError: (options) => makeNotification("error", "Oops, Something went wrong!", options),
|
|
24
|
+
error: (message, options) => makeNotification("error", message, options),
|
|
25
|
+
info: (message, options) => makeNotification("info", message, options),
|
|
26
|
+
warning: (message, options) => makeNotification("warning", message, options)
|
|
27
|
+
}), []);
|
|
28
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(context.Provider, {
|
|
29
|
+
value: actions,
|
|
30
|
+
children
|
|
31
|
+
}), notification && /* @__PURE__ */ jsx(Notification, { ...notification })] });
|
|
32
|
+
}
|
|
33
|
+
const useNotifications = () => useContext(context);
|
|
34
|
+
//#endregion
|
|
35
|
+
export { NotificationsProvider, useNotifications };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.__toESM = __toESM;
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_Alert = require("./Alert.cjs");
|
|
3
|
+
const require_useResponsive = require("./useResponsive.cjs");
|
|
4
|
+
const require_useIsLarge = require("./useIsLarge.cjs");
|
|
5
|
+
const require_BoxDirection = require("./BoxDirection.cjs");
|
|
6
|
+
const require_ContactUs = require("./ContactUs.cjs");
|
|
7
|
+
const require_ExternalLink = require("./ExternalLink.cjs");
|
|
8
|
+
const require_Image = require("./Image.cjs");
|
|
9
|
+
const require_Loader = require("./Loader.cjs");
|
|
10
|
+
const require_NotificationsProvider = require("./NotificationsProvider.cjs");
|
|
11
|
+
const require_Notification = require("./Notification.cjs");
|
|
12
|
+
const require_useTrackEvents = require("./useTrackEvents.cjs");
|
|
13
|
+
exports.BoxDirection = require_BoxDirection.BoxDirection;
|
|
14
|
+
exports.ContactUs = require_ContactUs.ContactUs;
|
|
15
|
+
exports.ExternalLink = require_ExternalLink.ExternalLink;
|
|
16
|
+
exports.Image = require_Image.Image;
|
|
17
|
+
exports.Information = require_Alert.Information;
|
|
18
|
+
exports.Loader = require_Loader.Loader;
|
|
19
|
+
exports.Notification = require_Notification.Notification;
|
|
20
|
+
exports.NotificationsProvider = require_NotificationsProvider.NotificationsProvider;
|
|
21
|
+
exports.Warning = require_Alert.Warning;
|
|
22
|
+
exports.reportEvent = require_useTrackEvents.reportEvent;
|
|
23
|
+
exports.useIsLarge = require_useIsLarge.useIsLarge;
|
|
24
|
+
exports.useNotifications = require_NotificationsProvider.useNotifications;
|
|
25
|
+
exports.useResponsive = require_useResponsive.useResponsive;
|
|
26
|
+
exports.useTrackEvents = require_useTrackEvents.useTrackEvents;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AlertProps, Information, Warning } from "./Alert.cjs";
|
|
2
|
+
import { BoxDirection, BoxDirectionProps } from "./BoxDirection.cjs";
|
|
3
|
+
import { ContactUs, ContactUsProps } from "./ContactUs.cjs";
|
|
4
|
+
import { ExternalLink, ExternalLinkProps } from "./ExternalLink.cjs";
|
|
5
|
+
import { Image } from "./Image.cjs";
|
|
6
|
+
import { Loader, LoaderProps } from "./Loader.cjs";
|
|
7
|
+
import { Notification, NotificationMessage, NotificationOptions, NotificationProps, NotificationType } from "./Notification.cjs";
|
|
8
|
+
import { MakeNotificationOptions, NotificationActions, NotificationsProvider, useNotifications } from "./NotificationsProvider.cjs";
|
|
9
|
+
import { useResponsive } from "./useResponsive.cjs";
|
|
10
|
+
import { useIsLarge } from "./useIsLarge.cjs";
|
|
11
|
+
import { reportEvent, useTrackEvents } from "./useTrackEvents.cjs";
|
|
12
|
+
export { type AlertProps, BoxDirection, type BoxDirectionProps, ContactUs, type ContactUsProps, ExternalLink, type ExternalLinkProps, Image, Information, Loader, type LoaderProps, type MakeNotificationOptions, Notification, type NotificationActions, type NotificationMessage, type NotificationOptions, type NotificationProps, type NotificationType, NotificationsProvider, Warning, reportEvent, useIsLarge, useNotifications, useResponsive, useTrackEvents };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AlertProps, Information, Warning } from "./Alert.mjs";
|
|
2
|
+
import { BoxDirection, BoxDirectionProps } from "./BoxDirection.mjs";
|
|
3
|
+
import { ContactUs, ContactUsProps } from "./ContactUs.mjs";
|
|
4
|
+
import { ExternalLink, ExternalLinkProps } from "./ExternalLink.mjs";
|
|
5
|
+
import { Image } from "./Image.mjs";
|
|
6
|
+
import { Loader, LoaderProps } from "./Loader.mjs";
|
|
7
|
+
import { Notification, NotificationMessage, NotificationOptions, NotificationProps, NotificationType } from "./Notification.mjs";
|
|
8
|
+
import { MakeNotificationOptions, NotificationActions, NotificationsProvider, useNotifications } from "./NotificationsProvider.mjs";
|
|
9
|
+
import { useResponsive } from "./useResponsive.mjs";
|
|
10
|
+
import { useIsLarge } from "./useIsLarge.mjs";
|
|
11
|
+
import { reportEvent, useTrackEvents } from "./useTrackEvents.mjs";
|
|
12
|
+
export { type AlertProps, BoxDirection, type BoxDirectionProps, ContactUs, type ContactUsProps, ExternalLink, type ExternalLinkProps, Image, Information, Loader, type LoaderProps, type MakeNotificationOptions, Notification, type NotificationActions, type NotificationMessage, type NotificationOptions, type NotificationProps, type NotificationType, NotificationsProvider, Warning, reportEvent, useIsLarge, useNotifications, useResponsive, useTrackEvents };
|