UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

1 lines 874 B
{"version":3,"file":"get-options-lockup.mjs","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;AAC1C,QAAO,QAAQ,QAA6C,KAAK,SAAS;AACxE,MAAI,WAAW,KACb,QAAO;GAAE,GAAG;GAAK,GAAG,iBAAiB,KAAK,MAAM;GAAE;AAGpD,MAAI,GAAG,KAAK,WAAW;AAEvB,SAAO;IACN,EAAE,CAAC"}