Skip to content

Write HTML. Render video. Built for agents.

8.2 KB
Raw Blame
{"html":"<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=1920, height=1080\" />\n    <title>Input Feedback - Demo</title>\n    <script src=\"https://cdn.jsdelivr.net/npm/[email protected]/dist/gsap.min.js\"></script>\n    <style>\n      * {\n        box-sizing: border-box;\n      }\n      html,\n      body {\n        margin: 0;\n        width: 1920px;\n        height: 1080px;\n        overflow: hidden;\n      }\n      #demo {\n        width: 1920px;\n        height: 1080px;\n        display: grid;\n        place-items: center;\n        background: #f8fafc;\n        font-family: Inter, system-ui, sans-serif;\n      }\n      .demo-frame {\n        display: grid;\n        place-items: center;\n        min-width: 760px;\n        min-height: 480px;\n        padding: 56px;\n        /* ponytail: scale up the static wrapper so the widget fills ~60% of frame; GSAP targets children, not this element */\n        transform: scale(2.8);\n      }\n      .hf-transition-input-feedback {\n        display: grid;\n        gap: 10px;\n        width: 430px;\n        color: #18181b;\n        font-family: Inter, system-ui, sans-serif;\n      }\n      .hf-transition-input-feedback label {\n        color: #52525b;\n        font-size: 15px;\n        font-weight: 850;\n      }\n      .hf-transition-input-shell {\n        display: flex;\n        align-items: center;\n        gap: 12px;\n        height: 62px;\n        padding: 0 16px;\n        border: 1px solid #d4d4d8;\n        border-radius: 16px;\n        background: #ffffff;\n        box-shadow: 0 18px 50px rgba(0, 0, 0, 0.08);\n      }\n      .hf-transition-input-value {\n        flex: 1;\n        font-size: 20px;\n        font-weight: 760;\n      }\n      .hf-transition-input-clear,\n      .hf-transition-input-check {\n        display: grid;\n        place-items: center;\n        height: 28px;\n        border-radius: 999px;\n        font-size: 12px;\n        font-weight: 900;\n      }\n      .hf-transition-input-clear {\n        width: 28px;\n        border: 0;\n        background: #f4f4f5;\n        color: #71717a;\n      }\n      .hf-transition-input-check {\n        min-width: 38px;\n        padding: 0 8px;\n        background: #dcfce7;\n        color: #166534;\n      }\n      .hf-transition-input-hint {\n        margin: 0;\n        color: #16a34a;\n        font-size: 14px;\n        font-weight: 800;\n      }\n    </style>\n  </head>\n  <body>\n    <div\n      id=\"demo\"\n      data-composition-id=\"input-feedback-demo\"\n      data-start=\"0\"\n      data-width=\"1920\"\n      data-height=\"1080\"\n      data-duration=\"5\"\n    >\n      <div class=\"demo-frame\">\n        <div\n          class=\"hf-transition-input-feedback\"\n          data-state=\"valid\"\n          data-composition-variables='[\n    { \"id\": \"status\", \"type\": \"enum\", \"role\": \"style\", \"label\": \"Status\", \"description\": \"Whether the field reads as accepted or rejected, colouring the border, chip and hint.\", \"default\": \"valid\", \"options\": [{ \"value\": \"valid\", \"label\": \"Valid\" }, { \"value\": \"error\", \"label\": \"Error\" }] },\n    { \"id\": \"value\", \"type\": \"string\", \"role\": \"content\", \"label\": \"Value\", \"description\": \"Text held by the field.\", \"default\": \"[email protected]\" },\n    { \"id\": \"hint\", \"type\": \"string\", \"role\": \"content\", \"label\": \"Hint\", \"description\": \"Helper line under the field.\", \"default\": \"Looks good.\" }\n  ]'\n        >\n          <label>Email</label>\n          <div class=\"hf-transition-input-shell\">\n            <span class=\"hf-transition-input-value\">[email protected]</span>\n            <button class=\"hf-transition-input-clear\" type=\"button\">x</button>\n            <span class=\"hf-transition-input-check\">OK</span>\n          </div>\n          <p class=\"hf-transition-input-hint\">Looks good.</p>\n        </div>\n      </div>\n      <script>\n        (function () {\n          \"use strict\";\n\n          var vars =\n            window.__hyperframes && window.__hyperframes.getVariables\n              ? window.__hyperframes.getVariables()\n              : {};\n\n          // Unrecognised overrides return to their declared defaults.\n          function pick(table, value, fallback) {\n            return Object.prototype.hasOwnProperty.call(table, value) ? value : fallback;\n          }\n\n          function text(value, fallback) {\n            return typeof value === \"string\" && value.trim() !== \"\" ? value : fallback;\n          }\n\n          var statuses = { valid: \"OK\", error: \"!\" };\n\n          var status = pick(statuses, vars.status, \"valid\");\n          var value = text(vars.value, \"[email protected]\");\n          var hint = text(vars.hint, \"Looks good.\");\n\n          var roots = document.querySelectorAll(\".hf-transition-input-feedback\");\n          for (var i = 0; i < roots.length; i += 1) {\n            var root = roots[i];\n            root.setAttribute(\"data-state\", status);\n            var valueEl = root.querySelector(\".hf-transition-input-value\");\n            if (valueEl) valueEl.textContent = value;\n            var hintEl = root.querySelector(\".hf-transition-input-hint\");\n            if (hintEl) hintEl.textContent = hint;\n            var chip = root.querySelector(\".hf-transition-input-check\");\n            if (chip) chip.textContent = statuses[status];\n          }\n        })();\n      </script>\n      <script>\n        const tl = gsap.timeline({ paused: true });\n        tl.fromTo(\n          \".hf-transition-input-feedback\",\n          { y: 22, opacity: 0 },\n          { y: 0, opacity: 1, duration: 0.34, ease: \"power2.out\" },\n          0.3,\n        );\n        tl.to(\n          \".hf-transition-input-shell\",\n          { x: -12, duration: 0.06, repeat: 5, yoyo: true, ease: \"none\" },\n          0.72,\n        );\n        tl.fromTo(\n          \".hf-transition-input-check\",\n          { scale: 0, opacity: 0 },\n          { scale: 1, opacity: 1, duration: 0.28, ease: \"back.out(2)\" },\n          1.18,\n        );\n        tl.fromTo(\n          \".hf-transition-input-hint\",\n          { opacity: 0, y: -6 },\n          { opacity: 1, y: 0, duration: 0.22, ease: \"power2.out\" },\n          1.28,\n        );\n        tl.set({}, {}, 5);\n        window.__timelines = window.__timelines || {};\n        window.__timelines[\"input-feedback-demo\"] = tl;\n      </script>\n    </div>\n    <style>\n      .hf-transition-input-feedback {\n        --hf-fb-border: #d4d4d8;\n        --hf-fb-chip-bg: #dcfce7;\n        --hf-fb-chip-fg: #166534;\n        --hf-fb-hint: #16a34a;\n        display: grid;\n        gap: 10px;\n        width: 430px;\n        color: #18181b;\n        font-family: Inter, system-ui, sans-serif;\n      }\n      .hf-transition-input-feedback label {\n        color: #52525b;\n        font-size: 15px;\n        font-weight: 850;\n      }\n      .hf-transition-input-shell {\n        display: flex;\n        align-items: center;\n        gap: 12px;\n        height: 62px;\n        padding: 0 16px;\n        border: 1px solid var(--hf-fb-border);\n        border-radius: 16px;\n        background: #ffffff;\n        box-shadow: 0 18px 50px rgba(0, 0, 0, 0.08);\n      }\n      .hf-transition-input-value {\n        flex: 1;\n        font-size: 20px;\n        font-weight: 760;\n      }\n      .hf-transition-input-clear,\n      .hf-transition-input-check {\n        display: grid;\n        place-items: center;\n        height: 28px;\n        border-radius: 999px;\n        font-size: 12px;\n        font-weight: 900;\n      }\n      .hf-transition-input-clear {\n        width: 28px;\n        border: 0;\n        background: #f4f4f5;\n        color: #71717a;\n      }\n      .hf-transition-input-check {\n        min-width: 38px;\n        padding: 0 8px;\n        background: var(--hf-fb-chip-bg);\n        color: var(--hf-fb-chip-fg);\n      }\n      .hf-transition-input-hint {\n        margin: 0;\n        color: var(--hf-fb-hint);\n        font-size: 14px;\n        font-weight: 800;\n      }\n      .hf-transition-input-feedback[data-state=\"error\"] {\n        --hf-fb-border: #fca5a5;\n        --hf-fb-chip-bg: #fee2e2;\n        --hf-fb-chip-fg: #991b1b;\n        --hf-fb-hint: #dc2626;\n      }\n    </style>\n  </body>\n</html>\n"}