cleanplate 0.3.3 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/app-shell/AppShell.d.ts.map +1 -1
- package/dist/components/avatar/Avatar.d.ts +1 -1
- package/dist/components/avatar/Avatar.d.ts.map +1 -1
- package/dist/components/header/Header.d.ts +6 -0
- package/dist/components/header/Header.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.es.css +1 -1
- package/dist/index.es.js +4 -4
- package/dist/index.js +3 -3
- package/dist/utils/common.d.ts +0 -1
- package/dist/utils/common.d.ts.map +1 -1
- package/docs/AppShell.md +6 -5
- package/docs/Avatar.md +14 -6
- package/docs/Header.md +18 -0
- package/docs/MediaObject.md +1 -1
- package/docs/MenuList.md +1 -0
- package/llms.txt +4 -4
- package/package.json +1 -1
package/dist/utils/common.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export function getInitials(name?: string): string;
|
|
2
|
-
export function getAvatarBgColor(name?: string): string;
|
|
3
2
|
export function getSpacingClass(marginConfig: any, styleObject: any, prefix: any): any;
|
|
4
3
|
export function getUniqueId(): string;
|
|
5
4
|
export function getVariantIcon(variant: any): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.js"],"names":[],"mappings":"AAEO,mDAIN;AAEM,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.js"],"names":[],"mappings":"AAEO,mDAIN;AAEM,uFAcN;AAEM,sCAON;AAEM,qDAgBN;AAEM,oDAEN;AAEM,mGAcN"}
|
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
|
|
|
@@ -69,8 +69,9 @@ const Dashboard = () => {
|
|
|
69
69
|
variant: "light",
|
|
70
70
|
}}
|
|
71
71
|
header={{
|
|
72
|
-
logoUrl
|
|
72
|
+
logoUrl: "/logo.svg",
|
|
73
73
|
menuItems: MENU_ITEMS,
|
|
74
|
+
showCenterMenu: false,
|
|
74
75
|
activeMenuItem: active,
|
|
75
76
|
onMenuItemClick: onMenuClick,
|
|
76
77
|
headerRight: <Avatar name="User" />,
|
|
@@ -108,7 +109,7 @@ const Dashboard = () => {
|
|
|
108
109
|
```jsx
|
|
109
110
|
<AppShell
|
|
110
111
|
header={{
|
|
111
|
-
logoUrl
|
|
112
|
+
logoUrl: "/logo.svg",
|
|
112
113
|
menuItems,
|
|
113
114
|
activeMenuItem: active,
|
|
114
115
|
onMenuItemClick: (item) => setActive(item.value),
|
|
@@ -137,12 +138,12 @@ const Dashboard = () => {
|
|
|
137
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.
|
|
138
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.
|
|
139
140
|
- **Sidebar:** Rendered in an `<aside aria-label="Main navigation">` with MenuList `direction="vertical"`. Width from `sidebarWidth` (inline style).
|
|
140
|
-
- **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.
|
|
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).
|
|
141
142
|
- **No root spacing props:** AppShell does not expose margin/padding; use `className` or `contentClassName` for layout.
|
|
142
143
|
|
|
143
144
|
## Related Components / Links
|
|
144
145
|
|
|
145
|
-
- Header (
|
|
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)
|
|
146
147
|
- Footer (rendered in footer slot when footer is Footer props)
|
|
147
148
|
- MenuList (used in sidebar with direction="vertical")
|
|
148
149
|
- Container (wrap page content inside children)
|
package/docs/Avatar.md
CHANGED
|
@@ -6,14 +6,14 @@ Purpose: Displays user initials, an image, or a Material icon in a consistent ci
|
|
|
6
6
|
|
|
7
7
|
| Prop | Type | Required | Default | Description |
|
|
8
8
|
| --- | --- | --- | --- | --- |
|
|
9
|
-
| name | string | no | "" | Display name; used for initials and `title` when no image/icon. Also used for image `alt
|
|
9
|
+
| name | string | no | "" | Display name; used for initials and `title` when no image/icon. Also used for image `alt`. |
|
|
10
10
|
| image | string | no | "" | Image URL; when set, shows image instead of initials or icon. |
|
|
11
11
|
| icon | MaterialIconName | no | — | Material icon name; when set (and no image), shows icon instead of initials. |
|
|
12
12
|
| size | "small" \| "medium" | no | "medium" | Size of the avatar. |
|
|
13
13
|
| margin | string \| string[] | no | "m-0" | Spacing **suffix** for outer margin. The component adds the `m-` prefix (e.g. `"0"` → m-0, `"b-2"` → m-b-2). Use a single string or array: `"0"`, `["2", "b-3"]`. |
|
|
14
14
|
| onClick | function | no | — | Click handler for the root div. |
|
|
15
|
-
| className | string | no | "" | Additional class names for the root element. |
|
|
16
|
-
| ...rest |
|
|
15
|
+
| className | string | no | "" | Additional class names for the root element; use to override backgrounds or other visuals (no inline `style` on Avatar). |
|
|
16
|
+
| ...rest | `Omit<HTMLAttributes<HTMLDivElement>, "style">` | no | — | Other div attributes (`id`, `data-*`, `aria-*`, `ref`, etc.). The **`style`** prop is not supported; use **`className`** and CSS instead. |
|
|
17
17
|
|
|
18
18
|
## Types
|
|
19
19
|
|
|
@@ -34,7 +34,7 @@ type AvatarMargin = string | SpacingOption[];
|
|
|
34
34
|
|
|
35
35
|
### AvatarProps
|
|
36
36
|
```typescript
|
|
37
|
-
interface AvatarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
37
|
+
interface AvatarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "style"> {
|
|
38
38
|
name?: string;
|
|
39
39
|
image?: string;
|
|
40
40
|
icon?: MaterialIconName; // from "../icon/material-icon-names"
|
|
@@ -87,6 +87,14 @@ export const Example = () => (
|
|
|
87
87
|
);
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
+
### Custom appearance (`className`)
|
|
91
|
+
|
|
92
|
+
Backgrounds come from CSS modules (`--primary-brand` for initials/icon, `--white` behind images). Override with your own class:
|
|
93
|
+
|
|
94
|
+
```jsx
|
|
95
|
+
<Avatar name="VIP" className="my-avatar--gold" />
|
|
96
|
+
```
|
|
97
|
+
|
|
90
98
|
### Clickable avatar
|
|
91
99
|
|
|
92
100
|
```jsx
|
|
@@ -119,9 +127,9 @@ export const Example = () => (
|
|
|
119
127
|
|
|
120
128
|
- **Display priority:** If `image` is set, the image is shown. Else if `icon` is set, the Material icon is shown. Otherwise initials from `name` are shown.
|
|
121
129
|
- **Initials:** Derived from the first letter of each word in `name` (up to 2 characters), e.g. "John Doe" → "JD".
|
|
122
|
-
- **
|
|
130
|
+
- **Backgrounds (CSS only):** **Initials** use `var(--primary-brand)` on the root. **Icon** mode uses `var(--primary-brand)` for the circle. **Image** mode uses `var(--white)` behind the photo so transparent PNGs do not show a hole. To change colors, add a **`className`** and target the root in your stylesheet.
|
|
123
131
|
- **Spacing:** `margin` accepts the **spacing suffix**; the component adds the `m-` prefix via `getSpacingClass`. Use suffix form (e.g. `"0"`, `"2"`, `"b-3"`) when passing values explicitly.
|
|
124
|
-
- **Root element:** A `div`;
|
|
132
|
+
- **Root element:** A `div`; supports `ref` and other attributes except **`style`** (omitted from the public type so layout stays class-based).
|
|
125
133
|
|
|
126
134
|
## Related Components / Links
|
|
127
135
|
|
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/MediaObject.md
CHANGED
|
@@ -9,7 +9,7 @@ Purpose: Combines fixed media (`Avatar`: icon, image, or initials) with a dense
|
|
|
9
9
|
| title | string | yes | — | Primary line (e.g. name, sender). Rendered emphasized. |
|
|
10
10
|
| mediaIcon | `MaterialIconName` \| string | no | "" | Material Symbol name passed to `Avatar`. |
|
|
11
11
|
| mediaImage | string | no | "" | Image URL for `Avatar`. |
|
|
12
|
-
| mediaAvatar | string | no | "" | Display name used for initials
|
|
12
|
+
| mediaAvatar | string | no | "" | Display name used for initials when image/icon are not shown. |
|
|
13
13
|
| subtitle | `React.ReactNode` | no | — | Optional middle line (e.g. subject). Omit for two-line layouts. |
|
|
14
14
|
| description | `React.ReactNode` | no | — | Optional preview/snippet line(s); muted, multi-line ellipsis via `--cp-media-object-desc-lines`. |
|
|
15
15
|
| descriptionLineClamp | number | no | 2 | Max lines for `description` before truncation. |
|
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
|
@@ -74,7 +74,7 @@ All component documentation is located in the `docs/` folder. The following docu
|
|
|
74
74
|
### Avatar Component
|
|
75
75
|
- File: `docs/Avatar.md`
|
|
76
76
|
- Purpose: Displays user initials, an image, or a Material icon in a consistent circle. Use for user identity in headers, lists, MediaObject, or anywhere you need a compact avatar.
|
|
77
|
-
- Key Features: Display modes (initials, image, icon), sizes (small, medium), margin spacing (suffix API: e.g. "0" → m-0), optional onClick
|
|
77
|
+
- Key Features: Display modes (initials, image, icon), sizes (small, medium), margin spacing (suffix API: e.g. "0" → m-0), optional onClick; backgrounds from CSS (className overrides), no inline style prop
|
|
78
78
|
- Types: AvatarProps, AvatarSize, AvatarMargin, SpacingOption; icon prop uses MaterialIconName from Icon
|
|
79
79
|
- Related Components: Used by MediaObject; often used with Container, Icon
|
|
80
80
|
|
|
@@ -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, mobileSidebarDrawer / mobileSidebarDrawerLabel, responsive (sidebar column hidden ≤1024px; default Floating UI drawer when no HeaderProps header, else 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
|
|