@yamada-ui/alert 1.1.3-dev-20241110150258 → 1.1.3-dev-20241111191457
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/alert.d.mts +6 -30
- package/dist/alert.d.ts +6 -30
- package/dist/alert.js.map +1 -1
- package/dist/alert.mjs +1 -1
- package/dist/{chunk-TZEWAS6E.mjs → chunk-SBLMAKL3.mjs} +1 -1
- package/dist/chunk-SBLMAKL3.mjs.map +1 -0
- package/dist/index.d.mts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +4 -4
- package/dist/chunk-TZEWAS6E.mjs.map +0 -1
package/dist/alert.d.mts
CHANGED
@@ -1,41 +1,17 @@
|
|
1
|
-
import * as react from 'react';
|
2
1
|
import * as _yamada_ui_core from '@yamada-ui/core';
|
3
|
-
import { AlertStatuses, HTMLUIProps, ThemeProps, FC } from '@yamada-ui/core';
|
4
|
-
import * as _yamada_ui_lucide_src_lucide_icon from '@yamada-ui/lucide/src/lucide-icon';
|
2
|
+
import { AlertStatus, AlertStatuses, HTMLUIProps, ThemeProps, FC } from '@yamada-ui/core';
|
5
3
|
import { LoadingProps } from '@yamada-ui/loading';
|
4
|
+
import { ComponentType } from 'react';
|
6
5
|
|
7
|
-
declare const
|
8
|
-
|
9
|
-
readonly colorScheme: "danger";
|
10
|
-
readonly icon: _yamada_ui_core.Component<"svg", _yamada_ui_lucide_src_lucide_icon.LucideIconProps>;
|
11
|
-
};
|
12
|
-
readonly info: {
|
13
|
-
readonly colorScheme: "info";
|
14
|
-
readonly icon: _yamada_ui_core.Component<"svg", _yamada_ui_lucide_src_lucide_icon.LucideIconProps>;
|
15
|
-
};
|
16
|
-
readonly loading: {
|
17
|
-
readonly colorScheme: "primary";
|
18
|
-
readonly icon: _yamada_ui_core.Component<"svg", LoadingProps>;
|
19
|
-
};
|
20
|
-
readonly success: {
|
21
|
-
readonly colorScheme: "success";
|
22
|
-
readonly icon: _yamada_ui_core.Component<"svg", _yamada_ui_lucide_src_lucide_icon.LucideIconProps>;
|
23
|
-
};
|
24
|
-
readonly warning: {
|
25
|
-
readonly colorScheme: "warning";
|
26
|
-
readonly icon: _yamada_ui_core.Component<"svg", _yamada_ui_lucide_src_lucide_icon.LucideIconProps>;
|
27
|
-
};
|
28
|
-
};
|
29
|
-
type Status = keyof typeof defaultStatuses;
|
30
|
-
declare const getStatusColorScheme: (status: Status, statuses?: AlertStatuses) => "danger" | "link" | "info" | "primary" | "success" | "warning" | "amber" | "blackAlpha" | "blue" | "cyan" | "emerald" | "flashy" | "fuchsia" | "gray" | "green" | "indigo" | "lime" | "neutral" | "orange" | "pink" | "purple" | "red" | "rose" | "secondary" | "sky" | "teal" | "violet" | "whiteAlpha" | "yellow" | ({} & string);
|
31
|
-
declare const getStatusIcon: (status: Status, statuses?: AlertStatuses) => _yamada_ui_core.Component<"svg", _yamada_ui_lucide_src_lucide_icon.LucideIconProps> | _yamada_ui_core.Component<"svg", LoadingProps> | react.FC;
|
6
|
+
declare const getStatusColorScheme: (status: AlertStatus, statuses?: AlertStatuses) => string;
|
7
|
+
declare const getStatusIcon: (status: AlertStatus, statuses?: AlertStatuses) => ComponentType<any>;
|
32
8
|
interface AlertOptions {
|
33
9
|
/**
|
34
10
|
* The status of the alert.
|
35
11
|
*
|
36
12
|
* @default 'info'
|
37
13
|
*/
|
38
|
-
status?:
|
14
|
+
status?: AlertStatus;
|
39
15
|
}
|
40
16
|
interface AlertProps extends HTMLUIProps, ThemeProps<"Alert">, AlertOptions {
|
41
17
|
}
|
@@ -56,4 +32,4 @@ interface AlertDescriptionProps extends HTMLUIProps<"span"> {
|
|
56
32
|
}
|
57
33
|
declare const AlertDescription: _yamada_ui_core.Component<"span", AlertDescriptionProps>;
|
58
34
|
|
59
|
-
export { Alert, AlertDescription, type AlertDescriptionProps, AlertIcon, type AlertIconProps, type AlertProps, AlertTitle, type AlertTitleProps,
|
35
|
+
export { Alert, AlertDescription, type AlertDescriptionProps, AlertIcon, type AlertIconProps, type AlertProps, AlertTitle, type AlertTitleProps, getStatusColorScheme, getStatusIcon };
|
package/dist/alert.d.ts
CHANGED
@@ -1,41 +1,17 @@
|
|
1
|
-
import * as react from 'react';
|
2
1
|
import * as _yamada_ui_core from '@yamada-ui/core';
|
3
|
-
import { AlertStatuses, HTMLUIProps, ThemeProps, FC } from '@yamada-ui/core';
|
4
|
-
import * as _yamada_ui_lucide_src_lucide_icon from '@yamada-ui/lucide/src/lucide-icon';
|
2
|
+
import { AlertStatus, AlertStatuses, HTMLUIProps, ThemeProps, FC } from '@yamada-ui/core';
|
5
3
|
import { LoadingProps } from '@yamada-ui/loading';
|
4
|
+
import { ComponentType } from 'react';
|
6
5
|
|
7
|
-
declare const
|
8
|
-
|
9
|
-
readonly colorScheme: "danger";
|
10
|
-
readonly icon: _yamada_ui_core.Component<"svg", _yamada_ui_lucide_src_lucide_icon.LucideIconProps>;
|
11
|
-
};
|
12
|
-
readonly info: {
|
13
|
-
readonly colorScheme: "info";
|
14
|
-
readonly icon: _yamada_ui_core.Component<"svg", _yamada_ui_lucide_src_lucide_icon.LucideIconProps>;
|
15
|
-
};
|
16
|
-
readonly loading: {
|
17
|
-
readonly colorScheme: "primary";
|
18
|
-
readonly icon: _yamada_ui_core.Component<"svg", LoadingProps>;
|
19
|
-
};
|
20
|
-
readonly success: {
|
21
|
-
readonly colorScheme: "success";
|
22
|
-
readonly icon: _yamada_ui_core.Component<"svg", _yamada_ui_lucide_src_lucide_icon.LucideIconProps>;
|
23
|
-
};
|
24
|
-
readonly warning: {
|
25
|
-
readonly colorScheme: "warning";
|
26
|
-
readonly icon: _yamada_ui_core.Component<"svg", _yamada_ui_lucide_src_lucide_icon.LucideIconProps>;
|
27
|
-
};
|
28
|
-
};
|
29
|
-
type Status = keyof typeof defaultStatuses;
|
30
|
-
declare const getStatusColorScheme: (status: Status, statuses?: AlertStatuses) => "danger" | "link" | "info" | "primary" | "success" | "warning" | "amber" | "blackAlpha" | "blue" | "cyan" | "emerald" | "flashy" | "fuchsia" | "gray" | "green" | "indigo" | "lime" | "neutral" | "orange" | "pink" | "purple" | "red" | "rose" | "secondary" | "sky" | "teal" | "violet" | "whiteAlpha" | "yellow" | ({} & string);
|
31
|
-
declare const getStatusIcon: (status: Status, statuses?: AlertStatuses) => _yamada_ui_core.Component<"svg", _yamada_ui_lucide_src_lucide_icon.LucideIconProps> | _yamada_ui_core.Component<"svg", LoadingProps> | react.FC;
|
6
|
+
declare const getStatusColorScheme: (status: AlertStatus, statuses?: AlertStatuses) => string;
|
7
|
+
declare const getStatusIcon: (status: AlertStatus, statuses?: AlertStatuses) => ComponentType<any>;
|
32
8
|
interface AlertOptions {
|
33
9
|
/**
|
34
10
|
* The status of the alert.
|
35
11
|
*
|
36
12
|
* @default 'info'
|
37
13
|
*/
|
38
|
-
status?:
|
14
|
+
status?: AlertStatus;
|
39
15
|
}
|
40
16
|
interface AlertProps extends HTMLUIProps, ThemeProps<"Alert">, AlertOptions {
|
41
17
|
}
|
@@ -56,4 +32,4 @@ interface AlertDescriptionProps extends HTMLUIProps<"span"> {
|
|
56
32
|
}
|
57
33
|
declare const AlertDescription: _yamada_ui_core.Component<"span", AlertDescriptionProps>;
|
58
34
|
|
59
|
-
export { Alert, AlertDescription, type AlertDescriptionProps, AlertIcon, type AlertIconProps, type AlertProps, AlertTitle, type AlertTitleProps,
|
35
|
+
export { Alert, AlertDescription, type AlertDescriptionProps, AlertIcon, type AlertIconProps, type AlertProps, AlertTitle, type AlertTitleProps, getStatusColorScheme, getStatusIcon };
|
package/dist/alert.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/alert.tsx"],"sourcesContent":["import type {\n AlertStatuses,\n CSSUIObject,\n FC,\n HTMLUIProps,\n ThemeProps,\n} from \"@yamada-ui/core\"\nimport type { LoadingProps } from \"@yamada-ui/loading\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n useTheme,\n} from \"@yamada-ui/core\"\nimport { Loading } from \"@yamada-ui/loading\"\nimport {\n CircleCheckBigIcon,\n InfoIcon,\n TriangleAlertIcon,\n} from \"@yamada-ui/lucide\"\nimport { createContext, cx } from \"@yamada-ui/utils\"\n\nconst defaultStatuses = {\n error: { colorScheme: \"danger\", icon: TriangleAlertIcon },\n info: { colorScheme: \"info\", icon: InfoIcon },\n loading: { colorScheme: \"primary\", icon: Loading },\n success: { colorScheme: \"success\", icon: CircleCheckBigIcon },\n warning: { colorScheme: \"warning\", icon: TriangleAlertIcon },\n} as const\n\
|
1
|
+
{"version":3,"sources":["../src/alert.tsx"],"sourcesContent":["import type {\n AlertStatus,\n AlertStatuses,\n CSSUIObject,\n FC,\n HTMLUIProps,\n ThemeProps,\n} from \"@yamada-ui/core\"\nimport type { LoadingProps } from \"@yamada-ui/loading\"\nimport type { ComponentType } from \"react\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n useTheme,\n} from \"@yamada-ui/core\"\nimport { Loading } from \"@yamada-ui/loading\"\nimport {\n CircleCheckBigIcon,\n InfoIcon,\n TriangleAlertIcon,\n} from \"@yamada-ui/lucide\"\nimport { createContext, cx } from \"@yamada-ui/utils\"\n\nconst defaultStatuses = {\n error: { colorScheme: \"danger\", icon: TriangleAlertIcon },\n info: { colorScheme: \"info\", icon: InfoIcon },\n loading: { colorScheme: \"primary\", icon: Loading },\n success: { colorScheme: \"success\", icon: CircleCheckBigIcon },\n warning: { colorScheme: \"warning\", icon: TriangleAlertIcon },\n} as const\n\ninterface AlertContext {\n status: AlertStatus\n styles: { [key: string]: CSSUIObject | undefined }\n}\n\nconst [AlertProvider, useAlert] = createContext<AlertContext>({\n name: `AlertStylesContext`,\n errorMessage: `useAlert returned is 'undefined'. Seems you forgot to wrap the components in \"<Alert />\" `,\n})\n\nexport const getStatusColorScheme = (\n status: AlertStatus,\n statuses?: AlertStatuses,\n): string =>\n statuses?.[status]?.colorScheme ?? defaultStatuses[status].colorScheme\n\nexport const getStatusIcon = (\n status: AlertStatus,\n statuses?: AlertStatuses,\n): ComponentType<any> =>\n statuses?.[status]?.icon ?? defaultStatuses[status].icon\n\ninterface AlertOptions {\n /**\n * The status of the alert.\n *\n * @default 'info'\n */\n status?: AlertStatus\n}\n\nexport interface AlertProps\n extends HTMLUIProps,\n ThemeProps<\"Alert\">,\n AlertOptions {}\n\n/**\n * `Alert` is a component that conveys information to the user.\n *\n * @see Docs https://yamada-ui.com/components/feedback/alert\n */\nexport const Alert = forwardRef<AlertProps, \"div\">(\n ({ colorScheme, status = \"info\", ...props }, ref) => {\n const { theme } = useTheme()\n const statuses = theme.__config?.alert?.statuses ?? {}\n\n colorScheme ??= getStatusColorScheme(status, statuses)\n\n const [styles, mergedProps] = useComponentMultiStyle(\"Alert\", {\n ...props,\n colorScheme,\n })\n const { className, children, ...rest } = omitThemeProps(mergedProps)\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"flex\",\n overflow: \"hidden\",\n position: \"relative\",\n w: \"100%\",\n ...styles.container,\n }\n\n return (\n <AlertProvider value={{ status, styles }}>\n <ui.div\n ref={ref}\n className={cx(\"ui-alert\", className)}\n role=\"alert\"\n __css={css}\n {...rest}\n >\n {children}\n </ui.div>\n </AlertProvider>\n )\n },\n)\n\nAlert.displayName = \"Alert\"\nAlert.__ui__ = \"Alert\"\n\nexport interface AlertIconProps extends HTMLUIProps<\"span\"> {\n variant?: LoadingProps[\"variant\"]\n}\n\nexport const AlertIcon: FC<AlertIconProps> = ({\n className,\n variant = \"oval\",\n children,\n ...rest\n}) => {\n const { status, styles } = useAlert()\n const { theme } = useTheme()\n const statuses = theme.__config?.alert?.statuses ?? {}\n\n const Icon = getStatusIcon(status, statuses)\n const css: CSSUIObject = {\n ...styles.icon,\n ...(status === \"loading\" ? styles.loading : {}),\n }\n\n return (\n <ui.span\n className={cx(\"ui-alert__icon\", className)}\n display=\"inherit\"\n __css={css}\n {...rest}\n >\n {children || (\n <Icon\n {...(status === \"loading\"\n ? { variant, color: \"currentcolor\" }\n : { boxSize: \"100%\" })}\n />\n )}\n </ui.span>\n )\n}\n\nAlertIcon.displayName = \"AlertIcon\"\nAlertIcon.__ui__ = \"AlertIcon\"\n\nexport interface AlertTitleProps extends HTMLUIProps<\"p\"> {}\n\nexport const AlertTitle = forwardRef<AlertTitleProps, \"p\">(\n ({ className, ...rest }, ref) => {\n const { styles } = useAlert()\n\n const css: CSSUIObject = {\n display: \"block\",\n ...styles.title,\n }\n\n return (\n <ui.p\n ref={ref}\n className={cx(\"ui-alert__title\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nAlertTitle.displayName = \"AlertTitle\"\nAlertTitle.__ui__ = \"AlertTitle\"\n\nexport interface AlertDescriptionProps extends HTMLUIProps<\"span\"> {}\n\nexport const AlertDescription = forwardRef<AlertDescriptionProps, \"span\">(\n ({ className, ...rest }, ref) => {\n const { styles } = useAlert()\n\n const css: CSSUIObject = {\n ...styles.description,\n }\n\n return (\n <ui.span\n ref={ref}\n className={cx(\"ui-alert__desc\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nAlertDescription.displayName = \"AlertDescription\"\nAlertDescription.__ui__ = \"AlertDescription\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,kBAMO;AACP,qBAAwB;AACxB,oBAIO;AACP,mBAAkC;AA2E1B;AAzER,IAAM,kBAAkB;AAAA,EACtB,OAAO,EAAE,aAAa,UAAU,MAAM,gCAAkB;AAAA,EACxD,MAAM,EAAE,aAAa,QAAQ,MAAM,uBAAS;AAAA,EAC5C,SAAS,EAAE,aAAa,WAAW,MAAM,uBAAQ;AAAA,EACjD,SAAS,EAAE,aAAa,WAAW,MAAM,iCAAmB;AAAA,EAC5D,SAAS,EAAE,aAAa,WAAW,MAAM,gCAAkB;AAC7D;AAOA,IAAM,CAAC,eAAe,QAAQ,QAAI,4BAA4B;AAAA,EAC5D,MAAM;AAAA,EACN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O;AAAA,QACN,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEA,iBAAiB,cAAc;AAC/B,iBAAiB,SAAS;","names":[]}
|
package/dist/alert.mjs
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/alert.tsx"],"sourcesContent":["import type {\n AlertStatus,\n AlertStatuses,\n CSSUIObject,\n FC,\n HTMLUIProps,\n ThemeProps,\n} from \"@yamada-ui/core\"\nimport type { LoadingProps } from \"@yamada-ui/loading\"\nimport type { ComponentType } from \"react\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n useTheme,\n} from \"@yamada-ui/core\"\nimport { Loading } from \"@yamada-ui/loading\"\nimport {\n CircleCheckBigIcon,\n InfoIcon,\n TriangleAlertIcon,\n} from \"@yamada-ui/lucide\"\nimport { createContext, cx } from \"@yamada-ui/utils\"\n\nconst defaultStatuses = {\n error: { colorScheme: \"danger\", icon: TriangleAlertIcon },\n info: { colorScheme: \"info\", icon: InfoIcon },\n loading: { colorScheme: \"primary\", icon: Loading },\n success: { colorScheme: \"success\", icon: CircleCheckBigIcon },\n warning: { colorScheme: \"warning\", icon: TriangleAlertIcon },\n} as const\n\ninterface AlertContext {\n status: AlertStatus\n styles: { [key: string]: CSSUIObject | undefined }\n}\n\nconst [AlertProvider, useAlert] = createContext<AlertContext>({\n name: `AlertStylesContext`,\n errorMessage: `useAlert returned is 'undefined'. Seems you forgot to wrap the components in \"<Alert />\" `,\n})\n\nexport const getStatusColorScheme = (\n status: AlertStatus,\n statuses?: AlertStatuses,\n): string =>\n statuses?.[status]?.colorScheme ?? defaultStatuses[status].colorScheme\n\nexport const getStatusIcon = (\n status: AlertStatus,\n statuses?: AlertStatuses,\n): ComponentType<any> =>\n statuses?.[status]?.icon ?? defaultStatuses[status].icon\n\ninterface AlertOptions {\n /**\n * The status of the alert.\n *\n * @default 'info'\n */\n status?: AlertStatus\n}\n\nexport interface AlertProps\n extends HTMLUIProps,\n ThemeProps<\"Alert\">,\n AlertOptions {}\n\n/**\n * `Alert` is a component that conveys information to the user.\n *\n * @see Docs https://yamada-ui.com/components/feedback/alert\n */\nexport const Alert = forwardRef<AlertProps, \"div\">(\n ({ colorScheme, status = \"info\", ...props }, ref) => {\n const { theme } = useTheme()\n const statuses = theme.__config?.alert?.statuses ?? {}\n\n colorScheme ??= getStatusColorScheme(status, statuses)\n\n const [styles, mergedProps] = useComponentMultiStyle(\"Alert\", {\n ...props,\n colorScheme,\n })\n const { className, children, ...rest } = omitThemeProps(mergedProps)\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"flex\",\n overflow: \"hidden\",\n position: \"relative\",\n w: \"100%\",\n ...styles.container,\n }\n\n return (\n <AlertProvider value={{ status, styles }}>\n <ui.div\n ref={ref}\n className={cx(\"ui-alert\", className)}\n role=\"alert\"\n __css={css}\n {...rest}\n >\n {children}\n </ui.div>\n </AlertProvider>\n )\n },\n)\n\nAlert.displayName = \"Alert\"\nAlert.__ui__ = \"Alert\"\n\nexport interface AlertIconProps extends HTMLUIProps<\"span\"> {\n variant?: LoadingProps[\"variant\"]\n}\n\nexport const AlertIcon: FC<AlertIconProps> = ({\n className,\n variant = \"oval\",\n children,\n ...rest\n}) => {\n const { status, styles } = useAlert()\n const { theme } = useTheme()\n const statuses = theme.__config?.alert?.statuses ?? {}\n\n const Icon = getStatusIcon(status, statuses)\n const css: CSSUIObject = {\n ...styles.icon,\n ...(status === \"loading\" ? styles.loading : {}),\n }\n\n return (\n <ui.span\n className={cx(\"ui-alert__icon\", className)}\n display=\"inherit\"\n __css={css}\n {...rest}\n >\n {children || (\n <Icon\n {...(status === \"loading\"\n ? { variant, color: \"currentcolor\" }\n : { boxSize: \"100%\" })}\n />\n )}\n </ui.span>\n )\n}\n\nAlertIcon.displayName = \"AlertIcon\"\nAlertIcon.__ui__ = \"AlertIcon\"\n\nexport interface AlertTitleProps extends HTMLUIProps<\"p\"> {}\n\nexport const AlertTitle = forwardRef<AlertTitleProps, \"p\">(\n ({ className, ...rest }, ref) => {\n const { styles } = useAlert()\n\n const css: CSSUIObject = {\n display: \"block\",\n ...styles.title,\n }\n\n return (\n <ui.p\n ref={ref}\n className={cx(\"ui-alert__title\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nAlertTitle.displayName = \"AlertTitle\"\nAlertTitle.__ui__ = \"AlertTitle\"\n\nexport interface AlertDescriptionProps extends HTMLUIProps<\"span\"> {}\n\nexport const AlertDescription = forwardRef<AlertDescriptionProps, \"span\">(\n ({ className, ...rest }, ref) => {\n const { styles } = useAlert()\n\n const css: CSSUIObject = {\n ...styles.description,\n }\n\n return (\n <ui.span\n ref={ref}\n className={cx(\"ui-alert__desc\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nAlertDescription.displayName = \"AlertDescription\"\nAlertDescription.__ui__ = \"AlertDescription\"\n"],"mappings":";;;AAUA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe;AACxB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe,UAAU;AA2E1B;AAzER,IAAM,kBAAkB;AAAA,EACtB,OAAO,EAAE,aAAa,UAAU,MAAM,kBAAkB;AAAA,EACxD,MAAM,EAAE,aAAa,QAAQ,MAAM,SAAS;AAAA,EAC5C,SAAS,EAAE,aAAa,WAAW,MAAM,QAAQ;AAAA,EACjD,SAAS,EAAE,aAAa,WAAW,MAAM,mBAAmB;AAAA,EAC5D,SAAS,EAAE,aAAa,WAAW,MAAM,kBAAkB;AAC7D;AAOA,IAAM,CAAC,eAAe,QAAQ,IAAI,cAA4B;AAAA,EAC5D,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAEM,IAAM,uBAAuB,CAClC,QACA,aACQ;AA9CV;AA+CE,0DAAW,YAAX,mBAAoB,gBAApB,YAAmC,gBAAgB,MAAM,EAAE;AAAA;AAEtD,IAAM,gBAAgB,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ert, AlertDescription, AlertDescriptionProps, AlertIcon, AlertIconProps, AlertProps, AlertTitle, AlertTitleProps } from './alert.mjs';
|
2
|
-
import 'react';
|
3
2
|
import '@yamada-ui/core';
|
4
|
-
import '@yamada-ui/lucide/src/lucide-icon';
|
5
3
|
import '@yamada-ui/loading';
|
4
|
+
import 'react';
|
package/dist/index.d.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
export { Alert, AlertDescription, AlertDescriptionProps, AlertIcon, AlertIconProps, AlertProps, AlertTitle, AlertTitleProps } from './alert.js';
|
2
|
-
import 'react';
|
3
2
|
import '@yamada-ui/core';
|
4
|
-
import '@yamada-ui/lucide/src/lucide-icon';
|
5
3
|
import '@yamada-ui/loading';
|
4
|
+
import 'react';
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/alert.tsx"],"sourcesContent":["export { Alert, AlertDescription, AlertIcon, AlertTitle } from \"./alert\"\nexport type {\n AlertDescriptionProps,\n AlertIconProps,\n AlertProps,\n AlertTitleProps,\n} from \"./alert\"\n","import type {\n AlertStatuses,\n CSSUIObject,\n FC,\n HTMLUIProps,\n ThemeProps,\n} from \"@yamada-ui/core\"\nimport type { LoadingProps } from \"@yamada-ui/loading\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n useTheme,\n} from \"@yamada-ui/core\"\nimport { Loading } from \"@yamada-ui/loading\"\nimport {\n CircleCheckBigIcon,\n InfoIcon,\n TriangleAlertIcon,\n} from \"@yamada-ui/lucide\"\nimport { createContext, cx } from \"@yamada-ui/utils\"\n\nconst defaultStatuses = {\n error: { colorScheme: \"danger\", icon: TriangleAlertIcon },\n info: { colorScheme: \"info\", icon: InfoIcon },\n loading: { colorScheme: \"primary\", icon: Loading },\n success: { colorScheme: \"success\", icon: CircleCheckBigIcon },\n warning: { colorScheme: \"warning\", icon: TriangleAlertIcon },\n} as const\n\
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/alert.tsx"],"sourcesContent":["export { Alert, AlertDescription, AlertIcon, AlertTitle } from \"./alert\"\nexport type {\n AlertDescriptionProps,\n AlertIconProps,\n AlertProps,\n AlertTitleProps,\n} from \"./alert\"\n","import type {\n AlertStatus,\n AlertStatuses,\n CSSUIObject,\n FC,\n HTMLUIProps,\n ThemeProps,\n} from \"@yamada-ui/core\"\nimport type { LoadingProps } from \"@yamada-ui/loading\"\nimport type { ComponentType } from \"react\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n useTheme,\n} from \"@yamada-ui/core\"\nimport { Loading } from \"@yamada-ui/loading\"\nimport {\n CircleCheckBigIcon,\n InfoIcon,\n TriangleAlertIcon,\n} from \"@yamada-ui/lucide\"\nimport { createContext, cx } from \"@yamada-ui/utils\"\n\nconst defaultStatuses = {\n error: { colorScheme: \"danger\", icon: TriangleAlertIcon },\n info: { colorScheme: \"info\", icon: InfoIcon },\n loading: { colorScheme: \"primary\", icon: Loading },\n success: { colorScheme: \"success\", icon: CircleCheckBigIcon },\n warning: { colorScheme: \"warning\", icon: TriangleAlertIcon },\n} as const\n\ninterface AlertContext {\n status: AlertStatus\n styles: { [key: string]: CSSUIObject | undefined }\n}\n\nconst [AlertProvider, useAlert] = createContext<AlertContext>({\n name: `AlertStylesContext`,\n errorMessage: `useAlert returned is 'undefined'. Seems you forgot to wrap the components in \"<Alert />\" `,\n})\n\nexport const getStatusColorScheme = (\n status: AlertStatus,\n statuses?: AlertStatuses,\n): string =>\n statuses?.[status]?.colorScheme ?? defaultStatuses[status].colorScheme\n\nexport const getStatusIcon = (\n status: AlertStatus,\n statuses?: AlertStatuses,\n): ComponentType<any> =>\n statuses?.[status]?.icon ?? defaultStatuses[status].icon\n\ninterface AlertOptions {\n /**\n * The status of the alert.\n *\n * @default 'info'\n */\n status?: AlertStatus\n}\n\nexport interface AlertProps\n extends HTMLUIProps,\n ThemeProps<\"Alert\">,\n AlertOptions {}\n\n/**\n * `Alert` is a component that conveys information to the user.\n *\n * @see Docs https://yamada-ui.com/components/feedback/alert\n */\nexport const Alert = forwardRef<AlertProps, \"div\">(\n ({ colorScheme, status = \"info\", ...props }, ref) => {\n const { theme } = useTheme()\n const statuses = theme.__config?.alert?.statuses ?? {}\n\n colorScheme ??= getStatusColorScheme(status, statuses)\n\n const [styles, mergedProps] = useComponentMultiStyle(\"Alert\", {\n ...props,\n colorScheme,\n })\n const { className, children, ...rest } = omitThemeProps(mergedProps)\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"flex\",\n overflow: \"hidden\",\n position: \"relative\",\n w: \"100%\",\n ...styles.container,\n }\n\n return (\n <AlertProvider value={{ status, styles }}>\n <ui.div\n ref={ref}\n className={cx(\"ui-alert\", className)}\n role=\"alert\"\n __css={css}\n {...rest}\n >\n {children}\n </ui.div>\n </AlertProvider>\n )\n },\n)\n\nAlert.displayName = \"Alert\"\nAlert.__ui__ = \"Alert\"\n\nexport interface AlertIconProps extends HTMLUIProps<\"span\"> {\n variant?: LoadingProps[\"variant\"]\n}\n\nexport const AlertIcon: FC<AlertIconProps> = ({\n className,\n variant = \"oval\",\n children,\n ...rest\n}) => {\n const { status, styles } = useAlert()\n const { theme } = useTheme()\n const statuses = theme.__config?.alert?.statuses ?? {}\n\n const Icon = getStatusIcon(status, statuses)\n const css: CSSUIObject = {\n ...styles.icon,\n ...(status === \"loading\" ? styles.loading : {}),\n }\n\n return (\n <ui.span\n className={cx(\"ui-alert__icon\", className)}\n display=\"inherit\"\n __css={css}\n {...rest}\n >\n {children || (\n <Icon\n {...(status === \"loading\"\n ? { variant, color: \"currentcolor\" }\n : { boxSize: \"100%\" })}\n />\n )}\n </ui.span>\n )\n}\n\nAlertIcon.displayName = \"AlertIcon\"\nAlertIcon.__ui__ = \"AlertIcon\"\n\nexport interface AlertTitleProps extends HTMLUIProps<\"p\"> {}\n\nexport const AlertTitle = forwardRef<AlertTitleProps, \"p\">(\n ({ className, ...rest }, ref) => {\n const { styles } = useAlert()\n\n const css: CSSUIObject = {\n display: \"block\",\n ...styles.title,\n }\n\n return (\n <ui.p\n ref={ref}\n className={cx(\"ui-alert__title\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nAlertTitle.displayName = \"AlertTitle\"\nAlertTitle.__ui__ = \"AlertTitle\"\n\nexport interface AlertDescriptionProps extends HTMLUIProps<\"span\"> {}\n\nexport const AlertDescription = forwardRef<AlertDescriptionProps, \"span\">(\n ({ className, ...rest }, ref) => {\n const { styles } = useAlert()\n\n const css: CSSUIObject = {\n ...styles.description,\n }\n\n return (\n <ui.span\n ref={ref}\n className={cx(\"ui-alert__desc\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nAlertDescription.displayName = \"AlertDescription\"\nAlertDescription.__ui__ = \"AlertDescription\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACUA,kBAMO;AACP,qBAAwB;AACxB,oBAIO;AACP,mBAAkC;AA2E1B;AAzER,IAAM,kBAAkB;AAAA,EACtB,OAAO,EAAE,aAAa,UAAU,MAAM,gCAAkB;AAAA,EACxD,MAAM,EAAE,aAAa,QAAQ,MAAM,uBAAS;AAAA,EAC5C,SAAS,EAAE,aAAa,WAAW,MAAM,uBAAQ;AAAA,EACjD,SAAS,EAAE,aAAa,WAAW,MAAM,iCAAmB;AAAA,EAC5D,SAAS,EAAE,aAAa,WAAW,MAAM,gCAAkB;AAC7D;AAOA,IAAM,CAAC,eAAe,QAAQ,QAAI,4BAA4B;AAAA,EAC5D,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAEM,IAAM,uBAAuB,CAClC,QACA,aACQ;AA9CV;AA+CE,0DAAW,YAAX,mBAAoB,gBAApB,YAAmC,gBAAgB,MAAM,EAAE;AAAA;AAEtD,IAAM,gBAAgB,CAC3B,QACA,aACoB;AApDtB;AAqDE,0DAAW,YAAX,mBAAoB,SAApB,YAA4B,gBAAgB,MA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3
|
+
"version": "1.1.3-dev-20241111191457",
|
4
4
|
"description": "Yamada UI alert component",
|
5
5
|
"keywords": [
|
6
6
|
"yamada",
|
@@ -36,9 +36,9 @@
|
|
36
36
|
"url": "https://github.com/yamada-ui/yamada-ui/issues"
|
37
37
|
},
|
38
38
|
"dependencies": {
|
39
|
-
"@yamada-ui/core": "1.15.5-dev-
|
40
|
-
"@yamada-ui/lucide": "1.8.0-dev-
|
41
|
-
"@yamada-ui/loading": "1.1.23-dev-
|
39
|
+
"@yamada-ui/core": "1.15.5-dev-20241111191457",
|
40
|
+
"@yamada-ui/lucide": "1.8.0-dev-20241111191457",
|
41
|
+
"@yamada-ui/loading": "1.1.23-dev-20241111191457",
|
42
42
|
"@yamada-ui/utils": "1.5.4"
|
43
43
|
},
|
44
44
|
"devDependencies": {
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/alert.tsx"],"sourcesContent":["import type {\n AlertStatuses,\n CSSUIObject,\n FC,\n HTMLUIProps,\n ThemeProps,\n} from \"@yamada-ui/core\"\nimport type { LoadingProps } from \"@yamada-ui/loading\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n useTheme,\n} from \"@yamada-ui/core\"\nimport { Loading } from \"@yamada-ui/loading\"\nimport {\n CircleCheckBigIcon,\n InfoIcon,\n TriangleAlertIcon,\n} from \"@yamada-ui/lucide\"\nimport { createContext, cx } from \"@yamada-ui/utils\"\n\nconst defaultStatuses = {\n error: { colorScheme: \"danger\", icon: TriangleAlertIcon },\n info: { colorScheme: \"info\", icon: InfoIcon },\n loading: { colorScheme: \"primary\", icon: Loading },\n success: { colorScheme: \"success\", icon: CircleCheckBigIcon },\n warning: { colorScheme: \"warning\", icon: TriangleAlertIcon },\n} as const\n\nexport type Status = keyof typeof defaultStatuses\n\ninterface AlertContext {\n status: Status\n styles: { [key: string]: CSSUIObject | undefined }\n}\n\nconst [AlertProvider, useAlert] = createContext<AlertContext>({\n name: `AlertStylesContext`,\n errorMessage: `useAlert returned is 'undefined'. Seems you forgot to wrap the components in \"<Alert />\" `,\n})\n\nexport const getStatusColorScheme = (\n status: Status,\n statuses?: AlertStatuses,\n) => statuses?.[status]?.colorScheme ?? defaultStatuses[status].colorScheme\n\nexport const getStatusIcon = (status: Status, statuses?: AlertStatuses) =>\n statuses?.[status]?.icon ?? defaultStatuses[status].icon\n\ninterface AlertOptions {\n /**\n * The status of the alert.\n *\n * @default 'info'\n */\n status?: Status\n}\n\nexport interface AlertProps\n extends HTMLUIProps,\n ThemeProps<\"Alert\">,\n AlertOptions {}\n\n/**\n * `Alert` is a component that conveys information to the user.\n *\n * @see Docs https://yamada-ui.com/components/feedback/alert\n */\nexport const Alert = forwardRef<AlertProps, \"div\">(\n ({ colorScheme, status = \"info\", ...props }, ref) => {\n const { theme } = useTheme()\n const statuses = theme.__config?.alert?.statuses ?? {}\n\n colorScheme ??= getStatusColorScheme(status, statuses)\n\n const [styles, mergedProps] = useComponentMultiStyle(\"Alert\", {\n ...props,\n colorScheme,\n })\n const { className, children, ...rest } = omitThemeProps(mergedProps)\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"flex\",\n overflow: \"hidden\",\n position: \"relative\",\n w: \"100%\",\n ...styles.container,\n }\n\n return (\n <AlertProvider value={{ status, styles }}>\n <ui.div\n ref={ref}\n className={cx(\"ui-alert\", className)}\n role=\"alert\"\n __css={css}\n {...rest}\n >\n {children}\n </ui.div>\n </AlertProvider>\n )\n },\n)\n\nAlert.displayName = \"Alert\"\nAlert.__ui__ = \"Alert\"\n\nexport interface AlertIconProps extends HTMLUIProps<\"span\"> {\n variant?: LoadingProps[\"variant\"]\n}\n\nexport const AlertIcon: FC<AlertIconProps> = ({\n className,\n variant = \"oval\",\n children,\n ...rest\n}) => {\n const { status, styles } = useAlert()\n const { theme } = useTheme()\n const statuses = theme.__config?.alert?.statuses ?? {}\n\n const Icon = getStatusIcon(status, statuses)\n const css: CSSUIObject = {\n ...styles.icon,\n ...(status === \"loading\" ? styles.loading : {}),\n }\n\n return (\n <ui.span\n className={cx(\"ui-alert__icon\", className)}\n display=\"inherit\"\n __css={css}\n {...rest}\n >\n {children || (\n <Icon\n {...(status === \"loading\"\n ? { variant, color: \"currentcolor\" }\n : { boxSize: \"100%\" })}\n />\n )}\n </ui.span>\n )\n}\n\nAlertIcon.displayName = \"AlertIcon\"\nAlertIcon.__ui__ = \"AlertIcon\"\n\nexport interface AlertTitleProps extends HTMLUIProps<\"p\"> {}\n\nexport const AlertTitle = forwardRef<AlertTitleProps, \"p\">(\n ({ className, ...rest }, ref) => {\n const { styles } = useAlert()\n\n const css: CSSUIObject = {\n display: \"block\",\n ...styles.title,\n }\n\n return (\n <ui.p\n ref={ref}\n className={cx(\"ui-alert__title\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nAlertTitle.displayName = \"AlertTitle\"\nAlertTitle.__ui__ = \"AlertTitle\"\n\nexport interface AlertDescriptionProps extends HTMLUIProps<\"span\"> {}\n\nexport const AlertDescription = forwardRef<AlertDescriptionProps, \"span\">(\n ({ className, ...rest }, ref) => {\n const { styles } = useAlert()\n\n const css: CSSUIObject = {\n ...styles.description,\n }\n\n return (\n <ui.span\n ref={ref}\n className={cx(\"ui-alert__desc\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nAlertDescription.displayName = \"AlertDescription\"\nAlertDescription.__ui__ = \"AlertDescription\"\n"],"mappings":";;;AAQA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe;AACxB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe,UAAU;AAyE1B;AAvER,IAAM,kBAAkB;AAAA,EACtB,OAAO,EAAE,aAAa,UAAU,MAAM,kBAAkB;AAAA,EACxD,MAAM,EAAE,aAAa,QAAQ,MAAM,SAAS;AAAA,EAC5C,SAAS,EAAE,aAAa,WAAW,MAAM,QAAQ;AAAA,E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