cleanplate 0.3.22 → 0.3.23

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.
@@ -0,0 +1,179 @@
1
+ # FeedbackState Component
2
+
3
+ Purpose: Unified empty and error **region** for cards, panels, tables, and main content areas — when a section has no data or failed to load. Use `Alert` for short inline banners and `Toast` for transient messages. **Margin** uses the **framework-wide spacing suffix rule** (same for all components); see `llms.txt`.
4
+
5
+ **Illustrations:** CleanPlate does not host artwork. Pass your own image URL (`png`, `jpg`, `svg`) or a custom `ReactNode`, or use the `icon` prop with a Material icon name when no image is needed.
6
+
7
+ ## Props / Inputs
8
+
9
+ | Prop | Type | Required | Default | Description |
10
+ | --- | --- | --- | --- | --- |
11
+ | variant | `"empty" \| "error"` | yes | — | Drives default ARIA role and error tone |
12
+ | title | string | yes | — | Primary headline |
13
+ | titleTag | `"h1"` … `"h6" \| "p"` | no | `"h2"` | Semantic element for the title |
14
+ | description | string \| ReactNode | no | — | Supporting copy |
15
+ | illustration | string \| ReactNode | no | — | Image URL or custom media node |
16
+ | illustrationAlt | string | no | `""` | `alt` for URL images; empty = decorative |
17
+ | icon | MaterialIconName | no | — | Material icon when `illustration` is omitted |
18
+ | size | `"small" \| "medium" \| "large"` | no | `"medium"` | Overall scale (spacing, media box, icon size) |
19
+ | primaryAction | ActionConfig | no | — | Solid primary button |
20
+ | secondaryAction | ActionConfig | no | — | Ghost secondary button |
21
+ | onRetry | `() => void` | no | — | Shorthand primary “Try again” when `primaryAction` is absent |
22
+ | retryLabel | string | no | `"Try again"` | Label when `onRetry` is used |
23
+ | errorCode | string \| number | no | — | Visual error code (not the sole indicator) |
24
+ | errorDetails | string | no | — | Technical detail in a `<details>` disclosure |
25
+ | role | `"alert" \| "status" \| "none"` | no | `status` (empty) / `alert` (error) | Root ARIA role |
26
+ | margin | string \| SpacingOption[] | no | `"0"` | Spacing **suffix**; component adds `m-` prefix |
27
+ | className | string | no | `""` | Extra class on root for consumer CSS overrides |
28
+ | dataTestId | string | no | — | `data-testid` on root |
29
+
30
+ ### ActionConfig
31
+
32
+ ```typescript
33
+ type ActionConfig = {
34
+ label: string;
35
+ onClick: () => void;
36
+ };
37
+ ```
38
+
39
+ Actions use `Button` only — there is no `href`. Use `onClick` for navigation (e.g. router).
40
+
41
+ ## Types
42
+
43
+ ### FeedbackStateVariant
44
+ ```typescript
45
+ type FeedbackStateVariant = "empty" | "error";
46
+ ```
47
+
48
+ ### FeedbackStateSize
49
+ ```typescript
50
+ type FeedbackStateSize = "small" | "medium" | "large";
51
+ ```
52
+
53
+ ### FeedbackStateTitleTag
54
+ ```typescript
55
+ type FeedbackStateTitleTag = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p";
56
+ ```
57
+
58
+ ### FeedbackStateRole
59
+ ```typescript
60
+ type FeedbackStateRole = "alert" | "status" | "none";
61
+ ```
62
+
63
+ ### FeedbackStateProps
64
+ ```typescript
65
+ interface FeedbackStateProps {
66
+ variant: FeedbackStateVariant;
67
+ title: string;
68
+ titleTag?: FeedbackStateTitleTag;
69
+ description?: string | React.ReactNode;
70
+ illustration?: string | React.ReactNode;
71
+ illustrationAlt?: string;
72
+ icon?: MaterialIconName;
73
+ size?: FeedbackStateSize;
74
+ primaryAction?: ActionConfig;
75
+ secondaryAction?: ActionConfig;
76
+ onRetry?: () => void;
77
+ retryLabel?: string;
78
+ errorCode?: string | number;
79
+ errorDetails?: string;
80
+ role?: FeedbackStateRole;
81
+ margin?: string | SpacingOption[];
82
+ className?: string;
83
+ dataTestId?: string;
84
+ }
85
+ ```
86
+
87
+ ## Usage Examples
88
+
89
+ ### Empty state with icon
90
+
91
+ ```jsx
92
+ import { FeedbackState } from "cleanplate";
93
+
94
+ export const ProjectsEmpty = ({ onCreate }) => (
95
+ <FeedbackState
96
+ variant="empty"
97
+ title="No projects yet"
98
+ description="Create your first project to get started."
99
+ icon="folder_open"
100
+ primaryAction={{ label: "New project", onClick: onCreate }}
101
+ />
102
+ );
103
+ ```
104
+
105
+ ### Empty state with module illustration
106
+
107
+ ```jsx
108
+ <FeedbackState
109
+ variant="empty"
110
+ title="No search results"
111
+ description="Try adjusting your filters."
112
+ illustration="/assets/modules/search-empty.png"
113
+ illustrationAlt=""
114
+ primaryAction={{ label: "Clear filters", onClick: clearFilters }}
115
+ />
116
+ ```
117
+
118
+ ### Error with retry
119
+
120
+ ```jsx
121
+ <FeedbackState
122
+ variant="error"
123
+ title="Could not load projects"
124
+ description="Check your connection and try again."
125
+ icon="cloud_off"
126
+ errorCode={503}
127
+ onRetry={refetch}
128
+ />
129
+ ```
130
+
131
+ ### Error with technical details
132
+
133
+ ```jsx
134
+ <FeedbackState
135
+ variant="error"
136
+ title="Request failed"
137
+ errorDetails={error.message}
138
+ dataTestId="projects-error"
139
+ />
140
+ ```
141
+
142
+ ### Custom styles via className
143
+
144
+ ```jsx
145
+ <FeedbackState
146
+ variant="empty"
147
+ title="No items"
148
+ className="my-module-empty"
149
+ icon="inbox"
150
+ />
151
+ ```
152
+
153
+ ```css
154
+ .my-module-empty.cp-feedback-state {
155
+ min-height: 280px;
156
+ }
157
+ ```
158
+
159
+ ## Behavior Notes
160
+
161
+ - **Media precedence:** `illustration` → `icon` → no media. If both `illustration` and `icon` are set, illustration wins.
162
+ - **Action precedence:** `primaryAction` overrides `onRetry`.
163
+ - **Layout:** Stacked only (media above text, centered actions).
164
+ - **Accessibility:** Root `aria-labelledby` points at the title; decorative media uses `aria-hidden` when `illustrationAlt` is empty and a title is present.
165
+ - **Motion:** Subtle mount fade; disabled when `prefers-reduced-motion: reduce`.
166
+
167
+ ### Stable slot classes (for CSS overrides)
168
+
169
+ - `cp-feedback-state` — root
170
+ - `cp-feedback-state__media`, `cp-feedback-state__media-img`
171
+ - `cp-feedback-state__content`, `cp-feedback-state__title`, `cp-feedback-state__description`
172
+ - `cp-feedback-state__error-code`, `cp-feedback-state__actions`, `cp-feedback-state__details`
173
+
174
+ ## Related Components / Links
175
+
176
+ - Alert (inline feedback)
177
+ - Toast (transient messages)
178
+ - Button, Icon, Typography (composed internally)
179
+ - Container (wrap for layout in stories and apps)
package/llms.txt CHANGED
@@ -101,6 +101,13 @@ All component documentation is located in the `docs/` folder. The following docu
101
101
  - Types: AlertProps, AlertSize, AlertVariant, AlertMargin, SpacingOption
