{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "input-floating-label",
  "type": "registry:component",
  "title": "Floating Label Input",
  "description": "A text field whose label floats up on focus or when filled, with an animated focus line and error and success states.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "micro",
    "input",
    "floating label",
    "form",
    "validation",
    "text field",
    "focus"
  ],
  "docs": "https://hyperblur.dev/effects/input-floating-label",
  "files": [
    {
      "path": "registry/hyperblur/input-floating-label.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/input-floating-label.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface InputFloatingLabelProps\n  extends Omit<React.InputHTMLAttributes<HTMLInputElement>, \"size\"> {\n  label: string;\n  error?: string;\n  success?: boolean;\n  hint?: string;\n  icon?: React.ReactNode;\n  accent?: string;\n}\n\nconst css = `\n.hb-qn5 {\n  box-sizing: border-box;\n  width: 100%;\n  font: inherit;\n  color: #ededed;\n}\n.hb-qn5 *, .hb-qn5 *::before, .hb-qn5 *::after { box-sizing: border-box; }\n.hb-qn5-field {\n  position: relative;\n  display: flex;\n  align-items: center;\n  height: 54px;\n  border: 1px solid #262626;\n  border-radius: 12px;\n  background: #111;\n  transition: border-color 0.2s ease, box-shadow 0.2s ease;\n}\n.hb-qn5-field:hover { border-color: #3a3a3a; }\n.hb-qn5-field:focus-within {\n  border-color: var(--hb-qn5-c);\n  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hb-qn5-c) 18%, transparent);\n}\n.hb-qn5[data-state=\"error\"] .hb-qn5-field { animation: hb-qn5-shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97); }\n.hb-qn5-icon {\n  display: grid;\n  flex: none;\n  place-items: center;\n  width: 20px;\n  margin-left: 14px;\n  color: #6f6f6f;\n  transition: color 0.2s ease;\n}\n.hb-qn5-icon svg { width: 18px; height: 18px; display: block; }\n.hb-qn5-field:focus-within .hb-qn5-icon { color: var(--hb-qn5-c); }\n.hb-qn5-in {\n  flex: 1;\n  min-width: 0;\n  height: 100%;\n  margin: 0;\n  padding: 20px 14px 6px;\n  border: 0;\n  outline: 0;\n  background: transparent;\n  color: #ededed;\n  font: inherit;\n  font-size: 15px;\n  line-height: 1.2;\n  text-overflow: ellipsis;\n}\n.hb-qn5[data-icon=\"true\"] .hb-qn5-in { padding-left: 10px; }\n.hb-qn5-in::placeholder { color: transparent; transition: color 0.2s ease; }\n.hb-qn5-in:focus::placeholder { color: #5f5f5f; }\n.hb-qn5-in:disabled { cursor: not-allowed; opacity: 0.5; }\n.hb-qn5-lab {\n  position: absolute;\n  top: 50%;\n  left: 14px;\n  max-width: calc(100% - 56px);\n  overflow: hidden;\n  color: #8f8f8f;\n  font-size: 15px;\n  line-height: 1;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n  pointer-events: none;\n  transform: translateY(-50%);\n  transform-origin: left center;\n  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), color 0.2s ease;\n}\n.hb-qn5[data-icon=\"true\"] .hb-qn5-lab { left: 44px; }\n.hb-qn5-in:focus ~ .hb-qn5-lab,\n.hb-qn5-in:not(:placeholder-shown) ~ .hb-qn5-lab { transform: translateY(calc(-50% - 11px)) scale(0.76); }\n.hb-qn5-in:focus ~ .hb-qn5-lab { color: var(--hb-qn5-c); }\n.hb-qn5-line {\n  position: absolute;\n  right: 12px;\n  bottom: -1px;\n  left: 12px;\n  height: 2px;\n  border-radius: 2px;\n  background: var(--hb-qn5-c);\n  transform: scaleX(0);\n  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);\n}\n.hb-qn5-field:focus-within .hb-qn5-line,\n.hb-qn5[data-state=\"error\"] .hb-qn5-line,\n.hb-qn5[data-state=\"success\"] .hb-qn5-line { transform: scaleX(1); }\n.hb-qn5[data-state=\"error\"] { --hb-qn5-c: #ff5d6c; }\n.hb-qn5[data-state=\"success\"] { --hb-qn5-c: #34d27b; }\n.hb-qn5[data-state=\"error\"] .hb-qn5-field { border-color: #ff5d6c; }\n.hb-qn5[data-state=\"success\"] .hb-qn5-field { border-color: color-mix(in srgb, #34d27b 60%, #262626); }\n.hb-qn5[data-state=\"success\"] .hb-qn5-field:focus-within { border-color: #34d27b; }\n.hb-qn5[data-state=\"error\"] .hb-qn5-lab { color: #ff8a95; }\n.hb-qn5[data-state=\"success\"] .hb-qn5-lab { color: #5fe39b; }\n.hb-qn5-status {\n  display: grid;\n  flex: none;\n  place-items: center;\n  width: 20px;\n  height: 20px;\n  margin-right: 14px;\n  animation: hb-qn5-pop 0.4s cubic-bezier(0.34, 1.7, 0.64, 1);\n}\n.hb-qn5-status svg { width: 20px; height: 20px; display: block; overflow: visible; }\n.hb-qn5-status path, .hb-qn5-status circle { fill: none; stroke: var(--hb-qn5-c); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }\n.hb-qn5-draw { stroke-dasharray: 1 1.1; stroke-dashoffset: 1.05; animation: hb-qn5-draw 0.4s 0.1s cubic-bezier(0.6, 0, 0.3, 1) forwards; }\n.hb-qn5-msg {\n  margin: 6px 4px 0;\n  font-size: 12.5px;\n  line-height: 1.35;\n  color: #8f8f8f;\n  animation: hb-qn5-rise 0.25s ease-out;\n}\n.hb-qn5[data-state=\"error\"] .hb-qn5-msg { color: #ff8a95; }\n.hb-qn5[data-state=\"success\"] .hb-qn5-msg { color: #5fe39b; }\n@keyframes hb-qn5-shake {\n  10%, 90% { transform: translateX(-1px); }\n  20%, 80% { transform: translateX(2px); }\n  30%, 50%, 70% { transform: translateX(-4px); }\n  40%, 60% { transform: translateX(4px); }\n}\n@keyframes hb-qn5-pop {\n  0% { opacity: 0; transform: scale(0.4); }\n  100% { opacity: 1; transform: scale(1); }\n}\n@keyframes hb-qn5-draw { to { stroke-dashoffset: 0; } }\n@keyframes hb-qn5-rise {\n  0% { opacity: 0; transform: translateY(-4px); }\n  100% { opacity: 1; transform: translateY(0); }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-qn5-field, .hb-qn5-lab, .hb-qn5-line, .hb-qn5-icon, .hb-qn5-in::placeholder { transition: none; }\n  .hb-qn5[data-state=\"error\"] .hb-qn5-field, .hb-qn5-status, .hb-qn5-msg { animation: none; }\n  .hb-qn5-draw { animation: none; stroke-dashoffset: 0; }\n}\n`;\n\nexport function InputFloatingLabel({\n  label,\n  error,\n  success = false,\n  hint,\n  icon,\n  accent = \"#2f7bff\",\n  className = \"\",\n  style,\n  id,\n  placeholder,\n  \"aria-describedby\": describedBy,\n  ...rest\n}: InputFloatingLabelProps) {\n  const autoId = React.useId();\n  const inputId = id ?? autoId;\n  const msgId = `${inputId}-msg`;\n  const state = error ? \"error\" : success ? \"success\" : \"idle\";\n  const message = error ?? hint;\n  const vars = { \"--hb-qn5-c\": accent, ...style } as React.CSSProperties;\n  const ids = message ? (describedBy ? `${describedBy} ${msgId}` : msgId) : describedBy;\n\n  return (\n    <>\n      <style href=\"hb-input-floating-label\" precedence=\"default\">{css}</style>\n      <div className={`hb-qn5 ${className}`} style={vars} data-state={state} data-icon={icon ? \"true\" : \"false\"}>\n        <div className=\"hb-qn5-field\">\n          {icon ? (\n            <span className=\"hb-qn5-icon\" aria-hidden=\"true\">\n              {icon}\n            </span>\n          ) : null}\n          <input\n            id={inputId}\n            className=\"hb-qn5-in\"\n            placeholder={placeholder ?? \" \"}\n            aria-invalid={error ? true : undefined}\n            aria-describedby={ids}\n            {...rest}\n          />\n          <label className=\"hb-qn5-lab\" htmlFor={inputId}>\n            {label}\n          </label>\n          {error ? (\n            <span className=\"hb-qn5-status\" aria-hidden=\"true\">\n              <svg viewBox=\"0 0 24 24\" focusable=\"false\">\n                <circle cx=\"12\" cy=\"12\" r=\"9\" />\n                <path d=\"M12 7.5v5.5M12 16.4v.1\" />\n              </svg>\n            </span>\n          ) : success ? (\n            <span className=\"hb-qn5-status\" aria-hidden=\"true\">\n              <svg viewBox=\"0 0 24 24\" focusable=\"false\">\n                <circle cx=\"12\" cy=\"12\" r=\"9\" />\n                <path className=\"hb-qn5-draw\" d=\"M8 12.4l2.8 2.8 5.2-5.8\" pathLength=\"1\" />\n              </svg>\n            </span>\n          ) : null}\n          <span className=\"hb-qn5-line\" aria-hidden=\"true\" />\n        </div>\n        {message ? (\n          <p key={message} id={msgId} className=\"hb-qn5-msg\" aria-live=\"polite\">\n            {message}\n          </p>\n        ) : null}\n      </div>\n    </>\n  );\n}\n"
    }
  ]
}