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/llms.txt
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
# CleanPlate Component Documentation Index
|
|
2
|
-
|
|
3
|
-
This file contains an index of all available component documentation for the CleanPlate UI framework.
|
|
4
|
-
|
|
5
|
-
## Project Overview
|
|
6
|
-
|
|
7
|
-
CleanPlate is a Headless React UI Framework providing reusable, accessible, and customizable components for building modern web applications.
|
|
8
|
-
|
|
9
|
-
## Component Documentation
|
|
10
|
-
|
|
11
|
-
All component documentation is located in the `docs/` folder. The following documentation files are available:
|
|
12
|
-
|
|
13
|
-
### Button Component
|
|
14
|
-
- File: `docs/Button.md`
|
|
15
|
-
- Purpose: A highly customizable and interactive UI element designed to handle user actions with various styles, sizes, and variants. Supports loading states, disabled states, and click events.
|
|
16
|
-
- Key Features: Variants (solid, outline, ghost, icon), sizes (small, medium), loading states, disabled states, fluid layout, margin spacing
|
|
17
|
-
- Types: ButtonProps, ButtonSize, ButtonVariant, ButtonMargin, SpacingOption
|
|
18
|
-
|
|
19
|
-
### Typography Component
|
|
20
|
-
- File: `docs/Typography.md`
|
|
21
|
-
- Purpose: Provides a consistent set of text styles for headings, paragraphs, and inline elements, ensuring clear hierarchy, readability, and brand-aligned communication across the interface.
|
|
22
|
-
- Key Features: Variants (h1-h6, p, span, small), text alignment, word breaking, bold text, margin spacing
|
|
23
|
-
- Types: TypographyProps, TypographyVariant, TypographyAlign, TypographyWordBreak, TypographyMargin, SpacingOption
|
|
24
|
-
|
|
25
|
-
### Icon Component
|
|
26
|
-
- File: `docs/Icon.md`
|
|
27
|
-
- Purpose: A versatile and reusable element for displaying scalable vector icons, supporting various sizes, colors, and custom classes. Uses Google Material Symbols.
|
|
28
|
-
- Key Features: Material Symbols integration, sizes (small, medium, large), colors (black, white, gray, blue, green, red, yellow, orange)
|
|
29
|
-
- Types: IconProps, IconSize, IconColor
|
|
30
|
-
- Note: Requires Material Symbols font to be included in the project
|
|
31
|
-
|
|
32
|
-
### MediaObject Component
|
|
33
|
-
- File: `docs/MediaObject.md`
|
|
34
|
-
- 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.
|
|
35
|
-
- Key Features: Media types (icon, image, avatar), title and description, margin and padding spacing, clickable support
|
|
36
|
-
- Types: MediaObjectProps, MediaObjectMargin, MediaObjectPadding, SpacingOption
|
|
37
|
-
- Related Components: Uses Avatar and Typography internally
|
|
38
|
-
|
|
39
|
-
### Avatar Component
|
|
40
|
-
- File: `docs/Avatar.md`
|
|
41
|
-
- 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.
|
|
42
|
-
- Key Features: Display modes (initials, image, icon), sizes (small, medium), margin spacing (suffix API: e.g. "0" → m-0), optional onClick
|
|
43
|
-
- Types: AvatarProps, AvatarSize, AvatarMargin, SpacingOption; icon prop uses MaterialIconName from Icon
|
|
44
|
-
- Related Components: Used by MediaObject; often used with Container, Icon
|
|
45
|
-
|
|
46
|
-
### Container Component
|
|
47
|
-
- File: `docs/Container.md`
|
|
48
|
-
- Purpose: A layout wrapper that controls display type, width, spacing (margin, padding, gap), and flex alignment. Use it to structure content, create flex layouts, and apply consistent spacing.
|
|
49
|
-
- Key Features: Display (block, flex, inline-block), width variants, margin/padding/gap spacing (suffix API: e.g. "4" → p-4, "0" → m-0), flex align/justify, responsive width at 600px
|
|
50
|
-
- Types: ContainerProps, ContainerDisplay, ContainerWidth, ContainerJustify, ContainerAlign, ContainerSpacing, SpacingOption
|
|
51
|
-
|
|
52
|
-
### Dropdown Component
|
|
53
|
-
- File: `docs/Dropdown.md`
|
|
54
|
-
- Purpose: Floating panel that shows content relative to a trigger. Use for menus, option lists, or any content that opens on click.
|
|
55
|
-
- Key Features: 12 placements, flip/shift to stay in viewport, three trigger modes (trigger element, renderTrigger, triggerLabel), close on outside click or Escape
|
|
56
|
-
- Types: DropdownProps, DropdownPlacement, DropdownTriggerProps, DropdownRenderTriggerParams
|
|
57
|
-
- Related Components: Button (trigger), MenuList (content)
|
|
58
|
-
|
|
59
|
-
### Alert Component
|
|
60
|
-
- File: `docs/Alert.md`
|
|
61
|
-
- Purpose: Displays a short message with optional variant icon and dismiss button. Use for inline feedback (success, error, warning, info) or neutral notices.
|
|
62
|
-
- Key Features: Variants (default, info, warning, error, success), sizes (small, medium, large), dismissible with onDismiss, margin spacing (suffix API), unmounts on dismiss
|
|
63
|
-
- Types: AlertProps, AlertSize, AlertVariant, AlertMargin, SpacingOption
|
|
64
|
-
- Related Components: Typography, Container, Button, Icon (used internally)
|
|
65
|
-
|
|
66
|
-
### Spinner Component
|
|
67
|
-
- File: `docs/Spinner.md`
|
|
68
|
-
- Purpose: Loading indicator that shows a rotating Material icon. Use for progress or activity states.
|
|
69
|
-
- Key Features: Six icon options (progress_activity, autorenew, sync, refresh, cached, loop), sizes (small, medium, large), variants (light, dark), margin spacing (suffix API)
|
|
70
|
-
- Types: SpinnerProps, SpinnerSize, SpinnerVariant, SpinnerIcon, SpinnerMargin, SpacingOption
|
|
71
|
-
- Related Components: Container, Icon (used internally)
|
|
72
|
-
|
|
73
|
-
### Stepper Component
|
|
74
|
-
- File: `docs/Stepper.md`
|
|
75
|
-
- Purpose: Displays a sequence of steps for wizards or multi-step flows. Each step has label, key, and optional active/completed state; steps can be clickable.
|
|
76
|
-
- Key Features: Variants (horizontal, vertical), config-driven steps (StepperStepConfig), optional onClick(step), margin spacing (suffix API), completed state shows done icon
|
|
77
|
-
- Types: StepperProps, StepperStepConfig, StepperVariant, StepperMargin, SpacingOption
|
|
78
|
-
- Related Components: Container, Typography, Icon (used internally)
|
|
79
|
-
|
|
80
|
-
### ConfirmDialog Component
|
|
81
|
-
- File: `docs/ConfirmDialog.md`
|
|
82
|
-
- Purpose: Modal dialog for confirmation actions (delete, discard, proceed). Title, description, primary/secondary buttons, optional close button; overlay and Escape to close.
|
|
83
|
-
- Key Features: Variants (default, destructive, warning), sizes (small, medium, large), showCloseButton, closeOnOverlayClick, closeOnEscape, focus and body scroll management
|
|
84
|
-
- Types: ConfirmDialogProps, ConfirmDialogSize, ConfirmDialogVariant
|
|
85
|
-
- Related Components: Button, Typography, Icon (used internally)
|
|
86
|
-
|
|
87
|
-
### Modal Component
|
|
88
|
-
- File: `docs/Modal.md`
|
|
89
|
-
- Purpose: Full-featured modal overlay for forms, long content, or custom dialogs. Optional title, close button, footer primary/secondary buttons; overlay and Escape to close.
|
|
90
|
-
- Key Features: Sizes (small, medium, large, fullscreen), showCloseButton, closeOnOverlayClick, closeOnEscape, margin spacing, contentClassName/overlayClassName, focus and body scroll management
|
|
91
|
-
- Types: ModalProps, ModalSize, ModalMargin, SpacingOption
|
|
92
|
-
- Related Components: ConfirmDialog (simpler confirm-only), Button, Typography, Icon (used internally)
|
|
93
|
-
|
|
94
|
-
### Pagination Component
|
|
95
|
-
- File: `docs/Pagination.md`
|
|
96
|
-
- Purpose: Navigate large content sets by pages. Shows total count, prev/next and page-number buttons with ellipsis, and optional rows-per-page select. Controlled via currentPage and rowsPerPage.
|
|
97
|
-
- Key Features: Variants (default, minimal), rowsPerPageOptions, onPageChange(page, rowsPerPage), onRowsPerPageChange(rowsPerPage), margin spacing (suffix API)
|
|
98
|
-
- Types: PaginationProps, PaginationVariant, PaginationMargin, PaginationRowsPerPageOption, SpacingOption
|
|
99
|
-
- Related Components: Table (often used with Pagination), Container, Button, FormControls.Select, Typography, Icon (used internally)
|
|
100
|
-
|
|
101
|
-
### Table Component
|
|
102
|
-
- File: `docs/Table.md`
|
|
103
|
-
- Purpose: Displays structured data in a table with configurable columns, optional built-in pagination, and responsive mobile view (MediaObject cards when viewport < 768px and mobileColumns set).
|
|
104
|
-
- Key Features: columns (id, title, textAlign, widthPercentage, customRender), data (TableRow[]), variants (default, compact), mobileColumns, onRowClick, pagination props (totalItems, currentPage, onPageChange, etc.), hidePagination, margin (suffix API)
|
|
105
|
-
- Types: TableProps, TableColumn, TableRow, TableVariant, TableMargin, TableColumnTextAlign, TableMobileColumns, SpacingOption
|
|
106
|
-
- Related Components: Pagination (built-in), MediaObject (mobile view), Typography, Container, Badge (often in customRender)
|
|
107
|
-
|
|
108
|
-
### Badge Component
|
|
109
|
-
- File: `docs/Badge.md`
|
|
110
|
-
- Purpose: Short label with colored background for status, tags, or counts. Inline-block, five variants.
|
|
111
|
-
- Key Features: label, variant (default, info, success, warning, error), className
|
|
112
|
-
- Types: BadgeProps, BadgeVariant
|
|
113
|
-
- Related Components: Table (often in customRender for status columns), Container (layout for multiple badges)
|
|
114
|
-
|
|
115
|
-
### Pills Component
|
|
116
|
-
- File: `docs/Pills.md`
|
|
117
|
-
- Purpose: Single tag/chip with modes: read-only (label only), edit (input + submit), remove (label + close). For tags, filters, editable chips.
|
|
118
|
-
- Key Features: mode (read-only, edit, remove), label, placeholder, onSubmit(value), onRemove(), isLoading, isDisabled, margin (suffix API)
|
|
119
|
-
- Types: PillsProps, PillsMode, PillsMargin, SpacingOption
|
|
120
|
-
- Related Components: Container (layout), FormControls.Input, Button, Icon, Spinner, Typography (used internally)
|
|
121
|
-
|
|
122
|
-
## Documentation Format
|
|
123
|
-
|
|
124
|
-
All documentation files follow a consistent format:
|
|
125
|
-
1. Component name and purpose
|
|
126
|
-
2. Props/Inputs table with types, defaults, and descriptions
|
|
127
|
-
3. TypeScript type definitions
|
|
128
|
-
4. Usage examples covering common use cases
|
|
129
|
-
5. Behavior notes explaining important details
|
|
130
|
-
6. Related components and links
|
|
131
|
-
|
|
132
|
-
## Quick Reference
|
|
133
|
-
|
|
134
|
-
| Component | File | Primary Use Case |
|
|
135
|
-
|-----------|------|------------------|
|
|
136
|
-
| Button | `docs/Button.md` | User actions and interactions |
|
|
137
|
-
| Typography | `docs/Typography.md` | Text content and headings |
|
|
138
|
-
| Icon | `docs/Icon.md` | Visual icons and symbols |
|
|
139
|
-
| MediaObject | `docs/MediaObject.md` | Media + content layouts |
|
|
140
|
-
| Avatar | `docs/Avatar.md` | User identity (initials, image, or icon) |
|
|
141
|
-
| Container | `docs/Container.md` | Layout, spacing, and flex structure |
|
|
142
|
-
| Dropdown | `docs/Dropdown.md` | Menus and floating panels |
|
|
143
|
-
| Alert | `docs/Alert.md` | Inline feedback and notices |
|
|
144
|
-
| Spinner | `docs/Spinner.md` | Loading and activity indicator |
|
|
145
|
-
| Stepper | `docs/Stepper.md` | Multi-step flows and wizards |
|
|
146
|
-
| ConfirmDialog | `docs/ConfirmDialog.md` | Confirmation modals and destructive actions |
|
|
147
|
-
| Modal | `docs/Modal.md` | Forms, long content, and custom dialogs |
|
|
148
|
-
| Pagination | `docs/Pagination.md` | Page navigation for tables and lists |
|
|
149
|
-
| Table | `docs/Table.md` | Structured tabular data with optional pagination and mobile view |
|
|
150
|
-
| Badge | `docs/Badge.md` | Status labels, tags, and counts with colored variants |
|
|
151
|
-
| Pills | `docs/Pills.md` | Tags/chips with read-only, edit, and remove modes |
|
|
152
|
-
|
|
153
|
-
## Additional Resources
|
|
154
|
-
|
|
155
|
-
- Component source code: `src/components/`
|
|
156
|
-
- Storybook documentation: Available at the project's Storybook instance
|
|
157
|
-
- Type definitions: `src/types/` and component-specific type exports
|
|
158
|
-
- Storybook static build: `storybook-static/`
|
|
159
|
-
- Component stories: `src/stories/`
|
|
160
|
-
|
|
161
|
-
## Installation
|
|
162
|
-
|
|
163
|
-
```bash
|
|
164
|
-
npm install cleanplate
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
## Usage
|
|
168
|
-
|
|
169
|
-
```jsx
|
|
170
|
-
import { Button, Typography, Icon, MediaObject, Avatar, Container, Dropdown, Alert, Spinner, Stepper, ConfirmDialog, Modal, Pagination, Table, Badge, Pills } from "cleanplate";
|
|
171
|
-
```
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
// scripts/generate-icons.js
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const https = require('https');
|
|
5
|
-
|
|
6
|
-
// Material Symbols Outlined variable font codepoints (same format: "icon_name codepoint" per line)
|
|
7
|
-
const CODEPOINTS_URL =
|
|
8
|
-
'https://raw.githubusercontent.com/google/material-design-icons/master/variablefont/MaterialSymbolsOutlined%5BFILL%2CGRAD%2Copsz%2Cwght%5D.codepoints';
|
|
9
|
-
|
|
10
|
-
async function fetchMaterialIcons() {
|
|
11
|
-
return new Promise((resolve, reject) => {
|
|
12
|
-
https.get(CODEPOINTS_URL, (res) => {
|
|
13
|
-
let data = '';
|
|
14
|
-
res.on('data', (chunk) => data += chunk);
|
|
15
|
-
res.on('end', () => resolve(data));
|
|
16
|
-
res.on('error', reject);
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function parseCodepoints(data) {
|
|
22
|
-
// Same format as Material Icons: each line is "icon_name codepoint" (space-separated)
|
|
23
|
-
return data
|
|
24
|
-
.split('\n')
|
|
25
|
-
.filter((line) => line.trim())
|
|
26
|
-
.map((line) => line.split(' ')[0])
|
|
27
|
-
.sort();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function categorizIcons(icons) {
|
|
31
|
-
// Basic categorization - you can enhance this
|
|
32
|
-
const categories = {
|
|
33
|
-
navigation: [],
|
|
34
|
-
action: [],
|
|
35
|
-
communication: [],
|
|
36
|
-
content: [],
|
|
37
|
-
device: [],
|
|
38
|
-
editor: [],
|
|
39
|
-
file: [],
|
|
40
|
-
hardware: [],
|
|
41
|
-
image: [],
|
|
42
|
-
maps: [],
|
|
43
|
-
notification: [],
|
|
44
|
-
social: [],
|
|
45
|
-
toggle: [],
|
|
46
|
-
av: [],
|
|
47
|
-
alert: [],
|
|
48
|
-
other: []
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
icons.forEach(icon => {
|
|
52
|
-
// Simple prefix-based categorization
|
|
53
|
-
if (icon.startsWith('arrow_') || icon.startsWith('navigation_') || ['home', 'menu', 'close'].includes(icon)) {
|
|
54
|
-
categories.navigation.push(icon);
|
|
55
|
-
} else if (icon.startsWith('add') || icon.startsWith('delete') || icon.startsWith('edit') || ['search', 'settings', 'refresh'].includes(icon)) {
|
|
56
|
-
categories.action.push(icon);
|
|
57
|
-
} else if (icon.startsWith('email') || icon.startsWith('chat') || icon.startsWith('message')) {
|
|
58
|
-
categories.communication.push(icon);
|
|
59
|
-
} else if (icon.startsWith('content_')) {
|
|
60
|
-
categories.content.push(icon);
|
|
61
|
-
} else if (icon.startsWith('phone') || icon.startsWith('device')) {
|
|
62
|
-
categories.device.push(icon);
|
|
63
|
-
} else if (icon.startsWith('format_')) {
|
|
64
|
-
categories.editor.push(icon);
|
|
65
|
-
} else if (icon.startsWith('folder') || icon.startsWith('insert_')) {
|
|
66
|
-
categories.file.push(icon);
|
|
67
|
-
} else if (icon.startsWith('computer') || icon.startsWith('keyboard')) {
|
|
68
|
-
categories.hardware.push(icon);
|
|
69
|
-
} else if (icon.startsWith('image') || icon.startsWith('photo')) {
|
|
70
|
-
categories.image.push(icon);
|
|
71
|
-
} else if (icon.startsWith('map') || icon.startsWith('place')) {
|
|
72
|
-
categories.maps.push(icon);
|
|
73
|
-
} else if (icon.startsWith('notification')) {
|
|
74
|
-
categories.notification.push(icon);
|
|
75
|
-
} else if (icon.startsWith('person') || icon.startsWith('group') || icon.startsWith('share')) {
|
|
76
|
-
categories.social.push(icon);
|
|
77
|
-
} else if (icon.startsWith('toggle_') || icon.startsWith('check')) {
|
|
78
|
-
categories.toggle.push(icon);
|
|
79
|
-
} else if (icon.startsWith('play_') || icon.startsWith('pause') || icon.startsWith('volume')) {
|
|
80
|
-
categories.av.push(icon);
|
|
81
|
-
} else if (icon.startsWith('error') || icon.startsWith('warning')) {
|
|
82
|
-
categories.alert.push(icon);
|
|
83
|
-
} else {
|
|
84
|
-
categories.other.push(icon);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
return categories;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function generateTypeScript(icons, categories) {
|
|
92
|
-
const template = `// This file is auto-generated. Do not edit manually.
|
|
93
|
-
// Generated on: ${new Date().toISOString()}
|
|
94
|
-
// Total icons: ${icons.length}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* All available Material Symbol names (Material Symbols Outlined variable font).
|
|
98
|
-
* Source: https://fonts.google.com/icons
|
|
99
|
-
*/
|
|
100
|
-
export const MATERIAL_ICON_NAMES = [
|
|
101
|
-
${icons.map(icon => ` '${icon}'`).join(',\n')}
|
|
102
|
-
] as const;
|
|
103
|
-
|
|
104
|
-
export type MaterialIconName = typeof MATERIAL_ICON_NAMES[number];
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Material Symbols organized by category for easier discovery.
|
|
108
|
-
* Use this when you need to find icons for specific purposes.
|
|
109
|
-
*/
|
|
110
|
-
export const ICON_CATEGORIES = {
|
|
111
|
-
${Object.entries(categories)
|
|
112
|
-
.filter(([_, icons]) => icons.length > 0)
|
|
113
|
-
.map(([category, icons]) =>
|
|
114
|
-
` ${category}: [\n${icons.map(icon => ` '${icon}'`).join(',\n')}\n ] as const`
|
|
115
|
-
)
|
|
116
|
-
.join(',\n')}
|
|
117
|
-
} as const;
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Helper function to check if a string is a valid Material Symbol name.
|
|
121
|
-
*/
|
|
122
|
-
export function isMaterialIconName(name: string): name is MaterialIconName {
|
|
123
|
-
return MATERIAL_ICON_NAMES.includes(name as MaterialIconName);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Get all icons in a specific category.
|
|
128
|
-
*/
|
|
129
|
-
export function getIconsByCategory(category: keyof typeof ICON_CATEGORIES): readonly string[] {
|
|
130
|
-
return ICON_CATEGORIES[category];
|
|
131
|
-
}
|
|
132
|
-
`;
|
|
133
|
-
|
|
134
|
-
return template;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
async function main() {
|
|
138
|
-
try {
|
|
139
|
-
console.log('Fetching Material Symbols Outlined codepoints...');
|
|
140
|
-
const data = await fetchMaterialIcons();
|
|
141
|
-
|
|
142
|
-
console.log('Parsing icon names...');
|
|
143
|
-
const icons = parseCodepoints(data);
|
|
144
|
-
|
|
145
|
-
console.log(`Found ${icons.length} icons`);
|
|
146
|
-
|
|
147
|
-
console.log('Categorizing icons...');
|
|
148
|
-
const categories = categorizIcons(icons);
|
|
149
|
-
|
|
150
|
-
console.log('Generating TypeScript file...');
|
|
151
|
-
const tsContent = generateTypeScript(icons, categories);
|
|
152
|
-
|
|
153
|
-
const outputPath = path.join(__dirname, '../src/components/icon/material-icon-names.ts');
|
|
154
|
-
const outputDir = path.dirname(outputPath);
|
|
155
|
-
|
|
156
|
-
if (!fs.existsSync(outputDir)) {
|
|
157
|
-
fs.mkdirSync(outputDir, { recursive: true });
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
fs.writeFileSync(outputPath, tsContent);
|
|
161
|
-
|
|
162
|
-
console.log(`✅ Successfully generated ${outputPath}`);
|
|
163
|
-
console.log('\nCategory summary:');
|
|
164
|
-
Object.entries(categories)
|
|
165
|
-
.filter(([_, icons]) => icons.length > 0)
|
|
166
|
-
.forEach(([category, icons]) => {
|
|
167
|
-
console.log(` ${category}: ${icons.length} icons`);
|
|
168
|
-
});
|
|
169
|
-
} catch (error) {
|
|
170
|
-
console.error('Error generating icons:', error);
|
|
171
|
-
process.exit(1);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
main();
|
package/templates/README.md
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# Templates
|
|
2
|
-
|
|
3
|
-
Reference templates for documentation and Storybook. Use these when adding or updating component docs.
|
|
4
|
-
|
|
5
|
-
| File | Purpose |
|
|
6
|
-
|------|---------|
|
|
7
|
-
| `storybook-docs-template.md` | How to write Storybook docs (stories + docs.mdx): folder structure, meta, argTypes, args, Default/named stories, spacing suffix, docs.mdx sections, checklist. |
|
|
8
|
-
| `docs-template-sample.md` | Sample structure for LLM/component docs in `docs/<Component>.md`: Purpose, Props table, Types, Usage examples, Behavior notes, Related components. |
|
|
9
|
-
|
|
10
|
-
See `llms.txt` for the full documentation index.
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
# Avatar Component
|
|
2
|
-
|
|
3
|
-
Purpose: Display a user avatar as an image, icon, or initials.
|
|
4
|
-
|
|
5
|
-
## Props / Inputs
|
|
6
|
-
|
|
7
|
-
| Prop | Type | Required | Default | Description |
|
|
8
|
-
| --- | --- | --- | --- | --- |
|
|
9
|
-
| name | string | no | "" | Used for initials, title text, and background color seed. |
|
|
10
|
-
| image | string | no | "" | Image URL to render when `icon` is not set. |
|
|
11
|
-
| icon | string | no | "" | Icon name to render when `image` is not set. |
|
|
12
|
-
| size | "small" \| "medium" | no | "medium" | Size variant. |
|
|
13
|
-
| margin | string \| string[] | no | "m-0" | Spacing utility token(s), such as `m-0` or `m-b-2`. |
|
|
14
|
-
| className | string | no | "" | Additional class names for the root element. |
|
|
15
|
-
| onClick | function | no | — | Called with the click event. |
|
|
16
|
-
|
|
17
|
-
## Types
|
|
18
|
-
|
|
19
|
-
None.
|
|
20
|
-
|
|
21
|
-
## Usage Examples
|
|
22
|
-
|
|
23
|
-
### Initials (default)
|
|
24
|
-
|
|
25
|
-
```jsx
|
|
26
|
-
import { Avatar } from "cleanplate";
|
|
27
|
-
|
|
28
|
-
export const Example = () => (
|
|
29
|
-
<Avatar name="Jane Doe" />
|
|
30
|
-
);
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### Image avatar
|
|
34
|
-
|
|
35
|
-
```jsx
|
|
36
|
-
import { Avatar } from "cleanplate";
|
|
37
|
-
|
|
38
|
-
export const Example = () => (
|
|
39
|
-
<Avatar
|
|
40
|
-
name="Jane Doe"
|
|
41
|
-
image="https://example.com/jane.jpg"
|
|
42
|
-
size="small"
|
|
43
|
-
/>
|
|
44
|
-
);
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Icon avatar
|
|
48
|
-
|
|
49
|
-
```jsx
|
|
50
|
-
import { Avatar } from "cleanplate";
|
|
51
|
-
|
|
52
|
-
export const Example = () => (
|
|
53
|
-
<Avatar icon="person" />
|
|
54
|
-
);
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## Behavior Notes
|
|
58
|
-
|
|
59
|
-
- Initials are derived from the first letter of each word and limited to 2 characters.
|
|
60
|
-
- Background color is generated from `name`, so the same name yields the same color.
|
|
61
|
-
- Provide only one of `image` or `icon`. If both are set, the component renders no content.
|
|
62
|
-
- The root element sets `title` to the value of `name`.
|
|
63
|
-
|
|
64
|
-
## Related Components / Links
|
|
65
|
-
|
|
66
|
-
- MediaObject
|
|
67
|
-
- Icon
|
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
# Storybook docs reference template
|
|
2
|
-
|
|
3
|
-
Use this as a reference when adding or updating Storybook documentation for a component. The pattern is used by Alert, Avatar, Spinner, Stepper, ConfirmDialog, and Dropdown.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. Folder and file structure
|
|
8
|
-
|
|
9
|
-
Put each component's stories and docs in a **folder** under `src/stories/`:
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
src/stories/
|
|
13
|
-
<component-name>/
|
|
14
|
-
<component-name>.stories.jsx # Playground + named stories
|
|
15
|
-
<component-name>.docs.mdx # Documentation tab
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Examples: `alert/alert.stories.jsx`, `avatar/avatar.docs.mdx`, `stepper/stepper.stories.jsx`.
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## 2. Stories file (`*.stories.jsx`)
|
|
23
|
-
|
|
24
|
-
### Meta (shared)
|
|
25
|
-
|
|
26
|
-
- **title:** `atoms/<ComponentName>/Playground` or `molecules/<ComponentName>/Playground` (match your taxonomy).
|
|
27
|
-
- **component:** The component from `../../index`.
|
|
28
|
-
- **parameters:** `layout: "centered"` for consistent canvas.
|
|
29
|
-
- **argTypes:** One entry per prop you want in the Controls panel:
|
|
30
|
-
- `control: "text"` or `control: "boolean"` or `control: { type: "select" }` with `options`.
|
|
31
|
-
- `description` for each.
|
|
32
|
-
- For event handlers use `{ action: "onClick" }` (or onClose, etc.).
|
|
33
|
-
- **args:** Default values for the Controls (and for the Default story if it spreads `args`).
|
|
34
|
-
|
|
35
|
-
### Spacing props (margin, padding, gap)
|
|
36
|
-
|
|
37
|
-
- Use **suffix** values: the component adds the prefix (`m-`, `p-`, `g-`) internally.
|
|
38
|
-
- In argTypes, use a limited options list, e.g. `SPACING_OPTIONS.slice(0, 10)` and `control: { type: "select" }`.
|
|
39
|
-
- In args and in static examples, use strings like `"0"`, `"b-2"` (not `"m-0"`, `"m-b-2"`).
|
|
40
|
-
|
|
41
|
-
### Stories to export
|
|
42
|
-
|
|
43
|
-
- **Default:** Single interactive story that spreads `args` so Controls drive the component. Wrap in `Container` if needed.
|
|
44
|
-
- **Variants / Sizes / etc.:** Named stories that show a few fixed variants (e.g. all variants, all sizes) with short headings via Typography.
|
|
45
|
-
|
|
46
|
-
### Imports
|
|
47
|
-
|
|
48
|
-
- Component(s), Container, Typography from `../../index`.
|
|
49
|
-
- Constants (e.g. `SPACING_OPTIONS`) from `../../constants/common` if needed.
|
|
50
|
-
|
|
51
|
-
### Example skeleton (stories)
|
|
52
|
-
|
|
53
|
-
```jsx
|
|
54
|
-
import { ComponentName, Container, Typography } from "../../index";
|
|
55
|
-
import { SPACING_OPTIONS } from "../../constants/common";
|
|
56
|
-
|
|
57
|
-
const MARGIN_OPTIONS = SPACING_OPTIONS.slice(0, 10);
|
|
58
|
-
|
|
59
|
-
const meta = {
|
|
60
|
-
title: "atoms/ComponentName/Playground",
|
|
61
|
-
component: ComponentName,
|
|
62
|
-
parameters: { layout: "centered" },
|
|
63
|
-
argTypes: {
|
|
64
|
-
someProp: { control: "text", description: "..." },
|
|
65
|
-
variant: {
|
|
66
|
-
options: ["a", "b"],
|
|
67
|
-
control: { type: "select" },
|
|
68
|
-
description: "...",
|
|
69
|
-
},
|
|
70
|
-
margin: {
|
|
71
|
-
options: MARGIN_OPTIONS,
|
|
72
|
-
control: { type: "select" },
|
|
73
|
-
description: "Margin spacing (suffix: e.g. '0' applies m-0)",
|
|
74
|
-
},
|
|
75
|
-
onClick: { action: "onClick" },
|
|
76
|
-
},
|
|
77
|
-
args: {
|
|
78
|
-
variant: "a",
|
|
79
|
-
margin: "0",
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export const Default = {
|
|
84
|
-
name: "Default",
|
|
85
|
-
render: (args) => (
|
|
86
|
-
<Container padding="4">
|
|
87
|
-
<ComponentName {...args} />
|
|
88
|
-
</Container>
|
|
89
|
-
),
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export const Variants = {
|
|
93
|
-
name: "Variants",
|
|
94
|
-
render: () => (
|
|
95
|
-
<Container padding="4">
|
|
96
|
-
<Typography variant="h5" margin="m-0 m-b-2">Variants</Typography>
|
|
97
|
-
{/* ... */}
|
|
98
|
-
</Container>
|
|
99
|
-
),
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export default meta;
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
107
|
-
## 3. Documentation MDX (`*.docs.mdx`)
|
|
108
|
-
|
|
109
|
-
### Meta
|
|
110
|
-
|
|
111
|
-
```mdx
|
|
112
|
-
import { Meta } from "@storybook/blocks";
|
|
113
|
-
import { ArgsTable } from "@storybook/addon-docs";
|
|
114
|
-
import { ComponentName, Container, Typography } from "../../index";
|
|
115
|
-
|
|
116
|
-
<Meta title="atoms/ComponentName/Documentation" />
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
### Sections (in order)
|
|
120
|
-
|
|
121
|
-
1. **Title and intro**
|
|
122
|
-
One short paragraph: what the component is and when to use it.
|
|
123
|
-
|
|
124
|
-
2. **Features**
|
|
125
|
-
Bullet list of main capabilities (variants, sizes, key props, spacing API, etc.).
|
|
126
|
-
|
|
127
|
-
3. **Usage**
|
|
128
|
-
Single code block (jsx) with one import and one minimal example.
|
|
129
|
-
|
|
130
|
-
4. **Examples**
|
|
131
|
-
Subsections (e.g. Variants, Sizes, With Container) with short descriptions and code blocks. Use `jsx` for blocks.
|
|
132
|
-
|
|
133
|
-
5. **Spacing (if applicable)**
|
|
134
|
-
Explain suffix API and show single value and array usage.
|
|
135
|
-
|
|
136
|
-
6. **Behavior**
|
|
137
|
-
Bullet list: how key props work, DOM structure, accessibility notes.
|
|
138
|
-
|
|
139
|
-
7. **Props**
|
|
140
|
-
```mdx
|
|
141
|
-
## Props
|
|
142
|
-
<ArgsTable of={ComponentName} />
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
8. **Related components**
|
|
146
|
-
Bullet list of related components and how they're used with this one.
|
|
147
|
-
|
|
148
|
-
### Example skeleton (docs)
|
|
149
|
-
|
|
150
|
-
```mdx
|
|
151
|
-
import { Meta } from "@storybook/blocks";
|
|
152
|
-
import { ArgsTable } from "@storybook/addon-docs";
|
|
153
|
-
import { ComponentName, Container } from "../../index";
|
|
154
|
-
|
|
155
|
-
<Meta title="atoms/ComponentName/Documentation" />
|
|
156
|
-
|
|
157
|
-
# ComponentName
|
|
158
|
-
|
|
159
|
-
Short intro: what it is and when to use it.
|
|
160
|
-
|
|
161
|
-
## Features
|
|
162
|
-
|
|
163
|
-
- **Feature one:** ...
|
|
164
|
-
- **Feature two:** ...
|
|
165
|
-
|
|
166
|
-
## Usage
|
|
167
|
-
|
|
168
|
-
```jsx
|
|
169
|
-
import { ComponentName } from "cleanplate";
|
|
170
|
-
const App = () => <ComponentName prop="value" />;
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
## Examples
|
|
174
|
-
|
|
175
|
-
### Variants
|
|
176
|
-
```jsx
|
|
177
|
-
<ComponentName variant="a" />
|
|
178
|
-
<ComponentName variant="b" />
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
### With Container
|
|
182
|
-
```jsx
|
|
183
|
-
<Container padding="4">
|
|
184
|
-
<ComponentName margin="b-2" />
|
|
185
|
-
</Container>
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
## Spacing (margin)
|
|
189
|
-
|
|
190
|
-
`margin` accepts the **spacing suffix**. Component adds `m-` prefix (e.g. `"0"` → m-0).
|
|
191
|
-
|
|
192
|
-
```jsx
|
|
193
|
-
<ComponentName margin="0" />
|
|
194
|
-
<ComponentName margin={["b-2"]} />
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
## Behavior
|
|
198
|
-
|
|
199
|
-
- **Point one:** ...
|
|
200
|
-
- **Root element:** ...
|
|
201
|
-
|
|
202
|
-
## Props
|
|
203
|
-
|
|
204
|
-
<ArgsTable of={ComponentName} />
|
|
205
|
-
|
|
206
|
-
## Related components
|
|
207
|
-
|
|
208
|
-
- **OtherComponent** – How it relates
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
---
|
|
212
|
-
|
|
213
|
-
## 4. Naming and taxonomy
|
|
214
|
-
|
|
215
|
-
- **Atoms:** Button, Typography, Icon, Alert, Avatar, Spinner, Stepper, Container.
|
|
216
|
-
- **Molecules:** Dropdown, ConfirmDialog, MediaObject, etc.
|
|
217
|
-
- Use the same segment in both titles: `atoms/Alert/Playground` and `atoms/Alert/Documentation`.
|
|
218
|
-
|
|
219
|
-
---
|
|
220
|
-
|
|
221
|
-
## 5. Checklist for a new component
|
|
222
|
-
|
|
223
|
-
- [ ] Create `src/stories/<name>/<name>.stories.jsx` with meta (title, component, parameters, argTypes, args), Default story, and at least one named story (e.g. Variants).
|
|
224
|
-
- [ ] Create `src/stories/<name>/<name>.docs.mdx` with Meta, intro, Features, Usage, Examples, Behavior, Props (ArgsTable), Related components.
|
|
225
|
-
- [ ] Use spacing **suffix** in examples and in Controls (e.g. `"0"`, `"b-2"`), not full tokens like `"m-0"`.
|
|
226
|
-
- [ ] Add `onClick` / `onClose` etc. as `action` in argTypes so they appear in the Actions panel.
|
|
227
|
-
- [ ] Ensure the Documentation tab title matches the Playground (e.g. both `atoms/Alert/...`).
|
|
228
|
-
|
|
229
|
-
---
|
|
230
|
-
|
|
231
|
-
## 6. Reference components
|
|
232
|
-
|
|
233
|
-
For full examples, see:
|
|
234
|
-
|
|
235
|
-
- **Stories:** `src/stories/alert/alert.stories.jsx`, `src/stories/avatar/avatar.stories.jsx`, `src/stories/spinner/spinner.stories.jsx`
|
|
236
|
-
- **Docs:** `src/stories/alert/alert.docs.mdx`, `src/stories/avatar/avatar.docs.mdx`
|
package/tsconfig.json
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
5
|
-
"jsx": "react-jsx",
|
|
6
|
-
"module": "ESNext",
|
|
7
|
-
"moduleResolution": "node",
|
|
8
|
-
"resolveJsonModule": true,
|
|
9
|
-
"allowJs": true,
|
|
10
|
-
"checkJs": false,
|
|
11
|
-
"outDir": "./dist",
|
|
12
|
-
"declaration": true,
|
|
13
|
-
"declarationMap": true,
|
|
14
|
-
"emitDeclarationOnly": true,
|
|
15
|
-
"sourceMap": true,
|
|
16
|
-
"strict": false,
|
|
17
|
-
"noImplicitAny": false,
|
|
18
|
-
"esModuleInterop": true,
|
|
19
|
-
"skipLibCheck": true,
|
|
20
|
-
"forceConsistentCasingInFileNames": true,
|
|
21
|
-
"isolatedModules": true,
|
|
22
|
-
"allowSyntheticDefaultImports": true
|
|
23
|
-
},
|
|
24
|
-
"include": ["src/**/*"],
|
|
25
|
-
"exclude": ["node_modules", "dist", "storybook-static", "**/*.stories.*", "**/*.test.*", "**/*.spec.*"]
|
|
26
|
-
}
|