cleanplate 0.3.2 → 0.3.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/docs/AppShell.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # AppShell Component
2
2
 
3
- Purpose: Full-page layout that combines an optional Header (top), optional Footer (bottom), and an optional MenuList as a left sidebar, with main content in the center. Use for dashboard-style apps where the sidebar holds primary navigation and the header holds logo and utilities (e.g. user menu). Sidebar is hidden below 1024px; pass the same menu items to the header for the header’s mobile menu.
3
+ Purpose: Full-page layout that combines an optional Header (top), optional Footer (bottom), and an optional MenuList as a left sidebar, with main content in the center. Use for dashboard-style apps where the sidebar holds primary navigation and the header holds logo and utilities (e.g. user menu). Sidebar is hidden below 1024px; pass the same menu items to the header for the header’s mobile menu. To avoid duplicating nav in the header center on desktop, set **`showCenterMenu: false`** on Header props (see `docs/Header.md`).
4
4
 
5
5
  ## Props / Inputs
6
6
 
@@ -11,6 +11,8 @@ Purpose: Full-page layout that combines an optional Header (top), optional Foote
11
11
  | footer | ReactNode \| FooterProps | no | — | Bottom bar: pass Footer props object or custom ReactNode. Omit to hide footer. |
12
12
  | sidebar | AppShellSidebarConfig | no | — | Sidebar config (MenuList as vertical nav on the left). Omit to hide sidebar. |
13
13
  | sidebarWidth | string | no | "240px" | Width of the sidebar (e.g. "240px", "16rem"). |
14
+ | mobileSidebarDrawer | boolean | no | *see below* | When `sidebar` is set: show a Floating UI drawer + trigger on narrow viewports (≤1024px). Default `false` if `header` is `HeaderProps` (header mobile menu); otherwise default `true`. |
15
+ | mobileSidebarDrawerLabel | string | no | "Main navigation" | Accessible name (`aria-label`) for the mobile navigation dialog. |
14
16
  | className | string | no | "" | Additional class name for the root element. |
15
17
  | contentClassName | string | no | "" | Additional class name for the main content wrapper. |
16
18
 
@@ -35,6 +37,8 @@ interface AppShellProps {
35
37
  footer?: React.ReactNode | FooterProps;
36
38
  sidebar?: AppShellSidebarConfig;
37
39
  sidebarWidth?: string;
40
+ mobileSidebarDrawer?: boolean;
41
+ mobileSidebarDrawerLabel?: string;
38
42
  className?: string;
39
43
  contentClassName?: string;
40
44
  }
@@ -65,8 +69,9 @@ const Dashboard = () => {
65
69
  variant: "light",
66
70
  }}
67
71
  header={{
68
- logoUrl="/logo.svg",
72
+ logoUrl: "/logo.svg",
69
73
  menuItems: MENU_ITEMS,
74
+ showCenterMenu: false,
70
75
  activeMenuItem: active,
71
76
  onMenuItemClick: onMenuClick,
72
77
  headerRight: <Avatar name="User" />,
@@ -104,7 +109,7 @@ const Dashboard = () => {
104
109
  ```jsx
105
110
  <AppShell
106
111
  header={{
107
- logoUrl="/logo.svg",
112
+ logoUrl: "/logo.svg",
108
113
  menuItems,
109
114
  activeMenuItem: active,
110
115
  onMenuItemClick: (item) => setActive(item.value),
@@ -133,12 +138,12 @@ const Dashboard = () => {
133
138
  - **Layout:** Root is a flex column with `min-height: 100vh`. Header and footer slots are full width; body is a flex row (sidebar + main). Main area is scrollable.
134
139
  - **Header / footer:** When `header` or `footer` is a plain object with Header/Footer props (e.g. `menuItems` for header), the component renders `<Header {...header} />` or `<Footer {...footer} />`. Otherwise it renders the ReactNode as-is.
135
140
  - **Sidebar:** Rendered in an `<aside aria-label="Main navigation">` with MenuList `direction="vertical"`. Width from `sidebarWidth` (inline style).
136
- - **Responsive:** At viewport width ≤ 1024px the sidebar is hidden via CSS. Pass the same `menuItems` and `activeMenuItem` / `onMenuItemClick` to `header` so the header’s mobile menu provides navigation.
141
+ - **Responsive:** At viewport width ≤ 1024px the sidebar column is hidden via CSS. When `header` is `HeaderProps`, the default is to rely on the header’s mobile menu for the same items. When there is no header (or `mobileSidebarDrawer` is `true`), AppShell renders a **Floating UI** mobile drawer: fixed menu trigger, `FloatingPortal` + `FloatingOverlay` (scroll lock) + `FloatingFocusManager` (modal focus), dismiss on overlay press and Escape, and the same `MenuList` as the sidebar. On desktop, use Header’s **`showCenterMenu: false`** when the sidebar already shows the same items so the header center stays empty (or use **`headerCenter`** for a title or other content).
137
142
  - **No root spacing props:** AppShell does not expose margin/padding; use `className` or `contentClassName` for layout.
138
143
 
139
144
  ## Related Components / Links
140
145
 
141
- - Header (rendered in header slot when header is Header props; use same menu items for mobile)
146
+ - Header (Header props or custom node; with sidebar + `HeaderProps`, pass **`showCenterMenu: false`** to hide duplicate center nav on desktop while keeping `menuItems` for the mobile menu)
142
147
  - Footer (rendered in footer slot when footer is Footer props)
143
148
  - MenuList (used in sidebar with direction="vertical")
144
149
  - Container (wrap page content inside children)
package/docs/Header.md CHANGED
@@ -13,6 +13,7 @@ Purpose: Responsive navigation header with logo, menu items, and customizable le
13
13
  | headerLeft | ReactNode | no | — | Custom content for the left area (replaces logo when provided). |
14
14
  | headerRight | ReactNode | no | — | Custom content for the right area. |
15
15
  | headerCenter | ReactNode | no | — | Custom content for the center area (replaces MenuList when provided). |
16
+ | showCenterMenu | boolean | no | true | When true, shows `menuItems` in the center on wide viewports. Set false when primary nav is only in a sidebar; `menuItems` is still used for the mobile menu. |
16
17
  | menuItems | MenuListItem[] | yes | — | Menu items for center nav and mobile menu; each has label, value, optional icon. |
17
18
  | size | "small" \| "medium" \| "large" | no | — | Size of the header. |
18
19
  | variant | "light" \| "dark" | no | — | Visual variant. |
@@ -45,6 +46,7 @@ interface HeaderProps {
45
46
  headerLeft?: React.ReactNode;
46
47
  headerRight?: React.ReactNode;
47
48
  headerCenter?: React.ReactNode;
49
+ showCenterMenu?: boolean;
48
50
  menuItems: MenuListItem[];
49
51
  size?: HeaderSize;
50
52
  variant?: HeaderVariant;
@@ -79,6 +81,21 @@ const AppHeader = () => {
79
81
  };
80
82
  ```
81
83
 
84
+ ### With AppShell (desktop nav in sidebar only)
85
+
86
+ Use `showCenterMenu: false` so `menuItems` is only used for the header’s mobile menu while the sidebar shows the same links on desktop.
87
+
88
+ ```jsx
89
+ <Header
90
+ logoUrl="/logo.svg"
91
+ menuItems={MENU_ITEMS}
92
+ showCenterMenu={false}
93
+ activeMenuItem={active}
94
+ onMenuItemClick={onMenuClick}
95
+ headerRight={<Avatar name="User" />}
96
+ />
97
+ ```
98
+
82
99
  ### With custom slots
83
100
 
84
101
  ```jsx
@@ -103,6 +120,7 @@ const AppHeader = () => {
103
120
 
104
121
  - **menuItems:** Required; each item has label, value, optional icon (Material icon name).
105
122
  - **headerLeft / headerCenter / headerRight:** When provided, replace the default logo, MenuList, or right slot.
123
+ - **showCenterMenu:** When `false`, the center column is empty on desktop (unless `headerCenter` is set). `menuItems` is still used for the mobile overlay.
106
124
  - **Mobile:** Below 1024px, center nav hides; hamburger shows. Click opens slide-in menu (Animated fade-in-left).
107
125
  - **onMenuItemClick:** Called with the clicked item; mobile menu closes on click.
108
126
  - **Margin:** Uses the suffix API (e.g. `"0"` → m-0).
package/docs/MenuList.md CHANGED
@@ -104,6 +104,7 @@ const Nav = () => {
104
104
  - **DOM:** A `div` wrapping a `ul` of `li` elements; each `li` contains an anchor.
105
105
  - **Animated:** Each item is wrapped in Animated with `fade-in-left` and staggered delay.
106
106
  - **Margin:** Uses the suffix API (e.g. `"0"` → m-0, `"b-2"` → m-b-2).
107
+ - **Responsive (root):** At viewport width **≤1024px**, the root `.wrapper` gets extra padding, full viewport min-height, and constrained max-width so the list reads well in the header mobile sheet and similar narrow layouts (including AppShell’s mobile drawer).
107
108
 
108
109
  ## Related Components / Links
109
110
 
package/llms.txt CHANGED
@@ -194,14 +194,14 @@ All component documentation is located in the `docs/` folder. The following docu
194
194
  ### MenuList Component
195
195
  - File: `docs/MenuList.md`
196
196
  - Purpose: Renders a list of navigational items with optional icons, active state highlighting, and customizable layout.
197
- - Key Features: items (label, value, icon), activeItem, direction (horizontal, vertical), sizes (small, medium, large), variants (light, dark), margin (suffix API), onMenuClick(item), Animated entrance
197
+ - Key Features: items (label, value, icon), activeItem, direction (horizontal, vertical), sizes (small, medium, large), variants (light, dark), margin (suffix API), onMenuClick(item), Animated entrance, responsive root layout at ≤1024px (padding, min-height) for mobile nav contexts
198
198
  - Types: MenuListProps, MenuListItem, MenuListSize, MenuListVariant, MenuListDirection, MenuListMargin
199
199
  - Related Components: Dropdown (content), Header (navigation), Container, Typography, Icon, Animated (used internally)
200
200
 
201
201
  ### Header Component
202
202
  - File: `docs/Header.md`
203
203
  - Purpose: Responsive navigation header with logo, menu items, and customizable left/center/right slots.
204
- - Key Features: logoUrl, menuItems, activeMenuItem, onMenuItemClick, headerLeft, headerCenter, headerRight, sizes (small, medium, large), variants (light, dark), margin (suffix API), responsive mobile menu
204
+ - Key Features: logoUrl, menuItems, activeMenuItem, onMenuItemClick, headerLeft, headerCenter, headerRight, showCenterMenu, sizes (small, medium, large), variants (light, dark), margin (suffix API), responsive mobile menu
205
205
  - Types: HeaderProps, HeaderSize, HeaderVariant, HeaderMargin
206
206
  - Related Components: MenuList (center and mobile menu), Avatar (headerRight), Button, Icon, Animated (used internally)
207
207
 
@@ -229,7 +229,7 @@ All component documentation is located in the `docs/` folder. The following docu
229
229
  ### AppShell Component
230
230
  - File: `docs/AppShell.md`
231
231
  - Purpose: Full-page layout combining optional Header (top), Footer (bottom), and MenuList as left sidebar with main content. For dashboard-style apps.
232
- - Key Features: header (Header props or ReactNode), footer (Footer props or ReactNode), sidebar (AppShellSidebarConfig: items, activeItem, onMenuClick, size, variant), sidebarWidth, responsive (sidebar hidden ≤1024px; use header mobile menu)
232
+ - Key Features: header (Header props or ReactNode), footer (Footer props or ReactNode), sidebar (AppShellSidebarConfig: items, activeItem, onMenuClick, size, variant), sidebarWidth, mobileSidebarDrawer / mobileSidebarDrawerLabel, responsive (sidebar column hidden ≤1024px; default Floating UI drawer when no HeaderProps header, else header mobile menu); with Header + sidebar use Header `showCenterMenu: false` to avoid duplicate desktop nav
233
233
  - Types: AppShellProps, AppShellSidebarConfig
234
234
  - Related Components: Header, Footer, MenuList (sidebar), Container, Typography, Avatar
235
235
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cleanplate",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "CleanPlate - A Headless React UI Framework",
5
5
  "files": [
6
6
  "dist",