Comparing version 1.0.1 to 1.1.0
# aero-nudge | ||
## 1.1.0 | ||
### Minor Changes | ||
- 80188da: use vanilla CSS | ||
## 1.0.1 | ||
@@ -4,0 +10,0 @@ |
type Props = { | ||
description?: string; | ||
onAction: () => Promise<void>; | ||
onReset?: () => void; | ||
onAction: () => any; | ||
onReset?: () => any; | ||
title?: string; | ||
isLoading: boolean; | ||
show: boolean; | ||
className?: string; | ||
}; | ||
declare const useActionToast: ({ onAction, onReset, isLoading, show, description }: Props) => void; | ||
declare const useAeroNudge: ({ onAction, onReset, title, isLoading, show, description, className }: Props) => void; | ||
export { useActionToast as default }; | ||
export { useAeroNudge as default }; |
@@ -57,8 +57,7 @@ "use strict"; | ||
// src/use-action-toast.tsx | ||
var import_react_icons = require("@radix-ui/react-icons"); | ||
// src/use-aero-nudge.tsx | ||
var import_react = __toESM(require("react")); | ||
var import_sonner = require("sonner"); | ||
var import_jsx_runtime = require("react/jsx-runtime"); | ||
var useActionToast = ({ onAction, onReset, isLoading, show, description }) => { | ||
var useAeroNudge = ({ onAction, onReset, title = "Unsaved Changes", isLoading, show, description, className }) => { | ||
const toastId = import_react.default.useRef(); | ||
@@ -68,17 +67,17 @@ import_react.default.useEffect(() => { | ||
const ToastContent = () => { | ||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mx-auto flex py-2 w-fit min-w-[400px] text-white items-center rounded-full bg-gradient-to-b from-gray-700 to-gray-900 pl-4 pr-3 shadow-xl shadow-black/30", children: [ | ||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_icons.InfoCircledIcon, { className: "size-4 mr-1" }), | ||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col", children: [ | ||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-base ml-2", children: "Unsaved Changes" }), | ||
description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-xs text-gray-400 ml-2", children: description }) | ||
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `aero-nudge-container ${className}`, children: [ | ||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", className: "aero-nudge-icon", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z" }) }), | ||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", flexDirection: "column", marginLeft: "0.2rem" }, children: [ | ||
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: title }), | ||
description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { fontSize: "0.75rem", color: "#a1a1aa", marginTop: "0.2rem" }, children: description }) | ||
] }), | ||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "ml-auto flex items-center gap-2 text-sm", children: [ | ||
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", flexDirection: "row", gap: "0.4rem", marginLeft: "auto" }, children: [ | ||
onReset && /* @__PURE__ */ (0, import_jsx_runtime.jsx)( | ||
"button", | ||
{ | ||
className: "bg-red-500 transition-all text-white px-4 py-1.5 rounded-full drop-shadow-xl disabled:opacity-60", | ||
onClick: () => { | ||
onReset(); | ||
className: "aero-nudge-reset aero-nudge-button", | ||
onClick: () => __async(void 0, null, function* () { | ||
yield onReset(); | ||
import_sonner.toast.dismiss(toastId.current); | ||
}, | ||
}), | ||
disabled: isLoading2, | ||
@@ -91,3 +90,3 @@ children: "Reset" | ||
{ | ||
className: "transition-all bg-green-500 text-white px-4 py-1.5 rounded-full drop-shadow-xl disabled:opacity-60", | ||
className: "aero-nudge-action aero-nudge-button", | ||
onClick: () => __async(void 0, null, function* () { | ||
@@ -128,5 +127,5 @@ yield onAction(); | ||
}; | ||
var use_action_toast_default = useActionToast; | ||
var use_aero_nudge_default = useAeroNudge; | ||
// index.ts | ||
var aero_nudge_default = use_action_toast_default; | ||
var aero_nudge_default = use_aero_nudge_default; |
@@ -1,2 +0,2 @@ | ||
import useActionToast from './src/use-action-toast' | ||
export default useActionToast | ||
import useAeroNudge from './src/use-aero-nudge' | ||
export default useAeroNudge |
{ | ||
"name": "aero-nudge", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"main": "dist/index.js", | ||
@@ -11,4 +11,6 @@ "module": "dist/index.mjs", | ||
"@types/react": "^18.3.3", | ||
"@vitejs/plugin-react": "^4.3.1", | ||
"tsup": "^8.2.3", | ||
"typescript": "^5.0.0" | ||
"typescript": "^5.0.0", | ||
"vite": "^5.3.5" | ||
}, | ||
@@ -18,3 +20,2 @@ "author": "Elliott Chong", | ||
"dependencies": { | ||
"@radix-ui/react-icons": "^1.3.0", | ||
"react": "^18.3.1", | ||
@@ -30,4 +31,5 @@ "react-dom": "^18.3.1", | ||
"release": "pnpm run build && changeset publish", | ||
"dev": "vite", | ||
"lint": "tsc" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
32445
3
20
543
84
6
- Removed@radix-ui/react-icons@^1.3.0
- Removed@radix-ui/react-icons@1.3.2(transitive)