@fuf-stack/pixels 1.7.4 → 1.9.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.
Files changed (75) hide show
  1. package/dist/Alert/index.cjs +2 -2
  2. package/dist/Alert/index.d.cts +2 -2
  3. package/dist/Alert/index.d.ts +2 -2
  4. package/dist/Alert/index.js +1 -1
  5. package/dist/{Alert-Dc0RSQaB.d.cts → Alert-CWjAMyih.d.cts} +45 -69
  6. package/dist/{Alert-Dc0RSQaB.d.ts → Alert-CWjAMyih.d.ts} +45 -69
  7. package/dist/Avatar/index.d.cts +3 -2
  8. package/dist/Avatar/index.d.ts +3 -2
  9. package/dist/{Avatar-DjZ3H25h.d.cts → Avatar-DTg6mH8E.d.cts} +19 -18
  10. package/dist/{Avatar-DjZ3H25h.d.ts → Avatar-DTg6mH8E.d.ts} +19 -18
  11. package/dist/AvatarGroup/index.d.cts +4 -3
  12. package/dist/AvatarGroup/index.d.ts +4 -3
  13. package/dist/{AvatarGroup-B1Tdw57Q.d.ts → AvatarGroup-9wz1iZH4.d.ts} +1 -1
  14. package/dist/{AvatarGroup-BujXZ7Vy.d.cts → AvatarGroup-BYAaERBV.d.cts} +1 -1
  15. package/dist/Badge/index.d.cts +3 -2
  16. package/dist/Badge/index.d.ts +3 -2
  17. package/dist/{Badge-L8r9mgSs.d.cts → Badge-DkO-EJif.d.cts} +10 -9
  18. package/dist/{Badge-L8r9mgSs.d.ts → Badge-DkO-EJif.d.ts} +10 -9
  19. package/dist/Breadcrumb/index.d.cts +3 -2
  20. package/dist/Breadcrumb/index.d.ts +3 -2
  21. package/dist/{Breadcrumb-Cvt5Xa5D.d.cts → Breadcrumb-CW1qsIoL.d.cts} +22 -21
  22. package/dist/{Breadcrumb-Cvt5Xa5D.d.ts → Breadcrumb-CW1qsIoL.d.ts} +22 -21
  23. package/dist/Card/index.d.cts +3 -2
  24. package/dist/Card/index.d.ts +3 -2
  25. package/dist/{Card-OBRZ-ssX.d.cts → Card-2AwIQqnR.d.cts} +19 -18
  26. package/dist/{Card-OBRZ-ssX.d.ts → Card-2AwIQqnR.d.ts} +19 -18
  27. package/dist/Drawer/index.d.cts +3 -2
  28. package/dist/Drawer/index.d.ts +3 -2
  29. package/dist/{Drawer-JpihbwKl.d.cts → Drawer-Bd7lsUl9.d.cts} +25 -24
  30. package/dist/{Drawer-JpihbwKl.d.ts → Drawer-Bd7lsUl9.d.ts} +25 -24
  31. package/dist/Menu/index.d.cts +3 -2
  32. package/dist/Menu/index.d.ts +3 -2
  33. package/dist/{Menu-CS28E7nM.d.cts → Menu-C9M_q1Z6.d.cts} +10 -9
  34. package/dist/{Menu-CS28E7nM.d.ts → Menu-C9M_q1Z6.d.ts} +10 -9
  35. package/dist/Popover/index.d.cts +3 -2
  36. package/dist/Popover/index.d.ts +3 -2
  37. package/dist/{Popover-Bf192yqn.d.cts → Popover-DKzS6RUP.d.cts} +28 -27
  38. package/dist/{Popover-Bf192yqn.d.ts → Popover-DKzS6RUP.d.ts} +28 -27
  39. package/dist/SearchInput/index.d.cts +16 -15
  40. package/dist/SearchInput/index.d.ts +16 -15
  41. package/dist/Tabs/index.d.cts +3 -2
  42. package/dist/Tabs/index.d.ts +3 -2
  43. package/dist/{Tabs-BjMJs02F.d.cts → Tabs-BM4tl_1j.d.cts} +25 -24
  44. package/dist/{Tabs-BjMJs02F.d.ts → Tabs-BM4tl_1j.d.ts} +25 -24
  45. package/dist/Toast/index.cjs +3 -6
  46. package/dist/Toast/index.cjs.map +1 -1
  47. package/dist/Toast/index.d.cts +6 -5
  48. package/dist/Toast/index.d.ts +6 -5
  49. package/dist/Toast/index.js +7 -10
  50. package/dist/Toaster-BtcILj3f.d.ts +79 -0
  51. package/dist/Toaster-D28PKRWz.d.cts +79 -0
  52. package/dist/chunk-I5QMH3J5.cjs +96 -0
  53. package/dist/chunk-I5QMH3J5.cjs.map +1 -0
  54. package/dist/chunk-SDZX5VJZ.js +96 -0
  55. package/dist/chunk-SDZX5VJZ.js.map +1 -0
  56. package/dist/chunk-VD7VRLYO.js +112 -0
  57. package/dist/chunk-VD7VRLYO.js.map +1 -0
  58. package/dist/chunk-YWEUUA52.cjs +112 -0
  59. package/dist/chunk-YWEUUA52.cjs.map +1 -0
  60. package/dist/index.cjs +3 -7
  61. package/dist/index.cjs.map +1 -1
  62. package/dist/index.d.cts +13 -12
  63. package/dist/index.d.ts +13 -12
  64. package/dist/index.js +6 -10
  65. package/package.json +9 -8
  66. package/dist/ToastProvider-BaynjNgq.d.cts +0 -182
  67. package/dist/ToastProvider-BaynjNgq.d.ts +0 -182
  68. package/dist/chunk-565TFIAK.js +0 -135
  69. package/dist/chunk-565TFIAK.js.map +0 -1
  70. package/dist/chunk-56CIU4EG.cjs +0 -174
  71. package/dist/chunk-56CIU4EG.cjs.map +0 -1
  72. package/dist/chunk-7IFOMPCK.js +0 -174
  73. package/dist/chunk-7IFOMPCK.js.map +0 -1
  74. package/dist/chunk-K25U4BJO.cjs +0 -135
  75. package/dist/chunk-K25U4BJO.cjs.map +0 -1
