@commercetools/nimbus-icons 2.0.1 → 2.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/CHANGELOG.md +26 -0
- package/CLAUDE.md +250 -0
- package/README.mdx +2 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @commercetools/nimbus-icons
|
|
2
2
|
|
|
3
|
+
## 2.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#733](https://github.com/commercetools/nimbus/pull/733)
|
|
8
|
+
[`04a8510`](https://github.com/commercetools/nimbus/commit/04a8510051585cfa67dcf64e141bccce6749d625)
|
|
9
|
+
Thanks [@valoriecarli](https://github.com/valoriecarli)! - Update minor/patch
|
|
10
|
+
versions of util dependencies
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#612](https://github.com/commercetools/nimbus/pull/612)
|
|
15
|
+
[`f92fb51`](https://github.com/commercetools/nimbus/commit/f92fb515479f0565429f8bbfc0749f2aea5fbc12)
|
|
16
|
+
Thanks [@misama-ct](https://github.com/misama-ct)! - Update
|
|
17
|
+
DateRangePickerField types
|
|
18
|
+
|
|
19
|
+
## 2.1.0
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [#643](https://github.com/commercetools/nimbus/pull/643)
|
|
24
|
+
[`42124ce`](https://github.com/commercetools/nimbus/commit/42124cedaa62526de6a0eac3744486f00f416e66)
|
|
25
|
+
Thanks [@tylermorrisford](https://github.com/tylermorrisford)! - Changes the
|
|
26
|
+
designated changeset github action and includes the PR title in the release
|
|
27
|
+
workflow.
|
|
28
|
+
|
|
3
29
|
## 2.0.1
|
|
4
30
|
|
|
5
31
|
## 2.0.0
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# Nimbus Icons
|
|
2
|
+
|
|
3
|
+
## Package Overview
|
|
4
|
+
|
|
5
|
+
The `@commercetools/nimbus-icons` package provides SVG icons as React components:
|
|
6
|
+
- Material Design Icons (outlined variant) - Auto-generated from @material-design-icons/svg
|
|
7
|
+
- Custom commercetools icons - Hand-crafted for brand-specific needs
|
|
8
|
+
- Generated using SVGR from SVG files to React components
|
|
9
|
+
- Outputs both ESM and CJS formats for compatibility
|
|
10
|
+
|
|
11
|
+
## Build Process
|
|
12
|
+
|
|
13
|
+
### Build Commands
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Build from root
|
|
17
|
+
pnpm --filter @commercetools/nimbus-icons build
|
|
18
|
+
|
|
19
|
+
# Or step-by-step
|
|
20
|
+
pnpm --filter @commercetools/nimbus-icons build:icons # Generate React components from SVGs
|
|
21
|
+
pnpm --filter @commercetools/nimbus-icons build:esm # Build ESM bundle
|
|
22
|
+
pnpm --filter @commercetools/nimbus-icons build:cjs # Build CJS bundle
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Build Pipeline
|
|
26
|
+
|
|
27
|
+
1. **Material Icons** → Downloaded from `@material-design-icons/svg` package
|
|
28
|
+
2. **SVGR Transform** → Converts SVG files to React components with TypeScript
|
|
29
|
+
3. **Compilation** → Builds both ESM and CJS bundles for distribution
|
|
30
|
+
|
|
31
|
+
## Icon Structure
|
|
32
|
+
|
|
33
|
+
### Generated Files
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
packages/nimbus-icons/
|
|
37
|
+
├── src/
|
|
38
|
+
│ ├── material-icons/ # Auto-generated Material Design icons
|
|
39
|
+
│ │ ├── account-circle.tsx
|
|
40
|
+
│ │ ├── arrow-forward.tsx
|
|
41
|
+
│ │ └── ...
|
|
42
|
+
│ ├── custom-icons/ # Hand-crafted custom icons
|
|
43
|
+
│ │ └── custom-logo.tsx
|
|
44
|
+
│ └── index.ts # Barrel export
|
|
45
|
+
├── dist/
|
|
46
|
+
│ ├── esm/ # ESM build output
|
|
47
|
+
│ └── cjs/ # CJS build output
|
|
48
|
+
└── package.json
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Naming Convention
|
|
52
|
+
|
|
53
|
+
Icons use kebab-case filenames matching Material Design naming:
|
|
54
|
+
- `account-circle.tsx` → `AccountCircle` component
|
|
55
|
+
- `arrow-forward.tsx` → `ArrowForward` component
|
|
56
|
+
- `delete-outlined.tsx` → `DeleteOutlined` component
|
|
57
|
+
|
|
58
|
+
Component names are PascalCase exports.
|
|
59
|
+
|
|
60
|
+
## Adding New Icons
|
|
61
|
+
|
|
62
|
+
### Adding Material Design Icons
|
|
63
|
+
|
|
64
|
+
Material Design icons are automatically available from the `@material-design-icons/svg` package.
|
|
65
|
+
|
|
66
|
+
1. **Find the icon** at https://fonts.google.com/icons
|
|
67
|
+
- Use "outlined" variant (default for Nimbus)
|
|
68
|
+
- Note the exact icon name (e.g., "account_circle")
|
|
69
|
+
|
|
70
|
+
2. **Verify availability**
|
|
71
|
+
```bash
|
|
72
|
+
# Check if icon exists in node_modules
|
|
73
|
+
ls node_modules/@material-design-icons/svg/outlined/ | grep account_circle
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
3. **Generate the component**
|
|
77
|
+
```bash
|
|
78
|
+
pnpm --filter @commercetools/nimbus-icons build:icons
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
4. **Icon is auto-generated** in `src/material-icons/`
|
|
82
|
+
|
|
83
|
+
5. **Export** from `src/index.ts` (may be automatic)
|
|
84
|
+
```typescript
|
|
85
|
+
export { AccountCircle } from './material-icons/account-circle'
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
6. **Build the package**
|
|
89
|
+
```bash
|
|
90
|
+
pnpm --filter @commercetools/nimbus-icons build
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Adding Custom Icons
|
|
94
|
+
|
|
95
|
+
For brand-specific or custom icons:
|
|
96
|
+
|
|
97
|
+
1. **Create SVG file** or create React component directly in `src/custom-icons/`
|
|
98
|
+
|
|
99
|
+
2. **If using SVG**, convert manually or use SVGR:
|
|
100
|
+
```bash
|
|
101
|
+
npx @svgr/cli --icon --typescript custom-icon.svg
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
3. **Or create React component manually**:
|
|
105
|
+
```typescript
|
|
106
|
+
// src/custom-icons/custom-logo.tsx
|
|
107
|
+
import type { SVGProps } from 'react'
|
|
108
|
+
|
|
109
|
+
export function CustomLogo(props: SVGProps<SVGSVGElement>) {
|
|
110
|
+
return (
|
|
111
|
+
<svg
|
|
112
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
113
|
+
viewBox="0 0 24 24"
|
|
114
|
+
fill="currentColor"
|
|
115
|
+
{...props}
|
|
116
|
+
>
|
|
117
|
+
<path d="M12 2L2 7v10c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V7l-10-5z" />
|
|
118
|
+
</svg>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
4. **Export** from `src/index.ts`:
|
|
124
|
+
```typescript
|
|
125
|
+
export { CustomLogo } from './custom-icons/custom-logo'
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
5. **Build the package**:
|
|
129
|
+
```bash
|
|
130
|
+
pnpm --filter @commercetools/nimbus-icons build
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Custom Icon Guidelines
|
|
134
|
+
|
|
135
|
+
- Use `viewBox="0 0 24 24"` for consistency (24x24 grid)
|
|
136
|
+
- Use `fill="currentColor"` to inherit text color
|
|
137
|
+
- Accept `SVGProps<SVGSVGElement>` for flexibility
|
|
138
|
+
- Spread `{...props}` to allow customization
|
|
139
|
+
- Follow PascalCase naming for components
|
|
140
|
+
- Include proper TypeScript types
|
|
141
|
+
|
|
142
|
+
## Icon Usage
|
|
143
|
+
|
|
144
|
+
### In Components
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
// Import specific icons
|
|
148
|
+
import { AccountCircle, ArrowForward, Delete } from '@commercetools/nimbus-icons'
|
|
149
|
+
|
|
150
|
+
function MyComponent() {
|
|
151
|
+
return (
|
|
152
|
+
<div>
|
|
153
|
+
<AccountCircle width={24} height={24} />
|
|
154
|
+
<ArrowForward width={16} height={16} color="blue" />
|
|
155
|
+
<Delete width={20} height={20} className="icon-delete" />
|
|
156
|
+
</div>
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Styling
|
|
162
|
+
|
|
163
|
+
Icons inherit color from CSS `color` property:
|
|
164
|
+
|
|
165
|
+
```tsx
|
|
166
|
+
// Icons use fill="currentColor"
|
|
167
|
+
<div style={{ color: 'red' }}>
|
|
168
|
+
<Delete width={24} height={24} />
|
|
169
|
+
</div>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Or apply directly:
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
<Delete width={24} height={24} fill="red" />
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Sizing
|
|
179
|
+
|
|
180
|
+
Always specify width and height:
|
|
181
|
+
|
|
182
|
+
```tsx
|
|
183
|
+
// Recommended sizes
|
|
184
|
+
<Icon width={16} height={16} /> // Small
|
|
185
|
+
<Icon width={20} height={20} /> // Medium
|
|
186
|
+
<Icon width={24} height={24} /> // Large
|
|
187
|
+
<Icon width={32} height={32} /> // Extra large
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### In Nimbus Components
|
|
191
|
+
|
|
192
|
+
Icons are used throughout Nimbus components:
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
// In a Button component
|
|
196
|
+
import { ArrowForward } from '@commercetools/nimbus-icons'
|
|
197
|
+
|
|
198
|
+
<Button>
|
|
199
|
+
Next <ArrowForward width={16} height={16} />
|
|
200
|
+
</Button>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Dependencies
|
|
204
|
+
|
|
205
|
+
This package:
|
|
206
|
+
- Has minimal dependencies (@material-design-icons/svg for source icons)
|
|
207
|
+
- Does not depend on tokens or nimbus packages
|
|
208
|
+
- Can build independently
|
|
209
|
+
- Is consumed as a dependency by nimbus
|
|
210
|
+
|
|
211
|
+
## Common Tasks
|
|
212
|
+
|
|
213
|
+
### Find Available Icons
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
# List all Material icons
|
|
217
|
+
ls packages/nimbus-icons/src/material-icons/
|
|
218
|
+
|
|
219
|
+
# Search for specific icon
|
|
220
|
+
ls packages/nimbus-icons/src/material-icons/ | grep arrow
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Update Material Icons Version
|
|
224
|
+
|
|
225
|
+
1. Update `@material-design-icons/svg` in package.json
|
|
226
|
+
2. Run `pnpm install`
|
|
227
|
+
3. Rebuild icons: `pnpm --filter @commercetools/nimbus-icons build:icons`
|
|
228
|
+
4. Rebuild package: `pnpm --filter @commercetools/nimbus-icons build`
|
|
229
|
+
|
|
230
|
+
### Replace Custom Icon
|
|
231
|
+
|
|
232
|
+
1. Update SVG in `src/custom-icons/[icon-name].tsx`
|
|
233
|
+
2. Rebuild package: `pnpm --filter @commercetools/nimbus-icons build`
|
|
234
|
+
3. Rebuild consuming packages if needed
|
|
235
|
+
|
|
236
|
+
## Troubleshooting
|
|
237
|
+
|
|
238
|
+
### Icon Not Found
|
|
239
|
+
|
|
240
|
+
1. Verify icon name matches Material Design naming
|
|
241
|
+
2. Check it exists: `ls node_modules/@material-design-icons/svg/outlined/`
|
|
242
|
+
3. Regenerate: `pnpm --filter @commercetools/nimbus-icons build:icons`
|
|
243
|
+
4. Check export in `src/index.ts`
|
|
244
|
+
|
|
245
|
+
### Icon Rendering Issues
|
|
246
|
+
|
|
247
|
+
- Ensure width/height are specified
|
|
248
|
+
- Check viewBox is "0 0 24 24"
|
|
249
|
+
- Verify `fill="currentColor"` is used
|
|
250
|
+
- Test with explicit color: `fill="black"`
|
package/README.mdx
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools/nimbus-icons",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@svgr/plugin-jsx": "^8.1.0",
|
|
34
|
-
"@types/node": "^24.
|
|
35
|
-
"@types/react": "^19.
|
|
34
|
+
"@types/node": "^24.10.1",
|
|
35
|
+
"@types/react": "^19.2.8",
|
|
36
36
|
"react": "^19.0.0",
|
|
37
37
|
"typescript": "~5.9.3"
|
|
38
38
|
},
|