@payfit/unity-components
Version:
135 lines (134 loc) • 4.3 kB
JavaScript
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 { EmptyStateIcon as i } from "../../empty-state/parts/EmptyStateIcon.js";
import { EmptyStateContent as a } from "../../empty-state/parts/EmptyStateContent.js";
import { EmptyStateActions as o } from "../../empty-state/parts/EmptyStateActions.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 { Trans as f, useTranslation as p } from "react-i18next";
//#region src/core/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 _ = () => {
let { t } = p("unity");
return /* @__PURE__ */ u(g, { children: /* @__PURE__ */ u(e, {
size: "medium",
label: t((e) => e.unity.component.table.emptyState.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(i, {
icon: "InfoOutlined",
variant: "neutral"
}),
/* @__PURE__ */ u(a, {
title: /* @__PURE__ */ u(f, {
ns: "unity",
i18nKey: (e) => e.unity.component.emptyState.waitingForData.title
}),
description: e
}),
n && /* @__PURE__ */ u(o, { children: /* @__PURE__ */ u(t, {
variant: "ghost",
onPress: n,
children: /* @__PURE__ */ u(f, {
ns: "unity",
i18nKey: (e) => e.unity.component.emptyState.waitingForData.buttonLabel
})
}) })
]
}), y = ({ onButtonPress: e }) => /* @__PURE__ */ d(r, {
className: "uy:max-w-[524px] uy:h-[400px] uy:justify-self-center uy:p-300",
children: [
/* @__PURE__ */ u(i, {
icon: "WarningCircleOutlined",
variant: "neutral"
}),
/* @__PURE__ */ u(a, {
title: /* @__PURE__ */ u(f, {
ns: "unity",
i18nKey: (e) => e.unity.component.errorState.common.mainTitle
}),
description: /* @__PURE__ */ u(f, {
ns: "unity",
i18nKey: (e) => e.unity.component.errorState.common.mainDescriptionComponent
})
}),
e && /* @__PURE__ */ u(o, { children: /* @__PURE__ */ u(t, {
variant: "ghost",
onPress: e,
children: /* @__PURE__ */ u(f, {
ns: "unity",
i18nKey: (e) => e.unity.component.errorState.button.label
})
}) })
]
}), b = ({ onButtonPress: e }) => /* @__PURE__ */ d(r, {
className: "uy:max-w-[524px] uy:h-[400px] uy:justify-self-center uy:p-300",
children: [
/* @__PURE__ */ u(i, {
icon: "MagnifyingGlassOutlined",
variant: "neutral"
}),
/* @__PURE__ */ u(a, {
title: /* @__PURE__ */ u(f, {
ns: "unity",
i18nKey: (e) => e.unity.component.emptyState.noSearchResults.title
}),
description: /* @__PURE__ */ u(f, {
ns: "unity",
i18nKey: (e) => e.unity.component.emptyState.noSearchResults.description
})
}),
e && /* @__PURE__ */ u(o, { children: /* @__PURE__ */ u(t, {
variant: "ghost",
onPress: e,
children: /* @__PURE__ */ u(f, {
ns: "unity",
i18nKey: (e) => e.unity.component.emptyState.noSearchResults.buttonLabel
})
}) })
]
});
//#endregion
export { g as TableEmptyState, y as TableEmptyStateError, _ as TableEmptyStateLoading, v as TableEmptyStateNoData, h as TableEmptyStateText, b as TableNoSearchResults, m as tableEmptyState };