UNPKG

@payfit/unity-components

Version:

132 lines (131 loc) 4.58 kB
import { Spinner as e } from "../../spinner/Spinner.js"; import { Button as t } from "../../button/Button.js"; import { Text as n } from "../../text/Text.js"; import { EmptyState as r } from "../../empty-state/EmptyState.js"; import { EmptyStateActions as i } from "../../empty-state/parts/EmptyStateActions.js"; import { EmptyStateContent as a } from "../../empty-state/parts/EmptyStateContent.js"; import { EmptyStateIcon as o } from "../../empty-state/parts/EmptyStateIcon.js"; import { forwardRef as s, useMemo as c } from "react"; import { uyTv as l } from "@payfit/unity-themes"; import { jsx as u, jsxs as d } from "react/jsx-runtime"; import { FormattedMessage as f, useIntl as p } from "react-intl"; //#region src/components/table/parts/TableEmptyState.tsx var m = l({ slots: { base: "uy:flex uy:flex-col uy:items-center uy:justify-center", wrapper: "uy:max-w-[300px] uy:flex uy:flex-col uy:items-center uy:py-800" } }), h = s((e, t) => { let { variant: r, children: i } = e; return /* @__PURE__ */ u(n, { variant: c(() => { switch (r) { case "title": return "bodyStrong"; default: return "body"; } }, [r]), asElement: c(() => { switch (r) { case "title": return "h6"; default: return "p"; } }, [r]), ref: t, className: "uy:text-center", children: i }); }); h.displayName = "TableEmptyStateText"; var g = s(({ children: e, className: t, ...n }, r) => { let { base: i, wrapper: a } = m(); return /* @__PURE__ */ u("div", { "data-dd-privacy": "allow", ...n, ref: r, className: i(), children: /* @__PURE__ */ u("div", { className: a({ className: t }), children: e }) }); }); g.displayName = "TableEmptyState"; var _ = () => /* @__PURE__ */ u(g, { children: /* @__PURE__ */ u(e, { size: "medium", label: p().formatMessage({ id: "unity:component:table:empty-state:loading:title" }) }) }), v = ({ description: e, onButtonPress: n }) => /* @__PURE__ */ d(r, { className: "uy:max-w-[524px] uy:h-[400px] uy:justify-self-center uy:p-300", children: [ /* @__PURE__ */ u(o, { icon: "InfoOutlined", variant: "neutral" }), /* @__PURE__ */ u(a, { title: /* @__PURE__ */ u(f, { id: "unity:component:empty-state:waiting-for-data:title", defaultMessage: "No available results yet" }), description: e }), n && /* @__PURE__ */ u(i, { children: /* @__PURE__ */ u(t, { variant: "ghost", onPress: n, children: /* @__PURE__ */ u(f, { id: "unity:component:empty-state:waiting-for-data:button-label", defaultMessage: "Enable settings" }) }) }) ] }), y = ({ onButtonPress: e }) => /* @__PURE__ */ d(r, { className: "uy:max-w-[524px] uy:h-[400px] uy:justify-self-center uy:p-300", children: [ /* @__PURE__ */ u(o, { icon: "WarningCircleOutlined", variant: "neutral" }), /* @__PURE__ */ u(a, { title: /* @__PURE__ */ u(f, { id: "unity:component:error-state:common:main-title", defaultMessage: "Something went wrong" }), description: /* @__PURE__ */ u(f, { id: "unity:component:error-state:common:main-description-component", defaultMessage: "Please refresh the page or check your connection. We’ve been notified of the issue and are working to resolve it as quickly as possible." }) }), e && /* @__PURE__ */ u(i, { children: /* @__PURE__ */ u(t, { variant: "ghost", onPress: e, children: /* @__PURE__ */ u(f, { id: "unity:component:error-state:button:label", defaultMessage: "Go to dashboard" }) }) }) ] }), b = ({ onButtonPress: e }) => /* @__PURE__ */ d(r, { className: "uy:max-w-[524px] uy:h-[400px] uy:justify-self-center uy:p-300", children: [ /* @__PURE__ */ u(o, { icon: "MagnifyingGlassOutlined", variant: "neutral" }), /* @__PURE__ */ u(a, { title: /* @__PURE__ */ u(f, { id: "unity:component:empty-state:no-search-results:title", defaultMessage: "We didn't find any results" }), description: /* @__PURE__ */ u(f, { id: "unity:component:empty-state:no-search-results:description", defaultMessage: "Try adjusting your search or filters to find what you're looking for." }) }), e && /* @__PURE__ */ u(i, { children: /* @__PURE__ */ u(t, { variant: "ghost", onPress: e, children: /* @__PURE__ */ u(f, { id: "unity:component:empty-state:no-search-results:button-label", defaultMessage: "Reset filters" }) }) }) ] }); //#endregion export { g as TableEmptyState, y as TableEmptyStateError, _ as TableEmptyStateLoading, v as TableEmptyStateNoData, h as TableEmptyStateText, b as TableNoSearchResults, m as tableEmptyState };