@momo-webplatform/mobase 0.0.39 → 0.0.40
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/package.json +1 -1
- package/publish/cjs/components/Callout/Callout.js +46 -0
- package/publish/cjs/components/Callout/index.js +5 -0
- package/publish/cjs/components/SearchBar/SearchBar.js +48 -0
- package/publish/cjs/components/SearchBar/index.js +5 -0
- package/publish/cjs/components/TextButton/TextButton.js +63 -0
- package/publish/cjs/components/TextButton/index.js +5 -0
- package/publish/cjs/components/Toast/Toast.js +12 -11
- package/publish/cjs/components/Toast/index.js +4 -12
- package/publish/cjs/components/Toast/toaster.js +4 -4
- package/publish/cjs/components/Toast/{use-toast.js → useToast.js} +4 -2
- package/publish/cjs/index.js +4 -0
- package/publish/cjs/tsconfig.lib.tsbuildinfo +1 -1
- package/publish/esm/components/Callout/Callout.d.ts +19 -0
- package/publish/esm/components/Callout/Callout.js +43 -0
- package/publish/esm/components/Callout/index.d.ts +1 -0
- package/publish/esm/components/Callout/index.js +1 -0
- package/publish/esm/components/SearchBar/SearchBar.d.ts +7 -0
- package/publish/esm/components/SearchBar/SearchBar.js +45 -0
- package/publish/esm/components/SearchBar/index.d.ts +1 -0
- package/publish/esm/components/SearchBar/index.js +1 -0
- package/publish/esm/components/TextButton/TextButton.d.ts +22 -0
- package/publish/esm/components/TextButton/TextButton.js +36 -0
- package/publish/esm/components/TextButton/index.d.ts +2 -0
- package/publish/esm/components/TextButton/index.js +1 -0
- package/publish/esm/components/Toast/Toast.d.ts +1 -1
- package/publish/esm/components/Toast/Toast.js +13 -12
- package/publish/esm/components/Toast/index.d.ts +1 -2
- package/publish/esm/components/Toast/index.js +1 -2
- package/publish/esm/components/Toast/toaster.js +3 -3
- package/publish/esm/components/Toast/{use-toast.d.ts → useToast.d.ts} +1 -1
- package/publish/esm/components/Toast/{use-toast.js → useToast.js} +4 -2
- package/publish/esm/index.d.ts +4 -0
- package/publish/esm/index.js +4 -0
- package/publish/esm/tsconfig.lib.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Callout = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const class_variance_authority_1 = require("class-variance-authority");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const utils_1 = require("../../helpers/utils");
|
|
8
|
+
const outline_1 = require("@heroicons/react/24/outline");
|
|
9
|
+
const TextButton_1 = require("../TextButton");
|
|
10
|
+
const calloutVariants = (0, class_variance_authority_1.cva)("px-3 py-2 rounded-md border flex items-center space-x-2 text-gray-700 text-sm ", {
|
|
11
|
+
variants: {
|
|
12
|
+
typeDiv: {
|
|
13
|
+
neutral: "bg-gray-50 border-gray-300 ",
|
|
14
|
+
error: "bg-red-50 border-red-300",
|
|
15
|
+
success: "bg-green-50 border-green-300",
|
|
16
|
+
warning: "bg-yellow-50 border-yellow-300",
|
|
17
|
+
info: "bg-blue-50 border-blue-300",
|
|
18
|
+
},
|
|
19
|
+
disabled: {
|
|
20
|
+
true: "text-gray-400 bg-gray-50 opacity-55 pointer-events-none border-gray-300",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
typeDiv: "neutral",
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
const iconVariants = (0, class_variance_authority_1.cva)("w-5 h-5 shrink-0 border-none p-0 ", {
|
|
28
|
+
variants: {
|
|
29
|
+
typeIcon: {
|
|
30
|
+
neutral: "text-gray-700",
|
|
31
|
+
error: "text-red-700",
|
|
32
|
+
success: "text-green-700",
|
|
33
|
+
warning: "text-yellow-700",
|
|
34
|
+
info: "text-blue-700",
|
|
35
|
+
},
|
|
36
|
+
disabled: {
|
|
37
|
+
true: "text-gray-400",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
defaultVariants: {
|
|
41
|
+
typeIcon: "neutral",
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
exports.Callout = (0, react_1.forwardRef)(({ type = "neutral", message = "", withAction = false, onClickAction, className, disabled, actionClassName, ...props }, ref) => {
|
|
45
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, className: (0, utils_1.cn)("", className, calloutVariants({ typeDiv: type, disabled })), ...props, children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center space-x-2", children: [(0, jsx_runtime_1.jsx)(outline_1.InformationCircleIcon, { className: (0, utils_1.cn)(iconVariants({ typeIcon: type, disabled })), width: 20, height: 20 }), (0, jsx_runtime_1.jsx)("div", { children: "B\u1EA1n c\u1EA7n cho ph\u00E9p website s\u1EED d\u1EE5ng th\u00F4ng tin v\u1ECB tr\u00ED \u0111\u1EC3 s\u1EED d\u1EE5ng t\u00EDnh n\u0103ng n\u00E0y" })] }), withAction && ((0, jsx_runtime_1.jsx)(TextButton_1.TextButton, { variant: "primary", onClick: () => onClickAction?.(), className: (0, utils_1.cn)("", actionClassName), isDisabled: disabled, children: withAction }))] }));
|
|
46
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SearchBar = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const solid_1 = require("@heroicons/react/20/solid");
|
|
7
|
+
const outline_1 = require("@heroicons/react/24/outline");
|
|
8
|
+
const utils_1 = require("../../helpers/utils");
|
|
9
|
+
exports.SearchBar = (0, react_1.forwardRef)(({ disabled, className, inputClassName, size, onChange, onFocus, onClickClear, value, defaultValue, type = "text", ...restProps }, ref) => {
|
|
10
|
+
const [clearable, setClearable] = (0, react_1.useState)(false);
|
|
11
|
+
const rootRef = (0, react_1.useRef)(null);
|
|
12
|
+
const handleShowClearButton = (inputValue) => {
|
|
13
|
+
if (inputValue && !clearable) {
|
|
14
|
+
setClearable(true);
|
|
15
|
+
}
|
|
16
|
+
if (!inputValue && clearable) {
|
|
17
|
+
setClearable(false);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const onChangeFactory = (event) => {
|
|
21
|
+
handleShowClearButton(event.target.value);
|
|
22
|
+
onChange?.(event);
|
|
23
|
+
};
|
|
24
|
+
const onFocusFactory = (event) => {
|
|
25
|
+
handleShowClearButton(event.target.value);
|
|
26
|
+
onFocus?.(event);
|
|
27
|
+
};
|
|
28
|
+
const handleClear = () => {
|
|
29
|
+
const inputTarget = rootRef.current?.querySelector("input");
|
|
30
|
+
if (!inputTarget)
|
|
31
|
+
return;
|
|
32
|
+
onClickClear?.(inputTarget.value);
|
|
33
|
+
inputTarget.value = "";
|
|
34
|
+
inputTarget.focus();
|
|
35
|
+
setClearable(false);
|
|
36
|
+
};
|
|
37
|
+
(0, react_1.useEffect)(() => {
|
|
38
|
+
handleShowClearButton(defaultValue || value);
|
|
39
|
+
}, [value, defaultValue]);
|
|
40
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)(className), ref: rootRef, children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative flex items-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "absolute left-3 top-1/2 -translate-y-1/2 shrink-0 text-gray-500 duration-200 ", children: (0, jsx_runtime_1.jsx)(solid_1.MagnifyingGlassIcon, { className: "w-4 h-4 text-gray-500" }) }), (0, jsx_runtime_1.jsx)("input", { disabled: disabled, type: type, ref: ref, className: (0, utils_1.cn)("mobase-text-input-box text-gray-900 h-10 bg-white w-full transition-all text-sm rounded-md border border-gray-400 placeholder:text-gray-500 px-9 focus:border-pink-500 disabled:bg-gray-50 disabled:border-gray-300 disabled:pointer-events-none block disabled:opacity-50", inputClassName), onChange: onChangeFactory, onFocus: onFocusFactory, value: value, defaultValue: defaultValue, ...restProps }), clearable && ((0, jsx_runtime_1.jsx)("button", { "aria-label": "button", type: "button", className: "absolute right-3 top-1/2 -translate-y-1/2 shrink-0 cursor-pointer text-gray-500 duration-200 hover:opacity-70 disabled:pointer-events-none", disabled: disabled, onClick: handleClear, children: (0, jsx_runtime_1.jsx)(outline_1.XCircleIcon, { strokeWidth: 2, width: 20, height: 20 }) }))] }), (0, jsx_runtime_1.jsx)("style", { children: `
|
|
41
|
+
.mobase-text-input-box:hover {
|
|
42
|
+
box-shadow: 0px 0px 0px 1px rgb(var(--mobase-gray-400) / 1) inset;
|
|
43
|
+
}
|
|
44
|
+
.mobase-text-input-box:focus {
|
|
45
|
+
box-shadow: 0px 0px 0px 1px rgb(var(--mobase-pink-500) / 1) inset;
|
|
46
|
+
}
|
|
47
|
+
` })] }));
|
|
48
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SearchBar = void 0;
|
|
4
|
+
var SearchBar_1 = require("./SearchBar");
|
|
5
|
+
Object.defineProperty(exports, "SearchBar", { enumerable: true, get: function () { return SearchBar_1.SearchBar; } });
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.textButtonVariants = exports.TextButton = void 0;
|
|
27
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
|
+
const React = __importStar(require("react"));
|
|
29
|
+
const react_slot_1 = require("@radix-ui/react-slot");
|
|
30
|
+
const class_variance_authority_1 = require("class-variance-authority");
|
|
31
|
+
const utils_1 = require("../../helpers/utils");
|
|
32
|
+
// /dwd
|
|
33
|
+
const textButtonVariants = (0, class_variance_authority_1.cva)("inline-flex items-center justify-center whitespace-nowrap font-semibold transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed border border-transparent flex-nowrap", {
|
|
34
|
+
variants: {
|
|
35
|
+
/**
|
|
36
|
+
* Determines style variation of Button component.
|
|
37
|
+
*/
|
|
38
|
+
variant: {
|
|
39
|
+
default: "text-blue-700 hover:underline hover:bg-blue-50 disabled:bg-transparent disabled:text-gray-400 disabled:no-underline",
|
|
40
|
+
primary: "text-pink-500 hover:underline hover:bg-pink-50 disabled:bg-transparent disabled:text-gray-400 disabled:no-underline",
|
|
41
|
+
secondary: "text-gray-700 hover:underline hover:text-blue-700 hover:bg-blue-50 disabled:bg-transparent disabled:text-gray-400 disabled:no-underline",
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* Determines size variation of Button component.
|
|
45
|
+
*/
|
|
46
|
+
size: {
|
|
47
|
+
default: "text-sm",
|
|
48
|
+
lg: "text-base",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
defaultVariants: {
|
|
52
|
+
variant: "default",
|
|
53
|
+
size: "default",
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
exports.textButtonVariants = textButtonVariants;
|
|
57
|
+
const TextButton = React.forwardRef(({ className, variant = "default", size = "default", asChild = false, isDisabled = false, ...props }, ref) => {
|
|
58
|
+
const Comp = asChild ? react_slot_1.Slot : "button";
|
|
59
|
+
const buttonClassName = (0, utils_1.cn)(textButtonVariants({ variant, size, className }));
|
|
60
|
+
return ((0, jsx_runtime_1.jsx)(Comp, { className: buttonClassName, disabled: isDisabled, ref: ref, ...props, children: props.children }));
|
|
61
|
+
});
|
|
62
|
+
exports.TextButton = TextButton;
|
|
63
|
+
TextButton.displayName = "TextButton";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextButton = void 0;
|
|
4
|
+
var TextButton_1 = require("./TextButton");
|
|
5
|
+
Object.defineProperty(exports, "TextButton", { enumerable: true, get: function () { return TextButton_1.TextButton; } });
|
|
@@ -28,36 +28,37 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
28
28
|
const React = __importStar(require("react"));
|
|
29
29
|
const ToastPrimitives = __importStar(require("@radix-ui/react-toast"));
|
|
30
30
|
const class_variance_authority_1 = require("class-variance-authority");
|
|
31
|
-
const lucide_react_1 = require("lucide-react");
|
|
32
31
|
const utils_1 = require("../../helpers/utils");
|
|
32
|
+
const solid_1 = require("@heroicons/react/20/solid");
|
|
33
33
|
const ToastProvider = ToastPrimitives.Provider;
|
|
34
34
|
exports.ToastProvider = ToastProvider;
|
|
35
|
-
const ToastViewport = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(ToastPrimitives.Viewport, { ref: ref, className: (0, utils_1.cn)("fixed
|
|
35
|
+
const ToastViewport = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(ToastPrimitives.Viewport, { ref: ref, className: (0, utils_1.cn)("fixed bottom-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 left-0 sm:right-0 sm:left-auto sm:top-0 sm:bottom-auto sm:flex-col md:max-w-[420px]", className), ...props })));
|
|
36
36
|
exports.ToastViewport = ToastViewport;
|
|
37
37
|
ToastViewport.displayName = ToastPrimitives.Viewport.displayName;
|
|
38
|
-
const toastVariants = (0, class_variance_authority_1.cva)("group pointer-events-auto relative
|
|
38
|
+
const toastVariants = (0, class_variance_authority_1.cva)("group pointer-events-auto relative w-full overflow-hidden rounded-md border py-4 pr-10 pl-10 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-bottom-full data-[state=open]:sm:slide-in-from-top-full bg-white text-gray-900 border border-gray-200 border-l-4", {
|
|
39
39
|
variants: {
|
|
40
40
|
variant: {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
sucess: "border-l-green-500",
|
|
42
|
+
warning: "border-l-yellow-500",
|
|
43
|
+
error: "border-l-red-500",
|
|
43
44
|
},
|
|
44
45
|
},
|
|
45
46
|
defaultVariants: {
|
|
46
|
-
variant: "
|
|
47
|
+
variant: "sucess",
|
|
47
48
|
},
|
|
48
49
|
});
|
|
49
|
-
const Toast = React.forwardRef(({ className, variant, ...props }, ref) => {
|
|
50
|
-
return ((0, jsx_runtime_1.
|
|
50
|
+
const Toast = React.forwardRef(({ className, variant = "sucess", children, ...props }, ref) => {
|
|
51
|
+
return ((0, jsx_runtime_1.jsxs)(ToastPrimitives.Root, { ref: ref, className: (0, utils_1.cn)(toastVariants({ variant }), className), ...props, children: [(0, jsx_runtime_1.jsxs)("div", { className: "w-5 h-5 flex items-center justify-center absolute top-4 left-3", children: [variant === "sucess" && ((0, jsx_runtime_1.jsx)(solid_1.CheckCircleIcon, { className: "w-5 h-5 text-green-500" })), variant === "warning" && ((0, jsx_runtime_1.jsx)(solid_1.ExclamationTriangleIcon, { className: "w-5 h-5 text-yellow-500" })), variant === "error" && ((0, jsx_runtime_1.jsx)(solid_1.InformationCircleIcon, { className: "w-5 h-5 text-red-500" }))] }), children] }));
|
|
51
52
|
});
|
|
52
53
|
exports.Toast = Toast;
|
|
53
54
|
Toast.displayName = ToastPrimitives.Root.displayName;
|
|
54
|
-
const ToastAction = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(ToastPrimitives.Action, { ref: ref, className: (0, utils_1.cn)("inline-flex
|
|
55
|
+
const ToastAction = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(ToastPrimitives.Action, { ref: ref, className: (0, utils_1.cn)("inline-flex shrink-0 items-center justify-center bg-transparent text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-0 focus:ring-ring focus:ring-offset-0 disabled:pointer-events-none disabled:opacity-50 text-blue-600 hover:underline mt-2", className), ...props })));
|
|
55
56
|
exports.ToastAction = ToastAction;
|
|
56
57
|
ToastAction.displayName = ToastPrimitives.Action.displayName;
|
|
57
|
-
const ToastClose = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(ToastPrimitives.Close, { ref: ref, className: (0, utils_1.cn)("absolute right-2 top-2 rounded-md
|
|
58
|
+
const ToastClose = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(ToastPrimitives.Close, { ref: ref, className: (0, utils_1.cn)("absolute right-2 top-2 rounded-md transition-opacity hover:opacity-70 focus:opacity-100 focus:outline-none focus:ring-2 text-gray-800 w-8 h-8 flex items-center justify-center", className), "toast-close": "", ...props, children: (0, jsx_runtime_1.jsx)(solid_1.XMarkIcon, { className: "h-5 w-5" }) })));
|
|
58
59
|
exports.ToastClose = ToastClose;
|
|
59
60
|
ToastClose.displayName = ToastPrimitives.Close.displayName;
|
|
60
|
-
const ToastTitle = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(ToastPrimitives.Title, { ref: ref, className: (0, utils_1.cn)("text-
|
|
61
|
+
const ToastTitle = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(ToastPrimitives.Title, { ref: ref, className: (0, utils_1.cn)("text-base font-semibold leading-tight", className), ...props })));
|
|
61
62
|
exports.ToastTitle = ToastTitle;
|
|
62
63
|
ToastTitle.displayName = ToastPrimitives.Title.displayName;
|
|
63
64
|
const ToastDescription = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(ToastPrimitives.Description, { ref: ref, className: (0, utils_1.cn)("text-sm opacity-90", className), ...props })));
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Toaster = exports.toast = exports.useToast =
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "
|
|
6
|
-
Object.defineProperty(exports, "
|
|
7
|
-
Object.defineProperty(exports, "Toast", { enumerable: true, get: function () { return Toast_1.Toast; } });
|
|
8
|
-
Object.defineProperty(exports, "ToastTitle", { enumerable: true, get: function () { return Toast_1.ToastTitle; } });
|
|
9
|
-
Object.defineProperty(exports, "ToastDescription", { enumerable: true, get: function () { return Toast_1.ToastDescription; } });
|
|
10
|
-
Object.defineProperty(exports, "ToastClose", { enumerable: true, get: function () { return Toast_1.ToastClose; } });
|
|
11
|
-
Object.defineProperty(exports, "ToastAction", { enumerable: true, get: function () { return Toast_1.ToastAction; } });
|
|
12
|
-
var use_toast_1 = require("./use-toast");
|
|
13
|
-
Object.defineProperty(exports, "useToast", { enumerable: true, get: function () { return use_toast_1.useToast; } });
|
|
14
|
-
Object.defineProperty(exports, "toast", { enumerable: true, get: function () { return use_toast_1.toast; } });
|
|
3
|
+
exports.Toaster = exports.toast = exports.useToast = void 0;
|
|
4
|
+
var useToast_1 = require("./useToast");
|
|
5
|
+
Object.defineProperty(exports, "useToast", { enumerable: true, get: function () { return useToast_1.useToast; } });
|
|
6
|
+
Object.defineProperty(exports, "toast", { enumerable: true, get: function () { return useToast_1.toast; } });
|
|
15
7
|
var toaster_1 = require("./toaster");
|
|
16
8
|
Object.defineProperty(exports, "Toaster", { enumerable: true, get: function () { return toaster_1.Toaster; } });
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.Toaster = void 0;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const Toast_1 = require("
|
|
7
|
-
const
|
|
6
|
+
const Toast_1 = require("./Toast");
|
|
7
|
+
const useToast_1 = require("./useToast");
|
|
8
8
|
function Toaster() {
|
|
9
|
-
const { toasts } = (0,
|
|
9
|
+
const { toasts } = (0, useToast_1.useToast)();
|
|
10
10
|
return ((0, jsx_runtime_1.jsxs)(Toast_1.ToastProvider, { children: [toasts.map(function ({ id, title, description, action, ...props }) {
|
|
11
|
-
return ((0, jsx_runtime_1.jsxs)(Toast_1.Toast, { ...props, children: [(0, jsx_runtime_1.jsxs)("div", { className: "grid gap-
|
|
11
|
+
return ((0, jsx_runtime_1.jsxs)(Toast_1.Toast, { ...props, children: [(0, jsx_runtime_1.jsxs)("div", { className: "grid gap-2", children: [title && (0, jsx_runtime_1.jsx)(Toast_1.ToastTitle, { children: title }), description && ((0, jsx_runtime_1.jsx)(Toast_1.ToastDescription, { children: description }))] }), action, (0, jsx_runtime_1.jsx)(Toast_1.ToastClose, {})] }, id));
|
|
12
12
|
}), (0, jsx_runtime_1.jsx)(Toast_1.ToastViewport, {})] }));
|
|
13
13
|
}
|
|
14
14
|
exports.Toaster = Toaster;
|
|
@@ -48,7 +48,7 @@ const addToRemoveQueue = (toastId) => {
|
|
|
48
48
|
toastTimeouts.delete(toastId);
|
|
49
49
|
dispatch({
|
|
50
50
|
type: "REMOVE_TOAST",
|
|
51
|
-
toastId
|
|
51
|
+
toastId,
|
|
52
52
|
});
|
|
53
53
|
}, TOAST_REMOVE_DELAY);
|
|
54
54
|
toastTimeouts.set(toastId, timeout);
|
|
@@ -98,6 +98,8 @@ const reducer = (state, action) => {
|
|
|
98
98
|
...state,
|
|
99
99
|
toasts: state.toasts.filter((t) => t.id !== action.toastId),
|
|
100
100
|
};
|
|
101
|
+
default:
|
|
102
|
+
return state;
|
|
101
103
|
}
|
|
102
104
|
};
|
|
103
105
|
exports.reducer = reducer;
|
|
@@ -129,7 +131,7 @@ function toast({ ...props }) {
|
|
|
129
131
|
},
|
|
130
132
|
});
|
|
131
133
|
return {
|
|
132
|
-
id
|
|
134
|
+
id,
|
|
133
135
|
dismiss,
|
|
134
136
|
update,
|
|
135
137
|
};
|
package/publish/cjs/index.js
CHANGED
|
@@ -26,6 +26,8 @@ __exportStar(require("./components/Pagination"), exports);
|
|
|
26
26
|
__exportStar(require("./components/Popover"), exports);
|
|
27
27
|
__exportStar(require("./components/Tabs"), exports);
|
|
28
28
|
__exportStar(require("./components/TextArea"), exports);
|
|
29
|
+
__exportStar(require("./components/Toast"), exports);
|
|
30
|
+
__exportStar(require("./components/TextButton"), exports);
|
|
29
31
|
__exportStar(require("./components/Tooltip"), exports);
|
|
30
32
|
__exportStar(require("./components/TextInput"), exports);
|
|
31
33
|
__exportStar(require("./components/Stepper"), exports);
|
|
@@ -38,5 +40,7 @@ __exportStar(require("./components/Footer"), exports);
|
|
|
38
40
|
__exportStar(require("./components/Card"), exports);
|
|
39
41
|
__exportStar(require("./components/Command"), exports);
|
|
40
42
|
__exportStar(require("./components/Combobox"), exports);
|
|
43
|
+
__exportStar(require("./components/Callout"), exports);
|
|
44
|
+
__exportStar(require("./components/SearchBar"), exports);
|
|
41
45
|
__exportStar(require("./mobase-tw-plugin"), exports);
|
|
42
46
|
__exportStar(require("./site"), exports);
|