UNPKG

@esri/calcite-components

Version:

Web Components for Esri's Calcite Design System.

18 lines (17 loc) 1.32 kB
/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. * v1.5.0-next.4 */ import { h, Host } from "@stencil/core"; import { toAriaBoolean } from "../../utils/dom"; import { CSS, SLOTS } from "./resources"; export const List = ({ props: { disabled, loading, filterEnabled, dataForFilter, handleFilterEvent, filterPlaceholder, filterText, setFilterEl, dragEnabled, storeAssistiveEl }, ...rest }) => { const defaultSlot = h("slot", null); return (h(Host, { "aria-busy": toAriaBoolean(loading), role: "menu", ...rest }, h("section", null, dragEnabled ? (h("span", { "aria-live": "assertive", class: "assistive-text", // eslint-disable-next-line react/jsx-sort-props ref: storeAssistiveEl })) : null, h("header", { class: { [CSS.sticky]: true } }, filterEnabled ? (h("calcite-filter", { "aria-label": filterPlaceholder, disabled: loading || disabled, items: dataForFilter, onCalciteFilterChange: handleFilterEvent, placeholder: filterPlaceholder, value: filterText, // eslint-disable-next-line react/jsx-sort-props ref: setFilterEl })) : null, h("slot", { name: SLOTS.menuActions })), loading ? h("calcite-scrim", { loading: loading }) : null, defaultSlot))); }; export default List;