UNPKG

@eristack/list-shell

Version:

Presentational list page layout, toolbar, and TanStack Query state banners

76 lines (72 loc) • 3.3 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/index.ts var index_exports = {}; __export(index_exports, { ListPageLayout: () => ListPageLayout, ListToolbar: () => ListToolbar, QueryStateBanner: () => QueryStateBanner }); module.exports = __toCommonJS(index_exports); // src/list-page-layout.tsx var import_jsx_runtime = require("react/jsx-runtime"); function ListPageLayout({ toolbar, banner, children }) { return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "erista-list-page", "data-component": "list-page-layout", children: [ toolbar ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "erista-list-page__toolbar", children: toolbar }) : null, banner ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "erista-list-page__banner", children: banner }) : null, /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "erista-list-page__body", children }) ] }); } // src/list-toolbar.tsx var import_jsx_runtime2 = require("react/jsx-runtime"); function ListToolbar({ leading, trailing, children }) { return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "erista-list-toolbar", "data-component": "list-toolbar", children: [ leading ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "erista-list-toolbar__leading", children: leading }) : null, children ?? null, trailing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "erista-list-toolbar__trailing", children: trailing }) : null ] }); } // src/query-state-banner.tsx var import_jsx_runtime3 = require("react/jsx-runtime"); function QueryStateBanner({ isLoading, isError, isEmpty, loadingMessage = "Loading\u2026", errorMessage = "Something went wrong.", emptyMessage = "No results." }) { if (isLoading) { return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "erista-query-banner", "data-state": "loading", role: "status", children: loadingMessage }); } if (isError) { return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "erista-query-banner", "data-state": "error", role: "alert", children: errorMessage }); } if (isEmpty) { return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "erista-query-banner", "data-state": "empty", children: emptyMessage }); } return null; } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { ListPageLayout, ListToolbar, QueryStateBanner }); //# sourceMappingURL=index.cjs.map