@gemboss/ui 0.50.0 → 0.51.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/src/auth.css CHANGED
@@ -1 +1 @@
1
- .gb-auth{--gb-surface: #ffffff;--gb-ink: var(--gemboss-text-strong, #1b1c1e);--gb-muted: #6d7175;--gb-line: #e1e3e5;--gb-field-line: #c9cccf;--gb-field-bg: #ffffff;--gb-field-hover: #fafafa;--gb-placeholder: #868b94;--gb-accent: #5661f5;--gb-btn: linear-gradient(120deg, #1b1c1e 0%, #000000 100%);--gb-btn-ink: #ffffff;--gb-wordmark: linear-gradient(120deg, #1b1c1e 0%, #000000 100%);--gb-hover: #f7f7f5;--gb-hover-line: #b9bbc0;--gb-err-bg: #fee2e2;--gb-err-ink: #b91c1c;--gb-err-line: transparent;--gb-card-shadow: 0 24px 64px rgba(15, 23, 42, .08);--gb-mark-bg: #0b0b0c;--gb-facet: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 120'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='0.45' stroke-linejoin='round'%3E%3Cpath d='M26,14 74,14 96,50 50,110 4,50Z'/%3E%3Cpath d='M4,50H96M26,14 34,50M74,14 66,50M34,50 50,110M66,50 50,110'/%3E%3C/g%3E%3C/svg%3E");--gb-page: radial-gradient(1200px 600px at 20% 10%, rgba(27, 28, 30, .05), transparent 60%), radial-gradient(1000px 500px at 80% 90%, rgba(86, 97, 245, .06), transparent 60%), #fafafb;--gb-page-flat: #ffffff;--gb-panel-bg: radial-gradient(900px 520px at 78% 12%, rgba(86, 97, 245, .26), transparent 62%), radial-gradient(700px 480px at 12% 96%, rgba(86, 97, 245, .12), transparent 60%), #0b0b0c;--gb-panel-ink: #f4f4f2;--gb-panel-muted: rgba(244, 244, 242, .72);--gb-panel-eyebrow: #8a93ff;--gb-panel-facet-o: .05;--gb-panel-grid-bg: linear-gradient(160deg, #1b1c22 0%, #0b0b0c 72%);--gb-panel-grid-line: rgba(138, 147, 255, .1);--gb-panel-grid-size: 34px;--gb-panel-grid-fade: radial-gradient(90% 80% at 30% 20%, #000, transparent 75%);color-scheme:light dark;position:fixed;top:var(--vvt, 0px);left:0;right:0;height:100vh;height:var(--vvh, 100dvh);container:gb-auth / size;overflow-y:auto;background:var(--gb-page);color:var(--gb-ink);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,system-ui,sans-serif}.gb-auth-split{display:grid;grid-template-columns:1fr;min-height:100%}.gb-auth-stage{box-sizing:border-box;display:flex;min-height:100%;padding:clamp(12px,3cqh,24px) clamp(16px,4vw,24px)}.gb-auth-panel-in{position:relative;box-sizing:border-box;width:100%;max-width:520px;padding:48px clamp(32px,5vw,64px)}.gb-auth-eyebrow{margin:0 0 20px;font-family:ui-monospace,SFMono-Regular,SF Mono,Menlo,monospace;font-size:12px;font-weight:500;letter-spacing:.12em;text-transform:uppercase;color:var(--gb-panel-eyebrow)}.gb-auth-panel-h{margin:0 0 16px;font-size:clamp(28px,3.2vw,40px);line-height:1.15;letter-spacing:-.02em;font-weight:700;color:var(--gb-panel-ink)}.gb-auth-panel-p{margin:0;font-size:15px;line-height:1.6;color:var(--gb-panel-muted)}.gb-auth-panel{display:none}@container gb-auth (min-width: 900px) and (min-height: 520px){.gb-auth-split{grid-template-columns:minmax(420px,1fr) minmax(0,1.05fr)}.gb-auth-split .gb-auth-stage{background:var(--gb-surface)}.gb-auth-split .gb-auth-card{border:none;box-shadow:none;max-width:400px}.gb-auth-panel{display:flex;align-items:center;position:relative;overflow:hidden;background:var(--gb-panel-bg);color:var(--gb-panel-ink)}.gb-auth-panel:before{content:"";position:absolute;inset:-45% -38% auto auto;width:132%;aspect-ratio:1;background-image:var(--gb-facet);background-size:contain;background-repeat:no-repeat;opacity:var(--gb-panel-facet-o);pointer-events:none}.gb-auth-split .gb-auth-panel--grid{background:var(--gb-panel-grid-bg)}.gb-auth-panel.gb-auth-panel--grid:before{inset:0;width:auto;aspect-ratio:auto;background-image:linear-gradient(var(--gb-panel-grid-line) 1px,transparent 1px),linear-gradient(90deg,var(--gb-panel-grid-line) 1px,transparent 1px);background-size:var(--gb-panel-grid-size) var(--gb-panel-grid-size);background-repeat:repeat;opacity:1;-webkit-mask-image:var(--gb-panel-grid-fade);mask-image:var(--gb-panel-grid-fade)}.gb-auth-panel.gb-auth-panel--none:before{content:none}}.gb-auth-card{width:100%;max-width:380px;margin:auto;background:var(--gb-surface);border:1px solid var(--gb-line);border-radius:14px;padding:clamp(18px,3.5cqh,28px) 28px;box-shadow:var(--gb-card-shadow)}.gb-auth-header{text-align:center;margin-bottom:clamp(12px,3cqh,24px)}.gb-auth-mark{display:inline-flex;margin-bottom:clamp(6px,calc(6px + (100cqh - 480px)*.075),12px)}.gb-auth-mark svg,.gb-auth-mark img{width:clamp(32px,calc(32px + (100cqh - 480px)*.3),56px);height:clamp(32px,calc(32px + (100cqh - 480px)*.3),56px)}@container gb-auth (max-height: 479.98px){.gb-auth-mark{display:none}}.gb-auth-header h1{font-size:clamp(19px,2.75cqh,22px);font-weight:700;margin:0 0 clamp(0px,calc((100cqh - 560px)*.1),4px);background:var(--gb-wordmark);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text}.gb-auth-header p{margin:0;font-size:13px;color:var(--gb-muted)}@container gb-auth (max-height: 599.98px){.gb-auth-header p{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}}.gb-auth-form{display:flex;flex-direction:column;gap:clamp(8px,1.5cqh,12px)}.gb-auth-form label{display:flex;flex-direction:column;gap:clamp(4px,.75cqh,6px);font-size:12px;font-weight:500;color:var(--gb-ink)}.gb-auth-input{box-sizing:border-box;height:32px;min-height:44px;min-width:0;padding:0 12px;font:inherit;font-size:13px;line-height:20px;border:1px solid;border-radius:8px}@media (max-width: 47.9975em){.gb-auth-input{font-size:16px}}@media (pointer: coarse){.gb-auth-input{height:auto}}.gb-auth-form input{width:100%;box-sizing:border-box;background-color:var(--gb-field-bg);border-color:var(--gb-field-line);color:var(--gb-ink)}.gb-auth-form input::placeholder{color:var(--gb-placeholder)}.gb-auth-form input:hover:not(:disabled){background-color:var(--gb-field-hover);border-color:var(--gb-hover-line)}.gb-auth-form input:focus-visible{outline:2px solid var(--gb-ink);outline-offset:1px;border-color:var(--gb-ink)}.gb-auth-field{display:flex;flex-direction:column;gap:clamp(4px,.75cqh,6px);font-size:12px;font-weight:500;color:var(--gb-ink)}.gb-auth-pw{position:relative;display:flex}.gb-auth-pw input{width:100%;padding-right:48px}.gb-auth-pw-toggle{min-height:44px;min-width:44px;position:absolute;right:0;top:0;bottom:0;display:inline-flex;align-items:center;justify-content:center;padding:0;margin:0;background:none;border:none;border-radius:8px;cursor:pointer;color:var(--gb-muted);transition:none}.gb-auth-pw-toggle:hover{color:var(--gb-ink)}.gb-auth-pw-toggle:focus-visible{outline:2px solid var(--gemboss-primary, #1b1c1e);outline-offset:-2px}.gb-auth-error{background:var(--gb-err-bg);border:1px solid var(--gb-err-line);color:var(--gb-err-ink);padding:8px 10px;font-size:13px;border-radius:6px}.gb-auth-form>.gb-auth-submit{margin-top:clamp(2px,.75cqh,6px);min-height:44px;font-size:14px;font-weight:600;border:none;border-radius:8px;background:var(--gb-btn);color:var(--gb-btn-ink);cursor:pointer;font-family:inherit;transition:opacity .15s ease,transform .15s ease}.gb-auth-form>.gb-auth-submit:hover:not(:disabled){transform:translateY(-1px)}.gb-auth-form>.gb-auth-submit:disabled{opacity:.6;cursor:not-allowed}.gb-auth-sso-btn{display:flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 16px;border:1px solid var(--gb-field-line);border-radius:8px;background:var(--gb-surface);color:var(--gb-ink);font-size:14px;font-weight:600;text-decoration:none;transition:background .15s,border-color .15s}.gb-auth-sso-btn:hover{background:var(--gb-hover);border-color:var(--gb-hover-line)}.gb-auth-sso-btn:focus-visible{outline:2px solid var(--gb-ink);outline-offset:1px}.gb-auth-sso-why{margin:8px 0 0;font-size:12px;line-height:1.5;color:var(--gb-muted);text-align:center}.gb-auth-sso .gb-auth-or{display:flex;align-items:center;gap:12px;margin:clamp(8px,1.75cqh,14px) 0;color:var(--gb-muted);font-size:12px}.gb-auth-sso .gb-auth-or:before,.gb-auth-sso .gb-auth-or:after{content:"";flex:1;height:1px;background:var(--gb-line)}.gb-auth-foot{margin:clamp(10px,2cqh,16px) 0 0;font-size:13px;color:var(--gb-muted);text-align:center;line-height:1.5}.gb-auth-foot a{display:inline-block;min-height:24px;line-height:24px;padding:0 2px;color:var(--gb-accent);font-weight:600;text-decoration:none}.gb-auth-foot a:hover,.gb-auth-foot a:focus-visible{text-decoration:underline}.gb-auth-card .gb-auth-help{margin:clamp(8px,1.75cqh,14px) 0 0;font-size:12px;color:var(--gb-muted);text-align:center;line-height:1.5}.gb-auth-card .gb-auth-help a{display:inline-block;min-height:24px;line-height:24px;color:var(--gb-accent);font-weight:600;text-decoration:none}.gb-auth-card .gb-auth-help a:hover,.gb-auth-card .gb-auth-help a:focus-visible{text-decoration:underline}@media (max-width: 480px){.gb-auth{background:var(--gb-page-flat)}.gb-auth-stage{padding:max(clamp(10px,3cqh,20px),env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(clamp(10px,3cqh,20px),env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left))}.gb-auth-card{border:none;border-radius:0;box-shadow:none;padding:0}}@container gb-auth (max-height: 399.98px){.gb-auth-header{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}}@container gb-auth (max-height: 359.98px){.gb-auth-card .gb-auth-help,.gb-auth-foot{display:none}.gb-auth-stage{padding-top:max(8px,env(safe-area-inset-top));padding-bottom:max(8px,env(safe-area-inset-bottom))}}@container gb-auth (max-height: 359.98px) and (min-width: 481px){.gb-auth-card{padding-top:14px;padding-bottom:14px}}@media (prefers-color-scheme: dark){:root:not([data-theme=light]) .gb-auth{--gb-surface: #141517;--gb-ink: #f4f4f3;--gb-muted: #969c97;--gb-line: rgba(255, 255, 255, .11);--gb-field-line: rgba(255, 255, 255, .17);--gb-field-bg: #1b1c1f;--gb-field-hover: #212226;--gb-placeholder: #7f838c;--gb-accent: #8a93ff;--gb-btn: linear-gradient(120deg, #f4f4f3 0%, #dfe0e4 100%);--gb-btn-ink: #0b0b0c;--gb-wordmark: linear-gradient(120deg, #f4f4f3 0%, #c9cbd2 100%);--gb-hover: rgba(255, 255, 255, .06);--gb-hover-line: rgba(255, 255, 255, .28);--gb-err-bg: rgba(215, 44, 13, .16);--gb-err-ink: #ff9d88;--gb-err-line: rgba(245, 120, 95, .4);--gb-card-shadow: 0 24px 64px rgba(0, 0, 0, .55);--gb-mark-bg: #202127;--gb-page: radial-gradient(1200px 600px at 20% 10%, rgba(255, 255, 255, .05), transparent 60%), radial-gradient(1000px 500px at 80% 90%, rgba(138, 147, 255, .1), transparent 60%), #0b0b0c;--gb-page-flat: #0b0b0c}}:root[data-theme=dark] .gb-auth{--gb-surface: #141517;--gb-ink: #f4f4f3;--gb-muted: #969c97;--gb-line: rgba(255, 255, 255, .11);--gb-field-line: rgba(255, 255, 255, .17);--gb-field-bg: #1b1c1f;--gb-field-hover: #212226;--gb-placeholder: #7f838c;--gb-accent: #8a93ff;--gb-btn: linear-gradient(120deg, #f4f4f3 0%, #dfe0e4 100%);--gb-btn-ink: #0b0b0c;--gb-wordmark: linear-gradient(120deg, #f4f4f3 0%, #c9cbd2 100%);--gb-hover: rgba(255, 255, 255, .06);--gb-hover-line: rgba(255, 255, 255, .28);--gb-err-bg: rgba(215, 44, 13, .16);--gb-err-ink: #ff9d88;--gb-err-line: rgba(245, 120, 95, .4);--gb-card-shadow: 0 24px 64px rgba(0, 0, 0, .55);--gb-mark-bg: #202127;--gb-page: radial-gradient(1200px 600px at 20% 10%, rgba(255, 255, 255, .05), transparent 60%), radial-gradient(1000px 500px at 80% 90%, rgba(138, 147, 255, .1), transparent 60%), #0b0b0c;--gb-page-flat: #0b0b0c}
1
+ .gb-auth{--gb-surface: #ffffff;--gb-ink: var(--gemboss-text-strong, #1b1c1e);--gb-muted: #6d7175;--gb-line: #e1e3e5;--gb-field-line: #c9cccf;--gb-field-bg: #ffffff;--gb-field-hover: #fafafa;--gb-placeholder: #868b94;--gb-accent: #5661f5;--gb-btn: linear-gradient(120deg, #1b1c1e 0%, #000000 100%);--gb-btn-ink: #ffffff;--gb-wordmark: linear-gradient(120deg, #1b1c1e 0%, #000000 100%);--gb-hover: #f7f7f5;--gb-hover-line: #b9bbc0;--gb-err-bg: #fee2e2;--gb-err-ink: #b91c1c;--gb-err-line: transparent;--gb-card-shadow: 0 24px 64px rgba(15, 23, 42, .08);--gb-mark-bg: #0b0b0c;--gb-facet: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 120'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='0.45' stroke-linejoin='round'%3E%3Cpath d='M26,14 74,14 96,50 50,110 4,50Z'/%3E%3Cpath d='M4,50H96M26,14 34,50M74,14 66,50M34,50 50,110M66,50 50,110'/%3E%3C/g%3E%3C/svg%3E");--gb-page: radial-gradient(1200px 600px at 20% 10%, rgba(27, 28, 30, .05), transparent 60%), radial-gradient(1000px 500px at 80% 90%, rgba(86, 97, 245, .06), transparent 60%), #fafafb;--gb-page-flat: #ffffff;--gb-panel-bg: radial-gradient(900px 520px at 78% 12%, rgba(86, 97, 245, .26), transparent 62%), radial-gradient(700px 480px at 12% 96%, rgba(86, 97, 245, .12), transparent 60%), #0b0b0c;--gb-panel-ink: #f4f4f2;--gb-panel-muted: rgba(244, 244, 242, .72);--gb-panel-eyebrow: #8a93ff;--gb-panel-facet-o: .05;--gb-panel-grid-bg: linear-gradient(160deg, #1b1c22 0%, #0b0b0c 72%);--gb-panel-grid-line: rgba(138, 147, 255, .1);--gb-panel-grid-size: 34px;--gb-panel-grid-fade: radial-gradient(90% 80% at 30% 20%, #000, transparent 75%);color-scheme:light dark;position:fixed;top:var(--vvt, 0px);left:0;right:0;height:100vh;height:var(--vvh, 100dvh);container:gb-auth / size;overflow-y:auto;background:var(--gb-page);color:var(--gb-ink);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,system-ui,sans-serif}.gb-auth-split{display:grid;grid-template-columns:1fr;min-height:100%}.gb-auth-stage{box-sizing:border-box;display:flex;min-height:100%;padding:clamp(12px,3cqh,24px) clamp(16px,4vw,24px)}.gb-auth-panel-in{position:relative;box-sizing:border-box;width:100%;max-width:520px;padding:48px clamp(32px,5vw,64px)}.gb-auth-eyebrow{margin:0 0 20px;font-family:ui-monospace,SFMono-Regular,SF Mono,Menlo,monospace;font-size:12px;font-weight:500;letter-spacing:.12em;text-transform:uppercase;color:var(--gb-panel-eyebrow)}.gb-auth-panel-h{margin:0 0 16px;font-size:clamp(28px,3.2vw,40px);line-height:1.15;letter-spacing:-.02em;font-weight:700;color:var(--gb-panel-ink)}.gb-auth-panel-p{margin:0;font-size:15px;line-height:1.6;color:var(--gb-panel-muted)}.gb-auth-panel{display:none}@container gb-auth (min-width: 900px) and (min-height: 520px){.gb-auth-split{grid-template-columns:minmax(420px,1fr) minmax(0,1.05fr)}.gb-auth-split .gb-auth-stage{background:var(--gb-surface)}.gb-auth-split .gb-auth-card{border:none;box-shadow:none;max-width:400px}.gb-auth-panel{display:flex;align-items:center;position:relative;overflow:hidden;background:var(--gb-panel-bg);color:var(--gb-panel-ink)}.gb-auth-panel:before{content:"";position:absolute;inset:-45% -38% auto auto;width:132%;aspect-ratio:1;background-image:var(--gb-facet);background-size:contain;background-repeat:no-repeat;opacity:var(--gb-panel-facet-o);pointer-events:none}.gb-auth-split .gb-auth-panel--grid{background:var(--gb-panel-grid-bg)}.gb-auth-panel.gb-auth-panel--grid:before{inset:0;width:auto;aspect-ratio:auto;background-image:linear-gradient(var(--gb-panel-grid-line) 1px,transparent 1px),linear-gradient(90deg,var(--gb-panel-grid-line) 1px,transparent 1px);background-size:var(--gb-panel-grid-size) var(--gb-panel-grid-size);background-repeat:repeat;opacity:1;-webkit-mask-image:var(--gb-panel-grid-fade);mask-image:var(--gb-panel-grid-fade)}.gb-auth-panel.gb-auth-panel--none:before{content:none}}.gb-auth-card{width:100%;max-width:380px;margin:auto;background:var(--gb-surface);border:1px solid var(--gb-line);border-radius:14px;padding:clamp(18px,3.5cqh,28px) 28px;box-shadow:var(--gb-card-shadow)}.gb-auth-header{text-align:center;margin-bottom:clamp(12px,3cqh,24px)}.gb-auth-mark{display:inline-flex;margin-bottom:clamp(6px,calc(6px + (100cqh - 480px)*.075),12px)}.gb-auth-mark svg,.gb-auth-mark img{width:clamp(32px,calc(32px + (100cqh - 480px)*.3),56px);height:clamp(32px,calc(32px + (100cqh - 480px)*.3),56px)}@container gb-auth (max-height: 479.98px){.gb-auth-mark{display:none}}.gb-auth-header h1{font-size:clamp(19px,2.75cqh,22px);font-weight:700;margin:0 0 clamp(0px,calc((100cqh - 560px)*.1),4px);background:var(--gb-wordmark);-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text}.gb-auth-header p{margin:0;font-size:13px;color:var(--gb-muted)}@container gb-auth (max-height: 599.98px){.gb-auth-header p{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}}.gb-auth-form{display:flex;flex-direction:column;gap:clamp(8px,1.5cqh,12px)}.gb-auth-form label{display:flex;flex-direction:column;gap:clamp(4px,.75cqh,6px);font-size:12px;font-weight:500;color:var(--gb-ink)}.gb-auth-input{box-sizing:border-box;height:32px;min-height:44px;min-width:0;padding:0 12px;font:inherit;font-size:13px;line-height:20px;border:1px solid;border-radius:8px}@media (max-width: 47.9975em){.gb-auth-input{font-size:16px}}@media (pointer: coarse){.gb-auth-input{height:auto}}.gb-auth-form input{width:100%;box-sizing:border-box;background-color:var(--gb-field-bg);border-color:var(--gb-field-line);color:var(--gb-ink)}.gb-auth-form input::placeholder{color:var(--gb-placeholder)}.gb-auth-form input:hover:not(:disabled){background-color:var(--gb-field-hover);border-color:var(--gb-hover-line)}.gb-auth-form input:focus-visible{outline:2px solid var(--gb-ink);outline-offset:1px;border-color:var(--gb-ink)}.gb-auth-field{display:flex;flex-direction:column;gap:clamp(4px,.75cqh,6px);font-size:12px;font-weight:500;color:var(--gb-ink)}.gb-auth-pw{position:relative;display:flex}.gb-auth-pw input{width:100%;padding-right:48px}.gb-auth-pw-toggle{min-height:44px;min-width:44px;position:absolute;right:0;top:0;bottom:0;display:inline-flex;align-items:center;justify-content:center;padding:0;margin:0;background:none;border:none;border-radius:8px;cursor:pointer;color:var(--gb-muted);transition:none}.gb-auth-pw-toggle:hover{color:var(--gb-ink)}.gb-auth-pw-toggle:focus-visible{outline:2px solid var(--gemboss-primary, #1b1c1e);outline-offset:-2px}.gb-auth-error{background:var(--gb-err-bg);border:1px solid var(--gb-err-line);color:var(--gb-err-ink);padding:8px 10px;font-size:13px;border-radius:6px}.gb-auth-form>.gb-auth-submit{margin-top:clamp(2px,.75cqh,6px);min-height:44px;font-size:14px;font-weight:600;border:none;border-radius:8px;background:var(--gb-btn);color:var(--gb-btn-ink);cursor:pointer;font-family:inherit;transition:opacity .15s ease,transform .15s ease}.gb-auth-form>.gb-auth-submit:hover:not(:disabled){transform:translateY(-1px)}.gb-auth-form>.gb-auth-submit:disabled{opacity:.6;cursor:not-allowed}.gb-auth-sso-btn{display:flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 16px;border:1px solid var(--gb-field-line);border-radius:8px;background:var(--gb-surface);color:var(--gb-ink);font-size:14px;font-weight:600;text-decoration:none;transition:background .15s,border-color .15s}.gb-auth-sso-btn:hover{background:var(--gb-hover);border-color:var(--gb-hover-line)}.gb-auth-sso-btn:focus-visible{outline:2px solid var(--gb-ink);outline-offset:1px}.gb-auth-notice{margin:0 0 12px;padding:8px 10px;border-radius:6px;background:var(--gb-hover);font-size:13px}.gb-auth-sso-why{margin:8px 0 0;font-size:12px;line-height:1.5;color:var(--gb-muted);text-align:center}.gb-auth-sso .gb-auth-or{display:flex;align-items:center;gap:12px;margin:clamp(8px,1.75cqh,14px) 0;color:var(--gb-muted);font-size:12px}.gb-auth-sso .gb-auth-or:before,.gb-auth-sso .gb-auth-or:after{content:"";flex:1;height:1px;background:var(--gb-line)}.gb-auth-foot{margin:clamp(10px,2cqh,16px) 0 0;font-size:13px;color:var(--gb-muted);text-align:center;line-height:1.5}.gb-auth-foot a{display:inline-block;min-height:24px;line-height:24px;padding:0 2px;color:var(--gb-accent);font-weight:600;text-decoration:none}.gb-auth-foot a:hover,.gb-auth-foot a:focus-visible{text-decoration:underline}.gb-auth-card .gb-auth-help{margin:clamp(8px,1.75cqh,14px) 0 0;font-size:12px;color:var(--gb-muted);text-align:center;line-height:1.5}.gb-auth-card .gb-auth-help a{display:inline-block;min-height:24px;line-height:24px;color:var(--gb-accent);font-weight:600;text-decoration:none}.gb-auth-card .gb-auth-help a:hover,.gb-auth-card .gb-auth-help a:focus-visible{text-decoration:underline}@media (max-width: 480px){.gb-auth{background:var(--gb-page-flat)}.gb-auth-stage{padding:max(clamp(10px,3cqh,20px),env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(clamp(10px,3cqh,20px),env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left))}.gb-auth-card{border:none;border-radius:0;box-shadow:none;padding:0}}@container gb-auth (max-height: 399.98px){.gb-auth-header{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}}@container gb-auth (max-height: 359.98px){.gb-auth-card .gb-auth-help,.gb-auth-foot{display:none}.gb-auth-stage{padding-top:max(8px,env(safe-area-inset-top));padding-bottom:max(8px,env(safe-area-inset-bottom))}}@container gb-auth (max-height: 359.98px) and (min-width: 481px){.gb-auth-card{padding-top:14px;padding-bottom:14px}}@media (prefers-color-scheme: dark){:root:not([data-theme=light]) .gb-auth{--gb-surface: #141517;--gb-ink: #f4f4f3;--gb-muted: #969c97;--gb-line: rgba(255, 255, 255, .11);--gb-field-line: rgba(255, 255, 255, .17);--gb-field-bg: #1b1c1f;--gb-field-hover: #212226;--gb-placeholder: #7f838c;--gb-accent: #8a93ff;--gb-btn: linear-gradient(120deg, #f4f4f3 0%, #dfe0e4 100%);--gb-btn-ink: #0b0b0c;--gb-wordmark: linear-gradient(120deg, #f4f4f3 0%, #c9cbd2 100%);--gb-hover: rgba(255, 255, 255, .06);--gb-hover-line: rgba(255, 255, 255, .28);--gb-err-bg: rgba(215, 44, 13, .16);--gb-err-ink: #ff9d88;--gb-err-line: rgba(245, 120, 95, .4);--gb-card-shadow: 0 24px 64px rgba(0, 0, 0, .55);--gb-mark-bg: #202127;--gb-page: radial-gradient(1200px 600px at 20% 10%, rgba(255, 255, 255, .05), transparent 60%), radial-gradient(1000px 500px at 80% 90%, rgba(138, 147, 255, .1), transparent 60%), #0b0b0c;--gb-page-flat: #0b0b0c}}:root[data-theme=dark] .gb-auth{--gb-surface: #141517;--gb-ink: #f4f4f3;--gb-muted: #969c97;--gb-line: rgba(255, 255, 255, .11);--gb-field-line: rgba(255, 255, 255, .17);--gb-field-bg: #1b1c1f;--gb-field-hover: #212226;--gb-placeholder: #7f838c;--gb-accent: #8a93ff;--gb-btn: linear-gradient(120deg, #f4f4f3 0%, #dfe0e4 100%);--gb-btn-ink: #0b0b0c;--gb-wordmark: linear-gradient(120deg, #f4f4f3 0%, #c9cbd2 100%);--gb-hover: rgba(255, 255, 255, .06);--gb-hover-line: rgba(255, 255, 255, .28);--gb-err-bg: rgba(215, 44, 13, .16);--gb-err-ink: #ff9d88;--gb-err-line: rgba(245, 120, 95, .4);--gb-card-shadow: 0 24px 64px rgba(0, 0, 0, .55);--gb-mark-bg: #202127;--gb-page: radial-gradient(1200px 600px at 20% 10%, rgba(255, 255, 255, .05), transparent 60%), radial-gradient(1000px 500px at 80% 90%, rgba(138, 147, 255, .1), transparent 60%), #0b0b0c;--gb-page-flat: #0b0b0c}
package/src/auth.tsx CHANGED
@@ -12,8 +12,17 @@
12
12
  * the height ladder that sheds the tagline and the mark on short screens, the keyboard-aware height,
13
13
  * the dark theme. Re-theme it by redefining the `--gb-*` tokens on `.gb-auth` (see auth.css), never
14
14
  * by restyling its classes.
15
+ *
16
+ * The standard screen (24/10/2026, Chris's design canvas for GemBoss, GemCommunity and GemBoss Affiliates): the card,
17
+ * "Forgot password?" on the Password row (PasswordField `forgot`), a row under the card (`footer`: AuthFooter in
18
+ * auth-footer.tsx, with the theme, the language and Help · Terms · Privacy), and a real screenshot of the product on
19
+ * the panel (`panel.shot`). A sign-up of several steps adds auth-steps.tsx: the step header, Back + Continue, and the
20
+ * choice cards and chips that answer a step's one question.
15
21
  */
16
22
  import "./auth.css"; // its own stylesheet travels with it (0.23.0): a surface that never renders it never loads it
23
+ // What the screen gained on 24/10/2026 (the panel's picture, "Forgot password?", the bottom row's place). Its own entry
24
+ // because auth.css rides in the frozen compatibility bundle, which had 21 bytes of room left (auth-extras.css says more).
25
+ import "./auth-extras.css";
17
26
  import React, { useEffect, useRef, useState } from "react";
18
27
 
19
28
  import { GemMark } from "./GemMark";
@@ -33,24 +42,60 @@ export type AuthBackdrop = "facet" | "grid" | "none";
33
42
  // Whole class names, not `gb-auth-panel--${backdrop}`: written out, grep and the admin's orphan-rule gate can see them.
34
43
  const BACKDROP: Record<AuthBackdrop, string> = { facet: "", grid: "gb-auth-panel--grid", none: "gb-auth-panel--none" };
35
44
 
45
+ /**
46
+ * A real page of the product in a white window, under the panel's words (24/10/2026). Chris asked for one sign-in for
47
+ * GemBoss, GemCommunity and GemBoss Affiliates that looks better than the words alone: the panel shows what the person
48
+ * is signing in TO (Affiliates its earnings chart, GemCommunity its members, GemBoss its funnels), in a window with a
49
+ * 28px bar and three grey dots so it reads as a screen, not as decoration.
50
+ *
51
+ * Lazy, like AuthPageField's pages: the panel is display:none below 900 wide or 520 tall, and a lazy image there is
52
+ * never fetched, so a phone does not download a picture it cannot see.
53
+ */
54
+ export interface AuthShot {
55
+ /** The screenshot, served by the surface: a real page, wider than tall (16:10 reads best). */
56
+ src: string;
57
+ /** What it shows, for a screen reader ("This month's earnings, day by day"). `""` when the heading already says it. */
58
+ alt: string;
59
+ /** One line under the window. */
60
+ caption?: React.ReactNode;
61
+ /** The picture's own size, so the window holds its height before the image arrives. */
62
+ width?: number;
63
+ height?: number;
64
+ }
65
+
66
+ function AuthShotWindow({ src, alt, caption, width, height }: AuthShot) {
67
+ return (
68
+ <figure className="gb-auth-shot">
69
+ <div className="gb-auth-shot-win">
70
+ <img src={src} alt={alt} width={width} height={height} loading="lazy" decoding="async" />
71
+ </div>
72
+ {caption ? <figcaption>{caption}</figcaption> : null}
73
+ </figure>
74
+ );
75
+ }
76
+
36
77
  /**
37
78
  * The whole screen. `children` is everything inside the card below the heading: the form, then any
38
79
  * lines under it.
39
80
  */
40
- export function AuthLayout({ brand, tagline, mark, panel, backdrop = "facet", art, className, children }: {
81
+ export function AuthLayout({ brand, tagline, mark, panel, backdrop = "facet", art, footer, className, children }: {
41
82
  /** The page heading (h1) in the card. */
42
83
  brand: React.ReactNode;
43
84
  /** One line under the heading; the first thing shed on a short screen. */
44
85
  tagline?: React.ReactNode;
45
86
  /** Defaults to the GemBoss gem on the `--gb-mark-bg` tile. */
46
87
  mark?: React.ReactNode;
47
- /** The brand panel beside the card — shown only where there is room (900 wide AND 520 tall). */
48
- panel?: { eyebrow?: React.ReactNode; heading: React.ReactNode; body?: React.ReactNode };
88
+ /** The brand panel beside the card — shown only where there is room (900 wide AND 520 tall). `shot` (24/10/2026):
89
+ * a screenshot of the product in a window under the words; see `AuthShot`. */
90
+ panel?: { eyebrow?: React.ReactNode; heading: React.ReactNode; body?: React.ReactNode; shot?: AuthShot };
49
91
  /** The panel's ground pattern; see `AuthBackdrop`. Only drawn where the panel is (900 wide AND 520 tall). */
50
92
  backdrop?: AuthBackdrop;
51
93
  /** Drawn on the panel, under its words (16/10/2026): `AuthPageField`, or anything else that is decoration. Pair it
52
94
  * with `backdrop="none"`. Only drawn where the panel is. */
53
95
  art?: React.ReactNode;
96
+ /** The row at the bottom of the form's column, OUTSIDE the card (24/10/2026): `AuthFooter` (theme, language, Help ·
97
+ * Terms · Privacy). Those are about the page, not the form, so they sit under it rather than in it. */
98
+ footer?: React.ReactNode;
54
99
  className?: string;
55
100
  children?: React.ReactNode;
56
101
  }) {
@@ -92,7 +137,9 @@ export function AuthLayout({ brand, tagline, mark, panel, backdrop = "facet", ar
92
137
  return (
93
138
  <main className={cx("gb-auth", className)} ref={shellRef}>
94
139
  <div className="gb-auth-split">
95
- <div className="gb-auth-stage">
140
+ {/* With a footer the column stacks (gb-auth-stage--foot): the card keeps its auto margins, so it still centres in
141
+ the room above, and the row sits at the bottom. Without one the markup is exactly what it was. */}
142
+ <div className={cx("gb-auth-stage", footer ? "gb-auth-stage--foot" : null)}>
96
143
  <div className="gb-auth-card">
97
144
  <header className="gb-auth-header">
98
145
  <span className="gb-auth-mark" aria-hidden>
@@ -103,6 +150,7 @@ export function AuthLayout({ brand, tagline, mark, panel, backdrop = "facet", ar
103
150
  </header>
104
151
  {children}
105
152
  </div>
153
+ {footer ? <div className="gb-auth-bottom">{footer}</div> : null}
106
154
  </div>
107
155
  {/* Left OUT of aria-hidden: the words are an invitation and a screen-reader user should hear
108
156
  them. Nothing in it is focusable — it is decoration beside the form, not a second path. */}
@@ -113,6 +161,7 @@ export function AuthLayout({ brand, tagline, mark, panel, backdrop = "facet", ar
113
161
  {panel.eyebrow ? <p className="gb-auth-eyebrow">{panel.eyebrow}</p> : null}
114
162
  <h2 className="gb-auth-panel-h">{panel.heading}</h2>
115
163
  {panel.body ? <p className="gb-auth-panel-p">{panel.body}</p> : null}
164
+ {panel.shot ? <AuthShotWindow {...panel.shot} /> : null}
116
165
  </div>
117
166
  </aside>
118
167
  ) : null}
@@ -178,6 +227,12 @@ export function AuthContinueWithGemBoss({ service, next = "/", issuer = GEMBOSS_
178
227
  window.location.replace(gemBossSignInUrl(service, next, issuer, window.location.host));
179
228
  }
180
229
  }, [service, next, issuer]);
230
+ // Back from GemBoss into a page the browser kept in memory: the door is not still "Continuing with GemBoss…".
231
+ useEffect(() => {
232
+ const back = (e: PageTransitionEvent) => { if (e.persisted) setGoing(false); };
233
+ window.addEventListener("pageshow", back);
234
+ return () => window.removeEventListener("pageshow", back);
235
+ }, []);
181
236
  return (
182
237
  <div className="gb-auth-sso">
183
238
  <a className="gb-auth-sso-btn" href={href} onClick={() => setGoing(true)}>
@@ -240,17 +295,25 @@ function EyeIcon({ off }: { off: boolean }) {
240
295
  * Password + reveal toggle inside the field. The input is NOT inside the label: a <button> inside a
241
296
  * <label> still fires the label's activation, so every reveal re-focused the input and, on iOS
242
297
  * Safari, scrolled the card. `htmlFor` keeps the word "Password" clickable without that.
298
+ *
299
+ * `forgot` (24/10/2026): "Forgot password?" on the label's row, at its right end, as the approved sign-in draws it. It
300
+ * is AFTER the field in the page, and only drawn up on the label's row (a grid, auth-extras.css): someone who Tabs from
301
+ * Email goes straight into Password, types, and presses Enter. Placed before the field it would sit between the two
302
+ * boxes every keyboard user fills.
243
303
  */
244
304
  export function PasswordField({ id, label = "Password", toggleLabels = { show: "Show password", hide: "Hide password" },
245
- inputClassName = "gb-auth-input", ...input }: InputProps & {
305
+ forgot, inputClassName = "gb-auth-input", ...input }: InputProps & {
246
306
  id: string;
247
307
  label?: React.ReactNode;
248
308
  toggleLabels?: { show: string; hide: string };
309
+ /** The "Forgot password?" link: where it goes, its words (default "Forgot password?"), and an onClick for a page that
310
+ * handles it in place (call preventDefault there; the href still works before React has loaded). */
311
+ forgot?: { href: string; label?: React.ReactNode; onClick?: React.MouseEventHandler<HTMLAnchorElement> };
249
312
  }) {
250
313
  const [shown, setShown] = useState(false);
251
314
  const name = shown ? toggleLabels.hide : toggleLabels.show;
252
315
  return (
253
- <div className="gb-auth-field">
316
+ <div className={forgot ? "gb-auth-field gb-auth-field--forgot" : "gb-auth-field"}>
254
317
  <label htmlFor={id}>{label}</label>
255
318
  <div className="gb-auth-pw">
256
319
  <input className={inputClassName} id={id} type={shown ? "text" : "password"} {...input} />
@@ -270,6 +333,7 @@ export function PasswordField({ id, label = "Password", toggleLabels = { show: "
270
333
  <EyeIcon off={shown} />
271
334
  </button>
272
335
  </div>
336
+ {forgot ? <a className="gb-auth-forgot" href={forgot.href} onClick={forgot.onClick}>{forgot.label ?? "Forgot password?"}</a> : null}
273
337
  </div>
274
338
  );
275
339
  }
@@ -296,6 +360,19 @@ export function AuthHelp({ children }: { children?: React.ReactNode }) {
296
360
  /** What the form says when the request never got an answer. */
297
361
  export const SIGN_IN_OFFLINE = "Couldn't reach the server. Check your connection and try again.";
298
362
 
363
+ // The refusals that are about what was typed: a missing or malformed value, a wrong email or password. A lock (429), a
364
+ // closed door (503) or a forbidden (403) marks no field.
365
+ const FIELD_REFUSALS = [400, 401, 422];
366
+
367
+ /** A sign-in route's refusal read the way initSignIn() reads it, for an `onSignIn` that fetches the route itself:
368
+ * the body's `error`, `detail` or `message`, and whether it is about the fields (FIELD_REFUSALS).
369
+ * `if (!res.ok) return signInRefusal(res);` keeps a React form and a plain one saying the same thing. */
370
+ export async function signInRefusal(res: Response): Promise<{ message: string; fields: boolean }> {
371
+ const j = await res.json().catch(() => null);
372
+ const said = j && typeof j === "object" ? [j.error, j.detail, j.message].find((x) => typeof x === "string" && x) : undefined;
373
+ return { message: said || `Couldn't sign in (HTTP ${res.status}). Try again.`, fields: FIELD_REFUSALS.includes(res.status) };
374
+ }
375
+
299
376
  /**
300
377
  * The whole sign-in form of a fleet tool (23/10/2026), the part every tool used to write itself: Continue with GemBoss,
301
378
  * then Email, Password, the error and Sign in. Chris, 23/10/2026, seeing "Your lark email" on one form and other words on
@@ -303,13 +380,19 @@ export const SIGN_IN_OFFLINE = "Couldn't reach the server. Check your connection
303
380
  * a tool says which tool it is (`service`), where to land (`next`) and how to check the two values (`onSignIn`).
304
381
  *
305
382
  * `onSignIn` returns the sentence to show when it did not work (the server's own words, e.g. "The email or password is
306
- * wrong."), or nothing once it has started moving the browser on: the button stays on "Signing in…" until the page goes,
307
- * so a second press cannot send the password twice. It throwing reads as the network being down.
383
+ * wrong."; `signInRefusal(res)` reads them from a fetch), or nothing once it has started moving the browser on: the button
384
+ * stays on "Signing in…" until the page goes, so a second press cannot send the password twice. It throwing reads as the
385
+ * network being down.
308
386
  *
309
387
  * Without `service` there is no GemBoss button: only for a tool that GemBoss does not sign into yet.
310
388
  * Plain-HTML twin: `initSignIn()` in auth-signin-plain.js, same markup (auth-signin-browser.test.ts compares the two).
311
389
  */
312
- export function AuthSignIn({ service, next = "/", issuer = GEMBOSS_ISSUER, host, action, onSignIn, foot, idPrefix = "gb-signin" }: {
390
+ /** What `onSignIn` answers: nothing once it has moved on; the server's sentence (about what was typed, so both fields are
391
+ * marked); or `{ message, fields: false }` for a sentence that is not about the fields (a lock, a closed door). */
392
+ export type SignInAnswer = string | { message: string; fields?: boolean } | null | undefined | void;
393
+
394
+ export function AuthSignIn({ service, next, issuer = GEMBOSS_ISSUER, host, action, onSignIn, foot, forgot, idPrefix = "gb-signin",
395
+ error: givenError, errorFields = true, notice, autoFocus = false }: {
313
396
  /** This tool's id in GemBoss's FLEET_SSO_SERVICES. */
314
397
  service?: string;
315
398
  /** The request's Host, from a server-rendered page: see AuthContinueWithGemBoss. */
@@ -318,22 +401,43 @@ export function AuthSignIn({ service, next = "/", issuer = GEMBOSS_ISSUER, host,
318
401
  * should answer a plain form post with a redirect. The form is always `method="post"`, so that early press never
319
402
  * becomes a GET with the password in the URL. */
320
403
  action?: string;
321
- /** Where on this tool to land after GemBoss: a path. */
404
+ /** Where on this tool to land after GemBoss: a path. It is also posted with the form (`next`), so a press made before
405
+ * React loaded still lands there; left out, the GemBoss door goes to "/" and the form post lets the server choose. */
322
406
  next?: string;
323
407
  issuer?: string;
324
- onSignIn: (credentials: { email: string; password: string }) => Promise<string | null | undefined | void>;
408
+ onSignIn: (credentials: { email: string; password: string }) => Promise<SignInAnswer>;
325
409
  /** One line under the form, e.g. "Internal use only." */
326
410
  foot?: React.ReactNode;
411
+ /** "Forgot password?" on the Password row (24/10/2026): PasswordField's `forgot`. The plain twin reads `data-forgot`. */
412
+ forgot?: { href: string; label?: React.ReactNode };
327
413
  /** Prefix of the inputs' ids: only matters with two sign-in forms on one page. */
328
414
  idPrefix?: string;
415
+ /** The sentence the server answered a plain form post with (a press before React loaded; the page reads it from its
416
+ * `?error=`): shown as if `onSignIn` had said it. */
417
+ error?: string;
418
+ /** Whether `error` is about what was typed (default): false for a lock or a closed door, so the fields are not marked. */
419
+ errorFields?: boolean;
420
+ /** A line above the form before anyone presses ("Your session expired. Sign in again."); it goes on the first press. */
421
+ notice?: React.ReactNode;
422
+ /** Put the cursor in Email when the form is on the page: unless someone is already in a field, or the page is going on to
423
+ * GemBoss by itself (a phone's keyboard would open over the redirect). */
424
+ autoFocus?: boolean;
329
425
  }) {
330
- const [email, setEmail] = useState("");
331
- const [password, setPassword] = useState("");
332
426
  const [busy, setBusy] = useState(false);
333
- const [error, setError] = useState<string | null>(null);
334
- // The server refused what was typed: both fields are marked. A dropped network marks neither (nothing in them is wrong).
335
- const [wrong, setWrong] = useState(false);
336
- const errorId = `${idPrefix}-error`;
427
+ const [error, setError] = useState<string | null>(givenError || null);
428
+ // The server refused what was typed: both fields are marked. A lock, a closed door or a dropped network marks neither
429
+ // (nothing in them is wrong).
430
+ const [wrong, setWrong] = useState(!!givenError && errorFields);
431
+ // A new `error` after mount (the page moved to another ?error= without remounting): shown, as the first one was.
432
+ const [given, setGiven] = useState(givenError);
433
+ if (given !== givenError) {
434
+ setGiven(givenError);
435
+ setError(givenError || null);
436
+ setWrong(!!givenError && errorFields);
437
+ }
438
+ const [noticeShown, setNoticeShown] = useState(true);
439
+ const errorId = `${idPrefix}-error`, noticeId = `${idPrefix}-notice`;
440
+ const showNotice = !!notice && noticeShown;
337
441
 
338
442
  // Back to this page from the browser's memory after it moved on (bfcache keeps React's state): not still "Signing in…".
339
443
  useEffect(() => {
@@ -342,36 +446,60 @@ export function AuthSignIn({ service, next = "/", issuer = GEMBOSS_ISSUER, host,
342
446
  return () => window.removeEventListener("pageshow", back);
343
447
  }, []);
344
448
 
449
+ // As HTML autofocus, but not under a field someone is already in (a click made while the page loaded) and not over the
450
+ // redirect when the GemBoss door continues by itself.
451
+ useEffect(() => {
452
+ if (!autoFocus) return;
453
+ const at = document.activeElement;
454
+ if (at && at !== document.body) return;
455
+ if (service && continuesByItself(document.cookie, window.location.search)) return;
456
+ document.getElementById(`${idPrefix}-email`)?.focus();
457
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- once, when the form arrives
458
+ }, []);
459
+
345
460
  async function submit(e: React.FormEvent<HTMLFormElement>) {
346
461
  e.preventDefault();
347
462
  if (busy) return;
463
+ // What is in the fields now, read from the form: a password manager that filled them before React loaded fires no
464
+ // change event, so state would still say "" and the press would send an empty password (a counted wrong try).
465
+ const values = new FormData(e.currentTarget);
466
+ const email = String(values.get("email") ?? "").trim(), password = String(values.get("password") ?? "");
348
467
  setBusy(true);
349
468
  setError(null);
350
- let said: string | null | undefined | void;
351
- let refused = true;
469
+ setNoticeShown(false);
470
+ let said: SignInAnswer;
471
+ let fields = true;
352
472
  try {
353
- said = await onSignIn({ email: email.trim(), password });
473
+ said = await onSignIn({ email, password });
354
474
  } catch {
355
475
  said = SIGN_IN_OFFLINE;
356
- refused = false;
476
+ fields = false;
357
477
  }
358
- if (said) {
359
- setError(said);
360
- setWrong(refused);
478
+ // An answer with no words is still a refusal: the button must not stay on "Signing in…".
479
+ const message = typeof said === "string" ? said : said ? said.message || "Couldn't sign in. Try again." : "";
480
+ if (said && typeof said === "object" && said.fields === false) fields = false;
481
+ if (message) {
482
+ setError(message);
483
+ setWrong(fields);
361
484
  setBusy(false);
362
485
  }
363
486
  }
364
487
 
365
- // Both fields point at the error once there is one: a screen reader that Tabs back into either hears why.
366
- const described = error ? { ...(wrong ? { "aria-invalid": true as const } : {}), "aria-describedby": errorId } : {};
488
+ // Both fields point at the error once there is one: a screen reader that Tabs back into either hears why. Email also
489
+ // points at the notice: it is on the page from the start, and a live region only speaks when it changes.
490
+ const invalid = error && wrong ? { "aria-invalid": true as const } : {};
491
+ const describedBy = (...ids: (string | false)[]) => ids.filter(Boolean).join(" ") || undefined;
367
492
  return (
368
493
  <>
369
- {service ? <AuthContinueWithGemBoss service={service} next={next} issuer={issuer} host={host} /> : null}
494
+ {showNotice ? <p id={noticeId} className="gb-auth-notice" role="status">{notice}</p> : null}
495
+ {service ? <AuthContinueWithGemBoss service={service} next={next ?? "/"} issuer={issuer} host={host} /> : null}
370
496
  <AuthForm method="post" action={action} onSubmit={submit}>
371
- <AuthField id={`${idPrefix}-email`} label="Email" type="email" name="email" autoComplete="username" required
372
- value={email} onChange={(e) => setEmail(e.target.value)} {...described} />
373
- <PasswordField id={`${idPrefix}-password`} name="password" autoComplete="current-password" required
374
- value={password} onChange={(e) => setPassword(e.target.value)} {...described} />
497
+ {next !== undefined ? <input type="hidden" name="next" value={next} /> : null}
498
+ {/* Not controlled: the browser keeps what is typed or filled, and submit reads the form. */}
499
+ <AuthField id={`${idPrefix}-email`} label="Email" type="email" name="email" autoComplete="username" required {...invalid}
500
+ aria-describedby={describedBy(showNotice && noticeId, !!error && errorId)} />
501
+ <PasswordField id={`${idPrefix}-password`} name="password" autoComplete="current-password" required forgot={forgot} {...invalid}
502
+ aria-describedby={describedBy(!!error && errorId)} />
375
503
  <div id={errorId}><AuthError>{error}</AuthError></div>
376
504
  <AuthSubmit disabled={busy}>{busy ? "Signing in…" : "Sign in"}</AuthSubmit>
377
505
  </AuthForm>
package/src/dialog.tsx CHANGED
@@ -25,6 +25,8 @@ const cx = (...p: Array<string | false | null | undefined>) => p.filter(Boolean)
25
25
  *
26
26
  * - The backdrop closes it only when the press STARTED there too: a text selection dragged from the panel and released
27
27
  * over the scrim lands its click on the dialog (the common ancestor), and must not close it (review #4062).
28
+ * - `[data-autofocus]` inside it gets the focus on opening, as in the kit's Popover (a picker's search box: `search.autoFocus`);
29
+ * without one the browser's rule applies, the first control, which is the head's ✕.
28
30
  * - `focusPanel`: after opening, focus the dialog itself (it needs `tabIndex={-1}`) instead of its first control, so a
29
31
  * second Enter does not follow the head's first link (Sheet's "Open full profile").
30
32
  * - Unmounted while open (a route that drew it went away), focus still goes back to the opener.
@@ -54,6 +56,7 @@ export function useModalDialog(open: boolean, onClose: () => void, { focusPanel
54
56
  d.showModal();
55
57
  shown.current = true;
56
58
  if (focusPanel) d.focus({ preventScroll: true });
59
+ else d.querySelector<HTMLElement>("[data-autofocus]")?.focus({ preventScroll: true });
57
60
  }
58
61
  if (!open && d.open) d.close();
59
62
  }, [open, focusPanel]);
@@ -0,0 +1,183 @@
1
+ "use client";
2
+ // COLOR PICKER (24/10/2026, Chris: the colour picker should be standard and look right; "ưu tiên ui ux dễ dùng"). The panel a
3
+ // colour field's swatch opens (ColorControl → Popover). Before it the swatch opened the OPERATING SYSTEM's picker: a different
4
+ // window on every machine, no opacity, none of the theme's colours. Learnt from GemPages (an in-app square, hue and opacity, an
5
+ // eyedropper, recent colours) and NOT copied where it is worse (its square is hidden on desktop until a second click, and works
6
+ // with a mouse only; it offers no theme colours):
7
+ // · the square (saturation × brightness) works with the pointer AND the keys: ← → saturation, ↑ ↓ brightness, Shift for 10;
8
+ // · hue and opacity are native ranges (keys, screen readers, a finger: free), opacity over a checkerboard in the colour;
9
+ // · the hex box takes a colour as typed (3 or 6 digits, with or without #); the eyedropper picks one from the screen where
10
+ // the browser has `EyeDropper` (Chrome, Edge);
11
+ // · the theme's colours (they write `var(--gem-color-<role>)`: the page keeps following the theme), the recent ones, and None;
12
+ // · a pick keeps the value's transparency and its way of writing (`pickSwatch`, as the native swatch did); while a drag lasts
13
+ // it writes at most every 80 ms and once when it ends, so the canvas follows without a write per pixel.
14
+ // Its own part (`editor-color.css`).
15
+ import "../editor.css"; // the colour chips (.gemboss-ei-sw) are the editor's
16
+ import "../editor-color.css";
17
+ import React, { useEffect, useRef, useState } from "react";
18
+ import { Icon } from "../icons";
19
+ import { hexOf, opacityOf, parseColor, pickSwatch, withOpacity, type Rgba } from "./swatch";
20
+ import type { ColorChoice } from "./controls";
21
+
22
+ export interface ColorPickerProps {
23
+ /** The field's value now (what the theme chips and None compare with). */
24
+ value: string;
25
+ /** The colour picks start from: the value, or the colour a theme chip it holds paints. Empty opens on white. */
26
+ base?: string;
27
+ /** Called with each new value (throttled while a drag lasts, then once at its end). */
28
+ onChange: (value: string) => void;
29
+ /** The field's name, for the controls' names ("Background hue"). */
30
+ label: string;
31
+ choices?: readonly ColorChoice[];
32
+ /** A "None" chip that empties the field (Not set). */
33
+ allowNone?: boolean;
34
+ }
35
+
36
+ type Hsv = { h: number; s: number; v: number };
37
+ const clamp = (n: number, lo: number, hi: number) => Math.min(hi, Math.max(lo, n));
38
+
39
+ function hsvOf({ r, g, b }: Rgba, keepHue = 0): Hsv {
40
+ const R = r / 255, G = g / 255, B = b / 255, max = Math.max(R, G, B), min = Math.min(R, G, B), d = max - min;
41
+ let h = keepHue;
42
+ if (d) h = max === R ? ((G - B) / d) % 6 : max === G ? (B - R) / d + 2 : (R - G) / d + 4;
43
+ if (d) h = (h * 60 + 360) % 360;
44
+ return { h, s: max ? (d / max) * 100 : 0, v: max * 100 };
45
+ }
46
+ function rgbOf({ h, s, v }: Hsv) {
47
+ const S = s / 100, V = v / 100, c = V * S, x = c * (1 - Math.abs(((h / 60) % 2) - 1)), m = V - c;
48
+ const [r, g, b] = h < 60 ? [c, x, 0] : h < 120 ? [x, c, 0] : h < 180 ? [0, c, x] : h < 240 ? [0, x, c] : h < 300 ? [x, 0, c] : [c, 0, x];
49
+ return { r: (r + m) * 255, g: (g + m) * 255, b: (b + m) * 255 };
50
+ }
51
+
52
+ export function ColorPicker({ value, base, onChange, label, choices, allowNone = true }: ColorPickerProps) {
53
+ const from = base ?? value;
54
+ const parsed = parseColor(from);
55
+ const rgba: Rgba = parsed ?? { r: 255, g: 255, b: 255, a: 1 };
56
+ // The hue is kept here: a grey or a black has none, and dragging to one must not throw the square back to red.
57
+ const [hsv, setHsv] = useState<Hsv>(() => hsvOf(rgba));
58
+ // A value from outside (a chip, the text box, Undo) moves the square; our own echo does not, nor anything while a drag lasts
59
+ // (a throttled write comes back older than the pointer, and the square would jump back to it).
60
+ const emitted = useRef<string | null>(null);
61
+ const dragging = useRef(false);
62
+ useEffect(() => {
63
+ if (dragging.current || from === emitted.current) return;
64
+ setHsv((now) => hsvOf(rgba, now.h));
65
+ }, [from]); // eslint-disable-line react-hooks/exhaustive-deps
66
+
67
+ // Writes: a key or a click at once; a drag at most every 80 ms, and always its last one.
68
+ const last = useRef(0);
69
+ const trailing = useRef<ReturnType<typeof setTimeout> | null>(null);
70
+ const send = (next: string) => { emitted.current = next; last.current = Date.now(); onChange(next); };
71
+ const emit = (next: string, final = !dragging.current) => {
72
+ if (trailing.current) { clearTimeout(trailing.current); trailing.current = null; }
73
+ const now = Date.now();
74
+ if (final || now - last.current >= 80) { send(next); return; }
75
+ trailing.current = setTimeout(() => { trailing.current = null; send(next); }, 80 - (now - last.current));
76
+ };
77
+ useEffect(() => () => { if (trailing.current) clearTimeout(trailing.current); }, []);
78
+ const write = (h: Hsv, final?: boolean) => { setHsv(h); emit(pickSwatch(from, hexOf(rgbOf(h))), final); };
79
+ // A bar pressed and let go without moving writes nothing: a plain click rewrote a theme token as its hex, and hsl / oklch / #f00
80
+ // as rgb (review of #5296). `moved` says the bar's value changed during this press.
81
+ const moved = useRef(false);
82
+ const dragStart = () => { dragging.current = true; moved.current = false; };
83
+ const dragEnd = () => { dragging.current = false; };
84
+ // The opacity bar's value while it is held: a controlled range only moves when a (throttled) write lands, so between writes React
85
+ // put it back, and the release read that old value and wrote it over the one the pointer left (review of #5296).
86
+ const [alphaHeld, setAlphaHeld] = useState<number | null>(null);
87
+
88
+ // The square: pointer, then keys.
89
+ const area = useRef<HTMLDivElement>(null);
90
+ const fromPointer = (e: React.PointerEvent, final?: boolean) => {
91
+ const r = area.current!.getBoundingClientRect();
92
+ write({ h: hsv.h, s: clamp(((e.clientX - r.left) / r.width) * 100, 0, 100), v: clamp(100 - ((e.clientY - r.top) / r.height) * 100, 0, 100) }, final);
93
+ };
94
+ const areaKey = (e: React.KeyboardEvent) => {
95
+ const step = e.shiftKey ? 10 : 1;
96
+ const d = { ArrowLeft: [-step, 0], ArrowRight: [step, 0], ArrowUp: [0, step], ArrowDown: [0, -step] }[e.key];
97
+ if (!d) return;
98
+ e.preventDefault();
99
+ write({ h: hsv.h, s: clamp(hsv.s + d[0]!, 0, 100), v: clamp(hsv.v + d[1]!, 0, 100) }, true);
100
+ };
101
+
102
+ const alpha = opacityOf(from);
103
+ const pure = `hsl(${Math.round(hsv.h)} 100% 50%)`;
104
+ const now = hexOf(rgbOf(hsv));
105
+ const [hexDraft, setHexDraft] = useState<string | null>(null);
106
+ const commitHex = (raw: string) => {
107
+ setHexDraft(null);
108
+ const t = raw.trim().replace(/^#?/, "#");
109
+ if (!/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(t)) return;
110
+ const next = pickSwatch(from, t);
111
+ const c = parseColor(next);
112
+ if (c) setHsv((h) => hsvOf(c, h.h));
113
+ emit(next, true);
114
+ };
115
+ const canDrop = typeof window !== "undefined" && "EyeDropper" in window;
116
+ const dropper = async () => {
117
+ try {
118
+ const picked = await new (window as unknown as { EyeDropper: new () => { open: () => Promise<{ sRGBHex: string }> } }).EyeDropper().open();
119
+ const next = pickSwatch(from, picked.sRGBHex);
120
+ const c = parseColor(next);
121
+ if (c) setHsv((h) => hsvOf(c, h.h));
122
+ emit(next, true);
123
+ } catch { /* closed with Escape: nothing picked */ }
124
+ };
125
+ const theme = (choices ?? []).filter((c) => c.group !== "recent");
126
+ const recent = (choices ?? []).filter((c) => c.group === "recent");
127
+ const chips = (list: readonly ColorChoice[], name: string) => list.length ? (
128
+ <div className="gemboss-ei-cp-group">
129
+ <span className="gemboss-ei-cp-label">{name}</span>
130
+ <div className="gemboss-ei-cp-chips" role="group" aria-label={`${label}: ${name.toLowerCase()}`}>
131
+ {list.map((c) => {
132
+ const on = c.value === value.trim();
133
+ return <button key={c.value} type="button" className={`gemboss-ei-sw${on ? " on" : ""}`} title={c.label} aria-label={c.label} aria-pressed={on}
134
+ style={{ background: c.swatch }} onClick={() => { emitted.current = null; onChange(c.value); }} />;
135
+ })}
136
+ </div>
137
+ </div>
138
+ ) : null;
139
+
140
+ return (
141
+ <div className="gemboss-ei-cp" style={{ "--cp-hue": pure, "--cp-now": now } as React.CSSProperties}>
142
+ <div ref={area} className="gemboss-ei-cp-area" role="slider" tabIndex={0} data-autofocus=""
143
+ aria-label={`${label}: saturation and brightness`} aria-valuemin={0} aria-valuemax={100} aria-valuenow={Math.round(hsv.s)}
144
+ aria-valuetext={`Saturation ${Math.round(hsv.s)}%, brightness ${Math.round(hsv.v)}%`}
145
+ onPointerDown={(e) => { e.currentTarget.setPointerCapture(e.pointerId); e.currentTarget.focus(); dragStart(); fromPointer(e); }}
146
+ onPointerMove={(e) => { if (e.currentTarget.hasPointerCapture(e.pointerId)) fromPointer(e); }}
147
+ onPointerUp={(e) => { if (e.currentTarget.hasPointerCapture(e.pointerId)) { dragEnd(); fromPointer(e, true); } }}
148
+ onPointerCancel={dragEnd}
149
+ onKeyDown={areaKey}>
150
+ <span className="gemboss-ei-cp-thumb" style={{ left: `${hsv.s}%`, top: `${100 - hsv.v}%` }} />
151
+ </div>
152
+ <input type="range" className="gemboss-ei-cp-hue" min={0} max={359} step={1} value={Math.round(hsv.h)} aria-label={`${label} hue`}
153
+ onPointerDown={dragStart} onChange={(e) => { moved.current = true; write({ ...hsv, h: Number(e.target.value) }); }}
154
+ onPointerUp={() => { dragEnd(); if (moved.current) emit(pickSwatch(from, now), true); }} onPointerCancel={dragEnd} />
155
+ <input type="range" className="gemboss-ei-cp-alpha" min={0} max={100} step={1} value={alphaHeld ?? alpha ?? 100} aria-label={`${label} opacity`}
156
+ disabled={alpha === null} onPointerDown={dragStart}
157
+ onChange={(e) => { const n = Number(e.target.value); moved.current = true; if (dragging.current) setAlphaHeld(n); emit(withOpacity(from, n)); }}
158
+ onPointerUp={() => { dragEnd(); const n = alphaHeld; setAlphaHeld(null); if (moved.current && n !== null) emit(withOpacity(from, n), true); }}
159
+ onPointerCancel={() => { dragEnd(); setAlphaHeld(null); }} />
160
+ <div className="gemboss-ei-cp-row">
161
+ <span className="gemboss-ei-cp-now" aria-hidden />
162
+ <input className="gemboss-field gemboss-ei-cp-hex" aria-label={`${label} hex`} spellCheck={false} autoComplete="off"
163
+ value={hexDraft ?? (parsed ? now.toUpperCase() : "")} placeholder="#FFFFFF"
164
+ // Only what was typed is written: a blur with nothing typed since (the popover handing the focus back) writes nothing.
165
+ onChange={(e) => setHexDraft(e.target.value)} onBlur={() => { if (hexDraft !== null) commitHex(hexDraft); }}
166
+ onKeyDown={(e) => { if (e.key === "Enter" && !e.nativeEvent.isComposing && hexDraft !== null) { e.preventDefault(); commitHex(hexDraft); } }} />
167
+ <span className="gemboss-ei-cp-pct" aria-hidden>{alpha === null ? "" : `${alpha}%`}</span>
168
+ {canDrop ? (
169
+ <button type="button" className="gemboss-ei-cp-drop" aria-label="Pick a color from the screen" title="Pick a color from the screen" onClick={dropper}>
170
+ <Icon name="eyedropper" size={16} />
171
+ </button>
172
+ ) : null}
173
+ </div>
174
+ {chips(theme, "Theme")}
175
+ {chips(recent, "Recent")}
176
+ {allowNone ? (
177
+ <button type="button" className="gemboss-ei-cp-none" aria-pressed={!value.trim()} onClick={() => { emitted.current = null; onChange(""); }}>
178
+ <span className="gemboss-ei-cp-none-sw" aria-hidden />None
179
+ </button>
180
+ ) : null}
181
+ </div>
182
+ );
183
+ }