@mantine/spotlight
Version:
Command center components for react and Mantine
1 lines • 2.56 kB
Source Map (JSON)
{"version":3,"file":"SpotlightActionsList.cjs","names":["useSpotlightContext","spotlightActions","ScrollArea","classes"],"sources":["../src/SpotlightActionsList.tsx"],"sourcesContent":["import { useEffect, useId } from 'react';\nimport {\n BoxProps,\n CompoundStylesApiProps,\n ElementProps,\n factory,\n Factory,\n ScrollArea,\n useProps,\n} from '@mantine/core';\nimport { useSpotlightContext } from './Spotlight.context';\nimport { spotlightActions } from './spotlight.store';\nimport classes from './Spotlight.module.css';\n\nexport type SpotlightActionsListStylesNames = 'actionsList' | 'actionsListInner';\n\nexport interface SpotlightActionsListProps\n extends BoxProps, CompoundStylesApiProps<SpotlightActionsListFactory>, ElementProps<'div'> {}\n\nexport type SpotlightActionsListFactory = Factory<{\n props: SpotlightActionsListProps;\n ref: HTMLDivElement;\n stylesNames: SpotlightActionsListStylesNames;\n compound: true;\n}>;\n\nexport const SpotlightActionsList = factory<SpotlightActionsListFactory>((props) => {\n const { className, style, id, children, vars, classNames, styles, ...others } = useProps(\n 'SpotlightActionsList',\n null,\n props\n );\n const ctx = useSpotlightContext();\n const generatedId = `mantine-${useId().replace(/:/g, '')}`;\n const listId = id || generatedId;\n\n useEffect(() => {\n spotlightActions.setListId(listId, ctx.store);\n return () => spotlightActions.setListId('', ctx.store);\n }, []);\n\n return (\n <ScrollArea.Autosize\n {...ctx.getStyles('actionsList', { className, style, classNames, styles })}\n type=\"scroll\"\n scrollbarSize=\"var(--spotlight-actions-list-padding)\"\n offsetScrollbars=\"y\"\n id={listId}\n {...others}\n >\n {children}\n </ScrollArea.Autosize>\n );\n});\n\nSpotlightActionsList.classes = classes;\nSpotlightActionsList.displayName = '@mantine/spotlight/SpotlightActionsList';\n"],"mappings":";;;;;;;;AA0BA,MAAa,wBAAA,GAAA,cAAA,UAA6D,UAAU;CAClF,MAAM,EAAE,WAAW,OAAO,IAAI,UAAU,MAAM,YAAY,QAAQ,GAAG,YAAA,GAAA,cAAA,UACnE,wBACA,MACA,KACF;CACA,MAAM,MAAMA,0BAAAA,oBAAoB;CAChC,MAAM,cAAc,YAAA,GAAA,MAAA,OAAiB,EAAE,QAAQ,MAAM,EAAE;CACvD,MAAM,SAAS,MAAM;CAErB,CAAA,GAAA,MAAA,iBAAgB;EACd,wBAAA,iBAAiB,UAAU,QAAQ,IAAI,KAAK;EAC5C,aAAaC,wBAAAA,iBAAiB,UAAU,IAAI,IAAI,KAAK;CACvD,GAAG,CAAC,CAAC;CAEL,OACE,iBAAA,GAAA,kBAAA,KAACC,cAAAA,WAAW,UAAZ;EACE,GAAI,IAAI,UAAU,eAAe;GAAE;GAAW;GAAO;GAAY;EAAO,CAAC;EACzE,MAAK;EACL,eAAc;EACd,kBAAiB;EACjB,IAAI;EACJ,GAAI;EAEH;CACkB,CAAA;AAEzB,CAAC;AAED,qBAAqB,UAAUC,yBAAAA;AAC/B,qBAAqB,cAAc"}