jattac.libs.web.zest-button 1.0.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.
@@ -0,0 +1,586 @@
1
+ 'use strict';
2
+
3
+ var require$$0 = require('react');
4
+ var fa6 = require('react-icons/fa6');
5
+
6
+ var jsxRuntime = {exports: {}};
7
+
8
+ var reactJsxRuntime_production = {};
9
+
10
+ /**
11
+ * @license React
12
+ * react-jsx-runtime.production.js
13
+ *
14
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */
19
+
20
+ var hasRequiredReactJsxRuntime_production;
21
+
22
+ function requireReactJsxRuntime_production () {
23
+ if (hasRequiredReactJsxRuntime_production) return reactJsxRuntime_production;
24
+ hasRequiredReactJsxRuntime_production = 1;
25
+ var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
26
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
27
+ function jsxProd(type, config, maybeKey) {
28
+ var key = null;
29
+ void 0 !== maybeKey && (key = "" + maybeKey);
30
+ void 0 !== config.key && (key = "" + config.key);
31
+ if ("key" in config) {
32
+ maybeKey = {};
33
+ for (var propName in config)
34
+ "key" !== propName && (maybeKey[propName] = config[propName]);
35
+ } else maybeKey = config;
36
+ config = maybeKey.ref;
37
+ return {
38
+ $$typeof: REACT_ELEMENT_TYPE,
39
+ type: type,
40
+ key: key,
41
+ ref: void 0 !== config ? config : null,
42
+ props: maybeKey
43
+ };
44
+ }
45
+ reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
46
+ reactJsxRuntime_production.jsx = jsxProd;
47
+ reactJsxRuntime_production.jsxs = jsxProd;
48
+ return reactJsxRuntime_production;
49
+ }
50
+
51
+ var reactJsxRuntime_development = {};
52
+
53
+ /**
54
+ * @license React
55
+ * react-jsx-runtime.development.js
56
+ *
57
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
58
+ *
59
+ * This source code is licensed under the MIT license found in the
60
+ * LICENSE file in the root directory of this source tree.
61
+ */
62
+
63
+ var hasRequiredReactJsxRuntime_development;
64
+
65
+ function requireReactJsxRuntime_development () {
66
+ if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
67
+ hasRequiredReactJsxRuntime_development = 1;
68
+ "production" !== process.env.NODE_ENV &&
69
+ (function () {
70
+ function getComponentNameFromType(type) {
71
+ if (null == type) return null;
72
+ if ("function" === typeof type)
73
+ return type.$$typeof === REACT_CLIENT_REFERENCE
74
+ ? null
75
+ : type.displayName || type.name || null;
76
+ if ("string" === typeof type) return type;
77
+ switch (type) {
78
+ case REACT_FRAGMENT_TYPE:
79
+ return "Fragment";
80
+ case REACT_PROFILER_TYPE:
81
+ return "Profiler";
82
+ case REACT_STRICT_MODE_TYPE:
83
+ return "StrictMode";
84
+ case REACT_SUSPENSE_TYPE:
85
+ return "Suspense";
86
+ case REACT_SUSPENSE_LIST_TYPE:
87
+ return "SuspenseList";
88
+ case REACT_ACTIVITY_TYPE:
89
+ return "Activity";
90
+ }
91
+ if ("object" === typeof type)
92
+ switch (
93
+ ("number" === typeof type.tag &&
94
+ console.error(
95
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
96
+ ),
97
+ type.$$typeof)
98
+ ) {
99
+ case REACT_PORTAL_TYPE:
100
+ return "Portal";
101
+ case REACT_CONTEXT_TYPE:
102
+ return type.displayName || "Context";
103
+ case REACT_CONSUMER_TYPE:
104
+ return (type._context.displayName || "Context") + ".Consumer";
105
+ case REACT_FORWARD_REF_TYPE:
106
+ var innerType = type.render;
107
+ type = type.displayName;
108
+ type ||
109
+ ((type = innerType.displayName || innerType.name || ""),
110
+ (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
111
+ return type;
112
+ case REACT_MEMO_TYPE:
113
+ return (
114
+ (innerType = type.displayName || null),
115
+ null !== innerType
116
+ ? innerType
117
+ : getComponentNameFromType(type.type) || "Memo"
118
+ );
119
+ case REACT_LAZY_TYPE:
120
+ innerType = type._payload;
121
+ type = type._init;
122
+ try {
123
+ return getComponentNameFromType(type(innerType));
124
+ } catch (x) {}
125
+ }
126
+ return null;
127
+ }
128
+ function testStringCoercion(value) {
129
+ return "" + value;
130
+ }
131
+ function checkKeyStringCoercion(value) {
132
+ try {
133
+ testStringCoercion(value);
134
+ var JSCompiler_inline_result = !1;
135
+ } catch (e) {
136
+ JSCompiler_inline_result = true;
137
+ }
138
+ if (JSCompiler_inline_result) {
139
+ JSCompiler_inline_result = console;
140
+ var JSCompiler_temp_const = JSCompiler_inline_result.error;
141
+ var JSCompiler_inline_result$jscomp$0 =
142
+ ("function" === typeof Symbol &&
143
+ Symbol.toStringTag &&
144
+ value[Symbol.toStringTag]) ||
145
+ value.constructor.name ||
146
+ "Object";
147
+ JSCompiler_temp_const.call(
148
+ JSCompiler_inline_result,
149
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
150
+ JSCompiler_inline_result$jscomp$0
151
+ );
152
+ return testStringCoercion(value);
153
+ }
154
+ }
155
+ function getTaskName(type) {
156
+ if (type === REACT_FRAGMENT_TYPE) return "<>";
157
+ if (
158
+ "object" === typeof type &&
159
+ null !== type &&
160
+ type.$$typeof === REACT_LAZY_TYPE
161
+ )
162
+ return "<...>";
163
+ try {
164
+ var name = getComponentNameFromType(type);
165
+ return name ? "<" + name + ">" : "<...>";
166
+ } catch (x) {
167
+ return "<...>";
168
+ }
169
+ }
170
+ function getOwner() {
171
+ var dispatcher = ReactSharedInternals.A;
172
+ return null === dispatcher ? null : dispatcher.getOwner();
173
+ }
174
+ function UnknownOwner() {
175
+ return Error("react-stack-top-frame");
176
+ }
177
+ function hasValidKey(config) {
178
+ if (hasOwnProperty.call(config, "key")) {
179
+ var getter = Object.getOwnPropertyDescriptor(config, "key").get;
180
+ if (getter && getter.isReactWarning) return false;
181
+ }
182
+ return void 0 !== config.key;
183
+ }
184
+ function defineKeyPropWarningGetter(props, displayName) {
185
+ function warnAboutAccessingKey() {
186
+ specialPropKeyWarningShown ||
187
+ ((specialPropKeyWarningShown = true),
188
+ console.error(
189
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
190
+ displayName
191
+ ));
192
+ }
193
+ warnAboutAccessingKey.isReactWarning = true;
194
+ Object.defineProperty(props, "key", {
195
+ get: warnAboutAccessingKey,
196
+ configurable: true
197
+ });
198
+ }
199
+ function elementRefGetterWithDeprecationWarning() {
200
+ var componentName = getComponentNameFromType(this.type);
201
+ didWarnAboutElementRef[componentName] ||
202
+ ((didWarnAboutElementRef[componentName] = true),
203
+ console.error(
204
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
205
+ ));
206
+ componentName = this.props.ref;
207
+ return void 0 !== componentName ? componentName : null;
208
+ }
209
+ function ReactElement(type, key, props, owner, debugStack, debugTask) {
210
+ var refProp = props.ref;
211
+ type = {
212
+ $$typeof: REACT_ELEMENT_TYPE,
213
+ type: type,
214
+ key: key,
215
+ props: props,
216
+ _owner: owner
217
+ };
218
+ null !== (void 0 !== refProp ? refProp : null)
219
+ ? Object.defineProperty(type, "ref", {
220
+ enumerable: false,
221
+ get: elementRefGetterWithDeprecationWarning
222
+ })
223
+ : Object.defineProperty(type, "ref", { enumerable: false, value: null });
224
+ type._store = {};
225
+ Object.defineProperty(type._store, "validated", {
226
+ configurable: false,
227
+ enumerable: false,
228
+ writable: true,
229
+ value: 0
230
+ });
231
+ Object.defineProperty(type, "_debugInfo", {
232
+ configurable: false,
233
+ enumerable: false,
234
+ writable: true,
235
+ value: null
236
+ });
237
+ Object.defineProperty(type, "_debugStack", {
238
+ configurable: false,
239
+ enumerable: false,
240
+ writable: true,
241
+ value: debugStack
242
+ });
243
+ Object.defineProperty(type, "_debugTask", {
244
+ configurable: false,
245
+ enumerable: false,
246
+ writable: true,
247
+ value: debugTask
248
+ });
249
+ Object.freeze && (Object.freeze(type.props), Object.freeze(type));
250
+ return type;
251
+ }
252
+ function jsxDEVImpl(
253
+ type,
254
+ config,
255
+ maybeKey,
256
+ isStaticChildren,
257
+ debugStack,
258
+ debugTask
259
+ ) {
260
+ var children = config.children;
261
+ if (void 0 !== children)
262
+ if (isStaticChildren)
263
+ if (isArrayImpl(children)) {
264
+ for (
265
+ isStaticChildren = 0;
266
+ isStaticChildren < children.length;
267
+ isStaticChildren++
268
+ )
269
+ validateChildKeys(children[isStaticChildren]);
270
+ Object.freeze && Object.freeze(children);
271
+ } else
272
+ console.error(
273
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
274
+ );
275
+ else validateChildKeys(children);
276
+ if (hasOwnProperty.call(config, "key")) {
277
+ children = getComponentNameFromType(type);
278
+ var keys = Object.keys(config).filter(function (k) {
279
+ return "key" !== k;
280
+ });
281
+ isStaticChildren =
282
+ 0 < keys.length
283
+ ? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
284
+ : "{key: someKey}";
285
+ didWarnAboutKeySpread[children + isStaticChildren] ||
286
+ ((keys =
287
+ 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
288
+ console.error(
289
+ 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
290
+ isStaticChildren,
291
+ children,
292
+ keys,
293
+ children
294
+ ),
295
+ (didWarnAboutKeySpread[children + isStaticChildren] = true));
296
+ }
297
+ children = null;
298
+ void 0 !== maybeKey &&
299
+ (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
300
+ hasValidKey(config) &&
301
+ (checkKeyStringCoercion(config.key), (children = "" + config.key));
302
+ if ("key" in config) {
303
+ maybeKey = {};
304
+ for (var propName in config)
305
+ "key" !== propName && (maybeKey[propName] = config[propName]);
306
+ } else maybeKey = config;
307
+ children &&
308
+ defineKeyPropWarningGetter(
309
+ maybeKey,
310
+ "function" === typeof type
311
+ ? type.displayName || type.name || "Unknown"
312
+ : type
313
+ );
314
+ return ReactElement(
315
+ type,
316
+ children,
317
+ maybeKey,
318
+ getOwner(),
319
+ debugStack,
320
+ debugTask
321
+ );
322
+ }
323
+ function validateChildKeys(node) {
324
+ isValidElement(node)
325
+ ? node._store && (node._store.validated = 1)
326
+ : "object" === typeof node &&
327
+ null !== node &&
328
+ node.$$typeof === REACT_LAZY_TYPE &&
329
+ ("fulfilled" === node._payload.status
330
+ ? isValidElement(node._payload.value) &&
331
+ node._payload.value._store &&
332
+ (node._payload.value._store.validated = 1)
333
+ : node._store && (node._store.validated = 1));
334
+ }
335
+ function isValidElement(object) {
336
+ return (
337
+ "object" === typeof object &&
338
+ null !== object &&
339
+ object.$$typeof === REACT_ELEMENT_TYPE
340
+ );
341
+ }
342
+ var React = require$$0,
343
+ REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
344
+ REACT_PORTAL_TYPE = Symbol.for("react.portal"),
345
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
346
+ REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
347
+ REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
348
+ REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
349
+ REACT_CONTEXT_TYPE = Symbol.for("react.context"),
350
+ REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
351
+ REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
352
+ REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
353
+ REACT_MEMO_TYPE = Symbol.for("react.memo"),
354
+ REACT_LAZY_TYPE = Symbol.for("react.lazy"),
355
+ REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
356
+ REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
357
+ ReactSharedInternals =
358
+ React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
359
+ hasOwnProperty = Object.prototype.hasOwnProperty,
360
+ isArrayImpl = Array.isArray,
361
+ createTask = console.createTask
362
+ ? console.createTask
363
+ : function () {
364
+ return null;
365
+ };
366
+ React = {
367
+ react_stack_bottom_frame: function (callStackForError) {
368
+ return callStackForError();
369
+ }
370
+ };
371
+ var specialPropKeyWarningShown;
372
+ var didWarnAboutElementRef = {};
373
+ var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(
374
+ React,
375
+ UnknownOwner
376
+ )();
377
+ var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
378
+ var didWarnAboutKeySpread = {};
379
+ reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
380
+ reactJsxRuntime_development.jsx = function (type, config, maybeKey) {
381
+ var trackActualOwner =
382
+ 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
383
+ return jsxDEVImpl(
384
+ type,
385
+ config,
386
+ maybeKey,
387
+ false,
388
+ trackActualOwner
389
+ ? Error("react-stack-top-frame")
390
+ : unknownOwnerDebugStack,
391
+ trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
392
+ );
393
+ };
394
+ reactJsxRuntime_development.jsxs = function (type, config, maybeKey) {
395
+ var trackActualOwner =
396
+ 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
397
+ return jsxDEVImpl(
398
+ type,
399
+ config,
400
+ maybeKey,
401
+ true,
402
+ trackActualOwner
403
+ ? Error("react-stack-top-frame")
404
+ : unknownOwnerDebugStack,
405
+ trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
406
+ );
407
+ };
408
+ })();
409
+ return reactJsxRuntime_development;
410
+ }
411
+
412
+ var hasRequiredJsxRuntime;
413
+
414
+ function requireJsxRuntime () {
415
+ if (hasRequiredJsxRuntime) return jsxRuntime.exports;
416
+ hasRequiredJsxRuntime = 1;
417
+
418
+ if (process.env.NODE_ENV === 'production') {
419
+ jsxRuntime.exports = requireReactJsxRuntime_production();
420
+ } else {
421
+ jsxRuntime.exports = requireReactJsxRuntime_development();
422
+ }
423
+ return jsxRuntime.exports;
424
+ }
425
+
426
+ var jsxRuntimeExports = requireJsxRuntime();
427
+
428
+ const SpinnerIcon = ({ className, ...props }) => (jsxRuntimeExports.jsx(fa6.FaSpinner, { className: className, ...props }));
429
+
430
+ var styles = {"button":"ZestButton-module_button__KDafc","disabled":"ZestButton-module_disabled__gw6y3","fullWidth":"ZestButton-module_fullWidth__2ziwk","sm":"ZestButton-module_sm__G1vAP","md":"ZestButton-module_md__Y-PMO","lg":"ZestButton-module_lg__AQgdf","standard":"ZestButton-module_standard__T3EGM","success":"ZestButton-module_success__XEptA","danger":"ZestButton-module_danger__nJpJ-","inner":"ZestButton-module_inner__1j2Fr","spinner":"ZestButton-module_spinner__l2hLe","spin":"ZestButton-module_spin__4asdw","content":"ZestButton-module_content__hlea3","label":"ZestButton-module_label__8x263","icon":"ZestButton-module_icon__B3DFi","animatedCheck":"ZestButton-module_animatedCheck__8K4K-","animatedX":"ZestButton-module_animatedX__KQnt7","fadeIn":"ZestButton-module_fadeIn__iEave","drawCheck":"ZestButton-module_drawCheck__3DyjT","shake":"ZestButton-module_shake__NtIjf","shakeIt":"ZestButton-module_shakeIt__ox-R3"};
431
+
432
+ // --- Components ---
433
+ const AnimatedCheckmark = () => (jsxRuntimeExports.jsx("svg", { className: styles.animatedCheck, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round", children: jsxRuntimeExports.jsx("path", { d: "M5 13l4 4L19 7" }) }));
434
+ const AnimatedX = () => (jsxRuntimeExports.jsxs("svg", { className: styles.animatedX, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round", children: [jsxRuntimeExports.jsx("path", { d: "M6 6L18 18" }), jsxRuntimeExports.jsx("path", { d: "M6 18L18 6" })] }));
435
+ const ZestButton = ({ visualOptions, busyOptions, successOptions, isDefault = false, className = "", disabled, children, onClick, ...props }) => {
436
+ const { variant = "standard", size = "md", fullWidth = false, iconLeft, iconRight, } = visualOptions || {};
437
+ const { handleInternally = true, preventRageClick = true, minBusyDurationMs = 500, } = busyOptions || {};
438
+ const { showCheckmark = true, showFailIcon = true, autoResetAfterMs = 2000, } = successOptions || {};
439
+ const [internalBusy, setInternalBusy] = require$$0.useState(false);
440
+ const [wasSuccessful, setWasSuccessful] = require$$0.useState(false);
441
+ const [wasFailed, setWasFailed] = require$$0.useState(false);
442
+ const buttonRef = require$$0.useRef(null);
443
+ const [currentChildren, setCurrentChildren] = require$$0.useState(children);
444
+ const [awaitingConfirm, setAwaitingConfirm] = require$$0.useState(false);
445
+ // ✅ interval ref for confirm countdown
446
+ const confirmIntervalRef = require$$0.useRef(null);
447
+ // keep children in sync when not in confirm mode
448
+ require$$0.useEffect(() => {
449
+ if (!awaitingConfirm) {
450
+ setCurrentChildren(children);
451
+ }
452
+ }, [children, awaitingConfirm]);
453
+ const effectiveBusy = typeof props["aria-busy"] === "boolean"
454
+ ? Boolean(props["aria-busy"])
455
+ : handleInternally
456
+ ? internalBusy
457
+ : false;
458
+ const isDisabled = disabled ||
459
+ effectiveBusy ||
460
+ (preventRageClick && (wasSuccessful || wasFailed));
461
+ const handleClick = async (e) => {
462
+ if (preventRageClick && internalBusy)
463
+ return;
464
+ if (handleInternally && typeof onClick === "function") {
465
+ try {
466
+ setWasSuccessful(false);
467
+ setWasFailed(false);
468
+ setInternalBusy(true);
469
+ const startTime = Date.now();
470
+ await onClick(e);
471
+ const elapsed = Date.now() - startTime;
472
+ const remaining = Math.max(minBusyDurationMs - elapsed, 0);
473
+ if (remaining > 0) {
474
+ await new Promise((resolve) => setTimeout(resolve, remaining));
475
+ }
476
+ if (showCheckmark)
477
+ setWasSuccessful(true);
478
+ }
479
+ catch (err) {
480
+ console.error(err);
481
+ if (showFailIcon)
482
+ setWasFailed(true);
483
+ }
484
+ finally {
485
+ setInternalBusy(false);
486
+ }
487
+ }
488
+ else if (onClick) {
489
+ onClick(e);
490
+ }
491
+ };
492
+ // auto-reset success/failure state
493
+ require$$0.useEffect(() => {
494
+ if ((wasSuccessful || wasFailed) && autoResetAfterMs) {
495
+ const timeout = setTimeout(() => {
496
+ setWasSuccessful(false);
497
+ setWasFailed(false);
498
+ }, autoResetAfterMs);
499
+ return () => clearTimeout(timeout);
500
+ }
501
+ }, [wasSuccessful, wasFailed, autoResetAfterMs]);
502
+ // Enter key handler if isDefault
503
+ require$$0.useEffect(() => {
504
+ if (!isDefault || isDisabled)
505
+ return;
506
+ const listener = (e) => {
507
+ var _a;
508
+ const target = e.target;
509
+ if (e.key === "Enter" &&
510
+ !e.repeat &&
511
+ !e.defaultPrevented &&
512
+ !(target instanceof HTMLTextAreaElement)) {
513
+ e.preventDefault();
514
+ (_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.click();
515
+ }
516
+ };
517
+ document.addEventListener("keydown", listener);
518
+ return () => document.removeEventListener("keydown", listener);
519
+ }, [isDefault, isDisabled]);
520
+ const stopWaiting = () => {
521
+ if (confirmIntervalRef.current) {
522
+ clearInterval(confirmIntervalRef.current);
523
+ confirmIntervalRef.current = null;
524
+ }
525
+ setCurrentChildren(children);
526
+ setAwaitingConfirm(false);
527
+ };
528
+ const handleConfirmClick = (e) => {
529
+ if (!props.confirmOptions) {
530
+ return handleClick(e);
531
+ }
532
+ if (awaitingConfirm) {
533
+ stopWaiting();
534
+ return handleClick(e);
535
+ }
536
+ const { displayLabel, timeoutSecs } = props.confirmOptions;
537
+ const startTime = Date.now();
538
+ setAwaitingConfirm(true);
539
+ confirmIntervalRef.current = setInterval(() => {
540
+ const elapsed = Date.now() - startTime;
541
+ if (elapsed >= timeoutSecs * 1000) {
542
+ stopWaiting();
543
+ }
544
+ else {
545
+ const elapsedSecs = Math.floor(elapsed / 1000);
546
+ const timeRemaining = timeoutSecs - elapsedSecs;
547
+ setCurrentChildren(`${displayLabel} (${timeRemaining}s)`);
548
+ }
549
+ }, 100); // ✅ update once per second
550
+ };
551
+ // cleanup on unmount
552
+ require$$0.useEffect(() => {
553
+ return () => {
554
+ if (confirmIntervalRef.current) {
555
+ clearInterval(confirmIntervalRef.current);
556
+ }
557
+ };
558
+ }, []);
559
+ const renderLeftIcon = () => {
560
+ if (effectiveBusy) {
561
+ return (jsxRuntimeExports.jsx("span", { className: `${styles.icon} ${styles.fadeIn}`, children: jsxRuntimeExports.jsx(SpinnerIcon, { className: styles.spinner, size: 18 }) }));
562
+ }
563
+ else if (wasSuccessful && showCheckmark) {
564
+ return (jsxRuntimeExports.jsx("span", { className: `${styles.icon} ${styles.fadeIn}`, children: jsxRuntimeExports.jsx(AnimatedCheckmark, {}) }));
565
+ }
566
+ else if (wasFailed && showFailIcon) {
567
+ return (jsxRuntimeExports.jsx("span", { className: `${styles.icon} ${styles.fadeIn} ${styles.failShake}`, children: jsxRuntimeExports.jsx(AnimatedX, {}) }));
568
+ }
569
+ else if (iconLeft) {
570
+ return jsxRuntimeExports.jsx("span", { className: styles.icon, children: iconLeft });
571
+ }
572
+ return null;
573
+ };
574
+ return (jsxRuntimeExports.jsx("button", { ref: buttonRef, className: [
575
+ styles.button,
576
+ styles[variant],
577
+ styles[size],
578
+ fullWidth ? styles.fullWidth : "",
579
+ isDisabled ? styles.disabled : "",
580
+ wasFailed ? styles.failGlow : "",
581
+ className,
582
+ ].join(" "), disabled: isDisabled, "aria-busy": effectiveBusy, onClick: handleConfirmClick, ...props, children: jsxRuntimeExports.jsxs("span", { className: styles.inner, children: [renderLeftIcon(), jsxRuntimeExports.jsxs("span", { className: styles.content, children: [currentChildren, iconRight && jsxRuntimeExports.jsx("span", { className: styles.icon, children: iconRight })] })] }) }));
583
+ };
584
+
585
+ module.exports = ZestButton;
586
+ //# sourceMappingURL=index.js.map