Files
WRNexusJS/packages/ui/components/RangeSlider.wrn
T

859 lines
40 KiB
Plaintext

component RangeSlider {
outputs {
input(payload: ({ value: number; name: string; sourceEvent: Event }) | ({ sourceEvent?: Event; value: string | number | boolean | null | object; [key: string]: string | number | boolean | null | object } | string | number | boolean | null | object[]))
change(payload: ({ value: number; name: string; sourceEvent: Event }) | ({ sourceEvent?: Event; value: string | number | boolean | null | object; [key: string]: string | number | boolean | null | object } | string | number | boolean | null | object[]))
focus(payload: { sourceEvent?: Event; [key: string]: string | number | boolean | null | object })
blur(payload: { sourceEvent?: Event; [key: string]: string | number | boolean | null | object })
}
props {
size: string = "default"
color: string = "primary"
id: string = ""
name: string = ""
label: string = "Range"
hiddenLabel: boolean = false
placeholder: string = ""
variant: string = "normal"
icon: string = ""
iconPosition: string = "start"
value: number = 50
min: number = 0
max: number = 100
step: number = 1
showValue: boolean = true
showBounds: boolean = true
showSteps: boolean = false
marks: unknown[] = []
helperText: string = ""
cornerHint: string = ""
error: string = ""
inline: boolean = false
readonly: boolean = false
disabled: boolean = false
required: boolean = false
class: string = ""
}
state currentValue = value
functions {
shared function snapValue(raw) {
var increment = Math.max(0.0001, Number(step))
var snapped = Number(min) + Math.round((Number(raw) - Number(min)) / increment) * increment
var bounded = Math.min(Number(max), Math.max(Number(min), snapped))
return Math.round(bounded * 1000000) / 1000000
}
shared function percent() { if (Number(max) === Number(min)) { return 0 } return (Number(currentValue) - Number(min)) / (Number(max) - Number(min)) * 100 }
client function setValue(nextValue, sourceEvent, commit, detail, root, slider, input, outputElement, progressValue) { if (sourceEvent.currentTarget.closest(".wrn-next--range-slider").dataset.readonly === "true" || sourceEvent.currentTarget.closest(".wrn-next--range-slider").dataset.disabled === "true") { return } currentValue = Number(nextValue); root = sourceEvent.currentTarget.closest(".wrn-next--range-slider"); if (root) { slider = root.querySelector("[role=slider]"); input = root.querySelector("input[name='" + name + "']"); outputElement = root.querySelector("output"); progressValue = (currentValue - Number(min)) / (Number(max) - Number(min)) * 100; if (slider) { slider.setAttribute("aria-valuenow", String(currentValue)); slider.style.setProperty("--wrn-range-progress", progressValue + "%") } if (input) { input.value = String(currentValue) } if (outputElement) { outputElement.textContent = String(currentValue) } } detail = { value: currentValue, min: min, max: max, step: step, name: name, sourceEvent: sourceEvent }; output.input(detail); if (commit) { output.change(detail) } }
client function valueFromPointer(sourceEvent, rect, ratio) { rect = sourceEvent.currentTarget.getBoundingClientRect(); ratio = Math.max(0, Math.min(1, (sourceEvent.clientX - rect.left) / rect.width)); return Number(min) + ratio * (Number(max) - Number(min)) }
client function beginSlide(sourceEvent, rect, ratio, rawValue) { if (sourceEvent.currentTarget.closest(".wrn-next--range-slider").dataset.readonly === "true" || sourceEvent.currentTarget.closest(".wrn-next--range-slider").dataset.disabled === "true") { return } sourceEvent.currentTarget.setPointerCapture(sourceEvent.pointerId); rect = sourceEvent.currentTarget.getBoundingClientRect(); ratio = Math.max(0, Math.min(1, (sourceEvent.clientX - rect.left) / rect.width)); rawValue = Number(min) + ratio * (Number(max) - Number(min)); currentValue = snapValue(rawValue); output.input({ value: currentValue, name: name, sourceEvent: sourceEvent }) }
client function moveSlide(sourceEvent, rect, ratio, rawValue) { if (!sourceEvent.currentTarget.hasPointerCapture(sourceEvent.pointerId)) { return } rect = sourceEvent.currentTarget.getBoundingClientRect(); ratio = Math.max(0, Math.min(1, (sourceEvent.clientX - rect.left) / rect.width)); rawValue = Number(min) + ratio * (Number(max) - Number(min)); currentValue = snapValue(rawValue); output.input({ value: currentValue, name: name, sourceEvent: sourceEvent }) }
client function endSlide(sourceEvent, rect, ratio, rawValue) { rect = sourceEvent.currentTarget.getBoundingClientRect(); ratio = Math.max(0, Math.min(1, (sourceEvent.clientX - rect.left) / rect.width)); rawValue = Number(min) + ratio * (Number(max) - Number(min)); currentValue = snapValue(rawValue); if (sourceEvent.currentTarget.hasPointerCapture(sourceEvent.pointerId)) { sourceEvent.currentTarget.releasePointerCapture(sourceEvent.pointerId) } output.change({ value: currentValue, name: name, sourceEvent: sourceEvent }) }
client function selectMark(sourceEvent, root, slider, input, outputElement, nextValue, progressValue, detail) { if (sourceEvent.currentTarget.closest(".wrn-next--range-slider").dataset.readonly === "true" || sourceEvent.currentTarget.closest(".wrn-next--range-slider").dataset.disabled === "true") { return } root = sourceEvent.currentTarget.closest(".wrn-next--range-slider"); slider = root.querySelector(".wrn-next__custom-slider"); input = root.querySelector(".wrn-next__range-value"); outputElement = root.querySelector("output"); nextValue = Number(sourceEvent.currentTarget.dataset.value); currentValue = nextValue; progressValue = (nextValue - Number(min)) / (Number(max) - Number(min)) * 100; slider.setAttribute("aria-valuenow", String(nextValue)); slider.style.setProperty("--wrn-range-progress", progressValue + "%"); input.setAttribute("value", String(nextValue)); outputElement.replaceChildren(String(nextValue)); detail = { value: nextValue, min: min, max: max, step: step, name: name, sourceEvent: sourceEvent }; output.input(detail); output.change(detail) }
client function handleKey(sourceEvent) {
if (readonly || disabled) { return }
var next = Number(currentValue)
if (sourceEvent.key === "ArrowRight" || sourceEvent.key === "ArrowUp") { next = next + Number(step) }
else if (sourceEvent.key === "ArrowLeft" || sourceEvent.key === "ArrowDown") { next = next - Number(step) }
else if (sourceEvent.key === "Home") { next = Number(min) }
else if (sourceEvent.key === "End") { next = Number(max) }
else { return }
sourceEvent.preventDefault()
currentValue = snapValue(next)
output.input({ value: currentValue, name: name, sourceEvent: sourceEvent })
output.change({ value: currentValue, name: name, sourceEvent: sourceEvent })
}
client function emitFocus(nameEvent, sourceEvent) { output[nameEvent]({ value: currentValue, name: name, sourceEvent: sourceEvent }) }
client function decreaseValue(sourceEvent) {
if (readonly || disabled) { return }
var next = Math.max(Number(min), Number(currentValue) - Number(step))
currentValue = Math.round(next * 1000000) / 1000000
output.input({ value: currentValue, name: name, sourceEvent: sourceEvent })
output.change({ value: currentValue, name: name, sourceEvent: sourceEvent })
}
client function increaseValue(sourceEvent) {
if (readonly || disabled) { return }
var next = Math.min(Number(max), Number(currentValue) + Number(step))
currentValue = Math.round(next * 1000000) / 1000000
output.input({ value: currentValue, name: name, sourceEvent: sourceEvent })
output.change({ value: currentValue, name: name, sourceEvent: sourceEvent })
}
}
view {
<div {...attrs} class="wrn-component wrn-component--color-{color} wrn-component--size-{size} wrn-next--field wrn-next--range-slider {class}" data-readonly="{readonly}" data-disabled="{disabled}" data-variant="{variant}" data-inline="{inline}" data-invalid="{error ? 'true' : 'false'}" data-wrn-owner="RangeSlider" data-wrn-part="root" data-wrn-component="RangeSlider" data-wrn-axis-size="{size}" data-wrn-axis-color="{color}" data-wrn-axis-variant="{variant}">
<div class="wrn-next__field-heading" data-wrn-owner="RangeSlider" data-wrn-part="heading" data-wrn-axis-size="{size}" data-wrn-axis-color="{color}" data-wrn-axis-variant="{variant}"><label class="{hiddenLabel ? 'wrn-next__sr-only' : ''}" for="{id || name}" data-wrn-owner="RangeSlider" data-wrn-part="srOnly" data-wrn-axis-size="{size}" data-wrn-axis-color="{color}" data-wrn-axis-variant="{variant}">{label}</label>{#if cornerHint}<span class="wrn-next__field-hint" data-wrn-owner="RangeSlider" data-wrn-part="hint" data-wrn-axis-size="{size}" data-wrn-axis-color="{color}" data-wrn-axis-variant="{variant}">{cornerHint}</span>{/if}</div>
<div class="wrn-next__range-control" data-variant="{variant}" data-icon-position="{iconPosition}" data-show-steps="{showSteps}" data-wrn-owner="RangeSlider" data-wrn-part="rangeControl" data-wrn-axis-size="{size}" data-wrn-axis-color="{color}" data-wrn-axis-variant="{variant}">
{#if icon}<span class="{icon}" aria-hidden="true"></span>{/if}
<button type="button" class="wrn-next__range-stepper" aria-label="Decrease {label}" disabled="{disabled || readonly}" @click="decreaseValue(event)" data-wrn-owner="RangeSlider" data-wrn-part="rangeStepper" data-wrn-axis-size="{size}" data-wrn-axis-color="{color}" data-wrn-axis-variant="{variant}"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" aria-hidden="true" data-wrn-owner="RangeSlider" data-wrn-part="vector" data-wrn-axis-size="{size}" data-wrn-axis-color="{color}" data-wrn-axis-variant="{variant}"><path d="M3.5 8h9"></path></svg></button>
<div class="wrn-next__range-track" data-wrn-owner="RangeSlider" data-wrn-part="rangeTrack" data-wrn-axis-size="{size}" data-wrn-axis-color="{color}" data-wrn-axis-variant="{variant}">
<input id="{id || name}" class="wrn-next__sr-only wrn-next__range-value" type="number" name="{name}" value="{currentValue}" min="{min}" max="{max}" step="{step}" required="{required}" readonly data-wrn-owner="RangeSlider" data-wrn-part="srOnly" data-wrn-axis-size="{size}" data-wrn-axis-color="{color}" data-wrn-axis-variant="{variant}"/>
<div class="wrn-next__custom-slider" role="slider" tabindex="{disabled ? '-1' : '0'}" aria-label="{hiddenLabel ? label : ''}" aria-valuemin="{min}" aria-valuemax="{max}" aria-valuenow="{currentValue}" aria-disabled="{disabled}" aria-readonly="{readonly}" aria-invalid="{error ? 'true' : 'false'}" style="--wrn-range-progress: {percent()}%" @pointerdown="beginSlide(event)" @pointermove="moveSlide(event)" @pointerup="endSlide(event)" @pointercancel="endSlide(event)" @keydown="handleKey(event)" @focus="emitFocus('focus', event)" @blur="emitFocus('blur', event)" data-wrn-owner="RangeSlider" data-wrn-part="customSlider" data-wrn-axis-size="{size}" data-wrn-axis-color="{color}" data-wrn-axis-variant="{variant}">
<span class="wrn-next__slider-fill" data-wrn-owner="RangeSlider" data-wrn-part="sliderFill" data-wrn-axis-size="{size}" data-wrn-axis-color="{color}" data-wrn-axis-variant="{variant}"></span><span class="wrn-next__slider-thumb" data-wrn-owner="RangeSlider" data-wrn-part="sliderThumb" data-wrn-axis-size="{size}" data-wrn-axis-color="{color}" data-wrn-axis-variant="{variant}"></span>
{#if marks.length}<span class="wrn-next__slider-marks" data-wrn-owner="RangeSlider" data-wrn-part="sliderMarks" data-wrn-axis-size="{size}" data-wrn-axis-color="{color}" data-wrn-axis-variant="{variant}">{#each marks as mark}<button type="button" data-value="{mark.value}" style="left: {(Number(mark.value) - Number(min)) / (Number(max) - Number(min)) * 100}%" aria-label="{mark.label}" @click="selectMark(event)" data-wrn-owner="RangeSlider" data-wrn-part="button" data-wrn-axis-size="{size}" data-wrn-axis-color="{color}" data-wrn-axis-variant="{variant}"></button>{/each}</span>{/if}
</div>
{#if showBounds}<div class="wrn-next__range-bounds" data-wrn-owner="RangeSlider" data-wrn-part="rangeBounds" data-wrn-axis-size="{size}" data-wrn-axis-color="{color}" data-wrn-axis-variant="{variant}"><span>{min}</span><span>Step {step}</span><span>{max}</span></div>{/if}
</div>
{#if showValue}<output for="{id || name}">{currentValue}</output>{/if}
<button type="button" class="wrn-next__range-stepper" aria-label="Increase {label}" disabled="{disabled || readonly}" @click="increaseValue(event)" data-wrn-owner="RangeSlider" data-wrn-part="rangeStepper" data-wrn-axis-size="{size}" data-wrn-axis-color="{color}" data-wrn-axis-variant="{variant}"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" aria-hidden="true" data-wrn-owner="RangeSlider" data-wrn-part="vector" data-wrn-axis-size="{size}" data-wrn-axis-color="{color}" data-wrn-axis-variant="{variant}"><path d="M3.5 8h9"></path><path d="M8 3.5v9"></path></svg></button>
</div>
{#if helperText}<small class="wrn-next__field-help" data-wrn-owner="RangeSlider" data-wrn-part="help" data-wrn-axis-size="{size}" data-wrn-axis-color="{color}" data-wrn-axis-variant="{variant}">{helperText}</small>{/if}<small class="wrn-next__field-error" data-error="{name}" data-wrn-owner="RangeSlider" data-wrn-part="error" data-wrn-axis-size="{size}" data-wrn-axis-color="{color}" data-wrn-axis-variant="{variant}">{error}</small>
</div>
}
style {
.wrn-next__range-control { align-items:center; padding-bottom:1.5rem; }
.wrn-next__range-bounds { position:absolute; top:calc(100% + .25rem); left:0; right:0; }
.wrn-next__range-track {
position:relative;
display: grid;
flex: 1;
min-width: 0;
gap: 0.35rem;
}
.wrn-next__range-control input {
width: 100%;
min-width: 0;
margin: 0;
flex: 1;
accent-color: var(--wrn-field-color);
}
.wrn-next__custom-slider {
position: relative;
width: 100%;
height: 1.5rem;
cursor: pointer;
touch-action: none;
}
.wrn-next__custom-slider::before,
.wrn-next__slider-fill {
position: absolute;
top: 50%;
height: 0.375rem;
border-radius: 999px;
transform: translateY(-50%);
content: "";
}
.wrn-next__custom-slider::before {
right: 0;
left: 0;
background: var(--wrn-color-surface-muted, var(--wrn-color-surface-2));
box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.12);
}
.wrn-next__slider-fill {
z-index: 1;
left: 0;
width: var(--wrn-range-progress);
background: linear-gradient(180deg, color-mix(in srgb, var(--wrn-field-color) 88%, white), var(--wrn-field-color));
box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.25);
}
.wrn-next__slider-thumb {
position: absolute;
z-index: 3;
top: 50%;
left: var(--wrn-range-progress);
width: 1.125rem;
height: 1.125rem;
border: 1px solid rgb(0 0 0 / 0.12);
border-radius: 50%;
background: #fff;
box-shadow: 0 1px 3px rgb(0 0 0 / 0.25), 0 0 0 3px color-mix(in srgb, var(--wrn-field-color) 22%, transparent);
transform: translate(-50%, -50%);
transition: box-shadow 120ms ease;
}
.wrn-next__custom-slider:focus-visible {
outline: 3px solid color-mix(in srgb, var(--wrn-field-color) 28%, transparent);
outline-offset: 3px;
}
.wrn-next__slider-marks button {
position: absolute;
z-index: 2;
top: 50%;
width: 0.55rem;
height: 0.55rem;
padding: 0;
border: 2px solid var(--wrn-color-surface);
border-radius: 50%;
background: var(--wrn-color-muted);
transform: translate(-50%, -50%);
}
.wrn-next__range-control[data-show-steps="true"] input {
background-image: repeating-linear-gradient(
90deg,
transparent 0,
transparent calc(10% - 1px),
var(--wrn-color-border) calc(10% - 1px),
var(--wrn-color-border) 10%
);
}
.wrn-next__range-bounds {
display: grid;
grid-template-columns: 1fr auto 1fr;
color: var(--wrn-color-text-subtle, var(--wrn-color-muted));
font-family: var(--wrn-font-mono, monospace);
font-size: 0.7em;
font-variant-numeric: tabular-nums;
}
.wrn-next__range-bounds span:nth-child(2) {
text-align: center;
}
.wrn-next__range-bounds span:last-child {
text-align: right;
}
.wrn-next__range-control output {
min-width: 3ch;
font-family: var(--wrn-font-mono, monospace);
font-size: 0.8125rem;
font-weight: 600;
font-variant-numeric: tabular-nums;
}
.wrn-next__range-stepper {
display: inline-grid;
width: 2rem;
height: 2rem;
flex: 0 0 auto;
place-items: center;
border: 1px solid var(--wrn-color-border);
border-bottom-color: var(--wrn-color-border-strong, var(--wrn-color-border));
border-radius: var(--wrn-radius-sm);
background: linear-gradient(180deg, var(--wrn-color-surface), var(--wrn-color-surface-soft, var(--wrn-color-surface)));
box-shadow: var(--wrn-shadow-1);
color: var(--wrn-color-text);
font: inherit;
font-size: 1rem;
cursor: pointer;
}
.wrn-next__range-stepper > svg { display: block; }
.wrn-next__range-stepper:hover:not(:disabled) {
border-color: var(--wrn-color-border-strong, var(--wrn-color-border));
color: var(--wrn-color-text);
background: var(--wrn-color-surface);
}
.wrn-next__range-stepper:disabled {
cursor: not-allowed;
opacity: 0.45;
}
/* 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-text-muted, 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-text, var(--wrn-color-danger));
font-size: 0.78rem;
font-weight: 550;
}
.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: var(--wrn-control-height, 2.5rem);
padding: 0.5rem 0.75rem;
border: 1px solid var(--wrn-color-input-border, var(--wrn-color-border));
border-radius: var(--wrn-radius-sm, 8px);
outline: 0;
color: var(--wrn-color-text);
background: var(--wrn-color-input-background, var(--wrn-color-surface));
font: inherit;
font-weight: 500;
transition: border-color var(--wrn-motion-fast) var(--wrn-ease-standard), box-shadow var(--wrn-motion-fast) var(--wrn-ease-standard), background-color var(--wrn-motion-fast) var(--wrn-ease-standard);
}
.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: var(--wrn-control-height, 2.5rem);
border-radius: var(--wrn-radius-sm, 6px);
box-shadow: none;
}
.wrn-next--field :where(input, textarea, select):focus-visible {
border-color: var(--wrn-field-color, var(--wrn-color-primary));
box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.04), 0 0 0 3px color-mix(in srgb, var(--wrn-field-color, var(--wrn-color-primary)) 18%, 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-size: 0.8125rem;
font-weight: 600;
line-height: 1.35;
letter-spacing: -0.005em;
}
.wrn-next__field-hint,
.wrn-next__field-help {
color: var(--wrn-color-text-subtle, var(--wrn-color-muted));
font-size: 0.75rem;
font-weight: 450;
line-height: 1.45;
}
.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-input-border, var(--wrn-color-border));
border-radius: var(--wrn-radius-sm);
background: var(--wrn-color-input-background, var(--wrn-color-surface));
box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.04);
font-size: 0.875rem;
}
.wrn-next__field-control[data-has-icon="true"][data-icon-position="start"] > :is(input, textarea, select) {
padding-inline-start: 2.5rem;
}
.wrn-next__field-control[data-has-icon="true"][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) 6%, var(--wrn-color-surface-soft, var(--wrn-color-surface)));
box-shadow: none;
}
.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-text, var(--wrn-color-danger));
font-size: 0.78rem;
font-weight: 550;
}
.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);
box-shadow: 0 0 0 3px color-mix(in srgb, var(--wrn-color-danger) 12%, transparent);
}
.wrn-next--field :is(input, textarea, select):disabled,
.wrn-next--choice-field input:disabled {
cursor: not-allowed;
opacity: 0.55;
background: var(--wrn-color-surface-soft, var(--wrn-color-surface-2));
}
.wrn-next--field :is(input, textarea, select):read-only {
background: var(--wrn-color-surface-soft, 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: var(--wrn-control-height, 2.5rem);
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: var(--wrn-control-height, 2.5rem);
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.625rem;
color: var(--wrn-color-text);
width: 100%;
font-size: 0.875rem;
font-weight: 500;
line-height: 1.4;
cursor: pointer;
}
.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.125rem;
line-height: 1.4;
}
.wrn-next__choice-copy small {
color: var(--wrn-color-text-subtle, var(--wrn-color-muted));
font-size: 0.78rem;
font-weight: 450;
}
.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.9rem 1rem;
border: 1px solid var(--wrn-color-border);
border-radius: var(--wrn-radius);
background: var(--wrn-color-surface);
box-shadow: var(--wrn-shadow-1);
transition: border-color var(--wrn-motion-fast) var(--wrn-ease-standard), box-shadow var(--wrn-motion-fast) var(--wrn-ease-standard), background-color var(--wrn-motion-fast) var(--wrn-ease-standard);
}
.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);
background: color-mix(in srgb, var(--wrn-field-color) 5%, var(--wrn-color-surface));
box-shadow: 0 0 0 1px var(--wrn-field-color), var(--wrn-shadow-1);
}
.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.7rem 0.85rem;
border: 1px solid var(--wrn-color-border);
border-radius: var(--wrn-radius-sm);
background: var(--wrn-color-surface);
}
.wrn-next__choice[data-variant="pill"] {
padding: 0.6rem 1rem;
border: 1px solid color-mix(in srgb, var(--wrn-field-color) 22%, var(--wrn-color-border));
border-radius: 999px;
background: color-mix(in srgb, var(--wrn-field-color) 6%, var(--wrn-color-surface));
}
.wrn-next__choice[data-variant="ghost"] {
padding: 0.65rem 0.85rem;
border-radius: var(--wrn-radius-sm);
background: color-mix(in srgb, var(--wrn-field-color) 6%, 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: var(--wrn-control-height, 2.5rem);
align-items: center;
justify-content: space-between;
gap: 0.75rem;
padding: 0.55rem 0.85rem;
border: 1px solid var(--wrn-color-input-border, var(--wrn-color-border));
border-radius: var(--wrn-radius-sm);
background: var(--wrn-color-input-background, var(--wrn-color-surface));
box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.04);
color: var(--wrn-color-text);
font: inherit;
font-size: 0.875rem;
font-variant-numeric: tabular-nums;
text-align: left;
cursor: pointer;
transition: border-color 120ms ease, box-shadow 120ms ease;
}
.wrn-next__calendar,
.wrn-next__time-panel {
position: absolute;
z-index: 40;
top: 100%;
left: 0;
display: grid;
width: min(calc(100vw - 2rem), 19.5rem);
gap: 0.75rem;
margin-top: 0.375rem;
padding: 0.75rem;
border: 1px solid var(--wrn-color-border);
border-radius: var(--wrn-radius);
background: var(--wrn-color-surface-raised, var(--wrn-color-surface));
box-shadow: var(--wrn-highlight-edge, none), var(--wrn-shadow-3);
animation: wrn-popover-enter var(--wrn-motion-base, 160ms) var(--wrn-ease-emphasized, ease) both;
}
.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: calc(var(--wrn-radius-sm) - 2px);
background: transparent;
color: inherit;
font: inherit;
font-size: 0.8125rem;
font-variant-numeric: tabular-nums;
cursor: pointer;
transition: background-color 120ms ease, color 120ms ease;
}
.wrn-next__calendar-weekdays,
.wrn-next__calendar-grid {
display: grid;
grid-template-columns: repeat(7, 1fr);
gap: 0.125rem;
text-align: center;
}
.wrn-next__calendar-weekdays {
padding-bottom: 0.375rem;
border-bottom: 1px solid var(--wrn-color-border);
color: var(--wrn-color-text-subtle, var(--wrn-color-muted));
font-family: var(--wrn-font-mono, monospace);
font-size: 0.625rem;
font-weight: 600;
letter-spacing: 0.06em;
text-transform: uppercase;
}
.wrn-next__calendar-grid button:hover,
.wrn-next__time-panel button:hover {
background: var(--wrn-color-surface-muted, 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);
box-shadow: var(--wrn-highlight-edge, none), 0 1px 2px color-mix(in srgb, var(--wrn-field-color) 35%, transparent);
font-weight: 650;
}
.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) 6%, var(--wrn-color-surface-soft, 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);
}
.wrn-next__custom-slider:hover .wrn-next__slider-thumb {
box-shadow: 0 1px 3px rgb(0 0 0 / 0.25), 0 0 0 5px color-mix(in srgb, var(--wrn-field-color) 22%, transparent);
}
}
}