@sublimee/auth-ui 0.1.0 → 0.1.12

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/index.js CHANGED
@@ -23,20 +23,21 @@ __export(index_exports, {
23
23
  DiscordIcon: () => DiscordIcon,
24
24
  GoogleIcon: () => GoogleIcon,
25
25
  OAuthButton: () => OAuthButton,
26
- SpinnerIcon: () => SpinnerIcon,
27
- default: () => oauth_button_default
26
+ useButtonAnimation: () => useButtonAnimation
28
27
  });
29
28
  module.exports = __toCommonJS(index_exports);
30
29
 
31
30
  // src/oauth-button.tsx
32
- var import_react = require("react");
31
+ var import_react4 = require("react");
32
+
33
+ // src/base-button.tsx
34
+ var import_react3 = require("react");
33
35
  var import_button = require("@base-ui/react/button");
34
36
 
35
37
  // src/icons.tsx
36
38
  var import_jsx_runtime = require("react/jsx-runtime");
37
- function getSafeSize(size) {
38
- const safeSize = size ?? 24;
39
- return Math.max(1, safeSize);
39
+ function getSafeSize(size, defaultSize = 24) {
40
+ return Math.max(1, size ?? defaultSize);
40
41
  }
41
42
  function GoogleIcon({ size, className }) {
42
43
  const safeSize = getSafeSize(size);
@@ -48,8 +49,8 @@ function GoogleIcon({ size, className }) {
48
49
  viewBox: "0 0 24 24",
49
50
  fill: "none",
50
51
  xmlns: "http://www.w3.org/2000/svg",
51
- className,
52
52
  "aria-hidden": "true",
53
+ className,
53
54
  children: [
54
55
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
55
56
  "path",
@@ -93,8 +94,8 @@ function DiscordIcon({ size, className }) {
93
94
  viewBox: "0 0 24 24",
94
95
  fill: "none",
95
96
  xmlns: "http://www.w3.org/2000/svg",
96
- className,
97
97
  "aria-hidden": "true",
98
+ className,
98
99
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
99
100
  "path",
100
101
  {
@@ -106,51 +107,36 @@ function DiscordIcon({ size, className }) {
106
107
  );
107
108
  }
108
109
  function SpinnerIcon({ size, className }) {
109
- const safeSize = size ?? 20;
110
- const finalSize = Math.max(1, safeSize);
110
+ const safeSize = getSafeSize(size, 20);
111
111
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
112
112
  "svg",
113
113
  {
114
- width: finalSize,
115
- height: finalSize,
114
+ width: safeSize,
115
+ height: safeSize,
116
116
  viewBox: "0 0 24 24",
117
117
  fill: "none",
118
118
  xmlns: "http://www.w3.org/2000/svg",
119
- className,
120
119
  "aria-hidden": "true",
120
+ className,
121
121
  children: [
122
122
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
123
123
  "circle",
124
124
  {
125
125
  cx: "12",
126
126
  cy: "12",
127
- r: "10",
127
+ r: "9",
128
128
  stroke: "currentColor",
129
- strokeWidth: "4",
130
- strokeLinecap: "round",
131
- strokeDasharray: "60",
132
- strokeDashoffset: "20",
133
- opacity: "0.25"
129
+ strokeWidth: "3",
130
+ opacity: "0.22"
134
131
  }
135
132
  ),
136
133
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
137
134
  "path",
138
135
  {
139
- d: "M12 2C6.477 2 2 6.477 2 12",
136
+ d: "M12 3a9 9 0 0 1 9 9",
140
137
  stroke: "currentColor",
141
- strokeWidth: "4",
142
- strokeLinecap: "round",
143
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
144
- "animateTransform",
145
- {
146
- attributeName: "transform",
147
- type: "rotate",
148
- from: "0 12 12",
149
- to: "360 12 12",
150
- dur: "1s",
151
- repeatCount: "indefinite"
152
- }
153
- )
138
+ strokeWidth: "3",
139
+ strokeLinecap: "round"
154
140
  }
155
141
  )
156
142
  ]
@@ -158,79 +144,464 @@ function SpinnerIcon({ size, className }) {
158
144
  );
159
145
  }
160
146
 
161
- // src/oauth-button.tsx
147
+ // src/button-loading-indicator.tsx
162
148
  var import_jsx_runtime2 = require("react/jsx-runtime");
163
- var PROVIDER_NAMES = {
164
- google: "Google",
165
- discord: "Discord"
149
+ function SpinnerLoadingIndicator({ size }) {
150
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SpinnerIcon, { size, className: "sublime-button__spinner" });
151
+ }
152
+ var LOADING_INDICATORS = {
153
+ spinner: SpinnerLoadingIndicator
166
154
  };
167
- function getProviderIcon(provider) {
168
- switch (provider) {
169
- case "google":
170
- return GoogleIcon;
171
- case "discord":
172
- return DiscordIcon;
173
- default:
174
- return () => null;
175
- }
155
+ function ButtonLoadingIndicator({
156
+ animation = "spinner",
157
+ size = 18
158
+ }) {
159
+ const LoadingIndicator = LOADING_INDICATORS[animation];
160
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LoadingIndicator, { size });
176
161
  }
177
- var SENSIBLE_DEFAULTS = ["cursor-pointer"];
178
- function mergeButtonClasses(userClassName, isDisabled) {
179
- const userClasses = userClassName?.trim() ?? "";
180
- const neededDefaults = SENSIBLE_DEFAULTS.filter(
181
- (defaultClass) => !userClasses.includes(defaultClass)
162
+
163
+ // src/use-button-animation.ts
164
+ var import_react = require("react");
165
+ var PRESS_RELEASE_DURATION = 180;
166
+ function useButtonAnimation(animation = "press") {
167
+ const [phase, setPhase] = (0, import_react.useState)("idle");
168
+ const timeoutRef = (0, import_react.useRef)(null);
169
+ const clearExistingTimeout = (0, import_react.useCallback)(() => {
170
+ if (timeoutRef.current) {
171
+ clearTimeout(timeoutRef.current);
172
+ timeoutRef.current = null;
173
+ }
174
+ }, []);
175
+ (0, import_react.useEffect)(() => {
176
+ return () => {
177
+ clearExistingTimeout();
178
+ };
179
+ }, [clearExistingTimeout]);
180
+ const handlePressStart = (0, import_react.useCallback)(() => {
181
+ if (!animation) {
182
+ return;
183
+ }
184
+ clearExistingTimeout();
185
+ setPhase("pressed");
186
+ }, [animation, clearExistingTimeout]);
187
+ const handlePressEnd = (0, import_react.useCallback)(() => {
188
+ if (!animation || phase !== "pressed") {
189
+ return;
190
+ }
191
+ setPhase("releasing");
192
+ timeoutRef.current = setTimeout(() => {
193
+ setPhase("idle");
194
+ }, PRESS_RELEASE_DURATION);
195
+ }, [animation, phase]);
196
+ const handleBlur = (0, import_react.useCallback)(() => {
197
+ clearExistingTimeout();
198
+ setPhase("idle");
199
+ }, [clearExistingTimeout]);
200
+ const handleKeyDown = (0, import_react.useCallback)(
201
+ (event) => {
202
+ if (event.repeat) {
203
+ return;
204
+ }
205
+ if (event.key === " " || event.key === "Enter") {
206
+ handlePressStart();
207
+ }
208
+ },
209
+ [handlePressStart]
182
210
  );
183
- if (isDisabled && !userClasses.includes("cursor-not-allowed")) {
184
- neededDefaults.push("cursor-not-allowed");
211
+ const handleKeyUp = (0, import_react.useCallback)(
212
+ (event) => {
213
+ if (event.key === " " || event.key === "Enter") {
214
+ handlePressEnd();
215
+ }
216
+ },
217
+ [handlePressEnd]
218
+ );
219
+ const getAnimationClass = () => {
220
+ if (!animation) {
221
+ return "";
222
+ }
223
+ if (phase === "pressed") {
224
+ return "sublime-button-pressed";
225
+ }
226
+ if (phase === "releasing") {
227
+ return "animate-sublime-button-press-release";
228
+ }
229
+ return "";
230
+ };
231
+ return {
232
+ animationClassName: getAnimationClass(),
233
+ eventHandlers: {
234
+ onBlur: handleBlur,
235
+ onKeyDown: handleKeyDown,
236
+ onKeyUp: handleKeyUp,
237
+ onMouseDown: handlePressStart,
238
+ onMouseLeave: handlePressEnd,
239
+ onMouseUp: handlePressEnd,
240
+ onTouchEnd: handlePressEnd,
241
+ onTouchStart: handlePressStart
242
+ }
243
+ };
244
+ }
245
+
246
+ // src/runtime-styles.ts
247
+ var import_react2 = require("react");
248
+ var AUTH_UI_RUNTIME_STYLE_ID = "sublime-auth-ui-runtime-styles";
249
+ var AUTH_UI_RUNTIME_STYLES = `
250
+ .sublime-button {
251
+ --sublime-button-gap: var(--sublime-space-3, 0.75rem);
252
+ --sublime-button-padding-x: var(--sublime-space-button-x, 1rem);
253
+ --sublime-button-padding-y: var(--sublime-space-button-y, 0.75rem);
254
+ --sublime-button-height: var(--sublime-size-button-height-md, 2.75rem);
255
+ --sublime-button-radius: var(--sublime-radius-button, 0.875rem);
256
+ --sublime-button-font-family: var(--sublime-font-family-sans, ui-sans-serif, system-ui, sans-serif);
257
+ --sublime-button-font-size: var(--sublime-font-size-sm, 0.875rem);
258
+ --sublime-button-font-weight: var(--sublime-font-weight-medium, 500);
259
+ --sublime-button-line-height: var(--sublime-line-height-tight, 1.15);
260
+ --sublime-button-visual-size: 1.25rem;
261
+ --sublime-button-transition: var(--sublime-transition-button, background-color 160ms cubic-bezier(0.4, 0, 0.2, 1), border-color 160ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 160ms cubic-bezier(0.4, 0, 0.2, 1), color 160ms cubic-bezier(0.4, 0, 0.2, 1), transform 160ms cubic-bezier(0.4, 0, 0.2, 1));
262
+ --sublime-button-bg: var(--sublime-color-surface-1, #ffffff);
263
+ --sublime-button-bg-hover: var(--sublime-color-surface-1-hover, #f8fafc);
264
+ --sublime-button-bg-active: var(--sublime-color-surface-1-active, #eef2f7);
265
+ --sublime-button-color: var(--sublime-color-text-primary, #111827);
266
+ --sublime-button-color-hover: var(--sublime-color-text-primary, #111827);
267
+ --sublime-button-border: var(--sublime-color-border-primary, #d1d5db);
268
+ --sublime-button-border-hover: var(--sublime-color-border-primary-hover, #9ca3af);
269
+ --sublime-button-border-active: var(--sublime-color-border-primary-active, #6b7280);
270
+ --sublime-button-shadow: var(--sublime-shadow-button, 0 1px 2px rgb(15 23 42 / 0.08));
271
+ --sublime-button-shadow-hover: var(--sublime-shadow-button-hover, 0 8px 20px rgb(15 23 42 / 0.12));
272
+ --sublime-button-shadow-active: var(--sublime-shadow-button-active, inset 0 1px 2px rgb(15 23 42 / 0.14));
273
+ --sublime-button-focus-ring: var(--sublime-color-focus-ring, var(--sublime-color-interactive-accent, #2563eb));
274
+ --sublime-button-focus-ring-offset: var(--sublime-color-focus-ring-offset, var(--sublime-color-surface-0, #ffffff));
275
+ position: relative;
276
+ display: inline-flex;
277
+ min-height: var(--sublime-button-height);
278
+ align-items: center;
279
+ justify-content: center;
280
+ gap: var(--sublime-button-gap);
281
+ padding: var(--sublime-button-padding-y) var(--sublime-button-padding-x);
282
+ border: 1px solid var(--sublime-button-border);
283
+ border-radius: var(--sublime-button-radius);
284
+ background: var(--sublime-button-bg);
285
+ color: var(--sublime-button-color);
286
+ box-shadow: var(--sublime-button-shadow);
287
+ font-family: var(--sublime-button-font-family);
288
+ font-size: var(--sublime-button-font-size);
289
+ font-weight: var(--sublime-button-font-weight);
290
+ line-height: var(--sublime-button-line-height);
291
+ cursor: pointer;
292
+ user-select: none;
293
+ text-decoration: none;
294
+ white-space: nowrap;
295
+ vertical-align: middle;
296
+ isolation: isolate;
297
+ overflow: hidden;
298
+ appearance: none;
299
+ -webkit-tap-highlight-color: transparent;
300
+ transition: var(--sublime-button-transition);
301
+ }
302
+
303
+ .sublime-button:hover:not(:disabled) {
304
+ background: var(--sublime-button-bg-hover);
305
+ color: var(--sublime-button-color-hover);
306
+ border-color: var(--sublime-button-border-hover);
307
+ box-shadow: var(--sublime-button-shadow-hover);
308
+ }
309
+
310
+ .sublime-button:active:not(:disabled) {
311
+ background: var(--sublime-button-bg-active);
312
+ border-color: var(--sublime-button-border-active);
313
+ box-shadow: var(--sublime-button-shadow-active);
314
+ }
315
+
316
+ .sublime-button:focus {
317
+ outline: none;
318
+ }
319
+
320
+ .sublime-button:focus-visible {
321
+ box-shadow:
322
+ 0 0 0 2px var(--sublime-button-focus-ring-offset),
323
+ 0 0 0 4px var(--sublime-button-focus-ring),
324
+ var(--sublime-button-shadow-hover);
325
+ }
326
+
327
+ .sublime-button:disabled {
328
+ cursor: not-allowed;
329
+ opacity: 0.6;
330
+ box-shadow: none;
331
+ }
332
+
333
+ .sublime-button[data-loading='true'] {
334
+ cursor: progress;
335
+ }
336
+
337
+ .sublime-button[data-loading='true']:disabled {
338
+ opacity: 0.78;
339
+ }
340
+
341
+ .sublime-button[data-icon-only='true'] {
342
+ min-width: var(--sublime-button-height);
343
+ padding-inline: calc(var(--sublime-button-padding-y) + 0.125rem);
344
+ }
345
+
346
+ .sublime-button__content {
347
+ display: inline-flex;
348
+ width: 100%;
349
+ align-items: center;
350
+ justify-content: center;
351
+ gap: inherit;
352
+ }
353
+
354
+ .sublime-button__visual,
355
+ .sublime-button__label {
356
+ display: inline-flex;
357
+ align-items: center;
358
+ }
359
+
360
+ .sublime-button__visual {
361
+ flex-shrink: 0;
362
+ justify-content: center;
363
+ min-width: var(--sublime-button-visual-size);
364
+ }
365
+
366
+ .sublime-button__visual svg {
367
+ display: block;
368
+ }
369
+
370
+ .sublime-button__label {
371
+ min-width: 0;
372
+ }
373
+
374
+ .sublime-button--primary {
375
+ --sublime-button-bg: var(--sublime-color-interactive-primary, #111827);
376
+ --sublime-button-bg-hover: var(--sublime-color-interactive-primary-hover, #1f2937);
377
+ --sublime-button-bg-active: var(--sublime-color-interactive-primary-active, #0f172a);
378
+ --sublime-button-color: var(--sublime-color-interactive-primary-text, #f9fafb);
379
+ --sublime-button-color-hover: var(--sublime-color-interactive-primary-text, #f9fafb);
380
+ --sublime-button-border: var(--sublime-color-interactive-primary, #111827);
381
+ --sublime-button-border-hover: var(--sublime-color-interactive-primary-hover, #1f2937);
382
+ --sublime-button-border-active: var(--sublime-color-interactive-primary-active, #0f172a);
383
+ }
384
+
385
+ .sublime-button--secondary {
386
+ --sublime-button-bg: var(--sublime-color-surface-1, #ffffff);
387
+ --sublime-button-bg-hover: var(--sublime-color-surface-1-hover, #f8fafc);
388
+ --sublime-button-bg-active: var(--sublime-color-surface-1-active, #eef2f7);
389
+ --sublime-button-color: var(--sublime-color-text-primary, #111827);
390
+ --sublime-button-color-hover: var(--sublime-color-text-primary, #111827);
391
+ --sublime-button-border: var(--sublime-color-border-primary, #d1d5db);
392
+ --sublime-button-border-hover: var(--sublime-color-border-primary-hover, #9ca3af);
393
+ --sublime-button-border-active: var(--sublime-color-border-primary-active, #6b7280);
394
+ }
395
+
396
+ .sublime-auth-button[data-provider='discord'] .sublime-button__visual {
397
+ color: #5865f2;
398
+ }
399
+
400
+ .sublime-auth-button[data-loading='true'] .sublime-button__visual {
401
+ color: currentColor;
402
+ }
403
+
404
+ @keyframes sublime-button-press-release {
405
+ 0% {
406
+ transform: translateY(1px) scale(0.985);
407
+ box-shadow: var(--sublime-button-shadow-active);
408
+ }
409
+ 100% {
410
+ transform: translateY(0) scale(1);
411
+ box-shadow: var(--sublime-button-shadow);
412
+ }
413
+ }
414
+
415
+ @keyframes sublime-button-spinner {
416
+ from {
417
+ transform: rotate(0deg);
185
418
  }
186
- if (neededDefaults.length === 0) {
187
- return userClasses;
419
+ to {
420
+ transform: rotate(360deg);
188
421
  }
189
- return `${neededDefaults.join(" ")} ${userClasses}`.trim();
190
422
  }
191
- var OAuthButton = (0, import_react.forwardRef)(
423
+
424
+ .sublime-button-pressed {
425
+ transform: translateY(1px) scale(0.985);
426
+ box-shadow: var(--sublime-button-shadow-active);
427
+ }
428
+
429
+ .animate-sublime-button-press-release {
430
+ animation: sublime-button-press-release 180ms var(--sublime-ease-out, cubic-bezier(0, 0, 0.2, 1));
431
+ }
432
+
433
+ .sublime-button__spinner {
434
+ animation: sublime-button-spinner 720ms linear infinite;
435
+ transform-origin: center;
436
+ }
437
+
438
+ @media (prefers-reduced-motion: reduce) {
439
+ .sublime-button,
440
+ .animate-sublime-button-press-release {
441
+ animation-duration: 0.01ms !important;
442
+ animation-iteration-count: 1 !important;
443
+ transition-duration: 0.01ms !important;
444
+ }
445
+
446
+ .sublime-button__spinner {
447
+ animation-duration: 1.6s !important;
448
+ }
449
+ }
450
+ `;
451
+ function useAuthUiRuntimeStyles() {
452
+ (0, import_react2.useInsertionEffect)(() => {
453
+ if (typeof document === "undefined") {
454
+ return;
455
+ }
456
+ if (document.getElementById(AUTH_UI_RUNTIME_STYLE_ID)) {
457
+ return;
458
+ }
459
+ const styleElement = document.createElement("style");
460
+ styleElement.id = AUTH_UI_RUNTIME_STYLE_ID;
461
+ styleElement.textContent = AUTH_UI_RUNTIME_STYLES;
462
+ document.head.prepend(styleElement);
463
+ }, []);
464
+ }
465
+
466
+ // src/base-button.tsx
467
+ var import_jsx_runtime3 = require("react/jsx-runtime");
468
+ function mergeClassNames(...classNames) {
469
+ return classNames.filter(Boolean).join(" ");
470
+ }
471
+ function composeEventHandlers(internalHandler, externalHandler) {
472
+ if (!internalHandler) {
473
+ return externalHandler;
474
+ }
475
+ if (!externalHandler) {
476
+ return internalHandler;
477
+ }
478
+ return (event) => {
479
+ internalHandler(event);
480
+ externalHandler(event);
481
+ };
482
+ }
483
+ var BaseButton = (0, import_react3.forwardRef)(
484
+ function BaseButton2(props, forwardedRef) {
485
+ const {
486
+ animation = "press",
487
+ "aria-busy": ariaBusy,
488
+ children,
489
+ className,
490
+ disabled = false,
491
+ isIconOnly = false,
492
+ leadingVisual,
493
+ loading = false,
494
+ loadingAnimation = "spinner",
495
+ type = "button",
496
+ variant = "secondary",
497
+ onBlur,
498
+ onKeyDown,
499
+ onKeyUp,
500
+ onMouseDown,
501
+ onMouseLeave,
502
+ onMouseUp,
503
+ onTouchEnd,
504
+ onTouchStart,
505
+ ...otherProps
506
+ } = props;
507
+ useAuthUiRuntimeStyles();
508
+ const { animationClassName, eventHandlers } = useButtonAnimation(
509
+ disabled || loading ? null : animation
510
+ );
511
+ const mergedClassName = mergeClassNames(
512
+ "sublime-button",
513
+ `sublime-button--${variant}`,
514
+ animationClassName,
515
+ className
516
+ );
517
+ const visualContent = loading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ButtonLoadingIndicator, { animation: loadingAnimation, size: 18 }) : leadingVisual ?? (isIconOnly ? children : void 0);
518
+ const labelContent = isIconOnly ? null : children;
519
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
520
+ import_button.Button,
521
+ {
522
+ ref: forwardedRef,
523
+ type,
524
+ disabled: disabled || loading,
525
+ className: mergedClassName,
526
+ "data-icon-only": isIconOnly ? "true" : void 0,
527
+ "data-loading": loading ? "true" : void 0,
528
+ "aria-busy": loading ? true : ariaBusy,
529
+ ...otherProps,
530
+ onBlur: composeEventHandlers(eventHandlers.onBlur, onBlur),
531
+ onKeyDown: composeEventHandlers(eventHandlers.onKeyDown, onKeyDown),
532
+ onKeyUp: composeEventHandlers(eventHandlers.onKeyUp, onKeyUp),
533
+ onMouseDown: composeEventHandlers(eventHandlers.onMouseDown, onMouseDown),
534
+ onMouseLeave: composeEventHandlers(eventHandlers.onMouseLeave, onMouseLeave),
535
+ onMouseUp: composeEventHandlers(eventHandlers.onMouseUp, onMouseUp),
536
+ onTouchEnd: composeEventHandlers(eventHandlers.onTouchEnd, onTouchEnd),
537
+ onTouchStart: composeEventHandlers(eventHandlers.onTouchStart, onTouchStart),
538
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "sublime-button__content", children: [
539
+ visualContent ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "sublime-button__visual", children: visualContent }) : null,
540
+ labelContent !== null && labelContent !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "sublime-button__label", children: labelContent }) : null
541
+ ] })
542
+ }
543
+ );
544
+ }
545
+ );
546
+
547
+ // src/oauth-button.tsx
548
+ var import_jsx_runtime4 = require("react/jsx-runtime");
549
+ var PROVIDER_NAMES = {
550
+ google: "Google",
551
+ discord: "Discord"
552
+ };
553
+ var PROVIDER_ICONS = {
554
+ google: GoogleIcon,
555
+ discord: DiscordIcon
556
+ };
557
+ function mergeClassNames2(...classNames) {
558
+ return classNames.filter(Boolean).join(" ");
559
+ }
560
+ var OAuthButton = (0, import_react4.forwardRef)(
192
561
  function OAuthButton2(props, forwardedRef) {
193
562
  const {
563
+ "aria-label": ariaLabel,
194
564
  provider,
195
565
  onClick,
196
566
  loading = false,
567
+ loadingAnimation = "spinner",
568
+ disabled = false,
569
+ variant = "secondary",
570
+ animation = "press",
197
571
  className,
198
572
  children,
199
- disabled = false,
200
573
  ...otherProps
201
574
  } = props;
202
- const isDisabled = disabled || loading;
203
- const Icon = getProviderIcon(provider);
575
+ const isIconOnly = children === null;
576
+ const Icon = PROVIDER_ICONS[provider];
204
577
  const defaultText = `Continuar con ${PROVIDER_NAMES[provider]}`;
205
- const mergedClassName = (0, import_react.useMemo)(
206
- () => mergeButtonClasses(className, isDisabled),
207
- [className, isDisabled]
208
- );
209
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
210
- import_button.Button,
578
+ const buttonLabel = loading ? children ?? "Conectando..." : children ?? defaultText;
579
+ const resolvedAriaLabel = ariaLabel ?? (isIconOnly ? defaultText : void 0);
580
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
581
+ BaseButton,
211
582
  {
212
583
  ref: forwardedRef,
213
584
  onClick,
214
- disabled: isDisabled,
215
- "aria-busy": loading,
216
- className: mergedClassName,
585
+ disabled,
586
+ animation,
587
+ variant,
588
+ loading,
589
+ loadingAnimation,
590
+ isIconOnly,
591
+ leadingVisual: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { size: 20 }),
592
+ className: mergeClassNames2("sublime-auth-button", className),
593
+ "data-provider": provider,
594
+ "aria-label": resolvedAriaLabel,
217
595
  ...otherProps,
218
- children: loading ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
219
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SpinnerIcon, {}),
220
- children !== null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: children ?? "Conectando..." })
221
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
222
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, {}),
223
- children !== null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: children ?? defaultText })
224
- ] })
596
+ children: buttonLabel
225
597
  }
226
598
  );
227
599
  }
228
600
  );
229
- var oauth_button_default = OAuthButton;
230
601
  // Annotate the CommonJS export names for ESM import in node:
231
602
  0 && (module.exports = {
232
603
  DiscordIcon,
233
604
  GoogleIcon,
234
605
  OAuthButton,
235
- SpinnerIcon
606
+ useButtonAnimation
236
607
  });