@@ -0,0 +1,79 @@
1
+ import { ReactNode, ReactElement, ComponentProps } from 'react';
2
+ import { ExternalToast, Toaster as Toaster$1 } from 'sonner';
3
+ import { b as AlertProps } from './Alert-CWjAMyih.js';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
+
6
+ type AlertVariant = NonNullable<AlertProps['variant']>;
7
+ /** Props passed to a custom render function */
8
+ interface ToastRenderProps {
9
+ /** The toast message */
10
+ message: ReactNode;
11
+ /** The color/severity of the toast */
12
+ variant: AlertVariant;
13
+ /** Function to close the toast */
14
+ close: () => void;
15
+ /** Whether the toast can be closed by the user */
16
+ closable?: boolean;
17
+ /** Title displayed above the toast message */
18
+ title?: ReactNode;
19
+ /** Content displayed at the end of the toast */
20
+ endContent?: ReactNode;
21
+ /** Icon displayed at the start of the toast */
22
+ icon?: ReactNode;
23
+ }
24
+ /** Options passed to each toast method */
25
+ interface ToastOptions {
26
+ /** Title displayed above the toast message */
27
+ title?: ReactNode;
28
+ /** Whether the toast can be closed by the user */
29
+ closable?: boolean;
30
+ /** Duration in milliseconds before the toast auto-closes */
31
+ duration?: number;
32
+ /** Position of the toast on the screen */
33
+ position?: ExternalToast['position'];
34
+ /** Callback fired when the toast auto-closes */
35
+ onAutoClose?: ExternalToast['onAutoClose'];
36
+ /** Callback fired when the toast is closed */
37
+ onClose?: ExternalToast['onDismiss'];
38
+ /** Content displayed at the end of the toast */
39
+ endContent?: ReactNode;
40
+ /** Icon displayed at the start of the toast */
41
+ icon?: ReactNode;
42
+ /** Custom render function to override the default AlertComponent */
43
+ render?: (props: ToastRenderProps) => ReactElement;
44
+ }
45
+ /** Toast object with convenience methods for different severity levels */
46
+ declare const toast: {
47
+ /**
48
+ * Show a default toast.
49
+ * @returns The toast id which can be passed to `toast.close()`
50
+ */
51
+ default: (message: ReactNode, options?: ToastOptions) => string | number;
52
+ /**
53
+ * Show an info toast.
54
+ * @returns The toast id which can be passed to `toast.close()`
55
+ */
56
+ info: (message: ReactNode, options?: ToastOptions) => string | number;
57
+ /**
58
+ * Show a warning toast.
59
+ * @returns The toast id which can be passed to `toast.close()`
60
+ */
61
+ warn: (message: ReactNode, options?: ToastOptions) => string | number;
62
+ /**
63
+ * Show a success toast.
64
+ * @returns The toast id which can be passed to `toast.close()`
65
+ */
66
+ success: (message: ReactNode, options?: ToastOptions) => string | number;
67
+ /**
68
+ * Show an error toast.
69
+ * @returns The toast id which can be passed to `toast.close()`
70
+ */
71
+ error: (message: ReactNode, options?: ToastOptions) => string | number;
72
+ /** Close a toast by its id */
73
+ close: (toastId: string | number) => void;
74
+ };
75
+
76
+ type ToasterProps = Pick<ComponentProps<typeof Toaster$1>, 'visibleToasts' | 'position'>;
77
+ declare const Toaster: (props: ToasterProps) => react_jsx_runtime.JSX.Element;
78
+
79
+ export { Toaster as T, type ToastOptions as a, type ToastRenderProps as b, type ToasterProps as c, toast as t };
@@ -0,0 +1,79 @@
1
+ import { ReactNode, ReactElement, ComponentProps } from 'react';
2
+ import { ExternalToast, Toaster as Toaster$1 } from 'sonner';
3
+ import { b as AlertProps } from './Alert-CWjAMyih.cjs';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
+
6
+ type AlertVariant = NonNullable<AlertProps['variant']>;
7
+ /** Props passed to a custom render function */
8
+ interface ToastRenderProps {
9
+ /** The toast message */
10
+ message: ReactNode;
11
+ /** The color/severity of the toast */
12
+ variant: AlertVariant;
13
+ /** Function to close the toast */
14
+ close: () => void;
15
+ /** Whether the toast can be closed by the user */
16
+ closable?: boolean;
17
+ /** Title displayed above the toast message */
18
+ title?: ReactNode;
19
+ /** Content displayed at the end of the toast */
20
+ endContent?: ReactNode;
21
+ /** Icon displayed at the start of the toast */
22
+ icon?: ReactNode;
23
+ }
24
+ /** Options passed to each toast method */
25
+ interface ToastOptions {
26
+ /** Title displayed above the toast message */
27
+ title?: ReactNode;
28
+ /** Whether the toast can be closed by the user */
29
+ closable?: boolean;
30
+ /** Duration in milliseconds before the toast auto-closes */
31
+ duration?: number;
32
+ /** Position of the toast on the screen */
33
+ position?: ExternalToast['position'];
34
+ /** Callback fired when the toast auto-closes */
35
+ onAutoClose?: ExternalToast['onAutoClose'];
36
+ /** Callback fired when the toast is closed */
37
+ onClose?: ExternalToast['onDismiss'];
38
+ /** Content displayed at the end of the toast */
39
+ endContent?: ReactNode;
40
+ /** Icon displayed at the start of the toast */
41
+ icon?: ReactNode;
42
+ /** Custom render function to override the default AlertComponent */
43
+ render?: (props: ToastRenderProps) => ReactElement;
44
+ }
45
+ /** Toast object with convenience methods for different severity levels */
46
+ declare const toast: {
47
+ /**
48
+ * Show a default toast.
49
+ * @returns The toast id which can be passed to `toast.close()`
50
+ */
51
+ default: (message: ReactNode, options?: ToastOptions) => string | number;
52
+ /**
53
+ * Show an info toast.
54
+ * @returns The toast id which can be passed to `toast.close()`
55
+ */
56
+ info: (message: ReactNode, options?: ToastOptions) => string | number;
57
+ /**
58
+ * Show a warning toast.
59
+ * @returns The toast id which can be passed to `toast.close()`
60
+ */
61
+ warn: (message: ReactNode, options?: ToastOptions) => string | number;
62
+ /**
63
+ * Show a success toast.
64
+ * @returns The toast id which can be passed to `toast.close()`
65
+ */
66
+ success: (message: ReactNode, options?: ToastOptions) => string | number;
67
+ /**
68
+ * Show an error toast.
69
+ * @returns The toast id which can be passed to `toast.close()`
70
+ */
71
+ error: (message: ReactNode, options?: ToastOptions) => string | number;
72
+ /** Close a toast by its id */
73
+ close: (toastId: string | number) => void;
74
+ };
75
+
76
+ type ToasterProps = Pick<ComponentProps<typeof Toaster$1>, 'visibleToasts' | 'position'>;
77
+ declare const Toaster: (props: ToasterProps) => react_jsx_runtime.JSX.Element;
78
+
79
+ export { Toaster as T, type ToastOptions as a, type ToastRenderProps as b, type ToasterProps as c, toast as t };
@@ -0,0 +1,96 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/Alert/Alert.tsx
2
+ var _alert = require('@heroui/alert');
3
+ var _theme = require('@heroui/theme');
4
+ var _pixelutils = require('@fuf-stack/pixel-utils');
5
+ var _jsxruntime = require('react/jsx-runtime');
6
+ var alertVariants = _pixelutils.tv.call(void 0, {
7
+ slots: {
8
+ base: "min-w-72",
9
+ title: "",
10
+ description: "",
11
+ mainWrapper: "gap-1.5",
12
+ closeButton: "",
13
+ iconWrapper: "",
14
+ alertIcon: ""
15
+ },
16
+ variants: {
17
+ // if HeroUI Alert title and description are set the icon is placed on top (looks better)
18
+ hasTitleAndChildren: {
19
+ true: {
20
+ iconWrapper: "self-start"
21
+ }
22
+ },
23
+ // see: https://github.com/heroui-inc/heroui/blob/canary/packages/core/theme/src/components/alert.ts
24
+ variant: {
25
+ danger: {
26
+ base: "bg-danger-50 dark:bg-danger-50"
27
+ },
28
+ default: {
29
+ base: "bg-default-100 dark:bg-default-50"
30
+ },
31
+ info: {
32
+ alertIcon: "fill-current",
33
+ base: "border-small border-info-200 bg-info-50 text-info-600 dark:border-info-100 dark:bg-info-50",
34
+ closeButton: "text-info-500 data-[hover]:bg-info-200",
35
+ description: "text-inherit",
36
+ iconWrapper: "border-info-100 bg-info-50 dark:bg-info-100",
37
+ mainWrapper: "text-inherit",
38
+ title: "text-inherit"
39
+ },
40
+ success: {
41
+ base: "bg-success-50 dark:bg-success-50"
42
+ },
43
+ warning: {
44
+ base: "bg-warning-50 dark:bg-warning-50"
45
+ }
46
+ }
47
+ }
48
+ });
49
+ var Alert = ({
50
+ children = void 0,
51
+ className = void 0,
52
+ endContent = void 0,
53
+ icon = void 0,
54
+ closable = false,
55
+ onClose = void 0,
56
+ testId = void 0,
57
+ title = void 0,
58
+ variant = "info"
59
+ }) => {
60
+ const hasTitleAndChildren = !!children && !!title;
61
+ const variants = alertVariants({
62
+ hasTitleAndChildren,
63
+ variant
64
+ });
65
+ const classNames = _pixelutils.variantsToClassNames.call(void 0, variants, className, "base");
66
+ const heroColor = Object.keys(_theme.alert.variants.color).includes(
67
+ variant
68
+ ) ? variant : void 0;
69
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
70
+ _alert.Alert,
71
+ {
72
+ classNames,
73
+ color: heroColor,
74
+ "data-testid": testId,
75
+ description: title ? children : void 0,
76
+ endContent,
77
+ hideIcon: variant === "default",
78
+ icon,
79
+ isClosable: closable,
80
+ onClose,
81
+ title: title != null ? title : children,
82
+ variant: "faded"
83
+ }
84
+ );
85
+ };
86
+ var Alert_default = Alert;
87
+
88
+ // src/Alert/index.ts
89
+ var Alert_default2 = Alert_default;
90
+
91
+
92
+
93
+
94
+
95
+ exports.alertVariants = alertVariants; exports.Alert_default = Alert_default; exports.Alert_default2 = Alert_default2;
96
+ //# sourceMappingURL=chunk-I5QMH3J5.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/pixels/pixels/packages/pixels/dist/chunk-I5QMH3J5.cjs","../src/Alert/Alert.tsx","../src/Alert/index.ts"],"names":["Alert_default"],"mappings":"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","file":"/home/runner/work/pixels/pixels/packages/pixels/dist/chunk-I5QMH3J5.cjs","sourcesContent":[null,"import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { AlertProps as HeroAlertProps } from '@heroui/alert';\nimport type { ReactNode } from 'react';\n\nimport { Alert as HeroAlert } from '@heroui/alert';\nimport { alert as heroAlertVariants } from '@heroui/theme';\n\nimport { tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nexport const alertVariants = tv({\n slots: {\n base: 'min-w-72',\n title: '',\n description: '',\n mainWrapper: 'gap-1.5',\n closeButton: '',\n iconWrapper: '',\n alertIcon: '',\n },\n variants: {\n // if HeroUI Alert title and description are set the icon is placed on top (looks better)\n hasTitleAndChildren: {\n true: {\n iconWrapper: 'self-start',\n },\n },\n // see: https://github.com/heroui-inc/heroui/blob/canary/packages/core/theme/src/components/alert.ts\n variant: {\n danger: {\n base: 'bg-danger-50 dark:bg-danger-50',\n },\n default: {\n base: 'bg-default-100 dark:bg-default-50',\n },\n info: {\n alertIcon: 'fill-current',\n base: 'border-small border-info-200 bg-info-50 text-info-600 dark:border-info-100 dark:bg-info-50',\n closeButton: 'text-info-500 data-[hover]:bg-info-200',\n description: 'text-inherit',\n iconWrapper: 'border-info-100 bg-info-50 dark:bg-info-100',\n mainWrapper: 'text-inherit',\n title: 'text-inherit',\n },\n success: {\n base: 'bg-success-50 dark:bg-success-50',\n },\n warning: {\n base: 'bg-warning-50 dark:bg-warning-50',\n },\n },\n },\n});\n\nexport type VariantProps = TVProps<typeof alertVariants>;\ntype ClassName = TVClassName<typeof alertVariants>;\n\n// hasTitleAndChildren is omitted because its used for automatic icon position\nexport interface AlertProps extends Omit<VariantProps, 'hasTitleAndChildren'> {\n /** Content displayed inside the Alert if no description is given! */\n children?: ReactNode;\n /** CSS class name */\n className?: ClassName;\n /** Content displayed at the end of the Alert */\n endContent?: ReactNode;\n /** Icon displayed at the start of the Alert */\n icon?: ReactNode;\n /** Whether the Alert can be closed */\n closable?: boolean;\n /** Callback fired when the close button is clicked */\n onClose?: () => void;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** Title displayed in the Alert above the content */\n title?: ReactNode;\n /** Style variant of the Alert */\n variant?: VariantProps['variant'];\n}\n\n/**\n * Alert component based on [HeroUI Alert](https://www.heroui.com//docs/components/alert)\n */\nconst Alert = ({\n children = undefined,\n className = undefined,\n endContent = undefined,\n icon = undefined,\n closable = false,\n onClose = undefined,\n testId = undefined,\n title = undefined,\n variant = 'info',\n}: AlertProps) => {\n const hasTitleAndChildren = !!children && !!title;\n const variants = alertVariants({\n hasTitleAndChildren,\n variant,\n });\n const classNames = variantsToClassNames(variants, className, 'base');\n\n // map variant to HeroUI color prop (only for variants that exist in HeroUI)\n const heroColor = Object.keys(heroAlertVariants.variants.color).includes(\n variant,\n )\n ? (variant as HeroAlertProps['color'])\n : undefined;\n\n return (\n <HeroAlert\n classNames={classNames}\n color={heroColor}\n data-testid={testId}\n description={title ? children : undefined}\n endContent={endContent}\n hideIcon={variant === 'default'}\n icon={icon}\n // map closable to isClosable, because of we do not want \"is\" as prefix\n isClosable={closable}\n onClose={onClose}\n title={(title ?? children) as string}\n variant=\"faded\"\n />\n );\n};\n\nexport default Alert;\n","import Alert, { alertVariants } from './Alert';\n\nexport type { AlertProps } from './Alert';\n\nexport { Alert, alertVariants };\n\nexport default Alert;\n"]}
@@ -0,0 +1,96 @@
1
+ // src/Alert/Alert.tsx
2
+ import { Alert as HeroAlert } from "@heroui/alert";
3
+ import { alert as heroAlertVariants } from "@heroui/theme";
4
+ import { tv, variantsToClassNames } from "@fuf-stack/pixel-utils";
5
+ import { jsx } from "react/jsx-runtime";
6
+ var alertVariants = tv({
7
+ slots: {
8
+ base: "min-w-72",
9
+ title: "",
10
+ description: "",
11
+ mainWrapper: "gap-1.5",
12
+ closeButton: "",
13
+ iconWrapper: "",
14
+ alertIcon: ""
15
+ },
16
+ variants: {
17
+ // if HeroUI Alert title and description are set the icon is placed on top (looks better)
18
+ hasTitleAndChildren: {
19
+ true: {
20
+ iconWrapper: "self-start"
21
+ }
22
+ },
23
+ // see: https://github.com/heroui-inc/heroui/blob/canary/packages/core/theme/src/components/alert.ts
24
+ variant: {
25
+ danger: {
26
+ base: "bg-danger-50 dark:bg-danger-50"
27
+ },
28
+ default: {
29
+ base: "bg-default-100 dark:bg-default-50"
30
+ },
31
+ info: {
32
+ alertIcon: "fill-current",
33
+ base: "border-small border-info-200 bg-info-50 text-info-600 dark:border-info-100 dark:bg-info-50",
34
+ closeButton: "text-info-500 data-[hover]:bg-info-200",
35
+ description: "text-inherit",
36
+ iconWrapper: "border-info-100 bg-info-50 dark:bg-info-100",
37
+ mainWrapper: "text-inherit",
38
+ title: "text-inherit"
39
+ },
40
+ success: {
41
+ base: "bg-success-50 dark:bg-success-50"
42
+ },
43
+ warning: {
44
+ base: "bg-warning-50 dark:bg-warning-50"
45
+ }
46
+ }
47
+ }
48
+ });
49
+ var Alert = ({
50
+ children = void 0,
51
+ className = void 0,
52
+ endContent = void 0,
53
+ icon = void 0,
54
+ closable = false,
55
+ onClose = void 0,
56
+ testId = void 0,
57
+ title = void 0,
58
+ variant = "info"
59
+ }) => {
60
+ const hasTitleAndChildren = !!children && !!title;
61
+ const variants = alertVariants({
62
+ hasTitleAndChildren,
63
+ variant
64
+ });
65
+ const classNames = variantsToClassNames(variants, className, "base");
66
+ const heroColor = Object.keys(heroAlertVariants.variants.color).includes(
67
+ variant
68
+ ) ? variant : void 0;
69
+ return /* @__PURE__ */ jsx(
70
+ HeroAlert,
71
+ {
72
+ classNames,
73
+ color: heroColor,
74
+ "data-testid": testId,
75
+ description: title ? children : void 0,
76
+ endContent,
77
+ hideIcon: variant === "default",
78
+ icon,
79
+ isClosable: closable,
80
+ onClose,
81
+ title: title != null ? title : children,
82
+ variant: "faded"
83
+ }
84
+ );
85
+ };
86
+ var Alert_default = Alert;
87
+
88
+ // src/Alert/index.ts
89
+ var Alert_default2 = Alert_default;
90
+
91
+ export {
92
+ alertVariants,
93
+ Alert_default,
94
+ Alert_default2
95
+ };
96
+ //# sourceMappingURL=chunk-SDZX5VJZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/Alert/Alert.tsx","../src/Alert/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { AlertProps as HeroAlertProps } from '@heroui/alert';\nimport type { ReactNode } from 'react';\n\nimport { Alert as HeroAlert } from '@heroui/alert';\nimport { alert as heroAlertVariants } from '@heroui/theme';\n\nimport { tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nexport const alertVariants = tv({\n slots: {\n base: 'min-w-72',\n title: '',\n description: '',\n mainWrapper: 'gap-1.5',\n closeButton: '',\n iconWrapper: '',\n alertIcon: '',\n },\n variants: {\n // if HeroUI Alert title and description are set the icon is placed on top (looks better)\n hasTitleAndChildren: {\n true: {\n iconWrapper: 'self-start',\n },\n },\n // see: https://github.com/heroui-inc/heroui/blob/canary/packages/core/theme/src/components/alert.ts\n variant: {\n danger: {\n base: 'bg-danger-50 dark:bg-danger-50',\n },\n default: {\n base: 'bg-default-100 dark:bg-default-50',\n },\n info: {\n alertIcon: 'fill-current',\n base: 'border-small border-info-200 bg-info-50 text-info-600 dark:border-info-100 dark:bg-info-50',\n closeButton: 'text-info-500 data-[hover]:bg-info-200',\n description: 'text-inherit',\n iconWrapper: 'border-info-100 bg-info-50 dark:bg-info-100',\n mainWrapper: 'text-inherit',\n title: 'text-inherit',\n },\n success: {\n base: 'bg-success-50 dark:bg-success-50',\n },\n warning: {\n base: 'bg-warning-50 dark:bg-warning-50',\n },\n },\n },\n});\n\nexport type VariantProps = TVProps<typeof alertVariants>;\ntype ClassName = TVClassName<typeof alertVariants>;\n\n// hasTitleAndChildren is omitted because its used for automatic icon position\nexport interface AlertProps extends Omit<VariantProps, 'hasTitleAndChildren'> {\n /** Content displayed inside the Alert if no description is given! */\n children?: ReactNode;\n /** CSS class name */\n className?: ClassName;\n /** Content displayed at the end of the Alert */\n endContent?: ReactNode;\n /** Icon displayed at the start of the Alert */\n icon?: ReactNode;\n /** Whether the Alert can be closed */\n closable?: boolean;\n /** Callback fired when the close button is clicked */\n onClose?: () => void;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** Title displayed in the Alert above the content */\n title?: ReactNode;\n /** Style variant of the Alert */\n variant?: VariantProps['variant'];\n}\n\n/**\n * Alert component based on [HeroUI Alert](https://www.heroui.com//docs/components/alert)\n */\nconst Alert = ({\n children = undefined,\n className = undefined,\n endContent = undefined,\n icon = undefined,\n closable = false,\n onClose = undefined,\n testId = undefined,\n title = undefined,\n variant = 'info',\n}: AlertProps) => {\n const hasTitleAndChildren = !!children && !!title;\n const variants = alertVariants({\n hasTitleAndChildren,\n variant,\n });\n const classNames = variantsToClassNames(variants, className, 'base');\n\n // map variant to HeroUI color prop (only for variants that exist in HeroUI)\n const heroColor = Object.keys(heroAlertVariants.variants.color).includes(\n variant,\n )\n ? (variant as HeroAlertProps['color'])\n : undefined;\n\n return (\n <HeroAlert\n classNames={classNames}\n color={heroColor}\n data-testid={testId}\n description={title ? children : undefined}\n endContent={endContent}\n hideIcon={variant === 'default'}\n icon={icon}\n // map closable to isClosable, because of we do not want \"is\" as prefix\n isClosable={closable}\n onClose={onClose}\n title={(title ?? children) as string}\n variant=\"faded\"\n />\n );\n};\n\nexport default Alert;\n","import Alert, { alertVariants } from './Alert';\n\nexport type { AlertProps } from './Alert';\n\nexport { Alert, alertVariants };\n\nexport default Alert;\n"],"mappings":";AAIA,SAAS,SAAS,iBAAiB;AACnC,SAAS,SAAS,yBAAyB;AAE3C,SAAS,IAAI,4BAA4B;AAoGrC;AAlGG,IAAM,gBAAgB,GAAG;AAAA,EAC9B,OAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa;AAAA,IACb,aAAa;AAAA,IACb,WAAW;AAAA,EACb;AAAA,EACA,UAAU;AAAA;AAAA,IAER,qBAAqB;AAAA,MACnB,MAAM;AAAA,QACJ,aAAa;AAAA,MACf;AAAA,IACF;AAAA;AAAA,IAEA,SAAS;AAAA,MACP,QAAQ;AAAA,QACN,MAAM;AAAA,MACR;AAAA,MACA,SAAS;AAAA,QACP,MAAM;AAAA,MACR;AAAA,MACA,MAAM;AAAA,QACJ,WAAW;AAAA,QACX,MAAM;AAAA,QACN,aAAa;AAAA,QACb,aAAa;AAAA,QACb,aAAa;AAAA,QACb,aAAa;AAAA,QACb,OAAO;AAAA,MACT;AAAA,MACA,SAAS;AAAA,QACP,MAAM;AAAA,MACR;AAAA,MACA,SAAS;AAAA,QACP,MAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF,CAAC;AA8BD,IAAM,QAAQ,CAAC;AAAA,EACb,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,OAAO;AAAA,EACP,WAAW;AAAA,EACX,UAAU;AAAA,EACV,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,UAAU;AACZ,MAAkB;AAChB,QAAM,sBAAsB,CAAC,CAAC,YAAY,CAAC,CAAC;AAC5C,QAAM,WAAW,cAAc;AAAA,IAC7B;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,aAAa,qBAAqB,UAAU,WAAW,MAAM;AAGnE,QAAM,YAAY,OAAO,KAAK,kBAAkB,SAAS,KAAK,EAAE;AAAA,IAC9D;AAAA,EACF,IACK,UACD;AAEJ,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,OAAO;AAAA,MACP,eAAa;AAAA,MACb,aAAa,QAAQ,WAAW;AAAA,MAChC;AAAA,MACA,UAAU,YAAY;AAAA,MACtB;AAAA,MAEA,YAAY;AAAA,MACZ;AAAA,MACA,OAAQ,wBAAS;AAAA,MACjB,SAAQ;AAAA;AAAA,EACV;AAEJ;AAEA,IAAO,gBAAQ;;;ACtHf,IAAOA,iBAAQ;","names":["Alert_default"]}
@@ -0,0 +1,112 @@
1
+ import {
2
+ Alert_default2 as Alert_default
3
+ } from "./chunk-SDZX5VJZ.js";
4
+ import {
5
+ __objRest,
6
+ __spreadValues
7
+ } from "./chunk-OAIRL2FN.js";
8
+
9
+ // src/Toast/Toast.tsx
10
+ import { toast as sonnerToast } from "sonner";
11
+ import { jsx } from "react/jsx-runtime";
12
+ var showToast = (message, variant, options) => {
13
+ const _a = options != null ? options : {}, { onClose, closable, title, endContent, icon, render } = _a, rest = __objRest(_a, ["onClose", "closable", "title", "endContent", "icon", "render"]);
14
+ const sonnerOptions = __spreadValues({
15
+ position: "top-center",
16
+ onDismiss: onClose
17
+ }, rest);
18
+ return sonnerToast.custom((id) => {
19
+ const close = () => {
20
+ return sonnerToast.dismiss(id);
21
+ };
22
+ if (render) {
23
+ return render({
24
+ message,
25
+ variant,
26
+ close,
27
+ closable,
28
+ title,
29
+ endContent,
30
+ icon
31
+ });
32
+ }
33
+ return /* @__PURE__ */ jsx(
34
+ Alert_default,
35
+ {
36
+ closable,
37
+ endContent,
38
+ icon,
39
+ onClose: closable ? close : void 0,
40
+ title,
41
+ variant,
42
+ children: message
43
+ }
44
+ );
45
+ }, sonnerOptions);
46
+ };
47
+ var toast = {
48
+ /**
49
+ * Show a default toast.
50
+ * @returns The toast id which can be passed to `toast.close()`
51
+ */
52
+ default: (message, options) => {
53
+ return showToast(message, "default", options);
54
+ },
55
+ /**
56
+ * Show an info toast.
57
+ * @returns The toast id which can be passed to `toast.close()`
58
+ */
59
+ info: (message, options) => {
60
+ return showToast(message, "info", options);
61
+ },
62
+ /**
63
+ * Show a warning toast.
64
+ * @returns The toast id which can be passed to `toast.close()`
65
+ */
66
+ warn: (message, options) => {
67
+ return showToast(message, "warning", __spreadValues({
68
+ duration: 6e4,
69
+ closable: true
70
+ }, options));
71
+ },
72
+ /**
73
+ * Show a success toast.
74
+ * @returns The toast id which can be passed to `toast.close()`
75
+ */
76
+ success: (message, options) => {
77
+ return showToast(message, "success", options);
78
+ },
79
+ /**
80
+ * Show an error toast.
81
+ * @returns The toast id which can be passed to `toast.close()`
82
+ */
83
+ error: (message, options) => {
84
+ return showToast(message, "danger", __spreadValues({
85
+ duration: 6e4,
86
+ closable: true
87
+ }, options));
88
+ },
89
+ /** Close a toast by its id */
90
+ close: (toastId) => {
91
+ sonnerToast.dismiss(toastId);
92
+ }
93
+ };
94
+ var Toast_default = toast;
95
+
96
+ // src/Toast/Toaster.tsx
97
+ import { Toaster as SonnerToaster } from "sonner";
98
+ import { jsx as jsx2 } from "react/jsx-runtime";
99
+ var Toaster = (props) => {
100
+ return /* @__PURE__ */ jsx2(SonnerToaster, __spreadValues({}, props));
101
+ };
102
+ var Toaster_default = Toaster;
103
+
104
+ // src/Toast/index.ts
105
+ var Toast_default2 = Toast_default;
106
+
107
+ export {
108
+ Toast_default,
109
+ Toaster_default,
110
+ Toast_default2
111
+ };
112
+ //# sourceMappingURL=chunk-VD7VRLYO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/Toast/Toast.tsx","../src/Toast/Toaster.tsx","../src/Toast/index.ts"],"sourcesContent":["import type { ReactElement, ReactNode } from 'react';\nimport type { ExternalToast } from 'sonner';\nimport type { AlertProps } from '../Alert';\n\nimport { toast as sonnerToast } from 'sonner';\n\nimport AlertComponent from '../Alert';\n\ntype AlertVariant = NonNullable<AlertProps['variant']>;\n\n/** Props passed to a custom render function */\nexport interface ToastRenderProps {\n /** The toast message */\n message: ReactNode;\n /** The color/severity of the toast */\n variant: AlertVariant;\n /** Function to close the toast */\n close: () => void;\n /** Whether the toast can be closed by the user */\n closable?: boolean;\n /** Title displayed above the toast message */\n title?: ReactNode;\n /** Content displayed at the end of the toast */\n endContent?: ReactNode;\n /** Icon displayed at the start of the toast */\n icon?: ReactNode;\n}\n\n/** Options passed to each toast method */\nexport interface ToastOptions {\n /** Title displayed above the toast message */\n title?: ReactNode;\n /** Whether the toast can be closed by the user */\n closable?: boolean;\n /** Duration in milliseconds before the toast auto-closes */\n duration?: number;\n /** Position of the toast on the screen */\n position?: ExternalToast['position'];\n /** Callback fired when the toast auto-closes */\n onAutoClose?: ExternalToast['onAutoClose'];\n /** Callback fired when the toast is closed */\n onClose?: ExternalToast['onDismiss'];\n /** Content displayed at the end of the toast */\n endContent?: ReactNode;\n /** Icon displayed at the start of the toast */\n icon?: ReactNode;\n /** Custom render function to override the default AlertComponent */\n render?: (props: ToastRenderProps) => ReactElement;\n}\n\nconst showToast = (\n message: ReactNode,\n variant: AlertVariant,\n options?: ToastOptions,\n) => {\n // Map custom ToastOptions to Sonner's ExternalToast format:\n // - onClose is mapped to Sonner's onDismiss\n // - closable is handled separately (not a Sonner option)\n // - position defaults to 'top-center'\n const { onClose, closable, title, endContent, icon, render, ...rest } =\n options ?? {};\n const sonnerOptions: ExternalToast = {\n position: 'top-center' as const,\n onDismiss: onClose,\n ...rest,\n };\n return sonnerToast.custom((id) => {\n // Close function passed to custom render or AlertComponent\n const close = () => {\n return sonnerToast.dismiss(id);\n };\n\n // Allow custom rendering via render prop\n if (render) {\n return render({\n message,\n variant,\n close,\n closable,\n title,\n endContent,\n icon,\n });\n }\n\n // Default: render AlertComponent\n return (\n <AlertComponent\n closable={closable}\n endContent={endContent}\n icon={icon}\n onClose={closable ? close : undefined}\n title={title}\n variant={variant}\n >\n {message}\n </AlertComponent>\n );\n }, sonnerOptions);\n};\n\n/** Toast object with convenience methods for different severity levels */\nconst toast = {\n /**\n * Show a default toast.\n * @returns The toast id which can be passed to `toast.close()`\n */\n default: (message: ReactNode, options?: ToastOptions) => {\n return showToast(message, 'default', options);\n },\n /**\n * Show an info toast.\n * @returns The toast id which can be passed to `toast.close()`\n */\n info: (message: ReactNode, options?: ToastOptions) => {\n return showToast(message, 'info', options);\n },\n /**\n * Show a warning toast.\n * @returns The toast id which can be passed to `toast.close()`\n */\n warn: (message: ReactNode, options?: ToastOptions) => {\n return showToast(message, 'warning', {\n duration: 60000,\n closable: true,\n ...options,\n });\n },\n /**\n * Show a success toast.\n * @returns The toast id which can be passed to `toast.close()`\n */\n success: (message: ReactNode, options?: ToastOptions) => {\n return showToast(message, 'success', options);\n },\n /**\n * Show an error toast.\n * @returns The toast id which can be passed to `toast.close()`\n */\n error: (message: ReactNode, options?: ToastOptions) => {\n return showToast(message, 'danger', {\n duration: 60000,\n closable: true,\n ...options,\n });\n },\n /** Close a toast by its id */\n close: (toastId: string | number) => {\n sonnerToast.dismiss(toastId);\n },\n};\n\nexport default toast;\n","import type { ComponentProps } from 'react';\n\nimport { Toaster as SonnerToaster } from 'sonner';\n\nexport type ToasterProps = Pick<\n ComponentProps<typeof SonnerToaster>,\n 'visibleToasts' | 'position'\n>;\n\nconst Toaster = (props: ToasterProps) => {\n return <SonnerToaster {...props} />;\n};\n\nexport default Toaster;\n","import toast from './Toast';\nimport Toaster from './Toaster';\n\nexport type { ToastOptions, ToastRenderProps } from './Toast';\nexport type { ToasterProps } from './Toaster';\n\nexport { Toaster, toast };\nexport default toast;\n"],"mappings":";;;;;;;;;AAIA,SAAS,SAAS,mBAAmB;AAmF/B;AArCN,IAAM,YAAY,CAChB,SACA,SACA,YACG;AAKH,QACE,iCAAW,CAAC,GADN,WAAS,UAAU,OAAO,YAAY,MAAM,OA3DtD,IA4DI,IAD6D,iBAC7D,IAD6D,CAAvD,WAAS,YAAU,SAAO,cAAY,QAAM;AAEpD,QAAM,gBAA+B;AAAA,IACnC,UAAU;AAAA,IACV,WAAW;AAAA,KACR;AAEL,SAAO,YAAY,OAAO,CAAC,OAAO;AAEhC,UAAM,QAAQ,MAAM;AAClB,aAAO,YAAY,QAAQ,EAAE;AAAA,IAC/B;AAGA,QAAI,QAAQ;AACV,aAAO,OAAO;AAAA,QACZ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAGA,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA,SAAS,WAAW,QAAQ;AAAA,QAC5B;AAAA,QACA;AAAA,QAEC;AAAA;AAAA,IACH;AAAA,EAEJ,GAAG,aAAa;AAClB;AAGA,IAAM,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA,EAKZ,SAAS,CAAC,SAAoB,YAA2B;AACvD,WAAO,UAAU,SAAS,WAAW,OAAO;AAAA,EAC9C;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,CAAC,SAAoB,YAA2B;AACpD,WAAO,UAAU,SAAS,QAAQ,OAAO;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,CAAC,SAAoB,YAA2B;AACpD,WAAO,UAAU,SAAS,WAAW;AAAA,MACnC,UAAU;AAAA,MACV,UAAU;AAAA,OACP,QACJ;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAS,CAAC,SAAoB,YAA2B;AACvD,WAAO,UAAU,SAAS,WAAW,OAAO;AAAA,EAC9C;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,CAAC,SAAoB,YAA2B;AACrD,WAAO,UAAU,SAAS,UAAU;AAAA,MAClC,UAAU;AAAA,MACV,UAAU;AAAA,OACP,QACJ;AAAA,EACH;AAAA;AAAA,EAEA,OAAO,CAAC,YAA6B;AACnC,gBAAY,QAAQ,OAAO;AAAA,EAC7B;AACF;AAEA,IAAO,gBAAQ;;;ACtJf,SAAS,WAAW,qBAAqB;AAQhC,gBAAAA,YAAA;AADT,IAAM,UAAU,CAAC,UAAwB;AACvC,SAAO,gBAAAA,KAAC,kCAAkB,MAAO;AACnC;AAEA,IAAO,kBAAQ;;;ACNf,IAAOC,iBAAQ;","names":["jsx","Toast_default"]}
@@ -0,0 +1,112 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkI5QMH3J5cjs = require('./chunk-I5QMH3J5.cjs');
4
+
5
+
6
+
7
+ var _chunkAHEA4IJVcjs = require('./chunk-AHEA4IJV.cjs');
8
+
9
+ // src/Toast/Toast.tsx
10
+ var _sonner = require('sonner');
11
+ var _jsxruntime = require('react/jsx-runtime');
12
+ var showToast = (message, variant, options) => {
13
+ const _a = options != null ? options : {}, { onClose, closable, title, endContent, icon, render } = _a, rest = _chunkAHEA4IJVcjs.__objRest.call(void 0, _a, ["onClose", "closable", "title", "endContent", "icon", "render"]);
14
+ const sonnerOptions = _chunkAHEA4IJVcjs.__spreadValues.call(void 0, {
15
+ position: "top-center",
16
+ onDismiss: onClose
17
+ }, rest);
18
+ return _sonner.toast.custom((id) => {
19
+ const close = () => {
20
+ return _sonner.toast.dismiss(id);
21
+ };
22
+ if (render) {
23
+ return render({
24
+ message,
25
+ variant,
26
+ close,
27
+ closable,
28
+ title,
29
+ endContent,
30
+ icon
31
+ });
32
+ }
33
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
34
+ _chunkI5QMH3J5cjs.Alert_default2,
35
+ {
36
+ closable,
37
+ endContent,
38
+ icon,
39
+ onClose: closable ? close : void 0,
40
+ title,
41
+ variant,
42
+ children: message
43
+ }
44
+ );
45
+ }, sonnerOptions);
46
+ };
47
+ var toast = {
48
+ /**
49
+ * Show a default toast.
50
+ * @returns The toast id which can be passed to `toast.close()`
51
+ */
52
+ default: (message, options) => {
53
+ return showToast(message, "default", options);
54
+ },
55
+ /**
56
+ * Show an info toast.
57
+ * @returns The toast id which can be passed to `toast.close()`
58
+ */
59
+ info: (message, options) => {
60
+ return showToast(message, "info", options);
61
+ },
62
+ /**
63
+ * Show a warning toast.
64
+ * @returns The toast id which can be passed to `toast.close()`
65
+ */
66
+ warn: (message, options) => {
67
+ return showToast(message, "warning", _chunkAHEA4IJVcjs.__spreadValues.call(void 0, {
68
+ duration: 6e4,
69
+ closable: true
70
+ }, options));
71
+ },
72
+ /**
73
+ * Show a success toast.
74
+ * @returns The toast id which can be passed to `toast.close()`
75
+ */
76
+ success: (message, options) => {
77
+ return showToast(message, "success", options);
78
+ },
79
+ /**
80
+ * Show an error toast.
81
+ * @returns The toast id which can be passed to `toast.close()`
82
+ */
83
+ error: (message, options) => {
84
+ return showToast(message, "danger", _chunkAHEA4IJVcjs.__spreadValues.call(void 0, {
85
+ duration: 6e4,
86
+ closable: true
87
+ }, options));
88
+ },
89
+ /** Close a toast by its id */
90
+ close: (toastId) => {
91
+ _sonner.toast.dismiss(toastId);
92
+ }
93
+ };
94
+ var Toast_default = toast;
95
+
96
+ // src/Toast/Toaster.tsx
97
+
98
+
99
+ var Toaster = (props) => {
100
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _sonner.Toaster, _chunkAHEA4IJVcjs.__spreadValues.call(void 0, {}, props));
101
+ };
102
+ var Toaster_default = Toaster;
103
+
104
+ // src/Toast/index.ts
105
+ var Toast_default2 = Toast_default;
106
+
107
+
108
+
109
+
110
+
111
+ exports.Toast_default = Toast_default; exports.Toaster_default = Toaster_default; exports.Toast_default2 = Toast_default2;
112
+ //# sourceMappingURL=chunk-YWEUUA52.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/pixels/pixels/packages/pixels/dist/chunk-YWEUUA52.cjs","../src/Toast/Toast.tsx","../src/Toast/Toaster.tsx","../src/Toast/index.ts"],"names":["jsx","Toast_default"],"mappings":"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","file":"/home/runner/work/pixels/pixels/packages/pixels/dist/chunk-YWEUUA52.cjs","sourcesContent":[null,"import type { ReactElement, ReactNode } from 'react';\nimport type { ExternalToast } from 'sonner';\nimport type { AlertProps } from '../Alert';\n\nimport { toast as sonnerToast } from 'sonner';\n\nimport AlertComponent from '../Alert';\n\ntype AlertVariant = NonNullable<AlertProps['variant']>;\n\n/** Props passed to a custom render function */\nexport interface ToastRenderProps {\n /** The toast message */\n message: ReactNode;\n /** The color/severity of the toast */\n variant: AlertVariant;\n /** Function to close the toast */\n close: () => void;\n /** Whether the toast can be closed by the user */\n closable?: boolean;\n /** Title displayed above the toast message */\n title?: ReactNode;\n /** Content displayed at the end of the toast */\n endContent?: ReactNode;\n /** Icon displayed at the start of the toast */\n icon?: ReactNode;\n}\n\n/** Options passed to each toast method */\nexport interface ToastOptions {\n /** Title displayed above the toast message */\n title?: ReactNode;\n /** Whether the toast can be closed by the user */\n closable?: boolean;\n /** Duration in milliseconds before the toast auto-closes */\n duration?: number;\n /** Position of the toast on the screen */\n position?: ExternalToast['position'];\n /** Callback fired when the toast auto-closes */\n onAutoClose?: ExternalToast['onAutoClose'];\n /** Callback fired when the toast is closed */\n onClose?: ExternalToast['onDismiss'];\n /** Content displayed at the end of the toast */\n endContent?: ReactNode;\n /** Icon displayed at the start of the toast */\n icon?: ReactNode;\n /** Custom render function to override the default AlertComponent */\n render?: (props: ToastRenderProps) => ReactElement;\n}\n\nconst showToast = (\n message: ReactNode,\n variant: AlertVariant,\n options?: ToastOptions,\n) => {\n // Map custom ToastOptions to Sonner's ExternalToast format:\n // - onClose is mapped to Sonner's onDismiss\n // - closable is handled separately (not a Sonner option)\n // - position defaults to 'top-center'\n const { onClose, closable, title, endContent, icon, render, ...rest } =\n options ?? {};\n const sonnerOptions: ExternalToast = {\n position: 'top-center' as const,\n onDismiss: onClose,\n ...rest,\n };\n return sonnerToast.custom((id) => {\n // Close function passed to custom render or AlertComponent\n const close = () => {\n return sonnerToast.dismiss(id);\n };\n\n // Allow custom rendering via render prop\n if (render) {\n return render({\n message,\n variant,\n close,\n closable,\n title,\n endContent,\n icon,\n });\n }\n\n // Default: render AlertComponent\n return (\n <AlertComponent\n closable={closable}\n endContent={endContent}\n icon={icon}\n onClose={closable ? close : undefined}\n title={title}\n variant={variant}\n >\n {message}\n </AlertComponent>\n );\n }, sonnerOptions);\n};\n\n/** Toast object with convenience methods for different severity levels */\nconst toast = {\n /**\n * Show a default toast.\n * @returns The toast id which can be passed to `toast.close()`\n */\n default: (message: ReactNode, options?: ToastOptions) => {\n return showToast(message, 'default', options);\n },\n /**\n * Show an info toast.\n * @returns The toast id which can be passed to `toast.close()`\n */\n info: (message: ReactNode, options?: ToastOptions) => {\n return showToast(message, 'info', options);\n },\n /**\n * Show a warning toast.\n * @returns The toast id which can be passed to `toast.close()`\n */\n warn: (message: ReactNode, options?: ToastOptions) => {\n return showToast(message, 'warning', {\n duration: 60000,\n closable: true,\n ...options,\n });\n },\n /**\n * Show a success toast.\n * @returns The toast id which can be passed to `toast.close()`\n */\n success: (message: ReactNode, options?: ToastOptions) => {\n return showToast(message, 'success', options);\n },\n /**\n * Show an error toast.\n * @returns The toast id which can be passed to `toast.close()`\n */\n error: (message: ReactNode, options?: ToastOptions) => {\n return showToast(message, 'danger', {\n duration: 60000,\n closable: true,\n ...options,\n });\n },\n /** Close a toast by its id */\n close: (toastId: string | number) => {\n sonnerToast.dismiss(toastId);\n },\n};\n\nexport default toast;\n","import type { ComponentProps } from 'react';\n\nimport { Toaster as SonnerToaster } from 'sonner';\n\nexport type ToasterProps = Pick<\n ComponentProps<typeof SonnerToaster>,\n 'visibleToasts' | 'position'\n>;\n\nconst Toaster = (props: ToasterProps) => {\n return <SonnerToaster {...props} />;\n};\n\nexport default Toaster;\n","import toast from './Toast';\nimport Toaster from './Toaster';\n\nexport type { ToastOptions, ToastRenderProps } from './Toast';\nexport type { ToasterProps } from './Toaster';\n\nexport { Toaster, toast };\nexport default toast;\n"]}