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.9 to 0.0.10

2

dist/index.js

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

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

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

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

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

"@babel/runtime": "^7.13.10",
"@radix-ui/react-compose-refs": "0.0.3",
"@radix-ui/react-id": "0.0.3",
"@radix-ui/react-polymorphic": "0.0.8",
"@radix-ui/react-primitive": "0.0.9"
"@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"
},

@@ -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