UNPKG

2.44 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../src/reach-visually-hidden.tsx"],"sourcesContent":["/**\n * Welcome to @reach/visually-hidden!\n *\n * Provides text for screen readers that is visually hidden.\n * It is the logical opposite of the `aria-hidden` attribute.\n *\n * @see https://snook.ca/archives/html_and_css/hiding-content-for-accessibility\n * @see https://a11yproject.com/posts/how-to-hide-content/\n * @see Docs https://reach.tech/visually-hidden\n * @see Source https://github.com/reach/reach-ui/tree/main/packages/visually-hidden\n */\n\nimport * as React from \"react\";\nimport type * as Polymorphic from \"@reach/polymorphic\";\n\n/**\n * VisuallyHidden\n *\n * Provides text for screen readers that is visually hidden.\n * It is the logical opposite of the `aria-hidden` attribute.\n */\nconst VisuallyHidden = React.forwardRef<any, any>(function VisuallyHidden(\n\t{ as: Comp = \"span\", style = {}, ...props },\n\tref\n) {\n\treturn (\n\t\t<Comp\n\t\t\tref={ref}\n\t\t\tstyle={{\n\t\t\t\tborder: 0,\n\t\t\t\tclip: \"rect(0 0 0 0)\",\n\t\t\t\theight: \"1px\",\n\t\t\t\tmargin: \"-1px\",\n\t\t\t\toverflow: \"hidden\",\n\t\t\t\tpadding: 0,\n\t\t\t\tposition: \"absolute\",\n\t\t\t\twidth: \"1px\",\n\n\t\t\t\t// https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe\n\t\t\t\twhiteSpace: \"nowrap\",\n\t\t\t\twordWrap: \"normal\",\n\t\t\t\t...style,\n\t\t\t}}\n\t\t\t{...props}\n\t\t/>\n\t);\n}) as Polymorphic.ForwardRefComponent<\"span\", VisuallyHiddenProps>;\nVisuallyHidden.displayName = \"VisuallyHidden\";\n\n/**\n * @see Docs https://reach.tech/visually-hidden#visuallyhidden-props\n */\ninterface VisuallyHiddenProps {\n\t/**\n\t * @see Docs https://reach.tech/visually-hidden#visuallyhidden-children\n\t */\n\tchildren: React.ReactNode;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// Exports\n\nexport type { VisuallyHiddenProps };\nexport { VisuallyHidden };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,YAAuB;AASvB,IAAM,iBAAiB,AAAM,iBAAqB,yBACjD,IACA,KACC;AAFD,eAAE,MAAI,OAAO,QAAQ,QAAQ,CAAC,MAA9B,IAAoC,kBAApC,IAAoC,CAAlC,MAAmB;AAGrB,SACC,oCAAC;AAAA,IACA;AAAA,IACA,OAAO;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,SAAS;AAAA,MACT,UAAU;AAAA,MACV,OAAO;AAAA,MAGP,YAAY;AAAA,MACZ,UAAU;AAAA,OACP;AAAA,KAEA,MACL;AAEF,CAAC;AACD,eAAe,cAAc;","names":[]}
\No newline at end of file