Files

2 lines
1007 B
JavaScript

"use client";import e from"react";import{useId as T}from'../../hooks/use-id.js';import{useSlot as P}from'../../hooks/use-slot.js';import{DisabledProvider as y,useDisabled as u}from'../../internal/disabled.js';import{FormFieldsProvider as D}from'../../internal/form-fields.js';import{IdProvider as v}from'../../internal/id.js';import{forwardRefWithAs as b,useRender as E}from'../../utils/render.js';import{useDescriptions as A}from'../description/description.js';import{useLabels as L}from'../label/label.js';let _="div";function c(d,l){let t=`headlessui-control-${T()}`,[p,n]=L(),[s,a]=A(),m=u(),{disabled:r=m||!1,...o}=d,i=P({disabled:r}),f={ref:l,disabled:r||void 0,"aria-disabled":r||void 0},F=E();return e.createElement(y,{value:r},e.createElement(n,{value:p},e.createElement(a,{value:s},e.createElement(v,{id:t},F({ourProps:f,theirProps:{...o,children:e.createElement(D,null,typeof o.children=="function"?o.children(i):o.children)},slot:i,defaultTag:_,name:"Field"})))))}let W=b(c);export{W as Field};