102
102
  - Related Components: Typography, Container, Button, Icon (used internally)
103
103
 
104
+ ### FeedbackState Component
105
+ - File: `docs/FeedbackState.md`
106
+ - Purpose: Unified empty and error region for cards, panels, tables, and content areas. Consumer-supplied illustration URL (png/jpg/svg) or Material `icon`; optional primary/secondary actions (`onClick` only).
107
+ - Key Features: variant empty|error, sizes small|medium|large, stacked layout, errorCode/errorDetails, onRetry shorthand, className overrides, dataTestId, margin suffix API
108
+ - Types: FeedbackStateProps, FeedbackStateVariant, FeedbackStateSize, FeedbackStateTitleTag, FeedbackStateRole, ActionConfig, FeedbackStateMargin, SpacingOption
109
+ - Related Components: Typography, Button, Icon (used internally); Alert (inline); Toast (transient)
110
+
104
111
  ### Spinner Component
105
112
  - File: `docs/Spinner.md`
106
113
  - Purpose: Loading indicator that shows a rotating Material icon. Use for progress or activity states.
@@ -259,6 +266,7 @@ All documentation files follow a consistent format:
259
266
  | Container | `docs/Container.md` | Layout, spacing, and flex structure |
260
267
  | Dropdown | `docs/Dropdown.md` | Menus and floating panels |
261
268
  | Alert | `docs/Alert.md` | Inline feedback and notices |
269
+ | FeedbackState | `docs/FeedbackState.md` | Empty/error content regions |
262
270
  | Spinner | `docs/Spinner.md` | Loading and activity indicator |
263
271
  | Stepper | `docs/Stepper.md` | Wizard / checkout **step progress** (not numeric +/−; that is **FormControls.Stepper** in FormControls) |
264
272
  | BreadCrumb | `docs/BreadCrumb.md` | Navigation trail and page hierarchy |
@@ -296,5 +304,5 @@ npm install cleanplate
296
304
  ## Usage
297
305
 
298
306
  ```jsx
299
- import { Button, Typography, Icon, MediaObject, Avatar, Container, Dropdown, Alert, Spinner, Stepper, BreadCrumb, Accordion, ConfirmDialog, Modal, Pagination, Table, Badge, Pills, Animated, FormControls, Toast, MenuList, Header, PageHeader, BottomSheet, Footer, AppShell } from "cleanplate";
307
+ import { Button, Typography, Icon, MediaObject, Avatar, Container, Dropdown, Alert, FeedbackState, Spinner, Stepper, BreadCrumb, Accordion, ConfirmDialog, Modal, Pagination, Table, Badge, Pills, Animated, FormControls, Toast, MenuList, Header, PageHeader, BottomSheet, Footer, AppShell } from "cleanplate";
300
308
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cleanplate",
3
- "version": "0.3.22",
3
+ "version": "0.3.23",
4
4
  "description": "CleanPlate - A Headless React UI Framework",
5
5
  "files": [
6
6
  "dist",