{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "input-with-select", "type": "registry:ui", "title": "Input With Select", "description": "iOS 26 liquid-glass amount input with integrated segmented currency/unit selector and spring-animated knob.", "dependencies": [ "motion" ], "files": [ { "path": "registry/ruixenui/input-with-select.tsx", "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { motion } from \"motion/react\";\n\n/* ── sound ── */\nlet _a: AudioContext, _b: AudioBuffer;\nconst tick = () => {\n if (typeof window === \"undefined\") return;\n if (!_a) {\n _a = new AudioContext();\n _b = _a.createBuffer(1, (_a.sampleRate * 0.003) | 0, _a.sampleRate);\n const d = _b.getChannelData(0);\n for (let i = 0; i < d.length; i++)\n d[i] = (Math.random() * 2 - 1) * (1 - i / d.length) ** 4;\n }\n const s = _a.createBufferSource();\n s.buffer = _b;\n const g = _a.createGain();\n g.gain.value = 0.08;\n s.connect(g).connect(_a.destination);\n s.start();\n};\n\n/* ── theme ── */\nconst CSS = `\n.is{\n --is-glass:linear-gradient(180deg,rgba(255,255,255,0.78),rgba(255,255,255,0.62));\n --is-border:rgba(0,0,0,0.06);\n --is-shadow:0 0 1px rgba(0,0,0,0.04),0 2px 8px rgba(0,0,0,0.04),inset 0 1px 0 rgba(255,255,255,0.8);\n --is-dim:rgba(0,0,0,0.42);\n --is-mid:rgba(0,0,0,0.55);\n --is-hi:rgba(0,0,0,0.88);\n --is-focus:rgba(0,0,0,0.12);\n --is-sep:rgba(0,0,0,0.06);\n --is-seg-bg:rgba(0,0,0,0.04);\n --is-seg-active:rgba(0,0,0,0.07);\n --is-knob:#fff;\n --is-knob-border:rgba(0,0,0,0.08);\n --is-knob-shadow:0 1px 3px rgba(0,0,0,0.12)\n}\n.dark .is,[data-theme=\"dark\"] .is{\n --is-glass:linear-gradient(180deg,rgba(255,255,255,0.05),rgba(255,255,255,0.02));\n --is-border:rgba(255,255,255,0.07);\n --is-shadow:0 1px 3px rgba(0,0,0,0.08),inset 0 1px 0 rgba(255,255,255,0.04);\n --is-dim:rgba(255,255,255,0.28);\n --is-mid:rgba(255,255,255,0.5);\n --is-hi:rgba(255,255,255,0.88);\n --is-focus:rgba(255,255,255,0.12);\n --is-sep:rgba(255,255,255,0.06);\n --is-seg-bg:rgba(255,255,255,0.04);\n --is-seg-active:rgba(255,255,255,0.09);\n --is-knob:#fff;\n --is-knob-border:rgba(255,255,255,0.06);\n --is-knob-shadow:0 1px 3px rgba(0,0,0,0.15)\n}`;\n\n/* ── types ── */\ninterface Option {\n value: string;\n label: string;\n}\n\ninterface InputWithSelectProps {\n label?: string;\n placeholder?: string;\n options?: Option[];\n defaultOption?: string;\n defaultValue?: string;\n onChange?: (value: string, option: string) => void;\n sound?: boolean;\n style?: React.CSSProperties;\n}\n\n/* ── component ── */\nexport default function InputWithSelect({\n label = \"Amount\",\n placeholder = \"0.00\",\n options = [\n { value: \"usd\", label: \"USD\" },\n { value: \"eur\", label: \"EUR\" },\n { value: \"inr\", label: \"INR\" },\n ],\n defaultOption = \"usd\",\n defaultValue = \"\",\n onChange,\n sound = true,\n style,\n}: InputWithSelectProps) {\n const [value, setValue] = React.useState(defaultValue);\n const [selected, setSelected] = React.useState(defaultOption);\n const [focused, setFocused] = React.useState(false);\n const inputRef = React.useRef(null);\n\n const activeIdx = options.findIndex((o) => o.value === selected);\n\n const selectOption = (opt: string) => {\n if (opt !== selected) {\n setSelected(opt);\n if (sound) tick();\n onChange?.(value, opt);\n }\n };\n\n return (\n <>\n