@axzydev/axzy_ui_system 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +99 -88
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +99 -88
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/layout/layout.tsx +2 -1
- package/src/components/page/page.props.ts +2 -0
- package/src/components/page/page.tsx +52 -47
- package/src/components/page-header/page-header.tsx +1 -2
- package/src/components/text/text.tsx +1 -1
- package/src/dev.css +2 -0
- package/src/main.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
|
+
import clsx from "clsx";
|
|
2
3
|
import ITTopBar from "../topbar/topbar";
|
|
3
4
|
import ITSidebar from "../sidebar/sidebar";
|
|
4
5
|
import { ITLayoutProps } from "./layout.props";
|
|
@@ -69,7 +70,7 @@ export default function ITLayout({
|
|
|
69
70
|
|
|
70
71
|
{/* MAIN CONTENT AREA */}
|
|
71
72
|
<main className="flex-1 overflow-y-auto w-full custom-scrollbar relative z-0">
|
|
72
|
-
<div className={
|
|
73
|
+
<div className={clsx("mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8 py-6 h-full", contentClassName)}>
|
|
73
74
|
{children}
|
|
74
75
|
</div>
|
|
75
76
|
</main>
|
|
@@ -6,51 +6,66 @@ import ITEmptyState from "../empty-state/empty-state";
|
|
|
6
6
|
import ITButton from "../button/button";
|
|
7
7
|
import ITStack from "../stack/stack";
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
title
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
9
|
+
const hasHeader = (props: ITPageProps) =>
|
|
10
|
+
!!(props.title || props.description || props.breadcrumbs || props.actions || props.backAction);
|
|
11
|
+
|
|
12
|
+
const renderHeader = (props: ITPageProps) => {
|
|
13
|
+
if (!hasHeader(props)) return null;
|
|
14
|
+
return (
|
|
15
|
+
<ITPageHeader
|
|
16
|
+
title={props.title || ""}
|
|
17
|
+
description={props.description}
|
|
18
|
+
breadcrumbs={props.breadcrumbs}
|
|
19
|
+
actions={props.actions}
|
|
20
|
+
backAction={props.backAction}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default function ITPage(props: ITPageProps) {
|
|
26
|
+
const {
|
|
27
|
+
loading = false,
|
|
28
|
+
error = null,
|
|
29
|
+
errorTitle,
|
|
30
|
+
errorActionLabel,
|
|
31
|
+
onRetry,
|
|
32
|
+
empty = false,
|
|
33
|
+
emptyTitle,
|
|
34
|
+
emptyDescription,
|
|
35
|
+
emptyAction,
|
|
36
|
+
className,
|
|
37
|
+
children,
|
|
38
|
+
} = props;
|
|
39
|
+
|
|
40
|
+
const wrapperClass = clsx("space-y-6", className);
|
|
41
|
+
|
|
25
42
|
if (loading) {
|
|
26
43
|
return (
|
|
27
|
-
<div className={
|
|
28
|
-
{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
<ITSkeleton variant="rectangular" height={200} />
|
|
35
|
-
<ITSkeleton variant="rectangular" height={200} />
|
|
36
|
-
</ITStack>
|
|
37
|
-
</div>
|
|
44
|
+
<div className={wrapperClass}>
|
|
45
|
+
{renderHeader(props)}
|
|
46
|
+
<ITStack spacing={4}>
|
|
47
|
+
<ITSkeleton variant="rectangular" height={40} width="40%" />
|
|
48
|
+
<ITSkeleton variant="rectangular" height={200} />
|
|
49
|
+
<ITSkeleton variant="rectangular" height={200} />
|
|
50
|
+
</ITStack>
|
|
38
51
|
</div>
|
|
39
52
|
);
|
|
40
53
|
}
|
|
41
54
|
|
|
42
55
|
if (error) {
|
|
43
56
|
return (
|
|
44
|
-
<div className={
|
|
45
|
-
{
|
|
46
|
-
<ITPageHeader title={title} />
|
|
47
|
-
)}
|
|
57
|
+
<div className={wrapperClass}>
|
|
58
|
+
{renderHeader(props)}
|
|
48
59
|
<ITEmptyState
|
|
49
|
-
title="Error"
|
|
60
|
+
title={errorTitle || "Error"}
|
|
50
61
|
description={error}
|
|
51
62
|
action={
|
|
52
63
|
onRetry ? (
|
|
53
|
-
<ITButton
|
|
64
|
+
<ITButton
|
|
65
|
+
label={errorActionLabel || "Reintentar"}
|
|
66
|
+
onClick={onRetry}
|
|
67
|
+
size="small"
|
|
68
|
+
/>
|
|
54
69
|
) : undefined
|
|
55
70
|
}
|
|
56
71
|
/>
|
|
@@ -60,10 +75,8 @@ export default function ITPage({
|
|
|
60
75
|
|
|
61
76
|
if (empty) {
|
|
62
77
|
return (
|
|
63
|
-
<div className={
|
|
64
|
-
{
|
|
65
|
-
<ITPageHeader title={title} />
|
|
66
|
-
)}
|
|
78
|
+
<div className={wrapperClass}>
|
|
79
|
+
{renderHeader(props)}
|
|
67
80
|
<ITEmptyState
|
|
68
81
|
title={emptyTitle || "Sin datos"}
|
|
69
82
|
description={emptyDescription || "No hay información para mostrar"}
|
|
@@ -74,16 +87,8 @@ export default function ITPage({
|
|
|
74
87
|
}
|
|
75
88
|
|
|
76
89
|
return (
|
|
77
|
-
<div className={
|
|
78
|
-
{(
|
|
79
|
-
<ITPageHeader
|
|
80
|
-
title={title || ""}
|
|
81
|
-
description={description}
|
|
82
|
-
breadcrumbs={breadcrumbs}
|
|
83
|
-
actions={actions}
|
|
84
|
-
backAction={backAction}
|
|
85
|
-
/>
|
|
86
|
-
)}
|
|
90
|
+
<div className={wrapperClass}>
|
|
91
|
+
{renderHeader(props)}
|
|
87
92
|
{children}
|
|
88
93
|
</div>
|
|
89
94
|
);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
1
|
import { FaChevronLeft } from "react-icons/fa";
|
|
3
2
|
import { ITPageHeaderProps } from "./page-header.props";
|
|
4
3
|
import ITBreadcrumbs from "../breadcrumbs/breadcrumbs";
|
|
@@ -15,7 +14,7 @@ export default function ITPageHeader({
|
|
|
15
14
|
const showTopRow = breadcrumbs?.length || backAction;
|
|
16
15
|
|
|
17
16
|
return (
|
|
18
|
-
<div className={
|
|
17
|
+
<div className={className}>
|
|
19
18
|
{showTopRow && (
|
|
20
19
|
<div className="flex items-center justify-between gap-4 mb-1">
|
|
21
20
|
<div className="flex items-center gap-2 min-w-0">
|
|
@@ -11,7 +11,7 @@ export default function ITText({
|
|
|
11
11
|
return (
|
|
12
12
|
<Tag
|
|
13
13
|
className={className}
|
|
14
|
-
style={muted ? { color: "var(--color-text-muted)", ...style } :
|
|
14
|
+
style={muted ? { color: "var(--color-text-muted)", ...style } : style}
|
|
15
15
|
{...rest}
|
|
16
16
|
>
|
|
17
17
|
{children}
|
package/src/dev.css
ADDED