cleanplate 0.3.4 → 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/avatar/Avatar.d.ts +1 -1
- package/dist/components/avatar/Avatar.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.es.css +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/common.d.ts +0 -1
- package/dist/utils/common.d.ts.map +1 -1
- package/docs/Avatar.md +14 -6
- package/docs/MediaObject.md +1 -1
- package/llms.txt +1 -1
- 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/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/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/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
|
|