1052 lines
36 KiB
Plaintext
1052 lines
36 KiB
Plaintext
component StrongPassword {
|
|
outputs {
|
|
input(payload: { value: string; score: number; maximumScore: number; percent: number; level: string })
|
|
change(payload: { value: string; score: number; maximumScore: number; percent: number; level: string })
|
|
strength(payload: { value: string; score: number; maximumScore: number; percent: number; level: string })
|
|
}
|
|
|
|
props {
|
|
size: string = "default"
|
|
color: string = "primary"
|
|
label: string = "Password"
|
|
name: string = "password"
|
|
value: string = ""
|
|
placeholder: string = "Create a strong password"
|
|
autocomplete: string = "new-password"
|
|
minLength: number = 8
|
|
specialCharactersSet: string = "!@#$%^&*()_+-=[]{}|;:,.<>?"
|
|
requireLowercase: boolean = true
|
|
requireUppercase: boolean = true
|
|
requireNumber: boolean = true
|
|
requireSpecialCharacter: boolean = true
|
|
showRequirements: boolean = true
|
|
presentation: string = "inline"
|
|
hintText: string = "Use a unique password you do not use elsewhere."
|
|
emptyLabel: string = "Enter a password"
|
|
weakLabel: string = "Weak"
|
|
fairLabel: string = "Fair"
|
|
goodLabel: string = "Good"
|
|
strongLabel: string = "Strong"
|
|
disabled: boolean = false
|
|
readonly: boolean = false
|
|
required: boolean = false
|
|
invalid: boolean = false
|
|
validationMessage: string = ""
|
|
showLabel: string = "Show password"
|
|
hideLabel: string = "Hide password"
|
|
class: string = ""
|
|
}
|
|
|
|
state password = value
|
|
state detailsOpen: boolean = false
|
|
state revealed: boolean = false
|
|
|
|
functions {
|
|
shared function hasMinimumLength() {
|
|
return password.length >= Number(minLength)
|
|
}
|
|
|
|
shared function hasLowercase() {
|
|
return password !== password.toUpperCase()
|
|
}
|
|
|
|
shared function hasUppercase() {
|
|
return password !== password.toLowerCase()
|
|
}
|
|
|
|
shared function hasNumber() {
|
|
return containsCharacterAt("0123456789", 0)
|
|
}
|
|
|
|
shared function hasSpecialCharacter() {
|
|
return containsCharacterAt(specialCharactersSet, 0)
|
|
}
|
|
|
|
shared function containsCharacterAt(characters, index) {
|
|
if (index >= characters.length) {
|
|
return false
|
|
}
|
|
if (password.includes(characters[index])) {
|
|
return true
|
|
}
|
|
return containsCharacterAt(characters, index + 1)
|
|
}
|
|
|
|
shared function score() {
|
|
return (hasMinimumLength() ? 1 : 0) + (requireLowercase && hasLowercase() ? 1 : 0) + (requireUppercase && hasUppercase() ? 1 : 0) + (requireNumber && hasNumber() ? 1 : 0) + (requireSpecialCharacter && hasSpecialCharacter() ? 1 : 0)
|
|
}
|
|
|
|
shared function maximumScore() {
|
|
return 1 + (requireLowercase ? 1 : 0) + (requireUppercase ? 1 : 0) + (requireNumber ? 1 : 0) + (requireSpecialCharacter ? 1 : 0)
|
|
}
|
|
|
|
shared function strengthPercent() {
|
|
return Math.round(score() / maximumScore() * 100)
|
|
}
|
|
|
|
shared function strengthLevel() {
|
|
if (!password) {
|
|
return "empty"
|
|
}
|
|
if (strengthPercent() <= 25) {
|
|
return "weak"
|
|
}
|
|
if (strengthPercent() <= 50) {
|
|
return "fair"
|
|
}
|
|
if (strengthPercent() < 100) {
|
|
return "good"
|
|
}
|
|
return "strong"
|
|
}
|
|
|
|
shared function strengthLabel() {
|
|
if (strengthLevel() === "weak") {
|
|
return weakLabel
|
|
}
|
|
if (strengthLevel() === "fair") {
|
|
return fairLabel
|
|
}
|
|
if (strengthLevel() === "good") {
|
|
return goodLabel
|
|
}
|
|
if (strengthLevel() === "strong") {
|
|
return strongLabel
|
|
}
|
|
return emptyLabel
|
|
}
|
|
|
|
shared function toggleVisibility() {
|
|
if (!disabled && !readonly) {
|
|
revealed = !revealed
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
view {
|
|
<div
|
|
class="wrn-component wrn-component--color-{color} wrn-component--size-{size} wrn-next--strong-password wrn-next--strong-password-{presentation} {invalid ? 'wrn-next--invalid' : ''} {disabled ? 'wrn-next--disabled' : ''} {class}"
|
|
data-wrn-strong-password
|
|
data-strength="{password ? strengthLevel() : 'empty'}"
|
|
data-score="{password ? score() : 0}"
|
|
>
|
|
<label for="{name}-strong-password">{label}</label>
|
|
<div class="wrn-next__strong-password-anchor">
|
|
<span class="wrn-next__strong-password-leading-icon" aria-hidden="true"></span>
|
|
<input
|
|
{...attrs}
|
|
id="{name}-strong-password"
|
|
type="{revealed ? 'text' : 'password'}"
|
|
name="{name}"
|
|
value="{password}"
|
|
placeholder="{placeholder}"
|
|
autocomplete="{autocomplete}"
|
|
minlength="{minLength}"
|
|
disabled="{disabled}"
|
|
readonly="{readonly}"
|
|
required="{required}"
|
|
aria-invalid="{invalid ? 'true' : 'false'}"
|
|
aria-describedby="{validationMessage ? name + '-validation' : hintText ? name + '-hint' : ''}"
|
|
@focus="detailsOpen = true"
|
|
@blur="detailsOpen = false"
|
|
@input="password = event.target.value; output.input({ value: password, score: score(), maximumScore: maximumScore(), percent: strengthPercent(), level: strengthLevel() }); output.strength({ value: password, score: score(), maximumScore: maximumScore(), percent: strengthPercent(), level: strengthLevel() })"
|
|
@change="output.change({ value: password, score: score(), maximumScore: maximumScore(), percent: strengthPercent(), level: strengthLevel() })"
|
|
/>
|
|
<button
|
|
type="button"
|
|
class="wrn-next__strong-password-toggle"
|
|
aria-label="{revealed ? hideLabel : showLabel}"
|
|
title="{revealed ? hideLabel : showLabel}"
|
|
aria-pressed="{revealed ? 'true' : 'false'}"
|
|
disabled="{disabled || readonly}"
|
|
@click="toggleVisibility()"
|
|
><span aria-hidden="true"></span></button>
|
|
|
|
{#if presentation === "popover"}
|
|
<div
|
|
class="wrn-next__strong-password-popover"
|
|
data-open="{detailsOpen ? 'true' : 'false'}"
|
|
role="status"
|
|
>
|
|
<div class="wrn-next__strong-password-popover-arrow" aria-hidden="true"></div>
|
|
<div class="wrn-next__strong-password-details">
|
|
<div class="wrn-next__strong-password-summary">
|
|
<span>Password strength</span>
|
|
<strong>{password ? strengthLabel() : emptyLabel}</strong>
|
|
</div>
|
|
<div
|
|
class="wrn-next__strong-password-meter"
|
|
role="progressbar"
|
|
aria-label="Password strength"
|
|
aria-valuemin="0"
|
|
aria-valuemax="100"
|
|
aria-valuenow="{password ? strengthPercent() : 0}"
|
|
>
|
|
<span style="width: {password ? strengthPercent() : 0}%"></span>
|
|
</div>
|
|
{#if showRequirements}
|
|
<ul class="wrn-next__strong-password-requirements">
|
|
<li data-met="{password && hasMinimumLength() ? 'true' : 'false'}">
|
|
<span aria-hidden="true"></span>At least {minLength} characters
|
|
</li>
|
|
{#if requireLowercase}<li data-met="{password && hasLowercase() ? 'true' : 'false'}"><span aria-hidden="true"></span>One lowercase letter</li>{/if}
|
|
{#if requireUppercase}<li data-met="{password && hasUppercase() ? 'true' : 'false'}"><span aria-hidden="true"></span>One uppercase letter</li>{/if}
|
|
{#if requireNumber}<li data-met="{password && hasNumber() ? 'true' : 'false'}"><span aria-hidden="true"></span>One number</li>{/if}
|
|
{#if requireSpecialCharacter}<li class="wrn-next__strong-password-special" data-met="{password && hasSpecialCharacter() ? 'true' : 'false'}"><span aria-hidden="true"></span>One special character: {specialCharactersSet}</li>{/if}
|
|
</ul>
|
|
{/if}
|
|
{#if hintText}<small id="{name}-hint">{hintText}</small>{/if}
|
|
</div>
|
|
</div>
|
|
{/if}
|
|
</div>
|
|
|
|
{#if presentation !== "popover"}
|
|
<div class="wrn-next__strong-password-details">
|
|
<div class="wrn-next__strong-password-summary">
|
|
<span>Password strength</span>
|
|
<strong>{password ? strengthLabel() : emptyLabel}</strong>
|
|
</div>
|
|
<div
|
|
class="wrn-next__strong-password-meter"
|
|
role="progressbar"
|
|
aria-label="Password strength"
|
|
aria-valuemin="0"
|
|
aria-valuemax="100"
|
|
aria-valuenow="{password ? strengthPercent() : 0}"
|
|
>
|
|
<span style="width: {password ? strengthPercent() : 0}%"></span>
|
|
</div>
|
|
{#if showRequirements}
|
|
<ul class="wrn-next__strong-password-requirements">
|
|
<li data-met="{password && hasMinimumLength() ? 'true' : 'false'}"><span aria-hidden="true"></span>At least {minLength} characters</li>
|
|
{#if requireLowercase}<li data-met="{password && hasLowercase() ? 'true' : 'false'}"><span aria-hidden="true"></span>One lowercase letter</li>{/if}
|
|
{#if requireUppercase}<li data-met="{password && hasUppercase() ? 'true' : 'false'}"><span aria-hidden="true"></span>One uppercase letter</li>{/if}
|
|
{#if requireNumber}<li data-met="{password && hasNumber() ? 'true' : 'false'}"><span aria-hidden="true"></span>One number</li>{/if}
|
|
{#if requireSpecialCharacter}<li class="wrn-next__strong-password-special" data-met="{password && hasSpecialCharacter() ? 'true' : 'false'}"><span aria-hidden="true"></span>One special character: {specialCharactersSet}</li>{/if}
|
|
</ul>
|
|
{/if}
|
|
{#if hintText}<small id="{name}-hint">{hintText}</small>{/if}
|
|
</div>
|
|
{/if}
|
|
|
|
<small id="{name}-validation" class="wrn-next__validation" data-error="{name}">{validationMessage}</small>
|
|
</div>
|
|
}
|
|
|
|
style {
|
|
.wrn-next--strong-password {
|
|
position: relative;
|
|
display: grid;
|
|
width: 100%;
|
|
gap: 0.6rem;
|
|
color: var(--wrn-color-text);
|
|
}
|
|
|
|
.wrn-next--strong-password > label {
|
|
font-size: 0.82em;
|
|
font-weight: 700;
|
|
}
|
|
|
|
.wrn-next__strong-password-anchor {
|
|
position: relative;
|
|
}
|
|
|
|
.wrn-next--strong-password input {
|
|
width: 100%;
|
|
min-height: 3rem;
|
|
padding: 0.75rem 3rem 0.75rem 2.75rem;
|
|
border: 1px solid var(--wrn-color-border);
|
|
border-radius: var(--wrn-radius-sm);
|
|
outline: 0;
|
|
color: var(--wrn-color-text);
|
|
background: var(--wrn-color-surface);
|
|
font: inherit;
|
|
font-size: 0.875rem;
|
|
transition:
|
|
border-color 160ms ease,
|
|
box-shadow 160ms ease;
|
|
}
|
|
|
|
.wrn-next__strong-password-leading-icon,
|
|
.wrn-next__strong-password-toggle {
|
|
position: absolute;
|
|
top: 50%;
|
|
z-index: 2;
|
|
transform: translateY(-50%);
|
|
}
|
|
.wrn-next__strong-password-leading-icon {
|
|
left: 0.9rem;
|
|
width: 1rem;
|
|
height: 1rem;
|
|
color: var(--wrn-color-muted);
|
|
background: currentColor;
|
|
pointer-events: none;
|
|
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='11' x='3' y='11' rx='2' ry='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
|
|
}
|
|
.wrn-next__strong-password-toggle {
|
|
right: 0.45rem;
|
|
display: grid;
|
|
width: 2rem;
|
|
height: 2rem;
|
|
padding: 0;
|
|
place-items: center;
|
|
border: 0;
|
|
border-radius: calc(var(--wrn-radius-sm) * 0.72);
|
|
color: var(--wrn-color-muted);
|
|
background: transparent;
|
|
cursor: pointer;
|
|
}
|
|
.wrn-next__strong-password-toggle:hover,
|
|
.wrn-next__strong-password-toggle:focus-visible {
|
|
color: var(--wrn-component-color);
|
|
background: color-mix(in srgb, var(--wrn-component-color) 10%, transparent);
|
|
outline: 0;
|
|
}
|
|
.wrn-next__strong-password-toggle > span {
|
|
width: 1.05rem;
|
|
height: 1.05rem;
|
|
background: currentColor;
|
|
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.06 12.35a1 1 0 0 1 0-.7C3.7 7.6 7.64 5 12 5c4.36 0 8.3 2.6 9.94 6.65a1 1 0 0 1 0 .7C20.3 16.4 16.36 19 12 19c-4.36 0-8.3-2.6-9.94-6.65Z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
|
|
}
|
|
.wrn-next__strong-password-toggle[aria-pressed="true"]::after {
|
|
position: absolute;
|
|
width: 1.25rem;
|
|
height: 0.12rem;
|
|
border-radius: 999px;
|
|
background: currentColor;
|
|
content: "";
|
|
transform: rotate(45deg);
|
|
box-shadow: 0 0 0 1px var(--wrn-color-surface);
|
|
}
|
|
|
|
.wrn-next--strong-password input:focus-visible {
|
|
border-color: var(--wrn-component-color);
|
|
box-shadow: 0 0 0 3px color-mix(in srgb, var(--wrn-component-color) 16%, transparent);
|
|
}
|
|
|
|
.wrn-next__strong-password-details {
|
|
display: grid;
|
|
gap: 0.65rem;
|
|
}
|
|
|
|
.wrn-next__strong-password-summary {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: 1rem;
|
|
color: var(--wrn-color-muted);
|
|
font-size: 0.75em;
|
|
}
|
|
|
|
.wrn-next__strong-password-summary strong {
|
|
color: var(--wrn-color-text);
|
|
}
|
|
|
|
.wrn-next__strong-password-meter {
|
|
width: 100%;
|
|
height: 0.42rem;
|
|
overflow: hidden;
|
|
border-radius: 999px;
|
|
background: color-mix(in srgb, var(--wrn-color-border) 72%, transparent);
|
|
}
|
|
|
|
.wrn-next__strong-password-meter > span {
|
|
display: block;
|
|
width: 0;
|
|
height: 100%;
|
|
border-radius: inherit;
|
|
background: var(--wrn-color-danger);
|
|
transition:
|
|
width 180ms ease,
|
|
background-color 180ms ease;
|
|
}
|
|
|
|
.wrn-next--strong-password[data-strength="fair"] .wrn-next__strong-password-meter > span {
|
|
background: var(--wrn-color-warning);
|
|
}
|
|
|
|
.wrn-next--strong-password[data-strength="good"] .wrn-next__strong-password-meter > span {
|
|
background: var(--wrn-component-color);
|
|
}
|
|
|
|
.wrn-next--strong-password[data-strength="strong"] .wrn-next__strong-password-meter > span {
|
|
background: var(--wrn-color-success);
|
|
}
|
|
|
|
.wrn-next__strong-password-requirements {
|
|
display: grid;
|
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
gap: 0.45rem 1rem;
|
|
margin: 0;
|
|
padding: 0;
|
|
list-style: none;
|
|
}
|
|
|
|
.wrn-next__strong-password-requirements li {
|
|
display: flex;
|
|
min-width: 0;
|
|
align-items: flex-start;
|
|
gap: 0.45rem;
|
|
color: var(--wrn-color-muted);
|
|
font-size: 0.72em;
|
|
line-height: 1.45;
|
|
}
|
|
|
|
.wrn-next__strong-password-requirements .wrn-next__strong-password-special {
|
|
grid-column: 1 / -1;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.wrn-next__strong-password-special [data-text="specialCharactersSet"] {
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.wrn-next__strong-password-requirements li > span[aria-hidden="true"] {
|
|
position: relative;
|
|
width: 0.9rem;
|
|
height: 0.9rem;
|
|
flex: 0 0 auto;
|
|
margin-top: 0.08rem;
|
|
border: 1px solid currentColor;
|
|
border-radius: 50%;
|
|
}
|
|
|
|
.wrn-next__strong-password-requirements li > span[aria-hidden="true"]::after {
|
|
position: absolute;
|
|
top: 0.12rem;
|
|
left: 0.29rem;
|
|
width: 0.22rem;
|
|
height: 0.42rem;
|
|
border: solid var(--wrn-color-surface);
|
|
border-width: 0 0.1rem 0.1rem 0;
|
|
content: "";
|
|
opacity: 0;
|
|
transform: rotate(45deg);
|
|
}
|
|
|
|
.wrn-next__strong-password-requirements li[data-met="true"] {
|
|
color: var(--wrn-color-success);
|
|
}
|
|
|
|
.wrn-next__strong-password-requirements li[data-met="true"] > span[aria-hidden="true"] {
|
|
border-color: var(--wrn-color-success);
|
|
background: var(--wrn-color-success);
|
|
}
|
|
|
|
.wrn-next__strong-password-requirements li[data-met="true"] > span[aria-hidden="true"]::after {
|
|
opacity: 1;
|
|
}
|
|
|
|
.wrn-next__strong-password-details > small {
|
|
color: var(--wrn-color-muted);
|
|
font-size: 0.7em;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.wrn-next__strong-password-popover {
|
|
position: absolute;
|
|
top: calc(100% + 0.7rem);
|
|
left: 0;
|
|
z-index: 30;
|
|
width: min(28rem, calc(100vw - 2rem));
|
|
padding: 1rem;
|
|
border: 1px solid var(--wrn-color-border);
|
|
border-radius: var(--wrn-radius);
|
|
opacity: 0;
|
|
visibility: hidden;
|
|
background: var(--wrn-color-surface);
|
|
box-shadow: var(--wrn-shadow-2);
|
|
transform: translateY(-0.35rem);
|
|
transition:
|
|
opacity 140ms ease,
|
|
transform 140ms ease,
|
|
visibility 140ms ease;
|
|
}
|
|
|
|
.wrn-next__strong-password-popover[data-open="true"] {
|
|
opacity: 1;
|
|
visibility: visible;
|
|
transform: translateY(0);
|
|
}
|
|
|
|
.wrn-next__strong-password-popover-arrow {
|
|
position: absolute;
|
|
top: -0.38rem;
|
|
left: 1.25rem;
|
|
width: 0.7rem;
|
|
height: 0.7rem;
|
|
border-top: 1px solid var(--wrn-color-border);
|
|
border-left: 1px solid var(--wrn-color-border);
|
|
background: var(--wrn-color-surface);
|
|
transform: rotate(45deg);
|
|
}
|
|
|
|
@media (max-width: 560px) {
|
|
.wrn-next__strong-password-requirements {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
}
|
|
|
|
/* Shared component foundation. */
|
|
|
|
.wrn-component {
|
|
--wrn-component-color: var(--wrn-color-primary);
|
|
--wrn-component-scale: 1;
|
|
margin: 0;
|
|
color: var(--wrn-color-text);
|
|
font-family: var(--wrn-font-sans, inherit);
|
|
}
|
|
|
|
.wrn-component--color-primary {
|
|
--wrn-component-color: var(--wrn-color-primary);
|
|
}
|
|
|
|
.wrn-component--color-secondary {
|
|
--wrn-component-color: var(--wrn-color-secondary);
|
|
}
|
|
|
|
.wrn-component--color-success {
|
|
--wrn-component-color: var(--wrn-color-success);
|
|
}
|
|
|
|
.wrn-component--color-warning {
|
|
--wrn-component-color: var(--wrn-color-warning);
|
|
}
|
|
|
|
.wrn-component--color-danger {
|
|
--wrn-component-color: var(--wrn-color-danger);
|
|
}
|
|
|
|
.wrn-component--color-info {
|
|
--wrn-component-color: var(--wrn-color-info);
|
|
}
|
|
|
|
.wrn-component--size-xs {
|
|
--wrn-component-scale: 0.78;
|
|
}
|
|
|
|
.wrn-component--size-sm {
|
|
--wrn-component-scale: 0.88;
|
|
}
|
|
|
|
.wrn-component--size-default,
|
|
.wrn-component--size-md {
|
|
--wrn-component-scale: 1;
|
|
}
|
|
|
|
.wrn-component--size-lg {
|
|
--wrn-component-scale: 1.14;
|
|
}
|
|
|
|
.wrn-component--size-xl {
|
|
--wrn-component-scale: 1.28;
|
|
}
|
|
|
|
.wrn-component:not(.wrn-btn) {
|
|
font-size: calc(1em * var(--wrn-component-scale));
|
|
}
|
|
|
|
.wrn-component :is(a, button, input, select, textarea):focus-visible {
|
|
outline-color: var(--wrn-component-color);
|
|
}
|
|
|
|
.wrn-component p {
|
|
margin: 0;
|
|
color: var(--wrn-color-muted);
|
|
line-height: 1.6;
|
|
}
|
|
|
|
/* Shared field foundation. */
|
|
|
|
/* Validation states set by the browser validation runtime. */
|
|
.wrn-invalid {
|
|
border-color: var(--wrn-color-danger) !important;
|
|
}
|
|
|
|
.wrn-field-error {
|
|
display: block;
|
|
min-height: 1em;
|
|
margin-top: 0.25rem;
|
|
color: var(--wrn-color-danger);
|
|
font-size: 0.8rem;
|
|
}
|
|
|
|
.wrn-next--choice {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.55rem;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.wrn-next--choice input {
|
|
width: 1.1rem;
|
|
height: 1.1rem;
|
|
accent-color: var(--wrn-color-primary);
|
|
}
|
|
|
|
.wrn-next--field {
|
|
display: grid;
|
|
width: min(100%, 28rem);
|
|
gap: 0.4rem;
|
|
font-size: 0.78rem;
|
|
font-weight: 700;
|
|
}
|
|
.wrn-next--field :where(input, textarea, select) {
|
|
width: 100%;
|
|
min-height: 2.65rem;
|
|
padding: 0.6rem 0.7rem;
|
|
border: 1px solid var(--wrn-color-border);
|
|
border-radius: 0.6rem;
|
|
outline: 0;
|
|
color: var(--wrn-color-text);
|
|
background: var(--wrn-color-bg);
|
|
font: inherit;
|
|
font-weight: 500;
|
|
}
|
|
.wrn-auth-form form > .wrn-next--field,
|
|
.wrn-auth-form form > .wrn-field {
|
|
width: 100%;
|
|
max-width: none;
|
|
}
|
|
.wrn-auth-form__submit > .wrn-btn {
|
|
width: 100%;
|
|
min-height: 3rem;
|
|
border-radius: 0.75rem;
|
|
box-shadow: 0 0.8rem 1.8rem color-mix(in srgb, var(--wrn-btn-color) 20%, transparent);
|
|
}
|
|
.wrn-next--field :where(input, textarea, select):focus-visible {
|
|
border-color: var(--wrn-color-primary);
|
|
box-shadow: 0 0 0 3px color-mix(in srgb, var(--wrn-color-primary) 16%, transparent);
|
|
}
|
|
.wrn-next--field textarea {
|
|
resize: vertical;
|
|
}
|
|
.wrn-next--field,
|
|
.wrn-next--choice-field {
|
|
--wrn-field-color: var(--wrn-component-color, var(--wrn-color-primary));
|
|
width: min(100%, 34rem);
|
|
min-width: 0;
|
|
color: var(--wrn-color-text);
|
|
font-size: 0.8125rem;
|
|
font-weight: 500;
|
|
}
|
|
.wrn-next--field.wrn-next--size-sm,
|
|
.wrn-next--choice-field.wrn-next--size-sm {
|
|
font-size: 0.8125rem;
|
|
}
|
|
.wrn-next--field.wrn-next--size-lg,
|
|
.wrn-next--choice-field.wrn-next--size-lg {
|
|
font-size: 1rem;
|
|
}
|
|
.wrn-next__field-heading {
|
|
display: flex;
|
|
min-width: 0;
|
|
align-items: baseline;
|
|
justify-content: space-between;
|
|
gap: 1rem;
|
|
}
|
|
.wrn-next__field-heading label {
|
|
color: var(--wrn-color-text);
|
|
font-weight: 600;
|
|
}
|
|
.wrn-next__field-hint,
|
|
.wrn-next__field-help {
|
|
color: var(--wrn-color-muted);
|
|
font-size: 0.82em;
|
|
font-weight: 500;
|
|
}
|
|
.wrn-next__field-control {
|
|
position: relative;
|
|
min-width: 0;
|
|
}
|
|
.wrn-next__field-control > :is(input, textarea, select) {
|
|
padding-inline: 0.85rem;
|
|
border-color: var(--wrn-color-border);
|
|
border-radius: var(--wrn-radius-sm);
|
|
background: var(--wrn-color-surface);
|
|
font-size: 0.8125rem;
|
|
}
|
|
.wrn-next__field-control[data-icon-position="start"] > :is(input, textarea, select) {
|
|
padding-inline-start: 2.5rem;
|
|
}
|
|
.wrn-next__field-control[data-icon-position="end"] > :is(input, textarea, select) {
|
|
padding-inline-end: 2.5rem;
|
|
}
|
|
.wrn-next__field-icon {
|
|
position: absolute;
|
|
z-index: 1;
|
|
top: 50%;
|
|
left: 0.85rem;
|
|
color: var(--wrn-color-muted);
|
|
pointer-events: none;
|
|
transform: translateY(-50%);
|
|
}
|
|
.wrn-next__field-control[data-icon-position="end"] > .wrn-next__field-icon {
|
|
right: 0.85rem;
|
|
left: auto;
|
|
}
|
|
.wrn-next--field[data-variant="outlined"]
|
|
.wrn-next__field-control
|
|
> :is(input, textarea, select) {
|
|
border-width: 2px;
|
|
}
|
|
.wrn-next--field[data-variant="underline"]
|
|
.wrn-next__field-control
|
|
> :is(input, textarea, select) {
|
|
padding-inline: 0;
|
|
border-width: 0 0 1px;
|
|
border-radius: 0;
|
|
background: transparent;
|
|
box-shadow: none;
|
|
}
|
|
.wrn-next--field[data-variant="pill"] .wrn-next__field-control > :is(input, select) {
|
|
border-radius: 999px;
|
|
padding-inline: 1.15rem;
|
|
}
|
|
.wrn-next--field[data-variant="ghost"] .wrn-next__field-control > :is(input, textarea, select) {
|
|
border-color: transparent;
|
|
background: color-mix(in srgb, var(--wrn-field-color) 8%, var(--wrn-color-surface));
|
|
}
|
|
.wrn-next__field-floating-label {
|
|
position: absolute;
|
|
top: 50%;
|
|
left: 0.85rem;
|
|
color: var(--wrn-color-muted);
|
|
pointer-events: none;
|
|
transform: translateY(-50%);
|
|
transition: 150ms ease;
|
|
}
|
|
.wrn-next--textarea .wrn-next__field-floating-label {
|
|
top: 1.35rem;
|
|
}
|
|
.wrn-next--field[data-floating="true"] .wrn-next__field-control > :is(input, textarea, select) {
|
|
padding-top: 1.2rem;
|
|
padding-bottom: 0.3rem;
|
|
}
|
|
.wrn-next--field[data-floating="true"] .wrn-next__field-heading > label {
|
|
position: absolute !important;
|
|
width: 1px !important;
|
|
height: 1px !important;
|
|
overflow: hidden !important;
|
|
margin: -1px !important;
|
|
clip: rect(0, 0, 0, 0) !important;
|
|
white-space: nowrap !important;
|
|
}
|
|
.wrn-next--field[data-floating="true"]
|
|
.wrn-next__field-heading:not(:has(.wrn-next__field-hint)) {
|
|
display: none;
|
|
}
|
|
.wrn-next--field[data-floating="true"]
|
|
.wrn-next__field-control
|
|
> :is(input, textarea):is(:focus, :not(:placeholder-shown))
|
|
+ .wrn-next__field-floating-label {
|
|
top: 0.42rem;
|
|
font-size: 0.7em;
|
|
transform: none;
|
|
}
|
|
.wrn-next__field-error {
|
|
min-height: 1em;
|
|
color: var(--wrn-color-danger);
|
|
font-size: 0.82em;
|
|
font-weight: 600;
|
|
}
|
|
.wrn-next__field-error:empty {
|
|
display: none;
|
|
}
|
|
.wrn-next--field[data-invalid="true"] :is(input, textarea, select),
|
|
.wrn-next--choice-field[data-invalid="true"] input {
|
|
border-color: var(--wrn-color-danger);
|
|
}
|
|
.wrn-next--field :is(input, textarea, select):disabled,
|
|
.wrn-next--choice-field input:disabled {
|
|
cursor: not-allowed;
|
|
opacity: 0.58;
|
|
}
|
|
.wrn-next--field :is(input, textarea, select):read-only {
|
|
background: var(--wrn-color-surface-2);
|
|
}
|
|
.wrn-next--field[data-inline="true"],
|
|
.wrn-next--choice-field[data-inline="true"] {
|
|
display: grid;
|
|
width: 100%;
|
|
max-width: none;
|
|
grid-template-columns: minmax(7rem, max-content) minmax(12rem, 20rem) minmax(10rem, 1fr);
|
|
justify-content: center;
|
|
align-items: center;
|
|
gap: 0.75rem;
|
|
}
|
|
.wrn-next--field[data-inline="true"] .wrn-next__field-heading,
|
|
.wrn-next--choice-field[data-inline="true"] .wrn-next__field-heading {
|
|
min-height: 2.65rem;
|
|
align-items: center;
|
|
}
|
|
.wrn-next--field[data-inline="true"] .wrn-next__field-heading {
|
|
justify-content: flex-end;
|
|
}
|
|
.wrn-next--field[data-inline="true"] .wrn-next__field-help,
|
|
.wrn-next--choice-field[data-inline="true"] .wrn-next__field-help {
|
|
display: flex;
|
|
min-height: 2.65rem;
|
|
align-items: center;
|
|
}
|
|
.wrn-next--choice-field[data-inline="true"] {
|
|
grid-template-columns: minmax(12rem, 20rem) minmax(10rem, 1fr);
|
|
}
|
|
.wrn-next--choice-field[data-inline="true"] .wrn-next__field-heading:empty {
|
|
display: none;
|
|
}
|
|
.wrn-next--field[data-inline="true"] .wrn-next__field-error,
|
|
.wrn-next--choice-field[data-inline="true"] .wrn-next__field-error {
|
|
grid-column: 2 / -1;
|
|
}
|
|
.wrn-next__sr-only {
|
|
position: absolute !important;
|
|
width: 1px !important;
|
|
height: 1px !important;
|
|
overflow: hidden !important;
|
|
padding: 0 !important;
|
|
border: 0 !important;
|
|
margin: -1px !important;
|
|
clip: rect(0, 0, 0, 0) !important;
|
|
white-space: nowrap !important;
|
|
}
|
|
.wrn-next__choice-field {
|
|
display: grid;
|
|
width: 100%;
|
|
max-width: none;
|
|
gap: 0.4rem;
|
|
}
|
|
.wrn-next__choice {
|
|
display: flex;
|
|
min-width: 0;
|
|
align-items: center;
|
|
gap: 0.65rem;
|
|
color: var(--wrn-color-text);
|
|
width: 100%;
|
|
font-size: 0.75rem;
|
|
font-weight: 500;
|
|
}
|
|
.wrn-next__checkbox-content > .wrn-next__choice {
|
|
width: 100%;
|
|
min-width: 0;
|
|
align-items: flex-start;
|
|
}
|
|
.wrn-next__choice input {
|
|
flex: 0 0 auto;
|
|
margin: 0;
|
|
accent-color: var(--wrn-field-color);
|
|
}
|
|
.wrn-next__choice-copy {
|
|
display: grid;
|
|
min-width: 0;
|
|
gap: 0.15rem;
|
|
line-height: 1.35;
|
|
}
|
|
.wrn-next__choice-copy small {
|
|
color: var(--wrn-color-muted);
|
|
font-weight: 500;
|
|
}
|
|
.wrn-next__radio-group,
|
|
.wrn-next__checkbox-group {
|
|
display: grid;
|
|
min-width: 0;
|
|
gap: 0.65rem;
|
|
}
|
|
.wrn-next--radio-field[data-orientation="horizontal"] .wrn-next__radio-group,
|
|
.wrn-next--checkbox-field[data-orientation="horizontal"] .wrn-next__checkbox-group {
|
|
grid-template-columns: repeat(auto-fit, minmax(8rem, max-content));
|
|
align-items: stretch;
|
|
}
|
|
.wrn-next--radio-field[data-card="true"] .wrn-next__radio-group,
|
|
.wrn-next--checkbox-field[data-card="true"] .wrn-next__checkbox-group {
|
|
grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
|
|
}
|
|
.wrn-next--radio-field[data-card="true"] .wrn-next--radio,
|
|
.wrn-next--checkbox-field[data-card="true"] .wrn-next--checkbox {
|
|
min-height: 4.5rem;
|
|
padding: 0.85rem;
|
|
border: 1px solid var(--wrn-color-border);
|
|
border-radius: var(--wrn-radius-sm);
|
|
background: var(--wrn-color-surface);
|
|
}
|
|
.wrn-next--radio-field[data-card="true"] .wrn-next--radio:has(input:checked),
|
|
.wrn-next--checkbox-field[data-card="true"] .wrn-next--checkbox:has(input:checked) {
|
|
border-color: var(--wrn-field-color);
|
|
box-shadow: 0 0 0 1px var(--wrn-field-color);
|
|
}
|
|
.wrn-next--radio-field[data-list="true"] .wrn-next--radio,
|
|
.wrn-next--checkbox-field[data-list="true"] .wrn-next--checkbox {
|
|
padding-block: 0.75rem;
|
|
border-bottom: 1px solid var(--wrn-color-border);
|
|
}
|
|
.wrn-next--radio-field[data-right-aligned="true"] .wrn-next--radio,
|
|
.wrn-next--checkbox-field[data-right-aligned="true"] .wrn-next--checkbox {
|
|
justify-content: space-between;
|
|
}
|
|
.wrn-next--radio-field[data-right-aligned="true"] .wrn-next--radio input,
|
|
.wrn-next--checkbox-field[data-right-aligned="true"] .wrn-next--checkbox input {
|
|
order: 2;
|
|
}
|
|
.wrn-next--radio-field[data-right-aligned="true"] .wrn-next__choice-copy,
|
|
.wrn-next--checkbox-field[data-right-aligned="true"] .wrn-next__choice-copy {
|
|
order: 1;
|
|
}
|
|
.wrn-next__choice[data-variant="outlined"],
|
|
.wrn-next__choice[data-variant="floating"] {
|
|
padding: 0.65rem 0.8rem;
|
|
border: 1px solid var(--wrn-color-border);
|
|
border-radius: var(--wrn-radius-sm);
|
|
}
|
|
.wrn-next__choice[data-variant="pill"] {
|
|
padding: 0.65rem 1rem;
|
|
border-radius: 999px;
|
|
background: color-mix(in srgb, var(--wrn-field-color) 9%, var(--wrn-color-surface));
|
|
}
|
|
.wrn-next__choice[data-variant="ghost"] {
|
|
padding: 0.65rem 0.8rem;
|
|
border-radius: var(--wrn-radius-sm);
|
|
background: color-mix(in srgb, var(--wrn-field-color) 7%, transparent);
|
|
}
|
|
.wrn-next__choice[data-variant="underline"] {
|
|
padding-block: 0.5rem;
|
|
border-bottom: 1px solid var(--wrn-color-border);
|
|
}
|
|
.wrn-next--select .wrn-next__field-control {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
.wrn-next__color-control,
|
|
.wrn-next__range-control,
|
|
.wrn-next__input-group-control,
|
|
.wrn-next__file-control {
|
|
display: flex;
|
|
min-width: 0;
|
|
align-items: center;
|
|
gap: 0.65rem;
|
|
}
|
|
.wrn-next__picker-control,
|
|
.wrn-next--time-picker .wrn-next__field-control {
|
|
position: relative;
|
|
display: flex;
|
|
min-width: 0;
|
|
align-items: center;
|
|
}
|
|
.wrn-next__picker-control > button:first-of-type,
|
|
.wrn-next__time-trigger {
|
|
display: flex;
|
|
width: 100%;
|
|
min-height: 2.65rem;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: 0.75rem;
|
|
padding: 0.7rem 0.85rem;
|
|
border: 1px solid var(--wrn-color-border);
|
|
border-radius: var(--wrn-radius-sm);
|
|
background: var(--wrn-color-surface);
|
|
color: var(--wrn-color-text);
|
|
font: inherit;
|
|
text-align: left;
|
|
}
|
|
.wrn-next__calendar,
|
|
.wrn-next__time-panel {
|
|
z-index: 20;
|
|
display: grid;
|
|
width: min(100%, 22rem);
|
|
gap: 0.75rem;
|
|
padding: 0.85rem;
|
|
border: 1px solid var(--wrn-color-border);
|
|
border-radius: var(--wrn-radius-md);
|
|
background: var(--wrn-color-surface);
|
|
box-shadow: var(--wrn-shadow-3);
|
|
}
|
|
.wrn-next--date-picker[data-expanded="false"] .wrn-next__calendar,
|
|
.wrn-next--time-picker[data-expanded="false"] .wrn-next__time-panel {
|
|
display: none;
|
|
}
|
|
.wrn-next__calendar button,
|
|
.wrn-next__time-panel button {
|
|
min-height: 2.25rem;
|
|
border: 0;
|
|
border-radius: var(--wrn-radius-sm);
|
|
background: transparent;
|
|
color: inherit;
|
|
}
|
|
.wrn-next__calendar-weekdays,
|
|
.wrn-next__calendar-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(7, 1fr);
|
|
gap: 0.2rem;
|
|
text-align: center;
|
|
}
|
|
.wrn-next__calendar-weekdays {
|
|
color: var(--wrn-color-muted);
|
|
font-size: 0.75rem;
|
|
}
|
|
.wrn-next__calendar-grid button:hover,
|
|
.wrn-next__time-panel button:hover {
|
|
background: var(--wrn-color-surface-2);
|
|
}
|
|
.wrn-next__calendar-grid button[aria-pressed="true"],
|
|
.wrn-next__time-panel button[aria-pressed="true"] {
|
|
background: var(--wrn-field-color);
|
|
color: var(--wrn-color-primary-contrast, #fff);
|
|
}
|
|
.wrn-next__time-period {
|
|
display: flex;
|
|
gap: 0.35rem;
|
|
}
|
|
.wrn-next--file-upload-progress .wrn-next__row,
|
|
.wrn-next__upload-actions {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: 0.75rem;
|
|
}
|
|
.wrn-next--file-upload-progress .wrn-next__row > span {
|
|
display: grid;
|
|
min-width: 0;
|
|
}
|
|
.wrn-next--field[data-variant="underline"]
|
|
:is(.wrn-next__input-group-control, .wrn-next__file-control, .wrn-next__color-control) {
|
|
border-width: 0 0 1px;
|
|
border-radius: 0;
|
|
background: transparent;
|
|
}
|
|
.wrn-next--field[data-variant="outlined"]
|
|
:is(.wrn-next__input-group-control, .wrn-next__file-control) {
|
|
border-width: 2px;
|
|
}
|
|
.wrn-next--field[data-variant="pill"]
|
|
:is(.wrn-next__input-group-control, .wrn-next__file-control) {
|
|
border-radius: 999px;
|
|
}
|
|
.wrn-next--field[data-variant="ghost"]
|
|
:is(.wrn-next__input-group-control, .wrn-next__file-control, .wrn-next__color-control) {
|
|
border-color: transparent;
|
|
background: color-mix(in srgb, var(--wrn-field-color) 8%, var(--wrn-color-surface));
|
|
}
|
|
@media (max-width: 640px) {
|
|
.wrn-next--field[data-inline="true"],
|
|
.wrn-next--choice-field[data-inline="true"] {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.wrn-next--field[data-inline="true"] .wrn-next__field-error,
|
|
.wrn-next--choice-field[data-inline="true"] .wrn-next__field-error {
|
|
grid-column: auto;
|
|
}
|
|
}
|
|
.wrn-next--toggle-password:has(input.wrn-invalid) .wrn-next__password-control > input,
|
|
.wrn-next--toggle-password.wrn-next--invalid .wrn-next__password-control > input {
|
|
border-color: var(--wrn-color-danger);
|
|
box-shadow: 0 0 0 3px color-mix(in srgb, var(--wrn-color-danger) 14%, transparent);
|
|
}
|
|
.wrn-next--strong-password.wrn-next--invalid input,
|
|
.wrn-next--strong-password input.wrn-invalid {
|
|
border-color: var(--wrn-color-danger);
|
|
}
|
|
}
|
|
}
|