PageSourceSearch

https://leanpub.com/assets/label-CW7CKBMv.js

js leanpub.com collected 2026-09-24 08:26:26 UTC 2,884 bytes, 5 lines download raw bytes

1
2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="00e2c89d-89da-57d8-979c-3a035a9eec13")}catch(e){}}();
3import{r as n,W as y}from"./vendor-react-qLnyzkeB.js";import{Y as L,c as x,y as S,n as F,b as j,K as P,L as A,m as k,l as B}from"./use-sync-refs-BjU-iZ6Q.js";import{a as N}from"./description-CIZ8nWpB.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"13978386027a4a2683cfa43e79422df47742043f"}}catch{}})();let E=n.createContext(void 0);function Y(){return n.useContext(E)}function K({id:t,children:l}){return y.createElement(E.Provider,{value:t},l)}let b=n.createContext(null);b.displayName="LabelContext";function T(){let t=n.useContext(b);if(t===null){let l=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(l,T),l}return t}function I(t){var l,i,a;let e=(i=(l=n.useContext(b))==null?void 0:l.value)!=null?i:void 0;return((a=t==null?void 0:t.length)!=null?a:0)>0?[e,...t].filter(Boolean).join(" "):e}function U({inherit:t=!1}={}){let l=I(),[i,a]=n.useState([]),e=t?[l,...i].filter(Boolean):i;return[e.length>0?e.join(" "):void 0,n.useMemo(()=>function(r){let p=x(d=>(a(f=>[...f,d]),()=>a(f=>{let u=f.slice(),m=u.indexOf(d);return m!==-1&&u.splice(m,1),u}))),s=n.useMemo(()=>({register:p,slot:r.slot,name:r.name,props:r.props,value:r.value}),[p,r.slot,r.name,r.props,r.value]);return y.createElement(b.Provider,{value:s},r.children)},[a])]}let M="label";function O(t,l){var i;let a=n.useId(),e=T(),r=Y(),p=N(),{id:s=`headlessui-label-${a}`,htmlFor:d=r??((i=e.props)==null?void 0:i.htmlFor),passive:f=!1,...u}=t,m=S(l);F(()=>e.register(s),[s,e.register]);let $=x(c=>{let g=c.currentTarget;if(!(c.target!==c.currentTarget&&A(c.target))&&(k(g)&&c.preventDefault(),e.props&&"onClick"in e.props&&typeof e.props.onClick=="function"&&e.props.onClick(c),k(g))){let o=document.getElementById(g.htmlFor);if(o){let h=o.getAttribute("disabled");if(h==="true"||h==="")return;let C=o.getAttribute("aria-disabled");if(C==="true"||C==="")return;(B(o)&&(o.type==="file"||o.type==="radio"||o.type==="checkbox")||o.role==="radio"||o.role==="checkbox"||o.role==="switch")&&o.click(),o.focus({preventScroll:!0})}}}),w=j({...e.slot,disabled:p||!1}),v={ref:m,...e.props,id:s,htmlFor:d,onClick:$};return f&&("onClick"in v&&(delete v.htmlFor,delete v.onClick),"onClick"in u&&delete u.onClick),P()({ourProps:v,theirProps:u,slot:w,defaultTag:d?M:"div",name:e.name||"Label"})}let R=L(O),V=Object.assign(R,{});export{T as C,I as N,U as V,V as Z,K as f,Y as u};
4
5//# debugId=00e2c89d-89da-57d8-979c-3a035a9eec13

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.