@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
1 lines • 884 B
Source Map (JSON)
{"version":3,"file":"get-options-lockup.cjs","names":[],"sources":["../../../../src/components/Combobox/get-options-lockup/get-options-lockup.ts"],"sourcesContent":["import { Primitive } from '../../../core';\nimport { ComboboxItem, ComboboxParsedItem } from '../Combobox.types';\n\nexport function getOptionsLockup<Value extends Primitive = string>(\n options: ComboboxParsedItem<Value>[]\n): Record<PropertyKey, ComboboxItem<Value>> {\n return options.reduce<Record<string, ComboboxItem<Value>>>((acc, item) => {\n if ('group' in item) {\n return { ...acc, ...getOptionsLockup(item.items) };\n }\n\n acc[`${item.value}`] = item;\n\n return acc;\n }, {});\n}\n"],"mappings":";;AAGA,SAAgB,iBACd,SAC0C;CAC1C,OAAO,QAAQ,QAA6C,KAAK,SAAS;EACxE,IAAI,WAAW,MACb,OAAO;GAAE,GAAG;GAAK,GAAG,iBAAiB,KAAK,KAAK;EAAE;EAGnD,IAAI,GAAG,KAAK,WAAW;EAEvB,OAAO;CACT,GAAG,CAAC,CAAC;AACP"}