{"version":3,"file":"index.mjs","sources":["../../../../../../packages/hooks/use-calc-input-width/index.ts"],"sourcesContent":["import { computed, ref, shallowRef } from 'vue'\nimport { useResizeObserver } from '@vueuse/core'\nimport { MINIMUM_INPUT_WIDTH } from '@hd-front-end/constants'\n\nexport function useCalcInputWidth() {\n  const calculatorRef = shallowRef<HTMLElement>()\n  const calculatorWidth = ref(0)\n\n  const inputStyle = computed(() => ({\n    minWidth: `${Math.max(calculatorWidth.value, MINIMUM_INPUT_WIDTH)}px`,\n  }))\n\n  const resetCalculatorWidth = () => {\n    calculatorWidth.value =\n      calculatorRef.value?.getBoundingClientRect().width ?? 0\n  }\n\n  useResizeObserver(calculatorRef, resetCalculatorWidth)\n\n  return {\n    calculatorRef,\n    calculatorWidth,\n    inputStyle,\n  }\n}\n"],"names":[],"mappings":";;;;AAIO,SAAS,iBAAoB,GAAA;AAClC,EAAA,MAAM,gBAAgB,UAAwB,EAAA,CAAA;AAC9C,EAAM,MAAA,eAAA,GAAkB,IAAI,CAAC,CAAA,CAAA;AAE7B,EAAM,MAAA,UAAA,GAAa,SAAS,OAAO;AAAA,IACjC,UAAU,CAAG,EAAA,IAAA,CAAK,GAAI,CAAA,eAAA,CAAgB,OAAO,mBAAmB,CAAA,CAAA,EAAA,CAAA;AAAA,GAChE,CAAA,CAAA,CAAA;AAEF,EAAA,MAAM,uBAAuB,MAAM;AAZrC,IAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AAaI,IAAA,eAAA,CAAgB,SACd,EAAc,GAAA,CAAA,EAAA,GAAA,aAAA,CAAA,KAAA,KAAd,IAAqB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,qBAAA,EAAA,CAAwB,UAA7C,IAAsD,GAAA,EAAA,GAAA,CAAA,CAAA;AAAA,GAC1D,CAAA;AAEA,EAAA,iBAAA,CAAkB,eAAe,oBAAoB,CAAA,CAAA;AAErD,EAAO,OAAA;AAAA,IACL,aAAA;AAAA,IACA,eAAA;AAAA,IACA,UAAA;AAAA,GACF,CAAA;AACF;;;;"}