cleanplate 0.1.10 → 0.2.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/dist/components/accordion/Accordion.d.ts +23 -12
- package/dist/components/accordion/Accordion.d.ts.map +1 -1
- package/dist/components/accordion/index.d.ts +2 -1
- package/dist/components/accordion/index.d.ts.map +1 -1
- package/dist/components/animated/Animated.d.ts +18 -16
- package/dist/components/animated/Animated.d.ts.map +1 -1
- package/dist/components/animated/index.d.ts +2 -2
- package/dist/components/animated/index.d.ts.map +1 -1
- package/dist/components/app-shell/AppShell.d.ts +35 -3
- package/dist/components/app-shell/AppShell.d.ts.map +1 -1
- package/dist/components/app-shell/index.d.ts +2 -1
- package/dist/components/app-shell/index.d.ts.map +1 -1
- package/dist/components/bottom-sheet/BottomSheet.d.ts +17 -16
- package/dist/components/bottom-sheet/BottomSheet.d.ts.map +1 -1
- package/dist/components/bottom-sheet/index.d.ts +2 -1
- package/dist/components/bottom-sheet/index.d.ts.map +1 -1
- package/dist/components/breadcrumb/BreadCrumb.d.ts +26 -0
- package/dist/components/breadcrumb/BreadCrumb.d.ts.map +1 -0
- package/dist/components/breadcrumb/index.d.ts +3 -2
- package/dist/components/breadcrumb/index.d.ts.map +1 -1
- package/dist/components/footer/Footer.d.ts +21 -16
- package/dist/components/footer/Footer.d.ts.map +1 -1
- package/dist/components/footer/index.d.ts +2 -1
- package/dist/components/footer/index.d.ts.map +1 -1
- package/dist/components/form-controls/Checkbox.d.ts +10 -8
- package/dist/components/form-controls/Checkbox.d.ts.map +1 -1
- package/dist/components/form-controls/Date.d.ts +6 -4
- package/dist/components/form-controls/Date.d.ts.map +1 -1
- package/dist/components/form-controls/File.d.ts +10 -9
- package/dist/components/form-controls/File.d.ts.map +1 -1
- package/dist/components/form-controls/Input.d.ts +11 -9
- package/dist/components/form-controls/Input.d.ts.map +1 -1
- package/dist/components/form-controls/Radio.d.ts +10 -9
- package/dist/components/form-controls/Radio.d.ts.map +1 -1
- package/dist/components/form-controls/Select.d.ts +12 -6
- package/dist/components/form-controls/Select.d.ts.map +1 -1
- package/dist/components/form-controls/Stepper.d.ts +10 -8
- package/dist/components/form-controls/Stepper.d.ts.map +1 -1
- package/dist/components/form-controls/TextArea.d.ts +10 -8
- package/dist/components/form-controls/TextArea.d.ts.map +1 -1
- package/dist/components/form-controls/Toggle.d.ts +10 -9
- package/dist/components/form-controls/Toggle.d.ts.map +1 -1
- package/dist/components/form-controls/index.d.ts +30 -20
- package/dist/components/form-controls/index.d.ts.map +1 -1
- package/dist/components/header/Header.d.ts +32 -28
- package/dist/components/header/Header.d.ts.map +1 -1
- package/dist/components/header/index.d.ts +2 -1
- package/dist/components/header/index.d.ts.map +1 -1
- package/dist/components/menu-list/MenuList.d.ts +32 -22
- package/dist/components/menu-list/MenuList.d.ts.map +1 -1
- package/dist/components/menu-list/index.d.ts +2 -1
- package/dist/components/menu-list/index.d.ts.map +1 -1
- package/dist/components/page-header/PageHeader.d.ts +22 -3
- package/dist/components/page-header/PageHeader.d.ts.map +1 -1
- package/dist/components/page-header/index.d.ts +2 -1
- package/dist/components/page-header/index.d.ts.map +1 -1
- package/dist/components/toast/Toast.d.ts +20 -12
- package/dist/components/toast/Toast.d.ts.map +1 -1
- package/dist/components/toast/index.d.ts +2 -1
- package/dist/components/toast/index.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.es.css +1 -1
- package/dist/index.es.js +3 -3
- package/dist/index.js +3 -3
- package/package.json +1 -1
- package/docs/Alert.md +0 -131
- package/docs/Avatar.md +0 -130
- package/docs/Badge.md +0 -83
- package/docs/Button.md +0 -175
- package/docs/ConfirmDialog.md +0 -139
- package/docs/Container.md +0 -230
- package/docs/Dropdown.md +0 -175
- package/docs/Icon.md +0 -225
- package/docs/MediaObject.md +0 -303
- package/docs/Modal.md +0 -152
- package/docs/Pagination.md +0 -142
- package/docs/Pills.md +0 -104
- package/docs/Spinner.md +0 -115
- package/docs/Stepper.md +0 -131
- package/docs/Table.md +0 -194
- package/docs/Typography.md +0 -226
- package/llms.txt +0 -171
- package/scripts/generate-icons.js +0 -175
- package/templates/README.md +0 -10
- package/templates/docs-template-sample.md +0 -67
- package/templates/storybook-docs-template.md +0 -236
- package/tsconfig.json +0 -26
package/docs/MediaObject.md
DELETED
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
# MediaObject Component
|
|
2
|
-
|
|
3
|
-
Purpose: A flexible layout pattern that combines media (icon, image, or avatar) with content (title and description). Perfect for displaying user profiles, product cards, notifications, and any content that needs a media element alongside text.
|
|
4
|
-
|
|
5
|
-
## Props / Inputs
|
|
6
|
-
|
|
7
|
-
| Prop | Type | Required | Default | Description |
|
|
8
|
-
| --- | --- | --- | --- | --- |
|
|
9
|
-
| title | string | yes | — | The main title text displayed in the content area. |
|
|
10
|
-
| mediaIcon | string | no | "" | Icon name from Material Symbols to display as the media element. |
|
|
11
|
-
| mediaImage | string | no | "" | Image URL to display as the media element. |
|
|
12
|
-
| mediaAvatar | string | no | "" | Name used to generate an avatar with initials and background color. |
|
|
13
|
-
| description | string | no | — | Secondary text displayed below the title. |
|
|
14
|
-
| margin | string \| string[] | no | "0" | Spacing utility token(s) for outer margin, such as `m-0` or `["m-1", "m-b-2"]`. |
|
|
15
|
-
| padding | string \| string[] | no | "0" | Spacing utility token(s) for inner padding, such as `p-0` or `["p-1", "p-b-2"]`. |
|
|
16
|
-
| className | string | no | "media-object" | Additional class names for the root element. |
|
|
17
|
-
| onClick | function | no | — | Called with the click event when the media object is clicked. |
|
|
18
|
-
| ...rest | React.HTMLAttributes<HTMLDivElement> | no | — | All other standard HTML div attributes are supported and passed through to the rendered element. |
|
|
19
|
-
|
|
20
|
-
## Types
|
|
21
|
-
|
|
22
|
-
### MediaObjectMargin
|
|
23
|
-
```typescript
|
|
24
|
-
type MediaObjectMargin = string | SpacingOption[];
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### MediaObjectPadding
|
|
28
|
-
```typescript
|
|
29
|
-
type MediaObjectPadding = string | SpacingOption[];
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
### SpacingOption
|
|
33
|
-
```typescript
|
|
34
|
-
type SpacingOption = typeof SPACING_OPTIONS[number];
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### MediaObjectProps
|
|
38
|
-
```typescript
|
|
39
|
-
interface MediaObjectProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
40
|
-
mediaIcon?: string;
|
|
41
|
-
mediaImage?: string;
|
|
42
|
-
mediaAvatar?: string;
|
|
43
|
-
title: string;
|
|
44
|
-
description?: string;
|
|
45
|
-
margin?: MediaObjectMargin;
|
|
46
|
-
padding?: MediaObjectPadding;
|
|
47
|
-
className?: string;
|
|
48
|
-
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Usage Examples
|
|
53
|
-
|
|
54
|
-
### With icon
|
|
55
|
-
|
|
56
|
-
```jsx
|
|
57
|
-
import { MediaObject } from "cleanplate";
|
|
58
|
-
|
|
59
|
-
export const Example = () => (
|
|
60
|
-
<MediaObject
|
|
61
|
-
mediaIcon="person"
|
|
62
|
-
title="User Profile"
|
|
63
|
-
description="Manage your account settings and preferences"
|
|
64
|
-
/>
|
|
65
|
-
);
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### With image
|
|
69
|
-
|
|
70
|
-
```jsx
|
|
71
|
-
import { MediaObject } from "cleanplate";
|
|
72
|
-
|
|
73
|
-
export const Example = () => (
|
|
74
|
-
<MediaObject
|
|
75
|
-
mediaImage="https://example.com/avatar.jpg"
|
|
76
|
-
title="John Doe"
|
|
77
|
-
description="Senior Developer at Tech Corp"
|
|
78
|
-
/>
|
|
79
|
-
);
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
### With avatar (initials)
|
|
83
|
-
|
|
84
|
-
```jsx
|
|
85
|
-
import { MediaObject } from "cleanplate";
|
|
86
|
-
|
|
87
|
-
export const Example = () => (
|
|
88
|
-
<MediaObject
|
|
89
|
-
mediaAvatar="John Doe"
|
|
90
|
-
title="John Doe"
|
|
91
|
-
description="Senior Developer with 5+ years of experience"
|
|
92
|
-
/>
|
|
93
|
-
);
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### Title only
|
|
97
|
-
|
|
98
|
-
```jsx
|
|
99
|
-
import { MediaObject } from "cleanplate";
|
|
100
|
-
|
|
101
|
-
export const Example = () => (
|
|
102
|
-
<MediaObject
|
|
103
|
-
mediaIcon="settings"
|
|
104
|
-
title="Settings"
|
|
105
|
-
/>
|
|
106
|
-
);
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### With margin and padding
|
|
110
|
-
|
|
111
|
-
```jsx
|
|
112
|
-
import { MediaObject } from "cleanplate";
|
|
113
|
-
|
|
114
|
-
export const Example = () => (
|
|
115
|
-
<>
|
|
116
|
-
<MediaObject
|
|
117
|
-
mediaIcon="star"
|
|
118
|
-
title="Featured Item"
|
|
119
|
-
description="This item has custom spacing"
|
|
120
|
-
margin="m-3"
|
|
121
|
-
padding="p-2"
|
|
122
|
-
/>
|
|
123
|
-
<MediaObject
|
|
124
|
-
mediaIcon="heart"
|
|
125
|
-
title="Another Item"
|
|
126
|
-
description="With multiple margin tokens"
|
|
127
|
-
margin={["m-1", "m-b-3"]}
|
|
128
|
-
padding={["p-1", "p-x-2"]}
|
|
129
|
-
/>
|
|
130
|
-
</>
|
|
131
|
-
);
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### Clickable media object
|
|
135
|
-
|
|
136
|
-
```jsx
|
|
137
|
-
import { MediaObject } from "cleanplate";
|
|
138
|
-
|
|
139
|
-
export const Example = () => (
|
|
140
|
-
<MediaObject
|
|
141
|
-
mediaImage="https://example.com/product.jpg"
|
|
142
|
-
title="Wireless Headphones"
|
|
143
|
-
description="High-quality wireless headphones"
|
|
144
|
-
onClick={() => console.log("Media object clicked")}
|
|
145
|
-
/>
|
|
146
|
-
);
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
### User profile card
|
|
150
|
-
|
|
151
|
-
```jsx
|
|
152
|
-
import { MediaObject } from "cleanplate";
|
|
153
|
-
import { Button } from "cleanplate";
|
|
154
|
-
|
|
155
|
-
export const Example = () => (
|
|
156
|
-
<div style={{
|
|
157
|
-
border: "1px solid #e0e0e0",
|
|
158
|
-
borderRadius: "8px",
|
|
159
|
-
padding: "16px"
|
|
160
|
-
}}>
|
|
161
|
-
<MediaObject
|
|
162
|
-
mediaImage="https://example.com/avatar.jpg"
|
|
163
|
-
title="John Doe"
|
|
164
|
-
description="Senior Developer • john.doe@example.com"
|
|
165
|
-
/>
|
|
166
|
-
<Button variant="outline" size="small" margin="m-t-3">
|
|
167
|
-
Edit Profile
|
|
168
|
-
</Button>
|
|
169
|
-
</div>
|
|
170
|
-
);
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
### Product card
|
|
174
|
-
|
|
175
|
-
```jsx
|
|
176
|
-
import { MediaObject } from "cleanplate";
|
|
177
|
-
import { Typography } from "cleanplate";
|
|
178
|
-
import { Button } from "cleanplate";
|
|
179
|
-
|
|
180
|
-
export const Example = () => (
|
|
181
|
-
<div style={{
|
|
182
|
-
border: "1px solid #e0e0e0",
|
|
183
|
-
borderRadius: "8px",
|
|
184
|
-
padding: "16px"
|
|
185
|
-
}}>
|
|
186
|
-
<MediaObject
|
|
187
|
-
mediaImage="https://example.com/product.jpg"
|
|
188
|
-
title="Wireless Headphones"
|
|
189
|
-
description="High-quality wireless headphones with noise cancellation"
|
|
190
|
-
/>
|
|
191
|
-
<div style={{ marginTop: "12px", display: "flex", justifyContent: "space-between", alignItems: "center" }}>
|
|
192
|
-
<Typography variant="h5">$199.99</Typography>
|
|
193
|
-
<Button size="small" variant="outline">Add to Cart</Button>
|
|
194
|
-
</div>
|
|
195
|
-
</div>
|
|
196
|
-
);
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
### Notification list
|
|
200
|
-
|
|
201
|
-
```jsx
|
|
202
|
-
import { MediaObject } from "cleanplate";
|
|
203
|
-
|
|
204
|
-
export const Example = () => (
|
|
205
|
-
<div>
|
|
206
|
-
<MediaObject
|
|
207
|
-
mediaIcon="notifications"
|
|
208
|
-
title="New Message"
|
|
209
|
-
description="You have received a new message from Jane Smith"
|
|
210
|
-
margin="m-b-2"
|
|
211
|
-
/>
|
|
212
|
-
<MediaObject
|
|
213
|
-
mediaIcon="schedule"
|
|
214
|
-
title="Meeting Reminder"
|
|
215
|
-
description="Team standup in 30 minutes"
|
|
216
|
-
margin="m-b-2"
|
|
217
|
-
/>
|
|
218
|
-
<MediaObject
|
|
219
|
-
mediaIcon="done"
|
|
220
|
-
title="Task Completed"
|
|
221
|
-
description="Your project 'Website Redesign' has been updated"
|
|
222
|
-
/>
|
|
223
|
-
</div>
|
|
224
|
-
);
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
### Settings items
|
|
228
|
-
|
|
229
|
-
```jsx
|
|
230
|
-
import { MediaObject } from "cleanplate";
|
|
231
|
-
|
|
232
|
-
export const Example = () => (
|
|
233
|
-
<div>
|
|
234
|
-
<MediaObject
|
|
235
|
-
mediaIcon="settings"
|
|
236
|
-
title="Account Settings"
|
|
237
|
-
description="Manage your account preferences and security settings"
|
|
238
|
-
margin="m-b-2"
|
|
239
|
-
/>
|
|
240
|
-
<MediaObject
|
|
241
|
-
mediaIcon="lock"
|
|
242
|
-
title="Privacy & Security"
|
|
243
|
-
description="Control your privacy settings and security options"
|
|
244
|
-
margin="m-b-2"
|
|
245
|
-
/>
|
|
246
|
-
<MediaObject
|
|
247
|
-
mediaIcon="notifications"
|
|
248
|
-
title="Notifications"
|
|
249
|
-
description="Configure how and when you receive notifications"
|
|
250
|
-
/>
|
|
251
|
-
</div>
|
|
252
|
-
);
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
### List of users
|
|
256
|
-
|
|
257
|
-
```jsx
|
|
258
|
-
import { MediaObject } from "cleanplate";
|
|
259
|
-
|
|
260
|
-
export const Example = () => {
|
|
261
|
-
const users = [
|
|
262
|
-
{ name: "John Doe", role: "Developer", avatar: "https://example.com/avatar1.jpg" },
|
|
263
|
-
{ name: "Jane Smith", role: "Designer", avatar: "https://example.com/avatar2.jpg" },
|
|
264
|
-
{ name: "Mike Johnson", role: "Manager", avatar: "https://example.com/avatar3.jpg" }
|
|
265
|
-
];
|
|
266
|
-
|
|
267
|
-
return (
|
|
268
|
-
<div>
|
|
269
|
-
{users.map((user, index) => (
|
|
270
|
-
<MediaObject
|
|
271
|
-
key={index}
|
|
272
|
-
mediaImage={user.avatar}
|
|
273
|
-
title={user.name}
|
|
274
|
-
description={user.role}
|
|
275
|
-
margin={index < users.length - 1 ? "m-b-2" : "m-0"}
|
|
276
|
-
/>
|
|
277
|
-
))}
|
|
278
|
-
</div>
|
|
279
|
-
);
|
|
280
|
-
};
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
## Behavior Notes
|
|
284
|
-
|
|
285
|
-
- The `title` prop is required and will always be displayed in bold text.
|
|
286
|
-
- The `description` prop is optional. If not provided, only the title will be displayed.
|
|
287
|
-
- You can provide one of `mediaIcon`, `mediaImage`, or `mediaAvatar` to display the media element. If multiple are provided, the component will prioritize in this order: `mediaAvatar` > `mediaImage` > `mediaIcon`.
|
|
288
|
-
- The component uses the `Avatar` component internally to render the media element, which supports icons, images, and generated avatars with initials.
|
|
289
|
-
- The component uses the `Typography` component internally for the title and description text.
|
|
290
|
-
- The title is rendered with `isBold={true}` by default.
|
|
291
|
-
- The description is rendered with `variant="small"`.
|
|
292
|
-
- The component renders as a `<div>` element with a flex layout structure.
|
|
293
|
-
- Margin and padding spacing accept either a single string token (e.g., `"m-2"`) or an array of tokens (e.g., `["m-1", "m-b-3"]`).
|
|
294
|
-
- The `onClick` handler makes the entire media object clickable, useful for interactive lists or cards.
|
|
295
|
-
- All standard HTML div attributes can be passed through, allowing for custom `id`, `data-*`, `aria-*`, and other attributes.
|
|
296
|
-
- The component is designed to be responsive and adapts to different screen sizes.
|
|
297
|
-
|
|
298
|
-
## Related Components / Links
|
|
299
|
-
|
|
300
|
-
- Avatar (used internally for the media element)
|
|
301
|
-
- Typography (used internally for title and description)
|
|
302
|
-
- Button (often used alongside MediaObject in cards)
|
|
303
|
-
- Container (commonly used to wrap MediaObject components)
|
package/docs/Modal.md
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
# Modal Component
|
|
2
|
-
|
|
3
|
-
Purpose: A full-featured modal overlay for forms, long content, or custom dialogs. Use it when you need a larger, flexible dialog than ConfirmDialog—with optional title, close button, footer actions, and configurable close behavior (overlay click, Escape). Supports body scroll lock and focus management when open.
|
|
4
|
-
|
|
5
|
-
## Props / Inputs
|
|
6
|
-
|
|
7
|
-
| Prop | Type | Required | Default | Description |
|
|
8
|
-
| --- | --- | --- | --- | --- |
|
|
9
|
-
| children | React.ReactNode | yes | — | Modal body content. |
|
|
10
|
-
| isOpen | boolean | no | false | Whether the modal is visible. |
|
|
11
|
-
| onClose | () => void | no | — | Called when the modal should close (close button, overlay, or Escape). |
|
|
12
|
-
| title | string | no | "" | Title displayed in the modal header. |
|
|
13
|
-
| size | "small" \| "medium" \| "large" \| "fullscreen" | no | "medium" | Size of the modal panel. |
|
|
14
|
-
| showCloseButton | boolean | no | true | Whether to show the X close button in the header. |
|
|
15
|
-
| closeOnOverlayClick | boolean | no | true | Whether clicking the overlay closes the modal. |
|
|
16
|
-
| closeOnEscape | boolean | no | true | Whether pressing Escape closes the modal. |
|
|
17
|
-
| margin | string \| SpacingOption[] | no | "m-0" | Margin around the modal. Use full class string (e.g. "m-0") or array of spacing suffixes; component adds `m-` prefix. |
|
|
18
|
-
| className | string | no | "" | Additional class names for the modal panel. |
|
|
19
|
-
| overlayClassName | string | no | "" | Additional class names for the overlay. |
|
|
20
|
-
| contentClassName | string | no | "" | Additional class names for the content wrapper. |
|
|
21
|
-
| primaryButtonLabel | string | no | "" | Label for the primary footer button; empty hides it. |
|
|
22
|
-
| onPrimaryButtonClick | () => void | no | — | Called when the primary footer button is clicked. |
|
|
23
|
-
| secondaryButtonLabel | string | no | "" | Label for the secondary footer button; empty hides it. |
|
|
24
|
-
| onSecondaryButtonClick | () => void | no | — | Called when the secondary footer button is clicked. |
|
|
25
|
-
|
|
26
|
-
## Types
|
|
27
|
-
|
|
28
|
-
### SpacingOption
|
|
29
|
-
```typescript
|
|
30
|
-
type SpacingOption = (typeof SPACING_OPTIONS)[number];
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### ModalSize
|
|
34
|
-
```typescript
|
|
35
|
-
type ModalSize = "small" | "medium" | "large" | "fullscreen";
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### ModalMargin
|
|
39
|
-
```typescript
|
|
40
|
-
type ModalMargin = string | SpacingOption[];
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### ModalProps
|
|
44
|
-
```typescript
|
|
45
|
-
interface ModalProps {
|
|
46
|
-
children: React.ReactNode;
|
|
47
|
-
isOpen?: boolean;
|
|
48
|
-
onClose?: () => void;
|
|
49
|
-
title?: string;
|
|
50
|
-
size?: ModalSize;
|
|
51
|
-
showCloseButton?: boolean;
|
|
52
|
-
closeOnOverlayClick?: boolean;
|
|
53
|
-
closeOnEscape?: boolean;
|
|
54
|
-
margin?: ModalMargin;
|
|
55
|
-
className?: string;
|
|
56
|
-
overlayClassName?: string;
|
|
57
|
-
contentClassName?: string;
|
|
58
|
-
primaryButtonLabel?: string;
|
|
59
|
-
onPrimaryButtonClick?: () => void;
|
|
60
|
-
secondaryButtonLabel?: string;
|
|
61
|
-
onSecondaryButtonClick?: () => void;
|
|
62
|
-
}
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Usage Examples
|
|
66
|
-
|
|
67
|
-
### Basic
|
|
68
|
-
|
|
69
|
-
```jsx
|
|
70
|
-
import { Modal, Button, Typography } from "cleanplate";
|
|
71
|
-
import { useState } from "react";
|
|
72
|
-
|
|
73
|
-
const App = () => {
|
|
74
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
75
|
-
return (
|
|
76
|
-
<>
|
|
77
|
-
<Button onClick={() => setIsOpen(true)}>Open Modal</Button>
|
|
78
|
-
<Modal
|
|
79
|
-
isOpen={isOpen}
|
|
80
|
-
onClose={() => setIsOpen(false)}
|
|
81
|
-
title="Modal Title"
|
|
82
|
-
>
|
|
83
|
-
<Typography variant="p">Modal body content goes here.</Typography>
|
|
84
|
-
</Modal>
|
|
85
|
-
</>
|
|
86
|
-
);
|
|
87
|
-
};
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### Sizes
|
|
91
|
-
|
|
92
|
-
```jsx
|
|
93
|
-
<Modal size="small" title="Small" isOpen={isOpen} onClose={onClose}>...</Modal>
|
|
94
|
-
<Modal size="medium" title="Medium" isOpen={isOpen} onClose={onClose}>...</Modal>
|
|
95
|
-
<Modal size="large" title="Large" isOpen={isOpen} onClose={onClose}>...</Modal>
|
|
96
|
-
<Modal size="fullscreen" title="Fullscreen" isOpen={isOpen} onClose={onClose}>...</Modal>
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### With footer buttons
|
|
100
|
-
|
|
101
|
-
```jsx
|
|
102
|
-
<Modal
|
|
103
|
-
isOpen={isOpen}
|
|
104
|
-
onClose={() => setIsOpen(false)}
|
|
105
|
-
title="Save Changes"
|
|
106
|
-
primaryButtonLabel="Save"
|
|
107
|
-
onPrimaryButtonClick={handleSave}
|
|
108
|
-
secondaryButtonLabel="Cancel"
|
|
109
|
-
onSecondaryButtonClick={() => setIsOpen(false)}
|
|
110
|
-
>
|
|
111
|
-
<Typography variant="p">Review and save your changes.</Typography>
|
|
112
|
-
</Modal>
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### Close behavior
|
|
116
|
-
|
|
117
|
-
```jsx
|
|
118
|
-
<Modal
|
|
119
|
-
showCloseButton={true}
|
|
120
|
-
closeOnOverlayClick={true}
|
|
121
|
-
closeOnEscape={true}
|
|
122
|
-
onClose={handleClose}
|
|
123
|
-
...
|
|
124
|
-
/>
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
### Form inside modal
|
|
128
|
-
|
|
129
|
-
```jsx
|
|
130
|
-
<Modal isOpen={isOpen} onClose={() => setIsOpen(false)} title="Contact Form" size="medium">
|
|
131
|
-
<form onSubmit={handleSubmit}>
|
|
132
|
-
{/* form fields */}
|
|
133
|
-
<Button type="submit">Submit</Button>
|
|
134
|
-
</form>
|
|
135
|
-
</Modal>
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
## Behavior Notes
|
|
139
|
-
|
|
140
|
-
- **Rendering:** When `isOpen` is false, the component returns `null` (nothing in the DOM).
|
|
141
|
-
- **Close:** onClose is called when the user clicks the X button (if showCloseButton), the overlay (if closeOnOverlayClick), or Escape (if closeOnEscape). Footer buttons do not auto-close; call onClose in their handlers if desired.
|
|
142
|
-
- **Body scroll:** When open, `document.body.style.overflow` is set to `"hidden"`; restored on close.
|
|
143
|
-
- **Focus:** On open, focus moves to the modal panel (ref + tabIndex={-1}); on close, focus returns to the previously focused element.
|
|
144
|
-
- **ARIA:** The overlay has `role="dialog"`, `aria-modal="true"`, and `aria-labelledby` pointing to the title when present.
|
|
145
|
-
- **Spacing:** `margin` accepts a full class string (e.g. "m-0") or an array of spacing suffixes; the component uses `getSpacingClass` with prefix `m-`.
|
|
146
|
-
|
|
147
|
-
## Related Components / Links
|
|
148
|
-
|
|
149
|
-
- ConfirmDialog (simpler confirmation-only modal with title, description, primary/secondary actions)
|
|
150
|
-
- Button (often used to open the modal and for footer actions)
|
|
151
|
-
- Typography (used for title and body content)
|
|
152
|
-
- Icon (used for the close button)
|
package/docs/Pagination.md
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
# Pagination Component
|
|
2
|
-
|
|
3
|
-
Purpose: Lets users navigate large sets of content by splitting them into pages. Shows total count, previous/next and page-number buttons (with ellipsis for long ranges), and an optional “rows per page” select. Use it below tables, lists, or search results. Fully controlled via `currentPage` and `rowsPerPage` with `onPageChange` and `onRowsPerPageChange`.
|
|
4
|
-
|
|
5
|
-
## Props / Inputs
|
|
6
|
-
|
|
7
|
-
| Prop | Type | Required | Default | Description |
|
|
8
|
-
| --- | --- | --- | --- | --- |
|
|
9
|
-
| totalItems | number | yes | — | Total number of items across all pages. |
|
|
10
|
-
| totalLabel | string | no | "Items" | Label for the total count (e.g. "Items", "Results"). |
|
|
11
|
-
| currentPage | number | yes | — | Current 1-based page number (controlled). |
|
|
12
|
-
| rowsPerPage | number | no | 10 | Number of rows per page. |
|
|
13
|
-
| rowsPerPageOptions | PaginationRowsPerPageOption[] | no | [{ label: "10", value: 10 }, ...] | Options for the rows-per-page select; each has `label` and `value` (number). |
|
|
14
|
-
| onPageChange | (page, rowsPerPage) => void | yes | — | Called when the page changes; receives (page, rowsPerPage). |
|
|
15
|
-
| onRowsPerPageChange | (rowsPerPage: number) => void | no | — | Called when the user changes rows per page; receives the new value. |
|
|
16
|
-
| variant | "default" \| "minimal" | no | "default" | Visual variant. |
|
|
17
|
-
| margin | string \| SpacingOption[] | no | "0" | Margin spacing. Suffix or array of spacing suffixes; component adds `m-` prefix (e.g. "0" → m-0). |
|
|
18
|
-
| className | string | no | "" | Additional class names for the root element. |
|
|
19
|
-
|
|
20
|
-
## Types
|
|
21
|
-
|
|
22
|
-
### SpacingOption
|
|
23
|
-
```typescript
|
|
24
|
-
type SpacingOption = (typeof SPACING_OPTIONS)[number];
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### PaginationVariant
|
|
28
|
-
```typescript
|
|
29
|
-
type PaginationVariant = "default" | "minimal";
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
### PaginationMargin
|
|
33
|
-
```typescript
|
|
34
|
-
type PaginationMargin = string | SpacingOption[];
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### PaginationRowsPerPageOption
|
|
38
|
-
```typescript
|
|
39
|
-
interface PaginationRowsPerPageOption {
|
|
40
|
-
label: string;
|
|
41
|
-
value: number;
|
|
42
|
-
}
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### PaginationProps
|
|
46
|
-
```typescript
|
|
47
|
-
interface PaginationProps {
|
|
48
|
-
totalItems: number;
|
|
49
|
-
totalLabel?: string;
|
|
50
|
-
currentPage: number;
|
|
51
|
-
rowsPerPage?: number;
|
|
52
|
-
rowsPerPageOptions?: PaginationRowsPerPageOption[];
|
|
53
|
-
onPageChange: (page: number, rowsPerPage: number) => void;
|
|
54
|
-
onRowsPerPageChange?: (rowsPerPage: number) => void;
|
|
55
|
-
variant?: PaginationVariant;
|
|
56
|
-
margin?: PaginationMargin;
|
|
57
|
-
className?: string;
|
|
58
|
-
}
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## Usage Examples
|
|
62
|
-
|
|
63
|
-
### Basic
|
|
64
|
-
|
|
65
|
-
```jsx
|
|
66
|
-
import { Pagination } from "cleanplate";
|
|
67
|
-
import { useState } from "react";
|
|
68
|
-
|
|
69
|
-
const App = () => {
|
|
70
|
-
const [currentPage, setCurrentPage] = useState(1);
|
|
71
|
-
const [rowsPerPage, setRowsPerPage] = useState(10);
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<Pagination
|
|
75
|
-
totalItems={120}
|
|
76
|
-
totalLabel="Items"
|
|
77
|
-
currentPage={currentPage}
|
|
78
|
-
rowsPerPage={rowsPerPage}
|
|
79
|
-
onPageChange={(page) => setCurrentPage(page)}
|
|
80
|
-
onRowsPerPageChange={(rpp) => {
|
|
81
|
-
setRowsPerPage(rpp);
|
|
82
|
-
setCurrentPage(1);
|
|
83
|
-
}}
|
|
84
|
-
/>
|
|
85
|
-
);
|
|
86
|
-
};
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### Variants
|
|
90
|
-
|
|
91
|
-
```jsx
|
|
92
|
-
<Pagination variant="default" totalItems={120} currentPage={currentPage} rowsPerPage={rowsPerPage} onPageChange={handlePageChange} onRowsPerPageChange={handleRowsPerPageChange} />
|
|
93
|
-
<Pagination variant="minimal" totalItems={120} currentPage={currentPage} rowsPerPage={rowsPerPage} onPageChange={handlePageChange} onRowsPerPageChange={handleRowsPerPageChange} />
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### Custom rows per page options
|
|
97
|
-
|
|
98
|
-
```jsx
|
|
99
|
-
const options = [
|
|
100
|
-
{ label: "10", value: 10 },
|
|
101
|
-
{ label: "25", value: 25 },
|
|
102
|
-
{ label: "50", value: 50 },
|
|
103
|
-
{ label: "100", value: 100 },
|
|
104
|
-
];
|
|
105
|
-
|
|
106
|
-
<Pagination
|
|
107
|
-
totalItems={500}
|
|
108
|
-
currentPage={currentPage}
|
|
109
|
-
rowsPerPage={rowsPerPage}
|
|
110
|
-
rowsPerPageOptions={options}
|
|
111
|
-
onPageChange={handlePageChange}
|
|
112
|
-
onRowsPerPageChange={handleRowsPerPageChange}
|
|
113
|
-
/>
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
### With Table
|
|
117
|
-
|
|
118
|
-
```jsx
|
|
119
|
-
import { Table, Pagination } from "cleanplate";
|
|
120
|
-
|
|
121
|
-
// Table can hide its built-in pagination (hidePagination) and you render Pagination below with your own state.
|
|
122
|
-
<Pagination
|
|
123
|
-
totalItems={totalCount}
|
|
124
|
-
currentPage={page}
|
|
125
|
-
rowsPerPage={pageSize}
|
|
126
|
-
onPageChange={(p, rpp) => { setPage(p); }}
|
|
127
|
-
onRowsPerPageChange={(rpp) => { setPageSize(rpp); setPage(1); }}
|
|
128
|
-
/>
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
## Behavior Notes
|
|
132
|
-
|
|
133
|
-
- **Controlled:** You must hold `currentPage` (and typically `rowsPerPage`) in state and pass them in; update them in `onPageChange` and `onRowsPerPageChange`.
|
|
134
|
-
- **onPageChange:** Called when the user clicks a page number or prev/next; receives `(page, rowsPerPage)`. Update `currentPage` in state.
|
|
135
|
-
- **onRowsPerPageChange:** Called when the user selects a new rows-per-page value; receives the new number. Update `rowsPerPage` and usually set `currentPage` to 1.
|
|
136
|
-
- **Page buttons:** First page, last page, and a range around the current page are shown; gaps are represented as ellipsis (disabled "..." button).
|
|
137
|
-
- **Spacing:** `margin` uses the suffix API; the component adds the `m-` prefix via `getSpacingClass`.
|
|
138
|
-
|
|
139
|
-
## Related Components / Links
|
|
140
|
-
|
|
141
|
-
- Table (often used with Pagination for tabular data; Table can show Pagination via `hidePagination={false}` or you can render Pagination separately)
|
|
142
|
-
- Container, Button, FormControls.Select, Typography, Icon (used internally)
|
package/docs/Pills.md
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
# Pills Component
|
|
2
|
-
|
|
3
|
-
Purpose: A single tag or chip that can show a label only (read-only), an inline input with submit (edit), or a label with a close button (remove). Use it for tags, filters, or editable chips where the user can add or remove items. Submit in edit mode via Enter or check button; remove via close button. Optional `isLoading` and `isDisabled`; margin uses the suffix API.
|
|
4
|
-
|
|
5
|
-
## Props / Inputs
|
|
6
|
-
|
|
7
|
-
| Prop | Type | Required | Default | Description |
|
|
8
|
-
| --- | --- | --- | --- | --- |
|
|
9
|
-
| margin | string \| SpacingOption[] | no | "0" | Margin spacing. Suffix or array of spacing suffixes; component adds `m-` prefix. |
|
|
10
|
-
| className | string | no | "" | Additional class names for the root element. |
|
|
11
|
-
| label | string | no | "" | Label in read-only/remove mode; initial value in edit mode. |
|
|
12
|
-
| placeholder | string | no | "Add tag" | Placeholder for the input in edit mode. |
|
|
13
|
-
| onSubmit | (value: string) => void | no | — | Called when user submits in edit mode (Enter or check); receives current input value. |
|
|
14
|
-
| onRemove | () => void | no | — | Called when user clicks close in remove mode. |
|
|
15
|
-
| isDisabled | boolean | no | false | Disables the input and action button. |
|
|
16
|
-
| isLoading | boolean | no | false | Shows spinner instead of icon in edit/remove mode. |
|
|
17
|
-
| mode | "read-only" \| "edit" \| "remove" | no | "read-only" | read-only (label only), edit (input + check), remove (label + close). |
|
|
18
|
-
|
|
19
|
-
## Types
|
|
20
|
-
|
|
21
|
-
### SpacingOption
|
|
22
|
-
```typescript
|
|
23
|
-
type SpacingOption = (typeof SPACING_OPTIONS)[number];
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### PillsMargin
|
|
27
|
-
```typescript
|
|
28
|
-
type PillsMargin = string | SpacingOption[];
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### PillsMode
|
|
32
|
-
```typescript
|
|
33
|
-
type PillsMode = "read-only" | "edit" | "remove";
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### PillsProps
|
|
37
|
-
```typescript
|
|
38
|
-
interface PillsProps {
|
|
39
|
-
margin?: PillsMargin;
|
|
40
|
-
className?: string;
|
|
41
|
-
label?: string;
|
|
42
|
-
placeholder?: string;
|
|
43
|
-
onSubmit?: (value: string) => void;
|
|
44
|
-
onRemove?: () => void;
|
|
45
|
-
isDisabled?: boolean;
|
|
46
|
-
isLoading?: boolean;
|
|
47
|
-
mode?: PillsMode;
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Usage Examples
|
|
52
|
-
|
|
53
|
-
### Basic
|
|
54
|
-
|
|
55
|
-
```jsx
|
|
56
|
-
import { Pills } from "cleanplate";
|
|
57
|
-
|
|
58
|
-
<Pills label="Taxi" mode="read-only" />
|
|
59
|
-
<Pills mode="edit" placeholder="Add tag" onSubmit={(v) => console.log(v)} />
|
|
60
|
-
<Pills label="Tag" mode="remove" onRemove={() => {}} />
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### Controlled (edit)
|
|
64
|
-
|
|
65
|
-
```jsx
|
|
66
|
-
import { Pills } from "cleanplate";
|
|
67
|
-
import { useState } from "react";
|
|
68
|
-
|
|
69
|
-
const [tag, setTag] = useState("Taxi");
|
|
70
|
-
<Pills
|
|
71
|
-
label={tag}
|
|
72
|
-
mode="edit"
|
|
73
|
-
placeholder="Add tag"
|
|
74
|
-
onSubmit={(v) => setTag(v)}
|
|
75
|
-
onRemove={() => setTag("")}
|
|
76
|
-
/>
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### Modes
|
|
80
|
-
|
|
81
|
-
```jsx
|
|
82
|
-
<Pills label="Tag" mode="read-only" />
|
|
83
|
-
<Pills label="" mode="edit" placeholder="Add tag" onSubmit={onSubmit} />
|
|
84
|
-
<Pills label="Tag" mode="remove" onRemove={onRemove} />
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### Loading and disabled
|
|
88
|
-
|
|
89
|
-
```jsx
|
|
90
|
-
<Pills mode="edit" isLoading />
|
|
91
|
-
<Pills label="Tag" mode="remove" isDisabled onRemove={() => {}} />
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
## Behavior Notes
|
|
95
|
-
|
|
96
|
-
- **Edit mode:** Internal state holds the input value. On submit (Enter or check), `onSubmit(value)` is called and internal value is cleared. Parent can pass new `label` to reflect saved value.
|
|
97
|
-
- **Remove mode:** Close button calls `onRemove()`; parent typically clears or unmounts the pill.
|
|
98
|
-
- **Spacing:** `margin` uses the suffix API; the component adds the `m-` prefix via `getSpacingClass`.
|
|
99
|
-
|
|
100
|
-
## Related Components / Links
|
|
101
|
-
|
|
102
|
-
- Container (layout for multiple pills)
|
|
103
|
-
- FormControls.Input, Button, Icon, Spinner (used internally)
|
|
104
|
-
- Typography (used for label in read-only/remove mode)
|