{"version":3,"sources":["../../../src/components/SwatchPicker/useSwatchPicker.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useSwatchPickerBase_unstable } from '@fluentui/react-swatch-picker';\nimport type { SwatchPickerProps, SwatchPickerState } from './SwatchPicker.types';\n\nexport {\n  useSwatchPickerContextValues,\n  useSwatchPickerContextValue_unstable as useSwatchPickerContextValue,\n} from '@fluentui/react-swatch-picker';\n\nexport const useSwatchPicker = (props: SwatchPickerProps, ref: React.Ref<HTMLDivElement>): SwatchPickerState => {\n  const { focusMode = 'arrow', layout = 'row' } = props;\n\n  const baseState: SwatchPickerState = useSwatchPickerBase_unstable(props, ref);\n\n  // eslint-disable-next-line react-hooks/immutability\n  baseState.root['data-layout'] = layout;\n\n  if (focusMode === 'arrow') {\n    const behavior = baseState.isGrid ? 'grid manual rowflow' : 'radiogroup';\n\n    // eslint-disable-next-line react-hooks/immutability\n    baseState.root.focusgroup = baseState.selectedValue ? `${behavior} nomemory` : behavior;\n  }\n\n  return baseState;\n};\n"],"names":["useSwatchPicker","useSwatchPickerContextValue","useSwatchPickerContextValue_unstable","useSwatchPickerContextValues","props","ref","focusMode","layout","baseState","useSwatchPickerBase_unstable","root","behavior","isGrid","focusgroup","selectedValue"],"mappings":"AAAA;;;;;;;;;;;;QAWaA;eAAAA;;QAH6BC;eAAxCC,uDAAoC;;QADpCC;eAAAA,+CAA4B;;;mCAJe;AAQtC,MAAMH,kBAAkB,CAACI,OAA0BC;IACxD,MAAM,EAAEC,YAAY,OAAO,EAAEC,SAAS,KAAK,EAAE,GAAGH;IAEhD,MAAMI,YAA+BC,IAAAA,+CAA4B,EAACL,OAAOC;IAEzE,oDAAoD;IACpDG,UAAUE,IAAI,CAAC,cAAc,GAAGH;IAEhC,IAAID,cAAc,SAAS;QACzB,MAAMK,WAAWH,UAAUI,MAAM,GAAG,wBAAwB;QAE5D,oDAAoD;QACpDJ,UAAUE,IAAI,CAACG,UAAU,GAAGL,UAAUM,aAAa,GAAG,GAAGH,SAAS,SAAS,CAAC,GAAGA;IACjF;IAEA,OAAOH;AACT"}