{"version":3,"sources":["../../../src/components/RangeSlider/useRangeSlider.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useRangeSliderBase_unstable } from '@fluentui/react-range-slider-preview';\n\nimport type { RangeSliderProps, RangeSliderState } from './RangeSlider.types';\nimport { toDataAttributeValue } from '../../utils';\n\n/**\n * Returns the state for a RangeSlider component, given its props and ref.\n * The returned state can be modified with hooks before being passed to `renderRangeSlider`.\n */\nexport const useRangeSlider = (props: RangeSliderProps, ref: React.Ref<HTMLDivElement>): RangeSliderState => {\n  const state: RangeSliderState = useRangeSliderBase_unstable(props, ref);\n\n  // Set data attributes after the base hook resolves consumer slot props, so they always reflect the real state.\n  /* eslint-disable react-hooks/immutability */\n  state.root['data-disabled'] = toDataAttributeValue(state.disabled);\n  state.root['data-vertical'] = toDataAttributeValue(state.vertical);\n  state.startThumb['data-disabled'] = toDataAttributeValue(state.startDisabled);\n  state.startThumb['data-active'] = toDataAttributeValue(state.activeThumb === 'start');\n  state.endThumb['data-disabled'] = toDataAttributeValue(state.endDisabled);\n  state.endThumb['data-active'] = toDataAttributeValue(state.activeThumb === 'end');\n  /* eslint-enable react-hooks/immutability */\n\n  return state;\n};\n"],"names":["useRangeSlider","props","ref","state","useRangeSliderBase_unstable","root","toDataAttributeValue","disabled","vertical","startThumb","startDisabled","activeThumb","endThumb","endDisabled"],"mappings":"AAAA;;;;;+BAYaA;;;eAAAA;;;yCAT+B;uBAGP;AAM9B,MAAMA,iBAAiB,CAACC,OAAyBC;IACtD,MAAMC,QAA0BC,IAAAA,oDAA2B,EAACH,OAAOC;IAEnE,+GAA+G;IAC/G,2CAA2C,GAC3CC,MAAME,IAAI,CAAC,gBAAgB,GAAGC,IAAAA,2BAAoB,EAACH,MAAMI,QAAQ;IACjEJ,MAAME,IAAI,CAAC,gBAAgB,GAAGC,IAAAA,2BAAoB,EAACH,MAAMK,QAAQ;IACjEL,MAAMM,UAAU,CAAC,gBAAgB,GAAGH,IAAAA,2BAAoB,EAACH,MAAMO,aAAa;IAC5EP,MAAMM,UAAU,CAAC,cAAc,GAAGH,IAAAA,2BAAoB,EAACH,MAAMQ,WAAW,KAAK;IAC7ER,MAAMS,QAAQ,CAAC,gBAAgB,GAAGN,IAAAA,2BAAoB,EAACH,MAAMU,WAAW;IACxEV,MAAMS,QAAQ,CAAC,cAAc,GAAGN,IAAAA,2BAAoB,EAACH,MAAMQ,WAAW,KAAK;IAC3E,0CAA0C,GAE1C,OAAOR;AACT"}