{"version":3,"sources":["../src/components/Select/useSelect.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useSelectBase_unstable } from '@fluentui/react-select';\nimport type { SelectProps, SelectState } from './Select.types';\nimport { stringifyDataAttribute } from '../../utils';\n\n/**\n * Create the state required to render Select.\n *\n * The returned state can be modified with hooks,\n * before being passed to renderSelect.\n *\n * @param props - props from this instance of Select\n * @param ref - reference to root HTMLSelectElement\n */\nexport const useSelect = (props: SelectProps, ref: React.Ref<HTMLSelectElement>): SelectState => {\n  const state: SelectState = useSelectBase_unstable(props, ref);\n\n  // Set data attribute for disabled state to simplify styling.\n  // eslint-disable-next-line react-hooks/immutability\n  state.root['data-disabled'] = stringifyDataAttribute(state.select.disabled);\n  // eslint-disable-next-line react-hooks/immutability\n  state.root['data-invalid'] = stringifyDataAttribute(\n    state.select['aria-invalid'] === true || state.select['aria-invalid'] === 'true',\n  );\n\n  return state;\n};\n"],"names":["useSelect","props","ref","state","useSelectBase_unstable","root","stringifyDataAttribute","select","disabled"],"mappings":"AAAA;;;;;+BAgBaA;;;eAAAA;;;6BAb0B;uBAEA;AAWhC,MAAMA,YAAY,CAACC,OAAoBC;IAC5C,MAAMC,QAAqBC,IAAAA,mCAAsB,EAACH,OAAOC;IAEzD,6DAA6D;IAC7D,oDAAoD;IACpDC,MAAME,IAAI,CAAC,gBAAgB,GAAGC,IAAAA,6BAAsB,EAACH,MAAMI,MAAM,CAACC,QAAQ;IAC1E,oDAAoD;IACpDL,MAAME,IAAI,CAAC,eAAe,GAAGC,IAAAA,6BAAsB,EACjDH,MAAMI,MAAM,CAAC,eAAe,KAAK,QAAQJ,MAAMI,MAAM,CAAC,eAAe,KAAK;IAG5E,OAAOJ;AACT"}