UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

1 lines 1.75 kB
{"version":3,"file":"ComboboxDropdown.mjs","names":["classes"],"sources":["../../../../src/components/Combobox/ComboboxDropdown/ComboboxDropdown.tsx"],"sourcesContent":["import { factory, Factory, useProps } from '../../../core';\nimport { Popover, PopoverDropdownProps } from '../../Popover';\nimport { useComboboxContext } from '../Combobox.context';\nimport classes from '../Combobox.module.css';\n\nexport type ComboboxDropdownStylesNames = 'dropdown';\n\nexport interface ComboboxDropdownProps extends PopoverDropdownProps {\n /** Determines whether the dropdown should be hidden, for example, when there are no options to display */\n hidden?: boolean;\n}\n\nexport type ComboboxDropdownFactory = Factory<{\n props: ComboboxDropdownProps;\n ref: HTMLDivElement;\n stylesNames: ComboboxDropdownStylesNames;\n compound: true;\n}>;\n\nexport const ComboboxDropdown = factory<ComboboxDropdownFactory>((props) => {\n const { classNames, styles, className, style, hidden, ...others } = useProps(\n 'ComboboxDropdown',\n null,\n props\n );\n\n const ctx = useComboboxContext();\n\n return (\n <Popover.Dropdown\n {...others}\n role=\"presentation\"\n data-hidden={hidden || undefined}\n {...ctx.getStyles('dropdown', { className, style, classNames, styles })}\n />\n );\n});\n\nComboboxDropdown.classes = classes;\nComboboxDropdown.displayName = '@mantine/core/ComboboxDropdown';\n"],"mappings":";;;;;;;;AAmBA,MAAa,mBAAmB,SAAkC,UAAU;CAC1E,MAAM,EAAE,YAAY,QAAQ,WAAW,OAAO,QAAQ,GAAG,WAAW,SAClE,oBACA,MACA,MACD;CAED,MAAM,MAAM,oBAAoB;AAEhC,QACE,oBAAC,QAAQ,UAAT;EACE,GAAI;EACJ,MAAK;EACL,eAAa,UAAU,KAAA;EACvB,GAAI,IAAI,UAAU,YAAY;GAAE;GAAW;GAAO;GAAY;GAAQ,CAAC;EACvE,CAAA;EAEJ;AAEF,iBAAiB,UAAUA;AAC3B,iBAAiB,cAAc"}