@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
1 lines • 1.2 kB
Source Map (JSON)
{"version":3,"file":"get-input-offsets.cjs","names":[],"sources":["../../../../../src/components/Input/InputWrapper/get-input-offsets/get-input-offsets.ts"],"sourcesContent":["export function getInputOffsets(\n inputWrapperOrder: ('label' | 'input' | 'description' | 'error')[],\n { hasDescription, hasError }: { hasDescription: boolean; hasError: boolean }\n) {\n const inputIndex = inputWrapperOrder.findIndex((part) => part === 'input');\n const aboveInput = inputWrapperOrder.slice(0, inputIndex);\n const belowInput = inputWrapperOrder.slice(inputIndex + 1);\n const offsetTop =\n (hasDescription && aboveInput.includes('description')) ||\n (hasError && aboveInput.includes('error'));\n const offsetBottom =\n (hasDescription && belowInput.includes('description')) ||\n (hasError && belowInput.includes('error'));\n return { offsetBottom, offsetTop };\n}\n"],"mappings":";;AAAA,SAAgB,gBACd,mBACA,EAAE,gBAAgB,YAClB;CACA,MAAM,aAAa,kBAAkB,WAAW,SAAS,SAAS,QAAQ;CAC1E,MAAM,aAAa,kBAAkB,MAAM,GAAG,WAAW;CACzD,MAAM,aAAa,kBAAkB,MAAM,aAAa,EAAE;CAC1D,MAAM,YACH,kBAAkB,WAAW,SAAS,cAAc,IACpD,YAAY,WAAW,SAAS,QAAQ;AAI3C,QAAO;EAAE,cAFN,kBAAkB,WAAW,SAAS,cAAc,IACpD,YAAY,WAAW,SAAS,QAAQ;EACpB;EAAW"}