@axzydev/axzy_ui_system 1.3.0 → 1.3.2

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.
Files changed (52) hide show
  1. package/README.md +6 -2
  2. package/dist/index.cjs +2342 -1715
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.css +1 -1
  5. package/dist/index.d.cts +286 -9
  6. package/dist/index.d.ts +286 -9
  7. package/dist/index.js +2164 -1538
  8. package/dist/index.js.map +1 -1
  9. package/package.json +1 -1
  10. package/src/App.tsx +153 -153
  11. package/src/components/molecules/calendar/calendar.doc.mdx +2 -1
  12. package/src/components/molecules/calendar/calendar.tsx +102 -24
  13. package/src/components/molecules/masked-input/masked-input.doc.mdx +78 -0
  14. package/src/components/molecules/masked-input/masked-input.props.ts +58 -0
  15. package/src/components/molecules/masked-input/masked-input.stories.tsx +126 -0
  16. package/src/components/molecules/masked-input/masked-input.tsx +244 -0
  17. package/src/components/molecules/table/table.doc.mdx +64 -21
  18. package/src/components/molecules/table/table.props.ts +81 -2
  19. package/src/components/molecules/table/table.stories.tsx +155 -0
  20. package/src/components/molecules/table/table.tsx +177 -36
  21. package/src/components/organisms/data-table/ITDataTable.doc.mdx +37 -3
  22. package/src/components/organisms/data-table/ITDataTable.stories.tsx +43 -0
  23. package/src/components/organisms/data-table/dataTable.props.ts +64 -0
  24. package/src/components/organisms/data-table/dataTable.tsx +240 -82
  25. package/src/components/organisms/sidebar/sidebar.doc.mdx +5 -0
  26. package/src/components/organisms/sidebar/sidebar.props.ts +5 -0
  27. package/src/components/organisms/sidebar/sidebar.stories.tsx +1 -1
  28. package/src/components/organisms/sidebar/sidebar.tsx +27 -7
  29. package/src/components/organisms/topbar/topbar.doc.mdx +3 -0
  30. package/src/components/organisms/topbar/topbar.props.ts +16 -0
  31. package/src/components/organisms/topbar/topbar.tsx +133 -98
  32. package/src/components/templates/layout/layout.doc.mdx +2 -0
  33. package/src/components/templates/layout/layout.tsx +7 -1
  34. package/src/components/templates/page/page.doc.mdx +8 -2
  35. package/src/components/templates/page/page.props.ts +11 -1
  36. package/src/components/templates/page/page.tsx +11 -1
  37. package/src/dev.css +58 -1
  38. package/src/hooks/useElementSize.ts +46 -0
  39. package/src/hooks/useVirtualRows.ts +123 -0
  40. package/src/index.ts +6 -2
  41. package/src/sandbox/LandingShowcase.tsx +465 -0
  42. package/src/sandbox/NotFoundShowcase.tsx +70 -0
  43. package/src/sandbox/TopbarSearch.tsx +85 -0
  44. package/src/sandbox/navigation.ts +148 -0
  45. package/src/sandbox/useHashRoute.ts +149 -0
  46. package/src/showcases/DataShowcases.tsx +321 -24
  47. package/src/showcases/FormShowcases.tsx +178 -0
  48. package/src/showcases/PageShowcases.tsx +31 -0
  49. package/src/showcases/StructureShowcases.tsx +42 -4
  50. package/src/types/table.types.ts +48 -0
  51. package/src/utils/styles.ts +9 -4
  52. package/src/utils/table.utils.ts +31 -0
@@ -5,7 +5,8 @@ import ITText from "@/components/atoms/text/text";
5
5
 
6
6
  /**
7
7
  * Vertical navigation sidebar with submenu expand/collapse, hover tooltips in collapsed mode,
8
- * and glassmorphism styling.
8
+ * and glassmorphism styling. The collapsed rail expands automatically on pointer hover — there
9
+ * is no toggle button; the hover is the only way to expand and collapse it.
9
10
  *
10
11
  * @example
11
12
  * ```tsx
@@ -20,8 +21,7 @@ import ITText from "@/components/atoms/text/text";
20
21
  * ],
21
22
  * },
22
23
  * ]}
23
- * isCollapsed={collapsed}
24
- * onToggleCollapse={() => setCollapsed(!collapsed)}
24
+ * isCollapsed
25
25
  * />
26
26
  * ```
27
27
  */
