@seip/bluebird-js 0.2.1 → 0.2.2

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.
@@ -378,9 +378,12 @@ export const Button = forwardRef(function Button(props, ref) {
378
378
  const isLoading = Boolean(loading || busy);
379
379
 
380
380
  const handleClick = async (e) => {
381
+ if (confirm && typeof window !== "undefined" && !window.confirm(confirm)) {
382
+ e.preventDefault();
383
+ return;
384
+ }
381
385
  onClick?.(e);
382
386
  if (e.defaultPrevented || !url) return;
383
- if (confirm && typeof window !== "undefined" && !window.confirm(confirm)) return;
384
387
  setBusy(true);
385
388
  try {
386
389
  const data = await api(url, { method, body: payload });
@@ -159,6 +159,7 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
159
159
  url?: string;
160
160
  method?: string;
161
161
  payload?: Record<string, any>;
162
+ /** Asks with `window.confirm()` first; nothing runs (neither `onClick` nor the `url` request) when cancelled. */
162
163
  confirm?: string;
163
164
  onSuccess?: (data: any) => void;
164
165
  onError?: (error: ApiError) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seip/bluebird-js",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Performance-first Node.js framework: Express + HTML {{ }} SSR templates + React Router SPA with Vite, Tailwind CSS, JWT auth, BaseModel, smart migrations, and multi-level caching",
5
5
  "type": "module",
6
6
  "main": "core/app.js",