Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@radix-ui/react-label

Package Overview
Dependencies
Maintainers
5
Versions
171
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@radix-ui/react-label - npm Package Compare versions

Comparing version 0.0.10 to 0.0.11

2

dist/index.js

@@ -1,2 +0,2 @@

var e,t,r,n=require("@radix-ui/react-id").useId,i=require("@radix-ui/react-primitive").Primitive,o=require("@radix-ui/react-compose-refs").useComposedRefs,u=(e={},t=require("react"),Object.keys(t).forEach((function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})),e),l=(r=require("@babel/runtime/helpers/extends"))&&r.__esModule?r.default:r;const a="span",s=u.createContext(void 0),c=u.forwardRef(((e,t)=>{const{as:r=a,htmlFor:c,id:f,...b}=e,v=u.useRef(null),m=o(t,v),p=n(f);return u.useEffect((()=>{const e=v.current;if(e){const t=e=>{e.detail>1&&e.preventDefault()};return e.addEventListener("mousedown",t),()=>e.removeEventListener("mousedown",t)}}),[v]),u.useEffect((()=>{if(c){const e=document.getElementById(c),t=v.current;if(t&&e){const r=d(t,e),n=()=>e.getAttribute("aria-labelledby"),i=[n(),p].filter(Boolean).join(" ");return e.setAttribute("aria-labelledby",i),()=>{var t;r();const i=null===(t=n())||void 0===t?void 0:t.replace(p,"");""===i?e.removeAttribute("aria-labelledby"):i&&e.setAttribute("aria-labelledby",i)}}}}),[p,c]),u.createElement(s.Provider,{value:u.useMemo((()=>({id:p,ref:v})),[p])},u.createElement(i,l({role:"label",id:p},b,{as:r,ref:m})))}));exports.Label=c,c.displayName="Label";function d(e,t){const r=e=>{t.contains(e.target)||(t.click(),t.focus())};return e.addEventListener("click",r),()=>e.removeEventListener("click",r)}exports.useLabelContext=e=>{const t=u.useContext(s);return u.useEffect((()=>{const r=null==t?void 0:t.ref.current,n=null==e?void 0:e.current;if(r&&n)return d(r,n)}),[t,e]),null==t?void 0:t.id};const f=c;exports.Root=f;
var e,t,r,n=require("@radix-ui/react-id").useId,i=require("@radix-ui/react-primitive").Primitive,o=require("@radix-ui/react-compose-refs").useComposedRefs,u=(e={},t=require("react"),Object.keys(t).forEach((function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})),e),l=(r=require("@babel/runtime/helpers/extends"))&&r.__esModule?r.default:r;const a="span",s=/*#__PURE__*/u.createContext(void 0),c=/*#__PURE__*/u.forwardRef(((e,t)=>{const{as:r=a,htmlFor:c,id:f,...b}=e,v=u.useRef(null),m=o(t,v),p=n(f);return u.useEffect((()=>{const e=v.current;if(e){const t=e=>{e.detail>1&&e.preventDefault()};return e.addEventListener("mousedown",t),()=>e.removeEventListener("mousedown",t)}}),[v]),u.useEffect((()=>{if(c){const e=document.getElementById(c),t=v.current;if(t&&e){const r=d(t,e),n=()=>e.getAttribute("aria-labelledby"),i=[n(),p].filter(Boolean).join(" ");return e.setAttribute("aria-labelledby",i),()=>{var t;r();const i=null===(t=n())||void 0===t?void 0:t.replace(p,"");""===i?e.removeAttribute("aria-labelledby"):i&&e.setAttribute("aria-labelledby",i)}}}}),[p,c]),/*#__PURE__*/u.createElement(s.Provider,{value:u.useMemo((()=>({id:p,ref:v})),[p])},/*#__PURE__*/u.createElement(i,l({role:"label",id:p},b,{as:r,ref:m})))}));exports.Label=c;function d(e,t){const r=e=>{t.contains(e.target)||(t.click(),t.focus())};return e.addEventListener("click",r),()=>e.removeEventListener("click",r)}exports.useLabelContext=e=>{const t=u.useContext(s);return u.useEffect((()=>{const r=null==t?void 0:t.ref.current,n=null==e?void 0:e.current;if(r&&n)return d(r,n)}),[t,e]),null==t?void 0:t.id};const f=c;exports.Root=f;
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import{useId as e}from"@radix-ui/react-id";import{Primitive as t}from"@radix-ui/react-primitive";import{useComposedRefs as r}from"@radix-ui/react-compose-refs";import*as o from"react";import n from"@babel/runtime/helpers/esm/extends";const i="span",a=o.createContext(void 0);export const Label=o.forwardRef(((s,c)=>{const{as:u=i,htmlFor:d,id:f,...m}=s,b=o.useRef(null),v=r(c,b),p=e(f);return o.useEffect((()=>{const e=b.current;if(e){const t=e=>{e.detail>1&&e.preventDefault()};return e.addEventListener("mousedown",t),()=>e.removeEventListener("mousedown",t)}}),[b]),o.useEffect((()=>{if(d){const e=document.getElementById(d),t=b.current;if(t&&e){const r=l(t,e),o=()=>e.getAttribute("aria-labelledby"),n=[o(),p].filter(Boolean).join(" ");return e.setAttribute("aria-labelledby",n),()=>{var t;r();const n=null===(t=o())||void 0===t?void 0:t.replace(p,"");""===n?e.removeAttribute("aria-labelledby"):n&&e.setAttribute("aria-labelledby",n)}}}}),[p,d]),o.createElement(a.Provider,{value:o.useMemo((()=>({id:p,ref:b})),[p])},o.createElement(t,n({role:"label",id:p},m,{as:u,ref:v})))}));Label.displayName="Label";export const useLabelContext=e=>{const t=o.useContext(a);return o.useEffect((()=>{const r=null==t?void 0:t.ref.current,o=null==e?void 0:e.current;if(r&&o)return l(r,o)}),[t,e]),null==t?void 0:t.id};function l(e,t){const r=e=>{t.contains(e.target)||(t.click(),t.focus())};return e.addEventListener("click",r),()=>e.removeEventListener("click",r)}export const Root=Label;
import{useId as e}from"@radix-ui/react-id";import{Primitive as t}from"@radix-ui/react-primitive";import{useComposedRefs as r}from"@radix-ui/react-compose-refs";import*as o from"react";import n from"@babel/runtime/helpers/esm/extends";const i="span",l=/*#__PURE__*/o.createContext(void 0);export const Label=/*#__PURE__*/o.forwardRef(((c,s)=>{const{as:u=i,htmlFor:d,id:f,...m}=c,b=o.useRef(null),v=r(s,b),p=e(f);return o.useEffect((()=>{const e=b.current;if(e){const t=e=>{e.detail>1&&e.preventDefault()};return e.addEventListener("mousedown",t),()=>e.removeEventListener("mousedown",t)}}),[b]),o.useEffect((()=>{if(d){const e=document.getElementById(d),t=b.current;if(t&&e){const r=a(t,e),o=()=>e.getAttribute("aria-labelledby"),n=[o(),p].filter(Boolean).join(" ");return e.setAttribute("aria-labelledby",n),()=>{var t;r();const n=null===(t=o())||void 0===t?void 0:t.replace(p,"");""===n?e.removeAttribute("aria-labelledby"):n&&e.setAttribute("aria-labelledby",n)}}}}),[p,d]),/*#__PURE__*/o.createElement(l.Provider,{value:o.useMemo((()=>({id:p,ref:b})),[p])},/*#__PURE__*/o.createElement(t,n({role:"label",id:p},m,{as:u,ref:v})))}));/*#__PURE__*/export const useLabelContext=e=>{const t=o.useContext(l);return o.useEffect((()=>{const r=null==t?void 0:t.ref.current,o=null==e?void 0:e.current;if(r&&o)return a(r,o)}),[t,e]),null==t?void 0:t.id};function a(e,t){const r=e=>{t.contains(e.target)||(t.click(),t.focus())};return e.addEventListener("click",r),()=>e.removeEventListener("click",r)}export const Root=Label;
//# sourceMappingURL=index.module.js.map
{
"name": "@radix-ui/react-label",
"version": "0.0.10",
"version": "0.0.11",
"license": "MIT",

@@ -21,6 +21,6 @@ "source": "src/index.ts",

"@babel/runtime": "^7.13.10",
"@radix-ui/react-compose-refs": "0.0.4",
"@radix-ui/react-id": "0.0.4",
"@radix-ui/react-polymorphic": "0.0.9",
"@radix-ui/react-primitive": "0.0.10"
"@radix-ui/react-compose-refs": "0.0.5",
"@radix-ui/react-id": "0.0.5",
"@radix-ui/react-polymorphic": "0.0.10",
"@radix-ui/react-primitive": "0.0.11"
},

@@ -27,0 +27,0 @@ "peerDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc