@pushwoosh/kit-icons 2.1.7 → 2.1.8
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/ai-documentation.mdx +241 -0
- package/package.json +2 -2
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
# @pushwoosh/kit-icons - AI Agent Documentation
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This is a React-based icon library that is part of the Pushwoosh Design System. The library contains 131 auto-generated SVG icons that can be used across Pushwoosh products.
|
|
6
|
+
|
|
7
|
+
## Package Information
|
|
8
|
+
|
|
9
|
+
- **Name**: `@pushwoosh/kit-icons`
|
|
10
|
+
- **Version**: 2.0.0
|
|
11
|
+
- **Type**: React component library
|
|
12
|
+
- **Peer Dependencies**:
|
|
13
|
+
- React >= 16.14.0
|
|
14
|
+
- styled-components >= 5.3.3
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @pushwoosh/kit-icons
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
### Basic Import
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import { ArrowIcon, CheckIcon, CloseIcon } from '@pushwoosh/kit-icons';
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Component Usage
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
// Example with ArrowIcon
|
|
34
|
+
<ArrowIcon
|
|
35
|
+
direction="down"
|
|
36
|
+
size="medium"
|
|
37
|
+
/>
|
|
38
|
+
|
|
39
|
+
// Example with custom props
|
|
40
|
+
<CheckIcon
|
|
41
|
+
size="small"
|
|
42
|
+
style={{ color: '#4CAF50' }}
|
|
43
|
+
onClick={handleClick}
|
|
44
|
+
/>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Icon Properties
|
|
48
|
+
|
|
49
|
+
All icons share these common properties:
|
|
50
|
+
|
|
51
|
+
### Base Props (CommonProps)
|
|
52
|
+
- `boxRef?: Ref<HTMLDivElement>` - Reference to the wrapper div element
|
|
53
|
+
- `as?: string` - Polymorphic component prop for changing the wrapper element
|
|
54
|
+
- All standard HTML div attributes are supported (className, style, onClick, etc.)
|
|
55
|
+
|
|
56
|
+
### Icon-Specific Props
|
|
57
|
+
Each icon has specific required props:
|
|
58
|
+
- `size`: Usually `"small"` | `"medium"`
|
|
59
|
+
- Additional props vary by icon (e.g., `direction`, `type`, `view`, etc.)
|
|
60
|
+
|
|
61
|
+
## Available Icons (131 total)
|
|
62
|
+
|
|
63
|
+
### Navigation & Arrows
|
|
64
|
+
- `ArrowIcon` - Directional arrows (up, down, left, right, diagonal)
|
|
65
|
+
- `ArrowRoundIcon` - Rounded arrow variations
|
|
66
|
+
- `ChevronIcon` - Chevron arrows for navigation
|
|
67
|
+
- `NavigationIcon` - Navigation-specific icons
|
|
68
|
+
|
|
69
|
+
### UI Controls
|
|
70
|
+
- `CheckIcon` - Checkmark icon
|
|
71
|
+
- `CheckRoundIcon` - Rounded checkmark
|
|
72
|
+
- `CloseIcon` - Close/X icon
|
|
73
|
+
- `CloseRoundIcon` - Rounded close icon
|
|
74
|
+
- `MenuIcon` - Menu/hamburger icon
|
|
75
|
+
- `MoreIcon` - More options (dots)
|
|
76
|
+
|
|
77
|
+
### Communication
|
|
78
|
+
- `CallIcon` - Phone/call icon
|
|
79
|
+
- `ChatIcon` - Chat bubble icon
|
|
80
|
+
- `EmailIcon` - Email envelope icon
|
|
81
|
+
- `NotificationIcon` - Notification bell icon
|
|
82
|
+
|
|
83
|
+
### Data & Documents
|
|
84
|
+
- `AttachmentIcon` - File attachment icon
|
|
85
|
+
- `DocumentIcon` - Document icon
|
|
86
|
+
- `FolderIcon` - Folder icon
|
|
87
|
+
- `FileIcon` - Generic file icon
|
|
88
|
+
- `DownloadIcon` - Download arrow icon
|
|
89
|
+
- `UploadIcon` - Upload arrow icon
|
|
90
|
+
|
|
91
|
+
### Platform & Device
|
|
92
|
+
- `DeviceIcon` - Device-specific icons
|
|
93
|
+
- `BrowserIcon` - Web browser icon
|
|
94
|
+
- `MobileIcon` - Mobile device icon
|
|
95
|
+
- `DesktopIcon` - Desktop computer icon
|
|
96
|
+
|
|
97
|
+
### Media & Content
|
|
98
|
+
- `ImageIcon` - Image/photo icon
|
|
99
|
+
- `VideoIcon` - Video/play icon
|
|
100
|
+
- `MusicIcon` - Music/audio icon
|
|
101
|
+
- `PlayIcon` - Play button icon
|
|
102
|
+
- `PauseIcon` - Pause button icon
|
|
103
|
+
|
|
104
|
+
### Status & Indicators
|
|
105
|
+
- `InfoIcon` - Information icon
|
|
106
|
+
- `WarningIcon` - Warning triangle icon
|
|
107
|
+
- `ErrorIcon` - Error/danger icon
|
|
108
|
+
- `SuccessIcon` - Success checkmark icon
|
|
109
|
+
- `LoadingIcon` - Loading spinner icon
|
|
110
|
+
|
|
111
|
+
### Actions
|
|
112
|
+
- `EditIcon` - Edit/pencil icon
|
|
113
|
+
- `DeleteIcon` - Delete/trash icon
|
|
114
|
+
- `CopyIcon` - Copy/duplicate icon
|
|
115
|
+
- `ShareIcon` - Share icon
|
|
116
|
+
- `SaveIcon` - Save/floppy disk icon
|
|
117
|
+
- `SearchIcon` - Search/magnifying glass icon
|
|
118
|
+
- `FilterIcon` - Filter/funnel icon
|
|
119
|
+
- `SettingsIcon` - Settings/gear icon
|
|
120
|
+
|
|
121
|
+
### E-commerce & Finance
|
|
122
|
+
- `CartIcon` - Shopping cart icon
|
|
123
|
+
- `BillingIcon` - Billing/invoice icon
|
|
124
|
+
- `CreditCardIcon` - Credit card icon
|
|
125
|
+
- `WalletIcon` - Wallet icon
|
|
126
|
+
|
|
127
|
+
### Social & User
|
|
128
|
+
- `UserIcon` - User/person icon
|
|
129
|
+
- `GroupIcon` - Group/team icon
|
|
130
|
+
- `HeartIcon` - Heart/favorite icon
|
|
131
|
+
- `StarIcon` - Star/rating icon
|
|
132
|
+
- `BookmarkIcon` - Bookmark icon
|
|
133
|
+
|
|
134
|
+
### Other Categories
|
|
135
|
+
- `CalendarIcon` - Calendar icon
|
|
136
|
+
- `ClockIcon` - Clock/time icon
|
|
137
|
+
- `LocationIcon` - Location/map pin icon
|
|
138
|
+
- `LockIcon` - Lock/security icon
|
|
139
|
+
- `KeyIcon` - Key/authentication icon
|
|
140
|
+
- `CloudIcon` - Cloud storage icon
|
|
141
|
+
- `DatabaseIcon` - Database icon
|
|
142
|
+
- `CodeIcon` - Code/development icon
|
|
143
|
+
- `BugIcon` - Bug/issue icon
|
|
144
|
+
- `QuestionIcon` - Question mark icon
|
|
145
|
+
- `ExclamationIcon` - Exclamation mark icon
|
|
146
|
+
- `PlusIcon` - Plus/add icon
|
|
147
|
+
- `MinusIcon` - Minus/remove icon
|
|
148
|
+
|
|
149
|
+
## Architecture Notes
|
|
150
|
+
|
|
151
|
+
### Icon Generation Process
|
|
152
|
+
1. Source SVG files are stored in `source-icons/` directory
|
|
153
|
+
2. Filename format: `name=icon-name, size=medium, [other-props].svg`
|
|
154
|
+
3. Run `npm run generate-icons` to process SVGs
|
|
155
|
+
4. Icons are optimized with SVGO and converted to React components
|
|
156
|
+
5. Components are generated in `src/icons/[icon-name]/`
|
|
157
|
+
|
|
158
|
+
### Component Structure
|
|
159
|
+
Each icon is created using the `createIconComponent` factory function which:
|
|
160
|
+
- Dynamically loads the correct SVG based on props
|
|
161
|
+
- Wraps the SVG in a styled `IconBox` component
|
|
162
|
+
- Provides TypeScript type safety
|
|
163
|
+
- Handles prop-based variations (size, direction, etc.)
|
|
164
|
+
|
|
165
|
+
### File Organization
|
|
166
|
+
```
|
|
167
|
+
src/icons/[icon-name]/
|
|
168
|
+
├── index.tsx # Main export
|
|
169
|
+
├── [icon-name].component.tsx # Component definition
|
|
170
|
+
├── [icon-name].types.tsx # TypeScript types
|
|
171
|
+
└── assets/ # SVG components for each variation
|
|
172
|
+
├── name_[icon]_size_small_[...].tsx
|
|
173
|
+
└── name_[icon]_size_medium_[...].tsx
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Development Commands
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# Generate new icons from source SVGs
|
|
180
|
+
npm run generate-icons
|
|
181
|
+
|
|
182
|
+
# Build the library
|
|
183
|
+
npm run build
|
|
184
|
+
|
|
185
|
+
# Run development playground
|
|
186
|
+
npm start
|
|
187
|
+
|
|
188
|
+
# Run linting and type checks
|
|
189
|
+
npm run check
|
|
190
|
+
|
|
191
|
+
# Fix linting issues
|
|
192
|
+
npm run lint-fix
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Important Considerations
|
|
196
|
+
|
|
197
|
+
1. **Icon Sizing**: Icons are designed in two sizes (small, medium) that correspond to specific pixel dimensions defined in the design system
|
|
198
|
+
2. **Color Inheritance**: Icons use `currentColor` for fill, inheriting color from parent elements
|
|
199
|
+
3. **Styled Components**: The library uses styled-components for styling, ensure it's available in your project
|
|
200
|
+
4. **TypeScript**: Full TypeScript support with strict typing for all icon props
|
|
201
|
+
5. **Tree Shaking**: Icons are exported individually for optimal bundle size
|
|
202
|
+
|
|
203
|
+
## Common Issues & Solutions
|
|
204
|
+
|
|
205
|
+
### Icon Not Found Error
|
|
206
|
+
If you see `[IconName]: Icon not found!` in console:
|
|
207
|
+
- Check that you're passing valid prop combinations
|
|
208
|
+
- Verify the icon variant exists for your prop values
|
|
209
|
+
- Some icons may not have all size/direction combinations
|
|
210
|
+
|
|
211
|
+
### Styling Icons
|
|
212
|
+
```tsx
|
|
213
|
+
// Use style prop for inline styles
|
|
214
|
+
<ArrowIcon style={{ color: 'red', width: '24px' }} />
|
|
215
|
+
|
|
216
|
+
// Use className for CSS classes
|
|
217
|
+
<CheckIcon className="custom-icon" />
|
|
218
|
+
|
|
219
|
+
// Use styled-components
|
|
220
|
+
const StyledIcon = styled(CloseIcon)`
|
|
221
|
+
color: ${props => props.theme.colors.primary};
|
|
222
|
+
`;
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### TypeScript Usage
|
|
226
|
+
```tsx
|
|
227
|
+
import { ArrowIconProps } from '@pushwoosh/kit-icons';
|
|
228
|
+
|
|
229
|
+
const MyComponent: FC<{ iconProps: ArrowIconProps }> = ({ iconProps }) => (
|
|
230
|
+
<ArrowIcon {...iconProps} />
|
|
231
|
+
);
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Notes for AI Agents
|
|
235
|
+
|
|
236
|
+
- This is a read-only generated library - do not modify files in `src/icons/*/assets/`
|
|
237
|
+
- To add new icons, place SVGs in `source-icons/` and run generation script
|
|
238
|
+
- The library follows Pushwoosh Design System specifications from Figma
|
|
239
|
+
- All icons are optimized for performance and accessibility
|
|
240
|
+
- Components are memoized internally for performance
|
|
241
|
+
- The library supports server-side rendering (SSR)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pushwoosh/kit-icons",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.8",
|
|
4
4
|
"description": "React component for build Pushwoosh products",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"scripts": {
|
|
10
10
|
"start": "npm run playground",
|
|
11
|
-
"build": "pushwoosh-engine lib:build && node ./scripts/bundleSVG.js",
|
|
11
|
+
"build": "pushwoosh-engine lib:build && node ./scripts/bundleSVG.js && cp ./ai-documentation.mdx ./dist/ai-documentation.mdx",
|
|
12
12
|
"playground": "`pushwoosh-engine lib:command:playground`",
|
|
13
13
|
"check": "npm run check:lint && npm run check:types",
|
|
14
14
|
"check:lint": "echo \"Run check:lint\" && eslint ./src",
|