UNPKG

@ariakit/react-core

Version:

Ariakit React core

53 lines (40 loc) 1.67 kB
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _IOFHSY3Lcjs = require('../__chunks/IOFHSY3L.cjs'); require('../__chunks/7X7JMIHX.cjs'); require('../__chunks/WDV6EJ2U.cjs'); require('../__chunks/VFNUZFXS.cjs'); require('../__chunks/EOGOO37X.cjs'); var _RDNUVX4Vcjs = require('../__chunks/RDNUVX4V.cjs'); require('../__chunks/ZYZTL3IQ.cjs'); var _SQLDFLTEcjs = require('../__chunks/SQLDFLTE.cjs'); require('../__chunks/4KGS3DOW.cjs'); require('../__chunks/TWX5YNTH.cjs'); // src/combobox/combobox-label.tsx var _misc = require('@ariakit/core/utils/misc'); var TagName = "label"; var useComboboxLabel = _SQLDFLTEcjs.createHook.call(void 0, function useComboboxLabel2({ store, ...props }) { const context = _IOFHSY3Lcjs.useComboboxProviderContext.call(void 0, ); store = store || context; _misc.invariant.call(void 0, store, process.env.NODE_ENV !== "production" && "ComboboxLabel must receive a `store` prop or be wrapped in a ComboboxProvider component." ); const comboboxId = _RDNUVX4Vcjs.useStoreState.call(void 0, store, (state) => { var _a; return (_a = state.baseElement) == null ? void 0 : _a.id; }); props = { htmlFor: comboboxId, ...props }; return _misc.removeUndefinedValues.call(void 0, props); } ); var ComboboxLabel = _SQLDFLTEcjs.memo.call(void 0, _SQLDFLTEcjs.forwardRef.call(void 0, function ComboboxLabel2(props) { const htmlProps = useComboboxLabel(props); return _SQLDFLTEcjs.createElement.call(void 0, TagName, htmlProps); }) ); exports.ComboboxLabel = ComboboxLabel; exports.useComboboxLabel = useComboboxLabel;