{"version":3,"names":["VISUALLY_HIDDEN_STYLE","HiddenInput","props","mergedStyle","style","type"],"sources":["hidden-input.tsx"],"sourcesContent":["import type { JSX } from \"@solidjs/web\";\n\nimport { VISUALLY_HIDDEN_STYLE } from \"../visually-hidden-style\";\n\n/**\n * Props accepted by `<HiddenInput>`. Structurally equivalent to Solid's\n * built-in `JSX.InputHTMLAttributes<HTMLInputElement>` (the \"all native\n * input attrs\" bucket), minus `style` — we own the visually-hidden style\n * block and consumers shouldn't stomp it.\n */\nexport interface HiddenInputProps\n\textends Omit<JSX.InputHTMLAttributes<HTMLInputElement>, \"style\"> {\n\t/**\n\t * Optional style extensions merged ON TOP of `VISUALLY_HIDDEN_STYLE`.\n\t * Intended for niche cases (e.g. an inner `padding: '1px'` hack for\n\t * Safari iframe autofill); in practice you'll rarely need this.\n\t */\n\tstyle?: JSX.CSSProperties | undefined;\n}\n\n/**\n * A visually-hidden `<input>` used by checkbox / switch / radio / etc. to\n * make them participate in native form submission while the visible element\n * is a `<button>` or `<div role=...>`.\n *\n * Contract:\n *\n * - ALL native input props pass through as-is. That includes `ref` — Solid\n *   natively composes ref arrays (`ref={[a, b]}`), so consumers can chain\n *   their own refs without help from this component.\n * - The component does NOT own the controlled/uncontrolled story. Pass\n *   `checked` or `defaultChecked` as the consumer sees fit. See solidify.md §6\n *   for consumer-owned signal patterns.\n * - `style` is merged on top of `VISUALLY_HIDDEN_STYLE`. Callers who want\n *   to replace the visually-hidden style (e.g. for a clickable-area hack)\n *   should pass the desired keys as an override — they win over ours by\n *   the standard right-most-spread rule.\n * - `type` defaults to `\"checkbox\"` because that's the by-far common\n *   case; pass `type=\"radio\"` (or any other native `type`) when you need\n *   something else.\n *\n * Solid 2 notes:\n *\n * - This is a function component that returns a single `<input>`; there's\n *   no wrapper. `props.style` is merged into a new object inside JSX so the\n *   shallow spread stays reactive via `mergePropsN`-free fast path.\n * - `aria-hidden` is NOT forced here — `aria-hidden` on a focusable input\n *   is an accessibility landmine, but some consumers still want it (e.g.\n *   when the surrounding widget already owns the role). Callers decide.\n */\nexport function HiddenInput(props: HiddenInputProps): JSX.Element {\n\t// Local tracking ensures every reactive read stays live. Top-level\n\t// `const type = props.type` would warn under STRICT_READ_UNTRACKED —\n\t// we deliberately read inside JSX instead.\n\t// Set `type` BEFORE the spread so that `value`, `checked` and friends\n\t// coming out of `...props` are applied to an input whose `type` is\n\t// already the final one. Switching `<input type>` after setting `value`\n\t// mangles the property on some engines (an input's stored `value` is\n\t// interpreted against its current `type`). Then hand-override `style`\n\t// at the very end so the visually-hidden keys always win over any\n\t// `props.style` the consumer forwarded.\n\t//\n\t// `VISUALLY_HIDDEN_STYLE` is frozen at module scope. Solid 2's style\n\t// binding mutates its in-memory `prev` object (`delete prev[key]` when\n\t// re-reconciling), which throws on a frozen source. We ALWAYS hand a\n\t// fresh plain object to the `style` prop — never the frozen constant\n\t// directly — so the binding can mutate freely.\n\tconst mergedStyle = (): JSX.CSSProperties => ({\n\t\t...VISUALLY_HIDDEN_STYLE,\n\t\t...(props.style ?? {}),\n\t});\n\treturn (\n\t\t<input type={props.type ?? \"checkbox\"} {...props} style={mergedStyle()} />\n\t);\n}\n"],"mappings":"AAEA,SAASA,qBAAqB,QAAQ,0BAA0B;;AAEhE;AACA;AACA;AACA;AACA;AACA;;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAACC,KAAuB,EAAe;EACjE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,MAAMC,WAAW,GAAGA,CAAA,MAA0B;IAC7C,GAAGH,qBAAqB;IACxB,IAAIE,KAAK,CAACE,KAAK,IAAI,CAAC,CAAC;EACtB,CAAC,CAAC;EACF,OACC,CAAC,KAAK,CAAC,IAAI,CAAC,CAACF,KAAK,CAACG,IAAI,IAAI,UAAU,CAAC,CAAC,IAAIH,KAAK,CAAC,CAAC,KAAK,CAAC,CAACC,WAAW,CAAC,CAAC,CAAC,GAAG;AAE5E","ignoreList":[]}