"use strict";const g=require("./tslib.es6-C4EgNkz1.js"),a=require("react"),t=require("classnames"),s=require("makeup-floating-label"),{default:E=s}=s?.default?.__esModule?s.default:s;function y({text:n,disabled:_,invalid:m,size:N,opaqueLabel:C,static:i,containerTagName:L="span",onMount:d=()=>{}}){const r=a.useRef(null),c=a.useRef(null);a.useLayoutEffect(()=>{var e;(e=c.current)===null||e===void 0||e.refresh()}),a.useLayoutEffect(()=>{if(!(!n||i))return r.current&&(c.current=new E(r.current),d()),()=>{var e;(e=c.current)===null||e===void 0||e.destroy()}},[n,i]);const b=t("floating-label",{"floating-label--large":N==="large","floating-label--opaque":C}),v=a.useCallback(({children:e})=>a.createElement(a.Fragment,null,e),[]),p=a.useCallback(a.forwardRef((e,l)=>{var{className:o}=e,q=g.__rest(e,["className"]);return a.createElement(L,Object.assign({},q,{ref:u=>{r.current=u,typeof l=="function"?l(u):l&&(l.current=u)},className:t(o,b)}))}),[b]),f=t("floating-label__label",{"floating-label__label--disabled":_,"floating-label__label--invalid":m}),F=a.useCallback(e=>{var{className:l}=e,o=g.__rest(e,["className"]);return a.createElement("label",Object.assign({},o,{className:t(l,f)}),n)},[f,n]);return n?{Label:F,Container:p}:{Label:()=>null,Container:v}}exports.useFloatingLabel=y;
