@fuf-stack/pixels 0.41.0 → 0.41.1
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/Toast/index.cjs +14 -0
- package/dist/Toast/index.cjs.map +1 -0
- package/dist/Toast/index.d.cts +11 -0
- package/dist/Toast/index.d.ts +11 -0
- package/dist/Toast/index.js +14 -0
- package/dist/Toast/index.js.map +1 -0
- package/dist/ToastProvider-CL1v-bkE.d.cts +295 -0
- package/dist/ToastProvider-CL1v-bkE.d.ts +295 -0
- package/dist/chunk-5XFAJUE5.cjs +170 -0
- package/dist/chunk-5XFAJUE5.cjs.map +1 -0
- package/dist/chunk-KSAL4SBX.js +170 -0
- package/dist/chunk-KSAL4SBX.js.map +1 -0
- package/dist/index.cjs +7 -160
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -295
- package/dist/index.d.ts +6 -295
- package/dist/index.js +6 -159
- package/dist/index.js.map +1 -1
- package/package.json +8 -3
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkD4TLDLEXcjs = require('./chunk-D4TLDLEX.cjs');
|
|
5
|
+
|
|
6
|
+
// src/Toast/addToast.tsx
|
|
7
|
+
var _theme = require('@heroui/theme');
|
|
8
|
+
var _toast = require('@heroui/toast');
|
|
9
|
+
var _pixelutils = require('@fuf-stack/pixel-utils');
|
|
10
|
+
var toastVariants = _pixelutils.tv.call(void 0, {
|
|
11
|
+
slots: {
|
|
12
|
+
base: "",
|
|
13
|
+
title: "",
|
|
14
|
+
description: "",
|
|
15
|
+
icon: "",
|
|
16
|
+
loadingIcon: "",
|
|
17
|
+
content: "",
|
|
18
|
+
motionDiv: "",
|
|
19
|
+
progressTrack: "",
|
|
20
|
+
progressIndicator: "",
|
|
21
|
+
closeButton: "",
|
|
22
|
+
closeIcon: ""
|
|
23
|
+
},
|
|
24
|
+
variants: {
|
|
25
|
+
// see: https://github.com/heroui-inc/heroui/blob/canary/packages/core/theme/src/components/toast.ts
|
|
26
|
+
color: _chunkD4TLDLEXcjs.__spreadValues.call(void 0, {
|
|
27
|
+
info: {}
|
|
28
|
+
}, _theme.toast.variants.color),
|
|
29
|
+
variant: _chunkD4TLDLEXcjs.__spreadValues.call(void 0, {}, _theme.toast.variants.variant)
|
|
30
|
+
},
|
|
31
|
+
compoundVariants: [
|
|
32
|
+
..._theme.toast.compoundVariants,
|
|
33
|
+
{
|
|
34
|
+
variant: "solid",
|
|
35
|
+
color: "info",
|
|
36
|
+
className: {
|
|
37
|
+
base: "bg-info text-info-foreground",
|
|
38
|
+
title: "text-info-foreground",
|
|
39
|
+
description: "text-info-foreground",
|
|
40
|
+
icon: "text-info-foreground",
|
|
41
|
+
closeIcon: "border-info-400 bg-info-100",
|
|
42
|
+
closeButton: "text-info-400 hover:text-info-600",
|
|
43
|
+
progressIndicator: "bg-info-400"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
color: "info",
|
|
48
|
+
variant: "flat",
|
|
49
|
+
className: {
|
|
50
|
+
base: "bg-info-50 text-info-600 dark:bg-info-50/50",
|
|
51
|
+
title: "text-info-600",
|
|
52
|
+
description: "text-info-500",
|
|
53
|
+
icon: "text-info-600",
|
|
54
|
+
closeIcon: "border-info-400 bg-info-100",
|
|
55
|
+
closeButton: "text-info-400 hover:text-info-600",
|
|
56
|
+
progressIndicator: "bg-info-400"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
color: "info",
|
|
61
|
+
variant: "bordered",
|
|
62
|
+
className: {
|
|
63
|
+
base: "border-small border-info text-info-600",
|
|
64
|
+
title: "text-info-600",
|
|
65
|
+
description: "text-info-500",
|
|
66
|
+
icon: "text-info-600",
|
|
67
|
+
closeIcon: "border-info-400 bg-info-100",
|
|
68
|
+
closeButton: "text-info-400 hover:text-info-600",
|
|
69
|
+
progressIndicator: "bg-info-400"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
var addToast = ({
|
|
75
|
+
className = void 0,
|
|
76
|
+
closeIcon = void 0,
|
|
77
|
+
color = "default",
|
|
78
|
+
description = void 0,
|
|
79
|
+
endContent = void 0,
|
|
80
|
+
icon = void 0,
|
|
81
|
+
loadingIcon = void 0,
|
|
82
|
+
onClose = void 0,
|
|
83
|
+
promise = void 0,
|
|
84
|
+
shouldShowTimeoutProgress = false,
|
|
85
|
+
showCloseButton = true,
|
|
86
|
+
showIcon = true,
|
|
87
|
+
timeout = 5e3,
|
|
88
|
+
title = void 0,
|
|
89
|
+
variant = "bordered"
|
|
90
|
+
}) => {
|
|
91
|
+
const variants = toastVariants({
|
|
92
|
+
color,
|
|
93
|
+
variant
|
|
94
|
+
});
|
|
95
|
+
const isHeroUIColor = Object.keys(_theme.toast.variants.color).includes(
|
|
96
|
+
color
|
|
97
|
+
);
|
|
98
|
+
const classNames = _pixelutils.variantsToClassNames.call(void 0, variants, className, "base");
|
|
99
|
+
_toast.addToast.call(void 0, {
|
|
100
|
+
classNames,
|
|
101
|
+
closeIcon,
|
|
102
|
+
color: isHeroUIColor ? color : void 0,
|
|
103
|
+
// TODO: 'data-testid': testId,
|
|
104
|
+
description,
|
|
105
|
+
endContent,
|
|
106
|
+
hideCloseButton: !showCloseButton,
|
|
107
|
+
hideIcon: !showIcon,
|
|
108
|
+
icon,
|
|
109
|
+
loadingIcon,
|
|
110
|
+
onClose,
|
|
111
|
+
promise,
|
|
112
|
+
shouldShowTimeoutProgress,
|
|
113
|
+
timeout,
|
|
114
|
+
title,
|
|
115
|
+
variant
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// src/Toast/ToastProvider.tsx
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
124
|
+
var ToastProvider = ({
|
|
125
|
+
disableAnimation = false,
|
|
126
|
+
maxVisibleToasts = 5,
|
|
127
|
+
placement = "top-center",
|
|
128
|
+
toastProps = void 0,
|
|
129
|
+
toastOffset = 26,
|
|
130
|
+
regionProps = void 0
|
|
131
|
+
}) => {
|
|
132
|
+
const variants = toastVariants({
|
|
133
|
+
color: toastProps == null ? void 0 : toastProps.color,
|
|
134
|
+
variant: toastProps == null ? void 0 : toastProps.variant
|
|
135
|
+
});
|
|
136
|
+
const isHeroUIColor = Object.keys(_theme.toast.variants.color).includes(
|
|
137
|
+
(toastProps == null ? void 0 : toastProps.color) || ""
|
|
138
|
+
);
|
|
139
|
+
const classNames = _pixelutils.variantsToClassNames.call(void 0,
|
|
140
|
+
variants,
|
|
141
|
+
toastProps == null ? void 0 : toastProps.className,
|
|
142
|
+
"base"
|
|
143
|
+
);
|
|
144
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
145
|
+
_toast.ToastProvider,
|
|
146
|
+
{
|
|
147
|
+
disableAnimation,
|
|
148
|
+
maxVisibleToasts,
|
|
149
|
+
placement,
|
|
150
|
+
regionProps,
|
|
151
|
+
toastOffset,
|
|
152
|
+
toastProps: _chunkD4TLDLEXcjs.__spreadProps.call(void 0, _chunkD4TLDLEXcjs.__spreadValues.call(void 0, {}, toastProps), {
|
|
153
|
+
classNames,
|
|
154
|
+
color: isHeroUIColor ? toastProps == null ? void 0 : toastProps.color : void 0
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
var ToastProvider_default = ToastProvider;
|
|
160
|
+
|
|
161
|
+
// src/Toast/index.ts
|
|
162
|
+
var Toast_default = ToastProvider_default;
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
exports.toastVariants = toastVariants; exports.addToast = addToast; exports.ToastProvider_default = ToastProvider_default; exports.Toast_default = Toast_default;
|
|
170
|
+
//# sourceMappingURL=chunk-5XFAJUE5.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/pixels/dist/chunk-5XFAJUE5.cjs","../src/Toast/addToast.tsx","../src/Toast/ToastProvider.tsx","../src/Toast/index.ts"],"names":["heroToastVariants","variantsToClassNames"],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACDA,sCAA2C;AAC3C,sCAAyC;AAEzC,oDAAyC;AAElC,IAAM,cAAA,EAAgB,4BAAA;AAAG,EAC9B,KAAA,EAAO;AAAA,IACL,IAAA,EAAM,EAAA;AAAA,IACN,KAAA,EAAO,EAAA;AAAA,IACP,WAAA,EAAa,EAAA;AAAA,IACb,IAAA,EAAM,EAAA;AAAA,IACN,WAAA,EAAa,EAAA;AAAA,IACb,OAAA,EAAS,EAAA;AAAA,IACT,SAAA,EAAW,EAAA;AAAA,IACX,aAAA,EAAe,EAAA;AAAA,IACf,iBAAA,EAAmB,EAAA;AAAA,IACnB,WAAA,EAAa,EAAA;AAAA,IACb,SAAA,EAAW;AAAA,EACb,CAAA;AAAA,EACA,QAAA,EAAU;AAAA;AAAA,IAER,KAAA,EAAO,8CAAA;AAAA,MACL,IAAA,EAAM,CAAC;AAAA,IAAA,CAAA,EACJ,YAAA,CAAkB,QAAA,CAAS,KAAA,CAAA;AAAA,IAEhC,OAAA,EAAS,8CAAA,CAAA,CAAA,EACJ,YAAA,CAAkB,QAAA,CAAS,OAAA;AAAA,EAElC,CAAA;AAAA,EACA,gBAAA,EAAkB;AAAA,IAChB,GAAG,YAAA,CAAkB,gBAAA;AAAA,IACrB;AAAA,MACE,OAAA,EAAS,OAAA;AAAA,MACT,KAAA,EAAO,MAAA;AAAA,MACP,SAAA,EAAW;AAAA,QACT,IAAA,EAAM,8BAAA;AAAA,QACN,KAAA,EAAO,sBAAA;AAAA,QACP,WAAA,EAAa,sBAAA;AAAA,QACb,IAAA,EAAM,sBAAA;AAAA,QACN,SAAA,EA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AAA,EAAA,KAAA,EAAA,EAAA,UAAA,CAAY;AAAA,EACvB,CAAC,CAAA;AACD,EAAA,MAAM,cAAA,EAAgB,MAAA,CAAO,IAAA,CAAKA,YAAAA,CAAkB,QAAA,CAAS,KAAK,CAAA,CAAE,QAAA;AAAA,IAAA,CAClE,WAAA,GAAA,KAAA,EAAA,KAAA,EAAA,EAAA,UAAA,CAAY,KAAA,EAAA,GAAS;AAAA,EACvB,CAAA;AACA,EAAA,MAAM,WAAA,EAAaC,8CAAAA;AAAA,IACjB,QAAA;AAAA,IACA,WAAA,GAAA,KAAA,EAAA,KAAA,EAAA,EAAA,UAAA,CAAY,SAAA;AAAA,IACZ;AAAA,EACF,CAAA;AACA,EAAA,uBACE,6BAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,gBAAA;AAAA,MACA,gBAAA;AAAA,MACA,SAAA;AAAA,MACA,WAAA;AAAA,MACA,WAAA;AAAA,MACA,UAAA,EAAY,6CAAA,8CAAA,CAAA,CAAA,EACP,UAAA,CAAA,EADO;AAAA,QAEV,UAAA;AAAA,QACA,KAAA,EAAO,cAAA,EACF,WAAA,GAAA,KAAA,EAAA,KAAA,EAAA,EAAA,UAAA,CAAY,MAAA,EACb,KAAA;AAAA,MACN,CAAA;AAAA,IAAA;AAAA,EACF,CAAA;AAEJ,CAAA;AAEA,IAAO,sBAAA,EAAQ,aAAA;AFuFf;AACA;AGxJA,IAAO,cAAA,EAAQ,qBAAA;AH0Jf;AACA;AACE;AACA;AACA;AACA;AACF,iKAAC","file":"/home/runner/work/pixels/pixels/packages/pixels/dist/chunk-5XFAJUE5.cjs","sourcesContent":[null,"import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ToastProps as HeroToastProps } from '@heroui/toast';\nimport type { ReactNode } from 'react';\n\nimport { toast as heroToastVariants } from '@heroui/theme';\nimport { addToast as heroAddToast } from '@heroui/toast';\n\nimport { tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nexport const toastVariants = tv({\n slots: {\n base: '',\n title: '',\n description: '',\n icon: '',\n loadingIcon: '',\n content: '',\n motionDiv: '',\n progressTrack: '',\n progressIndicator: '',\n closeButton: '',\n closeIcon: '',\n },\n variants: {\n // see: https://github.com/heroui-inc/heroui/blob/canary/packages/core/theme/src/components/toast.ts\n color: {\n info: {},\n ...heroToastVariants.variants.color,\n },\n variant: {\n ...heroToastVariants.variants.variant,\n },\n },\n compoundVariants: [\n ...heroToastVariants.compoundVariants,\n {\n variant: 'solid',\n color: 'info',\n className: {\n base: 'bg-info text-info-foreground',\n title: 'text-info-foreground',\n description: 'text-info-foreground',\n icon: 'text-info-foreground',\n closeIcon: 'border-info-400 bg-info-100',\n closeButton: 'text-info-400 hover:text-info-600',\n progressIndicator: 'bg-info-400',\n },\n },\n {\n color: 'info',\n variant: 'flat',\n className: {\n base: 'bg-info-50 text-info-600 dark:bg-info-50/50',\n title: 'text-info-600',\n description: 'text-info-500',\n icon: 'text-info-600',\n closeIcon: 'border-info-400 bg-info-100',\n closeButton: 'text-info-400 hover:text-info-600',\n progressIndicator: 'bg-info-400',\n },\n },\n\n {\n color: 'info',\n variant: 'bordered',\n className: {\n base: 'border-small border-info text-info-600',\n title: 'text-info-600',\n description: 'text-info-500',\n icon: 'text-info-600',\n closeIcon: 'border-info-400 bg-info-100',\n closeButton: 'text-info-400 hover:text-info-600',\n progressIndicator: 'bg-info-400',\n },\n },\n ],\n});\n\nexport type AddToastVariantProps = TVProps<typeof toastVariants>;\ntype ClassName = TVClassName<typeof toastVariants>;\n\nexport interface ToastProps extends AddToastVariantProps {\n /** CSS class name */\n className?: ClassName;\n /** Icon displayed at the end of the Alert */\n closeIcon?: ReactNode;\n /** Color of the alert */\n color?: AddToastVariantProps['color'];\n /** Content displayed inside the Alert */\n description?: ReactNode;\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 /** Icon or animation displayed until promise is resolved */\n loadingIcon?: ReactNode;\n /** Callback function called when the toast is closed */\n onClose?: () => void;\n /** Promise based on which the notification will be styled */\n promise?: Promise<void>;\n /** Whether the toast should show a progress bar */\n shouldShowTimeoutProgress?: boolean;\n /** Whether the toast should show a close button */\n showCloseButton?: boolean;\n /** Whether the toast should show an icon */\n showIcon?: boolean;\n /** Time the toast is displayed */\n timeout?: number;\n /** Content displayed at the top of the toast */\n title?: ReactNode;\n /** Variant of the toast */\n variant?: AddToastVariantProps['variant'];\n}\n\n/**\n * addToast function based on [HeroUI Toast](https://www.heroui.com//docs/components/toast)\n */\nexport const addToast = ({\n className = undefined,\n closeIcon = undefined,\n color = 'default',\n description = undefined,\n endContent = undefined,\n icon = undefined,\n loadingIcon = undefined,\n onClose = undefined,\n promise = undefined,\n shouldShowTimeoutProgress = false,\n showCloseButton = true,\n showIcon = true,\n timeout = 5000,\n title = undefined,\n variant = 'bordered',\n}: ToastProps) => {\n const variants = toastVariants({\n color,\n variant,\n });\n const isHeroUIColor = Object.keys(heroToastVariants.variants.color).includes(\n color,\n );\n const classNames = variantsToClassNames(variants, className, 'base');\n heroAddToast({\n classNames,\n closeIcon,\n color: isHeroUIColor ? (color as HeroToastProps['color']) : undefined,\n // TODO: 'data-testid': testId,\n description,\n endContent,\n hideCloseButton: !showCloseButton,\n hideIcon: !showIcon,\n icon,\n loadingIcon,\n onClose,\n promise,\n shouldShowTimeoutProgress,\n timeout,\n title,\n variant,\n });\n};\n\nexport default addToast;\n","import type { ToastProps as HeroToastProps } from '@heroui/toast';\nimport type { ToastProps } from './addToast';\n\nimport { toast as heroToastVariants } from '@heroui/theme';\nimport { ToastProvider as HeroToastProvider } from '@heroui/toast';\n\nimport { variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { toastVariants } from './addToast';\n\nexport type ToastProviderToastProps = Omit<\n ToastProps,\n 'description' | 'endContent' | 'title'\n>;\n\nexport interface ToastProviderProps {\n disableAnimation?: boolean;\n maxVisibleToasts?: number;\n placement?:\n | 'bottom-right'\n | 'bottom-left'\n | 'bottom-center'\n | 'top-right'\n | 'top-left'\n | 'top-center';\n\n toastProps?: ToastProviderToastProps;\n toastOffset?: number;\n regionProps?: { classNames?: Record<'base', string> };\n}\n\n/**\n * ToastProvider component based on [HeroUI Toast](https://www.heroui.com//docs/components/toast)\n */\nconst ToastProvider = ({\n disableAnimation = false,\n maxVisibleToasts = 5,\n placement = 'top-center',\n toastProps = undefined,\n toastOffset = 26,\n regionProps = undefined,\n}: ToastProviderProps) => {\n const variants = toastVariants({\n color: toastProps?.color,\n variant: toastProps?.variant,\n });\n const isHeroUIColor = Object.keys(heroToastVariants.variants.color).includes(\n toastProps?.color || '',\n );\n const classNames = variantsToClassNames(\n variants,\n toastProps?.className,\n 'base',\n );\n return (\n <HeroToastProvider\n disableAnimation={disableAnimation}\n maxVisibleToasts={maxVisibleToasts}\n placement={placement}\n regionProps={regionProps}\n toastOffset={toastOffset}\n toastProps={{\n ...toastProps,\n classNames,\n color: isHeroUIColor\n ? (toastProps?.color as HeroToastProps['color'])\n : undefined,\n }}\n />\n );\n};\n\nexport default ToastProvider;\n","import { addToast, toastVariants } from './addToast';\nimport ToastProvider from './ToastProvider';\n\nexport type { ToastProps, AddToastVariantProps } from './addToast';\nexport type { ToastProviderProps } from './ToastProvider';\n\nexport { addToast, ToastProvider, toastVariants };\n\nexport default ToastProvider;\n"]}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__spreadProps,
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "./chunk-J7N2552D.js";
|
|
5
|
+
|
|
6
|
+
// src/Toast/addToast.tsx
|
|
7
|
+
import { toast as heroToastVariants } from "@heroui/theme";
|
|
8
|
+
import { addToast as heroAddToast } from "@heroui/toast";
|
|
9
|
+
import { tv, variantsToClassNames } from "@fuf-stack/pixel-utils";
|
|
10
|
+
var toastVariants = tv({
|
|
11
|
+
slots: {
|
|
12
|
+
base: "",
|
|
13
|
+
title: "",
|
|
14
|
+
description: "",
|
|
15
|
+
icon: "",
|
|
16
|
+
loadingIcon: "",
|
|
17
|
+
content: "",
|
|
18
|
+
motionDiv: "",
|
|
19
|
+
progressTrack: "",
|
|
20
|
+
progressIndicator: "",
|
|
21
|
+
closeButton: "",
|
|
22
|
+
closeIcon: ""
|
|
23
|
+
},
|
|
24
|
+
variants: {
|
|
25
|
+
// see: https://github.com/heroui-inc/heroui/blob/canary/packages/core/theme/src/components/toast.ts
|
|
26
|
+
color: __spreadValues({
|
|
27
|
+
info: {}
|
|
28
|
+
}, heroToastVariants.variants.color),
|
|
29
|
+
variant: __spreadValues({}, heroToastVariants.variants.variant)
|
|
30
|
+
},
|
|
31
|
+
compoundVariants: [
|
|
32
|
+
...heroToastVariants.compoundVariants,
|
|
33
|
+
{
|
|
34
|
+
variant: "solid",
|
|
35
|
+
color: "info",
|
|
36
|
+
className: {
|
|
37
|
+
base: "bg-info text-info-foreground",
|
|
38
|
+
title: "text-info-foreground",
|
|
39
|
+
description: "text-info-foreground",
|
|
40
|
+
icon: "text-info-foreground",
|
|
41
|
+
closeIcon: "border-info-400 bg-info-100",
|
|
42
|
+
closeButton: "text-info-400 hover:text-info-600",
|
|
43
|
+
progressIndicator: "bg-info-400"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
color: "info",
|
|
48
|
+
variant: "flat",
|
|
49
|
+
className: {
|
|
50
|
+
base: "bg-info-50 text-info-600 dark:bg-info-50/50",
|
|
51
|
+
title: "text-info-600",
|
|
52
|
+
description: "text-info-500",
|
|
53
|
+
icon: "text-info-600",
|
|
54
|
+
closeIcon: "border-info-400 bg-info-100",
|
|
55
|
+
closeButton: "text-info-400 hover:text-info-600",
|
|
56
|
+
progressIndicator: "bg-info-400"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
color: "info",
|
|
61
|
+
variant: "bordered",
|
|
62
|
+
className: {
|
|
63
|
+
base: "border-small border-info text-info-600",
|
|
64
|
+
title: "text-info-600",
|
|
65
|
+
description: "text-info-500",
|
|
66
|
+
icon: "text-info-600",
|
|
67
|
+
closeIcon: "border-info-400 bg-info-100",
|
|
68
|
+
closeButton: "text-info-400 hover:text-info-600",
|
|
69
|
+
progressIndicator: "bg-info-400"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
var addToast = ({
|
|
75
|
+
className = void 0,
|
|
76
|
+
closeIcon = void 0,
|
|
77
|
+
color = "default",
|
|
78
|
+
description = void 0,
|
|
79
|
+
endContent = void 0,
|
|
80
|
+
icon = void 0,
|
|
81
|
+
loadingIcon = void 0,
|
|
82
|
+
onClose = void 0,
|
|
83
|
+
promise = void 0,
|
|
84
|
+
shouldShowTimeoutProgress = false,
|
|
85
|
+
showCloseButton = true,
|
|
86
|
+
showIcon = true,
|
|
87
|
+
timeout = 5e3,
|
|
88
|
+
title = void 0,
|
|
89
|
+
variant = "bordered"
|
|
90
|
+
}) => {
|
|
91
|
+
const variants = toastVariants({
|
|
92
|
+
color,
|
|
93
|
+
variant
|
|
94
|
+
});
|
|
95
|
+
const isHeroUIColor = Object.keys(heroToastVariants.variants.color).includes(
|
|
96
|
+
color
|
|
97
|
+
);
|
|
98
|
+
const classNames = variantsToClassNames(variants, className, "base");
|
|
99
|
+
heroAddToast({
|
|
100
|
+
classNames,
|
|
101
|
+
closeIcon,
|
|
102
|
+
color: isHeroUIColor ? color : void 0,
|
|
103
|
+
// TODO: 'data-testid': testId,
|
|
104
|
+
description,
|
|
105
|
+
endContent,
|
|
106
|
+
hideCloseButton: !showCloseButton,
|
|
107
|
+
hideIcon: !showIcon,
|
|
108
|
+
icon,
|
|
109
|
+
loadingIcon,
|
|
110
|
+
onClose,
|
|
111
|
+
promise,
|
|
112
|
+
shouldShowTimeoutProgress,
|
|
113
|
+
timeout,
|
|
114
|
+
title,
|
|
115
|
+
variant
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// src/Toast/ToastProvider.tsx
|
|
120
|
+
import { toast as heroToastVariants2 } from "@heroui/theme";
|
|
121
|
+
import { ToastProvider as HeroToastProvider } from "@heroui/toast";
|
|
122
|
+
import { variantsToClassNames as variantsToClassNames2 } from "@fuf-stack/pixel-utils";
|
|
123
|
+
import { jsx } from "react/jsx-runtime";
|
|
124
|
+
var ToastProvider = ({
|
|
125
|
+
disableAnimation = false,
|
|
126
|
+
maxVisibleToasts = 5,
|
|
127
|
+
placement = "top-center",
|
|
128
|
+
toastProps = void 0,
|
|
129
|
+
toastOffset = 26,
|
|
130
|
+
regionProps = void 0
|
|
131
|
+
}) => {
|
|
132
|
+
const variants = toastVariants({
|
|
133
|
+
color: toastProps == null ? void 0 : toastProps.color,
|
|
134
|
+
variant: toastProps == null ? void 0 : toastProps.variant
|
|
135
|
+
});
|
|
136
|
+
const isHeroUIColor = Object.keys(heroToastVariants2.variants.color).includes(
|
|
137
|
+
(toastProps == null ? void 0 : toastProps.color) || ""
|
|
138
|
+
);
|
|
139
|
+
const classNames = variantsToClassNames2(
|
|
140
|
+
variants,
|
|
141
|
+
toastProps == null ? void 0 : toastProps.className,
|
|
142
|
+
"base"
|
|
143
|
+
);
|
|
144
|
+
return /* @__PURE__ */ jsx(
|
|
145
|
+
HeroToastProvider,
|
|
146
|
+
{
|
|
147
|
+
disableAnimation,
|
|
148
|
+
maxVisibleToasts,
|
|
149
|
+
placement,
|
|
150
|
+
regionProps,
|
|
151
|
+
toastOffset,
|
|
152
|
+
toastProps: __spreadProps(__spreadValues({}, toastProps), {
|
|
153
|
+
classNames,
|
|
154
|
+
color: isHeroUIColor ? toastProps == null ? void 0 : toastProps.color : void 0
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
var ToastProvider_default = ToastProvider;
|
|
160
|
+
|
|
161
|
+
// src/Toast/index.ts
|
|
162
|
+
var Toast_default = ToastProvider_default;
|
|
163
|
+
|
|
164
|
+
export {
|
|
165
|
+
toastVariants,
|
|
166
|
+
addToast,
|
|
167
|
+
ToastProvider_default,
|
|
168
|
+
Toast_default
|
|
169
|
+
};
|
|
170
|
+
//# sourceMappingURL=chunk-KSAL4SBX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Toast/addToast.tsx","../src/Toast/ToastProvider.tsx","../src/Toast/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ToastProps as HeroToastProps } from '@heroui/toast';\nimport type { ReactNode } from 'react';\n\nimport { toast as heroToastVariants } from '@heroui/theme';\nimport { addToast as heroAddToast } from '@heroui/toast';\n\nimport { tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nexport const toastVariants = tv({\n slots: {\n base: '',\n title: '',\n description: '',\n icon: '',\n loadingIcon: '',\n content: '',\n motionDiv: '',\n progressTrack: '',\n progressIndicator: '',\n closeButton: '',\n closeIcon: '',\n },\n variants: {\n // see: https://github.com/heroui-inc/heroui/blob/canary/packages/core/theme/src/components/toast.ts\n color: {\n info: {},\n ...heroToastVariants.variants.color,\n },\n variant: {\n ...heroToastVariants.variants.variant,\n },\n },\n compoundVariants: [\n ...heroToastVariants.compoundVariants,\n {\n variant: 'solid',\n color: 'info',\n className: {\n base: 'bg-info text-info-foreground',\n title: 'text-info-foreground',\n description: 'text-info-foreground',\n icon: 'text-info-foreground',\n closeIcon: 'border-info-400 bg-info-100',\n closeButton: 'text-info-400 hover:text-info-600',\n progressIndicator: 'bg-info-400',\n },\n },\n {\n color: 'info',\n variant: 'flat',\n className: {\n base: 'bg-info-50 text-info-600 dark:bg-info-50/50',\n title: 'text-info-600',\n description: 'text-info-500',\n icon: 'text-info-600',\n closeIcon: 'border-info-400 bg-info-100',\n closeButton: 'text-info-400 hover:text-info-600',\n progressIndicator: 'bg-info-400',\n },\n },\n\n {\n color: 'info',\n variant: 'bordered',\n className: {\n base: 'border-small border-info text-info-600',\n title: 'text-info-600',\n description: 'text-info-500',\n icon: 'text-info-600',\n closeIcon: 'border-info-400 bg-info-100',\n closeButton: 'text-info-400 hover:text-info-600',\n progressIndicator: 'bg-info-400',\n },\n },\n ],\n});\n\nexport type AddToastVariantProps = TVProps<typeof toastVariants>;\ntype ClassName = TVClassName<typeof toastVariants>;\n\nexport interface ToastProps extends AddToastVariantProps {\n /** CSS class name */\n className?: ClassName;\n /** Icon displayed at the end of the Alert */\n closeIcon?: ReactNode;\n /** Color of the alert */\n color?: AddToastVariantProps['color'];\n /** Content displayed inside the Alert */\n description?: ReactNode;\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 /** Icon or animation displayed until promise is resolved */\n loadingIcon?: ReactNode;\n /** Callback function called when the toast is closed */\n onClose?: () => void;\n /** Promise based on which the notification will be styled */\n promise?: Promise<void>;\n /** Whether the toast should show a progress bar */\n shouldShowTimeoutProgress?: boolean;\n /** Whether the toast should show a close button */\n showCloseButton?: boolean;\n /** Whether the toast should show an icon */\n showIcon?: boolean;\n /** Time the toast is displayed */\n timeout?: number;\n /** Content displayed at the top of the toast */\n title?: ReactNode;\n /** Variant of the toast */\n variant?: AddToastVariantProps['variant'];\n}\n\n/**\n * addToast function based on [HeroUI Toast](https://www.heroui.com//docs/components/toast)\n */\nexport const addToast = ({\n className = undefined,\n closeIcon = undefined,\n color = 'default',\n description = undefined,\n endContent = undefined,\n icon = undefined,\n loadingIcon = undefined,\n onClose = undefined,\n promise = undefined,\n shouldShowTimeoutProgress = false,\n showCloseButton = true,\n showIcon = true,\n timeout = 5000,\n title = undefined,\n variant = 'bordered',\n}: ToastProps) => {\n const variants = toastVariants({\n color,\n variant,\n });\n const isHeroUIColor = Object.keys(heroToastVariants.variants.color).includes(\n color,\n );\n const classNames = variantsToClassNames(variants, className, 'base');\n heroAddToast({\n classNames,\n closeIcon,\n color: isHeroUIColor ? (color as HeroToastProps['color']) : undefined,\n // TODO: 'data-testid': testId,\n description,\n endContent,\n hideCloseButton: !showCloseButton,\n hideIcon: !showIcon,\n icon,\n loadingIcon,\n onClose,\n promise,\n shouldShowTimeoutProgress,\n timeout,\n title,\n variant,\n });\n};\n\nexport default addToast;\n","import type { ToastProps as HeroToastProps } from '@heroui/toast';\nimport type { ToastProps } from './addToast';\n\nimport { toast as heroToastVariants } from '@heroui/theme';\nimport { ToastProvider as HeroToastProvider } from '@heroui/toast';\n\nimport { variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { toastVariants } from './addToast';\n\nexport type ToastProviderToastProps = Omit<\n ToastProps,\n 'description' | 'endContent' | 'title'\n>;\n\nexport interface ToastProviderProps {\n disableAnimation?: boolean;\n maxVisibleToasts?: number;\n placement?:\n | 'bottom-right'\n | 'bottom-left'\n | 'bottom-center'\n | 'top-right'\n | 'top-left'\n | 'top-center';\n\n toastProps?: ToastProviderToastProps;\n toastOffset?: number;\n regionProps?: { classNames?: Record<'base', string> };\n}\n\n/**\n * ToastProvider component based on [HeroUI Toast](https://www.heroui.com//docs/components/toast)\n */\nconst ToastProvider = ({\n disableAnimation = false,\n maxVisibleToasts = 5,\n placement = 'top-center',\n toastProps = undefined,\n toastOffset = 26,\n regionProps = undefined,\n}: ToastProviderProps) => {\n const variants = toastVariants({\n color: toastProps?.color,\n variant: toastProps?.variant,\n });\n const isHeroUIColor = Object.keys(heroToastVariants.variants.color).includes(\n toastProps?.color || '',\n );\n const classNames = variantsToClassNames(\n variants,\n toastProps?.className,\n 'base',\n );\n return (\n <HeroToastProvider\n disableAnimation={disableAnimation}\n maxVisibleToasts={maxVisibleToasts}\n placement={placement}\n regionProps={regionProps}\n toastOffset={toastOffset}\n toastProps={{\n ...toastProps,\n classNames,\n color: isHeroUIColor\n ? (toastProps?.color as HeroToastProps['color'])\n : undefined,\n }}\n />\n );\n};\n\nexport default ToastProvider;\n","import { addToast, toastVariants } from './addToast';\nimport ToastProvider from './ToastProvider';\n\nexport type { ToastProps, AddToastVariantProps } from './addToast';\nexport type { ToastProviderProps } from './ToastProvider';\n\nexport { addToast, ToastProvider, toastVariants };\n\nexport default ToastProvider;\n"],"mappings":";;;;;;AAIA,SAAS,SAAS,yBAAyB;AAC3C,SAAS,YAAY,oBAAoB;AAEzC,SAAS,IAAI,4BAA4B;AAElC,IAAM,gBAAgB,GAAG;AAAA,EAC9B,OAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,aAAa;AAAA,IACb,MAAM;AAAA,IACN,aAAa;AAAA,IACb,SAAS;AAAA,IACT,WAAW;AAAA,IACX,eAAe;AAAA,IACf,mBAAmB;AAAA,IACnB,aAAa;AAAA,IACb,WAAW;AAAA,EACb;AAAA,EACA,UAAU;AAAA;AAAA,IAER,OAAO;AAAA,MACL,MAAM,CAAC;AAAA,OACJ,kBAAkB,SAAS;AAAA,IAEhC,SAAS,mBACJ,kBAAkB,SAAS;AAAA,EAElC;AAAA,EACA,kBAAkB;AAAA,IAChB,GAAG,kBAAkB;AAAA,IACrB;AAAA,MACE,SAAS;AAAA,MACT,OAAO;AAAA,MACP,WAAW;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,QACb,MAAM;AAAA,QACN,WAAW;AAAA,QACX,aAAa;AAAA,QACb,mBAAmB;AAAA,MACrB;AAAA,IACF;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,SAAS;AAAA,MACT,WAAW;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,QACb,MAAM;AAAA,QACN,WAAW;AAAA,QACX,aAAa;AAAA,QACb,mBAAmB;AAAA,MACrB;AAAA,IACF;AAAA,IAEA;AAAA,MACE,OAAO;AAAA,MACP,SAAS;AAAA,MACT,WAAW;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,QACb,MAAM;AAAA,QACN,WAAW;AAAA,QACX,aAAa;AAAA,QACb,mBAAmB;AAAA,MACrB;AAAA,IACF;AAAA,EACF;AACF,CAAC;AAyCM,I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A,IACZ;AAAA,EACF;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,YAAY,iCACP,aADO;AAAA,QAEV;AAAA,QACA,OAAO,gBACF,yCAAY,QACb;AAAA,MACN;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,wBAAQ;;;AChEf,IAAO,gBAAQ;","names":["heroToastVariants","variantsToClassNames","heroToastVariants","variantsToClassNames"]}
|
package/dist/index.cjs
CHANGED
|
@@ -16,6 +16,11 @@ var _chunkAJCAIA6Hcjs = require('./chunk-AJCAIA6H.cjs');
|
|
|
16
16
|
var _chunkJUHSESWBcjs = require('./chunk-JUHSESWB.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var _chunk5XFAJUE5cjs = require('./chunk-5XFAJUE5.cjs');
|
|
22
|
+
|
|
23
|
+
|
|
19
24
|
var _chunk25AJSW5Ecjs = require('./chunk-25AJSW5E.cjs');
|
|
20
25
|
|
|
21
26
|
|
|
@@ -79,165 +84,7 @@ var _chunkZZOEFQWQcjs = require('./chunk-ZZOEFQWQ.cjs');
|
|
|
79
84
|
|
|
80
85
|
|
|
81
86
|
var _chunkFLPLJTACcjs = require('./chunk-FLPLJTAC.cjs');
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
var _chunkD4TLDLEXcjs = require('./chunk-D4TLDLEX.cjs');
|
|
86
|
-
|
|
87
|
-
// src/Toast/addToast.tsx
|
|
88
|
-
var _theme = require('@heroui/theme');
|
|
89
|
-
var _toast = require('@heroui/toast');
|
|
90
|
-
var _pixelutils = require('@fuf-stack/pixel-utils');
|
|
91
|
-
var toastVariants = _pixelutils.tv.call(void 0, {
|
|
92
|
-
slots: {
|
|
93
|
-
base: "",
|
|
94
|
-
title: "",
|
|
95
|
-
description: "",
|
|
96
|
-
icon: "",
|
|
97
|
-
loadingIcon: "",
|
|
98
|
-
content: "",
|
|
99
|
-
motionDiv: "",
|
|
100
|
-
progressTrack: "",
|
|
101
|
-
progressIndicator: "",
|
|
102
|
-
closeButton: "",
|
|
103
|
-
closeIcon: ""
|
|
104
|
-
},
|
|
105
|
-
variants: {
|
|
106
|
-
// see: https://github.com/heroui-inc/heroui/blob/canary/packages/core/theme/src/components/toast.ts
|
|
107
|
-
color: _chunkD4TLDLEXcjs.__spreadValues.call(void 0, {
|
|
108
|
-
info: {}
|
|
109
|
-
}, _theme.toast.variants.color),
|
|
110
|
-
variant: _chunkD4TLDLEXcjs.__spreadValues.call(void 0, {}, _theme.toast.variants.variant)
|
|
111
|
-
},
|
|
112
|
-
compoundVariants: [
|
|
113
|
-
..._theme.toast.compoundVariants,
|
|
114
|
-
{
|
|
115
|
-
variant: "solid",
|
|
116
|
-
color: "info",
|
|
117
|
-
className: {
|
|
118
|
-
base: "bg-info text-info-foreground",
|
|
119
|
-
title: "text-info-foreground",
|
|
120
|
-
description: "text-info-foreground",
|
|
121
|
-
icon: "text-info-foreground",
|
|
122
|
-
closeIcon: "border-info-400 bg-info-100",
|
|
123
|
-
closeButton: "text-info-400 hover:text-info-600",
|
|
124
|
-
progressIndicator: "bg-info-400"
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
color: "info",
|
|
129
|
-
variant: "flat",
|
|
130
|
-
className: {
|
|
131
|
-
base: "bg-info-50 text-info-600 dark:bg-info-50/50",
|
|
132
|
-
title: "text-info-600",
|
|
133
|
-
description: "text-info-500",
|
|
134
|
-
icon: "text-info-600",
|
|
135
|
-
closeIcon: "border-info-400 bg-info-100",
|
|
136
|
-
closeButton: "text-info-400 hover:text-info-600",
|
|
137
|
-
progressIndicator: "bg-info-400"
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
color: "info",
|
|
142
|
-
variant: "bordered",
|
|
143
|
-
className: {
|
|
144
|
-
base: "border-small border-info text-info-600",
|
|
145
|
-
title: "text-info-600",
|
|
146
|
-
description: "text-info-500",
|
|
147
|
-
icon: "text-info-600",
|
|
148
|
-
closeIcon: "border-info-400 bg-info-100",
|
|
149
|
-
closeButton: "text-info-400 hover:text-info-600",
|
|
150
|
-
progressIndicator: "bg-info-400"
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
]
|
|
154
|
-
});
|
|
155
|
-
var addToast = ({
|
|
156
|
-
className = void 0,
|
|
157
|
-
closeIcon = void 0,
|
|
158
|
-
color = "default",
|
|
159
|
-
description = void 0,
|
|
160
|
-
endContent = void 0,
|
|
161
|
-
icon = void 0,
|
|
162
|
-
loadingIcon = void 0,
|
|
163
|
-
onClose = void 0,
|
|
164
|
-
promise = void 0,
|
|
165
|
-
shouldShowTimeoutProgress = false,
|
|
166
|
-
showCloseButton = true,
|
|
167
|
-
showIcon = true,
|
|
168
|
-
timeout = 5e3,
|
|
169
|
-
title = void 0,
|
|
170
|
-
variant = "bordered"
|
|
171
|
-
}) => {
|
|
172
|
-
const variants = toastVariants({
|
|
173
|
-
color,
|
|
174
|
-
variant
|
|
175
|
-
});
|
|
176
|
-
const isHeroUIColor = Object.keys(_theme.toast.variants.color).includes(
|
|
177
|
-
color
|
|
178
|
-
);
|
|
179
|
-
const classNames = _pixelutils.variantsToClassNames.call(void 0, variants, className, "base");
|
|
180
|
-
_toast.addToast.call(void 0, {
|
|
181
|
-
classNames,
|
|
182
|
-
closeIcon,
|
|
183
|
-
color: isHeroUIColor ? color : void 0,
|
|
184
|
-
// TODO: 'data-testid': testId,
|
|
185
|
-
description,
|
|
186
|
-
endContent,
|
|
187
|
-
hideCloseButton: !showCloseButton,
|
|
188
|
-
hideIcon: !showIcon,
|
|
189
|
-
icon,
|
|
190
|
-
loadingIcon,
|
|
191
|
-
onClose,
|
|
192
|
-
promise,
|
|
193
|
-
shouldShowTimeoutProgress,
|
|
194
|
-
timeout,
|
|
195
|
-
title,
|
|
196
|
-
variant
|
|
197
|
-
});
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
// src/Toast/ToastProvider.tsx
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
var _jsxruntime = require('react/jsx-runtime');
|
|
205
|
-
var ToastProvider = ({
|
|
206
|
-
disableAnimation = false,
|
|
207
|
-
maxVisibleToasts = 5,
|
|
208
|
-
placement = "top-center",
|
|
209
|
-
toastProps = void 0,
|
|
210
|
-
toastOffset = 26,
|
|
211
|
-
regionProps = void 0
|
|
212
|
-
}) => {
|
|
213
|
-
const variants = toastVariants({
|
|
214
|
-
color: toastProps == null ? void 0 : toastProps.color,
|
|
215
|
-
variant: toastProps == null ? void 0 : toastProps.variant
|
|
216
|
-
});
|
|
217
|
-
const isHeroUIColor = Object.keys(_theme.toast.variants.color).includes(
|
|
218
|
-
(toastProps == null ? void 0 : toastProps.color) || ""
|
|
219
|
-
);
|
|
220
|
-
const classNames = _pixelutils.variantsToClassNames.call(void 0,
|
|
221
|
-
variants,
|
|
222
|
-
toastProps == null ? void 0 : toastProps.className,
|
|
223
|
-
"base"
|
|
224
|
-
);
|
|
225
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
226
|
-
_toast.ToastProvider,
|
|
227
|
-
{
|
|
228
|
-
disableAnimation,
|
|
229
|
-
maxVisibleToasts,
|
|
230
|
-
placement,
|
|
231
|
-
regionProps,
|
|
232
|
-
toastOffset,
|
|
233
|
-
toastProps: _chunkD4TLDLEXcjs.__spreadProps.call(void 0, _chunkD4TLDLEXcjs.__spreadValues.call(void 0, {}, toastProps), {
|
|
234
|
-
classNames,
|
|
235
|
-
color: isHeroUIColor ? toastProps == null ? void 0 : toastProps.color : void 0
|
|
236
|
-
})
|
|
237
|
-
}
|
|
238
|
-
);
|
|
239
|
-
};
|
|
240
|
-
var ToastProvider_default = ToastProvider;
|
|
87
|
+
require('./chunk-D4TLDLEX.cjs');
|
|
241
88
|
|
|
242
89
|
|
|
243
90
|
|
|
@@ -280,5 +127,5 @@ var ToastProvider_default = ToastProvider;
|
|
|
280
127
|
|
|
281
128
|
|
|
282
129
|
|
|
283
|
-
exports.Accordion = _chunk2P5WWVQ6cjs.Accordion_default; exports.Alert = _chunkYVPRFCWIcjs.Alert_default; exports.Avatar = _chunk77J7NZYBcjs.Avatar_default; exports.AvatarGroup = _chunkLIZGYO24cjs.AvatarGroup_default; exports.Badge = _chunkJSANDW3Wcjs.Badge_default; exports.Breadcrumb = _chunkZZOEFQWQcjs.Breadcrumb_default; exports.Button = _chunkFLPLJTACcjs.Button_default; exports.ButtonGroup = _chunkY3RSI2KVcjs.ButtonGroup_default; exports.Card = _chunkMHZAWSFJcjs.Card_default; exports.Drawer = _chunk7RVUB6I5cjs.Drawer_default; exports.Json = _chunkJ63YGHTGcjs.Json_default; exports.Label = _chunkPLJWIGRScjs.Label_default; exports.Menu = _chunkXHOAZB2Zcjs.Menu_default; exports.Modal = _chunkPEUUQMJScjs.Modal_default; exports.Popover = _chunkEAX5J2I2cjs.Popover_default; exports.Progress = _chunkVGXW3PSFcjs.Progress_default; exports.ProgressCircular = _chunkWCRVH4DScjs.ProgressCircular_default; exports.Table = _chunkAJCAIA6Hcjs.Table_default; exports.Tabs = _chunkJUHSESWBcjs.Tabs_default; exports.ToastProvider = ToastProvider_default; exports.Tooltip = _chunk25AJSW5Ecjs.Tooltip_default; exports.accordionVariants = _chunk2P5WWVQ6cjs.accordionVariants; exports.addToast = addToast; exports.alertVariants = _chunkYVPRFCWIcjs.alertVariants; exports.breadcrumbVariants = _chunkZZOEFQWQcjs.breadcrumbVariants; exports.buttonVariants = _chunkFLPLJTACcjs.buttonVariants; exports.cardVariants = _chunkMHZAWSFJcjs.cardVariants; exports.drawerBackdrops = _chunk7RVUB6I5cjs.drawerBackdrops; exports.drawerPlacements = _chunk7RVUB6I5cjs.drawerPlacements; exports.drawerRadii = _chunk7RVUB6I5cjs.drawerRadii; exports.drawerSizes = _chunk7RVUB6I5cjs.drawerSizes; exports.drawerVariants = _chunk7RVUB6I5cjs.drawerVariants; exports.labelVariants = _chunkPLJWIGRScjs.labelVariants; exports.modalVariants = _chunkPEUUQMJScjs.modalVariants; exports.progressCircularVariants = _chunkWCRVH4DScjs.progressCircularVariants; exports.progressVariants = _chunkVGXW3PSFcjs.progressVariants; exports.tableVariants = _chunkAJCAIA6Hcjs.tableVariants; exports.tabsVariants = _chunkJUHSESWBcjs.tabsVariants; exports.toastVariants = toastVariants; exports.useDebounce = _chunkMWNBYTRNcjs.useDebounce; exports.useLocalStorage = _chunkMWNBYTRNcjs.useLocalStorage;
|
|
130
|
+
exports.Accordion = _chunk2P5WWVQ6cjs.Accordion_default; exports.Alert = _chunkYVPRFCWIcjs.Alert_default; exports.Avatar = _chunk77J7NZYBcjs.Avatar_default; exports.AvatarGroup = _chunkLIZGYO24cjs.AvatarGroup_default; exports.Badge = _chunkJSANDW3Wcjs.Badge_default; exports.Breadcrumb = _chunkZZOEFQWQcjs.Breadcrumb_default; exports.Button = _chunkFLPLJTACcjs.Button_default; exports.ButtonGroup = _chunkY3RSI2KVcjs.ButtonGroup_default; exports.Card = _chunkMHZAWSFJcjs.Card_default; exports.Drawer = _chunk7RVUB6I5cjs.Drawer_default; exports.Json = _chunkJ63YGHTGcjs.Json_default; exports.Label = _chunkPLJWIGRScjs.Label_default; exports.Menu = _chunkXHOAZB2Zcjs.Menu_default; exports.Modal = _chunkPEUUQMJScjs.Modal_default; exports.Popover = _chunkEAX5J2I2cjs.Popover_default; exports.Progress = _chunkVGXW3PSFcjs.Progress_default; exports.ProgressCircular = _chunkWCRVH4DScjs.ProgressCircular_default; exports.Table = _chunkAJCAIA6Hcjs.Table_default; exports.Tabs = _chunkJUHSESWBcjs.Tabs_default; exports.ToastProvider = _chunk5XFAJUE5cjs.ToastProvider_default; exports.Tooltip = _chunk25AJSW5Ecjs.Tooltip_default; exports.accordionVariants = _chunk2P5WWVQ6cjs.accordionVariants; exports.addToast = _chunk5XFAJUE5cjs.addToast; exports.alertVariants = _chunkYVPRFCWIcjs.alertVariants; exports.breadcrumbVariants = _chunkZZOEFQWQcjs.breadcrumbVariants; exports.buttonVariants = _chunkFLPLJTACcjs.buttonVariants; exports.cardVariants = _chunkMHZAWSFJcjs.cardVariants; exports.drawerBackdrops = _chunk7RVUB6I5cjs.drawerBackdrops; exports.drawerPlacements = _chunk7RVUB6I5cjs.drawerPlacements; exports.drawerRadii = _chunk7RVUB6I5cjs.drawerRadii; exports.drawerSizes = _chunk7RVUB6I5cjs.drawerSizes; exports.drawerVariants = _chunk7RVUB6I5cjs.drawerVariants; exports.labelVariants = _chunkPLJWIGRScjs.labelVariants; exports.modalVariants = _chunkPEUUQMJScjs.modalVariants; exports.progressCircularVariants = _chunkWCRVH4DScjs.progressCircularVariants; exports.progressVariants = _chunkVGXW3PSFcjs.progressVariants; exports.tableVariants = _chunkAJCAIA6Hcjs.tableVariants; exports.tabsVariants = _chunkJUHSESWBcjs.tabsVariants; exports.toastVariants = _chunk5XFAJUE5cjs.toastVariants; exports.useDebounce = _chunkMWNBYTRNcjs.useDebounce; exports.useLocalStorage = _chunkMWNBYTRNcjs.useLocalStorage;
|
|
284
131
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/pixels/dist/index.cjs","../src/Toast/addToast.tsx","../src/Toast/ToastProvider.tsx"],"names":["heroToastVariants","variantsToClassNames"],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;A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A,EAAA,EAAA,UAAA,CAAY,KAAA;AAAA,IACnB,OAAA,EAAS,WAAA,GAAA,KAAA,EAAA,KAAA,EAAA,EAAA,UAAA,CAAY;AAAA,EACvB,CAAC,CAAA;AACD,EAAA,MAAM,cAAA,EAAgB,MAAA,CAAO,IAAA,CAAKA,YAAAA,CAAkB,QAAA,CAAS,KAAK,CAAA,CAAE,QAAA;AAAA,IAAA,CAClE,WAAA,GAAA,KAAA,EAAA,KAAA,EAAA,EAAA,UAAA,CAAY,KAAA,EAAA,GAAS;AAAA,EACvB,CAAA;AACA,EAAA,MAAM,WAAA,EAAaC,8CAAAA;AAAA,IACjB,QAAA;AAAA,IACA,WAAA,GAAA,KAAA,EAAA,KAAA,EAAA,EAAA,UAAA,CAAY,SAAA;AAAA,IACZ;AAAA,EACF,CAAA;AACA,EAAA,uBACE,6BAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,gBAAA;AAAA,MACA,gBAAA;AAAA,MACA,SAAA;AAAA,MACA,WAAA;AAAA,MACA,WAAA;AAAA,MACA,UAAA,EAAY,6CAAA,8CAAA,CAAA,CAAA,EACP,UAAA,CAAA,EADO;AAAA,QAEV,UAAA;AAAA,QACA,KAAA,EAAO,cAAA,EACF,WAAA,GAAA,KAAA,EAAA,KAAA,EAAA,EAAA,UAAA,CAAY,MAAA,EACb,KAAA;AAAA,MACN,CAAA;AAAA,IAAA;AAAA,EACF,CAAA;AAEJ,CAAA;AAEA,IAAO,sBAAA,EAAQ,aAAA;AFwKf;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,osEAAC","file":"/home/runner/work/pixels/pixels/packages/pixels/dist/index.cjs","sourcesContent":[null,"import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ToastProps as HeroToastProps } from '@heroui/toast';\nimport type { ReactNode } from 'react';\n\nimport { toast as heroToastVariants } from '@heroui/theme';\nimport { addToast as heroAddToast } from '@heroui/toast';\n\nimport { tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nexport const toastVariants = tv({\n slots: {\n base: '',\n title: '',\n description: '',\n icon: '',\n loadingIcon: '',\n content: '',\n motionDiv: '',\n progressTrack: '',\n progressIndicator: '',\n closeButton: '',\n closeIcon: '',\n },\n variants: {\n // see: https://github.com/heroui-inc/heroui/blob/canary/packages/core/theme/src/components/toast.ts\n color: {\n info: {},\n ...heroToastVariants.variants.color,\n },\n variant: {\n ...heroToastVariants.variants.variant,\n },\n },\n compoundVariants: [\n ...heroToastVariants.compoundVariants,\n {\n variant: 'solid',\n color: 'info',\n className: {\n base: 'bg-info text-info-foreground',\n title: 'text-info-foreground',\n description: 'text-info-foreground',\n icon: 'text-info-foreground',\n closeIcon: 'border-info-400 bg-info-100',\n closeButton: 'text-info-400 hover:text-info-600',\n progressIndicator: 'bg-info-400',\n },\n },\n {\n color: 'info',\n variant: 'flat',\n className: {\n base: 'bg-info-50 text-info-600 dark:bg-info-50/50',\n title: 'text-info-600',\n description: 'text-info-500',\n icon: 'text-info-600',\n closeIcon: 'border-info-400 bg-info-100',\n closeButton: 'text-info-400 hover:text-info-600',\n progressIndicator: 'bg-info-400',\n },\n },\n\n {\n color: 'info',\n variant: 'bordered',\n className: {\n base: 'border-small border-info text-info-600',\n title: 'text-info-600',\n description: 'text-info-500',\n icon: 'text-info-600',\n closeIcon: 'border-info-400 bg-info-100',\n closeButton: 'text-info-400 hover:text-info-600',\n progressIndicator: 'bg-info-400',\n },\n },\n ],\n});\n\nexport type AddToastVariantProps = TVProps<typeof toastVariants>;\ntype ClassName = TVClassName<typeof toastVariants>;\n\nexport interface ToastProps extends AddToastVariantProps {\n /** CSS class name */\n className?: ClassName;\n /** Icon displayed at the end of the Alert */\n closeIcon?: ReactNode;\n /** Color of the alert */\n color?: AddToastVariantProps['color'];\n /** Content displayed inside the Alert */\n description?: ReactNode;\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 /** Icon or animation displayed until promise is resolved */\n loadingIcon?: ReactNode;\n /** Callback function called when the toast is closed */\n onClose?: () => void;\n /** Promise based on which the notification will be styled */\n promise?: Promise<void>;\n /** Whether the toast should show a progress bar */\n shouldShowTimeoutProgress?: boolean;\n /** Whether the toast should show a close button */\n showCloseButton?: boolean;\n /** Whether the toast should show an icon */\n showIcon?: boolean;\n /** Time the toast is displayed */\n timeout?: number;\n /** Content displayed at the top of the toast */\n title?: ReactNode;\n /** Variant of the toast */\n variant?: AddToastVariantProps['variant'];\n}\n\n/**\n * addToast function based on [HeroUI Toast](https://www.heroui.com//docs/components/toast)\n */\nexport const addToast = ({\n className = undefined,\n closeIcon = undefined,\n color = 'default',\n description = undefined,\n endContent = undefined,\n icon = undefined,\n loadingIcon = undefined,\n onClose = undefined,\n promise = undefined,\n shouldShowTimeoutProgress = false,\n showCloseButton = true,\n showIcon = true,\n timeout = 5000,\n title = undefined,\n variant = 'bordered',\n}: ToastProps) => {\n const variants = toastVariants({\n color,\n variant,\n });\n const isHeroUIColor = Object.keys(heroToastVariants.variants.color).includes(\n color,\n );\n const classNames = variantsToClassNames(variants, className, 'base');\n heroAddToast({\n classNames,\n closeIcon,\n color: isHeroUIColor ? (color as HeroToastProps['color']) : undefined,\n // TODO: 'data-testid': testId,\n description,\n endContent,\n hideCloseButton: !showCloseButton,\n hideIcon: !showIcon,\n icon,\n loadingIcon,\n onClose,\n promise,\n shouldShowTimeoutProgress,\n timeout,\n title,\n variant,\n });\n};\n\nexport default addToast;\n","import type { ToastProps as HeroToastProps } from '@heroui/toast';\nimport type { ToastProps } from './addToast';\n\nimport { toast as heroToastVariants } from '@heroui/theme';\nimport { ToastProvider as HeroToastProvider } from '@heroui/toast';\n\nimport { variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { toastVariants } from './addToast';\n\nexport type ToastProviderToastProps = Omit<\n ToastProps,\n 'description' | 'endContent' | 'title'\n>;\n\nexport interface ToastProviderProps {\n disableAnimation?: boolean;\n maxVisibleToasts?: number;\n placement?:\n | 'bottom-right'\n | 'bottom-left'\n | 'bottom-center'\n | 'top-right'\n | 'top-left'\n | 'top-center';\n\n toastProps?: ToastProviderToastProps;\n toastOffset?: number;\n regionProps?: { classNames?: Record<'base', string> };\n}\n\n/**\n * ToastProvider component based on [HeroUI Toast](https://www.heroui.com//docs/components/toast)\n */\nconst ToastProvider = ({\n disableAnimation = false,\n maxVisibleToasts = 5,\n placement = 'top-center',\n toastProps = undefined,\n toastOffset = 26,\n regionProps = undefined,\n}: ToastProviderProps) => {\n const variants = toastVariants({\n color: toastProps?.color,\n variant: toastProps?.variant,\n });\n const isHeroUIColor = Object.keys(heroToastVariants.variants.color).includes(\n toastProps?.color || '',\n );\n const classNames = variantsToClassNames(\n variants,\n toastProps?.className,\n 'base',\n );\n return (\n <HeroToastProvider\n disableAnimation={disableAnimation}\n maxVisibleToasts={maxVisibleToasts}\n placement={placement}\n regionProps={regionProps}\n toastOffset={toastOffset}\n toastProps={{\n ...toastProps,\n classNames,\n color: isHeroUIColor\n ? (toastProps?.color as HeroToastProps['color'])\n : undefined,\n }}\n />\n );\n};\n\nexport default ToastProvider;\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/pixels/dist/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,0vEAAC","file":"/home/runner/work/pixels/pixels/packages/pixels/dist/index.cjs"}
|