Refine glass material and environment controls

This commit is contained in:
DCCONSTRUCTIONS
2026-07-10 21:05:04 +03:00
parent 4c74c22a6e
commit 0e030136bb
9 changed files with 350 additions and 112 deletions
+6 -3
View File
@@ -4,6 +4,8 @@ import { Dropdown } from "./Dropdown.js";
export interface RangeControlProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "onChange"> {
label: string;
/** Keeps the accessible name while letting a parent ControlRow render the visible label. */
showLabel?: boolean;
value: number;
min: number;
max: number;
@@ -13,6 +15,7 @@ export interface RangeControlProps extends Omit<InputHTMLAttributes<HTMLInputEle
export function RangeControl({
label,
showLabel = true,
value,
min,
max,
@@ -26,7 +29,7 @@ export function RangeControl({
const progress = Math.max(0, Math.min(100, ((value - min) / (safeMax - min)) * 100));
const style = { "--nodedc-range-progress": `${progress}%` } as CSSProperties;
return (
<label className={cn("nodedc-range", className)} style={style}>
<label className={cn("nodedc-range", className)} data-label-hidden={showLabel ? undefined : "true"} style={style}>
<input
type="range"
value={value}
@@ -37,10 +40,10 @@ export function RangeControl({
onChange={(event) => onChange(Number(event.target.value))}
{...props}
/>
<span className="nodedc-range__label">{label}</span>
{showLabel ? <span className="nodedc-range__label">{label}</span> : null}
<span className="nodedc-range__value">{formatValue(value)}</span>
<span className="nodedc-range__fill-text" aria-hidden="true">
<span className="nodedc-range__label">{label}</span>
{showLabel ? <span className="nodedc-range__label">{label}</span> : null}
<span className="nodedc-range__value">{formatValue(value)}</span>
</span>
</label>