@authhero/widget 0.17.2 → 0.18.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.
- package/dist/authhero-widget/authhero-widget.esm.js +1 -1
- package/dist/cjs/authhero-widget.cjs.entry.js +75 -74
- package/dist/collection/index.js +1 -1
- package/dist/collection/themes/index.js +34 -30
- package/dist/collection/utils/branding.js +75 -74
- package/dist/esm/authhero-widget.entry.js +75 -74
- package/dist/types/index.d.ts +1 -1
- package/dist/types/themes/index.d.ts +2 -2
- package/dist/types/utils/branding.d.ts +8 -8
- package/hydrate/index.js +75 -74
- package/hydrate/index.mjs +75 -74
- package/package.json +2 -2
- /package/dist/authhero-widget/{p-409a28d3.entry.js → p-18d0a438.entry.js} +0 -0
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
* <authhero-widget class="ah-theme-dark"></authhero-widget>
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
|
-
export { brandingToCssVars, themeToCssVars, mergeThemeVars, applyCssVars, } from
|
|
38
|
-
export type { WidgetBranding, WidgetTheme } from
|
|
37
|
+
export { brandingToCssVars, themeToCssVars, mergeThemeVars, applyCssVars, } from "../utils/branding";
|
|
38
|
+
export type { WidgetBranding, WidgetTheme } from "../utils/branding";
|
|
39
39
|
export declare const themePresets: readonly ["ah-theme-minimal", "ah-theme-rounded", "ah-theme-dark"];
|
|
40
40
|
export declare const cssParts: readonly ["container", "logo", "title", "form", "links", "link", "link-wrapper", "divider", "divider-text", "message", "message-error", "message-success", "input-wrapper", "label", "input", "helper-text", "error-text", "button", "button-primary", "button-secondary", "checkbox-wrapper", "checkbox", "checkbox-label", "image", "text-title", "text-description", "text-error", "text-success"];
|
|
@@ -30,10 +30,10 @@ export interface WidgetTheme {
|
|
|
30
30
|
borders?: {
|
|
31
31
|
button_border_radius?: number;
|
|
32
32
|
button_border_weight?: number;
|
|
33
|
-
buttons_style?:
|
|
33
|
+
buttons_style?: "pill" | "rounded" | "sharp";
|
|
34
34
|
input_border_radius?: number;
|
|
35
35
|
input_border_weight?: number;
|
|
36
|
-
inputs_style?:
|
|
36
|
+
inputs_style?: "pill" | "rounded" | "sharp";
|
|
37
37
|
show_widget_shadow?: boolean;
|
|
38
38
|
widget_border_weight?: number;
|
|
39
39
|
widget_corner_radius?: number;
|
|
@@ -42,7 +42,7 @@ export interface WidgetTheme {
|
|
|
42
42
|
base_focus_color?: string;
|
|
43
43
|
base_hover_color?: string;
|
|
44
44
|
body_text?: string;
|
|
45
|
-
captcha_widget_theme?:
|
|
45
|
+
captcha_widget_theme?: "auto" | "dark" | "light";
|
|
46
46
|
error?: string;
|
|
47
47
|
header?: string;
|
|
48
48
|
icons?: string;
|
|
@@ -77,7 +77,7 @@ export interface WidgetTheme {
|
|
|
77
77
|
bold?: boolean;
|
|
78
78
|
size?: number;
|
|
79
79
|
};
|
|
80
|
-
links_style?:
|
|
80
|
+
links_style?: "normal" | "underlined";
|
|
81
81
|
reference_text_size?: number;
|
|
82
82
|
subtitle?: {
|
|
83
83
|
bold?: boolean;
|
|
@@ -91,14 +91,14 @@ export interface WidgetTheme {
|
|
|
91
91
|
page_background?: {
|
|
92
92
|
background_color?: string;
|
|
93
93
|
background_image_url?: string;
|
|
94
|
-
page_layout?:
|
|
94
|
+
page_layout?: "center" | "left" | "right";
|
|
95
95
|
};
|
|
96
96
|
widget?: {
|
|
97
|
-
header_text_alignment?:
|
|
97
|
+
header_text_alignment?: "center" | "left" | "right";
|
|
98
98
|
logo_height?: number;
|
|
99
|
-
logo_position?:
|
|
99
|
+
logo_position?: "center" | "left" | "none" | "right";
|
|
100
100
|
logo_url?: string;
|
|
101
|
-
social_buttons_layout?:
|
|
101
|
+
social_buttons_layout?: "bottom" | "top";
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
104
|
/**
|
package/hydrate/index.js
CHANGED
|
@@ -5342,12 +5342,12 @@ function styleToRadius(style, baseRadius) {
|
|
|
5342
5342
|
if (baseRadius !== undefined)
|
|
5343
5343
|
return `${baseRadius}px`;
|
|
5344
5344
|
switch (style) {
|
|
5345
|
-
case
|
|
5346
|
-
return
|
|
5347
|
-
case
|
|
5348
|
-
return
|
|
5349
|
-
case
|
|
5350
|
-
return
|
|
5345
|
+
case "pill":
|
|
5346
|
+
return "9999px";
|
|
5347
|
+
case "rounded":
|
|
5348
|
+
return "8px";
|
|
5349
|
+
case "sharp":
|
|
5350
|
+
return "0";
|
|
5351
5351
|
default:
|
|
5352
5352
|
return undefined;
|
|
5353
5353
|
}
|
|
@@ -5361,28 +5361,29 @@ function brandingToCssVars(branding) {
|
|
|
5361
5361
|
const vars = {};
|
|
5362
5362
|
// Primary color
|
|
5363
5363
|
if (branding.colors?.primary) {
|
|
5364
|
-
vars[
|
|
5364
|
+
vars["--ah-color-primary"] = branding.colors.primary;
|
|
5365
5365
|
// Generate hover variant (slightly darker)
|
|
5366
|
-
vars[
|
|
5366
|
+
vars["--ah-color-primary-hover"] = branding.colors.primary;
|
|
5367
5367
|
}
|
|
5368
5368
|
// Page background
|
|
5369
5369
|
if (branding.colors?.page_background) {
|
|
5370
5370
|
const bg = branding.colors.page_background;
|
|
5371
|
-
if (bg.type ===
|
|
5372
|
-
vars[
|
|
5371
|
+
if (bg.type === "solid" && bg.start) {
|
|
5372
|
+
vars["--ah-page-bg"] = bg.start;
|
|
5373
5373
|
}
|
|
5374
|
-
else if (bg.type ===
|
|
5374
|
+
else if (bg.type === "gradient" && bg.start && bg.end) {
|
|
5375
5375
|
const angle = bg.angle_deg ?? 180;
|
|
5376
|
-
vars[
|
|
5376
|
+
vars["--ah-page-bg"] =
|
|
5377
|
+
`linear-gradient(${angle}deg, ${bg.start}, ${bg.end})`;
|
|
5377
5378
|
}
|
|
5378
5379
|
}
|
|
5379
5380
|
// Logo URL (stored for reference, used via prop)
|
|
5380
5381
|
if (branding.logo_url) {
|
|
5381
|
-
vars[
|
|
5382
|
+
vars["--ah-logo-url"] = `url(${branding.logo_url})`;
|
|
5382
5383
|
}
|
|
5383
5384
|
// Font URL
|
|
5384
5385
|
if (branding.font?.url) {
|
|
5385
|
-
vars[
|
|
5386
|
+
vars["--ah-font-url"] = branding.font.url;
|
|
5386
5387
|
}
|
|
5387
5388
|
return vars;
|
|
5388
5389
|
}
|
|
@@ -5398,29 +5399,29 @@ function themeToCssVars(theme) {
|
|
|
5398
5399
|
const b = theme.borders;
|
|
5399
5400
|
// Widget
|
|
5400
5401
|
if (b.widget_corner_radius !== undefined) {
|
|
5401
|
-
vars[
|
|
5402
|
+
vars["--ah-widget-radius"] = `${b.widget_corner_radius}px`;
|
|
5402
5403
|
}
|
|
5403
5404
|
if (b.widget_border_weight !== undefined) {
|
|
5404
|
-
vars[
|
|
5405
|
+
vars["--ah-widget-border-width"] = `${b.widget_border_weight}px`;
|
|
5405
5406
|
}
|
|
5406
5407
|
if (b.show_widget_shadow === false) {
|
|
5407
|
-
vars[
|
|
5408
|
+
vars["--ah-widget-shadow"] = "none";
|
|
5408
5409
|
}
|
|
5409
5410
|
// Buttons
|
|
5410
5411
|
const btnRadius = styleToRadius(b.buttons_style, b.button_border_radius);
|
|
5411
5412
|
if (btnRadius) {
|
|
5412
|
-
vars[
|
|
5413
|
+
vars["--ah-btn-radius"] = btnRadius;
|
|
5413
5414
|
}
|
|
5414
5415
|
if (b.button_border_weight !== undefined) {
|
|
5415
|
-
vars[
|
|
5416
|
+
vars["--ah-btn-border-width"] = `${b.button_border_weight}px`;
|
|
5416
5417
|
}
|
|
5417
5418
|
// Inputs
|
|
5418
5419
|
const inputRadius = styleToRadius(b.inputs_style, b.input_border_radius);
|
|
5419
5420
|
if (inputRadius) {
|
|
5420
|
-
vars[
|
|
5421
|
+
vars["--ah-input-radius"] = inputRadius;
|
|
5421
5422
|
}
|
|
5422
5423
|
if (b.input_border_weight !== undefined) {
|
|
5423
|
-
vars[
|
|
5424
|
+
vars["--ah-input-border-width"] = `${b.input_border_weight}px`;
|
|
5424
5425
|
}
|
|
5425
5426
|
}
|
|
5426
5427
|
// Colors
|
|
@@ -5428,68 +5429,68 @@ function themeToCssVars(theme) {
|
|
|
5428
5429
|
const c = theme.colors;
|
|
5429
5430
|
// Primary button
|
|
5430
5431
|
if (c.primary_button) {
|
|
5431
|
-
vars[
|
|
5432
|
-
vars[
|
|
5432
|
+
vars["--ah-color-primary"] = c.primary_button;
|
|
5433
|
+
vars["--ah-color-primary-hover"] = c.primary_button;
|
|
5433
5434
|
}
|
|
5434
5435
|
if (c.primary_button_label) {
|
|
5435
|
-
vars[
|
|
5436
|
+
vars["--ah-btn-primary-text"] = c.primary_button_label;
|
|
5436
5437
|
}
|
|
5437
5438
|
// Secondary button
|
|
5438
5439
|
if (c.secondary_button_border) {
|
|
5439
|
-
vars[
|
|
5440
|
+
vars["--ah-btn-secondary-border"] = c.secondary_button_border;
|
|
5440
5441
|
}
|
|
5441
5442
|
if (c.secondary_button_label) {
|
|
5442
|
-
vars[
|
|
5443
|
+
vars["--ah-btn-secondary-text"] = c.secondary_button_label;
|
|
5443
5444
|
}
|
|
5444
5445
|
// Text colors
|
|
5445
5446
|
if (c.body_text) {
|
|
5446
|
-
vars[
|
|
5447
|
+
vars["--ah-color-text"] = c.body_text;
|
|
5447
5448
|
}
|
|
5448
5449
|
if (c.header) {
|
|
5449
|
-
vars[
|
|
5450
|
+
vars["--ah-color-text-header"] = c.header;
|
|
5450
5451
|
}
|
|
5451
5452
|
if (c.input_labels_placeholders) {
|
|
5452
|
-
vars[
|
|
5453
|
-
vars[
|
|
5453
|
+
vars["--ah-color-text-label"] = c.input_labels_placeholders;
|
|
5454
|
+
vars["--ah-color-text-muted"] = c.input_labels_placeholders;
|
|
5454
5455
|
}
|
|
5455
5456
|
if (c.input_filled_text) {
|
|
5456
|
-
vars[
|
|
5457
|
+
vars["--ah-color-input-text"] = c.input_filled_text;
|
|
5457
5458
|
}
|
|
5458
5459
|
// Backgrounds
|
|
5459
5460
|
if (c.widget_background) {
|
|
5460
|
-
vars[
|
|
5461
|
+
vars["--ah-color-bg"] = c.widget_background;
|
|
5461
5462
|
}
|
|
5462
5463
|
if (c.input_background) {
|
|
5463
|
-
vars[
|
|
5464
|
+
vars["--ah-color-input-bg"] = c.input_background;
|
|
5464
5465
|
}
|
|
5465
5466
|
// Borders
|
|
5466
5467
|
if (c.widget_border) {
|
|
5467
|
-
vars[
|
|
5468
|
+
vars["--ah-widget-border-color"] = c.widget_border;
|
|
5468
5469
|
}
|
|
5469
5470
|
if (c.input_border) {
|
|
5470
|
-
vars[
|
|
5471
|
+
vars["--ah-color-border"] = c.input_border;
|
|
5471
5472
|
}
|
|
5472
5473
|
// Links
|
|
5473
5474
|
if (c.links_focused_components) {
|
|
5474
|
-
vars[
|
|
5475
|
+
vars["--ah-color-link"] = c.links_focused_components;
|
|
5475
5476
|
}
|
|
5476
5477
|
// Focus/hover
|
|
5477
5478
|
if (c.base_focus_color) {
|
|
5478
|
-
vars[
|
|
5479
|
+
vars["--ah-color-focus-ring"] = c.base_focus_color;
|
|
5479
5480
|
}
|
|
5480
5481
|
if (c.base_hover_color) {
|
|
5481
|
-
vars[
|
|
5482
|
+
vars["--ah-color-primary-hover"] = c.base_hover_color;
|
|
5482
5483
|
}
|
|
5483
5484
|
// Semantic colors
|
|
5484
5485
|
if (c.error) {
|
|
5485
|
-
vars[
|
|
5486
|
+
vars["--ah-color-error"] = c.error;
|
|
5486
5487
|
}
|
|
5487
5488
|
if (c.success) {
|
|
5488
|
-
vars[
|
|
5489
|
+
vars["--ah-color-success"] = c.success;
|
|
5489
5490
|
}
|
|
5490
5491
|
// Icons
|
|
5491
5492
|
if (c.icons) {
|
|
5492
|
-
vars[
|
|
5493
|
+
vars["--ah-color-icon"] = c.icons;
|
|
5493
5494
|
}
|
|
5494
5495
|
}
|
|
5495
5496
|
// Fonts
|
|
@@ -5498,93 +5499,93 @@ function themeToCssVars(theme) {
|
|
|
5498
5499
|
// reference_text_size is the base font size in pixels (default 16px)
|
|
5499
5500
|
const baseSize = f.reference_text_size || 16;
|
|
5500
5501
|
if (f.font_url) {
|
|
5501
|
-
vars[
|
|
5502
|
+
vars["--ah-font-url"] = f.font_url;
|
|
5502
5503
|
}
|
|
5503
5504
|
if (f.reference_text_size) {
|
|
5504
|
-
vars[
|
|
5505
|
+
vars["--ah-font-size-base"] = `${f.reference_text_size}px`;
|
|
5505
5506
|
}
|
|
5506
5507
|
// Title, subtitle, etc. sizes are percentages of the base size
|
|
5507
5508
|
if (f.title?.size) {
|
|
5508
5509
|
const titlePx = Math.round((f.title.size / 100) * baseSize);
|
|
5509
|
-
vars[
|
|
5510
|
+
vars["--ah-font-size-title"] = `${titlePx}px`;
|
|
5510
5511
|
}
|
|
5511
5512
|
if (f.subtitle?.size) {
|
|
5512
5513
|
const subtitlePx = Math.round((f.subtitle.size / 100) * baseSize);
|
|
5513
|
-
vars[
|
|
5514
|
+
vars["--ah-font-size-subtitle"] = `${subtitlePx}px`;
|
|
5514
5515
|
}
|
|
5515
5516
|
if (f.body_text?.size) {
|
|
5516
5517
|
const bodyPx = Math.round((f.body_text.size / 100) * baseSize);
|
|
5517
|
-
vars[
|
|
5518
|
+
vars["--ah-font-size-body"] = `${bodyPx}px`;
|
|
5518
5519
|
}
|
|
5519
5520
|
if (f.input_labels?.size) {
|
|
5520
5521
|
const labelPx = Math.round((f.input_labels.size / 100) * baseSize);
|
|
5521
|
-
vars[
|
|
5522
|
+
vars["--ah-font-size-label"] = `${labelPx}px`;
|
|
5522
5523
|
}
|
|
5523
5524
|
if (f.buttons_text?.size) {
|
|
5524
5525
|
const btnPx = Math.round((f.buttons_text.size / 100) * baseSize);
|
|
5525
|
-
vars[
|
|
5526
|
+
vars["--ah-font-size-btn"] = `${btnPx}px`;
|
|
5526
5527
|
}
|
|
5527
5528
|
if (f.links?.size) {
|
|
5528
5529
|
const linkPx = Math.round((f.links.size / 100) * baseSize);
|
|
5529
|
-
vars[
|
|
5530
|
+
vars["--ah-font-size-link"] = `${linkPx}px`;
|
|
5530
5531
|
}
|
|
5531
|
-
if (f.links_style ===
|
|
5532
|
-
vars[
|
|
5532
|
+
if (f.links_style === "underlined") {
|
|
5533
|
+
vars["--ah-link-decoration"] = "underline";
|
|
5533
5534
|
}
|
|
5534
5535
|
// Font weights - bold option sets font-weight to 700
|
|
5535
5536
|
if (f.title?.bold !== undefined) {
|
|
5536
|
-
vars[
|
|
5537
|
+
vars["--ah-font-weight-title"] = f.title.bold ? "700" : "400";
|
|
5537
5538
|
}
|
|
5538
5539
|
if (f.subtitle?.bold !== undefined) {
|
|
5539
|
-
vars[
|
|
5540
|
+
vars["--ah-font-weight-subtitle"] = f.subtitle.bold ? "700" : "400";
|
|
5540
5541
|
}
|
|
5541
5542
|
if (f.body_text?.bold !== undefined) {
|
|
5542
|
-
vars[
|
|
5543
|
+
vars["--ah-font-weight-body"] = f.body_text.bold ? "700" : "400";
|
|
5543
5544
|
}
|
|
5544
5545
|
if (f.input_labels?.bold !== undefined) {
|
|
5545
|
-
vars[
|
|
5546
|
+
vars["--ah-font-weight-label"] = f.input_labels.bold ? "700" : "400";
|
|
5546
5547
|
}
|
|
5547
5548
|
if (f.buttons_text?.bold !== undefined) {
|
|
5548
|
-
vars[
|
|
5549
|
+
vars["--ah-font-weight-btn"] = f.buttons_text.bold ? "600" : "400";
|
|
5549
5550
|
}
|
|
5550
5551
|
if (f.links?.bold !== undefined) {
|
|
5551
|
-
vars[
|
|
5552
|
+
vars["--ah-font-weight-link"] = f.links.bold ? "700" : "400";
|
|
5552
5553
|
}
|
|
5553
5554
|
}
|
|
5554
5555
|
// Widget settings
|
|
5555
5556
|
if (theme.widget) {
|
|
5556
5557
|
const w = theme.widget;
|
|
5557
5558
|
if (w.header_text_alignment) {
|
|
5558
|
-
vars[
|
|
5559
|
+
vars["--ah-title-align"] = w.header_text_alignment;
|
|
5559
5560
|
}
|
|
5560
5561
|
if (w.logo_height) {
|
|
5561
|
-
vars[
|
|
5562
|
+
vars["--ah-logo-height"] = `${w.logo_height}px`;
|
|
5562
5563
|
}
|
|
5563
5564
|
if (w.logo_position) {
|
|
5564
5565
|
const positionMap = {
|
|
5565
|
-
center:
|
|
5566
|
-
left:
|
|
5567
|
-
right:
|
|
5566
|
+
center: "center",
|
|
5567
|
+
left: "flex-start",
|
|
5568
|
+
right: "flex-end",
|
|
5568
5569
|
};
|
|
5569
|
-
if (w.logo_position ===
|
|
5570
|
-
vars[
|
|
5570
|
+
if (w.logo_position === "none") {
|
|
5571
|
+
vars["--ah-logo-display"] = "none";
|
|
5571
5572
|
}
|
|
5572
5573
|
else {
|
|
5573
|
-
vars[
|
|
5574
|
+
vars["--ah-logo-align"] = positionMap[w.logo_position] ?? "center";
|
|
5574
5575
|
}
|
|
5575
5576
|
}
|
|
5576
5577
|
if (w.social_buttons_layout) {
|
|
5577
5578
|
// 'top' means social buttons above fields, 'bottom' means below
|
|
5578
5579
|
// Divider is always order 1 (middle)
|
|
5579
|
-
if (w.social_buttons_layout ===
|
|
5580
|
-
vars[
|
|
5581
|
-
vars[
|
|
5582
|
-
vars[
|
|
5580
|
+
if (w.social_buttons_layout === "top") {
|
|
5581
|
+
vars["--ah-social-order"] = "0";
|
|
5582
|
+
vars["--ah-divider-order"] = "1";
|
|
5583
|
+
vars["--ah-fields-order"] = "2";
|
|
5583
5584
|
}
|
|
5584
5585
|
else {
|
|
5585
|
-
vars[
|
|
5586
|
-
vars[
|
|
5587
|
-
vars[
|
|
5586
|
+
vars["--ah-social-order"] = "2";
|
|
5587
|
+
vars["--ah-divider-order"] = "1";
|
|
5588
|
+
vars["--ah-fields-order"] = "0";
|
|
5588
5589
|
}
|
|
5589
5590
|
}
|
|
5590
5591
|
}
|
|
@@ -5592,10 +5593,10 @@ function themeToCssVars(theme) {
|
|
|
5592
5593
|
if (theme.page_background) {
|
|
5593
5594
|
const pb = theme.page_background;
|
|
5594
5595
|
if (pb.background_color) {
|
|
5595
|
-
vars[
|
|
5596
|
+
vars["--ah-page-bg"] = pb.background_color;
|
|
5596
5597
|
}
|
|
5597
5598
|
if (pb.background_image_url) {
|
|
5598
|
-
vars[
|
|
5599
|
+
vars["--ah-page-bg-image"] = `url(${pb.background_image_url})`;
|
|
5599
5600
|
}
|
|
5600
5601
|
}
|
|
5601
5602
|
return vars;
|