@@ -33,6 +33,7 @@ export default function ITSidebar({
33
33
  onItemClick,
34
34
  onSubItemClick,
35
35
  subitemConnector = 'dot',
36
+ header,
36
37
  }: ITSidebarProps) {
37
38
  const [expandedItems, setExpandedItems] = useState<Set<string>>(new Set());
38
39
  const [isHovering, setIsHovering] = useState(false);
@@ -133,12 +134,24 @@ export default function ITSidebar({
133
134
  backdropFilter: 'blur(12px)',
134
135
  }}
135
136
  >
137
+ {header && !isSidebarCollapsed && (
138
+ <div className="px-4 pt-4 pb-1 flex-shrink-0">{header}</div>
139
+ )}
140
+
136
141
  {/* Navigation Items */}
137
- <nav className="flex-1 py-4 overflow-y-auto overflow-x-hidden custom-scrollbar px-4">
142
+ <nav aria-label="Componentes de la librería" className="flex-1 py-4 overflow-y-auto overflow-x-hidden custom-scrollbar px-4">
138
143
  <ul className="space-y-1">
139
- {navigationItems.map((item) => (
144
+ {navigationItems.map((item) => {
145
+ const hasSubmenu = !!item.subitems && item.subitems.length > 0;
146
+ const submenuId = `it-sidebar-submenu-${item.id}`;
147
+ return (
140
148
  <li key={item.id} className="relative group/navitem">
141
149
  <div
150
+ role="button"
151
+ tabIndex={0}
152
+ aria-label={item.label}
153
+ aria-expanded={hasSubmenu ? expandedItems.has(item.id) : undefined}
154
+ aria-controls={hasSubmenu ? submenuId : undefined}
142
155
  className={`flex items-center cursor-pointer
143
156
  transition-all duration-300 ease-[cubic-bezier(0.2,0,0,1)]
144
157
  rounded-xl relative overflow-visible
@@ -156,6 +169,12 @@ export default function ITSidebar({
156
169
  if (!item.isActive) e.currentTarget.style.backgroundColor = 'transparent';
157
170
  }}
158
171
  onClick={() => handleItemClick(item)}
172
+ onKeyDown={(e) => {
173
+ if (e.key === "Enter" || e.key === " ") {
174
+ e.preventDefault();
175
+ handleItemClick(item);
176
+ }
177
+ }}
159
178
  >
160
179
  {item.isActive && !isSidebarCollapsed && (
161
180
  <div
@@ -264,7 +283,7 @@ export default function ITSidebar({
264
283
 
265
284
  {/* Submenu - smooth height/opacity when not collapsed */}
266
285
  {!isSidebarCollapsed && item.subitems && item.subitems.length > 0 && (
267
- <div className={`overflow-hidden transition-all duration-400 ease-[cubic-bezier(0.2,0,0,1)] ${expandedItems.has(item.id) ? "max-h-[500px] opacity-100 mt-1" : "max-h-0 opacity-0"}`}>
286
+ <div id={submenuId} role="group" aria-label={item.label} className={`overflow-hidden transition-all duration-400 ease-[cubic-bezier(0.2,0,0,1)] ${expandedItems.has(item.id) ? "max-h-[500px] opacity-100 mt-1" : "max-h-0 opacity-0"}`}>
268
287
  <ul
269
288
  className="ml-4 flex flex-col gap-0 py-0.5"
270
289
  style={{
@@ -276,6 +295,7 @@ export default function ITSidebar({
276
295
  {item.subitems.map((subitem) => (
277
296
  <li key={subitem.id} className="relative">
278
297
  <button
298
+ aria-current={subitem.isActive ? "page" : undefined}
279
299
  onClick={() => {
280
300
  if (subitem.action) subitem.action();
281
301
  if (onSubItemClick) onSubItemClick(subitem);
@@ -329,7 +349,7 @@ export default function ITSidebar({
329
349
  </div>
330
350
  )}
331
351
  </li>
332
- ))}
352
+ );})}
333
353
  </ul>
334
354
  </nav>
335
355
  </aside>
@@ -13,6 +13,8 @@ Sticky top navigation bar with glassmorphism effect, logo, breadcrumb-style nav
13
13
  |------|------|---------|-------------|
14
14
  | `logo` | `ReactNode` | — | Optional logo element (e.g. an `<img>` or SVG component). |
15
15
  | `logoText` | `string` | — | Text displayed next to the logo as the brand/title. |
16
+ | `centerContent` | `ReactNode` | — | Content rendered in the centered region between the left (logo / nav) and right (user menu) areas — e.g. a global search box. Rendered only when provided, and only from the `lg` breakpoint up. |
17
+ | `children` | `ReactNode` | — | Actions rendered in the right area, immediately before the user menu — e.g. a notification bell, a help link, a theme switcher. The component owns the placement; the caller only supplies the controls. The area renders only when this prop or `userMenu` is provided. |
16
18
  | `userMenu` | `object` | — | User dropdown configuration with name, email, avatar, and menu items. |
17
19
  | `userMenu.userName` | `string` | — | Display name shown in the trigger button and dropdown header. |
18
20
  | `userMenu.userEmail` | `string` | — | User email shown in the trigger button and dropdown header. |
@@ -53,6 +55,7 @@ import { FaChartBar, FaUserCog } from 'react-icons/fa';
53
55
 
54
56
  ## Notes
55
57
 
58
+ - The `centerContent` slot renders in a centered `flex-1` (basis 0) region that absorbs all the slack, so the left and right areas stay flush with the row edges. It is `hidden` below `lg`, which leaves the below-`lg` layout exactly as before (logo + user menu).
56
59
  - The bar uses a **glassmorphism** backdrop blur effect (`backdrop-blur-xl`), giving it a translucent appearance over scrolling content.
57
60
  - Navigation items support **icons** and highlight the active item with the primary color and an underline indicator.
58
61
  - The **user menu** dropdown opens on avatar click and closes on outside click (via `useClickOutside` hook).
@@ -1,3 +1,5 @@
1
+ import type { ReactNode } from "react";
2
+
1
3
  export interface ITTopBarNavItem {
2
4
  /** Unique identifier for the navigation item. */
3
5
  id: string;
@@ -14,6 +16,20 @@ export interface ITTopBarProps {
14
16
  logo?: any;
15
17
  /** Text displayed next to the logo. */
16
18
  logoText?: string;
19
+ /**
20
+ * Content rendered in the centered region between the left (logo / nav) and
21
+ * right (user menu) areas — e.g. a global search box. The region is rendered
22
+ * only when this prop is provided, and only from the `lg` breakpoint up;
23
+ * below `lg` the row stays logo + user menu so nothing is squeezed.
24
+ */
25
+ centerContent?: ReactNode;
26
+ /**
27
+ * Actions rendered in the right area, immediately before the user menu —
28
+ * e.g. a notification bell, a help link, a theme switcher. The component
29
+ * decides the placement, so the caller only supplies the controls. The area
30
+ * is rendered only when this prop or `userMenu` is provided.
31
+ */
32
+ children?: ReactNode;
17
33
  /** User dropdown configuration including name, email, avatar, and menu items. */
18
34
  userMenu?: {
19
35
  /** Display name shown in the trigger button and dropdown header. */
@@ -41,11 +41,28 @@ import ITText from "@/components/atoms/text/text";
41
41
  * showMobileMenuButton
42
42
  * onToggleMobileMenu={() => setSidebarOpen((v) => !v)}
43
43
  * />
44
+ *
45
+ * @example
46
+ * // Topbar with a global search box in the centered region (lg and up)
47
+ * <ITTopBar
48
+ * logoText="AXZY"
49
+ * centerContent={<SearchBox value={term} onChange={setTerm} />}
50
+ * userMenu={{ userName: "Jane Doe", userEmail: "jane@example.com", menuItems: [] }}
51
+ * />
52
+ *
53
+ * @example
54
+ * // Topbar with a notification bell passed as children, sitting right before
55
+ * // the user menu. The slot is placed by the component, not by the caller.
56
+ * <ITTopBar logoText="AXZY" userMenu={userMenu}>
57
+ * <NotificationBell count={3} />
58
+ * </ITTopBar>
44
59
  */
45
60
  export default function ITTopBar({
46
61
  logo,
47
62
  logoText,
63
+ centerContent,
48
64
  userMenu,
65
+ children,
49
66
  showMobileMenuButton,
50
67
  onToggleMobileMenu,
51
68
  navItems,
@@ -131,110 +148,128 @@ export default function ITTopBar({
131
148
  )}
132
149
  </div>
133
150
 
134
- {/* RIGHT AREA: User Menu */}
135
- {userMenu && (
136
- <div className="relative">
137
- <button
138
- type="button"
139
- className="flex items-center gap-3 rounded-full pl-2 pr-4 py-1.5 transition-all duration-200 ease-[cubic-bezier(0.2,0,0,1)] border border-transparent hover:border-secondary-200"
140
- style={{
141
- backgroundColor: isUserMenuOpen ? "var(--it-topbar-user-hover, #f1f5f9)" : "transparent",
142
- }}
143
- onMouseEnter={(e) => {
144
- if (!isUserMenuOpen) e.currentTarget.style.backgroundColor = "var(--it-topbar-user-hover, #f1f5f9)";
145
- }}
146
- onMouseLeave={(e) => {
147
- if (!isUserMenuOpen) e.currentTarget.style.backgroundColor = "transparent";
148
- }}
149
- onClick={() => setIsUserMenuOpen(!isUserMenuOpen)}
150
- >
151
- {/* Avatar */}
151
+ {/* CENTER AREA: optional slot (e.g. global search) — lg and up only.
152
+ `flex-1` is basis 0, so it absorbs every pixel of slack and
153
+ `justify-between` has nothing left to distribute: the logo/nav and
154
+ the user menu stay flush with the row edges. */}
155
+ {centerContent && (
156
+ <div className="hidden lg:flex flex-1 min-w-0 items-center justify-center px-4">
157
+ <div className="w-full max-w-[420px]">{centerContent}</div>
158
+ </div>
159
+ )}
160
+
161
+ {/* RIGHT AREA: optional children (e.g. a notification bell) + the user menu.
162
+ Both share one flex group so `justify-between` on the row keeps the pair
163
+ flush to the right edge instead of pushing the bell into the middle of
164
+ the bar. */}
165
+ {(children || userMenu) && (
166
+ <div className="flex items-center gap-2">
167
+ {children}
168
+ {userMenu && (
152
169
  <div className="relative">
153
- {userMenu.userImage ? (
154
- <img
155
- className="w-9 h-9 rounded-full object-cover ring-2 ring-white shadow-sm"
156
- src={userMenu.userImage}
157
- alt="Current user"
158
- />
159
- ) : (
160
- <div className="w-9 h-9 rounded-full bg-slate-100 flex items-center justify-center ring-2 ring-white shadow-sm">
161
- <FaUserCircle className="w-6 h-6" style={{ color: "var(--it-topbar-icon, #94a3b8)" }} />
170
+ <button
171
+ type="button"
172
+ className="flex items-center gap-3 rounded-full pl-2 pr-4 py-1.5 transition-all duration-200 ease-[cubic-bezier(0.2,0,0,1)] border border-transparent hover:border-secondary-200"
173
+ style={{
174
+ backgroundColor: isUserMenuOpen ? "var(--it-topbar-user-hover, #f1f5f9)" : "transparent",
175
+ }}
176
+ onMouseEnter={(e) => {
177
+ if (!isUserMenuOpen) e.currentTarget.style.backgroundColor = "var(--it-topbar-user-hover, #f1f5f9)";
178
+ }}
179
+ onMouseLeave={(e) => {
180
+ if (!isUserMenuOpen) e.currentTarget.style.backgroundColor = "transparent";
181
+ }}
182
+ onClick={() => setIsUserMenuOpen(!isUserMenuOpen)}
183
+ >
184
+ {/* Avatar */}
185
+ <div className="relative">
186
+ {userMenu.userImage ? (
187
+ <img
188
+ className="w-9 h-9 rounded-full object-cover ring-2 ring-white shadow-sm"
189
+ src={userMenu.userImage}
190
+ alt="Current user"
191
+ />
192
+ ) : (
193
+ <div className="w-9 h-9 rounded-full bg-slate-100 flex items-center justify-center ring-2 ring-white shadow-sm">
194
+ <FaUserCircle className="w-6 h-6" style={{ color: "var(--it-topbar-icon, #94a3b8)" }} />
195
+ </div>
196
+ )}
197
+ {/* Active dot indicator */}
198
+ <div className="absolute bottom-0 right-0 w-2.5 h-2.5 bg-green-500 border-2 border-white rounded-full"></div>
162
199
  </div>
163
- )}
164
- {/* Active dot indicator */}
165
- <div className="absolute bottom-0 right-0 w-2.5 h-2.5 bg-green-500 border-2 border-white rounded-full"></div>
166
- </div>
167
200
 
168
- {/* Name Details */}
169
- <div className="hidden sm:flex flex-col text-left py-0.5">
170
- <ITText as="span"
171
- className="font-semibold text-[0.85rem] leading-tight"
172
- style={{ color: "var(--it-topbar-user-text, #0f172a)" }}
173
- >
174
- {userMenu.userName}
175
- </ITText>
176
- <ITText as="span"
177
- className="text-[0.7rem] font-medium"
178
- style={{ color: "var(--it-topbar-user-subtitle, #64748b)" }}
179
- >
180
- {userMenu.userEmail}
181
- </ITText>
182
- </div>
183
- </button>
201
+ {/* Name Details */}
202
+ <div className="hidden sm:flex flex-col text-left py-0.5">
203
+ <ITText as="span"
204
+ className="font-semibold text-[0.85rem] leading-tight"
205
+ style={{ color: "var(--it-topbar-user-text, #0f172a)" }}
206
+ >
207
+ {userMenu.userName}
208
+ </ITText>
209
+ <ITText as="span"
210
+ className="text-[0.7rem] font-medium"
211
+ style={{ color: "var(--it-topbar-user-subtitle, #64748b)" }}
212
+ >
213
+ {userMenu.userEmail}
214
+ </ITText>
215
+ </div>
216
+ </button>
184
217
 
185
- {/* Dropdown Menu */}
186
- <div
187
- ref={userMenuRef}
188
- className={`
189
- absolute right-0 mt-3 w-64 rounded-2xl shadow-[0_10px_40px_-10px_rgba(0,0,0,0.15)] z-[70] overflow-hidden transform origin-top-right transition-all duration-200 ease-[cubic-bezier(0.2,0,0,1)]
190
- ${isUserMenuOpen ? "scale-100 opacity-100 translate-y-0" : "scale-95 opacity-0 -translate-y-2 pointer-events-none"}
191
- `}
192
- style={{
193
- backgroundColor: "var(--it-topbar-user-dropdown-bg, #ffffff)",
194
- border: "1px solid var(--it-topbar-user-dropdown-border, #f1f5f9)"
195
- }}
196
- >
197
- {/* Dropdown Header */}
198
- <div className="px-5 py-4 border-b" style={{ borderColor: "var(--it-topbar-user-dropdown-border, #f1f5f9)", backgroundColor: "var(--it-topbar-user-bg, #f8fafc)" }}>
199
- <ITText as="span" className="block font-bold text-[0.9rem]" style={{ color: "var(--it-topbar-user-text, #0f172a)" }}>
200
- {userMenu.userName}
201
- </ITText>
202
- <ITText as="span" className="block text-xs font-medium truncate mt-0.5" style={{ color: "var(--it-topbar-user-subtitle, #64748b)" }}>
203
- {userMenu.userEmail}
204
- </ITText>
205
- </div>
218
+ {/* Dropdown Menu */}
219
+ <div
220
+ ref={userMenuRef}
221
+ className={`
222
+ absolute right-0 mt-3 w-64 rounded-2xl shadow-[0_10px_40px_-10px_rgba(0,0,0,0.15)] z-[70] overflow-hidden transform origin-top-right transition-all duration-200 ease-[cubic-bezier(0.2,0,0,1)]
223
+ ${isUserMenuOpen ? "scale-100 opacity-100 translate-y-0" : "scale-95 opacity-0 -translate-y-2 pointer-events-none"}
224
+ `}
225
+ style={{
226
+ backgroundColor: "var(--it-topbar-user-dropdown-bg, #ffffff)",
227
+ border: "1px solid var(--it-topbar-user-dropdown-border, #f1f5f9)"
228
+ }}
229
+ >
230
+ {/* Dropdown Header */}
231
+ <div className="px-5 py-4 border-b" style={{ borderColor: "var(--it-topbar-user-dropdown-border, #f1f5f9)", backgroundColor: "var(--it-topbar-user-bg, #f8fafc)" }}>
232
+ <ITText as="span" className="block font-bold text-[0.9rem]" style={{ color: "var(--it-topbar-user-text, #0f172a)" }}>
233
+ {userMenu.userName}
234
+ </ITText>
235
+ <ITText as="span" className="block text-xs font-medium truncate mt-0.5" style={{ color: "var(--it-topbar-user-subtitle, #64748b)" }}>
236
+ {userMenu.userEmail}
237
+ </ITText>
238
+ </div>
206
239
 
207
- {/* Dropdown Items */}
208
- <ul className="py-2">
209
- {userMenu.menuItems.map((m, i) => {
210
- const isDestructive = m.label.toLowerCase().includes('salir') || m.label.toLowerCase().includes('cerrar') || m.label.toLowerCase().includes('logout');
240
+ {/* Dropdown Items */}
241
+ <ul className="py-2">
242
+ {userMenu.menuItems.map((m, i) => {
243
+ const isDestructive = m.label.toLowerCase().includes('salir') || m.label.toLowerCase().includes('cerrar') || m.label.toLowerCase().includes('logout');
211
244
 
212
- return (
213
- <li key={i} className="px-2">
214
- {i === userMenu.menuItems.length - 1 && isDestructive && i > 0 && (
215
- <div className="h-px bg-slate-100 my-1 mx-2"></div>
216
- )}
217
- <button
218
- onClick={() => {
219
- m.onClick();
220
- setIsUserMenuOpen(false);
221
- }}
222
- className="block w-full text-left px-3 py-2.5 rounded-xl text-[0.875rem] font-medium transition-colors duration-150"
223
- style={{ color: isDestructive ? 'var(--color-danger-500)' : "var(--it-topbar-user-text, #334155)" }}
224
- onMouseEnter={(e) => {
225
- e.currentTarget.style.backgroundColor = isDestructive ? 'var(--color-danger-50)' : "var(--it-topbar-user-item-hover, #f8fafc)";
226
- }}
227
- onMouseLeave={(e) => {
228
- e.currentTarget.style.backgroundColor = "transparent";
229
- }}
230
- >
231
- <ITText as="span">{m.label}</ITText>
232
- </button>
233
- </li>
234
- )
235
- })}
236
- </ul>
237
- </div>
245
+ return (
246
+ <li key={i} className="px-2">
247
+ {i === userMenu.menuItems.length - 1 && isDestructive && i > 0 && (
248
+ <div className="h-px bg-slate-100 my-1 mx-2"></div>
249
+ )}
250
+ <button
251
+ onClick={() => {
252
+ m.onClick();
253
+ setIsUserMenuOpen(false);
254
+ }}
255
+ className="block w-full text-left px-3 py-2.5 rounded-xl text-[0.875rem] font-medium transition-colors duration-150"
256
+ style={{ color: isDestructive ? 'var(--color-danger-500)' : "var(--it-topbar-user-text, #334155)" }}
257
+ onMouseEnter={(e) => {
258
+ e.currentTarget.style.backgroundColor = isDestructive ? 'var(--color-danger-50)' : "var(--it-topbar-user-item-hover, #f8fafc)";
259
+ }}
260
+ onMouseLeave={(e) => {
261
+ e.currentTarget.style.backgroundColor = "transparent";
262
+ }}
263
+ >
264
+ <ITText as="span">{m.label}</ITText>
265
+ </button>
266
+ </li>
267
+ )
268
+ })}
269
+ </ul>
270
+ </div>
271
+ </div>
272
+ )}
238
273
  </div>
239
274
  )}
240
275
  </div>
@@ -40,7 +40,9 @@ import { ITLayout } from '@axzydev/axzy_ui_system';
40
40
 
41
41
  - The topbar spans the full viewport width at the top of the page.
42
42
  - The sidebar sits under the topbar on the left and floats over content when expanded via hover.
43
+ - Reserved desktop width follows `sidebar.isCollapsed`: omitted/uncontrolled or `true` reserves the 88px rail (hover expands over content); controlled-expanded (`sidebar.isCollapsed={false}`) reserves the full 280px so it never overlays content.
43
44
  - Sidebar in collapsed state shows only icons; expanding reveals labels.
45
+ - The collapsed rail expands automatically on hover. Keep global search in `topBar.centerContent` (always visible, `lg` and up) rather than `sidebar.header`, which is expanded-only and disappears in the 88px rail.
44
46
  - Themed entirely through CSS custom properties from ITThemeProvider.
45
47
  - Includes mobile responsive behavior with a hamburger-style toggle.
46
48
 
@@ -58,7 +58,13 @@ export default function ITLayout({
58
58
  >
59
59
  {/* DESKTOP SIDEBAR */}
60
60
  <div className="hidden lg:block relative z-40 h-full">
61
- <div className="w-[88px] h-full flex-shrink-0" />
61
+ {/* Reserves the sidebar's at-rest width. When the sidebar is collapsed
62
+ (default), this is the 88px rail and hover expands over the content.
63
+ When controlled-expanded (`sidebar.isCollapsed === false`), it
64
+ reserves the full 280px so the sidebar never overlays content. */}
65
+ <div
66
+ className={`${desktopCollapsed ? "w-[88px]" : "w-[280px]"} h-full flex-shrink-0`}
67
+ />
62
68
  <div className="absolute top-0 left-0 h-full">
63
69
  <ITSidebar
64
70
  {...sidebar}
@@ -29,7 +29,8 @@ A page template component that wraps an ITPageHeader with content area and built
29
29
  | `emptyAction` | `ReactNode` | `undefined` | Custom action element for the empty state. |
30
30
  | `children` | `ReactNode` | required | Content rendered when no special state (loading/error/empty) is active. |
31
31
  | `maxWidth` | `'2xl' \| '3xl' \| '4xl' \| '5xl' \| '6xl' \| '7xl'` | `'7xl'` | Maximum width of the page content container. |
32
- | `noPadding` | `boolean` | `false` | When true, removes default padding from the page wrapper. |
32
+ | `noPadding` | `boolean` | `false` | When true, removes default padding from the page wrapper. Overrides `horizontalPadding`. |
33
+ | `horizontalPadding` | `string` | `'px-4 sm:px-6 lg:px-8'` | Tailwind classes for the wrapper's horizontal padding. Use `'px-0'` for edge-to-edge content. Must be a literal — Tailwind scans source, so runtime-assembled values are not generated. |
33
34
  | `className` | `string` | `undefined` | Additional CSS classes for the page wrapper. |
34
35
 
35
36
  ## Usage
@@ -71,7 +72,12 @@ import { ITPage } from '@axzydev/axzy_ui_system';
71
72
  - The empty state renders a centered placeholder with optional title, description, and action.
72
73
  - All header props (`title`, `description`, `breadcrumbs`, `actions`, `backAction`, `icon`) are forwarded to ITPageHeader.
73
74
  - Content maximum width is controlled by Tailwind max-width classes via `maxWidth`.
74
- - `noPadding` is useful for full-bleed layouts like dashboards.
75
+ - `noPadding` is useful for full-bleed layouts like dashboards. It removes both axes and wins over `horizontalPadding`.
76
+ - `horizontalPadding` tunes only the horizontal gutter, so you can keep the vertical rhythm while going edge-to-edge:
77
+ ```tsx
78
+ <ITPage title="Reportes" horizontalPadding="px-0">...</ITPage>
79
+ ```
80
+ Because Tailwind scans your source files, write the value as a literal. A value built at runtime (`"px-" + n`) will silently produce no padding.
75
81
 
76
82
  ## Stories
77
83
 
@@ -41,6 +41,16 @@ export interface ITPageProps {
41
41
  children: ReactNode;
42
42
  /** Maximum width of the page content. Options: "2xl", "3xl", "4xl", "5xl", "6xl", "7xl". Default: "7xl". */
43
43
  maxWidth?: "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl";
44
- /** Whether to remove default padding from the page wrapper. */
44
+ /** Whether to remove default padding from the page wrapper. Overrides `horizontalPadding`. */
45
45
  noPadding?: boolean;
46
+ /**
47
+ * Tailwind classes for the page wrapper's horizontal padding. Pass `"px-0"`
48
+ * for edge-to-edge content, or a responsive scale like `"px-2 sm:px-4"`.
49
+ *
50
+ * Must be written as a literal: Tailwind scans source files, so a value
51
+ * assembled at runtime will not be generated into the stylesheet.
52
+ *
53
+ * @default "px-4 sm:px-6 lg:px-8"
54
+ */
55
+ horizontalPadding?: string;
46
56
  }
@@ -41,6 +41,14 @@ const renderHeader = (props: ITPageProps) => {
41
41
  * <ITCard>Dashboard content</ITCard>
42
42
  * </ITPage>
43
43
  * ```
44
+ *
45
+ * @example
46
+ * ```tsx
47
+ * // Edge-to-edge content: no horizontal gutter, vertical padding kept.
48
+ * <ITPage title="Reportes" horizontalPadding="px-0">
49
+ * <ITTable data={rows} columns={columns} />
50
+ * </ITPage>
51
+ * ```
44
52
  */
45
53
  export default function ITPage(props: ITPageProps) {
46
54
  const {
@@ -57,11 +65,13 @@ export default function ITPage(props: ITPageProps) {
57
65
  children,
58
66
  maxWidth = "7xl",
59
67
  noPadding = false,
68
+ horizontalPadding = "px-4 sm:px-6 lg:px-8",
60
69
  } = props;
61
70
 
62
71
  const wrapperClass = clsx(
63
72
  "mx-auto w-full",
64
- !noPadding && "px-4 sm:px-6 lg:px-8 py-6",
73
+ !noPadding && horizontalPadding,
74
+ !noPadding && "py-6",
65
75
  `max-w-${maxWidth}`,
66
76
  "space-y-8",
67
77
  className
package/src/dev.css CHANGED
@@ -1,2 +1,59 @@
1
1
  @import "tailwindcss";
2
- @import "./index.css";
2
+ @import "./index.css";
3
+
4
+ /* ──────────────────────────────────────────────
5
+ SANDBOX-ONLY ANIMATIONS (dev.css)
6
+ Never shipped: only src/main.tsx imports this file and `pnpm bundle`
7
+ builds from src/index.ts, so these never reach dist/index.css.
8
+ ────────────────────────────────────────────── */
9
+
10
+ @keyframes it-landing-rise {
11
+ from {
12
+ opacity: 0;
13
+ transform: translateY(14px);
14
+ }
15
+ to {
16
+ opacity: 1;
17
+ transform: translateY(0);
18
+ }
19
+ }
20
+
21
+ .it-landing-rise {
22
+ animation: it-landing-rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
23
+ }
24
+
25
+ @keyframes it-landing-float {
26
+ 0%,
27
+ 100% {
28
+ transform: translateY(0);
29
+ }
30
+ 50% {
31
+ transform: translateY(-18px);
32
+ }
33
+ }
34
+
35
+ .it-landing-float {
36
+ animation: it-landing-float 8s ease-in-out infinite;
37
+ }
38
+
39
+ .it-landing-grid {
40
+ background-image: radial-gradient(
41
+ circle at center,
42
+ currentColor 1px,
43
+ transparent 1px
44
+ );
45
+ background-size: 22px 22px;
46
+ -webkit-mask-image: radial-gradient(
47
+ ellipse at center,
48
+ black 40%,
49
+ transparent 78%
50
+ );
51
+ mask-image: radial-gradient(ellipse at center, black 40%, transparent 78%);
52
+ }
53
+
54
+ @media (prefers-reduced-motion: reduce) {
55
+ .it-landing-rise,
56
+ .it-landing-float {
57
+ animation: none;
58
+ }
59
+ }
@@ -0,0 +1,46 @@
1
+ import { useLayoutEffect, useRef, useState, type RefObject } from "react";
2
+
3
+ /**
4
+ * Observes an element's rendered size with a `ResizeObserver`.
5
+ *
6
+ * Used to make container-relative decisions (e.g. a table falling back to its
7
+ * cards view when the container itself is narrow, regardless of viewport
8
+ * width). The initial measurement runs in a layout effect so the first paint
9
+ * already has the real width and no incorrect layout flashes.
10
+ *
11
+ * @returns `ref` to attach to the element to measure, plus its current `width`
12
+ * and `height` in pixels (both `0` until the first measurement).
13
+ *
14
+ * @example
15
+ * const { ref, width } = useElementSize<HTMLDivElement>();
16
+ * return <div ref={ref}>{width < 640 ? <Cards /> : <Table />}</div>;
17
+ */
18
+ export function useElementSize<T extends HTMLElement>(): {
19
+ ref: RefObject<T | null>;
20
+ width: number;
21
+ height: number;
22
+ } {
23
+ const ref = useRef<T>(null);
24
+ const [size, setSize] = useState({ width: 0, height: 0 });
25
+
26
+ useLayoutEffect(() => {
27
+ const element = ref.current;
28
+ if (!element) return;
29
+
30
+ const update = () => {
31
+ const rect = element.getBoundingClientRect();
32
+ setSize({ width: rect.width, height: rect.height });
33
+ };
34
+
35
+ update();
36
+
37
+ const observer = new ResizeObserver(update);
38
+ observer.observe(element);
39
+
40
+ return () => observer.disconnect();
41
+ }, []);
42
+
43
+ return { ref, width: size.width, height: size.height };
44
+ }
45
+
46
+ export default useElementSize;