UNPKG

@empoleon/spotlight

Version:

Command center components for react and Empoleon

45 lines (42 loc) 1.69 kB
import { createComponent, mergeProps } from 'solid-js/web'; import { factory, useProps, ScrollArea } from '@empoleon/core'; import { useSpotlightContext } from './Spotlight.context.mjs'; import { spotlightActions } from './spotlight.store.mjs'; import classes from './Spotlight.module.css.mjs'; import { splitProps, createEffect } from 'solid-js'; import { useId } from '@empoleon/hooks'; const defaultProps = {}; const SpotlightActionsList = factory(_props => { const props = useProps("SpotlightActionsList", defaultProps, _props); const [local, others] = splitProps(props, ["className", "style", "id", "children", "vars", "classNames", "styles", "ref"]); const ctx = useSpotlightContext(); const generatedId = `empoleon-${useId().replace(/:/g, "")}`; const listId = local.id || generatedId; createEffect(() => { spotlightActions.setListId(listId, ctx.store); return () => spotlightActions.setListId("", ctx.store); }, []); return createComponent(ScrollArea.Autosize, mergeProps(() => ctx.getStyles("actionsList", { className: local.className, style: local.style, classNames: local.classNames, styles: local.styles }), { ref(r$) { var _ref$ = local.ref; typeof _ref$ === "function" ? _ref$(r$) : local.ref = r$; }, type: "scroll", scrollbarSize: "var(--spotlight-actions-list-padding)", offsetScrollbars: "y", id: listId }, others, { get children() { return local.children; } })); }); SpotlightActionsList.classes = classes; SpotlightActionsList.displayName = "@empoleon/spotlight/SpotlightActionsList"; export { SpotlightActionsList }; //# sourceMappingURL=SpotlightActionsList.mjs.map