@yamada-ui/alert 0.5.2 → 0.5.4

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/dist/alert.d.mts CHANGED
@@ -1,13 +1,13 @@
1
1
  import * as _yamada_ui_core from '@yamada-ui/core';
2
- import { HTMLUIProps, ThemeProps } from '@yamada-ui/core';
2
+ import { AlertStatuses, HTMLUIProps, ThemeProps } from '@yamada-ui/core';
3
3
  import * as _yamada_ui_icon from '@yamada-ui/icon';
4
4
  import { LoadingProps } from '@yamada-ui/loading';
5
5
  import { FC } from 'react';
6
6
 
7
- declare const statuses: {
7
+ declare const defaultStatuses: {
8
8
  readonly info: {
9
9
  readonly icon: FC<_yamada_ui_icon.IconProps>;
10
- readonly colorScheme: "primary";
10
+ readonly colorScheme: "info";
11
11
  };
12
12
  readonly success: {
13
13
  readonly icon: FC<_yamada_ui_icon.IconProps>;
@@ -26,9 +26,9 @@ declare const statuses: {
26
26
  readonly colorScheme: "primary";
27
27
  };
28
28
  };
29
- type Status = keyof typeof statuses;
30
- declare const getStatusColorScheme: (status: Status) => "primary" | "success" | "warning" | "danger";
31
- declare const getStatusIcon: (status: Status) => FC<_yamada_ui_icon.IconProps> | _yamada_ui_core.Component<"svg", LoadingProps>;
29
+ type Status = keyof typeof defaultStatuses;
30
+ declare const getStatusColorScheme: (status: Status, statuses?: AlertStatuses) => "link" | (string & {}) | "info" | "success" | "warning" | "danger" | "blue" | "cyan" | "fuchsia" | "gray" | "green" | "indigo" | "lime" | "orange" | "pink" | "purple" | "red" | "teal" | "violet" | "yellow" | "primary" | "secondary" | "whiteAlpha" | "blackAlpha" | "zinc" | "neutral" | "stone" | "rose" | "amber" | "emerald" | "sky";
31
+ declare const getStatusIcon: (status: Status, statuses?: AlertStatuses) => FC<_yamada_ui_icon.IconProps> | _yamada_ui_core.Component<"svg", LoadingProps> | FC;
32
32
  type AlertOptions = {
33
33
  /**
34
34
  * The status of the alert.
package/dist/alert.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import * as _yamada_ui_core from '@yamada-ui/core';
2
- import { HTMLUIProps, ThemeProps } from '@yamada-ui/core';
2
+ import { AlertStatuses, HTMLUIProps, ThemeProps } from '@yamada-ui/core';
3
3
  import * as _yamada_ui_icon from '@yamada-ui/icon';
4
4
  import { LoadingProps } from '@yamada-ui/loading';
5
5
  import { FC } from 'react';
6
6
 
7
- declare const statuses: {
7
+ declare const defaultStatuses: {
8
8
  readonly info: {
9
9
  readonly icon: FC<_yamada_ui_icon.IconProps>;
10
- readonly colorScheme: "primary";
10
+ readonly colorScheme: "info";
11
11
  };
12
12
  readonly success: {
13
13
  readonly icon: FC<_yamada_ui_icon.IconProps>;
@@ -26,9 +26,9 @@ declare const statuses: {
26
26
  readonly colorScheme: "primary";
27
27
  };
28
28
  };
29
- type Status = keyof typeof statuses;
30
- declare const getStatusColorScheme: (status: Status) => "primary" | "success" | "warning" | "danger";
31
- declare const getStatusIcon: (status: Status) => FC<_yamada_ui_icon.IconProps> | _yamada_ui_core.Component<"svg", LoadingProps>;
29
+ type Status = keyof typeof defaultStatuses;
30
+ declare const getStatusColorScheme: (status: Status, statuses?: AlertStatuses) => "link" | (string & {}) | "info" | "success" | "warning" | "danger" | "blue" | "cyan" | "fuchsia" | "gray" | "green" | "indigo" | "lime" | "orange" | "pink" | "purple" | "red" | "teal" | "violet" | "yellow" | "primary" | "secondary" | "whiteAlpha" | "blackAlpha" | "zinc" | "neutral" | "stone" | "rose" | "amber" | "emerald" | "sky";
31
+ declare const getStatusIcon: (status: Status, statuses?: AlertStatuses) => FC<_yamada_ui_icon.IconProps> | _yamada_ui_core.Component<"svg", LoadingProps> | FC;
32
32
  type AlertOptions = {
33
33
  /**
34
34
  * The status of the alert.
package/dist/alert.js CHANGED
@@ -34,8 +34,8 @@ var import_icon = require("@yamada-ui/icon");
34
34
  var import_loading = require("@yamada-ui/loading");
35
35
  var import_utils = require("@yamada-ui/utils");
36
36
  var import_jsx_runtime = require("react/jsx-runtime");
37
- var statuses = {
38
- info: { icon: import_icon.InfoIcon, colorScheme: "primary" },
37
+ var defaultStatuses = {
38
+ info: { icon: import_icon.InfoIcon, colorScheme: "info" },
39
39
  success: { icon: import_icon.CheckIcon, colorScheme: "success" },
40
40
  warning: { icon: import_icon.WarningIcon, colorScheme: "warning" },
41
41
  error: { icon: import_icon.WarningIcon, colorScheme: "danger" },
@@ -45,11 +45,20 @@ var [AlertProvider, useAlert] = (0, import_utils.createContext)({
45
45
  name: `AlertStylesContext`,
46
46
  errorMessage: `useAlert returned is 'undefined'. Seems you forgot to wrap the components in "<Alert />" `
47
47
  });
48
- var getStatusColorScheme = (status) => statuses[status].colorScheme;
49
- var getStatusIcon = (status) => statuses[status].icon;
48
+ var getStatusColorScheme = (status, statuses) => {
49
+ var _a, _b;
50
+ return (_b = (_a = statuses == null ? void 0 : statuses[status]) == null ? void 0 : _a.colorScheme) != null ? _b : defaultStatuses[status].colorScheme;
51
+ };
52
+ var getStatusIcon = (status, statuses) => {
53
+ var _a, _b;
54
+ return (_b = (_a = statuses == null ? void 0 : statuses[status]) == null ? void 0 : _a.icon) != null ? _b : defaultStatuses[status].icon;
55
+ };
50
56
  var Alert = (0, import_core.forwardRef)(
51
57
  ({ status = "info", colorScheme, ...props }, ref) => {
52
- colorScheme = colorScheme != null ? colorScheme : getStatusColorScheme(status);
58
+ var _a, _b, _c;
59
+ const { theme } = (0, import_core.useTheme)();
60
+ const statuses = (_c = (_b = (_a = theme.__config) == null ? void 0 : _a.alert) == null ? void 0 : _b.statuses) != null ? _c : {};
61
+ colorScheme = colorScheme != null ? colorScheme : getStatusColorScheme(status, statuses);
53
62
  const [styles, mergedProps] = (0, import_core.useMultiComponentStyle)("Alert", {
54
63
  ...props,
55
64
  colorScheme
@@ -82,8 +91,11 @@ var AlertIcon = ({
82
91
  variant = "oval",
83
92
  ...rest
84
93
  }) => {
94
+ var _a, _b, _c;
85
95
  const { status, styles } = useAlert();
86
- const Icon = getStatusIcon(status);
96
+ const { theme } = (0, import_core.useTheme)();
97
+ const statuses = (_c = (_b = (_a = theme.__config) == null ? void 0 : _a.alert) == null ? void 0 : _b.statuses) != null ? _c : {};
98
+ const Icon = getStatusIcon(status, statuses);
87
99
  const css = {
88
100
  ...status === "loading" ? styles.loading : styles.icon
89
101
  };
package/dist/alert.mjs CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  AlertTitle,
7
7
  getStatusColorScheme,
8
8
  getStatusIcon
9
- } from "./chunk-RAB3N7WN.mjs";
9
+ } from "./chunk-3X7FYNVJ.mjs";
10
10
  export {
11
11
  Alert,
12
12
  AlertDescription,
@@ -5,14 +5,15 @@ import {
5
5
  ui,
6
6
  forwardRef,
7
7
  useMultiComponentStyle,
8
- omitThemeProps
8
+ omitThemeProps,
9
+ useTheme
9
10
  } from "@yamada-ui/core";
10
11
  import { InfoIcon, WarningIcon, CheckIcon } from "@yamada-ui/icon";
11
12
  import { Loading } from "@yamada-ui/loading";
12
13
  import { createContext, cx } from "@yamada-ui/utils";
13
14
  import { jsx } from "react/jsx-runtime";
14
- var statuses = {
15
- info: { icon: InfoIcon, colorScheme: "primary" },
15
+ var defaultStatuses = {
16
+ info: { icon: InfoIcon, colorScheme: "info" },
16
17
  success: { icon: CheckIcon, colorScheme: "success" },
17
18
  warning: { icon: WarningIcon, colorScheme: "warning" },
18
19
  error: { icon: WarningIcon, colorScheme: "danger" },
@@ -22,11 +23,20 @@ var [AlertProvider, useAlert] = createContext({
22
23
  name: `AlertStylesContext`,
23
24
  errorMessage: `useAlert returned is 'undefined'. Seems you forgot to wrap the components in "<Alert />" `
24
25
  });
25
- var getStatusColorScheme = (status) => statuses[status].colorScheme;
26
- var getStatusIcon = (status) => statuses[status].icon;
26
+ var getStatusColorScheme = (status, statuses) => {
27
+ var _a, _b;
28
+ return (_b = (_a = statuses == null ? void 0 : statuses[status]) == null ? void 0 : _a.colorScheme) != null ? _b : defaultStatuses[status].colorScheme;
29
+ };
30
+ var getStatusIcon = (status, statuses) => {
31
+ var _a, _b;
32
+ return (_b = (_a = statuses == null ? void 0 : statuses[status]) == null ? void 0 : _a.icon) != null ? _b : defaultStatuses[status].icon;
33
+ };
27
34
  var Alert = forwardRef(
28
35
  ({ status = "info", colorScheme, ...props }, ref) => {
29
- colorScheme = colorScheme != null ? colorScheme : getStatusColorScheme(status);
36
+ var _a, _b, _c;
37
+ const { theme } = useTheme();
38
+ const statuses = (_c = (_b = (_a = theme.__config) == null ? void 0 : _a.alert) == null ? void 0 : _b.statuses) != null ? _c : {};
39
+ colorScheme = colorScheme != null ? colorScheme : getStatusColorScheme(status, statuses);
30
40
  const [styles, mergedProps] = useMultiComponentStyle("Alert", {
31
41
  ...props,
32
42
  colorScheme
@@ -59,8 +69,11 @@ var AlertIcon = ({
59
69
  variant = "oval",
60
70
  ...rest
61
71
  }) => {
72
+ var _a, _b, _c;
62
73
  const { status, styles } = useAlert();
63
- const Icon = getStatusIcon(status);
74
+ const { theme } = useTheme();
75
+ const statuses = (_c = (_b = (_a = theme.__config) == null ? void 0 : _a.alert) == null ? void 0 : _b.statuses) != null ? _c : {};
76
+ const Icon = getStatusIcon(status, statuses);
64
77
  const css = {
65
78
  ...status === "loading" ? styles.loading : styles.icon
66
79
  };
package/dist/index.js CHANGED
@@ -34,8 +34,8 @@ var import_icon = require("@yamada-ui/icon");
34
34
  var import_loading = require("@yamada-ui/loading");
35
35
  var import_utils = require("@yamada-ui/utils");
36
36
  var import_jsx_runtime = require("react/jsx-runtime");
37
- var statuses = {
38
- info: { icon: import_icon.InfoIcon, colorScheme: "primary" },
37
+ var defaultStatuses = {
38
+ info: { icon: import_icon.InfoIcon, colorScheme: "info" },
39
39
  success: { icon: import_icon.CheckIcon, colorScheme: "success" },
40
40
  warning: { icon: import_icon.WarningIcon, colorScheme: "warning" },
41
41
  error: { icon: import_icon.WarningIcon, colorScheme: "danger" },
@@ -45,11 +45,20 @@ var [AlertProvider, useAlert] = (0, import_utils.createContext)({
45
45
  name: `AlertStylesContext`,
46
46
  errorMessage: `useAlert returned is 'undefined'. Seems you forgot to wrap the components in "<Alert />" `
47
47
  });
48
- var getStatusColorScheme = (status) => statuses[status].colorScheme;
49
- var getStatusIcon = (status) => statuses[status].icon;
48
+ var getStatusColorScheme = (status, statuses) => {
49
+ var _a, _b;
50
+ return (_b = (_a = statuses == null ? void 0 : statuses[status]) == null ? void 0 : _a.colorScheme) != null ? _b : defaultStatuses[status].colorScheme;
51
+ };
52
+ var getStatusIcon = (status, statuses) => {
53
+ var _a, _b;
54
+ return (_b = (_a = statuses == null ? void 0 : statuses[status]) == null ? void 0 : _a.icon) != null ? _b : defaultStatuses[status].icon;
55
+ };
50
56
  var Alert = (0, import_core.forwardRef)(
51
57
  ({ status = "info", colorScheme, ...props }, ref) => {
52
- colorScheme = colorScheme != null ? colorScheme : getStatusColorScheme(status);
58
+ var _a, _b, _c;
59
+ const { theme } = (0, import_core.useTheme)();
60
+ const statuses = (_c = (_b = (_a = theme.__config) == null ? void 0 : _a.alert) == null ? void 0 : _b.statuses) != null ? _c : {};
61
+ colorScheme = colorScheme != null ? colorScheme : getStatusColorScheme(status, statuses);
53
62
  const [styles, mergedProps] = (0, import_core.useMultiComponentStyle)("Alert", {
54
63
  ...props,
55
64
  colorScheme
@@ -82,8 +91,11 @@ var AlertIcon = ({
82
91
  variant = "oval",
83
92
  ...rest
84
93
  }) => {
94
+ var _a, _b, _c;
85
95
  const { status, styles } = useAlert();
86
- const Icon = getStatusIcon(status);
96
+ const { theme } = (0, import_core.useTheme)();
97
+ const statuses = (_c = (_b = (_a = theme.__config) == null ? void 0 : _a.alert) == null ? void 0 : _b.statuses) != null ? _c : {};
98
+ const Icon = getStatusIcon(status, statuses);
87
99
  const css = {
88
100
  ...status === "loading" ? styles.loading : styles.icon
89
101
  };
package/dist/index.mjs CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  AlertDescription,
5
5
  AlertIcon,
6
6
  AlertTitle
7
- } from "./chunk-RAB3N7WN.mjs";
7
+ } from "./chunk-3X7FYNVJ.mjs";
8
8
  export {
9
9
  Alert,
10
10
  AlertDescription,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yamada-ui/alert",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "Yamada UI alert component",
5
5
  "keywords": [
6
6
  "yamada",
@@ -35,10 +35,10 @@
35
35
  "url": "https://github.com/hirotomoyamada/yamada-ui/issues"
36
36
  },
37
37
  "dependencies": {
38
- "@yamada-ui/core": "0.11.2",
38
+ "@yamada-ui/core": "0.12.0",
39
39
  "@yamada-ui/utils": "0.3.0",
40
- "@yamada-ui/icon": "0.3.8",
41
- "@yamada-ui/loading": "0.4.8"
40
+ "@yamada-ui/icon": "0.3.10",
41
+ "@yamada-ui/loading": "0.4.10"
42
42
  },
43
43
  "devDependencies": {
44
44
  "react": "^18.0.0",