@yamada-ui/alert 0.1.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 +21 -0
- package/README.md +28 -0
- package/dist/alert.d.ts +47 -0
- package/dist/alert.js +104 -0
- package/dist/alert.mjs +16 -0
- package/dist/chunk-2AJTREQZ.mjs +80 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +106 -0
- package/dist/index.mjs +16 -0
- package/package.json +77 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Hirotomo Yamada
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# @yamada-ui/alert
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
$ pnpm add @yamada-ui/alert
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
or
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
$ yarn add @yamada-ui/alert
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
or
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
$ npm install @yamada-ui/alert
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Contribution
|
|
22
|
+
|
|
23
|
+
Wouldn't you like to contribute? That's amazing! We have prepared a [contribution guide](https://github.com/hirotomoyamada/yamada-ui/blob/main/CONTRIBUTING.md) to assist you.
|
|
24
|
+
|
|
25
|
+
## Licence
|
|
26
|
+
|
|
27
|
+
This package is licensed under the terms of the
|
|
28
|
+
[MIT license](https://github.com/hirotomoyamada/yamada-ui/blob/main/LICENSE).
|
package/dist/alert.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as _yamada_ui_core from '@yamada-ui/core';
|
|
3
|
+
import { HTMLUIProps, ThemeProps } from '@yamada-ui/core';
|
|
4
|
+
import * as react from 'react';
|
|
5
|
+
import * as _yamada_ui_icon from '@yamada-ui/icon';
|
|
6
|
+
import { LoadingProps } from '@yamada-ui/loading';
|
|
7
|
+
|
|
8
|
+
declare const statuses: {
|
|
9
|
+
readonly info: {
|
|
10
|
+
readonly icon: react.FC<_yamada_ui_icon.IconProps>;
|
|
11
|
+
readonly colorScheme: "blue";
|
|
12
|
+
};
|
|
13
|
+
readonly success: {
|
|
14
|
+
readonly icon: react.FC<_yamada_ui_icon.IconProps>;
|
|
15
|
+
readonly colorScheme: "green";
|
|
16
|
+
};
|
|
17
|
+
readonly warning: {
|
|
18
|
+
readonly icon: react.FC<_yamada_ui_icon.IconProps>;
|
|
19
|
+
readonly colorScheme: "orange";
|
|
20
|
+
};
|
|
21
|
+
readonly error: {
|
|
22
|
+
readonly icon: react.FC<_yamada_ui_icon.IconProps>;
|
|
23
|
+
readonly colorScheme: "red";
|
|
24
|
+
};
|
|
25
|
+
readonly loading: {
|
|
26
|
+
readonly icon: _yamada_ui_core.Component<"div", LoadingProps>;
|
|
27
|
+
readonly colorScheme: "blue";
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
type Status = keyof typeof statuses;
|
|
31
|
+
declare const getStatusColorScheme: (status: Status) => "blue" | "green" | "orange" | "red";
|
|
32
|
+
declare const getStatusIcon: (status: Status) => react.FC<_yamada_ui_icon.IconProps> | _yamada_ui_core.Component<"div", LoadingProps>;
|
|
33
|
+
type AlertOptions = {
|
|
34
|
+
status?: Status;
|
|
35
|
+
};
|
|
36
|
+
type AlertProps = HTMLUIProps<'div'> & ThemeProps<'Alert'> & AlertOptions;
|
|
37
|
+
declare const Alert: _yamada_ui_core.Component<"div", AlertProps>;
|
|
38
|
+
type AlertIconProps = HTMLUIProps<'span'> & {
|
|
39
|
+
variant?: LoadingProps['variant'];
|
|
40
|
+
};
|
|
41
|
+
declare const AlertIcon: ({ className, children, variant, ...rest }: AlertIconProps) => react_jsx_runtime.JSX.Element;
|
|
42
|
+
type AlertTitleProps = HTMLUIProps<'p'>;
|
|
43
|
+
declare const AlertTitle: _yamada_ui_core.Component<"p", AlertTitleProps>;
|
|
44
|
+
type AlertDescriptionProps = HTMLUIProps<'span'>;
|
|
45
|
+
declare const AlertDescription: _yamada_ui_core.Component<"span", AlertDescriptionProps>;
|
|
46
|
+
|
|
47
|
+
export { Alert, AlertDescription, AlertDescriptionProps, AlertIcon, AlertIconProps, AlertProps, AlertTitle, AlertTitleProps, getStatusColorScheme, getStatusIcon };
|
package/dist/alert.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/alert.tsx
|
|
21
|
+
var alert_exports = {};
|
|
22
|
+
__export(alert_exports, {
|
|
23
|
+
Alert: () => Alert,
|
|
24
|
+
AlertDescription: () => AlertDescription,
|
|
25
|
+
AlertIcon: () => AlertIcon,
|
|
26
|
+
AlertTitle: () => AlertTitle,
|
|
27
|
+
getStatusColorScheme: () => getStatusColorScheme,
|
|
28
|
+
getStatusIcon: () => getStatusIcon
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(alert_exports);
|
|
31
|
+
var import_core = require("@yamada-ui/core");
|
|
32
|
+
var import_icon = require("@yamada-ui/icon");
|
|
33
|
+
var import_loading = require("@yamada-ui/loading");
|
|
34
|
+
var import_utils = require("@yamada-ui/utils");
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var statuses = {
|
|
37
|
+
info: { icon: import_icon.InfoIcon, colorScheme: "blue" },
|
|
38
|
+
success: { icon: import_icon.CheckIcon, colorScheme: "green" },
|
|
39
|
+
warning: { icon: import_icon.WarningIcon, colorScheme: "orange" },
|
|
40
|
+
error: { icon: import_icon.WarningIcon, colorScheme: "red" },
|
|
41
|
+
loading: { icon: import_loading.Loading, colorScheme: "blue" }
|
|
42
|
+
};
|
|
43
|
+
var [AlertProvider, useAlert] = (0, import_utils.createContext)({
|
|
44
|
+
name: `AlertStylesContext`,
|
|
45
|
+
errorMessage: `useAlert returned is 'undefined'. Seems you forgot to wrap the components in "<Alert />" `
|
|
46
|
+
});
|
|
47
|
+
var getStatusColorScheme = (status) => statuses[status].colorScheme;
|
|
48
|
+
var getStatusIcon = (status) => statuses[status].icon;
|
|
49
|
+
var Alert = (0, import_core.forwardRef)(
|
|
50
|
+
({ status = "info", colorScheme, ...props }, ref) => {
|
|
51
|
+
colorScheme = colorScheme != null ? colorScheme : getStatusColorScheme(status);
|
|
52
|
+
const [styles, mergedProps] = (0, import_core.useMultiComponentStyle)("Alert", { ...props, colorScheme });
|
|
53
|
+
const { className, children, ...rest } = (0, import_core.omitThemeProps)(mergedProps);
|
|
54
|
+
const css = {
|
|
55
|
+
w: "100%",
|
|
56
|
+
display: "flex",
|
|
57
|
+
alignItems: "center",
|
|
58
|
+
position: "relative",
|
|
59
|
+
overflow: "hidden",
|
|
60
|
+
...styles.container
|
|
61
|
+
};
|
|
62
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertProvider, { value: { status, styles }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ui.div, { ref, className: (0, import_utils.cx)("ui-alert", className), __css: css, ...rest, children }) });
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
var AlertIcon = ({ className, children, variant = "oval", ...rest }) => {
|
|
66
|
+
const { status, styles } = useAlert();
|
|
67
|
+
const Icon = getStatusIcon(status);
|
|
68
|
+
const css = {
|
|
69
|
+
...status === "loading" ? styles.loading : styles.icon
|
|
70
|
+
};
|
|
71
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ui.span, { display: "inherit", className: (0, import_utils.cx)("ui-alert-icon", className), __css: css, ...rest, children: children || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
72
|
+
Icon,
|
|
73
|
+
{
|
|
74
|
+
boxSize: "100%",
|
|
75
|
+
...status === "loading" ? { variant, color: "currentcolor" } : {}
|
|
76
|
+
}
|
|
77
|
+
) });
|
|
78
|
+
};
|
|
79
|
+
var AlertTitle = (0, import_core.forwardRef)(({ className, ...rest }, ref) => {
|
|
80
|
+
const { styles } = useAlert();
|
|
81
|
+
const css = {
|
|
82
|
+
display: "block",
|
|
83
|
+
...styles.title
|
|
84
|
+
};
|
|
85
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ui.p, { ref, className: (0, import_utils.cx)("ui-alert-title", className), __css: css, ...rest });
|
|
86
|
+
});
|
|
87
|
+
var AlertDescription = (0, import_core.forwardRef)(
|
|
88
|
+
({ className, ...rest }, ref) => {
|
|
89
|
+
const { styles } = useAlert();
|
|
90
|
+
const css = {
|
|
91
|
+
...styles.description
|
|
92
|
+
};
|
|
93
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ui.span, { ref, className: (0, import_utils.cx)("ui-alert-desc", className), __css: css, ...rest });
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
97
|
+
0 && (module.exports = {
|
|
98
|
+
Alert,
|
|
99
|
+
AlertDescription,
|
|
100
|
+
AlertIcon,
|
|
101
|
+
AlertTitle,
|
|
102
|
+
getStatusColorScheme,
|
|
103
|
+
getStatusIcon
|
|
104
|
+
});
|
package/dist/alert.mjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Alert,
|
|
3
|
+
AlertDescription,
|
|
4
|
+
AlertIcon,
|
|
5
|
+
AlertTitle,
|
|
6
|
+
getStatusColorScheme,
|
|
7
|
+
getStatusIcon
|
|
8
|
+
} from "./chunk-2AJTREQZ.mjs";
|
|
9
|
+
export {
|
|
10
|
+
Alert,
|
|
11
|
+
AlertDescription,
|
|
12
|
+
AlertIcon,
|
|
13
|
+
AlertTitle,
|
|
14
|
+
getStatusColorScheme,
|
|
15
|
+
getStatusIcon
|
|
16
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// src/alert.tsx
|
|
2
|
+
import {
|
|
3
|
+
ui,
|
|
4
|
+
forwardRef,
|
|
5
|
+
useMultiComponentStyle,
|
|
6
|
+
omitThemeProps
|
|
7
|
+
} from "@yamada-ui/core";
|
|
8
|
+
import { InfoIcon, WarningIcon, CheckIcon } from "@yamada-ui/icon";
|
|
9
|
+
import { Loading } from "@yamada-ui/loading";
|
|
10
|
+
import { createContext, cx } from "@yamada-ui/utils";
|
|
11
|
+
import { jsx } from "react/jsx-runtime";
|
|
12
|
+
var statuses = {
|
|
13
|
+
info: { icon: InfoIcon, colorScheme: "blue" },
|
|
14
|
+
success: { icon: CheckIcon, colorScheme: "green" },
|
|
15
|
+
warning: { icon: WarningIcon, colorScheme: "orange" },
|
|
16
|
+
error: { icon: WarningIcon, colorScheme: "red" },
|
|
17
|
+
loading: { icon: Loading, colorScheme: "blue" }
|
|
18
|
+
};
|
|
19
|
+
var [AlertProvider, useAlert] = createContext({
|
|
20
|
+
name: `AlertStylesContext`,
|
|
21
|
+
errorMessage: `useAlert returned is 'undefined'. Seems you forgot to wrap the components in "<Alert />" `
|
|
22
|
+
});
|
|
23
|
+
var getStatusColorScheme = (status) => statuses[status].colorScheme;
|
|
24
|
+
var getStatusIcon = (status) => statuses[status].icon;
|
|
25
|
+
var Alert = forwardRef(
|
|
26
|
+
({ status = "info", colorScheme, ...props }, ref) => {
|
|
27
|
+
colorScheme = colorScheme != null ? colorScheme : getStatusColorScheme(status);
|
|
28
|
+
const [styles, mergedProps] = useMultiComponentStyle("Alert", { ...props, colorScheme });
|
|
29
|
+
const { className, children, ...rest } = omitThemeProps(mergedProps);
|
|
30
|
+
const css = {
|
|
31
|
+
w: "100%",
|
|
32
|
+
display: "flex",
|
|
33
|
+
alignItems: "center",
|
|
34
|
+
position: "relative",
|
|
35
|
+
overflow: "hidden",
|
|
36
|
+
...styles.container
|
|
37
|
+
};
|
|
38
|
+
return /* @__PURE__ */ jsx(AlertProvider, { value: { status, styles }, children: /* @__PURE__ */ jsx(ui.div, { ref, className: cx("ui-alert", className), __css: css, ...rest, children }) });
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
var AlertIcon = ({ className, children, variant = "oval", ...rest }) => {
|
|
42
|
+
const { status, styles } = useAlert();
|
|
43
|
+
const Icon = getStatusIcon(status);
|
|
44
|
+
const css = {
|
|
45
|
+
...status === "loading" ? styles.loading : styles.icon
|
|
46
|
+
};
|
|
47
|
+
return /* @__PURE__ */ jsx(ui.span, { display: "inherit", className: cx("ui-alert-icon", className), __css: css, ...rest, children: children || /* @__PURE__ */ jsx(
|
|
48
|
+
Icon,
|
|
49
|
+
{
|
|
50
|
+
boxSize: "100%",
|
|
51
|
+
...status === "loading" ? { variant, color: "currentcolor" } : {}
|
|
52
|
+
}
|
|
53
|
+
) });
|
|
54
|
+
};
|
|
55
|
+
var AlertTitle = forwardRef(({ className, ...rest }, ref) => {
|
|
56
|
+
const { styles } = useAlert();
|
|
57
|
+
const css = {
|
|
58
|
+
display: "block",
|
|
59
|
+
...styles.title
|
|
60
|
+
};
|
|
61
|
+
return /* @__PURE__ */ jsx(ui.p, { ref, className: cx("ui-alert-title", className), __css: css, ...rest });
|
|
62
|
+
});
|
|
63
|
+
var AlertDescription = forwardRef(
|
|
64
|
+
({ className, ...rest }, ref) => {
|
|
65
|
+
const { styles } = useAlert();
|
|
66
|
+
const css = {
|
|
67
|
+
...styles.description
|
|
68
|
+
};
|
|
69
|
+
return /* @__PURE__ */ jsx(ui.span, { ref, className: cx("ui-alert-desc", className), __css: css, ...rest });
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
export {
|
|
74
|
+
getStatusColorScheme,
|
|
75
|
+
getStatusIcon,
|
|
76
|
+
Alert,
|
|
77
|
+
AlertIcon,
|
|
78
|
+
AlertTitle,
|
|
79
|
+
AlertDescription
|
|
80
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Alert, AlertDescription, AlertDescriptionProps, AlertIcon, AlertIconProps, AlertProps, AlertTitle, AlertTitleProps, getStatusColorScheme, getStatusIcon } from './alert.js';
|
|
2
|
+
import 'react/jsx-runtime';
|
|
3
|
+
import '@yamada-ui/core';
|
|
4
|
+
import 'react';
|
|
5
|
+
import '@yamada-ui/icon';
|
|
6
|
+
import '@yamada-ui/loading';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
Alert: () => Alert,
|
|
24
|
+
AlertDescription: () => AlertDescription,
|
|
25
|
+
AlertIcon: () => AlertIcon,
|
|
26
|
+
AlertTitle: () => AlertTitle,
|
|
27
|
+
getStatusColorScheme: () => getStatusColorScheme,
|
|
28
|
+
getStatusIcon: () => getStatusIcon
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(src_exports);
|
|
31
|
+
|
|
32
|
+
// src/alert.tsx
|
|
33
|
+
var import_core = require("@yamada-ui/core");
|
|
34
|
+
var import_icon = require("@yamada-ui/icon");
|
|
35
|
+
var import_loading = require("@yamada-ui/loading");
|
|
36
|
+
var import_utils = require("@yamada-ui/utils");
|
|
37
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
+
var statuses = {
|
|
39
|
+
info: { icon: import_icon.InfoIcon, colorScheme: "blue" },
|
|
40
|
+
success: { icon: import_icon.CheckIcon, colorScheme: "green" },
|
|
41
|
+
warning: { icon: import_icon.WarningIcon, colorScheme: "orange" },
|
|
42
|
+
error: { icon: import_icon.WarningIcon, colorScheme: "red" },
|
|
43
|
+
loading: { icon: import_loading.Loading, colorScheme: "blue" }
|
|
44
|
+
};
|
|
45
|
+
var [AlertProvider, useAlert] = (0, import_utils.createContext)({
|
|
46
|
+
name: `AlertStylesContext`,
|
|
47
|
+
errorMessage: `useAlert returned is 'undefined'. Seems you forgot to wrap the components in "<Alert />" `
|
|
48
|
+
});
|
|
49
|
+
var getStatusColorScheme = (status) => statuses[status].colorScheme;
|
|
50
|
+
var getStatusIcon = (status) => statuses[status].icon;
|
|
51
|
+
var Alert = (0, import_core.forwardRef)(
|
|
52
|
+
({ status = "info", colorScheme, ...props }, ref) => {
|
|
53
|
+
colorScheme = colorScheme != null ? colorScheme : getStatusColorScheme(status);
|
|
54
|
+
const [styles, mergedProps] = (0, import_core.useMultiComponentStyle)("Alert", { ...props, colorScheme });
|
|
55
|
+
const { className, children, ...rest } = (0, import_core.omitThemeProps)(mergedProps);
|
|
56
|
+
const css = {
|
|
57
|
+
w: "100%",
|
|
58
|
+
display: "flex",
|
|
59
|
+
alignItems: "center",
|
|
60
|
+
position: "relative",
|
|
61
|
+
overflow: "hidden",
|
|
62
|
+
...styles.container
|
|
63
|
+
};
|
|
64
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertProvider, { value: { status, styles }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ui.div, { ref, className: (0, import_utils.cx)("ui-alert", className), __css: css, ...rest, children }) });
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
var AlertIcon = ({ className, children, variant = "oval", ...rest }) => {
|
|
68
|
+
const { status, styles } = useAlert();
|
|
69
|
+
const Icon = getStatusIcon(status);
|
|
70
|
+
const css = {
|
|
71
|
+
...status === "loading" ? styles.loading : styles.icon
|
|
72
|
+
};
|
|
73
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ui.span, { display: "inherit", className: (0, import_utils.cx)("ui-alert-icon", className), __css: css, ...rest, children: children || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
74
|
+
Icon,
|
|
75
|
+
{
|
|
76
|
+
boxSize: "100%",
|
|
77
|
+
...status === "loading" ? { variant, color: "currentcolor" } : {}
|
|
78
|
+
}
|
|
79
|
+
) });
|
|
80
|
+
};
|
|
81
|
+
var AlertTitle = (0, import_core.forwardRef)(({ className, ...rest }, ref) => {
|
|
82
|
+
const { styles } = useAlert();
|
|
83
|
+
const css = {
|
|
84
|
+
display: "block",
|
|
85
|
+
...styles.title
|
|
86
|
+
};
|
|
87
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ui.p, { ref, className: (0, import_utils.cx)("ui-alert-title", className), __css: css, ...rest });
|
|
88
|
+
});
|
|
89
|
+
var AlertDescription = (0, import_core.forwardRef)(
|
|
90
|
+
({ className, ...rest }, ref) => {
|
|
91
|
+
const { styles } = useAlert();
|
|
92
|
+
const css = {
|
|
93
|
+
...styles.description
|
|
94
|
+
};
|
|
95
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ui.span, { ref, className: (0, import_utils.cx)("ui-alert-desc", className), __css: css, ...rest });
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
99
|
+
0 && (module.exports = {
|
|
100
|
+
Alert,
|
|
101
|
+
AlertDescription,
|
|
102
|
+
AlertIcon,
|
|
103
|
+
AlertTitle,
|
|
104
|
+
getStatusColorScheme,
|
|
105
|
+
getStatusIcon
|
|
106
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Alert,
|
|
3
|
+
AlertDescription,
|
|
4
|
+
AlertIcon,
|
|
5
|
+
AlertTitle,
|
|
6
|
+
getStatusColorScheme,
|
|
7
|
+
getStatusIcon
|
|
8
|
+
} from "./chunk-2AJTREQZ.mjs";
|
|
9
|
+
export {
|
|
10
|
+
Alert,
|
|
11
|
+
AlertDescription,
|
|
12
|
+
AlertIcon,
|
|
13
|
+
AlertTitle,
|
|
14
|
+
getStatusColorScheme,
|
|
15
|
+
getStatusIcon
|
|
16
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@yamada-ui/alert",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Yamada UI alert component",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"yamada",
|
|
7
|
+
"yamada ui",
|
|
8
|
+
"react",
|
|
9
|
+
"emotion",
|
|
10
|
+
"component",
|
|
11
|
+
"alert",
|
|
12
|
+
"ui",
|
|
13
|
+
"uikit",
|
|
14
|
+
"styled",
|
|
15
|
+
"style-props",
|
|
16
|
+
"styled-component",
|
|
17
|
+
"css-in-js"
|
|
18
|
+
],
|
|
19
|
+
"author": "Hirotomo Yamada <hirotomo.yamada@avap.co.jp>",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"main": "dist/index.js",
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"sideEffects": false,
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/hirotomoyamada/yamada-ui",
|
|
32
|
+
"directory": "packages/components/alert"
|
|
33
|
+
},
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/hirotomoyamada/yamada-ui/issues"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@yamada-ui/icon": "0.1.0",
|
|
39
|
+
"@yamada-ui/core": "0.1.0",
|
|
40
|
+
"@yamada-ui/utils": "0.1.0",
|
|
41
|
+
"@yamada-ui/loading": "0.1.0"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"react": "^18.0.0",
|
|
45
|
+
"clean-package": "2.2.0"
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"react": ">=18"
|
|
49
|
+
},
|
|
50
|
+
"clean-package": "../../../clean-package.config.json",
|
|
51
|
+
"tsup": {
|
|
52
|
+
"clean": true,
|
|
53
|
+
"target": "es2019",
|
|
54
|
+
"format": [
|
|
55
|
+
"cjs",
|
|
56
|
+
"esm"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"module": "dist/index.mjs",
|
|
60
|
+
"types": "dist/index.d.ts",
|
|
61
|
+
"exports": {
|
|
62
|
+
".": {
|
|
63
|
+
"types": "./dist/index.d.ts",
|
|
64
|
+
"import": "./dist/index.mjs",
|
|
65
|
+
"require": "./dist/index.js"
|
|
66
|
+
},
|
|
67
|
+
"./package.json": "./package.json"
|
|
68
|
+
},
|
|
69
|
+
"scripts": {
|
|
70
|
+
"dev": "pnpm build:fast -- --watch",
|
|
71
|
+
"build": "tsup src --dts",
|
|
72
|
+
"build:fast": "tsup src",
|
|
73
|
+
"clean": "rimraf dist .turbo",
|
|
74
|
+
"typecheck": "tsc --noEmit",
|
|
75
|
+
"gen:docs": "tsx ../../../scripts/generate-docs"
|
|
76
|
+
}
|
|
77
|
+
}
|