@axzydev/axzy_ui_system 1.4.8 → 1.5.0
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/README.md +2 -11
- package/dist/index.cjs +1826 -1351
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +115 -14
- package/dist/index.d.ts +115 -14
- package/dist/index.js +1481 -1010
- package/dist/index.js.map +1 -1
- package/dist/layered.css +1 -1
- package/package.json +3 -16
- package/src/App.tsx +90 -73
- package/src/components/atoms/badget/badget.tsx +23 -5
- package/src/components/atoms/chip/chip.tsx +3 -1
- package/src/components/atoms/image/image.tsx +3 -1
- package/src/components/atoms/input/input.tsx +8 -5
- package/src/components/atoms/loader/loader.tsx +3 -1
- package/src/components/atoms/slide/slide.props.ts +12 -0
- package/src/components/atoms/slide/slide.tsx +3 -0
- package/src/components/molecules/alert/alert.tsx +3 -1
- package/src/components/molecules/breadcrumbs/breadcrumbs.tsx +3 -1
- package/src/components/molecules/calendar/calendar.tsx +9 -6
- package/src/components/molecules/card/card.tsx +5 -2
- package/src/components/molecules/chip-input/chip-input.tsx +9 -7
- package/src/components/molecules/date-picker/datePicker.tsx +9 -9
- package/src/components/molecules/dropdown-menu/dropdown-menu.props.ts +1 -1
- package/src/components/molecules/dropdown-menu/dropdown-menu.tsx +6 -3
- package/src/components/molecules/field/field.tsx +3 -1
- package/src/components/molecules/form-header/form-header.tsx +3 -1
- package/src/components/molecules/line-bar-chart/line-bar-chart.props.ts +2 -2
- package/src/components/molecules/line-bar-chart/line-bar-chart.tsx +20 -15
- package/src/components/molecules/masked-input/masked-input.tsx +3 -1
- package/src/components/molecules/multi-select/multi-select.tsx +12 -9
- package/src/components/molecules/pagination/pagination.tsx +11 -5
- package/src/components/molecules/search-select/search-select.tsx +11 -9
- package/src/components/molecules/select/select.tsx +6 -4
- package/src/components/molecules/stepper/stepper.tsx +6 -4
- package/src/components/molecules/table/table.tsx +30 -28
- package/src/components/molecules/time-picker/timePicker.tsx +8 -6
- package/src/components/molecules/wysiwyg/wysiwyg.tsx +23 -12
- package/src/components/organisms/confirm-dialog/confirm-dialog.props.ts +4 -4
- package/src/components/organisms/confirm-dialog/confirm-dialog.tsx +16 -8
- package/src/components/organisms/data-table/dataTable.tsx +31 -25
- package/src/components/organisms/dialog/dialog.tsx +3 -0
- package/src/components/organisms/drawer/drawer.tsx +3 -0
- package/src/components/organisms/dropfile/dropfile.tsx +19 -17
- package/src/components/organisms/form-builder/fieldRenderer.tsx +4 -2
- package/src/components/organisms/navbar/navbar.tsx +4 -2
- package/src/components/organisms/page-header/page-header.tsx +3 -1
- package/src/components/organisms/searchTable/components/PaginationControls.tsx +8 -6
- package/src/components/organisms/searchTable/components/PaginationInfo.tsx +3 -1
- package/src/components/organisms/searchTable/components/SearchAndSortBar.tsx +7 -5
- package/src/components/organisms/searchTable/components/SearchInput.tsx +4 -2
- package/src/components/organisms/searchTable/components/SortButton.tsx +13 -11
- package/src/components/organisms/searchTable/components/TableEmptyState.tsx +4 -2
- package/src/components/organisms/searchTable/components/TableRow.tsx +6 -4
- package/src/components/organisms/searchTable/searchTable.tsx +4 -2
- package/src/components/organisms/sidebar/sidebar.props.ts +1 -1
- package/src/components/organisms/sidebar/sidebar.tsx +9 -4
- package/src/components/organisms/toast/toast.tsx +3 -1
- package/src/components/organisms/topbar/topbar.tsx +4 -2
- package/src/components/templates/page/page.props.ts +4 -4
- package/src/components/templates/page/page.tsx +6 -4
- package/src/components/theme-provider/themeProvider.tsx +28 -17
- package/src/dev.css +77 -2
- package/src/global.d.ts +10 -0
- package/src/i18n/context.ts +9 -0
- package/src/i18n/index.ts +22 -0
- package/src/i18n/locales/en.ts +163 -0
- package/src/i18n/locales/es.ts +165 -0
- package/src/i18n/provider.tsx +44 -0
- package/src/i18n/translator.ts +82 -0
- package/src/i18n/types.ts +54 -0
- package/src/i18n/useITTranslation.ts +20 -0
- package/src/index.css +0 -1
- package/src/index.ts +7 -1
- package/src/sandbox/LandingShowcase.tsx +224 -580
- package/src/sandbox/NotFoundShowcase.tsx +51 -36
- package/src/sandbox/TopbarSearch.tsx +6 -4
- package/src/sandbox/controls.tsx +180 -0
- package/src/sandbox/i18n.ts +1929 -0
- package/src/sandbox/icons.tsx +25 -0
- package/src/sandbox/locale.tsx +72 -0
- package/src/sandbox/ui.tsx +377 -0
- package/src/sandbox/useHashRoute.ts +46 -10
- package/src/showcases/DataShowcases.tsx +103 -87
- package/src/showcases/FeedbackShowcases.tsx +37 -30
- package/src/showcases/FormShowcases.tsx +302 -214
- package/src/showcases/GettingStartedShowcase.tsx +151 -145
- package/src/showcases/HelpShowcase.tsx +126 -128
- package/src/showcases/HomeShowcase.tsx +678 -482
- package/src/showcases/LayoutPrimitivesShowcases.tsx +129 -114
- package/src/showcases/NavigationShowcases.tsx +45 -37
- package/src/showcases/PageShowcases.tsx +171 -152
- package/src/showcases/ProductoDetalle.tsx +272 -129
- package/src/showcases/ShowcaseLayout.tsx +270 -216
- package/src/showcases/SizesShowcase.tsx +123 -64
- package/src/showcases/StructureShowcases.tsx +157 -131
- package/src/showcases/portfolioUi.tsx +153 -0
- package/src/showcases/techIcons.ts +3 -0
- package/src/utils/table.utils.ts +10 -2
- package/src/components/atoms/avatar/avatar.doc.mdx +0 -48
- package/src/components/atoms/avatar/avatar.stories.tsx +0 -64
- package/src/components/atoms/badget/badget.doc.mdx +0 -46
- package/src/components/atoms/badget/badget.stories.tsx +0 -75
- package/src/components/atoms/button/button.doc.mdx +0 -59
- package/src/components/atoms/button/button.stories.tsx +0 -173
- package/src/components/atoms/checkbox/checkbox.doc.mdx +0 -54
- package/src/components/atoms/checkbox/checkbox.stories.tsx +0 -53
- package/src/components/atoms/chip/chip.doc.mdx +0 -47
- package/src/components/atoms/chip/chip.stories.tsx +0 -64
- package/src/components/atoms/divider/divider.doc.mdx +0 -42
- package/src/components/atoms/divider/divider.stories.tsx +0 -33
- package/src/components/atoms/flex/flex.doc.mdx +0 -59
- package/src/components/atoms/flex/flex.stories.tsx +0 -70
- package/src/components/atoms/grid/grid.doc.mdx +0 -54
- package/src/components/atoms/grid/grid.stories.tsx +0 -71
- package/src/components/atoms/image/image.doc.mdx +0 -44
- package/src/components/atoms/image/image.stories.tsx +0 -48
- package/src/components/atoms/input/input.doc.mdx +0 -70
- package/src/components/atoms/input/input.stories.tsx +0 -113
- package/src/components/atoms/input-number/input-number.doc.mdx +0 -74
- package/src/components/atoms/input-number/input-number.stories.tsx +0 -111
- package/src/components/atoms/loader/loader.doc.mdx +0 -43
- package/src/components/atoms/loader/loader.stories.tsx +0 -104
- package/src/components/atoms/popover/popover.doc.mdx +0 -53
- package/src/components/atoms/popover/popover.stories.tsx +0 -24
- package/src/components/atoms/progress/progress.doc.mdx +0 -48
- package/src/components/atoms/progress/progress.stories.tsx +0 -39
- package/src/components/atoms/radio/radio.doc.mdx +0 -62
- package/src/components/atoms/radio/radio.stories.tsx +0 -48
- package/src/components/atoms/segmented-control/segmented-control.doc.mdx +0 -60
- package/src/components/atoms/segmented-control/segmented-control.stories.tsx +0 -62
- package/src/components/atoms/skeleton/skeleton.doc.mdx +0 -43
- package/src/components/atoms/skeleton/skeleton.stories.tsx +0 -29
- package/src/components/atoms/slide/slide.doc.mdx +0 -46
- package/src/components/atoms/slide/slide.stories.tsx +0 -120
- package/src/components/atoms/slider/slider.doc.mdx +0 -49
- package/src/components/atoms/slider/slider.stories.tsx +0 -29
- package/src/components/atoms/stack/stack.doc.mdx +0 -126
- package/src/components/atoms/stack/stack.stories.tsx +0 -283
- package/src/components/atoms/text/text.doc.mdx +0 -41
- package/src/components/atoms/text/text.stories.tsx +0 -66
- package/src/components/atoms/textarea/textarea.doc.mdx +0 -64
- package/src/components/atoms/textarea/textarea.stories.tsx +0 -26
- package/src/components/atoms/tooltip/tooltip.doc.mdx +0 -47
- package/src/components/atoms/tooltip/tooltip.stories.tsx +0 -19
- package/src/components/isolation/isolation.stories.tsx +0 -202
- package/src/components/molecules/accordion/accordion.doc.mdx +0 -47
- package/src/components/molecules/accordion/accordion.stories.tsx +0 -68
- package/src/components/molecules/alert/alert.doc.mdx +0 -48
- package/src/components/molecules/alert/alert.stories.tsx +0 -40
- package/src/components/molecules/breadcrumbs/breadcrumbs.doc.mdx +0 -57
- package/src/components/molecules/breadcrumbs/breadcrumbs.stories.tsx +0 -20
- package/src/components/molecules/calendar/calendar.doc.mdx +0 -76
- package/src/components/molecules/calendar/calendar.stories.tsx +0 -90
- package/src/components/molecules/card/card.doc.mdx +0 -54
- package/src/components/molecules/card/card.stories.tsx +0 -57
- package/src/components/molecules/chip-input/chip-input.doc.mdx +0 -44
- package/src/components/molecules/chip-input/chip-input.stories.tsx +0 -52
- package/src/components/molecules/date-picker/date-picker.doc.mdx +0 -65
- package/src/components/molecules/date-picker/date-picker.stories.tsx +0 -88
- package/src/components/molecules/dropdown-menu/dropdown-menu.doc.mdx +0 -46
- package/src/components/molecules/dropdown-menu/dropdown-menu.stories.tsx +0 -41
- package/src/components/molecules/empty-state/empty-state.doc.mdx +0 -50
- package/src/components/molecules/empty-state/empty-state.stories.tsx +0 -19
- package/src/components/molecules/field/field.doc.mdx +0 -43
- package/src/components/molecules/field/field.stories.tsx +0 -42
- package/src/components/molecules/form-header/form-header.doc.mdx +0 -38
- package/src/components/molecules/form-header/form-header.stories.tsx +0 -52
- package/src/components/molecules/masked-input/masked-input.doc.mdx +0 -78
- package/src/components/molecules/masked-input/masked-input.stories.tsx +0 -126
- package/src/components/molecules/multi-select/multi-select.doc.mdx +0 -55
- package/src/components/molecules/multi-select/multi-select.stories.tsx +0 -59
- package/src/components/molecules/pagination/pagination.doc.mdx +0 -62
- package/src/components/molecules/pagination/pagination.stories.tsx +0 -110
- package/src/components/molecules/search-select/search-select.doc.mdx +0 -77
- package/src/components/molecules/search-select/search-select.stories.tsx +0 -146
- package/src/components/molecules/select/select.doc.mdx +0 -75
- package/src/components/molecules/select/select.stories.tsx +0 -85
- package/src/components/molecules/stat-card/stat-card.doc.mdx +0 -48
- package/src/components/molecules/stat-card/stat-card.stories.tsx +0 -40
- package/src/components/molecules/stepper/stepper.doc.mdx +0 -54
- package/src/components/molecules/stepper/stepper.stories.tsx +0 -154
- package/src/components/molecules/table/table.doc.mdx +0 -140
- package/src/components/molecules/table/table.stories.tsx +0 -402
- package/src/components/molecules/tabs/tabs.doc.mdx +0 -52
- package/src/components/molecules/tabs/tabs.stories.tsx +0 -31
- package/src/components/molecules/time-picker/timePicker.doc.mdx +0 -68
- package/src/components/molecules/time-picker/timePicker.stories.tsx +0 -130
- package/src/components/molecules/wysiwyg/wysiwyg.stories.tsx +0 -95
- package/src/components/organisms/confirm-dialog/confirm-dialog.doc.mdx +0 -60
- package/src/components/organisms/confirm-dialog/confirm-dialog.stories.tsx +0 -32
- package/src/components/organisms/data-table/ITDataTable.doc.mdx +0 -132
- package/src/components/organisms/data-table/ITDataTable.stories.tsx +0 -353
- package/src/components/organisms/dialog/dialog.doc.mdx +0 -54
- package/src/components/organisms/dialog/dialog.stories.tsx +0 -126
- package/src/components/organisms/drawer/drawer.doc.mdx +0 -59
- package/src/components/organisms/drawer/drawer.stories.tsx +0 -40
- package/src/components/organisms/dropfile/dropfile.doc.mdx +0 -74
- package/src/components/organisms/dropfile/dropfile.stories.tsx +0 -93
- package/src/components/organisms/form-builder/formBuilder.doc.mdx +0 -251
- package/src/components/organisms/form-builder/formBuilder.stories.tsx +0 -914
- package/src/components/organisms/navbar/navbar.doc.mdx +0 -77
- package/src/components/organisms/navbar/navbar.stories.tsx +0 -83
- package/src/components/organisms/page-header/page-header.doc.mdx +0 -54
- package/src/components/organisms/page-header/page-header.stories.tsx +0 -74
- package/src/components/organisms/searchTable/searchTable.doc.mdx +0 -79
- package/src/components/organisms/searchTable/searchTable.stories.tsx +0 -73
- package/src/components/organisms/sidebar/sidebar.doc.mdx +0 -176
- package/src/components/organisms/sidebar/sidebar.stories.tsx +0 -234
- package/src/components/organisms/toast/toast.doc.mdx +0 -50
- package/src/components/organisms/toast/toast.stories.tsx +0 -137
- package/src/components/organisms/topbar/topbar.doc.mdx +0 -72
- package/src/components/organisms/topbar/topbar.stories.tsx +0 -79
- package/src/components/organisms/triple-filter/tripleFilter.doc.mdx +0 -62
- package/src/components/organisms/triple-filter/tripleFilter.stories.tsx +0 -31
- package/src/components/templates/layout/layout.doc.mdx +0 -53
- package/src/components/templates/layout/layout.stories.tsx +0 -113
- package/src/components/templates/page/page.doc.mdx +0 -86
- package/src/components/templates/page/page.stories.tsx +0 -97
- package/src/components/theme-provider/themeProvider.doc.mdx +0 -85
- package/src/components/theme-provider/themeProvider.stories.tsx +0 -58
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { Meta, Title, Description, Primary, Controls, Stories } from '@storybook/blocks';
|
|
2
|
-
import * as StoriesData from './navbar.stories';
|
|
3
|
-
|
|
4
|
-
<Meta of={StoriesData} />
|
|
5
|
-
|
|
6
|
-
# ITNavbar
|
|
7
|
-
|
|
8
|
-
A full sidebar navigation shell for application layouts. Provides collapsible submenus with expand/collapse animation, active state highlighting via `isActive`, and an optional user menu dropdown with avatar, name, and email.
|
|
9
|
-
|
|
10
|
-
## Props
|
|
11
|
-
|
|
12
|
-
| Prop | Type | Default | Description |
|
|
13
|
-
|------|------|---------|-------------|
|
|
14
|
-
| `navigationItems` | `ITNavigationItem[]` | `undefined` | Navigation items with labels, icons, subitems, and active states. |
|
|
15
|
-
| `logo` | `ReactNode` | `undefined` | Logo element rendered in the sidebar header. |
|
|
16
|
-
| `logoText` | `string` | `undefined` | Text displayed next to the logo. |
|
|
17
|
-
| `userMenu` | `{ userImage?, userName, userEmail, menuItems }` | `undefined` | User dropdown configuration. |
|
|
18
|
-
| `children` | `ReactNode` | `undefined` | Main content rendered next to the sidebar. |
|
|
19
|
-
| `navItems` | `ReactNode` | `undefined` | **Deprecated.** Use `navigationItems` instead. |
|
|
20
|
-
| `showSidebar` | `boolean` | `undefined` | **Deprecated.** Legacy flag. |
|
|
21
|
-
| `showSidebarOnMobile` | `boolean` | `undefined` | **Deprecated.** Legacy flag. |
|
|
22
|
-
| `sidebarItems` | `ReactNode` | `undefined` | **Deprecated.** Use `navigationItems` instead. |
|
|
23
|
-
|
|
24
|
-
### ITNavigationItem
|
|
25
|
-
|
|
26
|
-
| Prop | Type | Default | Description |
|
|
27
|
-
|------|------|---------|-------------|
|
|
28
|
-
| `id` | `string` | required | Unique identifier. |
|
|
29
|
-
| `label` | `string` | required | Display label. |
|
|
30
|
-
| `icon` | `ReactNode` | `undefined` | Icon rendered next to the label. |
|
|
31
|
-
| `action` | `() => void` | `undefined` | Callback on click. |
|
|
32
|
-
| `isActive` | `boolean` | `false` | Whether the item is currently highlighted as active. |
|
|
33
|
-
| `subitems` | `ITNavigationSubItem[]` | `undefined` | Nested items shown on expand. |
|
|
34
|
-
|
|
35
|
-
### ITNavigationSubItem
|
|
36
|
-
|
|
37
|
-
| Prop | Type | Default | Description |
|
|
38
|
-
|------|------|---------|-------------|
|
|
39
|
-
| `id` | `string` | required | Unique identifier. |
|
|
40
|
-
| `label` | `string` | required | Display label. |
|
|
41
|
-
| `action` | `() => void` | required | Callback on click. |
|
|
42
|
-
| `isActive` | `boolean` | `false` | Whether the sub-item is highlighted. |
|
|
43
|
-
|
|
44
|
-
## Usage
|
|
45
|
-
|
|
46
|
-
```tsx
|
|
47
|
-
import { ITNavbar } from '@axzydev/axzy_ui_system';
|
|
48
|
-
import { FaHome, FaChartBar } from 'react-icons/fa';
|
|
49
|
-
|
|
50
|
-
<ITNavbar
|
|
51
|
-
logoText="AXZY"
|
|
52
|
-
navigationItems={[
|
|
53
|
-
{ id: 'home', label: 'Dashboard', icon: <FaHome />, isActive: true },
|
|
54
|
-
{ id: 'analytics', label: 'Analytics', icon: <FaChartBar />,
|
|
55
|
-
subitems: [{ id: 'reports', label: 'Reports', action: () => {} }]
|
|
56
|
-
}
|
|
57
|
-
]}
|
|
58
|
-
userMenu={{ userName: 'John', userEmail: 'john@axzy.dev', menuItems: [...] }}
|
|
59
|
-
>
|
|
60
|
-
<div>Content area</div>
|
|
61
|
-
</ITNavbar>
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## Notes
|
|
65
|
-
|
|
66
|
-
- Sidebar has a collapsed state where only icons are visible; expanding shows labels.
|
|
67
|
-
- Submenus animate open/closed with a height transition.
|
|
68
|
-
- Items with `isActive` are visually highlighted.
|
|
69
|
-
- `userMenu` renders a dropdown at the bottom of the sidebar with user info and action items.
|
|
70
|
-
- Legacy props (`navItems`, `showSidebar`, etc.) are maintained for backward compatibility but should be migrated to `navigationItems`.
|
|
71
|
-
- Supports dark mode via CSS variables from the theme provider.
|
|
72
|
-
|
|
73
|
-
## Stories
|
|
74
|
-
|
|
75
|
-
<Primary />
|
|
76
|
-
<Controls />
|
|
77
|
-
<Stories />
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import ITNavbar from '@/components/organisms/navbar/navbar';
|
|
3
|
-
import { FaHome, FaChartBar, FaCog, FaUsers } from 'react-icons/fa';
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
title: 'Components/Layout & Navigation/ITNavbar',
|
|
7
|
-
component: ITNavbar,
|
|
8
|
-
parameters: { layout: 'fullscreen' },
|
|
9
|
-
argTypes: {
|
|
10
|
-
logoText: { control: 'text', description: 'Text displayed next to the logo' },
|
|
11
|
-
navigationItems: { control: false, description: 'Navigation items with optional sub-items' },
|
|
12
|
-
userMenu: { control: false, description: 'User menu configuration' },
|
|
13
|
-
children: { control: false, description: 'Main content area' },
|
|
14
|
-
},
|
|
15
|
-
} satisfies Meta<typeof ITNavbar>;
|
|
16
|
-
|
|
17
|
-
export default meta;
|
|
18
|
-
type Story = StoryObj<typeof meta>;
|
|
19
|
-
|
|
20
|
-
const sampleNavigationItems = [
|
|
21
|
-
{
|
|
22
|
-
id: 'home',
|
|
23
|
-
label: 'Dashboard',
|
|
24
|
-
icon: <FaHome />,
|
|
25
|
-
action: () => {},
|
|
26
|
-
isActive: true,
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
id: 'analytics',
|
|
30
|
-
label: 'Analytics',
|
|
31
|
-
icon: <FaChartBar />,
|
|
32
|
-
action: () => {},
|
|
33
|
-
subitems: [
|
|
34
|
-
{ id: 'reports', label: 'Reports', action: () => {} },
|
|
35
|
-
{ id: 'metrics', label: 'Metrics', action: () => {} },
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
id: 'users',
|
|
40
|
-
label: 'Users',
|
|
41
|
-
icon: <FaUsers />,
|
|
42
|
-
action: () => {},
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
id: 'settings',
|
|
46
|
-
label: 'Settings',
|
|
47
|
-
icon: <FaCog />,
|
|
48
|
-
action: () => {},
|
|
49
|
-
},
|
|
50
|
-
];
|
|
51
|
-
|
|
52
|
-
export const Default: Story = {
|
|
53
|
-
args: {
|
|
54
|
-
logoText: 'AXZY',
|
|
55
|
-
navigationItems: sampleNavigationItems,
|
|
56
|
-
userMenu: {
|
|
57
|
-
userName: 'John Doe',
|
|
58
|
-
userEmail: 'john@axzy.dev',
|
|
59
|
-
menuItems: [
|
|
60
|
-
{ label: 'Profile', onClick: () => alert('Profile') },
|
|
61
|
-
{ label: 'Logout', onClick: () => alert('Logout') },
|
|
62
|
-
],
|
|
63
|
-
},
|
|
64
|
-
children: (
|
|
65
|
-
<div className="p-8">
|
|
66
|
-
<h1 className="text-2xl font-bold text-slate-800 dark:text-white">Welcome to AXZY</h1>
|
|
67
|
-
<p className="text-slate-500 dark:text-slate-400 mt-2">Main content area goes here.</p>
|
|
68
|
-
</div>
|
|
69
|
-
),
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export const NoUserMenu: Story = {
|
|
74
|
-
args: {
|
|
75
|
-
logoText: 'AXZY',
|
|
76
|
-
navigationItems: sampleNavigationItems,
|
|
77
|
-
children: (
|
|
78
|
-
<div className="p-8">
|
|
79
|
-
<h1 className="text-2xl font-bold text-slate-800 dark:text-white">Public View</h1>
|
|
80
|
-
</div>
|
|
81
|
-
),
|
|
82
|
-
},
|
|
83
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Meta, Title, Description, Primary, Controls, Stories } from '@storybook/blocks';
|
|
2
|
-
import * as StoriesData from './page-header.stories';
|
|
3
|
-
|
|
4
|
-
<Meta of={StoriesData} />
|
|
5
|
-
|
|
6
|
-
# ITPageHeader
|
|
7
|
-
|
|
8
|
-
A page title bar component that displays a heading with optional breadcrumbs, description text, action buttons, and a back navigation button. Designed to sit at the top of page content for consistent page-level navigation.
|
|
9
|
-
|
|
10
|
-
## Props
|
|
11
|
-
|
|
12
|
-
| Prop | Type | Default | Description |
|
|
13
|
-
|------|------|---------|-------------|
|
|
14
|
-
| `title` | `string` | required | Page title displayed as the main heading. |
|
|
15
|
-
| `description` | `string` | `undefined` | Optional description text shown below the title. |
|
|
16
|
-
| `breadcrumbs` | `ITBreadcrumbItem[]` | `undefined` | Breadcrumb navigation items above the title. |
|
|
17
|
-
| `actions` | `ReactNode` | `undefined` | Action buttons or elements rendered on the right side. |
|
|
18
|
-
| `backAction` | `() => void` | `undefined` | Callback fired when the back button is clicked. |
|
|
19
|
-
| `icon` | `ReactNode` | `undefined` | Optional icon displayed next to the title. |
|
|
20
|
-
| `iconColor` | `string` | `undefined` | Custom CSS color value for the icon. |
|
|
21
|
-
| `className` | `string` | `undefined` | Additional CSS classes for the container. |
|
|
22
|
-
|
|
23
|
-
## Usage
|
|
24
|
-
|
|
25
|
-
```tsx
|
|
26
|
-
import { ITPageHeader } from '@axzydev/axzy_ui_system';
|
|
27
|
-
import { FaUsers } from 'react-icons/fa';
|
|
28
|
-
|
|
29
|
-
<ITPageHeader
|
|
30
|
-
title="Users"
|
|
31
|
-
description="Manage system users"
|
|
32
|
-
breadcrumbs={[{ label: 'Dashboard', href: '#' }, { label: 'Users' }]}
|
|
33
|
-
actions={<ITButton label="Add User" />}
|
|
34
|
-
/>
|
|
35
|
-
<ITPageHeader
|
|
36
|
-
title="Edit User"
|
|
37
|
-
backAction={() => navigate(-1)}
|
|
38
|
-
breadcrumbs={[{ label: 'Users', href: '/users' }, { label: 'Edit' }]}
|
|
39
|
-
/>
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Notes
|
|
43
|
-
|
|
44
|
-
- Breadcrumbs render above the title using the ITBreadcrumbs component.
|
|
45
|
-
- `backAction` renders a left-arrow button before the content; breadcrumbs shift to the right of the back button.
|
|
46
|
-
- The `icon` slot places an icon beside the title, colored by `iconColor` or the primary theme color.
|
|
47
|
-
- Actions area accepts any React nodes; typically ITButton components with `small` sizing.
|
|
48
|
-
- The component uses a flex layout: breadcrumbs + back button on the left, actions on the right.
|
|
49
|
-
|
|
50
|
-
## Stories
|
|
51
|
-
|
|
52
|
-
<Primary />
|
|
53
|
-
<Controls />
|
|
54
|
-
<Stories />
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import { FaUsers } from "react-icons/fa";
|
|
3
|
-
import ITPageHeader from "@/components/organisms/page-header/page-header";
|
|
4
|
-
import ITButton from "@/components/atoms/button/button";
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof ITPageHeader> = {
|
|
7
|
-
title: "Components/Layout/ITPageHeader",
|
|
8
|
-
component: ITPageHeader,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default meta;
|
|
12
|
-
type Story = StoryObj<typeof ITPageHeader>;
|
|
13
|
-
|
|
14
|
-
export const Default: Story = {
|
|
15
|
-
args: {
|
|
16
|
-
title: "Usuarios",
|
|
17
|
-
description: "Gestiona los usuarios del sistema",
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const WithBreadcrumbs: Story = {
|
|
22
|
-
args: {
|
|
23
|
-
title: "Editar Usuario",
|
|
24
|
-
description: "Modifica los datos del usuario seleccionado",
|
|
25
|
-
breadcrumbs: [
|
|
26
|
-
{ label: "Inicio", href: "#" },
|
|
27
|
-
{ label: "Usuarios", href: "#" },
|
|
28
|
-
{ label: "Editar Usuario" },
|
|
29
|
-
],
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const WithActions: Story = {
|
|
34
|
-
args: {
|
|
35
|
-
title: "Órdenes de Compra",
|
|
36
|
-
description: "Listado de órdenes activas",
|
|
37
|
-
breadcrumbs: [
|
|
38
|
-
{ label: "Dashboard", href: "#" },
|
|
39
|
-
{ label: "Órdenes" },
|
|
40
|
-
],
|
|
41
|
-
actions: (
|
|
42
|
-
<>
|
|
43
|
-
<ITButton label="Exportar" variant="outlined" size="sm" />
|
|
44
|
-
<ITButton label="Nueva Orden" size="sm" />
|
|
45
|
-
</>
|
|
46
|
-
),
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export const WithBackAction: Story = {
|
|
51
|
-
args: {
|
|
52
|
-
title: "Detalle del Producto",
|
|
53
|
-
description: "Información completa del producto",
|
|
54
|
-
backAction: () => alert("Back clicked"),
|
|
55
|
-
breadcrumbs: [
|
|
56
|
-
{ label: "Productos", href: "#" },
|
|
57
|
-
{ label: "Detalle" },
|
|
58
|
-
],
|
|
59
|
-
actions: <ITButton label="Editar" size="sm" />,
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export const WithIcon: Story = {
|
|
64
|
-
args: {
|
|
65
|
-
title: "Usuarios",
|
|
66
|
-
description: "Gestiona los usuarios del sistema",
|
|
67
|
-
icon: <FaUsers size={20} />,
|
|
68
|
-
iconColor: "#6366f1",
|
|
69
|
-
breadcrumbs: [
|
|
70
|
-
{ label: "Inicio", href: "#" },
|
|
71
|
-
{ label: "Usuarios" },
|
|
72
|
-
],
|
|
73
|
-
},
|
|
74
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { Meta, Title, Description, Primary, Controls, Stories } from '@storybook/blocks';
|
|
2
|
-
import * as StoriesData from './searchTable.stories';
|
|
3
|
-
|
|
4
|
-
<Meta of={StoriesData} />
|
|
5
|
-
|
|
6
|
-
# ITSearchTable
|
|
7
|
-
|
|
8
|
-
Server-side data table with global search across all fields, column-level filtering, sortable columns, inline row editing, and integrated pagination. Supports six column types and optional Yup validation schema.
|
|
9
|
-
|
|
10
|
-
## Props
|
|
11
|
-
|
|
12
|
-
| Prop | Type | Default | Description |
|
|
13
|
-
|------|------|---------|-------------|
|
|
14
|
-
| `columns` | `SearchColumn<T>[]` | — | Column definitions with key, label, type, filter, sortable, editable, and custom render options. |
|
|
15
|
-
| `data` | `T[]` | — | Array of row data objects (server-side paginated). |
|
|
16
|
-
| `title` | `string` | — | Title displayed in the table header bar. |
|
|
17
|
-
| `searchInputPlaceholder` | `string` | — | Placeholder text for the global search input. |
|
|
18
|
-
| `variant` | `"default" \| "striped" \| "bordered"` | — | Table visual variant. |
|
|
19
|
-
| `size` | `"sm" \| "md" \| "lg"` | — | Table row size. |
|
|
20
|
-
| `containerClassName` | `string` | — | Additional CSS class for the outer container wrapper. |
|
|
21
|
-
| `className` | `string` | — | Additional CSS class applied to the `<table>` element. |
|
|
22
|
-
| `itemsPerPageOptions` | `number[]` | — | Available page-size options for the pagination dropdown. |
|
|
23
|
-
| `defaultItemsPerPage` | `number` | — | Initial/default number of rows per page. |
|
|
24
|
-
| `validationSchema` | `yup.ObjectSchema` | — | Yup validation schema for inline row editing. |
|
|
25
|
-
| `pageIndex` | `number` | — | Current page index (0-based, server-side). |
|
|
26
|
-
| `totalCount` | `number` | — | Total number of rows across all pages. |
|
|
27
|
-
| `totalPages` | `number` | — | Total number of available pages. |
|
|
28
|
-
| `hasPreviousPage` | `boolean` | — | Whether there is a previous page available. |
|
|
29
|
-
| `hasNextPage` | `boolean` | — | Whether there is a next page available. |
|
|
30
|
-
| `onPageChange` | `(page: number) => void` | — | Callback when the user navigates to a different page. |
|
|
31
|
-
| `onItemsPerPageChange` | `(itemsPerPage: number) => void` | — | Callback when the user changes the page size. |
|
|
32
|
-
| `onSortChange` | `(sortConfig: { key: string, direction: "asc" \| "desc" }) => void` | — | Callback when a column header sort is triggered. |
|
|
33
|
-
| `onFilterChange` | `(filters: Record<string, string \| boolean \| number>) => void` | — | Callback when global search or column filter changes. |
|
|
34
|
-
|
|
35
|
-
## Usage
|
|
36
|
-
|
|
37
|
-
```tsx
|
|
38
|
-
import { ITSearchTable } from '@axzydev/axzy_ui_system';
|
|
39
|
-
import type { SearchColumn } from '@axzydev/axzy_ui_system';
|
|
40
|
-
|
|
41
|
-
const columns: SearchColumn<MyRow>[] = [
|
|
42
|
-
{ key: 'id', label: 'ID', type: 'number', sortable: true },
|
|
43
|
-
{ key: 'name', label: 'Name', type: 'string', sortable: true, filter: true, editable: true },
|
|
44
|
-
{ key: 'email', label: 'Email', type: 'string', sortable: true },
|
|
45
|
-
{ key: 'status', label: 'Status', type: 'catalog', filter: 'catalog', sortable: true },
|
|
46
|
-
];
|
|
47
|
-
|
|
48
|
-
<ITSearchTable
|
|
49
|
-
columns={columns}
|
|
50
|
-
data={rows}
|
|
51
|
-
title="Users"
|
|
52
|
-
searchInputPlaceholder="Search users..."
|
|
53
|
-
pageIndex={0}
|
|
54
|
-
totalCount={100}
|
|
55
|
-
totalPages={10}
|
|
56
|
-
hasPreviousPage={false}
|
|
57
|
-
hasNextPage={true}
|
|
58
|
-
onPageChange={handlePageChange}
|
|
59
|
-
onSortChange={handleSort}
|
|
60
|
-
onFilterChange={handleFilter}
|
|
61
|
-
/>
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## Notes
|
|
65
|
-
|
|
66
|
-
- **Column types**: `string`, `number`, `boolean`, `date`, `actions`, and `catalog` provide specialized filtering and rendering.
|
|
67
|
-
- **Global search**: built-in search input filters across all filterable columns via `onFilterChange`.
|
|
68
|
-
- **Column filtering**: `filter: true` enables text filtering; `filter: 'catalog'` renders a dropdown with `catalogOptions`.
|
|
69
|
-
- **Sorting**: `sortable: true` on a column triggers `onSortChange` with `{ key, direction }`.
|
|
70
|
-
- **Inline editing**: `editable: true` with `inputType` enables cell-level editing with optional `validation` and Yup `validationSchema` support.
|
|
71
|
-
- **Pagination**: fully server-driven via `pageIndex`, `totalPages`, `hasPreviousPage`, `hasNextPage`, and callbacks.
|
|
72
|
-
- **Rendering**: `currencyMX` formats numbers as MXN; `render` provides a custom cell render function; `actions` renders custom action buttons with edit helpers.
|
|
73
|
-
- Variants `striped` and `bordered` provide alternative visual styles.
|
|
74
|
-
|
|
75
|
-
## Stories
|
|
76
|
-
|
|
77
|
-
<Primary />
|
|
78
|
-
<Controls />
|
|
79
|
-
<Stories />
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import ITSearchTable from '@/components/organisms/searchTable/searchTable';
|
|
3
|
-
import { SearchColumn } from './searchTable.props';
|
|
4
|
-
|
|
5
|
-
interface SampleRow {
|
|
6
|
-
id: number;
|
|
7
|
-
name: string;
|
|
8
|
-
email: string;
|
|
9
|
-
status: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const sampleColumns: SearchColumn<SampleRow>[] = [
|
|
13
|
-
{ key: 'id', label: 'ID', type: 'number', sortable: true },
|
|
14
|
-
{ key: 'name', label: 'Name', type: 'string', sortable: true, filter: true },
|
|
15
|
-
{ key: 'email', label: 'Email', type: 'string', sortable: true },
|
|
16
|
-
{ key: 'status', label: 'Status', type: 'catalog', filter: 'catalog', sortable: true },
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
const sampleData: SampleRow[] = [
|
|
20
|
-
{ id: 1, name: 'Alice', email: 'alice@example.com', status: 'Active' },
|
|
21
|
-
{ id: 2, name: 'Bob', email: 'bob@example.com', status: 'Inactive' },
|
|
22
|
-
{ id: 3, name: 'Charlie', email: 'charlie@example.com', status: 'Active' },
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
const meta = {
|
|
26
|
-
title: 'Components/Data Display/ITSearchTable',
|
|
27
|
-
component: ITSearchTable,
|
|
28
|
-
parameters: { layout: 'padded' },
|
|
29
|
-
argTypes: {
|
|
30
|
-
columns: { control: false, description: 'Column definitions' },
|
|
31
|
-
data: { control: false, description: 'Row data array' },
|
|
32
|
-
title: { control: 'text', description: 'Table header title' },
|
|
33
|
-
searchInputPlaceholder: { control: 'text', description: 'Placeholder for the search input' },
|
|
34
|
-
variant: { control: 'select', options: ['default', 'striped', 'bordered'], description: 'Visual variant' },
|
|
35
|
-
size: { control: 'select', options: ['sm', 'md', 'lg'], description: 'Row size' },
|
|
36
|
-
pageIndex: { control: 'number', description: 'Current page index (0-based)' },
|
|
37
|
-
totalCount: { control: 'number', description: 'Total number of rows across all pages' },
|
|
38
|
-
totalPages: { control: 'number', description: 'Total number of pages' },
|
|
39
|
-
hasPreviousPage: { control: 'boolean', description: 'Whether there is a previous page' },
|
|
40
|
-
hasNextPage: { control: 'boolean', description: 'Whether there is a next page' },
|
|
41
|
-
},
|
|
42
|
-
} satisfies Meta<typeof ITSearchTable>;
|
|
43
|
-
|
|
44
|
-
export default meta;
|
|
45
|
-
type Story = StoryObj<typeof meta>;
|
|
46
|
-
|
|
47
|
-
export const Default: Story = {
|
|
48
|
-
args: {
|
|
49
|
-
columns: sampleColumns,
|
|
50
|
-
data: sampleData,
|
|
51
|
-
title: 'Users',
|
|
52
|
-
searchInputPlaceholder: 'Search users...',
|
|
53
|
-
pageIndex: 0,
|
|
54
|
-
totalCount: 3,
|
|
55
|
-
totalPages: 1,
|
|
56
|
-
hasPreviousPage: false,
|
|
57
|
-
hasNextPage: false,
|
|
58
|
-
} as any,
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const EmptyState: Story = {
|
|
62
|
-
args: {
|
|
63
|
-
columns: sampleColumns,
|
|
64
|
-
data: [],
|
|
65
|
-
title: 'Users',
|
|
66
|
-
searchInputPlaceholder: 'Search users...',
|
|
67
|
-
pageIndex: 0,
|
|
68
|
-
totalCount: 0,
|
|
69
|
-
totalPages: 0,
|
|
70
|
-
hasPreviousPage: false,
|
|
71
|
-
hasNextPage: false,
|
|
72
|
-
} as any,
|
|
73
|
-
};
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { Meta, Title, Description, Primary, Controls, Stories } from '@storybook/blocks';
|
|
2
|
-
import * as StoriesData from './sidebar.stories';
|
|
3
|
-
|
|
4
|
-
<Meta of={StoriesData} />
|
|
5
|
-
|
|
6
|
-
# ITSidebar
|
|
7
|
-
|
|
8
|
-
Vertical navigation sidebar with collapsible submenus, tooltips when collapsed, active item highlighting, badge support, and themed glassmorphism styling. Designed for admin panels and dashboard layouts.
|
|
9
|
-
|
|
10
|
-
## Props
|
|
11
|
-
|
|
12
|
-
| Prop | Type | Default | Description |
|
|
13
|
-
|------|------|---------|-------------|
|
|
14
|
-
| `navigationItems` | `ITNavigationItem[]` | — | Navigation structure: top-level items with optional sub-items. |
|
|
15
|
-
| `isCollapsed` | `boolean` | `false` | Whether the sidebar is collapsed to icon-only mode. |
|
|
16
|
-
| `onToggleCollapse` | `() => void` | — | Accepted for API compatibility but never invoked by `ITSidebar`: the component renders no collapse toggle button (the rail expands on pointer hover). `ITLayout` still passes it through. |
|
|
17
|
-
| `visibleOnMobile` | `boolean` | `false` | When `true`, the sidebar is always fully expanded (the collapsed 88px rail is disabled) and visible at every breakpoint. |
|
|
18
|
-
| `onItemClick` | `(item: ITNavigationItem) => void` | — | Callback when a top-level navigation item is clicked. |
|
|
19
|
-
| `onSubItemClick` | `(subitem: ITNavigationSubItem) => void` | — | Callback when a sub-navigation item is clicked. |
|
|
20
|
-
| `subitemConnector` | `"dot" \| "\|" \| "none"` | `"dot"` | Visual connector style for sub-items. |
|
|
21
|
-
| `className` | `string` | — | Additional CSS classes on the sidebar `<aside>`. |
|
|
22
|
-
| `header` | `ReactNode` | — | Optional content rendered above the navigation list (e.g. a wordmark). Hidden while the sidebar is collapsed, so it only appears when the hover-expanded rail is shown. |
|
|
23
|
-
| `notification` | `ITSidebarNotification` | — | Optional notification entry (icon + label + `ITBadget` counter) pinned above the navigation. Unlike `header`, it stays visible while collapsed, showing only the icon and counter. |
|
|
24
|
-
| `brand` | `ITSidebarBrand` | — | Brand (`logo` + `text`) pinned in a 64px row at the very top. The logo stays visible while collapsed; the text does not. `ITLayout` fills it from `topBar.logo` / `topBar.logoText` when `sidebarFullHeight` is set. |
|
|
25
|
-
| `expandOnHover` | `boolean` | `true` | `true`: the collapsed rail expands over the content on hover. `false`: it stays an icon-only rail (item name in a tooltip) and only opens through `onToggleCollapse` — the top bar menu button in `ITLayout`. Clicking a collapsed parent item opens the sidebar with that group expanded. |
|
|
26
|
-
|
|
27
|
-
### ITNavigationItem
|
|
28
|
-
|
|
29
|
-
| Prop | Type | Description |
|
|
30
|
-
|------|------|-------------|
|
|
31
|
-
| `id` | `string` | Unique identifier. |
|
|
32
|
-
| `label` | `string` | Display label. |
|
|
33
|
-
| `icon` | `ReactNode` | Icon rendered left of the label. |
|
|
34
|
-
| `action` | `() => void` | Click handler for top-level items without submenus. |
|
|
35
|
-
| `isActive` | `boolean` | Whether this item is active/highlighted. |
|
|
36
|
-
| `subitems` | `ITNavigationSubItemEntry[]` | Array of entries: plain sub-items or titled groups (`ITNavigationSubItemGroup`). |
|
|
37
|
-
| `badge` | `number \| string` | Notification content rendered with `ITBadget` (e.g. an unread count). |
|
|
38
|
-
| `badgeProps` | `ITBadgetProps` | Styling forwarded to the item badge (`color`, `size`, `variant`, `className` for padding). |
|
|
39
|
-
|
|
40
|
-
### ITSidebarNotification
|
|
41
|
-
|
|
42
|
-
| Prop | Type | Default | Description |
|
|
43
|
-
|------|------|---------|-------------|
|
|
44
|
-
| `count` | `number` | — | Count displayed inside the notification `ITBadget`. |
|
|
45
|
-
| `icon` | `ReactNode` | — | Icon rendered left of the label (e.g. a bell). Omit for a count-only pill. |
|
|
46
|
-
| `label` | `string` | `"Notificaciones"` | Accessible label and tooltip for the notification button. |
|
|
47
|
-
| `onClick` | `() => void` | — | Click handler for the notification button. |
|
|
48
|
-
| `badgeProps` | `ITBadgetProps` | `{ color: "danger", size: "sm" }` | Styling forwarded to the internal `ITBadget`; use `className` for padding. |
|
|
49
|
-
|
|
50
|
-
### ITNavigationSubItem
|
|
51
|
-
|
|
52
|
-
| Prop | Type | Description |
|
|
53
|
-
|------|------|-------------|
|
|
54
|
-
| `id` | `string` | Unique identifier. |
|
|
55
|
-
| `label` | `string` | Display label. |
|
|
56
|
-
| `action` | `() => void` | Click handler. |
|
|
57
|
-
| `isActive` | `boolean` | Whether this sub-item is active/highlighted. |
|
|
58
|
-
|
|
59
|
-
### ITNavigationSubItemGroup
|
|
60
|
-
|
|
61
|
-
| Prop | Type | Description |
|
|
62
|
-
|------|------|-------------|
|
|
63
|
-
| `id` | `string` | Unique identifier for the group (used for the React key and the heading id). |
|
|
64
|
-
| `label` | `string` | Heading text rendered above the group's items. |
|
|
65
|
-
| `items` | `ITNavigationSubItem[]` | Sub-items belonging to this group. Nesting a group inside a group is not supported. |
|
|
66
|
-
|
|
67
|
-
### ITNavigationSubItemEntry
|
|
68
|
-
|
|
69
|
-
A submenu entry is either a plain `ITNavigationSubItem` or a titled `ITNavigationSubItemGroup`; narrow it with `"items" in entry`.
|
|
70
|
-
|
|
71
|
-
## Usage
|
|
72
|
-
|
|
73
|
-
```tsx
|
|
74
|
-
import { ITSidebar } from '@axzydev/axzy_ui_system';
|
|
75
|
-
import { FaHome, FaUsers, FaCog } from 'react-icons/fa';
|
|
76
|
-
|
|
77
|
-
const items = [
|
|
78
|
-
{ id: 'dashboard', label: 'Dashboard', icon: <FaHome />, isActive: true, action: () => {} },
|
|
79
|
-
{
|
|
80
|
-
id: 'users',
|
|
81
|
-
label: 'Users',
|
|
82
|
-
icon: <FaUsers />,
|
|
83
|
-
badge: '3',
|
|
84
|
-
subitems: [
|
|
85
|
-
{ id: 'users-list', label: 'User List', action: () => {} },
|
|
86
|
-
{ id: 'users-roles', label: 'Roles', action: () => {}, isActive: true },
|
|
87
|
-
],
|
|
88
|
-
},
|
|
89
|
-
];
|
|
90
|
-
|
|
91
|
-
<ITSidebar
|
|
92
|
-
navigationItems={items}
|
|
93
|
-
isCollapsed={false}
|
|
94
|
-
subitemConnector="dot"
|
|
95
|
-
/>
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
To group sub-items under a heading, replace a plain sub-item with a group object (`label` + `items`):
|
|
99
|
-
|
|
100
|
-
```tsx
|
|
101
|
-
const items = [
|
|
102
|
-
{
|
|
103
|
-
id: 'sales',
|
|
104
|
-
label: 'Sales',
|
|
105
|
-
subitems: [
|
|
106
|
-
{ id: 'summary', label: 'Summary', action: () => {} },
|
|
107
|
-
{
|
|
108
|
-
id: 'gestion',
|
|
109
|
-
label: 'Management',
|
|
110
|
-
items: [
|
|
111
|
-
{ id: 'orders', label: 'Orders', action: () => {} },
|
|
112
|
-
{ id: 'invoices', label: 'Invoices', action: () => {} },
|
|
113
|
-
],
|
|
114
|
-
},
|
|
115
|
-
],
|
|
116
|
-
},
|
|
117
|
-
];
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
Discriminate entries with `"items" in entry`. The heading style (uppercase, `0.68rem`, weight 700, `0.08em` tracking, `var(--it-sidebar-icon-color, var(--color-secondary-400))`) is applied by the component and cannot be overridden per group.
|
|
121
|
-
|
|
122
|
-
## Notifications and badges
|
|
123
|
-
|
|
124
|
-
Item badges and the notification row both render the `ITBadget` atom. Use `badge` for a per-item counter and `notification` for a top-level entry (e.g. a bell):
|
|
125
|
-
|
|
126
|
-
```tsx
|
|
127
|
-
import { ITSidebar } from '@axzydev/axzy_ui_system';
|
|
128
|
-
import { FaBell } from 'react-icons/fa';
|
|
129
|
-
|
|
130
|
-
const items = [
|
|
131
|
-
{ id: 'dashboard', label: 'Dashboard', isActive: true, action: () => {} },
|
|
132
|
-
{ id: 'inbox', label: 'Inbox', badge: 12, action: () => {} },
|
|
133
|
-
{
|
|
134
|
-
id: 'alerts',
|
|
135
|
-
label: 'Alerts',
|
|
136
|
-
badge: 3,
|
|
137
|
-
badgeProps: { color: 'warning', variant: 'outlined' },
|
|
138
|
-
action: () => {},
|
|
139
|
-
},
|
|
140
|
-
];
|
|
141
|
-
|
|
142
|
-
<ITSidebar
|
|
143
|
-
navigationItems={items}
|
|
144
|
-
notification={{
|
|
145
|
-
count: 5,
|
|
146
|
-
icon: <FaBell />,
|
|
147
|
-
label: 'Notifications',
|
|
148
|
-
onClick: () => {},
|
|
149
|
-
// Tweak the ITBadget, incl. padding via className.
|
|
150
|
-
badgeProps: { color: 'danger', className: 'px-2' },
|
|
151
|
-
}}
|
|
152
|
-
/>
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
## Notes
|
|
156
|
-
|
|
157
|
-
- There is no collapse toggle button: the collapsed 88px rail expands and collapses automatically on pointer hover (300 ms leave delay).
|
|
158
|
-
- Collapsed mode shrinks to icon-only; a glassmorphism panel shows the item's sub-items on hover. For an item whose `subitems` contain groups, that panel **flattens** every group into one plain list and renders **no** group headings.
|
|
159
|
-
- Submenus expand/collapse with smooth transitions when a parent item is clicked; the expanded submenu is animated with a `max-h` transition (cap `1000px`).
|
|
160
|
-
- Active item highlighting uses a colored left-border accent and subtle background tint.
|
|
161
|
-
- Badge support renders a notification-style counter on the item using the `ITBadget` atom; customize it with `badgeProps` (`color`, `size`, `variant`, `className`). The sidebar also accepts a `notification` entry (icon + label + `ITBadget` counter) pinned above the navigation, which stays visible while collapsed as icon + counter.
|
|
162
|
-
- `subitemConnector` styles the visual link between parent and sub-items: `dot` (default), `|` (vertical bar), or `none`. Grouping does not change it: the `|` guide is a single `border-left` on the outer submenu `<ul>` only.
|
|
163
|
-
- An active sub-item inside a group still auto-expands its parent, because auto-expand flattens groups the same way the collapsed flyout does.
|
|
164
|
-
- `visibleOnMobile` forces the sidebar visible at every breakpoint and disables the collapsed rail, so it stays fully expanded.
|
|
165
|
-
- Themed via CSS variables for consistent colors, shadows, and glassmorphism effects across light and dark modes.
|
|
166
|
-
- Accessible by default: the `<nav>` is labelled and carries the `id` referenced by the toggle's `aria-controls`, the toggle exposes `aria-expanded` plus a visible `focus-visible` ring, group toggles expose `aria-expanded`/`aria-controls` and respond to Enter/Space, submenus are labelled `role="group"`, and the active sub-item carries `aria-current="page"`.
|
|
167
|
-
- `subitems` accepts plain sub-items or titled groups (`label` + `items`); the group heading is rendered as a plain `<span>` inside a non-focusable `<div>`, so it is non-interactive and stays out of the tab order.
|
|
168
|
-
- Each group's inner `<ul>` keeps list semantics and is named by its heading through `aria-labelledby`, so it is reachable as a named list.
|
|
169
|
-
- Groups are purely visual: they add no third nesting level (the sidebar supports exactly one level of nesting).
|
|
170
|
-
- Consumers that introspect `navigationItems[].subitems` must narrow each entry first, e.g. `"items" in entry ? entry.items : [entry]`, because entries are typed as `ITNavigationSubItemEntry`.
|
|
171
|
-
|
|
172
|
-
## Stories
|
|
173
|
-
|
|
174
|
-
<Primary />
|
|
175
|
-
<Controls />
|
|
176
|
-
<Stories />
|