@axzydev/axzy_ui_system 1.2.3 → 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/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "packageManager": "pnpm@10.34.0",
5
5
  "private": false,
6
6
  "license": "MIT",
7
- "version": "1.2.3",
7
+ "version": "1.2.4",
8
8
  "type": "module",
9
9
  "sideEffects": [
10
10
  "*.css"
@@ -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={`mx-auto w-full h-full ${contentClassName}`}>
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>
@@ -9,6 +9,8 @@ export interface ITPageProps {
9
9
  backAction?: () => void;
10
10
  loading?: boolean;
11
11
  error?: string | null;
12
+ errorTitle?: string;
13
+ errorActionLabel?: string;
12
14
  onRetry?: () => void;
13
15
  empty?: boolean;
14
16
  emptyTitle?: string;
@@ -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
- export default function ITPage({
10
- title,
11
- description,
12
- breadcrumbs,
13
- actions,
14
- backAction,
15
- loading = false,
16
- error = null,
17
- onRetry,
18
- empty = false,
19
- emptyTitle,
20
- emptyDescription,
21
- emptyAction,
22
- className,
23
- children,
24
- }: ITPageProps) {
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={className}>
28
- {title && (
29
- <ITPageHeader title={title} />
30
- )}
31
- <div className="mt-6">
32
- <ITStack spacing={4}>
33
- <ITSkeleton variant="rectangular" height={40} width="40%" />
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={className}>
45
- {title && (
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 label="Reintentar" onClick={onRetry} size="small" />
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={className}>
64
- {title && (
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={clsx("space-y-6", className)}>
78
- {(title || breadcrumbs || actions || backAction) && (
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={clsx(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">